Java Code Examples for java.util.TreeMap
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 Application-Builder, under directory /src/main/java/org/silverpeas/version/.
Source file: ApplicationInfo.java

public static Map getPackages() throws IOException { if (thePackages == null) { File versionDirectory=new File(DirectoryLocator.getVersionHome()); String[] versionNames=versionDirectory.list(new VersionFilter()); thePackages=new TreeMap(); PackageInfo aPackage=null; for (int i=0; i < versionNames.length; i++) { aPackage=new PackageInfo(new File(versionDirectory,versionNames[i])); thePackages.put(aPackage.getName(),aPackage); } } return thePackages; }
Example 2
From project Android_1, under directory /org.eclipse.ecf.android/src/org/eclipse/ecf/android/.
Source file: SOContainerGMM.java

SOContainerGMM(SOContainer cont,Member local){ container=cont; groupManager=new GMMImpl(); groupManager.addObserver(this); loading=new TreeMap(); active=new TreeMap(); localMember=local; addMember(local); }
Example 3
From project CircDesigNA, under directory /src/circdesigna/abstractDesigner/.
Source file: EPDesigner.java

public void runBlockIteration_(CircDesigNA runner,double endThreshold){ TreeMap<Double,T> sorted=new TreeMap(); for (int i=0; i < populationSize; i++) { T toMutate=population_mutable[i]; SingleDesigner.mutateAndTestAndBackup(toMutate); sorted.put(SingleDesigner.getOverallScore(toMutate),toMutate); } ; setBestChild(sorted.get(sorted.firstKey())); }
Example 4
From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/view/presenter/.
Source file: MeasurementPresenter.java

protected synchronized CopyOnWriteArrayList<Measurement> prepareTimelineView(){ if (!timelineView.isEmpty()) return null; Stopwatch stopwatch=new Stopwatch().start(); final List<Measurement> measurements=getFullView(); int position=measurements.size() - 1 - anchor; final long lastMeasurementTime=measurements.isEmpty() ? 0 : measurements.get(position).getTime().getTime(); timelineView.clear(); TreeMap<Long,Measurement> measurementsMap=new TreeMap<Long,Measurement>(); for ( Measurement m : measurements) { measurementsMap.put(m.getTime().getTime(),m); } timelineView.addAll(measurementsMap.subMap(lastMeasurementTime - visibleMilliseconds,lastMeasurementTime + 1).values()); measurementsSize=measurements.size(); Constants.logGraphPerformance("prepareTimelineView for [" + timelineView.size() + "] took "+ stopwatch.elapsedMillis()); return timelineView; }
Example 5
From project airlift, under directory /configuration/src/main/java/io/airlift/configuration/testing/.
Source file: ConfigAssertions.java

public static <T>void assertRecordedDefaults(T recordedConfig){ $$RecordedConfigData<T> recordedConfigData=getRecordedConfig(recordedConfig); Set<Method> invokedMethods=recordedConfigData.getInvokedMethods(); T config=recordedConfigData.getInstance(); Class<T> configClass=(Class<T>)config.getClass(); ConfigurationMetadata<?> metadata=ConfigurationMetadata.getValidConfigurationMetadata(configClass); Map<String,Object> attributeValues=new TreeMap<String,Object>(); Set<String> setDeprecatedAttributes=new TreeSet<String>(); Set<Method> validSetterMethods=new HashSet<Method>(); for ( AttributeMetadata attribute : metadata.getAttributes().values()) { if (attribute.getInjectionPoint().getProperty() != null) { validSetterMethods.add(attribute.getInjectionPoint().getSetter()); } if (invokedMethods.contains(attribute.getInjectionPoint().getSetter())) { if (attribute.getInjectionPoint().getProperty() != null) { Object value=invoke(config,attribute.getGetter()); attributeValues.put(attribute.getName(),value); } else { setDeprecatedAttributes.add(attribute.getName()); } } } if (!setDeprecatedAttributes.isEmpty()) { Assert.fail("Invoked deprecated attribute setter methods: " + setDeprecatedAttributes); } if (!validSetterMethods.containsAll(invokedMethods)) { Set<Method> invalidInvocations=new HashSet<Method>(invokedMethods); invalidInvocations.removeAll(validSetterMethods); Assert.fail("Invoked non-attribute setter methods: " + invalidInvocations); } assertDefaults(attributeValues,configClass); }
Example 6
From project Catroid-maven-playground, under directory /src/main/java/at/tugraz/ist/catroid/io/.
Source file: CatroidFieldKeySorter.java

@SuppressWarnings({"unchecked","rawtypes"}) public Map sort(final Class type,final Map keyedByFieldKey){ final Map map=new TreeMap(new Comparator(){ public int compare( final Object o1, final Object o2){ final FieldKey fieldKey1=(FieldKey)o1; final FieldKey fieldKey2=(FieldKey)o2; int i=fieldKey1.getDepth() - fieldKey2.getDepth(); if (i == 0) { String fieldNameOrAlias1=getFieldNameOrAlias(fieldKey1); String fieldNameOrAlias2=getFieldNameOrAlias(fieldKey2); i=fieldNameOrAlias1.compareTo(fieldNameOrAlias2); } return i; } } ); map.putAll(keyedByFieldKey); return map; }
Example 7
From project 3Dto2DApplet, under directory /src/java/nl/dannyarends/generator/model/.
Source file: AbstractGenerator.java

public Map<String,Object> createArguments(){ Map<String,Object> args=new TreeMap<String,Object>(); Calendar calendar=Calendar.getInstance(); args.put("year",calendar.get(Calendar.YEAR)); DateFormat formatter=new SimpleDateFormat("MMMM d, yyyy, HH:mm:ss",Locale.US); args.put("datetime",formatter.format(new Date())); formatter=new SimpleDateFormat("MMMM d, yyyy",Locale.US); args.put("date",formatter.format(new Date())); return args; }
Example 8
From project activiti-explorer, under directory /src/main/java/org/activiti/explorer/ui/management/db/.
Source file: DatabasePage.java

protected void populateTableList(){ TreeMap<String,Long> tables=new TreeMap<String,Long>(managementService.getTableCount()); for ( String tableName : tables.keySet()) { Item item=table.addItem(tableName); item.getItemProperty("icon").setValue(determineTableIcon(tableName)); item.getItemProperty("tableName").setValue(tableName + " (" + tables.get(tableName)+ ")"); } }
Example 9
From project addis, under directory /application/src/main/java/org/drugis/addis/util/jaxb/.
Source file: JAXBConvertor.java

public static org.drugis.addis.entities.data.Study convertStudy(Study study) throws ConversionException { org.drugis.addis.entities.data.Study newStudy=new org.drugis.addis.entities.data.Study(); newStudy.setName(study.getName()); NameReferenceWithNotes indication=nameReferenceWithNotes(study.getIndication().getName()); convertOldNotes(study.getIndicationWithNotes().getNotes(),indication.getNotes().getNote()); newStudy.setIndication(indication); newStudy.setArms(convertStudyArms(study.getArms())); newStudy.setEpochs(convertEpochs(study.getEpochs())); newStudy.setActivities(convertStudyActivities(study.getStudyActivities())); LinkedHashMap<String,org.drugis.addis.entities.StudyOutcomeMeasure<?>> omMap=new LinkedHashMap<String,StudyOutcomeMeasure<?>>(); for ( StudyOutcomeMeasure<Endpoint> e : study.getEndpoints()) { omMap.put("endpoint-" + e.getValue().getName(),e); } for ( org.drugis.addis.entities.StudyOutcomeMeasure<AdverseEvent> e : study.getAdverseEvents()) { omMap.put("adverseEvent-" + e.getValue().getName(),e); } for ( org.drugis.addis.entities.StudyOutcomeMeasure<PopulationCharacteristic> e : study.getPopulationChars()) { omMap.put("popChar-" + e.getValue().getName(),e); } newStudy.setStudyOutcomeMeasures(convertStudyOutcomeMeasures(omMap)); Map<MeasurementKey,BasicMeasurement> sortedMeasurements=new TreeMap<MeasurementKey,BasicMeasurement>(new MeasurementKey.MeasurementKeyComparator()); sortedMeasurements.putAll(study.getMeasurements()); newStudy.setMeasurements(convertMeasurements(sortedMeasurements,omMap)); newStudy.setCharacteristics(convertStudyCharacteristics(study.getCharacteristics())); Notes notes=new Notes(); convertOldNotes(study.getNotes(),notes.getNote()); newStudy.setNotes(notes); return newStudy; }
Example 10
From project AdminCmd, under directory /src/main/java/be/Balor/Player/.
Source file: FilePlayer.java

@Override public Map<String,String> getPowersString(){ final TreeMap<String,String> result=new TreeMap<String,String>(); for ( final Entry<String,Object> entry : powers.getValues(false).entrySet()) { result.put(entry.getKey(),entry.getValue().toString()); } return result; }
Example 11
From project agileBase, under directory /gtpb_server/src/com/gtwm/pb/model/manageData/.
Source file: ViewMethods.java

public SortedMap<TableInfo,SortedSet<BaseField>> adminGetRelationCandidates() throws DisallowedException, ObjectNotFoundException { TableInfo table=this.sessionData.getTable(); if (!(getAuthenticator().loggedInUserAllowedTo(this.request,PrivilegeType.MANAGE_TABLE,table))) { throw new DisallowedException(this.getLoggedInUser(),PrivilegeType.MANAGE_TABLE,table); } CompanyInfo company=this.databaseDefn.getAuthManager().getCompanyForLoggedInUser(this.request); SortedSet<TableInfo> companyTables=company.getTables(); SortedMap<TableInfo,SortedSet<BaseField>> relationCandidates=new TreeMap<TableInfo,SortedSet<BaseField>>(); for ( TableInfo testTable : companyTables) { if (!(testTable.equals(table))) { if (this.getAuthenticator().loggedInUserAllowedTo(this.request,PrivilegeType.VIEW_TABLE_DATA,table)) { SortedSet<BaseField> uniqueFieldsForTable=new TreeSet<BaseField>(); for ( BaseField testField : testTable.getFields()) { if (testField.getUnique()) { uniqueFieldsForTable.add(testField); } } if (uniqueFieldsForTable.size() > 0) { relationCandidates.put(testTable,uniqueFieldsForTable); } } } } return relationCandidates; }
Example 12
From project Aion-Extreme, under directory /AE-go_GameServer/src/com/aionemu/gameserver/model/items/.
Source file: NpcEquippedGear.java

/** */ private void init(){ synchronized (this) { if (items == null) { items=new TreeMap<ItemSlot,ItemTemplate>(); for ( ItemTemplate item : v.items) { } } } }
Example 13
From project alljoyn_java, under directory /src/org/alljoyn/bus/.
Source file: InterfaceDescription.java

private Status getProperties(Class<?> busInterface) throws AnnotationBusException { for ( Method method : busInterface.getMethods()) { if (method.getAnnotation(BusProperty.class) != null) { String name=getName(method); Property property=properties.get(name); BusAnnotations propertyAnnotations=method.getAnnotation(BusAnnotations.class); TreeMap<String,String> annotations=new TreeMap<String,String>(); if (propertyAnnotations != null) { for ( BusAnnotation propertyAnnotation : propertyAnnotations.value()) { annotations.put(propertyAnnotation.name(),propertyAnnotation.value()); } } if (property == null) { property=new Property(name,getPropertySig(method),annotations); } else if (!property.signature.equals(getPropertySig(method))) { return Status.BAD_ANNOTATION; } if (method.getName().startsWith("get")) { property.get=method; } else if (method.getName().startsWith("set") && (method.getGenericReturnType().equals(void.class))) { property.set=method; } else { return Status.BAD_ANNOTATION; } properties.put(name,property); } } return Status.OK; }
Example 14
From project and-bible, under directory /jsword-tweaks/src/main/java/jsword/org/crosswire/jsword/book/sword/.
Source file: ConfigEntryTable.java

/** * Create an empty Sword config for the named book. * @param bookName the name of the book */ public ConfigEntryTable(String bookName){ table=new HashMap<ConfigEntryType,ConfigEntry>(); extra=new TreeMap<String,ConfigEntry>(); internal=bookName; supported=true; }
Example 15
From project Android, under directory /app/src/main/java/com/github/mobile/core/gist/.
Source file: GistStore.java

/** * Sort files in {@link Gist} * @param gist * @return sorted files */ protected Map<String,GistFile> sortFiles(final Gist gist){ Map<String,GistFile> files=gist.getFiles(); if (files == null || files.size() < 2) return files; Map<String,GistFile> sorted=new TreeMap<String,GistFile>(CASE_INSENSITIVE_ORDER); sorted.putAll(files); return sorted; }
Example 16
From project android-aac-enc, under directory /src/com/googlecode/mp4parser/authoring/tracks/.
Source file: Amf0Track.java

/** * Creates a new AMF0 track from * @param rawSamples */ public Amf0Track(Map<Long,byte[]> rawSamples){ this.rawSamples=new TreeMap<Long,byte[]>(rawSamples); trackMetaData.setCreationTime(new Date()); trackMetaData.setModificationTime(new Date()); trackMetaData.setTimescale(1000); trackMetaData.setLanguage("eng"); }
Example 17
From project Android-MapForgeFragment, under directory /library-common/src/com/jakewharton/android/mapsforge_fragment/.
Source file: CoastlineAlgorithm.java

/** * Constructs a new CoastlineAlgorithm instance to generate closed polygons. */ CoastlineAlgorithm(){ this.coastlineWayComparator=new Comparator<CoastlineWay>(){ @Override public int compare( CoastlineWay o1, CoastlineWay o2){ if (o1.entryAngle > o2.entryAngle) { return 1; } return -1; } } ; this.helperPoints=new HelperPoint[4]; this.helperPoints[0]=new HelperPoint(); this.helperPoints[1]=new HelperPoint(); this.helperPoints[2]=new HelperPoint(); this.helperPoints[3]=new HelperPoint(); this.additionalCoastlinePoints=new ArrayList<HelperPoint>(4); this.coastlineWays=new ArrayList<CoastlineWay>(4); this.coastlineSegments=new ArrayList<float[]>(8); this.coastlineEnds=new TreeMap<ImmutablePoint,float[]>(); this.coastlineStarts=new TreeMap<ImmutablePoint,float[]>(); this.handledCoastlineSegments=new HashSet<EndPoints>(64); this.virtualTileBoundaries=new int[4]; }
Example 18
From project android-rackspacecloud, under directory /src/com/rackspacecloud/android/.
Source file: ListAccountsActivity.java

