org.kalmeo.util
Class LinkedList

java.lang.Object
  extended by org.kalmeo.util.LinkedList

public class LinkedList
extends java.lang.Object

This class represent a linked list.

Author:
bbeaulant, omarino

Nested Class Summary
 class LinkedList.LinkedListEnumeration
          This class represent a LinkedList enumeration.
 
Constructor Summary
LinkedList()
           
 
Method Summary
 void add(LinkedListItem item)
          Add a LinkedListItem to this LinkedList
 void add(LinkedListItem item, LinkedListItem referenceItem, boolean after)
          Add a LinkedListItem to this LinkedList by placing it after or before the referenceItem according to the after parameter.
 LinkedList.LinkedListEnumeration enumerate(Filter filter)
          Return the LinkedList.LinkedListEnumeration
 LinkedListItem find(Filter filter)
          Returns the best occurence of the corresponding LinkedListItem witch is acceptable by the filter
 java.util.Vector findAll(Filter filter)
          Returns a Vector that contains the list of LinkedListItem witch iare acceptable by the filter
 LinkedListItem getFirst()
           
 LinkedListItem getLast()
           
 int getLength()
           
 boolean isEmpty()
           
 void remove(LinkedListItem item)
          Remove a LinkedListItem from this LinkedList
 void removeAll()
          Remove all items
 void sort(int flag)
          Sort a list e.g. : Person class implement LinkedListItem, a Person have name and firstname value Set NAME = 0 and FIRSTNAME = 1 flags as public static final int variable and then, when sort is called with NAME flag, the list is sorted by name
 LinkedListItem[] toArray()
          Returns an Object array containing all references of the elements in this LinkedList.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkedList

public LinkedList()
Method Detail

getFirst

public LinkedListItem getFirst()
Returns:
the first

getLast

public LinkedListItem getLast()
Returns:
the last

getLength

public int getLength()
Returns:
the length

isEmpty

public boolean isEmpty()
Returns:
true if this LinkedList is empty

find

public LinkedListItem find(Filter filter)
Returns the best occurence of the corresponding LinkedListItem witch is acceptable by the filter

Parameters:
filter -
Returns:
The best occurence of the corresponding LinkedListItem witch is acceptable by the filter

findAll

public java.util.Vector findAll(Filter filter)
Returns a Vector that contains the list of LinkedListItem witch iare acceptable by the filter

Parameters:
filter -
Returns:
A Vector that contains the list of acceptable occurences

add

public void add(LinkedListItem item)
Add a LinkedListItem to this LinkedList

Parameters:
item -

add

public void add(LinkedListItem item,
                LinkedListItem referenceItem,
                boolean after)
Add a LinkedListItem to this LinkedList by placing it after or before the referenceItem according to the after parameter.

Parameters:
item - the LinkedListItem to add
referenceItem - the LinkedListItem used as reference
after - true if the item is added after the referenceItem

remove

public void remove(LinkedListItem item)
Remove a LinkedListItem from this LinkedList

Parameters:
item -

removeAll

public void removeAll()
Remove all items


sort

public void sort(int flag)
Sort a list e.g. :

Person class implement LinkedListItem, a Person have name and firstname value

Set NAME = 0 and FIRSTNAME = 1 flags as public static final int variable and then, when sort is called with NAME flag, the list is sorted by name

Parameters:
flag - is an int value used for specifie test wich be done for sorting the list

toArray

public LinkedListItem[] toArray()
Returns an Object array containing all references of the elements in this LinkedList.

Returns:
an array representation of this list

enumerate

public LinkedList.LinkedListEnumeration enumerate(Filter filter)
Return the LinkedList.LinkedListEnumeration

Parameters:
filter - the filter to apply to the LinkedList.LinkedListEnumeration


Copyright © 2007-2008 Kalmeo. All Rights Reserved.