/** * Returns the date in the format "yyyy-MM-dd HH:mm:ss". * Use {@link #getDateString(long, String)} to specify a * custom date format instead. * @param time * @return */ public static String getDateAndTimeString(long time) { return getDateString(time, "yyyy-MM-dd HH:mm:ss"); }
/** * Registers the passed value listener for all subresources of <code>topNode</code> of type {@link ValueResource}, * also for those that will be added in the future. Safe to use on subtrees without references. * @param topNode * @param listener * @return */ public static TransitiveValueListener<ValueResource> registerTransitiveValueListener(Resource topNode, ResourceValueListener<ValueResource> listener) { return registerTransitiveValueListener(topNode, listener, ValueResource.class, true); }
public DefaultTimeSeriesFilterExtended(String id, String label, Map<ReadOnlyTimeSeries, String> shortName, Map<ReadOnlyTimeSeries, String> longName, Map<String, String> shortNameRD, Map<String, String> longNameRD) { this(id, label, shortName, longName, shortNameRD, longNameRD, null, null); } public DefaultTimeSeriesFilterExtended(String label,
@Override protected String format(T resource, Locale locale) { String output; if (resource instanceof FloatResource) output = ValueResourceUtils.getValue((FloatResource) resource, 2); // default; override in derived class, if necessary // FIXME or use parameter? else output = ValueResourceUtils.getValue(resource); return output; };
/** * Returns the value to be displayed on the user page. * Override this in derived class, if necessary. * * Note: several specific derived ResourceTextFields already come * with an adapted version of this, printing the resource value instead of * a name / the path of the resource. */ protected String format(T resource, Locale locale) { return ResourceUtils.getHumanReadableName(resource); }
public static String removeSubresourcesXml(String resourceXml, Class<? extends Resource> typeToBeRemoved, boolean recursive) throws SAXException, IOException, ParserConfigurationException, TransformerConfigurationException, TransformerException, TransformerFactoryConfigurationError { final Document document = getDocument(resourceXml); removeSubresourcesXml(document, typeToBeRemoved, recursive); return toString(document); }
/** * See {@link #interpolate(SampledValue, SampledValue, long, InterpolationMode, boolean)}. * The default value <tt>badQualityForUndefined = false</tt> is used here. * @param previous * @param next * @param t * @param mode * @return */ public static SampledValue interpolate(SampledValue previous, SampledValue next, long t, InterpolationMode mode) { return interpolate(previous, next, t, mode, false); }
/** * Similar to {@link #add(List, long, long)}, but here the data points are evaluated when needed * and not copied at construction time. * @param schedules * @param startTime * @param endTime * @return */ public static ReadOnlyTimeSeries addLazy(List<ReadOnlyTimeSeries> schedules, long startTime, long endTime) { return genericTimeSeriesSumLazy(schedules, startTime, endTime, false, false, null, false); }
/** * Get the first matching context resource of the specified type. See {@link #getContextResources(Resource, Class, boolean)}. * @param target * @param targetType * @return * A matching context resource, or null if none was found. * @throws NullPointerException if targetType is null */ public static <R extends Resource> R getFirstContextResource(final Resource target, final Class<R> targetType) { return getFirstContextResource(target, targetType, null, null); }
/** * Get a new instance. * @return */ public static ResourceCopyConfigurationBuilder newInstance() { return new ResourceCopyConfigurationBuilder(); }
/** * Get an unmodifiable MemoryTimeSeries representation of the input time series. * All operations that modify the time series, such as adding or deleting points, throw * UnsupportedOperationException. * * @param timeSeries * @return */ public static MemoryTimeSeries unmodifiableTimeSeries(final ReadOnlyTimeSeries timeSeries) { return new UnmodifiableMemoryTimeSeries(timeSeries); }
/** * Create a time series with random float values, in the value range 0..1. * @param nrPoints * @param startTime * @param avInterval * @param randomizeTimeSteps * @return */ public final static List<SampledValue> createRandomTimeSeries(final int nrPoints, final long startTime, final long avInterval, final boolean randomizeTimeSteps) { return createRandomTimeSeries(nrPoints, startTime, avInterval, randomizeTimeSteps, 1F, 0F); }
/** * Shifts the values of a temperature schedule by 273.15 (from Kelvin to Celsius) * * @param readOnlyTimeSeries * @return */ public static MemoryTimeSeries getTemperatureScheduleInCelsius(ReadOnlyTimeSeries readOnlyTimeSeries) { return affineTransformation(readOnlyTimeSeries,1,-273.15F); }
public DefaultTimeSeriesFilterExtended(String label, Map<ReadOnlyTimeSeries, String> shortName, Map<ReadOnlyTimeSeries, String> longName, Map<String, String> shortNameRD, Map<String, String> longNameRD, Map<ReadOnlyTimeSeries, Class<?>> typeMap, Map<String, Class<?>> typeMapRD) { this(ResourceUtils.getValidResourceName(label), label, shortName, longName, shortNameRD, longNameRD, typeMap, typeMapRD); } public DefaultTimeSeriesFilterExtended(String id, String label,
/** * Returns the value to be displayed on the user page. * Override this in derived class, if necessary. * * Note: several specific derived ResourceTextFields already come * with an adapted version of this, printing the resource value instead of * a name / the path of the resource. */ protected String format(T resource, Locale locale) { return ResourceUtils.getHumanReadableName(resource); }
public static String removeSubresourcesXml(String resourceXml, Class<? extends Resource>[] typesToBeRemoved, String[] relativePaths, boolean recursive) throws SAXException, IOException, ParserConfigurationException, TransformerConfigurationException, TransformerException, TransformerFactoryConfigurationError { final Document document = getDocument(resourceXml); removeSubresourcesXml(document, typesToBeRemoved, relativePaths, recursive); return toString(document); }
/** * Returns the date in the format "yyyy-MM-dd". * Use {@link #getDateString(long, String)} to specify a * custom date format instead. * @param time * @return */ public static String getDateString(long time) { return getDateString(time, "yyyy-MM-dd"); }
/** * Similar to {@link #getAverageTimeSeries(List, long, long)}, but here the data points are evaluated when needed * and not copied at construction time. * @param schedules * @param startTime * @param endTime * @return */ public static ReadOnlyTimeSeries getAverageTimeSeriesLazy(List<ReadOnlyTimeSeries> schedules, long startTime, long endTime) { return genericTimeSeriesSumLazy(schedules, startTime, endTime, false, true, null, false); }
/** * Get the communication status for some driver-managed resource. It is up to the driver to provide * the communication status resource, if it is not available null is returned. * @param target * Some resource that is managed by a driver that provides information on the communication status. * Could be a {@link PhysicalElement} resource representing a device managed by a driver, or a ValueResource. * @return */ public static CommunicationStatus getCommunicationStatus(final Resource target) { return ResourceUtils.getFirstContextResource(target, CommunicationStatus.class); }