|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scale.common.Root scale.clef.Node scale.clef.expr.Expression scale.clef.expr.Literal scale.clef.expr.AggregationElements
public class AggregationElements
The AggregationElements class represents an aggregation of values used to initialize a variable.
$Id: AggregationElements.java,v 1.67 2007-10-04 19:58:05 burrill Exp $
Copyright 2008 by the
Scale Compiler Group,
Department of Computer Science
University of Massachusetts,
Amherst MA. 01003, USA
All Rights Reserved.
The elements of the aggregation comprize a sequence of Literal
instances and PositionOp
instances.
Literal
,
PositionOp
,
PositionFieldOp
,
PositionIndexOp
,
PositionOffsetOp
,
PositionRepeatOp
Constructor Summary | |
---|---|
AggregationElements(Type type,
Vector<java.lang.Object> elements)
Create an initialization expression to represent multiple values. |
Method Summary | |
---|---|
boolean |
containsAllLiterals()
Return true if the all elements are instances of the Literal class and none of the literals are AddressLiteral instances that reference constants
or variables whose addresses are not constant. |
boolean |
containsAllZeros()
Return true if the all the elements are zero. |
boolean |
equivalent(java.lang.Object exp)
Return true if the two expressions are equivalent. |
Node |
getChild(int i)
Return the specified AST child of this node. |
int |
getCount()
Return the number of elements in the aggregation. |
void |
getDeclList(java.util.AbstractCollection<Declaration> varList)
Add all declarations referenced in this expression to the collection. |
java.lang.String |
getDisplayLabel()
Return short description of current node. |
java.lang.Object |
getElement(int i)
Return the specified element of the aggregation. |
Literal |
getElement(long index)
Return the specified element of the constant. |
Vector<java.lang.Object> |
getElementVector()
Return a vector of the elements of the aggregation. |
java.lang.String |
getGenericValue()
Get the string version of the literal using C syntax. |
int |
numChildren()
Return the number of AST children of this node. |
int |
numElements()
Return the number of elements in the aggregation. |
java.lang.String |
toStringChildren()
Convert children of this node to a string representation. |
void |
visit(Predicate p)
Process a node by calling its associated routine. |
Methods inherited from class scale.clef.expr.Literal |
---|
executionCostEstimate, findCoefficient, formatRealValue, getConstantValue, isOne, isZero, linearity |
Methods inherited from class scale.clef.expr.Expression |
---|
canonical, containsDeclaration, getCoreType, getDisplayColorHint, getDisplayShapeHint, getPointedToCore, getType, hasTrueFalseResult, isSimpleOp, setType, toStringSpecial |
Methods inherited from class scale.clef.Node |
---|
getDecl, getSourceLineNumber, setAnnotationLevel, setReportLevel, setSourceLineNumber, toString, toString |
Methods inherited from class scale.common.Root |
---|
addAnnotation, allAnnotations, allMatchingAnnotations, getAnnotation, getDisplayName, getDisplayString, getNodeCount, getNodeID, hasAnnotation, hasEqualAnnotation, hashCode, removeAnnotation, removeAnnotations, toStringAnnotations, toStringClass, trace, trace, trace |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AggregationElements(Type type, Vector<java.lang.Object> elements)
Literal
instance or a PositionOp
instance.
type
- is of no consequenceelements
- is a vector of the elements and positioning informationMethod Detail |
---|
public boolean equivalent(java.lang.Object exp)
equivalent
in class Expression
public void visit(Predicate p)
Node
Each class has a visit(Predicate p)
method. For
example, in class ABC
:
public void visit(Predicate p) { p.visitABC(this); }and the class that implements
Predicate
has a method
public void visitABC(Node n) { ABC a = (ABC) n; ... }Thus, the class that implements
Predicate
can call
n.visit(this);where
n
is a Node
sub-class without
determining which specific sub-class n
is.
The visit pattern basically avoids implementing a large
switch
statement or defining different methods
in each class for some purpose.
visit
in class Literal
Predicate
public final java.lang.Object getElement(int i)
public final Vector<java.lang.Object> getElementVector()
public int numElements()
public int getCount()
getCount
in class Literal
public Literal getElement(long index) throws InvalidException
getElement
in class Literal
InvalidException
public final boolean containsAllZeros()
public boolean containsAllLiterals()
Literal
class and none of the literals are AddressLiteral
instances that reference constants
or variables whose addresses are not constant.
public java.lang.String getGenericValue()
getGenericValue
in class Literal
public java.lang.String getDisplayLabel()
getDisplayLabel
in interface DisplayNode
getDisplayLabel
in class Literal
public Node getChild(int i)
getChild
in class Node
public int numChildren()
numChildren
in class Node
public java.lang.String toStringChildren()
toStringChildren
in class Node
public void getDeclList(java.util.AbstractCollection<Declaration> varList)
Expression
getDeclList
in class Literal
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |