Class ReadOnlyDataCollectionBuilder<T extends QueryableData>

java.lang.Object
fr.inria.rules.integraal.model.data.collection.builder.ReadOnlyDataCollectionBuilder<T>
Type Parameters:
T - the type of QueryableData to be stored in the collection

public class ReadOnlyDataCollectionBuilder<T extends QueryableData> extends Object
A builder for creating read-only data collections.
  • Constructor Details

    • ReadOnlyDataCollectionBuilder

      public ReadOnlyDataCollectionBuilder()
      Creates a read-only data collection builder.
  • Method Details

    • addQueryableData

      public ReadOnlyDataCollectionBuilder<T> addQueryableData(Predicate predicate, T 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 ReadOnlyDataCollectionBuilder<T> addQueryableData(T 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
    • addQueryableData

      public ReadOnlyDataCollectionBuilder<T> addQueryableData(Collection<Predicate> predicates, T queryableData)
      Adds a QueryableData instance with specific predicates
      Parameters:
      predicates - the predicates associated with the QueryableData
      queryableData - the QueryableData to be added
      Returns:
      this builder instance for chaining
      Throws:
      IllegalStateException - if any predicate is already associated with another QueryableData
    • build

      public QueryableDataCollection<T> build()
      Builds a QueryableDataCollection instance from the added QueryableData.
      Returns:
      an immutable QueryableDataCollection instance
    • buildMaterialized

      public MaterializedDataCollection<MaterializedData> buildMaterialized()
      Builds a MaterializedDataCollection instance if the type supports MaterializedData.
      Returns:
      an immutable MaterializedDataCollection instance
      Throws:
      IllegalStateException - if the type is not assignable to MaterializedData