Esempio n. 1
0
  public static void writeInitialFactHandleRightTuples(MarshallerWriteContext context)
      throws IOException {
    ObjectOutputStream stream = context.stream;
    InternalRuleBase ruleBase = context.ruleBase;

    ObjectTypeNode initialFactNode =
        ruleBase
            .getRete()
            .getEntryPointNode(EntryPoint.DEFAULT)
            .getObjectTypeNodes()
            .get(ClassObjectType.InitialFact_ObjectType);

    // do we write the fact to the objecttypenode memory
    if (initialFactNode != null) {
      ObjectHashSet initialFactMemory = (ObjectHashSet) context.wm.getNodeMemory(initialFactNode);
      if (initialFactMemory != null && !initialFactMemory.isEmpty()) {
        // context.out.println( "InitialFactMemory true int:" + initialFactNode.getId() );
        stream.writeBoolean(true);
        stream.writeInt(initialFactNode.getId());

        // context.out.println( "InitialFact RightTuples" );
        writeRightTuples(context.wm.getInitialFactHandle(), context);
      } else {
        // context.out.println( "InitialFactMemory false " );
        stream.writeBoolean(false);
      }
    } else {
      // context.out.println( "InitialFactMemory false " );
      stream.writeBoolean(false);
    }
  }
 /* (non-Javadoc)
  * @see org.drools.management.ObjectTypeNodeMonitorMbean#getId()
  */
 public int getId() {
   return node.getId();
 }