Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Complete the given uml using the following instructions. DEFAULT _ CAPACITY This field represents the default capacity of a newly constructed DoubleArraySeq which in this

Complete the given uml using the following instructions. DEFAULT
_
CAPACITY
This field represents the default capacity of a newly constructed DoubleArraySeq which in this case is
1
0
.
Since it is in SCREAMING
_
SNAKE
_
CASE, you can infer that it should be final.
You can also infer that it should be static based on it being underlined in the UML.
data
This field contains the elements of the sequence.
manyItems
This field contains the current length of the sequence
(
i
.
e
.
,
how many items are in this sequence
)
.
DoubleArraySeq: One
-
Arg
This constructor sets the data field to an empty sequence but with the given initial capacity.
It also initializes the manyItems and currentIndex fields to
0
.
DoubleArraySeq: No
-
Arg
This constructor should do the same thing as the one
-
arg constructor but use DEFAULT
_
CAPACITY for the capacity. To avoid code duplication, you should just call the one
-
arg constructor and pass it DEFAULT
_
CAPACITY using this
(
)
.
size
Accessor method for the number of items in the sequence.
getCapacity
Accessor method for the capacity of the sequence
toString
This method returns a string representation of the sequence.
The string should be surrounded by angle brackets, with each element, in order, separated by commas. If there is a current element it should be surrounded by square brackets
Examples:
>
7
.
7
,
2
.
1
>
1
.
1
,
[
2
.
2
]
,
3
.
3
>
currentIndex
This field contains the index of the current element in the sequence. If there is no current index then it should be equal to manyItems.
isCurrent
This method returns true if a current element exists and false otherwise.
getCurrent
This method returns a copy of the current element in the sequence if one exists.
If a current element does not exist then it should throw an IllegalStateException.
advance
If a current element exists then this method moves the current element forward so that it is now the next element in the sequence.
If the current element exists and was already at the end of the sequence then a current element no longer exists.
If a current element does not exist then it should throw an IllegalStateException.
start
This method sets the current element at the beginning of the sequence. If the sequence is empty then there is no current element.
removeCurrent
If a current element exists then this method will remove the current element from the sequence. The following element will become the new current element.
If there is no following element then there will now be no current element.
If a current element does not exist then you will need to throw an IllegalStateException.
ensureCapacity
This method changes the current capacity of the sequence to be at least the specified value. If the capacity is already greater than the amount requested, the capacity should not change.
addAfter
This method adds a new element to the sequence after the current element.
If a current element does not exist then the new element must be added to the end of the sequence.
The current element becomes the new element.
The capacity of the sequence should only increase if necessary
addBefore
This method adds a new element to the sequence before the current element.
If a current element does not exist then the new element must be added to the front of the sequence.
The current element becomes the new element.
The capacity of the sequence should only increase if necessary.
addAll
This method takes another sequence and places the contents of that sequence at the end of the current sequence.
The current element of the sequence remains where it is
.
The capacity of the sequence should only increase if necessary.
trimToSize
This method reduces the capacity of the sequence to be equal to the number of elements in the sequence.
equals
Sequences are equal if:
They have the same number of elements.
The elements at each position in the sequences are the same.
They have the same current index
Sequences don
t need to have the same capacity to be equal.
clone
This method creates a copy of the sequence.
Changes to the copy should not affect the original sequence or vice versa.
Everything in the new sequence should be the same as the current sequence.
concatenation
This is a static method that is used to create a sequence out of two existing sequences.
The created sequence should have all of the elements from the first parameter, in order, followed by all of the elements from the second parameter, in order.
There should be no current element.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

3. Identify cultural universals in nonverbal communication.

Answered: 1 week ago

Question

2. Discuss the types of messages that are communicated nonverbally.

Answered: 1 week ago