Example #1
0
 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);
   }
 }
  /**
   * 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();
    }
  }
  /** {@inheritDoc} */
  @Override
  public void onToggleSplitterClicked(boolean isShowSplitter) {
    terminalTab.setScopes(isShowSplitter ? EnumSet.allOf(State.class) : EnumSet.of(RUNNERS));

    if (isShowSplitter) {
      panelState.setSplitterState(SPLITTER_ON);

      view.setLeftPropertiesPanel(leftPropertiesContainer);
      view.setRightPropertiesPanel(rightPropertiesContainer);
    } else {
      panelState.setSplitterState(SPLITTER_OFF);

      view.setGeneralPropertiesPanel(rightPropertiesContainer);
    }

    if (TEMPLATE.equals(state)) {
      panelState.setState(TEMPLATE);

      leftTabContainer.showTab(locale.runnerTabTemplates());

      if (SPLITTER_OFF.equals(panelState.getSplitterState())) {
        rightPropertiesContainer.showTab(propertiesTab.getTitle());
      }
    }
  }
  public void testRequiredDeviceCharacteristic() {
    final AndroidVersion minSdkVersion = new AndroidVersion(8, null);
    final MockPlatformTarget projectTarget = new MockPlatformTarget(14, 0);
    EnumSet<IDevice.HardwareFeature> requiredFeatures = EnumSet.of(IDevice.HardwareFeature.WATCH);

    // cannot run if the device doesn't have a required feature
    LaunchCompatibility compatibility =
        LaunchCompatibility.canRunOnDevice(
            minSdkVersion, projectTarget, requiredFeatures, createMockDevice(8, null, false), null);
    assertEquals(new LaunchCompatibility(ThreeState.NO, "missing feature: WATCH"), compatibility);

    // can run if the device has the required features
    compatibility =
        LaunchCompatibility.canRunOnDevice(
            minSdkVersion, projectTarget, requiredFeatures, createMockDevice(8, null, true), null);
    assertEquals(new LaunchCompatibility(ThreeState.YES, null), compatibility);

    // cannot run apk's that don't specify uses-feature watch on a wear device
    requiredFeatures = EnumSet.noneOf(IDevice.HardwareFeature.class);
    compatibility =
        LaunchCompatibility.canRunOnDevice(
            minSdkVersion, projectTarget, requiredFeatures, createMockDevice(8, null, true), null);
    assertEquals(
        new LaunchCompatibility(
            ThreeState.NO,
            "missing uses-feature watch, non-watch apks cannot be launched on a watch"),
        compatibility);
  }
Example #5
0
@SuppressWarnings("javadoc")
@RunWith(Parameterized.class)
public class CeusSoftRock extends GmmTest {

  private static String GMM_INPUTS = "CEUS_vs760_inputs.csv";
  private static String GMM_RESULTS = "CEUS_vs760_results.csv";

  static {
    try {
      inputsList = loadInputs(GMM_INPUTS);
    } catch (IOException ioe) {
      ioe.printStackTrace();
      System.exit(1);
    }
  }

  @Parameters(name = "{index}: {0} {2} {1}")
  public static Collection<Object[]> data() throws IOException {
    return loadResults(GMM_RESULTS);
  }

  public CeusSoftRock(int index, Gmm gmm, Imt imt, double exMedian, double exSigma) {
    super(index, gmm, imt, exMedian, exSigma);
  }

  /* Result generation sets */
  private static Set<Gmm> gmms = EnumSet.range(AB_06_PRIME, TORO_97_MB);
  private static Set<Imt> imts = EnumSet.of(PGA, SA0P2, SA1P0, SA2P0);

  public static void main(String[] args) throws IOException {
    GmmTest.generateResults(gmms, imts, GMM_INPUTS, GMM_RESULTS);
  }
}
 /** {@inheritDoc} */
 @Override
 public boolean traverse(final EnumSet<TraversalOption> options) {
   final Tile next = getNext();
   if (next == null) {
     return false;
   }
   if (next.equals(getEnd())) {
     if (Calculations.distanceTo(next) <= 1
         || end && (!Players.getLocal().isMoving() || Calculations.distanceTo(next) < 3)) {
       return false;
     }
     end = true;
   } else {
     end = false;
   }
   if (options != null
       && options.contains(TraversalOption.HANDLE_RUN)
       && !Walking.isRunEnabled()
       && Walking.getEnergy() > 50) {
     Walking.setRun(true);
     Task.sleep(300);
   }
   if (options != null && options.contains(TraversalOption.SPACE_ACTIONS)) {
     final Tile dest = Walking.getDestination();
     if (dest != null
         && Players.getLocal().isMoving()
         && Calculations.distanceTo(dest) > 5
         && Calculations.distanceBetween(next, dest) < 7) {
       return true;
     }
   }
   return Walking.walkTileMM(next, 0, 0);
 }
  public static void startServer(Class<? extends Filter> filter) throws Exception {
    _tester = new ServletTester("/ctx");
    HttpURI uri = new HttpURI(_tester.createConnector(true));
    _host = uri.getHost();
    _port = uri.getPort();

    _tester.getContext().addServlet(TestServlet.class, "/*");

    _dosFilter =
        _tester.getContext().addFilter(filter, "/dos/*", EnumSet.allOf(DispatcherType.class));
    _dosFilter.setInitParameter("maxRequestsPerSec", "4");
    _dosFilter.setInitParameter("delayMs", "200");
    _dosFilter.setInitParameter("throttledRequests", "1");
    _dosFilter.setInitParameter("waitMs", "10");
    _dosFilter.setInitParameter("throttleMs", "4000");
    _dosFilter.setInitParameter("remotePort", "false");
    _dosFilter.setInitParameter("insertHeaders", "true");

    _timeoutFilter =
        _tester.getContext().addFilter(filter, "/timeout/*", EnumSet.allOf(DispatcherType.class));
    _timeoutFilter.setInitParameter("maxRequestsPerSec", "4");
    _timeoutFilter.setInitParameter("delayMs", "200");
    _timeoutFilter.setInitParameter("throttledRequests", "1");
    _timeoutFilter.setInitParameter("waitMs", "10");
    _timeoutFilter.setInitParameter("throttleMs", "4000");
    _timeoutFilter.setInitParameter("remotePort", "false");
    _timeoutFilter.setInitParameter("insertHeaders", "true");
    _timeoutFilter.setInitParameter("maxRequestMs", _requestMaxTime + "");

    _tester.start();
  }
 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;
 }
  /**
   * Create a new NotificationChannel.
   *
   * @param channelName name of the channel
   * @param channel text area for showing the event log
   * @param blackList if <code>true</code>, the channel will default to showing everything that has
   *     not been explicitly blacklisted. Otherwise it'll show only whitelisted content. The main
   *     channel should default to blacklisting, as it should show types that have been added in new
   *     game versions
   * @param defaultTypes default value of the saved notification type list (white- or blacklist
   *     depending on the value of <code>showUnknown</code>)
   */
  NotificationChannel(
      String channelName, KTextEdit channel, boolean blackList, String defaultTypes) {
    name = channelName;
    this.channel = channel;
    if (blackList) {
      eventTypes = EnumSet.allOf(NotificationType.class);
    } else {
      eventTypes = EnumSet.noneOf(NotificationType.class);
    }

    // Load
    WtWindowManager wm = WtWindowManager.getInstance();
    String value = wm.getProperty("ui.channel." + name, defaultTypes);
    for (String typeString : value.split(",")) {
      /*
       * String.split is unfortunately unable to return empty arrays when
       * applied on empty string. Work around it.
       */
      if ("".equals(typeString)) {
        continue;
      }
      try {
        NotificationType type = NotificationType.valueOf(typeString);
        setTypeFiltering(type, !blackList);
      } catch (RuntimeException e) {
        logger.error("Unrecognized notification type '" + typeString + "'", e);
      }
    }
  }
 private void emitURIs() throws IOException {
   writer.emitEmptyLine();
   for (Table table : mModel.getTables()) {
     writer.emitField(
         "Uri",
         SqlUtil.URI(table),
         EnumSet.of(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL),
         "Uri.parse(\"content://"
             + mModel.getContentAuthority()
             + "/"
             + table.name.toLowerCase()
             + "\")");
   }
   for (View view : mModel.getViews()) {
     writer.emitField(
         "Uri",
         SqlUtil.URI(view),
         EnumSet.of(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL),
         "Uri.parse(\"content://"
             + mModel.getContentAuthority()
             + "/"
             + view.name.toLowerCase()
             + "\")");
   }
   writer.emitEmptyLine();
 }
Example #11
0
  private boolean filterCard(AbstractCard abstractCard) {
    if (filterString != null && filterString.length() != 0) {
      if (!searchCardText(abstractCard, filterString)) {
        return false;
      }
    }
    if (cardTypes.size() != NUMBEROFCARDTYPES) {
      if (!match(abstractCard.cardType, cardTypes)) return false;
    }
    if (colors.size() != NUMBEROFCOLORS) {
      if (!match(abstractCard.colorFlags, colors)
          && (abstractCard.resourceThresholdGranted == null
              ? true
              : !match(abstractCard.resourceThresholdGranted[0].colorFlags, colors))) return false;
    }

    if (abstractCard instanceof Card) {

      Card card;
      card = (Card) abstractCard;

      if (card.resourceCost > maxCost || card.resourceCost < minCost) {
        return false;
      }
      if (!attributes.isEmpty()) {
        for (Attribute att : attributes) {
          if (!Arrays.asList(card.attributeFlags).contains(att)) {
            return false;
          }
        }
      }
    }
    return true;
  }
  public DecodeThread(ZXingCaptureActivity activity, int decodeMode) {

    this.activity = activity;
    handlerInitLatch = new CountDownLatch(1);

    hints = new EnumMap<DecodeHintType, Object>(DecodeHintType.class);

    Collection<BarcodeFormat> decodeFormats = new ArrayList<BarcodeFormat>();
    decodeFormats.addAll(EnumSet.of(BarcodeFormat.AZTEC));
    decodeFormats.addAll(EnumSet.of(BarcodeFormat.PDF_417));

    switch (decodeMode) {
      case BARCODE_MODE:
        decodeFormats.addAll(DecodeFormatManager.getBarCodeFormats());
        break;

      case QRCODE_MODE:
        decodeFormats.addAll(DecodeFormatManager.getQrCodeFormats());
        break;

      case ALL_MODE:
        decodeFormats.addAll(DecodeFormatManager.getBarCodeFormats());
        decodeFormats.addAll(DecodeFormatManager.getQrCodeFormats());
        break;

      default:
        break;
    }

    hints.put(DecodeHintType.POSSIBLE_FORMATS, decodeFormats);
  }
    public IntervalsForAggregatorHelper() {
      this.defaultAggregatedIntervalConfig =
          eventAggregationManagementDao.getDefaultAggregatedIntervalConfig();

      // Create the set of intervals that are actually being aggregated
      final Set<AggregationInterval> handledIntervalsNotIncluded =
          EnumSet.allOf(AggregationInterval.class);
      final Set<AggregationInterval> handledIntervalsBuilder =
          EnumSet.noneOf(AggregationInterval.class);
      for (final IntervalAwarePortalEventAggregator<PortalEvent> portalEventAggregator :
          intervalAwarePortalEventAggregators) {
        final Class<? extends IPortalEventAggregator<?>> aggregatorType =
            PortalRawEventsAggregatorImpl.this.getClass(portalEventAggregator);

        // Get aggregator specific interval info config
        final AggregatedIntervalConfig aggregatorIntervalConfig =
            this.getAggregatorIntervalConfig(aggregatorType);

        for (final Iterator<AggregationInterval> intervalsIterator =
                handledIntervalsNotIncluded.iterator();
            intervalsIterator.hasNext(); ) {
          final AggregationInterval interval = intervalsIterator.next();
          if (aggregatorIntervalConfig.isIncluded(interval)) {
            handledIntervalsBuilder.add(interval);
            intervalsIterator.remove();
          }
        }
      }

      handledIntervals = Sets.immutableEnumSet(handledIntervalsBuilder);
    }
 public boolean updateNewsStates(Collection<StatesUpdateInfo> statesUpdateInfos) {
   boolean changed = false;
   for (StatesUpdateInfo info : statesUpdateInfos) {
     long newsId = info.getNewsReference().getId();
     if (info.getOldState() == null) {
       boolean itemRemoved = fNewsIds[INews.State.NEW.ordinal()].removeByElement(newsId);
       if (!itemRemoved) {
         EnumSet<State> remainingStates = EnumSet.allOf(INews.State.class);
         remainingStates.remove(INews.State.NEW);
         remainingStates.remove(info.getNewState());
         for (INews.State state : remainingStates) {
           if (fNewsIds[state.ordinal()].removeByElement(newsId)) itemRemoved = true;
         }
       }
       if (itemRemoved) {
         changed = true;
         fNewsIds[info.getNewState().ordinal()].add(newsId);
       }
     } else if (fNewsIds[info.getOldState().ordinal()].removeByElement(newsId)) {
       changed = true;
       fNewsIds[info.getNewState().ordinal()].add(newsId);
     }
   }
   return changed;
 }
  /**
   * Validates expected {@link org.terracotta.statistics.OperationStatistic} updates for the
   * indicated {@code Ehcache} instance. The statistics identified in {@code changed} are checked
   * for a value of {@code 1}; all other statistics in the same enumeration class are checked for a
   * value of {@code 0}.
   *
   * @param ehcache the {@code Ehcache} instance to check
   * @param changed the statistics values that should have updated values
   * @param <E> the statistics enumeration type
   */
  protected static <E extends Enum<E>> void validateStats(
      final Ehcache<?, ?> ehcache, final EnumSet<E> changed) {
    assert changed != null;
    final EnumSet<E> unchanged = EnumSet.complementOf(changed);

    @SuppressWarnings("unchecked")
    final List<EnumSet<E>> sets = Arrays.asList(changed, unchanged);
    Class<E> statsClass = null;
    for (final EnumSet<E> set : sets) {
      if (!set.isEmpty()) {
        statsClass = set.iterator().next().getDeclaringClass();
        break;
      }
    }
    assert statsClass != null;

    final OperationStatistic<E> operationStatistic = getOperationStatistic(ehcache, statsClass);
    for (final E statId : changed) {
      assertThat(
          String.format("Value for %s.%s", statId.getDeclaringClass().getName(), statId.name()),
          getStatistic(operationStatistic, statId),
          StatisticMatcher.equalTo(1L));
    }
    for (final E statId : unchanged) {
      assertThat(
          String.format("Value for %s.%s", statId.getDeclaringClass().getName(), statId.name()),
          getStatistic(operationStatistic, statId),
          StatisticMatcher.equalTo(0L));
    }
  }
