[gme-users] Re: Traversing model
Berthing Jesper
f35594 at Danfoss.com
Tue Oct 24 10:02:45 CDT 2006
Hi Adi,
I think your question is clear.
You are using the functions correctly, but you need to be sure that the
atomName is a key in the HashTable.
Please use outConne.toString() and print it somewhere visible to you,
then you are able to se what the HashTable contains.
Or you can use outConne.isEmpty
<http://java.sun.com/j2se/1.4.2/docs/api/java/util/Hashtable.html#isEmpt
y()> ()that returns true if outConne is empty (No out connections from
the atomObject).
\Jesper
________________________________
From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Adi
Mallikarjuna Reddy V
Sent: 24. oktober 2006 07:57
To: A list for GME users to share thoughts and discuss bugs and fixes.
Subject: Re: [gme-users] Re: Traversing model
Hi Jesper,
1. Hashtable outConne= atomObject.getOutConnections();
2. Vector list = (Vector)outConne.get(atomName);
In the 1 statement, atomObject is the object of type JBuilderAtom or
JBuilderModel. What exactly I am trying to do in the above two
statements is
1. finding out the out connections (if any) for the JBuilderAtom or
JBuilderModel.
I hope this can be achieved thorough the first statement.
2. Next is getting those connections from the hash table with the name
of the above object.
I hope cleared my problem.
Regards
Adi
On 10/24/06, Berthing Jesper <f35594 at danfoss.com> wrote:
Hi Adi,
It looks correct, if the atomName[i] is a stored as a key in the
HashTable.
So if you say that it returns null, the it is not present in the
HashTable.
Try: (I guess that atomName[i] is the name of your connections
from the MetaModel)
if(true == outConne.containsKey(atomName[i])
{
Vector list = (Vector)outConne.get(atomName[i]);
}
else
{
// Look for another connection
}
toString() function from the HashTable class is also a good way
to visualize the content of the HashTable.
\Jesper
-----Original Message-----
From: gme-users-bounces at list.isis.vanderbilt.edu on behalf of
Adi Mallikarjuna Reddy V
Sent: Mon 10/23/2006 6:39 PM
To: A list for GME users to share thoughts and discuss bugs and
fixes.
Subject: [gme-users] Re: Traversing model
Is anyone in the list know about the following problem.
1. Hashtable outConne= atomNames[i].getOutConnections();
2. Vector list = (Vector)outConne.get(atomName[i]);
Are the above statements correct?
I am getting null in the 2 statement. Is it the right way to
access the
hashtable list?
Regards
Adi
On 10/21/06, Adi Mallikarjuna Reddy V <
adimallikarjunareddy at gmail.com>
wrote:
>
> Hi all,
> I got API that I required to traverse the model. But I am
facing some
> problems. When I tried accessing Connections (In and Out) of
an Object
> (Atom, Model), I am getting null as a result. I tried the
following APIs
>
> getOutConnections(String name) one which returns Vector
> getOutConnections() one which returns Hashtable
>
> this two functions I tried using the instance of (JBuilderAtom
or
> JBuilderModel).
>
> I would be helpful if you can help me in this regard.
>
>
> Regards
> Adi
_______________________________________________
gme-users mailing list
gme-users at list.isis.vanderbilt.edu
http://list.isis.vanderbilt.edu/mailman/listinfo/gme-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20061024/99608eb7/attachment.htm
More information about the gme-users
mailing list