예제 #1
0
 /** Returns the intersection of two enumsets */
 public static <E extends Enum<E>> EnumSet<E> intersection(EnumSet<E> s1, EnumSet<E> s2) {
   // We have to clone, since retainAll modifies the set
   EnumSet<E> s = s1.clone();
   s.retainAll(s2);
   // I tried coding this for arbitrary sets, but it failed because
   // the interface Cloneable does not make sure that the clone-method
   // is visible (!)
   return (s);
 }
예제 #2
0
  private byte[] negotiate(ExtendedNegotiation exneg, TransferCapability tc) {
    if (exneg == null) return null;

    StorageOptions storageOptions = tc.getStorageOptions();
    if (storageOptions != null) return storageOptions.toExtendedNegotiationInformation();

    EnumSet<QueryOption> queryOptions = tc.getQueryOptions();
    if (queryOptions != null) {
      EnumSet<QueryOption> commonOpts = QueryOption.toOptions(exneg);
      commonOpts.retainAll(queryOptions);
      return QueryOption.toExtendedNegotiationInformation(commonOpts);
    }
    return null;
  }
예제 #3
0
  @Override
  public void sceneSelectionChanged(final SceneSelectionChangeEvent event) {
    EnumSet<SelectionMode> supportedModes = null;
    if (event.getSelectedNodes().isEmpty()) {
      supportedModes = EnumSet.of(SelectionMode.OBJECT);
    } else {
      supportedModes = EnumSet.allOf(SelectionMode.class);

      for (final INode node : event.getSelectedNodes()) {
        supportedModes.retainAll(node.getSupportedSelectionModes());
      }
    }

    objectSelection.setEnabled(supportedModes.contains(SelectionMode.OBJECT));
    faceSelection.setEnabled(supportedModes.contains(SelectionMode.FACE));
    edgeSelection.setEnabled(supportedModes.contains(SelectionMode.EDGE));
    vertexSelection.setEnabled(supportedModes.contains(SelectionMode.VERTEX));
  }