object JavaApi
API interface for accessing the TeSSLa compiler from other Java or Scala projects. This API is optimized for a comfortable use from Java and Scala code.
Usage example (in Java):
import de.uni_luebeck.isp.tessla.interpreter.JavaApi; import de.uni_luebeck.isp.tessla.interpreter.JavaApi.*; import de.uni_luebeck.isp.tessla.interpreter.StreamEngine; class Main { public static void main(String[] args) { String spec_str = "in temperature: Events[Int]\r\n" + "\r\n" + "def low = temperature < 3\r\n" + "def high = temperature > 8\r\n" + "def unsafe = low || high\r\n" + "\r\n" + "out unsafe"; System.out.println("Compiling..."); Engine res = JavaApi.compile(spec_str ,"spec.tessla").engine(); System.out.println("Ready!"); res.addListener(new EngineListener(){ public void event(String stream, scala.math.BigInt time, Object value) { System.out.println("Got: " + stream + " = " + value + " at " + time); } public void printEvent(scala.math.BigInt time, Object value) { System.out.println("Raw output: " + value + " at " + time); } }); res.setTime(1); res.provide("temperature",2); res.setTime(2); res.provide("temperature",15); res.setTime(5); res.provide("temperature",8); res.step(); System.out.println("Finished!"); } }
Note: This API internally uses the TeSSLa interpreter. For high performance applications it is advisable to use the TeSSLa compiler to generate a Scala API directly for a specific specification.
- Alphabetic
- By Inheritance
- JavaApi
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- case class CompilationResult(result: Result, engine: Engine) extends Product with Serializable
Container for the result of the compilation of a TeSSLa specification.
Container for the result of the compilation of a TeSSLa specification.
- result
Object containing the errors and warnings which occurred during compilation
- engine
Monitor generated from the specification (can be used to receive input streams and generate output streams)
- case class Diagnostic(diagnostic: core.Diagnostic) extends Product with Serializable
Diagnostic object, carrying information about errors and warnings which occur during compilation and execution.
Diagnostic object, carrying information about errors and warnings which occur during compilation and execution.
- diagnostic
The Diagnostic object from the core API used to generate the Diagnostic object
- case class Engine(spec: Interpreter) extends Product with Serializable
Class for a TeSSLa monitor.
Class for a TeSSLa monitor.
Intended usage is not to directly instantiate an Engine but to use the compile function instead. See usage example of JavaApi for details.
An Engine object can be used to receive events from input streams (see provide) and to attach listeners for output streams (see addListener)
- spec
The interpreter of the base specification
- abstract class EngineListener extends AnyRef
Abstract interface of a Listener which can be attached to an Engine to observe the outputs generated there.
Abstract interface of a Listener which can be attached to an Engine to observe the outputs generated there. Use Engine.addListener to attach a Listener to an engine.
- case class Result(warnings: List[Diagnostic], errors: List[Diagnostic]) extends Product with Serializable
Container class for errors and warnings that occurred during compilation of a TeSSLa specification.
Container class for errors and warnings that occurred during compilation of a TeSSLa specification.
- warnings
Warnings which occurred during compilation
- errors
Errors which occurred during compilation
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def compile(tessla: String, fileName: String, baseTime: String): CompilationResult
Compiles a TeSSLa specification, i.e.
Compiles a TeSSLa specification, i.e. generates a monitor which can then be used to receive an input trace and generate an output trace. This variant of the function requires a base time unit to be set, which is necessary if the TeSSLa specification itself uses time units (like ns, ms, s).
- tessla
The TeSSLa code to be compiled/executed.
- fileName
The name of the TeSSLa file (does not really have to exist in the filesystem but is used, e.g. in error messages.
- returns
Object containing information about errors/warnings during compilation and an engine which can be used for monitoring.
- def compile(tessla: String, fileName: String): CompilationResult
Compiles a TeSSLa specification, i.e.
Compiles a TeSSLa specification, i.e. generates a monitor which can then be used to receive an input trace and generate an output trace.
- tessla
The TeSSLa code to be compiled/executed.
- fileName
The name of the TeSSLa file (does not really have to exist in the filesystem but is used, e.g. in error messages.
- returns
Object containing information about errors/warnings during compilation and an engine which can be used for monitoring.
- def compile(specSource: CharStream, compilerOptions: Options): CompilationResult
Compiles a TeSSLa specification, i.e.
Compiles a TeSSLa specification, i.e. generates a monitor which can then be used to receive an input trace and generate an output trace. This variant of the function requires compiler options to handle the fine tuning of the compiler and a CharStream for the input.
- specSource
The TeSSLa specification source as a char stream.
- compilerOptions
The options for the compiler. See the corresponding documentation of Compiler.Options for details.
- returns
Object containing information about errors/warnings during compilation and an engine which can be used for monitoring.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def verify(tessla: String, fileName: String, timeUnit: String): Result
Checks a TeSSLa specification for sound compilation.
Checks a TeSSLa specification for sound compilation. I.e. checks for Errors/Warnings in the code. This variant of the function requires a base time unit to be set, which is necessary if the TeSSLa specification itself uses time units (like ns, ms, s).
- tessla
The TeSSLa code to be verified.
- fileName
The name of the TeSSLa file (does not really have to exist in the filesystem but is used, e.g. in error messages.
- timeUnit
The base time unit. I.e. the unit of the input timestamps, Equal to the --base-time flag of the TeSSLa binary. Possible valid values are e.g. 1ns, 25ms, 1s etc.
- returns
Object containing information about errors and warnings during compilation.
- def verify(tessla: String, fileName: String): Result
Checks a TeSSLa specification for sound compilation.
Checks a TeSSLa specification for sound compilation. I.e. checks for Errors/Warnings in the code.
- tessla
The TeSSLa code to be verified.
- fileName
The name of the TeSSLa file (does not really have to exist in the filesystem but is used, e.g. in error messages.
- returns
Object containing information about errors and warnings during compilation.
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated