本文整理匯總了Java中rescuecore2.misc.collections.LazyMap類的典型用法代碼示例。如果您正苦於以下問題:Java LazyMap類的具體用法?Java LazyMap怎麽用?Java LazyMap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
LazyMap類屬於rescuecore2.misc.collections包,在下文中一共展示了LazyMap類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initShortestPath
import rescuecore2.misc.collections.LazyMap; //導入依賴的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.misc.collections.LazyMap; //導入依賴的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: analysis
import rescuecore2.misc.collections.LazyMap; //導入依賴的package包/類
private void analysis(StandardWorldModel world) {
Map<EntityID, Set<EntityID>> processedNeighbours = new LazyMap<EntityID, Set<EntityID>>() {
@Override
public Set<EntityID> createValue() {
return new HashSet<>();
}
};
Set<StandardEntity> processedRoad = this.analysisBuilding(world, processedNeighbours);
Collection<StandardEntity> roads = world.getEntitiesOfType(StandardEntityURN.ROAD, StandardEntityURN.HYDRANT);
roads.removeAll(processedRoad);
this.analysisRoad(world, roads, processedNeighbours);
this.passableNodeMap = new HashMap<>(this.nodeMap);
this.passableEdgeMap = new HashMap<>(this.edgeMap);
this.passableEdgeTable = HashBasedTable.create(this.edgeTable);
this.impassableArea = new HashSet<>();
}
示例4: initRandomWalk
import rescuecore2.misc.collections.LazyMap; //導入依賴的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);
}
}
}
示例5: init
import rescuecore2.misc.collections.LazyMap; //導入依賴的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;
}