/** * Creates an atom (functor with no arguments). * * @param name The name of the atom. * * @return An atom. */ public Functor atom(String name) { int internedName = interner.internFunctorName(name, 0); return new Functor(internedName, null); }
/** * Creates a cut built-in to implement the specified functor. * * @param functor The functor to implement as a built-in. * @param defaultBuiltIn The default built in, for standard compilation and interners and symbol tables. */ public Cut(Functor functor, DefaultBuiltIn defaultBuiltIn) { // Here the cut functor is transformed from ! to !(Y), where Y is a level variable that may be needed // to hold the current choice point. super(new Functor(functor.getName(), new Term[] { CutLevelVariable.CUT_LEVEL_VARIABLE }), defaultBuiltIn); }
/** * Creates an atom (functor with no arguments). * * @param name The name of the atom. * * @return An atom. */ public Functor atom(String name) { int internedName = interner.internFunctorName(name, 0); return new Functor(internedName, null); }
/** * Creates a functor. * * @param name The name of the functor. * @param args The functors arguments. * * @return A functor. */ public Functor functor(String name, Term... args) { int internedName = interner.internFunctorName(name, args.length); return new Functor(internedName, args); }
/** * Creates a functor. * * @param name The name of the functor. * @param args The functors arguments. * * @return A functor. */ public Functor functor(String name, Term... args) { int internedName = interner.internFunctorName(name, args.length); return new Functor(internedName, args); }
return new Functor(id, null);
return new Functor(id, null);
return new Functor(id, null);
result = new Functor(nameId, null);
result = new Functor(nameId, null);
/** * Parses a single functor in first order logic with its arguments. * * @return A single functor in first order logic with its arguments. * * @throws SourceCodeException If the token sequence does not parse as a valid functor. */ public Term functor() throws SourceCodeException { Token name = consumeToken(FUNCTOR); Term[] args = arglist(); consumeToken(RPAREN); int nameId = interner.internFunctorName((args == null) ? name.image : name.image.substring(0, name.image.length() - 1), (args == null) ? 0 : args.length); Functor result = new Functor(nameId, args); SourceCodePosition position = new SourceCodePositionImpl(name.beginLine, name.beginColumn, name.endLine, name.endColumn); result.setSourceCodePosition(position); return result; }
/** * Parses a single functor in first order logic with its arguments. * * @return A single functor in first order logic with its arguments. * * @throws SourceCodeException If the token sequence does not parse as a valid functor. */ public Functor functor() throws SourceCodeException { Token name = consumeToken(FUNCTOR); Term[] args = arglist(); consumeToken(RPAREN); int nameId = interner.internFunctorName((args == null) ? name.image : name.image.substring(0, name.image.length() - 1), (args == null) ? 0 : args.length); Functor result = new Functor(nameId, args); SourceCodePosition position = new SourceCodePositionImpl(name.beginLine, name.beginColumn, name.endLine, name.endColumn); result.setSourceCodePosition(position); return result; }
result = new Functor(nameId, null);
result = new Functor(nameId, null);