/**
  * Create a UnicodeUnescaper.
  *
  * <p>The constructor takes a list of options, only one type of which is currently available
  * (whether to allow, error or ignore the semi-colon on the end of a numeric entity to being
  * missing).
  *
  * <p>For example, to support numeric entities without a ';': new
  * NumericEntityUnescaper(NumericEntityUnescaper.OPTION.semiColonOptional) and to throw an
  * IllegalArgumentException when they're missing: new
  * NumericEntityUnescaper(NumericEntityUnescaper.OPTION.errorIfNoSemiColon)
  *
  * <p>Note that the default behaviour is to ignore them.
  *
  * @param options to apply to this unescaper
  */
 public NumericEntityUnescaper(final OPTION... options) {
   if (options.length > 0) {
     this.options = EnumSet.copyOf(Arrays.asList(options));
   } else {
     this.options = EnumSet.copyOf(Arrays.asList(new OPTION[] {OPTION.semiColonRequired}));
   }
 }
Exemple #2
0
 static {
   List<Biome> temp = new ArrayList<Biome>();
   EnumSet<Biome> set = null;
   try {
     temp.add(Biome.valueOf("RIVER"));
     temp.add(Biome.valueOf("OCEAN"));
     temp.add(Biome.valueOf("DEEP_OCEAN"));
   } catch (Exception e) {
     temp.clear();
   } finally {
     try {
       set = EnumSet.copyOf(temp);
     } catch (IllegalArgumentException e) {
       mcMMO.p.getLogger().severe("Biome enum mismatch");
       ;
     }
     temp.clear();
   }
   WATER_BIOMES = set;
   set = null;
   try {
     temp.add(Biome.valueOf("FROZEN_OCEAN"));
     temp.add(Biome.valueOf("FROZEN_RIVER"));
     temp.add(Biome.valueOf("TAIGA"));
     temp.add(Biome.valueOf("TAIGA_HILLS"));
     temp.add(Biome.valueOf("TAIGA_COLD_HILLS"));
     temp.add(Biome.valueOf("TAIGA_COLD"));
     temp.add(Biome.valueOf("MUTATED_TAIGA_COLD"));
     temp.add(Biome.valueOf("ICE_MOUNTAINS"));
     temp.add(Biome.valueOf("ICE_FLATS"));
     temp.add(Biome.valueOf("MUTATED_ICE_FLATS"));
   } catch (Exception e) {
     temp.clear();
     try {
       temp.add(Biome.valueOf("FROZEN_OCEAN"));
       temp.add(Biome.valueOf("FROZEN_RIVER"));
       temp.add(Biome.valueOf("TAIGA"));
       temp.add(Biome.valueOf("TAIGA_HILLS"));
       temp.add(Biome.valueOf("TAIGA_MOUNTAINS"));
       temp.add(Biome.valueOf("COLD_TAIGA"));
       temp.add(Biome.valueOf("COLD_TAIGA_HILLS"));
       temp.add(Biome.valueOf("COLD_TAIGA_MOUNTAINS"));
       temp.add(Biome.valueOf("ICE_MOUNTAINS"));
       temp.add(Biome.valueOf("ICE_PLAINS"));
       temp.add(Biome.valueOf("ICE_PLAINS_SPIKES"));
     } catch (Exception e1) {
       temp.clear();
     }
   } finally {
     try {
       set = EnumSet.copyOf(temp);
     } catch (IllegalArgumentException e) {
       mcMMO.p.getLogger().severe("Biome enum mismatch");
       ;
     }
     temp.clear();
   }
   ICE_BIOMES = set;
 }
    /**
     * 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);
    }
 public PnfsCreateEntryMessage(String path, int uid, int gid, int mode, Set<FileAttribute> attr) {
   super(
       path,
       EnumSet.copyOf(
           Sets.union(
               attr,
               EnumSet.of(
                   OWNER,
                   OWNER_GROUP,
                   MODE,
                   TYPE,
                   SIZE,
                   CREATION_TIME,
                   ACCESS_TIME,
                   MODIFICATION_TIME,
                   CHANGE_TIME,
                   PNFSID,
                   STORAGEINFO,
                   ACCESS_LATENCY,
                   RETENTION_POLICY))));
   _path = path;
   _uid = uid;
   _gid = gid;
   _mode = mode;
 }
Exemple #5
0
  public static <E extends Enum<E>> EnumSet<E> createEnumSet(Collection<E> c) {
    if (c == null) {
      return null;
    }

    return EnumSet.copyOf(c);
  }
  private NumericShaper(Range defaultContext, Set<Range> ranges) {
    shapingRange = defaultContext;
    rangeSet = EnumSet.copyOf(ranges); // throws NPE if ranges is null.

    // Give precedance to EASTERN_ARABIC if both ARABIC and
    // EASTERN_ARABIC are specified.
    if (rangeSet.contains(Range.EASTERN_ARABIC) && rangeSet.contains(Range.ARABIC)) {
      rangeSet.remove(Range.ARABIC);
    }

    // As well as the above case, give precedance to TAI_THAM_THAM if both
    // TAI_THAM_HORA and TAI_THAM_THAM are specified.
    if (rangeSet.contains(Range.TAI_THAM_THAM) && rangeSet.contains(Range.TAI_THAM_HORA)) {
      rangeSet.remove(Range.TAI_THAM_HORA);
    }

    rangeArray = rangeSet.toArray(new Range[rangeSet.size()]);
    if (rangeArray.length > BSEARCH_THRESHOLD) {
      // sort rangeArray for binary search
      Arrays.sort(
          rangeArray,
          new Comparator<Range>() {
            public int compare(Range s1, Range s2) {
              return s1.base > s2.base ? 1 : s1.base == s2.base ? 0 : -1;
            }
          });
    }
  }
  /**
   * Setter for the property 'connectionTracingEvents'. This method is called by the container
   *
   * @param tracingSpec A comma delimited list of {@link HzConnectionEvent}
   */
  public void setConnectionTracingEvents(String tracingSpec) {
    if ((null != tracingSpec) && (0 < tracingSpec.length())) {
      List<HzConnectionEvent> traceEvents = new ArrayList<HzConnectionEvent>();

      for (String traceEventId : tracingSpec.split(",")) {
        traceEventId = traceEventId.trim();
        try {
          HzConnectionEvent traceEvent = HzConnectionEvent.valueOf(traceEventId);
          if (null != traceEvent) {
            traceEvents.add(traceEvent);
          }
        } catch (IllegalArgumentException iae) {
          log(
              Level.WARNING,
              "Ignoring illegal token \""
                  + traceEventId
                  + "\" from connection config-property "
                  + "connectionTracingEvents, valid tokens are "
                  + EnumSet.allOf(HzConnectionEvent.class));
        }
      }

      this.hzConnectionTracingEvents = EnumSet.copyOf(traceEvents);
    } else {
      this.hzConnectionTracingEvents = emptySet();
    }
  }
Exemple #8
0
  public ActMood mostSpecificGeneralization(CD that) {
    if (this == that || this.equals(that)) return this;
    if (!(that instanceof ActMood))
      throw new UnsupportedOperationException("cannot handle argument of class " + that.getClass());
    final ActMood thatActMood = (ActMood) that;

    // First build the intersection of the implied concepts
    // the remainder is a single path of which we have to
    // find the most specific concept, i.e., the one who
    // has all others as parents, i.e., the one with the
    // largest set of implied concepts.
    EnumSet<ActMood> intersection = EnumSet.copyOf(getImpliedConcepts());
    intersection.removeAll(EnumSet.complementOf(thatActMood.getImpliedConcepts()));
    intersection.remove(root);

    // XXX: this iterative search is likely to be least optimal because
    // we probably have to search the path from the root here.
    // I don't know of any better way to do it right now though.

    ActMood mostSpecificKnownGeneralization = root;
    int maxKnownSpecificity = 1;

    for (ActMood candidate : intersection) {
      int specificity = candidate.getImpliedConcepts().size();
      if (specificity > maxKnownSpecificity) {
        maxKnownSpecificity = specificity;
        mostSpecificKnownGeneralization = candidate;
      }
    }

    return mostSpecificKnownGeneralization;
  }
 /**
  * Create an error diagnostic
  *
  * @param source The source of the compilation unit, if any, in which to report the error.
  * @param pos The source position at which to report the error.
  * @param errorKey The key for the localized error message.
  */
 public JCDiagnostic error(
     DiagnosticFlag flag, DiagnosticSource source, DiagnosticPosition pos, Error errorKey) {
   JCDiagnostic diag = create(null, EnumSet.copyOf(defaultErrorFlags), source, pos, errorKey);
   if (flag != null) {
     diag.setFlag(flag);
   }
   return diag;
 }
  /**
   * DO NOT USE DIRECTLY. public by accident. Calculate scale/offset/missing value info. This may
   * change the DataType.
   */
  public void enhance(Set<NetcdfDataset.Enhance> mode) {
    this.enhanceMode = EnumSet.copyOf(mode);
    boolean alreadyScaleOffsetMissing = false;
    boolean alreadyEnumConversion = false;

    // see if underlying variable has enhancements already applied
    if (orgVar != null && orgVar instanceof VariableDS) {
      VariableDS orgVarDS = (VariableDS) orgVar;
      EnumSet<NetcdfDataset.Enhance> orgEnhanceMode = orgVarDS.getEnhanceMode();
      if (orgEnhanceMode != null) {
        if (orgEnhanceMode.contains(NetcdfDataset.Enhance.ScaleMissing)) {
          alreadyScaleOffsetMissing = true;
          this.enhanceMode.add(
              NetcdfDataset.Enhance
                  .ScaleMissing); // Note: promote the enhancement to the wrapped variable
        }
        if (orgEnhanceMode.contains(NetcdfDataset.Enhance.ConvertEnums)) {
          alreadyEnumConversion = true;
          this.enhanceMode.add(
              NetcdfDataset.Enhance
                  .ConvertEnums); // Note: promote the enhancement to the wrapped variable
        }
      }
    }

    // do we need to calculate the ScaleMissing ?
    if (!alreadyScaleOffsetMissing
            && (dataType.isNumeric() || dataType == DataType.CHAR)
            && mode.contains(NetcdfDataset.Enhance.ScaleMissing)
        || mode.contains(NetcdfDataset.Enhance.ScaleMissingDefer)) {

      this.scaleMissingProxy = new EnhanceScaleMissingImpl(this);

      // promote the data type if ScaleMissing is set
      if (mode.contains(NetcdfDataset.Enhance.ScaleMissing)
          && scaleMissingProxy.hasScaleOffset()
          && (scaleMissingProxy.getConvertedDataType() != getDataType())) {
        setDataType(scaleMissingProxy.getConvertedDataType());
        removeAttributeIgnoreCase("_Unsigned");
      }

      // do we need to actually convert data ?
      needScaleOffsetMissing =
          mode.contains(NetcdfDataset.Enhance.ScaleMissing)
              && (scaleMissingProxy.hasScaleOffset() || scaleMissingProxy.getUseNaNs());
    }

    // do we need to do enum conversion ?
    if (!alreadyEnumConversion
        && mode.contains(NetcdfDataset.Enhance.ConvertEnums)
        && dataType.isEnum()) {
      this.needEnumConversion = true;

      // LOOK promote data type to STRING ????
      setDataType(DataType.STRING);
      removeAttributeIgnoreCase("_Unsigned");
    }
  }
 /**
  * Create an ordering from predefined lists of Fields and columns. This is enough information
  * from which to interpolate the other final members. Because there is no String interpretation,
  * there is no need to generate or catch exceptions. This version includes the ordered list of
  * labels, to save processing for those cases where the caller has already generated the list.
  *
  * @param fieldOrdering
  * @param ordering
  * @param orderedLabels
  */
 private CustomColumnOrdering(
     final List<ReportColumn> ordering,
     final List<Field> fieldOrdering,
     final List<String> orderedLabels) {
   this.ordering = ordering;
   this.fieldOrdering = fieldOrdering;
   this.orderedLabels = orderedLabels;
   this.fields = EnumSet.copyOf(fieldOrdering);
 }
 private EnumSet<DispatcherType> getDispatcherTypes(final FilterModel filterModel) {
   final ArrayList<DispatcherType> dispatcherTypes =
       new ArrayList<DispatcherType>(DispatcherType.values().length);
   for (final String dispatcherType : filterModel.getDispatcher()) {
     dispatcherTypes.add(DispatcherType.valueOf(dispatcherType.toUpperCase()));
   }
   final EnumSet<DispatcherType> result = EnumSet.copyOf(dispatcherTypes);
   return result;
 }
