NodeValueRewriter extends AbstractRewriter<NodeValue> implements
		NodeValueVisitor { @Override public void visit(NodeValueBoolean nv) { push(new NodeValueBoolean(nv.getBoolean(), changeNode(nv.asNode()))); } NodeValueRewriter(Map<Var, Node> values); @Override void visit(NodeValueBoolean nv); @Override void visit(NodeValueDecimal nv); @Override void visit(NodeValueDouble nv); @Override void visit(NodeValueFloat nv); @Override void visit(NodeValueInteger nv); @Override void visit(NodeValueNode nv); @Override void visit(NodeValueString nv); @Override void visit(NodeValueSortKey nv); @Override void visit(NodeValueDT nv); @Override void visit(NodeValueDuration nodeValueDuration); @Override void visit(NodeValueLang nv);  }
@Test public void visitNodeValueBooleanTest() { NodeValue nv = new NodeValueBoolean( true ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueBooleanNodeTest() { NodeValue nv = new NodeValueBoolean( true, NodeConst.nodeTrue ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueDecimalTest() { NodeValue nv = new NodeValueDecimal( new BigDecimal( 3.14 )); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueDecimalNodeTest() { Node n = NodeFactory.createLiteral(XSDFuncOp.canonicalDecimalStr(new BigDecimal( 3.14 )), XSDDatatype.XSDdecimal) ; NodeValue nv = new NodeValueDecimal( new BigDecimal( 3.14 ), n ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueDoubleTest() { NodeValue nv = new NodeValueDouble( 3.14 ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueDoubleNodeTest() { Node n = NodeFactory.createLiteral(Utils.stringForm( 3.14 ), XSDDatatype.XSDdouble) ; NodeValue nv = new NodeValueDouble( 3.14, n ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueFloatTest() { NodeValue nv = new NodeValueFloat( 3.14F ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueFloatNodeTest() { Node n = NodeFactory.createLiteral(Utils.stringForm( 3.14F ), XSDDatatype.XSDfloat) ; NodeValue nv = new NodeValueFloat( 3.14F, n ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueIntegerTest() { NodeValue nv = new NodeValueInteger( BigInteger.ONE ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueIntegerNodeTest() { Node n = NodeFactory.createLiteral(BigInteger.ONE.toString(), XSDDatatype.XSDinteger) ; NodeValue nv = new NodeValueInteger( BigInteger.ONE, n ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueNodeTest() { NodeValue nv = new NodeValueNode( Node.ANY); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueStringTest() { NodeValue nv = new NodeValueString( "Hello" ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueStringNodeTest() { Node n = NodeFactory.createLiteral( "Hello"); NodeValue nv = new NodeValueString( "Hello", n ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueSortKeyTest() { NodeValue nv = new NodeValueSortKey( "Hello", "fi" ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueSortKeyNodeTest() { Node n = NodeFactory.createLiteral( "Hello"); NodeValue nv = new NodeValueSortKey( "Hello", "fi", n ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueDTTest() { GregorianCalendar cal = new GregorianCalendar(2001, 10, 26, 21, 32, 52); Node n =NodeFactory.createLiteralByValue( cal, XSDDatatype.XSDdateTime); NodeValue nv = new NodeValueDT( "2001-10-26T21:32:52", n); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueDurationTest() throws DatatypeConfigurationException { Duration dur = DatatypeFactory.newInstance().newDuration(true, 1, 2, 3, 4, 5, 6); NodeValue nv = new NodeValueDuration( dur ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueDurationNodeTest() throws DatatypeConfigurationException { Duration dur = DatatypeFactory.newInstance().newDuration(true, 1, 2, 3, 4, 5, 6); Node n = NodeFactory.createLiteral(dur.toString(), XSDDatatype.XSDduration); NodeValue nv = new NodeValueDuration( dur, n ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueLangTest() { NodeValue nv = new NodeValueLang( "Hello", "fi" ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }
@Test public void visitNodeValueLangNodeTest() { Node n =NodeFactory.createLiteral("Hello", "fi"); NodeValue nv = new NodeValueLang( n ); nv.visit( rewriter ); NodeValue result = rewriter.getResult(); assertEquals( nv, result ); assertEquals( nv.getClass(), result.getClass() ); }