diff options
| author | Sam Anthony <sam@samanthony.xyz> | 2024-11-28 10:42:31 -0500 |
|---|---|---|
| committer | Sam Anthony <sam@samanthony.xyz> | 2024-11-28 10:42:31 -0500 |
| commit | 6a710c3943f2350f4575f8cb1898129ef3c7dfdd (patch) | |
| tree | dc20bc0480e77a74f2176e5f0fed02ad2251a2cd /src/main/java/derms/replica/replica2/Resource.java | |
| parent | 0cae203edc71b0285d2971f9124f24cb543b8e39 (diff) | |
| download | soen423-6a710c3943f2350f4575f8cb1898129ef3c7dfdd.zip | |
rename assignment code replica package
Diffstat (limited to 'src/main/java/derms/replica/replica2/Resource.java')
| -rw-r--r-- | src/main/java/derms/replica/replica2/Resource.java | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/main/java/derms/replica/replica2/Resource.java b/src/main/java/derms/replica/replica2/Resource.java new file mode 100644 index 0000000..18aa847 --- /dev/null +++ b/src/main/java/derms/replica/replica2/Resource.java @@ -0,0 +1,39 @@ +package derms.replica.replica2; + +import java.io.Serializable; + +public class Resource implements Serializable { + public ResourceID id; + public ResourceName name; + public int duration; + public boolean isBorrowed; + public CoordinatorID borrower; + public int borrowDuration; + + public Resource(ResourceID id, ResourceName name, int duration, boolean isBorrowed, CoordinatorID borrower, int borrowDuration) { + this.id = id; + this.name = name; + this.duration = duration; + this.isBorrowed = isBorrowed; + this.borrower = borrower; + this.borrowDuration = borrowDuration; + } + + public Resource(ResourceID id, ResourceName name, int duration) { + this(id, name, duration, false, new CoordinatorID(), -1); + } + + public Resource() { + this(new ResourceID(), ResourceName.AMBULANCE, 0); + } + + @Override + public int hashCode() { + return id.hashCode(); + } + + @Override + public String toString() { + return id+" "+duration; + } +} |