@Test public void testSize() { this.list.add( this.node1 ); assertEquals( "LinkedList should have 1 node", this.list.size(), 1 ); this.list.add( this.node2 ); assertEquals( "LinkedList should have 2 nodes", this.list.size(), 2 ); this.list.add( this.node3 ); assertEquals( "LinkedList should have 3 nodes", this.list.size(), 3 ); }
protected BetaNodeFieldConstraint[] convertToConstraints(LinkedList list) { final BetaNodeFieldConstraint[] array = new BetaNodeFieldConstraint[list.size()]; int i = 0; for ( LinkedListEntry entry = (LinkedListEntry) list.getFirst(); entry != null; entry = (LinkedListEntry) entry.getNext() ) { array[i++] = (BetaNodeFieldConstraint) entry.getObject(); } return array; } }
public int size() { return this.list.size(); }
public int size() { return this.list.size(); }
public boolean equals(final Object object) { if ( object == this ) { return true; } if ( !(object instanceof LinkedList) ) { return false; } final LinkedList other = (LinkedList) object; if ( this.size() != other.size() ) { return false; } for ( LinkedListNode thisNode = this.firstNode, otherNode = other.firstNode; thisNode != null && otherNode != null; thisNode = thisNode.getNext(), otherNode = otherNode.getNext() ) { if ( !thisNode.equals( otherNode ) ) { return false; } } return true; }
public Activation[] getScheduledActivations() { Activation[] scheduledActivations = new Activation[this.scheduledActivations.size()]; int i = 0; for ( ScheduledAgendaItem node = this.scheduledActivations.getFirst(); node != null; node = node.getNext() ) { scheduledActivations[i++] = node; } return scheduledActivations; }
public Activation[] getActivations() { Activation[] activations = new Activation[ list.size() ]; final Iterator<ActivationNode> it = this.list.iterator(); int i = 0; for ( ActivationNode node = it.next(); node != null; node = it.next() ) { activations[i++] = node.getActivation(); } return activations; }
this.node2 ); assertEquals( "LinkedList should have 3 nodes", this.list.size(), 3 ); assertSame( "First node should be node1",
assertEquals( 2, item1.getBlocked().size() ); assertEquals( 1, item2.getBlockers().size() ); assertEquals( 1, item3.getBlockers().size() ); assertEquals( 2, item1.getBlocked().size() ); assertEquals( 1, item2.getBlocked().size() ); assertEquals( 1, item2.getBlockers().size() ); assertEquals( 2, item3.getBlockers().size() );
public void blockActivation(org.drools.runtime.rule.Activation act) { AgendaItem targetMatch = ( AgendaItem ) act; // iterate to find previous equal logical insertion LogicalDependency dep = null; if ( this.previousJustified != null ) { for ( dep = this.previousJustified.getFirst(); dep != null; dep = dep.getNext() ) { if ( targetMatch == dep.getJustified() ) { this.previousJustified.remove( dep ); break; } } } if ( dep == null ) { dep = new SimpleLogicalDependency( activation, targetMatch ); } this.activation.addBlocked( dep ); if ( targetMatch.getBlockers().size() == 1 && targetMatch.isActive() ) { // it wasn't blocked before, but is now, so we must remove it from all groups, so it cannot be executed. targetMatch.remove(); if ( targetMatch.getActivationGroupNode() != null ) { targetMatch.getActivationGroupNode().getActivationGroup().removeActivation( targetMatch ); } if ( targetMatch.getActivationNode() != null ) { final InternalRuleFlowGroup ruleFlowGroup = (InternalRuleFlowGroup) targetMatch.getActivationNode().getParentContainer(); ruleFlowGroup.removeActivation( targetMatch ); } } }
if ( activation.isCanceled() || ( activation.getBlockers() != null && activation.getBlockers().size() > 0 ) ) {
assertEquals( 0, item2.getBlockers().size() ); assertEquals( 1, item2.getBlocked().size() ); assertEquals(1, item3.getBlockers().size()); assertNull(item3.getBlocked()); assertSame( item2, ((LogicalDependency)item2.getBlocked().getFirst()).getJustifier() ); assertEquals( 0, item3.getBlockers().size() ); assertNull( item3.getBlocked() ); assertEquals( 1, item2.getBlocked().size() ); assertEquals(1, item3.getBlockers().size()); assertNull(item3.getBlocked()); assertSame( item2, ((LogicalDependency)item2.getBlocked().getFirst()).getJustifier() ); assertNull( item3.getBlocked() ); assertEquals( 0, item2.getBlocked().size() ); assertNull( item2.getBlockers() );