Calculates the difference map.

@return
14917
private WritableRaster netdif() {
        // get rows and cols from the active region
        HashMap<String, Double> regionMap = CoverageUtilities.getRegionParamsFromGridCoverage(inFlow);
        int cols = regionMap.get(CoverageUtilities.COLS).intValue();
        int rows = regionMap.get(CoverageUtilities.ROWS).intValue();

        int[] flow = new int[2];
        int[] oldflow = new int[2];

        RandomIter flowIter = CoverageUtilities.getRandomIterator(inFlow);
        RandomIter streamIter = CoverageUtilities.getRandomIterator(inStream);
        RandomIter rasterIter = CoverageUtilities.getRandomIterator(inRaster);
        int[][] dir = ModelsSupporter.DIR_WITHFLOW_ENTERING;

        // create new matrix
        double[][] segna = new double[cols][rows];

        pm.beginTask(msg.message("working") + "h.netdif", 3 * rows);
        // First step: It marks with 1 the points which are at the upstream
        // beginning
        // of a link or stream
        for( int j = 0; j < rows; j++ ) {
            for( int i = 0; i < cols; i++ ) {
                flow[0] = i;
                flow[1] = j;
                // looks for the source
                if (ModelsEngine.isSourcePixel(flowIter, flow[0], flow[1])) {
                    segna[i][j] = 1;
                } else if (!isNovalue(flowIter.getSampleDouble(i, j, 0)) && flowIter.getSampleDouble(i, j, 0) != 10.0) {
                    for( int k = 1; k <= 8; k++ ) {
                        if (flowIter.getSampleDouble(flow[0] + dir[k][1], flow[1] + dir[k][0], 0) == dir[k][2]) {
                            if (streamIter.getSampleDouble(flow[0] + dir[k][1], flow[1] + dir[k][0], 0) == streamIter
                                    .getSampleDouble(i, j, 0)) {
                                segna[i][j] = 0;
                                break;
                            } else {
                                segna[i][j] = 1;
                            }
                        }
                    }
                }
            }
            pm.worked(1);
        }
        WritableRaster diffImage = CoverageUtilities.createWritableRaster(cols, rows, null, inFlow.getRenderedImage()
                .getSampleModel(), null);
        WritableRandomIter diffIter = RandomIterFactory.createWritable(diffImage, null);
        // Second step: It calculate the difference among the first and the last
        // point of a link
        for( int j = 0; j < rows; j++ ) {
            for( int i = 0; i < cols; i++ ) {
                if (segna[i][j] > 0) {
                    flow[0] = i;
                    flow[1] = j;
                    oldflow[0] = i;
                    oldflow[1] = j;
                    if (!isNovalue(flowIter.getSampleDouble(flow[0], flow[1], 0))) {
                        // call go_downstream in FluidUtils
                        ModelsEngine.go_downstream(flow, flowIter.getSampleDouble(flow[0], flow[1], 0));
                        while( segna[flow[0]][flow[1]] < 1 && !isNovalue(flowIter.getSampleDouble(flow[0], flow[1], 0))
                                && flowIter.getSampleDouble(flow[0], flow[1], 0) != 10.0
                                && streamIter.getSampleDouble(flow[0], flow[1], 0) == streamIter.getSampleDouble(i, j, 0) ) {
                            oldflow[0] = flow[0];
                            oldflow[1] = flow[1];
                            if (!ModelsEngine.go_downstream(flow, flowIter.getSampleDouble(flow[0], flow[1], 0)))
                                return null;
                        }
                        diffIter.setSample(
                                i,
                                j,
                                0,
                                Math.abs(rasterIter.getSampleDouble(i, j, 0)
                                        - rasterIter.getSampleDouble(oldflow[0], oldflow[1], 0)));
                        // Assign to any point inside the link the value of the
                        // difference
                        flow[0] = i;
                        flow[1] = j;
                        if (!ModelsEngine.go_downstream(flow, flowIter.getSampleDouble(flow[0], flow[1], 0)))
                            return null;
                        while( !isNovalue(flowIter.getSampleDouble(flow[0], flow[1], 0))
                                && flowIter.getSampleDouble(flow[0], flow[1], 0) != 10.0
                                && streamIter.getSampleDouble(flow[0], flow[1], 0) == streamIter.getSampleDouble(i, j, 0) ) {
                            diffIter.setSample(flow[0], flow[1], 0, diffIter.getSampleDouble(i, j, 0));
                            if (!ModelsEngine.go_downstream(flow, flowIter.getSampleDouble(flow[0], flow[1], 0)))
                                return null;
                        }
                        if (flowIter.getSampleDouble(flow[0], flow[1], 0) == 10
                                && streamIter.getSampleDouble(flow[0], flow[1], 0) == streamIter.getSampleDouble(i, j, 0)) {
                            diffIter.setSample(flow[0], flow[1], 0, diffIter.getSampleDouble(i, j, 0));
                        }
                    }
                }
            }
            pm.worked(1);
        }
        for( int j = 0; j < rows; j++ ) {
            for( int i = 0; i < cols; i++ ) {
                if (isNovalue(streamIter.getSampleDouble(i, j, 0))) {
                    diffIter.setSample(i, j, 0, doubleNovalue);
                }
            }
            pm.worked(1);
        }
        pm.done();

        diffIter.done();
        flowIter.done();
        rasterIter.done();
        streamIter.done();
        return diffImage;
    }
