public Set<InferenceType> getPrecomputedInferences() {
   Set<InferenceType> precompute = EnumSet.noneOf(InferenceType.class);
   for (InferenceType type : InferenceType.values()) {
     Set<String> requestors = requested.get(type);
     if (required.contains(type) || (requestors != null && !requestors.isEmpty())) {
       precompute.add(type);
     }
   }
   precompute.removeAll(disallowed);
   return precompute;
 }
 public void load(Preferences prefs) {
   required.clear();
   disallowed.clear();
   for (InferenceType type : InferenceType.values()) {
     if (prefs.getBoolean(getRequiredInferenceName(type), false)) {
       required.add(type);
     }
     if (prefs.getBoolean(getDisallowedInferenceName(type), false)) {
       disallowed.add(type);
     }
   }
 }
 public void requestPrecomputedInferences(String requestor, Set<InferenceType> types) {
   for (InferenceType type : InferenceType.values()) {
     Set<String> requestors = requested.get(type);
     if (types.contains(type)) {
       if (requestors == null) {
         requestors = new TreeSet<>();
         requested.put(type, requestors);
       }
       requestors.add(requestor);
     } else if (requestors != null) {
       requestors.remove(requestor);
     }
   }
 }
 public void save(Preferences prefs) {
   for (InferenceType type : InferenceType.values()) {
     prefs.putBoolean(getRequiredInferenceName(type), required.contains(type));
     prefs.putBoolean(getDisallowedInferenceName(type), disallowed.contains(type));
   }
 }