java.lang.Object
simula.runtime.RTS_ARRAY
- Direct Known Subclasses:
RTS_RTObject.RTS_BOOLEAN_ARRAY
,RTS_RTObject.RTS_CHARACTER_ARRAY
,RTS_RTObject.RTS_INTEGER_ARRAY
,RTS_RTObject.RTS_REALTYPE_ARRAY
,RTS_RTObject.RTS_REF_ARRAY
,RTS_RTObject.RTS_TEXT_ARRAY
Utility class ARRAY.
This class provides an abstract superclass for Simula arrays. The implementation technique used is called 'dope vector indexing'. The dope vector is calculated in the constructor based on the array bound pairs. A fictitious base is also Calculated. This base is the relative address of the array element (0,0, ... 0).
See Mapping Simula to Java (runtime design) Sect. 3.4 Array Quantities
Link to GitHub: Source File.
- Author:
- Øystein Myhre Andersen
-
Field Summary
Modifier and TypeFieldDescriptionprivate final int
The fictitious base.final RTS_RTObject.RTS_BOUNDS[]
The initilal BOUND pairsprivate final int[]
The DOPE Vectorfinal int
The initial calculated SIZE -
Constructor Summary
ConstructorDescriptionRTS_ARRAY
(RTS_RTObject.RTS_BOUNDS... BOUNDS) Create an _ARRAY with the given BOUNDS. -
Method Summary
Modifier and TypeMethodDescriptionabstract RTS_ARRAY
COPY()
Abstract method redefined for all subclass <type>_ARRAYint
index
(int... x) General method to calculate index to the ELT array.int
lowerBound
(int i) The procedure "lowerbound" returns the lower (upper) bound of the dimension of the given array corresponding to the given index.int
nDim()
Returns the number of dimensions for this _ARRAYint
size()
Return the size of the underlying ELT[] arraytoString()
Returns a string representation of the object.int
upperBound
(int i) The procedure "upperbound" returns the lower (upper) bound of the dimension of the given array corresponding to the given index.
-
Field Details
-
BOUNDS
The initilal BOUND pairs -
SIZE
public final int SIZEThe initial calculated SIZE -
BASE
private final int BASEThe fictitious base. This base is the relative address of the array element (0,0, ... 0). -
DOPE
private final int[] DOPEThe DOPE Vector
-
-
Constructor Details
-
RTS_ARRAY
Create an _ARRAY with the given BOUNDS.- Parameters:
BOUNDS
- the ARRAY BOUNDS
-
-
Method Details
-
nDim
public int nDim()Returns the number of dimensions for this _ARRAY- Returns:
- the number of dimensions
-
size
public int size()Return the size of the underlying ELT[] array- Returns:
- the size of the underlying ELT[] array
-
lowerBound
public int lowerBound(int i) The procedure "lowerbound" returns the lower (upper) bound of the dimension of the given array corresponding to the given index. The first dimension has index one, the next two, etc. An index less than one or greater than the number of dimensions of the given array constitutes a run time error- Parameters:
i
- the given index- Returns:
- lowerbound of index i
-
upperBound
public int upperBound(int i) The procedure "upperbound" returns the lower (upper) bound of the dimension of the given array corresponding to the given index. The first dimension has index one, the next two, etc. An index less than one or greater than the number of dimensions of the given array constitutes a run time error- Parameters:
i
- the given index- Returns:
- upperbound of index i
-
COPY
Abstract method redefined for all subclass <type>_ARRAY- Returns:
- a copy of this _ARRAY
-
index
public int index(int... x) General method to calculate index to the ELT array.- Parameters:
x
- the indicies- Returns:
- the calculated index
-
toString
Returns a string representation of the object.
-