OOscheme.visitor
Class GetLength

java.lang.Object
  extended by OOscheme.visitor.GetLength
All Implemented Interfaces:
IListAlgo

public class GetLength
extends Object
implements IListAlgo

Computes the length of the IList host.


Field Summary
static GetLength Singleton
          Singleton Pattern.
 
Constructor Summary
private GetLength()
           
 
Method Summary
 Object emptyCase(IEmptyList host, Object... nu)
          Returns Integer(0).
 Object nonEmptyCase(INEList host, Object... nu)
          Return the length of the host's rest plus 1.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Singleton

public static final GetLength Singleton
Singleton Pattern.

Constructor Detail

GetLength

private GetLength()
Method Detail

emptyCase

public Object emptyCase(IEmptyList host,
                        Object... nu)
Returns Integer(0).

Specified by:
emptyCase in interface IListAlgo
Parameters:
host - an EmptyList
nu - not used
Returns:
Integer.

nonEmptyCase

public Object nonEmptyCase(INEList host,
                           Object... nu)
Return the length of the host's rest plus 1.

Specified by:
nonEmptyCase in interface IListAlgo
Parameters:
host - an NEList
nu - not used.
Returns:
Integer