congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TimeResource
Code IndexAdd Tabnine to your IDE (free)

How to use
TimeResource
in
org.ogema.core.model.simple

Best Java code snippets using org.ogema.core.model.simple.TimeResource (Showing top 20 results out of 315)

origin: org.ogema.ref-impl/util

@XmlElement
public long getValue() {
  return ((TimeResource) res).getValue();
}
origin: org.ogema.tools/system-supervision

public static long getInterval(final TimeResource itvRes, long defaultItv) {
  long proposed = 0;
  if (itvRes.isActive())
    proposed = itvRes.getValue();
  if (proposed < MIN_SUPERVISION_ITV) {
    proposed = defaultItv;
    itvRes.<TimeResource> create().setValue(defaultItv);
    itvRes.activate(false);
  }
  return proposed;
}
origin: org.ogema.tools/resource-manipulators

private static RecordedData getHistoricalData(SingleValueResource resource) {
  RecordedData rd = null;
  if (resource instanceof FloatResource)
    rd = ((FloatResource) resource).getHistoricalData();
  else if (resource instanceof IntegerResource)
    rd = ((IntegerResource) resource).getHistoricalData();
  else if (resource instanceof TimeResource)
    rd = ((TimeResource) resource).getHistoricalData();
  else if (resource instanceof BooleanResource)
    rd = ((BooleanResource) resource).getHistoricalData();
  else 
    throw new IllegalArgumentException("Logging not possible for resource of type " + resource.getResourceType().getName());
  return rd;
}
 
origin: org.smartrplace.sim/resource-simulation

private static long getForecastHorizon(final ConfigPattern config) {
  if (config.forecastHorizon.isActive()) {
    final long try0 = config.forecastHorizon.getValue();
    if (try0 > 0)
      return try0;
  }
  return 24 * 60 * 60 * 1000; // one day
}

origin: org.ogema.widgets/widget-extended

@Override
public JSONObject onPOST(String data, OgemaHttpRequest req) {
  JSONObject result = super.onPOST(data, req);
  if (selectedResource != null && selectedResource.exists()) 
    selectedResource.setValue(getDateLong());
  else
    setDate("");
  return result;
}
 
origin: org.smartrplace.apps/smartrplace-util-proposed

private int performAttempt() {
  int code;
  if((serverUnavailableUntil != null) && 
      (serverUnavailableUntil.getValue() > appMan.getFrameworkTime())) {
    code = -2;
  } else {
    code = FileUploadUtil.sendFile(sourceToUse, dest, user, pw, serverPortAddress, appMan);            
    if(((code == -2)||(code == -3))&&(serverUnavailableUntil != null)) {
      serverUnavailableUntil.setValue(appMan.getFrameworkTime()+retryInterval/2);
    }
  }
  attemptCount++;
  setStatus(code);
  return code;
}
origin: org.ogema.tools/resource-manipulators

private ScheduleReductionAction getResourceFromConfig(TimeSeriesReduction config, long ageThreshold) {
  ScheduleReductionAction resource = null;
  if (config instanceof DeletionAction) {
    resource = this.config.actions().getSubResource(getNextActionName(), ScheduleDeletionAction.class).create();
  }
  else if (config instanceof InterpolationAction) {
    resource = this.config.actions().getSubResource(getNextActionName(), ScheduleDownsamplingAction.class).create();
    ((ScheduleDownsamplingAction) resource).minInterval().<TimeResource> create().setValue(((InterpolationAction) config).getMinInterval());
  }
  else if (config instanceof StepsReductionAction) {
    resource = this.config.actions().getSubResource(getNextActionName(), ScheduleStepsReductionAction.class).create();
  }
  else 
    throw new IllegalArgumentException("TimeSeriesReduction must be either a deletion action or a interpolation action; got " + config.getClass().getName() );
  if (resource != null) {
    resource.ageThreshold().<TimeResource> create().setValue(ageThreshold);
  }
  return resource;
}
 
origin: org.ogema.ref-impl/resource-manager

final RwPair<Long> pair = m_timeMap.get(path);
final Long value = pair.write;
if (!resource.exists()) {
  pair.read = null;
} else if (value == null) {
  pair.read = resource.getValue();
} else {
  resource.setValue(value);
  pair.read = resource.getValue();
origin: org.ogema.tools/system-supervision

  @Override
  public void timerElapsed(Timer timer /* may be null */) {
    if (!ramCheckSemaphore.tryAcquire())
      return;
    try {
      final Runtime runtime = Runtime.getRuntime();
      runtime.gc();
      final long used = ( runtime.totalMemory() - runtime.freeMemory());
      final long memMax = runtime.maxMemory();
      config.results().usedMemorySize().<TimeResource> create().setValue(used);
      config.results().maxAvailableMemorySize().<TimeResource> create().setValue(memMax); // should not really change
      config.results().usedMemorySize().activate(false);
      config.results().maxAvailableMemorySize().activate(false);
      appMan.getLogger().info("RAM used: {} MB, max. RAM available: {}", (used/mb), (memMax/mb));
    } finally {
      ramCheckSemaphore.release();
    }
  }
};
origin: org.ogema.widgets/widget-extended

@Override
public JSONObject retrieveGETData(OgemaHttpRequest req) {
  if (selectedResource != null && selectedResource.exists()) 
    setDate(selectedResource.getValue());
  else
    setDate(""); // FIXME
  return super.retrieveGETData(req);
}
 
