org.apache.lenya.cms.publication.util
Class DocumentSet

java.lang.Object
  extended by org.apache.lenya.cms.publication.util.DocumentSet
Direct Known Subclasses:
LanguageVersions

public class DocumentSet
extends java.lang.Object

An ordered set of documents without duplicates.


Constructor Summary
DocumentSet()
          Ctor.
DocumentSet(Document[] _documents)
          Ctor.
 
Method Summary
 void add(Document document)
          Adds a document to this set.
 void addAll(DocumentSet set)
          Adds a document set to this set.
 void clear()
          Removes all documents.
 boolean contains(Document document)
           
 Document[] getDocuments()
          Returns the documents contained in this set.
protected  java.util.List getList()
          Returns the list object that stores the documents.
 boolean isEmpty()
          Checks if this set is empty.
 void remove(Document resource)
          Removes a document.
 void removeAll(DocumentSet set)
          Removes all documents in a set from this set.
 void reverse()
          Reverses the document order.
 void visit(DocumentVisitor visitor)
          Visits the set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentSet

public DocumentSet()
Ctor.


DocumentSet

public DocumentSet(Document[] _documents)
Ctor.

Parameters:
_documents - The initial documents.
Method Detail

getList

protected java.util.List getList()
Returns the list object that stores the documents.

Returns:
A list.

getDocuments

public Document[] getDocuments()
Returns the documents contained in this set.

Returns:
An array of documents.

add

public void add(Document document)
Adds a document to this set.

Parameters:
document - The document to add.
Throws:
java.lang.IllegalArgumentException - if the document is null or already contained.

addAll

public void addAll(DocumentSet set)
Adds a document set to this set.

Parameters:
set - The documents to add.

contains

public boolean contains(Document document)
Parameters:
document - The document.
Returns:
if the document is contained.

isEmpty

public boolean isEmpty()
Checks if this set is empty.

Returns:
A boolean value.

visit

public void visit(DocumentVisitor visitor)
           throws PublicationException
Visits the set.

Parameters:
visitor - The visitor.
Throws:
PublicationException - if an error occurs during visiting.

remove

public void remove(Document resource)
            throws PublicationException
Removes a document.

Parameters:
resource - The document.
Throws:
PublicationException - if an error occurs.

removeAll

public void removeAll(DocumentSet set)
               throws PublicationException
Removes all documents in a set from this set.

Parameters:
set - The set.
Throws:
PublicationException - if an error occurs.

clear

public void clear()
Removes all documents.


reverse

public void reverse()
Reverses the document order.



Copyright © 1999-2006 Apache Software Foundation. All Rights Reserved.