|
|
|
Re: re-execute rule to duplicate object generation [message #632605 is a reply to message #632595] |
Wed, 13 October 2010 14:56 |
James Sharp Messages: 20 Registered: September 2010 |
Junior Member |
|
|
Hi Dimitris,
Sorry but this doesn't seem to have worked - I had left a line commented out that I shouldn't have.
I have the line:
c.containsChannels.addAll(v.containsEntity.definesPort.equiv alent());
This should in theory call the lazy rule:
@lazy
rule OutputPort2Channel
transform port : vhdl!Port
to channel : csp!Channel {
guard : port.hasDirection.name.toLowerCase() == "out"
channel.name = port.name;
channel.definesParameters := new csp!ChannelParameterList;
only one element assigned to OutputPorts
var typeRef = new csp!TypeRef;
typeRef.containsType := GetDataType(port);
channel.definesParameters.parameterTypes.add(typeRef);
}
However it seems that the result of the equivalent() that I am using here is returning the following:
Bag {TypeRef [], TypeRef [], TypeRef [], TypeRef [], Channel [name=ready, ], Channel [name=dispense, ], Channel [name=ret, ], Channel [name=coin, ]}
This is returning the values not only from the rule specified above but also from one of the normal rules as well. How can I stop this equivalent() from running on a normal rule? Or just ensure that only the lazy rule abore is run?
Many Thanks,
James
|
|
|
Re: re-execute rule to duplicate object generation [message #632621 is a reply to message #632605] |
Wed, 13 October 2010 15:22 |
Dimitrios Kolovos Messages: 1776 Registered: July 2009 |
Senior Member |
|
|
Hi James,
I'm afraid you can't. You should either filter the results of
v.containsEntity.definesPort.equivalent() or replace the Port->Channel
rules with operations so that you get more fine-grained control.
Cheers,
Dimitris
James Sharp wrote:
> Hi Dimitris,
>
> Sorry but this doesn't seem to have worked - I had left a line commented
> out that I shouldn't have.
>
> I have the line:
>
> c.containsChannels.addAll(v.containsEntity.definesPort.equiv alent());
>
> This should in theory call the lazy rule:
> @lazy
> rule OutputPort2Channel
> transform port : vhdl!Port
> to channel : csp!Channel {
> guard : port.hasDirection.name.toLowerCase() == "out"
> channel.name = port.name;
> channel.definesParameters := new csp!ChannelParameterList;
> only one element assigned to OutputPorts
> var typeRef = new csp!TypeRef;
> typeRef.containsType := GetDataType(port);
>
> channel.definesParameters.parameterTypes.add(typeRef);
>
> }
> However it seems that the result of the equivalent() that I am using
> here is returning the following:
> Bag {TypeRef [], TypeRef [], TypeRef [], TypeRef [], Channel
> [name=ready, ], Channel [name=dispense, ], Channel [name=ret, ], Channel
> [name=coin, ]}
>
> This is returning the values not only from the rule specified above but
> also from one of the normal rules as well. How can I stop this
> equivalent() from running on a normal rule? Or just ensure that only the
> lazy rule abore is run?
>
> Many Thanks,
>
> James
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03058 seconds