commit | a0b0a1395a44d557d0521361084427c16483a391 | [log] [tgz] |
---|---|---|
author | Yuta HIGUCHI <y-higuchi@ak.jp.nec.com> | Fri Sep 16 15:47:49 2016 -0700 |
committer | Gerrit Code Review <gerrit@onlab.us> | Wed Sep 21 00:23:04 2016 +0000 |
tree | 64ebc64af9166d1ca1b4e6d57acd79e8ef75a21d | |
parent | 2c51531ab7cb514b30e4830b20541aa8a2f7e673 [diff] |
Keep using same iterator. Change-Id: Icfdb9d79c188677dd89c851644ceb855e3bb9781
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/ConnectivityIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/ConnectivityIntentCompiler.java index 6dd4ebd..62c027a 100644 --- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/ConnectivityIntentCompiler.java +++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/ConnectivityIntentCompiler.java
@@ -154,14 +154,15 @@ @Override public double weight(TopologyEdge edge) { - if (!constraints.iterator().hasNext()) { - return 1.0; - } // iterate over all constraints in order and return the weight of // the first one with fast fail over the first failure Iterator<Constraint> it = constraints.iterator(); + if (!it.hasNext()) { + return 1.0; + } + double cost = it.next().cost(edge.link(), resourceService::isAvailable); while (it.hasNext() && cost > 0) { if (it.next().cost(edge.link(), resourceService::isAvailable) < 0) {