use of org.apache.jena.atlas.AtlasException in project jena by apache.
the class Timer method endTimer.
/** Return time in millisecods */
public long endTimer() {
if (!inTimer)
throw new AtlasException("Not in timer");
timeFinish = System.currentTimeMillis();
inTimer = false;
return getTimeInterval();
}
use of org.apache.jena.atlas.AtlasException in project jena by apache.
the class TupleMap method compileMapping.
/** Compile a mapping */
private static <T> int[] compileMapping(List<T> domain, List<T> range) {
if (domain.size() != range.size())
throw new AtlasException("Bad mapping: lengths not the same: " + domain + " -> " + range);
int[] cols = new int[domain.size()];
boolean[] mapped = new boolean[domain.size()];
for (int i = 0; i < domain.size(); i++) {
T input = domain.get(i);
int j = range.indexOf(input);
if (j < 0)
throw new AtlasException("Bad mapping: missing mapping: " + domain + " -> " + range);
if (mapped[j])
throw new AtlasException("Bad mapping: duplicate: " + domain + " -> " + range);
cols[i] = j;
mapped[j] = true;
}
return cols;
}
use of org.apache.jena.atlas.AtlasException in project jena by apache.
the class Hex method formatUnsignedLongHex.
// No checking, fixed width.
public static int formatUnsignedLongHex(final byte[] b, final int start, final long value, final int width) {
// Insert from low value end to high value end.
int idx = start + width - 1;
int w = width;
long x = value;
while (w > 0) {
int d = (int) (x & 0xF);
// Unsigned shift.
x = x >>> 4;
byte ch = Bytes.hexDigitsUC[d];
b[idx] = ch;
w--;
idx--;
if (x == 0)
break;
}
if (x != 0)
throw new AtlasException("formatUnsignedLongHex: overflow");
while (w > 0) {
b[idx] = '0';
idx--;
w--;
}
return width;
}
use of org.apache.jena.atlas.AtlasException in project jena by apache.
the class Timer method startTimer.
public void startTimer() {
if (inTimer)
throw new AtlasException("Already in timer");
timeStart = System.currentTimeMillis();
timeFinish = -1;
inTimer = true;
}
use of org.apache.jena.atlas.AtlasException in project jena by apache.
the class ColumnMap method compileMapping.
/** Compile a mapping */
static <T> int[] compileMapping(List<T> domain, List<T> range) {
if (domain.size() != range.size())
throw new AtlasException("Bad mapping: lengths not the same: " + domain + " -> " + range);
int[] cols = new int[domain.size()];
boolean[] mapped = new boolean[domain.size()];
for (int i = 0; i < domain.size(); i++) {
T input = domain.get(i);
int j = range.indexOf(input);
if (j < 0)
throw new AtlasException("Bad mapping: missing mapping: " + domain + " -> " + range);
if (mapped[j])
throw new AtlasException("Bad mapping: duplicate: " + domain + " -> " + range);
cols[i] = j;
mapped[j] = true;
}
return cols;
}
Aggregations