org.ccnx.ccn.protocol.Exclude Class Reference
Exclude filters are used during Interest matching to exclude content.
More...
List of all members.
Classes |
class | Element |
| Object to contain elements used in an exclude filter. More...
|
class | Filler |
| A filler element occurs in a Exclude filter between 2 name components which may be an implied name component if the filler element is the first or last element in the Exclude filter. More...
|
Public Member Functions |
| Exclude (ArrayList< Element > values) |
| Exclude (byte omissions[][]) |
| Create an Exclude filter that excludes exactly the listed name components.
|
boolean | match (byte[] component) |
void | add (byte omissions[][]) |
| Return a new Exclude filter that is a copy of this one with the supplied omissions added.
|
void | excludeUpto (byte[] component) |
| Take an existing Exclude filter and additionally exclude all components up to and including the component passed in.
|
boolean | empty () |
| Check for exclude with no elements.
|
void | decode (XMLDecoder decoder) throws ContentDecodingException |
| Decode this object as the top-level item in a new XML document, reading it from a network buffer.
|
void | encode (XMLEncoder encoder) throws ContentEncodingException |
| Encode this object during an ongoing encoding pass; this is what subclasses generally need to know how to implement.
|
long | getElementLabel () |
| Allow the encoder/decoder to retrieve the top-level element name programmatically.
|
boolean | validate () |
| Make sure all of the necessary fields are filled in prior to attempting to encode.
|
int | compareTo (Exclude o) |
boolean | equals (Object obj) |
int | size () |
| Gets the number of elements in the Exclude filter.
|
Element | value (int i) |
| DEBUGGING ONLY -- may need to be removed.
|
String | toString () |
| Default toString() implementation simply prints the text encoding of the object.
|
Static Public Member Functions |
static Exclude | uptoFactory (byte[] component) |
| Create an Exclude filter that excludes all components up to and including the one given, but none after.
|
static Exclude | factory (byte omissions[][]) |
Static Public Attributes |
static int | OPTIMUM_FILTER_SIZE = 100 |
Protected Attributes |
ArrayList< Element > | _values = new ArrayList<Element>() |
Detailed Description
Exclude filters are used during Interest matching to exclude content.
The filter works on the name component after the last one specified in the Interest.
Exclude filters contain at least one element. The elements are either a name component, a bloom filter or the 'any' element. This allows the specification of individual component values to be excluded, as well as arbitrary ranges of component values and a compact form for long lists of component values (bloom filters).
The order of elements within an exclude filter must follow 2 rules: 1. Within an exclude filter all name component elements must be in ascending order wherever they occur and there should be no duplicates. 2. An any element or a bloom filter element must not be followed by an any element or bloom filter.
- See also:
- Filler I.E. Any elements or bloom filters must be separated by at least one name component element.
Constructor & Destructor Documentation
org.ccnx.ccn.protocol.Exclude.Exclude |
( |
ArrayList< Element > |
values |
) |
|
- Parameters:
-
| values | Must be a list of ExcludeElements - Components must be in increasing order and there must not be more than one BloomFilter in a row. |
- Exceptions:
-
org.ccnx.ccn.protocol.Exclude.Exclude |
( |
byte |
omissions[][] |
) |
|
Create an Exclude filter that excludes exactly the listed name components.
- Parameters:
-
| omissions | The name components to be excluded. Passing in null or a zero length array here will result in an IllegalArgumentException exception |
- Exceptions:
-
Member Function Documentation
void org.ccnx.ccn.protocol.Exclude.add |
( |
byte |
omissions[][] |
) |
|
Return a new Exclude filter that is a copy of this one with the supplied omissions added.
- Parameters:
-
| omissions | name components to be excluded. |
- Returns:
- new Exclude filter object or null in case of error
Decode this object as the top-level item in a new XML document, reading it from a network buffer.
Reads document start and end. Assumes default encoding.
- Parameters:
-
| buf | input stream to read from |
- Exceptions:
-
| ContentDecodingException | if there is an error decoding the content Decode this object as the top-level item in a new XML document, reading it from a network buffer. Reads document start and end. |
- Parameters:
-
| buf | input stream to read from |
| codec | the codec to use; must be recognized by XMLCodecFactory |
- Exceptions:
-
| ContentDecodingException | if there is an error decoding the content |
- See also:
- XMLCodecFactory Decode this object during an ongoing decoding pass; this is what subclasses generally need to know how to implement. Reads just the object itself, higher-level processes have handled start and end document if need be. Allows object to be read using the same code whether it is a top-level element written alone, or nested inside another element.
- Parameters:
-
| decoder | the decoder being used; encapsulates state including the codec being used as well as the input source and current offset |
Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.
boolean org.ccnx.ccn.protocol.Exclude.empty |
( |
|
) |
|
Check for exclude with no elements.
- Returns:
- true if exclude has no elements
Encode this object during an ongoing encoding pass; this is what subclasses generally need to know how to implement.
Writes just the object itself, higher-level processes have handled start and end document if need be. Allows object to be written using the same code whether it is a top-level element written alone, or nested inside another element.
- Parameters:
-
| encoder | the encoder being used; encapsulates state including the codec being used as well as the output destination and current offset |
Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.
void org.ccnx.ccn.protocol.Exclude.excludeUpto |
( |
byte[] |
component |
) |
|
Take an existing Exclude filter and additionally exclude all components up to and including the component passed in.
Useful for updating filters during incremental searches. E.G. for version number components.
- Parameters:
-
| component | if null then the Exclude filter is left unchanged. |
static Exclude org.ccnx.ccn.protocol.Exclude.factory |
( |
byte |
omissions[][] |
) |
[static] |
- Parameters:
-
| omissions | List of names to exclude, or null |
- Returns:
- returns null if list is null or empty, or a new Exclude filter that excludes the listed names.
- See also:
- Exclude(byte [][])
long org.ccnx.ccn.protocol.Exclude.getElementLabel |
( |
|
) |
[virtual] |
Allow the encoder/decoder to retrieve the top-level element name programmatically.
This allows subclasses to rename elements without changing their encoder/decoders.
- Returns:
- the element label to use, as a key in a loaded encoding dictionary
Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.
boolean org.ccnx.ccn.protocol.Exclude.match |
( |
byte[] |
component |
) |
|
- Parameters:
-
| component | - A name component |
- Returns:
- true if this component would be excluded by the exclude filter
int org.ccnx.ccn.protocol.Exclude.size |
( |
|
) |
|
Gets the number of elements in the Exclude filter.
- Returns:
- number of elements
String org.ccnx.ccn.protocol.Exclude.toString |
( |
|
) |
|
static Exclude org.ccnx.ccn.protocol.Exclude.uptoFactory |
( |
byte[] |
component |
) |
[static] |
Create an Exclude filter that excludes all components up to and including the one given, but none after.
- Parameters:
-
| component | if a null component is passed in then null is returned. |
boolean org.ccnx.ccn.protocol.Exclude.validate |
( |
|
) |
[virtual] |
Make sure all of the necessary fields are filled in prior to attempting to encode.
All implementations of encode(XMLEncoder) should call this for their classes prior to encoding.
- Returns:
- true if object is valid and can be encoded, false if there is a problem; for example mandatory fields are uninitialized
Implements org.ccnx.ccn.impl.encoding.GenericXMLEncodable.
The documentation for this class was generated from the following file:
- src/org/ccnx/ccn/protocol/Exclude.java