List of usage examples for java.lang Double POSITIVE_INFINITY
double POSITIVE_INFINITY
To view the source code for java.lang Double POSITIVE_INFINITY.
Click Source Link
From source file:ucar.unidata.idv.control.chart.MyScatterPlot.java
/** * Calculates the X data range.//from w w w . j a v a 2 s .co m * * @param data the data. * * @return The range. */ private Range calculateXDataRange(double[][] data) { Range result = null; // double[][] data = (double[][]) series.get(0); if (data != null) { double lowest = Double.POSITIVE_INFINITY; double highest = Double.NEGATIVE_INFINITY; for (int i = 0; i < data[0].length; i++) { double v = data[0][i]; if (v < lowest) { lowest = v; } if (v > highest) { highest = v; } } if (lowest <= highest) { result = new Range(lowest, highest); } } return result; }
From source file:net.sourceforge.jasa.report.HistoricalDataReport.java
public double getLowestUnacceptedAskPrice() { if (lowestUnacceptedAsk != null) { return lowestUnacceptedAsk.getPriceAsDouble(); }/*from ww w . j av a 2s .c om*/ Iterator<Order> i = asks.iterator(); double lowestUnacceptedBidPrice = Double.POSITIVE_INFINITY; while (i.hasNext()) { Order s = i.next(); if (!accepted(s)) { if (s.getPriceAsDouble() < lowestUnacceptedBidPrice) { lowestUnacceptedBidPrice = s.getPriceAsDouble(); lowestUnacceptedAsk = s; } } } return lowestUnacceptedBidPrice; }
From source file:gmc_hdfs.distribution.ParetoDistribution.java
/** * {@inheritDoc}//w ww .ja v a2s . c o m * <p> * The upper bound of the support is always positive infinity no matter the parameters. * * @return upper bound of the support (always {@code Double.POSITIVE_INFINITY}) */ public double getSupportUpperBound() { return Double.POSITIVE_INFINITY; }
From source file:com.janrain.backplane.server.redisdao.RedisBackplaneMessageDAO.java
@Override public List<BackplaneMessage> getMessagesByBus(String bus, String since, String sticky) throws SimpleDBException, BackplaneServerException { Jedis jedis = null;/* ww w.j a va 2 s .co m*/ try { jedis = Redis.getInstance().getReadJedis(); double sinceInMs = 0; if (StringUtils.isNotBlank(since)) { sinceInMs = BackplaneMessage.getDateFromId(since).getTime(); } // every message has a unique timestamp - which serves as a key for indexing Set<byte[]> messageIdBytes = Redis.getInstance().zrangebyscore(RedisBackplaneMessageDAO.getBusKey(bus), sinceInMs, Double.POSITIVE_INFINITY); List<BackplaneMessage> messages = new ArrayList<BackplaneMessage>(); Pipeline pipeline = jedis.pipelined(); List<Response<byte[]>> responses = new ArrayList<Response<byte[]>>(); if (messageIdBytes != null) { for (byte[] b : messageIdBytes) { responses.add(pipeline.get(getKey(new String(b)))); } pipeline.sync(); for (Response<byte[]> response : responses) { byte[] bytes = response.get(); if (bytes != null) { BackplaneMessage backplaneMessage = (BackplaneMessage) SerializationUtils .deserialize(bytes); messages.add(backplaneMessage); } } } filterAndSort(messages, since, sticky); return messages; } finally { Redis.getInstance().releaseToPool(jedis); } }
From source file:com.janrain.backplane.server.dao.redis.RedisBackplaneMessageDAO.java
public List<BackplaneMessage> getMessagesByBus(String bus, String since, String sticky) throws SimpleDBException, BackplaneServerException { Jedis jedis = null;/*from w ww .jav a 2 s . co m*/ try { jedis = Redis.getInstance().getReadJedis(); double sinceInMs = 0; if (StringUtils.isNotBlank(since)) { sinceInMs = BackplaneMessage.getDateFromId(since).getTime(); } // every message has a unique timestamp - which serves as a key for indexing Set<byte[]> messageIdBytes = Redis.getInstance().zrangebyscore(RedisBackplaneMessageDAO.getBusKey(bus), sinceInMs, Double.POSITIVE_INFINITY); List<BackplaneMessage> messages = new ArrayList<BackplaneMessage>(); Pipeline pipeline = jedis.pipelined(); List<Response<byte[]>> responses = new ArrayList<Response<byte[]>>(); if (messageIdBytes != null) { for (byte[] b : messageIdBytes) { responses.add(pipeline.get(getKey(new String(b)))); } pipeline.sync(); for (Response<byte[]> response : responses) { byte[] bytes = response.get(); if (bytes != null) { BackplaneMessage backplaneMessage = (BackplaneMessage) SerializationUtils .deserialize(bytes); messages.add(backplaneMessage); } } } filterAndSort(messages, since, sticky); return messages; } finally { Redis.getInstance().releaseToPool(jedis); } }
From source file:ch.epfl.leb.sass.models.fluorophores.commands.internal.FluorophoreReceiverIT.java
/** * Test of generateFluorophoresFromCSV method, of class FluorophoreReceiver. *//*from w w w . j a v a 2s. c om*/ @Test public void testGenerateFluorophoresFromCSV() throws Exception { URL csv = FluorophoreReceiverIT.class.getResource("/label_pix_sass.csv"); File csvFile = new File(csv.getFile()); GenerateFluorophoresFromCSV.Builder fluorBuilder = new GenerateFluorophoresFromCSV.Builder(); fluorBuilder.file(csvFile); // The file containing the locations. fluorBuilder.rescale(true); // Rescale positions to fit image? // Create the set of fluorophores. fluorBuilder.camera(camera).psfBuilder(psfBuilder).fluorDynamics(fluorDynamics).illumination(illumination); FluorophoreCommand fluorCommand = fluorBuilder.build(); List<Fluorophore> fluorophores = fluorCommand.generateFluorophores(); assertEquals(69358, fluorophores.size()); double minX = Double.POSITIVE_INFINITY; double maxX = Double.NEGATIVE_INFINITY; double minY = Double.POSITIVE_INFINITY; double maxY = Double.NEGATIVE_INFINITY; for (Fluorophore f : fluorophores) { if (f.getX() < minX) minX = f.getX(); if (f.getX() > maxX) maxX = f.getX(); if (f.getY() < minY) minY = f.getY(); if (f.getY() > maxY) maxY = f.getY(); } assertTrue(maxX <= 32); assertTrue(minX >= 0.0); assertTrue(maxY <= 32); assertTrue(minY >= 0.0); }
From source file:com.rapidminer.gui.plotter.charts.SeriesChartPlotter.java
@Override public List<ParameterType> getAdditionalParameterKeys(InputPort inputPort) { List<ParameterType> types = super.getAdditionalParameterKeys(inputPort); types.add(new ParameterTypeDouble(PARAMETER_MARKER, "Defines a horizontal line as a reference to the plot.", Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, true)); return types; }
From source file:lfsom.visualization.clustering.LFSKMeans.java
/** * Get the index of the closest cluster for the given instance index. Note * that in case of equally distant clusters we assign the first found * cluster. At the end of the day this means that the clusters with lower * indices will have a tendency to be larger. It hopefully won't have too * much impact, possibly a random assignment in case of equal weights would * make sense, however, this would require a couple of steps more in here. * /* ww w. j a va 2s . c o m*/ * @param instance * the data vector to be assigned * @return index of the closest cluster centre */ private int getIndexOfClosestCluster(double[] instance) { int indexOfClosestCluster = 0; double smallestDistance = Double.POSITIVE_INFINITY; double currentDistance = 0; for (int clusterIndex = 0; clusterIndex < k; clusterIndex++) { currentDistance = clusters[clusterIndex].getDistanceToCentroid(instance); if (currentDistance < smallestDistance) { smallestDistance = currentDistance; indexOfClosestCluster = clusterIndex; } } return indexOfClosestCluster; }
From source file:egat.replicatordynamics.SymmetricConstrainedAmoebaSearch.java
private double calculateObjective(PayoffMatrix pm, double[] cur, int[] restricted, double[] distribution) { double sum = 0.0; for (int r = 0, n = restricted.length - 1; r < n; r++) { if (cur[r] < 0) { return Double.POSITIVE_INFINITY; }/* w w w. j a v a2 s . c o m*/ sum += cur[r]; } if (sum > 1.0) { return Double.POSITIVE_INFINITY; } return calculateRegret(pm, cur, restricted, distribution); }
From source file:ucar.unidata.idv.control.chart.MyScatterPlot.java
/** * Calculates the Y data range./*from ww w . j a v a 2 s . c o m*/ * * @param data the data. * * @return The range. */ private Range calculateYDataRange(double[][] data) { Range result = null; // double[][] data = (double[][]) series.get(0); if (data != null) { double lowest = Double.POSITIVE_INFINITY; double highest = Double.NEGATIVE_INFINITY; for (int i = 0; i < data[0].length; i++) { double v = data[1][i]; if (v < lowest) { lowest = v; } if (v > highest) { highest = v; } } if (lowest <= highest) { result = new Range(lowest, highest); } } return result; }