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

📄 abstractconverterplugin.java

📁 一个纯java写的神经网络源代码
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    protected Vector getPluginListeners() {        if (pluginListeners == null) {            pluginListeners = new Vector();        }        return pluginListeners;    }        public void dataChanged(PlugInEvent anEvent) {        fireDataChanged();    }        /**     * Fires a data changed event to all {@link PlugInListeners} that are registered     * to receive events from this plug-in object. This method calls the     * {@link InputPlugInListener#dataChanged()} method in all registered listeners.     */    protected void fireDataChanged() {        Object[] myList;        synchronized (this) {            myList = getPluginListeners().toArray();        }                for (int i=0; i < myList.length; ++i) {            PlugInListener myListener = (PlugInListener)myList[i];            if (myListener != null) {                myListener.dataChanged(new PlugInEvent(this));            }        }    }        /**     * Gets the AdvancedSerieSelector.     *     * @return Value of property AdvancedSerieSelector.     */    public String getAdvancedSerieSelector() {        return AdvancedSerieSelector;    }        /**     * Sets the AdvancedSerieSelector for this plugin.     * <P>The AdvancedSerieSelector instructs this plug-in what serie/columns it     * should process. The format of this specification is a common seperated list of     * values and ranges. E.g '1,2,5,7' will instruct the converter to convert serie 1     * and 2 and 5 and 7. A range can also be used e.g '2,4,5-8,9' will instruct the     * converter to process serie 2 and 4 and 5 and 6 and 7 and 8 and 9. A range is specifed     * using a '-' character with the number of the serie on either side.     * <P>Note <b>NO</b> negative numbers can be used in the <code>AdvancedSerieSelector</code>.</P>     *     * @param aNewSerieSelector New value for the <code>AdvancedSerieSelector</code>.     */    public void setAdvancedSerieSelector(String aNewSerieSelector) {        if((AdvancedSerieSelector == null) || (AdvancedSerieSelector.compareTo(aNewSerieSelector) != 0)) {            AdvancedSerieSelector = aNewSerieSelector;            serieSelected = null;            fireDataChanged();        }    }        /**     * Getter for property <code>serieSelected</code>. Returns the list of     * selected columns to elaborate.     *     * @return Value of property <code>serieSelected</code>.     */    protected int[] getSerieSelected() {        if(serieSelected == null) {            // if the advanced serie selected string is not parsed yet, then parse            // it now to obtain the serie selected            CSVParser myParser = new CSVParser(getAdvancedSerieSelector(), true);            serieSelected = myParser.parseInt();        }        return serieSelected;    }        /**     * Adds a plug-in at the end of the list of plug-ins.     *     * @param aNewPlugIn the new plug in to add at the end of plug ins.     * @return <code>true</code> when the plug in is added succesfully,     * <code>false</code> when the plug in is not added, e.g. in case the     * plug in is already added / connected to another synapse / plug-in.     */    public boolean addPlugIn(AbstractConverterPlugIn aNewPlugIn) {        if(nextPlugIn == aNewPlugIn) {            return false;        }                // The null parameter is used to detach or delete a plugin        if(aNewPlugIn == null) {            // We need to declare the next plugin, if existing,            // as not more used, so it could be used again.            if (nextPlugIn != null) {                nextPlugIn.setConnected(false);            }            nextPlugIn = null;            fireDataChanged();            return true;        }                if(aNewPlugIn.isConnected()) {            // The new plugin is already connected to another plugin,            // hence cannot be used.            return false;        }                if(nextPlugIn == null) {            aNewPlugIn.setConnected(true);            aNewPlugIn.addPlugInListener(this);            nextPlugIn = aNewPlugIn;            fireDataChanged();            return true;        } else {            return nextPlugIn.addPlugIn(aNewPlugIn);        }    }        /**     * Removes (and disconnects) all (cascading) plug ins.     */    public void removeAllPlugIns() {        if(nextPlugIn != null) {            nextPlugIn.setConnected(false);            nextPlugIn.removeAllPlugIns();            nextPlugIn = null;        } else {            // this is the last plug-in in a chain of plug ins that are removed            // just only one time it should be notified that these plug-ins are            // not used anymore (the data should not be converted anymore), so            // here we fire a data changed event JUST ONCE.            fireDataChanged();        }    }        /**     * Sets the next plug-in in a cascading series of plugins.     *     * @param aNewNextPlugIn The next plug-in in the series.     * @return <code>true</code> when the plug-in is successfully added,     * <code>false</code> otherwise.     * @deprecated {@link addPlugIn(AbstractConverterPlugIn)}     */    public boolean setNextPlugin(AbstractConverterPlugIn aNewNextPlugIn) {        if (aNewNextPlugIn == nextPlugIn) {            return false;        }                if (aNewNextPlugIn == null) {            nextPlugIn.setConnected(false);        } else {            if (aNewNextPlugIn.isConnected()) {                return false;            }            aNewNextPlugIn.setConnected(true);            aNewNextPlugIn.addPlugInListener(this);        }        nextPlugIn = aNewNextPlugIn;        fireDataChanged();        return true;    }        /**     * Gets the next converter plug-in within this cascading series of plug-ins.     *     * @return the next plug-in within this cascading series of plug-ins.     */    public AbstractConverterPlugIn getNextPlugIn() {        return nextPlugIn;    }        /**     * Added for XML serialization     * <p><b> **** DO NOT USE **** </b>     * <p>Use {@link #addPlugIn(AbstractConverterPlugIn)}     */    public void setNextPlugIn(AbstractConverterPlugIn newNextPlugIn) {        addPlugIn(newNextPlugIn);    }        /**     * Sets the input vector of <code>Patterns</code> that this converter plugin should process.     * @param newInputVector The vector of Pattern objects to process.     */    public void setInputVector(java.util.Vector newInputVector) {        InputVector = newInputVector;    }    /**     * Gets the input vector of <code>Patterns</code> with which this converter must process.     *     * @return the vector with patterns that this converter processes.     */    protected Vector getInputVector() {        return InputVector;    }        /**     * This method is called to perform a check on this converter's properties to     * ensure there are no errors or problems. If there is an error or problem with     * one of the properties then the issues are returned in a <code>TreeSet</code>     * object.     *     * @param checks A <code>TreeSet</code> of issues that should be added to by this     * plug-in.     * @return A <code>TreeSet</code> of errors or problems relating to the setup of     * this converter plug-in object.     * @see Synapse     */    public TreeSet check(TreeSet checks) {        if(AdvancedSerieSelector == null || AdvancedSerieSelector.equals(new String(""))) {            checks.add(new NetCheck(NetCheck.FATAL, "Advanced Serie Selector should be populated, e.g 1,2,4." , this));        }                // Call next converter plug-in in the chain of converter plug-ins        if(getNextPlugIn() != null) {            getNextPlugIn().check(checks);        }        return checks;    }        /**     * Gets the index of the current serie number.     * @return int -1 if the serie could not be found in the serie specification.     */    protected int getSerieIndexNumber(int serie) {        CSVParser Parse = new CSVParser(getAdvancedSerieSelector(),true);        int [] checker = Parse.parseInt();        for ( int i=0; i<checker.length;i++) {            if(checker[i] == serie+1)                return(i); // Returns index in array        }        return(-1); // Serie not found    }        private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {        in.defaultReadObject();        if (getAdvancedSerieSelector() == null) // To maintain the compatibility with the old saved classes            setAdvancedSerieSelector(new String("1"));    }}

⌨️ 快捷键说明

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