Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
quickstart [2019/05/09 19:07]
admin
quickstart [2019/10/31 19:30] (current)
a.leofreddi
Line 3: Line 3:
 To use TimEL you need to import the following dependecy: To use TimEL you need to import the following dependecy:
  
 +//Maven//
   <​dependency>​   <​dependency>​
       <​groupId>​net.vleo.timel</​groupId>​       <​groupId>​net.vleo.timel</​groupId>​
-      <​artifactId>​timel</​artifactId>​ +      <​artifactId>​timel-core</​artifactId>​ 
-      <​version>​0.2.0-rc12</​version> ​!!! 0.9-xxx is being published!+      <​version>​0.9.3</​version>​
   </​dependency>​   </​dependency>​
  
-Use the TimEL facade to compile and run a program:+//​Gradle//​ 
 +  implementation '​net.vleo.timel:timel-core:​0.9.3'​
  
-<code java> +\\
-// Assemble the evaluation interval as [now, now + 1 second) +
-Instant now = Instant.now();​ +
-Interval interval = Interval.of(now,​ now.plus(1, ChronoUnit.SECONDS));​+
  
-// Compile the expression 1 + 1. +Now you're ready to go! Let's count how many days passed since (unixepoch:
-// As we expect an Integer here, we explicitly request an IntegerType +
-// for the sake of type safety, but we can compile generic code as well. +
-Expression<​Integer>​ expression = TimEL +
-        .parse("1 + 1") +
-        .compile(new IntegerType());​+
  
-// Iterate through ​the results +<code java> 
-TimeIterator<Integeritor = TimEL +// Compile ​the expression 
-        .evaluate(expressioninterval);+Expression<?expression ​= TimEL 
 +        .parse("​scale(scale(uniform(1.0)every(1, \"​DAY_OF_YEAR\",​ \"​UTC\"​)))"​) 
 +        .compile();
  
-// Since 1+1 is constant we'll have a single sample for the whole interval +// Evaluate and print the number of days from epoch 
-int v itor.next().getValue();+Interval interval ​Interval.of(Instant.ofEpochMilli(0), Instant.now()); 
 +System.out.println(TimEL.evaluate(expression,​ interval).next());
 </​code>​ </​code>​
  
-That's it! +===== Adding a variable =====
- +
-\\+
  
 Now let's try something a bit more complex, where we provide an input time-serie variable. As TimEL is a streaming api, it will pull values out of the variable when it needs them. In this case we are going to use a TreeMapVariable,​ which is a Variable backed by a regular in memory TreeMap: Now let's try something a bit more complex, where we provide an input time-serie variable. As TimEL is a streaming api, it will pull values out of the variable when it needs them. In this case we are going to use a TreeMapVariable,​ which is a Variable backed by a regular in memory TreeMap:
  • quickstart.1557428871.txt.gz
  • Last modified: 2019/05/09 19:07
  • by admin