Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 1e7eda9e authored by Jérôme Euzenat's avatar Jérôme Euzenat
Browse files

- implemented missing hashCode (solve BUG #9680 Failed to redefine hashCode...

- implemented missing hashCode (solve BUG #9680	Failed to redefine hashCode when equal is redefined)
parent fd430df2
No related branches found
No related tags found
No related merge requests found
/*
* $Id$
*
* Copyright (C) INRIA, 2003-2005, 2007-2009
* Copyright (C) INRIA, 2003-2005, 2007-2010
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
......@@ -72,6 +72,10 @@ public class BasicCell implements Cell, Comparable<Cell> {
}
}
public int hashCode() {
return 17 + 7*object1.hashCode() + 11*object2.hashCode() + relation.hashCode() + (int)(strength*150.);
}
/**
* Used to order the cells in an alignment:
* -- this > c iff this.getStrength() < c.getStrength() --
......
......@@ -108,6 +108,9 @@ public class BasicRelation implements Relation
return false;
}
}
public int hashCode() {
return 19+relation.hashCode();
}
/** Housekeeping **/
public void dump( ContentHandler h ){};
......
......@@ -67,6 +67,11 @@ public class ObjectCell extends BasicCell {
}
}
public int hashCode() {
return 31 + 7*object1.hashCode() + 11*object2.hashCode() + relation.hashCode() + (int)(strength*150.);
}
/**
* Used to order the cells in an alignment:
* -- this > c iff this.getStrength() < c.getStrength() --
......
/*
* $Id$
*
* Copyright (C) INRIA Rhne-Alpes, 2007-2008
* Copyright (C) INRIA, 2007-2008, 2010
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
......@@ -76,6 +76,10 @@ public class URICell extends BasicCell {
}
}
public int hashCode() {
return 23 + 7*object1.hashCode() + 11*object2.hashCode() + relation.hashCode() + (int)(strength*150.);
}
public URI getObject1AsURI( Alignment al ) throws AlignmentException {
return (URI)object1;
};
......
......@@ -2,7 +2,7 @@
* $Id$
*
* Sourceforge version 1.2 - 2008
* Copyright (C) INRIA, 2007-2009
* Copyright (C) INRIA, 2007-2010
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
......@@ -86,6 +86,10 @@ public class EDOALCell extends BasicCell {
}
}
public int hashCode() {
return 11 + 7*object1.hashCode() + 11*object2.hashCode() + relation.hashCode() + (int)(strength*150.);
}
// JE// Maybe do it in case Expressions have URI
public URI getObject1AsURI( Alignment al ) throws AlignmentException {
return null;
......
......@@ -2,7 +2,7 @@
* $Id$
*
* Sourceforge version 1.3 - 2008
* Copyright (C) INRIA, 2007-2009
* Copyright (C) INRIA, 2007-2010
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
......@@ -41,6 +41,8 @@ import org.xml.sax.ContentHandler;
* In fact, for the EDOAL Mapping language, this encodes directions
* but should be rewritten in order to achive a better implementation
*
* I feel this is not used anymore
*
* @author Jérôme Euzenat
* @version $Id$
*/
......@@ -228,6 +230,10 @@ public class EDOALRelation implements Relation {
}
}
public int hashCode() {
return 5 + 3*type.hashCode() + 7*direction.hashCode() ;
}
/** Housekeeping **/
public void dump( ContentHandler h ){};
......
......@@ -65,7 +65,7 @@ public class Value { //implements Cloneable, Visitable {
}
public int hashCode() {
return value.hashCode();
return 5*value.hashCode();
}
public boolean equals(final Object o) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment