Commit 569ad96a authored by Riegel's avatar Riegel
Browse files

Style: Rename function and field

2 merge requests!28Version 3.17.0 Release,!26Add ZIP-archive support
Showing with 18 additions and 13 deletions
+18 -13
......@@ -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();
......
......@@ -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;
}
/**
......
......@@ -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) {
......
......@@ -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);
......
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment