Package examples.circuit

Source Code of examples.circuit.LogicalEmiter

/* ==============================================
* Simtools : The tools library used in JSynoptic
* ==============================================
*
* Project Info:  http://jsynoptic.sourceforge.net/index.html
*
* This library is free software; you can redistribute it and/or modify it under the terms
* of the GNU Lesser General Public License as published by the Free Software Foundation;
* either version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this
* library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* (C) Copyright 1999-2008, by :
*     Corporate:
*         Astrium SAS
*         EADS CRC
*     Individual:
*         Claude Cazenave
*
* $Id: LogicalEmiter.java,v 1.4 2008/10/24 15:50:51 ogor Exp $
*
* Changes
* -------
* 08-Sep-2008 : Initial public release (RO);
*
*/
package examples.circuit;

import jsynoptic.plugins.circuit.CircuitGate;
import jsynoptic.plugins.circuit.Signal;
import jsynoptic.plugins.circuit.boxes.CircuitBox;
import simtools.diagram.gate.Connection;
import simtools.diagram.gate.Gate;
import simtools.shapes.AbstractShape;

public class LogicalEmiter extends CircuitBox {

    private static final long serialVersionUID = -1648932770916119272L;

    protected CircuitGate out;


    public LogicalEmiter(int ox, int oy, int width, int height) {
        super(ox, oy, width, height);
        addGate(out = new CircuitGate(this, Gate.WEST, "OUT", false));
    }

   
    /*
     * (non-Javadoc)
     *
     * @see simtools.shapes.AbstractShape#cloneShape()
     */
    protected AbstractShape cloneShape() {
        LogicalEmiter res = (LogicalEmiter) super.cloneShape();
        
        res.out = (CircuitGate)out.cloneGate(res);
        res.addGate(res.out);
       
        return res;
    }
    /**
     * @param value
     */
    public void emitASignal(boolean value){
        Signal signal = new LogicalSignal(value);
        out.sendSignal(signal, Signal.getNewSignalEventId());
    }

    public void connectionAddedAt(Gate gate, Connection connection) {
        // TODO Auto-generated method stub
       
    }

    public void connectionRemovedAt(Gate gate, Connection connection) {
        // TODO Auto-generated method stub
    }
   


    public CircuitGate getOut() {
        return out;
    }

}
TOP

Related Classes of examples.circuit.LogicalEmiter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.