java.util.LinkedHashSet Java Examples

The following examples show how to use java.util.LinkedHashSet. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DecisionTreeRegressionModelInfoAdapter.java    From spark-transformers with Apache License 2.0 6 votes vote down vote up
public DecisionTreeModelInfo getModelInfo(final DecisionTreeRegressionModel decisionTreeModel, final DataFrame df) {
    final DecisionTreeModelInfo treeInfo = new DecisionTreeModelInfo();

    Node rootNode = decisionTreeModel.rootNode();
    treeInfo.setRoot( DecisionNodeAdapterUtils.adaptNode(rootNode));

    final Set<String> inputKeys = new LinkedHashSet<String>();
    inputKeys.add(decisionTreeModel.getFeaturesCol());
    inputKeys.add(decisionTreeModel.getLabelCol());
    treeInfo.setInputKeys(inputKeys);

    final Set<String> outputKeys = new LinkedHashSet<String>();
    outputKeys.add(decisionTreeModel.getPredictionCol());
    treeInfo.setOutputKeys(outputKeys);

    return treeInfo;
}
 
Example #2
Source File: ConsumesRequestCondition.java    From spring-analysis-note with MIT License 6 votes vote down vote up
private static Set<ConsumeMediaTypeExpression> parseExpressions(String[] consumes, @Nullable String[] headers) {
	Set<ConsumeMediaTypeExpression> result = new LinkedHashSet<>();
	if (headers != null) {
		for (String header : headers) {
			HeaderExpression expr = new HeaderExpression(header);
			if ("Content-Type".equalsIgnoreCase(expr.name) && expr.value != null) {
				for (MediaType mediaType : MediaType.parseMediaTypes(expr.value)) {
					result.add(new ConsumeMediaTypeExpression(mediaType, expr.isNegated));
				}
			}
		}
	}
	for (String consume : consumes) {
		result.add(new ConsumeMediaTypeExpression(consume));
	}
	return result;
}
 
Example #3
Source File: SimpleClassWriter.java    From coroutines with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Derives common super class from the super name mapping passed in to the constructor.
 * @param type1 the internal name of a class.
 * @param type2 the internal name of another class.
 * @return the internal name of the common super class of the two given classes
 * @throws NullPointerException if any argument is {@code null}
 */
@Override
protected String getCommonSuperClass(final String type1, final String type2) {
    Validate.notNull(type1);
    Validate.notNull(type2);
    
    infoRepo.getInformation(type1);
    LinkedHashSet<String> type1Hierarchy = flattenHierarchy(type1);
    LinkedHashSet<String> type2Hierarchy = flattenHierarchy(type2);
    
    for (String testType1 : type1Hierarchy) {
        for (String testType2 : type2Hierarchy) {
            if (testType1.equals(testType2)) {
                return testType1;
            }
        }
    }
    
    return "java/lang/Object"; // is this correct behaviour? shouldn't both type1 and type2 ultimately contain Object?
}
 
Example #4
Source File: SqlValidatorUtil.java    From Bats with Apache License 2.0 6 votes vote down vote up
/** Computes the cube of bit sets.
 *
 * <p>For example,  <code>rollup({0}, {1})</code>
 * returns <code>({0, 1}, {0}, {})</code>.
 *
 * <p>Bit sets are not necessarily singletons:
 * <code>rollup({0, 2}, {3, 5})</code>
 * returns <code>({0, 2, 3, 5}, {0, 2}, {})</code>. */
@VisibleForTesting
public static ImmutableList<ImmutableBitSet> cube(
    List<ImmutableBitSet> bitSets) {
  // Given the bit sets [{1}, {2, 3}, {5}],
  // form the lists [[{1}, {}], [{2, 3}, {}], [{5}, {}]].
  final Set<List<ImmutableBitSet>> builder = new LinkedHashSet<>();
  for (ImmutableBitSet bitSet : bitSets) {
    builder.add(Arrays.asList(bitSet, ImmutableBitSet.of()));
  }
  Set<ImmutableBitSet> flattenedBitSets = new LinkedHashSet<>();
  for (List<ImmutableBitSet> o : EnumeratorUtils.product(builder)) {
    flattenedBitSets.add(ImmutableBitSet.union(o));
  }
  return ImmutableList.copyOf(flattenedBitSets);
}
 
Example #5
Source File: ListenerProvider.java    From binnavi with Apache License 2.0 6 votes vote down vote up
/**
 * Adds a listener to the listener provider.
 *
 * @param listener The listener to add.
 *
 * @throws NullPointerException Thrown if the listener object is null.
 * @throws IllegalStateException Thrown if the listener is already managed by the listener
 *         provider.
 */
public void addListener(final T listener) {
  Preconditions.checkNotNull(listener, "Internal Error: Listener cannot be null");

  if (m_listeners == null) {
    synchronized (this) {
      if (m_listeners == null) {
        m_listeners = new LinkedHashSet<WeakReference<T>>();
      }
    }
  }

  synchronized (m_listeners) {
    if (!m_listeners.add(new ComparableReference(listener))) {
      // throw new IllegalStateException(String.format(
      // "Internal Error: Listener '%s' can not be added more than once.", listener));
    }
  }
}
 
Example #6
Source File: DefineResolver.java    From needsmoredojo with Apache License 2.0 6 votes vote down vote up
/**
 * gets a set of all define and require blocks from a given file.
 *
 * @param file
 * @return
 */
public Set<JSCallExpression> getAllImportBlocks(PsiFile file)
{
    final Set<JSCallExpression> listOfDefinesOrRequiresToVisit = new LinkedHashSet<JSCallExpression>();
    JSRecursiveElementVisitor defineOrRequireVisitor = new JSRecursiveElementVisitor() {
        @Override
        public void visitJSCallExpression(JSCallExpression expression)
        {
            if(expression != null && expression.getMethodExpression() != null &&
                    (expression.getMethodExpression().getText().equals("define") || expression.getMethodExpression().getText().equals("require")))
            {
                listOfDefinesOrRequiresToVisit.add(expression);
            }
            super.visitJSCallExpression(expression);
        }
    };

    file.accept(defineOrRequireVisitor);

    return listOfDefinesOrRequiresToVisit;
}
 
Example #7
Source File: SDGeneratorManager.java    From spring-data-generator with MIT License 6 votes vote down vote up
private Set<String> validateExtends(Class<?>[] additionalExtends){
    Class<?> extendTemporal;
    boolean errorValidate = Boolean.FALSE;
    Set<String> additionalExtendsList = new LinkedHashSet<>();
    for (int i = 0; i < additionalExtends.length; i++) {
        extendTemporal = additionalExtends[i];
        SDLogger.addAdditionalExtend(extendTemporal.getName());

        if (!extendTemporal.isInterface()) {
            SDLogger.addError( String.format("'%s' is not a interface!", extendTemporal.getName()));
            errorValidate = Boolean.TRUE;
        } else {
            additionalExtendsList.add(extendTemporal.getName());
        }
    }

    if (errorValidate) {
        return null;
    }

    return additionalExtendsList;
}
 
Example #8
Source File: JDesktopPane.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static Collection<JInternalFrame> getAllFrames(Container parent) {
    int i, count;
    Collection<JInternalFrame> results = new LinkedHashSet<>();
    count = parent.getComponentCount();
    for (i = 0; i < count; i++) {
        Component next = parent.getComponent(i);
        if (next instanceof JInternalFrame) {
            results.add((JInternalFrame) next);
        } else if (next instanceof JInternalFrame.JDesktopIcon) {
            JInternalFrame tmp = ((JInternalFrame.JDesktopIcon) next).getInternalFrame();
            if (tmp != null) {
                results.add(tmp);
            }
        } else if (next instanceof Container) {
            results.addAll(getAllFrames((Container) next));
        }
    }
    return results;
}
 
