edu.cmu.andrew.icalendar
Class Component

java.lang.Object
  |
  +--edu.cmu.andrew.icalendar.Component
Direct Known Subclasses:
VAlarm, VCalendar, VEvent, VFreeBusy, VJournal, VTimeZone, VTodo

public abstract class Component
extends Object

A single ICalendar component from BEGIN: to END: This is a representation of a generic ICalendar component.


Field Summary
protected  Map properties
          contains a map from property name -> List of Property objects
protected  List subComponents
          contains a map of Component objects
 
Constructor Summary
Component()
           
 
Method Summary
 List getComponents()
          Return a List containing Component representing all subcomponents of this Component.
static Component getInstance(String name, Map properties, List subComponents)
          Create a Property object of the correct type for name.
abstract  String getName()
          Return the name of this Component.
 List getProperty(String name)
          Return a List containing Property representing all of the properties associated with this component
 Map getPropertyMap()
           
 UnknownSingleDate getSingleDate(String name)
           
 UnknownSingleDuration getSingleDuration(String name)
           
 UnknownSingleInteger getSingleInteger(String name)
           
 UnknownSingleString getSingleString(String name)
           
 Writer outputICalendar(Writer w)
          Write the iCalendar representation to w.
 String toString()
          Returns this Component in iCalendar form.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

properties

protected Map properties
contains a map from property name -> List of Property objects

subComponents

protected List subComponents
contains a map of Component objects
Constructor Detail

Component

public Component()
Method Detail

getName

public abstract String getName()
Return the name of this Component.

getProperty

public List getProperty(String name)
Return a List containing Property representing all of the properties associated with this component
Returns:
a List<Property>

getPropertyMap

public Map getPropertyMap()

getSingleString

public UnknownSingleString getSingleString(String name)

getSingleInteger

public UnknownSingleInteger getSingleInteger(String name)

getSingleDate

public UnknownSingleDate getSingleDate(String name)

getSingleDuration

public UnknownSingleDuration getSingleDuration(String name)

getComponents

public List getComponents()
Return a List containing Component representing all subcomponents of this Component.
Returns:
a List<Component>

getInstance

public static Component getInstance(String name,
                                    Map properties,
                                    List subComponents)
                             throws BadComponentException
Create a Property object of the correct type for name.
Parameters:
name - the name of the component
properties - a map of property name to a List of properties
subComponents - a list of subcomponents of this component
Returns:
an instance of a subclass of Component
Throws:
BadComponentException - when an invariant of this Component is violated

outputICalendar

public Writer outputICalendar(Writer w)
                       throws IOException
Write the iCalendar representation to w. It invokes the output method of each subcomponent and each property of this object.
Parameters:
w - the writer to send output to
Returns:
the writer w
Throws:
IOException - when w does so

toString

public String toString()
Returns this Component in iCalendar form. This just invokes the output method, and using that method should be preferred.
Overrides:
toString in class Object
Returns:
a string representation of this object