extension/src/main/java/org/justinnk/masonssa/extension/ssa/EdgeDependencyGraph.java
/**
   * Store the fact that an Action action depends on the attribute of a certain Agent owner.
   *
   * @param action The action that is in the role of the dependent.
   * @param edge The attribute that the action depends on.
   * @param owner The owner of that attribute (used to uniquely identify the attribute).
   */
Store the fact that an Action action depends on the attribute of a certain Agent owner.
@param action The action that is in the role of the dependent.
@param edge The attribute that the action depends on.
@param owner The owner of that attribute (used to uniquely identify the attribute).
Store the fact that an Action action depends on the attribute of a certain Agent owner . @param action The action that is in the role of the dependent . @param edge The attribute that the action depends on . @param owner The owner of that attribute ( used to uniquely identify the attribute ) .
public void addDependency(Action action, Edge edge, Network owner) {
    /* Add to dependents */
    if (!dependents.containsKey(owner)) {
      HashMap<Edge, HashSet<Action>> attributeDeps = new HashMap<>();
      HashSet<Action> deps = new HashSet<>();
      deps.add(action);
      attributeDeps.put(edge, deps);
      dependents.put(owner, attributeDeps);
    } else if (!dependents.get(owner).containsKey(edge)) {
      HashSet<Action> deps = new HashSet<>();
      deps.add(action);
      dependents.get(owner).put(edge, deps);
    } else { 
      dependents.get(owner).get(edge).add(action);
    }
    /* Add to depends on */
    if (!dependsOn.containsKey(action)) {
      HashMap<Network, HashSet<Edge>> attributeDeps = new HashMap<>();
      HashSet<Edge> deps = new HashSet<>();
      deps.add(edge);
      attributeDeps.put(owner, deps);
      dependsOn.put(action, attributeDeps);
    } else if (!dependsOn.get(action).containsKey(owner)) {
      HashSet<Edge> deps = new HashSet<>();
      deps.add(edge);
      dependsOn.get(action).put(owner, deps);
    } else { 
      dependsOn.get(action).get(owner).add(edge);
    }
  }
public void addDependency ( Action action , Edge edge , Network owner ) { /* Add to dependents */ if ( ! dependents . containsKey ( owner ) ) { HashMap < Edge , HashSet < Action > > attributeDeps = new HashMap < > ( ) ; HashSet < Action > deps = new HashSet < > ( ) ; deps . add ( action ) ; attributeDeps . put ( edge , deps ) ; dependents . put ( owner , attributeDeps ) ; } else if ( ! dependents . get ( owner ) . containsKey ( edge ) ) { HashSet < Action > deps = new HashSet < > ( ) ; deps . add ( action ) ; dependents . get ( owner ) . put ( edge , deps ) ; } else { dependents . get ( owner ) . get ( edge ) . add ( action ) ; } /* Add to depends on */ if ( ! dependsOn . containsKey ( action ) ) { HashMap < Network , HashSet < Edge > > attributeDeps = new HashMap < > ( ) ; HashSet < Edge > deps = new HashSet < > ( ) ; deps . add ( edge ) ; attributeDeps . put ( owner , deps ) ; dependsOn . put ( action , attributeDeps ) ; } else if ( ! dependsOn . get ( action ) . containsKey ( owner ) ) { HashSet < Edge > deps = new HashSet < > ( ) ; deps . add ( edge ) ; dependsOn . get ( action ) . put ( owner , deps ) ; } else { dependsOn . get ( action ) . get ( owner ) . add ( edge ) ; } }
Store the fact that an Action action depends on the attribute of a certain Agent owner.
Store the fact that an Action action depends on the attribute of a certain Agent owner .
// HashSet will handle possible duplicates // HashSet will handle possible duplicates