Example #9
Source File: ReadOnlyGeneticVariantTriTyper.java    From systemsgenetics with GNU General Public License v3.0 6 votes vote down vote up
@Override
public List<Alleles> getSampleVariants() {
    List<Alleles> sampleVariantAlleles = Collections.unmodifiableList(sampleVariantsProvider.getSampleVariants(this));
    
    if (this.alleles == null) {
        //set alleles here

        LinkedHashSet<Allele> variantAlleles = new LinkedHashSet<Allele>(2);

        for (Alleles alleles2 : sampleVariantAlleles) {
            for (Allele allele : alleles2) {
                if (allele != allele.ZERO) {
                    variantAlleles.add(allele);
                }
            }
        }

        this.alleles = Alleles.createAlleles(new ArrayList<Allele>(variantAlleles));


    }
    return sampleVariantAlleles;
}
 
Example #10
Source File: StartupContext.java    From vertx-vaadin with MIT License 6 votes vote down vote up
@Override
public Set<String> getResourcePaths(String path) {
    if (path.startsWith("/")) {
        path = path.substring(1);
    }
    String relativePath = path;

    Pattern pattern;
    if (path.isEmpty()) {
        pattern = Pattern.compile("^((?:META-INF/resources/|)[^/]+(?:/|$))");
    } else {
        pattern = Pattern.compile(String.format("^((?:META-INF/resources/%1$s|%1$s)/[^/]+(?:/|$))", relativePath));
    }


    return startupContext.resources.stream()
        .filter(p -> p.startsWith("META-INF/resources/" + relativePath) || p.startsWith(relativePath))
        .map(p -> {
            Matcher matcher = pattern.matcher(p);
            matcher.find();
            return matcher.group(1);
        })
        .collect(Collectors.toCollection(LinkedHashSet::new));
}
 
Example #11
Source File: FirstSourceURLProvider.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private Set<FileObject> computeModuleRoots() {
    Set<FileObject> projectDirectories = new LinkedHashSet<>();
    String[] sourceRoots = sourcePath.getSourceRoots();
    for (String src : sourceRoots) {
        FileObject fo = getFileObject(src);
        if (fo == null) {
            continue;
        }
        Project p = getProject(fo);
        if (p == null) {
            continue;
        }
        projectDirectories.add(p.getProjectDirectory());
    }
    return projectDirectories;
}
 
Example #12
Source File: EncodingConflictOutputHandler.java    From workcraft with MIT License 6 votes vote down vote up
private LinkedHashSet<Core> convertSolutionsToCores(List<Solution> solutions) {
    LinkedHashSet<Core> cores = new LinkedHashSet<>();
    for (Solution solution: solutions) {
        String comment = solution.getComment();
        Matcher matcher = SIGNAL_PATTERN.matcher(comment);
        String signalName = matcher.find() ? matcher.group(1) : null;
        Core core = new Core(solution.getMainTrace(), solution.getBranchTrace(), signalName);
        boolean isDuplicateCore = cores.contains(core);
        if (!isDuplicateCore) {
            core.setColor(colorGenerator.updateColor());
            cores.add(core);
        }
        if (MpsatVerificationSettings.getDebugCores()) {
            if (signalName == null) {
                LogUtils.logMessage("Encoding conflict:");
            } else {
                LogUtils.logMessage("Encoding conflict for signal '" + signalName + "':");
            }
            LogUtils.logMessage("    Configuration 1: " + solution.getMainTrace());
            LogUtils.logMessage("    Configuration 2: " + solution.getBranchTrace());
            LogUtils.logMessage("    Conflict core" + (isDuplicateCore ? " (duplicate)" : "") + ": " + core);
            LogUtils.logMessage("");
        }
    }
    return cores;
}
 
