All Downloads are FREE. Search and download functionalities are using the official Maven repository.

eu.mais_h.mathsync.DeserializedDifference Maven / Gradle / Ivy

The newest version!
package eu.mais_h.mathsync;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import eu.mais_h.mathsync.serialize.Deserializer;

class DeserializedDifference implements Difference {

  private final Set added;
  private final Set removed;

  DeserializedDifference(Difference serialized, Deserializer deserializer) {
    added = deserialize(serialized.added(), deserializer);
    removed = deserialize(serialized.removed(), deserializer);
  }

  @Override
  public Set added() {
    return added;
  }

  @Override
  public Set removed() {
    return removed;
  }

  private Set deserialize(Set serialized, Deserializer deserializer) {
    Set deserialized = new HashSet(serialized.size());
    for (byte[] content : serialized) {
      deserialized.add(deserializer.deserialize(content));
    }
    return Collections.unmodifiableSet(deserialized);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy