java.util.SortedSet#addAll ( )源码实例Demo

下面列出了java.util.SortedSet#addAll ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: lams   文件: AuthoringController.java
/**
    * Remove resource item from HttpSession list and update page display. As
    * authoring rule, all persist only happen when user submit whole page. So
    * this remove is just impact HttpSession values.
    */
   @RequestMapping(path = "/removeItem", method = RequestMethod.POST)
   private String removeItem(@ModelAttribute ResourceItemForm resourceItemForm, HttpServletRequest request) {
SessionMap<String, Object> sessionMap = getSessionMap(request);

@SuppressWarnings("deprecation")
int itemIdx = NumberUtils.stringToInt(request.getParameter(ResourceConstants.PARAM_ITEM_INDEX), -1);
if (itemIdx != -1) {
    SortedSet<ResourceItem> resourceList = getResourceItemList(sessionMap);
    List<ResourceItem> rList = new ArrayList<>(resourceList);
    ResourceItem item = rList.remove(itemIdx);
    resourceList.clear();
    resourceList.addAll(rList);
    // add to delList
    List<ResourceItem> delList = getDeletedResourceItemList(sessionMap);
    delList.add(item);
}

return "pages/authoring/parts/itemlist";
   }
 
源代码2 项目: esigate   文件: IndexedInstances.java
private Map<UriMapping, String> buildUriMappings() {
    Map<UriMapping, String> result = new LinkedHashMap<>();

    Map<UriMapping, String> unsortedResult = new LinkedHashMap<>();

    if (this.instances != null) {
        for (String instanceId : this.instances.keySet()) {
            List<UriMapping> driverMappings = this.instances.get(instanceId).getConfiguration().getUriMappings();

            for (UriMapping mapping : driverMappings) {
                unsortedResult.put(mapping, instanceId);
            }
        }
    }

    // Order according to weight.
    SortedSet<UriMapping> keys = new TreeSet<>(new UriMappingComparator());
    keys.addAll(unsortedResult.keySet());
    for (UriMapping key : keys) {
        result.put(key, unsortedResult.get(key));
    }

    return result;
}
 
源代码3 项目: lams   文件: AuthoringController.java
/**
    * Ajax call, will add one more input line for new resource item instruction.
    */
   @RequestMapping("/initOverallFeedback")
   public String initOverallFeedback(HttpServletRequest request) {
SessionMap<String, Object> sessionMap = getSessionMap(request);
AssessmentForm assessmentForm = (AssessmentForm) sessionMap.get(AssessmentConstants.ATTR_ASSESSMENT_FORM);
Assessment assessment = assessmentForm.getAssessment();

// initial Overall feedbacks list
SortedSet<AssessmentOverallFeedback> overallFeedbackList = new TreeSet<>(new SequencableComparator());
if (!assessment.getOverallFeedbacks().isEmpty()) {
    overallFeedbackList.addAll(assessment.getOverallFeedbacks());
} else {
    for (int i = 1; i <= AssessmentConstants.INITIAL_OVERALL_FEEDBACK_NUMBER; i++) {
	AssessmentOverallFeedback overallFeedback = new AssessmentOverallFeedback();
	if (i == 1) {
	    overallFeedback.setGradeBoundary(100);
	}
	overallFeedback.setSequenceId(i);
	overallFeedbackList.add(overallFeedback);
    }
}

request.setAttribute(AssessmentConstants.ATTR_OVERALL_FEEDBACK_LIST, overallFeedbackList);
return "pages/authoring/parts/overallfeedbacklist";
   }
 