Exemple #13
0
 /** Emits the modifiers to the writer. */
 private void emitModifiers(Set<Modifier> modifiers) throws IOException {
   // Use an EnumSet to ensure the proper ordering
   if (!(modifiers instanceof EnumSet)) {
     modifiers = EnumSet.copyOf(modifiers);
   }
   for (Modifier modifier : modifiers) {
     out.append(modifier.toString()).append(' ');
   }
 }
  public VersionedVCardParameter(String value, VCardVersion... supportedVersions) {
    super(value);
    if (supportedVersions.length == 0) {
      supportedVersions = VCardVersion.values();
    }

    Set<VCardVersion> set = EnumSet.copyOf(Arrays.asList(supportedVersions));
    this.supportedVersions = Collections.unmodifiableSet(set);
  }
Exemple #15
0
 /**
  * Emits {@code modifiers} in the standard order. Modifiers in {@code implicitModifiers} will not
  * be emitted.
  */
 public void emitModifiers(Set<Modifier> modifiers, Set<Modifier> implicitModifiers)
     throws IOException {
   if (modifiers.isEmpty()) return;
   for (Modifier modifier : EnumSet.copyOf(modifiers)) {
     if (implicitModifiers.contains(modifier)) continue;
     emitAndIndent(modifier.name().toLowerCase(Locale.US));
     emitAndIndent(" ");
   }
 }
  public TestVisitContext(FacesContext facesContext, Set<VisitHint> hints) {
    this.facesContext = facesContext;

    EnumSet<VisitHint> hintsEnumSet =
        ((hints == null) || (hints.isEmpty()))
            ? EnumSet.noneOf(VisitHint.class)
            : EnumSet.copyOf(hints);

    this.hints = Collections.unmodifiableSet(hintsEnumSet);
  }
 public static <E> ImmutableSet<E> a(Collection<? extends E> paramCollection) {
   if (((paramCollection instanceof ImmutableSet))
       && (!(paramCollection instanceof ImmutableSortedSet))) {
     ImmutableSet localImmutableSet = (ImmutableSet) paramCollection;
     if (!localImmutableSet.a()) {
       return localImmutableSet;
     }
   } else if ((paramCollection instanceof EnumSet)) {
     return ImmutableEnumSet.a(EnumSet.copyOf((EnumSet) paramCollection));
   }
   return b(paramCollection);
 }
 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);
 }
  @Override
  protected EnumSet<ForgeDirection> getConsumingSides() {
    HashSet<ForgeDirection> set = new HashSet<ForgeDirection>();

    for (ForgeDirection dir : ForgeDirection.values()) {
      if (dir != ForgeDirection.getOrientation(facing)) {
        set.add(dir);
      }
    }

    return EnumSet.copyOf(set);
  }
 public void tickStart(EnumSet<TickType> ticks, Object... data) {
   sidedDelegate.profileStart("modTickStart$" + ticks);
   for (ITickHandler ticker : tickHandlers) {
     EnumSet<TickType> ticksToRun = EnumSet.copyOf(ticker.ticks());
     ticksToRun.removeAll(EnumSet.complementOf(ticks));
     if (!ticksToRun.isEmpty()) {
       sidedDelegate.profileStart(ticker.getLabel());
       ticker.tickStart(ticksToRun, data);
       sidedDelegate.profileEnd();
     }
   }
   sidedDelegate.profileEnd();
 }
