org.ccnx.ccn.io.content.Collection Class Reference

A representation of a collection of CCN objects, represented as a list of Link s. More...

List of all members.

Classes

class  CollectionObject
 A CCNNetworkObject wrapper around Collection, used for easily saving and retrieving versioned Collections to CCN. More...

Public Member Functions

Collection clone ()
 Collection (java.util.Collection< Link > contents)
 Collection (Link[] contents)
 Collection (ArrayList< ContentName > nameContents)
 Make a Collection containing Links which only specify names.
 Collection (String label, ArrayList< ContentName > nameContents)
 Make a Collection containing Links which only specify names and a single label.
LinkedList< Linkcontents ()
Link get (int i)
Link get (String label)
 Return the first Link with matching label, if any.
void add (Link content)
void add (ArrayList< Link > contents)
void add (String label, ArrayList< ContentName > nameContents)
void add (String label, ContentName target)
Link remove (int i)
boolean remove (Link content)
void removeAll ()
int size ()
ArrayList< Linkfind (Link target)
 Find all the elements in this Collection that match target on any of the parameters it has set, and return them.
ArrayList< Linkfind (ContentName targetName)
ArrayList< Linkfind (String targetLabel)
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.
boolean validate ()
 Make sure all of the necessary fields are filled in prior to attempting to encode.
long getElementLabel ()
 Allow the encoder/decoder to retrieve the top-level element name programmatically.
int hashCode ()
boolean equals (Object obj)
String toString ()
 More concise toString.
Iterator< Linkiterator ()

Protected Attributes

LinkedList< Link_contents = new LinkedList<Link>()

Detailed Description

A representation of a collection of CCN objects, represented as a list of Link s.

See Link for a discussion of what such links can refer to and their security. A Collection is the easiest way in CCN of representing extensional containment -- a fixed list of items that form a group, where it is possible to say that an item is either in or out of the group. Containment in CCN can also be represented intentionally -- by looking at the set of children a given name currently has. In that latter case, it is impossible to say in general whether something is not in the set, as there might exist a child with that name, but it is not accessible to your network at the moment.

By tailoring the meaning of and labels attached to the Links in a Collection, one can generate special-purpose Collection subclasses with particular semantics, useful in particular applications. See ACL and the Name Enumeration protocol for examples of this.


Constructor & Destructor Documentation

org.ccnx.ccn.io.content.Collection.Collection ( ArrayList< ContentName nameContents  ) 

Make a Collection containing Links which only specify names.

Parameters:
nameContents The list of names to link to.
org.ccnx.ccn.io.content.Collection.Collection ( String  label,
ArrayList< ContentName nameContents 
)

Make a Collection containing Links which only specify names and a single label.

Parameters:
nameContents The list of names to link to.

Member Function Documentation

void org.ccnx.ccn.io.content.Collection.decode ( XMLDecoder  decoder  )  throws ContentDecodingException [virtual]

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.

void org.ccnx.ccn.io.content.Collection.encode ( XMLEncoder  encoder  )  throws ContentEncodingException [virtual]

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.

Link org.ccnx.ccn.io.content.Collection.get ( String  label  ) 

Return the first Link with matching label, if any.

Parameters:
label 
Returns:
long org.ccnx.ccn.io.content.Collection.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.

Reimplemented in org.ccnx.ccn.profiles.security.access.group.ACL.

boolean org.ccnx.ccn.io.content.Collection.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.

Reimplemented in org.ccnx.ccn.profiles.security.access.group.ACL.


The documentation for this class was generated from the following file:
Generated on Fri May 13 16:27:45 2011 for Content-Centric Networking in Java by  doxygen 1.6.3