List of usage examples for java.math BigInteger doubleValue
public double doubleValue()
From source file:com.github.jessemull.microflex.stat.statbiginteger.NBigIntegerTest.java
/** * Tests set calculation.//from www . j a v a 2s . c o m */ @Test public void testSet() { for (PlateBigInteger plate : array) { Map<WellBigInteger, Integer> resultMap = new TreeMap<WellBigInteger, Integer>(); Map<WellBigInteger, Integer> returnedMap = n.set(plate.dataSet()); for (WellBigInteger well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index++] = bi.doubleValue(); } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = stat.getN(); resultMap.put(well, (int) result); } for (WellBigInteger well : plate) { int result = resultMap.get(well); int returned = returnedMap.get(well); assertEquals(result, returned); } } }
From source file:com.github.jessemull.microflexbiginteger.stat.NTest.java
/** * Tests set calculation./*from ww w . ja va 2 s .c o m*/ */ @Test public void testSet() { for (Plate plate : array) { Map<Well, Integer> resultMap = new TreeMap<Well, Integer>(); Map<Well, Integer> returnedMap = n.set(plate.dataSet()); for (Well well : plate) { double[] input = new double[well.size()]; int index = 0; for (BigInteger bi : well) { input[index++] = bi.doubleValue(); } DescriptiveStatistics stat = new DescriptiveStatistics(input); double result = stat.getN(); resultMap.put(well, (int) result); } for (Well well : plate) { int result = resultMap.get(well); int returned = returnedMap.get(well); assertEquals(result, returned); } } }
From source file:uk.co.petertribble.jangle.SnmpChart.java
/** * Update the oids.//from ww w . j av a 2s.com */ public void updateAccessory() { double value; long newsnap = (new Date()).getTime(); // loop over all oids for (String stat : tsmap.keySet()) { try { BigInteger newvalue = sc.getValue(stat).getNumber(); if (showdelta) { BigInteger bd = newvalue.subtract(valueMap.get(stat)); double dt = (double) (newsnap - lastsnap); value = 1000.0 * (bd.doubleValue() / dt); valueMap.put(stat, newvalue); } else { value = newvalue.doubleValue(); } tsmap.get(stat).add(new Millisecond(), value); } catch (SnmpException sne) { } } lastsnap = newsnap; fireTableDataChanged(); }
From source file:com.github.jessemull.microflex.stat.statbiginteger.NBigIntegerTest.java
/** * Tests the aggregated plate statistics method using a collection. *//*from w w w . j a v a 2 s . c o m*/ @Test public void testAggregatedPlateCollection() { List<PlateBigInteger> collection = Arrays.asList(array); Map<PlateBigInteger, Integer> aggregatedReturnedMap = n.platesAggregated(collection); Map<PlateBigInteger, Integer> aggregatedResultMap = new TreeMap<PlateBigInteger, Integer>(); for (PlateBigInteger plate : collection) { List<Double> resultList = new ArrayList<Double>(); for (WellBigInteger well : plate) { for (BigInteger bi : well) { resultList.add(bi.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(plate, (int) resultAggregated); } for (PlateBigInteger plate : collection) { int result = aggregatedResultMap.get(plate); int returned = aggregatedReturnedMap.get(plate); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.NBigIntegerTest.java
/** * Tests the aggregated plate statistics method using an array. *//*from www . j a v a 2s . c om*/ @Test public void testAggregatedPlateArray() { Map<PlateBigInteger, Integer> aggregatedReturnedMap = n.platesAggregated(array); Map<PlateBigInteger, Integer> aggregatedResultMap = new TreeMap<PlateBigInteger, Integer>(); for (PlateBigInteger plate : array) { List<Double> resultList = new ArrayList<Double>(); for (WellBigInteger well : plate) { for (BigInteger bi : well) { resultList.add(bi.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(plate, (int) resultAggregated); } for (PlateBigInteger plate : array) { int result = aggregatedResultMap.get(plate); int returned = aggregatedReturnedMap.get(plate); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflexbiginteger.stat.NTest.java
/** * Tests the aggregated plate statistics method using a collection. */// www. jav a2 s. c o m @Test public void testAggregatedPlateCollection() { List<Plate> collection = Arrays.asList(array); Map<Plate, Integer> aggregatedReturnedMap = n.platesAggregated(collection); Map<Plate, Integer> aggregatedResultMap = new TreeMap<Plate, Integer>(); for (Plate plate : collection) { List<Double> resultList = new ArrayList<Double>(); for (Well well : plate) { for (BigInteger bi : well) { resultList.add(bi.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(plate, (int) resultAggregated); } for (Plate plate : collection) { int result = aggregatedResultMap.get(plate); int returned = aggregatedReturnedMap.get(plate); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflexbiginteger.stat.NTest.java
/** * Tests the aggregated plate statistics method using an array. *///from w w w . j a v a 2s. co m @Test public void testAggregatedPlateArray() { Map<Plate, Integer> aggregatedReturnedMap = n.platesAggregated(array); Map<Plate, Integer> aggregatedResultMap = new TreeMap<Plate, Integer>(); for (Plate plate : array) { List<Double> resultList = new ArrayList<Double>(); for (Well well : plate) { for (BigInteger bi : well) { resultList.add(bi.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(plate, (int) resultAggregated); } for (Plate plate : array) { int result = aggregatedResultMap.get(plate); int returned = aggregatedReturnedMap.get(plate); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.NBigIntegerTest.java
/** * Tests the aggregated plate statistics method using a collection. *//*from ww w . jav a 2 s .com*/ @Test public void testAggregatedSetCollection() { List<WellSetBigInteger> collection = new ArrayList<WellSetBigInteger>(); for (PlateBigInteger plate : array) { collection.add(plate.dataSet()); } Map<WellSetBigInteger, Integer> aggregatedReturnedMap = n.setsAggregated(collection); Map<WellSetBigInteger, Integer> aggregatedResultMap = new TreeMap<WellSetBigInteger, Integer>(); for (WellSetBigInteger set : collection) { List<Double> resultList = new ArrayList<Double>(); for (WellBigInteger well : set) { for (BigInteger bi : well) { resultList.add(bi.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(set, (int) resultAggregated); } for (WellSetBigInteger set : collection) { int result = aggregatedResultMap.get(set); int returned = aggregatedReturnedMap.get(set); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflexbiginteger.stat.NTest.java
/** * Tests the aggregated plate statistics method using a collection. *//*w w w . j a v a2 s . c o m*/ @Test public void testAggregatedSetCollection() { List<WellSet> collection = new ArrayList<WellSet>(); for (Plate plate : array) { collection.add(plate.dataSet()); } Map<WellSet, Integer> aggregatedReturnedMap = n.setsAggregated(collection); Map<WellSet, Integer> aggregatedResultMap = new TreeMap<WellSet, Integer>(); for (WellSet set : collection) { List<Double> resultList = new ArrayList<Double>(); for (Well well : set) { for (BigInteger bi : well) { resultList.add(bi.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(set, (int) resultAggregated); } for (WellSet set : collection) { int result = aggregatedResultMap.get(set); int returned = aggregatedReturnedMap.get(set); assertEquals(result, returned); } }
From source file:com.github.jessemull.microflex.stat.statbiginteger.NBigIntegerTest.java
/** * Tests the aggregated plate statistics method using an array. *///from www .j a v a2 s . com @Test public void testAggregatedSetArray() { WellSetBigInteger[] setArray = new WellSetBigInteger[array.length]; for (int i = 0; i < setArray.length; i++) { setArray[i] = array[i].dataSet(); } Map<WellSetBigInteger, Integer> aggregatedReturnedMap = n.setsAggregated(setArray); Map<WellSetBigInteger, Integer> aggregatedResultMap = new TreeMap<WellSetBigInteger, Integer>(); for (WellSetBigInteger set : setArray) { List<Double> resultList = new ArrayList<Double>(); for (WellBigInteger well : set) { for (BigInteger bi : well) { resultList.add(bi.doubleValue()); } } double[] inputAggregated = new double[resultList.size()]; for (int i = 0; i < resultList.size(); i++) { inputAggregated[i] = resultList.get(i); } DescriptiveStatistics statAggregated = new DescriptiveStatistics(inputAggregated); double resultAggregated = statAggregated.getN(); aggregatedResultMap.put(set, (int) resultAggregated); } for (WellSetBigInteger set : setArray) { int result = aggregatedResultMap.get(set); int returned = aggregatedReturnedMap.get(set); assertEquals(result, returned); } }