diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-11-28 17:32:28 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-11-28 17:32:28 -0500 |
| commit | d267dd1dda606f0c56d8afaa7187485e60ebfd86 (patch) | |
| tree | e1bca5933aa7e5e9793773057fd5616ff65a9eb8 /src/main/java/derms/replica2/Resource.java | |
| parent | 6654546671eea9f9becd32b3160a134802659cbc (diff) | |
| download | soen423-d267dd1dda606f0c56d8afaa7187485e60ebfd86.zip | |
move replica2 to top level
Diffstat (limited to 'src/main/java/derms/replica2/Resource.java')
| -rw-r--r-- | src/main/java/derms/replica2/Resource.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/main/java/derms/replica2/Resource.java b/src/main/java/derms/replica2/Resource.java new file mode 100644 index 0000000..31d40bc --- /dev/null +++ b/src/main/java/derms/replica2/Resource.java @@ -0,0 +1,39 @@ +package derms.replica2; + +import java.io.Serializable; + +class Resource implements Serializable { + ResourceID id; + ResourceType type; + int duration; + boolean isBorrowed; + CoordinatorID borrower; + int borrowDuration; + + Resource(ResourceID id, ResourceType type, int duration, boolean isBorrowed, CoordinatorID borrower, int borrowDuration) { + this.id = id; + this.type = type; + this.duration = duration; + this.isBorrowed = isBorrowed; + this.borrower = borrower; + this.borrowDuration = borrowDuration; + } + + Resource(ResourceID id, ResourceType type, int duration) { + this(id, type, duration, false, new CoordinatorID(), -1); + } + + Resource() { + this(new ResourceID(), ResourceType.AMBULANCE, 0); + } + + @Override + public int hashCode() { + return id.hashCode(); + } + + @Override + public String toString() { + return id+" "+duration; + } +} |