structure
Class AbstractLinear
java.lang.Object
|
+--structure.AbstractStructure
|
+--structure.AbstractLinear
- All Implemented Interfaces:
- Linear, Structure
- Direct Known Subclasses:
- AbstractQueue, AbstractStack
- public abstract class AbstractLinear
- extends AbstractStructure
- implements Linear
An abstract implemtation of linear data structures. Linear structures have
completely determined add and remove methods.
Linear structures are often used to store the the state of a recursively
solved problem and stacks and queues are classic examples of such structures.
- See Also:
Stack
,
Queue
Method Summary |
boolean |
empty()
Determine if there are elements within the linear. |
Object |
remove(Object o)
Removes value from the linear structure. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, notify, notifyAll, registerNatives, toString, wait, wait, wait |
AbstractLinear
public AbstractLinear()
empty
public boolean empty()
- Determine if there are elements within the linear.
- Specified by:
empty
in interface Linear
- Postcondition:
- return true iff the linear structure is empty
- Returns:
- true if the linear structure is empty; false otherwise
remove
public Object remove(Object o)
- Removes value from the linear structure.
Not implemented (by default) for linear classes.
- Specified by:
remove
in interface Structure
- Parameters:
value
- value matching the value to be removed- Precondition:
- value is non-null
- Postcondition:
- value is removed from linear structure, if it was there
- Returns:
- returns the value that was replaced, or null if none.