[gme-users] Registering Custom Classes

Brian Williams BrianW at isis.vanderbilt.edu
Tue Oct 24 17:04:47 CDT 2006


Hi Adi,

 

Sorry for the slow reply. Please look at the registerCustomClasses
example from SFBONComponent.java

For the addCustom* methods, the first argument is the GME kindname your
custom class will represent in your interpreter, and the second argument
is the java classname for your custom class. The custom class must
inherit from the Java BON basetype classes (directly or indirectly). If
you want to use your custom classes, you must use the addCustom* methods
inside the registerCustomClasses method. When your Java BON interpreter
starts up, the JBuilderFactory will take each object in your GME diagram
and instantiate a Java Object. If you do not use the addCustom* methods,
the Factory will only give you instances of Java BON base types
(JBuilderModel, etc).

 

In the example below, whenever there is a Primitive GME object, you will
get an sfInterpreter.SFPrimitive Java object in your interpreter. If you
comment out that line, and run it again, you will just get an instance
of JBuilderModel.

 

public void registerCustomClasses() 

      {

 
JBuilderFactory.addCustomModel("Primitive","sfInterpreter.SFPrimitive");

 
JBuilderFactory.addCustomModel("Compound","sfInterpreter.SFCompound");

 
JBuilderFactory.addCustomAtom("InputSignal","sfInterpreter.SFInputSignal
");

 
JBuilderFactory.addCustomAtom("OutputSignal","sfInterpreter.SFOutputSign
al");

 
JBuilderFactory.addCustomAtom("Param","sfInterpreter.SFParam");

 
JBuilderFactory.addCustomAtom("InputParam","sfInterpreter.SFInputParam")
;

 
JBuilderFactory.addCustomAtom("OutputParam","sfInterpreter.SFOutputParam
");

 
JBuilderFactory.addCustomConnection("DataflowConn","sfInterpreter.SFData
flowConn");

 
JBuilderFactory.addCustomConnection("ParameterConn","sfInterpreter.SFPar
ameterConn");

 

      }

 

 

Hope this helps,

 

Brian

 

 

-----Original Message-----
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: Tuesday, October 24, 2006 9:29 AM
To: gme-users
Subject: Re: [gme-users] Registering Custom Classes

 

Hi Jesper,

Thank you for reply. I have looked into that example earlier, but I
didn't get anything from it. My requirement is to write one more class
extra apart from the class which extended from BONComponent. I found
addCustom*() APIs in JBuildFactory class. I didn't how to use them to
add  the class. First of all is it compulsory to register this extra
class I was trying to add?

Regards
Adi

On 10/24/06, Berthing Jesper <f35594 at danfoss.com> wrote:

Significance, it depends on what you want to do and how you want to use
it? I used it in a similarly way like the example below to transverse
the models objects.

 

Look into the folder below on your PC there is a good example that shows
the use of this

 

C:\Program Files\GME\Paradigms\SF\JavaBONSFExample\sfInterpreter

 

\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 14:04
To: A list for GME users to share thoughts and discuss bugs and fixes.
Subject: [gme-users] Registering Custom Classes

Hi all,
I would like to add new class to my interpreter source that is written
in Java. I found one method 

public void registerCustomClasses()
{

}

I would like to know what is the significance of this in the
Interpreter. How to add/register new class into the interpreter with
this method?

Example will be helpful.

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/b109bbe7/attachment.htm


More information about the gme-users mailing list