Free cookie consent management tool by TermsFeed Policy Generator

Changeset 552


Ignore:
Timestamp:
09/11/08 21:09:14 (16 years ago)
Author:
gkronber
Message:

added overrides for Equals and GetHashCode in Entity, Literal, SerializedLiteral to behave like values (equal means same uri or value). #200 (Simple indexer for results and matching search-frontend for solution-quality).

Location:
trunk/sources/HeuristicLab.CEDMA.DB.Interfaces
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/Entity.cs

    r544 r552  
    3434      this.Uri = uri;
    3535    }
     36
     37    public override bool Equals(object obj) {
     38      if(this == obj) return true;
     39      Entity other = obj as Entity;
     40      if(other == null) return false;
     41      else return other.Uri.Equals(this.Uri);
     42    }
     43
     44    public override int GetHashCode() {
     45      return Uri.GetHashCode();
     46    }
    3647  }
    3748}
  • trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/Literal.cs

    r544 r552  
    3636      Value = value;
    3737    }
     38
     39    public override bool Equals(object obj) {
     40      if(this == obj) return true;
     41      Literal other = obj as Literal;
     42      if(obj == null) return false;
     43      else return other.Value.Equals(this.Value);
     44    }
     45
     46    public override int GetHashCode() {
     47      return Value.GetHashCode();
     48    }
    3849  }
    3950}
  • trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/SerializedLiteral.cs

    r544 r552  
    3636      RawData = rawData;
    3737    }
     38
     39    public override bool Equals(object obj) {
     40      if(this == obj) return true;
     41      SerializedLiteral other = obj as SerializedLiteral;
     42      if(other == null) return false;
     43      else return other.RawData.Equals(this.RawData);
     44    }
     45
     46    public override int GetHashCode() {
     47      return RawData.GetHashCode();
     48    }
    3849  }
    3950}
Note: See TracChangeset for help on using the changeset viewer.