⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 visadoutputsynapse.java

📁 拥有图形界面的
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    /** Called by the previous layer to place a pattern on this VisADOutputSynapse, supports single/mono serie plot.  The data plotted is defined by the     * serie property.     * @param pattern The pattern with the data to plot.     */    public void fwdPut(Pattern pattern) {        if (isEnabled() && (pattern.getCount() > -1))  {            SharedBuffer sb = (SharedBuffer)ChartBuffers.get(def_handle);            if ( sb == null ) {                try {                    sb = new SharedBuffer();                    sb.setHandle(def_handle);                    ChartBuffers.put(def_handle,sb);                    time_set = new Integer1DSet(time,(int)timeMap.getRange()[1]);                    flat_fields.put(def_handle,new FlatField( func_time_height, time_set));                    ConstantMap[] lineCMap =                    {   new ConstantMap( (float)def_handle.getRedColor()/255, Display.Red),                        new ConstantMap( (float)def_handle.getGreenColor()/255, Display.Green),                        new ConstantMap( (float)def_handle.getBlueColor()/255, Display.Blue),                        new ConstantMap( 1.00f, Display.LineWidth)                    };                    DataColors.put(def_handle,lineCMap);                    DataRefs.put(def_handle,new DataReferenceImpl(def_handle.getName()));                }                catch(VisADException ex) {                    log.error(ex.toString());                    if ( getMonitor() != null )                        new NetErrorManager(getMonitor(),"VisADException while attempting to define VisAd compononent in fwdPut(pattern) method. Message is : " + ex.getMessage());                }                catch(Exception ex) {                    log.error(ex.toString());                    if ( getMonitor() != null )                        new NetErrorManager(getMonitor(),"Exception while attempting to define VisAd component in fwdPut(pattern) method. Message is : " + ex.getMessage());                }                catch(java.lang.OutOfMemoryError err) {                    log.error(err.toString());                    if ( getMonitor() != null )                        new NetErrorManager(getMonitor(),"Out of memory error while attempting to define VisAd component in fwdPut(pattern) method. Message is : " + err.getMessage());                }            }            sb.put(pattern.getArray()[getSerie()-1],pattern.getCount());        }    }        /** Returns the error pattern coming from the next layer during the training phase     * @return neural.engine.Pattern     */    public Pattern revGet() {        // Not used        return null;    }        /** Sets the dimension of the output synapse     * @param newOutputDimension int     */    public void setInputDimension(int newInputDimension) {    }        /** Returns the monitor     * @return org.joone.engine.Monitor     */    public Monitor getMonitor() {        return monitor;    }        /** Returns the dimension of this VisADOutputSynapse which is always 0.     * @return int Always 0.     */    public int getInputDimension() {        return 0;    }        /** Getter for property show.  Is the frame/component/chart on display?     * @return Value of property show.     */    public boolean isShow() {        return show;    }        /** Setter for property show.     * @param show true to display the chart component, false to hide it.     */    public void setShow(boolean show) {        this.show = show;        if (show)            iFrame.setVisible(true);        else            iFrame.setVisible(false);    }        /** Getter for property maxYaxis.     * @return Value of property maxYaxis.     */    public double getMaxYaxis() {        return maxYaxis;    }        /** Setter for property maxYaxis.     * @param maxYaxis New value of property maxYaxis.     */    public void setMaxYaxis(double maxYaxis) {        this.maxYaxis = maxYaxis;    }        /** Getter for property maxXaxis.     * @return Value of property maxXaxis.     */    public int getMaxXaxis() {        return maxXaxis;    }        /** Setter for property maxXaxis.     * @param maxXaxis New value of property maxXaxis.     */    public void setMaxXaxis(int maxXaxis) {        this.maxXaxis = maxXaxis;    }        /**     * Loads this serialised object from the object stream.     * @param in The serialised object stream.     */    private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {        in.defaultReadObject();        initComponents();        // Setup a default handle for mono plots.        def_handle.setSerie(getSerie());        def_handle.setBlueColor(230);        def_handle.setGreenColor(0);        def_handle.setRedColor(0);        def_handle.setName("Serie "+getSerie());        setShow(false);    }        private void writeObject(ObjectOutputStream out) throws IOException {        if (timeMap != null)   maxXaxis = (int)timeMap.getRange()[1];        if (heightMap != null) maxYaxis = heightMap.getRange()[1];        out.defaultWriteObject();    }            /** Getter for property serie.  Used for mono plots only.     * @return Value of property serie.     */    public int getSerie() {        if (serie < 1)  // Only for previously saved components            serie = 1;        return serie;    }        /** Setter for property serie. Used for mono plots only.     * @param serie New value of property serie.     */    public void setSerie(int newSerie) {                if (newSerie < 1)            this.serie = 1;        else            this.serie = newSerie;    }        /** Getter for property name.     * @return Value of property name.     */    public java.lang.String getName() {        return name;    }        /** Setter for property name.     * @param name New value of property name.     */    public void setName(java.lang.String name) {        this.name = name;    }        /** Getter for property title.  Gets the title of the components frame.     * @return Value of property title.     */    public java.lang.String getTitle() {        return title;    }        /** Setter for property title.  Sets the title of the components frame.     * @param title New value of property title.     */    public void setTitle(java.lang.String title) {        this.title = title;        if (iFrame != null) {            iFrame.setTitle(title);        }    }        /** Getter for property resizable.  Can user re-size the components frame or not.     * @return Value of property resizable.     */    public boolean isResizable() {        return resizable;    }        /** Setter for property resizable.  Can user re-size the components frame or not.     * @param resizable New value of property resizable.     */    public void setResizable(boolean resizable) {        this.resizable = resizable;        if (iFrame != null) {            iFrame.setResizable(resizable);        }    }        /**     *     * Base for check messages.     * Subclasses should call this method from their own check method.     * @see OutputPaternListener     * @return validation errors.     */    public TreeSet check() {        // Prepare an empty set for check messages;        TreeSet checks = new TreeSet();        // Return check messages        return checks;    }        /**     * Processes the cicleTerminated. Currently no processing.     */    public void cicleTerminated(NeuralNetEvent e) {    }        /**     * Processes the errorChanged event.  Currently no processing.     */    public void errorChanged(NeuralNetEvent e) {    }        /**     * Processes the netStarted event.  Initialises VisAd components.     */    public void netStarted(NeuralNetEvent e) {        // Re-make the memory to hold the recorded values.        ChartBuffers.clear();        DataRefs.clear();        DataColors.clear();        flat_fields.clear();        if ( visadinit == false) {            initVisAd(getMaxXaxis() , "Collecting data ....");            visadinit = true;        }        else {            try  {                display.removeAllReferences();            }            catch (VisADException ve) {                    log.error(ve.toString());                    if ( getMonitor() != null )                        new NetErrorManager(getMonitor(),"VisADException while attempting to remove Display references in netStarted event. Message is : " + ve.getMessage());            }            catch (RemoteException re) {                    log.error(re.toString());                    if ( getMonitor() != null )                        new NetErrorManager(getMonitor(),"RemoteException while attempting to remove Display references in netStarted event. Message is : " + re.getMessage());            }        }        status_label.setText("Collecting data ....");    }        /**     * Processes the netStopped event. Plots the VisAd chart in a frame.     */    public void netStopped(NeuralNetEvent e) {                try{            status_label.setText("Data collected and displayed.");            PlotVisAd();        }        catch(Exception ex){            log.error(ex.toString());        }    }        /**     * Processes the netStoppedError event. Currently no processing.     */    public void netStoppedError(NeuralNetEvent e, String error) {    }        /**     * Remove a chart handle. Currently no processing.     */    public void removeHandle(ChartingHandle handle) {    }        /** Getter for property enabled.  Is the component enabled or not.     * @return Value of property enabled.     *     */    public boolean isEnabled() {        return enabled;    }        /** Setter for property enabled.     * @param enabled New value of property enabled.     *     */    public void setEnabled(boolean enabled) {        this.enabled = enabled;    }        public boolean isOutputFull() {        return(outputFull);    }        public void setOutputFull(boolean newoutputFull) {        outputFull = newoutputFull;    }        public void init() {        // Do nothing    }        }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -