next up previous contents index
Next: Translation scheme Up: Non-local blocks Previous: Non-local blocks   Contents   Index


The crds() method

To allow for these kinds of situation, an new method crds() is added to the Range class. It takes no arguments, and returns an object of class hpjava.lang.Triplet, declared as:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}clas...
...lic boolean inRange(int n) {...}
}\end{verbatim}\end{minipage}\end{displaymath}

The values of lo, hi and stp define the parameters of some strided interval:

\begin{displaymath}
\mbox{\tt\small lo}, \quad
\mbox{\tt\small lo} + \mbox{\tt...
...l stp}}
\right\rfloor + 1\right) \times \mbox{\tt\small stp}
\end{displaymath}

The method inRange() returns true if and only if its argument is in this interval.

The Triplet object returned by the crds() method defines a triplet range of coordinates for which the block() method is well-defined. The method localBlock() introduced earlier can be defined in terms of the more primitive block() as follows:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}Bloc...
...d) ;
else
return Block.EMPTY ;
}\end{verbatim}\end{minipage}\end{displaymath}

The EMPTY block can be assumed to have fields:

\begin{displaymath}
\begin{minipage}[t]{\linewidth}\small\begin{verbatim}EMPT...
....glb_bas = 0 ;
EMPTY.glb_stp = 1 ;\end{verbatim}\end{minipage}\end{displaymath}

Calling block() for an argument outside the range defined by crds() is an error.

As in the case of localBlock, there are overloaded versions of crds() and block() that take l, u, s arguments.


next up previous contents index
Next: Translation scheme Up: Non-local blocks Previous: Non-local blocks   Contents   Index
Bryan Carpenter 2003-04-15