コード例 #1
0
ファイル: StorageNodeTest.java プロジェクト: srgg/yads
  @Test
  public void rejectAllStorageOperationsBeingInInappropriateState() throws Exception {

    // -- generate list of "inappropriate" states
    final List<String> states = new LinkedList<>();
    final EnumSet<StorageNode.StorageState> allowedStates =
        EnumSet.of(StorageNode.StorageState.RECOVERING, StorageNode.StorageState.RUNNING);

    for (StorageNode.StorageState s : StorageNode.StorageState.values()) {
      if (!allowedStates.contains(s)) {
        states.add(s.name());
      }
    }

    // --
    for (String s : states) {
      if (!node.getState().equals(s)) {
        manageNode(new ControlMessage.Builder().setState(s));
      }

      assertEquals(s, node.getState());

      for (StorageOperation op : allOperations) {
        // TODO: rewrite with Exception Matcher to introduce message checking
        try {
          node.onStorageRequest(op);
          fail();
        } catch (IllegalStateException ex) {
        }
      }
    }
  }
コード例 #2
0
ファイル: WAxisSliderWidget.java プロジェクト: sebap/jwt
 private void init() {
   this.transform_ = this.createJSTransform();
   this.mouseWentDown()
       .addListener("function(o, e){var o=" + this.getSObjJsRef() + ";if(o){o.mouseDown(o, e);}}");
   this.mouseWentUp()
       .addListener("function(o, e){var o=" + this.getSObjJsRef() + ";if(o){o.mouseUp(o, e);}}");
   this.mouseDragged()
       .addListener("function(o, e){var o=" + this.getSObjJsRef() + ";if(o){o.mouseDrag(o, e);}}");
   this.mouseMoved()
       .addListener(
           "function(o, e){var o=" + this.getSObjJsRef() + ";if(o){o.mouseMoved(o, e);}}");
   this.touchStarted()
       .addListener(
           "function(o, e){var o=" + this.getSObjJsRef() + ";if(o){o.touchStarted(o, e);}}");
   this.touchEnded()
       .addListener(
           "function(o, e){var o=" + this.getSObjJsRef() + ";if(o){o.touchEnded(o, e);}}");
   this.touchMoved()
       .addListener(
           "function(o, e){var o=" + this.getSObjJsRef() + ";if(o){o.touchMoved(o, e);}}");
   this.setSelectionAreaPadding(0, EnumSet.of(Side.Top));
   this.setSelectionAreaPadding(20, EnumSet.of(Side.Left, Side.Right));
   this.setSelectionAreaPadding(30, EnumSet.of(Side.Bottom));
   if (this.chart_ != null) {
     this.chart_.addAxisSliderWidget(this);
   }
 }
コード例 #3
0
ファイル: DistCp.java プロジェクト: neutronsharc/hdfsbackup
  private static void finalize(
      Configuration conf, JobConf jobconf, final Path destPath, String presevedAttributes)
      throws IOException {
    if (presevedAttributes == null) {
      return;
    }
    EnumSet<FileAttribute> preseved = FileAttribute.parse(presevedAttributes);
    if (!preseved.contains(FileAttribute.USER)
        && !preseved.contains(FileAttribute.GROUP)
        && !preseved.contains(FileAttribute.PERMISSION)) {
      return;
    }

    FileSystem dstfs = destPath.getFileSystem(conf);
    Path dstdirlist = new Path(jobconf.get(DST_DIR_LIST_LABEL));
    SequenceFile.Reader in = null;
    try {
      in = new SequenceFile.Reader(dstdirlist.getFileSystem(jobconf), dstdirlist, jobconf);
      Text dsttext = new Text();
      FilePair pair = new FilePair();
      for (; in.next(dsttext, pair); ) {
        Path absdst = new Path(destPath, pair.output);
        updatePermissions(pair.input, dstfs.getFileStatus(absdst), preseved, dstfs);
      }
    } finally {
      checkAndClose(in);
    }
  }
コード例 #4
0
ファイル: TestStandardVar.java プロジェクト: kenkyu/thredds
  public void testEnhanceDefer() throws IOException {
    NetcdfDataset ncd =
        NetcdfDataset.openDataset(
            filename, EnumSet.of(NetcdfDataset.Enhance.ScaleMissing), -1, null, null);
    VariableDS enhancedVar = (VariableDS) ncd.findVariable("t1");

    NetcdfDataset ncdefer =
        NetcdfDataset.openDataset(
            filename, EnumSet.of(NetcdfDataset.Enhance.ScaleMissingDefer), -1, null, null);
    VariableDS deferVar = (VariableDS) ncdefer.findVariable("t1");

    Array data = enhancedVar.read();
    Array dataDefer = deferVar.read();

    System.out.printf("Enhanced=");
    NCdumpW.printArray(data);
    System.out.printf("%nDeferred=");
    NCdumpW.printArray(dataDefer);
    System.out.printf("%nProcessed=");

    CompareNetcdf2 nc = new CompareNetcdf2(new Formatter(System.out), false, false, true);
    assert !nc.compareData(enhancedVar.getShortName(), data, dataDefer, false);

    IndexIterator ii = dataDefer.getIndexIterator();
    while (ii.hasNext()) {
      double val = deferVar.convertScaleOffsetMissing(ii.getDoubleNext());
      ii.setDoubleCurrent(val);
    }
    NCdumpW.printArray(dataDefer);

    assert nc.compareData(enhancedVar.getShortName(), data, dataDefer, false);

    ncd.close();
    ncdefer.close();
  }
コード例 #5
0
ファイル: SickBeard.java プロジェクト: Buttink/nzbOne
  public boolean showSetQuality(
      String tvdbid, EnumSet<Show.Quality> initial, EnumSet<Show.Quality> archive)
      throws Exception {
    StringBuilder builder = new StringBuilder("show.setquality");
    builder.append("&tvdbid=");
    builder.append(tvdbid);
    if (initial != null) {
      builder.append("&initial=");
      Iterator<Quality> iter = initial.iterator();
      if (iter.hasNext()) {
        builder.append(iter.next().toString().toLowerCase());
        while (iter.hasNext()) {
          builder.append("|");
          builder.append(iter.next().toString().toLowerCase());
        }
      }
    }
    if (archive != null) {
      builder.append("&archive=");
      Iterator<Quality> iter = archive.iterator();
      if (iter.hasNext()) {
        builder.append(iter.next().toString().toLowerCase());
        while (iter.hasNext()) {
          builder.append("|");
          builder.append(iter.next().toString().toLowerCase());
        }
      }
    }

    return this.<Object>commandSuccessful(
        builder.toString(), new TypeToken<JsonResponse<Object>>() {}.getType());
  }
コード例 #6
0
  @Override
  public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    if (in.getVersion().before(Version.V_1_4_0)) {
      // term vector used to read & write the index twice, here and in the parent class
      in.readString();
    }
    type = in.readString();
    id = in.readString();

    if (in.getVersion().onOrAfter(Version.V_1_4_0)) {
      if (in.readBoolean()) {
        doc = in.readBytesReference();
      }
    }
    routing = in.readOptionalString();
    preference = in.readOptionalString();
    long flags = in.readVLong();

    flagsEnum.clear();
    for (Flag flag : Flag.values()) {
      if ((flags & (1 << flag.ordinal())) != 0) {
        flagsEnum.add(flag);
      }
    }
    int numSelectedFields = in.readVInt();
    if (numSelectedFields > 0) {
      selectedFields = new HashSet<>();
      for (int i = 0; i < numSelectedFields; i++) {
        selectedFields.add(in.readString());
      }
    }
  }
コード例 #7
0
 /**
  * Helper method that can be used to dynamically figure out enumeration type of given {@link
  * EnumSet}, without having access to its declaration. Code is needed to work around design flaw
  * in JDK.
  *
  * @since 1.5
  */
 public static Class<? extends Enum<?>> findEnumType(EnumSet<?> s) {
   // First things first: if not empty, easy to determine
   if (!s.isEmpty()) {
     return findEnumType(s.iterator().next());
   }
   // Otherwise need to locate using an internal field
   return EnumTypeLocator.instance.enumTypeFor(s);
 }
コード例 #8
0
 private void setFlag(Flag flag, boolean set) {
   if (set && !flagsEnum.contains(flag)) {
     flagsEnum.add(flag);
   } else if (!set) {
     flagsEnum.remove(flag);
     assert (!flagsEnum.contains(flag));
   }
 }
コード例 #9
0
 public static EnumSet<AcSentMessageTypeEnum> collectFromCodes(Collection<String> v) {
   if (v == null) return null;
   EnumSet<AcSentMessageTypeEnum> set = newEnumSet();
   for (String s : v) {
     AcSentMessageTypeEnum e = _AcSentMessageTypeEnum._m.get(s);
     if (e != null) set.add(e);
   }
   return set;
 }
コード例 #10
0
 public static EnumSet<AcUspsDomesticRouteStatusStatusEnum> collectFromCodes(
     Collection<String> v) {
   if (v == null) return null;
   EnumSet<AcUspsDomesticRouteStatusStatusEnum> set = newEnumSet();
   for (String s : v) {
     AcUspsDomesticRouteStatusStatusEnum e = _AcUspsDomesticRouteStatusStatusEnum._m.get(s);
     if (e != null) set.add(e);
   }
   return set;
 }
コード例 #11
0
 public static EnumSet<AcUspsInternationalClaimLegTypeEnum> collectFromCodes(
     Collection<String> v) {
   if (v == null) return null;
   EnumSet<AcUspsInternationalClaimLegTypeEnum> set = newEnumSet();
   for (String s : v) {
     AcUspsInternationalClaimLegTypeEnum e = _AcUspsInternationalClaimLegTypeEnum._m.get(s);
     if (e != null) set.add(e);
   }
   return set;
 }
コード例 #12
0
ファイル: JediTerminal.java プロジェクト: patsimm/jediterm
  @Override
  public void setModeEnabled(TerminalMode mode, boolean enabled) {
    if (enabled) {
      myModes.add(mode);
    } else {
      myModes.remove(mode);
    }

    mode.setEnabled(this, enabled);
  }
コード例 #13
0
ファイル: SickBeard.java プロジェクト: Buttink/nzbOne
  public boolean showAddNew(
      String tvdbid,
      Language language,
      Boolean seasonFolders,
      Status status,
      EnumSet<Show.Quality> initial,
      EnumSet<Quality> archive)
      throws Exception {
    StringBuilder builder = new StringBuilder("show.addnew");
    builder.append("&tvdbid=");
    builder.append(tvdbid);
    if (language != null) {
      builder.append("&lang=");
      builder.append(language.getAbbrev());
    }
    if (seasonFolders != null) {
      // the option isnt called season folders anymore
      if (apiVersion >= 3) {
        builder.append("&flatten_folders=");
      } else {
        builder.append("&season_folder=");
      }
      // if you pass me a boolean you better damn well have checked the version number
      builder.append(seasonFolders ? "1" : "0");
    }
    if (status != null) {
      builder.append("&status=");
      builder.append(status.toJson());
    }
    if (initial != null) {
      builder.append("&initial=");
      Iterator<Quality> iter = initial.iterator();
      if (iter.hasNext()) {
        builder.append(iter.next().toString().toLowerCase());
        while (iter.hasNext()) {
          builder.append("|");
          builder.append(iter.next().toString().toLowerCase());
        }
      }
    }
    if (archive != null) {
      builder.append("&archive=");
      Iterator<Show.Quality> iter = archive.iterator();
      if (iter.hasNext()) {
        builder.append(iter.next().toString().toLowerCase());
        while (iter.hasNext()) {
          builder.append("|");
          builder.append(iter.next().toString().toLowerCase());
        }
      }
    }

    return this.<Object>commandSuccessful(
        builder.toString(), new TypeToken<JsonResponse<Object>>() {}.getType());
  }
 public static EnumSet<AcUspsInternationalCandidateRouteOfferHistoryStatusEnum> collectFromCodes(
     Collection<String> v) {
   if (v == null) return null;
   EnumSet<AcUspsInternationalCandidateRouteOfferHistoryStatusEnum> set = newEnumSet();
   for (String s : v) {
     AcUspsInternationalCandidateRouteOfferHistoryStatusEnum e =
         _AcUspsInternationalCandidateRouteOfferHistoryStatusEnum._m.get(s);
     if (e != null) set.add(e);
   }
   return set;
 }
