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


Java JavaConversions.asJavaIterable方法代码示例

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


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

示例1: select

import scala.collection.JavaConversions; //导入方法依赖的package包/类
@Override
public Routee select(Object message, IndexedSeq<Routee> routees) {

	//find which product ID is relevant here
	String productId = null;
	if(message instanceof PurchaseOrder){
		productId = ((PurchaseOrder) message).getProductId();
	}else if(message instanceof SalesOrder){
		productId = ((SalesOrder) message).getProductId();
	}
	ActorRef actorHandlingProduct = kids.get(productId);

	//no go find the routee for the relevant actor
	for(Routee r : JavaConversions.asJavaIterable(routees)){
		ActorRef a = ((ActorRefRoutee) r).ref(); //cast ok, since the are by definition in this program all routees to ActorRefs
		if(a.equals(actorHandlingProduct)){
			return r;
		}
	}
	
	return akka.routing.NoRoutee$.MODULE$; //none found, return NoRoutee
}
 
开发者ID:maxant,项目名称:akkaTrader,代码行数:23,代码来源:Main.java

示例2: refresh

import scala.collection.JavaConversions; //导入方法依赖的package包/类
public static void refresh() {
    if (null == CONTEXT)
        throw new IllegalStateException("The Spark context has not been created.");
    if (CONTEXT.isStopped())
        recreateStopped();

    final Set<String> keepNames = new HashSet<>();
    for (final RDD<?> rdd : JavaConversions.asJavaIterable(CONTEXT.persistentRdds().values())) {
        if (null != rdd.name()) {
            keepNames.add(rdd.name());
            NAME_TO_RDD.put(rdd.name(), rdd);
        }
    }
    // remove all stale names in the NAME_TO_RDD map
    NAME_TO_RDD.keySet().stream().filter(key -> !keepNames.contains(key)).collect(Collectors.toList()).forEach(NAME_TO_RDD::remove);
}
 
开发者ID:apache,项目名称:tinkerpop,代码行数:17,代码来源:Spark.java

示例3: source

import scala.collection.JavaConversions; //导入方法依赖的package包/类
public static StreamSource source(SourceConf sc){
 StreamSource s = new StreamSource();
 s.setAlias(sc.alias());
 s.setSqlQuery(sc.query());
 if (sc.slide().isDefined())
  s.setRawSlideValue(sc.slide().get());
 if (sc.samplingRate().isDefined())
  s.setSamplingRate(((Double)sc.samplingRate().get()).floatValue());
 if (sc.disconnectBufferSize().isDefined())
  s.setDisconnectedBufferSize(((Integer)sc.disconnectBufferSize().get()));
 if (sc.storageSize().isDefined())
  s.setRawHistorySize(sc.storageSize().get());
 AddressBean[] add=new AddressBean[sc.wrappers().size()];
 int i=0;
 for (WrapperConf w:JavaConversions.asJavaIterable(sc.wrappers())){
  add[i]=address(w);
  i++;
 }
 s.setAddressing(add);
 return s;
}
 
开发者ID:LSIR,项目名称:gsn,代码行数:22,代码来源:BeansInitializer.java

示例4: address

import scala.collection.JavaConversions; //导入方法依赖的package包/类
public static AddressBean address(WrapperConf w){
    KeyValueImp [] p=new KeyValueImp[w.params().size()];
    Iterable<String> keys=JavaConversions.asJavaIterable(w.params().keys());
    int i=0;
 for (String k:keys){
  p[i]=new KeyValueImp(k,w.params().apply(k));
  i++;
 }
    AddressBean a = new AddressBean(w.wrapper(),p);
    if(w.partialKey().isDefined()){
    a.setPartialOrderKey(w.partialKey().get());
    }
    DataField [] out=new DataField[(w.output().size())];
 for (int j=0;j<out.length;j++){
  out[j]=dataField(w.output().apply(j));
 }
    a.setVsconfig(out);
 return a;
}
 
开发者ID:LSIR,项目名称:gsn,代码行数:20,代码来源:BeansInitializer.java

示例5: render

