|
From: <rga...@us...> - 2002-11-10 15:12:56
|
Update of /cvsroot/csms/csms-core/src/java/org/fanfoot/scoring
In directory usw-pr-cvs1:/tmp/cvs-serv8618
Modified Files:
Events.java
Log Message:
Minor clarifications in comments
Index: Events.java
===================================================================
RCS file: /cvsroot/csms/csms-core/src/java/org/fanfoot/scoring/Events.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Events.java 21 Oct 2002 19:55:34 -0000 1.3
--- Events.java 10 Nov 2002 15:12:53 -0000 1.4
***************
*** 67,71 ****
private Vector types = new Vector();
! /** Holds value of property uid. */
private String uid = "";
--- 67,71 ----
private Vector types = new Vector();
! /** The unique identifier for these events. */
private String uid = "";
***************
*** 74,78 ****
/** Where to write log entries */
! final Logger logger = Logger.getLogger("org.fanfoot.scoring");
--- 74,78 ----
/** Where to write log entries */
! final Logger logger = Logger.getLogger( "org.fanfoot.scoring" );
***************
*** 89,95 ****
* application unique
*/
! public Events(String strUID) {
super();
! this.setUID(strUID);
}
--- 89,95 ----
* application unique
*/
! public Events( String strUID ) {
super();
! this.setUID( strUID );
}
***************
*** 111,116 ****
*@return the collection of events
*/
! public Event getEvent(int idx) {
! return (Event) this.events.get(idx);
}
--- 111,116 ----
*@return the collection of events
*/
! public Event getEvent( int idx ) {
! return (Event) this.events.get( idx );
}
***************
*** 121,130 ****
*@param evt The event to add
*/
! public void add(Event evt) {
! if(!this.types.contains(evt.getType())) {
! this.types.add(evt.getType());
}
! this.events.add(evt);
}
--- 121,130 ----
*@param evt The event to add
*/
! public void add( Event evt ) {
! if ( !this.types.contains( evt.getType() ) ) {
! this.types.add( evt.getType() );
}
! this.events.add( evt );
}
***************
*** 145,153 ****
*@param evts the events to add
*/
! public void addAll(Events evts) {
Iterator iter = evts.getEvents().iterator();
! while(iter.hasNext()) {
! this.add((Event) iter.next());
}
}
--- 145,153 ----
*@param evts the events to add
*/
! public void addAll( Events evts ) {
Iterator iter = evts.getEvents().iterator();
! while ( iter.hasNext() ) {
! this.add( (Event) iter.next() );
}
}
***************
*** 164,176 ****
*@param conf the vonfiguration for these events
*/
! public void addAll(Events evts, EventParserConfiguration conf) {
Iterator iter = evts.getEvents().iterator();
Event evt;
! while(iter.hasNext()) {
evt = (Event) iter.next();
! if(!contains(evt, conf)) {
! this.add(evt);
}
}
--- 164,176 ----
*@param conf the vonfiguration for these events
*/
! public void addAll( Events evts, EventParserConfiguration conf ) {
Iterator iter = evts.getEvents().iterator();
Event evt;
! while ( iter.hasNext() ) {
evt = (Event) iter.next();
! if ( !contains( evt, conf ) ) {
! this.add( evt );
}
}
***************
*** 188,205 ****
* allready
*/
! public boolean contains(Event evt, EventParserConfiguration conf) {
// indicates if an element that is equal does NOT exist
boolean contains = false;
// indicates if the parts tested so far are equal
boolean partsAreEqual = true;
! Iterator events = this.getEventsByType(evt.getType()).iterator();
Event existingEvt;
Iterator parts;
String strPartName;
! while(events.hasNext() & !contains) {
! parts = conf.getDuplicateDetectionParts(evt.getType());
! if(parts.hasNext()) {
partsAreEqual = true;
} else {
--- 188,205 ----
* allready
*/
! public boolean contains( Event evt, EventParserConfiguration conf ) {
// indicates if an element that is equal does NOT exist
boolean contains = false;
// indicates if the parts tested so far are equal
boolean partsAreEqual = true;
! Iterator events = this.getEventsByType( evt.getType() ).iterator();
Event existingEvt;
Iterator parts;
String strPartName;
! while ( events.hasNext() & !contains ) {
! parts = conf.getDuplicateDetectionParts( evt.getType() );
! if ( parts.hasNext() ) {
partsAreEqual = true;
} else {
***************
*** 208,215 ****
existingEvt = (Event) events.next();
! while(parts.hasNext()) {
strPartName = (String) parts.next();
! partsAreEqual = arePartsEqual(evt.getPart(strPartName),
! existingEvt.getPart(strPartName))
& partsAreEqual;
}
--- 208,215 ----
existingEvt = (Event) events.next();
! while ( parts.hasNext() ) {
strPartName = (String) parts.next();
! partsAreEqual = arePartsEqual( evt.getPart( strPartName ),
! existingEvt.getPart( strPartName ) )
& partsAreEqual;
}
***************
*** 229,234 ****
*@return true if the parts are equal
*/
! protected boolean arePartsEqual(String partValue1, String partValue2) {
! return partValue1.equals(partValue2);
}
--- 229,234 ----
*@return true if the parts are equal
*/
! protected boolean arePartsEqual( String partValue1, String partValue2 ) {
! return partValue1.equals( partValue2 );
}
***************
*** 250,254 ****
*@return an ArrayList of all events of the supplied type
*/
! public ArrayList getEventsByType(String strType) {
ArrayList result = new ArrayList();
Event evt;
--- 250,254 ----
*@return an ArrayList of all events of the supplied type
*/
! public ArrayList getEventsByType( String strType ) {
ArrayList result = new ArrayList();
Event evt;
***************
*** 256,264 ****
Iterator li = events.iterator();
! while(li.hasNext()) {
evt = (Event) li.next();
! if(evt.getType().equals(strType)) {
! result.add(evt);
}
}
--- 256,264 ----
Iterator li = events.iterator();
! while ( li.hasNext() ) {
evt = (Event) li.next();
! if ( evt.getType().equals( strType ) ) {
! result.add( evt );
}
}
***************
*** 269,273 ****
/**
! * Getter for property UID.
*
*@return Value of property UID.
--- 269,273 ----
/**
! * Getter for the unique identifier for this groups of events
*
*@return Value of property UID.
***************
*** 279,287 ****
/**
! * Setter for property UID.
*
*@param uid New value of property UID.
*/
! public void setUID(String uid) {
this.uid = uid;
}
--- 279,287 ----
/**
! * Setter for the unique identifier for this groups of events
*
*@param uid New value of property UID.
*/
! public void setUID( String uid ) {
this.uid = uid;
}
***************
*** 303,307 ****
*@param srcData New value of property srcData.
*/
! public void setSrcData(String srcData) {
this.srcData = srcData;
}
--- 303,307 ----
*@param srcData New value of property srcData.
*/
! public void setSrcData( String srcData ) {
this.srcData = srcData;
}
***************
*** 316,330 ****
*/
public Document toXMLDoc() throws ParserConfigurationException {
! Document doc = XMLUtils.createXMLDoc("events");
Element root = doc.getDocumentElement();
! Element elem = doc.createElement("uid");
! Text text = doc.createTextNode(this.getUID());
! elem.appendChild(text);
! root.appendChild(elem);
! elem = doc.createElement("srcData");
! text = doc.createTextNode(this.getSrcData());
! elem.appendChild(text);
! root.appendChild(elem);
Enumeration evtTypes = this.getTypes();// all types of events
--- 316,330 ----
*/
public Document toXMLDoc() throws ParserConfigurationException {
! Document doc = XMLUtils.createXMLDoc( "events" );
Element root = doc.getDocumentElement();
! Element elem = doc.createElement( "uid" );
! Text text = doc.createTextNode( this.getUID() );
! elem.appendChild( text );
! root.appendChild( elem );
! elem = doc.createElement( "srcData" );
! text = doc.createTextNode( this.getSrcData() );
! elem.appendChild( text );
! root.appendChild( elem );
Enumeration evtTypes = this.getTypes();// all types of events
***************
*** 333,343 ****
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);
}
}
--- 333,343 ----
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 );
}
}
|