@Override protected void onPostExecute(ArrayList<Image> result){ if (result != null && result.size() > 0) { TreeMap<String,Image> imageMap=new TreeMap<String,Image>(); for (int i=0; i < result.size(); i++) { Image image=result.get(i); imageMap.put(image.getId(),image); } Image.setImages(imageMap); if (app.isLoggingIn()) { new LoadProtocolsTask().execute((Void[])null); } else { hideAccountDialog(); } } else { hideAccountDialog(); if (app.isLoggingIn()) { showAlert("Login Failure","There was a problem loading server images. Please try again."); } } }
Example 19
From project android-thaiime, under directory /latinime/src/com/sugree/inputmethod/latin/spellcheck/.
Source file: AndroidSpellCheckerService.java

@Override public boolean onUnbind(final Intent intent){ final Map<String,DictionaryPool> oldPools=mDictionaryPools; mDictionaryPools=Collections.synchronizedMap(new TreeMap<String,DictionaryPool>()); final Map<String,Dictionary> oldUserDictionaries=mUserDictionaries; mUserDictionaries=Collections.synchronizedMap(new TreeMap<String,Dictionary>()); final Map<String,Dictionary> oldWhitelistDictionaries=mWhitelistDictionaries; mWhitelistDictionaries=Collections.synchronizedMap(new TreeMap<String,Dictionary>()); for ( DictionaryPool pool : oldPools.values()) { pool.close(); } for ( Dictionary dict : oldUserDictionaries.values()) { dict.close(); } for ( Dictionary dict : oldWhitelistDictionaries.values()) { dict.close(); } if (null != mContactsDictionary) { final SynchronouslyLoadedContactsDictionary dictToClose=mContactsDictionary; mContactsDictionary=null; dictToClose.close(); } return false; }
Example 20
From project androidannotations, under directory /AndroidAnnotations/androidannotations/src/main/java/com/googlecode/androidannotations/processing/rest/.
Source file: MethodProcessor.java

protected void generateRestTemplateCallBlock(MethodProcessorHolder methodHolder){ RestImplementationHolder holder=restImplementationsHolder.getEnclosingHolder(methodHolder.getElement()); ExecutableElement executableElement=(ExecutableElement)methodHolder.getElement(); JClass expectedClass=methodHolder.getExpectedClass(); JClass generatedReturnType=methodHolder.getGeneratedReturnType(); JMethod method; String methodName=executableElement.getSimpleName().toString(); boolean methodReturnVoid=generatedReturnType == null && expectedClass == null; if (methodReturnVoid) { method=holder.restImplementationClass.method(JMod.PUBLIC,void.class,methodName); } else { method=holder.restImplementationClass.method(JMod.PUBLIC,methodHolder.getGeneratedReturnType(),methodName); } method.annotate(Override.class); JBlock body=method.body(); JInvocation restCall=JExpr.invoke(holder.restTemplateField,"exchange"); JInvocation concatCall=JExpr.invoke(holder.rootUrlField,"concat"); restCall.arg(concatCall.arg(JExpr.lit(methodHolder.getUrlSuffix()))); EBeanHolder eBeanHolder=methodHolder.getHolder(); JClass httpMethod=eBeanHolder.refClass(CanonicalNameConstants.HTTP_METHOD); String restMethodInCapitalLetters=getTarget().getSimpleName().toUpperCase(); restCall.arg(httpMethod.staticRef(restMethodInCapitalLetters)); TreeMap<String,JVar> methodParams=(TreeMap<String,JVar>)generateMethodParamsVar(eBeanHolder,method,executableElement,holder); methodHolder.setBody(body); methodHolder.setMethodParams(methodParams); JVar hashMapVar=generateHashMapVar(methodHolder); restCall=addHttpEntityVar(restCall,methodHolder); restCall=addResponseEntityArg(restCall,methodHolder); boolean hasParametersInUrl=hashMapVar != null; if (hasParametersInUrl) { restCall.arg(hashMapVar); } restCall=addResultCallMethod(restCall,methodHolder); insertRestCallInBody(body,restCall,methodReturnVoid); }
Example 21
From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/quicklaunch/.
Source file: BookmarkPicker.java

private void fillAdapterList(List<Map<String,?>> list,List<ResolveInfo> resolveList){ list.clear(); int resolveListSize=resolveList.size(); for (int i=0; i < resolveListSize; i++) { ResolveInfo info=resolveList.get(i); Map<String,Object> map=new TreeMap<String,Object>(); map.put(KEY_TITLE,getResolveInfoTitle(info)); map.put(KEY_RESOLVE_INFO,info); list.add(map); } }
Example 22
/** * Add the SHA1 of every file to the manifest, creating it if necessary. */ private static Manifest addDigestsToManifest(JarFile jar) throws IOException, GeneralSecurityException { Manifest input=jar.getManifest(); Manifest output=new Manifest(); Attributes main=output.getMainAttributes(); if (input != null) { main.putAll(input.getMainAttributes()); } else { main.putValue("Manifest-Version","1.0"); main.putValue("Created-By","1.0 (Android SignApk)"); } BASE64Encoder base64=new BASE64Encoder(); MessageDigest md=MessageDigest.getInstance("SHA1"); byte[] buffer=new byte[4096]; int num; TreeMap<String,JarEntry> byName=new TreeMap<String,JarEntry>(); for (Enumeration<JarEntry> e=jar.entries(); e.hasMoreElements(); ) { JarEntry entry=e.nextElement(); byName.put(entry.getName(),entry); } for ( JarEntry entry : byName.values()) { String name=entry.getName(); if (!entry.isDirectory() && !name.equals(JarFile.MANIFEST_NAME) && !name.equals(CERT_SF_NAME)&& !name.equals(CERT_RSA_NAME)&& (stripPattern == null || !stripPattern.matcher(name).matches())) { InputStream data=jar.getInputStream(entry); while ((num=data.read(buffer)) > 0) { md.update(buffer,0,num); } Attributes attr=null; if (input != null) attr=input.getAttributes(name); attr=attr != null ? new Attributes(attr) : new Attributes(); attr.putValue("SHA1-Digest",base64.encode(md.digest())); output.getEntries().put(name,attr); } } return output; }
Example 23
From project android_external_guava, under directory /src/com/google/common/collect/.
Source file: TreeMultimap.java

@SuppressWarnings("unchecked") private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); keyComparator=(Comparator<? super K>)stream.readObject(); valueComparator=(Comparator<? super V>)stream.readObject(); setMap(new TreeMap<K,Collection<V>>(keyComparator)); Serialization.populateMultimap(this,stream); }
Example 24
From project android_external_libphonenumber, under directory /java/test/com/android/i18n/phonenumbers/geocoding/.
Source file: AreaCodeMapTest.java

public AreaCodeMapTest(){ SortedMap<Integer,String> sortedMapForUS=new TreeMap<Integer,String>(); sortedMapForUS.put(1212,"New York"); sortedMapForUS.put(1480,"Arizona"); sortedMapForUS.put(1650,"California"); sortedMapForUS.put(1907,"Alaska"); sortedMapForUS.put(1201664,"Westwood, NJ"); sortedMapForUS.put(1480893,"Phoenix, AZ"); sortedMapForUS.put(1501372,"Little Rock, AR"); sortedMapForUS.put(1626308,"Alhambra, CA"); sortedMapForUS.put(1650345,"San Mateo, CA"); sortedMapForUS.put(1867993,"Dawson, YT"); sortedMapForUS.put(1972480,"Richardson, TX"); areaCodeMapForUS.readAreaCodeMap(sortedMapForUS); SortedMap<Integer,String> sortedMapForIT=new TreeMap<Integer,String>(); sortedMapForIT.put(3902,"Milan"); sortedMapForIT.put(3906,"Rome"); sortedMapForIT.put(39010,"Genoa"); sortedMapForIT.put(390131,"Alessandria"); sortedMapForIT.put(390321,"Novara"); sortedMapForIT.put(390975,"Potenza"); areaCodeMapForIT.readAreaCodeMap(sortedMapForIT); }
Example 25
From project android_packages_apps_Gallery2, under directory /src/com/android/gallery3d/data/.
Source file: FaceClustering.java

@Override public void run(MediaSet baseSet){ final TreeMap<Face,FaceCluster> map=new TreeMap<Face,FaceCluster>(); final FaceCluster untagged=new FaceCluster(mUntaggedString); baseSet.enumerateTotalMediaItems(new MediaSet.ItemConsumer(){ public void consume( int index, MediaItem item){ Face[] faces=item.getFaces(); if (faces == null || faces.length == 0) { untagged.add(item,-1); return; } for (int j=0; j < faces.length; j++) { Face face=faces[j]; FaceCluster cluster=map.get(face); if (cluster == null) { cluster=new FaceCluster(face.getName()); map.put(face,cluster); } cluster.add(item,j); } } } ); int m=map.size(); mClusters=map.values().toArray(new FaceCluster[m + ((untagged.size() > 0) ? 1 : 0)]); if (untagged.size() > 0) { mClusters[m]=untagged; } }
Example 26
From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/latin/spellcheck/.
Source file: AndroidSpellCheckerService.java

@Override public boolean onUnbind(final Intent intent){ final Map<String,DictionaryPool> oldPools=mDictionaryPools; mDictionaryPools=Collections.synchronizedMap(new TreeMap<String,DictionaryPool>()); final Map<String,Dictionary> oldUserDictionaries=mUserDictionaries; mUserDictionaries=Collections.synchronizedMap(new TreeMap<String,Dictionary>()); final Map<String,Dictionary> oldWhitelistDictionaries=mWhitelistDictionaries; mWhitelistDictionaries=Collections.synchronizedMap(new TreeMap<String,Dictionary>()); for ( DictionaryPool pool : oldPools.values()) { pool.close(); } for ( Dictionary dict : oldUserDictionaries.values()) { dict.close(); } for ( Dictionary dict : oldWhitelistDictionaries.values()) { dict.close(); } if (null != mContactsDictionary) { final SynchronouslyLoadedContactsDictionary dictToClose=mContactsDictionary; mContactsDictionary=null; dictToClose.close(); } return false; }
Example 27
From project anidroid, under directory /anidroid/src/com/github/anidroid/.
Source file: FrameUtil.java

public SortedMap<Integer,String> extractFrames(final List<String> fnames){ final SortedMap<Integer,String> frames=new TreeMap<Integer,String>(); for ( final String fname : fnames) { final Integer index=indexUtil.extractIndex(fname); if (index != null) frames.put(index,fname); } if (frames.size() > 0) return frames; else throw new AniDroidException("No frame files found"); }
Example 28
/** * @param modelId * @param models will be changed by adding all found CardModels into it * @return unordered CardModels which are related to a given Model and eventually active put into the parameter"models" */ protected static final void fromDb(Deck deck,long modelId,TreeMap<Long,CardModel> models){ Cursor cursor=null; CardModel myCardModel=null; try { StringBuffer query=new StringBuffer(SELECT_STRING); query.append(" WHERE modelId = "); query.append(modelId); cursor=AnkiDatabaseManager.getDatabase(deck.getDeckPath()).getDatabase().rawQuery(query.toString(),null); if (cursor.moveToFirst()) { do { myCardModel=new CardModel(); myCardModel.mId=cursor.getLong(0); myCardModel.mOrdinal=cursor.getInt(1); myCardModel.mModelId=cursor.getLong(2); myCardModel.mName=cursor.getString(3); myCardModel.mDescription=cursor.getString(4); myCardModel.mActive=cursor.getInt(5); myCardModel.mQformat=cursor.getString(6); myCardModel.mAformat=cursor.getString(7); myCardModel.mQuestionInAnswer=cursor.getInt(8); myCardModel.mQuestionFontFamily=cursor.getString(9); myCardModel.mQuestionFontSize=cursor.getInt(10); myCardModel.mQuestionFontColour=cursor.getString(11); myCardModel.mQuestionAlign=cursor.getInt(12); myCardModel.mAnswerFontFamily=cursor.getString(13); myCardModel.mAnswerFontSize=cursor.getInt(14); myCardModel.mAnswerFontColour=cursor.getString(15); myCardModel.mAnswerAlign=cursor.getInt(16); myCardModel.mLastFontColour=cursor.getString(17); models.put(myCardModel.mId,myCardModel); } while (cursor.moveToNext()); } } finally { if (cursor != null && !cursor.isClosed()) { cursor.close(); } } }
Example 29
From project ANNIS, under directory /annis-gui/src/main/java/annis/gui/controlpanel/.
Source file: ControlPanel.java

public void executeQuery(){ if (getApplication() != null && getApplication().getUser() == null) { getWindow().showNotification("Please login first",Window.Notification.TYPE_WARNING_MESSAGE); } else if (getApplication() != null && corpusList != null && queryPanel != null) { Map<String,AnnisCorpus> rawCorpusSelection=corpusList.getSelectedCorpora(); lastCorpusSelection=new TreeMap<String,AnnisCorpus>(rawCorpusSelection); AnnisUser user=(AnnisUser)getApplication().getUser(); if (user != null) { lastCorpusSelection.keySet().retainAll(user.getCorpusNameList()); } lastQuery=queryPanel.getQuery(); if (lastCorpusSelection.isEmpty()) { getWindow().showNotification("Please select a corpus",Window.Notification.TYPE_WARNING_MESSAGE); return; } if ("".equals(lastQuery)) { getWindow().showNotification("Empty query",Window.Notification.TYPE_WARNING_MESSAGE); return; } HistoryEntry e=new HistoryEntry(); e.setQuery(lastQuery); e.setCorpora(getSelectedCorpora()); history.remove(e); history.add(0,e); queryPanel.updateShortHistory(history.asList()); queryPanel.setCountIndicatorEnabled(true); CountThread countThread=new CountThread(); countThread.start(); searchWindow.showQueryResult(lastQuery,lastCorpusSelection,searchOptions.getLeftContext(),searchOptions.getRightContext(),searchOptions.getSegmentationLayer(),searchOptions.getResultsPerPage()); } }
Example 30
private CommandBuilder(Class<? extends ProjectElement> c){ commands=new TreeMap<String,Command>(); addExtensionCommands(c); commands.putAll(buildCommands(c)); commands.put(HELP_COMMAND.getName(),HELP_COMMAND); }
Example 31
From project ardverk-commons, under directory /src/main/java/org/ardverk/net/.
Source file: NetworkCounter.java