源代码4 项目: freerouting   文件: ExpandTestState.java
private void complete_autoroute()
{
    MazeSearchAlgo.Result search_result = this.maze_search_algo.find_connection();
    if (search_result != null)
    {
        SortedSet<Item> ripped_item_list = new TreeSet<Item>();
        this.autoroute_result =
                LocateFoundConnectionAlgo.get_instance(search_result, control_settings,
                this.autoroute_engine.autoroute_search_tree,
                hdlg.get_routing_board().rules.get_trace_angle_restriction(),
                ripped_item_list, eu.mihosoft.freerouting.board.TestLevel.ALL_DEBUGGING_OUTPUT);
        hdlg.get_routing_board().generate_snapshot();
        SortedSet<Item> ripped_connections = new TreeSet<Item>();
        for (Item curr_ripped_item : ripped_item_list)
        {
            ripped_connections.addAll(curr_ripped_item.get_connection_items(Item.StopConnectionOption.VIA));
        }
        hdlg.get_routing_board().remove_items(ripped_connections, false);
        InsertFoundConnectionAlgo.get_instance(autoroute_result, hdlg.get_routing_board(), control_settings);
    }
}
 
源代码5 项目: lams   文件: AuthoringController.java
/**
    * Remove imageGallery item from HttpSession list and update page display. As authoring rule, all persist only
    * happen when user submit whole page. So this remove is just impact HttpSession values.
    */
   @RequestMapping("/removeImage")
   public String removeImage(HttpServletRequest request) {

// get back sessionMAP
String sessionMapID = WebUtil.readStrParam(request, ImageGalleryConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
	.getAttribute(sessionMapID);

int itemIdx = NumberUtils.stringToInt(request.getParameter(ImageGalleryConstants.PARAM_IMAGE_INDEX), -1);
if (itemIdx != -1) {
    SortedSet<ImageGalleryItem> imageGalleryList = getImageList(sessionMap);
    List<ImageGalleryItem> rList = new ArrayList<>(imageGalleryList);
    ImageGalleryItem item = rList.remove(itemIdx);
    imageGalleryList.clear();
    imageGalleryList.addAll(rList);
    // add to delList
    List<ImageGalleryItem> delList = getDeletedImageGalleryItemList(sessionMap);
    delList.add(item);
}

request.setAttribute(ImageGalleryConstants.ATTR_SESSION_MAP_ID, sessionMapID);
return "pages/authoring/parts/itemlist";
   }
 
源代码6 项目: projectforge-webapp   文件: UserPrefDO.java
@Transient
public Set<UserPrefEntryDO> getSortedUserPrefEntries()
{
  final SortedSet<UserPrefEntryDO> result = new TreeSet<UserPrefEntryDO>(new Comparator<UserPrefEntryDO>() {
    public int compare(final UserPrefEntryDO o1, final UserPrefEntryDO o2)
    {
      return StringHelper.compareTo(o1.orderString, o2.orderString);
    }
  });
  result.addAll(this.prefEntries);
  return result;
}
 
源代码7 项目: lams   文件: AuthoringController.java
/**
    * Remove taskList item from HttpSession list and update page display. As
    * authoring rule, all persist only happen when user submit whole page. So this
    * remove is just impact HttpSession values.
    */
   @RequestMapping("/removeItem")
   public String removeItem(HttpServletRequest request) {

// get back sessionMAP
String sessionMapID = WebUtil.readStrParam(request, TaskListConstants.ATTR_SESSION_MAP_ID);
SessionMap<String, Object> sessionMap = (SessionMap<String, Object>) request.getSession()
	.getAttribute(sessionMapID);

int itemIdx = NumberUtils.stringToInt(request.getParameter(TaskListConstants.PARAM_ITEM_INDEX), -1);
if (itemIdx != -1) {
    SortedSet<TaskListItem> taskListList = getTaskListItemList(sessionMap);
    List<TaskListItem> rList = new ArrayList<>(taskListList);
    TaskListItem item = rList.remove(itemIdx);
    taskListList.clear();
    taskListList.addAll(rList);
    // add to delList
    List delList = getDeletedTaskListItemList(sessionMap);
    delList.add(item);

    // delete tasklistitems that still may be contained in Conditions
    SortedSet<TaskListCondition> conditionList = getTaskListConditionList(sessionMap);
    for (TaskListCondition condition : conditionList) {
	Set<TaskListItem> itemList = condition.getTaskListItems();
	if (itemList.contains(item)) {
	    itemList.remove(item);
	}
    }

}

request.setAttribute(TaskListConstants.ATTR_SESSION_MAP_ID, sessionMapID);
return "pages/authoring/parts/itemlist";
   }
 
源代码8 项目: presto   文件: BenchmarkResultsPrinter.java
private static List<String> getSelectedQueryTagNames(Iterable<Suite> suites, Iterable<BenchmarkQuery> queries)
{
    SortedSet<String> tags = new TreeSet<>();
    for (Suite suite : suites) {
        for (BenchmarkQuery query : suite.selectQueries(queries)) {
            tags.addAll(query.getTags().keySet());
        }

        for (RegexTemplate regexTemplate : suite.getSchemaNameTemplates()) {
            tags.addAll(regexTemplate.getFieldNames());
        }
    }
    return ImmutableList.copyOf(tags);
}
 
@Override
public void applyTo(
    List<Statement> statements, CiscoConfiguration cc, Configuration c, Warnings w) {
  SortedSet<Long> communities = new TreeSet<>();
  for (String communityListName : _communityLists) {
    CommunityList communityList = c.getCommunityLists().get(communityListName);
    if (communityList != null) {
      StandardCommunityList scl = cc.getStandardCommunityLists().get(communityListName);
      if (scl != null) {
        for (StandardCommunityListLine line : scl.getLines()) {
          if (line.getAction() == LineAction.PERMIT) {
            communities.addAll(line.getCommunities());
          } else {
            w.redFlag(
                "Expected only permit lines in standard community-list referred to by route-map "
                    + "set community community-list line: \""
                    + communityListName
                    + "\"");
          }
        }
      } else {
        w.redFlag(
            "Expected standard community list in route-map set community community-list line "
                + "but got expanded instead: \""
                + communityListName
                + "\"");
      }
    }
  }
  _communityLists.forEach(
      communityListName ->
          statements.add(
              new AddCommunity(
                  new org.batfish.datamodel.routing_policy.expr.NamedCommunitySet(
                      communityListName))));
}
 
public ActionForward showCandidacyDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request,
        HttpServletResponse response) throws FenixActionException, FenixServiceException {

    final StudentCandidacy candidacy = getCandidacy(request);
    request.setAttribute("candidacy", candidacy);

    final SortedSet<Operation> operations = new TreeSet<Operation>();
    operations.addAll(candidacy.getActiveCandidacySituation().getOperationsForPerson(getLoggedPerson(request)));
    request.setAttribute("operations", operations);

    request.setAttribute("person", getUserView(request).getPerson());
    return mapping.findForward("showCandidacyDetails");
}
 
源代码11 项目: ldp4j   文件: AssertionsImpl.java
private List<Node> getValues() {
	List<Node> result=new ArrayList<Node>();
	result.addAll(this.values);
	SortedSet<IndividualImpl> sortedLinks=new TreeSet<IndividualImpl>(new IndividualComparator());
	sortedLinks.addAll(links.values());
	for(IndividualImpl link:sortedLinks) {
		result.add(link.getIdentity());
	}
	return result;
}
 
源代码12 项目: netbeans   文件: ProjectAssociationAction.java
@Messages({
    "ProjectAssociationAction.open_some_projects=Open some projects to choose from.",
    "ProjectAssociationAction.title_select_project=Select Project",
    "ProjectAssociationAction.could_not_associate=Failed to record a Hudson job association.",
    "ProjectAssociationAction.could_not_dissociate=Failed to find the Hudson job association to be removed."
})
@Override public void actionPerformed(ActionEvent e) {
    if (alreadyAssociatedProject == null) {
        SortedSet<Project> projects = new TreeSet<Project>(ProjectRenderer.comparator());
        projects.addAll(Arrays.asList(OpenProjects.getDefault().getOpenProjects()));
        if (projects.isEmpty()) {
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(Bundle.ProjectAssociationAction_open_some_projects(), NotifyDescriptor.INFORMATION_MESSAGE));
            return;
        }
        JComboBox box = new JComboBox(new DefaultComboBoxModel(projects.toArray(new Project[projects.size()])));
        box.setRenderer(new ProjectRenderer());
        if (DialogDisplayer.getDefault().notify(new NotifyDescriptor(box, Bundle.ProjectAssociationAction_title_select_project(), NotifyDescriptor.OK_CANCEL_OPTION, NotifyDescriptor.PLAIN_MESSAGE, null, null)) != NotifyDescriptor.OK_OPTION) {
            return;
        }
        if (!ProjectHudsonProvider.getDefault().recordAssociation((Project) box.getSelectedItem(), assoc)) {
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(Bundle.ProjectAssociationAction_could_not_associate(), NotifyDescriptor.WARNING_MESSAGE));
        }
    } else {
        if (!ProjectHudsonProvider.getDefault().recordAssociation(alreadyAssociatedProject, null)) {
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(Bundle.ProjectAssociationAction_could_not_dissociate(), NotifyDescriptor.WARNING_MESSAGE));
        }
    }
}
 
