Package de.hdm_stuttgart.mi.sd1.store
Class IntegerStore
java.lang.Object
de.hdm_stuttgart.mi.sd1.store.IntegerStore
A container holding a fixed
number of integer values.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new store being able to hold integer values.IntegerStore
(int capacity) Create a new store being able to hold integer values. -
Method Summary
-
Constructor Details
-
IntegerStore
public IntegerStore()Create a new store being able to hold integer values. -
IntegerStore
Create a new store being able to hold integer values.- Parameters:
capacity
- The store's initial capacity. If more values are being added viaaddValue(int)
the capacity will be increased dynamically.
-
-
Method Details
-
getCapacity
- Returns:
- The number of elements the store may
hold, see
IntegerStore(int)
.
-
getNumValues
- Returns:
- The number of values being contained.
-
addValue
Insert a new value into our container- Parameters:
value
- The value to be inserted. This will incrementgetNumValues()
by one.
-
getValue
Access the value at a given index- Parameters:
index
- The desired value's index- Returns:
- The desired value. Precondition: index <
getNumValues()
}
-
clear
Empty the current set of values and set the store to its initial state. -
getAverage
- Returns:
- The given sample's arithmetic average
-