PropertyFilter

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ocap.hn
Class PropertyFilter

    java.lang.Object
      org.ocap.hn.PropertyFilter

    public class PropertyFilter

extends Object

The filter for (key,value) pair filtering mechanism. If a device or a NetModule has same value on all of the specified keys, it is regarded as a match.

Constructor Summary
`PropertyFilter(Properties prop)` Constructs a PropertyFilter object.

Method Summary
`boolean` | `accept(Object element)` Checks whether an element is accepted by this filter, the element must be either `NetModule` or `Device`.
`void` | `addProperty(String key, String value)` Adds a (key,value) pair to the filter.
`boolean` | `contains(String key)` Checks whether a key is in the list.
`void` | `removeKey(String key)` Remove a key from the filter, if the key is not in the property list, no action is taken.
`void` | `removeKeys(String[] keys)` Remove keys from the filter, if a key is not in the property list, it is disregarded; while others are processed as normal.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PropertyFilter

    public PropertyFilter(Properties prop)

  Constructs a PropertyFilter object.

  Parameters:
    `prop` - Initial properties for this Property filter

Method Detail

### addProperty

    public void addProperty(String key,
                            String value)

  Adds a (key,value) pair to the filter. If the key is already in the list, no action is taken.

  Parameters:
    `key` - New key which will be used for filtering.
    `value` - Value for the new key.

### contains

    public boolean contains(String key)

  Checks whether a key is in the list.

  Parameters:
    `key` - Key to be checked against.
  Returns:
    True if key is in the list; otherwise returns false.

### accept

    public boolean accept(Object element)

  Checks whether an element is accepted by this filter, the element must be either `NetModule` or `Device`. If a NetModule/Device's properties share the same value as all properties from this filter, it is accepted and true is returned; otherwise, false is returned.

  Parameters:
    `element` - Element to be checked against.
  Returns:
    True if the element is accepted by the PropertyFilter, otherwise returns false.

### removeKey

    public void removeKey(String key)

  Remove a key from the filter, if the key is not in the property list, no action is taken.

  Parameters:
    `key` - Key to be removed from list.

### removeKeys

    public void removeKeys(String[] keys)

  Remove keys from the filter, if a key is not in the property list, it is disregarded; while others are processed as normal.

  Parameters:
    `keys` - Keys to be removed from the list.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD