Question: /** * This class is a homework assignment; * A IntLinkedSeq is a collection of int numbers. * The sequence can have a special current
/** * This class is a homework assignment; * A IntLinkedSeq is a collection of int numbers. * The sequence can have a special "current element," which is specified and * accessed through four methods (start, getCurrent, advance, and isCurrent). * *
- *
- Limitations: *
- Beyond Int.MAX_VALUE elements, the
sizemethod * does not work. * * - Note: *
- This file contains only blank implementations ("stubs") * because this is a Programming Project for students. */ public class IntLinkedSeq extends IntSeq { private int manyItems; // how many nodes are in this sequence private IntNode head; // reference to the first node of the sequence private IntNode tail; // reference to the last node of the sequence private IntNode cursor; // reference to the "current" node (null // if there isn't one)
/** * Initialize an empty sequence. * * @param none * @postcondition * This sequence is empty. It does not have a current element. **/ public IntLinkedSeq( ) {
}
/** * Copy Constructor * * @param otherSequence * Sequence to make a deep copy of. * * @postcondition * This sequence is a DEEP copy of the parameter sequence. * Subsequent changes to the copy will not affect the original, nor vice versa. * The copy should have its cursor set in the appropriate * place within its linked list. **/ public IntLinkedSeq(IntLinkedSeq otherSequence) {
}
/** * {@inheritDoc} */ public void addAfter(int element) {
}
/** * {@inheritDoc} */ public void addBefore(int element) {
}
/** * {@inheritDoc} */ public void addAll(IntSeq addend) {
}
/** * {@inheritDoc} */ public void addFirst(int element) {
}
/** * {@inheritDoc} */ public void addLast(int element) {
}
/** * {@inheritDoc} */ public void start( ) {
}
/** * {@inheritDoc} */ public boolean isCurrent( ) {
return false; // Replace this return statement with your own code: }
/** * {@inheritDoc} */ public int getCurrentValue( ) {
return 0; // Replace this return statement with your own code: }
/** * {@inheritDoc} */ public void setCurrentValue(int element) {
}
/** * {@inheritDoc} */ public void removeCurrent( ) {
}
/** * {@inheritDoc} */ public void removeFirst( ) {
}
/** * {@inheritDoc} */ public void removeLast( ) {
}
/** * {@inheritDoc} */ public void advance( ) {
}
/** * {@inheritDoc} */ public void setCurrent(int i) {
}
/** * {@inheritDoc} */ public void invalidateCurrent( ) {
}
/** * {@inheritDoc} */ public boolean contains(int target) {
return false; // Replace this return statement with your own code: }
/** * {@inheritDoc} */ public int indexOf(int target) {
return 0; // Replace this return statement with your own code: }
/** * {@inheritDoc} */ public int size( ) {
return 0; // Replace this return statement with your own code: }
/** * {@inheritDoc} */ public IntSeq catenation(IntSeq s2) {
return null; // Replace this return statement with your own code: }
/** * {@inheritDoc} */ public IntSeq subSeq(int fromIndex, int toIndex) {
return null; // Replace this return statement with your own code: }
/** * {@inheritDoc} */ public IntSeq reverse( ) {
return null; // Replace this return statement with your own code: }
/** * {@inheritDoc} */ public int[] toArray( ) {
return null; // Replace this return statement with your own code: }
/** * {@inheritDoc} */ public String toString( ) { String result = "["; IntNode ptr = head; while (ptr != null) { result += ptr.getData(); if (ptr == cursor) { result += "*"; // use a special symbol at the cursor } ptr = ptr.getLink(); if (ptr != null) { result += ", "; } } result += "]"; return result; }
}//IntLinkedSeq
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
