Examples of Chain


Examples of aima.core.logic.fol.kb.data.Chain

        AtomicSentence atom = (AtomicSentence) substVisitor.subst(
            renameSubstitution, l.getAtomicSentence());
        lits.add(l.newInstance(atom));
      }

      Chain renamed = new Chain(lits);

      renamed.setProofStep(new ProofStepRenaming(renamed, chain
          .getProofStep()));

      return renamed;
    }
View Full Code Here

Examples of aima.core.logic.fol.kb.data.Chain

  //
  private List<Chain> createChainsFromClauses(Set<Clause> clauses) {
    List<Chain> chains = new ArrayList<Chain>();

    for (Clause c : clauses) {
      Chain chn = new Chain(c.getLiterals());
      chn.setProofStep(new ProofStepChainFromClause(chn, c));
      chains.add(chn);
      chains.addAll(chn.getContrapositives());
    }

    return chains;
  }
View Full Code Here

Examples of aima.core.logic.fol.kb.data.Chain

      if (ansHandler.isComplete()) {
        break;
      }

      // Reduction
      Chain nextNearParent = indexedFarParents.attemptReduction(
          nearParent, farParentIdx);

      if (null == nextNearParent) {
        // Unable to remove the head via reduction
        continue;
      }

      // Handle Canceling and Dropping
      boolean cancelled = false;
      boolean dropped = false;
      do {
        cancelled = false;
        Chain nextParent = null;
        while (nextNearParent != (nextParent = tryCancellation(nextNearParent))) {
          nextNearParent = nextParent;
          cancelled = true;
        }
View Full Code Here

Examples of aima.core.logic.fol.kb.data.Chain

              for (Literal lfc : c.getTail()) {
                AtomicSentence a = (AtomicSentence) substVisitor
                    .subst(subst, lfc.getAtomicSentence());
                cancLits.add(lfc.newInstance(a));
              }
              Chain cancellation = new Chain(cancLits);
              cancellation
                  .setProofStep(new ProofStepChainCancellation(
                      cancellation, c, subst));
              return cancellation;
            }
          }
View Full Code Here

Examples of aima.core.logic.fol.kb.data.Chain

  // Returns c if no dropping occurred
  private Chain tryDropping(Chain c) {
    Literal head = c.getHead();
    if (null != head && (head instanceof ReducedLiteral)) {
      Chain dropped = new Chain(c.getTail());
      dropped.setProofStep(new ProofStepChainDropped(dropped, c));
      return dropped;
    }

    return c;
  }
View Full Code Here

Examples of aima.core.logic.fol.kb.data.Chain

    }
    return 0;
  }

  public Chain attemptReduction(Chain nearParent, int farParentIndex) {
    Chain nnpc = null;

    Literal nearLiteral = nearParent.getHead();

    Map<String, List<Chain>> candidateHeads = null;
    if (nearLiteral.isPositiveLiteral()) {
      candidateHeads = negHeads;
    } else {
      candidateHeads = posHeads;
    }

    AtomicSentence nearAtom = nearLiteral.getAtomicSentence();
    String nearestKey = nearAtom.getSymbolicName();
    List<Chain> farParents = candidateHeads.get(nearestKey);
    if (null != farParents) {
      Chain farParent = farParents.get(farParentIndex);
      standardizeApart(farParent);
      Literal farLiteral = farParent.getHead();
      AtomicSentence farAtom = farLiteral.getAtomicSentence();
      Map<Variable, Term> subst = unifier.unify(nearAtom, farAtom);

      // If I was able to unify with one
      // of the far heads
      if (null != subst) {
        // Want to always apply reduction uniformly
        Chain topChain = farParent;
        Literal botLit = nearLiteral;
        Chain botChain = nearParent;

        // Need to apply subst to all of the
        // literals in the reduction
        List<Literal> reduction = new ArrayList<Literal>();
        for (Literal l : topChain.getTail()) {
          AtomicSentence atom = (AtomicSentence) substVisitor.subst(
              subst, l.getAtomicSentence());
          reduction.add(l.newInstance(atom));
        }
        reduction.add(new ReducedLiteral((AtomicSentence) substVisitor
            .subst(subst, botLit.getAtomicSentence()), botLit
            .isNegativeLiteral()));
        for (Literal l : botChain.getTail()) {
          AtomicSentence atom = (AtomicSentence) substVisitor.subst(
              subst, l.getAtomicSentence());
          reduction.add(l.newInstance(atom));
        }

        nnpc = new Chain(reduction);
        nnpc.setProofStep(new ProofStepChainReduction(nnpc, nearParent,
            farParent, subst));
      }
    }
View Full Code Here

Examples of aima.core.logic.fol.kb.data.Chain

    return nnpc;
  }

  public Chain addToIndex(Chain c) {
    Chain added = null;
    Literal head = c.getHead();
    if (null != head) {
      Map<String, List<Chain>> toAddTo = null;
      if (head.isPositiveLiteral()) {
        toAddTo = posHeads;
View Full Code Here

Examples of com.calclab.suco.client.ioc.decorator.Chain

    @SuppressWarnings("unchecked")
    @Test
    public void testChain() {
  final Decorator d1 = mock(Decorator.class);
  final Decorator d2 = mock(Decorator.class);
  final Chain chain = new Chain(d1, d2);
  chain.decorate(null, null);
  verify(d1).decorate((Class) anyObject(), (Provider) anyObject());
    }
View Full Code Here

Examples of com.dotmarketing.portlets.chains.model.Chain

    chainFactory.deleteChainState(s);
  }
 
  public void saveChain(Chain chain, List<ChainState> states) throws DotDataException, DotCacheException, DuplicateChainStateParametersException, ChainAlreadyExistsException {

    Chain oldChain = loadChainByKey(chain.getKey());
    if(oldChain != null && oldChain.getId() != chain.getId())
      throw new ChainAlreadyExistsException("A chain with this same key = " + chain.getKey() + " already exists on the sytem.");
   
    //Checking the parameters before save
    List<ChainStateParameter> duplicatedStateParameters = new ArrayList<ChainStateParameter>();
    for(ChainState state : states) {
View Full Code Here

Examples of com.evelopers.unimod.glayout.graph.containers.Chain

    /*
     * unoriented method
     */
    private static Chain getTowardsPathUnOri(Face f, SimpleEdge e, SimpleVertex source,
                                             SimpleVertex target) {
        Chain res = new Chain(f.getGraph());
        res.addEdge(e);

        SimpleEdge curre = e;
        res.addVertex(source);

        SimpleVertex curr = e.getAnother(source);
        res.addVertex(curr);

        while (curr != target) {
            SimpleEdge tmp;

            if (curr.getEdgesRelative(f)
                        .get(0) == curre) {
                tmp = (SimpleEdge) curr.getEdgesRelative(f)
                                       .get(1);
            } else {
                tmp = (SimpleEdge) curr.getEdgesRelative(f)
                                       .get(0);
            }

            res.addEdge(tmp);
            curr = tmp.getAnother(curr);
            res.addVertex(curr);
            curre = tmp;
        }

        return res;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.