コード例 #15
0
 /**
  * Provisions a new EC2 slave or starts a previously stopped on-demand instance.
  *
  * @return always non-null. This needs to be then added to {@link Hudson#addNode(Node)}.
  */
 public EC2AbstractSlave provision(
     TaskListener listener, Label requiredLabel, EnumSet<ProvisionOptions> provisionOptions)
     throws AmazonClientException, IOException {
   if (this.spotConfig != null) {
     if (provisionOptions.contains(ProvisionOptions.ALLOW_CREATE)
         || provisionOptions.contains(ProvisionOptions.FORCE_CREATE))
       return provisionSpot(listener);
     return null;
   }
   return provisionOndemand(listener, requiredLabel, provisionOptions);
 }
コード例 #16
0
  public EnrollmentDialog(
      Frame owner,
      int maxCount,
      final String reasonToFail,
      EnumMap<DPFPFingerIndex, DPFPTemplate> templates) {
    super(owner, true);
    this.templates = templates;

    setTitle("Fingerprint Enrollment");

    DPFPEnrollmentControl enrollmentControl = new DPFPEnrollmentControl();

    EnumSet<DPFPFingerIndex> fingers = EnumSet.noneOf(DPFPFingerIndex.class);
    fingers.addAll(templates.keySet());
    enrollmentControl.setEnrolledFingers(fingers);
    enrollmentControl.setMaxEnrollFingerCount(maxCount);

    enrollmentControl.addEnrollmentListener(
        new DPFPEnrollmentListener() {
          public void fingerDeleted(DPFPEnrollmentEvent e) throws DPFPEnrollmentVetoException {
            if (reasonToFail != null) {
              throw new DPFPEnrollmentVetoException(reasonToFail);
            } else {
              EnrollmentDialog.this.templates.remove(e.getFingerIndex());
            }
          }

          public void fingerEnrolled(DPFPEnrollmentEvent e) throws DPFPEnrollmentVetoException {
            if (reasonToFail != null) {
              //                  e.setStopCapture(false);
              throw new DPFPEnrollmentVetoException(reasonToFail);
            } else EnrollmentDialog.this.templates.put(e.getFingerIndex(), e.getTemplate());
          }
        });

    getContentPane().setLayout(new BorderLayout());

    JButton closeButton = new JButton("Close");
    closeButton.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            setVisible(false); // End Dialog
          }
        });

    JPanel bottom = new JPanel();
    bottom.add(closeButton);
    add(enrollmentControl, BorderLayout.CENTER);
    add(bottom, BorderLayout.PAGE_END);

    pack();
    setLocationRelativeTo(null);
  }
コード例 #17
0
 public Set<Color> toEnumSet() {
   if (isColorless()) {
     return EnumSet.of(Color.COLORLESS);
   }
   List<Color> list = new ArrayList<Color>();
   for (Color c : Color.values()) {
     if (hasAnyColor(c.getColormask())) {
       list.add(c);
     }
   }
   return EnumSet.copyOf(list);
 }
コード例 #18
0
ファイル: WatercolorSets.java プロジェクト: codepython/usc
 public static void main(String[] args) {
   Set<Watercolors> set1 = EnumSet.range(BRILLIANT_RED, VIRIDIAN_HUE);
   Set<Watercolors> set2 = EnumSet.range(CERULEAN_BLUE_HUE, BURNT_UMBER);
   print("set1: " + set1);
   print("set2: " + set2);
   print("union(set1, set2): " + union(set1, set2));
   Set<Watercolors> subset = intersection(set1, set2);
   print("intersection(set1, set2): " + subset);
   print("difference(set1, subset): " + difference(set1, subset));
   print("difference(set2, subset): " + difference(set2, subset));
   print("complement(set1, set2): " + complement(set1, set2));
 }
