Skip to content

Commit

Permalink
Merge pull request #56 from Wikidata/add_toString_for_DataModelImpl
Browse files Browse the repository at this point in the history
Add to string for data model impl
  • Loading branch information
mkroetzsch committed Apr 3, 2014
2 parents fdc5e72 + 93939fe commit 0c775b6
Show file tree
Hide file tree
Showing 20 changed files with 113 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,5 +108,12 @@ public boolean equals(Object obj) {
&& this.mainSnak.equals(other.mainSnak)
&& this.qualifiers.equals(other.qualifiers);
}

@Override
public String toString(){
return "Claim { main snak = " + this.mainSnak
+ ", subject = " + this.subject + ", "
+ this.qualifiers.size() + " qualifiers}";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,10 @@ public boolean equals(Object obj) {

return iri.equals(((DatatypeIdValue) obj).getIri());
}

@Override
public String toString(){
return this.iri;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ public boolean equals(Object obj) {
EntityIdValueImpl other = (EntityIdValueImpl) obj;
return id.equals(other.id) && baseIri.equals(other.baseIri);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -147,4 +147,10 @@ public boolean equals(Object obj) {
&& longitude == other.longitude && precision == other.precision;
}

@Override
public String toString(){
return "(Coordinate)" + this.latitude + "°N, " + this.longitude + "°E (±"
+ this.precision + ") " + this.globeIri;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,14 @@ public boolean equals(Object obj) {
&& statementGroups.equals(other.statementGroups);
}

@Override
public String toString(){
return "ItemDocument {qId = " + this.itemId
+ ", " + this.labels.size() + " labels, "
+ this.descriptions.size() + " descriptions, "
+ this.aliases.size() + " aliases, "
+ this.siteLinks.size() + " site links, "
+ this.statementGroups.size() + " statement groups"
+ "}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,9 @@ public class ItemIdValueImpl extends EntityIdValueImpl implements ItemIdValue {
public String getEntityType() {
return EntityIdValue.ET_ITEM;
}


@Override
public String toString(){
return "(ItemId)" + this.baseIri +"/"+ this.id;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,8 @@ public boolean equals(Object obj) {
&& this.languageCode.equals(other.languageCode);
}

@Override
public String toString(){
return this.text + " (" + this.languageCode + ")";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,10 @@ public boolean equals(Object obj) {

return this.propertyId.equals(((NoValueSnak) obj).getPropertyId());
}

@Override
public String toString(){
return "NoValueSnak {pId = " + this.propertyId + "}";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,15 @@ public boolean equals(Object obj) {
return datatypeId.equals(other.datatypeId)
&& propertyId.equals(other.propertyId);
}

@Override
public String toString(){
return "PropertyDocument {pId = " + this.propertyId
+ ", " + this.labels.size() + " labels, "
+ this.descriptions.size() + " descriptions, "
+ this.aliases.size() + " aliases, "
+ "datatype = " + this.datatypeId
+ "}";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,9 @@ public String getEntityType() {
return EntityIdValue.ET_PROPERTY;
}

@Override
public String toString(){
return "(PropertyId)" + this.baseIri +"/"+ this.id;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,12 @@ public boolean equals(Object obj) {
&& lowerBound.equals(other.lowerBound)
&& upperBound.equals(other.upperBound);
}

@Override
public String toString(){
return "(Quantity)" + this.lowerBound
+ " <= " + this.numericValue
+ " <= " + this.upperBound;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,8 @@ public boolean equals(Object obj) {
return other.snakGroups.equals(this.snakGroups);
}

@Override
public String toString(){
return this.snakGroups.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,11 @@ public boolean equals(Object obj) {
return baseIri.equals(other.baseIri) && badges.equals(other.badges)
&& siteKey.equals(other.siteKey) && title.equals(other.title);
}

@Override
public String toString(){
return "SiteLink {title = " + this.baseIri + "/" + this.title
+ ", siteKey = " + siteKey
+ ", badges = " + this.badges + "}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,8 @@ public boolean equals(Object obj) {
SnakGroupImpl other = (SnakGroupImpl) obj;
return this.snaks.equals(other.snaks);
}

@Override
public String toString(){
return "SnakGroup {pId = " + this.getProperty() + ", " + this.snaks.size() + " snaks}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,8 @@ public boolean equals(Object obj) {

return this.propertyId.equals(((SomeValueSnak) obj).getPropertyId());
}

@Override
public String toString(){
return "SomeValueSnak {pId = " + this.propertyId + "}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,10 @@ public boolean equals(Object obj) {
return this.statements.equals(other.statements);
}

@Override
public String toString(){
return "[" + "subject: " + this.getSubject()
+ ", pId: " + this.getProperty() + ", "
+ this.statements.size() + " items]";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,10 @@ public boolean equals(Object obj) {
&& this.statementId.equals(other.statementId);
}

@Override
public String toString(){
return "Statement {id = " + this.statementId
+ ", rank = " + this.rank + ", "
+ this.references.size() + " references }";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,9 @@ public boolean equals(Object obj) {
return string.equals(((StringValueImpl) obj).string);
}

@Override
public String toString(){
return "(String)"+ this.string;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,11 @@ public boolean equals(Object obj) {
&& this.calendarModel.equals(other.calendarModel);
}

@Override
public String toString(){
return "(Time)" + this.year + "-" + this.month + "-" + this.day + ", "
+ this.hour + ":" + this.minute + ":" + this.second + "h (-"
+ this.beforeTolerance + ", +" + this.afterTolerance + ") timezone = "
+ this.timezoneOffset + " (" + this.calendarModel + ")";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,10 @@ public boolean equals(Object obj) {
return this.propertyId.equals(((ValueSnak) obj).getPropertyId())
&& this.value.equals(((ValueSnak) obj).getValue());
}

@Override
public String toString(){
return "ValueSnak {pId = " + this.propertyId + ", value = " + this.value + "}";
}

}

0 comments on commit 0c775b6

Please sign in to comment.