lij.model
Class Term

java.lang.Object
  extended by lij.model.Term
All Implemented Interfaces:
Argument

public class Term
extends java.lang.Object
implements Argument

A Term is a definition of the form a(x, y, z, ...) a is the name of the term, and x, y, z, ... are the arguments. A way to envision this is a Java method call, such as add(a, b)

Author:
Nikolaos Chatzinikolaou

Field Summary
private  java.util.ArrayList<Argument> arguments
           
private  java.lang.String name
           
 
Constructor Summary
Term(java.lang.String _name)
          Constructor.
Term(java.lang.String _name, java.util.ArrayList<Argument> _terms)
          Constructor.
 
Method Summary
 java.lang.Object clone()
           
 boolean equals(java.lang.Object other)
           
private  boolean equalsForArgument(Argument arg1, Argument arg2)
          This method performs an equality check between two terms' arguments.
 java.util.ArrayList<Argument> getArguments()
          Accessor.
 java.lang.String getName()
          Accessor.
 int hashCode()
           
private  int hashCodeForArgument(Argument argument)
          Returns a hashcode for the specified Argument.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

private java.lang.String name

arguments

private java.util.ArrayList<Argument> arguments
Constructor Detail

Term

public Term(java.lang.String _name)
Constructor.

Parameters:
_name - The name constant of the term.

Term

public Term(java.lang.String _name,
            java.util.ArrayList<Argument> _terms)
Constructor.

Parameters:
_name - The name constant of the term.
_terms - The arguments of the term.
Method Detail

getName

public java.lang.String getName()
Accessor.

Returns:
The name of the term.

getArguments

public java.util.ArrayList<Argument> getArguments()
Accessor.

Returns:
The list of arguments of the term.

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

equalsForArgument

private boolean equalsForArgument(Argument arg1,
                                  Argument arg2)
This method performs an equality check between two terms' arguments. Note that this method will NOT check whether the actual contents (i.e. value) of the arguments being compared are equal.

Parameters:
arg1 - The first Argument to compare.
arg2 - The second Argument to compare.
Returns:
True, if both Arguments are NOT of class Term. If they are, this method will call the .equals() method on the Term objects.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

hashCodeForArgument

private int hashCodeForArgument(Argument argument)
Returns a hashcode for the specified Argument.

Parameters:
argument - The Argument object.
Returns:
The Argument's hashcode.

clone

public java.lang.Object clone()
Specified by:
clone in interface Argument
Overrides:
clone in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object