Example #16
0
  @Test(expected = XenonException.class)
  public void test3() throws XenonException {

    ImmutableArray<String> schemes = new ImmutableArray<>("SCHEME1", "SCHEME2");
    ImmutableArray<String> locations = new ImmutableArray<>("L1", "L2");

    ImmutableArray<XenonPropertyDescription> supportedProperties =
        new ImmutableArray<XenonPropertyDescription>(
            new XenonPropertyDescriptionImplementation(
                "xenon.adaptors.test.p1",
                Type.STRING,
                EnumSet.of(Component.XENON),
                "aap2",
                "test property p1"),
            new XenonPropertyDescriptionImplementation(
                "xenon.adaptors.test.p2",
                Type.STRING,
                EnumSet.of(Component.XENON),
                "noot2",
                "test property p2"));

    Map<String, String> p = new HashMap<>(2);
    p.put("xenon.adaptors.test.p3", "mies");

    XenonProperties prop = new XenonProperties(supportedProperties, p);

    new TestAdaptor(null, "test", "DESCRIPTION", schemes, locations, supportedProperties, prop);
  }
 private static TimelineEntity maskFields(TimelineEntity entity, EnumSet<Field> fields) {
   // Conceal the fields that are not going to be exposed
   TimelineEntity entityToReturn = new TimelineEntity();
   entityToReturn.setEntityId(entity.getEntityId());
   entityToReturn.setEntityType(entity.getEntityType());
   entityToReturn.setStartTime(entity.getStartTime());
   // Deep copy
   if (fields.contains(Field.EVENTS)) {
     entityToReturn.addEvents(entity.getEvents());
   } else if (fields.contains(Field.LAST_EVENT_ONLY)) {
     entityToReturn.addEvent(entity.getEvents().get(0));
   } else {
     entityToReturn.setEvents(null);
   }
   if (fields.contains(Field.RELATED_ENTITIES)) {
     entityToReturn.addRelatedEntities(entity.getRelatedEntities());
   } else {
     entityToReturn.setRelatedEntities(null);
   }
   if (fields.contains(Field.PRIMARY_FILTERS)) {
     entityToReturn.addPrimaryFilters(entity.getPrimaryFilters());
   } else {
     entityToReturn.setPrimaryFilters(null);
   }
   if (fields.contains(Field.OTHER_INFO)) {
     entityToReturn.addOtherInfo(entity.getOtherInfo());
   } else {
     entityToReturn.setOtherInfo(null);
   }
   return entityToReturn;
 }
