|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gishur.core.Filter | +--gishur.graph.core.NameFilter
A Filter
class which stores Strings
. It can only be used for filtering
GraphElements
whose name string must be stored in the properties.
One can switch between two working modes: either the stored names can be defined as the
allowed names, i.e. a GraphElement
with one of these names will not be filtered out,
or the name strings represent the forbidden names (see acceptMode()
.
Constructor Summary | |
NameFilter()
Empty constructor. |
|
NameFilter(java.lang.String n)
Constructor accepting n as allowed name string. |
|
NameFilter(java.lang.String[] sa)
Constructor accepting an array of strings as allowed name strings. |
|
NameFilter(java.lang.String n1,
java.lang.String n2)
Constructor accepting 2 given names as allowed name strings. |
|
NameFilter(java.lang.String n1,
java.lang.String n2,
java.lang.String n3)
Constructor accepting 3 given names as allowed name strings. |
|
NameFilter(java.lang.String n1,
java.lang.String n2,
java.lang.String n3,
java.lang.String n4)
Constructor accepting 4 given names as allowed name strings. |
|
NameFilter(java.lang.String n1,
java.lang.String n2,
java.lang.String n3,
java.lang.String n4,
java.lang.String n5)
Constructor accepting 5 given names as allowed name strings. |
Method Summary | |
boolean |
acceptMode()
If the returned value is true , the filter accepts
Objects that are instances of at least one class stored at
this filter. |
void |
add(java.util.Enumeration enum)
Adds an Enumeration of Strings to the list of
strings accepted / rejected by this filter (depends on acceptMode() ). |
void |
add(java.lang.String name)
Adds a String object to the list of strings accepted / rejected
by this filter (depends on acceptMode() ). |
void |
add(java.lang.String[] names)
Adds an array of Strings to the list of strings accepted /
rejected by this filter (depends on acceptMode() ). |
boolean |
check(java.lang.Object obj)
Performs the filtering operation. |
void |
remove(java.util.Enumeration enum)
Removes an Enumeration of Strings off the list
of strings accepted / rejected by this filter (depends on
acceptMode() ). |
void |
remove(java.lang.String name)
Removes a name String of the list off strings accepted /
rejected by this filter (depends on acceptMode() ). |
void |
remove(java.lang.String[] names)
Removes an array of name Strings off the list of strings
accepted / rejected by this filter (depends on acceptMode() ). |
void |
setAcceptMode(boolean mode)
Sets the mode of the NameFilter ; if the given value is
true , the filter accepts GraphElements
that have names that are stored at this filter. |
java.lang.String |
toString()
Overrides java.lang.Object.toString() . |
Methods inherited from class gishur.core.Filter |
addFilter, nextFilter, removeFilter, valid |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public NameFilter()
public NameFilter(java.lang.String n)
n
as allowed name string.public NameFilter(java.lang.String n1, java.lang.String n2)
public NameFilter(java.lang.String n1, java.lang.String n2, java.lang.String n3)
public NameFilter(java.lang.String n1, java.lang.String n2, java.lang.String n3, java.lang.String n4)
public NameFilter(java.lang.String n1, java.lang.String n2, java.lang.String n3, java.lang.String n4, java.lang.String n5)
public NameFilter(java.lang.String[] sa)
Method Detail |
public java.lang.String toString()
java.lang.Object.toString()
.toString
in class java.lang.Object
Object.toString()
public void add(java.lang.String name)
String
object to the list of strings accepted / rejected
by this filter (depends on acceptMode()
).name
- String to add.public void add(java.lang.String[] names)
Strings
to the list of strings accepted /
rejected by this filter (depends on acceptMode()
).names
- array of strings to add.public void add(java.util.Enumeration enum)
Enumeration
of Strings
to the list of
strings accepted / rejected by this filter (depends on acceptMode()
).enum
- Enumeration
of strings to add.public void remove(java.lang.String name)
String
of the list off strings accepted /
rejected by this filter (depends on acceptMode()
).name
- name to removepublic void remove(java.lang.String[] names)
Strings
off the list of strings
accepted / rejected by this filter (depends on acceptMode()
).names
- array of names to removepublic void remove(java.util.Enumeration enum)
Enumeration
of Strings
off the list
of strings accepted / rejected by this filter (depends on
acceptMode()
).enum
- Enumeration
of strings to removepublic void setAcceptMode(boolean mode)
NameFilter
; if the given value is
true
, the filter accepts GraphElements
that have names that are stored at this filter. If the given value
is false
, the filter accepts GraphElements
that have names that are not stored at this filter.mode
- the mode to setacceptMode()
public boolean acceptMode()
true
, the filter accepts
Objects
that are instances of at least one class stored at
this filter. If the returned value is false
, the filter
accepts Objects
that are not instances of any of the classes
stored at this filter.
If the returned value is true
, the filter accepts
GraphElements
that have names that are stored at this
filter. If the returned value is false
, the filter accepts
GraphElements
that have names that are not stored at
this filter.setAcceptMode(boolean)
public boolean check(java.lang.Object obj)
obj
is a
GraphElement
, its name will be compared to the stored name strings,
and if an identical String
is found, true
or
false
will be returned (the result depends on the
acceptMode()
).
The GraphElement's
name must be stored in its
properties with key string name
, if no name is defined for the
given GraphElement
, false
will be returned anyway.
If obj
is not a GraphElement
, false
will be
returned.check
in class Filter
obj
- the object to checktrue
if obj
hass an allowed name string,
false
otherwise
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |