mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-22 21:01:00 +02:00
Simplify expression and statement
Change-Id: I66cc2bee3a929108c7b4451b3d64c9aac4dcf5d6
This commit is contained in:
parent
b5638b8bf3
commit
36ef79f97d
@ -53,12 +53,8 @@ public abstract class BooleanConstraint implements Constraint {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean validate(Path path, LinkResourceService resourceService) {
|
public boolean validate(Path path, LinkResourceService resourceService) {
|
||||||
for (Link link : path.links()) {
|
return path.links().stream()
|
||||||
if (!isValid(link, resourceService)) {
|
.allMatch(link -> isValid(link, resourceService));
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ public class LinkTypeConstraint extends BooleanConstraint {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isValid(Link link, LinkResourceService resourceService) {
|
public boolean isValid(Link link, LinkResourceService resourceService) {
|
||||||
boolean contains = types.contains(link.type());
|
boolean contains = types.contains(link.type());
|
||||||
return isInclusive ? contains : !contains;
|
return isInclusive == contains;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user