Updated javadoc comments
diff --git a/src/main/java/de/ids_mannheim/korap/query/DistanceConstraint.java b/src/main/java/de/ids_mannheim/korap/query/DistanceConstraint.java
index 0bb3e43..806384f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/DistanceConstraint.java
+++ b/src/main/java/de/ids_mannheim/korap/query/DistanceConstraint.java
@@ -2,9 +2,10 @@
/**
* DistanceConstraint specifies the constraints used in
- * {@link SpanDistanceQueries} or {@link SpanMultipleDistanceQueries}. The
- * constraints comprise the distance unit, the minimum and maximum distance, the
- * order and the co-occurence of the compared spans.
+ * {@link SpanDistanceQuery SpanDistanceQueries} or
+ * {@link SpanMultipleDistanceQuery SpanMultipleDistanceQueries}. The
+ * constraints comprise the distance unit, the minimum and maximum distances,
+ * the order and the co-occurence of the compared spans.
*
* Distance constraint examples:
*
@@ -55,6 +56,20 @@
private boolean exclusion;
private boolean isOrdered;
+ /**
+ * Constructs a DistanceConstraint object with the specified minimum and
+ * maximum distances. If isOrdered is true, the spans must occur in order.
+ * If exclusion is true, the second span must <em>not</em> occur together
+ * with the first span.
+ *
+ * @param min the minimum distance
+ * @param max the maximum distance
+ * @param isOrdered a boolean flag representing the value <code>true</code>
+ * if the spans should occur in order, false otherwise.
+ * @param exclusion a boolean flag representing the value <code>true</code>,
+ * if the second span should occur together with the first span,
+ * false otherwise.
+ */
public DistanceConstraint(int min, int max, boolean isOrdered,
boolean exclusion) {
this.unit = "w";
@@ -64,6 +79,22 @@
this.exclusion = exclusion;
}
+ /**
+ * Constructs a DistanceContraint object with the specified SpanElementQuery
+ * as the distance unit, and the specified minimum and the maximum
+ * distances. If isOrdered is true, the spans must occur in order. If
+ * exclusion is true, the second span must <em>not</em> occur together with
+ * the first span.
+ *
+ * @param elementQuery the distance unit
+ * @param min the minimum distance
+ * @param max the maximum distance
+ * @param isOrdered a boolean flag representing the value <code>true</code>
+ * if the spans should occur in order, false otherwise.
+ * @param exclusion a boolean flag representing the value <code>true</code>,
+ * if the second span should occur together with the first span,
+ * false otherwise.
+ */
public DistanceConstraint(SpanElementQuery elementQuery, int min, int max,
boolean isOrdered, boolean exclusion) {
if (elementQuery == null) {
@@ -78,50 +109,116 @@
this.elementQuery = elementQuery;
}
+ /**
+ * Returns the minimum distance.
+ *
+ * @return the minimum distance
+ */
public int getMinDistance() {
return minDistance;
}
+ /**
+ * Sets the minimum distance.
+ *
+ * @param minDistance the minimum distance
+ */
public void setMinDistance(int minDistance) {
this.minDistance = minDistance;
}
+ /**
+ * Returns the maximum distance.
+ *
+ * @return the maximum distance
+ */
public int getMaxDistance() {
return maxDistance;
}
+ /**
+ * Sets the maximum distance.
+ *
+ * @param maxDistance the maximum distance
+ */
public void setMaxDistance(int maxDistance) {
this.maxDistance = maxDistance;
}
+ /**
+ * Returns the distance unit.
+ *
+ * @return the distance unit
+ */
public String getUnit() {
return unit;
}
+ /**
+ * Sets the distance unit.
+ *
+ * @param unit the distance unit
+ */
public void setUnit(String unit) {
this.unit = unit;
}
+ /**
+ * Returns the element query used as the distance unit.
+ *
+ * @return the element query used as the distance unit
+ */
public SpanElementQuery getElementQuery() {
return elementQuery;
}
+ /**
+ * Sets the element query used as the distance unit.
+ *
+ * @param elementQuery the element query used as the distance unit.
+ */
public void setElementQuery(SpanElementQuery elementQuery) {
this.elementQuery = elementQuery;
}
+ /**
+ * Tells if the second span must occur together with the first span, or not.
+ *
+ * @return <code>true</code> if the second span must <em>not</em> occur
+ * together with the first span, <code>false</code> otherwise.
+ */
public boolean isExclusion() {
return exclusion;
}
+ /**
+ * Sets <code>true</code> if the second span must <em>not</em> occur
+ * together with the first span, <code>false</code> otherwise.
+ *
+ * @param exclusion a boolean with value <code>true</code> if the second
+ * span must <em>not</em> occur together with the first span,
+ * <code>false</code> otherwise.
+ */
public void setExclusion(boolean exclusion) {
this.exclusion = exclusion;
}
+ /**
+ * Tells if the spans must occur in order or not.
+ *
+ * @return <code>true</code> if the spans must occur in order,
+ * <code>false</code> otherwise.
+ */
public boolean isOrdered() {
return isOrdered;
}
+ /**
+ * Sets if the spans must occur in order or not.
+ *
+ * @param isOrdered a boolean with value <code>true</code> if the spans must
+ * occur in order, <code>false</code> otherwise.
+ */
public void setOrdered(boolean isOrdered) {
this.isOrdered = isOrdered;
}
diff --git a/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java b/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java
index d8083c6..448a85f 100644
--- a/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java
+++ b/src/main/java/de/ids_mannheim/korap/query/SpanDistanceQuery.java
@@ -25,9 +25,9 @@
* unit, the order of the spans (ordered or unordered), co-occurrence (i.e. the
* spans should co-occur or not), minimum and maximum distance. <br/>
* <br/>
- * The distance unit can be word (token), sentence or paragraph. The resulting
- * spans typically stretch from the starting position of a former span to the
- * end position of the latter span. <br/>
+ * The distance unit can be a word (token), a sentence or a paragraph. The
+ * resulting spans typically stretch from the starting position of a former span
+ * to the end position of the latter span. <br/>
* <br/>
* Query examples:
*
@@ -109,7 +109,14 @@
* of the two specified spanqueries and based-on the given distance
* constraints.
*
- * */
+ * @param firstClause a span query
+ * @param secondClause a span query
+ * @param constraint a DistanceConstraint containing all the constraints
+ * required for the distance query
+ * @param collectPayloads a boolean flag representing the value
+ * <code>true</code> if payloads are to be collected, otherwise
+ * <code>false</code>.
+ */
public SpanDistanceQuery(SpanQuery firstClause, SpanQuery secondClause,
DistanceConstraint constraint, boolean collectPayloads) {
super(firstClause, secondClause, collectPayloads);
@@ -197,43 +204,43 @@
}
/**
- * Returns the minimum distance constraint
+ * Returns the minimum distance constraint.
*
- * @return minimum distance constraint
+ * @return the minimum distance constraint
*/
public int getMinDistance() {
return minDistance;
}
/**
- * Sets the minimum distance constraint
+ * Sets the minimum distance constraint.
*
- * @param minDistance
+ * @param minDistance the minimum distance constraint
*/
public void setMinDistance(int minDistance) {
this.minDistance = minDistance;
}
/**
- * Returns the maximum distance constraint
+ * Returns the maximum distance.
*
- * @return maximum distance constraint
+ * @return the maximum distance constraint
*/
public int getMaxDistance() {
return maxDistance;
}
/**
- * Sets a maximum distance constraint
+ * Sets a maximum distance.
*
- * @param maxDistance
+ * @param maxDistance the maximum distance
*/
public void setMaxDistance(int maxDistance) {
this.maxDistance = maxDistance;
}
/**
- * Returns the element query used as the distance unit
+ * Returns the element query used as the distance unit.
*
* @return the element distance unit
*/
@@ -242,9 +249,9 @@
}
/**
- * Sets the specified element query used for the distance unit
+ * Sets the specified element query used as the distance unit.
*
- * @param elementQuery
+ * @param elementQuery the SpanElementQuery used as the distance unit
*/
public void setElementQuery(SpanElementQuery elementQuery) {
this.elementQuery = elementQuery;
@@ -252,15 +259,21 @@
/**
* Tells weather the second sub-span should co-occur or not.
- * */
+ *
+ * @return a boolean with <code>true</code> if the second sub-span should
+ * <em>not</em> co-occur, <code>false</code> otherwise.
+ */
public boolean isExclusion() {
return exclusion;
}
/**
- * Sets true if the second sub-span should <em>not</em> co-occur.
+ * Sets <code>true</code> if the second sub-span should <em>not</em>
+ * co-occur, <code>false</code> otherwise.
*
- * @param exclusion
+ * @param exclusion a boolean with value <code>true</code> if the second
+ * sub-span should <em>not</em> co-occur, <code>false</code>
+ * otherwise.
*/
public void setExclusion(boolean exclusion) {
this.exclusion = exclusion;
diff --git a/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java b/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java
index abf00a4..2127e35 100644
--- a/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java
+++ b/src/main/java/de/ids_mannheim/korap/query/spans/AttributeSpans.java
@@ -11,25 +11,24 @@
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermContext;
import org.apache.lucene.search.spans.Spans;
+import org.apache.lucene.search.spans.TermSpans;
import org.apache.lucene.util.Bits;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import de.ids_mannheim.korap.query.SpanAttributeQuery;
-import org.apache.lucene.search.spans.TermSpans;
/**
* Span enumeration of attributes which are term spans with special payload
- * assignment referring to another span (e.g. element/relation span) to which an
- * attribute span belongs.
- *
- * The class is basically a wrapper of Lucene {@link TermSpans} with additional
- * functionality regarding element/relation reference. Element/relation id is
- * annotated ascendingly starting from the left side.
- *
+ * assignments referring to another span (e.g. element/relation span) to which
+ * an attribute span belongs. The class is basically a wrapper of Lucene
+ * {@link TermSpans} with additional functionality regarding element/relation
+ * reference. Element/relation id is annotated ascendingly starting from the
+ * left side. <br/>
+ * <br/>
* The enumeration is ordered firstly by the start position of the attribute and
* secondly by the element/relation id descendingly. This order helps to match
- * element and attributes faster.
+ * element and attributes faster.
*
* @author margaretha
* */