• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java MutableTriple类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.commons.lang3.tuple.MutableTriple的典型用法代码示例。如果您正苦于以下问题:Java MutableTriple类的具体用法?Java MutableTriple怎么用?Java MutableTriple使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



MutableTriple类属于org.apache.commons.lang3.tuple包,在下文中一共展示了MutableTriple类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: updateTuioCursor

import org.apache.commons.lang3.tuple.MutableTriple; //导入依赖的package包/类
/**
 * Update Cursor Event.
 *
 * @param tcur
 */
@Override
public void updateTuioCursor(TuioCursor tcur) {
    logger.trace(MessageFormat.format("update tuio cursor id: {0}", tcur.getCursorID()));

    int width = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth();
    int height = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();

    if (!curs.isEmpty() && curs.get(0).getLeft() == tcur.getSessionID()) {
        logger.debug(MessageFormat.format("update mouse move: ({0}, {1})", new Object[]{tcur.getScreenX(width), tcur.getScreenY(height)}));
        robot.mouseMove(tcur.getScreenX(width), tcur.getScreenY(height));
    }
    for (MutableTriple<Long, Integer, Integer> trip : curs) {
        if (trip.getLeft() == tcur.getSessionID()) {
            trip.setMiddle(tcur.getScreenX(width));
            trip.setRight(tcur.getScreenY(height));
            break;
        }
    }
}
 
开发者ID:artistech-inc,项目名称:tuio-mouse-driver,代码行数:25,代码来源:MouseDriver.java


示例2: removeTuioCursor

import org.apache.commons.lang3.tuple.MutableTriple; //导入依赖的package包/类
/**
 * Remove Cursor Event.
 *
 * @param tcur
 */
@Override
public void removeTuioCursor(TuioCursor tcur) {
    logger.trace(MessageFormat.format("remove tuio cursor id: {0}", tcur.getCursorID()));

    if (!curs.isEmpty() && curs.get(0).getLeft() == tcur.getSessionID()) {
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
    } else if (curs.size() == 2) {
        logger.debug(MessageFormat.format("remove mouse release: {0}", tcur.getCursorID()));
        robot.mouseRelease(InputEvent.BUTTON1_MASK);
    }
    MutableTriple t = null;
    for (MutableTriple<Long, Integer, Integer> trip : curs) {
        if (trip.getLeft() == tcur.getSessionID()) {
            t = trip;
            break;
        }
    }
    if (t != null) {
        curs.remove(t);
    }
    if (!curs.isEmpty()) {
        robot.mouseMove(curs.get(0).getMiddle(), curs.get(0).getRight());
    }
}
 
开发者ID:artistech-inc,项目名称:tuio-mouse-driver,代码行数:30,代码来源:MouseDriver.java


示例3: loadDMap

import org.apache.commons.lang3.tuple.MutableTriple; //导入依赖的package包/类
/**
 * Given a key, it loads one docMap into memory
 *
 * @param key
 */
@SuppressWarnings("unchecked")
private void loadDMap(int key) {
    String path = dmap_cache.get(key).getMiddle();

    dmap_cache.put(key, new MutableTriple<>(System.currentTimeMillis(), path, (ConcurrentHashMap<Integer, Pair<String, Integer>>) dm.read(path)));
}
 
开发者ID:luminoso,项目名称:information-retrieval,代码行数:12,代码来源:SearchEngine.java


示例4: buildDmap_cache

import org.apache.commons.lang3.tuple.MutableTriple; //导入依赖的package包/类
/**
 * Builds the docMap cache map
 */
private void buildDmap_cache() {
    dm.getRFiles()
            .parallelStream()
            .filter(file -> file.getName().contains("docMap"))
            .forEach(file -> dmap_cache.put(Integer.valueOf(file.getName().split("\\.")[0]), new MutableTriple<>(System.currentTimeMillis(), file.getPath(), null)));
}
 
开发者ID:luminoso,项目名称:information-retrieval,代码行数:10,代码来源:SearchEngine.java


示例5: addTuioCursor

import org.apache.commons.lang3.tuple.MutableTriple; //导入依赖的package包/类
/**
 * Add Cursor Event.
 *
 * @param tcur
 */
@Override
public void addTuioCursor(TuioCursor tcur) {
    logger.trace(MessageFormat.format("add tuio cursor id: {0}", tcur.getCursorID()));

    int width = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth();
    int height = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();

    boolean found = false;
    for (MutableTriple<Long, Integer, Integer> trip : curs) {
        if (trip.getLeft() == tcur.getSessionID()) {
            found = true;
            break;
        }
    }
    if (!found) {
        curs.add(new MutableTriple<>(tcur.getSessionID(), tcur.getScreenX(width), tcur.getScreenY(height)));
    }

    if (curs.size() == 1) {
        logger.debug(MessageFormat.format("add mouse move: ({0}, {1})", new Object[]{tcur.getScreenX(width), tcur.getScreenY(height)}));
        robot.mouseMove(tcur.getScreenX(width), tcur.getScreenY(height));
    } else {
        logger.debug(MessageFormat.format("add mouse press: {0}", tcur.getCursorID()));
        if (curs.size() == 2) {
            robot.mousePress(InputEvent.BUTTON1_MASK);
        } else {
            robot.mousePress(InputEvent.BUTTON3_MASK);
            robot.mouseRelease(InputEvent.BUTTON3_MASK);
        }
    }
}
 
