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


Java QuickSort类代码示例

本文整理汇总了Java中com.ibm.commons.util.QuickSort的典型用法代码示例。如果您正苦于以下问题:Java QuickSort类的具体用法?Java QuickSort怎么用?Java QuickSort使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: sortDataProviders

import com.ibm.commons.util.QuickSort; //导入依赖的package包/类
protected void sortDataProviders(final String[] providerList, DeviceDataProvider[] providers) {
    (new QuickSort.ObjectArray(providers) {
        @Override
        public int compare(Object o1, Object o2) {
            DeviceDataProvider p1 = (DeviceDataProvider)o1; 
            DeviceDataProvider p2 = (DeviceDataProvider)o2;
            // Compare their position in the list
            int p = indexOf(providerList, p1.getName())-indexOf(providerList, p2.getName());
            if(p!=0) {
                return p;
            }
            // Then compare their respective weight
            int w1 = ((DeviceDataProvider)o1).getWeight();
            int w2 = ((DeviceDataProvider)o2).getWeight();
            return w1-w2;
        }
    }).sort();
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:19,代码来源:DeviceServicesFactory.java

示例2: sortDataProviders

import com.ibm.commons.util.QuickSort; //导入依赖的package包/类
protected void sortDataProviders(final String[] providerList, PeopleDataProvider[] providers) {
    (new QuickSort.ObjectArray(providers) {
        @Override
        public int compare(Object o1, Object o2) {
            PeopleDataProvider p1 = (PeopleDataProvider)o1; 
            PeopleDataProvider p2 = (PeopleDataProvider)o2;
            // Compare their position in the list
            int p = indexOf(providerList, p1.getName())-indexOf(providerList, p2.getName());
            if(p!=0) {
                return p;
            }
            // Then compare their respective weight
            int w1 = ((PeopleDataProvider)o1).getWeight();
            int w2 = ((PeopleDataProvider)o2).getWeight();
            return w1-w2;
        }
    }).sort();
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:19,代码来源:SocialServicesFactory.java

示例3: getPropertyKeys

import com.ibm.commons.util.QuickSort; //导入依赖的package包/类
@Override
  public Iterator<Object> getPropertyKeys(String category) {
Collection<String> names = definition.getPropertyNames();
ArrayList<Object> list = new ArrayList<Object>();
for(String s: names) {
	//FacesProperty prop = definition.getProperty(s);
	// Check the category here...
	list.add(s);
}
(new QuickSort.JavaList(list)).sort();
// Pseudo properties, at the end
if(object instanceof UIComponent) {
	UIComponent c = (UIComponent)object;
	list.add("children");//$NON-NLS-1$
	list.add("facets");//$NON-NLS-1$
}
return list.iterator();
  }
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:19,代码来源:XPagesDumpFactory.java

示例4: readStates

import com.ibm.commons.util.QuickSort; //导入依赖的package包/类
private static final String[][] readStates(final int searchIndex) {
	if(states==null) {
		try {
			String[] allStates = SampleDataUtil.readStates();
			states = new String[allStates.length][];
			for(int i=0; i<states.length; i++) {
				states[i] = StringUtil.splitString(allStates[i], ',', true);
			}
			// Sort by Label
			(new QuickSort.ObjectArray(states) {
				@Override
				public int compare(Object s1, Object s2) {
					String l1 = ((String[])s1)[searchIndex];
					String l2 = ((String[])s2)[searchIndex];
					return StringUtil.compareToIgnoreCase(l1, l2);
				}
			}).sort();
		} catch(IOException e) {
			throw new FacesExceptionEx("Unable to read the state list");
		}
	}
	return states;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:24,代码来源:SimplePicker.java

示例5: updateDesignElements

import com.ibm.commons.util.QuickSort; //导入依赖的package包/类
/**
 * 
 */
protected void updateDesignElements() {
    designElements = designerProject.getDesignElements(typeId);
    folderCount = getNavigatorFolderCount();
    new QuickSort.ObjectArray(designElements) {
        public int compare(Object o1, Object o2) {
            if(null != o1 && null != o2){
                return StringUtil.compareToIgnoreCase(o1.toString(),o2.toString());
            }
            return 0;
        }
    }.sort();
    notifyLookupChanged();
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:17,代码来源:ExtLibDesignElementLookup.java

示例6: sort

import com.ibm.commons.util.QuickSort; //导入依赖的package包/类
private void sort(List<Definition> list) {
    (new QuickSort.JavaList(list){
        public int compare(Object o1, Object o2) {
            String s1 = ((Definition)o1).getDisplayName();
            String s2 = ((Definition)o2).getDisplayName();
            return s1.compareToIgnoreCase(s2);
        }            
    }).sort();
    for (Definition def : list) {
        sort(def.getChildrenList());
    }
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:13,代码来源:Registry.java

示例7: getPropertyKeys

import com.ibm.commons.util.QuickSort; //导入依赖的package包/类
@Override
public Iterator<Object> getPropertyKeys(String category) {
    ArrayList<Object> list = new ArrayList<Object>();
    getAllPropertyKeys(category,list);
    (new QuickSort.JavaList(list)).sort();
    return list.iterator();
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:8,代码来源:JavaDumpFactory.java

示例8: loadEntries

import com.ibm.commons.util.QuickSort; //导入依赖的package包/类
public List<IPickerEntry> loadEntries(Object[] ids, String[] attributeNames) {
    FacesContext context = FacesContext.getCurrentInstance();
    List<IPickerEntry> entries = new ArrayList<IPickerEntry>(ids.length);
    for(int i=0; i<ids.length; i++) {
        entries.add(null);
    }
    String labelSep = getLabelSeparator();
    if(StringUtil.isEmpty(labelSep)) {
        labelSep = null;
    }
    final boolean searchLabel = labelSep!=null; 
    int start = 0;
    int count = Integer.MAX_VALUE;
    String startKey = null;
    for(int i=0; i<ids.length; i++) {
        Object key = ids[i];
        List<ShadowedObject> _shadowedData = pushVar(context, start, count, key, startKey);
        try {
            Object values = getValueList();
            if(values!=null) {
                boolean caseInsensitive = isCaseInsensitive();
                for(Iterator<Object> it=getIterator(values); it.hasNext(); ) {
                    Object o = it.next();
                    if(o!=null) {
                        IPickerEntry e = getEntry(o,labelSep);
                        if(e!=null) {
                            //String value = toString(searchLabel?e.getLabel():e.getValue());
                            String value = toString(e.getValue());
                            if(caseInsensitive) {
                                if(StringUtil.equalsIgnoreCase(value,ids[i].toString())) {
                                    entries.set(i,e);
                                    break;
                                }
                            } else {
                                if(StringUtil.equals(value,ids[i])) {
                                    entries.set(i,e);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        } finally {
            popVar(context,_shadowedData);
        }
    }
    // Sort the entries
    (new QuickSort.JavaList(entries) {
        @Override
        public int compare(Object o1, Object o2) {
            if(o1==null) {
                if(o2==null) return 0;
                return -1;
            }
            if(o2==null) {
                return 1;
            }
            String s1 = SimpleValuePickerData.toString(searchLabel ? ((IPickerEntry)o1).getLabel() : ((IPickerEntry)o1).getValue());
            String s2 = SimpleValuePickerData.toString(searchLabel ? ((IPickerEntry)o2).getLabel() : ((IPickerEntry)o2).getValue());
            return StringUtil.compareToIgnoreCase(s1, s2);
        }
    }).sort();
    return entries;
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:66,代码来源:SimpleValuePickerData.java

示例9: DatabaseMetaDataMap

import com.ibm.commons.util.QuickSort; //导入依赖的package包/类
public DatabaseMetaDataMap(DumpContext dumpContext, DatabaseMetaData d) {
    super(dumpContext,"Database Meta Data"); // $NON-NLS-1$
    try {
        addCategory("Database & Driver"); // $NLS-JdbcDumpFactory.DatabaseDriver-1$
        addValue("getDatabaseProductName()", d.getDatabaseProductName()); // $NON-NLS-1$
        addValue("getDatabaseProductVersion()", d.getDatabaseProductVersion()); // $NON-NLS-1$
        addValue("getDriverName()", d.getDriverName()); // $NON-NLS-1$
        addValue("getDriverVersion()", d.getDriverVersion()); // $NON-NLS-1$

        addCategory("All Properties"); // $NLS-JdbcDumpFactory.AllProperties-1$
        // Read all the methods from this class that don't take a parameter and return a simple type
        // then add them as a property
        Method[] allMethods = d.getClass().getMethods();
        (new QuickSort.ObjectArray(allMethods) {
            @Override
            public int compare(Object o1, Object o2) {
                Method m1 = (Method)o1;
                Method m2 = (Method)o2;
                return m1.getName().compareTo(m2.getName());
            }
        }).sort();
        for(int i=0; i<allMethods.length; i++) {
            Method m = allMethods[i];
            if(m.getParameterTypes().length!=0) {
                continue;
            }
            Class<?> ret = m.getReturnType();
            if(ret==String.class || ret==Boolean.TYPE || ret==Integer.TYPE || ret==Long.TYPE) {
                String name = m.getName();
                if(name.equals("getClass") || name.equals("hashCode") || name.equals("toString")) { // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
                    continue;
                }
                
                Object value = m.invoke(d);
                addValue(m.getName(), value);
            }
        }
    } catch(Exception ex) {
        if(RelationalLogger.RELATIONAL.isErrorEnabled()) {
            RelationalLogger.RELATIONAL.errorp(this, "DatabaseMetaDataMap", ex, "Exception during creation of DatabaseMetaDataMap"); // $NON-NLS-1$ $NLE-JdbcDumpFactory.ExceptionduringcreationofDatabase-2$
        }
        addValue("Exception", ex.getMessage()); // $NON-NLS-1$
    }
    
}
 
开发者ID:OpenNTF,项目名称:XPagesExtensionLibrary,代码行数:46,代码来源:JdbcDumpFactory.java


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