Map<TypedSymbol<?>, Long2ObjectMap<?>> newChannels = new Reference2ObjectArrayMap<TypedSymbol<?>, Long2ObjectMap<?>>();
// We recursively generate immutable versions of all channels. If freeze
// is true, these versions will be made without copying.
if (channelVectors != null) {
for (Map.Entry<Symbol, MutableSparseVector> entry : channelVectors.entrySet()) {
Symbol key = entry.getKey();
ImmutableSparseVector chan = entry.getValue().immutable(freeze, newDomain);
newChannelVectors.put(key, chan);
newChannels.put(key.withType(Double.class), new SparseVectorMap(chan));
}
}
if (channels != null) {
for (Entry<TypedSymbol<?>, Long2ObjectMap<?>> entry : channels.entrySet()) {
TypedSymbol<?> key = entry.getKey();
if (!key.getType().equals(Double.class)) {
Long2ObjectMap<?> chan = entry.getValue();
assert chan instanceof MutableTypedSideChannel;
newChannels.put(key, ((MutableTypedSideChannel<?>) chan).immutable(newDomain, freeze));
} else {
assert newChannels.containsKey(key);