コード例 #1
0
  public static InternalFactHandle[] orderFacts(ObjectStore objectStore) {
    // this method is just needed for testing purposes, to allow round tripping
    int size = objectStore.size();
    InternalFactHandle[] handles = new InternalFactHandle[size];
    int i = 0;
    for (Iterator<?> it = objectStore.iterateFactHandles(); it.hasNext(); ) {
      handles[i++] = (InternalFactHandle) it.next();
    }

    Arrays.sort(handles, new HandleSorter());

    return handles;
  }
コード例 #2
0
  public static void readFactHandles(
      MarshallerReaderContext context,
      org.drools.core.marshalling.impl.ProtobufMessages.EntryPoint _ep,
      ObjectStore objectStore,
      List<PropagationContextImpl> pctxs)
      throws IOException, ClassNotFoundException {
    InternalWorkingMemory wm = context.wm;

    SessionEntryPoint entryPoint = context.wm.getEntryPoints().get(_ep.getEntryPointId());
    // load the handles
    for (ProtobufMessages.FactHandle _handle : _ep.getHandleList()) {
      InternalFactHandle handle = readFactHandle(context, entryPoint, _handle);

      context.handles.put(handle.getId(), handle);

      if (!_handle.getIsJustified()) {
        // BeliefSystem handles the Object type
        if (handle.getObject() != null) {
          objectStore.addHandle(handle, handle.getObject());
        }

        // add handle to object type node
        assertHandleIntoOTN(context, wm, handle, pctxs);
      }
    }
  }