boolean openFloor = false;
boolean openCeiling = false;
if (expr instanceof Not)
{
Not n = (Not) expr;
SimpleTerm t = (SimpleTerm) n.getEx();
if (t.getOp() == Ops.EQ)
{
throw new NumberFormatException(
"Unexpected point version in negated expression " + expr);
}
if (!isMax(t.getOp()))
{
max = toVersion(t);
openCeiling = !openFloor(t);
}
else if (!isMin(t.getOp()))
{
min = toVersion(t);
openFloor = !openCeiling(t);
}
else
{
throw new IllegalStateException("Unexpected operator " + t.getOp());
}
}
else
{
SimpleTerm t = (SimpleTerm) expr;
if (t.getOp().equals(Ops.EQ))
{
max = toVersion(t);
min = max;
openFloor = false;
openCeiling = false;
}
else if (isMax(t.getOp()))
{
max = toVersion(t);
openCeiling = openCeiling(t);
}
else if (isMin(t.getOp()))
{
min = toVersion(t);
openFloor = openFloor(t);
}
else
{
throw new IllegalStateException("Unexpected operator " + t.getOp());
}
}
return new VersionRange(openFloor, min, max, openCeiling);
}