void copyFrom (NetworkLayer origin) { if ((this.id != origin.id) || (this.index != origin.index)) throw new RuntimeException ("Bad"); if ((this.netPlan == null) || (origin.netPlan == null) || (this.netPlan == origin.netPlan)) throw new RuntimeException ("Bad"); this.demandTrafficUnitsName = origin.demandTrafficUnitsName; this.description = origin.description; this.defaultNodeIconURL = origin.defaultNodeIconURL; this.name = origin.name; this.linkCapacityUnitsName = origin.linkCapacityUnitsName; this.cache_linksDown.clear (); for (Link e : origin.cache_linksDown) this.cache_linksDown.add(this.netPlan.getLinkFromId (e.id)); this.cache_linksZeroCap.clear (); for (Link e : origin.cache_linksZeroCap) this.cache_linksZeroCap.add(this.netPlan.getLinkFromId (e.id)); this.cache_coupledLinks.clear (); for (Link e : origin.cache_coupledLinks) this.cache_coupledLinks.add(this.netPlan.getLinkFromId (e.id)); this.cache_coupledDemands.clear (); for (Demand d : origin.cache_coupledDemands) this.cache_coupledDemands.add(this.netPlan.getDemandFromId (d.id)); this.cache_coupledMulticastDemands.clear (); for (MulticastDemand d : origin.cache_coupledMulticastDemands) this.cache_coupledMulticastDemands.add(this.netPlan.getMulticastDemandFromId(d.id)); this.cache_routesDown.clear (); for (Route r : origin.cache_routesDown) this.cache_routesDown.add(this.netPlan.getRouteFromId (r.id)); this.cache_routesTravLinkZeroCap.clear(); for (Route r : origin.cache_routesTravLinkZeroCap) this.cache_routesTravLinkZeroCap.add(this.netPlan.getRouteFromId (r.id)); this.cache_multicastTreesDown.clear (); for (MulticastTree t : origin.cache_multicastTreesDown) this.cache_multicastTreesDown.add(this.netPlan.getMulticastTreeFromId (t.id)); this.cache_multicastTreesTravLinkZeroCap.clear(); for (MulticastTree t : origin.cache_multicastTreesTravLinkZeroCap) this.cache_multicastTreesTravLinkZeroCap.add(this.netPlan.getMulticastTreeFromId (t.id)); this.cache_nodePairLinksThisLayer.clear(); for (Entry<Pair<Node,Node>,SortedSet<Link>> entry : origin.cache_nodePairLinksThisLayer.entrySet()) this.cache_nodePairLinksThisLayer.put(Pair.of(this.netPlan.getNodeFromId(entry.getKey().getFirst().getId()) , this.netPlan.getNodeFromId(entry.getKey().getSecond().getId())) , (SortedSet<Link>) (SortedSet<?>) this.netPlan.translateCollectionToThisNetPlan(entry.getValue())); this.cache_nodePairDemandsThisLayer.clear(); for (Entry<Pair<Node,Node>,SortedSet<Demand>> entry : origin.cache_nodePairDemandsThisLayer.entrySet()) this.cache_nodePairDemandsThisLayer.put(Pair.of(this.netPlan.getNodeFromId(entry.getKey().getFirst().getId()) , this.netPlan.getNodeFromId(entry.getKey().getSecond().getId())) , (SortedSet<Demand>) (SortedSet<?>) this.netPlan.translateCollectionToThisNetPlan(entry.getValue())); this.cache_qosTypes2DemandMap.clear(); for (Entry<String,Pair<SortedSet<Demand>,SortedSet<MulticastDemand>>> entry : origin.cache_qosTypes2DemandMap.entrySet()) this.cache_qosTypes2DemandMap.put(entry.getKey() , Pair.of((SortedSet<Demand>) (SortedSet<?>) this.netPlan.translateCollectionToThisNetPlan(entry.getValue().getFirst()) , (SortedSet<MulticastDemand>) (SortedSet<?>) this.netPlan.translateCollectionToThisNetPlan(entry.getValue().getSecond()))); for (Link e : origin.links) this.links.get(e.index).copyFrom(e); for (Demand d : origin.demands) this.demands.get(d.index).copyFrom(d); for (MulticastDemand d : origin.multicastDemands) this.multicastDemands.get(d.index).copyFrom(d); for (Route r : origin.routes) this.routes.get(r.index).copyFrom(r); for (MulticastTree t : origin.multicastTrees) this.multicastTrees.get(t.index).copyFrom(t); }