Class Primitive
- java.lang.Object
-
- ru.ispras.microtesk.translator.nml.ir.primitive.Primitive
-
- Direct Known Subclasses:
PrimitiveAnd
,PrimitiveOr
public class Primitive extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Primitive.Kind
static class
Primitive.Modifier
-
Constructor Summary
Constructors Constructor Description Primitive(java.lang.String name, Primitive.Kind kind, Primitive.Modifier modifier, boolean isOrRule, Type returnType, java.util.Set<java.lang.String> attrNames)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addParentReference(PrimitiveAnd parent, java.lang.String referenceName)
Registers a reference made from the parent primitive to the current primitive.java.util.Set<java.lang.String>
getAttrNames()
Returns names of the public attributes of the primitive.PrimitiveInfo
getInfo()
Primitive.Kind
getKind()
Primitive.Modifier
getModifier()
java.lang.String
getName()
int
getParentCount()
Returns the number of primitives (parents) that make references to the current primitive (have parameters of the corresponding type).int
getParentReferenceCount()
Returns the total number of references made to the current primitive from parent primitives (the total number of parameters of all parent primitives which have the corresponding type).java.util.Collection<PrimitiveReference>
getParents()
Returns the collection of primitives (parents) that make references to the current primitive (have parameters of the corresponding type).Type
getReturnType()
boolean
isOrRule()
boolean
isRoot()
Checks whether the current primitive is a root primitive.
-
-
-
Constructor Detail
-
Primitive
public Primitive(java.lang.String name, Primitive.Kind kind, Primitive.Modifier modifier, boolean isOrRule, Type returnType, java.util.Set<java.lang.String> attrNames)
-
-
Method Detail
-
addParentReference
public void addParentReference(PrimitiveAnd parent, java.lang.String referenceName)
Registers a reference made from the parent primitive to the current primitive.- Parameters:
parent
- Parent primitive.referenceName
- The name of the reference (parameter) made from the parent primitive to the current primitive.
-
getName
public final java.lang.String getName()
-
getKind
public final Primitive.Kind getKind()
-
getModifier
public final Primitive.Modifier getModifier()
-
isOrRule
public final boolean isOrRule()
-
getReturnType
public final Type getReturnType()
-
getAttrNames
public final java.util.Set<java.lang.String> getAttrNames()
Returns names of the public attributes of the primitive.- Returns:
- Public attribute names.
-
isRoot
public final boolean isRoot()
Checks whether the current primitive is a root primitive. A primitive is a root primitive if it does not have parents.- Returns:
- true if it is a root primitive or false otherwise.
-
getParents
public final java.util.Collection<PrimitiveReference> getParents()
Returns the collection of primitives (parents) that make references to the current primitive (have parameters of the corresponding type).- Returns:
- Collection of parent primitives.
-
getParentCount
public final int getParentCount()
Returns the number of primitives (parents) that make references to the current primitive (have parameters of the corresponding type).- Returns:
- Parent count.
-
getParentReferenceCount
public final int getParentReferenceCount()
Returns the total number of references made to the current primitive from parent primitives (the total number of parameters of all parent primitives which have the corresponding type).- Returns:
- Number of reference to this primitive from all its parents.
-
getInfo
public final PrimitiveInfo getInfo()
-
-