/** * Returns the type of a Expression * @param expression The expression * @return The type of the given expression */ public static DFGNodeType getTypeOfDFGNode(Expression expression) { if (expression == null) { return null; } expression.accept(getter); return getter.type; }
@Override public void visit(MacroCall node) { for (Expression arg : node.getArguments()) { arg.accept(this); } }
@Override public void visit(MathFunctionCall node) { // just do nothing, because only MulitvectorComponent is important node.getOperand().accept(this); }
@Override public void visit(Negation node) { // just do nothing, because only MulitvectorComponent is important node.getOperand().accept(this); }
@Override public void visit(AssignmentNode node) { node.getValue().accept(dfgVisitor); super.visit(node); }
@Override public void visit(Negation node) { node.getOperand().accept(this); result = IAMath.uminus(result); }
@Override protected void visitUnaryOperation(UnaryOperation node) { resultValue = null; node.getOperand().accept(this); if (resultValue != null) { node.setOperand(resultValue); resultValue = null; } }
@Override public void visit(Relation relation) { result = null; relation.getLeft().accept(this); Expression leftResult = result; relation.getRight().accept(this); Expression rightResult = result; if (leftResult != null || rightResult != null) result = new Relation(leftResult, rightResult, relation.getType()); }
@Override public void visit(ExpressionStatement node) { node.getExpression().accept(this); code.append("\\\\\n"); node.getSuccessor().accept(this); }
@Override public void visit(ExpressionStatement node) { UpdateMacroCallVisitor updater = new UpdateMacroCallVisitor(node); node.getExpression().accept(updater); node.getSuccessor().accept(this); }
private void fillMaximaInput(LinkedList<AssignmentNode> toDerive, MaximaInput input, MultivectorComponent variable) { for (AssignmentNode node : toDerive) { DFGToMaximaCode dfg = new DFGToMaximaCode(); node.getValue().accept(dfg); input.add("ratsimp(diff("+dfg.getResultString() + ","+variable.getName()+"\\$"+variable.getBladeIndex()+",1));"); } }