源代码13 项目: fenixedu-academic   文件: RootCurriculumGroup.java
public CycleCurriculumGroup getLastOrderedCycleCurriculumGroup() {
    final SortedSet<CycleCurriculumGroup> cycleCurriculumGroups =
            new TreeSet<CycleCurriculumGroup>(CycleCurriculumGroup.COMPARATOR_BY_CYCLE_TYPE_AND_ID);
    cycleCurriculumGroups.addAll(getInternalCycleCurriculumGroups());

    return cycleCurriculumGroups.isEmpty() ? null : cycleCurriculumGroups.last();
}
 
源代码14 项目: gemfirexd-oss   文件: ServerGroupUtils.java
public static SortedSet<String> getServerGroupsFromContainer(GemFireContainer container) {
  SortedSet<String> tableServerGroups = new TreeSet<String>();
  ExtraTableInfo    extraTableInfo    = container.getExtraTableInfo();
  TableDescriptor   tableDescriptor   = extraTableInfo.getTableDescriptor();
  try {
    DistributionDescriptor distributionDescriptor = tableDescriptor.getDistributionDescriptor(); // TODO Abhishek: when should we use this & why does it throw an exception?
    tableServerGroups.addAll(distributionDescriptor.getServerGroups());
  } catch (StandardException e) { // ignored - tableDescriptor.getDistributionDescriptor() is only an accessor method
  }

  return tableServerGroups;
}
 
private void getAllSent(int limit, int offset, boolean rescan, long lastBlock, SortedSet<ZCashTransactionDetails_taddr> uniqueTransactions) throws ZCashException {
  List<ZCashTransactionDetails_taddr> nextPack;
  do {
    List<ZCashTransactionDetails_taddr> uncachedTransactions = new LinkedList<>();
    nextPack = getSentTransactions(pubKey, limit, offset);
    //Log.i("UPDATE CACHE:", String.format("Downloaded %d transactions", nextPack.size()));
    if (!rescan) {
      boolean cachedAll = true;
      for (ZCashTransactionDetails_taddr details : nextPack) {
        boolean cached = details.blockHeight <= lastBlock;
        if (!cached) {
          uncachedTransactions.add(details);
        }

        cachedAll &= details.blockHeight <= lastBlock;
      }

      if (cachedAll) {
        break;
      }
    } else {
      uncachedTransactions = nextPack;
    }

    uniqueTransactions.addAll(uncachedTransactions);
    Log.i("UPDATE CACHE:", String.format("Downloaded %d transactions", uniqueTransactions.size()));
    offset += limit;
  } while (nextPack.size() == limit);
}
 
private void getAllSent(int limit, int offset, boolean rescan, long lastBlock, SortedSet<ZCashTransactionDetails_taddr> uniqueTransactions) throws ZCashException {
  List<ZCashTransactionDetails_taddr> nextPack;
  do {
    List<ZCashTransactionDetails_taddr> uncachedTransactions = new LinkedList<>();
    nextPack = getSentTransactions(pubKey, limit, offset);
    //Log.i("UPDATE CACHE:", String.format("Downloaded %d transactions", nextPack.size()));
    if (!rescan) {
      boolean cachedAll = true;
      for (ZCashTransactionDetails_taddr details : nextPack) {
        boolean cached = details.blockHeight <= lastBlock;
        if (!cached) {
          uncachedTransactions.add(details);
        }

        cachedAll &= details.blockHeight <= lastBlock;
      }

      if (cachedAll) {
        break;
      }
    } else {
      uncachedTransactions = nextPack;
    }

    uniqueTransactions.addAll(uncachedTransactions);
    Log.i("UPDATE CACHE:", String.format("Downloaded %d transactions", uniqueTransactions.size()));
    offset += limit;
  } while (nextPack.size() == limit);
}
 
源代码17 项目: magarena   文件: PermanentViewerInfo.java
private static SortedSet<PermanentViewerInfo> getLinked(final MagicGame game,final MagicPermanent permanent) {
    final SortedSet<PermanentViewerInfo> linked= new TreeSet<>(NAME_COMPARATOR);
    for (final MagicPermanent equipment : permanent.getEquipmentPermanents()) {
        linked.add(new PermanentViewerInfo(game,equipment));
        linked.addAll(getLinked(game, equipment));
    }
    for (final MagicPermanent aura : permanent.getAuraPermanents()) {
        linked.add(new PermanentViewerInfo(game,aura));
        linked.addAll(getLinked(game, aura));
    }
    return linked;
}
 
源代码18 项目: onos   文件: OchSignalTest.java
@Test
public void testToFlexgrid25() {
    OchSignal input = newDwdmSlot(CHL_25GHZ, 0);
    SortedSet<OchSignal> expected = newOchSignalTreeSet();
    expected.addAll(ImmutableList.of(
                newFlexGridSlot(-1),
                newFlexGridSlot(+1)));

    SortedSet<OchSignal> flexGrid = OchSignal.toFlexGrid(input);

    assertEquals(expected, flexGrid);
}
 
源代码19 项目: rice   文件: ConfigParserImplConfig.java
public void parseConfig() throws IOException {
    if ( LOG.isInfoEnabled() ) {
        LOG.info("Loading Rice configs: " + StringUtils.join(fileLocs, ", "));
    }
    Map<String, Object> baseObjects = getBaseObjects();
    if (baseObjects != null) {
        this.getObjects().putAll(baseObjects);
    }
    configureBuiltIns(getProperties());
    Properties baseProperties = getBaseProperties();
    if (baseProperties != null) {
        this.getProperties().putAll(baseProperties);
    }

    parseWithConfigParserImpl();
    //parseWithHierarchicalConfigParser();

    //if (!fileLocs.isEmpty()) {
    if ( LOG.isInfoEnabled() ) {
        LOG.info("");
        LOG.info("####################################");
        LOG.info("#");
        LOG.info("# Properties used after config override/replacement");
        LOG.info("# " + StringUtils.join(fileLocs, ", "));
        LOG.info("#");
        LOG.info("####################################");
        LOG.info("");
    }
    Map<String, String> safePropsUsed = ConfigLogger.getDisplaySafeConfig(this.propertiesUsed);
    Set<Map.Entry<String,String>> entrySet = safePropsUsed.entrySet();
    // sort it for display
    SortedSet<Map.Entry<String,String>>
            sorted = new TreeSet<Map.Entry<String,String>>(new Comparator<Map.Entry<String,String>>() {
        public int compare(Map.Entry<String,String> a, Map.Entry<String,String> b) {
            return a.getKey().compareTo(b.getKey());
        }
    });
    sorted.addAll(entrySet);
    //}
    if ( LOG.isInfoEnabled() ) {
        for (Map.Entry<String, String> propUsed: sorted) {
            LOG.info("Using config Prop " + propUsed.getKey() + "=[" + propUsed.getValue() + "]");
        }
    }
}
 
