[gme-users] Java interface: JBuilderModel/getAttribute

Amol Bakshi amol.bakshi at gmail.com
Thu Apr 14 09:37:43 CDT 2005


I am trying to use the Java interface to write a simple model
interpreter that retrieves attribute values of different models and
atoms.  The traversal appears to be working fine but I am having no
success (like some other postings in this list previously) in using
the getAttribute(String, String[]) method.

My code excerpt:

private void CreateTaskTemplate(JBuilderModel abstractTask) {
....
String[] firingRule = new String[4];
boolean success = abstractTask.getAttribute("FiringRule", firingRule);
JOptionPane.showMessageDialog(null, (success?"yes":"no"));
....
}

Notes:
* I tried various sizes of the String array, even tried not
initializing it!!  I expect only one value so I believe just a
String[1] should suffice...
* The value of "success" is false every time.
* I tried using code provided in a prior (April 04) posting in this
list that used MgaAttribute[] array to store the results of
abstractTask.getIObject().getAttributes().getAll(), and traversed the
returned values for a name match with the attribute.  I am not very
familiar with mga so I do not know if something is wrong.
* I tried using a 'fixed' gme.jar posted on this list in 2004; that
didnt' work either.
* I am using GME 4.11.10 in this example.

Is this a real problem and is there a fix/workaround or am I doing
something very stupid?  Not being able to retrieve attribute values
makes my model interpreter entirely useless!  Any help will be greatly
appreciated.

-Amol.


More information about the gme-users mailing list