List of usage examples for org.apache.commons.lang3.tuple Pair getLeft
public abstract L getLeft();
Gets the left element from this pair.
When treated as a key-value pair, this is the key.
From source file:hu.ppke.itk.nlpg.purepos.common.lemma.AbstractLemmaTransformation.java
@Override public Pair<String, Integer> analyze(String word) { Pair<String, Integer> ret = encode(word, representation); return Pair.of(postprocess(ret.getLeft()), ret.getRight()); }
From source file:com.vmware.identity.openidconnect.server.SlidingWindowMap.java
public V remove(K key) { Validate.notNull(key, "key"); Date now = this.timeProvider.getCurrentTime(); cleanUp(now);/* w w w. java2 s .c o m*/ Pair<V, Date> pair = this.map.remove(key); return (pair == null) ? null : pair.getLeft(); }
From source file:fi.jgke.miniplc.unit.VariableTest.java
@Test public void typeSanity() { List<Pair<VariableType, Object>> types = new ArrayList<>(); types.add(new ImmutablePair<>(VariableType.BOOL, "str")); types.add(new ImmutablePair<>(VariableType.BOOL, 5)); types.add(new ImmutablePair<>(VariableType.BOOL, null)); types.add(new ImmutablePair<>(VariableType.STRING, true)); types.add(new ImmutablePair<>(VariableType.STRING, 5)); types.add(new ImmutablePair<>(VariableType.STRING, null)); types.add(new ImmutablePair<>(VariableType.INT, true)); types.add(new ImmutablePair<>(VariableType.INT, "str")); types.add(new ImmutablePair<>(VariableType.INT, null)); for (Pair<VariableType, Object> p : types) { try {/*w w w .ja v a 2 s .co m*/ createVariable(p.getLeft(), p.getRight()); assertTrue(false); } catch (TypeException e) { assertNotNull(p.getRight()); } catch (IllegalStateException e) { assertNull(p.getRight()); } } }
From source file:ddf.catalog.operation.faceting.FacetedAttributeResult.java
/** * Instantiates a FacetedAttributeResult representing a portion of the results of a faceted query. * This constructor takes a zipped list of value to count pairings. * * @param attributeName The field name for which faceting data is reported * @param valueCountPairs A list of value-count pairs for the faceted field *///from w w w . j av a 2 s. co m public FacetedAttributeResult(String attributeName, List<Pair<String, Long>> valueCountPairs) { this.attributeName = attributeName; facetValues = new ArrayList<>(); for (Pair<String, Long> valueCountPair : valueCountPairs) { facetValues.add(new FacetValueCount(valueCountPair.getLeft(), valueCountPair.getRight())); } }
From source file:de.johni0702.minecraft.gui.layout.CustomLayout.java
protected void set(GuiElement element, int x, int y, int width, int height) { Pair<Point, Dimension> entry = entry(element); entry.getLeft().setLocation(x, y); entry.getRight().setSize(width, height); }
From source file:fredboat.command.music.control.StopCommand.java
@Override public void onInvoke(Guild guild, TextChannel channel, Member invoker, Message message, String[] args) { GuildPlayer player = PlayerRegistry.get(guild); player.setCurrentTC(channel);/*from w ww . j a v a 2 s . c om*/ List<AudioTrackContext> tracks = player.getRemainingTracks(); Pair<Boolean, String> pair = player.skipTracksForMemberPerms(channel, invoker, tracks); if (pair.getLeft()) { switch (tracks.size()) { case 0: channel.sendMessage(I18n.get(guild).getString("stopAlreadyEmpty")).queue(); break; case 1: channel.sendMessage(I18n.get(guild).getString("stopEmptyOne")).queue(); break; default: channel.sendMessage( MessageFormat.format(I18n.get(guild).getString("stopEmptySeveral"), tracks.size())).queue(); break; } player.leaveVoiceChannelRequest(channel, true); } }
From source file:com.qq.tars.service.PatchService.java
private String md5(String path) { String command = "md5sum " + path; Pair<Integer, Pair<String, String>> result = SystemUtils.exec(command); if (result.getLeft() == -1) { return null; }//from w ww. j a va 2 s. com String stdout = result.getRight().getLeft(); if (stdout.contains(" ")) { stdout = stdout.substring(0, stdout.indexOf(" ")); } return StringUtils.trimToNull(stdout); }
From source file:com.github.blindpirate.gogradle.core.dependency.produce.external.gopm.GopmfileParser.java
private Map<String, Object> toNotation(Pair<String, String> nameAndValue) { String name = nameAndValue.getLeft(); String value = nameAndValue.getRight(); Map<String, Object> ret = new HashMap<>(); ret.put(NAME_KEY, name);/*from ww w .j a v a 2s .c o m*/ if (value.startsWith(BRANCH_KEYWORD)) { ret.put(BRANCH_KEY, value.substring(BRANCH_KEYWORD.length())); } else if (value.startsWith(TAG_KEYWORD)) { ret.put(TAG_KEY, value.substring(TAG_KEYWORD.length())); } else if (value.startsWith(COMMIT_KEYWORD)) { ret.put(COMMIT_KEY, value.substring(COMMIT_KEYWORD.length())); } else if (isNotBlank(value)) { // it will be treated as file path ret.put(DIR_KEY, value); } return ret; }
From source file:ddf.catalog.operation.impl.FacetAttributeResultImpl.java
/** * Instantiates a FacetAttributeResultImpl representing a portion of the results of a faceted * query. This constructor takes a zipped list of value to count pairings. * * @param attributeName The field name for which faceting data is reported * @param valueCountPairs A list of value-count pairs for the faceted field *//*from www. ja v a2s . c om*/ public FacetAttributeResultImpl(String attributeName, List<Pair<String, Long>> valueCountPairs) { this.attributeName = attributeName; facetValues = new ArrayList<>(); for (Pair<String, Long> valueCountPair : valueCountPairs) { facetValues.add(new FacetValueCountImpl(valueCountPair.getLeft(), valueCountPair.getRight())); } }
From source file:cc.kave.commons.model.groum.GroumBuilder.java
public Set<Node> getPredecessors(Node node) { Set<Node> predecessors = new HashSet<>(); for (Pair<Node, Node> edge : edges) { if (edge.getRight() == node) { predecessors.add(edge.getLeft()); }/* w w w .j a v a 2s . c o m*/ } return predecessors; }