KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jas > InterfaceCP


1 /**
2  * An InterfaceCP is used to refer to an interface specification
3  *
4  * @author $Author: fqian $
5  * @version $Revision: 1.1 $
6  */

7
8 package jas;
9
10 import java.io.*;
11
12
13 public class InterfaceCP extends CP implements RuntimeConstants
14 {
15   ClassCP clazz;
16   NameTypeCP nt;
17
18   /**
19    * @param cname Name of class defining the interface
20    * @param varname symbol for the interface method
21    * @param sig Signature for method
22    */

23   public InterfaceCP(String JavaDoc cname, String JavaDoc varname, String JavaDoc sig)
24   {
25     uniq = (cname + "&%$#&" + varname + "*()#$" + sig).intern();
26     clazz = new ClassCP(cname);
27     nt = new NameTypeCP(varname, sig);
28   }
29
30   void resolve(ClassEnv e)
31   {
32     e.addCPItem(clazz);
33     e.addCPItem(nt);
34   }
35     
36   void write(ClassEnv e, DataOutputStream out)
37     throws IOException, jasError
38   {
39     out.writeByte(CONSTANT_INTERFACEMETHOD);
40     out.writeShort(e.getCPIndex(clazz));
41     out.writeShort(e.getCPIndex(nt));
42   }
43 }
44
Popular Tags