📄 allocexpr.java
字号:
// $Id: AllocExpr.java,v 1.6 2000/10/10 15:47:49 mdeeds Exp $package java6035.tools.IR;/** * AllocExpr represents an allocation expression. */public class AllocExpr extends Expression{ protected IRType type; protected Rhs number; /** * Constructs an AllocExpr indicating the allocation of the * specified Rhs (number). This will typically be an array or * class. * * Requires: type, number are not Null. **/ public AllocExpr(IRType type, Rhs number) { this.type = type; this.number = number; if (this.type == null) throw new IRException("AllocExpr: constructor: type null"); if (this.number == null) throw new IRException("AllocExpr: constructor: number null"); } /** * Returns the globally specified ID for this type of Expression. * (i.e. ALLOC_EXPR) **/ protected int expkind() { return ALLOC_EXPR; } /** * Returns the type of this allocation. */ public IRType getAllocType() { return type; } /** * Sets the type of this allocation. * * Requires: type is not null **/ public void setAllocType(IRType type) { this.type = type; if (this.type == null) throw new IRException("AllocExpr: setAllocType: type null"); } /** * Returns the number of allocations. */ public Rhs getNumber() { return number; } /** * Sets the number of allocation. */ public void setNumber(Rhs number) { this.number = number; if (this.number == null) throw new IRException("AllocExpr: setNumber: number null"); } /** * Walkable interface: returns the name of the node. */ public String getNodeName() { return "alloc_expr"; } /** * Walkable interface: returns the number of neighbors. */ public int getNeighborCount() { return 2; } /** * Walkable interface: returns the specified neighbor: 0, type; * 1, number. */ public Object getNeighbor(int index) { if (index == 0) return type; else if (index == 1) return number; return null; } public String PPrint(int indent, boolean recursive) { String output = new String(); for(int i=0;i<indent;i++) output += " "; output += "(alloc_expr\n"; if (recursive) output += number.PPrint(indent+2, true); for(int i=0;i<indent;i++) output += " "; output += ") /* alloc_expr */\n"; return output; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -