Timeline

Creates a Timeline (see Handling Data that Changes Over Time) of a given type, with values valid from specified dates.

A timeline must have a value from the start-of-time (the null date), and so to assist with this, the Timeline expression contains an optional initialvalue element to specify the value from the start-of-time. If not used, then the collection of Interval used must contain an interval with a null start date, otherwise an error will occur if this expression is evaluated at runtime.

<?xml version="1.0" encoding="UTF-8"?>
<RuleSet name="Example_Timeline"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:noNamespaceSchemaLocation=
"http://www.curamsoftware.com/CreoleRulesSchema.xsd">

  <Class name="CreateTimelines">

    <!-- This example uses <initialvalue> to set the value valid
         from the start of time. -->
    <Attribute name="aNumberTimeline">
      <type>
        <javaclass name="curam.creole.value.Timeline">
          <javaclass name="Number"/>
        </javaclass>
      </type>
      <derivation>
        <Timeline>
          <intervaltype>
            <javaclass name="Number"/>
          </intervaltype>
          <!-- Value from start of time -->
          <initialvalue>
            <Number value="0"/>
          </initialvalue>
          <!-- The remaining intervals -->
          <intervals>
            <fixedlist>
              <listof>
                <javaclass name="curam.creole.value.Interval">
                  <javaclass name="Number"/>
                </javaclass>
              </listof>
              <members>
                <Interval>
                  <intervaltype>
                    <javaclass name="Number"/>
                  </intervaltype>
                  <start>
                    <Date value="2001-01-01"/>
                  </start>
                  <value>
                    <Number value="10000"/>
                  </value>
                </Interval>
                <Interval>
                  <intervaltype>
                    <javaclass name="Number"/>
                  </intervaltype>
                  <start>
                    <Date value="2004-12-01"/>
                  </start>
                  <value>
                    <Number value="12000"/>
                  </value>
                </Interval>

              </members>
            </fixedlist>

          </intervals>
        </Timeline>

      </derivation>
    </Attribute>


    <!-- This example does not use <initialvalue>. -->
    <Attribute name="aStringTimeline">
      <type>
        <javaclass name="curam.creole.value.Timeline">
          <javaclass name="String"/>
        </javaclass>
      </type>
      <derivation>
        <Timeline>
          <intervaltype>
            <javaclass name="String"/>
          </intervaltype>

          <!-- The list of intervals must include one valid from the
             null date (start of time), otherwise an error will
             occur at runtime, if this expression is evaluated. -->
          <intervals>
            <fixedlist>
              <listof>
                <javaclass name="curam.creole.value.Interval">
                  <javaclass name="String"/>
                </javaclass>
              </listof>
              <members>
                <Interval>
                  <intervaltype>
                    <javaclass name="String"/>
                  </intervaltype>
                  <start>
                    <!-- "from the start of time" -->
                    <null/>
                  </start>
                  <value>
                    <String value="Start of time string"/>
                  </value>
                </Interval>
                <Interval>
                  <intervaltype>
                    <javaclass name="String"/>
                  </intervaltype>
                  <start>
                    <Date value="2001-01-01"/>
                  </start>
                  <value>
                    <String value="2001-only String"/>
                  </value>
                </Interval>
                <Interval>
                  <intervaltype>
                    <javaclass name="String"/>
                  </intervaltype>
                  <start>
                    <Date value="2002-01-01"/>
                  </start>
                  <value>
                    <String value="2002-onwards String"/>
                  </value>
                </Interval>
              </members>
            </fixedlist>
          </intervals>
        </Timeline>
      </derivation>
    </Attribute>
  </Class>
</RuleSet>