|
From: <rga...@us...> - 2002-10-21 19:55:38
|
Update of /cvsroot/csms/csms-core/src/java/org/fanfoot/scoring
In directory usw-pr-cvs1:/tmp/cvs-serv25165
Modified Files:
Events.java
Log Message:
Refactoring
Index: Events.java
===================================================================
RCS file: /cvsroot/csms/csms-core/src/java/org/fanfoot/scoring/Events.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Events.java 21 Oct 2002 12:01:14 -0000 1.2
--- Events.java 21 Oct 2002 19:55:34 -0000 1.3
***************
*** 56,62 ****
* affect the fantasy game.
*
! *@author rgardler
! *@created 21 October 2002
! *@see org.fanfoot.scoring.Event
*/
public class Events {
--- 56,62 ----
* affect the fantasy game.
*
! *@author rgardler
! *@created 21 October 2002
! *@see org.fanfoot.scoring.Event
*/
public class Events {
***************
*** 86,91 ****
* Creates a new instance of Events
*
! *@param strUID a unique identifier for this set of events, must
! * be application unique
*/
public Events(String strUID) {
--- 86,91 ----
* Creates a new instance of Events
*
! *@param strUID a unique identifier for this set of events, must be
! * application unique
*/
public Events(String strUID) {
***************
*** 98,102 ****
* Get the collection of events
*
! *@return the collection of events
*/
public List getEvents() {
--- 98,102 ----
* Get the collection of events
*
! *@return the collection of events
*/
public List getEvents() {
***************
*** 108,113 ****
* Get the event at the given index
*
! *@param idx the index number of the event required
! *@return the collection of events
*/
public Event getEvent(int idx) {
--- 108,113 ----
* Get the event at the given index
*
! *@param idx the index number of the event required
! *@return the collection of events
*/
public Event getEvent(int idx) {
***************
*** 119,126 ****
* Add the supplied event to the Events list.
*
! *@param evt The event to add
*/
public void add(Event evt) {
! if (!this.types.contains(evt.getType())) {
this.types.add(evt.getType());
}
--- 119,126 ----
* Add the supplied event to the Events list.
*
! *@param evt The event to add
*/
public void add(Event evt) {
! if(!this.types.contains(evt.getType())) {
this.types.add(evt.getType());
}
***************
*** 133,137 ****
* Get the number of events in this collection.
*
! *@return int number of events in collection
*/
public int size() {
--- 133,137 ----
* Get the number of events in this collection.
*
! *@return int number of events in collection
*/
public int size() {
***************
*** 143,152 ****
* Add all the supplied events to this Events collection.
*
! *@param evts the events to add
*/
public void addAll(Events evts) {
Iterator iter = evts.getEvents().iterator();
! while (iter.hasNext()) {
this.add((Event) iter.next());
}
--- 143,152 ----
* Add all the supplied events to this Events collection.
*
! *@param evts the events to add
*/
public void addAll(Events evts) {
Iterator iter = evts.getEvents().iterator();
! while(iter.hasNext()) {
this.add((Event) iter.next());
}
***************
*** 161,166 ****
* requireing validation.
*
! *@param evts the events to add
! *@param conf the vonfiguration for these events
*/
public void addAll(Events evts, EventParserConfiguration conf) {
--- 161,166 ----
* requireing validation.
*
! *@param evts the events to add
! *@param conf the vonfiguration for these events
*/
public void addAll(Events evts, EventParserConfiguration conf) {
***************
*** 168,175 ****
Event evt;
! while (iter.hasNext()) {
evt = (Event) iter.next();
! if (!contains(evt, conf)) {
this.add(evt);
}
--- 168,175 ----
Event evt;
! while(iter.hasNext()) {
evt = (Event) iter.next();
! if(!contains(evt, conf)) {
this.add(evt);
}
***************
*** 183,190 ****
* configuration file.
*
! *@param evt the event to check for
! *@param conf the event parser configuration
! *@return true if the events collection contains an identical
! * event allready
*/
public boolean contains(Event evt, EventParserConfiguration conf) {
--- 183,190 ----
* configuration file.
*
! *@param evt the event to check for
! *@param conf the event parser configuration
! *@return true if the events collection contains an identical event
! * allready
*/
public boolean contains(Event evt, EventParserConfiguration conf) {
***************
*** 198,205 ****
String strPartName;
! while (events.hasNext() & !contains) {
parts = conf.getDuplicateDetectionParts(evt.getType());
! if (parts.hasNext()) {
partsAreEqual = true;
} else {
--- 198,205 ----
String strPartName;
! while(events.hasNext() & !contains) {
parts = conf.getDuplicateDetectionParts(evt.getType());
! if(parts.hasNext()) {
partsAreEqual = true;
} else {
***************
*** 208,212 ****
existingEvt = (Event) events.next();
! while (parts.hasNext()) {
strPartName = (String) parts.next();
partsAreEqual = arePartsEqual(evt.getPart(strPartName),
--- 208,212 ----
existingEvt = (Event) events.next();
! while(parts.hasNext()) {
strPartName = (String) parts.next();
partsAreEqual = arePartsEqual(evt.getPart(strPartName),
***************
*** 225,231 ****
* Test to see if the two supplied part values are equal
*
! *@param partValue1 the first part value
! *@param partValue2 the second part value
! *@return true if the parts are equal
*/
protected boolean arePartsEqual(String partValue1, String partValue2) {
--- 225,231 ----
* Test to see if the two supplied part values are equal
*
! *@param partValue1 the first part value
! *@param partValue2 the second part value
! *@return true if the parts are equal
*/
protected boolean arePartsEqual(String partValue1, String partValue2) {
***************
*** 237,241 ****
* Get the names of all event types present
*
! *@return Enumeration of all event types
*/
public Enumeration getTypes() {
--- 237,241 ----
* Get the names of all event types present
*
! *@return Enumeration of all event types
*/
public Enumeration getTypes() {
***************
*** 247,252 ****
* Get all events in the collection of the indicated type.
*
! *@param strType the type of event requried
! *@return an ArrayList of all events of the supplied type
*/
public ArrayList getEventsByType(String strType) {
--- 247,252 ----
* Get all events in the collection of the indicated type.
*
! *@param strType the type of event requried
! *@return an ArrayList of all events of the supplied type
*/
public ArrayList getEventsByType(String strType) {
***************
*** 256,263 ****
Iterator li = events.iterator();
! while (li.hasNext()) {
evt = (Event) li.next();
! if (evt.getType().equals(strType)) {
result.add(evt);
}
--- 256,263 ----
Iterator li = events.iterator();
! while(li.hasNext()) {
evt = (Event) li.next();
! if(evt.getType().equals(strType)) {
result.add(evt);
}
***************
*** 271,275 ****
* Getter for property UID.
*
! *@return Value of property UID.
*/
public String getUID() {
--- 271,275 ----
* Getter for property UID.
*
! *@return Value of property UID.
*/
public String getUID() {
***************
*** 281,285 ****
* Setter for property UID.
*
! *@param uid New value of property UID.
*/
public void setUID(String uid) {
--- 281,285 ----
* Setter for property UID.
*
! *@param uid New value of property UID.
*/
public void setUID(String uid) {
***************
*** 291,295 ****
* Getter for property srcData.
*
! *@return Value of property srcData.
*/
public String getSrcData() {
--- 291,295 ----
* Getter for property srcData.
*
! *@return Value of property srcData.
*/
public String getSrcData() {
***************
*** 301,305 ****
* Setter for property srcData.
*
! *@param srcData New value of property srcData.
*/
public void setSrcData(String srcData) {
--- 301,305 ----
* Setter for property srcData.
*
! *@param srcData New value of property srcData.
*/
public void setSrcData(String srcData) {
***************
*** 311,317 ****
* Return an XML DOM representation of this event
*
! *@return Document XML DOM
! * representation of this event
! *@throws ParserConfigurationException if there is a problem with
* the XML parser
*/
--- 311,316 ----
* Return an XML DOM representation of this event
*
! *@return Document XML DOM representation of this event
! *@throws ParserConfigurationException if there is a problem with
* the XML parser
*/
***************
*** 329,346 ****
root.appendChild(elem);
! Enumeration evtTypes = this.getTypes();
! // all types of events
! String strType;
! // type of events currently being processed
! ArrayList typeEvts;
! // all events of a certain type
! Event evt;
! // event currently being processed
! while (evtTypes.hasMoreElements()) {
strType = (String) evtTypes.nextElement();
typeEvts = this.getEventsByType(strType);
! for (int i = 0; i < typeEvts.size(); i++) {
evt = (Event) typeEvts.get(i);
evt.appendXMLTo(doc);
--- 328,341 ----
root.appendChild(elem);
! Enumeration evtTypes = this.getTypes();// all types of events
! String strType;// type of events currently being processed
! ArrayList typeEvts;// all events of a certain type
! Event evt;// event currently being processed
! while(evtTypes.hasMoreElements()) {
strType = (String) evtTypes.nextElement();
typeEvts = this.getEventsByType(strType);
! for(int i = 0; i < typeEvts.size(); i++) {
evt = (Event) typeEvts.get(i);
evt.appendXMLTo(doc);
|