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


Java Triplet.with方法代码示例

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


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

示例1: getSrgNameMd

import org.javatuples.Triplet; //导入方法依赖的package包/类
public static Triplet<String, String, String[]> getSrgNameMd(String method) {
	Matcher mtch = OWNERNAME.matcher(method);
	if (!mtch.find()) {
		RMLog.fatal("Method string does not match pattern!", true);
		throw new RuntimeException("SRG-Name not found!");
	}

	String srgName = ASMHelper.isMCP ? null : MAPPINGS.get(method);

	String owner = mtch.group(1);
	String[] splitMd = mtch.group(2).split(" ");

	String name = srgName == null ? splitMd[0] : srgName;
	String[] additData = Arrays.copyOfRange(splitMd, 1, splitMd.length);

	return Triplet.with(owner, name, additData);
}
 
开发者ID:roryclaasen,项目名称:RorysMod,代码行数:18,代码来源:ASMNames.java

示例2: getSrgNameFd

import org.javatuples.Triplet; //导入方法依赖的package包/类
public static Triplet<String, String, String> getSrgNameFd(String field) {
	Matcher mtch = OWNERNAME.matcher(field);
	if (!mtch.find()) {
		RMLog.fatal("Field string does not match pattern!", true);
		throw new RuntimeException("SRG-Name not found!");
	}

	String srgName = ASMHelper.isMCP ? null : MAPPINGS.get(field);

	String owner = mtch.group(1);
	String[] splitFd = mtch.group(2).split(" ");

	String name = srgName == null ? splitFd[0] : srgName;
	String desc = splitFd[1];

	return Triplet.with(owner, name, desc);
}
 
开发者ID:roryclaasen,项目名称:RorysMod,代码行数:18,代码来源:ASMNames.java

示例3: copyChildren

import org.javatuples.Triplet; //导入方法依赖的package包/类
private void copyChildren(CLTreeNode<Triplet<MultiSpan, String, Node>> fromNode,
                          CLTreeNode<Triplet<MultiSpan, String, Node>> toNode,
                          int sourceRevision, int targetRevision) {
    final Span spanToInfinity = new SpanImpl(targetRevision, Span.POSITIVE_INFINITY);

    List<CLTreeNode<Triplet<MultiSpan, String, Node>>> children =
            fromNode.getChildren(inRevision(sourceRevision));
    for (CLTreeNode<Triplet<MultiSpan, String, Node>> child : children) {
        Triplet<MultiSpan, String, Node> d = child.lookInside();
        MultiSpan newMultiSpan = d.getValue0().clone();
        newMultiSpan.add(spanToInfinity);
        CLTreeNode<Triplet<MultiSpan, String, Node>> newChild = new CLTreeNodeImpl<>(Triplet.with(newMultiSpan, d.getValue1(), d.getValue2()));
        toNode.addChild(newChild);
        copyChildren(child, newChild, sourceRevision, targetRevision);
    }
}
 
开发者ID:cstroe,项目名称:svndumpapi,代码行数:17,代码来源:TreeOfKnowledgeImpl.java

示例4: findRenderer

import org.javatuples.Triplet; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public final <T> Renderer<? super T> findRenderer(Class<?> rootType, FieldPath path, Class<T> valueType) {
	Triplet<Class<?>, FieldPath, Class<?>> parameters = Triplet.<Class<?>, FieldPath, Class<?>>with(rootType, path, valueType);
	
	Renderer<? super T> renderer = (Renderer<? super T>) cache.get(parameters);
	if (renderer != null) {
		return renderer;
	} else {
		renderer = findRendererNoCache(rootType, path, valueType);
		cache.put(parameters, renderer);
		return renderer;
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:15,代码来源:RendererServiceImpl.java

示例5: extractParameters

import org.javatuples.Triplet; //导入方法依赖的package包/类
private static Tuple extractParameters(Tuple parameters, List<Integer> indices) {
	int size = indices.size();
	switch (size) {
	case 0:
		return null;
	case 1:
		return Unit.with(parameters.getValue(indices.get(0)));
	case 2:
		return Pair.with(
				parameters.getValue(indices.get(0)),
				parameters.getValue(indices.get(1))
		);
	case 3:
		return Triplet.with(
				parameters.getValue(indices.get(0)),
				parameters.getValue(indices.get(1)),
				parameters.getValue(indices.get(2))
		);
	case 4:
		return Quartet.with(
				parameters.getValue(indices.get(0)),
				parameters.getValue(indices.get(1)),
				parameters.getValue(indices.get(2)),
				parameters.getValue(indices.get(3))
		);
	default:
		throw new IllegalStateException("Only Unit, Pair, Triplet and Quartet parameters are supported for ILinkParameterMappingEntryFactory");
	}
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:30,代码来源:BuilderMapperLinkDescriptorFactory.java

示例6: addToTree

import org.javatuples.Triplet; //导入方法依赖的package包/类
private void addToTree(Node node) {
    final int currentRevision = node.getRevision().get().getNumber();

    String[] pathComponents = node.get(NodeHeader.PATH).split("/");

    CLTreeNode<Triplet<MultiSpan, String, Node>> currentRoot = root;
    for (String currentPath : pathComponents) {
        List<CLTreeNode<Triplet<MultiSpan, String, Node>>> children =
                currentRoot.getChildren(inRevisionWithLabel(currentRevision, currentPath));

        final Span spanToInfinity = new SpanImpl(currentRevision, Span.POSITIVE_INFINITY);
        if (children.size() == 0) {
            MultiSpan multiSpan = new MultiSpan();
            multiSpan.add(spanToInfinity);
            Triplet<MultiSpan, String, Node> r = Triplet.with(
                    multiSpan,
                    currentPath,
                    node);
            CLTreeNode<Triplet<MultiSpan, String, Node>> newNode = new CLTreeNodeImpl<>(r);
            currentRoot.addChild(newNode);
            currentRoot = newNode;
        } else if(children.size() == 1) {
            CLTreeNode<Triplet<MultiSpan, String, Node>> currentNode = children.get(0);
            currentNode.lookInside().getValue0().add(spanToInfinity);
            currentRoot = currentNode;
        } else {
            throw new IllegalArgumentException("Ambiguous node label.");
        }
    }

    // copied from
    String copiedFromRev = node.get(NodeHeader.COPY_FROM_REV);
    if (copiedFromRev != null) {
        int copyRevision = Integer.parseInt(copiedFromRev);
        String copyPath = node.get(NodeHeader.COPY_FROM_PATH);

        CLTreeNode<Triplet<MultiSpan, String, Node>> oldNode = findNode(copyRevision, copyPath);
        copyChildren(oldNode, currentRoot, copyRevision, currentRevision);
    }
}
 
开发者ID:cstroe,项目名称:svndumpapi,代码行数:41,代码来源:TreeOfKnowledgeImpl.java

示例7: TreeOfKnowledgeImpl

import org.javatuples.Triplet; //导入方法依赖的package包/类
public TreeOfKnowledgeImpl() {
    Span toInfinity = new SpanImpl(0, Span.POSITIVE_INFINITY);
    MultiSpan multiSpan = new MultiSpan();
    multiSpan.add(toInfinity);
    this.root = new CLTreeNodeImpl<>(Triplet.with(multiSpan, "/", null));
}
 
开发者ID:cstroe,项目名称:svndumpapi,代码行数:7,代码来源:TreeOfKnowledgeImpl.java

示例8: connect

import org.javatuples.Triplet; //导入方法依赖的package包/类
private void connect() {
    timerComp = create(JavaTimer.class, Init.NONE);
    networkComp = create(NettyNetwork.class, new NettyInit(selfAdr));

    StreamHostComp.ExtPort extPorts = new StreamHostComp.ExtPort(timerComp.getPositive(Timer.class), networkComp.getPositive(Network.class));
    TorrentDetails torrentDetails;
    torrentDetails = new TorrentDetails() {
        private final String torrentName = experimentConfig.torrentName;
        private final String filePath = inputDir + File.separator + experimentConfig.torrentName;
        private final String hashPath = inputDir + File.separator + experimentConfig.torrentName + ".hash";
        private final Torrent torrent;
        private final Triplet<FileMngr, HashMngr, TransferMngr> mngrs;

        {
            try {
                File dataFile = new File(filePath);
                if (!dataFile.exists()) {
                    throw new RuntimeException("missing data file:" + filePath);
                }
                File hashFile = new File(hashPath);
                if (!hashFile.exists()) {
                    throw new RuntimeException("missing hash file:" + hashPath);
                }

                int pieceSize = 1024;
                int piecesPerBlock = 1024;
                int blockSize = pieceSize * piecesPerBlock;

                long fileSize = dataFile.length();
                long hashFileSize = hashFile.length();

                String hashAlg = HashUtil.getAlgName(HashUtil.SHA);
                int hashSize = HashUtil.getHashSize(hashAlg);

                torrent = new Torrent(experimentConfig.torrentId, FileInfo.newFile(torrentName, fileSize), new TorrentInfo(pieceSize, piecesPerBlock, hashAlg, hashFileSize));
                FileMngr fileMngr = StorageMngrFactory.completeMMFileMngr(filePath, fileSize, blockSize, pieceSize);
                HashMngr hashMngr = StorageMngrFactory.completeMMHashMngr(hashPath, hashAlg, hashFileSize, hashSize);
                mngrs = Triplet.with(fileMngr, hashMngr, null);
            } catch (IOException ex) {
                throw new RuntimeException(ex);
            }
        }

        @Override
        public Identifier getOverlayId() {
            return torrent.overlayId;
        }

        @Override
        public boolean download() {
            return false;
        }

        @Override
        public Torrent getTorrent() {
            return torrent;
        }

        @Override
        public Triplet<FileMngr, HashMngr, TransferMngr> torrentMngrs(Torrent torrent) {
            return mngrs;
        }
    };
    streamComp = create(StreamHostComp.class, new StreamHostComp.Init(extPorts, selfAdr, torrentDetails, new ArrayList<KAddress>()));
}
 
开发者ID:CaracalDB,项目名称:CaracalDB,代码行数:66,代码来源:Sender.java

示例9: connect

import org.javatuples.Triplet; //导入方法依赖的package包/类
private void connect() {
    timerComp = create(JavaTimer.class, Init.NONE);
    networkComp = create(NettyNetwork.class, new NettyInit(selfAdr));

    StreamHostComp.ExtPort extPorts = new StreamHostComp.ExtPort(timerComp.getPositive(Timer.class), networkComp.getPositive(Network.class));
    TorrentDetails torrentDetails = new TorrentDetails() {
        private final Identifier overlayId = experimentConfig.torrentId;
        private final String filePath = outputDir + File.separator + experimentConfig.torrentName;
        private final String hashPath = outputDir + File.separator + experimentConfig.torrentName + ".hash";

        @Override
        public Identifier getOverlayId() {
            return overlayId;
        }

        @Override
        public boolean download() {
            return true;
        }

        @Override
        public Torrent getTorrent() {
            throw new RuntimeException("logic error");
        }

        @Override
        public Triplet<FileMngr, HashMngr, TransferMngr> torrentMngrs(Torrent torrent) {
            try {
                int blockSize = torrent.torrentInfo.piecesPerBlock * torrent.torrentInfo.pieceSize;
                int hashSize = HashUtil.getHashSize(torrent.torrentInfo.hashAlg);

                FileMngr fileMngr = StorageMngrFactory.incompleteMMFileMngr(filePath, torrent.fileInfo.size, blockSize, torrent.torrentInfo.pieceSize);
                HashMngr hashMngr = StorageMngrFactory.incompleteMMHashMngr(hashPath, torrent.torrentInfo.hashAlg, torrent.torrentInfo.hashFileSize, hashSize);
                return Triplet.with(fileMngr, hashMngr, new TransferMngr(torrent, hashMngr, fileMngr));
            } catch (IOException ex) {
                throw new RuntimeException(ex);
            }
        }
    };
    List<KAddress> partners = new ArrayList<KAddress>();
    partners.add(senderAdr);
    streamComp = create(StreamHostComp.class, new StreamHostComp.Init(extPorts, selfAdr, torrentDetails, partners));
    connect(streamComp.getPositive(ReportPort.class), reportPort.getPair(), Channel.TWO_WAY);
}
 
开发者ID:CaracalDB,项目名称:CaracalDB,代码行数:45,代码来源:Receiver.java

示例10: regexTagger

import org.javatuples.Triplet; //导入方法依赖的package包/类
/**
 * A regular expression based semantic tagger
 * 
 * @param  obj	an instance of class "semanticRuleEngine"
 * @param start	start index
 * @param strtokens	search string
 * @return a list that contains three items: 1>offset of end position of identified tag("-1", if no tag found), 2>tagged phrase 3> tagged type
 * @see  SemanticRuleEngine  
*/
private Triplet<Integer,String, String> regexTagger(SemanticRuleEngine obj,int start, String strtokens) throws IOException
{
	//System.out.println("strtokens:"+strtokens);
	int end = -1;
	String term = "";
	String tag = "";
	
	Map regexlist = new Hashtable();
	regexlist.put("^(\\d+[\\.]\\d+|\\.\\d+|\\d\\/\\d|\\d \\d\\/\\d|\\d+\\,\\d+|\\d+ \\, \\d+|\\d+)( |$)","NUM");
	regexlist.put("^[\\d\\.]+ (to|-) [\\d\\.]+( |$)","NUM");
	regexlist.put("^[\\d\\.]+[\\-\\/][\\d\\.]+( |$)","NUM");
	regexlist.put("^\\d+\\%( |$)","NUM");
	regexlist.put("^x( |)\\d+( |$)","FREQ");
	regexlist.put("^(\\d+|\\d+\\.\\d+)(mg|doz|oz|ml|l|mb|meq)", "DOSE");
	//regexlist.put("^[\\d\\.]+ (to|-)( |$)","NUM");
	regexlist.put("^several (min|minute|minutes|h|hr|hrs|hour|hours|d|day|days|wk|week|weeks|m|month|months)( |$)","DRT");
	regexlist.put("^x\\d+(min|minute|minutes|h|hr|hrs|hour|hours|d|day|days|wk|week|weeks|m|month|months)( |$)","DRT");
	//regexlist.put("^(\\d+|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|thirty)( more | )(to|-|)(\\d+|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|thirty|)( |)(min|minute|minutes|h|hr|hrs|hour|hours|d|day|days|wk|week|weeks|m|month|months)( |$)","DRT");
	regexlist.put("^(\\d+|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|thirty)( more | )(min|minute|minutes|h|hr|hrs|hour|hours|d|day|days|wk|week|weeks|m|month|months)( |$)","DRT");
	regexlist.put("^\\d{1,2}\\/\\d{1,2} \\- \\d{1,2}\\/\\d{1,2}( |$)","DRT");
	regexlist.put("^x(min|minute|minutes|d|day|days|wk|week|weeks|m|month|months)( |$)","TUNIT");
	regexlist.put("^\\d( |)x( |)(daily|weekly|monthly|a day|a week|a month|per day|per week|per month)","FREQ");
	regexlist.put("^\\d+( |)(am|pm|clock)","TOD");
	regexlist.put("^(every|q|qdaily) (m|mon|t|tue|tues|w|wed|r|thu|thur|f|fri|sat|sun|monday|tuesday|wednesday|thursday|friday|saturday|sunday|,| |and)+( |$)","FREQ");
	regexlist.put("^(m|mon|t|tue|w|wed|r|thu|f|fri|sat|sun|monday|tuesday|wednesday|thursday|friday|saturday|sunday) and (m|mon|t|tue|w|wed|r|thu|f|fri|sat|sun|monday|tuesday|wednesday|thursday|friday|saturday|sunday)( |$)","FREQ");
	regexlist.put("^(one|two|three|four|five|six|seven|eight|nine|ten) to (one|two|three|four|five|six|seven|eight|nine|ten)( |$)","NUM");
	
	
	regexlist.put("^q(\\.|)\\d+( |$)","FREQ");
	regexlist.put("^q( \\. | |\\.|)( |)(\\d+|\\d\\-\\d|\\d \\- \\d)?( |)(hrs|hr|h|m|min|d|hour|hours|day|days|minute|minutes|wk|week|weeks|month|months)(prn|)(\\.|)( |$)","FREQ");
	//regexlist.put("^q(\\.|)\\d+( |$)","FREQ");
	regexlist.put("^(\\d+|one|two|three|four|five|six|seven|eight|nine|ten) times (daily|weekly|monthly|a day|a week|a month|per day|per week|per month)( |$)","FREQ");
	regexlist.put("^(every|each|per) (minute|hour|morning|afternoon|evening|day|wk|week|month|bedtime|breakfast|lunch|dinner)( |$)","FREQ");
	regexlist.put("^every (\\d+|\\d+\\-\\d+|\\d+ to \\d+|\\d+ \\- \\d+|one|two|three|four|five|six|seven|eight|nine|ten|eleven|twelve|thirteen|fourteen|fifteen|sixteen|seventeen|eighteen|nineteen|twenty|twenty-one|twenty-two|twenty-three|twenty-four) ?(hrs|hr|h|m|min|d|hour|hours|day|days|minute|minutes|wk|week|weeks|month|months)( |$)","FREQ");
	
	//r'^\d( |)x( |)(daily|weekly|monthly|a day|a week|a month|per day|per week|per month)', 'FREQ'), 	# 2x daily , modified 11/2/09
	int maxlen = 0;
	int num_rows = 18;
	int num_cols = 2;
	Iterator it = regexlist.entrySet().iterator();
	
	
	while (it.hasNext()) 
	{
		 	  Map.Entry pairs = (Map.Entry)it.next();
	    	  String regexp = (String) pairs.getKey();
	    	  String stag = (String) pairs.getValue();
	    	  
	    	  
	    	  Pattern r = Pattern.compile(regexp, Pattern.CASE_INSENSITIVE);
	    	  Matcher m = r.matcher(strtokens);
		      if (m.find()) 
		      { 
		    	  String matchstr = m.group(0);
		    	  matchstr = matchstr.trim();
		    	  int matchlen = matchstr.split(" ").length;
		    	  
		    	  if (matchlen > maxlen)
		    	  {
		    		  maxlen = matchlen;
		    		  end = start + matchlen;
		    		  term = rTrim(matchstr);
		    		  tag = stag;
		    	  }
		    }
	}
	
	//System.out.println("Regex :"+term+"\t"+tag);
	Triplet<Integer,String, String> temptuple = Triplet.with(end, term, tag);
	return temptuple;

}
 
开发者ID:UTHealth-CCB,项目名称:Medex,代码行数:82,代码来源:SemanticRuleEngine.java


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