/[eiffelstudio]/FreeELKS/trunk/library/kernel/array.e
ViewVC logotype

Diff of /FreeELKS/trunk/library/kernel/array.e

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 91476 by ericb, Fri Mar 3 10:19:32 2006 UTC revision 91477 by ericb, Sun Jan 14 09:47:13 2007 UTC
# Line 76  feature -- Initialization Line 76  feature -- Initialization
76                          upper := a.upper                          upper := a.upper
77                  end                  end
78    
79          make_from_cil (na: NATIVE_ARRAY [G]) is          make_from_cil (na: NATIVE_ARRAY [like item]) is
80                          -- Initialize array from `na'.                          -- Initialize array from `na'.
81                  require                  require
82                          is_dotnet: {PLATFORM}.is_dotnet                          is_dotnet: {PLATFORM}.is_dotnet
# Line 316  feature -- Element change Line 316  feature -- Element change
316                          higher_count: count >= old count                          higher_count: count >= old count
317                  end                  end
318    
319          subcopy (other: ARRAY [G]; start_pos, end_pos, index_pos: INTEGER) is          subcopy (other: ARRAY [like item]; start_pos, end_pos, index_pos: INTEGER) is
320                          -- Copy items of `other' within bounds `start_pos' and `end_pos'                          -- Copy items of `other' within bounds `start_pos' and `end_pos'
321                          -- to current array starting at index `index_pos'.                          -- to current array starting at index `index_pos'.
322                  require                  require
# Line 336  feature -- Element change Line 336  feature -- Element change
336  feature -- Iteration  feature -- Iteration
337    
338          do_all (action: PROCEDURE [ANY, TUPLE [G]]) is          do_all (action: PROCEDURE [ANY, TUPLE [G]]) is
339                          -- Apply `action' to every non-void item.                          -- Apply `action' to every item.
340                          -- Semantics not guaranteed if `action' changes the structure;                          -- Semantics not guaranteed if `action' changes the structure;
341                          -- in such a case, apply iterator to clone of structure instead.                          -- in such a case, apply iterator to clone of structure instead.
342                  require                  require
# Line 361  feature -- Iteration Line 361  feature -- Iteration
361                  end                  end
362    
363          do_if (action: PROCEDURE [ANY, TUPLE [G]]; test: FUNCTION [ANY, TUPLE [G], BOOLEAN]) is          do_if (action: PROCEDURE [ANY, TUPLE [G]]; test: FUNCTION [ANY, TUPLE [G], BOOLEAN]) is
364                          -- Apply `action' to every non-void item that satisfies `test'.                          -- Apply `action' to every item that satisfies `test'.
365                          -- Semantics not guaranteed if `action' or `test' changes the structure;                          -- Semantics not guaranteed if `action' or `test' changes the structure;
366                          -- in such a case, apply iterator to clone of structure instead.                          -- in such a case, apply iterator to clone of structure instead.
367                  require                  require
# Line 412  feature -- Iteration Line 412  feature -- Iteration
412                  end                  end
413    
414          for_all (test: FUNCTION [ANY, TUPLE [G], BOOLEAN]): BOOLEAN is          for_all (test: FUNCTION [ANY, TUPLE [G], BOOLEAN]): BOOLEAN is
415                          -- Is `test' true for all non-void items?                          -- Is `test' true for all items?
416                  require                  require
417                          test_not_void: test /= Void                          test_not_void: test /= Void
418                  local                  local
# Line 598  feature -- Duplication Line 598  feature -- Duplication
598                          -- bounds `start_pos' and `end_pos'.                          -- bounds `start_pos' and `end_pos'.
599                  require                  require
600                          valid_start_pos: valid_index (start_pos)                          valid_start_pos: valid_index (start_pos)
601                          valid_end_pos: valid_index (end_pos)                          valid_end_pos: end_pos <= upper
602                          valid_bounds: (start_pos <= end_pos) or (start_pos = end_pos + 1)                          valid_bounds: (start_pos <= end_pos) or (start_pos = end_pos + 1)
603                  do                  do
604                          create Result.make (start_pos, end_pos)                          create Result.make (start_pos, end_pos)
605                          Result.subcopy (Current, start_pos, end_pos, start_pos)                          if start_pos <= end_pos then
606                                            -- Only copy elements if needed.
607                                    Result.subcopy (Current, start_pos, end_pos, start_pos)
608                            end
609                  ensure                  ensure
610                          lower: Result.lower = start_pos                          lower: Result.lower = start_pos
611                          upper: Result.upper = end_pos                          upper: Result.upper = end_pos

Legend:
Removed from v.91476  
changed lines
  Added in v.91477

  ViewVC Help
Powered by ViewVC 1.1.23