de.gaalop.dfg.Expression.accept()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(137)

本文整理了Java中de.gaalop.dfg.Expression.accept()方法的一些代码示例,展示了Expression.accept()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Expression.accept()方法的具体详情如下:
包路径:de.gaalop.dfg.Expression
类名称:Expression
方法名:accept

Expression.accept介绍

[英]This method must be implemented by all concrete classes that implement this interface. It should call a visit method on the visitor that has one parameter, which has the type of the concrete implementing class.

See the Visitor Pattern for more details.
[中]此方法必须由实现此接口的所有具体类实现。它应该对具有一个参数的访问者调用一个visit方法,该参数具有具体实现类的类型。
有关更多详细信息,请参见访问者模式。

代码示例

代码示例来源:origin: CallForSanity/Gaalop

/**
 * 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;
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(MacroCall node) {
  for (Expression arg : node.getArguments()) {
    arg.accept(this);
  }
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(Multiplication node) {
  node.getLeft().accept(this);
  node.getRight().accept(this);
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(Inequality node) {
  node.getLeft().accept(this);
  node.getRight().accept(this);
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(MathFunctionCall node) {
  // just do nothing, because only MulitvectorComponent is important
  node.getOperand().accept(this);
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(Negation node) {
  // just do nothing, because only MulitvectorComponent is important
  node.getOperand().accept(this);
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(Relation relation) {
  // just do nothing, because only MulitvectorComponent is important
  relation.getLeft().accept(this);
  relation.getRight().accept(this);		
}

代码示例来源:origin: CallForSanity/Gaalop

public void visit(Exponentiation node) {
  // just do nothing, because only MulitvectorComponent is important
  node.getLeft().accept(this);
  node.getRight().accept(this);
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(Exponentiation node) {
  node.getLeft().accept(this);
  Double left = result;
  node.getRight().accept(this);
  result = Math.pow(left,result);
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(Division node) {
  result = null;
  node.getLeft().accept(this);
  Expression leftResult = result;
  node.getRight().accept(this);
  Expression rightResult = result;
  
  if (leftResult != null || rightResult != null) 
    result = new Division(leftResult, rightResult);
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(InnerProduct node) {
  result = null;
  node.getLeft().accept(this);
  Expression leftResult = result;
  node.getRight().accept(this);
  Expression rightResult = result;
  
  if (leftResult != null || rightResult != null) 
    result = new InnerProduct(leftResult, rightResult);
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(Exponentiation node) {
  result = null;
  node.getLeft().accept(this);
  Expression leftResult = result;
  node.getRight().accept(this);
  Expression rightResult = result;
  
  if (leftResult != null || rightResult != null) 
    result = new Exponentiation(leftResult, rightResult);
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(Inequality node) {
  result = null;
  node.getLeft().accept(this);
  Expression leftResult = result;
  node.getRight().accept(this);
  Expression rightResult = result;
  
  if (leftResult != null || rightResult != null) 
    result = new Inequality(leftResult, rightResult);
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(AssignmentNode node) {
  node.getValue().accept(dfgVisitor);
  super.visit(node);
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(Negation node) {
  node.getOperand().accept(this);
  result = IAMath.uminus(result);
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
protected void visitUnaryOperation(UnaryOperation node) {
  resultValue = null;
  node.getOperand().accept(this);
  if (resultValue != null) {
    node.setOperand(resultValue);
    resultValue = null;
  }
}

代码示例来源:origin: CallForSanity/Gaalop

@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());
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(ExpressionStatement node) {
  node.getExpression().accept(this);
  code.append("\\\\\n");
  node.getSuccessor().accept(this);
}

代码示例来源:origin: CallForSanity/Gaalop

@Override
public void visit(ExpressionStatement node) {
  UpdateMacroCallVisitor updater = new UpdateMacroCallVisitor(node);
  node.getExpression().accept(updater);
  node.getSuccessor().accept(this);
}

代码示例来源:origin: CallForSanity/Gaalop

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));");
  }
}

相关文章