ExpressionBuilder { public static SequenceExpr SEQ(Type elementType, Expression elementCount) { return SEQ(CONSTANT(elementType), elementCount); } private  ExpressionBuilder(); static ConstantExpr CONSTANT(Object value); static ConstantExpr INV(Expression value); static SequenceExpr SEQ(Type elementType, Expression elementCount); static SequenceExpr SEQ(Expression elementType, int elementCount); static SequenceExpr SEQ(Type elementType, int elementCount); static SequenceExpr SEQ(Expression elementType, Expression elementCount); static CompoundExpr COMP(String name, CompoundExpr.Member... members); static CompoundExpr.Member MEMBER(String name, Type type); static CompoundExpr.Member MEMBER(String name, Expression expression); static ChoiceExpr IF(Expression condition, Type type1, Type type2); static ChoiceExpr IF(Expression condition, Expression expression1, Expression expression2); static SelectionExpr SELECT(Expression condition, SelectionExpr.Case... cases); static SelectionExpr.Case CASE(Object value, Type type); static SelectionExpr.Case CASE(Object value, Expression expression); static SelectionExpr.Default DEFAULT(Type type); static SelectionExpr.Default DEFAULT(Expression expression); static IntReferenceExpr IREF(String name); final static SimpleType BYTE; final static SimpleType UBYTE; final static SimpleType SHORT; final static SimpleType USHORT; final static SimpleType INT; final static SimpleType UINT; final static SimpleType LONG; final static SimpleType ULONG; final static SimpleType FLOAT; final static SimpleType DOUBLE; }
@Test public void testSequence() throws IOException { SequenceExpr sequence = SEQ(UINT, 42); assertEquals(true, sequence.isConstant()); Object result = sequence.evaluate(null); assertTrue(result instanceof SequenceType); SequenceType sequenceType = (SequenceType) result; assertEquals(SimpleType.UINT, sequenceType.getElementType()); assertEquals(42, sequenceType.getElementCount()); }