Class ComposedKeySet<T>

Composition of a list of KeySets.

On a normal use case, this is not needed and it can be solved with first.intersect(second). But there are other cases where we have to be explicit about the 2 sets that we are intersecting.

e.g. We have a list of items with labels, where an item can have multiple labels. We need to filter the items with labels A, B and C but that do not have labels D.

We cannot use some(A, B, C).intersect(allExceptSome(D)) since that would end up with just some(A, B, C). So we use composedKeySet([some(A, B, C), allExceptSome(D)]).

This way, if we have a search engine that translates key sets like this:

  • All => WHERE 1=1
  • None => WHERE 1=0
  • Some => WHERE list.contains(elements)
  • AllExceptSome => WHERE not list.contains(elements)

then the composed key set above will end up with WHERE items.labels.contains(A, B, or C) AND NOT items.labels.contains(D)

Type Parameters

Constructors

Properties

list: KeySet<T>[]

Methods

  • returns a new one with all the elements of the same type as union

    eg

    Compacted(ALL, ALL, SOME(1, 2), ALL, ALL_EXCEPT_SOME(3, 4), NONE, SOME(3), ALL_EXCEPT_SOME(3, 4, 5)) => Compacted(ALL, ALL_EXCEPT_SOME(3, 4, 5), NONE)

    Returns ComposedKeySet<T>

  • returns a new one with all the elements of the same type as union

    eg

    Compacted(ALL, ALL, SOME(1, 2), ALL, ALL_EXCEPT_SOME(3, 4), NONE, SOME(3), ALL_EXCEPT_SOME(3, 4, 5)) => Compacted(ALL, SOME(1, 2, 3), ALL_EXCEPT_SOME(3, 4), NONE)

    Returns ComposedKeySet<T>

  • returns true if ALL the sets in the list return representsAllExceptSome()

    Returns boolean