Module org.cloudi

Class OtpErlangList

    • Constructor Detail

      • OtpErlangList

        public OtpErlangList()
        Create an empty list.
      • OtpErlangList

        public OtpErlangList​(String str)
        Create a list of Erlang integers representing Unicode codePoints. This method does not check if the string contains valid code points.
        Parameters:
        str - the characters from which to create the list.
      • OtpErlangList

        public OtpErlangList​(OtpErlangObject elem)
        Create a list containing one element.
        Parameters:
        elem - the elememet to make the list from.
      • OtpErlangList

        public OtpErlangList​(OtpErlangObject[] elems)
        Create a list from an array of arbitrary Erlang terms.
        Parameters:
        elems - the array of terms from which to create the list.
      • OtpErlangList

        public OtpErlangList​(OtpErlangObject[] elems,
                             OtpErlangObject lastTail)
                      throws OtpErlangException
        Create a list from an array of arbitrary Erlang terms. Tail can be specified, if not null, the list will not be proper.
        Parameters:
        elems - array of terms from which to create the list
        lastTail -
        Throws:
        OtpErlangException
      • OtpErlangList

        public OtpErlangList​(OtpErlangObject[] elems,
                             int start,
                             int count)
        Create a list from an array of arbitrary Erlang 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.
      • OtpErlangList

        public OtpErlangList​(OtpInputStream buf)
                      throws OtpErlangDecodeException
        Create a list from a stream containing an list encoded in Erlang external format.
        Parameters:
        buf - the stream containing the encoded list.
        Throws:
        OtpErlangDecodeException - if the buffer does not contain a valid external representation of an Erlang list.
    • Method Detail

      • arity

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

        public OtpErlangObject 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 OtpErlangObject[] elements()
        Get all the elements from the list as an array.
        Returns:
        an array containing all of the list's elements.
      • toString

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

        protected String toString​(int start)
      • encode

        public void encode​(OtpOutputStream buf)
        Convert this list to the equivalent Erlang external representation. Note that this method never encodes lists as strings, even when it is possible to do so.
        Specified by:
        encode in class OtpErlangObject
        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 OtpErlangObject
        Parameters:
        o - the list to compare to.
        Returns:
        true if the lists have the same arity and all the elements are equal.
      • match

        public <T> boolean match​(OtpErlangObject term,
                                 T bindings)
        Description copied from class: OtpErlangObject
        Perform match operation against given term.
        Overrides:
        match in class OtpErlangObject
        Parameters:
        term - the object to match
        bindings - variable bindings
        Returns:
        true if match succeeded
      • isProper

        public boolean isProper()
        Returns:
        true if the list is proper, i.e. the last tail is nil