org.unizone.source | ![]() |
org.unizone.0.4070
Instance of Type
Inheriting from SourceAdapterSingleTimeseries
Type data | Value |
org.uninode.Type.displayPattern | {att:org.unizone.source.Source.displayName} |
org.unizone.source.Source.valueAttribute | |
org.uninode.Resource.resourceType | '''adapter''' |
org.uninode.Resource.label | Average |
org.uninode.Resource.resourceOf | List{org.unizone.source.Source} |
org.uninode.Listable.resources | Reference[org.uninode.Listable.resources] of org.unizone.source.Average |
Attribute summary | Defined in | Uninode® Id | Properties | Default | |
Int | days | Average | org.unizone.0.4071 | 21 | |
Reference[org.uninode.Listable.resources] | resources | Listable | org.uninode.0.2001 | type | |
String | toString This is the display string. | Node | org.uninode.0.102 | ||
Type | type The type of an object determines the behaviour and attributes of the object. | Node | org.uninode.0.101 | ||
String | uri | Node | org.uninode.0.103 | ||
String | label | Resource | org.uninode.0.2041 | type | |
List[Type] | resourceOf | Resource | org.uninode.0.2042 | type | |
Signature | resourceType This defines the type of resource. It can be 'view', 'adapter' or 'action' | Resource | org.uninode.0.2043 | type | |
String | displayName The display name is the name that is shown in lists, displays and graphs. | Source | org.unizone.0.4001 | essential | |
Attribute | valueAttribute The value attribute is used for determining the default value that should be used for displaying this source in a graph. | Source | org.unizone.0.4011 | type inheritValue | |
Signature | valueType The value type determines which axes should be used in graphs. | Source | org.unizone.0.4002 | inheritValue | |
Source | source | SourceAdapterSingle | org.unizone.0.4051 |
Method summary | Defined in | Overrides | Properties | |
void | activate | Listable | ||
void | checkRange | SourceAdapterSingle | Source | |
void | designEditor(WidgetWorkspace ws) | Listable | ||
void | generateScript(ScriptGenerationInfo info) | SourceAdapterSingle | ScriptGenerator | |
Real | get(DateTime timestamp) | SourceAdapterSingleTimeseries | ||
Boolean | isResourceOf(Listable listable, Signature aspect) | Mixable | type | |
Listable | mixOn(Mixable mix) | Mixable | ||
Listable | mixWith(Mixable mix) | Mixable | ||
void | put(DateTime timestamp, Real value) | SourceAdapterSingleTimeseries | ||
String | resourceString | Listable | introspection | |
void | setSource(Source source) | SourceAdapterSingle | ||
Source | source | SourceAdapterSingle | ||
void | XXXcom.nodelab.java.sourceadaptersingle.CheckRange | SourceAdapterSingle | ||
Signature | XXXcom.nodelab.java.sourceadaptersingle.ValueType | SourceAdapterSingle | ||
void | com.nodelab.java.source.Activate | Source | Listable | |
Listable | com.nodelab.java.source.MixWithMi | Source | Mixable |
Script summary |
org.unizone.0.8546import org.uninode.widget.Workspace; import org.uninode.widget.Place; import org.unizone.source.Source; import org.uninode.Listable; import com.nodelab.System; import org.edgescript.ScriptGenerationInfo; import org.uninode.dimension.DimensionHistory; import org.uninode.collection.List; constructor() { SourceAdapterSingleTimeseries:(); days = 30; // addListener(Void () {changedHistory()}); } constructor(Source src, Int days) { SourceAdapterSingleTimeseries:(); setSource(src); this.days = days; // days.addListener(Void () {changedHistory()}); } void setDays(Int days) { this.days = days; } type Boolean isResourceOf(Listable node, Signature aspect) { if (aspect == 'adapter') return true; false; } String displayName() { "" + days + " days average of " + source().toString(); } /* Signature valueType() { source.valueType; } */ void designEditor(Workspace ws) { // ws.addLabel(new Place(0, 0).setPadding(5, 5), "Days"); // ws.addField(new Place(1, 0).setPadding(20, 5), days, null); } trace void prepareRange() { System.report("preparing " + toString); Source src = source; List[Date] dates = new List[Date](10); List[Real] values = new List[Real](10); Date from = Date{DimensionHistory@'org.uninode.Dimension.from'}; Date to = Date{DimensionHistory@'org.uninode.Dimension.to'}; DimensionHistory@'org.uninode.Dimension.from' = from.addDays(-days); src.collectValues(dates, values, DimensionHistory); Real sum = 0.0; Int count = 0; Int fromIndex = 0; Int toIndex = -1; Int index = 0; Real val; while (index < dates.size && dates.get(index) < from) index = index + 1; while (index < dates.size) { while (toIndex < index) { toIndex = toIndex + 1; DimensionHistory@'org.uninode.Dimension.focus' = dates.get(toIndex); val = src.evaluate; if (val != null) { sum = sum + val; count = count + 1; } } Date fromDate = dates.get(index).addDays(-days); while (dates.get(fromIndex) < fromDate) { DimensionHistory@'org.uninode.Dimension.focus' = dates.get(fromIndex); val = src.evaluate; if (val != null) { sum = sum - val; count = count - 1; } fromIndex = fromIndex + 1; } if (count > 0) val = (10000.0 * sum / count).round / 10000.0; else val = null; put(dates.get(index), val); index = index + 1; } } void instanceScript(ScriptGenerationInfo info) { // getSource().instanceScript(info); // create variables // info.objectId(this, AverageDay, "ave"); } void initScript(ScriptGenerationInfo info) { // String prefix = info.methodPrefix(this); // " " + prefix + "setNextSource(" + getSource().instanceScript(info) + "); // " + prefix + "setDays(" + days.toString + "); //"; } |