Java Code Examples for java.util.LinkedHashSet

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project Codeable_Objects, under directory /codeableObjects/src/com/math/.

Source file: Geom.java

  18 
vote

public static Vector<CompPoint> removeDuplicateVerts(Vector<CompPoint> verticies){
  Collection noDup=new LinkedHashSet(verticies);
  verticies.clear();
  verticies.addAll(noDup);
  return verticies;
}
 

Example 2

From project components, under directory /torquebox/as6-int/src/main/java/org/switchyard/deployment/torquebox/.

Source file: ServiceInvoker.java

  17 
vote

private static Collection<Object> createCollection(Class<? extends Collection> colClass){
  if (Set.class.isAssignableFrom(colClass)) {
    return new LinkedHashSet();
  }
 else   if (List.class.isAssignableFrom(colClass)) {
    return new ArrayList();
  }
 else {
    return new ArrayList();
  }
}
 

Example 3

From project fastjson, under directory /src/main/java/com/alibaba/fastjson/parser/deserializer/.

Source file: ArrayListTypeDeserializer.java

  16 
vote

@SuppressWarnings({"unchecked","rawtypes"}) public <T>T deserialze(DefaultJSONParser parser,Type type,Object fieldName){
  Collection list=null;
  if (parser.getLexer().token() == JSONToken.NULL) {
    parser.getLexer().nextToken();
  }
 else {
    if (rawClass.isAssignableFrom(LinkedHashSet.class)) {
      list=new LinkedHashSet();
    }
 else     if (rawClass.isAssignableFrom(HashSet.class)) {
      list=new HashSet();
    }
 else {
      list=new ArrayList();
    }
    parser.parseArray(itemType,list,fieldName);
  }
  return (T)list;
}
 

Example 4

From project Gemini-Blueprint, under directory /core/src/main/java/org/eclipse/gemini/blueprint/blueprint/container/support/.

Source file: BlueprintEditorRegistrar.java

  16 
vote

@SuppressWarnings("unchecked") @Override protected Collection createCollection(Class collectionType,int initialCapacity){
  if (!collectionType.isInterface()) {
    try {
      return (Collection)collectionType.newInstance();
    }
 catch (    Exception ex) {
      throw new IllegalArgumentException("Could not instantiate collection class [" + collectionType.getName() + "]: "+ ex.getMessage());
    }
  }
 else   if (List.class.equals(collectionType)) {
    return new ArrayList(initialCapacity);
  }
 else   if (Set.class.equals(collectionType)) {
    return new LinkedHashSet(initialCapacity);
  }
 else   if (SortedSet.class.equals(collectionType)) {
    return new TreeSet();
  }
 else {
    return new ArrayList(initialCapacity);
  }
}
 

Example 5

From project activemq-apollo, under directory /apollo-util/src/main/scala/org/apache/activemq/apollo/util/.

Source file: Combinator.java

  15 
vote

private Set<Map<String,Object>> _combinations(){
  LinkedHashSet<Map<String,Object>> rc=new LinkedHashSet<Map<String,Object>>();
  List<Map<String,Object>> expandedOptions=new ArrayList<Map<String,Object>>();
  expandCombinations(new ArrayList<ComboOption>(comboOptions.values()),expandedOptions);
  rc.addAll(expandedOptions);
  for (  Combinator c : children) {
    rc.addAll(c._combinations());
  }
  return rc;
}
 

Example 6

From project aether-ant, under directory /src/main/java/org/eclipse/aether/ant/util/.

Source file: ConverterUtils.java

  15 
vote

private static Collection<org.eclipse.aether.graph.Exclusion> toExclusions(Collection<Exclusion> exclusions1,Collection<Exclusion> exclusions2){
  Collection<org.eclipse.aether.graph.Exclusion> results=new LinkedHashSet<org.eclipse.aether.graph.Exclusion>();
  if (exclusions1 != null) {
    for (    Exclusion exclusion : exclusions1) {
      results.add(toExclusion(exclusion));
    }
  }
  if (exclusions2 != null) {
    for (    Exclusion exclusion : exclusions2) {
      results.add(toExclusion(exclusion));
    }
  }
  return results;
}
 

Example 7

From project aether-core, under directory /aether-api/src/main/java/org/eclipse/aether/collection/.

Source file: UnsolvableVersionConflictException.java

  15 
vote

public UnsolvableVersionConflictException(Collection<List<DependencyNode>> paths,Object dependencyConflictId){
  super("Could not resolve version conflict among " + toPaths(paths));
  this.dependencyConflictId=(dependencyConflictId != null) ? dependencyConflictId : "";
  if (paths == null) {
    this.paths=Collections.emptyList();
    this.versions=Collections.emptyList();
  }
 else {
    this.paths=paths;
    this.versions=new LinkedHashSet<String>();
    for (    List<DependencyNode> path : paths) {
      VersionConstraint constraint=path.get(path.size() - 1).getVersionConstraint();
      if (constraint != null && constraint.getRange() != null) {
        versions.add(constraint.toString());
      }
    }
  }
}
 

Example 8

From project agileBase, under directory /gtpb_server/src/com/gtwm/pb/auth/.

Source file: Authenticator.java

  15 
vote

/** 
 * @return Only the privileges which the specified user has (not countingprivileges they have as a result of being a member of roles)
 */
@Transient protected Set<UserGeneralPrivilegeInfo> getPrivilegesForUser(AppUserInfo user){
  Set<UserGeneralPrivilegeInfo> privilegesForUser=new LinkedHashSet<UserGeneralPrivilegeInfo>();
  for (  UserGeneralPrivilegeInfo privilege : this.getUserPrivilegesDirect()) {
    if (privilege.getUser().equals(user)) {
      privilegesForUser.add(privilege);
    }
  }
  return Collections.unmodifiableSet(privilegesForUser);
}
 

Example 9

From project alphaportal_dev, under directory /sys-src/alphaportal/web/src/main/java/alpha/portal/webapp/listener/.

Source file: UserCounterListener.java

  15 
vote

/** 
 * Adds the username.
 * @param user the user
 */
@SuppressWarnings("unchecked") synchronized void addUsername(final User user){
  this.users=(Set<User>)this.servletContext.getAttribute(UserCounterListener.USERS_KEY);
  if (this.users == null) {
    this.users=new LinkedHashSet<User>();
  }
  if (!this.users.contains(user)) {
    this.users.add(user);
    this.servletContext.setAttribute(UserCounterListener.USERS_KEY,this.users);
    this.incrementUserCounter();
  }
}
 

Example 10

From project Android, under directory /app/src/main/java/com/github/mobile/ui/repo/.

Source file: RecentRepositories.java

  15 
vote

private void load(){
  LinkedHashSet<Long> loaded=new RequestReader(file,VERSION).read();
  if (loaded == null)   loaded=new LinkedHashSet<Long>();
  ids=loaded;
  trim();
}
 

Example 11

From project AndroidLab, under directory /libs/unboundid/docs/examples/.

Source file: LDAPSearch.java

  15 
vote

/** 
 * Adds the arguments used by this program that aren't already provided by the generic  {@code LDAPCommandLineTool} framework.
 * @param parser  The argument parser to which the arguments should be added.
 * @throws ArgumentException  If a problem occurs while adding the arguments.
 */
@Override() public void addNonLDAPArguments(final ArgumentParser parser) throws ArgumentException {
  this.parser=parser;
  String description="The base DN to use for the search.  This must be " + "provided.";
  baseDN=new DNArgument('b',"baseDN",true,1,"{dn}",description);
  parser.addArgument(baseDN);
  description="The scope to use for the search.  It should be 'base', " + "'one', 'sub', or 'subord'.  If this is not provided, then " + "a default scope of 'sub' will be used.";
  final LinkedHashSet<String> allowedScopes=new LinkedHashSet<String>(4);
  allowedScopes.add("base");
  allowedScopes.add("one");
  allowedScopes.add("sub");
  allowedScopes.add("subord");
  scopeStr=new StringArgument('s',"scope",false,1,"{scope}",description,allowedScopes,"sub");
  parser.addArgument(scopeStr);
  description="Follow any referrals encountered during processing.";
  followReferrals=new BooleanArgument('R',"followReferrals",description);
  parser.addArgument(followReferrals);
  description="Generate terse output with minimal additional information.";
  terseMode=new BooleanArgument('t',"terse",description);
  parser.addArgument(terseMode);
  description="Specifies the length of time in milliseconds to sleep " + "before repeating the same search.  If this is not " + "provided, then the search will only be performed once.";
  repeatIntervalMillis=new IntegerArgument('i',"repeatIntervalMillis",false,1,"{millis}",description,0,Integer.MAX_VALUE);
  parser.addArgument(repeatIntervalMillis);
  description="Specifies the number of times that the search should be " + "performed.  If this argument is present, then the " + "--repeatIntervalMillis argument must also be provided to "+ "specify the length of time between searches.  If "+ "--repeatIntervalMillis is used without --numSearches, "+ "then the search will be repeated until the tool is "+ "interrupted.";
  numSearches=new IntegerArgument('n',"numSearches",false,1,"{count}",description,1,Integer.MAX_VALUE);
  parser.addArgument(numSearches);
  parser.addDependentArgumentSet(numSearches,repeatIntervalMillis);
}
 

Example 12

