Inspects each density grid in grid_list whose attribute has changed since the last
call to adjustClustering. Implements lines 3/4/7/19 of the procedure given in Figure
4 of Chen and Tu 2007.

@return TRUE if any grids are updated; FALSE otherwise.
432849
private boolean inspectChangedGrids()
	{
		HashMap<DensityGrid, CharacteristicVector> glNew = new HashMap<DensityGrid, CharacteristicVector>();
		Iterator<Map.Entry<DensityGrid, CharacteristicVector>> gridIter = this.grid_list.entrySet().iterator();
		
		while (gridIter.hasNext() && glNew.isEmpty())
		{
			Map.Entry<DensityGrid, CharacteristicVector> grid = gridIter.next();
			DensityGrid dg = grid.getKey();
			CharacteristicVector cv = grid.getValue();
			int dgClass = cv.getLabel();
			
			if(cv.isAttChanged() && !dg.isVisited())
			{
				dg.setVisited(true);
				glNew.put(dg, cv);
				//System.out.print(dg.toString()+" is changed and now ");
				if (cv.getAttribute() == SPARSE)
					glNew.putAll(adjustForSparseGrid(dg, cv, dgClass));
				else if (cv.getAttribute() == DENSE)
					glNew.putAll(adjustForDenseGrid(dg, cv, dgClass));
				else	// TRANSITIONAL
					glNew.putAll(adjustForTransitionalGrid(dg, cv, dgClass));
			}
		}
		
		// If there are grids in glNew, update the corresponding grids in grid_list and clean up the cluster list
		if (!glNew.isEmpty())
		{
			//System.out.println("There are "+glNew.size()+" entries to update from glNew to grid_list.");
			this.grid_list.putAll(glNew);
			cleanClusters();
			return true;
		}
		else
			return false;
	}
1238993
private boolean hasSameStructure() {
        Object wrappedCollection = getWrappedValue();
        if (wrappedCollection == null) {
            return bufferedListModel.size() == 0;
        }
        else if (wrappedCollection instanceof Object[]) {
            Object[] wrappedArray = (Object[])wrappedCollection;
            if (wrappedArray.length != bufferedListModel.size()) {
                return false;
            }
            for (int i = 0; i < bufferedListModel.size(); i++) {
                if(super.hasValueChanged(wrappedArray[i], bufferedListModel.get(i))) {
                    return false;
                }
            }
        }
        else {
            if (((Collection)wrappedCollection).size() != bufferedListModel.size()) {
                return false;
            }
            for (Iterator i = ((Collection)wrappedCollection).iterator(), j = bufferedListModel.iterator(); i.hasNext();) {
                if (super.hasValueChanged(i.next(), j.next())) {
                    return false;
                }
            }
        }
        return true;
    }
934154
public void updateGrid(List<S> solutionList) {
    //Update lower and upper limits
    updateLimits(solutionList);

    //Calculate the division size
    for (int obj = 0; obj < numberOfObjectives; obj++) {
      divisionSize[obj] = gridUpperLimits[obj] - gridLowerLimits[obj];
    }

    //Clean the hypercubes
    for (int i = 0; i < hypercubes.length; i++) {
      hypercubes[i] = 0;
    }

    //Add the population
    addSolutionSet(solutionList);
  }
1315864
public boolean cchanged(String descriptor) {
		if (liveVersion != null) {
			boolean b = liveVersion.hasConstructorChanged(descriptor);
			return b;
		}
		return false;
	}
914568
private function hasAtLeastOneFilter()
    {
        $columns = $this->options[self::GRID_PARAM_COLUMNS];

        foreach ($columns as $column) {
            if (isset($column[self::GRID_PARAM_FILTER]) && $column[self::GRID_PARAM_FILTER] == true) {
                return true;
            }
        }

        return false;
    }
1277210
private void initialClustering() {
		//System.out.println("INITIAL CLUSTERING CALLED");
		//printDStreamState();
		// 1. Update the density of all grids in grid_list

		updateGridListDensity();
		//printGridList();
				
		// 2. Assign each dense grid to a distinct cluster
		// and
		// 3. Label all other grids as NO_CLASS	
		Iterator<Map.Entry<DensityGrid, CharacteristicVector>> glIter = this.grid_list.entrySet().iterator();
		HashMap<DensityGrid, CharacteristicVector> newGL = new HashMap<DensityGrid, CharacteristicVector>();
		
		while(glIter.hasNext())
		{
			Map.Entry<DensityGrid, CharacteristicVector> grid = glIter.next();
			DensityGrid dg = grid.getKey();
			CharacteristicVector cvOfG = grid.getValue();

			//System.out.print(dg.toString());
			if(cvOfG.getAttribute() == DENSE)
			{
				int gridClass = this.cluster_list.size();
				cvOfG.setLabel(gridClass);
				GridCluster gc = new GridCluster ((CFCluster)dg, new ArrayList<CFCluster>(), gridClass);
				gc.addGrid(dg);
				this.cluster_list.add(gc);
				//System.out.print(" was dense (class "+gridClass+")");
			}
			else
				cvOfG.setLabel(NO_CLASS);

			//System.out.println();
			newGL.put(dg, cvOfG);
		}

		this.grid_list = newGL;
		//printGridClusters();
		
		// 4. Make changes to grid labels by doing:
		//    a. For each cluster c
		//    b. For each outside grid g of c
		//    c. For each neighbouring grid h of g
		//    d. If h belongs to c', label c and c' with 
		//       the label of the largest cluster
		//    e. Else if h is transitional, assign it to c
		//    f. While changes can be made

		boolean changesMade;

		do{	
			changesMade = adjustLabels();
		}while(changesMade);	// while changes are being made
		
		//printGridList();
		//printGridClusters();
	}
361575
public boolean isDeleted() {
        boolean deleted = true;
        for (PolygonMarkers polygon : polygonMarkers) {
            deleted = polygon.isDeleted();
            if (!deleted) {
                break;
            }
        }
        return deleted;
    }
869783
private void cleanClusters()
	{
		//System.out.println("Clean Clusters");
		Iterator<GridCluster> clusIter = this.cluster_list.iterator();
		ArrayList<GridCluster> toRem = new ArrayList<GridCluster>();

		// Check to see if there are any empty clusters
		while(clusIter.hasNext())
		{
			GridCluster c = clusIter.next();

			if(c.getWeight() == 0)
				toRem.add(c);
		}

		// Remove empty clusters
		if (!toRem.isEmpty())
		{
			clusIter = toRem.iterator();

			while(clusIter.hasNext())
			{
				this.cluster_list.remove(clusIter.next());
			}
		}

		// Adjust remaining clusters as necessary
		clusIter = this.cluster_list.iterator();

		while(clusIter.hasNext())
		{
			GridCluster c = clusIter.next();
			int index = this.cluster_list.indexOf(c);

			c.setClusterLabel(index);
			this.cluster_list.set(index, c);

			Iterator<Map.Entry<DensityGrid, Boolean>> gridsOfClus = c.getGrids().entrySet().iterator();

			while(gridsOfClus.hasNext())
			{
				DensityGrid dg = gridsOfClus.next().getKey();
				CharacteristicVector cv = this.grid_list.get(dg);
				if(cv == null)
				{
					System.out.println("Warning, cv is null for "+dg.toString()+" from cluster "+index+".");
					printGridList();
					printGridClusters();
				}
				//System.out.println("Cluster "+index+": "+dg.toString()+" is here.");
				cv.setLabel(index);
				this.grid_list.put(dg, cv);
			}
		}
	}
929562
private boolean hasChanges(final Map<URI, URI> changeTable) {
        if (changeTable.isEmpty()) {
            return false;
        }
        for (Map.Entry<URI, URI> e : changeTable.entrySet()) {
            if (!e.getKey().equals(e.getValue())) {
                return true;
            }
        }
        return false;
    }
