Exemplo n.º 1
0
 public ResearchNode copy() {
   ResearchNode copy = new ResearchNode(name, defaultState);
   copy.dependencies.addAll(dependencies);
   copy.dependants.addAll(dependants);
   copy.mapName = mapName;
   copy.locked = false;
   return copy;
 }
Exemplo n.º 2
0
  public final void addDependency(ResearchNode node) {
    if (locked) {
      throw new IllegalStateException("Node " + name + " is locked, cannot add new dependencies");
    }

    dependencies.add(node.getName());
    node.addDependant(this);
  }
Exemplo n.º 3
0
  @Override
  public boolean equals(Object o) {
    if (o == this) {
      return true;
    }

    if (!(o instanceof ResearchNode)) {
      return false;
    }

    ResearchNode node = (ResearchNode) o;

    return (name.equals(node.getName()) && mapName.equals(node.mapName));
  }
Exemplo n.º 4
0
  private void addDependant(ResearchNode node) {
    if (locked) {
      throw new IllegalStateException("Node " + name + " is locked, cannot add new dependants");
    }

    dependants.add(node.getName());
  }
Exemplo n.º 5
0
 public final boolean dependsOn(ResearchNode node) {
   return dependencies.contains(node.getName()) && Objects.equals(node.mapName, mapName);
 }