backend.domainObjects
Class MessageList

java.lang.Object
  extended by backend.domainObjects.MessageList

public class MessageList
extends java.lang.Object

This class contains multiple Message-type objects. It uses an array and two ints to keep track of the size and capacity of the array. The class corresponds to the <messages> tag in XML code.

Author:
ptm2

Constructor Summary
MessageList()
          This constructor sets the size to 0, the capacity to 5, and allocates memory for an array for 5 Message-type objects.
 
Method Summary
 void add(Message m)
          This method adds a Message-type object to the MessageList.
 Message at(int index)
          This accessor method returns the Message-type object in the array at the given index.
 void fromXML(org.kxml2.io.KXmlParser theParser)
          The parsing method for this class, like most other classes in domainObjects, assumes that the KXmlParser you give it has just found a <messages> tag.
 int size()
          returns the size---i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageList

public MessageList()
This constructor sets the size to 0, the capacity to 5, and allocates memory for an array for 5 Message-type objects.

Method Detail

add

public void add(Message m)
This method adds a Message-type object to the MessageList. It is sensitive to the capacity of the MessageList, and will boost the capacity to accomodate new additions.


at

public Message at(int index)
This accessor method returns the Message-type object in the array at the given index. It does no error-checking for bounds.


size

public int size()
returns the size---i.e. the number of Messages that have been added.


fromXML

public void fromXML(org.kxml2.io.KXmlParser theParser)
The parsing method for this class, like most other classes in domainObjects, assumes that the KXmlParser you give it has just found a <messages> tag. It looks for <message> tags, and, upon finding one, creates a new Message-type object and gives that object the KXmlParser so that the Message can fill in its fields from the XML. It will keep asking the KXmlParser for more until it finds a </messages> tag or the end of the document.