Package com.illumon.iris.db.v2.utils
Class FunctionGeneratedTableFactory
java.lang.Object
com.illumon.iris.db.v2.utils.FunctionGeneratedTableFactory
public class FunctionGeneratedTableFactory extends Object
An abstract table that represents the result of a function.
The table will refresh by regenerating the full values (using the tableGenerator Function passed in). The resultant
table's values are copied into the result table and appropriate listener notifications are fired.
All of the rows in the output table are modified on every tick, even if no actual changes occurred. The output table
also has a contiguous index.
The generator function must produce a V2 table, and the table definition must not change between invocations.
If you are transforming a table, you should generally prefer to use the regular table operations as opposed to this
factory, because they are capable of performing some operations incrementally. However, for small tables this might
prove to require less development effort.
-
Method Summary
Modifier and Type Method Description static Table
create(com.fishlib.base.Function.Nullary<Table> tableGenerator, int refreshIntervalMs)
Create a table that refreshes based on the value of your function, automatically called every refreshIntervalMs.static Table
create(com.fishlib.base.Function.Nullary<Table> tableGenerator, DynamicTable... sourceTables)
Create a table that refreshes based on the value of your function, automatically called when any of the sourceTables tick.
-
Method Details
-
create
public static Table create(com.fishlib.base.Function.Nullary<Table> tableGenerator, int refreshIntervalMs)Create a table that refreshes based on the value of your function, automatically called every refreshIntervalMs.- Parameters:
tableGenerator
- a function returning a table to copy into the output table- Returns:
- a ticking table (assuming sourceTables have been specified) generated by tableGenerator
-
create
public static Table create(com.fishlib.base.Function.Nullary<Table> tableGenerator, DynamicTable... sourceTables)Create a table that refreshes based on the value of your function, automatically called when any of the sourceTables tick.- Parameters:
tableGenerator
- a function returning a table to copy into the output tablesourceTables
- The query engine does not know the details of your function inputs. If you are dependent on a ticking table tables in your tableGenerator function, you can add it to this list so that the function will be recomputed on each tick.- Returns:
- a ticking table (assuming sourceTables have been specified) generated by tableGenerator
-