Example #18
0
  public static Pair<StringContentPayload, Boolean> runVeraPDF(
      Path input, String profile, boolean hasFeatures)
      throws VeraPDFException, IOException, JAXBException {

    PdfBoxFoundryProvider.initialise();
    PDFAFlavour flavour = PDFAFlavour.byFlavourId(profile);

    ValidatorConfig validatorConfig = ValidatorFactory.createConfig(flavour, true, 10);
    FeatureExtractorConfig featureConfig = FeatureFactory.defaultConfig();
    MetadataFixerConfig fixerConfig = FixerFactory.defaultConfig();
    EnumSet<TaskType> tasks = EnumSet.of(TaskType.VALIDATE);

    if (hasFeatures) {
      tasks.add(TaskType.EXTRACT_FEATURES);
    }

    ItemProcessor processor =
        ProcessorFactory.createProcessor(
            ProcessorFactory.fromValues(validatorConfig, featureConfig, fixerConfig, tasks));

    ProcessorResult result = processor.process(input.toFile());
    ByteArrayOutputStream os = new ByteArrayOutputStream();

    boolean prettyPrint = true;
    ProcessorFactory.resultToXml(result, os, prettyPrint);

    IOUtils.closeQuietly(os);
    StringContentPayload s = new StringContentPayload(os.toString(RodaConstants.DEFAULT_ENCODING));
    return Pair.create(s, result.getValidationResult().isCompliant());
  }
Example #19
0
  /**
   * Returns the role that has the specified name.
   *
   * @throws RoleNotFoundException when the role could not be found
   */
  public Role getRole(String roleName) throws IOException {
    Assert.hasLength(roleName);

    ILockedRepository repo = null;
    try {
      repo = globalRepositoryManager.getProjectCentralRepository(REPOSITORY_NAME, false);
      String json = BlobUtils.getHeadContent(repo.r(), roleName + ROLE_SUFFIX);
      if (json == null) {
        throw new RoleNotFoundException(roleName);
      }

      Gson gson = new GsonBuilder().enableComplexMapKeySerialization().create();
      Map<String, Object> roleMap =
          gson.fromJson(json, new TypeToken<Map<String, Object>>() {}.getType());
      @SuppressWarnings("unchecked")
      Collection<String> permissions =
          (Collection<String>) roleMap.get("permissions"); // $NON-NLS-1$
      EnumSet<Permission> rolePermissions = EnumSet.noneOf(Permission.class);
      for (String permission : permissions) {
        rolePermissions.add(Permission.valueOf(permission));
      }
      Role role = new Role(roleName, rolePermissions);
      return role;
    } finally {
      Util.closeQuietly(repo);
    }
  }
