Calculate the VA file position given the existing borders.

@param id Object ID
@param dv Data vector
@return Vector approximation
192059
public VectorApproximation calculateApproximation(DBID id, V dv) {
    int[] approximation = new int[dv.getDimensionality()];
    for(int d = 0; d < splitPositions.length; d++) {
      final double val = dv.doubleValue(d);
      final int lastBorderIndex = splitPositions[d].length - 1;

      // Value is below data grid
      if(val < splitPositions[d][0]) {
        approximation[d] = 0;
        if(id != null) {
          LOG.warning("Vector outside of VAFile grid!");
        }
      } // Value is above data grid
      else if(val > splitPositions[d][lastBorderIndex]) {
        approximation[d] = lastBorderIndex - 1;
        if(id != null) {
          LOG.warning("Vector outside of VAFile grid!");
        }
      } // normal case
      else {
        // Search grid position
        int pos = Arrays.binarySearch(splitPositions[d], val);
        pos = (pos >= 0) ? pos : ((-pos) - 2);
        approximation[d] = pos;
      }
    }
    return new VectorApproximation(id, approximation);
  }
996401
protected int mapIdRefToInternalScanNum(CharArray id) throws FileParsingException {
    String idStr = id.toString();
    MZMLIndexElement byId = index.getById(idStr);
    if (byId == null) {
      String msg = String.format("Could not find a mapping from spectrum id"
          + " ref to an internal scan number for"
          + "\n\t file: %s"
          + "\n\t spectrum index of the spectrum in which the error occured: #%d"
          + "\n\t idRef searched for: %s", source.getPath(), vars.spectrumIndex, idStr);
      throw new FileParsingException(msg);
    }
    return byId.getNumber();
  }
1092493
public static Trajectory getTrajectoryByID(List<? extends Trajectory> t, int id){
		Trajectory track = null;
		for(int i = 0; i < t.size() ; i++){
			if(t.get(i).getID()==id){
				track = t.get(i);
				break;
			}
		}
		return track;
	}
379238
public BoxRequestsFile.GetFileInfo getInfoRequest(final String id) {
        BoxRequestsFile.GetFileInfo request = new BoxRequestsFile.GetFileInfo(id, getFileInfoUrl(id), mSession);
        return request;
    }
472517
public static PlotCanvas plot(String id, double[] data) {
        Histogram histogram = new Histogram(data);
        histogram.setID(id);

        double[] lowerBound = {Math.min(data), 0};
        double[] upperBound = {Math.max(data), 0};
        
        double[][] freq = histogram.getHistogram();
        for (int i = 0; i < freq.length; i++) {
            if (freq[i][1] > upperBound[1]) {
                upperBound[1] = freq[i][1];
            }
        }

        PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound);
        canvas.getAxis(0).setGridVisible(false);
        canvas.add(histogram);

        return canvas;
    }
918450
private void moveMapCoordinateElementInMap(final String id) {
        if (getInitialized() && null != id) {
            final WeakReference<MapCoordinateElement> weakReference = mapCoordinateElements.get(id);
            if (null != weakReference) {
                final MapCoordinateElement mapCoordinateElement = weakReference.get();
                if (null != mapCoordinateElement) {
                    if (logger.isTraceEnabled()) {
                        logger.trace("move element in OpenLayers map to {}", mapCoordinateElement);
                    }
                    jsMapView.call("moveMapObject", mapCoordinateElement.getId(),
                            mapCoordinateElement.getPosition().getLatitude(),
                            mapCoordinateElement.getPosition().getLongitude());
                }
            }
        }
    }