/** * Returns a {@link Set} view of the mappings contained in this {@link NetworkCounter}. */ public synchronized Set<Map.Entry<byte[],Integer>> entrySet(){ Map<byte[],Integer> copy=new TreeMap<byte[],Integer>(ByteArrayComparator.COMPARATOR); for ( Map.Entry<byte[],AtomicInteger> entry : map.entrySet()) { copy.put(entry.getKey(),entry.getValue().intValue()); } return copy.entrySet(); }
Example 32
From project ardverk-dht, under directory /components/core/src/main/java/org/ardverk/dht/codec/bencode/.
Source file: MessageInputStream.java

public VectorClock<KUID> readVectorClock() throws IOException { int count=readUnsignedShort(); if (count == 0) { return null; } long creationTime=readLong(); SortedMap<KUID,Vector> dst=new TreeMap<KUID,Vector>(); while (0 < count--) { KUID contactId=readKUID(); Vector vector=readVector(); if (!vector.isEmpty()) { dst.put(contactId,vector); } } return VectorClock.create(creationTime,dst); }
Example 33
From project Arecibo, under directory /agent/src/main/java/com/ning/arecibo/agent/datasource/snmp/.
Source file: SNMPClient.java

public SortedMap<Integer,Object> getTableColumnValues(String tableColumnOidString){ TreeMap<Integer,Object> resMap=new TreeMap<Integer,Object>(); SnmpOID tableColumnOID=this.snmpTarget.getMibOperations().getSnmpOID(tableColumnOidString); this.snmpTarget.setMaxRepetitions(100); this.snmpTarget.setObjectIDList(new String[]{tableColumnOidString}); boolean done=false; do { SnmpVarBind[][] resultArray=this.snmpTarget.snmpGetBulkVariableBindings(); if (resultArray == null || resultArray.length == 0) break; for ( SnmpVarBind[] results : resultArray) { for ( SnmpVarBind result : results) { SnmpOID oid=result.getObjectID(); if (oid == null || tableColumnOID == null || !SnmpTarget.isInSubTree(tableColumnOID,oid)) { done=true; break; } int[] oidNumbers=oid.toIntArray(); Integer rowNum=oidNumbers[oidNumbers.length - 1]; SnmpVar var=result.getVariable(); Object resultObj=convertToStandardJavaObject(var); resMap.put(rowNum,resultObj); } if (done) break; } } while (!done); return resMap; }
Example 34
From project asterisk-java, under directory /src/main/java/org/asteriskjava/config/.
Source file: ConfigFileImpl.java

public Map<String,List<String>> getCategories(){ final Map<String,List<String>> c; c=new TreeMap<String,List<String>>(); synchronized (categories) { for ( Category category : categories.values()) { List<String> lines; lines=new ArrayList<String>(); for ( ConfigElement element : category.getElements()) { if (element instanceof ConfigVariable) { ConfigVariable cv=(ConfigVariable)element; lines.add(cv.getName() + "=" + cv.getValue()); } } c.put(category.getName(),lines); } } return c; }
Example 35
From project avro, under directory /lang/java/ipc/src/main/java/org/apache/avro/ipc/trace/.
Source file: FileSpanStorage.java

/** * Thread that runs continuously and writes outstanding requests to Avro files. This thread also deals with rolling files over and dropping old files when the span limit is reached. * @param compressionLevel */ public DiskWriterThread(BlockingQueue<Span> outstanding,TreeMap<Long,File> files,boolean buffer,int compressionLevel){ this.outstanding=outstanding; this.files=files; this.doBuffer=buffer; this.compressionLevel=compressionLevel; }
Example 36
From project aws-toolkit-for-eclipse, under directory /com.amazonaws.eclipse.core/src/com/amazonaws/eclipse/explorer/s3/acls/.
Source file: EditPermissionsDialog.java

private void displayPermissions(){ AccessControlList startingAcl=getAcl(); table.clearAll(); table.setData("owner",startingAcl.getOwner()); Map<Grantee,Set<Permission>> permissionsByGrantee=new TreeMap<Grantee,Set<Permission>>(new GranteeComparator()); permissionsByGrantee.put(GroupGrantee.AllUsers,new HashSet<Permission>()); permissionsByGrantee.put(GroupGrantee.AuthenticatedUsers,new HashSet<Permission>()); for ( Grant grant : startingAcl.getGrants()) { if (permissionsByGrantee.get(grant.getGrantee()) == null) { permissionsByGrantee.put(grant.getGrantee(),new HashSet<Permission>()); } Set<Permission> permissions=permissionsByGrantee.get(grant.getGrantee()); permissions.add(grant.getPermission()); } for ( Grantee grantee : permissionsByGrantee.keySet()) { Set<Permission> permissions=permissionsByGrantee.get(grantee); TableItem item=createTableItem(false); TableItemData data=(TableItemData)item.getData(); data.grantee=grantee; item.setText(new String[]{getGranteeDisplayName(grantee),"",""}); if (permissions.contains(Permission.FullControl)) { for ( Button checkbox : data.checkboxes) { checkbox.setSelection(true); } } for ( Button checkbox : data.checkboxes) { Permission permission=(Permission)checkbox.getData(); if (permissions.contains(permission)) { checkbox.setSelection(true); } } } }
Example 37
From project babel, under directory /src/babel/content/eqclasses/properties/context/.
Source file: PhraseContextCollector.java

public SentWords(String sent){ m_leftMap=new TreeMap<Integer,String>(); m_rightMap=new TreeMap<Integer,String>(); String word; for ( IdxPair idxPair : getAllWordIdxs(sent)) { word=sent.substring(idxPair.from,idxPair.to); m_leftMap.put(-idxPair.to,word); m_rightMap.put(idxPair.from,word); } }
Example 38
From project backend-update-center2, under directory /src/main/java/org/jvnet/hudson/update_center/.
Source file: Main.java