Example #13
Source File: RawRankProfile.java    From vespa with Apache License 2.0 6 votes vote down vote up
private void deriveRankingFeatures(RankProfile rankProfile, ModelContext.Properties deployProperties) {
    firstPhaseRanking = rankProfile.getFirstPhaseRanking();
    secondPhaseRanking = rankProfile.getSecondPhaseRanking();
    summaryFeatures = new LinkedHashSet<>(rankProfile.getSummaryFeatures());
    rankFeatures = rankProfile.getRankFeatures();
    rerankCount = rankProfile.getRerankCount();
    matchPhaseSettings = rankProfile.getMatchPhaseSettings();
    numThreadsPerSearch = rankProfile.getNumThreadsPerSearch();
    minHitsPerThread = rankProfile.getMinHitsPerThread();
    numSearchPartitions = rankProfile.getNumSearchPartitions();
    termwiseLimit = rankProfile.getTermwiseLimit().orElse(deployProperties.defaultTermwiseLimit());
    keepRankCount = rankProfile.getKeepRankCount();
    rankScoreDropLimit = rankProfile.getRankScoreDropLimit();
    ignoreDefaultRankFeatures = rankProfile.getIgnoreDefaultRankFeatures();
    rankProperties = new ArrayList<>(rankProfile.getRankProperties());
    derivePropertiesAndSummaryFeaturesFromFunctions(rankProfile.getFunctions());
}
 
Example #14
Source File: CameraXModule.java    From mollyim-android with GNU General Public License v3.0 6 votes vote down vote up
@RequiresPermission(permission.CAMERA)
private Set<Integer> getAvailableCameraLensFacing() {
  // Start with all camera directions
  Set<Integer> available = new LinkedHashSet<>(Arrays.asList(LensFacingConverter.values()));

  // If we're bound to a lifecycle, remove unavailable cameras
  if (mCurrentLifecycle != null) {
    if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_BACK)) {
      available.remove(CameraSelector.LENS_FACING_BACK);
    }

    if (!hasCameraWithLensFacing(CameraSelector.LENS_FACING_FRONT)) {
      available.remove(CameraSelector.LENS_FACING_FRONT);
    }
  }

  return available;
}
 
Example #15
Source File: StandardScalerModelInfoAdapter.java    From spark-transformers with Apache License 2.0 6 votes vote down vote up
@Override
public StandardScalerModelInfo getModelInfo(final StandardScalerModel from) {
    final StandardScalerModelInfo modelInfo = new StandardScalerModelInfo();
    modelInfo.setMean(from.mean().toArray());
    modelInfo.setStd(from.std().toArray());
    modelInfo.setWithMean(from.getWithMean());
    modelInfo.setWithStd(from.getWithStd());

    Set<String> inputKeys = new LinkedHashSet<String>();
    inputKeys.add(from.getInputCol());
    modelInfo.setInputKeys(inputKeys);

    Set<String> outputKeys = new LinkedHashSet<String>();
    outputKeys.add(from.getOutputCol());
    modelInfo.setOutputKeys(outputKeys);

    return modelInfo;
}
 
Example #16
Source File: FacebookAccessTokenConverter.java    From geowave with Apache License 2.0 6 votes vote down vote up
@Override
public OAuth2Authentication extractAuthentication(final Map<String, ?> map) {
  final Map<String, String> parameters = new HashMap<>();
  final Set<String> scope = parseScopes(map);
  final Object principal = map.get("name");
  final Authentication user =
      new UsernamePasswordAuthenticationToken(principal, "N/A", defaultAuthorities);
  final String clientId = (String) map.get(CLIENT_ID);
  parameters.put(CLIENT_ID, clientId);
  final Set<String> resourceIds =
      new LinkedHashSet<>(
          map.containsKey(AUD) ? (Collection<String>) map.get(AUD)
              : Collections.<String>emptySet());
  final OAuth2Request request =
      new OAuth2Request(parameters, clientId, null, true, scope, resourceIds, null, null, null);
  return new OAuth2Authentication(request, user);
}
 
