public final static Bindings readLuposBindings(final Bindings previousBindings, final InputStream in) throws IOException, ClassNotFoundException {
if (Bindings.instanceClass == BindingsMap.class) {
return InputHelper.readLuposBindingsMap(in);
} else {
final BindingsFactory bindingsFactory = (previousBindings==null) ? readLuposBindingsFactory(in) : ((BindingsArray) previousBindings).getBindingsFactory();
final Map<Variable, Integer> hm = bindingsFactory.getPosVariables();
BigInteger usedVars = InputHelper.readLuposBigInteger(hm.size(), in);
if (usedVars == null) {
return null;
}
BigInteger differentFromPreviousBindings = InputHelper.readLuposBigInteger(hm.size(), in);
final Bindings b = bindingsFactory.createInstance();
final BigInteger TWO = BigInteger.valueOf(2);
for (final Variable v : hm.keySet()) {
if (usedVars.mod(TWO).compareTo(BigInteger.ONE)==0) {
if (previousBindings == null || differentFromPreviousBindings.mod(TWO).compareTo(BigInteger.ONE)==0) {
Literal lit;