|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpt.ua.base.Array<T>
public class Array<T>
Generic array module.
This class follows DbC(tm) methodology. Where possible, contracts are implement with JML and native's Java assert.
Constructor Summary | |
---|---|
Array(int size)
Creates an array with size elements. |
Method Summary | |
---|---|
boolean |
equals(Array<T> other)
Queries equality with other array. |
T |
get(int idx)
Gets array's element at idx position. |
void |
set(int idx,
T elem)
Sets array's element at idx position. |
int |
size()
The array's immutable size |
void |
sort()
Sort array's elements (using their natural orderig). |
void |
sort(int fromIdx,
int toIdx)
Sort subarray's [fromIdx ; toIdx[ elements (using their natural orderig). |
java.lang.String |
toString()
Returns a String with all array's elements separated with a space. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Array(int size)
size
elements.
requires: size >= 0
Method Detail |
---|
public int size()
public boolean equals(Array<T> other)
other
array.
requires: other != null
true
if arrays are equal, false
otherwisepublic T get(int idx)
idx
position.
requires: idx >= 0 && idx < size()
idx
- the index
public void set(int idx, T elem)
idx
position.
requires: idx >= 0 && idx < size()
idx
- the indexelem
- the elementpublic java.lang.String toString()
String
with all array's elements separated with a space.
toString
in class java.lang.Object
public void sort()
public void sort(int fromIdx, int toIdx)
requires: fromIdx >= 0 && fromIdx < size()
requires: toIdx >= fromIdx && toIdx <= size()
fromIdx
- index of first element to sorttoIdx
- index of first element NOT to sort
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |