int from = range.getFrom();
int to = range.getTo();
for (MemoryIntField currentField : knownFields) {
IntRange currentRange = currentField.getRange();
// TODO check this doesn't break things
if (currentRange.isBefore(range.getFrom())) {
continue;
}
if (currentRange.isAfter(range.getTo())) {
break;
}
if (currentRange.isAfter(from)) {
// log.info("a from " + from + " to " + currentRange.getFrom());
list.add(new IntRange(from, currentRange.getFrom()));
}
from = currentRange.getTo();
if (from >= to)
break;
}
if (from < to) {
// log.info("b from " + from + " to " + to);
list.add(new IntRange(from, to));
}
return list.toArray(new IntRange[list.size()]);
}