/** * Given a coordinate position, find what grid element contains it, or is closest to it. * * @param coordVal position in this coordinate system * @return index of grid point containing it, or best estimate of closest grid interval. */ public int findCoordElementBounded(double coordVal) { if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis.findCoordElementBounded() on non-numeric"); if (isRegular()) return findCoordElementRegular(coordVal, true); if (isContiguous()) return findCoordElementIrregular(coordVal, true); else return findCoordElementNonContiguous(coordVal, true); }
/** * Given a coordinate position, find what grid element contains it, or is closest to it. * * @param coordVal position in this coordinate system * @return index of grid point containing it, or best estimate of closest grid interval. */ public int findCoordElementBounded(double coordVal) { if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis.findCoordElementBounded() on non-numeric"); if (isRegular()) return findCoordElementRegular(coordVal, true); if (isContiguous()) return findCoordElementIrregular(coordVal, true); else return findCoordElementNonContiguous(coordVal, true); }
/** * Given a coordinate position, find what grid element contains it. * This means that * <pre> * edge[i] <= pos < edge[i+1] (if values are ascending) * edge[i] > pos >= edge[i+1] (if values are descending) * </pre> * * @param coordVal position in this coordinate system * @return index of grid point containing it, or -1 if outside grid area */ public int findCoordElement(double coordVal) { if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis.findCoordElement() on non-numeric"); if (isRegular()) return findCoordElementRegular(coordVal, false); if (isContiguous()) return findCoordElementIrregular(coordVal, false); else return findCoordElementNonContiguous(coordVal, false); }
/** * Given a coordinate position, find what grid element contains it. * This means that * <pre> * edge[i] <= pos < edge[i+1] (if values are ascending) * edge[i] > pos >= edge[i+1] (if values are descending) * </pre> * * @param coordVal position in this coordinate system * @return index of grid point containing it, or -1 if outside grid area */ public int findCoordElement(double coordVal) { if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis.findCoordElement() on non-numeric"); if (isRegular()) return findCoordElementRegular(coordVal, false); if (isContiguous()) return findCoordElementIrregular(coordVal, false); else return findCoordElementNonContiguous(coordVal, false); }
/** * Given a coordinate value, find what grid element contains it. * This means that * <pre> * edge[i] <= value < edge[i+1] (if values are ascending) * edge[i] > value >= edge[i+1] (if values are descending) * </pre> * * @param coordVal position in this coordinate system * @return index of grid point containing it, or -1 if outside grid area */ public int findCoordElement(double coordVal) { if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis.findCoordElement() on non-numeric"); if (isRegular()) return findCoordElementRegular(coordVal, false); if (isContiguous()) return findCoordElementIrregular(coordVal, false); else return findCoordElementNonContiguous(coordVal, false); }
/** * Given a coordinate position, find what grid element contains it, or is closest to it. * * @param coordVal position in this coordinate system * @return index of grid point containing it, or best estimate of closest grid interval. */ public int findCoordElementBounded(double coordVal) { if (!isNumeric()) throw new UnsupportedOperationException("CoordinateAxis.findCoordElementBounded() on non-numeric"); // the scalar or len-1 case: if (this.getSize() == 1) return 0; if (isRegular()) return findCoordElementRegular(coordVal, true); if (isContiguous()) return findCoordElementIrregular(coordVal, true); else return findCoordElementNonContiguous(coordVal, true); }