User: norbert
Date: 00/05/24 12:17:20
Modified: src/java/org/spyderMQ/selectors Operator.java Selector.java
Log:
Changes to the Pub/Sub System in order to implement P2P.
Now, a SessionQueue is specific to an unique destination.
This is a way to code 'local optimisations' too
Added bug (I think) in acknowledge()
Selectors :
Remove the .getClass().getName() [ thx Rich ]
Revision Changes Path
1.8 +18 -20 spyderMQ/src/java/org/spyderMQ/selectors/Operator.java
Index: Operator.java
===================================================================
RCS file:
/products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/selectors/Operator.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Operator.java 2000/05/22 21:44:47 1.7
+++ Operator.java 2000/05/24 19:17:20 1.8
@@ -11,7 +11,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.7 $
+ * @version $Revision: 1.8 $
*/
public class Operator
{
@@ -198,11 +198,11 @@
void computeArgument1() throws Exception
{
- String className=oper1.getClass().getName();
+ Class className=oper1.getClass();
- if (className.equals("Identifier")) {
+ if (className.equals(Identifier.class)) {
arg1=((Identifier)oper1).value;
- } else if (className.equals("Operator")) {
+ } else if (className.equals(Operator.class)) {
arg1=((Operator)oper1).apply();
} else arg1=oper1;
@@ -211,23 +211,23 @@
return;
}
- className=arg1.getClass().getName();
+ className=arg1.getClass();
- if (className.equals("String")) class1=1;
- else if (className.equals("Double")) class1=2;
- else if (className.equals("Long")) class1=3;
- else if (className.equals("Boolean")) class1=4;
+ if (className.equals(String.class)) class1=1;
+ else if (className.equals(Double.class)) class1=2;
+ else if (className.equals(Long.class)) class1=3;
+ else if (className.equals(Boolean.class)) class1=4;
throw new Exception("ARG1: Bad object type");
}
void computeArgument2() throws Exception
{
- String className=oper2.getClass().getName();
+ Class className=oper2.getClass();
- if (className.equals("Identifier")) {
+ if (className.equals(Identifier.class)) {
arg2=((Identifier)oper2).value;
- } else if (className.equals("Operator")) {
+ } else if (className.equals(Operator.class)) {
arg2=((Operator)oper2).apply();
} else arg2=oper2;
@@ -236,12 +236,12 @@
return;
}
- className=arg2.getClass().getName();
+ className=arg2.getClass();
- if (className.equals("String")) class2=1;
- else if (className.equals("Double")) class2=2;
- else if (className.equals("Long")) class2=3;
- else if (className.equals("Boolean")) class2=4;
+ if (className.equals(String.class)) class2=1;
+ else if (className.equals(Double.class)) class2=2;
+ else if (className.equals(Long.class)) class2=3;
+ else if (className.equals(Boolean.class)) class2=4;
throw new Exception("ARG2: Bad object type");
}
@@ -263,10 +263,8 @@
throw new Exception("Unknown operation");
}
-
-
- //--
+ //--- Print functions ---
public String toString()
{
1.6 +6 -6 spyderMQ/src/java/org/spyderMQ/selectors/Selector.java
Index: Selector.java
===================================================================
RCS file:
/products/cvs/ejboss/spyderMQ/src/java/org/spyderMQ/selectors/Selector.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Selector.java 2000/05/22 22:01:01 1.5
+++ Selector.java 2000/05/24 19:17:20 1.6
@@ -17,7 +17,7 @@
*
* @author Norbert Lataille ([EMAIL PROTECTED])
*
- * @version $Revision: 1.5 $
+ * @version $Revision: 1.6 $
*/
public class Selector
{
@@ -57,8 +57,8 @@
Log.log("Warning : missing property "+id.name);
id.value=null;
} else {
- String type=find.getClass().getName();
- if
(type.equals("Boolean")||type.equals("String")||type.equals("Double")||type.equals("Integer"))
id.value=find;
+ Class type=find.getClass();
+ if
(type.equals(Boolean.class)||type.equals(String.class)||type.equals(Double.class)||type.equals(Integer.class))
id.value=find;
else throw new Exception("Bad property type
!");
}
}
@@ -66,14 +66,14 @@
//Compute the result of this operator
Object res;
- if (result.getClass().getName().equals("Identifier")) {
+ if (result.getClass().equals(Identifier.class)) {
res=((Identifier)result).value;
- } else if (result.getClass().getName().equals("Operator")) {
+ } else if (result.getClass().equals(Operator.class)) {
res=((Operator)result).apply();
} else res=result;
if (res==null) throw new Exception("res==null");
- if (!(res.getClass().getName().equals("Boolean"))) throw new
Exception("Bad object type");
+ if (!(res.getClass().equals(Boolean.class))) throw new
Exception("Bad object type");
return ((Boolean)res).booleanValue();