Class NonTopLevelOrdinalPolicy

    • Constructor Detail

      • NonTopLevelOrdinalPolicy

        public NonTopLevelOrdinalPolicy()
        Constructs a new non-top-level-ordinal-filter. With a given taxonomyWriter.
    • Method Detail

      • init

        public void init​(TaxonomyWriter taxonomyWriter)
        Description copied from interface: OrdinalPolicy
        Initialize the policy with a TaxonomyWriter. This method can be implemented as noop if the ordinal policy is not taxonomy dependent
        Specified by:
        init in interface OrdinalPolicy
        Parameters:
        taxonomyWriter - A relevant taxonomyWriter object, with which ordinals sent to shouldAdd(int) are examined.
      • shouldAdd

        public boolean shouldAdd​(int ordinal)
        Filters out ordinal which are ROOT or who's parent is ROOT. In order to determine if a parent is root, there's a need for TaxonomyWriter.getParent(int).
        Specified by:
        shouldAdd in interface OrdinalPolicy
        Parameters:
        ordinal - A given category ordinal which is to be tested for stream addition.
        Returns:
        true if the category should be added. false otherwise.