mapss.dif.psdf
Class PSDFSpecificationLanguageAnalysis

java.lang.Object
  extended by mapss.dif.language.sablecc.analysis.AnalysisAdapter
      extended by mapss.dif.language.sablecc.analysis.DepthFirstAdapter
          extended by mapss.dif.language.LanguageAnalysis
              extended by mapss.dif.psdf.PSDFSpecificationLanguageAnalysis
All Implemented Interfaces:
Analysis, Switch

public class PSDFSpecificationLanguageAnalysis
extends LanguageAnalysis

This analysis extends LanguageAnalysis to read PSDF Specifications.

The graph type keyword used in the dif file should be "psdfSpecificaiton" and runtime type of the returned graph will an PSDFSpecificationGraph.

Version:
$Id: PSDFSpecificationLanguageAnalysis.java 409 2007-05-13 19:47:16Z plishker $
Author:
Chia-Jui Hsu
See Also:
LanguageAnalysis, PSDFSpecificationGraph, PSDFSpecification

Field Summary
 
Fields inherited from class mapss.dif.language.LanguageAnalysis
_graph, _hierarchies, _hierarchy, _subHierarchy
 
Constructor Summary
PSDFSpecificationLanguageAnalysis()
           
 
Method Summary
protected  boolean _acceptableSubHierarchy(DIFHierarchy hierarchy)
          Returns true if a hierarchy can be a sub-hierarchy of the current one.
protected  mocgraph.Edge _getEmptyEdge(mocgraph.Node source, mocgraph.Node sink)
          Should return an empty edge that can be used in the graph that is constructed.
protected  DIFGraph _getEmptyGraph()
          Should return an empty graph of the type that is going to be constructed with this analysis.
protected  mocgraph.Node _getEmptyNode()
          Should return an empty node that can be used in the graph that is constructed.
protected  java.lang.String _getKeyword()
          Should return the DIF keyword associated with this analysis type.
protected  void _processBuiltinAttribute(java.lang.String id, java.lang.Object object, java.lang.Object value, DIFHierarchy hierarchy)
          Process the built-in attribute "paramsMatch".
 void inAActorBlock(AActorBlock parseNode)
          For each node representing an actor of design tool's library, an actor block is necessary to specify the attributes of that actor.
 void inABasedonBlock(ABasedonBlock parseNode)
           
 void inAGraphBlock(AGraphBlock parseNode)
          Parse a graph definition: dataflow model and graph name.
 void inARefinementDefinition(ARefinementDefinition parseNode)
          For each supernode-to-subgraph mapping, it is necessary to specify a refinement block.
 void inATopologyBlock(ATopologyBlock parseNode)
          init, subinit, body nodes will be added to the PSDFGraph of PSDFSpecificaiton automatically when defining the PSDFSpecification.
 void inAUserDefinedAttributeBlock(AUserDefinedAttributeBlock parseNode)
           
static boolean isKeyWord(java.lang.String word)
           
 
Methods inherited from class mapss.dif.language.LanguageAnalysis
_checkKeyword, _getName, _setComputationAttribute, externalHierarchies, getHierarchy, getKeyword, inAArrayValue, inABasedonExpression, inABlankParameterExpression, inABooleanValue, inABuiltinAttributeBlock, inAClosedClosedRange, inAClosedOpenRange, inAComplexMatrixValue, inAComplexValue, inAConcatenatedStringValue, inADiscreteRange, inADiscreteRangeNumberTail, inADoubleValue, inAEdgeDefinition, inAIdlistAttributeExpression, inAInputInterfaceExpression, inAIntegerValue, inANodeIdentifierTail, inANodePortDefinition, inANodesTopologyList, inANumericMatrixValue, inAOpenClosedRange, inAOpenOpenRange, inAOutputInterfaceExpression, inAParamsRefinementExpression, inAPlainPortDefinition, inAPortsRefinementExpression, inARangeParameterExpression, inAReferenceActorExpression, inAReferenceAttributeExpression, inAReflistActorExpression, inASubelementAssignAttributeExpression, outAArrayValue, outARangeParameterExpression, outAValueActorExpression, outAValueAttributeExpression, outAValueParameterExpression
 
