本文整理汇总了Java中org.apache.commons.lang3.tuple.MutablePair.getLeft方法的典型用法代码示例。如果您正苦于以下问题:Java MutablePair.getLeft方法的具体用法?Java MutablePair.getLeft怎么用?Java MutablePair.getLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.commons.lang3.tuple.MutablePair
的用法示例。
在下文中一共展示了MutablePair.getLeft方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyMap
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
public Map<String, MutablePair<String, CommentsNodeImpl>> copyMap(CommentsNodeImpl parent)
{
Map<String, MutablePair<String, CommentsNodeImpl>> result = new HashMap<>(this.dataMap.size());
for (Entry<String, MutablePair<String, CommentsNodeImpl>> entry : this.dataMap.entrySet())
{
String keyToCpy = entry.getKey();
MutablePair<String, CommentsNodeImpl> valueToCpy = entry.getValue();
CommentsNodeImpl nodeToCpy = valueToCpy.getRight();
CommentsNodeImpl copiedNode;
if (nodeToCpy == null)
{
copiedNode = null;
}
else
{
copiedNode = new CommentsNodeImpl(parent);
copiedNode.dataMap.putAll(nodeToCpy.copyMap(parent));
}
MutablePair<String, CommentsNodeImpl> copied = new MutablePair<>(valueToCpy.getLeft(), copiedNode);
result.put(keyToCpy, copied);
}
return result;
}
示例2: trim
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
@Override
public void trim()
{
for (Iterator<Entry<String, MutablePair<String, CommentsNodeImpl>>> iterator = this.dataMap.entrySet().iterator(); iterator.hasNext(); )
{
Entry<String, MutablePair<String, CommentsNodeImpl>> entry = iterator.next();
MutablePair<String, CommentsNodeImpl> value = entry.getValue();
CommentsNodeImpl right = value.getRight();
if (right != null)
{
right.trim();
}
if (((right == null) || right.dataMap.isEmpty()) && (value.getLeft() == null))
{
iterator.remove();
continue;
}
if (right == null)
{
continue;
}
right.trim();
}
}
示例3: getComment
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
@Override
@Nullable
public String getComment(String path)
{
MutablePair<String, CommentsNodeImpl> nodePair = this.dataMap.get(path);
if (nodePair != null)
{
String comment = nodePair.getLeft();
if (comment != null)
{
return comment;
}
}
MutablePair<String, CommentsNodeImpl> anyNodePair = this.dataMap.get(ANY);
if (anyNodePair != null)
{
return anyNodePair.getKey();
}
return null;
}
示例4: receive
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
@Override
public void receive(String channel, String packet)
{
String[] args = packet.split(":");
String[] prefix = args[0].split("/");
if (!prefix[0].equals(SamaGamesAPI.get().getServerName()))
return ;
int id = Integer.parseInt(prefix[1]);
MutablePair<ResultType, Object> result = TeamSpeakAPI.results.get(id);
TeamSpeakAPI.results.remove(id);
boolean ok = args.length > 1 && !args[1].equals("ERROR");
if (!ok)
SamaGamesAPI.get().getPlugin().getLogger().severe("[TeamSpeakAPI] Error : " + (args.length > 2 ? args[2] : "Unknown") + "(packet = " + packet + ")");
else
switch (result.getLeft())
{
case UUID_LIST:
List<UUID> uuid = (List<UUID>) result.getRight();
for (int i = 1; i < args.length; i++)
uuid.add(UUID.fromString(args[i]));
break;
case INTEGER:
result.setRight(Integer.parseInt(args[1]));
break;
case BOOLEAN:
result.setRight(args[1].equalsIgnoreCase("OK") || args[1].equalsIgnoreCase("true"));
break ;
default:
break ;
}
synchronized (result)
{
result.notifyAll();
}
}
示例5: buildMap
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
Map<String, MutablePair<String, ?>> buildMap()
{
Map<String, MutablePair<String, ?>> resultMap = new LinkedHashMap<>(this.dataMap.size());
for (Entry<String, MutablePair<String, CommentsNodeImpl>> entry : this.dataMap.entrySet())
{
MutablePair<String, CommentsNodeImpl> value = entry.getValue();
CommentsNodeImpl right = value.getRight();
String left = value.getLeft();
if ((right == null) && (left == null))
{
continue;
}
Map<String, MutablePair<String, ?>> rightMap = null;
if (right != null)
{
rightMap = right.buildMap();
if (rightMap.isEmpty())
{
rightMap = null;
if (left == null)
{
continue;
}
}
}
resultMap.put(entry.getKey(), new MutablePair<>(left, rightMap));
}
return resultMap;
}
示例6: join
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
@Override
public void join(CommentsNode toJoin_)
{
if (toJoin_ instanceof EmptyCommentsNode)
{
return;
}
if (! (toJoin_ instanceof CommentsNodeImpl))
{
throw new IllegalArgumentException("Can't join to unknown node type.");
}
CommentsNodeImpl toJoin = (CommentsNodeImpl) toJoin_;
for (Entry<String, MutablePair<String, CommentsNodeImpl>> entry : toJoin.dataMap.entrySet())
{
String nodeKey = entry.getKey();
MutablePair<String, CommentsNodeImpl> pair = entry.getValue();
String nodeComment = pair.getLeft();
CommentsNodeImpl subNode = pair.getRight();
if (nodeComment != null)
{
this.setComment(nodeKey, nodeComment);
}
if (subNode != null)
{
this.join(nodeKey, subNode);
}
}
}
示例7: write
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private void write(Map<String, MutablePair<String, ?>> map) throws IOException
{
this.updateIndent(true);
int keys = map.entrySet().size();
int k = 0;
for (Entry<String, MutablePair<String, ?>> entry : map.entrySet())
{
k += 1;
MutablePair<String, ?> pair = entry.getValue();
String comment = pair.getLeft();
Map<String, MutablePair<String, ?>> rightMap = (Map<String, MutablePair<String, ?>>) pair.getRight();
int rightKeys = (rightMap == null) ? 0 : rightMap.size();
boolean newLine = keys > 3;
if (comment != null)
{
this.writeComment(comment);
}
String key = entry.getKey();
this.writeKey(key);
if (rightMap != null)
{
this.write(rightMap);
}
if (newLine)
{
this.writeNewLine(false);
}
}
this.writeNewLine(false);
this.updateIndent(false);
}
示例8: updateBlock
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
public void updateBlock(long time, BlockChangeRecord record) {
MutablePair<Long, BlockChangeRecord> pair = blockChanges(record.getPosition());
if (pair.getLeft() < time) {
pair.setLeft(time);
pair.setRight(record);
}
}
示例9: beginWindow
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
@Override
public void beginWindow(long windowId)
{
currentWindowId = windowId;
if (currentWindowId <= windowManager.getLargestCompletedWindow()) {
try {
replay(currentWindowId);
return;
} catch (SQLException e) {
throw new RuntimeException("Replay failed", e);
}
}
currentWindowRecoveryState = WindowData.of(currentWindowRecoveryState.key, lastEmittedRow, 0);
if (isPollerPartition) {
MutablePair<Object, Integer> keyOffset = fetchedKeyAndOffset.get();
if (keyOffset != null && keyOffset.getRight() < lastEmittedRow) {
if (!adjustKeyAndOffset.get()) {
// rebase offset
lastEmittedRow -= keyOffset.getRight();
currentWindowRecoveryState.lowerBound = lastEmittedRow;
currentWindowRecoveryState.key = keyOffset.getLeft();
adjustKeyAndOffset.set(true);
}
}
}
}
示例10: accumulate
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
@Override
public MutablePair<MutableLong, MutableLong> accumulate(MutablePair<MutableLong, MutableLong> accumulatedValue, MutablePair<Double, Double> input)
{
if (input.getLeft() * input.getLeft() + input.getRight() * input.getRight() < 1) {
accumulatedValue.getLeft().increment();
}
accumulatedValue.getRight().increment();
return accumulatedValue;
}
示例11: buildMap
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
Map<String, MutablePair<String, ?>> buildMap()
{
Map<String, MutablePair<String, ?>> resultMap = new LinkedHashMap<>(this.dataMap.size());
for (Entry<String, MutablePair<String, CommentsNodeImpl>> entry : this.dataMap.entrySet())
{
MutablePair<String, CommentsNodeImpl> value = entry.getValue();
CommentsNodeImpl right = value.getRight();
String left = value.getLeft();
if ((right == null) && (left == null))
{
continue;
}
Map<String, MutablePair<String, ?>> rightMap = null;
if (right != null)
{
rightMap = right.buildMap();
if (rightMap.isEmpty())
{
rightMap = null;
if (left == null)
{
continue;
}
}
}
resultMap.put(entry.getKey(), new MutablePair<>(left, rightMap));
}
return resultMap;
}
示例12: refreshPermissionLevel
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
/**
* Refreshes the permission level required to be able to use this command
*/
public final void refreshPermissionLevel() {
MutablePair<Integer, TObjectIntMap<String>> level = MoreCommandsConfig.permissionMapping.get(this.getCommandName());
this.basePermLevel = level == null ? -1 : level.getLeft();
this.actionPermLevels = level == null ? null : level.getRight();
}
示例13: tick
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
/**
* The actual event dispatcher. This function is called by Timed on the time
* instance when the first not yet dispatched deferred event is due.
*
* <i>Note:</i> If multiple events must be delivered at a given time instance,
* then the order of the dispatched events are undefined.
*/
@Override
public void tick(long fires) {
final MutablePair<Integer, DeferredEvent[]> simultaneousReceiverPairs = toSweep.remove(fires);
if (simultaneousReceiverPairs != null) {
final int len = simultaneousReceiverPairs.getLeft();
final DeferredEvent[] simultaneousReceivers = simultaneousReceiverPairs.getRight();
for (int i = 0; i < len; i++) {
simultaneousReceivers[i].eventAction();
simultaneousReceivers[i].received = true;
}
}
updateDispatcher();
}
示例14: DeferredEvent
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
/**
* Allows constructing objects that will receive an eventAction() call from
* Timed after delay ticks.
*
* @param delay
* the number of ticks that should pass before this deferred event
* object's eventAction() will be called.
*/
public DeferredEvent(final long delay) {
if (delay <= 0) {
eventArrival = Timed.getFireCount();
eventAction();
received = true;
return;
}
eventArrival = Timed.calcTimeJump(delay);
MutablePair<Integer, DeferredEvent[]> simultaneousReceiverPairs = toSweep.get(eventArrival);
if (simultaneousReceiverPairs == null) {
simultaneousReceiverPairs = new MutablePair<Integer, DeferredEvent[]>(0, new DeferredEvent[5]);
toSweep.put(eventArrival, simultaneousReceiverPairs);
}
int len = simultaneousReceiverPairs.getLeft();
DeferredEvent[] simultaneousReceivers = simultaneousReceiverPairs.getRight();
if (len == simultaneousReceivers.length) {
DeferredEvent[] temp = new DeferredEvent[simultaneousReceivers.length * 2];
System.arraycopy(simultaneousReceivers, 0, temp, 0, len);
simultaneousReceivers = temp;
simultaneousReceiverPairs.setRight(temp);
}
simultaneousReceivers[len++] = this;
simultaneousReceiverPairs.setLeft(len);
if (!dispatcherSingleton.isSubscribed() || dispatcherSingleton.getNextEvent() > eventArrival) {
dispatcherSingleton.updateDispatcher();
}
}
示例15: cancel
import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
/**
* If the call for eventAction() is no longer necessary at the previously
* specified time then the user can cancel this call to arrive with this
* function.
*
* Calling this function will have no effect on events that are already past
* due.
*/
public void cancel() {
if (received)
return;
if (!cancelled) {
cancelled = true;
MutablePair<Integer, DeferredEvent[]> simultaneousReceiverPairs = toSweep.get(eventArrival);
if (simultaneousReceiverPairs != null) {
int len = simultaneousReceiverPairs.getLeft();
DeferredEvent[] simultaneousReceivers = simultaneousReceiverPairs.getRight();
// For performance reasons this removal operation does not keep
// the order of the array entries
for (int i = 0; i < len; i++) {
if (simultaneousReceivers[i] == this) {
len--;
if (len > i) {
simultaneousReceivers[i] = simultaneousReceivers[len];
}
simultaneousReceivers[len] = null;
break;
}
}
if (len == 0) {
toSweep.remove(eventArrival);
dispatcherSingleton.updateDispatcher();
} else {
simultaneousReceiverPairs.setLeft(len);
}
}
}
}