mapss.dif.psdf
Class PSDFLanguageAnalysis

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.PSDFLanguageAnalysis
All Implemented Interfaces:
Analysis, Switch

public class PSDFLanguageAnalysis
extends LanguageAnalysis

This analysis extends LanguageAnalysis to read PSDF graphs.

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

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

Field Summary
 
Fields inherited from class mapss.dif.language.LanguageAnalysis
_graph, _hierarchies, _hierarchy, _subHierarchy
 
Constructor Summary
PSDFLanguageAnalysis()
           
 
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)
          Override the LanguageAnalysis._processBuiltinAttribute(java.lang.String, java.lang.Object, java.lang.Object, mapss.dif.DIFHierarchy) to process built-in attributes: production, consumption, delay, and computation.
static boolean isKeyWord(java.lang.String word)
           
 
Methods inherited from class mapss.dif.language.LanguageAnalysis
_checkKeyword, _getName, _setComputationAttribute, externalHierarchies, getHierarchy, getKeyword, inAActorBlock, inAArrayValue, inABasedonExpression, inABlankParameterExpression, inABooleanValue, inABuiltinAttributeBlock, inAClosedClosedRange, inAClosedOpenRange, inAComplexMatrixValue, inAComplexValue, inAConcatenatedStringValue, inADiscreteRange, inADiscreteRangeNumberTail, inADoubleValue, inAEdgeDefinition, inAGraphBlock, inAIdlistAttributeExpression, inAInputInterfaceExpression, inAIntegerValue, inANodeIdentifierTail, inANodePortDefinition, inANodesTopologyList, inANumericMatrixValue, inAOpenClosedRange, inAOpenOpenRange, inAOutputInterfaceExpression, inAParamsRefinementExpression, inAPlainPortDefinition, inAPortsRefinementExpression, inARangeParameterExpression, inAReferenceActorExpression, inAReferenceAttributeExpression, inARefinementDefinition, inAReflistActorExpression, inASubelementAssignAttributeExpression, inAUserDefinedAttributeBlock, 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, inABasedonBlock, 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, inATopologyBlock, 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

PSDFLanguageAnalysis

public PSDFLanguageAnalysis()
Method Detail

isKeyWord

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

_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 PSDFSpecificationGraph.

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

_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.

_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.

_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.

_processBuiltinAttribute

protected void _processBuiltinAttribute(java.lang.String id,
                                        java.lang.Object object,
                                        java.lang.Object value,
                                        DIFHierarchy hierarchy)
                                 throws DIFLanguageException
Override the LanguageAnalysis._processBuiltinAttribute(java.lang.String, java.lang.Object, java.lang.Object, mapss.dif.DIFHierarchy) to process built-in attributes: production, consumption, delay, and computation.

The value can be Integer or DIFParameter and will be converted to ptolemy.data.expr.Variable in order to set PSDFEdgeWeight. The object is an Edge in the psdf graph of hierarchy or a Port in the same level.

The value type of Production and consumption port attributes is equal to the type in edge weights.

Overrides:
_processBuiltinAttribute in class LanguageAnalysis
Parameters:
object - An Edge in the psdf graph of hierarchy or a Port in the hierarchy.
id - Name of the attribute being processed.
value - The value of this built-in attribute or the DIFParameter.
hierarchy - The DIFHierarchy contains the PSDFGraph.
Throws:
DIFLanguageException
See Also:
PSDFEdgeWeight