More documentation.

This commit is contained in:
Jindra Petřík
2024-08-08 19:27:14 +02:00
parent 68954e714d
commit b57e38e387
286 changed files with 11752 additions and 3576 deletions
@@ -17,48 +17,88 @@
package com.jpexs.decompiler.graph;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
/**
*
* A loop in a graph.
* @author JPEXS
*/
public class Loop implements Serializable {
/**
* Continue part of the loop
*/
public GraphPart loopContinue;
/**
* Break part of the loop
*/
public GraphPart loopBreak;
/**
* Precontinue part of the loop.
* A precontinue is a part of the loop that is executed before the continue part.
* Example of this is a for loop with continue statement.
*/
public GraphPart loopPreContinue;
/**
* Back edges of the loop
*/
public Set<GraphPart> backEdges = new HashSet<>();
/**
* Break candidates of the loop
*/
public List<GraphPart> breakCandidates = new ArrayList<>();
/**
* Levels of the break candidates
*/
public List<Integer> breakCandidatesLevels = new ArrayList<>();
/**
* Unique id of the loop
*/
public final long id;
/**
* Mark for leads to method
*/
public int leadsToMark;
/**
* Mark for reachable method
*/
public int reachableMark;
/**
* Phase of the loop.
* The decompiler marks here whether the loop is already processed or not.
*/
public int phase;
/**
* Break candidates are locked
*/
public int breakCandidatesLocked = 0;
public List<GraphTargetItem> precontinueCommands = null;
/**
* Constructs a loop
* @param id Unique id of the loop
* @param loopContinue Continue part of the loop
* @param loopBreak Break part of the loop
*/
public Loop(long id, GraphPart loopContinue, GraphPart loopBreak) {
this.loopContinue = loopContinue;
this.loopBreak = loopBreak;
this.id = id;
}
/**
* To string method
* @return String representation of the loop
*/
@Override
public String toString() {
Set<String> edgesAsStr = new HashSet<>();
@@ -73,6 +113,10 @@ public class Loop implements Serializable {
return "loop(id:" + id + (loopPreContinue != null ? ",precontinue:" + loopPreContinue : "") + ",continue:" + loopContinue + ", break:" + loopBreak + ", phase:" + phase + ", backedges: " + String.join(",", edgesAsStr) + ", breakCandidates: " + String.join(",", bcAsStr) + ")";
}
/**
* Hash code
* @return Hash code of the loop
*/
@Override
public int hashCode() {
int hash = 3;
@@ -80,6 +124,11 @@ public class Loop implements Serializable {
return hash;
}
/**
* Equals
* @param obj Object to compare
* @return True if the object is equal to this loop
*/
@Override
public boolean equals(Object obj) {
if (obj == null) {