Refactor: Extract method
Change-Id: I729f679f2adcdc8507f0bb24a2d89117df18a5e6
Showing
1 changed file
with
13 additions
and
9 deletions
| ... | @@ -290,20 +290,24 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu | ... | @@ -290,20 +290,24 @@ public class OpticalCircuitIntentCompiler implements IntentCompiler<OpticalCircu |
| 290 | } | 290 | } |
| 291 | 291 | ||
| 292 | private boolean isAllowed(OpticalCircuitIntent circuitIntent, OpticalConnectivityIntent connIntent) { | 292 | private boolean isAllowed(OpticalCircuitIntent circuitIntent, OpticalConnectivityIntent connIntent) { |
| 293 | - ConnectPoint srcStaticPort = staticPort(circuitIntent.getSrc()); | 293 | + if (!isAllowed(circuitIntent.getSrc(), connIntent.getSrc())) { |
| 294 | - if (srcStaticPort != null) { | 294 | + return false; |
| 295 | - if (!srcStaticPort.equals(connIntent.getSrc())) { | ||
| 296 | - return false; | ||
| 297 | - } | ||
| 298 | } | 295 | } |
| 299 | 296 | ||
| 300 | - ConnectPoint dstStaticPort = staticPort(circuitIntent.getDst()); | 297 | + if (!isAllowed(circuitIntent.getDst(), connIntent.getDst())) { |
| 301 | - if (dstStaticPort != null) { | 298 | + return false; |
| 302 | - if (!dstStaticPort.equals(connIntent.getDst())) { | 299 | + } |
| 300 | + | ||
| 301 | + return true; | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + private boolean isAllowed(ConnectPoint circuitCp, ConnectPoint connectivityCp) { | ||
| 305 | + ConnectPoint srcStaticPort = staticPort(circuitCp); | ||
| 306 | + if (srcStaticPort != null) { | ||
| 307 | + if (!srcStaticPort.equals(connectivityCp)) { | ||
| 303 | return false; | 308 | return false; |
| 304 | } | 309 | } |
| 305 | } | 310 | } |
| 306 | - | ||
| 307 | return true; | 311 | return true; |
| 308 | } | 312 | } |
| 309 | 313 | ... | ... |
-
Please register or login to post a comment