[kepler-users] get list of connected ports
Ufuk Utku Turuncoglu
turuncu at ucar.edu
Wed Apr 29 08:14:53 PDT 2009
I try to write the number of ports but all off them returns zero.
IOPort pp = (IOPort) port;
System.out.println(pp.deepConnectedInPortList().size());
System.out.println(pp.deepConnectedOutPortList().size());
System.out.println(pp.deepConnectedPortList().size());
Any idea? BTW, i will run this code in connectionsChanged method. I also
found that if i add an actor between composite actor output and actor
output port the code works without problem.
--ufuk
Edward A. Lee wrote:
>
> Maybe you want to use deepConnectedOutPortList() and
> deepConnectedInPortList()? Note that these won't cross opaque
> composite actor boundaries...
>
> Edward
>
>
> Ufuk Utku Turuncoglu wrote:
>> Hi,
>>
>> I want to get connected port list and connected actor names. My case
>> is follows,
>>
>> actor A has port Ap1 and this port connect to another actor (B) and
>> its port Bp1. In this case, i can get actor B name from actor A using
>> following code,
>>
>> In actor A:
>>
>> int i = -1;
>> Iterator connections = port.connectedPortList().iterator();
>> while (connections.hasNext()) {
>> i++;
>> // get connected ports and its containers
>> connection[i] = (Port) connections.next();
>> container[i] = connection[i].getContainer();
>> String name = container[i].getName();
>> // check: connected actor is actor B or not
>> if (name.contains("Name of actor B")) {
>> connected = true;
>> }
>> }
>>
>> it normally returns name of connected actor (in our case actor B) but
>> if i put these two actors into a composite actor the actor name
>> returns as composite actor name like "CompositeActor". I think that i
>> miss something here. Is it necessary to implement a fix to handle
>> Composite actor case or is there any generic solution for it.
>>
>> Any suggestion will be helpful,
>>
>> Thanks,
>>
>> --ufuk
>> _______________________________________________
>> Kepler-users mailing list
>> Kepler-users at kepler-project.org
>> http://mercury.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
More information about the Kepler-users
mailing list