From project androidquery, under directory /src/com/androidquery/auth/.

Source file: AccountHandle.java

  15 
vote

public synchronized void auth(AbstractAjaxCallback<?,?> cb){
  if (callbacks == null) {
    callbacks=new LinkedHashSet<AbstractAjaxCallback<?,?>>();
    callbacks.add(cb);
    auth();
  }
 else {
    callbacks.add(cb);
  }
}
 

Example 13

From project android_external_guava, under directory /src/com/google/common/collect/.

Source file: LinkedHashMultimap.java

  15 
vote

private LinkedHashMultimap(int expectedKeys,int expectedValuesPerKey){
  super(new LinkedHashMap<K,Collection<V>>(expectedKeys));
  Preconditions.checkArgument(expectedValuesPerKey >= 0);
  this.expectedValuesPerKey=expectedValuesPerKey;
  linkedEntries=new LinkedHashSet<Map.Entry<K,V>>(expectedKeys * expectedValuesPerKey);
}
 

Example 14

From project ant4eclipse, under directory /org.ant4eclipse.lib.jdt/src/org/ant4eclipse/lib/jdt/internal/tools/container/.

Source file: JreContainerResolver.java

  15 
vote

/** 
 * @param resolver
 */
public void resolveContainer(ClasspathEntry classpathEntry,ClasspathResolverContext context){
  if (!context.isCurrentProjectRoot()) {
    return;
  }
  JavaRuntimeRegistry javaRuntimeRegistry=ServiceRegistryAccess.instance().getService(JavaRuntimeRegistry.class);
  String path=classpathEntry.getPath();
  if (path.contains("%")) {
    path=path.replace('%',' ');
  }
  JavaRuntime javaRuntime=null;
  if (path.equals(ContainerTypes.JRE_CONTAINER)) {
    javaRuntime=javaRuntimeRegistry.getDefaultJavaRuntime();
  }
 else   if (path.startsWith(ContainerTypes.VMTYPE_PREFIX)) {
    String key=path.substring(ContainerTypes.VMTYPE_PREFIX.length());
    javaRuntime=javaRuntimeRegistry.getJavaRuntime(key);
    if (javaRuntime == null) {
      javaRuntime=javaRuntimeRegistry.getDefaultJavaRuntime();
      A4ELogging.warn("Could not find JRE for %s. Using default JRE (Version: %s, Location: %s).",path,javaRuntime.getJavaVersion(),javaRuntime.getLocation());
      javaRuntimeRegistry.registerJavaRuntime(key,javaRuntime.getLocation());
    }
  }
 else {
    javaRuntime=javaRuntimeRegistry.getDefaultJavaRuntime();
  }
  AccessRestrictions accessRestrictions=null;
  File[] libraries=javaRuntime.getLibraries();
  if (!path.equals(ContainerTypes.JRE_CONTAINER)) {
    String profileKey=path.substring(ContainerTypes.VMTYPE_PREFIX.length());
    if (javaRuntimeRegistry.hasJavaProfile(profileKey)) {
      Set<String> publicPackages=new LinkedHashSet<String>();
      publicPackages.add("java");
      publicPackages.addAll(javaRuntimeRegistry.getJavaProfile(profileKey).getSystemPackages());
      accessRestrictions=new AccessRestrictions(publicPackages,new LinkedHashSet<String>(),true);
    }
  }
  context.setBootClasspathEntry(new ResolvedClasspathEntry(libraries,accessRestrictions));
}
 

Example 15

From project apb, under directory /modules/apb-base/src/apb/.

Source file: Apb.java

  15 
vote

/** 
 * Load the projectpath list.
 */
public static Set<File> loadProjectPath(){
  Set<File> result=new LinkedHashSet<File>();
  String path=System.getenv("APB_PROJECT_PATH");
  String path2=getEnv().getProperty("project.path","");
  if (isNotEmpty(path2)) {
    path=isEmpty(path) ? path2 : path + File.pathSeparator + path2;
  }
  if (isEmpty(path)) {
    path="./DEFS";
  }
  for (  String p : path.split(File.pathSeparator)) {
    File dir=new File(p);
    if (dir.isAbsolute() && !dir.isDirectory()) {
      getEnv().logWarning(Messages.INV_PROJECT_DIR(dir.getPath()));
    }
    result.add(dir);
  }
  return result;
}
 

Example 16

From project aranea, under directory /server/src/main/java/no/dusken/aranea/admin/control/.

Source file: EditSectionController.java

  15 
vote

@Override protected Map referenceData(HttpServletRequest request,Object object,Errors errors){
  Map<String,Object> map=new HashMap<String,Object>();
  Set<Section> sections=new LinkedHashSet<Section>();
  sections.add(null);
  SectionService sectionService=(SectionService)getGenericService();
  sections.addAll(sectionService.getSections(false));
  map.put("topLevelSections",sections);
  return map;
}
 

Example 17

From project archaius, under directory /archaius-core/src/main/java/com/netflix/config/.

Source file: ConcurrentCompositeConfiguration.java

  15 
vote

/** 
 * Get all the keys contained by sub configurations.
 */
public Iterator<String> getKeys(){
  Set<String> keys=new LinkedHashSet<String>();
  for (Iterator<String> it=overrideProperties.getKeys(); it.hasNext(); ) {
    keys.add(it.next());
  }
  for (  Configuration config : configList) {
    for (Iterator<String> it=config.getKeys(); it.hasNext(); ) {
      keys.add(it.next());
    }
  }
  return keys.iterator();
}
 

Example 18

From project Arecibo, under directory /agent/src/main/java/com/ning/arecibo/agent/datasource/jmx/.

Source file: MonitoredMBean.java

  15 
vote

public MonitoredMBean(String name,MBeanDescriptor mbeanDescriptor,Object memberId){
  this.name=name;
  this.mbeanDescriptor=mbeanDescriptor;
  this.memberId=memberId;
  this.relevantAttrs=new LinkedHashSet<String>();
  this.valueParsers=new HashMap<String,ValueParser>();
  setRelevantAttributes(mbeanDescriptor.getAttributeNames());
}
 

Example 19

From project arquillian-container-openshift, under directory /openshift-express/src/main/java/org/jboss/arquillian/container/openshift/express/archive/.

Source file: ArchiveUtil.java

  15 
vote

/** 
 * Gets all classes from the archive which implement interface or are the subclass of given needle
 * @param < T > Type of objects to be found
 * @param archive Archive to be searched
 * @param needle Class representing superclass of searched objects
 * @return Unique collection of classes in the archive
 */
public static final <T>Collection<Class<T>> getDefinedClassesOf(Archive<?> archive,Class<T> needle){
  long beforeScanning=System.currentTimeMillis();
  Collection<String> classNames=new LinkedHashSet<String>();
  Collection<Class<T>> needleImpls=new LinkedHashSet<Class<T>>();
  getDefinedClasses(classNames,needleImpls,archive,needle);
  if (log.isLoggable(Level.FINE)) {
    log.fine("Found " + needleImpls + " defined in the archive "+ archive.getName()+ " matching needle "+ needle.getName());
    log.fine("Scanning classpath took " + (System.currentTimeMillis() - beforeScanning) + "ms");
  }
  return needleImpls;
}
 

Example 20

From project arquillian-core, under directory /container/test-impl-base/src/main/java/org/jboss/arquillian/container/test/impl/.

Source file: RemoteExtensionLoader.java

  15 
vote

private <T>Set<T> createInstances(Class<T> serviceType,Set<Class<? extends T>> providers){
  Set<T> providerImpls=new LinkedHashSet<T>();
  for (  Class<? extends T> serviceClass : providers) {
    providerImpls.add(createInstance(serviceClass));
  }
  return providerImpls;
}
 

Example 21

From project arquillian-extension-android, under directory /android-impl/src/main/java/org/jboss/arquillian/android/configuration/.

Source file: AndroidSdk.java

  15 
vote

/** 
 * Initialize the maps matching platform and api levels form the source properties files.
 * @throws AndroidConfigurationException
 */
private Set<Platform> findAvailablePlatforms() throws AndroidConfigurationException {
  List<Platform> availablePlatforms=new ArrayList<Platform>();
  List<File> platformDirectories=getPlatformDirectories();
  for (  File pDir : platformDirectories) {
    File propFile=new File(pDir,SOURCE_PROPERTIES_FILENAME);
    Properties properties=new Properties();
    try {
      properties.load(new FileInputStream(propFile));
    }
 catch (    IOException e) {
      throw new AndroidConfigurationException("Unable to read platform directory details from its configuration file " + propFile.getAbsoluteFile());
    }
    if (properties.containsKey(PLATFORM_VERSION_PROPERTY) && properties.containsKey(API_LEVEL_PROPERTY)) {
      String platform=properties.getProperty(PLATFORM_VERSION_PROPERTY);
      String apiLevel=properties.getProperty(API_LEVEL_PROPERTY);
      Platform p=new Platform(platform,apiLevel,pDir.getAbsolutePath());
      availablePlatforms.add(p);
      if (log.isLoggable(Level.FINE)) {
        log.fine("Found available platform: " + p.toString());
      }
    }
  }
  Collections.sort(availablePlatforms);
  return new LinkedHashSet<AndroidSdk.Platform>(availablePlatforms);
}
 

Example 22

