Codota Logo
Multiplication.<init>
Code IndexAdd Codota to your IDE (free)

How to use
de.gaalop.dfg.Multiplication
constructor

Best Java code snippets using de.gaalop.dfg.Multiplication.<init> (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
DateTime d =
  • Codota Iconnew DateTime()
  • Codota IconDateTimeFormatter formatter;String text;formatter.parseDateTime(text)
  • Codota IconObject instant;new DateTime(instant)
  • Smart code suggestions by Codota
}
origin: CallForSanity/Gaalop

  @Override
  protected Multiplication create(Expression left, Expression right) {
    return new Multiplication(left, right);
  }
}
origin: CallForSanity/Gaalop

/**
 * Creates an exponentation node that squares the given expression.
 * 
 * @param base The expression that should be squared. A deep copy will be created.
 * @return An exponentation object that exponentiates the given base with a float constant of 2.0.
 */
public static Multiplication square(Expression base) {
  return new Multiplication(base, base.copy());
}
origin: CallForSanity/Gaalop

@Override
public void visit(Multiplication node) {
  handlebinary(node);
  resultExpr = new Multiplication(left, right);
   left=null;
  right=null;
}
origin: CallForSanity/Gaalop

@Override
public Expression visitMultiplication(MaximaParser.MultiplicationContext ctx) {
  return new Multiplication(visit(ctx.left), visit(ctx.right));
}
origin: CallForSanity/Gaalop

@Override
public Object visitMultiplication(CluCalcParser.MultiplicationContext ctx) {
  return new Multiplication((Expression) visit(ctx.left), (Expression) visit(ctx.right));
}
origin: CallForSanity/Gaalop

@Override
public void visit(Multiplication node) {
  node.getLeft().accept(this);
  Expression dLeft = result;
  node.getRight().accept(this);
  Expression dRight = result;
  
  
  if (dLeft == zero) {
    if (dRight == zero) {
      result = zero;
    } else {
      result = new Multiplication(node.getLeft().copy(), dRight);
    }
  } else {
    //dLeft != zero !!
    if (dRight == zero) {
      result = new Multiplication(dLeft, node.getRight().copy());
    } else {
      result = new Addition(
        new Multiplication(dLeft, node.getRight().copy()),
        new Multiplication(node.getLeft().copy(), dRight)
          );
    }
  }
}
origin: CallForSanity/Gaalop

@Override
public void visit(Exponentiation node) {
  
  if (node.getRight() instanceof FloatConstant) {
    double constant = ((FloatConstant) node.getRight()).getValue();
    int integer = (int) Math.round(constant);
    if (integer>0 && integer<=3) 
      if (Math.abs(constant-integer) < 10E-7) {
        //Unfold
        //TODO chs set a new temporary variable, if left is of big height
        switch (integer) {
          case 1:
            result = node.getLeft();
            return;
          case 2:
            result = new Multiplication(node.getLeft(), node.getLeft());
            return;
          case 3:
            result = new Multiplication(new Multiplication(node.getLeft(),node.getLeft()), node.getLeft());
            return;    
        }
      }
  }
  
  super.visit(node);
}
 
origin: CallForSanity/Gaalop

/** recursive function to create  an Expression out of a multivector
 * 
 */
public Expression createExpression(GaaletMultiVector vec){
  
  GaaletBladeTable table = vec.getTable();
  
  if (vec.getGaalopBlades().size() <= 0)
   return new FloatConstant(0.0f);  //empty vector
  
  Set<Integer> key = vec.getGaalopBlades().keySet();
  
  Set<Expression> expressionBlades = new HashSet<Expression> (); // here we store every blades 
  //multiplication with a base vector.
  
  for (Integer index :key ) { //lets create a set of the basisBlades expressions
    vec.getGaalopBlades().get(key);
    // what we do is: we search in the table for the right BladeExpression and multiplicate
    // it with the value of the blade stored in the multivector.
    //System.out.println(table.getExpression(index)+ "  :: "+vec.getGaalopBlades().get(index));
    expressionBlades.add(new Multiplication(table.getExpression(index),vec.getGaalopBlades().get(index)));
  }
  //this times blade
  return recCreateAddTree(expressionBlades); // add up all expressions
}
origin: CallForSanity/Gaalop

@Override
public void visit(Exponentiation exponentiation) {
  if (isSquare(exponentiation)) {
    Multiplication m = new Multiplication(exponentiation.getLeft(), exponentiation.getLeft());
    m.accept(this);
  } else {
    code.append("pow(");
    exponentiation.getLeft().accept(this);
    code.append(',');
    exponentiation.getRight().accept(this);
    code.append(')');
  }
}
origin: CallForSanity/Gaalop

@Override
public void visit(Multiplication node) {
  result = null;
  node.getLeft().accept(this);
  Expression leftResult = result;
  node.getRight().accept(this);
  Expression rightResult = result;
  
  if (leftResult != null || rightResult != null) 
    result = new Multiplication(leftResult, rightResult);
}
origin: CallForSanity/Gaalop

@Override//dfg
public void visit(Multiplication node) {
  node.getLeft().accept(this);
  Expression lhs =nx;
  node.getRight().accept(this);
  Expression rhs =nx;
  nx = new Multiplication(lhs, rhs);
}
origin: CallForSanity/Gaalop

  @Override
  public void visit(Division node) {
    resultValue = new Multiplication(node.getLeft(), new MathFunctionCall(node.getRight(), MathFunction.INVERT));
  }
};
origin: CallForSanity/Gaalop

