@Test public void testOrderFacts() throws Exception { List<InternalFactHandle> list = new ArrayList<InternalFactHandle>(); List<Integer> ids = Arrays.asList(0, 1, 2, 3, 4, 5, 6, 30, 31, 32, -2147483640, 7, 8, 9, 10, 11, 12, 13,14, 15, 28, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27); for(Integer i : ids) { list.add(new DefaultFactHandle(i.intValue(), i)); } InternalFactHandle first = ProtobufOutputMarshaller.orderFacts(list)[0]; assertEquals(-2147483640, first.getId()); }
public static InternalFactHandle[] orderFacts(ObjectStore objectStore) { int size = objectStore.size(); InternalFactHandle[] handles = new InternalFactHandle[size]; int i = 0; for ( Iterator<InternalFactHandle> it = objectStore.iterateFactHandles(); it.hasNext(); ) { handles[i++] = it.next(); } Arrays.sort( handles, new HandleSorter() ); return handles; }
ProtobufOutputMarshaller { public static InternalFactHandle[] orderFacts(ObjectStore objectStore) { int size = objectStore.size(); InternalFactHandle[] handles = new InternalFactHandle[size]; int i = 0; for ( Iterator<InternalFactHandle> it = objectStore.iterateFactHandles(); it.hasNext(); ) { handles[i++] = it.next(); } Arrays.sort( handles, new HandleSorter() ); return handles; } }
ProtobufOutputMarshaller { public static InternalFactHandle[] orderFacts(ObjectStore objectStore) { int size = objectStore.size(); InternalFactHandle[] handles = new InternalFactHandle[size]; int i = 0; for ( Iterator<InternalFactHandle> it = objectStore.iterateFactHandles(); it.hasNext(); ) { handles[i++] = it.next(); } Arrays.sort( handles, new HandleSorter() ); return handles; }  }
ProtobufOutputMarshaller { public static InternalFactHandle[] orderFacts(ObjectStore objectStore) { int size = objectStore.size(); InternalFactHandle[] handles = new InternalFactHandle[size]; int i = 0; for ( Iterator<InternalFactHandle> it = objectStore.iterateFactHandles(); it.hasNext(); ) { handles[i++] = it.next(); } Arrays.sort( handles, new HandleSorter() ); return handles; }  static void writeSession( ProtobufMarshallerWriteContext context); static void writeActionQueue( MarshallerWriteContext context,
                                         ProtobufMessages.RuleData.Builder _session); static void writeTruthMaintenanceSystem( MarshallerWriteContext context,
                                                    EntryPoint wmep,
                                                    ProtobufMessages.EntryPoint.Builder _epb); static InternalFactHandle[] orderFacts(ObjectStore objectStore); static InternalFactHandle[] orderFacts(List<InternalFactHandle> handlesList); static ProtobufMessages.Activation writeActivation( MarshallerWriteContext context,
                                                                                             AgendaItem<M> agendaItem,
                                                                                             boolean isDormient); static Tuple writeTuple( MarshallerWriteContext context, AgendaItem<?> agendaItem, boolean isDormient); static ProtobufMessages.Trigger writeTrigger(Trigger trigger, MarshallerWriteContext outCtx); static void writeWorkItem( MarshallerWriteContext context, WorkItem workItem ); }
ProtobufOutputMarshaller { public static InternalFactHandle[] orderFacts(ObjectStore objectStore) { int size = objectStore.size(); InternalFactHandle[] handles = new InternalFactHandle[size]; int i = 0; for ( Iterator<InternalFactHandle> it = objectStore.iterateFactHandles(); it.hasNext(); ) { handles[i++] = it.next(); } Arrays.sort( handles, new HandleSorter() ); return handles; }  static void writeSession( ProtobufMarshallerWriteContext context); static void writeActionQueue( MarshallerWriteContext context,
                                         ProtobufMessages.RuleData.Builder _session); static void writeTruthMaintenanceSystem( MarshallerWriteContext context,
                                                    EntryPoint wmep,
                                                    ProtobufMessages.EntryPoint.Builder _epb); static InternalFactHandle[] orderFacts(ObjectStore objectStore); static InternalFactHandle[] orderFacts(List<InternalFactHandle> handlesList); static ProtobufMessages.Activation writeActivation( MarshallerWriteContext context,
                                                                                             AgendaItem<M> agendaItem,
                                                                                             boolean isDormient); static Tuple writeTuple( MarshallerWriteContext context, AgendaItem<?> agendaItem, boolean isDormient); static ProtobufMessages.Trigger writeTrigger(Trigger trigger, MarshallerWriteContext outCtx); static void writeWorkItem( MarshallerWriteContext context, WorkItem workItem );  }