public boolean dependsOn(String variableName) { for (int i = 1; i < size(); i++) { if (get(i).dependsOn(variableName)) { return true; } } return false; }
/** * Returns <code>true</code>, if <b>none of the elements</b> in the * subexpressions or the expression itself equals <code>node</code> . * * @param node * a node to compare with * @return <code>true</code>, if <b>none of the elements</b> in the * subexpressions or the expression itself equals <code>node</code> * . */ public boolean isFree(final ASTNode node) { return !this.equals(node); }
public boolean evaluateNodeLogical(final ASTNode node) { if (node instanceof FunctionNode) { return evaluateFunctionLogical((FunctionNode) node); } if (node instanceof SymbolNode) { BooleanVariable v = fBooleanVariables.get(node.toString()); if (v != null) { return v.getValue(); } Boolean boole = SYMBOL_BOOLEAN_MAP.get(node.toString()); if (boole != null) { return boole.booleanValue(); } } throw new ArithmeticException("EvalDouble#evaluateNodeLogical(ASTNode) not possible for: " + node.toString()); }
if (node.isFree(var)) { return new DoubleNode(0.0); if (f.get(2).isFree(var)) {// derive x^r ASTNode arg1Derived = derivative(f.getNode(1), var); if (f.get(1).isFree(var)) {// derive a^x ASTNode arg2Derived = derivative(f.getNode(2), var); for (int i = 1; i < f.size(); i++) { ASTNode deriv = derivative(f.getNode(i), var); if (!deriv.equals(new DoubleNode(0.0))) { result.add(deriv); if (j == i) { ASTNode deriv = derivative(f.getNode(j), var); if (deriv.equals(new DoubleNode(0.0))) { valid = false; } else { IDoubleValue v = fVariableMap.get(node.toString()); if (v != null) { return new DoubleNode(0.0); Double dbl = SYMBOL_DOUBLE_MAP.get(node.toString()); if (dbl != null) { return new DoubleNode(0.0); throw new ArithmeticMathException("EvalDouble#evaluate(ASTNode) not possible for: " + node.toString());
Object theUnEscapedValue = toUnEscapedValue( aSymbolNodeC.getString() );
/** {@inheritDoc} */ @Override public boolean isFree(final ASTNode node) { if (this.equals(node)) { return false; } for (int i = 0; i < fNodesList.size(); i++) { if (!fNodesList.get(i).isFree(node)) { return false; } } return true; }
public String toString() { final StringBuffer buff = new StringBuffer(); if (fSymbol != null) { buff.append(fSymbol.toString()); } buff.append('_'); if (fDefault) { buff.append('.'); } if (fConstraint != null) { buff.append(fConstraint.toString()); } return buff.toString(); }
/** * {@inheritDoc} Equals. */ @Override public boolean equals( Object obj ) { if ( obj instanceof PatternNode ) { PatternNode pn = (PatternNode) obj; if ( fSymbol == pn.fSymbol ) { if ( fConstraint == null || pn.fConstraint == null ) { return fConstraint == pn.fConstraint; } return fConstraint.equals( pn.fConstraint ); } else { if ( fSymbol == null || pn.fSymbol == null ) { return false; } if ( fSymbol.equals( pn.fSymbol ) ) { if ( fConstraint == null || pn.fConstraint == null ) { return fConstraint == pn.fConstraint; } return fConstraint.equals( pn.fConstraint ); } } } return false; }
@Override public boolean dependsOn(String variableName) { for (int i = 1; i < size(); i++) { if (get(i).dependsOn(variableName)) { return true; } } return false; }
public boolean evaluateNodeLogical(final ASTNode node) { if (node instanceof FunctionNode) { return evaluateFunctionLogical((FunctionNode) node); } if (node instanceof SymbolNode) { BooleanVariable v = fBooleanVariables.get(node.toString()); if (v != null) { return v.getValue(); } Boolean boole = SYMBOL_BOOLEAN_MAP.get(node.toString()); if (boole != null) { return boole.booleanValue(); } } throw new ArithmeticException( "EvalDouble#evaluateNodeLogical(ASTNode) not possible for: " + node.toString()); }
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (this.getClass().equals(obj.getClass())) { PatternNode pn = (PatternNode) obj; if (fSymbol == pn.fSymbol) { if (fConstraint == null || pn.fConstraint == null) { return fConstraint == pn.fConstraint; } return fConstraint.equals(pn.fConstraint); } else { if (fSymbol == null || pn.fSymbol == null) { return false; } if (fSymbol.equals(pn.fSymbol)) { if (fConstraint == null || pn.fConstraint == null) { return fConstraint == pn.fConstraint; } return fConstraint.equals(pn.fConstraint); } } } return false; }
/** * {@inheritDoc} Depends on. */ @Override public boolean dependsOn( String variableName ) { for ( int i = 1; i < size(); i++ ) { if ( get( i ).dependsOn( variableName ) ) { return true; } } return false; }
public String toString() { final StringBuffer buff = new StringBuffer(); if (fSymbol != null) { buff.append(fSymbol.toString()); } buff.append("___"); if (fDefault) { buff.append('.'); } if (fConstraint != null) { buff.append(fConstraint.toString()); } return buff.toString(); }
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (this.getClass().equals(obj.getClass())) { Pattern3Node pn = (Pattern3Node) obj; if (fSymbol == pn.fSymbol) { if (fConstraint == null || pn.fConstraint == null) { return fConstraint == pn.fConstraint; } return fConstraint.equals(pn.fConstraint); } else { if (fSymbol == null || pn.fSymbol == null) { return false; } if (fSymbol.equals(pn.fSymbol)) { if (fConstraint == null || pn.fConstraint == null) { return fConstraint == pn.fConstraint; } return fConstraint.equals(pn.fConstraint); } } } return false; }
public String toString() { final StringBuffer buff = new StringBuffer(); if (fSymbol != null) { buff.append(fSymbol.toString()); } buff.append("__"); if (fDefault) { buff.append('.'); } if (fConstraint != null) { buff.append(fConstraint.toString()); } return buff.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (this.getClass().equals(obj.getClass())) { Pattern2Node pn = (Pattern2Node) obj; if (fSymbol == pn.fSymbol) { if (fConstraint == null || pn.fConstraint == null) { return fConstraint == pn.fConstraint; } return fConstraint.equals(pn.fConstraint); } else { if (fSymbol == null || pn.fSymbol == null) { return false; } if (fSymbol.equals(pn.fSymbol)) { if (fConstraint == null || pn.fConstraint == null) { return fConstraint == pn.fConstraint; } return fConstraint.equals(pn.fConstraint); } } } return false; }
@Override public String toString() { final StringBuilder buff = new StringBuilder(); if (fSymbol != null) { buff.append(fSymbol.toString()); } buff.append('_'); if (fDefault) { buff.append('.'); } if (fConstraint != null) { buff.append(fConstraint.toString()); } return buff.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (this.getClass().equals(obj.getClass())) { Pattern3Node pn = (Pattern3Node) obj; if (fSymbol == pn.fSymbol) { if (fConstraint == null || pn.fConstraint == null) { return fConstraint == pn.fConstraint; } return fConstraint.equals(pn.fConstraint); } else { if (fSymbol == null || pn.fSymbol == null) { return false; } if (fSymbol.equals(pn.fSymbol)) { if (fConstraint == null || pn.fConstraint == null) { return fConstraint == pn.fConstraint; } return fConstraint.equals(pn.fConstraint); } } } return false; }