本文整理汇总了Java中gnu.trove.set.hash.TLinkedHashSet类的典型用法代码示例。如果您正苦于以下问题:Java TLinkedHashSet类的具体用法?Java TLinkedHashSet怎么用?Java TLinkedHashSet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TLinkedHashSet类属于gnu.trove.set.hash包,在下文中一共展示了TLinkedHashSet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSingleWordCompletions
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
/**
* For a given set of completions for a search word puts them in histogram rank order.
* Also ensures that if the searched for word was a known word that it will be included in the results.
*
* @param currentWordCompletions The set of full word completions from the tries
* @param word The word being searched for
* @param limit Max number of results to return
* @return A histogram ordered
*/
private Set<String> getSingleWordCompletions(Set<String> currentWordCompletions, String word, int limit) {
Set<String> orderedWordCompletions = new TLinkedHashSet<String>(UnigramHistogram.getOrderedResults(unigramHistogram, currentWordCompletions, limit));
// makes sense that if there is an exact match, it should show up in the results
// logic here is that after the histogram ordering, if currentWordCompletions does
// contain the word then it fell out in the histogram ordering so add it back at the end.
boolean wordExactMatch = UnigramHistogram.contains(unigramHistogram, word);
if (wordExactMatch && !orderedWordCompletions.contains(word)) {
String[] words = orderedWordCompletions.toArray(new String[0]);
orderedWordCompletions.remove(words[words.length - 1]);
orderedWordCompletions.add(word);
}
return orderedWordCompletions;
}
开发者ID:networkdowntime,项目名称:EmbeddableSearch,代码行数:25,代码来源:Autocomplete.java
示例2: getCompletionsSingleWordUnordered
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
/**
* Internal method to get the unordered completions for a single word.
*
* @param word Word to get the completions for
* @param fuzzyMatch provides character back-off and re-searching if no completions are found
* @param limit Max number of results to return
* @return Not-null set of the suggested completions
*/
private Set<String> getCompletionsSingleWordUnordered(String word, boolean fuzzyMatch, int limit) {
Set<String> completions = new TLinkedHashSet<String>();
if (word != null && word.length() > 0) {
for (CostString wordPlusPrefix : prefixTrie.getCompletions(new CostString(word), limit * 2, true)) {
for (CostString completedWord : suffixTrie.getCompletions(wordPlusPrefix, limit * 2, true)) {
completions.add(completedWord.str);
}
}
if (fuzzyMatch && completions.isEmpty()) {
completions.addAll(getCompletionsSingleWordUnordered(word.substring(0, word.length() - 1), fuzzyMatch, limit));
}
}
return completions;
}
开发者ID:networkdowntime,项目名称:EmbeddableSearch,代码行数:26,代码来源:Autocomplete.java
示例3: getNeighborsIn
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
@Override
public Set<IAgent> getNeighborsIn(final IScope scope, final int placeIndex, final int radius) {
int[] n = neighborsIndexes[placeIndex];
if (n == null) {
n = new int[0];
neighborsIndexes[placeIndex] = n;
}
final int size = n.length;
if (radius > size) {
computeNeighborsFrom(placeIndex, size + 1, radius);
}
final int[] nn = neighbors[placeIndex];
final int nnSize = neighborsIndexes[placeIndex][radius - 1];
final Set<IAgent> result = new TLinkedHashSet<>();
for (int i = 0; i < nnSize; i++) {
result.add(matrix.matrix[nn[i]].getAgent());
}
scope.getRandom().shuffle2(result);
return result;
}
开发者ID:gama-platform,项目名称:gama,代码行数:21,代码来源:GridNeighborhood.java
示例4: findCommonType
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
public static IType<?> findCommonType(final IExpression[] elements, final int kind) {
final IType<?> result = Types.NO_TYPE;
if (elements.length == 0) { return result; }
final Set<IType<?>> types = new TLinkedHashSet<>();
for (final IExpression e : elements) {
// TODO Indicates a previous error in compiling expressions. Maybe
// we should cut this
// part
if (e == null) {
continue;
}
final IType<?> eType = e.getType();
types.add(kind == TYPE ? eType : kind == CONTENT ? eType.getContentType() : eType.getKeyType());
}
final IType<?>[] array = types.toArray(new IType[types.size()]);
return findCommonType(array);
}
开发者ID:gama-platform,项目名称:gama,代码行数:18,代码来源:GamaType.java
示例5: getQueryableProperties
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public List<String> getQueryableProperties() {
if (queryableProperties == null) {
synchronized (queryablePropertiesLock) {
if (queryableProperties == null) {
Set<String> queryablePropertiesSet = new TLinkedHashSet<>(1);
List<IComponentDescriptor<?>> ancestorDescs = getAncestorDescriptors();
if (ancestorDescs != null) {
for (IComponentDescriptor<?> ancestorDescriptor : ancestorDescs) {
queryablePropertiesSet.addAll(ancestorDescriptor.getQueryableProperties());
}
}
for (String renderedProperty : getRenderedProperties()) {
IPropertyDescriptor declaredPropertyDescriptor = getDeclaredPropertyDescriptor(renderedProperty);
if (declaredPropertyDescriptor != null && declaredPropertyDescriptor.isQueryable()) {
queryablePropertiesSet.add(renderedProperty);
}
}
queryableProperties = new ArrayList<>(queryablePropertiesSet);
}
}
}
return explodeComponentReferences(this, queryableProperties);
}
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:28,代码来源:AbstractComponentDescriptor.java
示例6: getServiceContractClassNames
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public Collection<String> getServiceContractClassNames() {
Set<String> serviceContractClassNames = new TLinkedHashSet<>(1);
if (serviceContracts != null) {
for (Class<?> serviceContract : serviceContracts) {
serviceContractClassNames.add(serviceContract.getName());
}
} else {
if (serviceDelegateClassNames != null) {
serviceContractClassNames.addAll(serviceDelegateClassNames.keySet());
}
if (serviceDelegateBeanNames != null) {
serviceContractClassNames.addAll(serviceDelegateBeanNames.keySet());
}
}
return serviceContractClassNames;
}
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:21,代码来源:AbstractComponentDescriptor.java
示例7: computeNeighborsFrom
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
private Set<IAgent> computeNeighborsFrom(final IScope scope, final int placeIndex, final int begin, final int end) {
final Set<IAgent> result = new TLinkedHashSet<>();
for (int i = begin; i <= end; i++) {
for (final Integer index : matrix.usesVN ? get4NeighborsAtRadius(placeIndex, i)
: get8NeighborsAtRadius(placeIndex, i)) {
result.add(matrix.matrix[index].getAgent());
}
}
// Addresses Issue 1071 by explicitly shuffling the result
scope.getRandom().shuffle2(result);
return result;
}
开发者ID:gama-platform,项目名称:gama,代码行数:13,代码来源:NoCacheNeighborhood.java
示例8: allAgents
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
@Override
public Collection<IAgent> allAgents() {
final Collection<IAgent> result = new TLinkedHashSet();
for (int x = 0; x < detail; x++)
for (int y = 0; y < detail; y++) {
cells[x][y].findIntersects(bounds, result);
}
return result;
}
开发者ID:gama-platform,项目名称:gama,代码行数:10,代码来源:GamaGridIndex.java
示例9: getAgentsStack
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
@Override
public IAgent[] getAgentsStack() {
final Set<IAgent> agents = new TLinkedHashSet<>();
AgentExecutionContext current = agentContext;
if (current == null) { return new IAgent[0]; }
final int i = 0;
while (current != null) {
agents.add(current.getAgent());
current = current.getOuterContext();
}
return agents.stream().toArray(IAgent[]::new);
}
开发者ID:gama-platform,项目名称:gama,代码行数:13,代码来源:ExecutionScope.java
示例10: assertReturnedValueIsOk
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
private void assertReturnedValueIsOk(final StatementDescription cd) {
final IType at = cd.getType();
if (at == Types.NO_TYPE) { return; }
final Set<StatementDescription> returns = new TLinkedHashSet<>();
cd.collectAllStatements(RETURN, returns);
// Primitives dont need to be ckecked
// if ( cd.getKeyword().equals(PRIMITIVE) ) { return; }
if (returns.isEmpty()) {
cd.error("Action " + cd.getName() + " must return a result of type " + at, IGamlIssue.MISSING_RETURN);
return;
}
for (final StatementDescription ret : returns) {
final IExpression ie = ret.getFacetExpr(VALUE);
if (ie == null) {
continue;
}
if (ie.equals(IExpressionFactory.NIL_EXPR)) {
if (at.getDefault() != null) {
ret.error("'nil' is not an acceptable return value. A valid " + at + " is expected instead.",
IGamlIssue.WRONG_TYPE, VALUE);
} else {
continue;
}
} else {
final IType<?> rt = ie.getType();
if (!rt.isTranslatableInto(at)) {
ret.error("Action " + cd.getName() + " must return a result of type " + at + " (and not " + rt
+ ")", IGamlIssue.SHOULD_CAST, VALUE, at.toString());
}
}
}
// FIXME This assertion is still simple (i.e. the tree is not
// verified to ensure that every
// branch returns something)
}
开发者ID:gama-platform,项目名称:gama,代码行数:37,代码来源:ActionStatement.java
示例11: getExperimentTitles
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
public Set<String> getExperimentTitles() {
final Set<String> strings = new TLinkedHashSet();
if (experiments != null) {
experiments.forEachEntry((a, b) -> {
if (b.getOriginName().equals(getName()))
strings.add(b.getExperimentTitleFacet());
return true;
});
}
return strings;
}
开发者ID:gama-platform,项目名称:gama,代码行数:12,代码来源:ModelDescription.java
示例12: getAttributeNames
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
public Collection<String> getAttributeNames() {
final Collection<String> accumulator =
parent != null && parent != this ? parent.getAttributeNames() : new TLinkedHashSet<String>();
if (attributes != null) {
attributes.forEachKey(s -> {
if (accumulator.contains(s))
accumulator.remove(s);
accumulator.add(s);
return true;
});
}
return accumulator;
}
开发者ID:gama-platform,项目名称:gama,代码行数:14,代码来源:TypeDescription.java
示例13: addModelChangeListener
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
/**
* Adds a new {@code IModelChangeListener}.
*
* @param listener
* The added listener.
* @see IModelProvider#addModelChangeListener(IModelChangeListener)
*/
public synchronized void addModelChangeListener(IModelChangeListener listener) {
if (listener != null) {
if (listeners == null) {
listeners = new TLinkedHashSet<>();
}
if (!listeners.contains(listener)) {
listeners.add(listener);
}
}
}
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:18,代码来源:ModelChangeSupport.java
示例14: getRenderedProperties
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public List<String> getRenderedProperties() {
if (renderedProperties == null) {
synchronized (renderedPropertiesLock) {
if (renderedProperties == null) {
Set<String> renderedPropertiesSet = new TLinkedHashSet<>(1);
List<IComponentDescriptor<?>> ancestorDescs = getAncestorDescriptors();
if (ancestorDescs != null) {
for (IComponentDescriptor<?> ancestorDescriptor : ancestorDescs) {
renderedPropertiesSet.addAll(ancestorDescriptor.getRenderedProperties());
}
}
Collection<IPropertyDescriptor> declaredPropertyDescriptors = getDeclaredPropertyDescriptors();
if (declaredPropertyDescriptors != null) {
for (IPropertyDescriptor propertyDescriptor : declaredPropertyDescriptors) {
if (!(propertyDescriptor instanceof ICollectionPropertyDescriptor<?>)
&& !(propertyDescriptor instanceof ITextPropertyDescriptor)
&& !(propertyDescriptor instanceof IObjectPropertyDescriptor)) {
String propertyName = propertyDescriptor.getName();
if (!propertyName.endsWith(RAW_SUFFIX) && !propertyName.endsWith(NLS_SUFFIX)) {
renderedPropertiesSet.add(propertyName);
}
}
}
}
renderedProperties = new ArrayList<>(renderedPropertiesSet);
}
}
}
return explodeComponentReferences(this, renderedProperties);
}
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:35,代码来源:AbstractComponentDescriptor.java
示例15: addInhibitedListener
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
/**
* Registers a listener to be excluded (generally temporarily) from the
* notification process without being removed from the actual listeners
* collection.
*
* @param listener
* the excluded listener.
*/
public void addInhibitedListener(ISelectionChangeListener listener) {
if (inhibitedListeners == null && listener != null) {
inhibitedListeners = new TLinkedHashSet<>(1);
}
if (inhibitedListeners != null) {
inhibitedListeners.add(listener);
}
}
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:17,代码来源:SelectionChangeSupport.java
示例16: addItemSelectionListener
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
/**
* Adds a new listener to this source.
*
* @param listener
* The added listener.
*/
public synchronized void addItemSelectionListener(
IItemSelectionListener listener) {
if (listener != null) {
if (listeners == null) {
listeners = new TLinkedHashSet<>(1);
}
if (!listeners.contains(listener)) {
listeners.add(listener);
}
}
}
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:18,代码来源:ItemSelectionSupport.java
示例17: addValueChangeListener
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public synchronized void addValueChangeListener(IValueChangeListener listener) {
if (listener != null) {
if (listeners == null) {
listeners = new TLinkedHashSet<>(1);
}
if (!listeners.contains(listener)) {
listeners.add(listener);
}
}
}
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:15,代码来源:ValueChangeSupport.java
示例18: getValueChangeListeners
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
/**
* Gets the listeners.
*
* @return the listeners.
*/
@Override
public Set<IValueChangeListener> getValueChangeListeners() {
if (listeners != null) {
return new TLinkedHashSet<>(listeners);
}
return Collections.emptySet();
}
开发者ID:jspresso,项目名称:jspresso-ce,代码行数:13,代码来源:ValueChangeSupport.java
示例19: allAgents
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
@Override
public Collection<IAgent> allAgents() {
final Collection<IAgent> result = new TLinkedHashSet();
root.findIntersects(root.bounds, result);
return result;
}
开发者ID:gama-platform,项目名称:gama,代码行数:7,代码来源:GamaQuadTree.java
示例20: initCollect
import gnu.trove.set.hash.TLinkedHashSet; //导入依赖的package包/类
@Override
protected void initCollect() {
if (collect == null) {
collect = new TLinkedHashSet<>();
}
}
开发者ID:gama-platform,项目名称:gama,代码行数:7,代码来源:Collector.java
注:本文中的gnu.trove.set.hash.TLinkedHashSet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论