List of usage examples for java.lang Float NaN
float NaN
To view the source code for java.lang Float NaN.
Click Source Link
From source file:pcgen.cdom.facet.analysis.ChallengeRatingFacet.java
/** * Returns the Challenge Rating of the Player Character represented by the * given CharID/* ww w.j a v a2 s. c om*/ * * @param id * The CharID representing the Player Character for which the * Challenge Rating should be returned * @return The Challenge Rating of the Player Character represented by the * given CharID */ public Float getCR(CharID id) { Float CR = new Float(0); if (levelFacet.getMonsterLevelCount(id) == 0) { if (levelFacet.getNonMonsterLevelCount(id) == 0) { return Float.NaN; } // calculate and add class CR for 0-HD races CR += calcClassesCR(id); } else { // calculate and add race CR and classes CR for // races with racial hit dice Float classRaceCR = calcClassesForRaceCR(id); if (classRaceCR.isNaN()) { return Float.NaN; } CR += calcRaceCR(id); CR += classRaceCR; } // calculate and add CR bonus from templates CR += getTemplateCR(id); // calculate and add in the MISC bonus to CR CR += (float) bonusCheckingFacet.getBonus(id, "MISC", "CR"); // change calculated results of less than CR 1 to fraction format if (CR < 1) { Float crMod = SettingsHandler.getGame().getCRSteps().get((int) CR.floatValue()); if (crMod != null) { CR = crMod; } else { CR = Math.max(CR, 0); } } return CR; }
From source file:edu.purdue.cc.bionet.util.Spectrum.java
/** * Returns true if the value is contained in this Spectrum's Range. * /* w w w . j a v a 2s .com*/ * @param value The value to be checked. * @return Whether the value is in range or not. */ protected boolean inRange(float value) { return (value != Float.NaN && this.range.contains(value)); }
From source file:org.broad.igv.data.ProcessingUtils.java
private static float computeMean(float[] data) { float sum = 0.0f; int nPts = 0; for (int i = 0; i < data.length; i++) { if (!Float.isNaN(data[i])) { sum += data[i];//from w w w.j a va 2 s. c o m nPts++; } } return (nPts == 0 ? Float.NaN : sum / nPts); }
From source file:juicebox.matrix.SymmetricMatrix.java
public float getRowMean(int i) { float sum = 0; int count = 0; for (int j = 0; j < dim; j++) { float value = getEntry(i, j); if (!Float.isNaN(value)) { sum += value;//from w w w. ja v a 2s. com count++; } } return count == 0 ? Float.NaN : sum / count; }
From source file:com.taobao.weex.dom.WXRecyclerDomObject.java
@Override public void add(WXDomObject child, int index) { if (WXBasicComponentType.CELL_SLOT.equals(child.getType()) && child instanceof WXCellDomObject) { if (cellList == null) { cellList = Collections.synchronizedList(new ArrayList<WXCellDomObject>()); }//from ww w . jav a 2 s . c o m cellList.add((WXCellDomObject) child); } else { super.add(child, index); } if (WXBasicComponentType.CELL.equals(child.getType()) || WXBasicComponentType.CELL_SLOT.equals(child.getType())) { if (!mIsPreCalculateCellWidth) { preCalculateCellWidth(); } if (mColumnWidth != 0 && mColumnWidth != Float.NaN) { child.getStyles().put(Constants.Name.WIDTH, mColumnWidth); } } }
From source file:com.bc.fiduceo.matchup.MatchupToolIntegrationTest_useCase_02.java
@Test public void testMatchup_overlappingSensingTimes() throws IOException, ParseException, SQLException, InvalidRangeException { final UseCaseConfig useCaseConfig = createUseCaseConfigBuilder().withTimeDeltaSeconds(10800) // 3 hours - we have one intersecting time interval .withMaxPixelDistanceKm(3) // value in km .withAngularScreening("satellite_zenith_angle", "satellite_zenith_angle", Float.NaN, Float.NaN, 10.f)/* w w w .j a v a 2 s . co m*/ .createConfig(); final File useCaseConfigFile = storeUseCaseConfig(useCaseConfig, "usecase-02.xml"); insert_AVHRR_GAC_NOAA17(); insert_AVHRR_GAC_NOAA18(); final String[] args = new String[] { "-c", configDir.getAbsolutePath(), "-u", useCaseConfigFile.getName(), "-start", "2007-090", "-end", "2007-092" }; MatchupToolMain.main(args); final File mmdFile = getMmdFilePath(useCaseConfig, "2007-090", "2007-092"); assertTrue(mmdFile.isFile()); try (NetcdfFile mmd = NetcdfFile.open(mmdFile.getAbsolutePath())) { NCTestUtils.assertVectorVariable("avhrr-n17_x", 0, 52.0, mmd); NCTestUtils.assertVectorVariable("avhrr-n17_y", 1, 13025.0, mmd); NCTestUtils.assertStringVariable("avhrr-n17_file_name", 2, "20070401033400-ESACCI-L1C-AVHRR17_G-fv01.0.nc", mmd); NCTestUtils.assertVectorVariable("avhrr-n18_x", 3, 79.0, mmd); NCTestUtils.assertVectorVariable("avhrr-n18_y", 4, 2306.0, mmd); NCTestUtils.assertStringVariable("avhrr-n18_file_name", 5, "20070401080400-ESACCI-L1C-AVHRR18_G-fv01.0.nc", mmd); NCTestUtils.assert3DVariable("avhrr-n17_acquisition_time", 0, 0, 6, 1175405006.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_acquisition_time", 1, 0, 7, 1175415805.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_lat", 2, 0, 8, 19.722999572753906, mmd); NCTestUtils.assert3DVariable("avhrr-n18_lon", 3, 0, 9, -103.84298706054688, mmd); NCTestUtils.assert3DVariable("avhrr-n18_dtime", 4, 0, 10, 1154.00048828125, mmd); NCTestUtils.assert3DVariable("avhrr-n18_ch1", 0, 1, 11, 3.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_ch2", 1, 1, 12, 0.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_ch3a", 2, 1, 13, -32768.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_ch3b", 3, 1, 14, 991.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_ch4", 4, 1, 15, 668.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_ch5", 0, 2, 16, 932.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_satellite_zenith_angle", 1, 2, 17, 3870.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_solar_zenith_angle", 2, 2, 18, 14806.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_relative_azimuth_angle", 3, 2, 19, 5455.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_ict_temp", 4, 2, 20, 1466.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_qual_flags", 0, 3, 21, 0.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_cloud_mask", 1, 3, 22, 7.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_cloud_probability", 2, 3, 23, -128.0, mmd); NCTestUtils.assert3DVariable("avhrr-n18_l1b_line_number", 3, 3, 24, 2312.0, mmd); NCTestUtils.assert3DVariable("avhrr-n17_lat", 4, 3, 25, 19.702999114990234, mmd); NCTestUtils.assert3DVariable("avhrr-n17_lon", 0, 4, 26, -104.16299438476562, mmd); NCTestUtils.assert3DVariable("avhrr-n17_dtime", 1, 4, 27, 6515.00048828125, mmd); NCTestUtils.assert3DVariable("avhrr-n17_ch1", 1, 1, 28, 0.0, mmd); NCTestUtils.assert3DVariable("avhrr-n17_ch2", 2, 1, 29, 5.0, mmd); // @todo 2 tb/** add more assertions here } }
From source file:uk.gov.nationalarchives.discovery.taxonomy.batch.actor.supervisor.CategorisationSupervisorActor.java
@Override public void startEpic(Object message) { if (message instanceof CategoriseAllDocumentsEpic) { logger.info("START WHOLE CATEGORISATION"); categoriserService.refreshTaxonomyIndex(); this.totalNbOfDocs = iaViewService.getTotalNbOfDocs(); if (totalNbOfDocs == 0) { throw new TaxonomyException(TaxonomyErrorType.DOC_NOT_FOUND, "The index is empty"); }/*from ww w . j a v a 2 s .com*/ status = CategorisationStatusEnum.INITIATED; Integer afterDocNumber = ((CategoriseAllDocumentsEpic) message).getAfterDocNumber(); if (afterDocNumber != null) { lastElementRetrieved = new FieldDoc(afterDocNumber, Float.NaN, new Object[] { afterDocNumber }); logger.info(".categoriseAllDocuments: categorizing {} documents from doc numbered: {}", this.totalNbOfDocs, afterDocNumber); } else { lastElementRetrieved = null; logger.info(".categoriseAllDocuments: categorizing {} documents", this.totalNbOfDocs); } categoriseDocsMessageNumber = 0; currentEpic = message; } }
From source file:org.broad.igv.tools.Accumulator.java
public void finish() { if (isFinished) { return; } mean = Float.isNaN(sum) ? Float.NaN : sum / nPts; isFinished = true; }
From source file:com.cloudera.oryx.rdf.common.rule.NumericDecision.java
static List<Decision> numericDecisionsFromExamples(int featureNumber, Iterable<Example> examples, int suggestedMaxSplitCandidates) { Multiset<Float> sortedFeatureValueCounts = TreeMultiset.create(); StorelessUnivariateStatistic mean = new Mean(); int numExamples = 0; for (Example example : examples) { NumericFeature feature = (NumericFeature) example.getFeature(featureNumber); if (feature == null) { continue; }//from www . j a v a 2 s . c om numExamples++; float value = feature.getValue(); sortedFeatureValueCounts.add(value, 1); mean.increment(value); } // Make decisions from split points that divide up input into roughly equal amounts of examples List<Decision> decisions = Lists.newArrayListWithExpectedSize(suggestedMaxSplitCandidates); int approxExamplesPerSplit = FastMath.max(1, numExamples / suggestedMaxSplitCandidates); int examplesInSplit = 0; float lastValue = Float.NaN; // This will iterate in order of value by nature of TreeMap for (Multiset.Entry<Float> entry : sortedFeatureValueCounts.entrySet()) { float value = entry.getElement(); if (examplesInSplit >= approxExamplesPerSplit) { decisions.add( new NumericDecision(featureNumber, (value + lastValue) / 2.0f, (float) mean.getResult())); examplesInSplit = 0; } examplesInSplit += entry.getCount(); lastValue = value; } // The vital condition here is that if decision n decides an example is positive, then all subsequent // decisions in the list will also find it positive. So we need to order from highest threshold to lowest Collections.reverse(decisions); return decisions; }
From source file:juicebox.matrix.SymmetricMatrix.java
@Override public float getEntry(int i, int j) { int idx = getIdx(i, j); return idx < data.length ? data[idx] : Float.NaN; }