Package com.cburch.logisim.instance

Examples of com.cburch.logisim.instance.Port


        int cols = instance.getAttributeValue(ATTR_MATRIX_COLS).intValue();
        Port[] ps;
        if (input == INPUT_COLUMN) {
            ps = new Port[cols];
            for (int i = 0; i < cols; i++) {
                ps[i] = new Port(10 * i, 0, Port.INPUT, rows);
            }
        } else if (input == INPUT_ROW) {
            ps = new Port[rows];
            for (int i = 0; i < rows; i++) {
                ps[i] = new Port(0, 10 * i, Port.INPUT, cols);
            }
        } else {
            if (rows <= 1) {
                ps = new Port[] { new Port(0, 0, Port.INPUT, cols) };
            } else if (cols <= 1) {
                ps = new Port[] { new Port(0, 0, Port.INPUT, rows) };
            } else {
                ps = new Port[] {
                        new Port(0, 0, Port.INPUT, cols),
                        new Port(0, 10, Port.INPUT, rows)
                };
            }
        }
        instance.setPorts(ps);
    }
View Full Code Here


    //
    @Override
    protected void configureNewInstance(Instance instance) {
        instance.addAttributeListener();
        instance.setPorts(new Port[] {
                new Port(0, 0, Port.INOUT, StdAttr.WIDTH)
            });
        configureLabel(instance);
    }
View Full Code Here

        setAttributes(new Attribute[] { Io.ATTR_ON_COLOR, Io.ATTR_OFF_COLOR,
                    Io.ATTR_BACKGROUND },
                new Object[] { new Color(240, 0, 0), SevenSegment.DEFAULT_OFF,
                    Io.DEFAULT_BACKGROUND });
        setPorts(new Port[] {
                new Port( 0, 0, Port.INPUT, 4),
                new Port(10, 0, Port.INPUT, 1)
            });
        setOffsetBounds(Bounds.create(-15, -60, 40, 60));
        setIconName("hexdig.svg");
    }
View Full Code Here

        setIconName("power.svg");
        setAttributes(new Attribute[] { StdAttr.FACING, StdAttr.WIDTH },
                new Object[] { Direction.NORTH, BitWidth.ONE });
        setFacingAttribute(StdAttr.FACING);
        setKeyConfigurator(new BitWidthConfigurator(StdAttr.WIDTH));
        setPorts(new Port[] { new Port(0, 0, Port.OUTPUT, StdAttr.WIDTH) });
    }
View Full Code Here

                new Object[] { new Color(240, 0, 0), DEFAULT_OFF,
                    Io.DEFAULT_BACKGROUND, Boolean.TRUE });
        setOffsetBounds(Bounds.create(-5, 0, 40, 60));
        setIconName("7seg.svg");
        setPorts(new Port[] {
                new Port(200, Port.INPUT, 1),
                new Port(300, Port.INPUT, 1),
                new Port(20, 60, Port.INPUT, 1),
                new Port(10, 60, Port.INPUT, 1),
                new Port( 0, 60, Port.INPUT, 1),
                new Port(100, Port.INPUT, 1),
                new Port( 00, Port.INPUT, 1),
                new Port(30, 60, Port.INPUT, 1),
            });
    }
View Full Code Here

        Object powerLoc = instance.getAttributeValue(Wiring.ATTR_GATE);
        boolean flip = (facing == Direction.SOUTH || facing == Direction.WEST)
            == (powerLoc == Wiring.GATE_TOP_LEFT);

        Port[] ports = new Port[3];
        ports[OUTPUT] = new Port(0, 0, Port.OUTPUT, StdAttr.WIDTH);
        ports[INPUT] = new Port(40 * dx, 40 * dy, Port.INPUT, StdAttr.WIDTH);
        if (flip) {
            ports[GATE] = new Port(20 * (dx + dy), 20 * (-dx + dy), Port.INPUT, 1);
        } else {
            ports[GATE] = new Port(20 * (dx - dy), 20 * (dx + dy), Port.INPUT, 1);
        }
        instance.setPorts(ports);
    }
View Full Code Here

    // methods for instances
    //
    @Override
    protected void configureNewInstance(Instance instance) {
        instance.addAttributeListener();
        instance.setPorts(new Port[] { new Port(0, 0, Port.OUTPUT, BitWidth.ONE) });
        configureLabel(instance);
    }
View Full Code Here

                "", Io.LABEL_CENTER,
                StdAttr.DEFAULT_LABEL_FONT, Color.BLACK
            });
        setFacingAttribute(StdAttr.FACING);
        setIconName("button.svg");
        setPorts(new Port[] { new Port(0, 0, Port.OUTPUT, 1) });
        setInstancePoker(Poker.class);
        setInstanceLogger(Logger.class);
    }
View Full Code Here

TOP

Related Classes of com.cburch.logisim.instance.Port

Copyright © 2018 www.massapicom. 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.