2

In UML how should we show a method which return string array in UML method that looks like this

public String[] delete(int col, int row){}

Is this representation correct?

+delete(col: int; row: int): String[]
Martin Spamer
  • 5,437
  • 28
  • 44
SuchZen
  • 57
  • 1
  • 1
  • 3

1 Answers1

2

That is ok, but ideally you should include the bounds in OCL. e.g.

+delete(col: int, row: int): string[0..*]

This is not an array but a 'bounds' so [0..] is zero to infinite strings. [0..1] Zero or one strings. [1..] 1 to infinite strings.

In this case string is the OCL type not a Java String object, others are Bag, Set etc.

Martin Spamer
  • 5,437
  • 28
  • 44
  • And for two dimensional array ? +delete(col: int, row: int): String[0..*][0..*] is this correct? – rluks Apr 03 '13 at 13:12
  • Actually NO, the bounds are an OCL constraint not a *type*, like array. It is actually Object Constraint Language. I'm not sure of the answer but you should be able to find it at http://search.cpan.org/~kstephens/UMMF-1.02/ – Martin Spamer Apr 11 '13 at 16:52