Exemple #21
0
 /**
  * Return the set of allowed {@link HttpMethod HTTP methods}, as specified by the {@code Allow}
  * header.
  *
  * <p>Returns an empty set when the allowed methods are unspecified.
  */
 public Set<HttpMethod> getAllow() {
   String value = getFirst(ALLOW);
   if (StringUtil.isNotBlank(value)) {
     List<HttpMethod> allowedMethod = new ArrayList<HttpMethod>(5);
     String[] tokens = value.split(",\\s*");
     for (String token : tokens) {
       allowedMethod.add(HttpMethod.valueOf(token));
     }
     return EnumSet.copyOf(allowedMethod);
   } else {
     return EnumSet.noneOf(HttpMethod.class);
   }
 }
Exemple #22
0
 /**
  * Creates a copy of a Flag Set removing instances of FAIL_SILENTLY. The copy might be the same
  * instance if no change is required, and should be considered immutable.
  *
  * @param flags
  * @return might return the same instance
  */
 public static Set<Flag> copyWithoutRemotableFlags(Set<Flag> flags) {
   // FAIL_SILENTLY should not be sent to remote nodes
   if (flags != null && flags.contains(Flag.FAIL_SILENTLY)) {
     EnumSet<Flag> copy = EnumSet.copyOf(flags);
     copy.remove(Flag.FAIL_SILENTLY);
     if (copy.isEmpty()) {
       return InfinispanCollections.emptySet();
     } else {
       return copy;
     }
   } else {
     return flags;
   }
 }
