KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SOFA > SOFAnode > Made > CDL > CompProtBinOper


1 /* $Id: CompProtBinOper.java,v 1.1.1.1 2003/02/11 16:19:40 bures Exp $ */
2 package SOFA.SOFAnode.Made.CDL;
3
4 class CompProtBinOper extends CompProtOper {
5   public CompProtOper operand1;
6   public CompProtOper operand2;
7   public CompProtBinOper(CompProtOper operand1, CompProtOper operand2, int kind) {
8     super(kind);
9     this.operand1 = operand1;
10     this.operand2 = operand2;
11   }
12
13   public String JavaDoc toText() {
14     StringBuffer JavaDoc sb = new StringBuffer JavaDoc("(");
15     String JavaDoc strOp="";
16     switch (type) {
17     case CompProtKind.p_alternative:
18       strOp = ")+(";
19       break;
20     case CompProtKind.p_andparallel:
21       strOp = ")|(";
22       break;
23     case CompProtKind.p_orparallel:
24       strOp = ")||(";
25       break;
26     case CompProtKind.p_sequence:
27       strOp = ");(";
28       break;
29     case CompProtKind.p_restriction:
30       strOp = ")/(";
31       break;
32     default: break;
33     }
34     
35     sb.append(operand1.toText());
36     sb.append(strOp);
37     sb.append(operand2.toText());
38     sb.append(")");
39     return sb.toString();
40   }
41 }
42
Popular Tags