Class ReadWriteDataCollectionBuilder<W extends QueryableData & Writable>

java.lang.Object
fr.inria.rules.integraal.model.data.collection.builder.ReadWriteDataCollectionBuilder<W>
Type Parameters:
W - the type of Writable data associated with the collection, which also extends Q

public class ReadWriteDataCollectionBuilder<W extends QueryableData & Writable> extends Object
A builder for creating read-write data collections.
  • Constructor Details

    • ReadWriteDataCollectionBuilder

      public ReadWriteDataCollectionBuilder()
      Creates a read-write data collection builder.
  • Method Details

    • addQueryableData

      public ReadWriteDataCollectionBuilder<W> addQueryableData(Predicate predicate, QueryableData queryableData)
      Adds a QueryableData instance associated with a specific Predicate.
      Parameters:
      predicate - the predicate associated with the QueryableData
      queryableData - the QueryableData to be added
      Returns:
      this builder instance for chaining
      Throws:
      IllegalArgumentException - if the predicate is not present in the QueryableData
      IllegalStateException - if the predicate is already associated with another QueryableData
    • addQueryableData

      public ReadWriteDataCollectionBuilder<W> addQueryableData(QueryableData queryableData)
      Adds a QueryableData instance with all its predicates.
      Parameters:
      queryableData - the QueryableData to be added
      Returns:
      this builder instance for chaining
      Throws:
      IllegalStateException - if any predicate is already associated with another QueryableData
    • addQueryableWritableData

      public ReadWriteDataCollectionBuilder<W> addQueryableWritableData(Predicate predicate, W writableData)
      Adds a Writable instance, which is also Queryable, associated with a specific Predicate.
      Parameters:
      predicate - the predicate associated with the writable data
      writableData - the writable/queryable data to register
      Returns:
      this builder instance for chaining
    • setDefaultWritableData

      public ReadWriteDataCollectionBuilder<W> setDefaultWritableData(W writableData)
      Sets the default Writable instance.
      Parameters:
      writableData - the default writable/queryable data
      Returns:
      this builder instance for chaining
    • build

      public <T extends QueryableData> QueryableWritableDataCollection<T,W> build()
      Builds a QueryableWritableDataCollection instance from the added data.
      Type Parameters:
      T - the queryable view type exposed by the built collection
      Returns:
      a new queryable/writable data collection
    • buildMaterialized

      public <T extends MaterializedData> MaterializedWritableDataCollection<T,W> buildMaterialized()
      Builds a MaterializedWritableDataCollection instance if the type supports MaterializedData.
      Type Parameters:
      T - the materialized queryable view type exposed by the built collection
      Returns:
      a new materialized writable data collection