Permalink
Browse files

Added auxiliary queries to BON types.

  • Loading branch information...
1 parent 216a460 commit 91a8b8d8e4ac23c4f5d86250b765edce95c4e52f @tdidriksen committed Apr 17, 2012
@@ -46,7 +46,11 @@ feature -- Access
feature_name: STRING
-- Feature name of `Current'.
do
- Result := my_feature_name.twin
+ if my_feature_name /= Void then
+ Result := my_feature_name.twin
+ elseif is_infix or is_prefix then
+ Result := operator.string_representation
+ end
end
operator: OPERATOR
@@ -11,7 +11,7 @@ class
inherit
HASHABLE
-creation
+create
make_class_type, make_formal_generic_name
feature -- Initialization
@@ -22,6 +22,8 @@ feature -- Initialization
a_class_type /= Void
do
my_class_type := a_class_type.twin
+ is_class_type := True
+ is_formal_generic_name := False
ensure
class_type.is_equal (a_class_type)
end
@@ -33,6 +35,8 @@ feature -- Initialization
not a_formal_generic_name.is_empty
do
my_formal_generic_name := a_formal_generic_name.twin
+ is_class_type := False
+ is_formal_generic_name := True
ensure
a_formal_generic_name /= Void and then
formal_generic_name.is_equal (a_formal_generic_name)
@@ -63,6 +67,13 @@ feature -- Access
end
end
+feature -- Status report
+ is_class_type: BOOLEAN
+ -- Is `Current' a class type?
+
+ is_formal_generic_name: BOOLEAN
+ -- Is `Current' a formal generic name?
+
feature -- Element change
set_class_type (a_class_type: CLASS_TYPE)
@@ -46,6 +46,14 @@ feature -- Element change
ancestors := ancestors & a_class
end
+ add_feature (a_feature: TBON_TC_FEATURE)
+ -- Add `a_feature' to `features'?
+ require
+ not_void: a_feature /= Void
+ do
+ features := features & a_feature
+ end
+
set_cluster (a_cluster: TBON_TC_CLUSTER_TYPE)
-- Set `Current' to be in cluster `a_cluster'?
require
@@ -121,6 +129,17 @@ feature -- Status report
is_interfaced: BOOLEAN
-- Is `Current' an interfaced class?
+ has_generic_name (a_formal_generic_name: STRING): BOOLEAN
+ -- Is `a_formal_generic_name' one of the generic names of `Current'?
+ do
+ Result := generics /= Void and then generics.exists (
+ agent (generic: TBON_TC_GENERIC; other_formal_name: STRING): BOOLEAN
+ do
+ Result := generic.formal_generic_name ~ other_formal_name
+ end (?, a_formal_generic_name)
+ )
+ end
+
conforms_to (other: TBON_TC_TYPE): BOOLEAN
-- Does `Current' conform to `other'?
local
@@ -28,7 +28,9 @@ feature -- Initialization
enclosing_class := an_enclosing_class
create {LINKED_LIST[STRING]} selective_export.make
+ selective_export.compare_objects
create {LINKED_LIST[TBON_TC_FEATURE_ARGUMENT]} arguments.make
+ arguments.compare_objects
end
feature -- Access
@@ -51,6 +53,10 @@ feature -- Status report
is_redefined: BOOLEAN
+ is_prefix: BOOLEAN
+
+ is_infix: BOOLEAN
+
is_model_equal alias "|=|" (other: TBON_TC_FEATURE): BOOLEAN
-- Is this model mathematically equal to `other'?
do
@@ -92,6 +98,22 @@ feature -- Element change
is_renamed: is_renamed
end
+ set_is_prefix
+ do
+ is_prefix := True
+ is_infix := False
+ ensure
+ is_prefix: is_prefix
+ end
+
+ set_is_infix
+ do
+ is_infix := True
+ is_prefix := False
+ ensure
+ is_infix: is_infix
+ end
+
set_type (a_type: TBON_TC_CLASS_TYPE)
require
a_type /= Void
@@ -109,6 +131,8 @@ feature -- Renaming
invariant
is_unclassified xor is_deferred xor is_effective xor is_redefined
is_renamed implies (new_name /= Void and not new_name.is_empty and renamed_from_class /= Void)
+ is_infix implies not is_prefix
+ is_prefix implies not is_infix
end
@@ -28,6 +28,12 @@ feature -- Access
type: TBON_TC_CLASS_TYPE
+feature -- Element change
+ set_type (a_type: TBON_TC_CLASS_TYPE)
+ do
+ type := a_type
+ end
+
invariant
formal_name /= Void
type /= Void

0 comments on commit 91a8b8d

Please sign in to comment.