@Override
public void appendForWrite(Document document) {
// get the analyzed time period intervals
boolean bWasInvalid = false;
TpIntervals intervals = null;
Object value = null;
if ((getValues() != null) && (getValues().length == 1)) {
value = getValues()[0];
if (value instanceof TpIntervals) {
intervals = (TpIntervals)value;
}
}
if (intervals == null) {
intervals = new TpIntervals();
bWasInvalid = true;
}
if (intervals.size() > 1) intervals.sort();
long nNow = System.currentTimeMillis();
long nLower = Long.MAX_VALUE;
long nUpper = Long.MIN_VALUE;
int nInterval = 0;
boolean bHasUnknown = false;
boolean bHasNow = false;
boolean bHasLowerNow = false;
boolean bHasUpperNow = false;
boolean bHasDeterminate = false;
boolean bLastWasUpperNow = false;
TpInterval firstInterval = null;
List<String> lIMetaTerms = new ArrayList<String>();
List<String> lSMetaTerms = new ArrayList<String>();
ArrayList<Fieldable> lFields = new ArrayList<Fieldable>();
int nIntervals = intervals.size();
int nLastInterval = (nIntervals - 1);
for (int i=0;i<nIntervals;i++) {
boolean bLastInterval = (i == nLastInterval);
TpInterval interval = intervals.get(i);
String sCurInd = Val.chkStr(interval.getIndeterminate());
if (sCurInd.equals("unknown")) {
bHasUnknown = true;
} else {