/* * Determines whether one cluster subsumes another */ public bool subsumes(Cluster other) { var thisClusterRoots = this.getRootQueries(); var OtherClusterRoots = other.getRootQueries(); //if both clusters are in the same configuration if (this.clusterTier == other.clusterTier) { return((other.clusterMax >= this.clusterMin && other.clusterMax <= this.clusterMax) || (other.clusterMin <= this.clusterMax && other.clusterMin >= this.clusterMax)); } else { if (this.clusterTier < other.clusterTier) { //if other cluster is within bounds if (other.clusterMin >= this.clusterIntervalLow && other.clusterMax <= this.clusterIntervalHigh) { /*comparison of queries from both clusters, if flagged then "this" cluster does not subsume "other"*/ foreach (var otherRoot in OtherClusterRoots) { bool subsumed = false; foreach (var thisRoot in thisClusterRoots) { if (thisRoot.SubsumesOrEqual(otherRoot)) { subsumed = true; } } if (!subsumed) { return(false); } } return(true); } else //not within bounds { return(false); } } else //this cluster config is larger { return(false); } } }
/* * Determines whether one cluster subsumes another */ public bool subsumes(Cluster other) { var thisClusterRoots = this.getRootQueries(); var OtherClusterRoots = other.getRootQueries(); //if both clusters are in the same configuration if (this.clusterTier == other.clusterTier) { return ((other.clusterMax >= this.clusterMin && other.clusterMax <= this.clusterMax) || (other.clusterMin <= this.clusterMax && other.clusterMin >= this.clusterMax)); } else { if (this.clusterTier < other.clusterTier) { //if other cluster is within bounds if (other.clusterMin >= this.clusterIntervalLow && other.clusterMax <= this.clusterIntervalHigh) { /*comparison of queries from both clusters, if flagged then "this" cluster does not subsume "other"*/ foreach (var otherRoot in OtherClusterRoots) { bool subsumed = false; foreach (var thisRoot in thisClusterRoots) { if (thisRoot.SubsumesOrEqual(otherRoot)) { subsumed = true; } } if (!subsumed) return false; } return true; } else //not within bounds { return false; } } else //this cluster config is larger { return false; } } }