Package com.parctechnologies.eclipse
Class CompoundTermImpl
- java.lang.Object
-
- com.parctechnologies.eclipse.AbstractCompoundTerm
-
- com.parctechnologies.eclipse.CompoundTermImpl
-
- All Implemented Interfaces:
CompoundTerm
public class CompoundTermImpl extends AbstractCompoundTerm implements CompoundTerm
An ECLiPSe compound term. This concrete class can be used to construct objects which implement the CompoundTerm interface.- See Also:
CompoundTerm
-
-
Constructor Summary
Constructors Constructor Description CompoundTermImpl(java.lang.Object[] term)
Construct a compound term from an Object array.CompoundTermImpl(java.lang.String functor, java.lang.Object a1)
Convenience constructor for compound terms with arity 1.CompoundTermImpl(java.lang.String functor, java.lang.Object[] args)
Construct a compound term from a String and an Object array.CompoundTermImpl(java.lang.String functor, java.lang.Object a1, java.lang.Object a2)
Convenience constructor for terms with arity 2.CompoundTermImpl(java.lang.String functor, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3)
Convenience constructor for compound terms with arity 3.CompoundTermImpl(java.lang.String functor, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3, java.lang.Object a4)
Convenience constructor for compound terms with arity 4.CompoundTermImpl(java.lang.String functor, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3, java.lang.Object a4, java.lang.Object a5)
Convenience constructor for compound terms with arity 5.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
arg(int i)
Return one of the term's arguments.CompoundTermImpl
argCT(int i)
Return the argument at positioni
, as a CompoundTermImpl.java.lang.String
toString()
-
Methods inherited from class com.parctechnologies.eclipse.AbstractCompoundTerm
arity, equals, functor, hashCode
-
Methods inherited from interface com.parctechnologies.eclipse.CompoundTerm
arity, functor
-
-
-
-
Constructor Detail
-
CompoundTermImpl
public CompoundTermImpl(java.lang.Object[] term)
Construct a compound term from an Object array. In this constructor the functor (which should be a String) is passed in as element 0 of the array parameter, the other arguments, which can be instances of any Java classes/interfaces representing ECLiPSe types, are the remaining elements of the array. The arity is therefore the size of the array - 1.
-
CompoundTermImpl
public CompoundTermImpl(java.lang.String functor, java.lang.Object[] args)
Construct a compound term from a String and an Object array. User supplies functor and an array of argument objects. Arity of the resulting compound term isargs.length
.
-
CompoundTermImpl
public CompoundTermImpl(java.lang.String functor, java.lang.Object a1)
Convenience constructor for compound terms with arity 1.
-
CompoundTermImpl
public CompoundTermImpl(java.lang.String functor, java.lang.Object a1, java.lang.Object a2)
Convenience constructor for terms with arity 2.
-
CompoundTermImpl
public CompoundTermImpl(java.lang.String functor, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3)
Convenience constructor for compound terms with arity 3.
-
CompoundTermImpl
public CompoundTermImpl(java.lang.String functor, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3, java.lang.Object a4)
Convenience constructor for compound terms with arity 4.
-
CompoundTermImpl
public CompoundTermImpl(java.lang.String functor, java.lang.Object a1, java.lang.Object a2, java.lang.Object a3, java.lang.Object a4, java.lang.Object a5)
Convenience constructor for compound terms with arity 5.
-
-
Method Detail
-
arg
public java.lang.Object arg(int i)
Return one of the term's arguments. These may be instances of any Java class/interface representing an ECLiPSe type.- Specified by:
arg
in interfaceCompoundTerm
- Parameters:
i
- the argument index. This may vary between 1 andarity()
inclusive.
-
argCT
public CompoundTermImpl argCT(int i)
Return the argument at positioni
, as a CompoundTermImpl. This operation is the same as arg, except that it tries to cast the result to a CompoundTermImpl. Useful for extracting nested objects: eg.a = result.argCT(1).argCT(3).argCT(3);
- Parameters:
i
- may vary between 1 andarity()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-