Author Topic: Elements types enumeration  (Read 8465 times)

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Elements types enumeration
« on: February 25, 2014, 08:09:58 pm »
Hello!

I would like to compare element type with a list of elements types.

However, string comparison takes more time than a comparison to enum- since enum members have numeric representation.

Is there an elements-types enumeration I can use for this purpose? (like for package the appropriate nuber is 1, for class- 2,  and so on...  )
How can I use it?

Thanks.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Elements types enumeration
« Reply #1 on: February 25, 2014, 09:12:36 pm »
In what century do you live? 8-bit? You're comparing in a repository, not Terabytes.

q.

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Re: Elements types enumeration
« Reply #2 on: February 25, 2014, 09:32:00 pm »
I know it may sounds strange but I work on a long process program and quality should be respected wherever it could be.
Do you have an answer?
Thanks.
« Last Edit: February 25, 2014, 09:35:43 pm by avoda234 »

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: Elements types enumeration
« Reply #3 on: February 25, 2014, 10:01:34 pm »
You can try
Code: [Select]
select * from t_objecttypes

to build a list of your own, but this may not contain all extended elements.
You can use the stereotype definition profile helper to get a list of all elements (including extended elements)

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Re: Elements types enumeration
« Reply #4 on: February 25, 2014, 10:42:57 pm »
Thanks, yet I have no answer what is the numeric value to each element type in t_objecttypes.

Thanks in advance.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Elements types enumeration
« Reply #5 on: February 25, 2014, 11:11:37 pm »
See page 41 (chap 9.2) of my Inside book.

Quote
0: Action
1: Activity
2: ActivityPartition 3: ActivityRegion 4: Actor
5: Artifact
6: Association
7: Boundary
8: Change
9: Class
10: Collaboration 11: Component
12: Constraint
13: Decision
14: DeploymentSpecification 15: DiagramFrame
16: EmbeddedElement
17: Entity
18: EntryPoint
19: Event
20: ExceptionHandler
21: ExitPoint
22: ExpansionNode
23: ExpansionRegion
24: GUIElement InteractionFragment
25: InteractionOccurrence 26: InteractionState
27: Interface
28: InterruptibleActivi- tyRegion
29: Issue
30: Node
31: Note
32: Object 33: Package
34: Parameter
35: Part
36: Port
37: ProvidedInterface 38: Report
39: RequiredInterface 40: Requirement
41: Screen
42: Sequence
43: State
44: StateNode
45: Synchronization
46: Text
47: TimeLine
48: UMLDiagram
49: UseCase

q.
« Last Edit: February 25, 2014, 11:12:26 pm by qwerty »

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Re: Elements types enumeration
« Reply #6 on: February 25, 2014, 11:26:48 pm »
Thanks! I have already these great books!
Well, how exactly do I manage this numeric value?
Code: [Select]
element.type.what?
Thanks in advance!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Elements types enumeration
« Reply #7 on: February 25, 2014, 11:53:12 pm »
Well, actually the table only holds the string value. The numeric values are used at other places only. Which leads me to the important question: where :-? Seems I have not documented that. So some work for me.

However, you are anyway doomed to compare strings (though I think there are worse conditions).

q.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Elements types enumeration
« Reply #8 on: February 26, 2014, 12:00:44 am »
The EAConstants refers to this page: http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/objecttypeenum.htm which of course does not exist.

Thank god I love Minecraft. Digging is one of my hobbies.

q.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Elements types enumeration
« Reply #9 on: February 26, 2014, 12:04:34 am »
Now I remember. The API returns Element.ObjectType which is a numeric value. The table itself stores string values.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Elements types enumeration
« Reply #10 on: February 26, 2014, 08:39:12 am »
ObjectType enum allows comparison of what type of automation object you have (as there are circumstances where you don't know)

There is no numeric form of the difference between a class and interface. My guess is that the excerpt from qwerty's book is just using a numbered list to enumerate the available strings.

You'll have to compare the strings and take solace that they are only very small strings. Realistically, if you are using the Enterprise Architect API, string comparisons aren't going to be what is slowing it down.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Elements types enumeration
« Reply #11 on: February 26, 2014, 09:04:11 am »
Quote
There is no numeric form of the difference between a class and interface. My guess is that the excerpt from qwerty's book is just using a numbered list to enumerate the available strings..
Actually I was just using the contents of the EAConstants scripts.

q.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8083
  • Karma: +118/-20
    • View Profile
Re: Elements types enumeration
« Reply #12 on: February 26, 2014, 09:09:48 am »
Quote
Actually I was just using the contents of the EAConstants scripts.
If that was the case you would have

1. Project
2. Repository
3. Collection

etc.

The list you included was the object types that are only available as a string comparison. ie. Type from http://www.sparxsystems.com/enterprise_architect_user_guide/10/automation_and_scripting/element2.html
« Last Edit: February 26, 2014, 09:11:09 am by simonm »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Elements types enumeration
« Reply #13 on: February 26, 2014, 11:57:35 am »
I guess I have to sleep over that :-)

q.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Elements types enumeration
« Reply #14 on: February 26, 2014, 09:50:09 pm »
I think I got it. When I wrote that section I somehow had no access to the enumeration used in EAConstants. Obviously I found a list of types in the help under (sorry, but that brain damaged help has no link one can use) Search "UMLDiagram", 3rd entry where you find objectTypes. The order in the list is what I took as given.

I will correct that section immediately.

q.

P.S. Orthogonality? The API has Type (string) and Object_Type (int). The table has Object_Type (string) and of course no Type.
« Last Edit: February 26, 2014, 10:28:18 pm by qwerty »