コード例 #1
0
  @Override
  public Iterable<VertexPair> getClusterResolutions() {
    // System.out.println(topClusterLength+ " "+getTopVertex());
    // TODO: return an iterator directly instead of building a collection.
    ArrayList<VertexPair> ret = new ArrayList<VertexPair>();
    /*Iterable<VertexPair> r= new Iterable<IClusterCollection.VertexPair>() {

    	@Override
    	public Iterator<VertexPair> iterator() {

    		return new Iterator<VertexPair>() {

    			@Override
    			public boolean hasNext() {
    				// TODO Auto-generated method stub
    				return false;
    			}

    			@Override
    			public VertexPair next() {
    				// TODO Auto-generated method stub
    				return null;
    			}

    			@Override
    			public void remove() {
    				throw new UnsupportedOperationException();
    			}
    		};
    	}
    };*/

    int clusterSize = topClusterLength;
    Vertex v = this.getTopVertex();
    for (int i = 1; i <= (clusterSize / 2); i++) {
      Set<Vertex> left = this.clusters.get(i);
      if (left == null || left.size() == 0) {
        continue;
      }
      Set<Vertex> right = this.clusters.get(clusterSize - i);
      if (right == null || right.size() == 0) {
        continue;
      }
      for (Vertex smallV : left) {

        for (Vertex bigv : right) {
          if (!smallV.getCluster().isDisjoint(bigv.getCluster())) {
            continue;
          }
          VertexPair bi = new VertexPair(smallV, bigv, v);
          ret.add(bi);
        }
      }
    }
    return ret;
  }
コード例 #2
0
  @Override
  public IClusterCollection getContainedClusters(Vertex v) {
    STITreeCluster cluster = v.getCluster();
    int size = cluster.getClusterSize();
    AbstractClusterCollection ret = newInstance(size);
    addClusterToRet(v, size, ret);

    for (int i = size - 1; i > 0; i--) {
      Set<Vertex> sizeClusters = clusters.get(i);
      if (sizeClusters == null) continue;
      for (Vertex vertex : sizeClusters) {
        if (cluster.containsCluster(vertex.getCluster())) {
          addClusterToRet(vertex, i, ret);
        }
      }
    }
    return ret;
  }
コード例 #3
0
 @Override
 public boolean contains(Vertex vertex) {
   return clusters.get(vertex.getCluster().getClusterSize()).contains(vertex);
 }