Ejemplo n.º 1
0
 /**
  * Returns close peer from the set to a given key. This method is tread-safe. You can use the
  * returned set as its a copy of the actual PeerMap and changes in the return set do not affect
  * PeerMap.
  *
  * @param id The key that should be close to the keys in the map
  * @param atLeast The number we want to find at least
  * @return A navigable set with close peers first in this set.
  */
 public SortedSet<PeerAddress> closePeers(final Number160 id, final int atLeast) {
   final SortedSet<PeerAddress> set = new TreeSet<PeerAddress>(createPeerComparator(id));
   // special treatment, as we can start iterating from 0
   if (self().equals(id)) {
     for (int j = 0; set.size() < atLeast && j < Number160.BITS; j++) {
       Map<Number160, PeerAddress> tmp = peerMap.get(j);
       synchronized (tmp) {
         set.addAll(tmp.values());
       }
     }
     return set;
   }
   final int classMember = classMember(id);
   Map<Number160, PeerAddress> tmp = peerMap.get(classMember);
   synchronized (tmp) {
     set.addAll(tmp.values());
   }
   if (set.size() >= atLeast) return set;
   // first go down, all the way...
   for (int i = classMember - 1; i >= 0; i--) {
     tmp = peerMap.get(i);
     synchronized (tmp) {
       set.addAll(tmp.values());
     }
   }
   if (set.size() >= atLeast) return set;
   // go up... these ones will be larger than our distance
   for (int i = classMember + 1; set.size() < atLeast && i < Number160.BITS; i++) {
     tmp = peerMap.get(i);
     synchronized (tmp) {
       set.addAll(tmp.values());
     }
   }
   return set;
 }
  /**
   * getServiceTypeNames
   *
   * @return a {@link java.util.Collection} object.
   */
  @Override
  public Collection<String> getServiceTypeNames(String groupName) {
    final SortedSet<String> serviceNames = new TreeSet<String>();

    m_readLock.lock();
    try {
      m_pendingForeignSourceRepository.flush();
      final ForeignSource pendingForeignSource =
          m_pendingForeignSourceRepository.getForeignSource(groupName);
      serviceNames.addAll(pendingForeignSource.getDetectorNames());

      m_deployedForeignSourceRepository.flush();
      final ForeignSource deployedForeignSource =
          m_deployedForeignSourceRepository.getForeignSource(groupName);
      serviceNames.addAll(deployedForeignSource.getDetectorNames());

      for (final OnmsServiceType type : m_serviceTypeDao.findAll()) {
        serviceNames.add(type.getName());
      }
      serviceNames.addAll(m_capsdConfig.getConfiguredProtocols());
      return serviceNames;
    } finally {
      m_readLock.unlock();
    }
  }
  public List<JavaSymbolName> getFinders(
      MemberDetails memberDetails, String plural, int depth, Set<JavaSymbolName> exclusions) {
    Assert.notNull(memberDetails, "Member details required");
    Assert.hasText(plural, "Plural required");
    Assert.notNull(
        depth, "The depth of combinations used for finder signatures combinations required");
    Assert.notNull(exclusions, "Exclusions required");

    SortedSet<JavaSymbolName> finders = new TreeSet<JavaSymbolName>();

    List<FieldMetadata> fields = memberDetails.getFields();
    for (int i = 0; i < depth; i++) {
      SortedSet<JavaSymbolName> tempFinders = new TreeSet<JavaSymbolName>();
      for (FieldMetadata field : fields) {
        // Ignoring java.util.Map field types (see ROO-194)
        if (field == null || field.getFieldType().equals(new JavaType(Map.class.getName()))) {
          continue;
        }
        if (exclusions.contains(field.getFieldName())) {
          continue;
        }
        if (i == 0) {
          tempFinders.addAll(createFinders(field, finders, "find" + plural + "By", true));
        } else {
          tempFinders.addAll(createFinders(field, finders, "And", false));
          tempFinders.addAll(createFinders(field, finders, "Or", false));
        }
      }
      finders.addAll(tempFinders);
    }

    return Collections.unmodifiableList(new ArrayList<JavaSymbolName>(finders));
  }
  /**
   * aggregates all collected neg examples CAVE: it is necessary to call one of the make functions
   * before calling this OTHERWISE it will choose random examples
   *
   * @param neglimit size of negative Example set, 0 means all, which can be quite large
   * @param stable decides whether neg Examples are randomly picked, default false, faster for
   *     developing, since the cache can be used
   * @param forceNegLimit forces that exactly neglimit instances are returned by adding more
   *     instances
   */
  public SortedSet<OWLIndividual> getNegativeExamples(
      int neglimit, boolean stable, boolean forceNegLimit) {
    SortedSet<OWLIndividual> negatives = new TreeSet<OWLIndividual>();
    negatives.addAll(fromParallelClasses);
    negatives.addAll(fromRelated);
    negatives.addAll(fromSuperclasses);
    if (negatives.size() < neglimit) {
      makeNegativeExamplesFromAllOtherInstances();

      negatives.addAll(SetManipulation.stableShrinkInd(fromAllOther, neglimit - negatives.size()));
    }

    if (neglimit <= 0) {
      logger.debug("neg Example size NO shrinking: " + negatives.size());
      return negatives;
    }

    logger.debug("neg Example size before shrinking: " + negatives.size());
    if (stable) {
      negatives = SetManipulation.stableShrinkInd(negatives, neglimit);
    } else {
      negatives = SetManipulation.fuzzyShrinkInd(negatives, neglimit);
    }
    logger.debug("neg Example size after shrinking: " + negatives.size());
    return negatives;
  }
 /**
  * Returns the number of option values amongst all internal option containers.
  *
  * @return the number of option values amongst all internal option containers
  */
 public int getNumberOfOptionValues() {
   SortedSet<Option> union = new TreeSet<Option>(savedOptionMap.keySet());
   union.addAll(dependenciesResolvedOptionMap.keySet());
   union.addAll(commandLineOptionMap.keySet());
   union.addAll(optionFileOptionMap.keySet());
   return union.size();
 }
 /* (non-Javadoc)
  * @see java.lang.Object#toString()
  */
 public String toString() {
   final StringBuilder sb = new StringBuilder();
   SortedSet<Option> union = new TreeSet<Option>(savedOptionMap.keySet());
   union.addAll(dependenciesResolvedOptionMap.keySet());
   union.addAll(commandLineOptionMap.keySet());
   union.addAll(optionFileOptionMap.keySet());
   for (Option option : union) {
     Object value = null;
     for (int i = OptionContainer.SAVEDOPTION; i <= OptionContainer.OPTIONFILE; i++) {
       if (i == OptionContainer.SAVEDOPTION) {
         value = savedOptionMap.get(option);
       } else if (i == OptionContainer.DEPENDENCIES_RESOLVED) {
         value = dependenciesResolvedOptionMap.get(option);
       } else if (i == OptionContainer.COMMANDLINE) {
         value = commandLineOptionMap.get(option);
       } else if (i == OptionContainer.OPTIONFILE) {
         value = optionFileOptionMap.get(option);
       }
       if (value != null) {
         break;
       }
     }
     sb.append(option.getGroup().getName() + "\t" + option.getName() + "\t" + value + "\n");
   }
   return sb.toString();
 }
