Skip to content

Commit

Permalink
Merge pull request #56 from jaycwb/master
Browse files Browse the repository at this point in the history
Fix to Attribute Indexing
  • Loading branch information
abifet committed May 12, 2016
2 parents cba5747 + 6ee5db1 commit c88d4c7
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class Instances implements Serializable {
/**
* A Hash that stores the indices of features.
*/
protected HashMap<Attribute, Integer> hsAttributesIndices;
protected HashMap<String, Integer> hsAttributesIndices;

/**
* Instantiates a new instances.
Expand Down Expand Up @@ -564,18 +564,18 @@ protected String stringWithoutHeader() {
* @param att, the attribute.
*/
protected int indexOf(Attribute att) {
return this.hsAttributesIndices.get(att);
return this.hsAttributesIndices.get(att.name());
}

/**
* Completes the hashset with attributes indices.
*/
private void computeAttributesIndices() {
this.hsAttributesIndices = new HashMap<Attribute, Integer>();
this.hsAttributesIndices = new HashMap<String, Integer>();
// iterates through all existing attributes
// and sets an unique identifier for each one of them
for (int i = 0; i < this.numAttributes(); i++) {
hsAttributesIndices.put(this.attribute(i), i);
hsAttributesIndices.put(this.attribute(i).name(), i);
}
}

Expand Down

0 comments on commit c88d4c7

Please sign in to comment.