Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Tehila1 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.
-
In what century do you live? 8-bit? You're comparing in a repository, not Terabytes.
q.
-
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.
-
You can try
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)
-
Thanks, yet I have no answer what is the numeric value to each element type in t_objecttypes.
Thanks in advance.
-
See page 41 (chap 9.2) of my Inside book.
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.
-
Thanks! I have already these great books!
Well, how exactly do I manage this numeric value?
element.type.what?
Thanks in advance!
-
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.
-
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.
-
Now I remember. The API returns Element.ObjectType which is a numeric value. The table itself stores string values.
q.
-
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.
-
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.
-
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
-
I guess I have to sleep over that :-)
q.
-
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.