Class Set
- java.lang.Object
-
- visad.ThingImpl
-
- visad.DataImpl
-
- visad.Set
-
- Direct Known Subclasses:
- SimpleSet
public abstract class Set extends DataImpl implements SetIface
Set is the abstract superclass of the VisAD hierarchy of sets.
Set-s are subsets of R^n for n>0. For the most part, Set objects are immutable (but see
SampledSet.getSamples(boolean)).- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class visad.DataImpl
DataImpl.Syncher
-
-
Field Summary
-
Fields inherited from interface visad.Data
ABS, ACOS, ACOS_DEGREES, ADD, ASIN, ASIN_DEGREES, ATAN, ATAN_DEGREES, ATAN2, ATAN2_DEGREES, CEIL, COS, COS_DEGREES, DEGREES_TO_RADIANS, DEPENDENT, DIVIDE, EXP, FLOOR, INDEPENDENT, INV_ATAN2, INV_ATAN2_DEGREES, INV_DIVIDE, INV_POW, INV_REMAINDER, INV_SUBTRACT, LOG, MAX, MIN, MULTIPLY, NEAREST_NEIGHBOR, NEGATE, NO_ERRORS, NOP, POW, RADIANS_TO_DEGREES, REMAINDER, RINT, ROUND, SIN, SIN_DEGREES, SQRT, SUBTRACT, TAN, TAN_DEGREES, WEIGHTED_AVERAGE
-
-
Constructor Summary
Constructors Constructor and Description Set(MathType type)construct a Set objectSet(MathType type, CoordinateSystem coord_sys)Constructs a Set object with a non-default CoordinateSystem.Set(MathType type, CoordinateSystem coord_sys, Unit[] units, ErrorEstimate[] errors)Constructs a Set object with a non-default CoordinateSystem, non-default Unit-s, and non-default errors.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description Data__getitem__(int index)for JPythonint__len__()A wrapper aroundgetLengthfor JPython.voidaddEqualsCache(Set set)add set to a cache of Set-s equal to thisvoidaddNotEqualsCache(Set set)add set to a cache of Set-s not equal to thisjava.lang.Objectclone()Clones this instance.abstract java.lang.ObjectcloneButType(MathType type)copy this Set, but give it a new MathType; this is safe, since constructor checks consistency of DomainCoordinateSystem and SetUnits with TypeDataShadowcomputeRanges(ShadowType type, DataShadow shadow)Recursive version of computeRanges(), called down through Data object tree.DataShadowcomputeRanges(ShadowType type, DataShadow shadow, double[][] ranges, boolean domain)this default does not set ranges - it is used by FloatSet and DoubleSetstatic double[][]copyDoubles(double[][] samples)static float[][]copyFloats(float[][] samples)voidcram_missing(boolean[] range_select)static float[][]doubleToFloat(double[][] value)int[]doubleToIndex(double[][] value)abstract booleanequals(java.lang.Object set)test for equalitybooleanequalUnitAndCS(Set set)test equality of SetUnits and DomainCoordinateSystem between this and setstatic double[][]floatToDouble(float[][] value)CoordinateSystemgetCoordinateSystem()Gets the coordinate system of this domain set (DomainCoordinateSystem).intgetDimension()get DomainDimension (i.e., this is a subset of R^DomainDimension)double[][]getDoubles()Returns an enumeration of the samples of the set in index order.double[][]getDoubles(boolean copy)Returns an enumeration of the samples of the set in index order.intgetLength()get the number of samplesintgetManifoldDimension()for non-SimpleSet, ManifoldDimension = DomainDimensionint[][]getNeighbors(int dimension)Returns the indexes of the neighboring points along a manifold dimesion for every point in the set.voidgetNeighbors(int[][] neighbors)Returns the indexes of the neighboring points for every point in the set.voidgetNeighbors(int[][] neighbors, float[][] weights)float[][]getSamples()return an enumeration of sample values in index order (i.e., not in getWedge order); the return array is organized as float[domain_dimension][number_of_samples]float[][]getSamples(boolean copy)Returns an enumeration of the samples of the set in index order.ErrorEstimate[]getSetErrors()Returns the error estimates of the values in the set.Unit[]getSetUnits()Returns the units of the values in the set.int[]getWedge()return an enumeration of sample indices in a spatially coherent order; this is useful for efficiencydouble[][]indexToDouble(int[] index)Returns an array of sample-point values corresponding to an array of sample-point indicies.abstract float[][]indexToValue(int[] index)return Set values corresponding to Set indicesjava.lang.StringlongString()java.lang.StringlongString(java.lang.String pre)static voidmain(java.lang.String[] args)VisADGeometryArraymake1DGeometry(byte[][] color_values)VisADGeometryArraymake2DGeometry(byte[][] color_values, boolean indexed)VisADGeometryArray[]make3DGeometry(byte[][] color_values)VisADGeometryArray[][]makeIsoLines(float[] intervals, float lowlimit, float highlimit, float base, float[] fieldValues, byte[][] color_values, boolean[] swap, boolean dash, boolean fill, ScalarMap[] smap, double[] scale, double label_size, boolean sphericalDisplayCS)return basic lines in array[0], fill-ins in array[1] and labels in array[2]VisADGeometryArraymakeIsoSurface(float isolevel, float[] fieldValues, byte[][] color_values, boolean indexed)VisADGeometryArraymakePointGeometry(byte[][] color_values)SetmakeSpatial(SetType type, float[][] samples)Setmerge1DSets(Set set)merge 1D sets; used for default animation setbooleantestEqualsCache(Set set)test set against a cache of Set-s equal to thisbooleantestNotEqualsCache(Set set)test set against a cache of Set-s not equal to thisDataunary(int op, MathType new_type, int sampling_mode, int error_mode)Pointwise unary operation applied to this.intunitAndCSHashCode()Returns the hash code of the units and coordinate-system.abstract int[]valueToIndex(float[][] value)return Set indices of Set values closest to value elements (return -1 for any value outside Set range)-
Methods inherited from class visad.DataImpl
__add__, __add__, __div__, __div__, __mod__, __mod__, __mul__, __mul__, __neg__, __pow__, __pow__, __radd__, __rdiv__, __rmod__, __rmul__, __rpow__, __rsub__, __sub__, __sub__, abs, abs, acos, acos, acosDegrees, acosDegrees, add, add, adjustSamplingError, asin, asin, asinDegrees, asinDegrees, atan, atan, atan2, atan2, atan2Degrees, atan2Degrees, atanDegrees, atanDegrees, binary, binary, ceil, ceil, changeMathType, computeRanges, computeRanges, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, local, log, log, max, max, min, min, multiply, multiply, negate, negate, notifyReferences, pow, pow, remainder, remainder, rint, rint, round, round, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, toString, unary
-
Methods inherited from class visad.ThingImpl
addReference, removeReference
-
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface visad.Data
abs, abs, acos, acos, acosDegrees, acosDegrees, add, add, adjustSamplingError, asin, asin, asinDegrees, asinDegrees, atan, atan, atan2, atan2, atan2Degrees, atan2Degrees, atanDegrees, atanDegrees, binary, binary, ceil, ceil, changeMathType, computeRanges, computeRanges, cos, cos, cosDegrees, cosDegrees, dataClone, divide, divide, exp, exp, floor, floor, getType, isMissing, local, log, log, max, max, min, min, multiply, multiply, negate, negate, pow, pow, remainder, remainder, rint, rint, round, round, sin, sin, sinDegrees, sinDegrees, sqrt, sqrt, subtract, subtract, tan, tan, tanDegrees, tanDegrees, unary
-
Methods inherited from interface visad.Thing
addReference, removeReference
-
-
-
-
Constructor Detail
-
Set
public Set(MathType type) throws VisADException
construct a Set object- Throws:
VisADException
-
Set
public Set(MathType type, CoordinateSystem coord_sys) throws VisADException
Constructs a Set object with a non-default CoordinateSystem.- Parameters:
type- The type of the Set.coord_sys- The CoordinateSystem associated with this Set.- Throws:
VisADException
-
Set
public Set(MathType type, CoordinateSystem coord_sys, Unit[] units, ErrorEstimate[] errors) throws VisADException
Constructs a Set object with a non-default CoordinateSystem, non-default Unit-s, and non-default errors. This is the most general constructor.- Parameters:
type- The MathType of the set. May be a RealType, a RealTupleType, or a SetType.coord_sys- Optional coordinate system for the domain of the set. May benull, in which case the default coordinate system of the domain is used.units- Optional units for the values. May benull, in which case the default units of the domain are used. If theith element is non-nulland the RealType of the corresponding domain component is an interval, then the unit that is actually used isunits[i].getAbsoluteUnit().errors- Error estimates. May benull.errors[i]is the error estimate for thei-th component and may benull.- Throws:
VisADException
-
-
Method Detail
-
getSetUnits
public Unit[] getSetUnits()
Returns the units of the values in the set. The units may differ from the default units of the underlying MathType but will be convertible with them.- Specified by:
getSetUnitsin interfaceSetIface- Returns:
- The units of the values in the set. Will not be
null. RETURN_VALUE[i]is the unit of thei-th component and may benull.
-
getSetErrors
public ErrorEstimate[] getSetErrors()
Returns the error estimates of the values in the set.- Specified by:
getSetErrorsin interfaceSetIface- Returns:
- Error estimates for the set. Will not be
null. RETURN_VALUE[i]is the error estimate for thei-th component and may benull.
-
getCoordinateSystem
public CoordinateSystem getCoordinateSystem()
Gets the coordinate system of this domain set (DomainCoordinateSystem).- Specified by:
getCoordinateSystemin interfaceSetIface- Returns:
- The coordinate system of this domain
set. This will be the coordinate
system passed to the constructor if
non-
null; otherwise, the (default) coordinate system of the underlying RealTupleType (which may benull).
-
getDimension
public int getDimension()
get DomainDimension (i.e., this is a subset of R^DomainDimension)- Specified by:
getDimensionin interfaceSetIface- Returns:
- The rank of the samples in the set.
-
getManifoldDimension
public int getManifoldDimension()
for non-SimpleSet, ManifoldDimension = DomainDimension- Specified by:
getManifoldDimensionin interfaceSetIface- Returns:
- The rank of the manifold of the set.
-
getLength
public int getLength() throws VisADExceptionget the number of samples- Specified by:
getLengthin interfaceSetIface- Returns:
- The number of samples in the set.
- Throws:
VisADException
-
__len__
public int __len__() throws VisADExceptionA wrapper aroundgetLengthfor JPython.- Returns:
- The number of elements in the Set
- Throws:
VisADException
-
getWedge
public int[] getWedge()
return an enumeration of sample indices in a spatially coherent order; this is useful for efficiency
-
getSamples
public float[][] getSamples() throws VisADExceptionreturn an enumeration of sample values in index order (i.e., not in getWedge order); the return array is organized as float[domain_dimension][number_of_samples]- Specified by:
getSamplesin interfaceSetIface- Returns:
- An enumeration of the samples of the set. Element [i][j] is the i-th coordinate of the j-th sample.
- Throws:
VisADException- VisAD failure.- See Also:
SetIface.getSamples(boolean copy)
-
getSamples
public float[][] getSamples(boolean copy) throws VisADExceptionDescription copied from interface:SetIfaceReturns an enumeration of the samples of the set in index order.- Specified by:
getSamplesin interfaceSetIface- Parameters:
copy- Whether or not to make a copy of the samples of the set.- Returns:
- An enumeration of the samples of the set. Element [i][j] is the i-th coordinate of the j-th sample.
- Throws:
VisADException- VisAD failure.
-
getDoubles
public double[][] getDoubles() throws VisADExceptionDescription copied from interface:SetIfaceReturns an enumeration of the samples of the set in index order. This is the same asgetDoubles(true).- Specified by:
getDoublesin interfaceSetIface- Returns:
- An enumeration of the samples of the set. Element [i][j] is the i-th coordinate of the j-th sample.
- Throws:
VisADException- VisAD failure.- See Also:
SetIface.getDoubles(boolean copy)
-
getDoubles
public double[][] getDoubles(boolean copy) throws VisADExceptionDescription copied from interface:SetIfaceReturns an enumeration of the samples of the set in index order.- Specified by:
getDoublesin interfaceSetIface- Parameters:
copy- Whether or not to make a copy of the samples of the set.- Returns:
- An enumeration of the samples of the set. Element [i][j] is the i-th coordinate of the j-th sample.
- Throws:
VisADException- VisAD failure.
-
cram_missing
public void cram_missing(boolean[] range_select)
- Specified by:
cram_missingin interfaceSetIface
-
indexToValue
public abstract float[][] indexToValue(int[] index) throws VisADExceptionreturn Set values corresponding to Set indices- Specified by:
indexToValuein interfaceSetIface- Parameters:
index- array of integer indices- Returns:
- float[domain_dimension][indices.length] array of Set values
- Throws:
VisADException- a VisAD error occurred
-
valueToIndex
public abstract int[] valueToIndex(float[][] value) throws VisADExceptionreturn Set indices of Set values closest to value elements (return -1 for any value outside Set range)- Specified by:
valueToIndexin interfaceSetIface- Parameters:
value- float[domain_dimension][number_of_values] array of Set values- Returns:
- array of integer indices
- Throws:
VisADException- a VisAD error occurred
-
computeRanges
public DataShadow computeRanges(ShadowType type, DataShadow shadow) throws VisADException
Description copied from interface:DataRecursive version of computeRanges(), called down through Data object tree.- Specified by:
computeRangesin interfaceData- Parameters:
type- ShadowType generated for MathType of thisshadow- DataShadow instance whose contained double[][] array and animation sampling Set are modified according to RealType values in this, and used as return value- Returns:
- DataShadow instance containing double[][] array of RealType ranges, and an animation sampling Set
- Throws:
VisADException- a VisAD error occurred
-
computeRanges
public DataShadow computeRanges(ShadowType type, DataShadow shadow, double[][] ranges, boolean domain) throws VisADException
this default does not set ranges - it is used by FloatSet and DoubleSet- Throws:
VisADException
-
merge1DSets
public Set merge1DSets(Set set) throws VisADException
merge 1D sets; used for default animation set- Specified by:
merge1DSetsin interfaceSetIface- Throws:
VisADException
-
makeSpatial
public Set makeSpatial(SetType type, float[][] samples) throws VisADException
- Specified by:
makeSpatialin interfaceSetIface- Throws:
VisADException
-
make1DGeometry
public VisADGeometryArray make1DGeometry(byte[][] color_values) throws VisADException
- Specified by:
make1DGeometryin interfaceSetIface- Throws:
VisADException
-
make2DGeometry
public VisADGeometryArray make2DGeometry(byte[][] color_values, boolean indexed) throws VisADException
- Specified by:
make2DGeometryin interfaceSetIface- Throws:
VisADException
-
make3DGeometry
public VisADGeometryArray[] make3DGeometry(byte[][] color_values) throws VisADException
- Specified by:
make3DGeometryin interfaceSetIface- Throws:
VisADException
-
makePointGeometry
public VisADGeometryArray makePointGeometry(byte[][] color_values) throws VisADException
- Specified by:
makePointGeometryin interfaceSetIface- Throws:
VisADException
-
makeIsoLines
public VisADGeometryArray[][] makeIsoLines(float[] intervals, float lowlimit, float highlimit, float base, float[] fieldValues, byte[][] color_values, boolean[] swap, boolean dash, boolean fill, ScalarMap[] smap, double[] scale, double label_size, boolean sphericalDisplayCS) throws VisADException
return basic lines in array[0], fill-ins in array[1] and labels in array[2]- Specified by:
makeIsoLinesin interfaceSetIface- Throws:
VisADException
-
makeIsoSurface
public VisADGeometryArray makeIsoSurface(float isolevel, float[] fieldValues, byte[][] color_values, boolean indexed) throws VisADException
- Specified by:
makeIsoSurfacein interfaceSetIface- Throws:
VisADException
-
indexToDouble
public double[][] indexToDouble(int[] index) throws VisADExceptionReturns an array of sample-point values corresponding to an array of sample-point indicies.- Specified by:
indexToDoublein interfaceSetIface- Parameters:
index- The indicies of the sample points.- Returns:
- A corresponding array of sample-point values.
RETURN_VALUE
[i][j]is thejth component of sample-pointi. - Throws:
VisADException- if a VisAD failure occurs.
-
doubleToIndex
public int[] doubleToIndex(double[][] value) throws VisADException- Specified by:
doubleToIndexin interfaceSetIface- Throws:
VisADException
-
floatToDouble
public static double[][] floatToDouble(float[][] value)
-
doubleToFloat
public static float[][] doubleToFloat(double[][] value)
-
copyFloats
public static float[][] copyFloats(float[][] samples)
-
copyDoubles
public static double[][] copyDoubles(double[][] samples)
-
getNeighbors
public void getNeighbors(int[][] neighbors) throws VisADExceptionReturns the indexes of the neighboring points for every point in the set.
neighbors.lengthshould be at leastgetLength(). On return,neighbors[i][j]will be the index of thej-th neighboring point of pointi. This method will allocate and set the arrayneighbors[i]for alli.This implementation always throws an
UnimplementedException.- Specified by:
getNeighborsin interfaceSetIface- Parameters:
neighbors- The array to contain the indexes of the neighboring points.- Throws:
java.lang.NullPointerException- if the array isnull.java.lang.ArrayIndexOutOfBoundsException- ifneighbors.length < getLength().VisADException- if a VisAD failure occurs.
-
getNeighbors
public void getNeighbors(int[][] neighbors, float[][] weights) throws VisADException- Specified by:
getNeighborsin interfaceSetIface- Throws:
VisADException
-
getNeighbors
public int[][] getNeighbors(int dimension) throws VisADExceptionReturns the indexes of the neighboring points along a manifold dimesion for every point in the set. Elements
[i][0]and[i][1]of the returned array are the indexes of the neighboring sample points in the direction of decreasing and increasing manifold index, respectively, for sample pointi. If a sample point doesn't have a neighboring point (because it is an exterior point, for example) then the value of the corresponding index will be -1.This implementation always throws an
UnimplementedException.- Specified by:
getNeighborsin interfaceSetIface- Parameters:
dimension- The index of the manifold dimension along which to return the neighboring points.- Throws:
java.lang.ArrayIndexOutOfBoundsException- ifmanifoldIndex < 0 || manifoldIndex >= getManifoldDimension().VisADException- if a VisAD failure occurs.- See Also:
getManifoldDimension()
-
testNotEqualsCache
public boolean testNotEqualsCache(Set set)
test set against a cache of Set-s not equal to this
-
addNotEqualsCache
public void addNotEqualsCache(Set set)
add set to a cache of Set-s not equal to this
-
testEqualsCache
public boolean testEqualsCache(Set set)
test set against a cache of Set-s equal to this
-
addEqualsCache
public void addEqualsCache(Set set)
add set to a cache of Set-s equal to this
-
equalUnitAndCS
public boolean equalUnitAndCS(Set set)
test equality of SetUnits and DomainCoordinateSystem between this and set- Specified by:
equalUnitAndCSin interfaceSetIface
-
unitAndCSHashCode
public int unitAndCSHashCode()
Returns the hash code of the units and coordinate-system. This is the hash code analogue ofequalUnitAndCS(Set).- Returns:
- The hash code of the units and coordinate system.
-
__getitem__
public Data __getitem__(int index) throws VisADException, java.rmi.RemoteException
for JPython- Throws:
VisADExceptionjava.rmi.RemoteException
-
equals
public abstract boolean equals(java.lang.Object set)
test for equality
-
clone
public java.lang.Object clone()
Clones this instance.
-
unary
public Data unary(int op, MathType new_type, int sampling_mode, int error_mode) throws VisADException, java.rmi.RemoteException
Description copied from class:DataImplPointwise unary operation applied to this. Applies to Reals, Tuples (recursively to components), and to Field ranges (Field domains implicitly resampled if necessary). Does not apply to Field domains, Sets (regarded as domains of Fields wthout ranges) or Text.- Specified by:
unaryin interfaceData- Overrides:
unaryin classDataImpl- Parameters:
op- may be Data.ABS, Data.ACOS, etc; these include all unary operations defined for Java primitive data typesnew_type- MathType of the resultsampling_mode- may be Data.NEAREST_NEIGHBOR or Data.WEIGHTED_AVERAGEerror_mode- may be Data.INDEPENDENT, Data.DEPENDENT or Data.NO_ERRORS;- Returns:
- result, with MathType = new_type
- Throws:
VisADException- a VisAD error occurredjava.rmi.RemoteException- an RMI error occurred
-
cloneButType
public abstract java.lang.Object cloneButType(MathType type) throws VisADException
copy this Set, but give it a new MathType; this is safe, since constructor checks consistency of DomainCoordinateSystem and SetUnits with Type- Specified by:
cloneButTypein interfaceSetIface- Parameters:
type- The MathType for the clone.- Returns:
- A clone of this set with the new MathType.
- Throws:
VisADException- VisAD failure.
-
longString
public java.lang.String longString() throws VisADException- Specified by:
longStringin interfaceData- Overrides:
longStringin classDataImpl- Returns:
- a longer String than returned by toString()
- Throws:
VisADException
-
longString
public java.lang.String longString(java.lang.String pre) throws VisADException- Specified by:
longStringin interfaceData- Overrides:
longStringin classDataImpl- Parameters:
pre- String added to start of each line- Returns:
- a longer String than returned by toString(), indented by pre (a string of blanks)
- Throws:
VisADException
-
main
public static void main(java.lang.String[] args) throws VisADException- Throws:
VisADException
-
-
DMelt 3.0 © DataMelt by jWork.ORG