@Override
public Expression copy() {
  return new Multiplication(getLeft().copy(), getRight().copy());
}
origin: CallForSanity/Gaalop

@Override
public void visit(Division node) {
  if (node.getRight() instanceof FloatConstant) {
    FloatConstant newLeft = new FloatConstant(1/((FloatConstant) node.getRight()).getValue());
    replaceWith = new Multiplication(newLeft, node.getLeft());
  }
}
origin: CallForSanity/Gaalop

@Override  //dfg
public void visit(Exponentiation node) {
  if(isSquare(node)){
   handlebinary(new Multiplication(node.getLeft(), node.getLeft()));
  }else{
  handlebinary(node);
  }
}
origin: CallForSanity/Gaalop

@Override
public void visit(Multiplication node) {
 if (opstor.OperationShouldBeReplaced(node)) {
   nx = new Variable(opstor.getReplacementID(node));
   System.out.println("Replacer: Node  in Set: (  " + node.toString() + "  )    ---> Replacing with " + opstor.getReplacementID(node));
  } else {
    node.getLeft().accept(this);
    Expression lhs = nx;
    node.getRight().accept(this);
    Expression rhs = nx;
    nx = new Multiplication(lhs, rhs);
  }
}
@Override
origin: CallForSanity/Gaalop

@Override//dfg
public void visit(Exponentiation node) {
  if (isSquare(node) && (node.getLeft() instanceof Variable))    {
    String varname = null;
    if(node.getLeft() instanceof MultivectorComponent){
      varname = ((MultivectorComponent)node.getLeft()).getName() + ((MultivectorComponent)node.getLeft()).getBladeIndex();
    } else
      varname=  ((Variable)node.getLeft()).getName();

    if (!myHashmap.containsKey(varname)){
    myHashmap.put(varname, ( varname + "_quad"));
    AddedExponentiationBang = new AssignmentNode(cfg, new Variable(varname+"_quad"), new Multiplication(node.getLeft(), node.getLeft()));
        //new AssignmentNode(cfg,new Variable(varname+"_quad"),node.copy());
    currentAssignment.insertBefore(AddedExponentiationBang);
    }
    nx = new Variable(myHashmap.get(varname));
    
  
  }
  else // left is novariable or node is no square
  {
  node.getLeft().accept(this);
  Expression lhs =nx;
  node.getRight().accept(this);
  Expression rhs =nx;
  nx = new Exponentiation(lhs, rhs);
  }
}
origin: CallForSanity/Gaalop

@Override
public void visit(Exponentiation exponentiation) {
  if (isSquare(exponentiation)) {
    Multiplication m = new Multiplication(exponentiation.getLeft(), exponentiation.getLeft());
    m.accept(this);
  } else {
    append("Math.pow(");
    exponentiation.getLeft().accept(this);
    append(',');
    exponentiation.getRight().accept(this);
    append(')');
  }
}
origin: CallForSanity/Gaalop

@Override
public void visit(Exponentiation node) {
  Multiplication nodeMul;
  if (isSquare(node)) {
    nodeMul = new Multiplication(node.getLeft(), node.getLeft());
    nx = nodeMul;
    if (opstor.OperationShouldBeReplaced(nodeMul)) {
      nx = new Variable(opstor.getReplacementID(nodeMul));
    }
  } else {
    if (opstor.OperationShouldBeReplaced(node)) {
      nx = new Variable(opstor.getReplacementID(node));
      System.out.println("Replacer: Node  in Set: (  " + node.toString() + "  )    ---> Replacing with " + opstor.getReplacementID(node));
    } else {
      node.getLeft().accept(this);
      Expression lhs = nx;
      node.getRight().accept(this);
      Expression rhs = nx;
      nx = new Exponentiation(lhs, rhs);
    }
  }
}
origin: CallForSanity/Gaalop

@Override
public void visit(Division node) {
 node.getLeft().accept(this);
 Expression left = resultExpr;
 node.getRight().accept(this);
 Expression right = resultExpr;
 if(left instanceof FloatConstant && ((FloatConstant)left).getValue() == 1.0) {
   resultExpr = new Division(left, right);
 } else {
 resultExpr = new Multiplication(left, new  Division(new FloatConstant("1.0"), right));
 }
 if ((left instanceof FloatConstant) &&
     (right instanceof FloatConstant)) {
  FloatConstant leftc = (FloatConstant) left;
  FloatConstant rightc = (FloatConstant) right;
  resultExpr = new FloatConstant(leftc.getValue() / rightc.getValue());
 } else if ((node.getRight() instanceof FloatConstant)) {
   /* division by 1 gets canceld */
  FloatConstant floatConst = (FloatConstant) node.getRight();
  if (floatConst.getValue() == 1.0) {
   resultExpr = left;
  }
 }
}
de.gaalop.dfgMultiplication<init>

Popular methods of Multiplication

  • getLeft
  • getRight
  • accept
    Calls de.gaalop.dfg.ExpressionVisitor#visit(Multiplication) on a visitor.
  • toString
    Converts this multiplication to a human readable string representation.

Popular in Java

  • Reactive rest calls using spring rest template
  • notifyDataSetChanged (ArrayAdapter)
  • requestLocationUpdates (LocationManager)
  • onCreateOptionsMenu (Activity)
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Notification (javax.management)
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now