To run Hyperon within your application you have to add it to your framework.
Hyperon can be run within any framework. We prepared example for Spring and Java 11.
More information in the tutorial: Connecting application
After connecting application you have to inject Hyperon Engine (part of Hyperon Runtime Library) in any place your app connects with business logic:
Parameter is one of the core concepts of Hyperon.
More information in the tutorial: Parameters
Simple parameter definition (with only one input and one output):
PARAMETER CODE: simple.parameter
Parameters data:
Now imagine you would like to show ranking position for Melanie (last row in matrix above) in your application.
Prepare context locally in a method you want to get parameter value to. Connect value source from parameter definition within the method.
Finally execute get method and receive parameter value for Melanie
Invoking parameter via Hyperon Engine returns instances of ParamValue classes. It contains evaluated values as sub-matrix from given parameter based on its input levels.
Your application received output value („3”) for given input („Melanie”). What can you do with it? It’s up to you! For more information go to the tutorial:
More information in the tutorial: Getting parameter value
Sometimes instead of using a parameter writing a function might be a better solution:
More information in the tutorial: Functions
Imagine you would like to calculate the cost for booking a room given the cost per day and the duration of stay (in days). The formula is pretty simple.
Function in Hyperon are written in Groovy (JVM language).
FUNCTION CODE: simple.parameter
ctx is an instance of ParamContext class that you can use to get any argument from context you passed to HyperonEngine. ParamContext is automatically passed to every function in Hyperon Engine.
date.getDayDiff is an example of a built in method in Hyperon.
date.getDayDiff is helpful in this scenario, because it calculates the difference in days between two dates. We add +1, because we want to include both end dates (the difference between 1st January and 3rd January is 2, so we need to add 1 to receive a duration).
Prepare context locally in a method you want to call the Hyperon function. Connect variables names the function within the constructor.
Finally execute call method and calculate total cost of vacation
Your application calculated value („600”) for given function. What can you do with it? It’s up to you! For more information go to the tutorial: Calling function.
Domain is one of the most powerful Hyperon features. However it’s very Hyperon specific, so if you’re new to Hyperon you might be thrown away by too much abstraction. That’s why we highly recommend to start by getting familiar with the domain concept.
More information in the tutorial: Domain.
The goal of Hyperon domain is to map real life into the system. Let’s imagine you develop an application for selling insurance. Your domain focuses on pricing plans and its excerpt could look like this:
Let’s say we would like to receive BI position on screen - POS.
Attributes values can be constant or parameter or function.
No context needed.
The same as in getting parameter example. Prepare context locally in a method you want to get domain value to. Connect value source from parameter definition within the method.
The same as in calling function example.
Execute following code:
We received position for BI coverage.
Let’s modify the scenario a bit and imagine we would like to list all coverages attached to full plan. We could execute the following code:
If you want to learn more about accessing domain, feel free to check the tutorial: Accessing Domain