Example #20
0
  /**
   * Returns all required stores for this DAO by computing dependencies of every dependencies.
   *
   * @return A set of every required stores to create a new transaction.
   */
  public Set<S> getRequiredStores() {
    final HashSet<BaseAsyncDAO<S>> dependencies = new HashSet<BaseAsyncDAO<S>>();
    dependencies.add(this);

    int previousSize = 0;
    int size = dependencies.size();

    // Expands dependencies by adding their dependencies until no new dependency is added.
    while (previousSize != size) {
      previousSize = size;

      final HashSet<BaseAsyncDAO<S>> entries = new HashSet<BaseAsyncDAO<S>>(dependencies);
      for (final BaseAsyncDAO<S> entry : entries) {
        dependencies.addAll(entry.getDependencies());
      }

      size = dependencies.size();
    }

    final EnumSet<S> requiredStores = EnumSet.noneOf(getSchema());
    for (final BaseAsyncDAO<S> dependency : dependencies) {
      requiredStores.add(dependency.getRequiredStore());
    }
    return requiredStores;
  }
 private ArchiveApplicationEntity createAdminAE(
     String aet,
     String[] image_tsuids,
     String[] video_tsuids,
     String[] other_tsuids,
     String pixConsumer,
     String pixManager) {
   ArchiveApplicationEntity ae = new ArchiveApplicationEntity(aet);
   ae.setAssociationAcceptor(true);
   ae.setAssociationInitiator(true);
   ae.setMatchUnknown(true);
   ae.setSendPendingCGet(true);
   ae.setSendPendingCMoveInterval(PENDING_CMOVE_INTERVAL);
   ae.addRejectionNote(INCORRECT_WORKLIST_ENTRY_SELECTED);
   ae.addRejectionNote(REJECT_FOR_PATIENT_SAFETY_REASONS);
   ae.addRejectionNote(INCORRECT_MODALITY_WORKLIST_ENTRY);
   ae.addRejectionNote(DATA_RETENTION_PERIOD_EXPIRED);
   addTCs(ae, null, SCU, IMAGE_CUIDS, image_tsuids);
   addTCs(ae, null, SCU, VIDEO_CUIDS, video_tsuids);
   addTCs(ae, null, SCU, OTHER_CUIDS, other_tsuids);
   addTCs(ae, EnumSet.allOf(QueryOption.class), SCP, QUERY_CUIDS, UID.ImplicitVRLittleEndian);
   addTCs(ae, EnumSet.of(QueryOption.RELATIONAL), SCP, RETRIEVE_CUIDS, UID.ImplicitVRLittleEndian);
   addTC(
       ae, null, SCP, UID.CompositeInstanceRetrieveWithoutBulkDataGET, UID.ImplicitVRLittleEndian);
   addTC(ae, null, SCP, UID.VerificationSOPClass, UID.ImplicitVRLittleEndian);
   addTC(ae, null, SCU, UID.VerificationSOPClass, UID.ImplicitVRLittleEndian);
   ae.setReturnOtherPatientIDs(true);
   ae.setReturnOtherPatientNames(true);
   ae.setLocalPIXConsumerApplication(pixConsumer);
   ae.setRemotePIXManagerApplication(pixManager);
   return ae;
 }
Example #22
0
  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);
    }
  }
  @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());
      }
    }
  }
Example #24
0
  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();
  }
  private EnumSet<ExecutableType> commonExecutableTypeChecks(
      ValidateOnExecution validateOnExecutionAnnotation) {
    if (validateOnExecutionAnnotation == null) {
      return EnumSet.noneOf(ExecutableType.class);
    }

    EnumSet<ExecutableType> executableTypes = EnumSet.noneOf(ExecutableType.class);
    if (validateOnExecutionAnnotation.type().length == 0) { // HV-757
      executableTypes.add(ExecutableType.NONE);
    } else {
      Collections.addAll(executableTypes, validateOnExecutionAnnotation.type());
    }

    // IMPLICIT cannot be mixed 10.1.2 of spec - Mixing IMPLICIT and other executable types is
    // illegal
    if (executableTypes.contains(ExecutableType.IMPLICIT) && executableTypes.size() > 1) {
      throw log.getMixingImplicitWithOtherExecutableTypesException();
    }

    // NONE can be removed 10.1.2 of spec - A list containing NONE and other types of executables is
    // equivalent to a
    // list containing the types of executables without NONE.
    if (executableTypes.contains(ExecutableType.NONE) && executableTypes.size() > 1) {
      executableTypes.remove(ExecutableType.NONE);
    }

    // 10.1.2 of spec - A list containing ALL and other types of executables is equivalent to a list
    // containing only ALL
    if (executableTypes.contains(ExecutableType.ALL)) {
      executableTypes = ALL_EXECUTABLE_TYPES;
    }

    return executableTypes;
  }
  public void testHtmlDocumentWithRandomFields() throws Exception {
    // date is not present in the html doc
    ArrayList<AttachmentProcessor.Field> fieldsList =
        new ArrayList<>(EnumSet.complementOf(EnumSet.of(AttachmentProcessor.Field.DATE)));
    Set<AttachmentProcessor.Field> selectedFields = new HashSet<>();

    int numFields = randomIntBetween(1, fieldsList.size());
    String[] selectedFieldNames = new String[numFields];
    for (int i = 0; i < numFields; i++) {
      AttachmentProcessor.Field field;
      do {
        field = randomFrom(fieldsList);
      } while (selectedFields.add(field) == false);

      selectedFieldNames[i] = field.toLowerCase();
    }
    if (randomBoolean()) {
      selectedFields.add(AttachmentProcessor.Field.DATE);
    }
    processor =
        new AttachmentProcessor(
            randomAsciiOfLength(10), "source_field", "target_field", selectedFields, 10000);

    Map<String, Object> attachmentData = parseDocument("htmlWithEmptyDateMeta.html", processor);
    assertThat(attachmentData.keySet(), hasSize(selectedFieldNames.length));
    assertThat(attachmentData.keySet(), containsInAnyOrder(selectedFieldNames));
  }
  protected JMenuBar createMenuBar() {
    JMenuBar bar = new JMenuBar();
    JMenu homeMenu = new JMenu("Homing");
    bar.add(homeMenu);

    // adding the appropriate homing options for your endstop configuration
    for (AxisId axis : AxisId.values()) {
      Endstops endstops = machine.getDriver().getMachine().getEndstops(axis);
      if (endstops != null) {
        if (endstops.hasMin == true)
          homeMenu.add(
              makeHomeItem("Home " + axis.name() + " to minimum", EnumSet.of(axis), false));
        if (endstops.hasMax == true)
          homeMenu.add(makeHomeItem("Home " + axis.name() + " to maximum", EnumSet.of(axis), true));
      }
    }

    /*
    homeMenu.add(new JSeparator());
    homeMenu.add(makeHomeItem("Home XY+",EnumSet.of(Axis.X,Axis.Y),true));
    homeMenu.add(makeHomeItem("Home XY-",EnumSet.of(Axis.X,Axis.Y),false));
    homeMenu.add(makeHomeItem("Home all+",EnumSet.allOf(Axis.class),true));
    homeMenu.add(makeHomeItem("Home all-",EnumSet.allOf(Axis.class),false));
    */
    return bar;
  }
