@Test public void testPackNestedAnd() { final GroupElement and1 = GroupElementFactory.newAndInstance(); final Pattern pattern1 = new Pattern( 0, null ); and1.addChild( pattern1 ); final Pattern pattern2 = new Pattern( 0, null ); and1.addChild( pattern2 ); assertEquals( 2, and1.getChildren().size() ); assertSame( pattern1, and1.getChildren().get( 0 ) ); assertSame( pattern2, and1.getChildren().get( 1 ) ); final GroupElement and2 = GroupElementFactory.newAndInstance(); and2.addChild( and1 ); and2.pack(); assertEquals( 2, and2.getChildren().size() ); assertSame( pattern1, and2.getChildren().get( 0 ) ); assertSame( pattern2, and2.getChildren().get( 1 ) ); }
@Test public void testAddSingleBranchAnd() { final GroupElement and1 = GroupElementFactory.newAndInstance(); final Pattern pattern = new Pattern( 0, null ); and1.addChild( pattern ); assertEquals( 1, and1.getChildren().size() ); assertSame( pattern, and1.getChildren().get( 0 ) ); final GroupElement or1 = GroupElementFactory.newOrInstance(); or1.addChild( and1 ); or1.pack(); assertEquals( 1, or1.getChildren().size() ); assertSame( pattern, or1.getChildren().get( 0 ) ); }
@Test public void testAddSingleBranchOr() { final GroupElement or1 = GroupElementFactory.newOrInstance(); final Pattern pattern = new Pattern( 0, null ); or1.addChild( pattern ); assertEquals( 1, or1.getChildren().size() ); assertSame( pattern, or1.getChildren().get( 0 ) ); final GroupElement and1 = GroupElementFactory.newAndInstance(); and1.addChild( or1 ); and1.pack(); assertEquals( 1, and1.getChildren().size() ); assertSame( pattern, and1.getChildren().get( 0 ) ); }
or1.addChild( pattern2 ); final GroupElement and1 = GroupElementFactory.newAndInstance(); and1.addChild( or1 ); assertEquals( 1, or3.getChildren().get( 0 ) ); final GroupElement and2 = GroupElementFactory.newAndInstance(); and2.addChild( or3 );
@Test public void testDeclarationOrdering() { final GroupElement and1 = GroupElementFactory.newAndInstance(); final Pattern pattern1 = new Pattern( 0, new ClassObjectType( Person.class), and1.getChildren().get( 1 ) ); final GroupElement and2 = GroupElementFactory.newAndInstance(); and2.addChild( and1 );
or.addChild( b ); final GroupElement parent = GroupElementFactory.newAndInstance(); parent.addChild( or ); parent.addChild( c );
"d" ); final GroupElement and1 = GroupElementFactory.newAndInstance(); and1.addChild( a ); and1.addChild( b ); final GroupElement and2 = GroupElementFactory.newAndInstance(); and2.addChild( c ); and2.addChild( d );
or1.addChild( pattern2 ); final GroupElement and1 = GroupElementFactory.newAndInstance(); and1.addChild( or1 ); assertEquals( 1, or3.getChildren().get( 0 ) ); final GroupElement and2 = GroupElementFactory.newAndInstance(); and2.addChild( or3 );
final GroupElement and = GroupElementFactory.newAndInstance(); not.addChild( exists ); exists.addChild( and );
"i" ); final GroupElement and1 = GroupElementFactory.newAndInstance(); final GroupElement and2 = GroupElementFactory.newAndInstance(); and1.addChild( a ); and1.addChild( and2 ); and1.addChild( d ); final GroupElement and3 = GroupElementFactory.newAndInstance(); and3.addChild( e ); final GroupElement or1 = GroupElementFactory.newOrInstance(); not3.addChild( i ); final GroupElement root = GroupElementFactory.newAndInstance(); root.addChild( and1 ); root.addChild( and3 );
new ClassObjectType( String.class ) ); final GroupElement lhsroot = GroupElementFactory.newAndInstance(); lhsroot.addChild( c1 ); lhsroot.addChild( c2 );
"h" ); final GroupElement and = GroupElementFactory.newAndInstance(); final GroupElement and1 = GroupElementFactory.newAndInstance(); and1.addChild( a ); final GroupElement or1 = GroupElementFactory.newOrInstance(); and.addChild( or2 ); final GroupElement and2 = GroupElementFactory.newAndInstance(); final GroupElement not1 = GroupElementFactory.newNotInstance(); not1.addChild( f );
"f" ); final GroupElement parent = GroupElementFactory.newAndInstance(); final GroupElement or = GroupElementFactory.newOrInstance(); or.addChild( a );
final GroupElement and = GroupElementFactory.newAndInstance(); and.addChild( a ); and.addChild( b ); or.addChild( d ); and.addChild( or ); final GroupElement and2 = GroupElementFactory.newAndInstance(); and2.addChild( e ); and2.addChild( f );