Guest User

Untitled

a guest
Jul 16th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.29 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // ELECTROTANK INC.
  4. // Copyright© 2009 Electrotank, Inc.
  5. // All Rights Reserved.
  6. //
  7. ////////////////////////////////////////////////////////////////////////////////
  8.  
  9. package com.electrotank.toolsuite.editor.world.entity {
  10.  
  11. //----------------------------------
  12. // imports
  13. //----------------------------------
  14. import com.electrotank.toolsuite.editor.entity.EntityInstance;
  15. import flash.utils.getQualifiedClassName;
  16.  
  17.  
  18. /**
  19. * This class represents the basic editor entity.
  20. *
  21. * @author Matt Bolt, Electrotank© 2009
  22. */
  23. public class AbstractEditorEntity {
  24.  
  25. //--------------------------------------------------------------------------
  26. //
  27. // Variables
  28. //
  29. //--------------------------------------------------------------------------
  30.  
  31. /**
  32. * @private
  33. * the entity instance representing the editor entity
  34. */
  35. private var _entity:EntityInstance;
  36.  
  37. /**
  38. * @private
  39. * the subclass name for this abstract entity
  40. */
  41. private var _className:String;
  42.  
  43. //--------------------------------------------------------------------------
  44. //
  45. // Constructor
  46. //
  47. //--------------------------------------------------------------------------
  48.  
  49. /**
  50. * <code>AbstractEditorEntity</code> Constructor.
  51. */
  52. public function AbstractEditorEntity(entity:EntityInstance) {
  53. _entity = entity;
  54.  
  55. _className = findSubClass();
  56. }
  57.  
  58. //--------------------------------------------------------------------------
  59. //
  60. // Methods
  61. //
  62. //--------------------------------------------------------------------------
  63.  
  64. /**
  65. * @private
  66. * finds the subclass name of this entity
  67. */
  68. private function findSubClass():String {
  69. var className:String = getQualifiedClassName(this);
  70. return className.substring(
  71. className.lastIndexOf("::") + 2,
  72. className.length );
  73. }
  74.  
  75. /**
  76. * This method returns the <code>String</code> representation of the object.
  77. *
  78. * @return <code>String</code>
  79. */
  80. public function toString():String {
  81. return "[" + _className + " - " +
  82. "name: " + name +
  83. ", id: " + id +
  84. "]";
  85. }
  86.  
  87. //--------------------------------------------------------------------------
  88. //
  89. // Properties
  90. //
  91. //--------------------------------------------------------------------------
  92.  
  93. /**
  94. * This property contains the entity instance for the world view.
  95. */
  96. public function get entity():EntityInstance {
  97. return _entity;
  98. }
  99.  
  100. /**
  101. * The world-view name.
  102. */
  103. public function get name():String {
  104. return _entity.name;
  105. }
  106.  
  107. /**
  108. * The world-view id.
  109. */
  110. public function get id():int {
  111. return _entity.id;
  112. }
  113.  
  114. }
  115.  
  116. }
Add Comment
Please, Sign In to add comment