-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Actors will now keep track of their parents and children. (#71)
- Loading branch information
1 parent
04fe05b
commit b879a41
Showing
8 changed files
with
137 additions
and
12 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
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
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
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
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
68 changes: 68 additions & 0 deletions
68
src/main/java/dansapps/interakt/objects/AbstractFamilialEntity.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,68 @@ | ||
package dansapps.interakt.objects; | ||
|
||
import preponderous.environmentlib.abs.objects.Entity; | ||
|
||
import java.util.HashSet; | ||
import java.util.UUID; | ||
|
||
/** | ||
* @author Daniel McCoy Stephenson | ||
*/ | ||
public abstract class AbstractFamilialEntity extends Entity { | ||
protected HashSet<UUID> parentIDs = new HashSet<>(); | ||
protected HashSet<UUID> childIDs = new HashSet<>(); | ||
|
||
public AbstractFamilialEntity(String name) { | ||
super(name); | ||
} | ||
|
||
public HashSet<UUID> getParentUUIDs() { | ||
return parentIDs; | ||
} | ||
|
||
public boolean addParent(UUID uuid) { | ||
return parentIDs.add(uuid); | ||
} | ||
|
||
public boolean removeParent(UUID uuid) { | ||
return parentIDs.remove(uuid); | ||
} | ||
|
||
public HashSet<UUID> getChildUUIDs() { | ||
return childIDs; | ||
} | ||
|
||
public boolean addChild(UUID uuid) { | ||
return childIDs.add(uuid); | ||
} | ||
|
||
public boolean removeChild(UUID uuid) { | ||
return childIDs.remove(uuid); | ||
} | ||
|
||
public String getParentsUUIDsSeparatedByCommas() { | ||
String toReturn = ""; | ||
int count = 0; | ||
for (UUID uuid : parentIDs) { | ||
toReturn = toReturn + uuid.toString(); | ||
count++; | ||
if (count != parentIDs.size()) { | ||
toReturn = toReturn + ", "; | ||
} | ||
} | ||
return toReturn; | ||
} | ||
|
||
public String getChildrenUUIDsSeparatedByCommas() { | ||
String toReturn = ""; | ||
int count = 0; | ||
for (UUID uuid : childIDs) { | ||
toReturn = toReturn + uuid.toString(); | ||
count++; | ||
if (count != childIDs.size()) { | ||
toReturn = toReturn + ", "; | ||
} | ||
} | ||
return toReturn; | ||
} | ||
} |
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
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