List of usage examples for com.google.common.collect Sets newHashSet
public static <E> HashSet<E> newHashSet()
From source file:com.vsct.dt.hesperides.resources.Properties.java
public static Properties empty() { return new Properties(Sets.newHashSet(), Sets.newHashSet()); }
From source file:com.textocat.textokit.morph.dictionary.resource.MorphDictionaryUtils.java
/** * @param surface a wordform//ww w .j ava2s. com * @param linkTypeFilter a predicate to ignore certain link types * @param dict a dictionary instance * @return a set of lemmas linked to each other including one of the given wordform. * If the wordform is ambiguous then the result will contain lemmas linked to any interpretation. * Return an empty set if the given worform is not found in the dictionary. */ public static Set<Lemma> getLinkedLemmas(String surface, Predicate<LemmaLinkType> linkTypeFilter, MorphDictionary dict) { List<Wordform> des = dict.getEntries(surface); Set<Lemma> res = Sets.newHashSet(); for (Wordform wf : des) { res.addAll(getLinkedLemmas(wf, linkTypeFilter, dict)); } return res; }
From source file:org.eclipse.incquery.runtime.localsearch.planner.util.CompilerHelper.java
public static Map<PVariable, Integer> createVariableMapping(SubPlan plan) { Map<PVariable, Integer> variableMapping = Maps.newHashMap(); int variableNumber = 0; // Important note: this list might contain duplications when parameters are made equal inside the pattern // This is the expected and normal behavior List<PVariable> symbolicParameterVariables = plan.getBody().getSymbolicParameterVariables(); for (PVariable pVariable : symbolicParameterVariables) { variableMapping.put(pVariable, variableNumber++); }/*from w ww . ja v a 2s. c o m*/ // Reason for complexity here: not all variables were given back for call plan.getAllDeducedVariables(); Set<PVariable> allVariables = Sets.newHashSet(); Set<PConstraint> allEnforcedConstraints = plan.getAllEnforcedConstraints(); for (PConstraint pConstraint : allEnforcedConstraints) { allVariables.addAll(pConstraint.getAffectedVariables()); } for (PVariable pVariable : allVariables) { if (!variableMapping.containsKey(pVariable)) { variableMapping.put(pVariable, variableNumber++); } } return variableMapping; }
From source file:org.jgrades.rest.admin.accounts.mass.CsvRowProcessor.java
@Override public void processStarted(ParsingContext context) { result = Sets.newHashSet(); }
From source file:com.dianping.apistatic.Job.MovieListCrawlerJob.java
@Override protected void execute() throws Exception { Set<Integer> movieIds = Sets.newHashSet(); Map<Integer, Set<Integer>> movieIdMap = Maps.newHashMap(); // key cityid for (int cityId : getCityIds()) { log("movieoninfolist current city: " + cityId); MovieListBuilder movieListBuilder = new MovieListBuilder(cityId); movieListBuilder.buildCache(movieListBuilder.getUrlAndHeader()); movieIdMap.put(cityId, movieListBuilder.getMovieIdsOnShow()); movieIds.addAll(movieListBuilder.getMovieIds()); }// w w w .j a v a 2 s . c om if (CollectionUtils.isNotEmpty(movieIds)) { writeObjectAsJsonToFile(Constants.MOVIEIDS_PATH, movieIds); } if (MapUtils.isNotEmpty(movieIdMap)) { writeObjectAsJsonToFile(Constants.MOVIEIDMAP_PATH, movieIdMap); } }
From source file:cc.recommenders.mining.calls.NoCallRecommender.java
@Override public Set<Tuple<String, Double>> getPatternsWithProbability() { return Sets.newHashSet(); }
From source file:qa.qcri.qnoise.inject.InconsistencyInjector.java
/** {@inheritDoc */ @Override//from w ww . j av a2s. c o m public void act(NoiseContext context, HashMap<String, Object> extras) { Stopwatch stopwatch = new Stopwatch().start(); HashSet<Integer> log = Sets.newHashSet(); NoiseSpec spec = context.spec; DataProfile profile = context.profile; NoiseReport report = context.report; ModelBase indexGen = ModelFactory.createRandomModel(); Constraint[] constraint = spec.constraint; double perc = spec.percentage; // by default, we keep it in the active domain double distances = spec.distance == null ? 0.0 : spec.distance[0]; int[] filteredResult = filter(profile, constraint); int nseed = (int) (Math.ceil(perc * profile.getLength())); int size = Math.min(nseed, filteredResult.length); for (int i = 0; i < size; i++) { int index; do { index = indexGen.nextIndex(0, filteredResult.length); } while (log.contains(index)); log.add(index); int columnIndex = constraint[0].messIt(profile, filteredResult[index], distances, report); // TODO; where is the old value if (columnIndex == -1) { tracer.info("No possible element is found."); } } report.appendMetric(NoiseReport.Metric.ChangedItem, nseed); report.addMetric(NoiseReport.Metric.InjectionTime, stopwatch.elapsed(TimeUnit.MILLISECONDS)); stopwatch.stop(); }
From source file:com.zaradai.bloodstone.model.composer.ServerFlows.java
protected Set<Flow> createFlowSet() { return Sets.newHashSet(); }
From source file:org.apache.kylin.measure.dim.DimCountDistinctCounter.java
public DimCountDistinctCounter() { container = Sets.newHashSet(); MAX_CARD = KylinConfig.getInstanceFromEnv().getDimCountDistinctMaxCardinality(); }
From source file:io.druid.segment.loading.StorageLocation.java
StorageLocation(File path, long maxSize) { this.path = path; this.maxSize = maxSize; this.segments = Sets.newHashSet(); }