diff src/fdl/PSXLinda.java @ 97:0ea086f0e96f fuchita

main loop modification, for easy meta engine addition. add comments.
author one
date Wed, 26 May 2010 10:49:50 +0900
parents a1d796c0e975
children efe50b1204f3
line wrap: on
line diff
--- a/src/fdl/PSXLinda.java	Wed May 26 08:56:24 2010 +0900
+++ b/src/fdl/PSXLinda.java	Wed May 26 10:49:50 2010 +0900
@@ -3,36 +3,137 @@
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
+/**
+ * @author kono
+ *
+ */
+/**
+ * @author kono
+ *
+ */
+/**
+ * @author kono
+ *
+ */
 public interface PSXLinda {
 
-
+	
+	/**
+	 * send IN request to the linda
+	 * Tuple with id will be removed, and the value is returned in the reply
+	 * @param id
+	 * @return wait for this request
+	 */
 	public PSXReply in(int id) ;
 
+	/**
+	 * send IN request and set call back for reply
+	 * @param id
+	 * @param callback
+	 */
 	public void in(int id, PSXCallback callback);
 
+	/**
+	 * send Check request to the linda
+	 * Tuple with id will not be removed, it return even if there is no tuple for
+	 * this id
+	 * @param id
+	 * @return wait for this request
+	 */
 	public PSXReply ck(int id) ;
 
+	/**
+	 * send Check request and set call back for reply
+	 * @param id
+	 * @param callback
+	 */
 	public void ck(int id, PSXCallback callback) ;
 
+	/**
+	 * send a Tuple to the linda
+	 * Tuple may stack in the linda, mutiple out is possible.
+	 * No blocking.
+	 * this id
+	 * @param id
+	 * @return wait for this request
+	 */
 	public PSXReply out(int id, ByteBuffer data) ;
 
+	/**
+	 * replace a Tuple in the linda
+	 * the old value is returned in the reply
+	 * @param id
+	 * @return wait for this request
+	 */
 	public PSXReply update(int id, ByteBuffer data) ;
 
+	/**
+	 * send Update request and set call back for reply
+	 * @param id
+	 * @param callback
+	 */
 	public void update(int id, ByteBuffer data,PSXCallback callback) ;
 
+	/**
+	 * Read the tuple in the linda, do not remove the tuple.
+	 * it return it's value
+	 * @param id
+	 * @return wait for this request
+	 */
 	public PSXReply rd(int id) ;
 
+	/**
+	 * send Read request and set call back for reply
+	 * @param id
+	 * @param callback
+	 */
 	public void rd(int id, PSXCallback callback) ;
 
-	public PSXLinda add(PSXLinda linda) ;
+
+	/**
+	 * Wait for newly incoming tuple for this id. 
+	 * Existing tuple is ingored.
+	 * Read the tuple in the linda, do not remove the tuple.
+	 * it return it's value
+	 * @param id
+	 * @return wait for this request
+	 */
+	public PSXReply waitRd(int i);
 
+	/**
+	 * send Read request and set call back for reply
+	 * @param id
+	 * @param callback
+	 */
+	public void waitRd(int i, PSXCallback callback);
+	
+	/**
+	 * Send all registered reqests, and read incoming replies.
+	 * No wait
+	 * @return
+	 * @throws IOException
+	 */
 	public int sync() throws IOException ;
 
+	/**
+	 * Send all registered reqests, and read incoming replies.
+	 * @param mtime     wait for mtime msec, if 0 this waits indefinitely.
+	 * @return
+	 * @throws IOException
+	 */
 	public int sync(long mtime) throws IOException ;
 
+	/**
+	 * Internal use
+	 * @param linda
+	 * @return
+	 */
+	public PSXLinda add(PSXLinda linda) ;
+	
+	/*
+	 * Intenal use
+	 * sned data for this port
+	 */
 	public void send(ByteBuffer command, ByteBuffer data);
 
-	public void waitRd(int i, PSXCallback callback);
-	
-	public PSXReply waitRd(int i);
 }