Exemple #1
0
 def __getitem__(self, ndx):
     if isinstance(ndx, slice):
         start, stop, step = ndx.indices(len(self))
         if step != 1:
             raise RuntimeError("Slicing with step unimplemented")
         return self.__getslice__(start, stop)
     return _jpype.getArrayItem(self.__javaobject__, ndx)
Exemple #2
0
 def __getitem__(self, ndx):
     if isinstance(ndx, slice):
         start, stop, step = ndx.indices(len(self))
         if step != 1:
             raise RuntimeError("Slicing with step unimplemented")
         return self.__getslice__(start, stop)
     return _jpype.getArrayItem(self.__javaobject__, ndx)
    def __getitem__(self, ndx):
        if type(ndx) is not slice:
            # Simple index
            return _jpype.getArrayItem(self.__javaobject__, ndx)

        # Slice
        start = ndx.start if ndx.start is not None else 0
        stop = ndx.stop if ndx.stop is not None else 0

        if stop >= start and ndx.step in (None, 1):
            # Normal slice
            return _jpype.getArraySlice(self.__javaobject__, start, stop)
        else:
            # Complex slice
            start, stop, step = ndx.indices(self.__len__())
            return [_jpype.getArrayItem(self.__javaobject__, index)
                    for index in range(start, stop, step)]
Exemple #4
0
    def __getitem__(self, ndx):
        if type(ndx) is not slice:
            # Simple index
            return _jpype.getArrayItem(self.__javaobject__, ndx)

        # Slice
        start = ndx.start if ndx.start is not None else 0
        stop = ndx.stop if ndx.stop is not None else 0

        if stop >= start and ndx.step in (None, 1):
            # Normal slice
            return _jpype.getArraySlice(self.__javaobject__, start, stop)
        else:
            # Complex slice
            start, stop, step = ndx.indices(self.__len__())
            return [
                _jpype.getArrayItem(self.__javaobject__, index)
                for index in range(start, stop, step)
            ]
	def __getitem__(self, ndx ) : 
		return _jpype.getArrayItem(self.__javaobject__, ndx)
Exemple #6
0
 def __getitem__(self, ndx):
     return _jpype.getArrayItem(self.__javaobject__, ndx)