From project arquillian-graphene, under directory /graphene-selenium/graphene-selenium-impl/src/main/java/org/jboss/arquillian/ajocado/command/.

Source file: CommandInterceptorProxyImpl.java

  15 
vote

/** 
 * Removes and returns all associated interceptors which of given type.
 * @param type of interceptors which we want to unregister from this command processor
 * @return the removed interceptors
 */
@Override public Set<CommandInterceptor> unregisterInterceptorType(Class<? extends CommandInterceptor> type){
  Set<Class<? extends CommandInterceptor>> typesToRemove=new LinkedHashSet<Class<? extends CommandInterceptor>>();
  for (  Class<? extends CommandInterceptor> entryType : interceptors.keySet()) {
    if (entryType.isInstance(type)) {
      typesToRemove.add(entryType);
    }
  }
  Set<CommandInterceptor> removedInterceptors=new LinkedHashSet<CommandInterceptor>();
  for (  Class<? extends CommandInterceptor> typeToRemove : typesToRemove) {
    removedInterceptors.add(interceptors.remove(typeToRemove));
  }
  return removedInterceptors;
}
 

Example 23

From project arquillian-rusheye, under directory /rusheye-impl/src/main/java/org/jboss/rusheye/parser/.

Source file: Handler.java

  15 
vote

@Override public Object invoke(Object proxy,Method method,Object[] args) throws Throwable {
  Set<SuiteListener> listeners=new LinkedHashSet<SuiteListener>(parserListeners);
  for (  SuiteListener listener : listeners) {
    Method wrappedMethod=listener.getClass().getMethod(method.getName(),method.getParameterTypes());
    try {
      wrappedMethod.invoke(listener,args);
    }
 catch (    InvocationTargetException e) {
      if (e.getCause() instanceof RuntimeException) {
        throw (RuntimeException)e.getCause();
      }
 else {
        throw new RuntimeException(e.getCause());
      }
    }
catch (    Exception e) {
      throw new IllegalStateException("unexpected invocation exception: " + e.getMessage(),e);
    }
  }
  return null;
}
 

Example 24

From project arquillian_deprecated, under directory /impl-base/src/main/java/org/jboss/arquillian/impl/.

Source file: DynamicServiceLoader.java

  15 
vote

private <T>Set<T> createInstances(Class<T> serviceType,Set<Class<? extends T>> providers){
  Set<T> providerImpls=new LinkedHashSet<T>();
  for (  Class<? extends T> serviceClass : providers) {
    providerImpls.add(createInstance(serviceClass));
  }
  return providerImpls;
}
 

Example 25

From project atlassian-rest-cli, under directory /rest-cli-runner/src/main/java/com/galeoconsulting/leonardinius/servlet/.

Source file: ScriptRunnerSessionServlet.java

  15 
vote

private Map<String,String> getConfiguredTemplates(){
  if (configuredTemplates == null) {
    String parameterValue=checkNotNull(getInitParameter(VELOCITY_TEMPLATES_CONFIG_PARAMETER),VELOCITY_TEMPLATES_CONFIG_PARAMETER + " servlet configuration parameter");
    Collection<String> entries=new LinkedHashSet<String>(Arrays.asList(StringUtils.split(parameterValue,';')));
    entries=Collections2.filter(entries,new Predicate<String>(){
      @Override public boolean apply(      @Nullable String s){
        return StringUtils.isNotBlank(s);
      }
    }
);
    Map<String,String> result=Maps.newHashMap();
    for (    String entry : entries) {
      String data[]=StringUtils.split(entry,'|');
      result.put(StringUtils.trimToNull(data[0]),StringUtils.trimToNull(data[1]));
    }
    configuredTemplates=ImmutableMap.copyOf(result);
  }
  return configuredTemplates;
}
 

Example 26

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/corecomponents/.

Source file: DataResultViewerTable.java

  15 
vote

/** 
 * Gets regular Bean property set properties from all first children and, recursively, subchildren of Node. Note: won't work out the box for lazy load - you need to set all children props for the parent by hand
 * @param parent Node with at least one child to get properties from
 * @return Properties,
 */
private Node.Property[] getAllChildPropertyHeaders(Node parent){
  Node firstChild=parent.getChildren().getNodeAt(0);
  Property[] properties=null;
  if (firstChild == null) {
    throw new IllegalArgumentException("Couldn't get a child Node from the given parent.");
  }
 else {
    Set<Property> allProperties=new LinkedHashSet<Property>();
    while (firstChild != null) {
      for (      PropertySet ps : firstChild.getPropertySets()) {
        final Property[] props=ps.getProperties();
        final int propsNum=props.length;
        for (int i=0; i < propsNum; ++i)         allProperties.add(props[i]);
      }
      firstChild=firstChild.getChildren().getNodeAt(0);
    }
    properties=allProperties.toArray(new Property[0]);
  }
  return properties;
}
 

Example 27

From project aviator, under directory /src/main/java/com/googlecode/aviator/.

Source file: BaseExpression.java

  15 
vote

public BaseExpression(List<String> varNames){
  super();
  LinkedHashSet<String> tmp=new LinkedHashSet<String>(varNames.size());
  for (  String name : varNames) {
    if (name.contains(".")) {
      name=name.substring(0,name.indexOf("."));
    }
    tmp.add(name);
  }
  this.varNames=new ArrayList<String>(tmp);
}
 

Example 28

From project avro, under directory /lang/java/avro/src/main/java/org/apache/avro/.

Source file: Schema.java

  15 
vote

private static Set<String> parseAliases(JsonNode node){
  JsonNode aliasesNode=node.get("aliases");
  if (aliasesNode == null)   return null;
  if (!aliasesNode.isArray())   throw new SchemaParseException("aliases not an array: " + node);
  Set<String> aliases=new LinkedHashSet<String>();
  for (  JsonNode aliasNode : aliasesNode) {
    if (!aliasNode.isTextual())     throw new SchemaParseException("alias not a string: " + aliasNode);
    aliases.add(aliasNode.getTextValue());
  }
  return aliases;
}
 

Example 29

From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.datatools.enablement.simpledb.ui/src/com/amazonaws/eclipse/datatools/enablement/simpledb/ui/editor/.

Source file: QueryEditor.java

  15 
vote

private synchronized void initializeElements(){
  if (this.elements == null && this.input != null) {
    List<SimpleDBItem> items=new LinkedList<SimpleDBItem>();
    Set<String> columns=new LinkedHashSet<String>();
    for (    Item item : this.input.getItems()) {
      SimpleDBItem e=new SimpleDBItem(item);
      columns.addAll(e.columns);
      items.add(e);
    }
    this.elements=items.toArray();
    this.columns=columns.toArray(new String[columns.size()]);
  }
}
 

Example 30

From project banshun, under directory /banshun/core/src/main/java/com/griddynamics/banshun/.

Source file: DependencySorter.java

  15 
vote

private List<Location> pullLocationListHead(LinkedList<Location> list){
  final Set<String> definedBeans=new LinkedHashSet<String>();
  Predicate canBeFired=new Predicate(){
    public boolean isValid(    Location location){
      return definedBeans.containsAll(collectBeanNames(location.getImportBeans()));
    }
  }
;
  Location location;
  LinkedList<Location> orderedHead=new LinkedList<Location>();
  while (!list.isEmpty() && (location=removeLocation(list,canBeFired)) != null) {
    definedBeans.addAll(collectBeanNames(location.getExportBeans()));
    orderedHead.add(location);
  }
  return orderedHead;
}
 

Example 31

From project BibleQuote-for-Android, under directory /src/com/BibleQuote/controllers/.

Source file: TSKController.java

  15 
vote

public LinkedHashSet<BibleReference> getLinks(BibleReference reference) throws TskNotFoundException, BQUniversalException {
  if (bCrossReferenceCache.containsKey(reference.getPath())) {
    return bCrossReferenceCache.get(reference.getPath());
  }
  LinkedHashSet<BibleReference> crossReference=BibleLinkParser.parse(reference.getModuleID(),getParallels(reference));
  bCrossReferenceCache.put(reference.getPath(),crossReference);
  return crossReference;
}
 

Example 32

From project big-data-plugin, under directory /src/org/pentaho/di/job/entries/sqoop/.

Source file: SqoopUtils.java

  15 
vote

/** 
 * Find all fields annotated with  {@link CommandLineArgument} in the class provided. All arguments must have validJavaBeans-style getter and setter methods in the object.
 * @param o Object to look for arguments in
 * @return Ordered set of arguments representing all {@link CommandLineArgument}-annotated fields in  {@code o}
 */
public static Set<? extends ArgumentWrapper> findAllArguments(Object o){
  Set<ArgumentWrapper> arguments=new LinkedHashSet<ArgumentWrapper>();
  Class<?> aClass=o.getClass();
  while (aClass != null) {
    for (    Field f : aClass.getDeclaredFields()) {
      if (f.isAnnotationPresent(CommandLineArgument.class)) {
        CommandLineArgument anno=f.getAnnotation(CommandLineArgument.class);
        String fieldName=f.getName().substring(0,1).toUpperCase() + f.getName().substring(1);
        Method getter=findMethod(aClass,fieldName,null,"get","is");
        Method setter=findMethod(aClass,fieldName,new Class<?>[]{f.getType()},"set");
        arguments.add(new ArgumentWrapper(anno.name(),getDisplayName(anno),anno.flag(),o,getter,setter));
      }
    }
    aClass=aClass.getSuperclass();
  }
  return arguments;
}
 