Exemple #23
0
 private EnumSet<ActMood> getImpliedConcepts() {
   if (_impliedConcepts == null) {
     if (_parent == null) { // then _parent2, 3 is also null
       _impliedConcepts = EnumSet.of(root);
       _impliedConcepts.add(this);
     } else {
       _impliedConcepts = EnumSet.copyOf(_parent.getImpliedConcepts());
       _impliedConcepts.add(this);
       if (_parent2 != null) _impliedConcepts.addAll(_parent2.getImpliedConcepts());
       if (_parent3 != null) _impliedConcepts.addAll(_parent3.getImpliedConcepts());
     }
   }
   return _impliedConcepts;
 }
  public void tickStart(EnumSet<TickType> ticks, Side side, Object... data) {
    List<IScheduledTickHandler> scheduledTicks =
        side.isClient() ? scheduledClientTicks : scheduledServerTicks;

    if (scheduledTicks.size() == 0) {
      return;
    }
    for (IScheduledTickHandler ticker : scheduledTicks) {
      EnumSet<TickType> ticksToRun =
          EnumSet.copyOf(Objects.firstNonNull(ticker.ticks(), EnumSet.noneOf(TickType.class)));
      ticksToRun.removeAll(EnumSet.complementOf(ticks));
      if (!ticksToRun.isEmpty()) {
        ticker.tickStart(ticksToRun, data);
      }
    }
  }
 /**
  * Handle the provided {@link InProcessTransformResult}, produced after evaluating the provided
  * {@link CommittedBundle} (potentially null, if the result of a root {@link PTransform}).
  *
  * <p>The result is the output of running the transform contained in the {@link
  * InProcessTransformResult} on the contents of the provided bundle.
  *
  * @param completedBundle the bundle that was processed to produce the result. Potentially {@code
  *     null} if the transform that produced the result is a root transform
  * @param completedTimers the timers that were delivered to produce the {@code completedBundle},
  *     or an empty iterable if no timers were delivered
  * @param result the result of evaluating the input bundle
  * @return the committed bundles contained within the handled {@code result}
  */
 public CommittedResult handleResult(
     @Nullable CommittedBundle<?> completedBundle,
     Iterable<TimerData> completedTimers,
     InProcessTransformResult result) {
   Iterable<? extends CommittedBundle<?>> committedBundles =
       commitBundles(result.getOutputBundles());
   // Update watermarks and timers
   EnumSet<OutputType> outputTypes = EnumSet.copyOf(result.getOutputTypes());
   if (Iterables.isEmpty(committedBundles)) {
     outputTypes.remove(OutputType.BUNDLE);
   } else {
     outputTypes.add(OutputType.BUNDLE);
   }
   CommittedResult committedResult =
       CommittedResult.create(
           result,
           completedBundle == null
               ? null
               : completedBundle.withElements((Iterable) result.getUnprocessedElements()),
           committedBundles,
           outputTypes);
   watermarkManager.updateWatermarks(
       completedBundle,
       result.getTimerUpdate().withCompletedTimers(completedTimers),
       committedResult,
       result.getWatermarkHold());
   // Update counters
   if (result.getCounters() != null) {
     mergedCounters.merge(result.getCounters());
   }
   // Update state internals
   CopyOnAccessInMemoryStateInternals<?> theirState = result.getState();
   if (theirState != null) {
     CopyOnAccessInMemoryStateInternals<?> committedState = theirState.commit();
     StepAndKey stepAndKey =
         StepAndKey.of(
             result.getTransform(), completedBundle == null ? null : completedBundle.getKey());
     if (!committedState.isEmpty()) {
       applicationStateInternals.put(stepAndKey, committedState);
     } else {
       applicationStateInternals.remove(stepAndKey);
     }
   }
   return committedResult;
 }
 static {
   PRODUCT_FORMATS =
       EnumSet.of(
           BarcodeFormat.UPC_A,
           BarcodeFormat.UPC_E,
           BarcodeFormat.EAN_13,
           BarcodeFormat.EAN_8,
           BarcodeFormat.RSS_14,
           BarcodeFormat.RSS_EXPANDED);
   INDUSTRIAL_FORMATS =
       EnumSet.of(
           BarcodeFormat.CODE_39,
           BarcodeFormat.CODE_93,
           BarcodeFormat.CODE_128,
           BarcodeFormat.ITF,
           BarcodeFormat.CODABAR);
   ONE_D_FORMATS = EnumSet.copyOf(PRODUCT_FORMATS);
   ONE_D_FORMATS.addAll(INDUSTRIAL_FORMATS);
 }
