Automatic generation produced by ISE Eiffel
note description: "Objects that represent the cursor of a text viewer" legal: "See notice at end of class." status: "See notice at end of class." author: "Christophe Bonnard [ bonnard@bigfoot.com ] / Arnaud PICHERY [ aranud@mail.dotcom.fr ]" revised_by: "Alexander Kogtenkov" date: "$Date: 2021-04-06 02:22:01 -0800 (Tue, 06 Apr 2021) $" revision: "$Revision: 105267 $" class interface VIEWER_CURSOR create make_from_absolute_pos (x, y: INTEGER_32; a_text: like whole_text) -- Create a cursor in a_text, at position given by -- x (in pixels) and y (in lines). require a_text_valid: a_text /= Void x_valid: x >= 0 y_valid: y >= 1 make_from_relative_pos (a_line: VIEWER_LINE; a_token: EDITOR_TOKEN; pos: INTEGER_32; a_text: like whole_text) -- Create a cursor in a_text, at position given by -- a_line, a_token and pos. require a_text_valid: a_text /= Void a_line_valid: a_line /= Void a_line_valid: a_line.is_valid a_token_valid: a_token /= Void pos_valid: pos >= 1 make_from_character_pos (ch_num, y: INTEGER_32; a_text: like whole_text) -- Create a cursor in a_text, at the ch_numth -- character in line y. require a_text_valid: a_text /= Void ch_num_valid: ch_num >= 1 y_valid: y >= 1 make_from_integer (ch_num: INTEGER_32; a_text: like whole_text) -- Create a cursor in a_text, at the ch_numth -- character of the whole text. require a_text_valid: a_text /= Void ch_num_valid: ch_num >= 1 feature -- Initialization make_from_absolute_pos (x, y: INTEGER_32; a_text: like whole_text) -- Create a cursor in a_text, at position given by -- x (in pixels) and y (in lines). require a_text_valid: a_text /= Void x_valid: x >= 0 y_valid: y >= 1 make_from_character_pos (ch_num, y: INTEGER_32; a_text: like whole_text) -- Create a cursor in a_text, at the ch_numth -- character in line y. require a_text_valid: a_text /= Void ch_num_valid: ch_num >= 1 y_valid: y >= 1 make_from_integer (ch_num: INTEGER_32; a_text: like whole_text) -- Create a cursor in a_text, at the ch_numth -- character of the whole text. require a_text_valid: a_text /= Void ch_num_valid: ch_num >= 1 make_from_relative_pos (a_line: VIEWER_LINE; a_token: EDITOR_TOKEN; pos: INTEGER_32; a_text: like whole_text) -- Create a cursor in a_text, at position given by -- a_line, a_token and pos. require a_text_valid: a_text /= Void a_line_valid: a_line /= Void a_line_valid: a_line.is_valid a_token_valid: a_token /= Void pos_valid: pos >= 1 feature -- Access generating_type: TYPE [VIEWER_CURSOR] -- Type of current object -- (type of which it is a direct instance) -- (from ANY) ensure -- from ANY generating_type_not_void: Result /= Void generator: STRING_8 -- Name of current object's generating class -- (base class of the type of which it is a direct instance) -- (from ANY) ensure -- from ANY generator_not_void: Result /= Void generator_not_empty: not Result.is_empty feature -- Access line: VIEWER_LINE -- Line where Current is number_of_lines: INTEGER_32 -- Number of lines in `whole_text` pos_in_characters: INTEGER_32 -- Position of Current, in characters from the start of the text. pos_in_token: INTEGER_32 -- Character (in `token`) Current points on token: EDITOR_TOKEN -- Token where Current is wide_item: CHARACTER_32 -- Character current points on x_in_characters: INTEGER_32 -- Horizontal position of Current, in characters. x_in_pixels: INTEGER_32 -- Theoric horizontal position of Current, in pixels y_in_lines: INTEGER_32 -- Line number of Current in the whole text feature -- Comparison frozen deep_equal (a: ANY; b: like arg #1): BOOLEAN -- Are a and b either both void -- or attached to isomorphic object structures? -- (from ANY) ensure -- from ANY instance_free: class shallow_implies_deep: standard_equal (a, b) implies Result both_or_none_void: (a = Void) implies (Result = (b = Void)) same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b)) symmetric: Result implies deep_equal (b, a) frozen equal (a: ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached -- to objects considered equal? -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.is_equal (b)) frozen is_deep_equal alias "≡≡≡" (other: VIEWER_CURSOR): BOOLEAN -- Are Current and other attached to isomorphic object structures? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY shallow_implies_deep: standard_is_equal (other) implies Result same_type: Result implies same_type (other) symmetric: Result implies other.is_deep_equal (Current) is_equal (other: like Current): BOOLEAN -- Is Current equal to other? require -- from ANY other_not_void: other /= Void ensure -- from ANY symmetric: Result implies other ~ Current consistent: standard_is_equal (other) implies Result ensure then -- from COMPARABLE trichotomy: Result = (not (Current < other) and not (other < Current)) is_greater alias ">" (other: VIEWER_CURSOR): BOOLEAN -- Is current object greater than other? -- (from COMPARABLE) require -- from PART_COMPARABLE other_exists: other /= Void ensure then -- from COMPARABLE definition: Result = (other < Current) is_greater_equal alias ">=" alias "≥" (other: VIEWER_CURSOR): BOOLEAN -- Is current object greater than or equal to other? -- (from COMPARABLE) require -- from PART_COMPARABLE other_exists: other /= Void ensure then -- from COMPARABLE definition: Result = (other <= Current) is_less alias "<" (other: like Current): BOOLEAN -- Is current object less than other? require -- from PART_COMPARABLE other_exists: other /= Void ensure then -- from COMPARABLE asymmetric: Result implies not (other < Current) is_less_equal alias "<=" alias "≤" (other: VIEWER_CURSOR): BOOLEAN -- Is current object less than or equal to other? -- (from COMPARABLE) require -- from PART_COMPARABLE other_exists: other /= Void ensure then -- from COMPARABLE definition: Result = ((Current < other) or (Current ~ other)) max alias "∨" (other: VIEWER_CURSOR): VIEWER_CURSOR -- The greater of current object and other -- (from COMPARABLE) require -- from COMPARABLE other_exists: other /= Void ensure -- from COMPARABLE current_if_not_smaller: Current >= other implies Result = Current other_if_smaller: Current < other implies Result = other min alias "∧" (other: VIEWER_CURSOR): VIEWER_CURSOR -- The smaller of current object and other -- (from COMPARABLE) require -- from COMPARABLE other_exists: other /= Void ensure -- from COMPARABLE current_if_not_greater: Current <= other implies Result = Current other_if_greater: Current > other implies Result = other frozen standard_equal (a: ANY; b: like arg #1): BOOLEAN -- Are a and b either both void or attached to -- field-by-field identical objects of the same type? -- Always uses default object comparison criterion. -- (from ANY) ensure -- from ANY instance_free: class definition: Result = (a = Void and b = Void) or else ((a /= Void and b /= Void) and then a.standard_is_equal (b)) frozen standard_is_equal alias "≜" (other: VIEWER_CURSOR): BOOLEAN -- Is other attached to an object of the same type -- as current object, and field-by-field identical to it? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY same_type: Result implies same_type (other) symmetric: Result implies other.standard_is_equal (Current) three_way_comparison alias "⋚" (other: VIEWER_CURSOR): INTEGER_32 -- If current object equal to other, 0; -- if smaller, -1; if greater, 1 -- (from COMPARABLE) require -- from COMPARABLE other_exists: other /= Void ensure -- from COMPARABLE equal_zero: (Result = 0) = (Current ~ other) smaller_negative: (Result = -1) = (Current < other) greater_positive: (Result = 1) = (Current > other) feature -- Status report conforms_to (other: ANY): BOOLEAN -- Does type of current object conform to type -- of other (as per Eiffel: The Language, chapter 13)? -- (from ANY) require -- from ANY other_not_void: other /= Void same_type (other: ANY): BOOLEAN -- Is type of current object identical to type of other? -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY definition: Result = (conforms_to (other) and other.conforms_to (Current)) feature -- Cursor movement go_down_line -- Move down one line (to next line), if possible. go_end_line -- Move to end of line. go_left_char -- Move to previous character, if there is one. go_right_char -- Move to next character, if there is one. go_start_line -- Move to beginning of line. go_up_line -- Move up one line (to preceding line), if possible. feature -- Element change set_current_char (a_token: EDITOR_TOKEN; a_position: INTEGER_32) -- Make a_token be the new value for `token`. -- Set the value of `pos_in_token` to a_position. -- Update `x_in_pixels` accordingly. require a_token_exists: a_token /= Void a_position_positive_not_null: a_position >= 0 set_line (a_line: like line) -- Make a_line the new value of `line`. require a_line_exists: a_line /= Void a_line_valid: a_line.is_valid set_x_in_characters (x_in_ch: INTEGER_32) -- Set attributes so that `x_in_characters` return x_in_ch. require x_in_ch_valid: x_in_ch >= 1 ensure valid_result: x_in_characters = x_in_ch set_x_in_pixels (x: INTEGER_32) -- Make x be the new value of `x_in_pixels`. require x_valid: x >= 0 set_y_in_lines (y: INTEGER_32) -- Make y be the new value of `y_in_lines`. -- Change `line` accordingly. require y_valid: y >= 1 and then y <= number_of_lines feature -- Duplication copy (other: VIEWER_CURSOR) -- Update current object using fields of object attached -- to other, so as to yield equal objects. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_equal: Current ~ other frozen deep_copy (other: VIEWER_CURSOR) -- Effect equivalent to that of: -- `copy` (other . `deep_twin`) -- (from ANY) require -- from ANY other_not_void: other /= Void ensure -- from ANY deep_equal: deep_equal (Current, other) frozen deep_twin: VIEWER_CURSOR -- New object structure recursively duplicated from Current. -- (from ANY) ensure -- from ANY deep_twin_not_void: Result /= Void deep_equal: deep_equal (Current, Result) frozen standard_copy (other: VIEWER_CURSOR) -- Copy every field of other onto corresponding field -- of current object. -- (from ANY) require -- from ANY other_not_void: other /= Void type_identity: same_type (other) ensure -- from ANY is_standard_equal: standard_is_equal (other) frozen standard_twin: VIEWER_CURSOR -- New object field-by-field identical to other. -- Always uses default copying semantics. -- (from ANY) ensure -- from ANY standard_twin_not_void: Result /= Void equal: standard_equal (Result, Current) frozen twin: VIEWER_CURSOR -- New object equal to Current -- `twin` calls `copy`; to change copying/twinning semantics, redefine `copy`. -- (from ANY) ensure -- from ANY twin_not_void: Result /= Void is_equal: Result ~ Current feature -- Basic operations frozen default: VIEWER_CURSOR -- Default value of object's type -- (from ANY) frozen default_pointer: POINTER -- Default value of type POINTER -- (Avoid the need to write p.`default` for -- some p of type POINTER.) -- (from ANY) ensure -- from ANY instance_free: class default_rescue -- Process exception for routines with no Rescue clause. -- (Default: do nothing.) -- (from ANY) frozen do_nothing -- Execute a null action. -- (from ANY) ensure -- from ANY instance_free: class feature -- Output Io: STD_FILES -- Handle to standard file setup -- (from ANY) ensure -- from ANY instance_free: class io_not_void: Result /= Void out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY out_not_void: Result /= Void print (o: ANY) -- Write terse external representation of o -- on standard output. -- (from ANY) ensure -- from ANY instance_free: class frozen tagged_out: STRING_8 -- New string containing terse printable representation -- of current object -- (from ANY) ensure -- from ANY tagged_out_not_void: Result /= Void feature -- Platform Operating_environment: OPERATING_ENVIRONMENT -- Objects available from the operating system -- (from ANY) ensure -- from ANY instance_free: class operating_environment_not_void: Result /= Void invariant x_in_pixels_positive_or_null: x_in_pixels >= 0 y_in_lines_positive_or_null: y_in_lines >= 0 pos_in_token_positive: pos_in_token > 0 whole_text_not_void: whole_text /= Void -- from ANY reflexive_equality: standard_is_equal (Current) reflexive_conformance: conforms_to (Current) -- from COMPARABLE irreflexive_comparison: not (Current < Current) note copyright: "Copyright (c) 1984-2021, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software 5949 Hollister Ave., Goleta, CA 93117 USA Telephone 805-685-1006, Fax 805-685-6869 Website http://www.eiffel.com Customer support http://support.eiffel.com ]" end -- class VIEWER_CURSOR -- Generated by Eiffel Studio --
For more details: eiffel.org