-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: changed the tracker for a more generic class
- Loading branch information
Showing
2 changed files
with
14 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 10 additions & 6 deletions
16
rskj-core/src/main/java/co/rsk/peg/federation/FederationTracker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
package co.rsk.peg.federation; | ||
|
||
public class FederationTracker<T> { | ||
private T federation; | ||
private T value; | ||
private boolean modified = false; | ||
|
||
public boolean isModified() { | ||
return this.modified; | ||
} | ||
|
||
public T get() { | ||
return this.federation; | ||
return this.value; | ||
} | ||
|
||
public boolean isPresent() { | ||
return this.federation != null; | ||
return this.value != null; | ||
} | ||
|
||
public boolean hasBeenSet() { | ||
return this.isPresent() || this.isModified(); | ||
} | ||
|
||
public void set(T aFederation, boolean shouldSave) { | ||
this.federation = aFederation; | ||
this.modified = shouldSave; | ||
public void setNew(T aValue) { | ||
this.value = aValue; | ||
this.modified = true; | ||
} | ||
|
||
public void set(T aValue) { | ||
this.value = aValue; | ||
} | ||
} |