From 569ad96a3079f6330b0ce129cae30472f3285236 Mon Sep 17 00:00:00 2001 From: Riegel <alexander.riegel@hft-stuttgart.de> Date: Fri, 14 Feb 2025 14:23:47 +0100 Subject: [PATCH] Style: Rename function and field --- .../citydoctor2/utils/ArchivePacker.java | 2 +- .../citydoctor2/zip/CityGmlZipEntry.java | 19 ++++++++++++------- .../citydoctor2/gui/CityDoctorController.java | 2 +- .../citydoctor2/gui/ZipEntryManager.java | 6 +++--- .../citydoctor2/gui/tree/ZipEntryNode.java | 2 +- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/ArchivePacker.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/ArchivePacker.java index 7286723..feadacb 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/ArchivePacker.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/utils/ArchivePacker.java @@ -30,7 +30,7 @@ public class ArchivePacker { tmpDir = Files.createTempDirectory("zipTmp"); tmpDir.toFile().deleteOnExit(); for (CityGmlZipEntry entry : archive.getEntries()) { - if (entry.getErrorType() != null || !entry.isDecompressed()) { + if (entry.getErrorType() != null || !entry.isLoaded()) { continue; } CityDoctorModel model = entry.getModel(); diff --git a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/zip/CityGmlZipEntry.java b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/zip/CityGmlZipEntry.java index c27b47d..6c443bd 100644 --- a/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/zip/CityGmlZipEntry.java +++ b/CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/zip/CityGmlZipEntry.java @@ -26,7 +26,7 @@ public class CityGmlZipEntry implements Serializable { private final String displayName; private transient CityDoctorModel model; private CityGmlZipArchive parentArchive; - private boolean decompressed; + private boolean inMemory; private long fileSize = -1L; private static final long MB = 1024 * 1024L; private ZipEntryErrorType errorType = null; @@ -42,7 +42,7 @@ public class CityGmlZipEntry implements Serializable { } public void loadEntry(ParserConfiguration config, ProgressListener l) { - if (decompressed) { + if (inMemory) { return; } if (errorType != null) { @@ -51,7 +51,7 @@ public class CityGmlZipEntry implements Serializable { } try { this.model = CityGmlParser.parseCityGmlZipEntry(this, config, l); - this.decompressed = true; + this.inMemory = true; } catch (CityGmlParseException | InvalidGmlFileException e) { logger.error(e); this.errorType = ZipEntryErrorType.INVALID_CITY_GML_FILE; @@ -91,7 +91,7 @@ public class CityGmlZipEntry implements Serializable { return memoryLimit > (fileSize / MB); } - protected CityGmlZipEntry(ZipEntry entry, CityGmlZipArchive parentArchive, boolean decompressed) { + private CityGmlZipEntry(ZipEntry entry, CityGmlZipArchive parentArchive, boolean inMemory) { this.fileName = entry.getName(); this.filePath = Path.of(entry.getName()); this.displayName = filePath.getFileName().toString(); @@ -99,7 +99,7 @@ public class CityGmlZipEntry implements Serializable { this.fileSize = entry.getSize(); } this.model = null; - this.decompressed = decompressed; + this.inMemory = inMemory; this.parentArchive = parentArchive; } @@ -140,8 +140,13 @@ public class CityGmlZipEntry implements Serializable { return filePath.getParent().resolve(libraryObjectPath); } - public boolean isDecompressed() { - return decompressed; + /** + * Returns whether this entry has been loaded into memory. + * + * @return true if + */ + public boolean isLoaded() { + return inMemory; } /** diff --git a/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/CityDoctorController.java b/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/CityDoctorController.java index 49ece29..e6e5ae7 100644 --- a/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/CityDoctorController.java +++ b/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/CityDoctorController.java @@ -200,7 +200,7 @@ public class CityDoctorController { } public void loadZipEntry(CityGmlZipEntry entry) { - if (!entry.isDecompressed()) { + if (!entry.isLoaded()) { entry.loadEntry(currentConfig); } if (entry.getErrorType() != null) { diff --git a/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryManager.java b/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryManager.java index f0ecce0..fd8abee 100644 --- a/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryManager.java +++ b/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/ZipEntryManager.java @@ -118,7 +118,7 @@ public class ZipEntryManager { private final String unknownValueText = Localization.getText("ZipEntryManager.unknownValue"); private static final Predicate<ZipEntryNode> entryDecompressed = node -> - (node.getEntry().isDecompressed() || node.getEntry().getErrorType() != null); + (node.getEntry().isLoaded() || node.getEntry().getErrorType() != null); private static final Predicate<ZipEntryNode> entryValidated = entryDecompressed.and(node -> (node.getEntry().getModel() != null && node.getEntry().getModel().isValidated())); @@ -383,8 +383,8 @@ public class ZipEntryManager { } else { erroneousValue.setText(Localization.getText("ZipEntryManager.no")); - loadBtn.setDisable(!entry.isDecompressed()); - decompressBtn.setDisable(entry.isDecompressed()); + loadBtn.setDisable(!entry.isLoaded()); + decompressBtn.setDisable(entry.isLoaded()); if (entry.getModel() == null) { validatedValue.setText(unknownValueText); objectCountValue.setText(unknownValueText); diff --git a/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/tree/ZipEntryNode.java b/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/tree/ZipEntryNode.java index 82ef20f..ad55567 100644 --- a/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/tree/ZipEntryNode.java +++ b/CityDoctorParent/Extensions/CityDoctorGUI/src/main/java/de/hft/stuttgart/citydoctor2/gui/tree/ZipEntryNode.java @@ -25,7 +25,7 @@ public class ZipEntryNode { return Color.RED; } return Color.BLUE; - } else if (entry.isDecompressed()) { + } else if (entry.isLoaded()) { return Color.BLUE; } else { return Color.BLACK; -- GitLab