Example 33

From project blueprint-namespaces, under directory /blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/.

Source file: BlueprintContainerImpl.java

  15 
vote

public Set<String> getComponentIds(){
  Set<String> set=new LinkedHashSet<String>();
  set.addAll(componentDefinitionRegistry.getComponentDefinitionNames());
  set.add("blueprintContainer");
  set.add("blueprintBundle");
  set.add("blueprintBundleContext");
  set.add("blueprintConverter");
  return set;
}
 

Example 34

From project bndtools, under directory /bndtools.core/src/bndtools/internal/testcaseselection/.

Source file: JavaSearchScopeTestCaseLister.java

  15 
vote

public String[] getTestCases(boolean includeNonSource,ITestCaseFilter filter) throws TestCaseListException {
  final List<IJavaElement> testCaseList=new LinkedList<IJavaElement>();
  search(Arrays.asList("junit.framework.TestCase","junit.framework.TestSuite"),testCaseList);
  Set<String> testCaseNames=new LinkedHashSet<String>();
  for (Iterator<IJavaElement> iter=testCaseList.iterator(); iter.hasNext(); ) {
    boolean omit=false;
    IJavaElement element=iter.next();
    try {
      IType type=(IType)element.getAncestor(IJavaElement.TYPE);
      if (Flags.isAbstract(type.getFlags())) {
        omit=true;
      }
      if (!includeNonSource) {
        IPackageFragment pkgFragment=(IPackageFragment)element.getAncestor(IJavaElement.PACKAGE_FRAGMENT);
        if (pkgFragment.getCompilationUnits().length == 0) {
          omit=true;
        }
      }
    }
 catch (    JavaModelException e) {
      throw new TestCaseListException(e);
    }
    String className=getClassName(element);
    if (filter != null && !filter.select(className)) {
      omit=true;
    }
    if (!omit) {
      testCaseNames.add(className);
    }
  }
  return testCaseNames.toArray(new String[testCaseNames.size()]);
}
 

Example 35

From project candlepin, under directory /src/main/java/org/candlepin/service/impl/.

Source file: DefaultEntitlementCertServiceAdapter.java

  15 
vote

public X509Certificate createX509Certificate(Entitlement ent,Subscription sub,Product product,BigInteger serialNumber,KeyPair keyPair,boolean useContentPrefix) throws GeneralSecurityException, IOException {
  Set<X509ExtensionWrapper> extensions;
  Set<X509ByteExtensionWrapper> byteExtensions=new LinkedHashSet<X509ByteExtensionWrapper>();
  Set<Product> products=new HashSet<Product>(getProvidedProducts(ent.getPool(),sub));
  products.add(product);
  Map<String,EnvironmentContent> promotedContent=getPromotedContent(ent);
  String contentPrefix=getContentPrefix(ent,useContentPrefix);
  if (shouldGenerateV3(ent)) {
    extensions=prepareV3Extensions(products,ent,contentPrefix,promotedContent,sub);
    byteExtensions=prepareV3ByteExtensions(products,ent,contentPrefix,promotedContent,sub);
  }
 else {
    extensions=prepareV1Extensions(products,ent,contentPrefix,promotedContent,sub);
  }
  X509Certificate x509Cert=this.pki.createX509Certificate(createDN(ent),extensions,byteExtensions,sub.getStartDate(),ent.getEndDate(),keyPair,serialNumber,null);
  return x509Cert;
}
 

Example 36

From project capedwarf-blue, under directory /datastore/src/main/java/org/jboss/capedwarf/datastore/query/.

Source file: QueryResultProcessor.java

  15 
vote

public List<String> getPropertiesUsedInIn(){
  Set<String> set=new LinkedHashSet<String>();
  for (  Query.FilterPredicate predicate : inPredicates) {
    set.add(predicate.getPropertyName());
  }
  return new ArrayList<String>(set);
}
 

Example 37

From project cascading, under directory /src/core/cascading/tap/.

Source file: MultiSinkTap.java

  15 
vote

@Override public Scheme getScheme(){
  if (super.getScheme() != null)   return super.getScheme();
  Set<Comparable> fieldNames=new LinkedHashSet<Comparable>();
  for (int i=0; i < getTaps().length; i++) {
    for (    Object o : getTaps()[i].getSinkFields())     fieldNames.add((Comparable)o);
  }
  Fields allFields=new Fields(fieldNames.toArray(new Comparable[fieldNames.size()]));
  setScheme(new NullScheme(allFields,allFields));
  return super.getScheme();
}
 

Example 38

From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/core/classpath/.

Source file: CeylonClasspathContainer.java

  15 
vote

private static Collection<IClasspathEntry> findModuleArchivePaths(IJavaProject javaProject,IProject project,TypeChecker typeChecker) throws JavaModelException, CoreException {
  final Collection<IClasspathEntry> paths=new LinkedHashSet<IClasspathEntry>();
  Context context=typeChecker.getContext();
  RepositoryManager provider=context.getRepositoryManager();
  Set<Module> modulesToAdd=context.getModules().getListOfModules();
  for (  Module module : modulesToAdd) {
    if (module.getNameAsString().equals(Module.DEFAULT_MODULE_NAME) || module.getNameAsString().equals("java") || module.getNameAsString().equals("oracle")|| isProjectModule(javaProject,module)) {
      continue;
    }
    IPath modulePath=getModuleArchive(provider,module);
    if (modulePath != null) {
      IPath srcPath=null;
      for (      IProject p : project.getReferencedProjects()) {
        if (p.isAccessible() && p.getLocation().isPrefixOf(modulePath)) {
          srcPath=p.getLocation();
          break;
        }
      }
      if (srcPath == null) {
        srcPath=getSourceArchive(provider,module);
      }
      paths.add(newLibraryEntry(modulePath,srcPath,null));
    }
 else {
      IMarker marker=project.createMarker(IJavaModelMarker.BUILDPATH_PROBLEM_MARKER);
      marker.setAttribute(IMarker.MESSAGE,"no module archive found for classpath container: " + module.getNameAsString() + "/"+ module.getVersion());
      marker.setAttribute(IMarker.PRIORITY,IMarker.PRIORITY_HIGH);
      marker.setAttribute(IMarker.SEVERITY,IMarker.SEVERITY_ERROR);
    }
  }
  if (isExplodeModulesEnabled(project)) {
    paths.add(newLibraryEntry(getCeylonClassesOutputFolder(project).getFullPath(),project.getFullPath(),null,true));
  }
  return paths;
}
 

Example 39

From project Citizens, under directory /src/core/net/citizensnpcs/utils/.

Source file: Metrics.java

  15 
vote

/** 
 * Adds a custom data plotter for a given plugin
 * @param plugin
 * @param plotter
 */
public void addCustomData(Plugin plugin,Plotter plotter){
  Set<Plotter> plotters=customData.get(plugin);
  if (plotters == null) {
    plotters=Collections.synchronizedSet(new LinkedHashSet<Plotter>());
    customData.put(plugin,plotters);
  }
  plotters.add(plotter);
}
 

Example 40

From project clearcase-plugin, under directory /src/main/java/hudson/plugins/clearcase/action/.

Source file: SnapshotCheckoutAction.java

  15 
vote

protected SnapshotCheckoutAction.LoadRulesDelta getLoadRulesDelta(Set<String> configSpecLoadRules,Launcher launcher){
  Set<String> removedLoadRules=new LinkedHashSet<String>(configSpecLoadRules);
  Set<String> addedLoadRules=new LinkedHashSet<String>();
  if (!ArrayUtils.isEmpty(loadRules)) {
    for (    String loadRule : loadRules) {
      addedLoadRules.add(ConfigSpec.cleanLoadRule(loadRule,launcher.isUnix()));
    }
    removedLoadRules.removeAll(addedLoadRules);
    addedLoadRules.removeAll(configSpecLoadRules);
    PrintStream logger=launcher.getListener().getLogger();
    for (    String removedLoadRule : removedLoadRules) {
      logger.println("Removed load rule : " + removedLoadRule);
    }
    for (    String addedLoadRule : addedLoadRules) {
      logger.println("Added load rule : " + addedLoadRule);
    }
  }
  return new SnapshotCheckoutAction.LoadRulesDelta(removedLoadRules,addedLoadRules);
}
 

Example 41

From project coffeescript-netbeans, under directory /src/coffeescript/nb/project/sample/.

Source file: CoffeeScriptApplicationWizardIterator.java

  15 
vote

public Set instantiate() throws IOException {
  Set<FileObject> resultSet=new LinkedHashSet<FileObject>();
  File dirF=FileUtil.normalizeFile((File)wiz.getProperty("projdir"));
  dirF.mkdirs();
  FileObject template=Templates.getTemplate(wiz);
  FileObject dir=FileUtil.toFileObject(dirF);
  unZipFile(template.getInputStream(),dir);
  resultSet.add(dir);
  Enumeration<? extends FileObject> e=dir.getFolders(true);
  while (e.hasMoreElements()) {
    FileObject subfolder=e.nextElement();
    if (ProjectManager.getDefault().isProject(subfolder)) {
      resultSet.add(subfolder);
    }
  }
  File parent=dirF.getParentFile();
  if (parent != null && parent.exists()) {
    ProjectChooser.setProjectsFolder(parent);
  }
  return resultSet;
}
 

