class GeneralArray
{
// objects: A set of pairs <index, value> where for each value of index in IndexSet there
// is a value of type float. IndexSet is a finite ordered set of one or more dimensions,
// for example, {0, …, n-1} for one dimension, {(0, 0), (0, 1), (0, 2),(1, 0), (1, 1), (1, 2), (2, 0),
// (2, 1), (2, 2)} for two dimensions, etc.
public:
GeneralArray(int j; RangeList list, float initValue = defatultValue);
// The constructor GeneralArray creates a j dimensional array; the range of
// the kth dimension is given by the kth element of list. For each index i in the index
// set, insert <i, initValue> into the array.
float Retrieve(index i);
// if (i is in the index set of the array) return the value associated with i
// in the array; else signal an error
void Store(index i, float x);
// if (i is in the index set of the array) delete any pair of the form <i, y> present
// in the array and insert the new pair <i, x>; else signal an error.
}; // end of GeneralArray
No comments:
Post a Comment