code
stringlengths
73
34.1k
label
stringclasses
1 value
public Blob open_blob( String db, String table, String column, long row, boolean rw ) throws jsqlite.Exception { synchronized (this) { Blob blob = new Blob(); _open_blob(db, table, column, row, rw, blob); return blob; } }
java
public static long long_from_julian( String s ) throws jsqlite.Exception { try { double d = Double.valueOf(s).doubleValue(); return long_from_julian(d); } catch (java.lang.Exception ee) { throw new jsqlite.Exception("not a julian date: " + s + ": " + ee); } ...
java
public void clear() { column = new String[0]; types = null; rows = new Vector(); ncolumns = nrows = 0; atmaxrows = false; }
java
public boolean newrow(String rowdata[]) { if (rowdata != null) { if (maxrows > 0 && nrows >= maxrows) { atmaxrows = true; return true; } rows.addElement(rowdata); nrows++; } return false; }
java
public ColumnVector solve(ColumnVector b, boolean improve) throws MatrixException { // Validate b's size. if (b.nRows != nRows) { throw new MatrixException( MatrixException.INVALID_DIMENSIONS); } decompose(); // Solve Ly =...
java
private void forwardElimination(double scales[]) throws MatrixException { // Loop once per pivot row 0..nRows-1. for (int rPivot = 0; rPivot < nRows - 1; ++rPivot) { double largestScaledElmt = 0; int rLargest = 0; // Starting from the pivot row...
java
private ColumnVector forwardSubstitution(ColumnVector b) throws MatrixException { ColumnVector y = new ColumnVector(nRows); // Do forward substitution. for (int r = 0; r < nRows; ++r) { int pr = permutation[r]; // permuted row index double dot = 0; ...
java
private ColumnVector backSubstitution(ColumnVector y) throws MatrixException { ColumnVector x = new ColumnVector(nRows); // Do back substitution. for (int r = nRows - 1; r >= 0; --r) { int pr = permutation[r]; // permuted row index double dot = 0; ...
java
private void improve(ColumnVector b, ColumnVector x) throws MatrixException { // Find the largest x element. double largestX = 0; for (int r = 0; r < nRows; ++r) { double absX = Math.abs(x.values[r][0]); if (largestX < absX) largestX = absX; } ...
java
void addFillComponents( Container panel, int[] cols, int[] rows ) { Dimension filler = new Dimension(10,10); boolean filled_cell_11 = false; CellConstraints cc = new CellConstraints(); if ( cols.length > 0 && rows.length > 0 ) { if ( cols[0] == 1 && rows[0] == 1 ) { ...
java
public ImageIcon loadImage( String imageName ) { try { ClassLoader classloader = getClass().getClassLoader(); java.net.URL url = classloader.getResource( imageName ); if ( url != null ) { ImageIcon icon = new ImageIcon( url ); return icon; ...
java
public synchronized Class<?> compileSource(String name, String code) throws Exception { Class<?> c = cache.get(name); if (c == null) { c = compileSource0(name, code); cache.put(name, c); } return c; }
java
private Class<?> compileSource0(String className, String sourceCode) throws Exception { List<MemorySourceJavaFileObject> compUnits = new ArrayList<MemorySourceJavaFileObject>(1); compUnits.add(new MemorySourceJavaFileObject(className + ".java", sourceCode)); DiagnosticCollector<JavaFileObject> d...
java
public void setValue( int position, double value ) { if (position >= internalArray.length) { double[] newArray = new double[position + growingSize]; System.arraycopy(internalArray, 0, newArray, 0, internalArray.length); internalArray = newArray; } internalArra...
java
public double[] getTrimmedInternalArray() { if (internalArray.length == lastIndex + 1) { return internalArray; } double[] newArray = new double[lastIndex + 1]; System.arraycopy(internalArray, 0, newArray, 0, newArray.length); return newArray; }
java
public byte[] getColor(float cat) { /* First check to see if the category * value is within the range of this rule. */ float diff = cat - low; if (diff <= 0f) return catColor; // else if (diff < 0) // { // /* Category value below lowest value in this rule. */ // return new byte[...
java
private String[] getExpectedRow( TableIterator<String[]> tableRowIterator, DateTime expectedDT ) throws IOException { while( tableRowIterator.hasNext() ) { String[] row = tableRowIterator.next(); DateTime currentTimestamp = formatter.parseDateTime(row[1]); if (currentTimestam...
java
@SuppressWarnings("unchecked") @Execute public void process() throws Exception { checkNull(inVector, pMaxOverlap, inRaster); RandomIter rasterIter = CoverageUtilities.getRandomIterator(inRaster); GridGeometry2D gridGeometry = inRaster.getGridGeometry(); double[] tm_utm_tac = new...
java
private static byte[] byteCopy(byte[] source, int offset, int count, byte[] target) { for (int i = offset, j = 0; i < offset + count; i++, j++) { target[j] = source[i]; } return target; }
java
public static String encodeX(byte[] a) { // check input if (a == null || a.length == 0) { return "X''"; } char[] out = new char[a.length * 2 + 3]; int i = 2; for (int j = 0; j < a.length; j++) { out[i++] = xdigits[(a[j] >> 4) & 0x0F]; out[i++] = xdigits[a[j] & 0x0F]; } out[0] = 'X'; out[1] = '\'...
java
public double[][] getWindow( int size, boolean doCircular ) { if (size % 2 == 0) { size++; } double[][] window = new double[size][size]; int delta = (size - 1) / 2; if (!doCircular) { for( int c = -delta; c <= delta; c++ ) { int tmpCol = co...
java
public double getElevationAt( Direction direction ) { switch( direction ) { case E: return eElev; case W: return wElev; case N: return nElev; case S: return sElev; case EN: return enElev; case NW: ...
java
public int getFlow() { GridNode nextDown = goDownstreamSP(); if (nextDown == null) { return HMConstants.intNovalue; } int dcol = nextDown.col - col; int drow = nextDown.row - row; Direction dir = Direction.getDir(dcol, drow); return dir.getFlow(); ...
java
public GridNode getNodeAt( Direction direction ) { int newCol = col + direction.col; int newRow = row + direction.row; GridNode node = new GridNode(gridIter, cols, rows, xRes, yRes, newCol, newRow); return node; }
java
public Direction isNeighborOf( GridNode otherNode ) { Direction[] orderedDirs = Direction.getOrderedDirs(); for( int i = 0; i < orderedDirs.length; i++ ) { Direction direction = orderedDirs[i]; int newCol = col + direction.col; int newRow = row + direction.row; ...
java
public Direction isSameValueNeighborOf( GridNode otherNode ) { Direction direction = isNeighborOf(otherNode); if (direction != null && NumericsUtilities.dEq(elevation, otherNode.elevation)) { return direction; } return null; }
java
public double getSlopeTo( GridNode node ) { double slope = (elevation - node.elevation) / getDistance(node); return slope; }
java
protected static String getXmlEncoding(Reader reader) { try { StringWriter sw = new StringWriter(MAX_XMLDECL_SIZE); int c; int count = 0; for (; (6 > count) && (-1 != (c = reader.read())); count++) { sw.write(c); } /* ...
java
public static List<LasCell> getLasCells( ASpatialDb db, Envelope envelope, Geometry exactGeometry, boolean doPosition, boolean doIntensity, boolean doReturns, boolean doTime, boolean doColor, int limitTo ) throws Exception { List<LasCell> lasCells = new ArrayList<>(); String sql = "SELECT " ...
java
public static List<LasCell> getLasCells( ASpatialDb db, Geometry geometry, boolean doPosition, boolean doIntensity, boolean doReturns, boolean doTime, boolean doColor ) throws Exception { List<LasCell> lasCells = new ArrayList<>(); String sql = "SELECT " + COLUMN_GEOM + "," + COLUMN_ID + ","...
java
public ValidationResult check(Feature feature) { result = new ValidationResult(); if (feature == null) { return result; } List<Qualifier> collectionDateQualifiers= feature.getQualifiers(Qualifier.COLLECTION_DATE_QUALIFIER_NAME); if(collectionDateQualifiers.isEmpty()) { return result; } ...
java
public static OSType getOperatingSystemType() { if (detectedOS == null) { String OS = System.getProperty("os.name", "generic").toLowerCase( Locale.ENGLISH); if ((OS.indexOf("mac") >= 0) || (OS.indexOf("darwin") >= 0)) { detectedOS = OSType.MacOS; } else if (OS.indexOf("win") >= 0) { detectedOS =...
java
public static Point2D[] calculateGisModelCircle(Point2D c, double r) { Point2D[] pts = new Point2D[360]; int angulo = 0; for (angulo=0; angulo<360; angulo++) { pts[angulo] = new Point2D.Double(c.getX(), c.getY()); pts[angulo].setLocation(pts[angulo].getX() + r * Math.sin(angulo*Math.PI/(double)180.0), pts[a...
java
public static Point2D[] calculateGisModelBulge(Point2D[] newPts, double[] bulges) { Vector ptspol = new Vector(); Point2D init = new Point2D.Double(); Point2D end = new Point2D.Double(); for (int j=0; j<newPts.length; j++) { init = newPts[j]; if (j!=newPts.length-1) end = newPts[j+1]; if (bulges[j]==0 ...
java
public byte[] seal(byte[] nonce, byte[] plaintext) { final XSalsa20Engine xsalsa20 = new XSalsa20Engine(); final Poly1305 poly1305 = new Poly1305(); // initialize XSalsa20 xsalsa20.init(true, new ParametersWithIV(new KeyParameter(key), nonce)); // generate Poly1305 subkey final byte[] sk = new...
java
public Optional<byte[]> open(byte[] nonce, byte[] ciphertext) { final XSalsa20Engine xsalsa20 = new XSalsa20Engine(); final Poly1305 poly1305 = new Poly1305(); // initialize XSalsa20 xsalsa20.init(false, new ParametersWithIV(new KeyParameter(key), nonce)); // generate mac subkey final byte[] s...
java
public byte[] nonce() { final byte[] nonce = new byte[NONCE_SIZE]; final SecureRandom random = new SecureRandom(); random.nextBytes(nonce); return nonce; }
java
public byte[] nonce(byte[] message) { final byte[] n1 = new byte[16]; final byte[] n2 = new byte[16]; final SecureRandom random = new SecureRandom(); random.nextBytes(n1); random.nextBytes(n2); final Blake2bDigest blake2b = new Blake2bDigest(key, NONCE_SIZE, n1, n2); blake2b.update(message,...
java
public Object get( int row, int col ) { return (dstore == null) ? null : dstore.get(row, col); }
java
public static boolean go_downstream( int[] colRow, double flowdirection ) { int n = (int) flowdirection; if (n == 10) { return true; } else if (n < 1 || n > 9) { return false; } else { colRow[1] += DIR[n][0]; colRow[0] += DIR[n][1]; ...
java
public static boolean sourcesNet( RandomIter flowIterator, int[] colRow, int num, RandomIter netNum ) { int[][] dir = {{0, 0, 0}, {1, 0, 5}, {1, -1, 6}, {0, -1, 7}, {-1, -1, 8}, {-1, 0, 1}, {-1, 1, 2}, {0, 1, 3}, {1, 1, 4}}; if (flowIterator.getSampleDouble(colRow[0], colRow[1], 0) <= 10.0 ...
java
public static double[] vectorizeDoubleMatrix( RenderedImage input ) { double[] U = new double[input.getWidth() * input.getHeight()]; RandomIter inputRandomIter = RandomIterFactory.create(input, null); int j = 0; for( int i = 0; i < input.getHeight() * input.getWidth(); i = i + input.get...
java
public static double calculateNthMoment( double[] values, int validValues, double mean, double momentOrder, IHMProgressMonitor pm ) { double moment = 0.0; double n = 0.0; if (momentOrder == 1.0) { for( int i = 0; i < validValues; i++ ) { if (!isNovalue(va...
java
public static WritableRaster extractSubbasins( WritableRandomIter flowIter, RandomIter netIter, WritableRandomIter netNumberIter, int rows, int cols, IHMProgressMonitor pm ) { for( int r = 0; r < rows; r++ ) { for( int c = 0; c < cols; c++ ) { if (!isNovalue(netIter.getS...
java
public static void markHillSlopeWithLinkValue( RandomIter flowIter, RandomIter attributeIter, WritableRandomIter markedIter, int cols, int rows, IHMProgressMonitor pm ) { pm.beginTask("Marking the hillslopes with the channel value...", rows); for( int r = 0; r < rows; r++ ) { for...
java
public static boolean isSourcePixel( RandomIter flowIter, int col, int row ) { double flowDirection = flowIter.getSampleDouble(col, row, 0); if (flowDirection < 9.0 && flowDirection > 0.0) { for( int k = 1; k <= 8; k++ ) { if (flowIter.getSampleDouble(col + dirIn[k][1], row +...
java
public static double width_interpolate( double[][] data, double x, int nx, int ny ) { int rows = data.length; double xuno = 0, xdue = 0, yuno = 0, ydue = 0, y = 0; // if 0, interpolate between 0 and the first value of data if (x >= 0 && x < data[0][nx]) { xuno = 0; ...
java
public static double henderson( double[][] data, int tp ) { int rows = data.length; int j = 1, n = 0; double dt = 0, muno, mdue, a, b, x, y, ydue, s_uno, s_due, smax = 0, tstar; for( int i = 1; i < rows; i++ ) { if (data[i][0] + tp <= data[(rows - 1)][0]) { ...
java
public static double gamma( double x ) { double tmp = (x - 0.5) * log(x + 4.5) - (x + 4.5); double ser = 1.0 + 76.18009173 / (x + 0) - 86.50532033 / (x + 1) + 24.01409822 / (x + 2) - 1.231739516 / (x + 3) + 0.00120858003 / (x + 4) - 0.00000536382 / (x + 5); double gamma = exp(tmp...
java
public static WritableRaster sumDownstream( RandomIter flowIter, RandomIter mapToSumIter, int width, int height, Double upperThreshold, Double lowerThreshold, IHMProgressMonitor pm ) { final int[] point = new int[2]; WritableRaster summedMapWR = CoverageUtilities.createWritableRaster(width, ...
java
public static double[] calcInverseSunVector( double[] sunVector ) { double m = Math.max(Math.abs(sunVector[0]), Math.abs(sunVector[1])); return new double[]{-sunVector[0] / m, -sunVector[1] / m, -sunVector[2] / m}; }
java
public static double[] calcNormalSunVector( double[] sunVector ) { double[] normalSunVector = new double[3]; normalSunVector[2] = Math.sqrt(Math.pow(sunVector[0], 2) + Math.pow(sunVector[1], 2)); normalSunVector[0] = -sunVector[0] * sunVector[2] / normalSunVector[2]; normalSunVector[1] =...
java
public static double scalarProduct( double[] a, double[] b ) { double c = 0; for( int i = 0; i < a.length; i++ ) { c = c + a[i] * b[i]; } return c; }
java
public static WritableRaster calculateFactor( int h, int w, double[] sunVector, double[] inverseSunVector, double[] normalSunVector, WritableRaster demWR, double dx ) { double casx = 1e6 * sunVector[0]; double casy = 1e6 * sunVector[1]; int f_i = 0; int f_j = 0; if ...
java
private static WritableRaster shadow( int i, int j, WritableRaster tmpWR, WritableRaster demWR, double res, double[] normalSunVector, double[] inverseSunVector ) { int n = 0; double zcompare = -Double.MAX_VALUE; double dx = (inverseSunVector[0] * n); double dy = (inverseSunVe...
java
public static double meanDoublematrixColumn( double[][] matrix, int column ) { double mean; mean = 0; int length = matrix.length; for( int i = 0; i < length; i++ ) { mean += matrix[i][column]; } return mean / length; }
java
public static double varianceDoublematrixColumn( double[][] matrix, int column, double mean ) { double variance; variance = 0; for( int i = 0; i < matrix.length; i++ ) { variance += (matrix[i][column] - mean) * (matrix[i][column] - mean); } return variance / ...
java
public static double sumDoublematrixColumns( int coolIndex, double[][] matrixToSum, double[][] resultMatrix, int firstRowIndex, int lastRowIndex, IHMProgressMonitor pm ) { double maximum; maximum = 0; if (matrixToSum.length != resultMatrix.length) { pm.errorMessage(msg...
java
public Long getRelativePosition(Long position) { long relativePosition = 0L; for (Location location : locations) { if (location instanceof RemoteLocation) { relativePosition += location.getLength(); } else { if (position < location.getBeginPosition() || position > location.getEndPosition()) { ...
java
protected boolean concatOr( boolean... statements ) { boolean isTrue = statements[0]; for( int i = 1; i < statements.length; i++ ) { isTrue = isTrue || statements[i]; } return isTrue; }
java
protected void checkNull( Object... objects ) { for( Object object : objects ) { if (object == null) { throw new ModelsIllegalargumentException("Mandatory input argument is missing. Check your syntax...", this.getClass().getSimpleName(), pm); } ...
java
protected void checkFileExists( String... existingFilePath ) { StringBuilder sb = null; for( String filePath : existingFilePath ) { File file = new File(filePath); if (!file.exists()) { if (sb == null) { sb = new StringBuilder(); ...
java
protected String checkWorkingFolderInPath( String filePath ) { if (filePath.contains(HMConstants.WORKINGFOLDER)) { return null; } return filePath; }
java
public GridCoverage2D getRaster( String source ) throws Exception { if (source == null || source.trim().length() == 0) return null; OmsRasterReader reader = new OmsRasterReader(); reader.pm = pm; reader.file = source; reader.process(); GridCoverage2D geodata =...
java
public SimpleFeatureCollection getVector( String source ) throws Exception { if (source == null || source.trim().length() == 0) return null; OmsVectorReader reader = new OmsVectorReader(); reader.pm = pm; reader.file = source; reader.process(); SimpleFeatureCo...
java
public void dumpRaster( GridCoverage2D raster, String source ) throws Exception { if (raster == null || source == null) return; OmsRasterWriter writer = new OmsRasterWriter(); writer.pm = pm; writer.inRaster = raster; writer.file = source; writer.process(); ...
java
public void dumpVector( SimpleFeatureCollection vector, String source ) throws Exception { if (vector == null || source == null) return; OmsVectorWriter writer = new OmsVectorWriter(); writer.pm = pm; writer.file = source; writer.inVector = vector; writer.proc...
java
public void setParameter( String key, Object obj ) { if (key.equals("novalue")) { //$NON-NLS-1$ novalue = obj; } else if (key.equals("matrixtype")) { //$NON-NLS-1$ Integer dmtype = (Integer) obj; matrixType = dmtype.intValue(); } }
java
private ByteBuffer readHeader( RandomAccessFile ds ) throws IOException { /* * the first byte defines the number of bytes are used to describe the row addresses in the * header (once it was sizeof(long) in grass but then it was turned to an offset (that * brought to reading problems ...
java
private long[] getRowAddressesFromHeader( ByteBuffer header ) { /* * Jump over the no more needed first byte (used in readHeader to define the header size) */ byte firstbyte = header.get(); /* Read the data row addresses inside the file */ long[] adrows = new long[file...
java
private void getMapRow( int currentrow, ByteBuffer rowdata, boolean iscompressed ) throws IOException, DataFormatException { // if (logger.isDebugEnabled()) // { // logger.debug("ACCESSING THE FILE at row: " + currentrow + // ", rasterMapType = " + rasterMapType + // ", numberOfB...
java
private void readCompressedFPRowByNumber( ByteBuffer rowdata, int rn, long[] adrows, RandomAccessFile thefile, int typeBytes ) throws DataFormatException, IOException { int offset = (int) (adrows[rn + 1] - adrows[rn]); /* * The fact that the file is compressed does not mean that the...
java
private void readUncompressedFPRowByNumber( ByteBuffer rowdata, int rn, RandomAccessFile thefile, int typeBytes ) throws IOException, DataFormatException { int datanumber = fileWindow.getCols() * typeBytes; thefile.seek((rn * datanumber)); thefile.read(rowdata.array()); }
java
private void readCompressedIntegerRowByNumber( ByteBuffer rowdata, int rn, long[] adrows, RandomAccessFile thefile ) throws IOException, DataFormatException { int offset = (int) (adrows[rn + 1] - adrows[rn]); thefile.seek(adrows[rn]); /* * Read how many bytes the values are...
java
private void readUncompressedIntegerRowByNumber( ByteBuffer rowdata, int rn, RandomAccessFile thefile ) throws IOException, DataFormatException { int cellValue = 0; ByteBuffer cell = ByteBuffer.allocate(rasterMapType); /* The number of bytes that are inside a row in the file. */ ...
java
public Color getColorFor( double value ) { if (value <= min) { return colors[0]; } else if (value >= max) { return colors[colors.length - 1]; } else { for( int i = 1; i < colors.length; i++ ) { double v1 = values[i - 1]; double ...
java
public static Color interpolateColor( Color color1, Color color2, float fraction ) { float int2Float = 1f / 255f; fraction = Math.min(fraction, 1f); fraction = Math.max(fraction, 0f); float r1 = color1.getRed() * int2Float; float g1 = color1.getGreen() * int2Float; float...
java
public void addSeries( String seriesName, double[] x, double[] y ) { XYSeries series = new XYSeries(seriesName); for( int i = 0; i < x.length; i++ ) { series.add(x[i], y[i]); } dataset.addSeries(series); }
java
public static long insertLasSource( ASpatialDb db, int srid, int levels, double resolution, double factor, Polygon polygon, String name, double minElev, double maxElev, double minIntens, double maxIntens ) throws Exception { String sql = "INSERT INTO " + TABLENAME// + " (" + COLUMN_G...
java
public static void updateMinMaxIntensity( ASpatialDb db, long sourceId, double minIntens, double maxIntens ) throws Exception { String sql = "UPDATE " + TABLENAME// + " SET " + COLUMN_MININTENSITY + "=" + minIntens + ", " + COLUMN_MAXINTENSITY + "=" + maxIntens + // "...
java
public static List<LasSource> getLasSources( ASpatialDb db ) throws Exception { List<LasSource> sources = new ArrayList<>(); String sql = "SELECT " + COLUMN_GEOM + "," + COLUMN_ID + "," + COLUMN_NAME + "," + COLUMN_RESOLUTION + "," + COLUMN_FACTOR + "," + COLUMN_LEVELS + "," + COLUMN_MIN...
java
public static boolean isLasDatabase( ASpatialDb db ) throws Exception { if (!db.hasTable(TABLENAME) || !db.hasTable(LasCellsTable.TABLENAME)) { return false; } return true; }
java
protected Point limitPointToWorldWindow( Point point ) { Rectangle viewport = this.getWwd().getView().getViewport(); int x = point.x; if (x < viewport.x) x = viewport.x; if (x > viewport.x + viewport.width) x = viewport.x + viewport.width; int y = point....
java
public static void show( BufferedImage image, String title, boolean modal ) { JDialog f = new JDialog(); f.add(new ImageViewer(image), BorderLayout.CENTER); f.setTitle(title); f.setIconImage(ImageCache.getInstance().getBufferedImage(ImageCache.HORTONMACHINE_FRAME_ICON)); f.setMod...
java
public static List<Image> getImagesList( IHMConnection connection ) throws Exception { List<Image> images = new ArrayList<Image>(); String sql = "select " + // ImageTableFields.COLUMN_ID.getFieldName() + "," + // ImageTableFields.COLUMN_LON.getFieldName() + "," + // ...
java
public static byte[] getImageData( IHMConnection connection, long imageDataId ) throws Exception { String sql = "select " + // ImageDataTableFields.COLUMN_IMAGE.getFieldName() + // " from " + TABLE_IMAGE_DATA + " where " + // ImageDataTableFields.COLUMN_ID.getFiel...
java
public static void convert(SquareMatrix sm) { for (int r = 0; r < sm.nRows; ++r) { for (int c = 0; c < sm.nCols; ++c) { sm.values[r][c] = (r == c) ? 1 : 0; } } }
java
public static SimpleFeatureCollection createFeatureCollection( SimpleFeature... features ) { DefaultFeatureCollection fcollection = new DefaultFeatureCollection(); for( SimpleFeature feature : features ) { fcollection.add(feature); } return fcollection; }
java
public static Object getAttributeCaseChecked( SimpleFeature feature, String field ) { Object attribute = feature.getAttribute(field); if (attribute == null) { attribute = feature.getAttribute(field.toLowerCase()); if (attribute != null) return attribute; ...
java
public static String findAttributeName( SimpleFeatureType featureType, String field ) { List<AttributeDescriptor> attributeDescriptors = featureType.getAttributeDescriptors(); for( AttributeDescriptor attributeDescriptor : attributeDescriptors ) { String name = attributeDescriptor.getLocalNa...
java
public static QueryResult featureCollection2QueryResult( SimpleFeatureCollection featureCollection ) { List<AttributeDescriptor> attributeDescriptors = featureCollection.getSchema().getAttributeDescriptors(); QueryResult queryResult = new QueryResult(); int count = 0; for( AttributeDescr...
java
private static URI createUriFromName(String name) { if (name == null) { throw new NullPointerException("name"); } try { return new URI(name); } catch (final URISyntaxException e) { throw new IllegalArgumentException("Invalid name: " + name, e); ...
java
public static void addNote( Connection connection, long id, double lon, double lat, double altim, long timestamp, String text, String form ) throws Exception { String insertSQL = "INSERT INTO " + TableDescriptions.TABLE_NOTES + "(" + // TableDescriptions.NotesTableFields.COLUMN_ID.ge...
java
public static List<Note> getNotesList( IHMConnection connection, float[] nswe ) throws Exception { String query = "SELECT " + // NotesTableFields.COLUMN_ID.getFieldName() + ", " + // NotesTableFields.COLUMN_LON.getFieldName() + ", " + // NotesTableFields.COLUMN_L...
java
private boolean isAtLeastOneAssignable( String main, Class< ? >... classes ) { for( Class< ? > clazz : classes ) { if (clazz.getCanonicalName().equals(main)) { return true; } } return false; }
java
public void sort( double[] values, double[] valuesToFollow ) { this.valuesToSortDouble = values; this.valuesToFollowDouble = valuesToFollow; number = values.length; monitor.beginTask("Sorting...", -1); monitor.worked(1); quicksort(0, number - 1); monitor.done(...
java
public void sort( float[] values, float[] valuesToFollow ) { this.valuesToSortFloat = values; this.valuesToFollowFloat = valuesToFollow; number = values.length; monitor.beginTask("Sorting...", -1); monitor.worked(1); quicksortFloat(0, number - 1...
java
public float nextCentral() { // Average 12 uniformly-distributed random values. float sum = 0.0f; for (int j = 0; j < 12; ++j) sum += gen.nextFloat(); // Subtract 6 to center about 0. return stddev*(sum - 6) + mean; }
java
public float nextPolar() { // If there's a saved value, return it. if (haveNextPolar) { haveNextPolar = false; return nextPolar; } float u1, u2, r; // point coordinates and their radius do { // u1 and u2 will be uniformly-d...
java
public float nextRatio() { float u, v, x, xx; do { // u and v are two uniformly-distributed random values // in [0, 1), and u != 0. while ((u = gen.nextFloat()) == 0); // try again if 0 v = gen.nextFloat(); float y = C1*(v - 0.5f)...
java