com.irs.jam
Class Relation

java.lang.Object
  |
  +--com.irs.jam.Relation
All Implemented Interfaces:
java.io.Serializable

public class Relation
extends java.lang.Object
implements java.io.Serializable

Represents an pair

See Also:
Serialized Form

Field Summary
protected  ExpList _args
           
protected  int _arity
           
protected  int _ID
           
protected  Interpreter _interpreter
           
 
Constructor Summary
Relation(Relation r, Binding binding, Interpreter interpreter)
          Name and binding constructor
Relation(java.lang.String s, ExpList expList, Interpreter interpreter)
          Name and parameter list constructor
Relation(java.lang.String s, Interpreter interpreter)
          Basic, name-only constructor
 
Method Summary
 Relation evalArgs(Binding b)
          Convert all variables elements of the relation into constants
 void format(java.io.PrintStream s, Binding b)
          Format the output so that it's conducive to being printed out in-line with other information.
 ExpList getArgs()
           
 int getArity()
           
 int getID()
           
 java.lang.String getName()
          Return the relation's string label
 void print(java.io.PrintStream s, Binding b)
          Format the output and don't worry about being printed out in-line with other information.
 boolean unify(Relation dstRelation, Binding dstBinding, Relation srcRelation, Binding srcBinding)
          If the source & the destination relations do not match, return false.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_ID

protected int _ID

_args

protected ExpList _args

_arity

protected int _arity

_interpreter

protected Interpreter _interpreter
Constructor Detail

Relation

public Relation(java.lang.String s,
                Interpreter interpreter)
Basic, name-only constructor

Relation

public Relation(java.lang.String s,
                ExpList expList,
                Interpreter interpreter)
Name and parameter list constructor

Relation

public Relation(Relation r,
                Binding binding,
                Interpreter interpreter)
Name and binding constructor
Method Detail

getArity

public int getArity()

getID

public int getID()

getArgs

public ExpList getArgs()

getName

public java.lang.String getName()
Return the relation's string label

evalArgs

public Relation evalArgs(Binding b)
Convert all variables elements of the relation into constants

print

public void print(java.io.PrintStream s,
                  Binding b)
Format the output and don't worry about being printed out in-line with other information.

format

public void format(java.io.PrintStream s,
                   Binding b)
Format the output so that it's conducive to being printed out in-line with other information.

unify

public boolean unify(Relation dstRelation,
                     Binding dstBinding,
                     Relation srcRelation,
                     Binding srcBinding)
If the source & the destination relations do not match, return false. Otherwise change the destination binding with linked variables to the source relation binding and return true.