Exemple #27
0
 public EnumSet<VMDetails> getDetails() throws InvalidParameterValueException {
   EnumSet<VMDetails> dv;
   if (viewDetails == null || viewDetails.size() <= 0) {
     dv = EnumSet.of(VMDetails.all);
   } else {
     try {
       ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
       for (String detail : viewDetails) {
         dc.add(VMDetails.valueOf(detail));
       }
       dv = EnumSet.copyOf(dc);
     } catch (IllegalArgumentException e) {
       throw new InvalidParameterValueException(
           "The details parameter contains a non permitted value. The allowed values are "
               + EnumSet.allOf(VMDetails.class));
     }
   }
   return dv;
 }
Exemple #28
0
public interface StationList extends GroupListIfc<Station> {
  static StationList emptyList() {
    return EmptyLists.EMPTY_STATIONS;
  }

  static Set<ColumnMeta> _Cols =
      EnumSet.copyOf(
          Arrays.asList(new ColumnMeta[] {ColumnMeta.StationID, ColumnMeta.StationNAME}));

  @Override
  default Set<ColumnMeta> getColTypes() {
    return _Cols;
  }

  @Override
  default ListMetaType getListMeta() {
    return ListMetaType.Station;
  }
}
 @Override
 public void execute() {
   CallContext.current().setEventDetails("Vm Id: " + getVmId() + " Network Id: " + getNetworkId());
   UserVm result = _userVmService.addNicToVirtualMachine(this);
   ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
   dc.add(VMDetails.valueOf("nics"));
   EnumSet<VMDetails> details = EnumSet.copyOf(dc);
   if (result != null) {
     UserVmResponse response =
         _responseGenerator
             .createUserVmResponse(ResponseView.Restricted, "virtualmachine", details, result)
             .get(0);
     response.setResponseName(getCommandName());
     setResponseObject(response);
   } else {
     throw new ServerApiException(
         ApiErrorCode.INTERNAL_ERROR,
         "Failed to add NIC to vm. Refer to server logs for details.");
   }
 }
Exemple #30
0
 /**
  * Adds a layout item to the grid.
  *
  * <p>Adds the <i>item</i> at (<i>row</i>, <code>column</code>). If an item was already added to
  * that location, it is replaced (but not deleted).
  *
  * <p>An item may span several more rows or columns, which is controlled by <i>rowSpan</i> and
  * <code>columnSpan</code>.
  *
  * <p>The <code>alignment</code> specifies the vertical and horizontal alignment of the item. The
  * default value 0 indicates that the item is stretched to fill the entire grid cell. The
  * alignment can be specified as a logical combination of a horizontal alignment ( {@link
  * AlignmentFlag#AlignLeft}, {@link AlignmentFlag#AlignCenter}, or {@link
  * AlignmentFlag#AlignRight}) and a vertical alignment ( {@link AlignmentFlag#AlignTop}, {@link
  * AlignmentFlag#AlignMiddle}, or {@link AlignmentFlag#AlignBottom}).
  *
  * <p>
  *
  * @see WGridLayout#addLayout(WLayout layout, int row, int column, EnumSet alignment)
  * @see WGridLayout#addWidget(WWidget widget, int row, int column, EnumSet alignment)
  */
 public void addItem(
     WLayoutItem item,
     int row,
     int column,
     int rowSpan,
     int columnSpan,
     EnumSet<AlignmentFlag> alignment) {
   columnSpan = Math.max(1, columnSpan);
   rowSpan = Math.max(1, rowSpan);
   this.expand(row, column, rowSpan, columnSpan);
   final Grid.Item gridItem = this.grid_.items_.get(row).get(column);
   if (gridItem.item_ != null) {
     WLayoutItem oldItem = gridItem.item_;
     gridItem.item_ = null;
     this.updateRemoveItem(oldItem);
   }
   gridItem.item_ = item;
   gridItem.rowSpan_ = rowSpan;
   gridItem.colSpan_ = columnSpan;
   gridItem.alignment_ = EnumSet.copyOf(alignment);
   this.updateAddItem(item);
 }