Examples of Gate


Examples of simtools.diagram.gate.Gate

            // Now Copy the connectors
            for (int i = 0; i < selectedConnectors.size(); i++) {
                Connection connection = (Connection) selectedConnectors.get(i);

                if (connection instanceof TestConnection){
                    Gate fisrtGate = (Gate) connection.getFirstEndGate();
                    Gate lastGate = (Gate) connection.getLastEndGate();

                    Gate newFg = null;
                    Gate newLg = null;

                    if ((fisrtGate!=null) && selectedGatedComponent.contains(fisrtGate.getOwner())){
                        newFg = (Gate) clonedGates.get(fisrtGate);
                    }
                    if ((lastGate!=null) && selectedGatedComponent.contains(lastGate.getOwner())){
View Full Code Here

Examples of simtools.diagram.gate.Gate

            Point p = new Point(_moveX, _moveY);
            GatedComponent gc = getGateComponentAt(p);
            if (gc != null){
                _currentTrackedComponent.add(gc);
            }
            Gate gate  =  getGateAt(p);
            if (gate != null){
                _currentTrackedGates.add(new TrackedGate(null, true, gate));
            }
           
        } else if (_elementContainer.getSelection().getShapeCount()== 1){
            //  track gates and components for selected gated components or connections
            ElementSelection ss =  _elementContainer.getSelection().getSelection(0);


            // look up for gate at selected end
            if (_translatingPoint &&  ss instanceof ConnectionPathSelection && ((ConnectionPathSelection)ss).isOneEndSelected()){

                ConnectionPathSelection cps = ((ConnectionPathSelection)ss);
                Connection connection = cps.getConnection();

                boolean isFirstEndSelected = ((ConnectionPathSelection)ss).isFirstEndSelected();

                Point p = isFirstEndSelected? connection.getPath().getNode(0) : connection.getPath().getNode(connection.getPath().getNodeNumber()-1);

                // Component
                GatedComponent gc = getGateComponentAt(p);
                if (gc != null){
                    _currentTrackedComponent.add(gc);
                }
               
                // Gate
                Gate gate  =  getGateAt(p);
                if (gate != null){
                    _currentTrackedGates.add(new TrackedGate(connection, isFirstEndSelected, gate));
                }

            }  else if (_translatingShapes){
                Shape s = ss.element;

                // For each  connection ends, look up for a gate
                if (ss instanceof ConnectionPathSelection){
                    Connection connection = ((ConnectionPathSelection)ss).getConnection();
                    Path connectionPath = connection.getPath();

                    Point firstEnd = connectionPath.getNode(0); // first end
                   
                    GatedComponent gc = getGateComponentAt(firstEnd);
                    if (gc != null){
                        _currentTrackedComponent.add(gc);
                    }
                   
                    Gate gate  =  getGateAt(firstEnd);
                    if (gate != null){
                        _currentTrackedGates.add(new TrackedGate(connection, true, gate));
                    }

                    Point lastEnd = connectionPath.getNode(connectionPath.getNodeNumber()-1); // first end
                   
                    gc = getGateComponentAt(lastEnd);
                    if (gc != null){
                        _currentTrackedComponent.add(gc);
                    }
                   
                    gate  =  getGateAt(lastEnd);
                    if (gate != null){
                        _currentTrackedGates.add(new TrackedGate(connection, false, gate));
                    }


                    // For each gates, look up for a connection ends
                } else if (s instanceof GatedComponent){   
                    GatedComponent gc = ((GatedComponent)s);
                    List gates = gc.getGates();

                    for(int i =0;i<gates.size();i++){
                        Gate gate = (Gate)gates.get(i);
                        Point gateAnchor = gate.getAnchor();

                        Connection connection = _elementContainer.getSelection().getConnectionAt(gateAnchor.x, gateAnchor.y);
                        if (connection != null && !connection.isConnected(gate)){

                            // first connection bound is free
                            if ( gate.canBeHanged(connection.getPath().getNode(0)) && connection.getFirstEndGate()==null){
                                _currentTrackedGates.add(new TrackedGate(connection, true, gate));

                                // last connection bound is free
                            } else if gate.canBeHanged(connection.getPath().getNode(connection.getPath().getNodeNumber()-1))
                                    && connection.getLastEndGate()==null){
                                _currentTrackedGates.add(new TrackedGate(connection, false, gate));
                            }
                        }
                    }
View Full Code Here

Examples of simtools.diagram.gate.Gate

     * Return the gate found on current diagram at given position
     * @param p
     * @return the gate found on current diagram at given position, or null if not gate found.
     */
    private Gate getGateAt(Point p){
        Gate res = null;
        GatedComponent gc = getGateComponentAt(p);
        if (gc != null){
            res = gc.getGateAt(p.x, p.y);
        }
        return res;
View Full Code Here

Examples of simtools.diagram.gate.Gate

            if (ns!=null){
                ns.translate(-p.x, -p.y);

                v.addElement(ns);

                Gate fisrtGate = (Gate) connection.getFirstEndGate();
                Gate lastGate = (Gate) connection.getLastEndGate();

                Gate newFg = null;
                Gate newLg = null;

                if ((fisrtGate!=null) && selectedGatedComponent.contains(fisrtGate.getOwner())){
                    newFg = (Gate) clonedGates.get(fisrtGate);
                }
                if ((lastGate!=null) && selectedGatedComponent.contains(lastGate.getOwner())){
View Full Code Here

Examples of simtools.diagram.gate.Gate

            if (ss.element instanceof GatedComponent){
                GatedComponent gc = (GatedComponent)ss.element;

                List gates = gc.getGates();
                for(int k=0; k< gates.size(); k++){
                    Gate gate =  ((Gate)gates.get(k));
                    List connections = gate.getConnections();

                    for(int j=0; j< connections.size(); j++){
                        Connection connection = (Connection)connections.get(j);   
                        if (connection.isConnected(gate)){
                            ce.addEdit(new GateDisconnectEdit(connection, gate, connection.getFirstEndGate()!=null && connection.getFirstEndGate().equals(gate)));
View Full Code Here

Examples of simtools.diagram.gate.Gate

        res.gateHolder = gateHolder.cloneGateHolder(res);
       
        // clone gates
        List gates = gateHolder.getGates();
        for(int i=0;i< gates.size();i++){
            Gate gate = (Gate)gates.get(i);
            res.gateHolder.addGate(gate.cloneGate(res));
        }
        return res;
    }
View Full Code Here

Examples of simtools.diagram.gate.Gate

     * @see simtools.diagram.gate.GatedComponent#connectionAddedAt(simtools.diagram.gate.Gate, simtools.diagram.gate.Connection)
     */
    public void connectionAddedAt(Gate gate, Connection connection) {  

        // If the other connection gate  holds a signal, the given gate becomes an input of this component
        Gate otherGate = null;
        if (connection.getFirstEndGate() != null && !connection.getFirstEndGate().equals(gate)){
            otherGate = connection.getFirstEndGate();

        } else if (connection.getLastEndGate() != null && !connection.getLastEndGate().equals(gate)){
            otherGate = connection.getLastEndGate();
View Full Code Here

Examples of simtools.diagram.gate.Gate

     */
    private int getIndex(Gate gate){
        int res = -1;
       
        if (gates.contains(gate)) {
            Gate g = null;
            for(int i=0;i<gates.size() && !gate.equals(g) ;i++){
                g = (Gate)gates.get(i);
                if (g.getSide() == gate.getSide()){
                    res++;
                }
            }
        }
       
View Full Code Here

Examples of simtools.diagram.gate.Gate

    /* (non-Javadoc)
     * @see simtools.diagram.gate.GatedComponent#getGateAt(int, int)
     */
    public Gate getGateAt(int ox, int oy){
        Gate res = null;
        Point p = new Point(ox, oy);

        List gates = getGates();
        for(int i=0;i<gates.size() && res==null; i++){
            Gate g = (Gate)gates.get(i);
            if ( g.canBeHanged(p)){
                res = g;
            }
        }
        return res;
    }
View Full Code Here

Examples of simtools.diagram.gate.Gate

      
    public GatedRectangleShape(int ox, int oy, int width, int height) {
        super(ox, oy, width, height);
        gateHolder = new GatesHolder(this);
       
        addGate(northGate = new Gate(this, Gate.NORTH));
        addGate(southGate = new Gate(this, Gate.SOUTH));
        addGate(eastGate = new Gate(this, Gate.EAST));
        addGate(westGate = new Gate(this, Gate.WEST));
       
    }
View Full Code Here
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.