コード例 #1
0
 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;
 }
コード例 #2
0
 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);
     }
   }
 }
コード例 #3
0
 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);
     }
   }
 }
コード例 #4
0
 public void save(Preferences prefs) {
   for (InferenceType type : InferenceType.values()) {
     prefs.putBoolean(getRequiredInferenceName(type), required.contains(type));
     prefs.putBoolean(getDisallowedInferenceName(type), disallowed.contains(type));
   }
 }