SuchZen
SuchZen

Reputation: 57

UML class diagram for string array

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[]

Upvotes: 2

Views: 12027

Answers (1)

Martin Spamer
Martin Spamer

Reputation: 5585

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.

Upvotes: 2

Related Questions