irobject.java

来自「用Java实现的编译器。把源代码编译成SPARC汇编程序」· Java 代码 · 共 65 行

JAVA
65
字号
// $Id: IRObject.java,v 1.6 1999/09/27 20:01:28 deberg Exp $package java6035.tools.IR;import java.util.*;/** * IRObject represents an object in the IR.   *  * All IRObject instances are annotatable. An annotation is an <int,Object> * tuple, and can be placed on an IRObject using the annotate method. */public abstract class IRObject implements Annotatable{    protected Hashtable annotations;     public IRObject()    {        annotations = new Hashtable();    }        /**     * Attach an annotation specified by the tag to the object. Remove     * existing annotation with the same tag first.      */    public void annotate(int tag, Object data)    {        annotations.remove(new Integer(tag));	annotations.put(new Integer(tag), data);    }    /**     * Searches for a particular annotation, given an annotation tag. Returns     * the object if found, null otherwise.     */    public Object getAnnotation(int tag)    {	return annotations.get(new Integer(tag));    }    /**     * Removes an annotation. Returns the object if annotation is found, null     * otherwise.     */    public Object removeAnnotation(int tag)    {	return annotations.remove(new Integer(tag));    }    public Enumeration listTags()    {        return annotations.keys();    }    public Enumeration listAnnotations()    {        return annotations.elements();    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?