开发者ID:artistech-inc,项目名称:tuio-mouse-driver,代码行数:37,代码来源:MouseDriver.java


示例6: inspect

import org.apache.commons.lang3.tuple.MutableTriple; //导入依赖的package包/类
public Object inspect(final ProceedingJoinPoint pjp) throws Throwable {
	MethodSignature signature = (MethodSignature) pjp.getSignature();

	InvokeInfo invokeInfo = invokeInfoThreadLocal.get();
	boolean isRoot = false;
	if (invokeInfo == null) {
		invokeInfo = new InvokeInfo();
		invokeInfoThreadLocal.set(invokeInfo);
		isRoot = true;
	}

	MutableTriple<Integer, MethodSignature, Long> currInvokeInfo =
			MutableTriple.of(invokeInfo.currentLevel++, signature, 0L);
	invokeInfo.infos.add(currInvokeInfo);

	try {
		Tick tick = Tick.tick();
		Object result = pjp.proceed();
		currInvokeInfo.setRight(tick.nip());
		return result;
	} finally {
		invokeInfo.currentLevel--;

		if (isRoot) {
			for (MutableTriple<Integer, MethodSignature, Long> info : invokeInfo.infos) {
				System.out.println(genInfoStr(info));
			}
			invokeInfoThreadLocal.set(null);
		}
	}
}
 
开发者ID:myshzzx,项目名称:mlib,代码行数:32,代码来源:PerformanceInspector.java


示例7: load

import org.apache.commons.lang3.tuple.MutableTriple; //导入依赖的package包/类
public void load(Reader data) throws IOException {
    vertices.clear();
    uvs.clear();
    normals.clear();
    faces.clear();
    BufferedReader reader = new BufferedReader(data);
    String line;
    int lineNumber = 1;
    while ((line = reader.readLine()) != null){
        StringTokenizer tokenizer = new StringTokenizer(line);
        if (tokenizer.hasMoreTokens()){
            switch (tokenizer.nextToken()){
                case "v":
                    if (tokenizer.countTokens() != 3){
                        MrglgaghCore.logger.error("Malformed vertex on line "+lineNumber);
                        break;
                    }
                    vertices.add(new Point3f(Float.parseFloat(tokenizer.nextToken()),
                            Float.parseFloat(tokenizer.nextToken()),
                            Float.parseFloat(tokenizer.nextToken())));
                    break;
                case "vt":
                    if (tokenizer.countTokens() != 2){
                        MrglgaghCore.logger.error("Malformed uv on line "+lineNumber);
                        break;
                    }
                    uvs.add(new Point2f(Float.parseFloat(tokenizer.nextToken()),
                            Float.parseFloat(tokenizer.nextToken())));
                    break;
                case "vn":
                    if (tokenizer.countTokens() != 3){
                        MrglgaghCore.logger.error("Malformed vertex normal on line "+lineNumber);
                        break;
                    }
                    normals.add(new Point3f(Float.parseFloat(tokenizer.nextToken()),
                            Float.parseFloat(tokenizer.nextToken()),
                            Float.parseFloat(tokenizer.nextToken())));
                    break;
                case "f":
                    if (tokenizer.countTokens() < 3){
                        MrglgaghCore.logger.error("Malformed face on line "+lineNumber);
                        break;
                    }
                    MutableTriple<Point3i, Point3i, Point3i> face = new MutableTriple<>();
                    String[] p1 = tokenizer.nextToken().split("/");
                    face.setLeft(new Point3i(Integer.parseInt(p1[0])-1, Integer.parseInt(p1[1])-1, Integer.parseInt(p1[2])-1));
                    String[] p2 = tokenizer.nextToken().split("/");
                    face.setMiddle(new Point3i(Integer.parseInt(p2[0])-1, Integer.parseInt(p2[1])-1, Integer.parseInt(p2[2])-1));
                    String[] p3 = tokenizer.nextToken().split("/");
                    face.setRight(new Point3i(Integer.parseInt(p3[0])-1, Integer.parseInt(p3[1])-1, Integer.parseInt(p3[2])-1));
                    faces.add(face);
                    break;
            }
        }
        lineNumber++;
    }
}
 
开发者ID:sedlak477,项目名称:MrglgaghCore,代码行数:58,代码来源:OBJModel.java


示例8: buildATriple

import org.apache.commons.lang3.tuple.MutableTriple; //导入依赖的package包/类
private static void buildATriple(MutableTriple<String, String, String> triple)
{
   triple.setMiddle("New Middle");
}
 
开发者ID:developerSid,项目名称:AwesomeJavaLibraryExamples,代码行数:5,代码来源:ExampleTriple.java


示例9: getMapping

import org.apache.commons.lang3.tuple.MutableTriple; //导入依赖的package包/类
/**
 * Computes a mapping between a source and a target.
 *
 * @param source
 *            Source cache
 * @param target
 *            Target cache
 * @param sourceVar
 *            Variable for the source dataset
 * @param targetVar
 *            Variable for the target dataset
 * @param expression
 *            Expression to process.
 * @param threshold
 *            Similarity threshold
 * @return A mapping which contains links between the source instances and
 *         the target instances
 */
@Override
public AMapping getMapping(ACache source, ACache target, String sourceVar, String targetVar, String expression,
        double threshold) {
    if (threshold <= 0) {
        throw new InvalidThresholdException(threshold);
    }
    List<String> listA, listB;
    Map<String, List<Integer>> invListA, invListB;
    List<String> properties = PropertyFetcher.getProperties(expression, threshold);
    Map<String, Set<String>> sourceMap = getValueToUriMap(source, properties.get(0));
    Map<String, Set<String>> targetMap = getValueToUriMap(target, properties.get(1));
    listA = new ArrayList<>(sourceMap.keySet());
    listB = new ArrayList<>(targetMap.keySet());
    // create inverted lists (code=>index of original list)
    invListA = getInvertedList(listA);
    invListB = getInvertedList(listB);
    Deque<Triple<Integer, List<Integer>, List<Integer>>> similarityBook = new ArrayDeque<>();
    // construct trie from smaller list
    TrieNode trie = TrieNode.recursiveAddAll(invListB);
    int maxDistance = getMaxDistance(threshold);
    // iterate over other list
    for (Map.Entry<String, List<Integer>> entry : invListA.entrySet()) {
        // for each entry do trie search
        Deque<TrieSearchState> queue = new ArrayDeque<>();
        queue.add(new TrieSearchState(0, 0, trie));
        while (!queue.isEmpty()) {
            TrieSearchState current = queue.pop();
            Set<Map.Entry<Character, TrieNode>> childs = current.getNode().getChildren();
            if (childs.isEmpty() && !current.getNode().getReferences().isEmpty()) {
                similarityBook.push(new MutableTriple<>(current.getDistance(), entry.getValue(),
                        current.getNode().getReferences()));
            }
            for (Map.Entry<Character, TrieNode> nodeEntry : childs) {
                if (nodeEntry.getKey().equals(entry.getKey().charAt(current.getPosition()))) {
                    queue.push(new TrieSearchState(current.getDistance(), current.getPosition() + 1,
                            nodeEntry.getValue()));
                } else if (current.getDistance() < maxDistance) {
                    queue.push(new TrieSearchState(current.getDistance() + 1, current.getPosition() + 1,
                            nodeEntry.getValue()));
                }
            }
        }
    }
    AMapping result = MappingFactory.createDefaultMapping();
    while (!similarityBook.isEmpty()) {
        Triple<Integer, List<Integer>, List<Integer>> t = similarityBook.pop();
        for (Integer i : t.getMiddle()) {
            String a = listA.get(i);
            for (Integer j : t.getRight()) {
                String b = listB.get(j);
                for (String sourceUri : sourceMap.get(a)) {
                    for (String targetUri : targetMap.get(b)) {
                        result.add(sourceUri, targetUri,
                                (1.0d - (t.getLeft().doubleValue() / (double) SoundexMeasure.codeLength)));
                    }
                }
            }
        }
    }

    return result;
}
 
开发者ID:dice-group,项目名称:LIMES,代码行数:81,代码来源:SoundexMapper.java


示例10: genInfoStr

import org.apache.commons.lang3.tuple.MutableTriple; //导入依赖的package包/类
private String genInfoStr(MutableTriple<Integer, MethodSignature, Long> info) {
	return Strings.repeat("\t", info.getLeft())
			+ info.getMiddle().getDeclaringType().getSimpleName() + "." + info.getMiddle().getName()
			+ " :" + info.getRight() + "ms";
}
 
开发者ID:myshzzx,项目名称:mlib,代码行数:6,代码来源:PerformanceInspector.java


示例11: main

import org.apache.commons.lang3.tuple.MutableTriple; //导入依赖的package包/类
public static void main(String[] args)
{
   MutableTriple<String, String, String> mutableTriple = new MutableTriple<>("Left", "Middle", "Right");

   System.out.println("Our first Triple: " + buildATriple());

   System.out.println("Before changing: " + mutableTriple);

   buildATriple(mutableTriple);

   System.out.println("After changing: " + mutableTriple);
}
 
开发者ID:developerSid,项目名称:AwesomeJavaLibraryExamples,代码行数:13,代码来源:ExampleTriple.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LifecycleState类代码示例发布时间:2022-05-23
下一篇:
Java NoActivityResumedException类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap