provided.music
Class NESeqList

java.lang.Object
  extended by provided.music.NESeqList
All Implemented Interfaces:
IPhrase, ISeqList

public class NESeqList
extends java.lang.Object
implements ISeqList

A non-empty ("cons") sequence list.


Field Summary
private  IPhrase _first
          The "first" of the list
private  ISeqList _rest
          The "rest" of the list
private static IPhraseVisitor _toStringAlgo
          toString algo for rest, the recursive helper function of the ToString algo.
 
Constructor Summary
NESeqList(IPhrase first, ISeqList rest)
          Cons an IPhrase to a Sequence List.
 
Method Summary
 java.lang.Object execute(IPhraseVisitor algo, java.lang.Object... params)
          Calls the "NESeqList" case of the visitor.
 IPhrase getFirst()
          Accessor method for the first element
 ISeqList getRest()
          Accessor method for the rest of the lsit
static void setToStringAlgo(IPhraseVisitor stringAlgo)
          Setter for the _toStringAlgo helper.
 java.lang.String toString()
          Run a visitor over the list to convert it to a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_first

private IPhrase _first
The "first" of the list


_rest

private ISeqList _rest
The "rest" of the list


_toStringAlgo

private static IPhraseVisitor _toStringAlgo
toString algo for rest, the recursive helper function of the ToString algo.

Constructor Detail

NESeqList

public NESeqList(IPhrase first,
                 ISeqList rest)
Cons an IPhrase to a Sequence List.

Method Detail

getFirst

public IPhrase getFirst()
Accessor method for the first element

Returns:
the IPhrase that is the first element of the sequence list

getRest

public ISeqList getRest()
Accessor method for the rest of the lsit

Returns:
the rest of the sequence list

execute

public java.lang.Object execute(IPhraseVisitor algo,
                                java.lang.Object... params)
Calls the "NESeqList" case of the visitor.

Specified by:
execute in interface IPhrase
Parameters:
algo - The visitor that is being used
params - vararg input parameters for the visitor.
Returns:
the result of running the visitor on this host.

setToStringAlgo

public static void setToStringAlgo(IPhraseVisitor stringAlgo)
Setter for the _toStringAlgo helper.

Parameters:
stringAlgo - The helper algo to use.

toString

public java.lang.String toString()
Run a visitor over the list to convert it to a String. Delegates to the rest of the list using the helper algo, with the accumulator (params[0]) set to "{"+_first.toString().

Overrides:
toString in class java.lang.Object
Returns:
"{a, b, c, d}"