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


Java Entity类代码示例

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


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

示例1: initShortestPath

import rescuecore2.worldmodel.Entity; //导入依赖的package包/类
private void initShortestPath(WorldInfo worldInfo) {
    Map<EntityID, Set<EntityID>> neighbours = new LazyMap<EntityID, Set<EntityID>>() {
        @Override
        public Set<EntityID> createValue() {
            return new HashSet<>();
        }
    };
    for (Entity next : worldInfo) {
        if (next instanceof Area) {
            Collection<EntityID> areaNeighbours = ((Area) next).getNeighbours();
            neighbours.get(next.getID()).addAll(areaNeighbours);
        }
    }
    for (Map.Entry<EntityID, Set<EntityID>> graph : neighbours.entrySet()) {// fix graph
        for (EntityID entityID : graph.getValue()) {
            neighbours.get(entityID).add(graph.getKey());
        }
    }
    this.shortestPathGraph = neighbours;
}
 
开发者ID:RCRS-ADF,项目名称:sample,代码行数:21,代码来源:SampleKMeans.java

示例2: init

import rescuecore2.worldmodel.Entity; //导入依赖的package包/类
private void init(StandardWorldModel world) {
    Map<EntityID, Set<EntityID>> neighbours = new LazyMap<EntityID, Set<EntityID>>() {
        @Override
        public Set<EntityID> createValue() {
            return new HashSet<EntityID>();
        }
    };
    buildingSet=new HashSet<EntityID>();
    for (Entity next : world) {
        if (next instanceof Area) {
            Collection<EntityID> areaNeighbours = ((Area) next).getNeighbours();
            neighbours.get(next.getID()).addAll(areaNeighbours);
            if(next instanceof Building)
                buildingSet.add(next.getID());
        }
    }
    for (Map.Entry<EntityID, Set<EntityID>> graph : neighbours.entrySet()) // fix graph
    {
        for (EntityID entityID : graph.getValue())
        {
            neighbours.get(entityID).add(graph.getKey());
        }
    }
    setGraph(neighbours);
}
 
开发者ID:AIT-Rescue,项目名称:AIT-Rescue,代码行数:26,代码来源:RouteManager.java

示例3: initRandomWalk

import rescuecore2.worldmodel.Entity; //导入依赖的package包/类
private void initRandomWalk() {
    this.neighbours = new LazyMap<EntityID, Set<EntityID>>() {
        @Override
        public Set<EntityID> createValue() {
            return new HashSet<>();
        }
    };
    for (Entity next : this.provider.getWorld()) {
        if (next instanceof Area) {
            Set<EntityID> roadNeighbours = new HashSet<>();
            for(EntityID areaID : ((Area)next).getNeighbours()) {
                StandardEntity area = this.provider.getWorld().getEntity(areaID);
                if(area instanceof Road || area instanceof Refuge) {
                    roadNeighbours.add(areaID);
                }
            }
            this.neighbours.put(next.getID(), roadNeighbours);
        }
    }
}
 
开发者ID:AIT-Rescue,项目名称:AIT-Rescue,代码行数:21,代码来源:BasicRouteSearcher.java

示例4: init

import rescuecore2.worldmodel.Entity; //导入依赖的package包/类
private void init() {
    Map<EntityID, Set<EntityID>> neighbours = new LazyMap<EntityID, Set<EntityID>>() {
        @Override
        public Set<EntityID> createValue() {
            return new HashSet<>();
        }
    };
    for (Entity next : this.worldInfo) {
        if (next instanceof Area) {
            Collection<EntityID> areaNeighbours = ((Area) next).getNeighbours();
            neighbours.get(next.getID()).addAll(areaNeighbours);
        }
    }
    this.graph = neighbours;
}
 
开发者ID:RCRS-ADF,项目名称:sample,代码行数:16,代码来源:SamplePathPlanning.java


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