コード例 #1
0
  // --------------------------------------------------------------------------
  // --- constructors ---------------------------------------------------------
  // --------------------------------------------------------------------------
  public DfaEdge(S src, Symbol symbol, S dest, LR0Item srcItem) {
    this.src = src;
    this.symbol = symbol;
    this.dst = dest;
    this.srcItem = srcItem;

    // Identity by src x symbol
    int srcHash = src == null ? 0 : src.hashCode();
    int symbolHash = symbol == null ? 0 : symbol.hashCode();
    this.hashCode = srcHash * 100 + symbolHash;
  }
コード例 #2
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   DfaEdge<?> other = (DfaEdge<?>) obj;
   if (src == null) {
     if (other.src != null) return false;
   } else if (!src.equals(other.src)) return false;
   if (symbol == null) {
     if (other.symbol != null) return false;
   } else if (!symbol.equals(other.symbol)) return false;
   return true;
 }