Example 42

From project Collections, under directory /src/test/java/vanilla/java/collections/.

Source file: HugeArrayBuilderTest.java

  15 
vote

@Test public void testRemoveTypes() throws Exception {
  gcPrintUsed();
  final HugeArrayBuilder<MutableTypes> builder=new HugeArrayBuilder<MutableTypes>(){
{
      capacity=length;
      setRemoveReturnsNull=false;
    }
  }
;
  final MutableTypes bean=builder.createBean();
  HugeArrayList<MutableTypes> hugeList=builder.create();
  List<MutableTypes> list=hugeList;
  assertEquals(0,list.size());
  final int elements=2;
  for (int i=0; i < elements; i++) {
    setFields(bean,i + 1);
    list.add(bean);
  }
  assertEquals(elements,list.size());
  Set<Integer> integers=new LinkedHashSet<Integer>();
  for (int i=0; i < elements; i++) {
    MutableTypes mt=list.remove(i);
    integers.add(mt.getInt());
    hugeList.recycle(mt);
  }
  assertEquals(0,list.size());
}
 

Example 43

From project connectbot, under directory /src/sk/vx/connectbot/service/.

Source file: TerminalBridge.java

  15 
vote

/** 
 * @return
 */
public List<String> scanForURLs(){
  Set<String> urls=new LinkedHashSet<String>();
  if (urlPattern == null) {
    String scheme="[A-Za-z][-+.0-9A-Za-z]*";
    String unreserved="[-._~0-9A-Za-z]";
    String pctEncoded="%[0-9A-Fa-f]{2}";
    String subDelims="[!$&'()*+,;:=]";
    String userinfo="(?:" + unreserved + "|"+ pctEncoded+ "|"+ subDelims+ "|:)*";
    String h16="[0-9A-Fa-f]{1,4}";
    String decOctet="(?:[0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])";
    String ipv4address=decOctet + "\\." + decOctet+ "\\."+ decOctet+ "\\."+ decOctet;
    String ls32="(?:" + h16 + ":"+ h16+ "|"+ ipv4address+ ")";
    String ipv6address="(?:(?:" + h16 + "){6}"+ ls32+ ")";
    String ipvfuture="v[0-9A-Fa-f]+.(?:" + unreserved + "|"+ subDelims+ "|:)+";
    String ipLiteral="\\[(?:" + ipv6address + "|"+ ipvfuture+ ")\\]";
    String regName="(?:" + unreserved + "|"+ pctEncoded+ "|"+ subDelims+ ")*";
    String host="(?:" + ipLiteral + "|"+ ipv4address+ "|"+ regName+ ")";
    String port="[0-9]*";
    String authority="(?:" + userinfo + "@)?"+ host+ "(?::"+ port+ ")?";
    String pchar="(?:" + unreserved + "|"+ pctEncoded+ "|"+ subDelims+ "|@)";
    String segment=pchar + "*";
    String pathAbempty="(?:/" + segment + ")*";
    String segmentNz=pchar + "+";
    String pathAbsolute="/(?:" + segmentNz + "(?:/"+ segment+ ")*)?";
    String pathRootless=segmentNz + "(?:/" + segment+ ")*";
    String hierPart="(?://" + authority + pathAbempty+ "|"+ pathAbsolute+ "|"+ pathRootless+ ")";
    String query="(?:" + pchar + "|/|\\?)*";
    String fragment="(?:" + pchar + "|/|\\?)*";
    String uriRegex=scheme + ":" + hierPart+ "(?:"+ query+ ")?(?:#"+ fragment+ ")?";
    urlPattern=Pattern.compile(uriRegex);
  }
  char[] visibleBuffer=new char[buffer.height * buffer.width];
  for (int l=0; l < buffer.height; l++)   System.arraycopy(buffer.charArray[buffer.windowBase + l],0,visibleBuffer,l * buffer.width,buffer.width);
  Matcher urlMatcher=urlPattern.matcher(new String(visibleBuffer));
  while (urlMatcher.find())   urls.add(urlMatcher.group());
  return (new LinkedList<String>(urls));
}
 

Example 44

From project core_1, under directory /common/src/main/java/org/switchyard/common/lang/.

Source file: Strings.java

  15 
vote

/** 
 * Splits the specified String per the specified delimiters (per StringTokenizer rules), then trims each split String, and if not zero-length, becomes part of the returned Set.
 * @param str the specified String
 * @param delim the specified delimiters
 * @return the split and trimmed-to-null'd Strings in an unmodifiable, insertion-ordered Set (possibly zero-size, but never null)
 */
public static Set<String> uniqueSplitTrimToNull(String str,String delim){
  Set<String> set=new LinkedHashSet<String>();
  if (str != null) {
    StringTokenizer st=new StringTokenizer(str,delim);
    while (st.hasMoreTokens()) {
      String s=trimToNull(st.nextToken());
      if (s != null) {
        set.add(s);
      }
    }
  }
  return Collections.unmodifiableSet(set);
}
 

Example 45

From project Core_2, under directory /javaee-impl/src/main/java/org/jboss/forge/spec/javaee/validation/provider/.

Source file: ApacheBeanValidationProvider.java

  15 
vote

public ApacheBeanValidationProvider(){
  this.defaultDescriptor=Descriptors.create(ValidationDescriptor.class).setDefaultProvider("org.apache.bval.jsr303.ApacheValidationProvider").setMessageInterpolator("org.apache.bval.jsr303.DefaultMessageInterpolator").setTraversableResolver("org.apache.bval.jsr303.resolver.DefaultTraversableResolver").setConstraintValidatorFactory("org.apache.bval.jsr303.DefaultConstraintValidatorFactory");
  final DependencyBuilder apacheBeanValidation=DependencyBuilder.create().setGroupId("org.apache.bval").setArtifactId("org.apache.bval.bundle").setVersion("[0.1-incubating,)");
  final Set<Dependency> tmpSet=new LinkedHashSet<Dependency>();
  tmpSet.add(apacheBeanValidation);
  this.dependencies=unmodifiableSet(tmpSet);
}
 

Example 46

From project core_4, under directory /api/src/main/java/org/richfaces/renderkit/util/.

Source file: CoreAjaxRendererUtils.java

  15 
vote

@SuppressWarnings("unchecked") private static Set<String> asSet(Object valueToSet){
  if (null != valueToSet) {
    if (valueToSet instanceof Set) {
      return new LinkedHashSet<String>((Set<String>)valueToSet);
    }
 else     if (valueToSet instanceof Collection) {
      return new LinkedHashSet<String>((Collection<String>)valueToSet);
    }
 else     if (Object[].class.isAssignableFrom(valueToSet.getClass())) {
      return new LinkedHashSet<String>(Arrays.asList((String[])valueToSet));
    }
 else     if (valueToSet instanceof String) {
      String areasString=((String)valueToSet).trim();
      if (areasString.contains(",") || areasString.contains(" ")) {
        String[] values=ID_SPLIT_PATTERN.split(areasString);
        Set<String> result=new LinkedHashSet<String>(values.length);
        for (        String value : values) {
          if (Strings.isNullOrEmpty(value)) {
            continue;
          }
          result.add(value);
        }
        return result;
      }
 else {
        Set<String> areasSet=new LinkedHashSet<String>(5);
        if (!Strings.isNullOrEmpty(areasString)) {
          areasSet.add(areasString);
        }
        return areasSet;
      }
    }
  }
  return null;
}
 

Example 47

From project craftbook, under directory /common/src/main/java/com/sk89q/craftbook/util/.

Source file: LocationUtil.java

  15 
vote

/** 
 * Gets all surrounding chunks near the given block and radius.
 * @param block  to get surrounding chunks for
 * @param radius around the block
 * @return chunks in the given radius
 */
public static Set<Chunk> getSurroundingChunks(Block block,int radius){
  Chunk chunk=block.getChunk();
  radius=radius / 16 + 1;
  Set<Chunk> chunks=new LinkedHashSet<Chunk>();
  World world=chunk.getWorld();
  int cX=chunk.getX();
  int cZ=chunk.getZ();
  for (int x=radius; x >= 0; x--) {
    for (int z=radius; z >= 0; z--) {
      chunks.add(world.getChunkAt(cX + x,cZ + z));
      chunks.add(world.getChunkAt(cX - x,cZ - z));
      chunks.add(world.getChunkAt(cX + x,cZ - z));
      chunks.add(world.getChunkAt(cX - x,cZ + z));
      chunks.add(world.getChunkAt(cX + x,cZ));
      chunks.add(world.getChunkAt(cX - x,cZ));
      chunks.add(world.getChunkAt(cX,cZ + z));
      chunks.add(world.getChunkAt(cX,cZ - z));
    }
  }
  return chunks;
}
 

Example 48

From project crash, under directory /shell/embed/spring/src/main/java/org/crsh/spring/.

Source file: SpringBootstrap.java

  15 
vote

public void afterPropertiesSet() throws Exception {
  Collection<CRaSHPlugin> plugins=new LinkedHashSet<CRaSHPlugin>();
  plugins.add(new CRaSHShellFactory());
  plugins.add(new ProcessorIOHandler());
  plugins.add(new JaasAuthenticationPlugin());
  plugins.add(new SimpleAuthenticationPlugin());
  Map<String,Object> attributes=new HashMap<String,Object>();
  attributes.put("factory",factory);
  if (factory instanceof ListableBeanFactory) {
    ListableBeanFactory listable=(ListableBeanFactory)factory;
    plugins.addAll(listable.getBeansOfType(CRaSHPlugin.class).values());
    attributes.put("beans",new SpringMap(listable));
  }
  PluginDiscovery discovery=new ServiceLoaderDiscovery(loader);
  FS cmdFS=createCommandFS();
  FS confFS=createConfFS();
  PluginContext context=new PluginContext(discovery,Collections.unmodifiableMap(attributes),cmdFS,confFS,loader);
  context.refresh();
  start(context);
}
 

Example 49

From project Custom-Salem, under directory /src/haven/.

Source file: JarSignersHardLinker.java

  15 
vote

/** 
 * get all the JarFile objects for all of the jars in the classpath
 * @return
 */
public static Set<JarFile> getAllJarsFilesInClassPath(){
  Set<JarFile> jars=new LinkedHashSet<JarFile>();
  for (  URL url : getAllJarUrls()) {
    try {
      jars.add(getJarFile(url));
    }
 catch (    IOException e) {
      System.out.println("unable to retrieve jar at URL: " + url);
    }
  }
  return jars;
}
 

Example 50

From project cxf-dosgi, under directory /discovery/local/src/test/java/org/apache/cxf/dosgi/discovery/local/.

Source file: LocalDiscoveryUtilsTest.java

  15 
vote

@SuppressWarnings("unchecked") public void testCreateXML() throws Exception {
  Map m=new LinkedHashMap();
  m.put("service.imported.configs","org.apache.cxf.ws");
  m.put("endpoint.id","foo:bar");
  m.put("objectClass",new String[]{"com.acme.HelloService","some.other.Service"});
  m.put("SomeObject",new Object());
  m.put("long",9223372036854775807L);
  m.put("Long2",-1L);
  m.put("double",1.7976931348623157E308);
  m.put("Double2",1.0d);
  m.put("float",42.24f);
  m.put("Float2",1.0f);
  m.put("int",17);
  m.put("Integer2",42);
  m.put("byte",(byte)127);
  m.put("Byte2",(byte)-128);
  m.put("boolean",true);
  m.put("Boolean2",false);
  m.put("short",(short)99);
  m.put("Short2",(short)-99);
  m.put("char",'@');
  m.put("Character2",'X');
  List<Boolean> boolList=new ArrayList<Boolean>();
  boolList.add(true);
  boolList.add(false);
  m.put("bool-list",boolList);
  m.put("empty-set",new HashSet());
  Set<String> stringSet=new LinkedHashSet<String>();
  stringSet.add("Hello there");
  stringSet.add("How are you?");
  m.put("string-set",stringSet);
  int[] intArray=new int[]{1,2};
  m.put("int-array",intArray);
  String xml="<xml>" + LF + "<t1 xmlns=\"http://www.acme.org/xmlns/other/v1.0.0\">"+ LF+ "<foo type='bar'>haha</foo>"+ LF+ "</t1>"+ LF+ "</xml>";
  m.put("someXML",xml);
  String actual=LocalDiscoveryUtils.getEndpointDescriptionXML(m);
  URL edURL=getClass().getResource("/ed2-generated.xml");
  String expected=new String(drainStream(edURL.openStream()));
  assertEquals(normXML(expected),normXML(actual));
}
 

Example 51

From project Cyborg, under directory /src/main/java/com/alta189/cyborg/api/util/config/.

Source file: AbstractConfigurationNodeSource.java

  15 
vote

@Override public Set<String> getKeys(boolean deep){
  Set<String> keys=new LinkedHashSet<String>(deep ? children.size() * 2 : children.size());
  for (  Map.Entry<String,ConfigurationNode> entry : children.entrySet()) {
    keys.add(entry.getKey());
    if (deep) {
      for (      String key : entry.getValue().getKeys(true)) {
        keys.add(entry.getKey() + getConfiguration().getPathSeparator() + key);
      }
    }
  }
  return keys;
}
 

Example 52

From project DirectMemory, under directory /DirectMemory-Cache/src/main/java/org/apache/directmemory/memory/allocator/.

Source file: MergingByteBufferAllocatorImpl.java

  15 
vote

/** 
 * Initialization function. Create an initial free  {@link Pointer} mapping the whole buffer.
 */
protected void init(){
  Integer totalSize=Integer.valueOf(parentBuffer.capacity());
  for (  Integer i : generateFreeSizesRange(totalSize)) {
    freePointers.put(Integer.valueOf(i),new LinkedHashSet<LinkedByteBuffer>());
  }
  initFirstBuffer();
}
 

Example 53

From project dmix, under directory /JmDNS/src/javax/jmdns/impl/.

Source file: ServiceInfoImpl.java

  15 
vote

ServiceInfoImpl(Map<Fields,String> qualifiedNameMap,int port,int weight,int priority,boolean persistent,byte text[]){
  Map<Fields,String> map=ServiceInfoImpl.checkQualifiedNameMap(qualifiedNameMap);
  this._domain=map.get(Fields.Domain);
  this._protocol=map.get(Fields.Protocol);
  this._application=map.get(Fields.Application);
  this._name=map.get(Fields.Instance);
  this._subtype=map.get(Fields.Subtype);
  this._port=port;
  this._weight=weight;
  this._priority=priority;
  this._text=text;
  this.setNeedTextAnnouncing(false);
  this._state=new ServiceInfoState(this);
  this._persistent=persistent;
  this._ipv4Addresses=Collections.synchronizedSet(new LinkedHashSet<Inet4Address>());
  this._ipv6Addresses=Collections.synchronizedSet(new LinkedHashSet<Inet6Address>());
}
 

Example 54

From project dozer, under directory /core/src/main/java/org/dozer/loader/.

Source file: CustomMappingsLoader.java

  15 
vote

public LoadMappingsResult load(List<String> mappingFiles,List<MappingFileData> builderMappings){
  RuntimeException exception=null;
  List<MappingFileData> mappingFileDataList=new ArrayList<MappingFileData>();
  try {
    mappingFileDataList=loadFromFiles(mappingFiles);
  }
 catch (  RuntimeException ex) {
    log.error("Error during loadFromFiles()",ex);
    exception=ex;
  }
  mappingFileDataList.addAll(builderMappings);
  Configuration globalConfiguration=findConfiguration(mappingFileDataList);
  ClassMappings customMappings=new ClassMappings();
  for (  MappingFileData mappingFileData : mappingFileDataList) {
    List<ClassMap> classMaps=mappingFileData.getClassMaps();
    ClassMappings customMappingsPrime=mappingsParser.processMappings(classMaps,globalConfiguration);
    customMappings.addAll(customMappingsPrime);
  }
  ClassMapBuilder.addDefaultFieldMappings(customMappings,globalConfiguration);
  Set<CustomConverterDescription> customConverterDescriptions=new LinkedHashSet<CustomConverterDescription>();
  if (globalConfiguration.getCustomConverters() != null && globalConfiguration.getCustomConverters().getConverters() != null) {
    for (    CustomConverterDescription cc : globalConfiguration.getCustomConverters().getConverters()) {
      customConverterDescriptions.add(cc);
    }
  }
  for (  Entry<String,ClassMap> entry : customMappings.getAll().entrySet()) {
    ClassMap classMap=entry.getValue();
    if (classMap.getCustomConverters() != null) {
      classMap.getCustomConverters().setConverters(new ArrayList<CustomConverterDescription>(customConverterDescriptions));
    }
 else {
      classMap.setCustomConverters(new CustomConverterContainer());
      classMap.getCustomConverters().setConverters(new ArrayList<CustomConverterDescription>(customConverterDescriptions));
    }
  }
  return new LoadMappingsResult(customMappings,globalConfiguration,exception);
}
 

Example 55

From project drools-planner, under directory /drools-planner-benchmark/src/main/java/org/drools/planner/benchmark/config/.

Source file: PlannerBenchmarkConfig.java

  15 
vote

protected void generateSolverBenchmarkConfigNames(){
  Set<String> nameSet=new HashSet<String>(solverBenchmarkConfigList.size());
  Set<SolverBenchmarkConfig> noNameBenchmarkConfigSet=new LinkedHashSet<SolverBenchmarkConfig>(solverBenchmarkConfigList.size());
  for (  SolverBenchmarkConfig solverBenchmarkConfig : solverBenchmarkConfigList) {
    if (solverBenchmarkConfig.getName() != null) {
      boolean unique=nameSet.add(solverBenchmarkConfig.getName());
      if (!unique) {
        throw new IllegalStateException("The benchmark name (" + solverBenchmarkConfig.getName() + ") is used in more than 1 benchmark.");
      }
    }
 else {
      noNameBenchmarkConfigSet.add(solverBenchmarkConfig);
    }
  }
  int generatedNameIndex=0;
  for (  SolverBenchmarkConfig solverBenchmarkConfig : noNameBenchmarkConfigSet) {
    String generatedName="Config_" + generatedNameIndex;
    while (nameSet.contains(generatedName)) {
      generatedNameIndex++;
      generatedName="Config_" + generatedNameIndex;
    }
    solverBenchmarkConfig.setName(generatedName);
    generatedNameIndex++;
  }
}
 

