Skip to content

Commit

Permalink
Fix constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian Mendez committed Jun 6, 2017
1 parent 88d1370 commit c810d64
Showing 1 changed file with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class TableImpl implements Table {

private CompositeType tableType = new CompositeTypeImpl();
private final List<Record> list = new ArrayList<>();
private Map<URI, URI> prefixMap = new TreeMap<URI, URI>();
private final Map<URI, URI> prefixMap = new TreeMap<URI, URI>();
private final List<String> sortingOrder = new ArrayList<>();
private final Set<String> fieldsWithReverseOrder = new TreeSet<>();

Expand All @@ -39,29 +39,32 @@ public TableImpl(CompositeTypeValue other) {
this.list.addAll(other.getRecords());
if (other instanceof Table) {
Table otherTable = (Table) other;
Map<URI, URI> otherMap = otherTable.getPrefixMap();
otherMap.keySet().forEach(key -> this.prefixMap.put(key, otherMap.get(key)));
this.sortingOrder.addAll(otherTable.getSortingOrder());
this.fieldsWithReverseOrder.addAll(otherTable.getFieldsWithReverseOrder());
}
}

@Override
public Map<URI, URI> getPrefixMap() {
return this.prefixMap;
public CompositeType getType() {
return this.tableType;
}

@Override
public void setPrefixMap(Map<URI, URI> newPrefixMap) {
this.prefixMap = newPrefixMap;
public void setType(CompositeType newType) {
this.tableType = newType;
}

@Override
public CompositeType getType() {
return this.tableType;
public Map<URI, URI> getPrefixMap() {
return this.prefixMap;
}

@Override
public void setType(CompositeType newType) {
this.tableType = newType;
public void setPrefixMap(Map<URI, URI> newPrefixMap) {
this.prefixMap.clear();
newPrefixMap.keySet().forEach(key -> this.prefixMap.put(key, newPrefixMap.get(key)));
}

@Override
Expand Down Expand Up @@ -114,8 +117,8 @@ public void clear() {

@Override
public int hashCode() {
return this.sortingOrder.hashCode() + 0x1F * (this.fieldsWithReverseOrder.hashCode()
+ 0x1F * (this.list.hashCode() + 0x1F * this.tableType.hashCode()));
return this.tableType.hashCode() + 0x1F * (this.prefixMap.hashCode() + 0x1F * (this.sortingOrder.hashCode()
+ 0x1F * (this.fieldsWithReverseOrder.hashCode() + 0x1F * this.list.hashCode())));
}

@Override
Expand All @@ -124,18 +127,19 @@ public boolean equals(Object obj) {
return true;
} else if (obj instanceof Table) {
Table other = (Table) obj;
return getSortingOrder().equals(other.getSortingOrder())
return getType().equals(other.getType()) && getPrefixMap().equals(other.getPrefixMap())
&& getSortingOrder().equals(other.getSortingOrder())
&& getFieldsWithReverseOrder().equals(other.getFieldsWithReverseOrder())
&& getType().equals(other.getType()) && getRecords().equals(other.getRecords());
&& getRecords().equals(other.getRecords());
} else {
return false;
}
}

@Override
public String toString() {
return this.tableType.toString() + " " + this.sortingOrder + " " + this.fieldsWithReverseOrder.toString() + " "
+ this.list.toString();
return this.tableType.toString() + " " + this.prefixMap.toString() + " " + this.sortingOrder.toString() + " "
+ this.fieldsWithReverseOrder.toString() + " " + this.list.toString();
}

}

0 comments on commit c810d64

Please sign in to comment.