44600
private void computeDivUVD(GrayF32 u , GrayF32 v , GrayF32 psi ,
							   GrayF32 divU , GrayF32 divV , GrayF32 divD ) {

		final int stride = psi.stride;

		// compute the inside pixel
		for (int y = 1; y < psi.height-1; y++) {

			// index of the current pixel
			int index = y*stride + 1;

			for (int x = 1; x < psi.width-1; x++ , index++) {

				float psi_index = psi.data[index];

				float coef0 = 0.5f*(psi.data[index+1] + psi_index);
				float coef1 = 0.5f*(psi.data[index-1] + psi_index);
				float coef2 = 0.5f*(psi.data[index+stride] + psi_index);
				float coef3 = 0.5f*(psi.data[index-stride] + psi_index);

				float u_index = u.data[index];

				divU.data[index] = coef0*(u.data[index+1] - u_index) + coef1*(u.data[index-1] - u_index) +
								   coef2*(u.data[index+stride] - u_index) + coef3*(u.data[index-stride] - u_index);

				float v_index = v.data[index];

				divV.data[index] = coef0*(v.data[index+1] - v_index) + coef1*(v.data[index-1] - v_index) +
								   coef2*(v.data[index+stride] - v_index) + coef3*(v.data[index-stride] - v_index);

				divD.data[index] = coef0 + coef1 + coef2 + coef3;
			}
		}

		// handle the image borders
		for( int x = 0; x < psi.width; x++ ) {
			computeDivUVD_safe(x,0,u,v,psi,divU,divV,divD);
			computeDivUVD_safe(x,psi.height-1,u,v,psi,divU,divV,divD);
		}
		for( int y = 1; y < psi.height-1; y++ ) {
			computeDivUVD_safe(0,y,u,v,psi,divU,divV,divD);
			computeDivUVD_safe(psi.width-1,y,u,v,psi,divU,divV,divD);
		}
	}
734346
public Point getPoint(String id) {
        for (Point point : points)
            if (id.equals(point.getId()))
                return point;
        return null;
    }
1225380
private static Shape getShapeWithId(String id,
                                        ArrayList<Shape> shapes) {
        Shape result = new Shape(id);
        if (shapes.contains(result)) {
            return shapes.get(shapes.indexOf(result));
        }

        shapes.add(result);
        return result;
    }
1215939
public Record findRecordById(String id) {
    if (directory == null)
      init();

    Property idprop = config.getIdentityProperties().iterator().next();
    for (Record r : lookup(idprop, id))
      if (r.getValue(idprop.getName()).equals(id))
        return r;

    return null; // not found
  }
1349269
public Range<Integer> getCardRange(String id) {
        Preconditions.checkState(mGroupBasicAdapter != null, "Must call bindView() first");
        return this.mGroupBasicAdapter.getCardRange(id);
    }
1009588
private void dfs(int v, int[] cc, int id) {
        cc[v] = id;
        for (int t = 0; t < n; t++) {
            if (graph[v][t] != 0.0) {
                if (cc[t] == -1) {
                    dfs(t, cc, id);
                }
            }
        }
    }
467086
public static PlotCanvas plot(String id, double[] data) {
        double[] lowerBound = {0, Math.min(data)};
        double[] upperBound = {data.length, Math.max(data)};
        PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound);

        BarPlot plot = new BarPlot(data);
        plot.setID(id);
        canvas.add(plot);

        canvas.getAxis(0).setGridVisible(false);
        canvas.getAxis(0).setLabelVisible(false);

        return canvas;
    }
394518
@SuppressWarnings("unchecked")
    public <V> V v(Object id) {
        Iterator<Vertex> it = graph.vertices(id);
        return it.hasNext() ? frame(it.next()) : null;
    }
173922
public Edge lookupEdgeById(int id) {
        Iterator<Edge> i = edgeIterator();
        while (i.hasNext()) {
            Edge edge = i.next();
            if (edge.getId() == id) {
                return edge;
            }
        }
        return null;
    }
456248
public BoxRequestsMetadata.GetFileMetadata getFileMetadataRequest(String id) {
        BoxRequestsMetadata.GetFileMetadata request = new BoxRequestsMetadata.GetFileMetadata(getFileMetadataUrl(id), mSession);
        return request;
    }
828435
public BoxRequestsMetadata.GetFileMetadata getMetadataRequest(String id) {
        BoxRequestsMetadata.GetFileMetadata request = new BoxRequestsMetadata.GetFileMetadata(getFileMetadataUrl(id), mSession);
        return request;
    }