Class SimpleAdapter

  • All Implemented Interfaces:
    ScoreEvaluation.Adapter, Iter

    public class SimpleAdapter
    extends java.lang.Object
    implements ScoreEvaluation.Adapter
    This adapter can be used for an arbitrary collection of DBIDs, and does hence not have a notion of ties.

    Note that of course, no id should occur more than once.

    Since:
    0.7.0
    Author:
    Erich Schubert
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private DBIDIter iter
      Original Iterator
      private DBIDs set
      Set of positive examples.
      private int size
      Number of IDs
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      SimpleAdapter advance()
      Moves the iterator forward to the next entry.
      int numPositive()
      Return the number of positive ids.
      int numTotal()
      Return the number of all ids.
      boolean test()
      True if the current object is a positive example.
      boolean tiedToPrevious()
      Test whether the score is the same as the previous objects score.
      boolean valid()
      Returns true if the iterator currently points to a valid object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • set

        private DBIDs set
        Set of positive examples.
      • iter

        private DBIDIter iter
        Original Iterator
      • size

        private int size
        Number of IDs
    • Constructor Detail

      • SimpleAdapter

        public SimpleAdapter​(DBIDs set,
                             DBIDIter iter,
                             int size)
        Constructor
        Parameters:
        set - Set of positive examples
        iter - Iterator for object IDs
        size - Number of IDs
    • Method Detail

      • valid

        public boolean valid()
        Description copied from interface: Iter
        Returns true if the iterator currently points to a valid object.
        Specified by:
        valid in interface Iter
        Returns:
        a boolean value, whether the position is valid.
      • advance

        public SimpleAdapter advance()
        Description copied from interface: Iter
        Moves the iterator forward to the next entry.
        Specified by:
        advance in interface Iter
        Returns:
        The iterator itself.
      • tiedToPrevious

        public boolean tiedToPrevious()
        Description copied from interface: ScoreEvaluation.Adapter
        Test whether the score is the same as the previous objects score. When there is no previous result, implementations should return false!
        Specified by:
        tiedToPrevious in interface ScoreEvaluation.Adapter
        Returns:
        Boolean