コード例 #19
0
 private static void printBufferObjectChecks(
     PrintWriter writer, ExecutableElement method, Mode mode, boolean context_specific) {
   EnumSet<BufferKind> check_set = EnumSet.noneOf(BufferKind.class);
   for (VariableElement param : method.getParameters()) {
     BufferObject bo_annotation = param.getAnnotation(BufferObject.class);
     if (bo_annotation != null) {
       check_set.add(bo_annotation.value());
     }
   }
   for (BufferKind kind : check_set) {
     printBufferObjectCheck(writer, kind, mode, context_specific);
   }
 }
コード例 #20
0
  public Collection<BUS_PERMISSION> getPermissions(String user) {
    if (isBusConfigField(user)) {
      throw new IllegalArgumentException("Invalid user name: " + user);
    }

    String perms = get(user);
    EnumSet<BUS_PERMISSION> result = EnumSet.noneOf(BUS_PERMISSION.class);
    if (StringUtils.isNotBlank(perms)) {
      for (String perm : perms.split(",")) {
        result.add(BUS_PERMISSION.valueOf(perm));
      }
    }
    return result;
  }
コード例 #21
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;
  }
コード例 #22
0
 private void internalScrollTo(long newX, long newY, boolean moveViewPort) {
   if (this.imageWidth_ != Infinite) {
     newX = Math.min(this.imageWidth_ - this.viewPortWidth_, Math.max((long) 0, newX));
   }
   if (this.imageHeight_ != Infinite) {
     newY = Math.min(this.imageHeight_ - this.viewPortHeight_, Math.max((long) 0, newY));
   }
   if (moveViewPort) {
     this.contents_.setOffsets(new WLength((double) -newX), EnumSet.of(Side.Left));
     this.contents_.setOffsets(new WLength((double) -newY), EnumSet.of(Side.Top));
   }
   this.generateGridItems(newX, newY);
   this.viewPortChanged_.trigger(this.currentX_, this.currentY_);
 }
コード例 #23
0
ファイル: TestStandardVar.java プロジェクト: kenkyu/thredds
  // for jon blower
  private Array getEnhancedArray(VariableDS vds) throws IOException {
    Array data = vds.read();
    EnumSet<NetcdfDataset.Enhance> mode = vds.getEnhanceMode();
    if (mode.contains(NetcdfDataset.Enhance.ScaleMissing)) return data;
    if (!mode.contains(NetcdfDataset.Enhance.ScaleMissingDefer))
      throw new IllegalStateException("Must include " + NetcdfDataset.Enhance.ScaleMissingDefer);

    IndexIterator ii = data.getIndexIterator();
    while (ii.hasNext()) {
      double val = vds.convertScaleOffsetMissing(ii.getDoubleNext());
      ii.setDoubleCurrent(val);
    }
    return data;
  }
コード例 #24
0
ファイル: Handshaker.java プロジェクト: OzkanCiftci/jdk7u-jdk
  /**
   * Get the active cipher suites.
   *
   * <p>In TLS 1.1, many weak or vulnerable cipher suites were obsoleted, such as
   * TLS_RSA_EXPORT_WITH_RC4_40_MD5. The implementation MUST NOT negotiate these cipher suites in
   * TLS 1.1 or later mode.
   *
   * <p>Therefore, when the active protocols only include TLS 1.1 or later, the client cannot
   * request to negotiate those obsoleted cipher suites. That is, the obsoleted suites should not be
   * included in the client hello. So we need to create a subset of the enabled cipher suites, the
   * active cipher suites, which does not contain obsoleted cipher suites of the minimum active
   * protocol.
   *
   * <p>Return empty list instead of null if no active cipher suites.
   */
  CipherSuiteList getActiveCipherSuites() {
    if (activeCipherSuites == null) {
      if (activeProtocols == null) {
        activeProtocols = getActiveProtocols();
      }

      ArrayList<CipherSuite> suites = new ArrayList<>();
      if (!(activeProtocols.collection().isEmpty())
          && activeProtocols.min.v != ProtocolVersion.NONE.v) {
        for (CipherSuite suite : enabledCipherSuites.collection()) {
          if (suite.obsoleted > activeProtocols.min.v && suite.supported <= activeProtocols.max.v) {
            if (algorithmConstraints.permits(
                EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), suite.name, null)) {
              suites.add(suite);
            }
          } else if (debug != null && Debug.isOn("verbose")) {
            if (suite.obsoleted <= activeProtocols.min.v) {
              System.out.println("Ignoring obsoleted cipher suite: " + suite);
            } else {
              System.out.println("Ignoring unsupported cipher suite: " + suite);
            }
          }
        }
      }
      activeCipherSuites = new CipherSuiteList(suites);
    }

    return activeCipherSuites;
  }
