2006/unicorn/org/w3c/unicorn/request RequestList.java,1.3,1.4

Update of /sources/public/2006/unicorn/org/w3c/unicorn/request
In directory hutz:/tmp/cvs-serv11296/org/w3c/unicorn/request

Modified Files:
	RequestList.java 
Log Message:
Functionalities added for the RequestList to deal with the level of execution of the tasklist tree

Index: RequestList.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/request/RequestList.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- RequestList.java	17 Jun 2008 13:41:11 -0000	1.3
+++ RequestList.java	26 Aug 2008 15:30:59 -0000	1.4
@@ -10,7 +10,6 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.w3c.unicorn.generated.tasklist.TPriority;
 
 /**
  * @author Damien LEROY
@@ -44,106 +43,48 @@
 	 * Map of request about the observer who handle the current mime type with a
 	 * LOW priority.
 	 */
-	private final Map<String, Request> mapOfRequestLOW = new LinkedHashMap<String, Request>();
-
-	/**
-	 * Map of request about the observer who handle the current mime type with a
-	 * MEDIUM priority.
-	 */
-	private final Map<String, Request> mapOfRequestMEDIUM = new LinkedHashMap<String, Request>();
-
-	/**
-	 * Map of request about the observer who handle the current mime type with a
-	 * HIGH priority.
-	 */
-	private final Map<String, Request> mapOfRequestHIGH = new LinkedHashMap<String, Request>();
+	private final Map<String, Request> mapOfRequest = new LinkedHashMap<String, Request>();
 
+	
 	/**
-	 * Get a request from the data structures with its ideas sorted by
-	 * priorities
 	 * 
-	 * @param sObserverID
-	 *            ID of the observer to get
-	 * @return a request extracted from the maps of priorities
+	 * @return
 	 */
-	public Request getRequest(final String sObserverID) {
-		RequestList.logger.trace("getRequest");
-		if (RequestList.logger.isDebugEnabled()) {
-			RequestList.logger.debug("Observer ID : " + sObserverID + ".");
-		}
-		Request aRequest = null;
-		aRequest = this.mapOfRequestHIGH.get(sObserverID);
-		if (null != aRequest)
-			return aRequest;
-		aRequest = this.mapOfRequestMEDIUM.get(sObserverID);
-		if (null != aRequest)
-			return aRequest;
-		return this.mapOfRequestLOW.get(sObserverID);
+	public Map<String,Request> getRequestMap() {
+		return this.mapOfRequest;
 	}
+ 
 
 	/**
-	 * Gives the map of the requests depending on the priorities
+	 * Gives an observer placed in the map 
 	 * 
-	 * @param aTPriority
-	 *            priority to get
-	 * @return map of the request depending on the priorities
+	 * @param String sNodeID the ID of the node into which we'll search the Request
+	 * @return
 	 */
-	public Map<String, Request> getRequest(final TPriority aTPriority) {
+	public Request getRequest(final String sNodeID) {
 		RequestList.logger.trace("getRequest");
 		if (RequestList.logger.isDebugEnabled()) {
-			RequestList.logger.debug("Priority : " + aTPriority + ".");
-		}
-		switch (aTPriority) {
-		case HIGH:
-			return this.mapOfRequestHIGH;
-		case MEDIUM:
-			return this.mapOfRequestMEDIUM;
-		case LOW:
-			return this.mapOfRequestLOW;
+			RequestList.logger.debug("Observer ID : " + sNodeID + ".");
 		}
-		return null;
+		return this.mapOfRequest.get(sNodeID);
 	}
 
 	/**
-	 * Gives an observer placed in priority list
-	 * 
-	 * @param aTPriority
-	 *            priority into which it will search
-	 * @param sObserverID
-	 *            ID of the observer to get
-	 * @return
+	 * Adds a request to the map
+	 * @param aRequest
+	 * @param sNodeID The ID of the corresponding node
+	 * @throws IOException
 	 */
-	public Request getRequest(final TPriority aTPriority,
-			final String sObserverID) {
-		RequestList.logger.trace("getRequest");
-		if (RequestList.logger.isDebugEnabled()) {
-			RequestList.logger.debug("Priority : " + aTPriority + ".");
-			RequestList.logger.debug("Observer ID : " + sObserverID + ".");
-		}
-		return this.getRequest(aTPriority).get(sObserverID);
-	}
-
-	public void addRequest(final Request aRequest, final TPriority aTPriority,
-			final String sObserverID) throws IOException {
+	public void addRequest(final Request aRequest, 
+			final String sNodeID) throws IOException {
 		RequestList.logger.trace("addRequest");
 		if (RequestList.logger.isDebugEnabled()) {
 			RequestList.logger.debug("Request : " + aRequest + ".");
-			RequestList.logger.debug("TPriority : " + aTPriority + ".");
-			RequestList.logger.debug("String observer ID : " + sObserverID
+			RequestList.logger.debug("String node ID : " + sNodeID
 					+ ".");
 		}
 		aRequest.setLang(this.sLang);
-		switch (aTPriority) {
-		case HIGH:
-			this.mapOfRequestHIGH.put(sObserverID, aRequest);
-			return;
-		case MEDIUM:
-			this.mapOfRequestMEDIUM.put(sObserverID, aRequest);
-			return;
-		case LOW:
-			this.mapOfRequestLOW.put(sObserverID, aRequest);
-			return;
-		}
+		this.mapOfRequest.put(sNodeID, aRequest);
 	}
 
 	/**
@@ -153,11 +94,7 @@
 		final int iStringBufferSize = 1000;
 		final String sVariableSeparator = " ";
 		final StringBuffer aStringBuffer = new StringBuffer(iStringBufferSize);
-		aStringBuffer.append("HIGH:").append(this.mapOfRequestHIGH);
-		aStringBuffer.append(sVariableSeparator);
-		aStringBuffer.append("MEDIUM:").append(this.mapOfRequestMEDIUM);
-		aStringBuffer.append(sVariableSeparator);
-		aStringBuffer.append("LOW:").append(this.mapOfRequestLOW);
+		aStringBuffer.append(mapOfRequest);
 		return aStringBuffer.toString();
 	}
 

Received on Tuesday, 26 August 2008 15:31:36 UTC