Example #28
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;
  }
Example #29
0
 private static void checkRegionFile(
     File world,
     File region,
     RegionFile regionFile,
     DefaultErrorHandler results,
     CheckParameters params) {
   for (int i = 0; i < 1024; i++) {
     ChunkOffset offset = new ChunkOffset(i);
     Chunk chunk = new Chunk(world, region, offset, regionFile.getX(), regionFile.getZ());
     switch (regionFile.getChunkStatus(offset)) {
       case NOT_PRESENT:
         break;
       case INVALID:
         results.corruptChunk(
             chunk, "Region file header had corrupt chunk offset", EnumSet.of(NONE), NONE);
         break;
       case OK:
         try {
           checkChunk(chunk, regionFile.readChunk(offset), results, params);
         } catch (IOException ex) {
           results.corruptChunk(chunk, ex.getMessage(), EnumSet.of(NONE), NONE);
         }
         break;
     }
   }
 }
 private Operator intersectXYintersectZ(
     int x, int y, IntersectOption xyOutput, int z, IntersectOption xyzOutput, boolean skip) {
   Ordering xOrdering = new Ordering();
   xOrdering.append(field(tXIndexRowType, 1), true);
   Ordering yOrdering = new Ordering();
   yOrdering.append(field(tYIndexRowType, 1), true);
   Ordering zOrdering = new Ordering();
   zOrdering.append(field(tZIndexRowType, 1), true);
   IntersectOption scanType = skip ? IntersectOption.SKIP_SCAN : IntersectOption.SEQUENTIAL_SCAN;
   return intersect_Ordered(
       intersect_Ordered(
           indexScan_Default(tXIndexRowType, xEq(x), xOrdering),
           indexScan_Default(tYIndexRowType, yEq(y), yOrdering),
           tXIndexRowType,
           tYIndexRowType,
           1,
           1,
           ascending(true),
           JoinType.INNER_JOIN,
           EnumSet.of(scanType, xyOutput),
           null,
           true),
       indexScan_Default(tZIndexRowType, zEq(z), zOrdering),
       xyOutput == LEFT ? tXIndexRowType : tYIndexRowType,
       tZIndexRowType,
       1,
       1,
       ascending(true),
       JoinType.INNER_JOIN,
       EnumSet.of(scanType, xyzOutput),
       null,
       true);
 }