Class RelCompositeTrait<T extends RelMultipleTrait>

  • Type Parameters:
    T - Member trait
    All Implemented Interfaces:
    RelTrait

    class RelCompositeTrait<T extends RelMultipleTrait>
    extends java.lang.Object
    implements RelTrait
    A trait that consists of a list of traits, all of the same type.

    It exists so that multiple traits of the same type (RelTraitDef) can be stored in the same RelTraitSet.

    • Constructor Detail

      • RelCompositeTrait

        private RelCompositeTrait​(RelTraitDef traitDef,
                                  T[] traits)
        Creates a RelCompositeTrait.
    • Method Detail

      • getTraitDef

        public RelTraitDef getTraitDef()
        Description copied from interface: RelTrait
        Returns the RelTraitDef that defines this RelTrait.
        Specified by:
        getTraitDef in interface RelTrait
        Returns:
        the RelTraitDef that defines this RelTrait
      • toString

        public java.lang.String toString()
        Description copied from interface: RelTrait
        Returns a succinct name for this trait. The planner may use this String to describe the trait.
        Specified by:
        toString in interface RelTrait
        Overrides:
        toString in class java.lang.Object
      • satisfies

        public boolean satisfies​(RelTrait trait)
        Description copied from interface: RelTrait
        Returns whether this trait satisfies a given trait.

        A trait satisfies another if it is the same or stricter. For example, ORDER BY x, y satisfies ORDER BY x.

        A trait's satisfies relation must be a partial order (reflexive, anti-symmetric, transitive). Many traits cannot be "loosened"; their satisfies is an equivalence relation, where only X satisfies X.

        If a trait has multiple values (see RelCompositeTrait) a collection (T0, T1, ...) satisfies T if any Ti satisfies T.

        Specified by:
        satisfies in interface RelTrait
        Parameters:
        trait - Given trait
        Returns:
        Whether this trait subsumes a given trait
      • register

        public void register​(RelOptPlanner planner)
        Description copied from interface: RelTrait
        Registers a trait instance with the planner.

        This is an opportunity to add rules that relate to that trait. However, typical implementations will do nothing.

        Specified by:
        register in interface RelTrait
        Parameters:
        planner - Planner
      • traitList

        public java.util.List<T> traitList()
        Returns an immutable list of the traits in this composite trait.
      • trait

        public T trait​(int i)
        Returns the ith trait.
      • size

        public int size()
        Returns the number of traits.