当前位置: 首页>>代码示例>>Java>>正文


Java MutablePair.getRight方法代码示例

本文整理汇总了Java中org.apache.commons.lang3.tuple.MutablePair.getRight方法的典型用法代码示例。如果您正苦于以下问题:Java MutablePair.getRight方法的具体用法?Java MutablePair.getRight怎么用?Java MutablePair.getRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang3.tuple.MutablePair的用法示例。


在下文中一共展示了MutablePair.getRight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createChannel

import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
public static int createChannel(@Nonnull String name, @Nullable Map<ChannelProperty, String> channelProperties, @Nullable Map<ChannelPermission, Integer> permissions)
{
    MutablePair<ResultType, Object> pair = MutablePair.of(ResultType.INTEGER, -1);
    int id = generator++;
    TeamSpeakAPI.results.put(id, pair);
    final String[] msg = {"createchannel:" + name};
    if (channelProperties != null)
        channelProperties.forEach(((channelProperty, s) -> msg[0] += ":" + channelProperties.toString().toUpperCase() + "=" + s));
    if (permissions != null)
        permissions.forEach(((channelPermission, integer) -> msg[0] += ":" + channelPermission.toString().toLowerCase() + "-" + integer));
    TeamSpeakAPI.publish(id, msg[0]);
    try
    {
        synchronized (pair)
        {
            pair.wait(TeamSpeakAPI.TIMEOUT);
        }
    } catch (Exception ignored) {}
    return (int)pair.getRight();
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:21,代码来源:TeamSpeakAPI.java

示例2: movePlayers

import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
public static List<UUID> movePlayers(@Nonnull List<UUID> uuids, int channelId)
{
    MutablePair<ResultType, Object> pair = MutablePair.of(ResultType.UUID_LIST, new ArrayList<>());
    int id = generator++;
    TeamSpeakAPI.results.put(id, pair);
    final String[] msg = {"move:" + channelId};
    uuids.forEach(uuid -> msg[0] += ":" + uuid);
    TeamSpeakAPI.publish(id, msg[0]);
    try
    {
        synchronized (pair)
        {
            pair.wait(TeamSpeakAPI.TIMEOUT);
        }
    } catch (Exception ignored) {}
    return (List<UUID>) pair.getRight();
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:18,代码来源:TeamSpeakAPI.java

示例3: 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;
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:24,代码来源:CommentsNodeImpl.java

示例4: 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();
    }
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:25,代码来源:CommentsNodeImpl.java

示例5: getNode

import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
@Override
public CommentsNodeImpl getNode(String path)
{
    MutablePair<String, CommentsNodeImpl> nodePair = this.dataMap.get(path);
    CommentsNodeImpl node = (nodePair == null) ? null : nodePair.getRight();
    if (node == null)
    {
        MutablePair<String, CommentsNodeImpl> anyNodePair = this.dataMap.get(ANY);
        node = (anyNodePair == null) ? null : anyNodePair.getRight();
        if (node == null)
        {
            CommentsNodeImpl commentsNode = new CommentsNodeImpl(this);
            if (nodePair != null)
            {
                nodePair.setRight(commentsNode);
            }
            else
            {
                this.dataMap.put(path, new MutablePair<>(null, commentsNode));
            }
            return commentsNode;
        }
        return node;
    }
    return node;
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:27,代码来源:CommentsNodeImpl.java

示例6: onRemove

import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
/**
 * Invoked when a mapping of a map of one of the settings is removed.<br>
 * This is used to adjust the merged map accordingly
 * 
 * @param sc the setting of which the entry was removed
 * @param key the key of the mapping to be removed
 */
private synchronized void onRemove(SettingsContainer sc, Object key) {
	MutablePair<V, Integer> pair = this.mergedMap.get(key);
	
	if (pair != null && pair.getRight() == sc.listIndex) {
		Pair<V, Integer> newVal = getIndexAndValueForKey(key);
		
		if (newVal != null) {
			pair.setLeft(newVal.getLeft());
			pair.setRight(newVal.getRight());
		}
		else this.mergedMap.remove(key);
	}
	
	removeMapIfEmpty(sc.listIndex);
}
 
开发者ID:MrNobody98,项目名称:morecommands,代码行数:23,代码来源:MergedMappedSettings.java

示例7: deleteChannel

import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
public static boolean deleteChannel(int channelId)
{
    MutablePair<ResultType, Object> pair = MutablePair.of(ResultType.BOOLEAN, false);
    int id = generator++;
    TeamSpeakAPI.results.put(id, pair);
    TeamSpeakAPI.publish(id, "deletechannel:" + channelId);
    try
    {
       synchronized (pair)
       {
           pair.wait(TeamSpeakAPI.TIMEOUT);
       }
    } catch (Exception ignored) {}
    return (boolean)pair.getRight();
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:16,代码来源:TeamSpeakAPI.java

示例8: isLinked

import org.apache.commons.lang3.tuple.MutablePair; //导入方法依赖的package包/类
public static boolean isLinked(@Nonnull UUID uuid)
{
    MutablePair<ResultType, Object> pair = MutablePair.of(ResultType.BOOLEAN, false);
    int id = generator++;
    TeamSpeakAPI.results.put(id, pair);
    TeamSpeakAPI.publish(id, "linked:" + uuid);
    try
    {
        synchronized (pair)
        {
            pair.wait(TeamSpeakAPI.TIMEOUT);
        }
    } catch (Exception ignored) {}
    return (boolean)pair.getRight();
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:16,代码来源:TeamSpeakAPI.java

示例9: 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();
    }
}
 
开发者ID:SamaGames,项目名称:SamaGamesAPI,代码行数:36,代码来源:TeamSpeakAPI.java

示例10: 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;
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:30,代码来源:CommentsNodeImpl.java

示例11: 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);
        }
    }
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:30,代码来源:CommentsNodeImpl.java

示例12: 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);
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:35,代码来源:CommentsWriter.java

示例13: 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);
      }
    }
  }
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:28,代码来源:AbstractJdbcPollInputOperator.java

示例14: 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;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:10,代码来源:Application.java

示例15: 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;
}
 
开发者ID:Diorite,项目名称:Diorite,代码行数:31,代码来源:CommentsNodeImpl.java


注:本文中的org.apache.commons.lang3.tuple.MutablePair.getRight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。