lib: rename IndexedCollection to Sequence
authorJean Privat <jean@pryen.org>
Mon, 3 Aug 2009 20:30:41 +0000 (16:30 -0400)
committerJean Privat <jean@pryen.org>
Thu, 6 Aug 2009 15:29:29 +0000 (11:29 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

lib/standard/collection/abstract_collection.nit
lib/standard/collection/array.nit
lib/standard/collection/list.nit
lib/standard/string.nit
src/icode/icode_base.nit
src/icode/icode_tools.nit
src/syntax/icode_generation.nit
tests/test_coll.nit

index 0d12d90..c0c895c 100644 (file)
@@ -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.
index 23b21c4..2e3b30b 100644 (file)
@@ -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)
index ec803ba..3b11a6b 100644 (file)
@@ -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
 
index 791be80..164e6f3 100644 (file)
@@ -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)
index 6a822e3..11d5a6f 100644 (file)
@@ -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
index 5186233..2d059e2 100644 (file)
@@ -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
index b87f91c..8e4502d 100644 (file)
@@ -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)
index 26bcc87..f0b3fdc 100644 (file)
@@ -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}")