/** * Get the ratio between the {@link #getCanvasSize() GUI canvas size} and the application main windows (if available) or the screen size. * @return the ratio between the {@link #getCanvasSize() GUI canvas size} and the application main windows (if available). * @see #getCanvasSize() */ public Vector2f getCanvasToWindowRatio() { if (environment != null){ if (environment.getApplication() != null){ if( ratio == null ) { ratio = new Vector2f(); Vector2f canvas = getCanvasSize(); int width = Integer.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getWidth(), environment.getApplication().getContext().getSettings().getWidth()); int height = Integer.min(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode().getHeight(), environment.getApplication().getContext().getSettings().getHeight()); ratio.x = Float.max(1f, canvas.x / width); ratio.y = Float.max(1f, canvas.y / height); } return ratio; } else { throw new IllegalStateException("VR GUI manager underlying environment is not attached to any application."); } } else { throw new IllegalStateException("VR GUI manager is not attached to any environment."); } }
private static float max(float[] array) { float returnValue = Float.MIN_VALUE; for (int col=0; col < array.length; col++) { returnValue = Float.max(returnValue, array[col]); } return returnValue; }
private static float[] max_columnwise(float[][] array) { float[] returnValue = new float[array[0].length]; for (int col=0; col < array[0].length; col++) { returnValue[col] = Float.MIN_VALUE; for (int row=0; row < array.length; row++) { returnValue[col] = Float.max(returnValue[col],array[row][col]); } } return returnValue; }
private float getMaxValue(String[] transcriptPredictions) { float maxValue = 0; for (int i = 0; i < transcriptPredictions.length; i++) { String score = transcriptPredictions[i]; if (!EMPTY_VALUE.equals(score)) { float value = Float.parseFloat(score); //The larger the score the more likely the SNP has damaging effect. maxValue = Float.max(maxValue, value); } } return maxValue; }
float value = Float.parseFloat(score); maxValue = Float.max(maxValue, value);
@Override protected int resolveParallelism() { if (getMaxConcurrency() == Integer.MAX_VALUE) { return max(CORES / getSubscriberCount(), 1); } else { // Resolve maximum factor of max concurrency that is less than number of cores in order to respect maxConcurrency more // closely. return min(CORES, maxFactor(Float.max((float) getMaxConcurrency() / getSubscriberCount(), 1))); } }