de.tfhberlin.panitz.eliza
Class MyList

java.lang.Object
  |
  +--de.tfhberlin.panitz.eliza.Li
        |
        +--de.tfhberlin.panitz.eliza.MyList

public class MyList
extends Li

A concrete implementation of abstract class Li.


Constructor Summary
MyList()
           
MyList(java.lang.Object x, de.tfhberlin.panitz.eliza.Li xs)
           
 
Method Summary
 de.tfhberlin.panitz.eliza.Li cons(java.lang.Object x, de.tfhberlin.panitz.eliza.Li xs)
          Constructs a new list by adding an element in front of an existing list.
 de.tfhberlin.panitz.eliza.Li empty()
          Constructs a new empty list.
 java.lang.Object head()
          Returns the first element of this list.
 boolean isEmpty()
          Tests, if the list contains some element.
 void rotate()
          Mutates this list, by appending first element as last.
 de.tfhberlin.panitz.eliza.Li tail()
          Returns the list after the first element has been skipped.
 
Methods inherited from class de.tfhberlin.panitz.eliza.Li
drop, isPrefixIgnoreCaseOf, reverse, tails, toString, unwords, words
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MyList

public MyList()

MyList

public MyList(java.lang.Object x,
              de.tfhberlin.panitz.eliza.Li xs)
Method Detail

empty

public de.tfhberlin.panitz.eliza.Li empty()
Description copied from class: Li
Constructs a new empty list.

Specified by:
empty in class Li
Returns:
a newly created empty list.

cons

public de.tfhberlin.panitz.eliza.Li cons(java.lang.Object x,
                                         de.tfhberlin.panitz.eliza.Li xs)
Description copied from class: Li
Constructs a new list by adding an element in front of an existing list.

Specified by:
cons in class Li
Parameters:
x - the first element for the new list.
xs - the tail for the new list.
Returns:
a newly created list.

isEmpty

public boolean isEmpty()
Description copied from class: Li
Tests, if the list contains some element.

Specified by:
isEmpty in class Li
Returns:
true if no element is contained in the list.

head

public java.lang.Object head()
Description copied from class: Li
Returns the first element of this list.

Specified by:
head in class Li
Returns:
from element.

tail

public de.tfhberlin.panitz.eliza.Li tail()
Description copied from class: Li
Returns the list after the first element has been skipped.

Specified by:
tail in class Li
Returns:
the tail (rest) of the list, which follows first element.

rotate

public void rotate()
Description copied from class: Li
Mutates this list, by appending first element as last.

Specified by:
rotate in class Li