From d11b4c06cc1b6bd2c5ad604c8e49f9db477a668f Mon Sep 17 00:00:00 2001 From: Erickson Silva Date: Sat, 31 Jan 2015 11:06:40 -0300 Subject: [PATCH] Adiciona metodo 'getInterval' no Iterator --- src/new/Iterator.py | 5 +++++ 1 file changed, 5 insertions(+), 0 deletions(-) diff --git a/src/new/Iterator.py b/src/new/Iterator.py index 4ad4258..5fd4178 100644 --- a/src/new/Iterator.py +++ b/src/new/Iterator.py @@ -13,6 +13,7 @@ class Iterator(object): self.count = -1 def load(self, lista): + self.reset() self.__list = list(lista); self.size = len(lista) @@ -47,6 +48,10 @@ class Iterator(object): def getAntT(self): return self.getToken("-")[1] + def getinterval(self, n): + if self.count+n > self.size: raise IndexError + return self.__list[self.count:self.count+n] + def hasNext(self): if(self.count < self.size-1): self.count += 1 -- libgit2 0.21.2