List of usage examples for org.apache.commons.lang3.tuple ImmutablePair ImmutablePair
public ImmutablePair(final L left, final R right)
From source file:net.mintern.primitive.pair.ImmutableCharBooleanPair.java
@Override public ImmutablePair<Character, Boolean> boxed() { return new ImmutablePair<>(left, right); }
From source file:net.mintern.primitive.pair.ImmutableFloatBooleanPair.java
@Override public ImmutablePair<Float, Boolean> boxed() { return new ImmutablePair<>(left, right); }
From source file:net.mintern.primitive.pair.ImmutableDoubleBooleanPair.java
@Override public ImmutablePair<Double, Boolean> boxed() { return new ImmutablePair<>(left, right); }
From source file:lda.inference.internal.Topics.java
List<Pair<String, Double>> getVocabsSortedByPhi(int topicID, Vocabularies vocabs, final double beta) { if (topicID < 0 || topics.size() <= topicID || vocabs == null || beta <= 0.0) { throw new IllegalArgumentException(); }//from w w w. j av a2 s .c o m Topic topic = topics.get(topicID); List<Pair<String, Double>> vocabProbPairs = vocabs.getVocabularyList().stream() .map(v -> new ImmutablePair<String, Double>(v.toString(), topic.getPhi(v.id(), beta))) .sorted((p1, p2) -> Double.compare(p2.getRight(), p1.getRight())).collect(Collectors.toList()); return Collections.unmodifiableList(vocabProbPairs); }
From source file:io.github.autsia.crowly.services.sentiment.impl.CrowlySentimentAnalyzer.java
@Override public Pair<Sentiment, Float> analyze(String text) { try {//from w ww .jav a 2 s . c om HttpResponse<JsonNode> request = Unirest.post(URL).field("txt", text).asJson(); JSONObject result = request.getBody().getObject().getJSONObject(RESULT); String sentiment = result.getString(SENTIMENT); Float confidence = Float.parseFloat(result.getString(CONFIDENCE)); return new ImmutablePair<>(Sentiment.get(sentiment), confidence); } catch (Exception e) { logger.error(e.getMessage(), e); return new ImmutablePair<>(Sentiment.NEUTRAL, 0.5f); } }
From source file:com.yahoo.bard.webservice.druid.model.aggregation.FilteredAggregation.java
/** * Splits an Aggregation for 2-pass aggregation into an inner filtered aggregation & outer aggregation. The * outer aggregation is obtained by unwrapping the inner filtered aggregation and getting just the aggregation. * The outer aggregation fieldName will reference the inner aggregation name. The inner aggregation is unmodified. * * @return A pair where pair.left is the outer aggregation and pair.right is the inner. *///w w w .j a v a 2s . c om @Override public Pair<Aggregation, Aggregation> nest() { String nestingName = this.getName(); Aggregation outer = this.getAggregation().withFieldName(nestingName); return new ImmutablePair<>(outer, this); }
From source file:com.acmutv.ontoqa.core.parser.state.ConflictElement.java
/** * Adds conflict element for adjunction. * @param candidate the SLTAG candidate. * @param prevIdx the previous lexical entry index. *//*from w w w . j a v a 2s. com*/ public void addSubstitution(Sltag candidate, Integer prevIdx) { this.getSubstitutions().add(new ImmutablePair<>(candidate, prevIdx)); }
From source file:com.pinterest.terrapin.hadoop.HdfsUploader.java
@Override List<Pair<Path, Long>> getFileList() { List<Pair<Path, Long>> fileSizePairList = Lists.newArrayList(); try {/* w ww . j a v a2s . co m*/ List<HdfsFileStatus> fileStatusList = TerrapinUtil.getHdfsFileList(dfsClient, hdfsDir.toString()); for (HdfsFileStatus fileStatus : fileStatusList) { fileSizePairList.add(new ImmutablePair(fileStatus.getFullPath(hdfsDir), fileStatus.getLen())); } } catch (IOException e) { throw new RuntimeException(e); } return fileSizePairList; }
From source file:fr.fastconnect.factory.tibco.bw.maven.hawk.AbstractMethodAction.java
public void setArguments(String... arguments) { List<ImmutablePair<String, String>> _arguments = new ArrayList<ImmutablePair<String, String>>(); Integer i = 0;/*from w w w.j a v a 2 s.com*/ for (String argument : arguments) { i++; _arguments.add(new ImmutablePair<String, String>("arg" + i.toString(), argument)); } this.setArguments(_arguments); }
From source file:com.cfitzarl.cfjwed.service.impl.MealOptionServiceImpl.java
/** {@inheritDoc} **/ @Override/*from w w w. ja va 2s . c o m*/ public List<Pair<MealOption, Long>> getChosenMealCount() { List<Pair<MealOption, Long>> mealGroupings = new ArrayList<>(); for (MealOption option : find()) { mealGroupings.add(new ImmutablePair<>(option, attendantDao.countByMeal(option))); } return mealGroupings; }