Ejemplo n.º 7
0
  /**
   * Handle responses from CCNNameEnumerator that give us a list of single-component child names.
   * Filter out the names new to us, add them to our list of known children, postprocess them with
   * processNewChildren(SortedSet<ContentName>), and signal waiters if we have new data.
   *
   * @param prefix Prefix used for name enumeration.
   * @param names The list of names returned in this name enumeration response.
   * @return int
   */
  public int handleNameEnumerator(ContentName prefix, ArrayList<ContentName> names) {

    if (Log.isLoggable(Level.INFO)) {
      if (!_enumerating) {
        // Right now, just log if we get data out of enumeration, don't drop it on the floor;
        // don't want to miss results in case we are started again.
        Log.info(
            "ENUMERATION STOPPED: but {0} new name enumeration results: our prefix: {1} returned prefix: {2}",
            names.size(), _namePrefix, prefix);
      } else {
        Log.info(
            names.size() + " new name enumeration results: our prefix: {0} returned prefix: {1}",
            _namePrefix,
            prefix);
      }
    }
    if (!prefix.equals(_namePrefix)) {
      Log.warning("Returned data doesn't match requested prefix!");
    }
    Log.info("Handling Name Iteration {0}", prefix);
    // the name enumerator hands off names to us, we own it now
    // DKS -- want to keep listed as new children we previously had
    synchronized (_childLock) {
      TreeSet<ContentName> thisRoundNew = new TreeSet<ContentName>();
      thisRoundNew.addAll(names);
      Iterator<ContentName> it = thisRoundNew.iterator();
      while (it.hasNext()) {
        ContentName name = it.next();
        if (_children.contains(name)) {
          it.remove();
        }
      }
      if (!thisRoundNew.isEmpty()) {
        if (null != _newChildren) {
          _newChildren.addAll(thisRoundNew);
        } else {
          _newChildren = thisRoundNew;
        }
        _children.addAll(thisRoundNew);
        _lastUpdate = new CCNTime();
        if (Log.isLoggable(Level.INFO)) {
          Log.info(
              "New children found: at {0} "
                  + thisRoundNew.size()
                  + " total children "
                  + _children.size(),
              _lastUpdate);
        }
        processNewChildren(thisRoundNew);
        _childLock.notifyAll();
      }
    }
    return 0;
  }
Ejemplo n.º 8
0
 public Set<String> rolesThatCanOperateOnStage(
     CruiseConfig cruiseConfig, PipelineConfig pipelineConfig) {
   PipelineConfigs group = cruiseConfig.findGroupOfPipeline(pipelineConfig);
   SortedSet<String> roles = new TreeSet<String>();
   if (group.hasAuthorizationDefined()) {
     if (group.hasOperationPermissionDefined()) {
       roles.addAll(group.getOperateRoleNames());
     }
   } else {
     roles.addAll(allRoleNames(cruiseConfig));
   }
   return roles;
 }
 static {
   final SortedSet<String> ecmds = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
   ecmds.addAll(Arrays.asList("exit", "done", "quit", "end", "fino"));
   EXIT_COMMANDS = Collections.unmodifiableSortedSet(ecmds);
   final SortedSet<String> hcmds = new TreeSet<String>(String.CASE_INSENSITIVE_ORDER);
   hcmds.addAll(Arrays.asList("help", "helpi", "?"));
   HELP_COMMANDS = Collections.unmodifiableSet(hcmds);
   DATE_PATTERN =
       Pattern.compile("\\d{4}([-\\/])\\d{2}\\1\\d{2}"); // http://regex101.com/r/xB8dR3/1
   HELP_MESSAGE =
       format(
           "Please enter some data or enter one of the following commands to exit %s",
           EXIT_COMMANDS);
 }
Ejemplo n.º 10
0
 @Override
 public List<Invocation> getMatches() {
   SortedSet<Invocation> set = new TreeSet<Invocation>(Invocation.COMPARATOR);
   set.addAll(keep.getMatches());
   set.removeAll(remove.getMatches());
   return new ArrayList<Invocation>(set);
 }
Ejemplo n.º 11
0
 /**
  * @return Returns the {@link MonthlyWage}s from this class sorted by the person ids. The person
  *     ids are assumed to be numbers. If there are ids that are not numbers, those are sorted to
  *     the end of the collection.
  */
 public SortedSet<MonthlyWage> getSortedWages() {
   SortedSet<MonthlyWage> sortedWages =
       new TreeSet<>(
           (wage1, wage2) -> {
             Integer id1 = null, id2 = null;
             try {
               id1 = Integer.parseInt(wage1.getPerson().getId());
             } catch (NumberFormatException e) {
             }
             try {
               id2 = Integer.parseInt(wage2.getPerson().getId());
             } catch (NumberFormatException e) {
             }
             if (id1 != null && id2 != null) {
               return id1.compareTo(id2);
             } else if (id1 != null && id2 == null) {
               return -1;
             } else if (id1 == null && id2 != null) {
               return 1;
             } else {
               return wage1.getPerson().getId().compareTo(wage2.getPerson().getId());
             }
           });
   sortedWages.addAll(this.getWages());
   return sortedWages;
 }
  public String printSummary() {
    SortedSet<String> knownFiles = new TreeSet<String>();
    // now sort the list of lists of lines to ensure that
    // printing is always deterministic.
    for (Map<String, List<List<Integer>>> perFile : sortedReport.values()) {
      for (List<List<Integer>> lines : perFile.values()) {
        sortListOfInts(lines);
        knownFiles.addAll(perFile.keySet());
      }
    }
    StringBuilder sb = new StringBuilder();
    for (String fname : knownFiles) {
      // TODO: don't hard code the keys.
      sb.append("In File: " + fname + "\n");
      cirtical += printReportForFileBySeverity(sb, fname, 0, "** Critical **");
      unreachable += printReportForFileBySeverity(sb, fname, 1, " - Unreachable -");
    }

    sb.append("Summary: fwd=");
    sb.append(cirtical);
    sb.append("\tbwd=");
    sb.append(unreachable);
    sb.append("\n");

    return sb.toString();
  }
 /**
  * misleading method name, examples are all instances from the a-Part of the atomicRole(a,b) it
  * has nothing to do with the actual Domain class
  *
  * @param atomicRole
  */
 public void makeNegativeExamplesFromDomain(OWLObjectProperty atomicRole) {
   fromDomain.clear();
   logger.debug("making Negative Examples from Domain of : " + atomicRole);
   fromDomain.addAll(reasoningService.getPropertyMembers(atomicRole).keySet());
   fromDomain.removeAll(fullPositiveSet);
   logger.debug("|-neg Example size from Domain: " + this.fromDomain.size());
 }
 /**
  * just takes all other instances from the ontology, except the ones in the fullPositiveSet (see
  * Constructor)
  */
 public void makeNegativeExamplesFromAllOtherInstances() {
   logger.debug("making random examples ");
   fromAllOther.clear();
   fromAllOther.addAll(reasoningService.getIndividuals());
   fromAllOther.removeAll(fullPositiveSet);
   logger.debug("|-negExample size from random: " + fromAllOther.size());
 }
  public ActionForward search(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    final AcademicServiceRequestBean bean = getOrCreateAcademicServiceRequestBean(request);
    request.setAttribute("bean", bean);

    final Collection<AcademicServiceRequest> remainingRequests =
        bean.searchAcademicServiceRequests();
    final Collection<AcademicServiceRequest> specificRequests =
        getAndRemoveSpecificRequests(bean, remainingRequests);

    final SortedSet<AcademicServiceRequest> sorted =
        new TreeSet<AcademicServiceRequest>(getComparator(request));
    sorted.addAll(remainingRequests);
    request.setAttribute("remainingRequests", remainingRequests);
    request.setAttribute("specificRequests", specificRequests);

    final CollectionPager<AcademicServiceRequest> pager =
        new CollectionPager<AcademicServiceRequest>(sorted, REQUESTS_PER_PAGE);
    request.setAttribute("collectionPager", pager);
    request.setAttribute("numberOfPages", Integer.valueOf(pager.getNumberOfPages()));

    final String pageParameter = request.getParameter("pageNumber");
    final Integer page =
        StringUtils.isEmpty(pageParameter) ? Integer.valueOf(1) : Integer.valueOf(pageParameter);
    request.setAttribute("pageNumber", page);
    request.setAttribute("resultPage", pager.getPage(page));

    return mapping.findForward("searchResults");
  }
  private SortedSet<Program> getProgramsAvailableOnServers() {
    SortedSet<Program> availableOnServer = new TreeSet<Program>();

    availableOnServer.addAll(getInstallationData());

    return availableOnServer;
  }
  @Test
  public void testCompareByName() throws Exception {

    final Category cat1 = context.mock(Category.class, "cat1");
    final Category cat2 = context.mock(Category.class, "cat2");

    context.checking(
        new Expectations() {
          {
            allowing(cat1).getRank();
            will(returnValue(0));
            allowing(cat1).getName();
            will(returnValue("name 2"));
            allowing(cat1).getCategoryId();
            will(returnValue(1L));
            allowing(cat2).getRank();
            will(returnValue(0));
            allowing(cat2).getName();
            will(returnValue("name 1"));
          }
        });

    final SortedSet<Category> set = new TreeSet<Category>(new CategoryRankNameComparator());
    set.addAll(Arrays.asList(cat1, cat2));

    final List<Category> list = new ArrayList<Category>(set);
    assertTrue(cat2 == list.get(0));
    assertTrue(cat1 == list.get(1));
  }