7850
public static <E> Set<E> difference(Set<? extends E> s1, Set<? extends E> s2) {
      Set<E> copy1 = new HashSet<>(s1);
      copy1.removeAll(new HashSet<>(s2));
      return copy1;
   }
1373139
public Map<T, Double> getProbabilityMap() {
    Map<T, Double> probabilityMap = Maps.newHashMap();
    for (T item : counts.keySet()) {
      probabilityMap.put(item, getProbability(item));
    }
    return probabilityMap;
  }
1142102
public int[] diffCols(int[] filterThese) {
    HashSet<Integer> filter = new HashSet<>();
    for(int i:filterThese)filter.add(i);
    ArrayList<Integer> res = new ArrayList<>();
    for(int i=0;i<_cols.length;++i) {
      if( _cols[i]._ignored || _cols[i]._response || filter.contains(i) ) continue;
      res.add(i);
    }
    return intListToA(res);
  }
1009120
public double getRewardTotal() {
        double rewards = 0.0;
        for (Map.Entry<Integer, Float> entry : this.map.entrySet()) {
            rewards += entry.getValue();
        }
        return rewards;
    }
1140448
public static NumberList delta(Map<String, Object> currentMap, Map<String, Object> previousMap) {
        LinkedHashMap<String, Long> values = new LinkedHashMap<String, Long>(currentMap.size());
        if(currentMap.size() != previousMap.size()) {
            throw new IllegalArgumentException("Maps must have the same keys");
        }
        for (Entry<String, Object> k : currentMap.entrySet()) {
            Object v = k.getValue();
            Number current = getNumber(v);
            Object p = previousMap.get(k.getKey());
            Number previous = null;
            if (p == null) {
                previous = 0;
            } else {
                previous = getNumber(p);
            }

            long d = (current.longValue() - previous.longValue());
            values.put(k.getKey(), d);
        }

        return new NumberList(values);
    }
603658
public Map<Integer, Integer> getReverseNumericMap()
    {
        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
        for(int newIndex = 0; newIndex < numIndexMap.length; newIndex++)
            map.put(newIndex, numIndexMap[newIndex]);
        return map;
    }
9958
public JTSGeometryExpression<Geometry> difference(Expression<? extends Geometry> geometry) {
        return JTSGeometryExpressions.geometryOperation(SpatialOps.DIFFERENCE, mixin, geometry);
    }
788517
public TreeMap<Bits, Long> computeSums() {
    final TreeMap<Bits, Long> sums = new TreeMap<Bits, Long>();
    long total = 0;
    for (final Entry<Bits, AtomicInteger> e : this.map.entrySet()) {
      sums.put(e.getKey(), total += e.getValue().get());
    }
    return sums;
  }
325466
public Map<Integer, ClientAffinityStats> getAffinityStats()
    {
        Map<Integer, ClientAffinityStats> retval = new TreeMap<Integer, ClientAffinityStats>();
        for (Entry<Integer, ClientAffinityStats> e : m_currentAffinity.entrySet()) {
            if (m_baselineAffinity.containsKey(e.getKey())) {
                retval.put(e.getKey(), ClientAffinityStats.diff(e.getValue(), m_baselineAffinity.get(e.getKey())));
            }
            else {
                retval.put(e.getKey(), (ClientAffinityStats) e.getValue().clone());
            }
        }
        return retval;
    }
944860
@Override
	@Pure
	protected Rectangle2d calcBounds() {
		final Rectangle2d rect = new Rectangle2d();
		boolean first = true;
		Rectangle2d rs;
		for (final RoadSegment segment : getRoadSegments()) {
			rs = segment.getBoundingBox();
			if (rs != null && !rs.isEmpty()) {
				if (first) {
					first = false;
					rect.set(rs);
				} else {
					rect.setUnion(rs);
				}
			}
		}
		return first ? null : rect;
	}
293259
public static <T> List<T> difference(final List<? extends T> list1, final List<? extends T> list2) {
		final List<T> result = new ArrayList<T>(list1);
		final Iterator<? extends T> iterator = list2.iterator();

		while (iterator.hasNext()) {
			result.remove(iterator.next());
		}

		return result;
	}
792996
public int removeShapesNotWithinMap(GoogleMap map) {

        int count = 0;

        BoundingBox boundingBox = MapUtils.getBoundingBox(map);

        for (String database : databases.keySet()) {
            count += removeShapesNotWithinMap(boundingBox, database);
        }

        return count;
    }
788278
public int size() {
		int size = 0;
		for (List<V> value : map.values()) {
			size += value.size();
		}
		return size;
	}
516116
def difference(self, *iterables):
        
        diff = self._set.difference(*iterables)
        new_set = self.__class__(key=self._key, load=self._load, _set=diff)
        return new_set
318806
public double getMacroFMeasure()
    {
        Map<String, Double> fMeasureForLabels = getFMeasureForLabels();

        double totalFMeasure = 0;

        for (Double d : fMeasureForLabels.values()) {
            totalFMeasure += d;
        }

        return totalFMeasure / fMeasureForLabels.size();
    }
571240
public static IntSet differenceView (IntSet set1, IntSet set2)
    {
        return andView(set1, notView(set2));
    }