当前位置: 首页>>代码示例>>Java>>正文


Java SetUniqueList.decorate方法代码示例

本文整理汇总了Java中org.apache.commons.collections.list.SetUniqueList.decorate方法的典型用法代码示例。如果您正苦于以下问题:Java SetUniqueList.decorate方法的具体用法?Java SetUniqueList.decorate怎么用?Java SetUniqueList.decorate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.collections.list.SetUniqueList的用法示例。


在下文中一共展示了SetUniqueList.decorate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeDuplicateProcesses

import org.apache.commons.collections.list.SetUniqueList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked") // TODO: switch to Apache Commons 4.0+
public void removeDuplicateProcesses() {
	ElementNSImpl mergedEnterpriseArchive = (ElementNSImpl) this.repository.getAny().get(0);
	ElementNSImpl mergedProcessArchive = getElement(mergedEnterpriseArchive, "processArchive");
	ElementNSImpl mergedProcessProperty = getElement(mergedProcessArchive, "processProperty");

	String content = mergedProcessProperty.getTextContent();
	if (content != null && !content.isEmpty()) {
		List<String> processes = SetUniqueList.decorate(new ArrayList<String>());
		processes.addAll(Arrays.asList(content.split(",")));
		String contentWithoutDuplicate = StringUtils.join(processes, ",");
		mergedProcessProperty.setTextContent(contentWithoutDuplicate);
	}

}
 
开发者ID:fastconnect,项目名称:tibco-bwmaven,代码行数:16,代码来源:ArchiveBuilder.java

示例2: setDbFileList

import org.apache.commons.collections.list.SetUniqueList; //导入方法依赖的package包/类
public static void setDbFileList(List<DbFile> list) {
	PreferenceModel model = SbApp.getInstance().getPreferenceModel();
	Session session = model.beginTransaction();
	PreferenceDAOImpl dao = new PreferenceDAOImpl(session);
	@SuppressWarnings("unchecked")
	List<DbFile> uniqueList = (List<DbFile>) SetUniqueList.decorate(list);
	try {
		if (uniqueList.size() > 10) {
			uniqueList = uniqueList.subList(uniqueList.size() - 10,
					uniqueList.size());
		}
	} catch (IndexOutOfBoundsException e) {
		// ignore
	}
	String val = StringUtils.join(uniqueList, "#");
	dao.saveOrUpdate(PreferenceKey.RECENT_FILES.toString(), val);
	model.commit();
}
 
开发者ID:markkohdev,项目名称:oStorybook,代码行数:19,代码来源:PrefUtil.java

示例3: createRandomIndividual

import org.apache.commons.collections.list.SetUniqueList; //导入方法依赖的package包/类
@Override
public Team createRandomIndividual() {
    Map<Position, Player> teamPlayers;
    do {
        teamPlayers = new LinkedHashMap<>();
        SetUniqueList uniq = SetUniqueList.decorate(new ArrayList<>());
        Player player;
        for (Position p : Position.values()) {
            while (! uniq.add(player = Player.getRandomPlayer(p.role))) {}
            teamPlayers.put(p, player);
        }
    } while (!TeamValidator.validate(teamPlayers));
    return new Team(teamPlayers);
}
 
开发者ID:juanmf,项目名称:ga,代码行数:15,代码来源:Team.java

示例4: createIndividual

import org.apache.commons.collections.list.SetUniqueList; //导入方法依赖的package包/类
@Override
public Team createIndividual(Team t, int genIdx) {
    Map<Position, Player> teamPlayers;
    int tries = 100;
    boolean valid = false;
    do {                
        SetUniqueList uniq = SetUniqueList.decorate(new ArrayList<>());
        for (Player pl : t) {
            uniq.add(pl);
        }
        teamPlayers = new LinkedHashMap<>();
        Position pos;
        Player player;
        Iterator<Player> i = t.iterator();
        int j = 0;
        for (Iterator<Position> positions = Arrays.asList(Position.values()).iterator(); 
             j < t.size(); j++) {
            pos = positions.next();
            if (genIdx == j) {
                i.next();
                while (! uniq.add(player = Player.getRandomPlayer(pos.role))) {}
            } else {
                player = i.next();
            }
            teamPlayers.put(pos, player);
        }
    } while (!(valid = TeamValidator.validate(teamPlayers)) && (0 < --tries));
    return valid ? new Team(teamPlayers) : null;
}
 
