KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* $Id: ProtocolUpdateStripped.java,v 1.2 2004/05/20 14:23:53 bures Exp $ */
2
3 package SOFA.SOFAnode.Util;
4
5
6 class ProtocolUpdateStripped extends ProtocolOperator {
7
8     protected Protocol nested;
9
10     public ProtocolUpdateStripped( Protocol l ) {
11     super( "=U'" ); // FIXME: something reasonable
12
nested = l;
13     }
14     
15     public Protocol Copy() {
16     return new ProtocolUpdateStripped( nested.Copy());
17     }
18     
19     public Machine createMachine() {
20         
21     Machine m1 = nested.createMachine();
22         
23     m1.StrippedUpdateOnly();
24
25     return m1;
26     }
27     
28     public boolean Restrict( ActionTokenArray a ) {
29     ActionTokenArray h = new ActionTokenArray( a );
30     h.tokens[1]=true; // [UPDATE] must survive the restriction
31
return nested.Restrict( h );
32     }
33
34     public void Print( int level ) {
35     Debug.println( level, "Stripped update behavior");
36     nested.Print( level );
37     }
38
39     public Protocol Left() {
40     return nested;
41     }
42
43     public Protocol getSameType( Object JavaDoc p1, Object JavaDoc p2 ) {
44     return new ProtocolUpdateStripped( (Protocol)p1 );
45     }
46 }
47
Popular Tags