Ejemplo n.º 18
0
 /**
  * Since the segmentations are disjoint, the total set of differentially expressed segments is the
  * union of the sets of differentially expressed segments in each segmentation.
  *
  * @param c1
  * @param c2
  * @return
  */
 public SortedSet<DifferentialKey> differentialRegions(int c1, int c2) {
   SortedSet<DifferentialKey> keys = new TreeSet<DifferentialKey>();
   for (InputSegmentation iseg : segmentations) {
     keys.addAll(differentialRegions(iseg, c1, c2));
   }
   return keys;
 }
Ejemplo n.º 19
0
    /**
     * create a file chooser populated with file filters for the given pathway importers / exporters
     */
    private void createFileFilters(Set<? extends PathwayIO> set) {
      jfc.setAcceptAllFileFilterUsed(false);

      SortedSet<PathwayIO> exporters =
          new TreeSet<PathwayIO>(
              new Comparator<PathwayIO>() {
                public int compare(PathwayIO o1, PathwayIO o2) {
                  return o1.getName().compareTo(o2.getName());
                }
              });
      exporters.addAll(set);

      PathwayFileFilter selectedFilter = null;
      for (PathwayIO exp : exporters) {
        PathwayFileFilter ff = new PathwayFileFilter(exp);
        jfc.addChoosableFileFilter(ff);
        if (exp instanceof GpmlFormat) {
          selectedFilter = ff;
        }
      }
      if (selectedFilter != null) {
        jfc.setFileFilter(selectedFilter);
        fileDialog.setFilenameFilter(selectedFilter);
      }
    }
Ejemplo n.º 20
0
 public SortedSet<User> users() throws IOException {
   SortedSet<User> users = new ConcurrentSkipListSet<User>();
   for (Room room : rooms()) {
     users.addAll(room.users());
   }
   return users;
 }
 public SortedSet<Locomotive> getAllLocomotives() {
   final SortedSet<Locomotive> allLocomotives = Sets.newTreeSet();
   for (final LocomotiveGroup locomotiveGroup : updatedLocomotiveGroups) {
     allLocomotives.addAll(locomotiveGroup.getLocomotives());
   }
   return allLocomotives;
 }
Ejemplo n.º 22
0
 public SortedSet<DegreeTeachingService> getDegreeTeachingServicesOrderedByShift() {
   final SortedSet<DegreeTeachingService> degreeTeachingServices =
       new TreeSet<DegreeTeachingService>(
           DegreeTeachingService.DEGREE_TEACHING_SERVICE_COMPARATOR_BY_SHIFT);
   degreeTeachingServices.addAll(getDegreeTeachingServicesSet());
   return degreeTeachingServices;
 }
  @Override
  public void handle(Page page, TemplateContext local, TemplateContext global) {
    Homepage homepage = homepage(page.getSite());
    if (homepage == null || !homepage.isHomepageActivated()) {
      return; // TODO we might want 404 here
    }

    global.put("homepage", homepage);
    Person owner = homepage.getPerson();
    global.put("owner", owner);

    if (homepage.getShowCurrentAttendingExecutionCourses()) {
      SortedSet<Attends> attendedCoursesByName =
          new TreeSet<Attends>(Attends.ATTENDS_COMPARATOR_BY_EXECUTION_COURSE_NAME);
      attendedCoursesByName.addAll(homepage.getPerson().getCurrentAttends());
      global.put("attendingCourses", attendedCoursesByName);
    }

    List<? extends PartyContact> emails = owner.getEmailAddresses();
    global.put("visibleEmails", getSortedFilteredContacts(emails));

    List<? extends PartyContact> phones = owner.getPhones();
    global.put(
        "visiblePersonalPhones", getSortedFilteredContacts(phones, PartyContactType.PERSONAL));
    global.put("visibleWorkPhones", getSortedFilteredContacts(phones, PartyContactType.WORK));

    List<? extends PartyContact> mobilePhones = owner.getMobilePhones();
    global.put("visibleMobilePhones", getSortedFilteredContacts(mobilePhones));

    List<? extends PartyContact> websites = owner.getWebAddresses();
    global.put("visibleWebsites", getSortedFilteredContacts(websites));
  }
