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:
  • Constructor Details

    • CompoundTermImpl

      public CompoundTermImpl(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(String functor, 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 is args.length.
    • CompoundTermImpl

      public CompoundTermImpl(String functor, Object a1)
      Convenience constructor for compound terms with arity 1.
    • CompoundTermImpl

      public CompoundTermImpl(String functor, Object a1, Object a2)
      Convenience constructor for terms with arity 2.
    • CompoundTermImpl

      public CompoundTermImpl(String functor, Object a1, Object a2, Object a3)
      Convenience constructor for compound terms with arity 3.
    • CompoundTermImpl

      public CompoundTermImpl(String functor, Object a1, Object a2, Object a3, Object a4)
      Convenience constructor for compound terms with arity 4.
    • CompoundTermImpl

      public CompoundTermImpl(String functor, Object a1, Object a2, Object a3, Object a4, Object a5)
      Convenience constructor for compound terms with arity 5.
  • Method Details

    • arg

      public 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 interface CompoundTerm
      Parameters:
      i - the argument index. This may vary between 1 and arity() inclusive.
    • argCT

      public CompoundTermImpl argCT(int i)
      Return the argument at position i, 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 and arity()
    • toString

      public String toString()
      Overrides:
      toString in class Object