开发者ID:juanmf,项目名称:ga,代码行数:30,代码来源:Team.java

示例5: Persona

import org.apache.commons.collections.list.SetUniqueList; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public Persona() {
  this.pageId = null;
  this.hostPatternKey = null;
  this.usernames = (List<String>)SetUniqueList.decorate(new ArrayList<String>());
}
 
开发者ID:USCDataScience,项目名称:PersonaExtraction,代码行数:7,代码来源:Persona.java

示例6: searchForQuantitationTypes

import org.apache.commons.collections.list.SetUniqueList; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
@SuppressWarnings({"unchecked", "PMD.ExcessiveMethodLength", "PMD.NPathComplexity" })
public List<QuantitationType> searchForQuantitationTypes(PageSortParams<QuantitationType> params,
        QuantitationTypeSearchCriteria criteria) {
    final Criteria c = getCurrentSession().createCriteria(HybridizationData.class);
    c.createCriteria("hybridization").add(Restrictions.eq("id", criteria.getHybridization().getId()));
    c.createCriteria("dataSet").createAlias("quantitationTypes", "qt").createAlias("arrayData", "ad");
    c.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP);

    if (!criteria.getArrayDataTypes().isEmpty()) {
        final List<Long> ids = new LinkedList<Long>();
        for (final ArrayDataType type : criteria.getArrayDataTypes()) {
            ids.add(type.getId());
        }
        c.createCriteria("ad.type").add(Restrictions.in("id", ids));
    }

    if (!criteria.getFileTypes().isEmpty() || !criteria.getFileCategories().isEmpty()) {
        c.createAlias("ad.dataFile", "df");
    }

    if (!criteria.getFileTypes().isEmpty()) {
        c.add(Restrictions.in("df.type",
                Sets.newHashSet(FileTypeRegistryImpl.namesForTypes(criteria.getFileTypes()))));
    }

    if (!criteria.getFileCategories().isEmpty()) {
        final Disjunction categoryCriterion = Restrictions.disjunction();
        if (criteria.getFileCategories().contains(FileCategory.DERIVED_DATA)) {
            categoryCriterion.add(Restrictions.in("df.type", Sets.newHashSet(FileTypeRegistryImpl
                    .namesForTypes(this.typeRegistry.getDerivedArrayDataTypes()))));
        }
        if (criteria.getFileCategories().contains(FileCategory.RAW_DATA)) {
            categoryCriterion.add(Restrictions.in("df.type",
                    Sets.newHashSet(FileTypeRegistryImpl.namesForTypes(this.typeRegistry.getRawArrayDataTypes()))));
        }
        c.add(categoryCriterion);
    }

    c.setFirstResult(params.getIndex());
    if (params.getPageSize() > 0) {
        c.setMaxResults(params.getPageSize());
    }
    c.addOrder(toOrder(params, "qt"));

    final List<Map<String, Object>> results = c.list();
    final List<QuantitationType> qTypes = SetUniqueList.decorate(new LinkedList<QuantitationType>());
    for (final Map<String, Object> row : results) {
        final QuantitationType qt = (QuantitationType) row.get("qt");
        qTypes.add(qt);
    }
    return qTypes;
}
 
开发者ID:NCIP,项目名称:caarray,代码行数:57,代码来源:ArrayDaoImpl.java


注:本文中的org.apache.commons.collections.list.SetUniqueList.decorate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。