remove unwanted lib's

This commit is contained in:
Mann Patel
2025-12-23 22:13:47 -07:00
parent 35458c6cbf
commit 1c59eb1b5b
14 changed files with 51 additions and 7 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
lib/.DS_Store vendored

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -4,11 +4,25 @@ import java.io.*;
import java.util.*; import java.util.*;
/** /**
* PDG Tool: Change Impact Analysis * Change Impact Analysis (CIA) Tool
* Usage: java PDGTool <java-file> [line-number] *
* This tool performs program dependence graph (PDG) analysis on Java source files
* to identify which lines of code are impacted by changes to a specific line.
*
* The analysis works by:
* 1. Building a Control Flow Graph (CFG) from the source code
* 2. Constructing a Program Dependence Graph (PDG) with control and data dependencies
* 3. Computing forward slices to determine impact
*
* Usage: java CIA <java-file> [line-number]
*/ */
public class CIA { public class CIA {
/**
* Main entry point for the Change Impact Analysis tool.
* Validates arguments and initiates the PDG analysis.
*
* @param args Command line arguments: [0] = filename, [1] = optional line number
*/
public static void main(String[] args) { public static void main(String[] args) {
if (args.length < 1) { if (args.length < 1) {
System.err.println("Usage: java PDGTool <java-file> [line-number]"); System.err.println("Usage: java PDGTool <java-file> [line-number]");
@@ -27,6 +41,18 @@ public class CIA {
} }
} }
/**
* Performs PDG analysis on the specified Java file.
*
* This method orchestrates the complete analysis workflow:
* 1. Builds the Control Flow Graph (CFG)
* 2. Constructs the Program Dependence Graph (PDG)
* 3. Either displays all dependencies or computes impact for a specific line
*
* @param filename Path to the Java source file to analyze
* @param targetLine Optional line number to analyze for change impact (null for all dependencies)
* @throws IOException If file cannot be read or parsed
*/
private static void analyzePDG(String filename, Integer targetLine) throws IOException { private static void analyzePDG(String filename, Integer targetLine) throws IOException {
System.out.println("PDG Analysis Tool"); System.out.println("PDG Analysis Tool");
System.out.println("File: " + filename); System.out.println("File: " + filename);
@@ -59,6 +85,19 @@ public class CIA {
} }
/**
* Computes and displays the change impact for a specific line of code.
*
* Change impact is determined by computing a forward slice from the target line,
* which identifies all statements that could be affected by modifying the target.
* This includes both direct dependencies (data flow) and indirect dependencies
* (control flow).
*
* @param cfg The Control Flow Graph of the program
* @param pdg The Program Dependence Graph containing dependency information
* @param cfgBuilder The CFG builder for line number mapping
* @param targetLine The line number to analyze for change impact
*/
private static void computeImpact(ControlFlowGraph cfg, PDG pdg, private static void computeImpact(ControlFlowGraph cfg, PDG pdg,
CFGBuilder cfgBuilder, int targetLine) { CFGBuilder cfgBuilder, int targetLine) {
System.out.println("\n=== Impact Analysis for Line " + targetLine + " ==="); System.out.println("\n=== Impact Analysis for Line " + targetLine + " ===");
@@ -76,7 +115,9 @@ public class CIA {
System.out.println(" " + node.label()); System.out.println(" " + node.label());
} }
// Compute forward slice // Compute forward slice: all nodes reachable via dependencies
// The forward slice represents all statements that could be affected
// by changes to the target line
Set<String> allImpacted = new HashSet<>(); Set<String> allImpacted = new HashSet<>();
for (Node node : nodesAtLine) { for (Node node : nodesAtLine) {
Set<String> impacted = pdg.computeForwardSlice(node.label()); Set<String> impacted = pdg.computeForwardSlice(node.label());

View File

@@ -6,8 +6,11 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
/** /**
* Simple Program Dependence Graph (PDG) * Implementation notes:
* Computes control and data dependencies for a CFG * - Control dependencies computed via iterative reachability analysis
* - Data dependencies computed via reaching definitions analysis
* - Support Java 1.4 syntax with simple pattern matching
*
*/ */
public class PDG { public class PDG {