/** * Identify the latest core, populates the htaccess redirect file, optionally download the core wars and build the index.html * @return the JSON for the core Jenkins */ protected JSONObject buildCore(MavenRepository repository,PrintWriter redirect) throws Exception { TreeMap<VersionNumber,HudsonWar> wars=repository.getHudsonWar(); if (wars.isEmpty()) return null; HudsonWar latest=wars.get(wars.firstKey()); JSONObject core=latest.toJSON("core"); System.out.println("core\n=> " + core); redirect.printf("Redirect 302 /latest/jenkins.war %s\n",latest.getURL().getPath()); redirect.printf("Redirect 302 /latest/debian/jenkins.deb http://pkg.jenkins-ci.org/debian/binary/jenkins_%s_all.deb\n",latest.getVersion()); redirect.printf("Redirect 302 /latest/redhat/jenkins.rpm http://pkg.jenkins-ci.org/redhat/RPMS/noarch/jenkins-%s-1.1.noarch.rpm\n",latest.getVersion()); redirect.printf("Redirect 302 /latest/opensuse/jenkins.rpm http://pkg.jenkins-ci.org/opensuse/RPMS/noarch/jenkins-%s-1.1.noarch.rpm\n",latest.getVersion()); if (latestCoreTxt != null) writeToFile(latest.getVersion().toString(),latestCoreTxt); if (download != null) { for ( HudsonWar w : wars.values()) { stage(w,new File(download,"war/" + w.version + "/"+ w.getFileName())); } } if (www != null) buildIndex(new File(www,"download/war/"),"jenkins.war",wars.values(),"/latest/jenkins.war"); return core; }
Example 39
From project beanstalker, under directory /simpledb-maven-plugin/src/main/java/br/com/ingenieux/mojo/simpledb/cmd/.
Source file: DumpDomainCommand.java

private void appendResult(ArrayNode rootNode,Item item){ ObjectNode rootObjectNode=mapper.createObjectNode(); rootObjectNode.put("name",item.getName()); Map<String,List<String>> replaceAttributes=new TreeMap<String,List<String>>(); for ( Attribute a : item.getAttributes()) { String key=a.getName(); String value=a.getValue(); if (replaceAttributes.containsKey(key)) { replaceAttributes.get(key).add(value); } else { replaceAttributes.put(key,new ArrayList<String>(Arrays.asList(value))); } } ObjectNode rootReplaceNode=mapper.createObjectNode(); for ( String k : replaceAttributes.keySet()) { List<String> valueList=replaceAttributes.get(k); if (1 == valueList.size()) { rootReplaceNode.put(k,valueList.get(0)); } else { ArrayNode valueArrayNode=mapper.createArrayNode(); for ( String value : valueList) valueArrayNode.add(value); rootReplaceNode.put(k,valueArrayNode); } } ArrayNode replaceNode=mapper.createArrayNode(); replaceNode.add(rootReplaceNode); rootObjectNode.put("replace",replaceNode); rootNode.add(rootObjectNode); }
Example 40
public static <K,K2,V2>SortedMap<K2,V2> ensureSortedMap(Map<K,SortedMap<K2,V2>> parent,K key){ return ensureAny(parent,key,new Morph<Void,SortedMap<K2,V2>>(){ public SortedMap<K2,V2> doIt( Void input){ return new TreeMap<K2,V2>(); } } ); }
Example 41
From project BetterShop_1, under directory /src/me/jascotty2/bettershop/regionshops/.
Source file: BSRegions.java

public String[] list(final World world){ if (world != null) { final RegionManager mgr=globalRegionManager.get(world); final Map<String,Region> regions=mgr.getRegions(); final String[] regionIDList=regions.keySet().toArray(new String[0]); Arrays.sort(regionIDList); return regionIDList; } else { final Map<String,Map<String,Region>> regions=new TreeMap<String,Map<String,Region>>(); for ( Entry<String,RegionManager> mgr : globalRegionManager.getAllEntries()) { regions.put(mgr.getKey(),mgr.getValue().getRegions()); } int size=0; for ( final String w : regions.keySet()) { size+=regions.get(w).size(); } int i=0; String[] regionIDList=new String[size]; for ( final String w : regions.keySet()) { for ( final String r : regions.get(w).keySet()) { regionIDList[i++]=w + ":" + r; } } Arrays.sort(regionIDList); return regionIDList; } }
Example 42
From project BibleQuote-for-Android, under directory /src/com/BibleQuote/controllers/.
Source file: CacheModuleController.java

public TreeMap<String,TModule> getModules(){ ArrayList<TModule> moduleList=getModuleList(); TreeMap<String,TModule> modules=new TreeMap<String,TModule>(); for ( TModule module : moduleList) { modules.put(((Module)module).getID(),module); } return modules; }
Example 43
From project big-data-plugin, under directory /shims/common/src/org/pentaho/hbase/shim/fake/.
Source file: FakeHBaseConnection.java

public FakeTable(List<String> families){ m_table=new TreeMap<byte[],NavigableMap<byte[],NavigableMap<byte[],NavigableMap<Long,byte[]>>>>(new BytesComparator()); for ( String fam : families) { m_families.add(fam); } m_enabled=true; m_available=true; }
Example 44
From project bioclipse.seneca, under directory /plugins/net.bioclipse.seneca/src/net/bioclipse/seneca/ga/.
Source file: MoleculeCandidateFactory.java

/** * Sorts atoms like Cs-other heavy atoms om alphabetical order-Hs. * @param mol The molecule to rearrange. * @return The new molecule as mdl file. * @exception Exception Problems writing mdl. */ public static IMolecule rearangeAtoms(IMolecule mol){ Iterator<IAtom> atomsold=mol.atoms().iterator(); IAtom[] atomsnew=new IAtom[mol.getAtomCount()]; int k=0; while (atomsold.hasNext()) { IAtom atom=atomsold.next(); if (atom.getSymbol().equals("C")) { atomsnew[k++]=atom; } } SortedMap<String,List<IAtom>> map=new TreeMap<String,List<IAtom>>(); atomsold=mol.atoms().iterator(); while (atomsold.hasNext()) { IAtom atom=(IAtom)atomsold.next(); if (!atom.getSymbol().equals("C") && !atom.getSymbol().equals("H")) { if (map.get(atom.getSymbol()) == null) map.put(atom.getSymbol(),new ArrayList<IAtom>()); map.get(atom.getSymbol()).add(atom); } } Iterator<String> symbolit=map.keySet().iterator(); while (symbolit.hasNext()) { List<IAtom> atoms=map.get(symbolit.next()); for (int i=0; i < atoms.size(); i++) { atomsnew[k++]=atoms.get(i); } } atomsold=mol.atoms().iterator(); while (atomsold.hasNext()) { IAtom atom=atomsold.next(); if (atom.getSymbol().equals("H")) { atomsnew[k++]=atom; } } mol.setAtoms(atomsnew); return (mol); }
Example 45
From project bioclipse.speclipse, under directory /plugins/net.bioclipse.spectrum/src/spok/utils/.
Source file: SpectrumUtils.java

public static TreeMap getJcampKeys(){ if (jcampKeys == null) { readJCAMPProperties(); } return jcampKeys; }
Example 46
From project Bitcoin-Wallet-for-Android, under directory /wallet/src/de/schildbach/wallet/.
Source file: ExchangeRatesProvider.java

