static String encodeName(Term t) {
   return encodeName(t.getName());
 }
Ejemplo n.º 2
0
 /**
  * Returns {@code true} if the specified {@link Term} represent a conjunction, else {@code false}.
  *
  * <p>A {@link Term} is judged to represent a conjunction if is a structure with a functor of
  * {@link #CONJUNCTION_PREDICATE_NAME} and exactly two arguments.
  */
 public static boolean isConjunction(Term t) {
   // is relying on assumption that conjunctions are only, and always, represented by a comma
   return t.getType() == TermType.STRUCTURE
       && CONJUNCTION_PREDICATE_NAME.equals(t.getName())
       && t.getArgs().length == 2;
 }
Ejemplo n.º 3
0
 /**
  * Returns {@code true} if the specified {@link Term} represents a question or directive, else
  * {@code false}.
  *
  * <p>A {@link Term} is judged to represent a question if it is a structure a single argument and
  * with a functor {@link #QUESTION_PREDICATE_NAME} or {@link #IMPLICATION_PREDICATE_NAME}.
  */
 public static boolean isQuestionOrDirectiveFunctionCall(Term t) {
   return t.getType() == TermType.STRUCTURE
       && t.getNumberOfArguments() == 1
       && (QUESTION_PREDICATE_NAME.equals(t.getName())
           || IMPLICATION_PREDICATE_NAME.equals(t.getName()));
 }
Ejemplo n.º 4
0
 /**
  * Returns {@code true} if the specified {@link Term} represent a {@code dynamic} function call,
  * else {@code false}.
  *
  * <p>A {@link Term} is judged to represent a dynamic function call (i.e. a request to mark a user
  * defined predicate as "dynamic") if it is a structure with a functor of {@code dynamic} and a
  * single argument.
  */
 public static boolean isDynamicFunctionCall(Term t) {
   return "dynamic".equals(t.getName()) && t.getNumberOfArguments() == 1;
 }