Example 56

From project eclipse-integration-commons, under directory /org.springsource.ide.eclipse.commons.content.core/src/org/springsource/ide/eclipse/commons/content/core/util/.

Source file: Descriptor.java

  15 
vote

public void addDependency(Dependency dependency){
  if (dependencies == null) {
    dependencies=new LinkedHashSet<Dependency>();
  }
  dependencies.add(dependency);
}
 

Example 57

From project eclipse-integration-gradle, under directory /org.springsource.ide.eclipse.gradle.core/src/org/springsource/ide/eclipse/gradle/core/.

Source file: ClassPath.java

  15 
vote

public Collection<IClasspathEntry> createEntrySet(int size){
  if (enableSorting) {
    return new TreeSet<IClasspathEntry>(new ClasspathEntryComparator());
  }
 else {
    return new LinkedHashSet<IClasspathEntry>();
  }
}
 

Example 58

From project eclipse.platform.runtime, under directory /bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/.

Source file: EclipseContext.java

  15 
vote

public void dispose(){
  for (  EclipseContext childContext : getChildren()) {
    childContext.dispose();
  }
  activeComputations.clear();
  ContextChangeEvent event=new ContextChangeEvent(this,ContextChangeEvent.DISPOSE,null,null,null);
  Set<Scheduled> scheduled=new LinkedHashSet<Scheduled>();
  Set<Computation> allComputations=getListeners();
  listeners.clear();
  for (  Computation computation : allComputations) {
    computation.handleInvalid(event,scheduled);
  }
  processScheduled(scheduled);
synchronized (notifyOnDisposal) {
    for (    IContextDisposalListener listener : notifyOnDisposal) {
      listener.disposed(this);
    }
  }
  localValueComputations.clear();
  EclipseContext parent=getParent();
  if (parent != null) {
    if (this == parent.getActiveChild())     parent.set(ACTIVE_CHILD,null);
  }
  localValues.clear();
  if (parent != null)   parent.removeChild(this);
  if (debugAddOn != null)   debugAddOn.notify(this,IEclipseContextDebugger.EventType.DISPOSED,null);
}
 

Example 59

From project elasticsearch-osem, under directory /src/main/java/org/elasticsearch/osem/common/springframework/util/.

Source file: ClassUtils.java

  15 
vote

/** 
 * Return all interfaces that the given class implements as Set, including ones implemented by superclasses. <p>If the class itself is an interface, it gets returned as sole interface.
 * @param clazz the class to analyze for interfaces
 * @param classLoader the ClassLoader that the interfaces need to be visible in(may be <code>null</code> when accepting all declared interfaces)
 * @return all interfaces that the given object implements as Set
 */
public static Set<Class> getAllInterfacesForClassAsSet(Class clazz,ClassLoader classLoader){
  Assert.notNull(clazz,"Class must not be null");
  if (clazz.isInterface() && isVisible(clazz,classLoader)) {
    return Collections.singleton(clazz);
  }
  Set<Class> interfaces=new LinkedHashSet<Class>();
  while (clazz != null) {
    Class<?>[] ifcs=clazz.getInterfaces();
    for (    Class<?> ifc : ifcs) {
      interfaces.addAll(getAllInterfacesForClassAsSet(ifc,classLoader));
    }
    clazz=clazz.getSuperclass();
  }
  return interfaces;
}
 

Example 60

From project ElasticSearchExample, under directory /src/main/java/de/jetwick/ese/ui/.

Source file: FacetPanel.java

  15 
vote

public void update(SearchResponse rsp,MyQuery query){
  normalFacetFields.clear();
  if (rsp != null) {
    for (    Entry<String,List<FacetHelper>> entry : createFacetsFields(rsp)) {
      if (entry != null) {
        normalFacetFields.add(entry);
      }
    }
  }
  alreadyFiltered=new LinkedHashSet<String>();
  for (  String f : query.getFilters()) {
    alreadyFiltered.add(f);
  }
}
 

Example 61

From project EMF-IncQuery, under directory /plugins/org.eclipse.viatra2.gtasm.patternmatcher.incremental.rete/src/org/eclipse/viatra2/gtasm/patternmatcher/incremental/rete/misc/.

Source file: DeltaMonitor.java

  15 
vote

/** 
 * @param reteContainer
 */
public DeltaMonitor(ReteContainer reteContainer){
  super(reteContainer);
  matchFoundEvents=new LinkedHashSet<MatchType>();
  matchLostEvents=new LinkedHashSet<MatchType>();
  reteContainer.registerClearable(this);
}
 

Example 62

From project Empire, under directory /core/src/com/clarkparsia/empire/util/.

Source file: BeanReflectUtil.java

  15 
vote

/** 
 * Create an instance of the specifiec collection.  If the type cannot be instantiated directly, such as List, or Set, we'll try and figure out which type of collection is desired and return the standard implementation for that type, for example ArrayList or HashSet.
 * @param theValueType the type of collection to instantiate
 * @return the instantiated collection
 * @throws RuntimeException if there is no way to instantiate any matching collection
 */
public static Collection<Object> instantiateCollectionFromField(Class theValueType){
  try {
    return (Collection<Object>)theValueType.newInstance();
  }
 catch (  Throwable e) {
    if (List.class.isAssignableFrom(theValueType)) {
      return new ArrayList<Object>();
    }
 else     if (Set.class.isAssignableFrom(theValueType)) {
      if (SortedSet.class.isAssignableFrom(theValueType)) {
        return new TreeSet<Object>();
      }
 else {
        return new LinkedHashSet<Object>();
      }
    }
 else     if (Collection.class.equals(theValueType)) {
      return new LinkedHashSet<Object>();
    }
 else {
      throw new RuntimeException("Unknown or unsupported collection type for a field: " + theValueType);
    }
  }
}
 

Example 63

From project enclojure, under directory /netbeans/plugins/org-enclojure-plugin/src/main/java/org/enclojure/ide/nb/clojure/project/.

Source file: ClojureTemplateWizardIterator.java

  15 
vote

public Set instantiate() throws IOException {
  Set<FileObject> resultSet=new LinkedHashSet<FileObject>();
  File dirF=(File)wiz.getProperty("projdir");
  dirF.mkdirs();
  FileObject template=Templates.getTemplate(wiz);
  try {
    ClojureTemplatePanelVisual component=(ClojureTemplatePanelVisual)current().getComponent();
    unZipFile(template.getInputStream(),dirF,component.packageNameTextField.getText(),component.getProjectName());
  }
 catch (  Exception ex) {
    Exceptions.printStackTrace(ex);
  }
  FileObject dir=FileUtil.toFileObject(dirF);
  resultSet.add(dir);
  Enumeration<? extends FileObject> e=dir.getFolders(true);
  while (e.hasMoreElements()) {
    FileObject subfolder=e.nextElement();
    if (ProjectManager.getDefault().isProject(subfolder)) {
      resultSet.add(subfolder);
    }
  }
  File parent=dirF.getParentFile();
  if (parent != null && parent.exists()) {
    ProjectChooser.setProjectsFolder(parent);
  }
  return resultSet;
}
 

Example 64

From project esbt, under directory /src/org/scalastuff/esbt/.

Source file: ProjectInfo.java

  15 
vote

private Set<ProjectInfo> findProjectDependencies(){
  Set<ProjectInfo> projectDeps=new LinkedHashSet<ProjectInfo>();
  for (  Dependency dep : getDependencies()) {
    ProjectInfo depPrj=findProjectDependency(dep);
    if (depPrj != null)     projectDeps.add(depPrj);
  }
  return projectDeps;
}
 

Example 65

From project Extlet6, under directory /liferay-6.0.5-patch/portal-impl/src/com/liferay/portal/service/impl/.

Source file: PortletLocalServiceImpl.java

  15 
vote

private Set<String> _readWebXML(String xml) throws Exception {
  Set<String> servletURLPatterns=new LinkedHashSet<String>();
  if (xml == null) {
    return servletURLPatterns;
  }
  Document document=SAXReaderUtil.read(xml);
  Element rootElement=document.getRootElement();
  for (  Element servletMappingElement : rootElement.elements("servlet-mapping")) {
    String urlPattern=servletMappingElement.elementText("url-pattern");
    servletURLPatterns.add(urlPattern);
  }
  return servletURLPatterns;
}
 

Example 66

From project fest-assert-2.x, under directory /src/main/java/org/fest/assertions/internal/.

Source file: Iterables.java

  15 
vote

/** 
 * Asserts that the given  {@code Iterable} contains the given values, in any order.
 * @param info contains information about the assertion.
 * @param actual the given {@code Iterable}.
 * @param values the values that are expected to be in the given {@code Iterable}.
 * @throws NullPointerException if the array of values is {@code null}.
 * @throws IllegalArgumentException if the array of values is empty.
 * @throws AssertionError if the given {@code Iterable} is {@code null}.
 * @throws AssertionError if the given {@code Iterable} does not contain the given values.
 */
