/** {@inheritDoc} */ public int internFunctorName(String name, int numArgs) { return interner.internFunctorName(name, numArgs); }
/** {@inheritDoc} */ public int internFunctorName(FunctorName name) { return interner.internFunctorName(name); }
/** {@inheritDoc} */ public int internFunctorName(FunctorName name) { return interner.internFunctorName(name); }
/** {@inheritDoc} */ public int internFunctorName(String name, int numArgs) { return interner.internFunctorName(name, numArgs); }
/** * 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 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); }
/** * Writes out the instruction plus arguments in the byte code format to the specified location within a code * buffer. * * @param codeBuf The code buffer to write to. * @param code The instruction mnemonic. * @param instruction The instruction, including its arguments. * @param interner The binary machine to write the code into. */ private static void emmitCodeFn(ByteBuffer codeBuf, byte code, WAMInstruction instruction, VariableAndFunctorInterner interner) { codeBuf.put(code); int arity = instruction.fn.getArity() << 24; int name = interner.internFunctorName(instruction.fn) & 0x00ffffff; codeBuf.putInt(arity | name); }
/** * Writes out the instruction plus arguments in the byte code format to the specified location within a code * buffer. * * @param codeBuf The code buffer to write to. * @param code The instruction mnemonic. * @param instruction The instruction, including its arguments. * @param interner The binary machine to write the code into. */ private static void emmitCodeReg1Fn(ByteBuffer codeBuf, byte code, WAMInstruction instruction, VariableAndFunctorInterner interner) { codeBuf.put(code); codeBuf.put(instruction.mode1); codeBuf.put(instruction.reg1); int arity = instruction.fn.getArity() << 24; int name = interner.internFunctorName(instruction.fn) & 0x00ffffff; codeBuf.putInt(arity | name); }
/** * Interns an operators name as a functor of appropriate arity for the operators fixity, and sets the operator in * the operator table. * * @param operatorName The name of the operator to create. * @param priority The priority of the operator, zero unsets it. * @param associativity The operators associativity. */ public void internOperator(String operatorName, int priority, OpSymbol.Associativity associativity) { int arity; if ((associativity == XFY) | (associativity == YFX) | (associativity == XFX)) { arity = 2; } else { arity = 1; } int name = interner.internFunctorName(operatorName, arity); operatorTable.setOperator(name, operatorName, priority, associativity); }
/** * Interns an operators name as a functor of appropriate arity for the operators fixity, and sets the operator in * the operator table. * * @param operatorName The name of the operator to create. * @param priority The priority of the operator, zero unsets it. * @param associativity The operators associativity. */ public void internOperator(String operatorName, int priority, OpSymbol.Associativity associativity) { int arity; if ((associativity == XFY) | (associativity == YFX) | (associativity == XFX)) { arity = 2; } else { arity = 1; } int name = interner.internFunctorName(operatorName, arity); operatorTable.setOperator(name, operatorName, priority, associativity); }
int id = interner.internFunctorName(fieldType, 0);
int nameId = interner.internFunctorName(candidate.getTextName(), 0); result = new Functor(nameId, null);
int nameId = interner.internFunctorName(candidate.getTextName(), 0); 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; }
/** {@inheritDoc} */ public boolean proofStep(ResolutionState state) { // Flatten the head goal on the disjunction operator to produce a series of choice points. Functor goalTerm = state.getGoalStack().poll().getFunctor(); disjuncts = TermUtils.flattenTerm(goalTerm, Functor.class, state.getInterner().internFunctorName(";", 2)); return true; }
int nameId = interner.internFunctorName(name.image, 0); result = new Functor(nameId, null);
int nameId = interner.internFunctorName(name.image, 0); result = new Functor(nameId, null);