workcraft/workcraft

View on GitHub
workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/SimulationAlg.java

Summary

Maintainability
F
6 days
Test Coverage

Avoid deeply nested control flow statements.
Open

                        if (!visit.isEmpty() && (e3 == visit.peekLast())) {
                            stack.pop();
                            visit.removeLast();
                        } else {
                            break;

    Avoid deeply nested control flow statements.
    Open

                            for (Condition c3 : bsonAlg.getUpperConditions(c2)) {
                                if (c3.isMarked()) {
                                    hasMarking = true;
                                }
                            }

      Avoid deeply nested control flow statements.
      Open

                              if (!visit.isEmpty() && (e3 == visit.peekLast())) {
                                  stack.pop();
                                  visit.removeLast();
                              } else {
                                  break;

        Avoid deeply nested control flow statements.
        Open

                                for (Node e2 : cycle) {
                                    if (e2 instanceof TransitionNode && u.contains(e2)) {
                                        u.remove(e2);
                                        stack.push((TransitionNode) e2);
                                    } else if (!step.contains(e2)) {

          Avoid deeply nested control flow statements.
          Open

                                  for (Condition c3 : bsonAlg.getUpperConditions(c2)) {
                                      if (c3.isMarked()) {
                                          hasMarking = true;
                                      }
                                  }

            Avoid deeply nested control flow statements.
            Open

                                    for (Node e2 : cycle) {
                                        if (e2 instanceof TransitionNode && u.contains(e2)) {
                                            u.remove(e2);
                                            stack.push((TransitionNode) e2);
                                        } else if (!step.contains(e2)) {

              Avoid deeply nested control flow statements.
              Open

                                      if (u.contains(e3)) {
                                          u.remove(e3);
                                          stack.push(e3);
                                      }

                Avoid deeply nested control flow statements.
                Open

                                        if (!((ChannelPlace) pre).isMarked()) {
                                            for (MathNode pre2 : net.getPreset(pre)) {
                                                if (visit.contains(pre2)) {
                                                    continue;
                                                } else if (!result.contains(pre2) || del.contains(pre2)) {

                  Avoid deeply nested control flow statements.
                  Open

                                          if (isInitial(min) && !min.isMarked()) {
                                              min.setMarked(true);
                                          }

                    Avoid deeply nested control flow statements.
                    Open

                                            if (u.contains(e3)) {
                                                u.remove(e3);
                                                stack.push(e3);
                                            }

                      Avoid deeply nested control flow statements.
                      Open

                                              if (!hasMarking) {
                                                  c2.setMarked(false);
                                              }

                        Avoid deeply nested control flow statements.
                        Open

                                                if (!((ChannelPlace) post).isMarked()) {
                                                    for (MathNode post2 : net.getPostset(post)) {
                                                        if (visit.contains(post2)) {
                                                            continue;
                                                        } else if (!result.contains(post2) || del.contains(post2)) {

                          Avoid deeply nested control flow statements.
                          Open

                                                  if (!hasMarking) {
                                                      c2.setMarked(false);
                                                  }

                            Avoid deeply nested control flow statements.
                            Open

                                                    if (!c2.isMarked()) {
                                                        return false;
                                                    }

                              Avoid deeply nested control flow statements.
                              Open

                                                      if (isFinal(max) && !max.isMarked()) {
                                                          max.setMarked(true);
                                                      }

                                Avoid deeply nested control flow statements.
                                Open

                                                        if (!c2.isMarked()) {
                                                            return false;
                                                        }

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      private Step getRevEnabled(Collection<Path> sync, Map<Condition, Collection<Phase>> phases) {
                                          Step result = new Step();
                                          Collection<Node> del = new HashSet<>();
                                          Stack<TransitionNode> stack = new Stack<>();
                                  
                                  
                                  workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/SimulationAlg.java on lines 238..305

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 393.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      private Step getEnabled(Collection<Path> sync, Map<Condition, Collection<Phase>> phases) {
                                          Step result = new Step();
                                          Collection<Node> del = new HashSet<>();
                                          Stack<TransitionNode> stack = new Stack<>();
                                  
                                  
                                  workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/SimulationAlg.java on lines 355..422

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 393.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      private void fire(Step step, Map<Condition, Collection<Phase>> phases) throws UnboundedException {
                                          //marking for ON and CSON
                                          for (TransitionNode e : step) {
                                              for (MathNode post : net.getPostset((MathNode) e)) {
                                                  if ((post instanceof PlaceNode) && net.getSONConnectionType((MathNode) e, post) != Semantics.SYNCLINE) {
                                  workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/SimulationAlg.java on lines 499..557

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 375.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      private void revFire(Step step, Map<Condition, Collection<Phase>> phases) throws UnboundedException {
                                  
                                          //marking for ON and CSON
                                          for (TransitionNode e : step) {
                                              for (MathNode pre : net.getPreset((MathNode) e)) {
                                  workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/SimulationAlg.java on lines 436..493

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 375.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      private Step getForwordMinFire(TransitionNode e, Collection<Path> sync, Step step) {
                                          Step result = new Step();
                                          Step u = new Step();
                                          Stack<TransitionNode> stack = new Stack<>();
                                          u.addAll(step);
                                  workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/SimulationAlg.java on lines 127..165

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 248.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      private Step getRevMinFire(TransitionNode e, Collection<Path> sync, Step step) {
                                          Step result = new Step();
                                          Step u = new Step();
                                          Stack<TransitionNode> stack = new Stack<>();
                                          u.addAll(step);
                                  workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/SimulationAlg.java on lines 86..125

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 248.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      private boolean isRevBSONEnabled(TransitionNode e, Map<Condition, Collection<Phase>> phases) {
                                          //if e is upper event, e is BSON unfire enabled if every condition in the minimal phases of e is marked
                                          for (ONGroup group : upperGroups) {
                                              if (group.getComponents().contains(e)) {
                                                  for (Node post : getPostPNSet(e)) {
                                  workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/SimulationAlg.java on lines 194..223

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 157.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      private boolean isBSONEnabled(TransitionNode e, Map<Condition, Collection<Phase>> phases) {
                                          //if e is upper event, e is BSON enabled if every condition in the maximal phases of e is marked
                                          for (ONGroup group : upperGroups) {
                                              if (group.getComponents().contains(e)) {
                                                  for (Node pre : getPrePNSet(e)) {
                                  workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/SimulationAlg.java on lines 324..353

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 157.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      public Map<PlaceNode, Boolean> getInitialMarking() {
                                          HashMap<PlaceNode, Boolean> result = new HashMap<>();
                                  
                                          Collection<PlaceNode> initialM = sonAlg.getSONInitial();
                                  
                                  
                                  workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/SimulationAlg.java on lines 55..69

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 69.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      public Map<PlaceNode, Boolean> getFinalMarking() {
                                          HashMap<PlaceNode, Boolean> result = new HashMap<>();
                                  
                                          Collection<PlaceNode> finalM = sonAlg.getSONFinal();
                                  
                                  
                                  workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/SimulationAlg.java on lines 38..52

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 69.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      private boolean isRevONEnabled(TransitionNode e) {
                                          if (net.getPostset((MathNode) e).isEmpty()) {
                                              return false;
                                          }
                                  
                                  
                                  workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/SimulationAlg.java on lines 178..192

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 68.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  Similar blocks of code found in 2 locations. Consider refactoring.
                                  Open

                                      private boolean isONEnabled(TransitionNode e) {
                                          if (net.getPreset((MathNode) e).isEmpty()) {
                                              return false;
                                          }
                                  
                                  
                                  workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/SimulationAlg.java on lines 308..322

                                  Duplicated Code

                                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                  Tuning

                                  This issue has a mass of 68.

                                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                  Refactorings

                                  Further Reading

                                  There are no issues that match your filters.

                                  Category
                                  Status