org.vagabond.explanation.model.prov.ProvWLRepresentation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vagabond Show documentation
Show all versions of vagabond Show documentation
Vagabond is a tool for automatic generation of explanations for data exchange errors.
package org.vagabond.explanation.model.prov;
import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import org.apache.log4j.Logger;
import org.vagabond.explanation.marker.IMarkerSet;
import org.vagabond.explanation.marker.ITupleMarker;
import org.vagabond.explanation.marker.MarkerFactory;
import org.vagabond.util.LogProviderHolder;
public class ProvWLRepresentation {
static Logger log = LogProviderHolder.getInstance().getLogger(ProvWLRepresentation.class);
protected List relNames;
protected IMarkerSet tuplesInProv;
protected Vector> witnessLists;
private int hash = -1;
public ProvWLRepresentation () {
witnessLists = new Vector> ();
tuplesInProv = MarkerFactory.newMarkerSet();
relNames = new ArrayList ();
}
public List getRelNames() {
return relNames;
}
public void setRelNames(List relNames) {
this.relNames = relNames;
}
public IMarkerSet getTuplesInProv() {
return tuplesInProv;
}
public void setTuplesInProv(IMarkerSet tuplesInProv) {
this.tuplesInProv = tuplesInProv;
}
public void addTupleInProv (ITupleMarker tuple) {
this.tuplesInProv.add(tuple);
}
public Vector> getWitnessLists() {
return witnessLists;
}
public void setWitnessLists(Vector> witnessLists) {
this.witnessLists = witnessLists;
}
public void addWitnessList(Vector witnessList) {
this.witnessLists.add(witnessList);
}
public Vector getWitnessList (int i) {
return this.witnessLists.get(i);
}
@Override
public String toString() {
StringBuffer result;
result = new StringBuffer();
result.append("PROVENANCE: relnames <" + relNames + ">\n");
result.append("\ttuples in prov: <" + tuplesInProv + ">\n");
result.append("\twitness lists: <" + witnessLists + ">");
return result.toString();
}
@Override
public int hashCode () {
if (hash == -1) {
hash = relNames.hashCode();
hash = 13 * hash + tuplesInProv.hashCode();
hash = 13 * hash + witnessLists.hashCode();
}
return hash;
}
@Override
public boolean equals (Object other) {
if (other == null)
return false;
if (other == this)
return true;
if (! (other instanceof ProvWLRepresentation))
return false;
ProvWLRepresentation oWl = (ProvWLRepresentation) other;
if (!this.relNames.equals(oWl.relNames))
return false;
if (!this.tuplesInProv.equals(oWl.tuplesInProv))
return false;
if (!this.witnessLists.equals(oWl.witnessLists))
return false;
return true;
}
}