Methods inherited from class mapss.dif.language.sablecc.analysis.DepthFirstAdapter
caseAActorBlock, caseAActorBody, caseAArrayValue, caseAAttrDataType, caseAAttributeBody, caseAAttrType, caseABasedonBlock, caseABasedonBody, caseABasedonExpression, caseABlankParameterExpression, caseABooleanValue, caseABuiltinAttributeBlock, caseAClosedClosedRange, caseAClosedOpenRange, caseAComplex, caseAComplexMatrixValue, caseAComplexRow, caseAComplexRowTail, caseAComplexTail, caseAComplexValue, caseAConcatenatedStringValue, caseADataType, caseADiscreteRange, caseADiscreteRangeNumberTail, caseADoubleNumber, caseADoubleValue, caseAEdgeDefinition, caseAEdgeDefinitionTail, caseAEdgesTopologyList, caseAFalseBooleanValue, caseAGraphBlock, caseAGraphList, caseAIdentifierName, caseAIdList, caseAIdlistAttributeExpression, caseAInputInterfaceExpression, caseAIntegerNumber, caseAIntegerValue, caseAInterfaceBlock, caseAInterfaceBody, caseANodeIdentifierTail, caseANodePortDefinition, caseANodesTopologyList, caseANumericMatrixValue, caseANumericRow, caseANumericRowTail, caseANumericTail, caseAOpenClosedRange, caseAOpenOpenRange, caseAOutputInterfaceExpression, caseAParameterBlock, caseAParameterBody, caseAParamsRefinementExpression, caseAParamType, caseAPlainPortDefinition, caseAPortDefinitionTail, caseAPortsRefinementExpression, caseARangeBlock, caseARangeParameterExpression, caseARangeTail, caseAReferenceActorExpression, caseAReferenceAttributeExpression, caseARefIdTail, caseARefinementBlock, caseARefinementBody, caseARefinementDefinition, caseAReflistActorExpression, caseAStringIdentifierName, caseAStringValue, caseASubelementAssignAttributeExpression, caseATopologyBlock, caseATopologyBody, caseATrueBooleanValue, caseAUserDefinedAttributeBlock, caseAValueActorExpression, caseAValueAttributeExpression, caseAValueParameterExpression, caseAValueTail, caseStart, defaultIn, defaultOut, inAActorBody, inAAttrDataType, inAAttributeBody, inAAttrType, inABasedonBody, inAComplex, inAComplexRow, inAComplexRowTail, inAComplexTail, inADataType, inADoubleNumber, inAEdgeDefinitionTail, inAEdgesTopologyList, inAFalseBooleanValue, inAGraphList, inAIdentifierName, inAIdList, inAIntegerNumber, inAInterfaceBlock, inAInterfaceBody, inANumericRow, inANumericRowTail, inANumericTail, inAParameterBlock, inAParameterBody, inAParamType, inAPortDefinitionTail, inARangeBlock, inARangeTail, inARefIdTail, inARefinementBlock, inARefinementBody, inAStringIdentifierName, inAStringValue, inATopologyBody, inATrueBooleanValue, inAValueActorExpression, inAValueAttributeExpression, inAValueParameterExpression, inAValueTail, inStart, outAActorBlock, outAActorBody, outAAttrDataType, outAAttributeBody, outAAttrType, outABasedonBlock, outABasedonBody, outABasedonExpression, outABlankParameterExpression, outABooleanValue, outABuiltinAttributeBlock, outAClosedClosedRange, outAClosedOpenRange, outAComplex, outAComplexMatrixValue, outAComplexRow, outAComplexRowTail, outAComplexTail, outAComplexValue, outAConcatenatedStringValue, outADataType, outADiscreteRange, outADiscreteRangeNumberTail, outADoubleNumber, outADoubleValue, outAEdgeDefinition, outAEdgeDefinitionTail, outAEdgesTopologyList, outAFalseBooleanValue, outAGraphBlock, outAGraphList, outAIdentifierName, outAIdList, outAIdlistAttributeExpression, outAInputInterfaceExpression, outAIntegerNumber, outAIntegerValue, outAInterfaceBlock, outAInterfaceBody, outANodeIdentifierTail, outANodePortDefinition, outANodesTopologyList, outANumericMatrixValue, outANumericRow, outANumericRowTail, outANumericTail, outAOpenClosedRange, outAOpenOpenRange, outAOutputInterfaceExpression, outAParameterBlock, outAParameterBody, outAParamsRefinementExpression, outAParamType, outAPlainPortDefinition, outAPortDefinitionTail, outAPortsRefinementExpression, outARangeBlock, outARangeTail, outAReferenceActorExpression, outAReferenceAttributeExpression, outARefIdTail, outARefinementBlock, outARefinementBody, outARefinementDefinition, outAReflistActorExpression, outAStringIdentifierName, outAStringValue, outASubelementAssignAttributeExpression, outATopologyBlock, outATopologyBody, outATrueBooleanValue, outAUserDefinedAttributeBlock, outAValueTail, outStart
 
Methods inherited from class mapss.dif.language.sablecc.analysis.AnalysisAdapter
caseEOF, caseTActor, caseTAttribute, caseTBasedon, caseTBlank, caseTColon, caseTComma, caseTComment, caseTDot, caseTDouble, caseTEdges, caseTEqual, caseTFalse, caseTGraph, caseTIdentifier, caseTInputs, caseTInteger, caseTInterface, caseTLBkt, caseTLPar, caseTLSqr, caseTNodes, caseTOutputs, caseTParameter, caseTPlus, caseTRBkt, caseTRefinement, caseTRPar, caseTRSqr, caseTSemicolon, caseTSQte, caseTString, caseTStringIdentifier, caseTStringTail, caseTTopology, caseTTrue, defaultCase, getIn, getOut, setIn, setOut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PSDFSpecificationLanguageAnalysis

public PSDFSpecificationLanguageAnalysis()
Method Detail