private static Map<String,Double> getExchangeRates(){ try { final URLConnection connection=new URL("http://bitcoincharts.com/t/weighted_prices.json").openConnection(); connection.connect(); final StringBuilder content=new StringBuilder(); Reader reader=null; try { reader=new InputStreamReader(new BufferedInputStream(connection.getInputStream(),1024)); IOUtils.copy(reader,content); final Map<String,Double> rates=new TreeMap<String,Double>(); final JSONObject head=new JSONObject(content.toString()); for (final Iterator<String> i=head.keys(); i.hasNext(); ) { final String currencyCode=i.next(); if (!"timestamp".equals(currencyCode)) { final JSONObject o=head.getJSONObject(currencyCode); double rate=o.optDouble("24h",0); if (rate == 0) rate=o.optDouble("7d",0); if (rate == 0) rate=o.optDouble("30d",0); if (rate != 0) rates.put(currencyCode,rate); } } return rates; } finally { if (reader != null) reader.close(); } } catch ( final IOException x) { x.printStackTrace(); } catch ( final JSONException x) { x.printStackTrace(); } return null; }
Example 47
From project blueprint-namespaces, under directory /blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/di/.
Source file: MapRecipe.java

public static Class getMap(Class type){ if (ReflectionUtils.hasDefaultConstructor(type)) { return type; } else if (SortedMap.class.isAssignableFrom(type)) { return TreeMap.class; } else if (ConcurrentMap.class.isAssignableFrom(type)) { return ConcurrentHashMap.class; } else { return LinkedHashMap.class; } }
Example 48
From project bndtools, under directory /bndtools.core/src/org/bndtools/core/utils/collections/.
Source file: CollectionUtils.java

public static <K,V>Map<V,Set<K>> invertMapOfCollection(Map<K,? extends Collection<V>> mapOfCollection){ Map<V,Set<K>> result=new TreeMap<V,Set<K>>(); for ( Entry<K,? extends Collection<V>> inputEntry : mapOfCollection.entrySet()) { K inputKey=inputEntry.getKey(); Collection<V> inputCollection=inputEntry.getValue(); for ( V inputValue : inputCollection) { Set<K> resultSet=result.get(inputValue); if (resultSet == null) { resultSet=new TreeSet<K>(); result.put(inputValue,resultSet); } resultSet.add(inputKey); } } return result; }
Example 49
From project build-info, under directory /build-info-client/src/main/java/org/jfrog/build/client/.
Source file: ArtifactoryClientConfiguration.java

public ArtifactoryClientConfiguration(Log log){ this.root=new PrefixPropertyHandler(log,new TreeMap<String,String>()); this.rootConfig=new PrefixPropertyHandler(root,BUILD_INFO_CONFIG_PREFIX); this.resolver=new ResolverHandler(); this.publisher=new PublisherHandler(); this.info=new BuildInfoHandler(); this.proxy=new ProxyHandler(); }
Example 50
From project candlepin, under directory /src/main/java/org/candlepin/config/.
Source file: Config.java

/** * Creates a new <code>Config</code> instance using the file name to override values defined in {@link ConfigProperties}. * @param configFileName the file that contains the configuration values */ public Config(String configFileName){ this.configFile=new File(configFileName); this.configuration=new TreeMap<String,String>(ConfigProperties.DEFAULT_PROPERTIES); this.configuration.putAll(loadProperties()); this.configuration=this.trimSpaces(configuration); }
Example 51
From project Caronas, under directory /src/main/java/componentesdosistema/.
Source file: RecomendacaoPorHistorico.java

public String buscaDestinoMaisBuscadasPorEsseUsuario(){ Map<String,Integer> destinoMaisProcurado=new TreeMap<String,Integer>(); for ( Carona carona : getCaronasCadastradas()) { if (carona.getTodosCaroneiros().contains(getUsuario())) { if (destinoMaisProcurado.containsKey(carona.getDestino())) { destinoMaisProcurado.put(carona.getDestino(),destinoMaisProcurado.get(carona.getDestino()) + 1); } else { destinoMaisProcurado.put(carona.getDestino(),1); } } } String destinoMaisProcuradoPeloUsuario=""; int valor=0; for ( String destino : destinoMaisProcurado.keySet()) { if (destinoMaisProcurado.get(destino) > valor) { valor=destinoMaisProcurado.get(destino); destinoMaisProcuradoPeloUsuario=destino; } } return destinoMaisProcuradoPeloUsuario; }
Example 52
From project cb2java, under directory /src/main/java/net/sf/cb2java/copybook/.
Source file: Copybooks.java

public static Map<String,Copybook> readCopybooks(File[] files) throws FileNotFoundException { Map<String,Copybook> copybooks=new TreeMap<String,Copybook>(); for ( File f : files) { String copybookName=copybookNameOfFile(f); try { copybooks.put(copybookName,CopybookParser.parse(copybookName,new FileInputStream(f))); } catch ( RuntimeException e) { throw new RuntimeException(String.format("Cannot parse copybook structure in file '%s'",f.getName()),e); } } return copybooks; }
Example 53
From project cdk, under directory /attributes/src/main/java/org/richfaces/cdk/attributes/.
Source file: Adapters.java

@Override public Map<String,KeyType> unmarshal(ValueType v) throws Exception { Map<String,KeyType> result=new TreeMap<String,KeyType>(); Collection<? extends KeyType> items=v.getChildren(); for ( KeyType keyedType : items) { result.put(keyedType.getKey(),keyedType); } return result; }
Example 54
From project CDKHashFingerPrint, under directory /src/fingerprints/.
Source file: HashedFingerprinter.java

@Override public Map<String,Integer> getRawFingerprint(IAtomContainer atomContainer) throws CDKException { Map<String,Integer> uniquePaths=new TreeMap<String,Integer>(); if (!ConnectivityChecker.isConnected(atomContainer)) { IAtomContainerSet partitionedMolecules=ConnectivityChecker.partitionIntoMolecules(atomContainer); for ( IAtomContainer container : partitionedMolecules.atomContainers()) { addUniquePaths(container,uniquePaths); } } else { addUniquePaths(atomContainer,uniquePaths); } return uniquePaths; }
Example 55
From project ceylon-ide-eclipse, under directory /plugins/com.redhat.ceylon.eclipse.ui/src/com/redhat/ceylon/eclipse/code/imports/.
Source file: CleanImportsHandler.java

private static String reorganizeImports(ImportList til,List<Declaration> unused,List<Declaration> proposed){ Map<String,List<Tree.Import>> packages=new TreeMap<String,List<Tree.Import>>(); if (til != null) { for ( Tree.Import i : til.getImports()) { List<Tree.Import> is=packages.get(packageName(i)); if (is == null) { is=new ArrayList<Tree.Import>(); packages.put(packageName(i),is); } is.add(i); } } for ( Declaration d : proposed) { String pn=d.getUnit().getPackage().getNameAsString(); if (!packages.containsKey(pn)) { packages.put(pn,Collections.<Tree.Import>emptyList()); } } StringBuilder builder=new StringBuilder(); String lastToplevel=null; for ( Map.Entry<String,List<Tree.Import>> pack : packages.entrySet()) { String packageName=pack.getKey(); List<Tree.Import> imports=pack.getValue(); boolean hasWildcard=hasWildcard(imports); List<Tree.ImportMemberOrType> list=getUsedImportElements(imports,unused,hasWildcard); if (hasWildcard || !list.isEmpty() || imports.isEmpty()) { lastToplevel=appendBreakIfNecessary(lastToplevel,packageName,builder); builder.append("import ").append(packageName).append(" { "); appendImportElements(packageName,list,unused,proposed,hasWildcard,builder); builder.append(" }\n"); } } if (builder.length() != 0) { builder.setLength(builder.length() - 1); } return builder.toString(); }
Example 56
From project CheckIn4Me, under directory /src/com/davidivins/checkin4me/facebook/.
Source file: FacebookOAuthConnector.java

