From: <lor...@us...> - 2011-11-06 21:31:19
|
Revision: 3383 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3383&view=rev Author: lorenz_b Date: 2011-11-06 21:31:13 +0000 (Sun, 06 Nov 2011) Log Message: ----------- Storing allocations in query objects for better debugging support. Modified Paths: -------------- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/WeightedQuery.java Modified: trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/WeightedQuery.java =================================================================== --- trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/WeightedQuery.java 2011-11-06 21:28:47 UTC (rev 3382) +++ trunk/components-ext/src/main/java/org/dllearner/algorithm/tbsl/sparql/WeightedQuery.java 2011-11-06 21:31:13 UTC (rev 3383) @@ -1,10 +1,15 @@ package org.dllearner.algorithm.tbsl.sparql; +import java.util.HashSet; +import java.util.Set; + public class WeightedQuery implements Comparable<WeightedQuery>{ private double score; private Query query; + private Set<Allocation> allocations = new HashSet<Allocation>(); + public WeightedQuery(Query query, double score) { super(); this.score = score; @@ -26,6 +31,18 @@ public Query getQuery() { return query; } + + public void addAllocation(Allocation a){ + allocations.add(a); + } + + public void addAllocations(Set<Allocation> allocations){ + this.allocations.addAll(allocations); + } + + public Set<Allocation> getAllocations() { + return allocations; + } @Override public int compareTo(WeightedQuery o) { @@ -50,6 +67,16 @@ return query.toString() + "\n(Score: " + score + ")"; } + public String explain(){ + String explanation = toString(); + explanation += "\n["; + for(Allocation a : allocations){ + explanation += a.toString() + "\n"; + } + explanation += "]"; + return explanation; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |