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


Java List类代码示例

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


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

示例1: getIntervals

import scala.collection.immutable.List; //导入依赖的package包/类
protected static java.util.List<GenomeLoc> getIntervals(RefContigInfo refContigInfo, String filePath) {
    String intervalPath = TestRealignerTargetCreator.class.getResource(filePath).getFile();
    java.util.List<GenomeLoc> intervals = new ArrayList<>();
    try (BufferedReader reader = new BufferedReader(new FileReader(new File(intervalPath)))) {
        String line = reader.readLine();
        while (line != null) {
            if(line.length() > 0 && !line.startsWith("@")) {
                String[] split = StringUtils.split(line, '\t');
                String contigName = split[0];
                int contigId = refContigInfo.getId(contigName);
                int start = Integer.parseInt(split[1]);
                int stop = Integer.parseInt(split[2]);
                intervals.add(new GenomeLoc(contigName, contigId, start, stop));
            }
            line = reader.readLine();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    return intervals;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:23,代码来源:AbstractTestCase.java

示例2: partitionAndCreateRouter

import scala.collection.immutable.List; //导入依赖的package包/类
/** partitions the market by product ID and creates an actor encapsulating an engine, per 
 * partition. returns a router containing all the kids together with the suitable logic 
 * to route to the correct engine. */
private Router partitionAndCreateRouter() {
	Map<String, ActorRef> kids = new HashMap<>();
	java.util.List<Routee> routees = new ArrayList<Routee>();
	int chunk = Constants.PRODUCT_IDS.length / NUM_KIDS;
	for (int i = 0, j = Constants.PRODUCT_IDS.length; i < j; i += chunk) {
	    String[] temparray = Arrays.copyOfRange(Constants.PRODUCT_IDS, i, i + chunk);
	    LOGGER.info("created engine for products " + temparray);
	    ActorRef actor = getContext().actorOf(Props.create(EngineActor.class));
	    getContext().watch(actor);
	    routees.add(new ActorRefRoutee(actor));

	    for (int k = 0; k < temparray.length; k++) {
	    	LOGGER.debug("mapping productId '" + temparray[k] + "' to engine " + i);
	    	kids.put(temparray[k], actor);
	    }
	    LOGGER.info("---started trading");
	    actor.tell(EngineActor.RUN, ActorRef.noSender());
	}			
	Router router = new Router(new PartitioningRoutingLogic(kids), routees);
	return router;
}
 
开发者ID:maxant,项目名称:akkaTrader,代码行数:25,代码来源:Main.java

示例3: getQueryHistograms

import scala.collection.immutable.List; //导入依赖的package包/类
/**
 * 
 * @param histograms a JSON array that contains "Histogram" structures
 * @return a List of doubles. even indexes contain "mean" numbers and 
 * uneven indexes contain "frequency" numbers
 */
private java.util.List<Double> getQueryHistograms(JSONArray histograms) {
	java.util.List<Double> histoList = new java.util.ArrayList<Double>();
	for(int i=0; i<histograms.length(); i++) {
		String histogram = "";
		try {
			histogram = histograms.get(i).toString();
		} catch (JSONException e) {
			JOptionPane.showMessageDialog(null, "Error: " + e.getMessage() + "", "Error", JOptionPane.ERROR_MESSAGE);
		}
		double mean = JsonFormat.jsonToDouble(histogram, "mean");
		double frequency = JsonFormat.jsonToDouble(histogram,  "frequency");
		histoList.add(mean);
		histoList.add(frequency);
	}
	return histoList;
}
 
开发者ID:cetic,项目名称:SimQRI,代码行数:23,代码来源:MonteCarloTracer.java

示例4: getStringElements

import scala.collection.immutable.List; //导入依赖的package包/类
public String getStringElements() {
	String elementsString = "\n  ----------------ELEMENTS---------------- \n";
	for(Map.Entry<String, Tuple2<String, List<Tuple2<String, Object>>>> entry : mapInfos.entrySet()) {
		String name = entry.getKey();
		elementsString += "\n  Element "+name+" ";
		Tuple2<String, List<Tuple2<String, Object>>> typeAndInfos = entry.getValue();
		String type = (String) typeAndInfos._1;
		elementsString += "("+type+") : \n";
		List<Tuple2<String, Object>> listInfos = (List<Tuple2<String, Object>>) typeAndInfos._2;
		Iterator<Tuple2<String, Object>> itInfos = listInfos.iterator();
		while(itInfos.hasNext()) {
			Tuple2<String, Object> infos = itInfos.next();
			String attribute = infos._1;
			String value = String.valueOf(infos._2);
			elementsString += "  * "+attribute+" : "+value+" \n";
		}
		elementsString += "  ---------------------------------------- \n";
	}
	return elementsString;
}
 
开发者ID:cetic,项目名称:SimQRI,代码行数:21,代码来源:OneShotTracer.java

示例5: testLocusSamTraverser2

import scala.collection.immutable.List; //导入依赖的package包/类
public void testLocusSamTraverser2() {
    String filePath = getClass().getResource("/test.sam").getFile();
    RefContigInfo refContigInfo = RefContigInfo.apply(getClass().getResource("/human_g1k_v37.dict").getFile());
    SamHeaderInfo headerInfo = SamHeaderInfo.sortedHeader(refContigInfo, null);
    headerInfo.addReadGroupInfo(ReadGroupInfo.apply("SRR504516", "sample1"));
    List<BasicSamRecord> samRecords = NormalFileLoader.loadSam(filePath, refContigInfo);

    SamRecordPartition samRecordPartition = new SamRecordPartition(1, 0, samRecords, headerInfo);
    SamContentProvider samContentProvider = new SamContentProvider(samRecordPartition);

    GenomeLoc traverseLoc = new GenomeLoc("1", 0, 2090100, 2090101);
    LocusSamTraverser traverser = new LocusSamTraverser(samContentProvider, traverseLoc);

    assertEquals(true, traverser.hasNext());
    AlignmentContext ac1 = traverser.next();
    assertEquals('C', ac1.basePileup.getBases()[0]);
    assertEquals(2090100, ac1.getPosition());
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:19,代码来源:TestLocusSamTraverser.java

示例6: testFilterWhenReadTraverse

import scala.collection.immutable.List; //导入依赖的package包/类
public void testFilterWhenReadTraverse() {
    String filePath = getClass().getResource("/test.sam").getFile();
    RefContigInfo refContigInfo = RefContigInfo.apply(getClass().getResource("/human_g1k_v37.dict").getFile());
    SamHeaderInfo headerInfo = SamHeaderInfo.sortedHeader(refContigInfo, null);
    headerInfo.addReadGroupInfo(ReadGroupInfo.apply("SRR504516", "sample1"));
    List<BasicSamRecord> samRecords = NormalFileLoader.loadSam(filePath, refContigInfo);

    SamRecordPartition samRecordPartition = new SamRecordPartition(1, 0, samRecords, headerInfo);
    SamContentProvider samContentProvider = new SamContentProvider(samRecordPartition);

    String[] filterNames = {FilterUtils.UNMAPPED_READ_FILTER,
            FilterUtils.MAPPING_QUALITY_UNAVAILABLE_FILTER,
            FilterUtils.HC_MAPPING_QUALITY_FILTER};
    FilterUtils filterUtils = new FilterUtils(filterNames);
    ReadSamTraverser traverser = new ReadSamTraverser(samContentProvider, filterUtils);
    GATKSAMRecord record = traverser.next();
    assertEquals("SRR504516.519_HWI-ST423_0087:3:1:7608:2165", record.getReadName());
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:19,代码来源:TestFilterUtils.java

示例7: testReadSamTraverser

import scala.collection.immutable.List; //导入依赖的package包/类
public void testReadSamTraverser() {
    String filePath = getClass().getResource("/test.sam").getFile();
    RefContigInfo refContigInfo = RefContigInfo.apply(getClass().getResource("/human_g1k_v37.dict").getFile());
    SamHeaderInfo headerInfo = SamHeaderInfo.sortedHeader(refContigInfo, null);
    headerInfo.addReadGroupInfo(ReadGroupInfo.apply("SRR504516", "sample1"));
    List<BasicSamRecord> samRecords = NormalFileLoader.loadSam(filePath, refContigInfo);

    SamRecordPartition samRecordPartition = new SamRecordPartition(1, 0, samRecords, headerInfo);
    SamContentProvider samContentProvider = new SamContentProvider(samRecordPartition);
    ReadSamTraverser traverser = new ReadSamTraverser(samContentProvider);

    assertEquals(true, traverser.hasNext());
    GATKSAMRecord record = traverser.next();
    assertEquals("SRR504516.1492_HWI-ST423_0087:3:1:19251:2214", record.getReadName());
    GATKSAMRecord record2 = traverser.next();
    record2 = traverser.next();
    assertEquals("SRR504516.519_HWI-ST423_0087:3:1:7608:2165", record2.getReadName());
    traverser.rewind();
    GATKSAMRecord record3 = traverser.next();
    assertEquals("SRR504516.1492_HWI-ST423_0087:3:1:19251:2214", record3.getReadName());
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:22,代码来源:TestReadSamTraverser.java

示例8: getRealignerTargetIntervalValue

import scala.collection.immutable.List; //导入依赖的package包/类
protected static java.util.List<GenomeLoc> getRealignerTargetIntervalValue(String filePath, RefContigInfo refContigInfo) {
    String intervalFilePath = TestRealignerTargetCreator.class.getResource(filePath).getFile();
    java.util.List<GenomeLoc> result = new ArrayList<>();
    try (BufferedReader reader = new BufferedReader(new FileReader(new File(intervalFilePath)))) {
        String line = reader.readLine();
        while (line != null) {
            if (line.length() > 0) {
                String[] split1 = line.split(":");
                String contigName = split1[0];
                int contigId = refContigInfo.getId(contigName);
                String[] split2 = split1[1].split("-");
                int start = Integer.parseInt(split2[0]);
                int end = (split2.length == 1) ? start : Integer.parseInt(split2[1]);
                result.add(new GenomeLoc(contigName, contigId, start, end));
            }
            line = reader.readLine();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    return result;
}
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:24,代码来源:AbstractTestCase.java

示例9: getReads

import scala.collection.immutable.List; //导入依赖的package包/类
protected static java.util.List<SAMRecord> getReads(String filePath, SamHeaderInfo headerInfo) {

        String realPath = TestRealignerTargetCreator.class.getResource(filePath).getFile();

        SAMFileHeader header = SAMHeaderTransfer.transfer(headerInfo);
        SAMLineParser parser = new SAMLineParser(header);
        java.util.List<SAMRecord> result = new java.util.ArrayList<>();
        try (BufferedReader reader = new BufferedReader(new FileReader(new File(realPath)))) {
            String line = reader.readLine();
            while (line != null) {
                if (line.length() > 0 && !line.startsWith("@")) {
                    result.add(parser.parseLine(line));
                }
                line = reader.readLine();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }

        return result;
    }
 
开发者ID:PAA-NCIC,项目名称:SparkSeq,代码行数:22,代码来源:AbstractTestCase.java

示例10: freeVariables

import scala.collection.immutable.List; //导入依赖的package包/类
public ProverExpr[] freeVariables(ProverExpr expr) {
  final ArrayList<ProverExpr> res = new ArrayList<ProverExpr> ();
  
  final scala.Tuple3<scala.collection.Set<IVariable>,
                      scala.collection.Set<ConstantTerm>,
                      scala.collection.Set<Predicate>> symTriple;
  if (expr instanceof TermExpr)
    symTriple = SymbolCollector$.MODULE$.varsConstsPreds(((TermExpr)expr).term);
  else
    symTriple = SymbolCollector$.MODULE$.varsConstsPreds(((FormulaExpr)expr).formula);
  
  final Iterator<IVariable> it1 = symTriple._1().iterator();
  while (it1.hasNext())
    res.add(new TermExpr(it1.next(), getIntType()));
  
  final Iterator<ConstantTerm> it2 = symTriple._2().iterator();
  while (it2.hasNext())
    res.add(new TermExpr(IConstant$.MODULE$.apply(it2.next()), getIntType()));
  
  final Iterator<Predicate> it3 = symTriple._3().iterator();
  final List<ITerm> emptyArgs = (new ArrayBuffer<ITerm>()).toList();
  while (it3.hasNext())
    res.add(new FormulaExpr(IAtom$.MODULE$.apply(it3.next(), emptyArgs)));
  
  return res.toArray(new ProverExpr[0]);
}
 
开发者ID:SRI-CSL,项目名称:bixie,代码行数:27,代码来源:PrincessProver.java

示例11: processQueryFunction

import scala.collection.immutable.List; //导入依赖的package包/类
private void processQueryFunction(FilterOption option, String boolMethod) {
    BooleanMethodCallExpr methodCall = (BooleanMethodCallExpr) option.expression();
    assertThat(methodCall.methodName(), is(boolMethod));
    List<Expression> args = methodCall.args();
    Iterator iterator = args.iterator();
    while (iterator.hasNext()) {
        Object cursor = iterator.next();
        if (cursor instanceof EntityPathExpr) {
            EntityPathExpr pathExpr = (EntityPathExpr) cursor;
            PropertyPathExpr path = (PropertyPathExpr) pathExpr.subPath().get();
            assertThat(path.propertyName(), is("name"));
        } else if (cursor instanceof LiteralExpr) {
            LiteralExpr literalExpr = (LiteralExpr) cursor;
            StringLiteral stringLiteral = (StringLiteral) literalExpr.value();
            assertThat(stringLiteral.value(), is("John"));
        }
    }
}
 
开发者ID:sdl,项目名称:odata,代码行数:19,代码来源:ParserLogicalTest.java

示例12: testQueryFunction

import scala.collection.immutable.List; //导入依赖的package包/类
private void testQueryFunction(String operator) throws ODataException {
    EqExpr expr = getExprFromOperator(operator);
    MethodCallExpr call = (MethodCallExpr) expr.left();
    assertThat(call.methodName(), is(operator));
    List<Expression> args = call.args();
    Iterator iter = args.iterator();
    while (iter.hasNext()) {
        Object obj = iter.next();
        if (obj instanceof EntityPathExpr) {
            EntityPathExpr entityPathExpr = (EntityPathExpr) obj;
            PropertyPathExpr propertyPath = (PropertyPathExpr) entityPathExpr.subPath().get();
            assertThat(propertyPath.propertyName(), is("name"));
        }
    }
    LiteralExpr literal = (LiteralExpr) expr.right();
    NumberLiteral number = (NumberLiteral) literal.value();
    assertThat(number.value(), is(new BigDecimal(new java.math.BigDecimal(19))));
}
 
开发者ID:sdl,项目名称:odata,代码行数:19,代码来源:ParserQueryFunctionsTest.java

示例13: main

import scala.collection.immutable.List; //导入依赖的package包/类
public static void main(String[] args) {

		if(args.length > 0){
			NUM_KIDS = Integer.parseInt(args[0]);
		}
		if(args.length > 1){
			DELAY = Long.parseLong(args[1]);
		}
		if(args.length > 2){
			DB_HOST = args[2];
		}
		
		ActorRef listener = system.actorOf(Props.create(HttpActor.class), "httpActor"); 
		
		InetSocketAddress endpoint = new InetSocketAddress(3000);
		int backlog = 100;
		List<Inet.SocketOption> options = JavaConversions.asScalaBuffer(new ArrayList<Inet.SocketOption>()).toList();
		Option<ServerSettings> settings = scala.Option.empty();
		ServerSSLEngineProvider sslEngineProvider = null;
		Bind bind = new Http.Bind(listener, endpoint, backlog, options, settings, sslEngineProvider);
		IO.apply(spray.can.Http$.MODULE$, system).tell(bind, ActorRef.noSender());
		
		system.scheduler().schedule(new FiniteDuration(5, TimeUnit.SECONDS), new FiniteDuration(5, TimeUnit.SECONDS), ()->{
			System.out.println(new Date() + " - numSales=" + numSales.get());
		}, system.dispatcher());
	}
 
开发者ID:maxant,项目名称:akkaTrader,代码行数:27,代码来源:Main.java

示例14: start

import scala.collection.immutable.List; //导入依赖的package包/类
public void start() {
  Duration[] defaultLatchIntervals = {Duration.apply(1, TimeUnit.MINUTES)};
  @SuppressWarnings("deprecation")
  AdminServiceFactory adminServiceFactory = new AdminServiceFactory(
      this.mPort,
      20,
      List$.MODULE$.<StatsFactory>empty(),
      Option.<String>empty(),
      List$.MODULE$.<Regex>empty(),
      Map$.MODULE$.<String, CustomHttpHandler>empty(),
      List.<Duration>fromArray(defaultLatchIntervals));
  RuntimeEnvironment runtimeEnvironment = new RuntimeEnvironment(this);
  AdminHttpService service = adminServiceFactory.apply(runtimeEnvironment);
  for (Map.Entry<String, CustomHttpHandler> entry : this.mCustomHttpHandlerMap.entrySet()) {
    service.httpServer().createContext(entry.getKey(), entry.getValue());
  }
}
 
开发者ID:pinterest-attic,项目名称:pinlater,代码行数:18,代码来源:OstrichAdminService.java

示例15: start

import scala.collection.immutable.List; //导入依赖的package包/类
public void start() {
  Duration[] defaultLatchIntervals = {Duration.apply(1, TimeUnit.MINUTES)};
  @SuppressWarnings("deprecation")
  AdminServiceFactory adminServiceFactory = new AdminServiceFactory(
      this.mPort,
      20,
      List$.MODULE$.<StatsFactory>empty(),
      Option.<String>empty(),
      List$.MODULE$.<Regex>empty(),
      Map$.MODULE$.<String, CustomHttpHandler>empty(),
      List.<Duration>fromArray(defaultLatchIntervals));
  RuntimeEnvironment runtimeEnvironment = new RuntimeEnvironment(this);
  AdminHttpService service = adminServiceFactory.apply(runtimeEnvironment);
  for (Map.Entry<String, CustomHttpHandler> entry: this.mCustomHttpHandlerMap.entrySet()) {
    service.httpServer().createContext(entry.getKey(), entry.getValue());
  }
}
 
开发者ID:pinterest-attic,项目名称:terrapin,代码行数:18,代码来源:OstrichAdminService.java


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