Examples of Sample


Examples of org.jrobin.core.Sample

        if (dsNames == null && dsCount + 1 != tokens.length) {
          throw new RrdException("Expected " + dsCount + " values, " +
              (tokens.length - 1) + " value(s) found in: " + words[i]);
        }
        timestamp = Util.getTimestamp(tokens[0]);
        Sample sample = rrdDb.createSample(timestamp);
        for (int j = 1; j < tokens.length; j++) {
          if (dsNames == null) {
            sample.setValue(j - 1, parseDouble(tokens[j]));
          }
          else {
            sample.setValue(dsNames[j - 1], parseDouble(tokens[j]));
          }
        }
        sample.update();
      }
      return timestamp;
    }
    finally {
      releaseRrdDbReference(rrdDb);
View Full Code Here

Examples of org.jrobin.core.Sample

                    // long time to complete
                    if(newTime <= db.getLastArchiveUpdateTime()) {
                        Log.warn("Sample time of " + newTime +  " for statistic " + key + " is " +
                                "invalid.");
                    }
                    Sample sample = db.createSample(newTime);

                    if (Log.isDebugEnabled()) {
                        Log.debug("Stat: " + db.getPath() + ". Last sample: " + db.getLastUpdateTime() +
                                ". New sample: " + sample.getTime());
                    }

                    for (StatDefinition definition : definitions) {
                        // Get a statistic sample of this JVM
                        double statSample = sampleStat(key, definition);
                        // Add up samples of remote cluster nodes
                        for (Object nodeResult : remoteSamples) {
                            Map<String, Double> nodeSamples = (Map<String, Double>) nodeResult;
                            Double remoteSample = nodeSamples.get(key);
                            if (remoteSample != null) {
                                statSample += remoteSample;
                            }
                        }
                        // Update sample with values
                        sample.setValue(definition.getDatasourceName(), statSample);
                        sampledStats.add(definition.getDatasourceName());
                        definition.lastSampleTime = newTime;
                        definition.lastSample = statSample;
                    }
                    sample.update();
                }
                catch (IOException e) {
                    Log.error("Error sampling for statistic " + key, e);
                }
                catch (RrdException e) {
View Full Code Here

Examples of org.opentripplanner.analyst.core.Sample

        // 3. Compute the isochrone based on the SPT.
        ZFunc timeFunc = new ZFunc() {
            @Override
            public long z(Coordinate c) {
                // TODO Make the sample source multi-router compatible
                Sample sample = sampleSource.getSample(c.x, c.y);
                if (sample == null) {
                    return Long.MAX_VALUE;
                }
                Long z = sample.eval(spt);
                return z;
            }
        };
        // TODO Snap the center as XYZ tile grid for better sample-reuse (if using sample cache).
        Coordinate center = sptRequest.from.getCoordinate();
View Full Code Here

Examples of org.rrd4j.core.Sample

          // happens right at this spot
          if(now - 1 > db.getLastUpdateTime()) {
            // only do it if there is not already a value
            double lastValue = db.getLastDatasourceValue(DATASOURCE_STATE);
            if(!Double.isNaN(lastValue)) {
              Sample sample = db.createSample();
                    sample.setTime(now - 1);
                    sample.setValue(DATASOURCE_STATE, lastValue);
                    sample.update();
                        logger.debug("Stored '{}' with state '{}' in rrd4j database", name, mapToState(lastValue, item.getName()));
            }
          }
        } catch (IOException e) {
          logger.debug("Error re-storing last value: {}", e.getMessage());
        }
      }
      try {
        Sample sample = db.createSample();
              sample.setTime(now);
             
              DecimalType state = (DecimalType) item.getStateAs(DecimalType.class);
              if (state!=null) {
                    double value = state.toBigDecimal().doubleValue();
                    sample.setValue(DATASOURCE_STATE, value);
                    sample.update();
                    logger.debug("Stored '{}' with state '{}' in rrd4j database", name, item.getState());
              }
      } catch (IllegalArgumentException e) {
        if(e.getMessage().contains("at least one second step is required")) {
View Full Code Here

Examples of uk.ac.bbsrc.tgac.miso.core.data.Sample

  }

  public void buildSubmission() {
    //submittable.buildSubmission();

    Sample sample = (Sample)submittable;
    Element s = submission.createElementNS(null, "SAMPLE");

    s.setAttribute("alias", sample.getAlias());

    s.setAttribute("center_name", submissionProperties.getProperty("submission.centreName"));

    Element sampleTitle = submission.createElementNS(null, "TITLE");
    sampleTitle.setTextContent(sample.getAlias());
    s.appendChild(sampleTitle);

    Element sampleName = submission.createElementNS(null, "SAMPLE_NAME");
    Element sampleScientificName = submission.createElementNS(null, "SCIENTIFIC_NAME");
    sampleScientificName.setTextContent(sample.getScientificName());
    sampleName.appendChild(sampleScientificName);


    //2/11/2011 Antony Colles moved IF !=null statement, to help produce valid submission XML.
    Element sampleTaxonIdentifier = submission.createElementNS(null, "TAXON_ID");
    if (sample.getTaxonIdentifier() != null && !sample.getTaxonIdentifier().equals(""))
    {
      sampleTaxonIdentifier.setTextContent(sample.getTaxonIdentifier());
    }
    else
    {
      sampleTaxonIdentifier.setTextContent("000001");
    }
    sampleName.appendChild(sampleTaxonIdentifier);

    s.appendChild(sampleName);

    Element sampleDescription = submission.createElementNS(null, "DESCRIPTION");
    sampleDescription.setTextContent(sample.getDescription());
    s.appendChild(sampleDescription);

    if (submission.getElementsByTagName("SAMPLE_SET").item(0) != null) {
      submission.getElementsByTagName("SAMPLE_SET").item(0).appendChild(s);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.