rename some stuff and be more specific on some usages

This commit is contained in:
OMGeeky
2025-06-21 20:12:17 +02:00
parent 3cc6eb9edb
commit b5a6aa6706
13 changed files with 88 additions and 55 deletions

View File

@@ -36,29 +36,6 @@ public abstract class GameDataElement implements ProjectTreeNode, Serializable {
public String id = null;
protected boolean linkCheck() {
if (checkNotRelatedToParseOrLink()) {
//This type of state is unrelated to parsing/linking.
return false;
} else if (this.state == State.init) {
//Not parsed yet.
this.parse();
} else if (this.state == State.linked) {
//Already linked.
return false;
}
return true;
}
protected boolean checkNotRelatedToParseOrLink() {
if (this.state == State.created || this.state == State.modified || this.state == State.saved) {
//This type of state is unrelated to parsing/linking.
return true;
}
return false;
}
@Override
public Enumeration<ProjectTreeNode> children() {
return null;
@@ -226,4 +203,34 @@ public abstract class GameDataElement implements ProjectTreeNode, Serializable {
public abstract List<SaveEvent> attemptSave();
/**
* Checks if the current state indicates that parsing/linking should be skipped.
* @return true if the operation should be skipped, false otherwise
*/
protected boolean shouldSkipParseOrLink() {
if (shouldSkipParse()) return true;
if (this.state == State.linked) {
//Already linked.
return true;
}
return false;
}
protected boolean shouldSkipParse() {
if (this.state == State.created || this.state == State.modified || this.state == State.saved) {
//This type of state is unrelated to parsing/linking.
return true;
}
return false;
}
/**
* Ensures the element is parsed if needed based on its current state.
*/
protected void ensureParseIfNeeded() {
if (this.state == State.init) {
//Not parsed yet.
this.parse();
}
}
}