public boolean equals( Object other ) { if ( other != null && getClass().equals( other.getClass() ) ) { RuleAtom atom = ( RuleAtom ) other; return getPredicate().equals( atom.getPredicate() ) && getAllArguments().equals( atom.getAllArguments() ); } return false; }
public boolean equals( Object other ) { if ( other != null && getClass().equals( other.getClass() ) ) { RuleAtom atom = ( RuleAtom ) other; return getPredicate().equals( atom.getPredicate() ) && getAllArguments().equals( atom.getAllArguments() ); } return false; }
private static NodeProvider createNodeProvider(AtomVariable arg, List<RuleAtom> processed, boolean lastWME) { for (int index = 0, n = processed.size(); index < n; index++) { RuleAtom sharedAtom = processed.get(index); int indexArg = sharedAtom.getAllArguments().indexOf(arg); if (indexArg != -1) { if (lastWME && index == n -1) { return new WMENodeProvider(indexArg); } else { return new TokenNodeProvider(index, indexArg); } } } return null; }
private RuleAtom pickNextAtom(List<RuleAtom> atoms, Set<AtomVariable> bound) { int index = 0; if (bound.isEmpty()) { for (int i = 0; i < atoms.size(); i++) { RuleAtom atom = atoms.get(i); if (safetyChecker.isSafe(atom)) { return atoms.remove(i); } } } else { for (int i = 0; i < atoms.size(); i++) { RuleAtom atom = atoms.get(i); if (SetUtils.intersects(bound, atom.getAllArguments())) { index = i; if (safetyChecker.isSafe(atom)) { break; } } } } return atoms.remove(index); }
/** * Static convenience function to return the instance variables used * in the given atom. */ public static Collection<AtomIVariable> getIVars(RuleAtom atom) { VisitingICollector collector = new VisitingICollector(); for( AtomObject obj : atom.getAllArguments() ) { obj.accept( collector ); } return collector.getVariables(); }
/** * Static convenience function to return the variables used * in the given atom. */ public static Collection<AtomVariable> getVars(RuleAtom atom) { VisitingCollector collector = new VisitingCollector(); for( AtomObject obj : atom.getAllArguments() ) { obj.accept( collector ); } return collector.getVariables(); }
/** * Static convenience function to return the variables used * in the given atom. */ public static Collection<AtomVariable> getVars(RuleAtom atom) { VisitingCollector collector = new VisitingCollector(); for( AtomObject obj : atom.getAllArguments() ) { obj.accept( collector ); } return collector.getVariables(); }
/** * Static convenience function to return the instance variables used * in the given atom. */ public static Collection<AtomIVariable> getIVars(RuleAtom atom) { VisitingICollector collector = new VisitingICollector(); for( AtomObject obj : atom.getAllArguments() ) { obj.accept( collector ); } return collector.getVariables(); }
/** * Static convenience function to return the instance variables used * in the given atom. */ public static Collection<AtomDVariable> getDVars(RuleAtom atom) { VisitingDCollector collector = new VisitingDCollector(); for( AtomObject obj : atom.getAllArguments() ) { obj.accept( collector ); } return collector.getVariables(); }
/** * Static convenience function to return the instance variables used * in the given atom. */ public static Collection<AtomDVariable> getDVars(RuleAtom atom) { VisitingDCollector collector = new VisitingDCollector(); for( AtomObject obj : atom.getAllArguments() ) { obj.accept( collector ); } return collector.getVariables(); }
List<? extends AtomObject> args = atom.getAllArguments(); Map<AtomVariable, NodeProvider> args = new HashMap<AtomVariable, NodeProvider>(); for (int i = 0; i < lastSafe; i++) { for (AtomObject arg : processed.get(i).getAllArguments()) { if (arg instanceof AtomVariable && !args.containsKey(arg)) { args.put((AtomVariable) arg, createNodeProvider((AtomVariable) arg, processed));