Package com.cburch.logisim.data

Examples of com.cburch.logisim.data.AttributeSet


  //
  // package methods
  //
  public static boolean tick(CircuitState circState, int ticks, Component comp) {
    AttributeSet attrs = comp.getAttributeSet();
    int durationHigh = attrs.getValue(ATTR_HIGH).intValue();
    int durationLow = attrs.getValue(ATTR_LOW).intValue();
    ClockState state = (ClockState) circState.getData(comp);
    if (state == null) {
      state = new ClockState();
      circState.setData(comp, state);
    }
View Full Code Here


            newOpts.copyFrom(src.getOptions(), dst);
        }

        private void copyToolAttributes(Library srcLib, Library dstLib) {
            for (Tool srcTool : srcLib.getTools()) {
                AttributeSet srcAttrs = srcTool.getAttributeSet();
                Tool dstTool = dstLib.getTool(srcTool.getName());
                if (srcAttrs != null && dstTool != null) {
                    AttributeSet dstAttrs = dstTool.getAttributeSet();
                    for (Attribute<?> attrBase : srcAttrs.getAttributes()) {
                        @SuppressWarnings("unchecked")
                        Attribute<Object> attr = (Attribute<Object>) attrBase;
                        Object srcValue = srcAttrs.getValue(attr);
                        Object dstValue = dstAttrs.getValue(attr);
                        if (!dstValue.equals(srcValue)) {
                            dstAttrs.setValue(attr, srcValue);
                            attrValues.add(new RevertAttributeValue(dstAttrs, attr, dstValue));
                        }
                    }
                }
            }
View Full Code Here

            CircuitMutation xn = new CircuitMutation(circuit);
            for (Component comp : toReplace) {
                xn.remove(comp);
                ComponentFactory factory = compMap.get(comp.getFactory());
                if (factory != null) {
                    AttributeSet newAttrs = createAttributes(factory, comp.getAttributeSet());
                    xn.add(factory.createComponent(comp.getLocation(), newAttrs));
                }
            }
            xn.execute();
        }
View Full Code Here

            xn.execute();
        }
    }

    private static AttributeSet createAttributes(ComponentFactory factory, AttributeSet src) {
        AttributeSet dest = factory.createAttributeSet();
        copyAttributes(dest, src);
        return dest;
    }
View Full Code Here

        }
        ComponentFactory source = ((AddTool) tool).getFactory();

        // Determine attributes
        String loc_str = elt.getAttribute("loc");
        AttributeSet attrs = source.createAttributeSet();
        reader.initAttributeSet(elt, attrs, source);

        // Create component if location known
        if (loc_str == null || loc_str.equals("")) {
            throw new XmlReaderException(getFromLocale("compLocMissingError", source.getName()));
View Full Code Here

            int width, int height);

    protected void paintRectangular(InstancePainter painter,
            int width, int height) {
        int don = negateOutput ? 10 : 0;
        AttributeSet attrs = painter.getAttributeSet();
        painter.drawRectangle(-width, -height / 2, width - don, height,
                getRectangularLabel(attrs));
        if (negateOutput) {
            painter.drawDongle(-5, 0);
        }
View Full Code Here

    @Override
    public void propagate(InstanceState state) {
        GateAttributes attrs = (GateAttributes) state.getAttributeSet();
        int inputCount = attrs.inputs;
        int negated = attrs.negated;
        AttributeSet opts = state.getProject().getOptions().getAttributeSet();
        boolean errorIfUndefined = opts.getValue(Options.ATTR_GATE_UNDEFINED)
                                    .equals(Options.GATE_UNDEFINED_ERROR);

        Value[] inputs = new Value[inputCount];
        int numInputs = 0;
        boolean error = false;
View Full Code Here

        return false;
    }

    @Override
    public Object getDefaultAttributeValue(Attribute<?> attr, LogisimVersion ver) {
        AttributeSet dfltSet = defaultSet;
        if (dfltSet == null) {
            dfltSet = (AttributeSet) createAttributeSet().clone();
            defaultSet = dfltSet;
        }
        return dfltSet.getValue(attr);
    }
View Full Code Here

                } else {
                    Pokable p = (Pokable) c.getFeature(Pokable.class);
                    if (p != null) {
                        Caret caret = p.getPokeCaret(event);
                        setPokedComponent(circ, c, caret);
                        AttributeSet attrs = c.getAttributeSet();
                        if (attrs != null && attrs.getAttributes().size() > 0) {
                            Project proj = canvas.getProject();
                            proj.getFrame().viewComponentAttributes(circ, c);
                        }
                    }
                }
View Full Code Here

        } else if (control == Value.ERROR || control == Value.UNKNOWN) {
            state.setPort(0, Value.createError(width), GateAttributes.DELAY);
        } else {
            Value out;
            if (control == Value.UNKNOWN || control == Value.NIL) {
                AttributeSet opts = state.getProject().getOptions().getAttributeSet();
                if (opts.getValue(Options.ATTR_GATE_UNDEFINED)
                        .equals(Options.GATE_UNDEFINED_ERROR)) {
                    out = Value.createError(width);
                } else {
                    out = Value.createUnknown(width);
                }
View Full Code Here

TOP

Related Classes of com.cburch.logisim.data.AttributeSet

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.