Example #17
Source File: BuildParameterBuilder.java    From smithy with Apache License 2.0 5 votes vote down vote up
private static Set<String> splitAndFilterString(String delimiter, String value) {
    if (value == null) {
        return SetUtils.of();
    }

    return Stream.of(value.split(Pattern.quote(delimiter)))
            .map(String::trim)
            .filter(FunctionalUtils.not(String::isEmpty))
            .collect(Collectors.toCollection(LinkedHashSet::new));
}
 
Example #18
Source File: PluginsService.java    From crate with Apache License 2.0 5 votes vote down vote up
private static void addSortedBundle(Bundle bundle, Map<String, Bundle> bundles, LinkedHashSet<Bundle> sortedBundles,
                                    LinkedHashSet<String> dependencyStack) {

    String name = bundle.plugin.getName();
    if (dependencyStack.contains(name)) {
        StringBuilder msg = new StringBuilder("Cycle found in plugin dependencies: ");
        dependencyStack.forEach(s -> {
            msg.append(s);
            msg.append(" -> ");
        });
        msg.append(name);
        throw new IllegalStateException(msg.toString());
    }
    if (sortedBundles.contains(bundle)) {
        // already added this plugin, via a dependency
        return;
    }

    dependencyStack.add(name);
    for (String dependency : bundle.plugin.getExtendedPlugins()) {
        Bundle depBundle = bundles.get(dependency);
        if (depBundle == null) {
            throw new IllegalArgumentException("Missing plugin [" + dependency + "], dependency of [" + name + "]");
        }
        addSortedBundle(depBundle, bundles, sortedBundles, dependencyStack);
        assert sortedBundles.contains(depBundle);
    }
    dependencyStack.remove(name);

    sortedBundles.add(bundle);
}
 
Example #19
Source File: DefaultYamlConverter.java    From spring-cloud-skipper with Apache License 2.0 5 votes vote down vote up
private Map<String, Collection<String>> addProperties(Map<String, Collection<String>> propertiesMap, Properties properties) {
	for (Entry<Object, Object> e : properties.entrySet()) {
		Set<String> s = new LinkedHashSet<>();
		s.add((String) e.getValue());
		propertiesMap.put((String) e.getKey(), s);
	}
	return propertiesMap;
}
 
Example #20
Source File: GamlProperties.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
public void put(final String key, final Iterable<String> values) {
	if (!map.containsKey(key))
		map.put(key, new LinkedHashSet());
	for (final String s : values) {
		map.get(key).add(s);
	}
}
 
Example #21
Source File: Fetch.java    From lumongo with Apache License 2.0 5 votes vote down vote up
public Fetch addDocumentMaskedField(String documentMaskedField) {
	if (documentMaskedFields.isEmpty()) {
		documentMaskedFields = new LinkedHashSet<>();
	}

	documentMaskedFields.add(documentMaskedField);
	return this;
}
 
