visad
Class CachingCoordinateSystem

java.lang.Object
  extended by visad.CoordinateSystem
      extended by visad.CachingCoordinateSystem
All Implemented Interfaces:
Serializable

public class CachingCoordinateSystem
extends CoordinateSystem

A wrapper class for CoordinateSystems that will cache the last values input and output values of the toReference and fromReference methods. If the inputs are the same as the last time these methods were called, the previously calculated values are returned.

Version:
$Revision: 1.11 $ $Date: 2009-12-07 12:16:19 $
Author:
Don Murray
See Also:
Serialized Form

Field Summary
static boolean debugTime
          Show time to transform
 
Constructor Summary
CachingCoordinateSystem(CoordinateSystem cs)
          Construct a new CachingCoordinateSystem that wraps around the input.
 
Method Summary
 boolean equals(Object obj)
          Check for equality of CoordinateSystem objects
 double[][] fromReference(double[][] inputs)
          Wrapper around the fromReference method of the input CoordinateSystem.
 float[][] fromReference(float[][] inputs)
          Wrapper around the fromReference method of the input CoordinateSystem.
 CoordinateSystem getCachedCoordinateSystem()
          Access to the "cached" CS
 double[][] toReference(double[][] inputs)
          Wrapper around the toReference method of the input CoordinateSystem.
 float[][] toReference(float[][] inputs)
          Wrapper around the toReference method of the input CoordinateSystem.
 String toString()
          A decriptive string of this CS.
 
Methods inherited from class visad.CoordinateSystem
canConvert, fromReference, fromReference, getCoordinateSystemUnits, getDimension, getReference, getReferenceUnits, toReference, toReference, transformCoordinates, transformCoordinates, transformCoordinates, transformCoordinates, transformCoordinatesFreeUnits, transformCoordinatesFreeUnits
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debugTime

public static boolean debugTime
Show time to transform

Constructor Detail

CachingCoordinateSystem

public CachingCoordinateSystem(CoordinateSystem cs)
                        throws VisADException
Construct a new CachingCoordinateSystem that wraps around the input.

Parameters:
cs - CoordinateSystem to wrap
Throws:
VisADException
Method Detail

toReference

public double[][] toReference(double[][] inputs)
                       throws VisADException
Wrapper around the toReference method of the input CoordinateSystem. If the inputs are the same as the last time this method was called, the previously computed outputs will be returned, otherwise the toReference method of the wrapped CS is called and it's output is returned

Specified by:
toReference in class CoordinateSystem
Parameters:
inputs - values to transform
Returns:
transformed input values.
Throws:
VisADException - when wrapped CS does

fromReference

public double[][] fromReference(double[][] inputs)
                         throws VisADException
Wrapper around the fromReference method of the input CoordinateSystem. If the inputs are the same as the last time this method was called, the previously computed outputs will be returned, otherwise the fromReference method of the wrapped CS is called and it's output is returned

Specified by:
fromReference in class CoordinateSystem
Parameters:
inputs - values to transform
Returns:
transformed input values.
Throws:
VisADException - when wrapped CS does

toReference

public float[][] toReference(float[][] inputs)
                      throws VisADException
Wrapper around the toReference method of the input CoordinateSystem. If the inputs are the same as the last time this method was called, the previously computed outputs will be returned, otherwise the toReference method of the wrapped CS is called and it's output is returned

Overrides:
toReference in class CoordinateSystem
Parameters:
inputs - values to transform
Returns:
transformed input values.
Throws:
VisADException - when wrapped CS does

fromReference

public float[][] fromReference(float[][] inputs)
                        throws VisADException
Wrapper around the fromReference method of the input CoordinateSystem. If the inputs are the same as the last time this method was called, the previously computed outputs will be returned, otherwise the fromReference method of the wrapped CS is called and it's output is returned

Overrides:
fromReference in class CoordinateSystem
Parameters:
inputs - values to transform
Returns:
transformed input values.
Throws:
VisADException - when wrapped CS does

equals

public boolean equals(Object obj)
Check for equality of CoordinateSystem objects

Specified by:
equals in class CoordinateSystem
Parameters:
obj - other object in question
Returns:
true if the object in question is a CachingCoordinateSystem and it's CS is equal this object's CS

getCachedCoordinateSystem

public CoordinateSystem getCachedCoordinateSystem()
Access to the "cached" CS

Returns:
cached CoordinateSystem

toString

public String toString()
A decriptive string of this CS.

Overrides:
toString in class Object
Returns:
a descriptive String