Пример #1
0
  /** To add this atomic delete/add element to the current state of the world. */
  public void add(State s, Term[] binding, Vector[] delAddList) {
    // -- Apply the binding (and execute the possible code calls) first.
    Predicate p = atom.applySubstitution(binding);

    // -- Try to add the atom to the current state of the world.
    if (s.add(p))
      // -- If the atom was really added to the current state of the world
      // -- (i.e., it wasn't there before), add it to the list of added atoms
      // -- so that in case of a backtrack it can be retracted.
      delAddList[1].add(p);
  }
 // Connect state to the out states of this frag
 // the out states of this frag is updated to be the out states of state
 protected void connect(State state) {
   for (State s : out) {
     s.add(state);
   }
   out = new LinkedHashSet<State>();
   state.updateOutStates(out);
   /*      if (state.next != null) {
     out.addAll(state.next);
   } else {
     out.add(state);
   } */
 }
 // Connect frag f to the out states of this frag
 // the out states of this frag is updated to be the out states of f
 protected void connect(Frag f) {
   for (State s : out) {
     s.add(f.start);
   }
   out = f.out;
 }
 private void build() {
   SIFIR.zeroState = false;
   for (State largeState : zeroStates) {
     largeState.zeroState = true;
   }
   for (int i = 1; i < states1.length; i++) {
     State oneState = states1[i];
     ROOT.add(i, oneState);
   }
   for (int i = 1; i < states10.length; i++) {
     State tenState = states10[i];
     SIFIR.add(i, tenState);
   }
   ROOT.add(0, SIFIR);
   SIFIR.add(0, YUZ);
   YUZ.add(0, BIN_1);
   BIN_1.add(0, BIN_2);
   BIN_2.add(0, BIN_3);
   BIN_3.add(0, MILYON_1);
   MILYON_1.add(0, MILYON_2);
   MILYON_2.add(0, MILYON_3);
   MILYON_3.add(0, MILYAR_1);
   MILYAR_1.add(0, MILYAR_2);
   MILYAR_2.add(0, MILYAR_3);
 }
 void add(ComparableAEH individualHandler) {
   state.add(individualHandler);
 }
Пример #6
0
 private static void createState0(State s) {
   s.add(new Predicate(0, 0, new TermList(TermConstant.getConstant(3), TermList.NIL)));
   s.add(new Predicate(1, 0, new TermList(TermConstant.getConstant(4), TermList.NIL)));
   s.add(new Predicate(1, 0, new TermList(TermConstant.getConstant(3), TermList.NIL)));
   s.add(new Predicate(2, 0, new TermList(TermConstant.getConstant(3), TermList.NIL)));
 }