KickJava   Java API By Example, From Geeks To Geeks.

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


1 /* $Id: CompRequire.java,v 1.1.1.1 2003/02/11 16:19:40 bures Exp $ */
2 package SOFA.SOFAnode.Made.CDL;
3  
4 class CompRequire extends CompContainedIm {
5   CompReffer type;
6   EnumList operations;
7   String JavaDoc typeCode;
8   
9   public CompRequire(ID id, CompContainer in, CompRepository inRep, CompReffer t, EnumList op, String JavaDoc tC) {
10     super(ObjectsKind.o_Requires, id, in, inRep);
11     id.version = ((CompContained) in).getIdent().version;
12     type = t;
13     operations = op;
14     typeCode = tC;
15 // Debug.message("Vytvarim require: "+id);
16
}
17
18   public void checkConsist(EnumList props, CompRepository rep) throws CDLExceptCheck, CDLExceptLock, CDLExceptRemote {
19     type.checkConsist(props, rep);
20   }
21
22   public boolean isOperation(String JavaDoc name) {
23     return operations.isIn(name);
24   }
25
26   public boolean containsArray() {
27     if (typeCode.indexOf('a')!=-1)
28       return true;
29     return false;
30   }
31
32   /** Returns interface protocol adjusted to frame (add ?/! and instantion of iface).
33       <b>Return values:</b><br>
34       <ol><li>string with protocol</li><li><i>null</i>, if reffers array, or no protocol exists</li></ol> */

35   public String JavaDoc ifaceProtocol() throws CDLExceptLock, CDLExceptRemote {
36     if (typeCode.indexOf('a')==-1)
37       return CompProvide.realIfaceProtocol(type, "!", id.name, rep);
38     else {
39       CompReffer r = CompProvide.getProvReqIface(type.ref, rep);
40       if (r!=null)
41         return CompProvide.realIfaceProtocol(r, "!", id.name, rep);
42       else
43         return null;
44     }
45   }
46 }
47
Popular Tags