
from org.gvsig.fmap.dal.feature.impl import DefaultFeatureSelection as JDefaultFeatureSelection

class JavaIteratorWraper(object):
    def __init__(self, jiterator):
        self._jiterator = jiterator

    def next(self):
        if self._jiterator.hasNext():
            return self._jiterator.next()
        raise StopIteration()

def _features(self):
    return self.iterator()

def __iter(self):
    return JavaIteratorWraper(self.iterator())

def _getCount(self):
    return self.getSize()

def __len(self):
  return self.getSize()

def __call(self):
    return self

#
# Inject new methods in the class JDefaultFeatureSelection
#
JDefaultFeatureSelection.getCount = _getCount
JDefaultFeatureSelection.features = _features
JDefaultFeatureSelection.__iter__ = __iter
JDefaultFeatureSelection.__len__ = __len
JDefaultFeatureSelection.__call__ = __call