//
// List1DDoubleSet.java
//
/*
VisAD system for interactive analysis and visualization of numerical
data. Copyright (C) 1996 - 2017 Bill Hibbard, Curtis Rueden, Tom
Rink, Dave Glowacki, Steve Emmerson, Tom Whittaker, Don Murray, and
Tommy Jasmin.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
*/
package visad;
/**
* List1DDoubleSet is the class for Set-s containing lists of
* 1-D double values with no topology. This set does not support
* interpolation.
*/
public class List1DDoubleSet extends SimpleSet {
double[] data;
/**
* Constructs with a non-default CoordinateSystem.
*
* @param d The data samples. Must not be
* null.
* @param type The type of the set.
* @param coord_sys The coordinate system transformation. May be
* null.
* @param units The units of the values. May be
* null.
* @throws VisADException Couldn't create set.
*/
public List1DDoubleSet(double[] d, MathType type, CoordinateSystem coord_sys,
Unit[] units) throws VisADException {
super(type, coord_sys, units, null);
if (DomainDimension != 1) {
throw new SetException("List1DDoubleSet: type must be 1-D");
}
data = d;
Length = d.length;
}
public boolean isMissing() {
return (data == null);
}
/**
* Converts an array of 1-D indices to an array of values in R^1. Note that a
* returned values may be Double.NaN due to double-to-float conversion.
* @param indices The indices of the values to be returned.
* @return The values associated with the given indices.
* A Float.NaN will be returned for an out-of-range
* index or a double value that cannot be converted
* to a float.
*/
public float[][] indexToValue(int[] indices) throws VisADException {
int length = indices.length;
float[][] value = new float[1][length];
for (int i=0; i= Length) {
for (int k=0; k= Length) {
for (int k=0; k
Ads help maintain this website.