Class TypeFilterImpl

java.lang.Object
com.nomagic.magicdraw.ui.dialogs.selection.TypeFilterImpl
All Implemented Interfaces:
TypeFilter, com.nomagic.magicdraw.ui.ElementFilter

@OpenApiAll public class TypeFilterImpl extends Object implements TypeFilter
Default TypeFilter implementation.
  • Constructor Details

    • TypeFilterImpl

      public TypeFilterImpl()
      Constructor. Any element will be accepted
    • TypeFilterImpl

      public TypeFilterImpl(@CheckForNull Collection<?> types)
      Constructor.
      Parameters:
      types - acceptable types. Can be null.
    • TypeFilterImpl

      public TypeFilterImpl(@CheckForNull Collection all, @CheckForNull Collection restricted)
      An utility constructor for compatibility with old approach when all and restricted types were used. It uses "restricted" types if they are not null, otherwise "all" types are used.
      Parameters:
      all - all types
      restricted - restricted types.
  • Method Details

    • getTypes

      public Collection<?> getTypes()
      Description copied from interface: TypeFilter
      Get the acceptable element types.
      Specified by:
      getTypes in interface TypeFilter
      Returns:
      acceptable element types. If null - all element types are accepted.
    • accept

      public final boolean accept(BaseElement obj)
      Description copied from interface: com.nomagic.magicdraw.ui.ElementFilter
      Tests element to satisfy filter condition.
      Specified by:
      accept in interface com.nomagic.magicdraw.ui.ElementFilter
      Parameters:
      obj - element.
      Returns:
      true if obj satisfies filter condition otherwise false.
    • accept

      public boolean accept(BaseElement baseElement, boolean checkType)
      Description copied from interface: TypeFilter
      Tests element to satisfy filter condition.
      Specified by:
      accept in interface TypeFilter
      Parameters:
      baseElement - element.
      checkType - check object type
      Returns:
      true if obj satisfies filter condition otherwise false.
    • acceptByType

      protected boolean acceptByType(@CheckForNull Collection<?> types, @Nonnull BaseElement baseElement)
      Test for acceptable element type.
      Parameters:
      types - acceptable types. Null means ANY type
      baseElement - element to be tested. Can not be null.
      Returns:
      true if tested element is acceptable.