dataStructures
Class ExtendedChain

java.lang.Object
  |
  +--dataStructures.Chain
        |
        +--dataStructures.ExtendedChain

public class ExtendedChain
extends Chain
implements ExtendedLinearList


Field Summary
protected  dataStructures.ChainNode lastNode
           
 
Fields inherited from class dataStructures.Chain
firstNode, size
 
Constructor Summary
ExtendedChain()
           
 
Method Summary
 void add(int index, java.lang.Object theElement)
          Insert an element with specified index.
 void add(java.lang.Object theElement)
          Add theElement to the right end of the chain.
 void clear()
          Make the chain empty.
static void main(java.lang.String[] args)
          test program
 java.lang.Object remove(int index)
          Remove the element with specified index.
 
Methods inherited from class dataStructures.Chain
get, indexOf, isEmpty, iterator, size, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

lastNode

protected dataStructures.ChainNode lastNode
Constructor Detail

ExtendedChain

public ExtendedChain()
Method Detail

remove

public java.lang.Object remove(int index)
Remove the element with specified index. All elements with higher index have their index reduced by 1.
Returns:
removed element
Throws:
IndexOutOfBoundsException - when index is not between 0 and size - 1
Overrides:
remove in class Chain

add

public void add(int index,
                java.lang.Object theElement)
Insert an element with specified index. All elements with equal or higher index have their index increased by 1.
Throws:
IndexOutOfBoundsException - thrown if index is not between 0 and size
Overrides:
add in class Chain

clear

public void clear()
Make the chain empty.
Specified by:
clear in interface ExtendedLinearList

add

public void add(java.lang.Object theElement)
Add theElement to the right end of the chain.
Specified by:
add in interface ExtendedLinearList

main

public static void main(java.lang.String[] args)
test program