coins.backend.util
クラス ImList

java.lang.Object
  |
  +--coins.backend.util.ImList

public class ImList
extends java.lang.Object

Immutable uni-directional list. Use BiList if you want mutable list. Alternative to Lisp cons cell.


フィールドの概要
static ImList Empty
           
 
コンストラクタの概要
ImList(java.lang.Object content)
          Create singleton list.
ImList(java.lang.Object content, ImList tail)
          Create a link
 
メソッドの概要
 ImList append(ImList addendum)
          Return the list concatenated this and addendum.
 boolean atEnd()
          Return true if this list is at end (empty).
 ImList destructiveReverse()
          Reverse the list destructively.
 ImList destructiveReverse(ImList tail)
          Reverse the list destructively with tail list.
 java.lang.Object elem()
          Return first element of the list.
 java.lang.Object elem(int n)
          Return nth element of the list.
 java.lang.Object elem2nd()
          Return second element of the list.
 java.lang.Object elem3rd()
          Return third element of the list.
 java.lang.Object elem4th()
          Return fourth element of the list.
 java.lang.Object elem5th()
          Return fifth element of the list.
 java.lang.Object elem6th()
          Return sixth element of the list.
 boolean equals(java.lang.Object x)
          Return true if x is an ImList and equals to this list.
 boolean isEmpty()
          Return true if this list is empty.
 java.lang.Object lastElem()
          Return last element of the list.
 int length()
          Return number of elements of the list.
static ImList list()
          Create empty list.
static ImList list(java.lang.Object obj)
          Create 1-element list.
static ImList list(java.lang.Object obj1, java.lang.Object obj2)
          Create 2-elements list.
static ImList list(java.lang.Object obj1, java.lang.Object obj2, java.lang.Object obj3)
          Create 3-elements list.
static ImList list(java.lang.Object obj1, java.lang.Object obj2, java.lang.Object obj3, java.lang.Object obj4)
          Create 4-elements list.
static ImList list(java.lang.Object obj1, java.lang.Object obj2, java.lang.Object obj3, java.lang.Object obj4, java.lang.Object obj5)
          Create 5-elements list.
static ImList list(java.lang.Object obj1, java.lang.Object obj2, java.lang.Object obj3, java.lang.Object obj4, java.lang.Object obj5, java.lang.Object obj6)
          Create 6-elements list.
 ImList locate(java.lang.Object obj)
          Find a sublist which has element obj.
static void main(java.lang.String[] args)
          Test Driver
 ImList makeCopy()
          Return shallow copy of list.
 ImList next()
          Return the next list header.
 ImList next(int n)
          Return nth next of the list.
 ImList next2nd()
          Return the 2nd next list header.
 ImList next3rd()
          Return the 3rd next list header.
 void printIt(java.io.PrintWriter writer)
          Print beautifully.
 void printIt(java.io.PrintWriter writer, int width)
          Print beautifully.
 void printIt(java.io.PrintWriter writer, int width, int indent)
          Print beautifully with indentation.
static void printIt(java.io.PrintWriter writer, java.lang.Object obj)
          Print beautifully any object.
static java.lang.Object readSexp(java.io.PushbackReader prd)
          Read S-expression from Reader prd and build them up in ImList form.
static java.lang.Object readSexp(java.io.Reader rdr)
          Read S-expression and build them up in ImList form.
 ImList scanOpt()
          Scan &opt
 java.lang.String toString()
          Visualize
 java.lang.String toStringWOParen()
          Visualize without ()
 
クラス java.lang.Object から継承したメソッド
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

Empty

public static final ImList Empty
コンストラクタの詳細

ImList

public ImList(java.lang.Object content,
              ImList tail)
Create a link


ImList

public ImList(java.lang.Object content)
Create singleton list.

メソッドの詳細

list

public static ImList list()
Create empty list.


list

public static ImList list(java.lang.Object obj)
Create 1-element list.


