Math2mat
Public Member Functions | Static Public Member Functions | Static Public Attributes

m2m.backend.structure.StructTreatment Class Reference

Inheritance diagram for m2m.backend.structure.StructTreatment:
Inheritance graph
[legend]
Collaboration diagram for m2m.backend.structure.StructTreatment:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 StructTreatment ()
StructTreatment copy ()
void modifyNumType (NumType type)
long getParseTime ()
void setTop (Function top)
Function getTop ()
Vector< ElementgetInput ()
Vector< ElementgetOutput ()
String getName ()
void parse (File file) throws ParsingException
void parseNoFlat (File file) throws ParsingException
String getSourceMd5 ()
String getSourceCode ()
void parse (String code) throws ParsingException
Vector< ElementcreateOp (Vector< Element > a, Vector< Element > b, Operation op)
Vector< ElementcreateNot (Vector< Element > a, Not not)
int getNextOpCpt ()
void treeToVector ()
void treeToVector (Function parent)
Vector< ElementcreateAff (Variable var, Vector< Element > expr)
SimpleVariable createInOut (String name)
Vector< ElementcreateVar (String name, ArrayList< Double > val, String type, int size, boolean minus)
Vector< ElementcreateSimpleVar (SimpleVariable var)
Vector< ElementcreateVar (Variable var)
Vector< ElementcreateVar (String name, double val, String type, boolean minus)
Vector< ElementcreateVar (String name)
void count (Element el)
void createInOutAff (Function top, HashMap< String, ReadWriteIndex > map)
void addPragma (String pragma)
void addPragma (String name, String type)
void changeVar (Element top, Variable varin, Variable varout)
void findInBody (Element top, HashMap< String, ReadWriteIndex > cpt)
boolean isVariable (String name)
Vector< VariablemonitoredVar ()
void setBlock (Element top, String opName, BuildingBlock block)
boolean writeVHDL (String vhdlPath)
void print ()
boolean writeSchematic (String outFile)
void writeOctaveFile ()
boolean writeOctaveFile (String outFile)
void clean (Vector< Element > body, Vector< Element > varVector)
void updateConditionsFor (HashMap< String, ReadWriteIndex > tmpVar, HashMap< String, ReadWriteIndex > cptVar, LoopFor loopFor)
void updateConditionsWhile (HashMap< String, ReadWriteIndex > tmpVar, HashMap< String, ReadWriteIndex > cptVar, LoopWhile loopWhile)
boolean getMonitor ()
void modifyMonitor (boolean monitor)
boolean isEmpty ()
boolean fromXml (org.w3c.dom.Element el)
String getXmlTagName ()
org.w3c.dom.Element toXml (Document dom)
Vector< ElementpostParse (Function function)
Vector< ElementpostParse (Vector< Element > vector)

Static Public Member Functions

static String getTrueName (String name)

Static Public Attributes

static final String TMP_NAME = "m2mtmp"

Detailed Description

Contains all the treatments make on the structure

Author:
Trolliet Gregory
gregory.trolliet@hesge.ch
Version:
0.1

Definition at line 44 of file StructTreatment.java.


Constructor & Destructor Documentation

m2m.backend.structure.StructTreatment.StructTreatment ( )

Constructor

Definition at line 96 of file StructTreatment.java.


Member Function Documentation

void m2m.backend.structure.StructTreatment.addPragma ( String  pragma)

Add a pragma and modify all the occurences that correspond to the pragma. It must be like : "%m2m name:type"

Parameters:
pragmaPragma

Definition at line 713 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.addPragma ( String  name,
String  type 
)

Add a pragma and modify all the occurences that correspond to the pragma. It must be a name and a type.

Parameters:
nameName
typeType

Definition at line 736 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.changeVar ( Element  top,
Variable  varin,
Variable  varout 
)

Switch a variable by another in the structure. Change each instance.

Parameters:
topStructure root
varinVariable to remplace
varoutNew variable

Definition at line 796 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.clean ( Vector< Element body,
Vector< Element varVector 
)

Clean the structure by deleting all unused variable

Definition at line 1044 of file StructTreatment.java.

StructTreatment m2m.backend.structure.StructTreatment.copy ( )

Copy entirely the structure.

Returns:
The new structure.

Definition at line 112 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.count ( Element  el)

Add a counter to the name of the Element

Parameters:
elElement

Definition at line 657 of file StructTreatment.java.

Vector<Element> m2m.backend.structure.StructTreatment.createAff ( Variable  var,
Vector< Element expr 
)

Create an assignment

Parameters:
varSimpleVariable, target of assignment
exprOperation list, the last element is to affect
Returns:
New operation list

Definition at line 469 of file StructTreatment.java.

SimpleVariable m2m.backend.structure.StructTreatment.createInOut ( String  name)

Create an in or out variable

Parameters:
nameName of the variable
Returns:
New variable