コード例 #25
0
    /**
     * Create a custom field ordering from a list of strings representing field labels. There may
     * also be one or more optionally-quoted strings, each indicating a value to be inserted into a
     * constant-valued column.
     *
     * @param labels a list of field labels and optionally constant string values
     * @throws CustomColumnOrderingException if there is an unrecognised field name or no id fields
     */
    public CustomColumnOrdering(List<String> labels) throws CustomColumnOrderingException {
      this.ordering = ReportColumn.fromStrings(labels);
      // Note we regenerate the labels from the ReportColumns so constant-valued
      // columns are consistently unquoted.
      this.orderedLabels = ReportColumn.getLabels(ordering);

      // Create the Field ordering
      this.fieldOrdering =
          new ArrayList<Field>() {
            {
              for (ReportColumn c : ordering) {
                if (c.isField()) add(c.field);
              }
            }
          };

      // Sanity checks
      // Are there any fields included?
      if (this.fieldOrdering.isEmpty())
        throw new CustomColumnOrderingException("", "No valid fields specified.");
      // Are there id fields included?
      if (!Field.idFields.clone().removeAll(this.fieldOrdering)) {
        String idFieldStr =
            String.format("(%s)", StringUtils.join(Field.getLabels(Field.idFields), ", "));
        throw new CustomColumnOrderingException(
            "",
            String.format(
                "No identifying fields specified. You must include one of %s.", idFieldStr));
      }
      // Set the field set if all is okay
      this.fields = EnumSet.copyOf(this.fieldOrdering);
    }
コード例 #26
0
ファイル: WAbstractMedia.java プロジェクト: clawplach/jwt
 /**
  * Consctructor for a media widget.
  *
  * <p>A freshly constructed media widget has no options set, no media sources, and has preload
  * mode set to PreloadAuto.
  */
 public WAbstractMedia(WContainerWidget parent) {
   super(parent);
   this.sources_ = new ArrayList<WAbstractMedia.Source>();
   this.sourcesRendered_ = 0;
   this.mediaId_ = "";
   this.flags_ = EnumSet.noneOf(WAbstractMedia.Options.class);
   this.preloadMode_ = WAbstractMedia.PreloadMode.PreloadAuto;
   this.alternative_ = null;
   this.flagsChanged_ = false;
   this.preloadChanged_ = false;
   this.sourcesChanged_ = false;
   this.playing_ = false;
   this.volume_ = -1;
   this.current_ = -1;
   this.duration_ = -1;
   this.ended_ = false;
   this.readyState_ = WAbstractMedia.ReadyState.HaveNothing;
   this.setInline(false);
   this.setFormObject(true);
   WApplication app = WApplication.getInstance();
   app.loadJavaScript("js/WAbstractMedia.js", wtjs1());
   this.setJavaScriptMember(
       " WAbstractMedia",
       "new Wt3_2_3.WAbstractMedia(" + app.getJavaScriptClass() + "," + this.getJsRef() + ");");
 }
