Package com.cburch.logisim.analyze.model

Examples of com.cburch.logisim.analyze.model.Expression


    return !data.getPoint().equals(instance.getLocation());
  }

  @Override
  protected Expression computeExpression(Expression[] inputs, int numInputs) {
    Expression ret = inputs[0];
    for (int i = 1; i < numInputs; i++) {
      ret = Expressions.or(ret, inputs[i]);
    }
    return Expressions.not(ret);
  }
View Full Code Here


    return GateFunctions.computeOddParity(inputs, numInputs).not();
  }

  @Override
  protected Expression computeExpression(Expression[] inputs, int numInputs) {
    Expression ret = inputs[0];
    for (int i = 1; i < numInputs; i++) {
      ret = Expressions.xor(ret, inputs[i]);
    }
    return Expressions.not(ret);
  }
View Full Code Here

          int negated = attrs.negated;
 
          Expression[] inputs = new Expression[inputCount];
          int numInputs = 0;
          for (int i = 1; i <= inputCount; i++) {
            Expression e = expressionMap.get(instance.getPortLocation(i));
            if (e != null) {
              int negatedBit = (negated >> (i - 1)) & 1;
              if (negatedBit == 1) {
                e = Expressions.not(e);
              }
              inputs[numInputs] = e;
              ++numInputs;
            }
          }
          if (numInputs > 0) {
            Expression out = AbstractGate.this.computeExpression(inputs, numInputs);
            expressionMap.put(instance.getPortLocation(0), out);
          }
        }
      };
    }
View Full Code Here

    return GateFunctions.computeAnd(inputs, numInputs).not();
  }

  @Override
  protected Expression computeExpression(Expression[] inputs, int numInputs) {
    Expression ret = inputs[0];
    for (int i = 1; i < numInputs; i++) {
      ret = Expressions.and(ret, inputs[i]);
    }
    return Expressions.not(ret);
  }
View Full Code Here

        field.setText(getCurrentString());
        field.grabFocus();
      } else if ((src == field || src == enter) && enter.isEnabled()) {
        try {
          String exprString = field.getText();
          Expression expr = Parser.parse(field.getText(), model);
          setError(null);
          model.getOutputExpressions().setExpression(getCurrentVariable(), expr, exprString);
          insertUpdate(null);
        } catch (ParserException ex) {
          setError(ex.getMessageGetter());
View Full Code Here

 
  protected static Expression xorExpression(Expression[] inputs, int numInputs) {
    if (numInputs > 2) {
      throw new UnsupportedOperationException("XorGate");
    }
    Expression ret = inputs[0];
    for (int i = 1; i < numInputs; i++) {
      ret = Expressions.xor(ret, inputs[i]);
    }
    return ret;
  }
View Full Code Here

    return GateFunctions.computeOddParity(inputs, numInputs);
  }

  @Override
  protected Expression computeExpression(Expression[] inputs, int numInputs) {
    Expression ret = inputs[0];
    for (int i = 1; i < numInputs; i++) {
      ret = Expressions.xor(ret, inputs[i]);
    }
    return ret;
  }
View Full Code Here

    return GateFunctions.computeAnd(inputs, numInputs);
  }

  @Override
  protected Expression computeExpression(Expression[] inputs, int numInputs) {
    Expression ret = inputs[0];
    for (int i = 1; i < numInputs; i++) {
      ret = Expressions.and(ret, inputs[i]);
    }
    return ret;
  }
View Full Code Here

  @Override
  protected Object getInstanceFeature(final Instance instance, Object key) {
    if (key == ExpressionComputer.class) {
      return new ExpressionComputer() {
        public void computeExpression(Map<Location,Expression> expressionMap) {
          Expression e = expressionMap.get(instance.getPortLocation(1));
          if (e != null) {
            expressionMap.put(instance.getPortLocation(0), Expressions.not(e));
          }
        }
      };
View Full Code Here

  @Override
  public Object getInstanceFeature(final Instance instance, Object key) {
    if (key == ExpressionComputer.class) {
      return new ExpressionComputer() {
        public void computeExpression(Map<Location,Expression> expressionMap) {
          Expression e = expressionMap.get(instance.getPortLocation(1));
          if (e != null) {
            expressionMap.put(instance.getPortLocation(0), e);
          }
        }
      };
View Full Code Here

TOP

Related Classes of com.cburch.logisim.analyze.model.Expression

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.