當前位置: 首頁>>代碼示例>>Java>>正文


Java LazyMap類代碼示例

本文整理匯總了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;
}
 
開發者ID:RCRS-ADF,項目名稱:sample,代碼行數:21,代碼來源:SampleKMeans.java

示例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);
}
 
開發者ID:AIT-Rescue,項目名稱:AIT-Rescue,代碼行數:26,代碼來源:RouteManager.java

示例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<>();
}
 
開發者ID:AIT-Rescue,項目名稱:AIT-Rescue,代碼行數:17,代碼來源:RouteManager.java

示例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);
        }
    }
}
 
開發者ID:AIT-Rescue,項目名稱:AIT-Rescue,代碼行數:21,代碼來源:BasicRouteSearcher.java

示例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;
}
 
開發者ID:RCRS-ADF,項目名稱:sample,代碼行數:16,代碼來源:SamplePathPlanning.java


注:本文中的rescuecore2.misc.collections.LazyMap類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。