use of org.batfish.z3.state.StateParameter.Type in project batfish by batfish.
the class Batfish method deserializeObjects.
/**
* Deserialize a bunch of objects
*
* @param namesByPath Mapping of object paths to their names
* @param outputClass the class type for {@link S}
* @param <S> desired type of objects
* @return a map of objects keyed by their name (from {@code namesByPath})
*/
public <S extends Serializable> SortedMap<String, S> deserializeObjects(Map<Path, String> namesByPath, Class<S> outputClass) {
String outputClassName = outputClass.getName();
BatfishLogger logger = getLogger();
AtomicInteger readCompleted = newBatch("Reading, unpacking, and deserializing files containing '" + outputClassName + "' instances", namesByPath.size());
return namesByPath.entrySet().parallelStream().map(e -> {
logger.debugf("Reading and unzipping: %s '%s' from %s%n", outputClassName, e.getValue(), e.getKey());
S object = deserializeObject(e.getKey(), outputClass);
logger.debug(" ...OK\n");
readCompleted.incrementAndGet();
return new SimpleImmutableEntry<>(e.getValue(), object);
}).collect(ImmutableSortedMap.toImmutableSortedMap(String::compareTo, Entry::getKey, Entry::getValue));
}
Aggregations