コード例 #1
0
 public Delta(FeatureFactory factory, int start, int end, Instance segmentInstance) {
   for (Iterator<Feature> i = featureSet(start, end, segmentInstance).iterator();
       i.hasNext(); ) {
     Feature f = i.next();
     // replace the feature with its canonical version, so
     // that variant versions are not stored in the
     // deltaWeight, zeroWeights hash tables
     f = factory.getFeature(f);
     double segmentWeight = segmentInstance.getWeight(f);
     if (segmentWeight == 0) zeroWeights.add(f);
     else {
       double sumWeight = getSumWeight(start, end, f);
       if (segmentWeight != sumWeight) deltaWeight.put(f, segmentWeight - sumWeight);
     }
   }
   /*
    System.out.println("segmentInstance: "+segmentInstance);
    System.out.println("deltaInstance:   "+new DeltaInstance(start,end,this,
    segmentInstance.getSource(),
    segmentInstance.getSubpopulationId()));
   */
 }
コード例 #2
0
 private void addAll(Set<Feature> s, Iterator<Feature> i) {
   while (i.hasNext()) s.add(i.next());
 }