isKeyWord

public static boolean isKeyWord(java.lang.String word)

inAGraphBlock

public void inAGraphBlock(AGraphBlock parseNode)
Description copied from class: LanguageAnalysis
Parse a graph definition: dataflow model and graph name. The Reader pre-scans all related dif files and input all hierarchies by LanguageAnalysis.externalHierarchies(java.util.Collection). Therefore, this method do not have to put _hierarchy into _hierarchies. According to the previous compiled DIFHierarchies, _hierarchies, we check that the current graph (hierarchy) use the predefined name or not. The name of DIFGraph and DIFHierarchy is set to the same as parseNode.getName().getText().

Overrides:
inAGraphBlock in class LanguageAnalysis

inABasedonBlock

public void inABasedonBlock(ABasedonBlock parseNode)
Overrides:
inABasedonBlock in class DepthFirstAdapter

inATopologyBlock

public void inATopologyBlock(ATopologyBlock parseNode)
init, subinit, body nodes will be added to the PSDFGraph of PSDFSpecificaiton automatically when defining the PSDFSpecification.

Overrides:
inATopologyBlock in class DepthFirstAdapter

inAUserDefinedAttributeBlock

public void inAUserDefinedAttributeBlock(AUserDefinedAttributeBlock parseNode)
Overrides:
inAUserDefinedAttributeBlock in class LanguageAnalysis

inAActorBlock

public void inAActorBlock(AActorBlock parseNode)
Description copied from class: LanguageAnalysis
For each node representing an actor of design tool's library, an actor block is necessary to specify the attributes of that actor.

An attribute of an actor can specify the parameter value of that actor. In this case, the attribute id is the parameter id and the attribute value is the parameter value.

An attribute can also specify the connection of the node (actor). In this case, the attribute id is the port id or argument id and the attribute value is the connected object's id.

All actor attributes and their value are stored as node attributes in DIF.

Overrides:
inAActorBlock in class LanguageAnalysis

inARefinementDefinition

public void inARefinementDefinition(ARefinementDefinition parseNode)
Description copied from class: LanguageAnalysis
For each supernode-to-subgraph mapping, it is necessary to specify a refinement block. The subhierarchy (subgraph) instance will be directed refered by superhierarchy (supergraph) instead of mirroring.

Overrides:
inARefinementDefinition in class LanguageAnalysis

_acceptableSubHierarchy

protected boolean _acceptableSubHierarchy(DIFHierarchy hierarchy)
Returns true if a hierarchy can be a sub-hierarchy of the current one. Type compatibility of underlying graphs should be checked. This implementation returns true if the type of this graph is the same as the underlying graph class or the underlying graph class is an instance of PSDFGraph.

Overrides:
_acceptableSubHierarchy in class LanguageAnalysis
Parameters:
hierarchy - Sub hierarchy to add.
Returns:
True if underlying graphs are compatible.

_getKeyword

protected java.lang.String _getKeyword()
Description copied from class: LanguageAnalysis
Should return the DIF keyword associated with this analysis type. For this implementation it returns "dif".

Overrides:
_getKeyword in class LanguageAnalysis
Returns:
Analysis keyword which is "dif" for this implementation.

_getEmptyGraph

protected DIFGraph _getEmptyGraph()
Description copied from class: LanguageAnalysis
Should return an empty graph of the type that is going to be constructed with this analysis. For this implementation returns a graph with runtime type of DIFGraph.

Overrides:
_getEmptyGraph in class LanguageAnalysis
Returns:
An instance of DIFGraph.

_getEmptyNode

protected mocgraph.Node _getEmptyNode()
Description copied from class: LanguageAnalysis
Should return an empty node that can be used in the graph that is constructed. In this implementation a node with an empty DIFNodeWeight is returned.

Overrides:
_getEmptyNode in class LanguageAnalysis
Returns:
A new node.

_getEmptyEdge

protected mocgraph.Edge _getEmptyEdge(mocgraph.Node source,
                                      mocgraph.Node sink)
Description copied from class: LanguageAnalysis
Should return an empty edge that can be used in the graph that is constructed. Source and the sink nodes of the edge should be as given in the parameters. In this implementation an edge with an empty DIFEdgeWeight is returned.

Overrides:
_getEmptyEdge in class LanguageAnalysis
Parameters:
source - Source node for the edge.
sink - Sink node for the edge.
Returns:
An edge.

_processBuiltinAttribute

protected void _processBuiltinAttribute(java.lang.String id,
                                        java.lang.Object object,
                                        java.lang.Object value,
                                        DIFHierarchy hierarchy)
                                 throws DIFLanguageException
Process the built-in attribute "paramsMatch". The dif syntax for paramsMatch is as follows:
  paramsMatch {
          subgraphId.subParamId = subgraphId.subPortId;
  }

Overrides:
_processBuiltinAttribute in class LanguageAnalysis
Parameters:
id - The attribute id.
object - The target object.
value - The source object.
hierarchy - The DIFSpecification.
Throws:
DIFLanguageException