本文整理汇总了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;
}
示例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);
}
示例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);
}
}
}
示例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;
}