org.ijsberg.iglu.util.collection
Class CollectionPart

java.lang.Object
  extended by org.ijsberg.iglu.util.collection.CollectionPart

public class CollectionPart
extends Object

Wrapper class for a specific part of a collection (which is currently to be displayed in some user interface). The collection may have been divided in parts to make it browsable. The wrapper has data on other parts of the full collection as well.


Nested Class Summary
static class CollectionPart.CollectionPartDescription
          Describes this and other parts of a collection
 
Constructor Summary
CollectionPart(Collection full, int maxPartSize, int offset)
          Constructs a CollectionPart based on a complete Collection.
CollectionPart(Collection part, int maxPartSize, int offset, int fullCollectionSize)
          Constructs a CollectionPart based on a previously defined subset of a Collection.
 
Method Summary
 CollectionPart.CollectionPartDescription[] getAllCollectionPartDescriptions()
           
 CollectionPart.CollectionPartDescription getFirstCollectionPartDescription()
           
 int getFullCollectionSize()
           
 CollectionPart.CollectionPartDescription getLastCollectionPartDescription()
           
 int getLastPartSize()
           
 int getMaxPartSize()
           
 CollectionPart.CollectionPartDescription[] getNearCollectionPartDescriptions(int scope)
           
 int getNrofParts()
           
 Collection getPart()
           
 int getPartSize()
           
 CollectionPart.CollectionPartDescription getPreceedingCollectionPartDescription()
           
 CollectionPart.CollectionPartDescription getTrailingCollectionPartDescription()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CollectionPart

public CollectionPart(Collection full,
                      int maxPartSize,
                      int offset)
Constructs a CollectionPart based on a complete Collection.

Parameters:
full - the complete collection this is part of
maxPartSize - size of this part or less if it's the last bit
offset - distance in elements from 0

CollectionPart

public CollectionPart(Collection part,
                      int maxPartSize,
                      int offset,
                      int fullCollectionSize)
Constructs a CollectionPart based on a previously defined subset of a Collection.

Parameters:
part - subset of the complete Collection
maxPartSize - size of this part or less if it's the last bit
offset - distance in elements from 0
fullCollectionSize - size of the complete collection
Method Detail

getPart

public Collection getPart()
Returns:
subset of the complete collection

getFullCollectionSize

public int getFullCollectionSize()
Returns:
size of the complete collection

getMaxPartSize

public int getMaxPartSize()
Returns:
default size of collection parts

getPartSize

public int getPartSize()
Returns:
actual size of this part of the collection

getNrofParts

public int getNrofParts()
Returns:
the total number of parts the complete collection is divided in

getLastPartSize

public int getLastPartSize()
Returns:
the size of the last part of the collection (which mey be less than the desired size)

toString

public String toString()
Overrides:
toString in class Object
Returns:
a String representation of the wrapped Collection

getPreceedingCollectionPartDescription

public CollectionPart.CollectionPartDescription getPreceedingCollectionPartDescription()
Returns:
a description of the preceeding CollectionPart or null if that does not exist

getTrailingCollectionPartDescription

public CollectionPart.CollectionPartDescription getTrailingCollectionPartDescription()
Returns:
a description of the trailing CollectionPart or null if that does not exist

getFirstCollectionPartDescription

public CollectionPart.CollectionPartDescription getFirstCollectionPartDescription()
Returns:
a description of the first CollectionPart or null if that does not exist

getLastCollectionPartDescription

public CollectionPart.CollectionPartDescription getLastCollectionPartDescription()
Returns:
a description of the last CollectionPart or null if that does not exist

getNearCollectionPartDescriptions

public CollectionPart.CollectionPartDescription[] getNearCollectionPartDescriptions(int scope)
Parameters:
scope - the number of CollectonParts around this CollectionPart to be shown
Returns:
descriptions of CollectionParts within a certain range around this part

getAllCollectionPartDescriptions

public CollectionPart.CollectionPartDescription[] getAllCollectionPartDescriptions()
Returns:
descriptions of all collection parts the complete collection consists of


Copyright © 2011. All Rights Reserved.