standup.unify
Class UnifiableCompound
java.lang.Object
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
functor
protected Unifiable functor
arguments
protected UnifiableList arguments
UnifiableCompound
public UnifiableCompound(Unifiable P,
UnifiableList A)
UnifiableCompound
public UnifiableCompound(Unifiable P,
List<? extends Unifiable> A)
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 Variable
s,
string Constant
s, or Compound
s (whose
arguments can be either Variable
s, string
Constant
s, or similar Compound
s).
- Parameters:
element
-
- Returns:
UnifiableList
of arguments.