origin: org.ogema.widgets/widget-extended

@Override
protected void setResourceValue(TimeResource resource, String value, OgemaHttpRequest req) {
  try {
    resource.setValue(getTimeValue(value, getData(req).getInterval()));
  } catch (Exception e) {
    // ignore: we do not want to write user data to the log
  }
}
 
origin: org.smartrplace.apps/smartrplace-util-proposed

  value = getCorerrectedValue(value, mode);
if(!source.exists()) {
  source.create();
  source.setValue(value);
  source.activate(true);
} else {
  source.setValue(value);
origin: org.ogema.tools/grafana-base

switch (dataType.getDataType()) {
case 0:
  ts = tr.getHistoricalData();
  break;
case 1:
  ts = tr.forecast();
  break;
case 2:
  ts = tr.program();
  break;
origin: org.ogema.drivers/remote-rest-connector

protected boolean needsPushListener() {
  if (isRecursivePushTrigger())
    return true;
  return !con.pushInterval().isActive();
}
origin: org.smartrplace.apps/smartrplace-util-proposed

public void onGET(OgemaHttpRequest req) {
  TimeResource source = getResource(sva, req, null);
  if ((source == null)||(!source.isActive())) {
    myLabel.setText("n.a.", req);
    return;
  switch(mode) {
  case 1:
    time = StringFormatHelper.getFormattedTimeOfDay(source.getValue());
    break;
  case 2:
    if(source.getValue() <= 0) time = "not set";
    else
      time = StringFormatHelper.getFormattedAgoValue(appMan, source);
    break;
  case 3:
    if(source.getValue() <= 0) time = "not set";
    else
      time = StringFormatHelper.getFormattedFutureValue(appMan, source);
    break;
  case 4:
    if(source.getValue() <= 0) time = "not set";
    else
      time = TimeUtils.getDateString(source.getValue());
    break;
  default:
    if(source.getValue() <= 0) time = "not set";
    else
      time = TimeUtils.getDateAndTimeString(source.getValue());
origin: org.ogema.tools/resource-manipulators

sum += ((TimeResource) value).getValue();
isEmpty = false;
sum += ((TimeResource) value).getValue();
isEmpty = false;
((TimeResource) m_config.resultBase()).setValue(sum);
origin: org.ogema.tools/resource-manipulators

config.targetResourceParent().create();
config.targetResourceParent().addDecorator("schedule",targetResource);
config.updateInterval().create();
config.updateInterval().setValue(updateInterval);
config.actions().create();
for (Map.Entry<Long, TimeSeriesReduction> action: actions.entrySet()) {
origin: org.ogema.tools/system-supervision

  @Override
  public void timerElapsed(Timer timer /* may be null */) {
    if (!diskCheckSemaphore.tryAcquire())
      return;
    try {
      final long dataSize = size(Paths.get("./data"));
      final long rundirSize = size(Paths.get("."));
      long free = Long.MIN_VALUE;
      try {
        free = Files.getFileStore(Paths.get("/")).getUsableSpace();
      } catch (IOException e) {
        appMan.getLogger().warn("Error determining free disk space",e);
      }
      config.results().rundirFolderSize().<TimeResource> create().setValue(rundirSize);
      config.results().dataFolderSize().<TimeResource> create().setValue(dataSize);
      if (free != Long.MIN_VALUE)
        config.results().freeDiskSpace().<TimeResource> create().setValue(free);
      config.results().rundirFolderSize().activate(false);
      config.results().dataFolderSize().activate(false);
      config.results().freeDiskSpace().activate(false);
      appMan.getLogger().info("Rundir folder size: {} MB, data folder: {} MB, free disk space: {} MB", 
          (rundirSize/mb), (dataSize/mb), (free != Long.MIN_VALUE ? (free/mb) : "n.a."));
    } finally {
      diskCheckSemaphore.release();
    }
  }
};
origin: org.ogema.ref-impl/resource-manager

final Long value = (resource.exists()) ? resource.getValue() : null;
final RwPair<Long> pair = m_timeMap.get(path);
pair.read = value;
origin: org.ogema.tools/resource-utils

/**
 * Set the resource value. The <code>value</code> parameter must be parsable to the primitive (or String)
 * value type of <code>resource</code>. For instance, if <code>resource</code> is a {@link FloatResource},
 * then <code>value</code> must be parsable as float.
 * @param resource
 * @param value
 * @throws NumberFormatException
 */
public static void setValue(SingleValueResource resource, String value) throws NumberFormatException {
  if (resource instanceof StringResource) {
    ((StringResource) resource).setValue(value);
  }
  else if (resource instanceof FloatResource) {
    ((FloatResource) resource).setValue(Float.parseFloat(value));
  }
  else if (resource instanceof IntegerResource) {
    ((IntegerResource) resource).setValue(Integer.parseInt(value));
  }
  else if (resource instanceof BooleanResource) {
    ((BooleanResource) resource).setValue(Boolean.parseBoolean(value));
  }
  else if (resource instanceof TimeResource) {
    ((TimeResource) resource).setValue(Long.parseLong(value));
  }
}
org.ogema.core.model.simpleTimeResource

Most used methods

  • getValue
  • setValue
  • isActive
  • create
  • getHistoricalData
  • exists
  • activate
  • historicalData
  • forecast
  • getPath
  • program
  • program

Popular in Java

  • Reading from database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getApplicationContext (Context)
  • setScale (BigDecimal)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now