KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Util > ProtocolBinaryOperator


1 /* $Id: ProtocolBinaryOperator.java,v 1.1.1.1 2003/02/11 16:19:41 bures Exp $ */
2
3 package SOFA.SOFAnode.Util;
4
5 abstract class ProtocolBinaryOperator extends ProtocolOperator {
6
7     protected Protocol left;
8     protected Protocol right;
9     
10     public ProtocolBinaryOperator( String JavaDoc operator, Protocol l, Protocol r ) {
11     super( operator );
12     left = l;
13     right = r;
14     }
15     
16     public boolean Restrict( ActionTokenArray a ) {
17     boolean resultl = left.Restrict( a );
18     boolean resultr = right.Restrict( a );
19     
20     if( resultl ) left = new ProtocolToken( 0 );
21     if( resultr ) right = new ProtocolToken( 0 );
22     
23     return resultl && resultr;
24     }
25
26     public void Print( int level ) {
27     super.Print(level);
28     left.Print(level);
29     right.Print(level);
30     Debug.print( level, "----" );
31     super.Print(level);
32     }
33
34     public Protocol Left() {
35     return left;
36     }
37
38     public Protocol Right() {
39     return right;
40     }
41 }
42
43
Popular Tags