Definition at line 508 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.createInOutAff ( Function  top,
HashMap< String, ReadWriteIndex >  map 
)

Create the final affectation for each in/out variables All input variables need to be affect to the first use of the variable: a_m2m_0 = a All output variables need to be affect to the last usw of the variable: s = s_m2m_17

Parameters:
mapListe of the variables

Definition at line 669 of file StructTreatment.java.

Vector<Element> m2m.backend.structure.StructTreatment.createNot ( Vector< Element a,
Not  not 
)

Create a "not" operation

Parameters:
aPrecedent operation list
notOperation "not"
Returns:
New operation list

Definition at line 349 of file StructTreatment.java.

Vector<Element> m2m.backend.structure.StructTreatment.createOp ( Vector< Element a,
Vector< Element b,
Operation  op 
)

Create operation and temporary variables if necessary

Parameters:
aFirst operation list
bSecond operation list
opOperation
Returns:
New operation list

Definition at line 309 of file StructTreatment.java.

Vector<Element> m2m.backend.structure.StructTreatment.createSimpleVar ( SimpleVariable  var)

Call the complete methode createVar, use an existing variable

Parameters:
varSimpleVariable
Returns:
New variable

Definition at line 607 of file StructTreatment.java.

Vector<Element> m2m.backend.structure.StructTreatment.createVar ( String  name,
ArrayList< Double >  val,
String  type,
int  size,
boolean  minus 
)

Create a variable. Check if existing, if yes juste return the adresse. If the variable is negative, check if the negation is already do, and if not create it. Crée une variable, vérifie si elle existe déjà et récupère l'objet dans ce cas, sinon en crée une nouvelle. Si la variable est négative elle vérifie si la négation est déjà créé, si non elle la crée.

Parameters:
nameName
valValue
typeType
minusNegative (true if the variable is negative)
Returns:
New variable

Definition at line 535 of file StructTreatment.java.

Vector<Element> m2m.backend.structure.StructTreatment.createVar ( String  name,
double  val,
String  type,
boolean  minus 
)

Create the variable with the parameters

Parameters:
nameName
valValue
typeType
minusNegative (true if the variable is negative)
Returns:
New variable into a Vector

Definition at line 635 of file StructTreatment.java.

Vector<Element> m2m.backend.structure.StructTreatment.createVar ( Variable  var)

Check if the variable is an instance of VectorVariable or SimpleVariable and call the methode.

Parameters:
varVariable
Returns:
New variable.

Definition at line 617 of file StructTreatment.java.

Vector<Element> m2m.backend.structure.StructTreatment.createVar ( String  name)

Create the variable with the parameters

Parameters:
nameName
Returns:
New variable into a Vector

Definition at line 647 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.findInBody ( Element  top,
HashMap< String, ReadWriteIndex >  cpt 
)

Definition at line 828 of file StructTreatment.java.

boolean m2m.backend.structure.StructTreatment.fromXml ( org.w3c.dom.Element  el)

Definition at line 1289 of file StructTreatment.java.

Vector<Element> m2m.backend.structure.StructTreatment.getInput ( )

Getter of the input for internal structure

Returns:
Input list

Definition at line 158 of file StructTreatment.java.

boolean m2m.backend.structure.StructTreatment.getMonitor ( )

Indicates if at least an element is monitored

Returns:
the monitor attribute of the structure

Definition at line 1265 of file StructTreatment.java.

String m2m.backend.structure.StructTreatment.getName ( )

Getter of the name of the function

Returns:
Name

Definition at line 174 of file StructTreatment.java.

int m2m.backend.structure.StructTreatment.getNextOpCpt ( )

Operation counter

Returns:
next value for the counter

Definition at line 367 of file StructTreatment.java.

Vector<Element> m2m.backend.structure.StructTreatment.getOutput ( )

Getter of the output for internal structure

Returns:
Input list

Definition at line 166 of file StructTreatment.java.

long m2m.backend.structure.StructTreatment.getParseTime ( )

Returns the time of the last parsing. This can be the parsing of a file or of an internal buffer.

Returns:
Time of the last parsing.

Definition at line 134 of file StructTreatment.java.

String m2m.backend.structure.StructTreatment.getSourceCode ( )

Definition at line 264 of file StructTreatment.java.

String m2m.backend.structure.StructTreatment.getSourceMd5 ( )

Definition at line 260 of file StructTreatment.java.

Function m2m.backend.structure.StructTreatment.getTop ( )

Getter of the internal structure root

Returns:
Internal structure root

Definition at line 150 of file StructTreatment.java.

static String m2m.backend.structure.StructTreatment.getTrueName ( String  name) [static]

Remove the m2m extension to the name a_m2m_2 -> a

Parameters:
nameName to analyse
Returns:
Name without m2m extension

Definition at line 585 of file StructTreatment.java.

String m2m.backend.structure.StructTreatment.getXmlTagName ( )

