Book a Demo

Author Topic: Modelling array as a type  (Read 3716 times)

gavinbarton

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Modelling array as a type
« on: June 18, 2007, 02:48:17 am »
I am trying to illustrate that a parameter being passed into a method is an array.

I can create a class and set the cardinality of the class to 0..*.  However if I then reference this class as the type of my parameter in my method it appears as:

void MyMethod(myParameter)

rather than

void MyMethod(myParameter[])

How can I achieve the [] without actually typing it?

Thanks

jeshaw2

  • EA User
  • **
  • Posts: 701
  • Karma: +0/-0
  • I'm a Singleton, what pattern are you?
    • View Profile
Re: Modelling array as a type
« Reply #1 on: June 18, 2007, 06:12:51 am »
You need to become more Object Oriented  ;)

Create a collection class and then pass an object of that class.

Don't, as you are attempting to do, make the object being called dependent on the internal implementation of the collection being passed.

If that won't work for you, write some code and reverse engineer it to see how EA models it.
« Last Edit: June 18, 2007, 06:14:33 am by jeshaw2 »
Verbal Use Cases aren't worth the paper they are written upon.

jkorman

  • EA User
  • **
  • Posts: 99
  • Karma: +0/-0
    • View Profile
Re: Modelling array as a type
« Reply #2 on: June 18, 2007, 06:56:51 am »
An observation.

An operation with an array return type can be modeled as such, not so with parameters.

 int [] foo(int [] a)

operation table
name = "foo", type = "int", array = "true"

operationParam table
name = "a", type = "int []"

The treatment is not consistent!

So the short answer is you have to manually enter the array brackets, i.e. double [], etc, when you want array parameters, but if you want an array return type, just check the "Return Array" box.

Jim