sexp
Interface SList

All Superinterfaces:
Iterable<SExp>, SExp
All Known Implementing Classes:
SEmpty, SNonEmpty

public interface SList
extends SExp, Iterable<SExp>

SList represents an expression consisting of a list of subexpressions, e.g. (a b c). The methods of SList offer three patterns for iterating over the subexpressions:


Method Summary
 SExp first()
           
 SExp get(int i)
           
 boolean isEmpty()
           
 Iterator<SExp> iterator()
           
 SList rest()
           
 int size()
           
 
Methods inherited from interface sexp.SExp
accept
 

Method Detail

isEmpty

boolean isEmpty()
Returns:

first

SExp first()
Returns:
first expression in this list
Requires:
this list is not empty

rest

SList rest()
Returns:
remaining expressions after removing the first
Requires:
this list is not empty

size

int size()
Returns:
number of subexpressions, i.e. elements in this list

get

SExp get(int i)
Returns:
ith element of this list, numbered from 0
Requires:
0 <= i < size()

iterator

Iterator<SExp> iterator()
Specified by:
iterator in interface Iterable<SExp>
Returns:
iterator that yields the subexpressions of this list in order from left to right