standup.unify
Class UnifiableCompound

java.lang.Object
  extended by standup.unify.UnifiableCompound
All Implemented Interfaces:
Unifiable
Direct Known Subclasses:
Precondition

public class UnifiableCompound
extends Object
implements Unifiable

Implementation of compound object. Overrides equals and hashCode appropriately.

Author:
Ruli Manurung

Field Summary
protected  UnifiableList arguments
           
protected  Unifiable functor
           
 
Constructor Summary
UnifiableCompound(Unifiable P, List<? extends Unifiable> A)
           
UnifiableCompound(Unifiable P, UnifiableList A)
           
 
Method Summary
static UnifiableList doArguments(Element element)
          Returns a UnifiableList of the arguments encoded in an XML element.
 UnifiableCompound duplicate()
          Returns a deep copy of this UnifiableCompound.
 boolean equals(Object obj)
           
 UnifiableList getArguments()
           
 int getArity()
           
 Unifiable getFunctor()
           
 int hashCode()
           
static UnifiableCompound readXML(Element element)
          Returns a UnifiableCompound encoded in an XML element.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

functor

protected Unifiable functor

arguments

protected UnifiableList arguments
Constructor Detail

UnifiableCompound

public UnifiableCompound(Unifiable P,
                         UnifiableList A)

UnifiableCompound

public UnifiableCompound(Unifiable P,
                         List<? extends Unifiable> A)
Method Detail

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

getFunctor

public Unifiable getFunctor()

getArity

public int getArity()

getArguments

public UnifiableList getArguments()

toString

public String toString()
Overrides:
toString in class Object

duplicate

public UnifiableCompound duplicate()
Returns a deep copy of this UnifiableCompound.

Specified by:
duplicate in interface Unifiable
See Also:
Unifiable.duplicate()

readXML

public static UnifiableCompound readXML(Element element)
Returns a UnifiableCompound encoded in an XML element. The functor can be either a Variable or a string Constant, and there are restrictions on the arguments (see doArguments(Element)).

Parameters:
element -
Returns:
UnifiableCompound encoded by given XML element.

doArguments

public static UnifiableList doArguments(Element element)
Returns a UnifiableList of the arguments encoded in an XML element. Currently it does not handle embedded lists or arbitrary constant values: arguments can be either Variables, string Constants, or Compounds (whose arguments can be either Variables, string Constants, or similar Compounds).

Parameters:
element -
Returns:
UnifiableList of arguments.