Algernon Software

org.algernon.datatype
Class Clause

java.lang.Object
  extended byorg.jatha.dynatype.StandardLispValue
      extended byorg.algernon.datatype.Clause
All Implemented Interfaces:
Comparable, Displayable, LispValue

public class Clause
extends StandardLispValue
implements Displayable


Field Summary
protected  Algernon f_algy
           
protected  LispValue f_clause
           
 
Fields inherited from class org.jatha.dynatype.StandardLispValue
f_lisp
 
Constructor Summary
Clause(Algernon algy, LispValue clause)
          Creates a new clause.
Clause(Algernon algy, String clause)
          Creates a new clause.
 
Method Summary
 Clause copyClause()
          Returns a new clause that is a copy of this one.
 String display(PrintStream out)
          Displayable interface
 Algernon getAlgernon()
          Returns the instance of Algernon that this Clause belongs to.
 LispValue getArguments()
          Returns the arguments of the clause (all elements except the first).
 LispValue getClause()
           
 LispValue getFrame()
          Returns the frame of the clause (the element in the second position).
 LispValue getRelation()
          Returns the relation of the clause (the element in the first position).
 LispValue getSlot()
          Returns the slot of the clause, which is the first element if performing the traditional mapping from predicates to frames.
 LispValue getValues()
          Returns the values of the clause, which is all but the first two elements if performing the traditional mapping from predicates to frames.
 BindingList getVariableArguments()
          Returns a BindingList of the arguments in the clause that are variables.
 boolean isGround()
          Returns true if the clause contains no variables.
 boolean isNegated()
          Returns true if the clause is negated, that is, if it has the form (NOT [clause]).
 Clause negateClause()
          Returns a negated form of the clause.
 void setClause(LispValue newClause)
           
 int size()
          Returns the size of the clause.
 String toString()
          Returns a string representation of the clause.
 boolean willBeGround(BindingList blist)
          Returns true if the clause will be ground if the given set of variables is bound at runtime.
 
Methods inherited from class org.jatha.dynatype.StandardLispValue
abs, acos, add, adjustSpecialCount, append, apply, apropos_print, asin, assoc, atan, atan2, atom, basic_atom, basic_bignump, basic_consp, basic_constantp, basic_floatp, basic_foreignp, basic_functionp, basic_integerp, basic_keywordp, basic_length, basic_listp, basic_macrop, basic_null, basic_numberp, basic_stringp, basic_symbolp, bignump, boundp, butlast, car, cdr, ceiling, characterp, clrhash, compareTo, concatenate, consp, constantp, contains, copy_list, copy, cos, cot, csc, degreesToRadians, divide, eighth, elt, elt, eq, eql, equal, equalNumeric, factorial, fboundp, fifth, first, floatp, floor, fourth, funcall, functionp, get_specialCount, gethash, gethash, getLisp, greaterThan, greaterThanOrEqual, hash_table_count, hash_table_rehash_size, hash_table_rehash_threshold, hash_table_size, hash_table_test, hashtablep, integerp, internal_getName, internal_prin1_as_cdr, internal_prin1, internal_princ_as_cdr, internal_princ, internal_print_as_cdr, internal_print, iterator, keywordp, last, length, lessThan, lessThanOrEqual, lisp_null, list, listp, max, member, min, multiply, nconc, negate, neql, ninth, nreverse, nstringCapitalize, nstringDowncase, nstringUpcase, numberp, pop, position, prin1, princ, print, push, radiansToDegrees, rassoc, reciprocal, remhash, remove, rest, reverse, rplaca, rplacd, sec, second, set_special, setf_gethash, setf_symbol_function, setf_symbol_plist, setf_symbol_value, setLisp, setPackage, setq, seventh, sin, sixth, specialP, sqrt, string, stringCapitalize, stringDowncase, stringEndsWith, stringEq, stringEqual, stringGreaterP, stringGreaterThan, stringGreaterThanOrEqual, stringLeftTrim, stringLeftTrim, stringLessP, stringLessThan, stringLessThanOrEqual, stringNeq, stringNotGreaterP, stringNotLessP, stringp, stringRightTrim, stringRightTrim, stringStartsWith, stringTrim, stringTrim, stringUpcase, subst, substring, substring, subtract, symbol_function, symbol_name, symbol_package, symbol_plist, symbol_value, symbolp, tan, tenth, third, toCollection, toJava, toJava, toString, toStringAsCdr_internal, toStringAsCdr, toStringShort, toStringShort, toStringSimple, type_of, typep, zerop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

f_algy

protected Algernon f_algy

f_clause

protected LispValue f_clause
Constructor Detail

Clause

public Clause(Algernon algy,
              String clause)
Creates a new clause. Send in a String or a LispValue representing the clause in LISP format.


Clause

public Clause(Algernon algy,
              LispValue clause)
       throws AlgernonDataException
Creates a new clause. Send in a String or a LispValue representing the clause in LISP format.

Method Detail

getClause

public LispValue getClause()

setClause

public void setClause(LispValue newClause)

copyClause

public Clause copyClause()
Returns a new clause that is a copy of this one.


toString

public String toString()
Returns a string representation of the clause.

Specified by:
toString in interface LispValue

display

public String display(PrintStream out)
Displayable interface

Specified by:
display in interface Displayable

getRelation

public LispValue getRelation()
Returns the relation of the clause (the element in the first position).


getFrame

public LispValue getFrame()
Returns the frame of the clause (the element in the second position).


getArguments

public LispValue getArguments()
Returns the arguments of the clause (all elements except the first).


getSlot

public LispValue getSlot()
Returns the slot of the clause, which is the first element if performing the traditional mapping from predicates to frames.


getValues

public LispValue getValues()
Returns the values of the clause, which is all but the first two elements if performing the traditional mapping from predicates to frames.


size

public int size()
Returns the size of the clause. Normally this returns 3: a binary relation has two arguments, plus the relation itself.


negateClause

public Clause negateClause()
                    throws AlgernonDataException
Returns a negated form of the clause.

Throws:
AlgernonDataException

isGround

public boolean isGround()
Returns true if the clause contains no variables.


willBeGround

public boolean willBeGround(BindingList blist)
Returns true if the clause will be ground if the given set of variables is bound at runtime.


isNegated

public boolean isNegated()
Returns true if the clause is negated, that is, if it has the form (NOT [clause]).


getVariableArguments

public BindingList getVariableArguments()
                                 throws AlgernonDataException
Returns a BindingList of the arguments in the clause that are variables.

Throws:
AlgernonDataException

getAlgernon

public Algernon getAlgernon()
Returns the instance of Algernon that this Clause belongs to.


Algernon Software