public void assertContains(AssertionInfo info,Iterable<?> actual,Object[] values){
  checkIsNotNullAndNotEmpty(values);
  assertNotNull(info,actual);
  Set<Object> notFound=new LinkedHashSet<Object>();
  for (  Object value : values) {
    if (!iterableContains(actual,value)) {
      notFound.add(value);
    }
  }
  if (notFound.isEmpty()) {
    return;
  }
  throw failures.failure(info,shouldContain(actual,values,notFound,comparisonStrategy));
}
 

Example 67

From project fest-util, under directory /src/main/java/org/fest/util/.

Source file: Collections.java

  15 
vote

/** 
 * Returns any duplicate elements from the given  {@code Collection}.
 * @param < T > the generic type of the given {@code Collection}.
 * @param c the given {@code Collection} that might have duplicate elements.
 * @return a {@code Collection} containing the duplicate elements of the given one. If no duplicates are found, anempty  {@code Collection} is returned.
 */
public static <T>Collection<T> duplicatesFrom(Collection<T> c){
  Set<T> duplicates=new LinkedHashSet<T>();
  if (isNullOrEmpty(c)) {
    return duplicates;
  }
  Set<T> noDuplicates=new HashSet<T>();
  for (  T e : c) {
    if (noDuplicates.contains(e)) {
      duplicates.add(e);
      continue;
    }
    noDuplicates.add(e);
  }
  return duplicates;
}
 

Example 68

From project fiftyfive-wicket, under directory /fiftyfive-wicket-core/src/main/java/fiftyfive/wicket/css/.

Source file: CssClassModifier.java

  15 
vote

/** 
 * Parse any existing classes declared in the markup for this component and then delegate to  {@link #modifyClasses modifyClasses()}. Set resulting set of classes on the component tag to render its  {@code class} attribute with the desired values.
 */
@Override public void onComponentTag(Component component,ComponentTag tag){
  if (tag.getType() != TagType.CLOSE) {
    Set<String> values=new LinkedHashSet<String>();
    String existing=tag.getAttribute("class");
    if (existing != null) {
      values.addAll(Arrays.asList(existing.split("\\s+")));
    }
    modifyClasses(component,values);
    tag.put("class",Strings.join(" ",values.toArray(new String[0])));
  }
}
 

Example 69

From project figgo, under directory /src/main/java/br/octahedron/figgo/modules/user/.

Source file: UserSpec.java

  15 
vote

@Override public Set<Class<? extends Subscriber>> getSubscribers(){
  Set<Class<? extends Subscriber>> subscribers=new LinkedHashSet<Class<? extends Subscriber>>();
  subscribers.add(UsersUploadSubscriber.class);
  subscribers.add(DomainUserSubscriber.class);
  return subscribers;
}
 

Example 70

From project flatpack-java, under directory /demo-server/src/main/java/com/getperka/flatpack/demo/server/.

Source file: DemoApplication.java

  15 
vote

@Override public Set<Object> getSingletons(){
  Set<Object> toReturn=new LinkedHashSet<Object>();
  Configuration configuration=new Configuration().addEntityResolver(new FakeDatabaseResolver()).addPersistenceMapper(new FakePersistenceMapper()).addTypeSource(new SearchTypeSource("com.getperka.flatpack.demo.server")).withPrettyPrint(true).withPrincipalMapper(new DemoPrincipalMapper()).withRoleMapper(new DemoRoleMapper()).withVerbose(true);
  toReturn.add(new FlatPackResolver(configuration));
  toReturn.add(new FlatPackProvider());
  toReturn.add(new DemoResource(db));
  return toReturn;
}
 

Example 71

From project flexmojos, under directory /flexmojos-maven-plugin/src/main/java/net/flexmojos/oss/plugin/.

Source file: AbstractMavenMojo.java

  15 
vote

protected List<String> filterClasses(List<FileSet> classesPattern,File[] directories){
  directories=PathUtil.existingFiles(directories);
  Set<String> includedFiles=new LinkedHashSet<String>();
  for (  FileSet pattern : classesPattern) {
    pattern.setIncludes(toFilePattern(pattern.getIncludes()));
    pattern.setExcludes(toFilePattern(pattern.getExcludes()));
    if (pattern.getDirectory() == null) {
      for (      File dir : directories) {
        includedFiles.addAll(Arrays.asList(scan(pattern,dir).getIncludedFiles()));
      }
    }
 else {
      File dir=PathUtil.file(pattern.getDirectory(),getBasedir());
      if (!ArrayUtils.contains(directories,dir)) {
        throw new IllegalArgumentException("Pattern does point to an invalid source directory: " + dir.getAbsolutePath());
      }
      includedFiles.addAll(Arrays.asList(scan(pattern,dir).getIncludedFiles()));
    }
  }
  List<String> classes=new ArrayList<String>();
  for (  String filename : includedFiles) {
    String classname=toClass(filename);
    classes.add(classname);
  }
  return classes;
}
 

Example 72

From project Foglyn, under directory /com.foglyn.ui/src/com/foglyn/ui/.

Source file: FoglynTaskEditorPage.java

  15 
vote

@Override protected Set<TaskEditorPartDescriptor> createPartDescriptors(){
  Set<TaskEditorPartDescriptor> descriptors=super.createPartDescriptors();
  Set<TaskEditorPartDescriptor> result=new LinkedHashSet<TaskEditorPartDescriptor>();
  result.add(new TaskEditorPartDescriptor(ID_PART_COMMENTS){
    @Override public AbstractTaskEditorPart createPart(){
      return new TaskEditorFogbugzEventsPart();
    }
  }
.setPath(PATH_COMMENTS));
  for (  TaskEditorPartDescriptor taskEditorPartDescriptor : descriptors) {
    if (taskEditorPartDescriptor.getId().equals(ID_PART_COMMENTS)) {
      continue;
    }
    if (taskEditorPartDescriptor.getId().equals(ID_PART_PLANNING)) {
      continue;
    }
    if (taskEditorPartDescriptor.getId().equals(ID_PART_DESCRIPTION)) {
      continue;
    }
    result.add(taskEditorPartDescriptor);
  }
  return result;
}
 

Example 73

From project galaxy, under directory /src/co/paralleluniverse/galaxy/core/.

Source file: Cache.java

  15 
vote

private void addPendingMessage(CacheLine line,LineMessage message){
  HashSet<LineMessage> msgs=pendingMessages.get(line.getId());
  if (msgs == null) {
    msgs=new LinkedHashSet<LineMessage>();
    pendingMessages.put(line.getId(),msgs);
  }
  msgs.add(message);
}
 

Example 74

From project gatein-common, under directory /common/src/main/java/org/gatein/common/util/.

Source file: Tools.java

  15 
vote

/** 
 * Transforms an iterator into a Set
 * @param iterator      The iterator to transform
 * @param preserveOrder true if the set must respect the ordering of the iterator
 * @return a LinkedHashSet if ordered is true, a HashSet otherwise
 */
public static <E>Set<E> toSet(Iterator<E> iterator,boolean preserveOrder){
  if (iterator == null) {
    throw new IllegalArgumentException();
  }
  Set<E> set;
  if (preserveOrder) {
    set=new LinkedHashSet<E>();
  }
 else {
    set=new HashSet<E>();
  }
  while (iterator.hasNext()) {
    set.add(iterator.next());
  }
  return set;
}
 

Example 75

From project gatein-management, under directory /api/src/main/java/org/gatein/management/api/operation/model/.

Source file: ReadResourceModel.java

  15 
vote

public Set<String> getChildren(){
  Set<String> childNames=new LinkedHashSet<String>(children.size());
  for (  NamedDescription nd : children) {
    childNames.add(nd.getName());
  }
  return Collections.unmodifiableSet(childNames);
}
 

Example 76

From project gatein-mop, under directory /core/src/main/java/org/gatein/mop/core/api/workspace/content/.

Source file: AbstractCustomization.java

  15 
vote

public Set<CustomizationContext> getContexts(){
  AbstractCustomization current=this;
  LinkedHashSet<CustomizationContext> contexts=new LinkedHashSet<CustomizationContext>();
  while (true) {
    CustomizationContext currentContext=current.getContext();
    if (currentContext == null) {
      throw new IllegalStateException("Could not resolve customization context for customization " + this);
    }
    contexts.add(currentContext);
    AbstractCustomization parent=current.getParent();
    if (parent != null) {
      current=parent;
    }
 else {
      break;
    }
  }
  return contexts;
}
 

Example 77

From project gda-common, under directory /uk.ac.gda.common/src/uk/ac/gda/doe/.

Source file: DOEUtils.java

  15 
vote

/** 
 * Reads the fields defined with a DOEField annotation and returns a list of objects used to describe the range. Each RangeInfo represents on experiment with the 
 * @param bean
 * @return list of expanded
 * @throws IllegalAccessException 
 * @throws IllegalArgumentException 
 */
public static List<RangeInfo> getInfo(final Object bean) throws Exception {
  final List<Collection<FieldContainer>> weightedFields=new ArrayList<Collection<FieldContainer>>(11);
  for (int i=0; i < 11; i++)   weightedFields.add(new LinkedHashSet<FieldContainer>(7));
  readAnnotations(null,bean,weightedFields,-1);
  List<FieldContainer> expandedFields=expandFields(weightedFields);
  final List<RangeInfo> ret=new ArrayList<RangeInfo>(31);
  getInfo(new RangeInfo(),expandedFields,0,ret);
  return ret;
}