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 java.lang.Object implements TypeFilter
DefaultTypeFilter
implementation.
-
-
Constructor Summary
Constructors Constructor Description TypeFilterImpl()
Constructor.TypeFilterImpl(java.util.Collection<?> types)
Constructor.TypeFilterImpl(java.util.Collection all, java.util.Collection restricted)
An utility constructor for compatibility with old approach when all and restricted types were used.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
accept(BaseElement obj)
boolean
accept(BaseElement baseElement, boolean checkType)
Tests element to satisfy filter condition.protected boolean
acceptByType(java.util.Collection<?> types, BaseElement baseElement)
Test for acceptable element type.java.util.Collection<?>
getTypes()
Get the acceptable element types.
-
-
-
Constructor Detail
-
TypeFilterImpl
public TypeFilterImpl()
Constructor. Any element will be accepted
-
TypeFilterImpl
public TypeFilterImpl(@CheckForNull java.util.Collection<?> types)
Constructor.- Parameters:
types
- acceptable types. Can be null.
-
TypeFilterImpl
public TypeFilterImpl(@CheckForNull java.util.Collection all, @CheckForNull java.util.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 typesrestricted
- restricted types.
-
-
Method Detail
-
getTypes
public java.util.Collection<?> getTypes()
Description copied from interface:TypeFilter
Get the acceptable element types.- Specified by:
getTypes
in interfaceTypeFilter
- Returns:
- acceptable element types. If null - all element types are accepted.
-
accept
public final boolean accept(BaseElement obj)
- Specified by:
accept
in interfacecom.nomagic.magicdraw.ui.ElementFilter
-
accept
public boolean accept(BaseElement baseElement, boolean checkType)
Description copied from interface:TypeFilter
Tests element to satisfy filter condition.- Specified by:
accept
in interfaceTypeFilter
- Parameters:
baseElement
- element.checkType
- check object type- Returns:
- true if obj satisfies filter condition otherwise false.
-
acceptByType
protected boolean acceptByType(@CheckForNull java.util.Collection<?> types, @Nonnull BaseElement baseElement)
Test for acceptable element type.- Parameters:
types
- acceptable types. Null means ANY typebaseElement
- element to be tested. Can not be null.- Returns:
- true if tested element is acceptable.
-
-