list

public static ImList list(java.lang.Object obj1,
                          java.lang.Object obj2)
Create 2-elements list.


list

public static ImList list(java.lang.Object obj1,
                          java.lang.Object obj2,
                          java.lang.Object obj3)
Create 3-elements list.


list

public static ImList list(java.lang.Object obj1,
                          java.lang.Object obj2,
                          java.lang.Object obj3,
                          java.lang.Object obj4)
Create 4-elements list.


list

public static ImList list(java.lang.Object obj1,
                          java.lang.Object obj2,
                          java.lang.Object obj3,
                          java.lang.Object obj4,
                          java.lang.Object obj5)
Create 5-elements list.


list

public static ImList list(java.lang.Object obj1,
                          java.lang.Object obj2,
                          java.lang.Object obj3,
                          java.lang.Object obj4,
                          java.lang.Object obj5,
                          java.lang.Object obj6)
Create 6-elements list.


next

public ImList next()
Return the next list header.


next2nd

public ImList next2nd()
Return the 2nd next list header.


next3rd

public ImList next3rd()
Return the 3rd next list header.


elem

public java.lang.Object elem()
Return first element of the list.


elem2nd

public java.lang.Object elem2nd()
Return second element of the list.


elem3rd

public java.lang.Object elem3rd()
Return third element of the list.


elem4th

public java.lang.Object elem4th()
Return fourth element of the list.


elem5th

public java.lang.Object elem5th()
Return fifth element of the list.


elem6th

public java.lang.Object elem6th()
Return sixth element of the list.


lastElem

public java.lang.Object lastElem()
Return last element of the list.


next

public ImList next(int n)
Return nth next of the list.


elem

public java.lang.Object elem(int n)
Return nth element of the list.


atEnd

public boolean atEnd()
Return true if this list is at end (empty).


isEmpty

public boolean isEmpty()
Return true if this list is empty.


append

public ImList append(ImList addendum)
Return the list concatenated this and addendum.


length

public int length()
Return number of elements of the list.


locate

public ImList locate(java.lang.Object obj)
Find a sublist which has element obj.


makeCopy

public ImList makeCopy()
Return shallow copy of list.


scanOpt

public ImList scanOpt()
Scan &opt


destructiveReverse

public ImList destructiveReverse()
Reverse the list destructively. Think three times before use.


destructiveReverse

public ImList destructiveReverse(ImList tail)
Reverse the list destructively with tail list.


readSexp

public static java.lang.Object readSexp(java.io.Reader rdr)
                                 throws java.io.IOException,
                                        SyntaxError
Read S-expression and build them up in ImList form.

パラメータ:
rdr - Reader where input comes from.
戻り値:
the list or String object. null indicates EOF.
java.io.IOException
SyntaxError

readSexp

public static java.lang.Object readSexp(java.io.PushbackReader prd)
                                 throws java.io.IOException,
                                        SyntaxError
Read S-expression from Reader prd and build them up in ImList form.

戻り値:
the list or String object. null indicates EOF.
java.io.IOException
SyntaxError

equals

public boolean equals(java.lang.Object x)
Return true if x is an ImList and equals to this list.

オーバーライド:
クラス java.lang.Object 内の equals

toString

public java.lang.String toString()
Visualize

オーバーライド:
クラス java.lang.Object 内の toString

toStringWOParen

public java.lang.String toStringWOParen()
Visualize without ()


printIt

public void printIt(java.io.PrintWriter writer)
Print beautifully.


printIt

public void printIt(java.io.PrintWriter writer,
                    int width)
Print beautifully.


printIt

public void printIt(java.io.PrintWriter writer,
                    int width,
                    int indent)
Print beautifully with indentation.


printIt

public static void printIt(java.io.PrintWriter writer,
                           java.lang.Object obj)
Print beautifully any object.


main

public static void main(java.lang.String[] args)
Test Driver