Ejemplo n.º 24
0
 @Override
 public void addAllToDownloadChapter(final Collection<Chapter> chapters) {
   LOG.trace("Add chapters to download [Chapters=" + chapters + "]");
   toDownloadChapters.addAll(chapters);
   changes.firePropertyChange(
       ModelProperties.CHAPTER_TO_DOWNLOAD.getPropertyName(), null, toDownloadChapters);
 }
 public void sortReadTriples() {
   final SortedSet<Triple> sst =
       new TreeSet<Triple>(new TripleComparator(RDF3XIndexScan.CollationOrder.SPO));
   sst.addAll(readTriples);
   readTriples.clear();
   readTriples.addAll(sst);
 }
Ejemplo n.º 26
0
 /**
  * Constructor
  *
  * @param compiledResults is a Map from questions to Pair of predicted response and response
  *     probabilities
  * @param responseCategories is a sorted set of holding response categories
  */
 public Results(
     Map<TypeQ, Pair<TypeR, Map<TypeR, Double>>> compiledResults, Set<TypeR> responseCategories) {
   this.compiledResults = compiledResults;
   this.responseCategories = responseCategories;
   sortedQuestions = new TreeSet<TypeQ>();
   sortedQuestions.addAll(compiledResults.keySet());
 }
 @SuppressWarnings("EmptyCatchBlock")
 static void ensureNotDirectlyModifiable(SortedSet<Integer> unmod) {
   try {
     unmod.add(4);
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     unmod.remove(4);
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     unmod.addAll(Collections.singleton(4));
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
   try {
     Iterator<Integer> iterator = unmod.iterator();
     iterator.next();
     iterator.remove();
     fail("UnsupportedOperationException expected");
   } catch (UnsupportedOperationException expected) {
   }
 }
 public void execute() {
   if (isCommunicatorRunning()) {
     if (getRelayCommunicator().isLoggedIn()) {
       final SortedSet<PeerIdentifier> availablePeers =
           new TreeSet<PeerIdentifier>(PEER_IDENTIFIER_COMPARATOR);
       try {
         availablePeers.addAll(getRelayCommunicator().getMyAvailablePeers());
       } catch (PeerException e) {
         LOG.error("PeerException while trying to get the set of available peers", e);
       }
       if (availablePeers.isEmpty()) {
         println("   No available peers.");
       } else {
         for (final PeerIdentifier peerIdentifier : availablePeers) {
           println(
               "   ["
                   + peerIdentifier.userId
                   + "|"
                   + peerIdentifier.firstName
                   + "|"
                   + peerIdentifier.lastName
                   + "]");
         }
       }
     } else {
       println("You must log in to the relay before you can list available peers.");
     }
   } else {
     println("Relay communicator is not running, so you can't log out.");
   }
 }
Ejemplo n.º 29
0
  public String toString() {
    StringBuilder buffer = new StringBuilder();

    buffer.append("Hosts:     ").append(this.getHosts().size()).append("\n");
    buffer.append("Sites:     ").append(this.sites.size()).append("\n");
    buffer.append("Fragments: ").append(this.fragments.size()).append("\n");

    SortedSet<String> hosts = new TreeSet<String>();
    hosts.addAll(this.getHosts());

    for (String host_key : hosts) {
      buffer.append("\nHost ").append(CatalogKey.getNameFromKey(host_key)).append("\n");
      for (SiteEntry site : this.host_site_xref.get(host_key)) {
        buffer.append(SPACER).append("Site ").append(site.getId()).append("\n");
        for (FragmentEntry fragment : site.getFragments()) {
          buffer
              .append(SPACER)
              .append(SPACER)
              .append("Fragment ")
              .append(fragment)
              .append(" Size=")
              .append(fragment.getEstimatedSize())
              .append(" Heat=")
              .append(fragment.getEstimatedHeat())
              .append("\n");
        } // FOR
      } // FOR
      buffer.append("--------------------");
    } // FOR
    return (buffer.toString());
  }
Ejemplo n.º 30
0
 /** Returns client-object-relative reference paths that should be further resolved. */
 public SortedSet<String> takeWork() {
   needsSimpleValues = false;
   SortedSet<String> toReturn = toResolve;
   resolved.addAll(toReturn);
   toResolve = EMPTY;
   return toReturn;
 }