コード例 #27
0
    protected CompleteReferenceProcessor() {
      super(null, EnumSet.allOf(ResolveKind.class), myRefExpr, PsiType.EMPTY_ARRAY);
      myConsumer =
          new Consumer<LookupElement>() {
            @Override
            public void consume(LookupElement element) {
              myIsEmpty = false;
              CompleteReferenceExpression.this.myConsumer.consume(element);
            }
          };
      myPreferredFieldNames = addAllRestrictedProperties();
      mySkipPackages = shouldSkipPackages();
      myEventListener =
          JavaPsiFacade.getInstance(myRefExpr.getProject())
              .findClass("java.util.EventListener", myRefExpr.getResolveScope());
      myPropertyNames.addAll(myPreferredFieldNames);

      myFieldPointerOperator = myRefExpr.hasAt();
      myMethodPointerOperator = myRefExpr.getDotTokenType() == GroovyTokenTypes.mMEMBER_POINTER;
      myIsMap = isMap();
      final PsiType thisType = GrReferenceResolveUtil.getQualifierType(myRefExpr);
      mySubstitutorComputer =
          new SubstitutorComputer(
              thisType, PsiType.EMPTY_ARRAY, PsiType.EMPTY_ARRAY, myRefExpr, myRefExpr.getParent());
    }
コード例 #28
0
ファイル: JediTerminal.java プロジェクト: patsimm/jediterm
 private void initModes() {
   myModes.clear();
   setModeEnabled(TerminalMode.AutoWrap, true);
   setModeEnabled(TerminalMode.AutoNewLine, false);
   setModeEnabled(TerminalMode.CursorVisible, true);
   setModeEnabled(TerminalMode.CursorBlinking, true);
 }
コード例 #29
0
ファイル: Handshaker.java プロジェクト: OzkanCiftci/jdk7u-jdk
  /*
   * Get the active protocol versions.
   *
   * In TLS 1.1, many weak or vulnerable cipher suites were obsoleted,
   * such as TLS_RSA_EXPORT_WITH_RC4_40_MD5. The implementation MUST NOT
   * negotiate these cipher suites in TLS 1.1 or later mode.
   *
   * For example, if "TLS_RSA_EXPORT_WITH_RC4_40_MD5" is the
   * only enabled cipher suite, the client cannot request TLS 1.1 or
   * later, even though TLS 1.1 or later is enabled.  We need to create a
   * subset of the enabled protocols, called the active protocols, which
   * contains protocols appropriate to the list of enabled Ciphersuites.
   *
   * Return empty list instead of null if no active protocol versions.
   */
  ProtocolList getActiveProtocols() {
    if (activeProtocols == null) {
      ArrayList<ProtocolVersion> protocols = new ArrayList<>(4);
      for (ProtocolVersion protocol : enabledProtocols.collection()) {
        boolean found = false;
        for (CipherSuite suite : enabledCipherSuites.collection()) {
          if (suite.isAvailable()
              && suite.obsoleted > protocol.v
              && suite.supported <= protocol.v) {
            if (algorithmConstraints.permits(
                EnumSet.of(CryptoPrimitive.KEY_AGREEMENT), suite.name, null)) {
              protocols.add(protocol);
              found = true;
              break;
            } else if (debug != null && Debug.isOn("verbose")) {
              System.out.println("Ignoring disabled cipher suite: " + suite + " for " + protocol);
            }
          } else if (debug != null && Debug.isOn("verbose")) {
            System.out.println("Ignoring unsupported cipher suite: " + suite + " for " + protocol);
          }
        }
        if (!found && (debug != null) && Debug.isOn("handshake")) {
          System.out.println("No available cipher suite for " + protocol);
        }
      }
      activeProtocols = new ProtocolList(protocols);
    }

    return activeProtocols;
  }
コード例 #30
0
  /**
   * determine type by first type attribute present in object, then add attribute according to
   * attribute order in template.
   */
  public RpslObjectBuilder addAttributeSorted(final RpslAttribute newAttribute) {
    final ObjectType objectType = getType();
    final ObjectTemplate objectTemplate = ObjectTemplate.getTemplate(objectType);
    final EnumSet<AttributeType> attributesAfter =
        getAttributeTypesAfter(objectTemplate, newAttribute.getType());

    for (int i = 0; i < attributes.size(); i++) {
      if (attributesAfter.contains(attributes.get(i).getType())) {
        attributes.add(i, newAttribute);
        return this;
      }
    }

    attributes.add(newAttribute);
    return this;
  }