-
Notifications
You must be signed in to change notification settings - Fork 266
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
3 changed files
with
41 additions
and
37 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
27 changes: 0 additions & 27 deletions
27
rskj-core/src/main/java/co/rsk/peg/federation/FederationTracker.java
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
rskj-core/src/main/java/co/rsk/peg/federation/ValueTracker.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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package co.rsk.peg.federation; | ||
|
||
public class ValueTracker<T> { | ||
private T value; | ||
private boolean modified = false; | ||
|
||
public boolean isModified() { | ||
return this.modified; | ||
} | ||
|
||
public T get() { | ||
return this.value; | ||
} | ||
|
||
public boolean isPresent() { | ||
return !isNull() || this.isModified(); | ||
} | ||
|
||
public boolean isNull() { | ||
return this.value == null; | ||
} | ||
|
||
public void setNew(T aValue) { | ||
this.value = aValue; | ||
this.modified = true; | ||
} | ||
|
||
public void set(T aValue) { | ||
this.value = aValue; | ||
} | ||
} |