public int size() { return _size() ; } public boolean isEmpty() { return _size()==0 ; }
public int size() { return _size() ; } public boolean isEmpty() { return _size()==0 ; }
public boolean isEmpty() { return _size()==0 ; }
public boolean isEmpty() { return _size()==0 ; }
public ItemList sublist(int start) { if ( _size() < start+offset ) return null ; ItemList x = new ItemList(noLine, noColumn, offset+start, elements) ; return x ; }
public ItemList sublist(int start) { if ( _size() < start+offset ) return null ; ItemList x = new ItemList(noLine, noColumn, offset+start, elements) ; return x ; }
/** Slice of the list from start (inclusive) to finish (exclusive) */ public ItemList sublist(int start, int finish) { if ( start < 0 || finish < 0 || finish < start ) return null ; if ( _size() < start ) return null ; if ( finish > _size() ) return null ; ItemList x = new ItemList() ; // Take a slice. // Note : this is a copy. // Note: List.subList just puts a wrapper around the overlying list // but don't do this a lot because ArrayList.get recurses to the core list (may run out of stack). // Better would an adjusting slice over base array but it's quite tricky to do the calculations correctly. // This way is mnore likely to be correct. x.elements.addAll(elements.subList(start+offset, finish+offset)) ; return x ; }
/** Slice of the list from start (inclusive) to finish (exclusive) */ public ItemList sublist(int start, int finish) { if ( start < 0 || finish < 0 || finish < start ) return null ; if ( _size() < start ) return null ; if ( finish > _size() ) return null ; ItemList x = new ItemList() ; // Take a slice. // Note : this is a copy. // Note: List.subList just puts a wrapper around the overlying list // but don't do this a lot because ArrayList.get recurses to the core list (may run out of stack). // Better would an adjusting slice over base array but it's quite tricky to do the calculations correctly. // This way is mnore likely to be correct. x.elements.addAll(elements.subList(start+offset, finish+offset)) ; return x ; }
public Item getLast() { return get(_size()-1) ; }
public Item getLast() { return get(_size()-1) ; }
public Item car() { if ( _size() == 0 ) throw new ItemException("ItemList.car: list is zero length") ; return get(0) ; } public ItemList cdr()
public Item car() { if ( _size() == 0 ) throw new ItemException("ItemList.car: list is zero length") ; return get(0) ; } public ItemList cdr()
public ItemList cdrOrNull() { if ( _size() == 0 ) return null ; ItemList x = new ItemList(super.getLine(), super.getColumn(), offset+1, elements) ; return x ; }
public ItemList cdrOrNull() { if ( _size() == 0 ) return null ; ItemList x = new ItemList(super.getLine(), super.getColumn(), offset+1, elements) ; return x ; }
public ItemList cdr() { if ( _size() == 0 ) throw new ItemException("ItemList.cdr: list is zero length") ; ItemList x = new ItemList(super.getLine(), super.getColumn(), offset+1, elements) ; return x ; }
public ItemList cdr() { if ( _size() == 0 ) throw new ItemException("ItemList.cdr: list is zero length") ; ItemList x = new ItemList(super.getLine(), super.getColumn(), offset+1, elements) ; return x ; }