001 package AST; 002 003 import java.util.HashSet; 004 import java.io.File; 005 import java.util.*; 006 import beaver.*; 007 import java.util.ArrayList; 008 import java.util.zip.*; 009 import java.io.*; 010 import java.io.FileNotFoundException; 011 import java.util.Collection; 012 /** 013 * @ast class 014 * 015 */ 016 public class ConstantNameAndType extends CPInfo { 017 018 private int name; 019 020 021 private int type; 022 023 024 public ConstantNameAndType(int name, int type) { 025 this.name = name; 026 this.type = type; 027 } 028 029 030 public void emit(DataOutputStream out) throws IOException { 031 out.writeByte(ConstantPool.CONSTANT_NameAndType); 032 out.writeChar(name); 033 out.writeChar(type); 034 } 035 036 037 public String toString() { 038 return pos + " NameAndType: tag " + ConstantPool.CONSTANT_NameAndType + ", name_index: " + name + ", descriptor_index: " + type; 039 } 040 041 042 }