<commit_before><commit_msg>Missed this last time round - base class storage for SimpleQuery and QueryBuilder.<commit_after>package org.biojava.utils.query;

import java.util.*;

import org.biojava.utils.*;

class QueryData {
  protected final Set nodes;
  protected final Map operationsToLabel;
  protected final Map arcsFrom;
  protected final Map arcsTo;
  
  {
    nodes = new HashSet();
    operationsToLabel = new HashMap();
    arcsFrom = new HashMap();
    arcsTo = new HashMap();
  }
  
  protected QueryData() {};
  
  protected QueryData(QueryData qd) {
    this.nodes.addAll(qd.nodes);
    this.operationsToLabel.putAll(qd.operationsToLabel);
    this.arcsFrom.putAll(qd.arcsFrom);
    this.arcsTo.putAll(qd.arcsTo);
  }
  
  public final Set getNodes() {
    return Collections.unmodifiableSet(nodes);
  }
  
  public final Set getOperations(Arc arc) {
    Set ops = (Set) operationsToLabel.get(arc);
    if(ops == null) {
      ops = Collections.EMPTY_SET;
    } else {
      ops = Collections.unmodifiableSet(ops);
    }
    return ops;
  }
  
  public final Map getArcsToOperators() {
    return Collections.unmodifiableMap(operationsToLabel);
  }
  
  public final Set getArcsFrom(Node from) {
    Set fromSet = (Set) arcsFrom.get(from);
    if(fromSet == null) {
      fromSet = Collections.EMPTY_SET;
    } else {
      fromSet = Collections.unmodifiableSet(fromSet);
    }
    return fromSet;
  }
  
  public final Set getArcsTo(Node to) {
    Set toSet = (Set) arcsTo.get(to);
    if(toSet == null) {
      toSet = Collections.EMPTY_SET;
    } else {
      toSet = Collections.unmodifiableSet(toSet);
    }
    return toSet;
  }
}
{'fraction_non_alphanumeric': 0.10787878787878788, 'fraction_numerical': 0.0, 'mean_word_length': 3.1069651741293534, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7309413', 'n_tokens_mistral': 545, 'n_tokens_neox': 544, 'n_words': 122}