org.unizone.source

Type RSI

org.unizone.0.4140
Instance of Type
Inheriting from SourceAdapterSingleTimeseries

Type dataValue
org.uninode.Type.displayPattern{att:org.unizone.source.Source.displayName}
org.unizone.source.Source.valueAttribute
org.uninode.Resource.resourceType
org.uninode.Resource.label
org.uninode.Resource.resourceOfList{}
org.uninode.Listable.resourcesReference[org.uninode.Listable.resources] of org.unizone.source.RSI

Attribute summaryDefined inUninode® IdPropertiesDefault
Reference[org.uninode.Listable.resources]resourcesListableorg.uninode.0.2001type
StringtoString
This is the display string.
Nodeorg.uninode.0.102
Typetype
The type of an object determines the behaviour and attributes of the object.
Nodeorg.uninode.0.101
StringuriNodeorg.uninode.0.103
StringlabelResourceorg.uninode.0.2041type
List[Type]resourceOfResourceorg.uninode.0.2042type
SignatureresourceType
This defines the type of resource. It can be 'view', 'adapter' or 'action'
Resourceorg.uninode.0.2043type
StringdisplayName
The display name is the name that is shown in lists, displays and graphs.
Sourceorg.unizone.0.4001essential
AttributevalueAttribute
The value attribute is used for determining the default value that should be used for displaying this source in a graph.
Sourceorg.unizone.0.4011type
inheritValue
SignaturevalueType
The value type determines which axes should be used in graphs.
Sourceorg.unizone.0.4002inheritValue
SourcesourceSourceAdapterSingleorg.unizone.0.4051

Method summaryDefined inOverridesProperties
voidactivateListable
voidcheckRangeSourceAdapterSingleSource
voiddesignEditor(WidgetWorkspace ws)Listable
voidgenerateScript(ScriptGenerationInfo info)SourceAdapterSingleScriptGenerator
Realget(DateTime timestamp)SourceAdapterSingleTimeseries
BooleanisResourceOf(Listable listable, Signature aspect)Mixabletype
ListablemixOn(Mixable mix)Mixable
ListablemixWith(Mixable mix)Mixable
voidput(DateTime timestamp, Real value)SourceAdapterSingleTimeseries
StringresourceStringListableintrospection
voidsetSource(Source source)SourceAdapterSingle
SourcesourceSourceAdapterSingle
voidXXXcom.nodelab.java.sourceadaptersingle.CheckRangeSourceAdapterSingle
SignatureXXXcom.nodelab.java.sourceadaptersingle.ValueTypeSourceAdapterSingle
voidcom.nodelab.java.source.ActivateSourceListable
Listablecom.nodelab.java.source.MixWithMiSourceMixable

Script summary
org.unizone.0.8552
/*
instance Value[Int] days;
constructor() {
  TimeSeries:();
  instance days = new Value(Int, 30);
  instance days.addListener(Void () {changedHistory()});
}
constructor(Source src, Int days) {
  TimeSeries:();
  setNextSource(src);
  instance days = new Value(Int, days);
  instance days.addListener(Void () {changedHistory()});
}
Void activate() {
  Gig gig = new Gig(ViewDiagramStandard);
  gig.addSource(this);
  gig.addSource(nextSource());
  gig.activate();
}
Void setDays(Int days) {
  instance days.set(days);
}
class Boolean isResourceOf(Listable node, Symbol aspect) {
  if (aspect == #adaptors) return true;
  false;
}
class String resourceLabel() "Name of resource" {
  "RSI day";
}
String resourceString() "Description of resource" {
  instance days.value.toString + " days RSI of " + nextSource().toString();
}
Mixable mixWith(Mixable item) {
  if (item.class.subclassOf(Source)) {
    setNextSource(Source{item});
    return this;
  }
  return TimeSeries:mixWith(item);
}
Symbol valueType() {#rsi}
Void designEditor(WidgetWorkspace ws) {
  ws.addLabel(new Place(0, 0).setPadding(5, 5), "Days");
  ws.addField(new Place(1, 0).setPadding(20, 5), instance days, null);
}
trace Void prepareData(Time from, Time to, Symbol resolution) {
  Source src = nextSource();
  Producer.report("Preparing " + toString());
  external cond_history_from = from.addDays(-instance days.value);
  external cond_history_to = to;
  external cond_history_resolution = #day;
  Set[Time] dates = new Set(Time);
  src.collectSteps(#cond_history, dates);
  Real sumUp = 0.0;
  Real sumDown = 0.0;
  Int fromIndex = 0;
  Int toIndex = 0;
  Int index = 0;
  Real val;
  Real trailFrom;
  Real trailTo;
  while (index < dates.size && dates.at(index) < from) index = index + 1;
  while (index < dates.size) {
    while (toIndex < index) {
      toIndex = toIndex + 1;
      external cond_history = dates.at(toIndex);
      val = Real{src.aspectValue(#value)};
      if (val != null) {
        if (trailTo != null) {
          if (dates.at(fromIndex) < fromTime) {
      external cond_history = dates.at(fromIndex);
      val = Real{src.aspectValue(#value)};
      if (val != null) {
        if (trailFrom != null) {
          if (val > trailFrom)
            sumUp = sumUp - val + trailFrom ;
          else
            sumDown = sumDown - trailFrom + val;
        }
        trailFrom = val;
      }
      fromIndex = fromIndex + 1;
    }
    if (sumUp + sumDown > 0)
      val = 100 * (sumUp - sumDown) / (sumUp + sumDown);
    else
  nextSource().instanceScript(info); // create variables
  info.objectId(this, AdaptorRSIDay, "rsi");
}
String initScript(InstanceScriptInfo info) {
  String prefix = info.methodPrefix(this);
  "  " + prefix + "setNextSource(" + nextSource().instanceScript(info) + ");
  " + prefix + "setDays(" + instance days.value.toString + ");
";
}

*/