Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
moex
Transmorpher
Commits
2dae503b
Commit
2dae503b
authored
Jan 17, 2003
by
Fabien Triolet
Browse files
Javadoc and added methods for tests
parent
a5511662
Changes
4
Hide whitespace changes
Inline
Side-by-side
transmorpher/src/fr/fluxmedia/transmorpher/graph/CallImpl.java
View file @
2dae503b
/**
* $Id: CallImpl.java,v 1.
3
200
2-12-04 12:04:34
triolet Exp $
* $Id: CallImpl.java,v 1.
4
200
3-01-17 14:28:27
triolet Exp $
*
* Transmorpher
*
...
...
@@ -44,15 +44,15 @@ import fr.fluxmedia.transmorpher.action.*;
public
abstract
class
CallImpl
extends
Observable
implements
Call
{
String
id
=
null
;
Parameters
parameters
=
null
;
StringParameters
iAttributes
=
null
;
protected
String
id
=
null
;
protected
Parameters
parameters
=
null
;
protected
StringParameters
iAttributes
=
null
;
PortList
inPorts
=
null
;
PortList
outPorts
=
null
;
boolean
visited
=
false
;
boolean
nullified
=
false
;
Process
process
=
null
;
protected
PortList
inPorts
=
null
;
protected
PortList
outPorts
=
null
;
protected
boolean
visited
=
false
;
protected
boolean
nullified
=
false
;
protected
Process
process
=
null
;
public
CallImpl
(
String
n
,
String
t
,
Process
p
,
int
numIn
,
int
numOut
)
{
id
=
n
;
...
...
transmorpher/src/fr/fluxmedia/transmorpher/graph/Generate.java
View file @
2dae503b
/**
* $Id: Generate.java,v 1.
3
200
2-11-25 16:09:11
triolet Exp $
* $Id: Generate.java,v 1.
4
200
3-01-17 14:28:27
triolet Exp $
*
* Transmorpher
*
...
...
@@ -22,109 +22,193 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* Transmorpher graph generator node interface
*
* @author Jerome.Euzenat@inrialpes.fr
* @since jdk 1.3 / SAX 2.0
*/
* CAUTION, This will have to change the parameter cannot always be a file
*/
/** CAUTION, This will have to change the parameter cannot always be a file */
package
fr.fluxmedia.transmorpher.graph
;
import
fr.fluxmedia.transmorpher.engine.TProcess
;
import
fr.fluxmedia.transmorpher.engine.TProcessComposite
;
package
fr.fluxmedia.transmorpher.
graph
;
import
fr.fluxmedia.transmorpher.
utils.Writer
;
import
java.io.IOException
;
import
fr.fluxmedia.transmorpher.utils.Writer
;
import
fr.fluxmedia.transmorpher.engine.TProcessComposite
;
import
fr.fluxmedia.transmorpher.engine.TProcess
;
/**
* Transmorpher graph generator node interface
*
*@author Jerome.Euzenat@inrialpes.fr
*@since jdk 1.3 / SAX 2.0
*/
public
class
Generate
extends
CallImpl
{
public
Generate
(){
this
(
null
,
null
);
}
public
Generate
(
String
n
,
String
t
){
this
(
n
,
t
,(
String
)
null
);
}
public
Generate
(
String
n
,
String
t
,
String
file
){
this
(
n
,
t
,
null
,
0
,
file
);
}
public
Generate
(
String
n
,
String
t
,
Process
p
){
this
(
n
,
t
,
p
,
0
);
}
public
Generate
(
String
n
,
String
t
,
String
file
,
Process
p
){
this
(
n
,
t
,
p
,
0
,
file
);
}
public
Generate
(
String
n
,
String
t
,
Process
p
,
int
out
){
this
(
n
,
t
,
p
,
out
,
null
);
}
/** For compatibility with pre-1.0 Transmorpher */
public
Generate
(
String
n
,
String
t
,
Process
p
,
int
out
,
String
file
){
super
(
n
,
t
,
p
,
0
,
out
);
/** This is for legacy code */
if
(
file
!=
null
)
parameters
.
setParameter
(
"file"
,
file
);
}
/** A generate can be nullified but it will propagate to nothing */
public
void
retroNull
(
PortList
out
,
PortList
in
)
{
nullified
=
out
.
getPort
(
0
).
getChannel
().
nullifiedP
();
visited
=
true
;
update
(
null
);
}
public
void
setFile
(
String
uri
){
if
(
uri
!=
null
)
parameters
.
setParameter
(
"file"
,
uri
);
}
public
void
generateXML
(){
System
.
out
.
print
(
" <generate id=\""
+
id
+
"\" type=\""
+
getType
()+
"\""
);
System
.
out
.
print
(
" out=\""
);
outPorts
.
generateXML
();
if
(
parameters
.
isEmpty
()
){
System
.
out
.
println
(
"\"/>"
);
}
else
{
System
.
out
.
println
(
"\">"
);
parameters
.
generateXMLCalls
();
System
.
out
.
println
(
" </generate>"
);
/**
*Constructor for the Generate object
*/
public
Generate
()
{
this
(
null
,
null
);
}
/**
*Constructor for the Generate object
*
*@param n Description of the Parameter
*@param t Description of the Parameter
*/
public
Generate
(
String
n
,
String
t
)
{
this
(
n
,
t
,
(
String
)
null
);
}
/**
*Constructor for the Generate object
*
*@param n Description of the Parameter
*@param t Description of the Parameter
*@param file Description of the Parameter
*/
public
Generate
(
String
n
,
String
t
,
String
file
)
{
this
(
n
,
t
,
null
,
0
,
file
);
}
/**
*Constructor for the Generate object
*
*@param n Description of the Parameter
*@param t Description of the Parameter
*@param p Description of the Parameter
*/
public
Generate
(
String
n
,
String
t
,
Process
p
)
{
this
(
n
,
t
,
p
,
0
);
}
/**
*Constructor for the Generate object
*
*@param n Description of the Parameter
*@param t Description of the Parameter
*@param file Description of the Parameter
*@param p Description of the Parameter
*/
public
Generate
(
String
n
,
String
t
,
String
file
,
Process
p
)
{
this
(
n
,
t
,
p
,
0
,
file
);
}
}
//end generate xml
public
final
void
createProcess
(
TProcessComposite
currentProcess
){
String
[]
vPortOut
=
outPorts
().
toStringList
();
String
className
=
this
.
getProcess
().
getTransmorpher
().
getClassForType
(
getType
());
Object
[]
params
=
{(
Object
)
vPortOut
,
(
Object
)
getParameters
(),
(
Object
)
getAttributes
()};
TProcess
vCurrent
=
this
.
newProcess
(
className
,
params
);
//System.out.println(" vPortOut "+ vPortOut);
//System.out.println("[ExecutionStructure]Creation d'un TReader "+ getParameters());
// TProcess vCurrent = (TProcess)iProcessFactory.newGenerator(vPortOut,
// getAttributes().getStringParameter("type"),
// getParameters(),
// getAttributes());
currentProcess
.
addProcess
(
vCurrent
);
update
(
vCurrent
);
}
//end proc
public
void
generateJavaCode
(
Writer
file
)
throws
IOException
{
file
.
writeln
();
file
.
writeln
(
4
,
"//------------------ Generation of Generator "
+
getId
()+
" -------------------"
);
generatePorts
(
file
);
generateParameters
(
file
);
String
className
=
this
.
getProcess
().
getTransmorpher
().
getClassForType
(
getType
());
file
.
writeln
(
4
,
"tmCurrentProcess = new "
+
className
+
"(portOut,tmParameters,tmAttributes);"
);
file
.
writeln
(
4
,
"tmCurrentProcess.setName(\""
+
getId
()+
"\");"
);
file
.
writeln
(
""
);
file
.
writeln
(
4
,
"tmCurrentCompositeProcess.addProcess(tmCurrentProcess);"
);
}
//end proc
}
//end class
/**
*Constructor for the Generate object
*
*@param n Description of the Parameter
*@param t Description of the Parameter
*@param p Description of the Parameter
*@param out Description of the Parameter
*/
public
Generate
(
String
n
,
String
t
,
Process
p
,
int
out
)
{
this
(
n
,
t
,
p
,
out
,
null
);
}
/**
* For compatibility with pre-1.0 Transmorpher
*
*@param n Description of the Parameter
*@param t Description of the Parameter
*@param p Description of the Parameter
*@param out Description of the Parameter
*@param file Description of the Parameter
*/
public
Generate
(
String
n
,
String
t
,
Process
p
,
int
out
,
String
file
)
{
super
(
n
,
t
,
p
,
0
,
out
);
/**
* This is for legacy code
*/
if
(
file
!=
null
)
{
parameters
.
setParameter
(
"file"
,
file
);
}
}
/**
* A generate can be nullified but it will propagate to nothing
*
*@param out Description of the Parameter
*@param in Description of the Parameter
*/
public
void
retroNull
(
PortList
out
,
PortList
in
)
{
nullified
=
out
.
getPort
(
0
).
getChannel
().
nullifiedP
();
visited
=
true
;
update
(
null
);
}
/**
* Sets the file attribute of the Generate object
*
*@param uri The new file value
*/
public
void
setFile
(
String
uri
)
{
if
(
uri
!=
null
)
{
parameters
.
setParameter
(
"file"
,
uri
);
}
}
/**
* Gets the file attribute of the Generate object
*
*@return The file value
*/
public
String
getFile
()
{
return
(
String
)
parameters
.
getParameter
(
"file"
);
}
/**
* Description of the Method
*/
public
void
generateXML
()
{
System
.
out
.
print
(
" <generate id=\""
+
id
+
"\" type=\""
+
getType
()
+
"\""
);
System
.
out
.
print
(
" out=\""
);
outPorts
.
generateXML
();
if
(
parameters
.
isEmpty
())
{
System
.
out
.
println
(
"\"/>"
);
}
else
{
System
.
out
.
println
(
"\">"
);
parameters
.
generateXMLCalls
();
System
.
out
.
println
(
" </generate>"
);
}
}
//end generate xml
/**
* Description of the Method
*
*@param currentProcess Description of the Parameter
*/
public
final
void
createProcess
(
TProcessComposite
currentProcess
)
{
String
[]
vPortOut
=
outPorts
().
toStringList
();
String
className
=
this
.
getProcess
().
getTransmorpher
().
getClassForType
(
getType
());
Object
[]
params
=
{(
Object
)
vPortOut
,
(
Object
)
getParameters
(),
(
Object
)
getAttributes
()};
TProcess
vCurrent
=
this
.
newProcess
(
className
,
params
);
currentProcess
.
addProcess
(
vCurrent
);
update
(
vCurrent
);
}
//end proc
/**
* Description of the Method
*
*@param file Description of the Parameter
*@exception IOException Description of the Exception
*/
public
void
generateJavaCode
(
Writer
file
)
throws
IOException
{
file
.
writeln
();
file
.
writeln
(
4
,
"//------------------ Generation of Generator "
+
getId
()
+
" -------------------"
);
generatePorts
(
file
);
generateParameters
(
file
);
String
className
=
this
.
getProcess
().
getTransmorpher
().
getClassForType
(
getType
());
file
.
writeln
(
4
,
"tmCurrentProcess = new "
+
className
+
"(portOut,tmParameters,tmAttributes);"
);
file
.
writeln
(
4
,
"tmCurrentProcess.setName(\""
+
getId
()
+
"\");"
);
file
.
writeln
(
""
);
file
.
writeln
(
4
,
"tmCurrentCompositeProcess.addProcess(tmCurrentProcess);"
);
}
//end proc
}
transmorpher/src/fr/fluxmedia/transmorpher/graph/Port.java
View file @
2dae503b
/**
* $Id: Port.java,v 1.
1
200
2-11-06
14:
0
8:2
1 serge
Exp $
* $Id: Port.java,v 1.
2
200
3-01-17
14:
2
8:2
7 triolet
Exp $
*
* Transmorpher
*
...
...
@@ -22,106 +22,229 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* Transmorpher graph list of ports/channels
*
* @author Jerome.Euzenat@inrialpes.fr
* @since jdk 1.3 / SAX 2.0
*/
package
fr.fluxmedia.transmorpher.graph
;
package
fr.fluxmedia.transmorpher.graph
;
import
java.io.Serializable
;
public
class
Port
implements
Serializable
{
public
static
int
OUTPUT
=
0
;
public
static
int
INPUT
=
1
;
Channel
chan
=
null
;
Transformation
tOwner
=
null
;
Call
cOwner
=
null
;
int
number
=
0
;
String
name
=
null
;
int
type
;
public
Port
(){
}
/** Port creator for transformations */
public
Port
(
String
n
,
Transformation
t
,
int
i
){
name
=
n
;
number
=
i
;
tOwner
=
t
;
}
/** Port creator for transformations */
public
Port
(
String
n
,
Transformation
t
,
int
i
,
int
type
){
name
=
n
;
number
=
i
;
tOwner
=
t
;
this
.
type
=
type
;
}
/** Port creator for calls */
public
Port
(
String
n
,
Call
c
,
int
i
){
name
=
n
;
number
=
i
;
cOwner
=
c
;
}
public
Port
(
String
n
,
Call
c
,
int
i
,
int
type
){
name
=
n
;
number
=
i
;
cOwner
=
c
;
this
.
type
=
type
;
}
public
void
setChannel
(
Channel
c
){
chan
=
c
;
if
(
c
!=
null
)
name
=
c
.
getName
();
else
name
=
""
;
}
public
Channel
getChannel
(){
return
chan
;
}
public
void
setName
(
String
newName
){
name
=
newName
;
}
public
String
getName
(){
return
name
;
}
public
int
getType
(){
return
type
;
}
public
boolean
TransformationPortP
(){
return
(
tOwner
!=
null
)
;
}
public
boolean
CallPortP
(){
return
(
cOwner
!=
null
);
}
public
Transformation
getTransformation
(){
return
tOwner
;
}
public
Call
getCall
(){
return
cOwner
;
}
}
//end class
/**
* Transmorpher graph list of ports/channels
*
*@author Jerome.Euzenat@inrialpes.fr
*@since jdk 1.3 / SAX 2.0
*/
public
class
Port
implements
Serializable
{
/**
* Description of the Field
*/
public
static
int
OUTPUT
=
0
;
/**
* Description of the Field
*/
public
static
int
INPUT
=
1
;
/**
* Description of the Field
*/
protected
Channel
channel
=
null
;
/**
* Description of the Field
*/
protected
Transformation
tOwner
=
null
;
/**
* Description of the Field
*/
protected
Call
cOwner
=
null
;
/**
* Description of the Field
*/
protected
int
number
=
0
;
/**
* Description of the Field
*/
protected
String
name
=
null
;
/**
* Description of the Field
*/
protected
int
type
;
/**
*Constructor for the Port object
*/
public
Port
()
{
}
/**
* Port creator for transformations
*
*@param n Description of the Parameter
*@param t Description of the Parameter
*@param i Description of the Parameter
*/
public
Port
(
String
n
,
Transformation
t
,
int
i
)
{
name
=
n
;
number
=
i
;
tOwner
=
t
;
}
/**
* Port creator for transformations
*
*@param n Description of the Parameter
*@param t Description of the Parameter
*@param i Description of the Parameter
*@param type Description of the Parameter
*/
public
Port
(
String
n
,
Transformation
t
,
int
i
,
int
type
)
{
name
=
n
;
number
=
i
;
tOwner
=
t
;
this
.
type
=
type
;
}
/**
* Port creator for calls
*
*@param n Description of the Parameter
*@param c Description of the Parameter
*@param i Description of the Parameter
*/
public
Port
(
String
n
,
Call
c
,
int
i
)
{
name
=
n
;
number
=
i
;
cOwner
=
c
;
}
/**
*Constructor for the Port object
*
*@param n Description of the Parameter
*@param c Description of the Parameter
*@param i Description of the Parameter
*@param type Description of the Parameter
*/
public
Port
(
String
n
,
Call
c
,
int
i
,
int
type
)
{
name
=
n
;
number
=
i
;
cOwner
=
c
;
this
.
type
=
type
;
}
/**
* Sets the channel attribute of the Port object
*
*@param c The new channel value
*/
public
void
setChannel
(
Channel
c
)
{
channel
=
c
;
if
(
c
!=
null
)
{
name
=
c
.
getName
();
}
else
{
name
=
""
;
}
}
/**
* Gets the channel attribute of the Port object
*
*@return The channel value
*/
public
Channel
getChannel
()
{
return
channel
;
}
/**
* Sets the name attribute of the Port object
*
*@param newName The new name value
*/
public
void
setName
(
String
newName
)
{
name
=
newName
;
}
/**
* Gets the name attribute of the Port object
*
*@return The name value
*/
public
String
getName
()
{
return
name
;
}
/**
* Gets the type attribute of the Port object
*
*@return The type value
*/
public
int
getType
()
{
return
type
;
}
/**
* Sets the type attribute of the Port object
*