Conversation
- Replace Vector with ArrayList in GraphSaveObject - Replace deprecated javax.xml.bind.DatatypeConverter with java.util.Base64 - Replace raw Enumeration/Class types with typed generics in ExtensionClassLoader - Add try-with-resources for FileInputStream and ZipFile in ExtensionClassLoader - Replace string concatenation in loops with StringBuilder in AlgorithmUtils - Simplify isConnected() to use stream().distinct().count() - Fix raw ArrayX types to ArrayX<?> across preferences classes (AbstractPreference, GraphPreferences, UserDefinedEligiblity, ArrowHandler) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the legacy BareBonesBrowserLaunch helper (which used reflection to call java.awt.Desktop and fell back to long-removed com.apple.eio and OS-specific exec hacks) with a direct Desktop.getDesktop().browse() call, available since Java 6. Drop the now-unused Arrays import. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…index reports PiIndex, SzegedIndex, WeightedPiIndex, WeightedSzegedIndex, MostarIndex, and RevisedSzegedIndex all shared identical Floyd-Warshall + nu/nv loop logic. Extract that into EdgePartitionIndexBase.sum() with a functional Contribution interface; each report now delegates with a one-liner lambda. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…aph products - Add setCircularPositions() helper + concrete setPositions() to GProduct; GCartesianProduct and GStrongProduct now inherit it, GTensorProduct and GSymmDiff override only what differs (directed flag / radius 200). - Extract GProductAction abstract base with shared @parameter fields, action(), checkParameters(), getCategory(); CartesianProduct, TensorProduct, StrongProduct and SymDiff each reduce to getName/getDescription/createProduct. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…otalGraph, EdgeSemitotalGraph, VertexSemitotalGraph All three shared the same vertex-copy loop, edge-subdivision loop, and curved-edge helper. They differ only in three boolean features: whether to mark subdivision vertices with their edge, whether to add a curved original edge, and whether to connect subdivision vertices of adjacent edges. Extract these into SubdividedGraphBase with overridable hook methods; each subclass is now getName/getDescription + 1-3 boolean flags. Also removes the unused `dis` variable and deduplicates edgeConnects(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…al overrides The vast majority of Parametrizable implementations return null unchanged. Adding a default makes the override opt-in for classes that have real validation, eliminating the boilerplate for all others. Existing non-null overrides (generators, etc.) are unaffected. Remove the now-redundant null overrides from GProductAction and SubdividedGraphBase. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nergy reports DistanceEnergy, TransmissionEnergy, DistanceLaplacianEnergy, and DistanceSignlessLaplacianEnergy all shared the same eigenvalue-sum loop differing only in the matrix source and an optional shift value. Extract AlgorithmUtils.spectralEnergy(Matrix, shift) and reduce each calculate() to a two-liner. Also removes unused `n` variable in the two Laplacian energy reports. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ibuteSetImpl.put() - Add AlgorithmUtils.getAllPairsDistances(GraphModel) as a one-line convenience wrapper for the FloydWarshall two-liner that appears 40+ times in the codebase. Migrate all 5 internal usages in AlgorithmUtils. - NotifiableAttributeSetImpl.put() duplicated the null-check from the parent by bypassing super.put(). Fix: read the old value via get(), delegate to super.put() for the null-guard + map update, then fire. Also remove the trivial get() override that just calls super.get(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Review Summary by QodoJava 17 upgrade with code modernization and refactoring
WalkthroughsDescription• Upgrade Java source/target from 11 to 17 in build configuration • Modernize legacy APIs: replace Vector with ArrayList, deprecated DatatypeConverter with Base64 • Extract EdgePartitionIndexBase to eliminate duplication across six topological index reports • Refactor graph product and subdivision actions into reusable base classes • Add helper methods for common patterns: getAllPairsDistances, spectralEnergy, setCircularPositions • Improve type safety with generics: replace raw Class/Enumeration types with typed versions • Add try-with-resources for FileInputStream and ZipFile in ExtensionClassLoader • Replace legacy BareBonesBrowserLaunch with direct Desktop API call Diagramflowchart LR
A["Java 11 codebase"] -->|"Upgrade JDK"| B["Java 17 target"]
A -->|"Replace deprecated APIs"| C["Modern Java APIs"]
A -->|"Extract duplication"| D["Reusable base classes"]
C --> E["Base64 instead of DatatypeConverter"]
C --> F["ArrayList instead of Vector"]
C --> G["Direct Desktop API"]
D --> H["EdgePartitionIndexBase"]
D --> I["SubdividedGraphBase"]
D --> J["GProductAction"]
H --> K["6 topological indices simplified"]
I --> L["3 graph transformations simplified"]
J --> M["4 product actions simplified"]
File Changes1. src/graphtea/extensions/AlgorithmUtils.java
|
Code Review by Qodo
1. SubdividedGraphBase.action() too nested
|
| if (addSubdivisionVertexEdges()) { | ||
| for (Vertex v1 : g2.getVertexArray()) { | ||
| for (Vertex v2 : g2.getVertexArray()) { | ||
| if (v1.getProp().obj != null && v2.getProp().obj != null) { | ||
| Edge e1 = (Edge) v1.getProp().obj; | ||
| Edge e2 = (Edge) v2.getProp().obj; | ||
| if (edgeConnects(e1, e2)) { | ||
| addCurvedEdge(g2, v1, v2); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
1. subdividedgraphbase.action() too nested 📘 Rule violation ⛯ Reliability
The new SubdividedGraphBase.action() implementation contains control-flow nesting deeper than 4 levels due to nested loops and conditionals. This violates the configured complexity limits and makes the method harder to read and maintain.
Agent Prompt
## Issue description
`SubdividedGraphBase.action()` exceeds the allowed nesting depth (must be ≤ 4) due to multiple nested loops and conditionals.
## Issue Context
The compliance checklist enforces nesting depth limits for new/modified methods. The newly added `if (addSubdivisionVertexEdges())` block introduces nesting deeper than 4.
## Fix Focus Areas
- src/graphtea/extensions/actions/SubdividedGraphBase.java[82-94]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| public ArrayList<VertexSaveObject> vs = new ArrayList<>(); | ||
| ArrayList<EdgeSaveObject> es = new ArrayList<>(); |
There was a problem hiding this comment.
2. Old .tea files unreadable 🐞 Bug ⛯ Reliability
GraphSaveObject’s serialized field types were changed (Vector→ArrayList) without preserving serialization compatibility, so ObjectInputStream deserialization of previously saved “.tea” files can fail and LoadGraph.read will return null instead of loading the graph.
Agent Prompt
### Issue description
GraphTea ".tea" files are serialized instances of `GraphSaveObject`. The PR changes `GraphSaveObject` field types (`Vector` -> `ArrayList`) without maintaining Java serialization compatibility, which can make previously saved ".tea" files fail to load.
### Issue Context
`SaveGraph` writes `new GraphSaveObject(graph)` via `ObjectOutputStream`, and `LoadGraph` reads it back via `ObjectInputStream`. Compatibility depends on the serialized class descriptor/`serialVersionUID`.
### Fix Focus Areas
- src/graphtea/extensions/io/GraphSaveObject.java[16-29]
- src/graphtea/extensions/io/SaveGraph.java[28-34]
- src/graphtea/extensions/io/LoadGraph.java[35-44]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
No description provided.