Class PrimitiveReference
- java.lang.Object
-
- ru.ispras.microtesk.translator.nml.ir.primitive.PrimitiveReference
-
public final class PrimitiveReference extends java.lang.Object
ThePrimitiveReference
class describes references to the current primitive made from another primitive (parent). There may be several reference since a primitive (AND rule) can have several parameters of the same type.
-
-
Field Summary
Fields Modifier and Type Field Description java.util.Set<java.lang.String>
refNames
PrimitiveAnd
source
Primitive
target
-
Constructor Summary
Constructors Constructor Description PrimitiveReference(PrimitiveAnd source, Primitive target)
Constructs a reference made from the source (parent) primitive to the target primitive.PrimitiveReference(PrimitiveAnd source, Primitive target, java.util.Set<java.lang.String> refNames)
Additional constructor for making modified copies.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addReference(java.lang.String referenceName)
Registers a reference from the parent primitive to the current primitive.java.lang.String
getName()
Returns the name of the primitive that makes a reference to the current primitive.int
getReferenceCount()
Returns the number of references made from the parent primitive to the current primitive.java.util.Set<java.lang.String>
getReferenceNames()
Returns names of the references (parameter names) made from the parent primitive to the current primitive.PrimitiveAnd
getSource()
Returns the primitive the refers to the current primitive.Primitive
getTarget()
Returns the primitive the reference points to (current primitive).PrimitiveAnd
resolve()
Resolves the reference and returns the source primitive that has all references resolved.
-
-
-
Field Detail
-
source
public final PrimitiveAnd source
-
target
public final Primitive target
-
refNames
public final java.util.Set<java.lang.String> refNames
-
-
Constructor Detail
-
PrimitiveReference
public PrimitiveReference(PrimitiveAnd source, Primitive target)
Constructs a reference made from the source (parent) primitive to the target primitive.- Parameters:
source
- Source primitive.target
- Target primitive.
-
PrimitiveReference
public PrimitiveReference(PrimitiveAnd source, Primitive target, java.util.Set<java.lang.String> refNames)
Additional constructor for making modified copies.- Parameters:
source
- Source primitive.target
- Target primitive.refNames
- Names of references from the source to the target.
-
-
Method Detail
-
addReference
public void addReference(java.lang.String referenceName)
Registers a reference from the parent primitive to the current primitive.- Parameters:
referenceName
- Reference name (name of the argument that describes a reference).
-
getName
public java.lang.String getName()
Returns the name of the primitive that makes a reference to the current primitive.- Returns:
- Name of the primitive that makes a reference to the current primitive.
-
getSource
public PrimitiveAnd getSource()
Returns the primitive the refers to the current primitive.- Returns:
- Primitive the refers to the current primitive.
-
getTarget
public Primitive getTarget()
Returns the primitive the reference points to (current primitive).- Returns:
- Primitive the reference points to (current primitive).
-
getReferenceCount
public int getReferenceCount()
Returns the number of references made from the parent primitive to the current primitive.- Returns:
- Number of references made from the parent primitive to the current primitive.
-
getReferenceNames
public java.util.Set<java.lang.String> getReferenceNames()
Returns names of the references (parameter names) made from the parent primitive to the current primitive.- Returns:
- Set of references names (corresponding to parameter names).
-
resolve
public PrimitiveAnd resolve()
Resolves the reference and returns the source primitive that has all references resolved.To resolve a reference from source to target means to set all source arguments that can point to the target (OR rules) to the specified target.
- Returns:
- Source primitive that has all references resolved.
-
-