From: Jean Privat Date: Mon, 3 Aug 2009 20:30:41 +0000 (-0400) Subject: lib: rename IndexedCollection to Sequence X-Git-Tag: v0.3~78 X-Git-Url: http://nitlanguage.org lib: rename IndexedCollection to Sequence Signed-off-by: Jean Privat --- diff --git a/lib/standard/collection/abstract_collection.nit b/lib/standard/collection/abstract_collection.nit index 0d12d90..c0c895c 100644 --- a/lib/standard/collection/abstract_collection.nit +++ b/lib/standard/collection/abstract_collection.nit @@ -283,7 +283,7 @@ end # Indexed collection are ordoned collections. # The first item is 0. The last is `length'-1. -interface IndexedCollectionRead[E] +interface SequenceRead[E] special MapRead[Int, E] # Get the first item. # Is equivalent with `self'[0]. @@ -318,8 +318,8 @@ end # Indexed collection are ordoned collections. # The first item is 0. The last is `length'-1. -interface IndexedCollection[E] -special IndexedCollectionRead[E] +interface Sequence[E] +special SequenceRead[E] special Map[Int, E] special SimpleCollection[E] # Set the first item. diff --git a/lib/standard/collection/array.nit b/lib/standard/collection/array.nit index 23b21c4..2e3b30b 100644 --- a/lib/standard/collection/array.nit +++ b/lib/standard/collection/array.nit @@ -19,7 +19,7 @@ import abstract_collection # One dimention array of objects. class AbstractArrayRead[E] -special IndexedCollectionRead[E] +special SequenceRead[E] # The current length redef readable var _length: Int = 0 @@ -143,7 +143,7 @@ end # Resizeable one dimention array of objects. class AbstractArray[E] special AbstractArrayRead[E] -special IndexedCollection[E] +special Sequence[E] fun enlarge(cap: Int) is abstract redef fun push(item) do add(item) diff --git a/lib/standard/collection/list.nit b/lib/standard/collection/list.nit index ec803ba..3b11a6b 100644 --- a/lib/standard/collection/list.nit +++ b/lib/standard/collection/list.nit @@ -17,7 +17,7 @@ import abstract_collection # Double linked lists. class List[E] -special IndexedCollection[E] +special Sequence[E] # Access redef fun [](index) do return get_node(index).item diff --git a/lib/standard/string.nit b/lib/standard/string.nit index 791be80..164e6f3 100644 --- a/lib/standard/string.nit +++ b/lib/standard/string.nit @@ -414,7 +414,7 @@ redef class Object return "<{object_id.to_hex}" end - protected fun args: IndexedCollection[String] + protected fun args: Sequence[String] do return sys.args end @@ -602,9 +602,9 @@ class StringCapable end redef class Sys - var _args_cache: nullable IndexedCollection[String] + var _args_cache: nullable Sequence[String] - redef fun args: IndexedCollection[String] + redef fun args: Sequence[String] do if _args_cache == null then init_args return _args_cache.as(not null) diff --git a/src/icode/icode_base.nit b/src/icode/icode_base.nit index 6a822e3..11d5a6f 100644 --- a/src/icode/icode_base.nit +++ b/src/icode/icode_base.nit @@ -46,10 +46,10 @@ end # A routine is a sequence of icodes with entry iregisters (params) and an exit iregister (result) class IRoutine # The parameters of the routine - readable var _params: IndexedCollection[IRegister] + readable var _params: Sequence[IRegister] # The closure declared - readable writable var _closure_decls: nullable IndexedCollection[IClosureDecl] = null + readable writable var _closure_decls: nullable Sequence[IClosureDecl] = null # The result of the routine readable var _result: nullable IRegister @@ -60,7 +60,7 @@ class IRoutine # The location of the iroutine (if any) readable writable var _location: nullable Location = null - init(p: IndexedCollection[IRegister], r: nullable IRegister) + init(p: Sequence[IRegister], r: nullable IRegister) do _params = p.to_a _result = r @@ -134,12 +134,12 @@ special ICode redef fun arity do return _exprs.length # All arguments - readable var _exprs: IndexedCollection[IRegister] + readable var _exprs: Sequence[IRegister] # All closure definition - readable writable var _closure_defs: nullable IndexedCollection[nullable IClosureDef] + readable writable var _closure_defs: nullable Sequence[nullable IClosureDef] - init(e: nullable IndexedCollection[IRegister]) + init(e: nullable Sequence[IRegister]) do if e == null then _exprs = new Array[IRegister] @@ -212,7 +212,7 @@ special ICodeN # The called method readable var _property: MMMethod - init(p: MMMethod, e: IndexedCollection[IRegister]) + init(p: MMMethod, e: Sequence[IRegister]) do super(e) _property = p @@ -239,7 +239,7 @@ class INew special ICall # The type to instantiate readable var _stype: MMType - init(t: MMType, p: MMMethod, a: IndexedCollection[IRegister]) + init(t: MMType, p: MMMethod, a: Sequence[IRegister]) do super(p, a) _stype = t @@ -256,7 +256,7 @@ special ICodeN # The !break sequence (if any) readable writable var _break_seq: nullable ISeq = null - init(c: IClosureDecl, e: IndexedCollection[IRegister]) + init(c: IClosureDecl, e: Sequence[IRegister]) do super(e) _closure_decl = c @@ -272,7 +272,7 @@ special ICodeN # Special character sequence '@@@' will be substitued in order with the arguments readable var _code: String - init(c: String, e: nullable IndexedCollection[IRegister]) + init(c: String, e: nullable Sequence[IRegister]) do super(e) _code = c diff --git a/src/icode/icode_tools.nit b/src/icode/icode_tools.nit index 5186233..2d059e2 100644 --- a/src/icode/icode_tools.nit +++ b/src/icode/icode_tools.nit @@ -93,7 +93,7 @@ end redef class IRoutine # Inline an iroutine in an icode sequence - fun inline_in_seq(seq: ISeq, args: IndexedCollection[IRegister]): nullable IRegister + fun inline_in_seq(seq: ISeq, args: Sequence[IRegister]): nullable IRegister do var d = new ICodeDupContext if args.length != params.length then print "{args.length} != {params.length}" @@ -129,7 +129,7 @@ private class ICodeDupContext # Duplicate a bunch of registers # Subsequent invocation will return the same registers - fun dup_iregs(regs: IndexedCollection[IRegister]): IndexedCollection[IRegister] + fun dup_iregs(regs: Sequence[IRegister]): Sequence[IRegister] do var a = new Array[IRegister].with_capacity(regs.length) for r in regs do diff --git a/src/syntax/icode_generation.nit b/src/syntax/icode_generation.nit index b87f91c..8e4502d 100644 --- a/src/syntax/icode_generation.nit +++ b/src/syntax/icode_generation.nit @@ -314,7 +314,7 @@ redef class AMethPropdef end redef class ASignature - fun fill_iroutine_parameters(v: A2IContext, orig_sig: MMSignature, params: IndexedCollection[IRegister], closdecls: nullable IndexedCollection[IClosureDecl]) + fun fill_iroutine_parameters(v: A2IContext, orig_sig: MMSignature, params: Sequence[IRegister], closdecls: nullable Sequence[IClosureDecl]) do for ap in n_params do var reg = v.variable(ap.variable) diff --git a/tests/test_coll.nit b/tests/test_coll.nit index 26bcc87..f0b3fdc 100644 --- a/tests/test_coll.nit +++ b/tests/test_coll.nit @@ -14,7 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -fun test_coll(c: IndexedCollection[Object], e: Object...) +fun test_coll(c: Sequence[Object], e: Object...) do print("c: {c.to_s.is_empty}") print("empty: {c.is_empty}")