import scala.collection.JavaConversions; //导入方法依赖的package包/类
public void render(Snapshot snapshot) {
    int x = 20;
    int y = height - 20;

    batch.begin();
    for (LeaderBoard.Stats stats : JavaConversions.asJavaIterable(snapshot.leaderBoard().sortedByHighest().take(4))) {
        ClientId player = stats.player();
        if (stats.hits() == 0)
            continue;

        Texture tex = bodyTextures[0];
        batch.draw(tex, x, y - tex.getWidth() * 5 / 6);

        String text = snapshot.nicknameFor(player) + " " + stats.hits() + "/" + stats.deaths();
        textRenderer.drawString(batch, text, x + tex.getWidth() + 20, y);

        y -= 40;
    }
    batch.end();
}
 
开发者ID:thorinii,项目名称:MountainRangePvP,代码行数:21,代码来源:LeaderBoardRenderer.java

示例6: persistenceId

import scala.collection.JavaConversions; //导入方法依赖的package包/类
@Override
public String persistenceId() {
    for (String role : JavaConversions.asJavaIterable((Cluster.get(getContext().system()).selfRoles()))) {
        if (role.startsWith("backend-")) {
            return role + "-master";
        }
    }
    return "master";

}
 
开发者ID:Abiy,项目名称:distGatling,代码行数:11,代码来源:Master.java

示例7: refresh

import scala.collection.JavaConversions; //导入方法依赖的package包/类
public static void refresh() {
    if (null == CONTEXT)
        throw new IllegalStateException("The Spark context has not been created.");
    final Set<String> keepNames = new HashSet<>();
    for (final RDD<?> rdd : JavaConversions.asJavaIterable(CONTEXT.persistentRdds().values())) {
        if (null != rdd.name()) {
            keepNames.add(rdd.name());
            NAME_TO_RDD.put(rdd.name(), rdd);
        }
    }
    // remove all stale names in the NAME_TO_RDD map
    NAME_TO_RDD.keySet().stream().filter(key -> !keepNames.contains(key)).collect(Collectors.toList()).forEach(NAME_TO_RDD::remove);
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:14,代码来源:Spark.java

示例8: hasPersistedRDD

import scala.collection.JavaConversions; //导入方法依赖的package包/类
private static boolean hasPersistedRDD(final String name) {
    for (final RDD<?> rdd : JavaConversions.asJavaIterable(Spark.getContext().persistentRdds().values())) {
        if (null != rdd.name() && rdd.name().equals(name))
            return true;
    }
    return false;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:8,代码来源:SparkTest.java

示例9: getPersistedRDDSize

import scala.collection.JavaConversions; //导入方法依赖的package包/类
private static int getPersistedRDDSize() {
    int counter = 0;
    for (final RDD<?> rdd : JavaConversions.asJavaIterable(Spark.getContext().persistentRdds().values())) {
        if (null != rdd.name())
            counter++;
    }
    return counter;
}
 
开发者ID:PKUSilvester,项目名称:LiteGraph,代码行数:9,代码来源:SparkTest.java

示例10: getBrokers

import scala.collection.JavaConversions; //导入方法依赖的package包/类
/**
 * There is always only one string in zkHost
 * @param zkHost
 * @return
 */
public static Set<String> getBrokers(Set<String> zkHost)
{
  ZkClient zkclient = new ZkClient(zkHost.iterator().next(), 30000, 30000, ZKStringSerializer$.MODULE$);
  Set<String> brokerHosts = new HashSet<String>();
  for (Broker b : JavaConversions.asJavaIterable(ZkUtils.getAllBrokersInCluster(zkclient))) {
    brokerHosts.add(b.connectionString());
  }
  zkclient.close();
  return brokerHosts;
}
 
开发者ID:apache,项目名称:apex-malhar,代码行数:16,代码来源:KafkaMetadataUtil.java

示例11: gatherTraits

import scala.collection.JavaConversions; //导入方法依赖的package包/类
private void gatherTraits(SchemaLike sch) {
    final Iterable<Thype> thypes = 
            JavaConversions.asJavaIterable(sch.thypes().values());

    for(Thype t: thypes) {
        if(t instanceof TraitThypeLike) {
            traits.add((TraitThypeLike)t);
        }
    }
    
    if(sch.parent().isDefined()) {
        gatherTraits(sch.parent().get());
    }
}
 
开发者ID:insweat,项目名称:hssd,代码行数:15,代码来源:TraitSelectCP.java

示例12: persistenceId

import scala.collection.JavaConversions; //导入方法依赖的package包/类
@Override
public String persistenceId() {
  for (String role : JavaConversions.asJavaIterable((Cluster.get(getContext().system()).selfRoles()))) {
    if (role.startsWith("backend-")) {
      return role + "-master";
    }
  }
  return "master";

}
 
开发者ID:typesafehub,项目名称:activator-akka-distributed-workers-java,代码行数:11,代码来源:Master.java

示例13: drawPlayers

import scala.collection.JavaConversions; //导入方法依赖的package包/类
private void drawPlayers(Vector2 scroll, Snapshot snapshot) {
    for (PlayerEntity player : JavaConversions.asJavaIterable(snapshot.playerEntities())) {
        Vector2 pos = player.position().cpy();
        pos.sub(scroll);

        pos.x -= width / 2;
        pos.y -= height / 2;

        pos.x /= H_SCALE;
        pos.y /= V_SCALE;

        pos.x = Math.min(WIDTH / 2, Math.max(pos.x, -WIDTH / 2));
        pos.y = Math.min(HEIGHT / 2, Math.max(pos.y, -HEIGHT / 2));

        pos.x += width - SHIFT - WIDTH + WIDTH / 2;
        pos.y += height - SHIFT - HEIGHT + HEIGHT / 2;

        Texture head = headTextures[0];

        Vector2 dir = player.aim();
        batch.draw(head,
                   pos.x - head.getWidth() / 2,
                   pos.y - head.getHeight() / 2, // Position
                   0, 0, // Origin
                   head.getWidth(), head.getHeight(), // Dst WH
                   1, 1, // Scale
                   0, // Rotation
                   0, 0, // Src XY
                   head.getWidth(), head.getHeight(), // Src WH
                   dir.x > 0, false);
    }
}
 
开发者ID:thorinii,项目名称:MountainRangePvP,代码行数:33,代码来源:MiniMapRenderer.java

示例14: buildUpdates

import scala.collection.JavaConversions; //导入方法依赖的package包/类
@Override
public Iterable<U> buildUpdates(JavaPairRDD<K, M> newData) {
  return JavaConversions.asJavaIterable(scalaManager.buildUpdates(newData.rdd()));
}
 
开发者ID:oncewang,项目名称:oryx2,代码行数:5,代码来源:ScalaSpeedModelManagerAdapter.java

示例15: generate

import scala.collection.JavaConversions; //导入方法依赖的package包/类
public void generate() throws IOException {

    Path tmpRoot = ScalaGenUtils
        .rmrf(outputRoot.resolveSibling(outputRoot.getFileName().toString() + "~tmp"), outputRoot.getParent());

    for (CNamespace namespace : ctx.namespaces().values()) {
      new NamespaceGen(namespace).writeUnder(tmpRoot);
    }

    for (CSchemaFile schemaFile : ctx.schemaFiles().values()) {
      for (CTypeDef typeDef : JavaConversions.asJavaIterable(schemaFile.typeDefs())) {

        switch (typeDef.kind()) {

          case ENTITY:
            //new VarTypeGen((CVarTypeDef) typeDef).writeUnder(tmpRoot);
            break;

          case RECORD:
            new RecordGen((CRecordTypeDef) typeDef).writeUnder(tmpRoot);
            break;

          case MAP:
            break;

          case LIST:
            new ListGen((CListTypeDef) typeDef).writeUnder(tmpRoot);
            break;

          case ENUM:
            break;

          case STRING:
          case INTEGER:
          case LONG:
          case DOUBLE:
          case BOOLEAN:
            new PrimitiveGen((CPrimitiveTypeDef) typeDef).writeUnder(tmpRoot);
            break;

          default:
            throw new UnsupportedOperationException(typeDef.kind().toString());
        }
      }
    }

    ScalaGenUtils.move(tmpRoot, outputRoot, outputRoot.getParent()); // move new root to final location

  }
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:50,代码来源:ScalaSchemaGenerator.java


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