home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-13 | 1.7 KB | 124 lines | [TEXT/EDIT] |
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- class AUX_GENERIC6LL[G]
-
- creation make
-
- feature
-
- make is
- do
- !!rep.make(1, 20);
- count := 0;
- index := 0;
- end; -- make
-
- feature
-
- empty: BOOLEAN is
- do
- Result := (count = 0);
- end; -- empty
-
- count: INTEGER;
-
- i_th (i: INTEGER): G is
- require
- i >= 1;
- i <= count;
- do
- Result := rep.item(i);
- end; -- i_th
-
- item: G is
- do
- Result := rep.item(index);
- end; -- item;
-
- forth is
- do
- index := index + 1;
- end; -- forth
-
- put (x: G) is
- require
- not_of: not off;
- do
- rep.put(x, count);
- end; -- put
-
- extend (x: G) is
- do
- count := count + 1;
- if count > rep.upper then
- rep.resize(1, count+10);
- end; -- if
- rep.put(x, count);
- end; -- extend
-
-
- after: BOOLEAN is
- do
- Result := (index > count);
- end; -- after;
-
- off: BOOLEAN is
- do
- Result := (index < 1) or (index > count);
- end; -- off
-
- start is
- do
- index := 1;
- end; -- start
-
- has (x: G): BOOLEAN is
- do
- Result := (rep.index_of(x) <= count);
- end; -- has
-
- first: G is
- do
- Result := rep.item(1);
- end; -- first
-
- last: G is
- do
- Result := rep.item(count);
- end; -- last
-
- remove_last is
- require
- not empty;
- do
- count := count - 1;
- end; -- remove_last
-
- wipe_out is
- do
- count := 0;
- end; -- wipe_out
-
- index: INTEGER;
-
-
- feature -- accËs au curseur
-
- cursor : CURSOR is
- do
- !!Result.make(index);
- end; -- cursor
-
- go_to (c: CURSOR) is
- do
- index := c.value;
- end; -- go_to
-
-
- feature {NONE}
-
- rep: ARRAY[G];
-
- end -- AUX_GENERIC6LL
-