Definition at line 1314 of file StructTreatment.java.

boolean m2m.backend.structure.StructTreatment.isEmpty ( )

Definition at line 1281 of file StructTreatment.java.

boolean m2m.backend.structure.StructTreatment.isVariable ( String  name)

Check if the name is a already declared variable

Parameters:
nameName of the variable
Returns:
True if name is a variable

Definition at line 871 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.modifyMonitor ( boolean  monitor)

Set the monitor attribute of the structure.

Parameters:
monitorThe value to the monitor attribute to set

Definition at line 1274 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.modifyNumType ( NumType  type)

Definition at line 125 of file StructTreatment.java.

Vector<Variable> m2m.backend.structure.StructTreatment.monitoredVar ( )

Return the list of all monitored variables.

Returns:
List of the variables

Definition at line 884 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.parse ( File  file) throws ParsingException

Run the parsing of the octave file

Parameters:
fileOctave file
Exceptions:
ParsingExceptionWhen parser can't parse the input file

Definition at line 183 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.parse ( String  code) throws ParsingException

Run the parsing of the octave file

Parameters:
fileText of the octave file
Exceptions:
ParsingExceptionWhen parser can't parse the input file

Definition at line 273 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.parseNoFlat ( File  file) throws ParsingException

Run the parsing of the octave file

Parameters:
fileOctave file
Exceptions:
ParsingExceptionWhen parser can't parse the input file

Definition at line 223 of file StructTreatment.java.

Vector<Element> m2m.backend.structure.StructTreatment.postParse ( Vector< Element vector)

Post parse a vector of elements.

Parameters:
vector
Returns:

Definition at line 1383 of file StructTreatment.java.

Vector<Element> m2m.backend.structure.StructTreatment.postParse ( Function  function)

Post parse a function.

Parameters:
function

Definition at line 1353 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.print ( )

Print the internal structure

Definition at line 952 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.setBlock ( Element  top,
String  opName,
BuildingBlock  block 
)

Set the material block who define the classe of element

Parameters:
topRoot of the structure
opNameName of the operation to change the material block
blockMaterial block

Definition at line 900 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.setTop ( Function  top)

Setter of the internal structure root

Parameters:
topInternal structure root

Definition at line 142 of file StructTreatment.java.

org.w3c.dom.Element m2m.backend.structure.StructTreatment.toXml ( Document  dom)

Definition at line 1318 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.treeToVector ( )

Convert the tree structure of the operation in a chain of simple operations : s=a+b+c -- c -- c -- + -- tmp -- + -- s -- + -- -- b ==> -- b -- a -- tmp s -- + -- -- a

Definition at line 382 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.treeToVector ( Function  parent)

Convert the top Element from a tree structure to a chain of operations.

Parameters:
topRoot of the structure to convert

Definition at line 390 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.updateConditionsFor ( HashMap< String, ReadWriteIndex >  tmpVar,
HashMap< String, ReadWriteIndex >  cptVar,
LoopFor  loopFor 
)

Update condition simple varables for a "loopFor".

Parameters:
tmpVarthe temporary compter variable of the structure before the "loopFor"
cptVarthe compter variable of the structure
loopForthe loopFor to update condition

Definition at line 1105 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.updateConditionsWhile ( HashMap< String, ReadWriteIndex >  tmpVar,
HashMap< String, ReadWriteIndex >  cptVar,
LoopWhile  loopWhile 
)

Update condition simple varables for a "loopWhile".

Parameters:
tmpVarthe temporary compter variable of the structure before the "loopWhile"
cptVarthe compter variable of the structure
loopForthe loopFor to update condition

Definition at line 1125 of file StructTreatment.java.

boolean m2m.backend.structure.StructTreatment.writeOctaveFile ( String  outFile)

Write the octave code to a file

Parameters:
outFileName of the output file, if empty the file will be named "test/name_of_the_function.m"

Definition at line 1005 of file StructTreatment.java.

void m2m.backend.structure.StructTreatment.writeOctaveFile ( )

Write the structure into an octave file

Definition at line 997 of file StructTreatment.java.

boolean m2m.backend.structure.StructTreatment.writeSchematic ( String  outFile)

Write the schematic file. Use graphviz to generate the schematic. dot -Tpdf outfile -o schematic.pdf

Parameters:
outFileName of the file
blockListTrue if you want have blocs for the Vector

Definition at line 962 of file StructTreatment.java.

boolean m2m.backend.structure.StructTreatment.writeVHDL ( String  vhdlPath)

Write the internal structure to a VHDL file

Parameters:
outFileFile name
Exceptions:
IOException
VHDLException

Definition at line 918 of file StructTreatment.java.


Member Data Documentation

final String m2m.backend.structure.StructTreatment.TMP_NAME = "m2mtmp" [static]

Use to reprensent temporary simple variable

Definition at line 73 of file StructTreatment.java.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations