+
+ private static boolean checkNull(TopologyConstraint tc) {
+ if (tc == null) {
+ return true;
+ }
+ if (tc.getAvoidTopology() == null) {
+ return true;
+ }
+ if (tc.getExcludeLink() == null) {
+ return true;
+ }
+ if (tc.getExcludeNode() == null) {
+ return true;
+ }
+ if (tc.getExcludePath() == null) {
+ return true;
+ }
+ if (tc.getIncludeLink() == null) {
+ return true;
+ }
+ if (tc.getIncludeNode() == null) {
+ return true;
+ }
+ if (tc.getIncludePath() == null) {
+ return true;
+ }
+ if (tc.getIncludeTopology() == null) {
+ return true;
+ }
+ return tc.getPreferredTransportLayer() == null;
+ }
+
+ //Due to number of check to do, cyclomatic complexity cannot be easily improved
+ @java.lang.SuppressWarnings("squid:MethodCyclomaticComplexity")
+ private static boolean checkEmpty(TopologyConstraint tc) {
+ if (tc == null) {
+ return true;
+ }
+ if (tc.getAvoidTopology() != null && tc.getAvoidTopology().isEmpty()) {
+ return true;
+ }
+ if (tc.getExcludeLink() != null && tc.getExcludeLink().isEmpty()) {
+ return true;
+ }
+ if (tc.getExcludeNode() != null && tc.getExcludeNode().isEmpty()) {
+ return true;
+ }
+ if (tc.getExcludePath() != null && tc.getExcludePath().isEmpty()) {
+ return true;
+ }
+ if (tc.getIncludeLink() != null && tc.getIncludeLink().isEmpty()) {
+ return true;
+ }
+ if (tc.getIncludeNode() != null && tc.getIncludeNode().isEmpty()) {
+ return true;
+ }
+ if (tc.getIncludePath() != null && tc.getIncludePath().isEmpty()) {
+ return true;
+ }
+ if (tc.getIncludeTopology() != null && tc.getIncludeTopology().isEmpty()) {
+ return true;
+ }
+ return tc.getPreferredTransportLayer() != null && tc.getPreferredTransportLayer().isEmpty();
+
+ }