源代码20 项目: iceberg   文件: TestTableMetadata.java
@Test
public void testAddPreviousMetadataRemoveOne() {
  long previousSnapshotId = System.currentTimeMillis() - new Random(1234).nextInt(3600);
  Snapshot previousSnapshot = new BaseSnapshot(
      ops.io(), previousSnapshotId, null, previousSnapshotId, null, null, ImmutableList.of(
      new GenericManifestFile(localInput("file:/tmp/manfiest.1.avro"), SPEC_5.specId())));
  long currentSnapshotId = System.currentTimeMillis();
  Snapshot currentSnapshot = new BaseSnapshot(
      ops.io(), currentSnapshotId, previousSnapshotId, currentSnapshotId, null, null, ImmutableList.of(
      new GenericManifestFile(localInput("file:/tmp/manfiest.2.avro"), SPEC_5.specId())));

  List<HistoryEntry> reversedSnapshotLog = Lists.newArrayList();
  long currentTimestamp = System.currentTimeMillis();
  List<MetadataLogEntry> previousMetadataLog = Lists.newArrayList();
  previousMetadataLog.add(new MetadataLogEntry(currentTimestamp - 100,
      "/tmp/000001-" + UUID.randomUUID().toString() + ".metadata.json"));
  previousMetadataLog.add(new MetadataLogEntry(currentTimestamp - 90,
      "/tmp/000002-" + UUID.randomUUID().toString() + ".metadata.json"));
  previousMetadataLog.add(new MetadataLogEntry(currentTimestamp - 80,
      "/tmp/000003-" + UUID.randomUUID().toString() + ".metadata.json"));
  previousMetadataLog.add(new MetadataLogEntry(currentTimestamp - 70,
      "/tmp/000004-" + UUID.randomUUID().toString() + ".metadata.json"));
  previousMetadataLog.add(new MetadataLogEntry(currentTimestamp - 60,
      "/tmp/000005-" + UUID.randomUUID().toString() + ".metadata.json"));

  MetadataLogEntry latestPreviousMetadata = new MetadataLogEntry(currentTimestamp - 50,
      "/tmp/000006-" + UUID.randomUUID().toString() + ".metadata.json");

  TableMetadata base = new TableMetadata(localInput(latestPreviousMetadata.file()), 1, UUID.randomUUID().toString(),
      TEST_LOCATION, 0, currentTimestamp - 50, 3, TEST_SCHEMA, 5,
      ImmutableList.of(SPEC_5), ImmutableMap.of("property", "value"), currentSnapshotId,
      Arrays.asList(previousSnapshot, currentSnapshot), reversedSnapshotLog,
      ImmutableList.copyOf(previousMetadataLog));

  previousMetadataLog.add(latestPreviousMetadata);

  TableMetadata metadata = base.replaceProperties(
      ImmutableMap.of(TableProperties.METADATA_PREVIOUS_VERSIONS_MAX, "5"));

  SortedSet<MetadataLogEntry> removedPreviousMetadata =
      Sets.newTreeSet(Comparator.comparingLong(MetadataLogEntry::timestampMillis));
  removedPreviousMetadata.addAll(base.previousFiles());
  removedPreviousMetadata.removeAll(metadata.previousFiles());

  Assert.assertEquals("Metadata logs should match", previousMetadataLog.subList(1, 6),
      metadata.previousFiles());
  Assert.assertEquals("Removed Metadata logs should contain 1", previousMetadataLog.subList(0, 1),
      ImmutableList.copyOf(removedPreviousMetadata));
}