commit | 36ef79f97d98fc8f061772f6ec33c53c3b9291bb | [log] [tgz] |
---|---|---|
author | Sho SHIMIZU <sshimizu@us.fujitsu.com> | Mon Feb 15 18:47:08 2016 -0800 |
committer | Gerrit Code Review <gerrit@onlab.us> | Wed Feb 17 00:16:48 2016 +0000 |
tree | 54cd1ebf6307bd6c5380aede6c126102d325cb7c | |
parent | b5638b8bf39887cdcfcd03c6bd53b21ccbbd6012 [diff] |
Simplify expression and statement Change-Id: I66cc2bee3a929108c7b4451b3d64c9aac4dcf5d6
diff --git a/core/api/src/main/java/org/onosproject/net/intent/constraint/BooleanConstraint.java b/core/api/src/main/java/org/onosproject/net/intent/constraint/BooleanConstraint.java index f1d4ad9..b644692 100644 --- a/core/api/src/main/java/org/onosproject/net/intent/constraint/BooleanConstraint.java +++ b/core/api/src/main/java/org/onosproject/net/intent/constraint/BooleanConstraint.java
@@ -53,12 +53,8 @@ @Override public boolean validate(Path path, LinkResourceService resourceService) { - for (Link link : path.links()) { - if (!isValid(link, resourceService)) { - return false; - } - } - return true; + return path.links().stream() + .allMatch(link -> isValid(link, resourceService)); } }
diff --git a/core/api/src/main/java/org/onosproject/net/intent/constraint/LinkTypeConstraint.java b/core/api/src/main/java/org/onosproject/net/intent/constraint/LinkTypeConstraint.java index ffa4405..fae76d6 100644 --- a/core/api/src/main/java/org/onosproject/net/intent/constraint/LinkTypeConstraint.java +++ b/core/api/src/main/java/org/onosproject/net/intent/constraint/LinkTypeConstraint.java
@@ -60,7 +60,7 @@ @Override public boolean isValid(Link link, LinkResourceService resourceService) { boolean contains = types.contains(link.type()); - return isInclusive ? contains : !contains; + return isInclusive == contains; } /**