Class ConfEList

Object
com.tailf.proto.ConfEObject
com.tailf.proto.ConfEList
All Implemented Interfaces:
Serializable, Cloneable

public class ConfEList extends ConfEObject implements Serializable, Cloneable
Provides a Java representation of E lists. Lists are created from zero or more arbitrary E terms.

The arity of the list is the number of elements it contains.

See Also:
  • Constructor Details

    • ConfEList

      public ConfEList()
      Create an empty list.
    • ConfEList

      public ConfEList(String str)
      Create a list of characters.
      Parameters:
      str - the characters from which to create the list.
    • ConfEList

      public ConfEList(ConfEObject elem)
      Create a list containing one element.
      Parameters:
      elem - the element to make the list from.
    • ConfEList

      public ConfEList(ConfEObject[] elems)
      Create a list from an array of arbitrary E terms.
      Parameters:
      elems - the array of terms from which to create the list.
    • ConfEList

      public ConfEList(ConfEObject[] elems, int start, int count)
      Create a list from an array of arbitrary E terms.
      Parameters:
      elems - the array of terms from which to create the list.
      start - the offset of the first term to insert.
      count - the number of terms to insert.
    • ConfEList

      public ConfEList(ConfInputStream buf) throws ConfEDecodeException
      Create a list from a stream containing an list encoded in E external format.
      Parameters:
      buf - the stream containing the encoded list.
      Throws:
      ConfEDecodeException - if the buffer does not contain a valid external representation of an E list.
  • Method Details

    • proper

      public boolean proper()
    • setProper

      public void setProper(boolean p)
    • arity

      public int arity()
      Get the arity of the list.
      Returns:
      the number of elements contained in the list.
    • elementAt

      public ConfEObject elementAt(int i)
      Get the specified element from the list.
      Parameters:
      i - the index of the requested element. List elements are numbered as array elements, starting at 0.
      Returns:
      the requested element, of null if i is not a valid element index.
    • elements

      public ConfEObject[] elements()
      Get all the elements from the list as an array.
      Returns:
      an array containing all of the list's elements.
    • reverse

      public ConfEList reverse()
    • toString

      public String toString()
      Get the string representation of the list.
      Specified by:
      toString in class ConfEObject
      Returns:
      the string representation of the list.
    • encode

      public void encode(ConfOutputStream buf)
      Convert this list to the equivalent E external representation. Note that this method never encodes lists as strings, even when it is possible to do so.
      Specified by:
      encode in class ConfEObject
      Parameters:
      buf - An output stream to which the encoded list should be written.
    • equals

      public boolean equals(Object o)
      Determine if two lists are equal. Lists are equal if they have the same arity and all of the elements are equal.
      Specified by:
      equals in class ConfEObject
      Parameters:
      o - the list to compare to.
      Returns:
      true if the lists have the same arity and all the elements are equal.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • clone

      public Object clone()
      Overrides:
      clone in class ConfEObject