currentBuffer = null;
return tempBuffer;
}
//try to find partial mapping
IntArrayList permMappingFrom = null, permMappingTo = null;
outer:
for (int mapFrom = 0; mapFrom < size; ++mapFrom) {
int fromIndex = fromIndices.get(mapFrom);
IndexMappingBufferRecord bRec = currentBuffer.getMap().get(getNameWithType(fromIndex));
//no such index in mapping yet
if (bRec == null)
continue;
//index contained in mapping have same state
if (getRawStateInt(fromIndex) == bRec.getFromRawState())
return currentBuffer = null;
//toIndex that we'll find in toIndices
int toIndex = inverseIndexState(setRawState(bRec.getToRawState(), bRec.getIndexName()));
for (int mapTo = 0; mapTo < size; ++mapTo) {
if (toIndices.get(mapTo) == toIndex) {
if (permMappingFrom == null) {
permMappingFrom = new IntArrayList();
permMappingTo = new IntArrayList();
}
permMappingFrom.add(mapFrom);
permMappingTo.add(mapTo);
continue outer;
}
}
//no index found in toIndices
return currentBuffer = null;
}
if (permMappingFrom == null)
searchForPermutations = fromIndices.getSymmetries().getPermutationGroup().iterator();
else
searchForPermutations = new OutputPort.PortIterator<>(
fromIndices.getSymmetries().getPermutationGroup().mapping(
permMappingFrom.toArray(), permMappingTo.toArray()));
return take();
}