public MappedExampleSet(ExampleSet parent,int[] mapping,boolean useMappedExamples,boolean sort){
  this.parent=(ExampleSet)parent.clone();
  this.mapping=mapping;
  if (sort) {
    Arrays.sort(this.mapping);
  }
  if (!useMappedExamples) {
    List<Integer> inverseIndexList=new ArrayList<Integer>();
    int currentExample=-1;
    for (    int m : mapping) {
      if (m != currentExample) {
        for (int z=currentExample + 1; z < m; z++) {
          inverseIndexList.add(z);
        }
        currentExample=m;
      }
    }
    this.mapping=new int[inverseIndexList.size()];
    Iterator<Integer> i=inverseIndexList.iterator();
    int index=0;
    while (i.hasNext()) {
      this.mapping[index++]=i.next();
    }
  }
}

public MappedExampleSet ( ExampleSet parent , int [ ] mapping , boolean useMappedExamples , boolean sort ) { this . parent = ( ExampleSet ) parent . clone ( ) ; this . mapping = mapping ; if ( sort ) { Arrays . sort ( this . mapping ) ; } if ( ! useMappedExamples ) { List < Integer > inverseIndexList = new ArrayList < Integer > ( ) ; int currentExample = - 1 ; for ( int m : mapping ) { if ( m != currentExample ) { for ( int z = currentExample + 1 ; z < m ; z ++ ) { inverseIndexList . add ( z ) ; } currentExample = m ; } } this . mapping = new int [ inverseIndexList . size ( ) ] ; Iterator < Integer > i = inverseIndexList . iterator ( ) ; int index = 0 ; while ( i . hasNext ( ) ) { this . mapping [ index ++ ] = i . next ( ) ; } } }
constructs an example set based on the given mapping . if the boolean flag usemappedexamples is false only examples which are not part of the original mapping are used . if the boolean flag sort is false the mapping is used as is .