/** * isSuccessfulCompletionResponse * @param response * @return boolean */ public boolean isSuccessfulCompletionResponse(OAuthResponse response){ boolean is_successful=false; TreeMap<String,String> query_parameters=response.getQueryParameters(); if (query_parameters.containsKey("access_token")) is_successful=true; Log.i(TAG,"isSuccessfulAuthorizationResponse = " + is_successful); return is_successful; }
Example 57
From project chukwa, under directory /contrib/chukwa-pig/src/java/org/apache/hadoop/chukwa/pig/.
Source file: ChukwaLoader.java

@Override public Tuple getNext() throws IOException { ChukwaRecord record=null; try { if (!reader.nextKeyValue()) { return null; } } catch ( InterruptedException e) { throw new IOException(e); } record=reader.getCurrentValue(); Tuple ret=tf.newTuple(2); try { ret.set(0,new Long(record.getTime())); HashMap<Object,Object> pigMapFields=new HashMap<Object,Object>(); TreeMap<String,Buffer> mapFields=record.getMapFields(); if (mapFields != null) { for ( String key : mapFields.keySet()) { pigMapFields.put(key,new DataByteArray(record.getValue(key).getBytes())); } } ret.set(1,pigMapFields); } catch ( ExecException e) { e.printStackTrace(); throw new IOException(e); } return ret; }
Example 58
From project cidb, under directory /phenotype-mapping-service/src/main/java/edu/toronto/cs/cidb/hpoa/annotation/.
Source file: AbstractHPOAnnotation.java

public Map<String,String> getPhenotypesWithAnnotation(String annId){ Map<String,String> results=new TreeMap<String,String>(); AnnotationTerm omimNode=this.getAnnotationNode(annId); for ( String hpId : omimNode.getNeighbors()) { String hpName=this.hpo != null ? this.hpo.getName(hpId) : hpId; results.put(hpId,hpName); } return results; }
Example 59
From project ciel-java, under directory /examples/Grep/src/skywriting/examples/grep/.
Source file: SortedPartialHashOutputCollector.java

public SortedPartialHashOutputCollector(Combiner<V> combiner){ comb=combiner; sortedMap=new TreeMap<K,V>(); maps=new ArrayList<Map<K,V>>(1); maps.add(sortedMap); }
Example 60
private boolean handleMistake(CommandSender sender,String command,String modifier){ String[] modifiers=commands.getAllCommandModifiers(command); Map<Integer,String> values=new TreeMap<Integer,String>(); int i=0; for ( String string : modifiers) { values.put(StringUtils.getLevenshteinDistance(modifier,string),modifiers[i]); ++i; } int best=0; boolean stop=false; Set<String> possible=new HashSet<String>(); for ( Entry<Integer,String> entry : values.entrySet()) { if (!stop) { best=entry.getKey(); stop=true; } else if (entry.getKey() > best) { break; } possible.add(entry.getValue()); } if (possible.size() > 0) { sender.sendMessage(ChatColor.GRAY + "Unknown command. Did you mean:"); for ( String string : possible) { sender.sendMessage(StringUtils.wrap(" /") + command + " "+ StringUtils.wrap(string)); } return true; } return false; }
Example 61
From project clj-ds, under directory /src/test/java/com/trifork/clj_ds/test/.
Source file: PersistentHashMapTest.java

/** * Test method for {@link com.trifork.clj_ds.PersistentHashMap#create(java.util.Map)}. */ @Test public final void testCreateMapOfQextendsKQextendsV(){ Map<String,Integer> input=new TreeMap<String,Integer>(); int N=10; for (int i=0; i < N; i++) { input.put(String.valueOf(('A' + i)),i); } PersistentHashMap<String,Integer> output=PersistentHashMap.create(input); for (int i=0; i < N; i++) { assertEquals(i,(int)output.get(String.valueOf(('A' + i)))); } assertEquals(N,output.count()); input=Collections.EMPTY_MAP; output=PersistentHashMap.create(input); assertEquals(0,output.count()); }
Example 62
From project Cloud9, under directory /src/dist/edu/umd/cloud9/io/.
Source file: SequenceFileUtils.java

public static <K extends Writable,V extends Writable>SortedMap<K,V> readFileIntoMap(Path path,FileSystem fs,int max){ SortedMap<K,V> map=new TreeMap<K,V>(); for ( PairOfWritables<K,V> pair : SequenceFileUtils.<K,V>readFile(path,fs,max)) { map.put(pair.getLeftElement(),pair.getRightElement()); } return map; }
Example 63
From project cloudhopper-commons-util, under directory /src/main/java/com/cloudhopper/commons/util/.
Source file: StringLookupMap.java

public V put(String key,V value) throws IllegalArgumentException { assertValidPutKey(key); char lastChar=key.charAt(key.length() - 1); if (lastChar != '*') { if (this.specificMap == null) { this.specificMap=new TreeMap<String,V>(); } return this.specificMap.put(toCorrectKeyCaseSensitivity(key),value); } else if (key.equals("*")) { V previousValue=this.rootPrefixValue; this.rootPrefixValue=value; return previousValue; } else { key=key.substring(0,key.length() - 1); if (this.prefixMap == null) { this.prefixMap=new TreeMap<String,V>(); } return this.prefixMap.put(toCorrectKeyCaseSensitivity(key),value); } }
Example 64
From project cloudhopper-smpp, under directory /src/main/java/com/cloudhopper/smpp/util/.
Source file: ConcurrentCommandStatusCounter.java

public SortedMap<Integer,Integer> createSortedMapSnapshot(){ SortedMap<Integer,Integer> sortedMap=new TreeMap<Integer,Integer>(); for ( Map.Entry<Integer,AtomicInteger> entry : this.map.entrySet()) { sortedMap.put(entry.getKey(),new Integer(entry.getValue().get())); } return sortedMap; }
Example 65
From project cloudify, under directory /rest-client/src/main/java/org/cloudifysource/restclient/.
Source file: EventLoggingTailer.java

/** * Create a list of messages from a given list of mapped event lines, while avoiding duplicate lines. * @param allLines a list of mapped lines * @return a list of formatted messages, based on the given lines */ public final List<String> getLinesToPrint(final List<Map<String,String>> allLines){ if (allLines == null || allLines.isEmpty()) { return null; } String outputMessage; List<String> outputList=new ArrayList<String>(); for ( Map<String,String> map : allLines) { Map<String,Object> sortedMap=new TreeMap<String,Object>(map); if (!eventsSet.contains(sortedMap.toString())) { eventsSet.add(sortedMap.toString()); outputMessage=getMessageFromMap(sortedMap); outputList.add(outputMessage); } } return outputList; }