Example #22
Source File: CronetProvider.java    From cronet with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Returns an unmodifiable list of all available {@link CronetProvider}s.
 * The providers are returned in no particular order. Some of the returned
 * providers may be in a disabled state and should be enabled by the invoker.
 * See {@link CronetProvider#isEnabled()}.
 *
 * @return the list of available providers.
 */
public static List<CronetProvider> getAllProviders(Context context) {
    // Use LinkedHashSet to preserve the order and eliminate duplicate providers.
    Set<CronetProvider> providers = new LinkedHashSet<>();
    addCronetProviderFromResourceFile(context, providers);
    addCronetProviderImplByClassName(
            context, PLAY_SERVICES_CRONET_PROVIDER_CLASS, providers, false);
    addCronetProviderImplByClassName(context, GMS_CORE_CRONET_PROVIDER_CLASS, providers, false);
    addCronetProviderImplByClassName(context, NATIVE_CRONET_PROVIDER_CLASS, providers, false);
    addCronetProviderImplByClassName(context, JAVA_CRONET_PROVIDER_CLASS, providers, false);
    return Collections.unmodifiableList(new ArrayList<>(providers));
}
 
Example #23
Source File: StringUtils.java    From sundrio with Apache License 2.0 5 votes vote down vote up
/**
 * Remove repeating strings that are appearing in the name.
 * This is done by splitting words (camel case) and using each word once.
 * @param name  The name to compact.
 * @return      The compact name.
 */
public static final String compact(String name) {
    Set<String> parts = new LinkedHashSet<String>();
    for (String part : name.split(SPLITTER_REGEX)) {
        parts.add(part);
    }
    return join(parts,"");
}
 
Example #24
Source File: WebContentGenerator.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Create a new WebContentGenerator.
 * @param restrictDefaultSupportedMethods {@code true} if this
 * generator should support HTTP methods GET, HEAD and POST by default,
 * or {@code false} if it should be unrestricted
 */
public WebContentGenerator(boolean restrictDefaultSupportedMethods) {
	if (restrictDefaultSupportedMethods) {
		this.supportedMethods = new LinkedHashSet<>(4);
		this.supportedMethods.add(METHOD_GET);
		this.supportedMethods.add(METHOD_HEAD);
		this.supportedMethods.add(METHOD_POST);
	}
	initAllowHeader();
}
 
Example #25
Source File: Content.java    From vespa with Apache License 2.0 5 votes vote down vote up
/** Create a new container cluster for indexing and add it to the Vespa model */
private void createImplicitIndexingCluster(IndexedSearchCluster cluster,
                                           Content content,
                                           ConfigModelContext modelContext,
                                           ApplicationConfigProducerRoot root) {
    String indexerName = cluster.getIndexingClusterName();
    AbstractConfigProducer parent = root.getChildren().get(ContainerModel.DOCPROC_RESERVED_NAME);
    if (parent == null)
        parent = new SimpleConfigProducer(root, ContainerModel.DOCPROC_RESERVED_NAME);
    ApplicationContainerCluster indexingCluster = new ApplicationContainerCluster(parent, "cluster." + indexerName, indexerName, modelContext.getDeployState());
    ContainerModel indexingClusterModel = new ContainerModel(modelContext.withParent(parent).withId(indexingCluster.getSubId()));
    indexingClusterModel.setCluster(indexingCluster);
    modelContext.getConfigModelRepoAdder().add(indexingClusterModel);
    content.ownedIndexingCluster = Optional.of(indexingCluster);

    indexingCluster.addDefaultHandlersWithVip();
    addDocproc(indexingCluster);

    List<ApplicationContainer> nodes = new ArrayList<>();
    int index = 0;
    Set<HostResource> processedHosts = new LinkedHashSet<>();
    for (SearchNode searchNode : cluster.getSearchNodes()) {
        HostResource host = searchNode.getHostResource();
        if (!processedHosts.contains(host)) {
            String containerName = String.valueOf(searchNode.getDistributionKey());
            ApplicationContainer docprocService = new ApplicationContainer(indexingCluster, containerName, index,
                                                                           modelContext.getDeployState().isHosted());
            index++;
            docprocService.useDynamicPorts();
            docprocService.setHostResource(host);
            docprocService.initService(modelContext.getDeployLogger());
            nodes.add(docprocService);
            processedHosts.add(host);
        }
    }
    indexingCluster.addContainers(nodes);

    addIndexingChain(indexingCluster);
    cluster.setIndexingChain(indexingCluster.getDocprocChains().allChains().getComponent(IndexingDocprocChain.NAME));
}
 
Example #26
Source File: MessagePackDeserializer.java    From attic-polygene-java with Apache License 2.0 5 votes vote down vote up
private Collection<?> deserializeCollection( ModuleDescriptor module, CollectionType collectionType,
                                             ArrayValue value ) throws IOException
{
    Collection<?> collection = collectionType.isSet() ? new LinkedHashSet( value.size() )
                                                      : new ArrayList( value.size() );
    for( Value element : value.list() )
    {
        collection.add( doDeserialize( module, collectionType.collectedType(), element ) );
    }
    return collection;
}
 
Example #27
Source File: RegressionTests.java    From quandl4j with Apache License 2.0 5 votes vote down vote up
/**
 * Perform a search to find how many documents there are in total and then choose random pages
 * and return a set of the quandl codes containing the first code in each page.  The idea here is to
 * give us a representative sample of the datasets available.
 * @param session the quandll session
 * @param resultProcessor a result processor to either save the results or check them
 * @return a randmly sampled set of quandl codes.
 */
private Set<String> sampleSearch(final ClassicQuandlSessionInterface session, final ResultProcessor resultProcessor) {
  SearchResult result = session.search(SearchRequest.Builder.ofAll().build()); // return all available data sets.
  final int totalDocs = result.getTotalDocuments();
  final int docsPerPage = result.getDocumentsPerPage();
  final int totalPages = totalDocs / docsPerPage;
  Set<String> quandlCodes = new LinkedHashSet<String>();
  for (int i = 0; i < _numRequests; i++) {
    int pageRequired = _random.nextInt(totalPages % MAX_PAGE);
    SearchRequest req = SearchRequest.Builder.ofQuery("").withPageNumber(pageRequired).build();
    System.out.println("About to run " + req);
    int retries = 0;
    SearchResult searchResult = null;
    do {
      try {
        searchResult = session.search(req);
        resultProcessor.processResult(searchResult);
        if (searchResult.getMetaDataResultList().size() > 0) {
          MetaDataResult metaDataResult = searchResult.getMetaDataResultList().get(0);
          if (metaDataResult.getQuandlCode() != null) {
            quandlCodes.add(metaDataResult.getQuandlCode());
          } else {
            s_logger.error("Meta data result (for req {}) returned without embedded Quandl code, result was {}", req, metaDataResult);
          }
        } else {
          s_logger.error("No results on page {}, skipping", pageRequired);
        }
      } catch (QuandlRuntimeException qre) {
        retries++;
      }
    } while (searchResult == null && retries < 1);
    if (searchResult == null) {
      s_logger.error("Giving up on this page request (" + pageRequired + ")");
    }
  }
  return quandlCodes;
}
 
Example #28
Source File: BaseViewHolder.java    From imsdk-android with MIT License 5 votes vote down vote up
public BaseViewHolder(final View view) {
    super(view);
    this.views = new SparseArray<>();
    this.childClickViewIds = new LinkedHashSet<>();
    this.itemChildLongClickViewIds = new LinkedHashSet<>();
    this.nestViews = new HashSet<>();
    convertView = view;


}
 
Example #29
Source File: OpeningHandshake.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static Collection<String> createRequestSubprotocols(
        Collection<String> subprotocols)
{
    LinkedHashSet<String> sp = new LinkedHashSet<>(subprotocols.size(), 1);
    for (String s : subprotocols) {
        if (s.trim().isEmpty() || !isValidName(s)) {
            throw illegal("Bad subprotocol syntax: " + s);
        }
        if (!sp.add(s)) {
            throw illegal("Duplicating subprotocol: " + s);
        }
    }
    return Collections.unmodifiableCollection(sp);
}
 
Example #30
Source File: MethodGeneratorImplTest.java    From jenerate with Eclipse Public License 1.0 5 votes vote down vote up
private void mockMethod1() throws Exception {
    when(method1Skeleton.getMethodName()).thenReturn(METHOD_1);
    when(method1Skeleton.getMethodArguments(objectClass)).thenReturn(METHOD_1_ARGUMENTS);
    when(method1Skeleton.getMethod(objectClass, data, METHOD1_CONTENT)).thenReturn(METHOD1_FULL_METHOD);
    when(method1.getMethodSkeleton()).thenReturn(method1Skeleton);

    when(method1Content.getLibrariesToImport(data)).thenReturn(new LinkedHashSet<String>());
    when(method1Content.getMethodContent(objectClass, data)).thenReturn(METHOD1_CONTENT);
    when(method1.getMethodContent()).thenReturn(method1Content);
}