/** * {@inheritDoc} Creates a new ASTNode object. */ @Override public FractionNode createFraction( final IntegerNode numerator, final IntegerNode denominator ) { return new FractionNode( numerator, denominator ); }
@Override public FractionNode createFraction(final IntegerNode numerator, final IntegerNode denominator) { return new FractionNode(numerator, denominator); }
public FractionNode createFraction(final IntegerNode numerator, final IntegerNode denominator) { return new FractionNode(numerator, denominator); }
public ASTNode createFunction(final IParserFactory factory, final ASTNode lhs, final ASTNode rhs) { if (rhs instanceof IntegerNode) { if (lhs instanceof IntegerNode) { return new FractionNode((IntegerNode) lhs, (IntegerNode) rhs); } return factory.createFunction(factory.createSymbol("Times"), lhs, new FractionNode(IntegerNode.C1, (IntegerNode) rhs)); } return factory.createFunction(factory.createSymbol("Times"), lhs, factory.createFunction(factory.createSymbol("Power"), rhs, factory.createInteger(-1))); } }
/** * {@inheritDoc} Creates the function. */ @Override public ASTNode createFunction( final IParserFactory factory, final ASTNode lhs, final ASTNode rhs ) { if ( rhs instanceof IntegerNode ) { if ( lhs instanceof IntegerNode ) { return new FractionNode( (IntegerNode) lhs, (IntegerNode) rhs ); } return factory.createFunction( factory.createSymbol( "Times" ), lhs, new FractionNode( IntegerNode.C1, (IntegerNode) rhs ) ); } return factory.createFunction( factory.createSymbol( "Times" ), lhs, factory.createFunction( factory.createSymbol( "Power" ), rhs, factory.createInteger( -1 ) ) ); } }
@Override public ASTNode createFunction(final INodeParserFactory factory, final ASTNode lhs, final ASTNode rhs) { if (rhs instanceof IntegerNode) { if (lhs instanceof IntegerNode) { return new FractionNode((IntegerNode) lhs, (IntegerNode) rhs); } return factory.createFunction(factory.createSymbol("Times"), new FractionNode(IntegerNode.C1, (IntegerNode) rhs), lhs); } if (lhs.equals(IntegerNode.C1)) { return factory.createFunction(factory.createSymbol("Power"), rhs, factory.createInteger(-1)); } return factory.createFunction(factory.createSymbol("Times"), lhs, factory.createFunction(factory.createSymbol("Power"), rhs, factory.createInteger(-1))); } }