private void mousePressedInFoldingArea(MouseEvent e) {
   for (Iterator<AbstractFoldingAreaPainter> it = myFoldingAreaPainters.descendingIterator();
       it.hasNext(); ) {
     AbstractFoldingAreaPainter painter = it.next();
     painter.mousePressed(e);
     if (e.isConsumed()) {
       break;
     }
   }
 }
 @SuppressWarnings("EmptyCatchBlock")
 static void ensureNotDirectlyModifiable(NavigableSet<Integer> unmod) {
   try {
     unmod.add(4);
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     unmod.remove(4);
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     unmod.addAll(Collections.singleton(4));
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     unmod.pollFirst();
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     unmod.pollLast();
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     Iterator<Integer> iterator = unmod.iterator();
     iterator.next();
     iterator.remove();
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     Iterator<Integer> iterator = unmod.descendingIterator();
     iterator.next();
     iterator.remove();
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
 }
Example #3
0
 @GwtIncompatible("NavigableSet")
 void ensureNotDirectlyModifiable(NavigableSet<Integer> unmod) {
   try {
     unmod.add(4);
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     unmod.remove(4);
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     unmod.addAll(Collections.singleton(4));
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     unmod.pollFirst();
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     unmod.pollLast();
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     Iterator<Integer> iterator = unmod.iterator();
     iterator.next();
     iterator.remove();
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     Iterator<Integer> iterator = unmod.descendingIterator();
     iterator.next();
     iterator.remove();
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
 }
Example #4
0
  public void setClusters(Set<SemiClusterDetails> clusters, int graphJobVertexMaxClusterCount) {
    int clusterCountToBeRemoved = 0;
    NavigableSet<SemiClusterDetails> setSort =
        new TreeSet<SemiClusterDetails>(
            new Comparator<SemiClusterDetails>() {

              @Override
              public int compare(SemiClusterDetails o1, SemiClusterDetails o2) {
                return (o1.getSemiClusterScore() == o2.getSemiClusterScore()
                    ? 0
                    : o1.getSemiClusterScore() < o2.getSemiClusterScore() ? -1 : 1);
              }
            });
    setSort.addAll(this.semiClusterContainThis);
    setSort.addAll(clusters);
    clusterCountToBeRemoved = setSort.size() - graphJobVertexMaxClusterCount;
    Iterator<SemiClusterDetails> itr = setSort.descendingIterator();
    while (clusterCountToBeRemoved > 0) {
      itr.next();
      itr.remove();
      clusterCountToBeRemoved--;
    }
    this.semiClusterContainThis = setSort;
  }
Example #5
0
 /**
  * Clear the data out of version window & write them to the second lowest version.
  *
  * @param commit
  * @param versions
  * @param r
  * @param row
  * @param isDelete
  * @param commitId
  * @param startId
  * @param lockId
  * @return
  * @throws IOException
  */
 @SuppressWarnings("deprecation")
 private boolean addClearColumns(
     Put commit,
     List<KeyValue> versions,
     Result r,
     byte[] row,
     boolean isDelete,
     long commitId,
     long startId,
     Integer lockId)
     throws IOException {
   KeyValue commitKV =
       new KeyValue(
           row,
           DominoConst.INNER_FAMILY,
           DominoConst.VERSION_COL,
           commitId,
           DominoConst.versionValue(startId, isDelete));
   NavigableSet<KeyValue> orderedVersions = new TreeSet<KeyValue>(MVCC.VERSION_KV_COMPARATOR);
   orderedVersions.add(versions.get(versions.size() - 1));
   if (versions.size() >= 2) {
     orderedVersions.add(versions.get(versions.size() - 2));
   }
   orderedVersions.add(commitKV);
   Iterator<KeyValue> it = orderedVersions.descendingIterator();
   KeyValue remove = it.next();
   KeyValue prev = it.next();
   byte[] removeValue = remove.getValue();
   byte[] prevValue = prev.getValue();
   long removeCommitId = remove.getTimestamp();
   long removeStartId = DominoConst.getVersion(removeValue);
   long prevStartId = DominoConst.getVersion(prevValue);
   boolean isFresh = (removeCommitId != commitId);
   Columns removeCols = new Columns(DominoConst.getColumnsAt(r, removeStartId));
   if (!DominoConst.isDeleteVersion(removeValue) && !DominoConst.isDeleteVersion(prevValue)) {
     Columns prevCols = new Columns(DominoConst.getColumnsAt(r, prevStartId));
     Get get = new Get(row);
     get.setTimeStamp(removeStartId);
     Result res = region.get(get, lockId);
     for (Column col : removeCols.cols) {
       if (prevCols.contains(col.family, col.qualifier)) {
         continue; // a newer value
       }
       // merge it
       byte[] value = res.getValue(col.family, col.qualifier);
       prevCols.add(col.family, col.qualifier);
       commit.add(col.family, col.qualifier, prevStartId, value);
     }
     commit.add(
         DominoConst.INNER_FAMILY, DominoConst.COLUMNS_COL, prevStartId, prevCols.toByteArray());
   }
   if (isFresh) {
     commit.add(
         new KeyValue(
             row,
             DominoConst.INNER_FAMILY,
             DominoConst.VERSION_COL,
             removeCommitId,
             KeyValue.Type.Delete));
   }
   commit.add(
       new KeyValue(
           row,
           DominoConst.INNER_FAMILY,
           DominoConst.COLUMNS_COL,
           removeStartId,
           KeyValue.Type.Delete));
   for (Column col : removeCols.cols) {
     commit.add(new KeyValue(row, col.family, col.qualifier, removeStartId, KeyValue.Type.Delete));
   }
   return isFresh;
 }