package com.kmwllc.search.solr.client;

public class RangeTerm extends Term {

	private String lowerTerm;
	private String upperTerm;
	// TODO: add more types , such as date/int/float/long/double
	public RangeTerm(String field, String lowerTerm, String upperTerm) {
		// super(field, term);
		// TODO Auto-generated constructor stub
		// TODO: propigate a boost here?
		// TODO: override the getTerm method.
		super(field, null, -1);
		this.lowerTerm = lowerTerm;
		this.upperTerm = upperTerm;
	}
	
	public RangeTerm(String field, String lowerTerm, String upperTerm, float boost) {
		// super(field, term);
		// TODO Auto-generated constructor stub
		// TODO: propigate a boost here?
		super(field, null, boost);
		this.lowerTerm = lowerTerm;
		this.upperTerm = upperTerm;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		String val = getField() + Term.SEP + "RANGE(" + lowerTerm + " TO " + upperTerm + ")";
		return val;
	}

}

@@ -131,16 +131,175 @@
 erTerm;%0D
+%0A%0D%0A  // set default inclusivity%0D%0A  private boolean lowerInclusive = true;%0D%0A  private boolean upperInclusive = true;%0D%0A%0D%0A  // TODO: override the getTerm method.%0D
 %0A%09// TOD
@@ -354,17 +354,20 @@
 double%0D%0A
-%09
+%0D%0A  
 public R
@@ -423,25 +423,37 @@
 pperTerm
+, float boost
 ) %7B%0D%0A
-%09%09//
+   
  super(f
@@ -462,233 +462,370 @@
 ld, 
-term);%0D%0A%09%09// TODO Auto-generated constructor stub%0D%0A%09%09// TODO: propigate a boost here?%0D%0A%09%09// TODO: override the getTerm method.%0D%0A%09%09super(field, null, -1);%0D%0A%09%09this.lowerTerm = lowerTerm;%0D%0A%09%09this.upperTerm = upperTerm
+null, boost);%0D%0A    this.lowerTerm = lowerTerm;%0D%0A    this.upperTerm = upperTerm;%0D%0A  %7D%0D%0A%0D%0A  public RangeTerm(String field, String lowerTerm, String upperTerm, boolean lowerInclusive, boolean upperInclusive, float boost) %7B%0D%0A    this(field, lowerTerm, upperTerm, boost);%0D%0A    this.lowerInclusive = lowerInclusive;%0D%0A    this.upperInclusive = upperInclusive
 ;%0D%0A%09%7D%0D%0A
-%09
 %0D%0A
-%09
+  
 publ
@@ -889,224 +889,312 @@
 Term
-, float boost) %7B%0D%0A%09%09// super(field, term);%0D%0A%09%09// TODO Auto-generated constructor stub%0D%0A%09%09// TODO: propigate a boost here?%0D%0A%09%09super(field, null, boost);%0D%0A%09%09this.lowerTerm = lowerTerm;%0D%0A%09%09this.upperTerm = upperTerm;%0D%0A%09
+) %7B%0D%0A    this(field, lowerTerm, upperTerm, -1);%0D%0A  %7D%0D%0A%0D%0A  public RangeTerm(String field, String lowerTerm, String upperTerm, boolean lowerInclusive, boolean upperInclusive) %7B%0D%0A    this(field, lowerTerm, upperTerm);%0D%0A    this.lowerInclusive = lowerInclusive;%0D%0A    this.upperInclusive = upperInclusive;%0D%0A  
 %7D%0D%0A%0D
@@ -1239,46 +1239,8 @@
  %7B%0D%0A
-%09%09// TODO Auto-generated method stub%0D%0A
 %09%09St
@@ -1289,66 +1289,825 @@
 %22 + 
-lowerTerm + %22 TO %22 + upperTerm + %22)%22;%0D%0A%09%09return val;%0D%0A%09%7D%0D%0A
+(lowerInclusive?%22%3E=%22:%22%3E%22) + lowerTerm + %22,%22 + (upperInclusive?%22%3C=%22:%22%3C%22) + upperTerm + %22,%22 + getBoost() + %22)%22;%0D%0A%09%09return val;%0D%0A%09%7D%0D%0A%0D%0A  @Override%0D%0A  public boolean equals(Object obj) %7B%0D%0A    if (!super.equals(obj)) %7B%0D%0A      return false;%0D%0A    %7D%0D%0A    %0D%0A    RangeTerm other = (RangeTerm)obj;%0D%0A%0D%0A    if (lowerInclusive != other.lowerInclusive) %7B%0D%0A      return false;%0D%0A    %7D%0D%0A    if (upperInclusive != other.upperInclusive) %7B%0D%0A      return false;%0D%0A    %7D%0D%0A%0D%0A    if (lowerTerm == null) %7B%0D%0A      if (other.lowerTerm != null)%0D%0A        return false;%0D%0A    %7D else if (!lowerTerm.equals(other.lowerTerm)) %7B%0D%0A      return false;%0D%0A    %7D%0D%0A%0D%0A    if (upperTerm == null) %7B%0D%0A      if (other.upperTerm != null)%0D%0A        return false;%0D%0A    %7D else if (!upperTerm.equals(other.upperTerm)) %7B%0D%0A      return false;%0D%0A    %7D%0D%0A%0D%0A    return true;%0D%0A  %7D
 %0D%0A%7D%0D

Add constructors for inclusivity. Add equals method. Update toString.