279720
private boolean checkAllRingAtomsHasCoordinates(IAtomContainer ac) {
        for (int i = 0; i < ac.getAtomCount(); i++) {
            if (ac.getAtom(i).getPoint3d() != null && ac.getAtom(i).getFlag(CDKConstants.ISINRING)) {
            } else if (!ac.getAtom(i).getFlag(CDKConstants.ISINRING)) {
            } else {
                return false;
            }
        }
        return true;
    }
841806
static boolean isClusterCandidate_(double x_1, double y1, double x2,
			double y2, double sqr_tolerance) {
		double dx = x_1 - x2;
		double dy = y1 - y2;
		return dx * dx + dy * dy <= sqr_tolerance;
	}
1212574
@Override
	public void trainOnInstanceImpl(Instance inst) {
		
		//System.out.print("Dstream.trainOnInstanceImpl (");
		int[]g;
		DensityGrid dg;
		CharacteristicVector cv;
		boolean recalculateN = false;	// flag indicating whether N needs to be recalculated after this instance

		// 1. Read record x = (x1,x2,...,xd)
		//printInst(inst);
		//System.out.println(") time "+this.getCurrTime());
		// Passed Instance inst
		if (!this.initialized)
		{
			//System.out.println("Not yet initialized");
			this.d = inst.numAttributes();
			//System.out.println("d = "+this.d);
			this.minVals = new int[this.d];
			this.maxVals = new int[this.d];
			//System.out.println("...data initialized");
			
			for(int i = 0 ; i < this.d ; i++)
			{
				//System.out.print(i+" ");
				if (inst.attribute(i).isNumeric())
				{
					maxVals[i] = (int) inst.value(i);
					minVals[i] = (int) inst.value(i);
				}
			}
			//System.out.println("...arrays initialized");
			recalculateN = true;
			this.initialized = true;
			//System.out.println("...boolean values initialized");
			//System.out.print("Grid list is: ");
			//printGridList();
		}		

		// 2. Determine the density grid g that contains x
		//System.out.print(" & Step 2 ");
		g = new int[this.d];

		for (int i = 0 ; i < this.d ; i++)
		{
			if (inst.attribute(i).isNumeric())
			{
				g[i] = (int) inst.value(i);
				if (g[i] > maxVals[i])
				{
					maxVals[i] = g[i];
					recalculateN = true;
				}
				else if (g[i] < minVals[i])
				{
					minVals[i] = g[i];
					recalculateN = true;
				}
			}
			else
			{
				g[i] = (int) inst.value(i);
			}
		}

		if (recalculateN)
		{
			//System.out.print(" recalculateN:");
			int n = 1;
			for (int i = 0 ; i < this.d ; i++)
			{
				//System.out.print(" "+n);
				if (inst.attribute(i).isNominal())
					n = n * inst.attribute(i).numValues();
				else
					n = n * (3+maxVals[i]-minVals[i]);
			}
			//System.out.print(" "+n);
			this.N = n;
			this.dl = this.cl/(this.N * (1.0 - this.decayFactor));
			this.dm = this.cm/(this.N * (1.0 - this.decayFactor));
			//System.out.print(" dl = " + this.dl + ", dm = " + this.dm);
			
			//Calculate the value for gap using the method defined in eq 26 of Chen and Tu 2007 
			double optionA = this.cl/this.cm;
			double optionB = ((double)this.N-this.cm)/((double)this.N-this.cl);
			gap = (int)Math.floor(Math.log(Math.max(optionA, optionB))/Math.log(this.getDecayFactor()));
			// Ensure that gap is not zero (i.e. if the procedure to calculate gap rounds down to zero, then set gap to 1 and adjust clustering every instance)
			if(gap == 0)
			{
				gap = 1;
			}
			//System.out.println(" A is "+optionA+", B is "+optionB+" and gap = "+gap);
		}

		dg = new DensityGrid(g);
		//System.out.println(dg.toString());
		
		// 3. If (g not in grid_list) insert dg to grid_list
		//System.out.println(" & Step 3 or 4");
		
		if(!this.grid_list.containsKey(dg))
		{
			//System.out.print("3 - dg wasn't in grid_list!");
			if(this.deleted_grids.containsKey(dg))
			{
				//System.out.print(" but it was in deleted_grids!");
				cv = new CharacteristicVector(this.getCurrTime(), this.deleted_grids.get(dg).intValue(), 1.0, -1, false, this.getDL(), this.getDM());
				this.deleted_grids.remove(dg);
			}
			else
				cv = new CharacteristicVector(this.getCurrTime(), -1, 1.0, -1, false, this.getDL(), this.getDM());
			
			this.grid_list.put(dg, cv);
			//System.out.print(" "+dg.toString()+" "+cv.toString());
			//System.out.println(" The size of grid_list is now "+grid_list.size());
		}
		// 4. Update the characteristic vector of dg
		else
		{
			//System.out.print("4 - dg was in grid_list!");
			cv = this.grid_list.get(dg);
				
			cv.densityWithNew(this.getCurrTime(), this.getDecayFactor());
				
			cv.setUpdateTime(this.getCurrTime());
		
			//System.out.println(" "+dg.toString()+" "+cv.toString());
		
			grid_list.put(dg, cv);
		}

		// 5. If tc == gap, then initial clustering
		// and
		// 6. If tc mod gap == 0, then:
		//    a. Detect and remove sporadic grids from grid_list
		//    b. Adjust clustering
		//System.out.println("\nCurrent Time is " + this.getCurrTime() + " and gap is " + this.gap);
		if (this.getCurrTime() != 0 && this.getCurrTime() % gap == 0)
		{
			if (this.getCurrTime() == gap)
			{
				//System.out.print(" & Step 5 x6x");
				this.initialClustering();
			}
			else
			{
				//System.out.print(" & Step x5x 6");
				this.removeSporadic();
				this.adjustClustering();
			}
		}

		// 7. Increment tc
		//System.out.println(" & Step 7");
		this.incCurrTime();

	}
714044
public boolean isModified()
  {
    I instance = _instance;

    if (instance == null) {
      return true;
    }
    
    if (DeployMode.MANUAL.equals(_strategy.redeployMode())) {
      return false;
    }
    
    return instance.isModified();
  }
234279
@Override
  public boolean isModified()
  {
    long now = CurrentTime.currentTime();
    long lastCheckTime = _lastCheckTime.get();
    
    if (now <= lastCheckTime + _checkInterval) {
      return _isModified;
    }

    if (! _lastCheckTime.compareAndSet(lastCheckTime, now)) {
      return _isModified;
    }

    if (isModifiedImpl()) {
      _isModified = true;
      //_lastCheckTime.set(0);
    }
    else {
      _isModified = false;
    }

    return _isModified;
  }
107514
public boolean[] getModified()
    {
        int iFieldCount = this.getFieldCount();  // BaseField Count
        boolean[] rgbModified = new boolean[iFieldCount];
        for (int iFieldSeq = DBConstants.MAIN_FIELD; iFieldSeq < iFieldCount + DBConstants.MAIN_FIELD; iFieldSeq++)
        {
            BaseField field = this.getField(iFieldSeq);
            rgbModified[iFieldSeq] = field.isModified();
        }
        return rgbModified;
    }
155772
public boolean hasChanges() {
        for (Map.Entry<Object, DocumentInfo> entity : documentsByEntity.entrySet()) {
            ObjectNode document = entityToJson.convertEntityToJson(entity.getKey(), entity.getValue());
            if (entityChanged(document, entity.getValue(), null)) {
                return true;
            }
        }

        return !deletedEntities.isEmpty();
    }
1371327
public boolean isChanged() {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "isChanged");
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "isChanged",  changed);
    return changed;
  }