Java Code Examples for java.util.Map.Entry

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 activemq-apollo, under directory /apollo-itests/src/test/java/org/apache/activemq/apollo/.

Source file: AutoFailTestSupport.java

  15 
vote

public static void dumpAllThreads(String prefix){
  Map<Thread,StackTraceElement[]> stacks=Thread.getAllStackTraces();
  for (  Entry<Thread,StackTraceElement[]> stackEntry : stacks.entrySet()) {
    System.err.println(prefix + " " + stackEntry.getKey());
    for (    StackTraceElement element : stackEntry.getValue()) {
      System.err.println("     " + element);
    }
  }
}
 

Example 2

From project activiti-explorer, under directory /src/main/java/org/activiti/explorer/ui/form/.

Source file: EnumFormPropertyRenderer.java

  15 
vote

@SuppressWarnings("unchecked") @Override public Field getPropertyField(FormProperty formProperty){
  ComboBox comboBox=new ComboBox(getPropertyLabel(formProperty));
  comboBox.setRequired(formProperty.isRequired());
  comboBox.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED,getPropertyLabel(formProperty)));
  comboBox.setEnabled(formProperty.isWritable());
  Map<String,String> values=(Map<String,String>)formProperty.getType().getInformation("values");
  if (values != null) {
    for (    Entry<String,String> enumEntry : values.entrySet()) {
      comboBox.addItem(enumEntry.getKey());
      if (enumEntry.getValue() != null) {
        comboBox.setItemCaption(enumEntry.getKey(),enumEntry.getValue());
      }
    }
  }
  return comboBox;
}
 

Example 3

From project activiti-webapp-rest-generic, under directory /activiti-webapp-rest/src/main/java/org/activiti/rest/builder/management/.

Source file: TableDataObjectBuilder.java

  15 
vote

private JSONObject createJSONObjectForRow(Map<String,Object> row) throws JSONException {
  JSONObject json=new JSONObject();
  for (  Entry<String,Object> column : row.entrySet()) {
    putColumnValue(json,column.getKey(),column.getValue());
  }
  return json;
}
 

Example 4

From project addis, under directory /application/src/main/java/org/drugis/addis/entities/analysis/.

Source file: AbstractMetaAnalysis.java

  15 
vote

private void checkArmsMatchTreatmentDefinitions(Map<Study,Map<TreatmentDefinition,Arm>> armMap){
  for (  Study study : armMap.keySet()) {
    for (    Entry<TreatmentDefinition,Arm> entry : armMap.get(study).entrySet()) {
      Arm arm=entry.getValue();
      TreatmentDefinition def=entry.getKey();
      if (!def.match(study,arm)) {
        throw new IllegalArgumentException("TreatmentActivity in Arm " + arm.getName() + " of Study "+ study.getName()+ " does not match the TreatmentDefinition "+ def.getLabel());
      }
    }
  }
}
 

Example 5

From project AdminCmd, under directory /src/main/java/be/Balor/bukkit/AdminCmd/.

Source file: ACHelper.java

  15 
vote

public synchronized void loadInfos(){
  itemBlacklist.addAll(getBlackListedItems());
  blockBlacklist=getBlackListedBlocks();
  groups=getGroupNames();
  alias.putAll(fManager.getAlias());
  addLocaleFromFile();
  kits=fManager.loadKits();
  deathMessages=fManager.loadDeathMessages();
  final Map<String,Ban> bans=dataManager.loadBan();
  for (  final Entry<String,Ban> ban : bans.entrySet()) {
    if (checkBan(ban.getValue())) {
      bannedPlayers.put(ban.getKey(),ban.getValue());
    }
  }
  if (pluginConfig.getBoolean("verboseLog",true)) {
    final Logger logger=coreInstance.getLogger();
    logger.info(itemBlacklist.size() + " blacklisted items loaded.");
    logger.info(blockBlacklist.size() + " blacklisted blocks loaded.");
    logger.info(alias.size() + " alias loaded.");
    logger.info(kits.size() + " kits loaded.");
    logger.info(bannedPlayers.size() + " banned players loaded.");
    logger.info(deathMessages.size() + " death messages loaded.");
  }
}
 

Example 6

From project AdminStuff, under directory /src/main/java/de/minestar/AdminStuff/commands/.

Source file: cmdBlockCount.java

  15 
vote

private void printStatistic(Player player,Map<Material,Counter> blockCounter,Counter total){
  PlayerUtils.sendSuccess(player,pluginName,"Es befinden sich " + total.getCount() + " Bloecke in dem Gebiet!");
  Counter counter=null;
  for (  Entry<Material,Counter> entry : blockCounter.entrySet()) {
    counter=entry.getValue();
    if (counter.getCount() != 0L) {
      double percent=((double)counter.getCount() / (double)total.getCount()) * 100.0;
      percent=Math.round(percent * 100.0) / 100.0;
      PlayerUtils.sendInfo(player,entry.getKey().name() + " : " + counter.getCount()+ " of "+ total.getCount()+ " ( "+ percent+ "% )");
    }
  }
}
 

Example 7

From project adt-cdt, under directory /com.android.ide.eclipse.adt.cdt/src/com/android/ide/eclipse/adt/cdt/internal/discovery/.

Source file: NDKDiscoveredPathInfo.java

  15 
vote

private void save(){
  try {
    File infoFile=getInfoFile();
    infoFile.getParentFile().mkdirs();
    PrintStream out=new PrintStream(infoFile);
    out.print("t,");
    out.print(lastUpdate);
    out.println();
    for (    IPath include : includePaths) {
      out.print("i,");
      out.print(include.toPortableString());
      out.println();
    }
    for (    Entry<String,String> symbol : symbols.entrySet()) {
      out.print("d,");
      out.print(symbol.getKey());
      out.print(",");
      out.print(symbol.getValue());
      out.println();
    }
    out.close();
  }
 catch (  IOException e) {
    Activator.log(e);
  }
}
 

Example 8

From project aether-core, under directory /aether-connector-file/src/main/java/org/eclipse/aether/connector/file/.

Source file: FileRepositoryWorker.java

  15 
vote

private void writeChecksum(File src,String targetPath) throws IOException, Throwable {
  Map<String,Object> crcs=ChecksumUtils.calc(src,checksumAlgos.keySet());
  for (  Entry<String,Object> crc : crcs.entrySet()) {
    String name=crc.getKey();
    Object sum=crc.getValue();
    if (sum instanceof Throwable) {
      throw (Throwable)sum;
    }
    File crcTarget=new File(targetPath + checksumAlgos.get(name));
    OutputStreamWriter crcWriter=new OutputStreamWriter(new FileOutputStream(crcTarget),"US-ASCII");
    crcWriter.write(sum.toString());
    crcWriter.close();
  }
}
 

Example 9

From project agit, under directory /agit/src/main/java/com/madgag/agit/ssh/.

Source file: AndroidSshSessionFactory.java

  15 
vote

private void updateJschWith(final JSch jsch,Map<String,byte[]> identities) throws JSchException {
  for (  Entry<String,byte[]> i : identities.entrySet()) {
    byte[] publicKey=i.getValue();
    String name=i.getKey();
    jsch.addIdentity(new SSHAgentIdentity(androidAuthAgentProvider,publicKey,name),null);
  }
}
 

Example 10

From project agorava-core, under directory /agorava-core-impl-cdi/src/main/java/org/agorava/core/cdi/.

Source file: OAuthServiceImpl.java

  15 
vote

@Override public RestResponse sendSignedRequest(RestVerb verb,String uri,Map<String,? extends Object> params){
  OAuthRequest request=getProvider().requestFactory(verb,uri);
  for (  Entry<String,? extends Object> ent : params.entrySet()) {
    request.addBodyParameter(ent.getKey(),ent.getValue().toString());
  }
  return sendSignedRequest(request);
}
 

Example 11

From project agorava-twitter, under directory /agorava-twitter-cdi/src/main/java/org/agorava/twitter/jackson/.

Source file: AbstractTrendsList.java

  15 
vote

public AbstractTrendsList(Map<String,List<Trend>> trends,DateFormat dateFormat){
  list=new ArrayList<Trends>(trends.size());
  for (Iterator<Entry<String,List<Trend>>> trendsIt=trends.entrySet().iterator(); trendsIt.hasNext(); ) {
    Entry<String,List<Trend>> entry=trendsIt.next();
    list.add(new Trends(toDate(entry.getKey(),dateFormat),entry.getValue()));
  }
  Collections.sort(list,new Comparator<Trends>(){
    public int compare(    Trends t1,    Trends t2){
      return t1.getTime().getTime() > t2.getTime().getTime() ? -1 : 1;
    }
  }
);
}
 

Example 12

From project Agot-Java, under directory /src/main/java/got/utility/.

Source file: PolygonGrabber.java

  15 
vote

/** 
 * javax.swing.JPanel createMainPanel() Creates a JPanel to be used. Dictates how the map is painted. Current problem is that islands inside sea zones are not recognized when filling in the sea zone with a color, so we just outline in red instead of filling. We fill for selecting territories only for ease of use. We use var "islandMode" to dictate how to paint the map.
 * @return javax.swing.JPanel the newly create panel
 */
private JPanel createMainPanel(){
  final JPanel imagePanel=new JPanel(){
    private static final long serialVersionUID=4106539186003148628L;
    @Override public void paint(    final Graphics g){
      g.drawImage(m_image,0,0,this);
      final Iterator<Entry<String,List<Polygon>>> iter=m_polygons.entrySet().iterator();
      g.setColor(Color.red);
      while (iter.hasNext()) {
        final Collection<Polygon> polygons=iter.next().getValue();
        final Iterator<Polygon> iter2=polygons.iterator();
        if (s_islandMode) {
          while (iter2.hasNext()) {
            final Polygon item=iter2.next();
            g.drawPolygon(item.xpoints,item.ypoints,item.npoints);
          }
        }
 else {
          while (iter2.hasNext()) {
            final Polygon item=iter2.next();
            g.setColor(Color.yellow);
            g.fillPolygon(item.xpoints,item.ypoints,item.npoints);
            g.setColor(Color.black);
            g.drawPolygon(item.xpoints,item.ypoints,item.npoints);
          }
        }
      }
      g.setColor(Color.red);
      if (m_current != null) {
        for (        final Polygon item : m_current) {
          g.fillPolygon(item.xpoints,item.ypoints,item.npoints);
        }
      }
    }
  }
;
  return imagePanel;
}
 

Example 13

From project agraph-java-client, under directory /src/com/franz/agraph/jena/.

Source file: AGPrefixMapping.java

  15 
vote

@Override public String shortForm(String uri){
  Map<String,String> map=getNsPrefixMap();
  for (  Entry<String,String> s : map.entrySet()) {
    if (uri.startsWith(s.getValue())) {
      return s.getKey() + ":" + uri.substring(s.getValue().length());
    }
  }
  return uri;
}
 

Example 14

From project airlift, under directory /bootstrap/src/main/java/io/airlift/bootstrap/.

Source file: Bootstrap.java

  15 
vote

private void logConfiguration(ConfigurationFactory configurationFactory,Map<String,String> unusedProperties){
  ColumnPrinter columnPrinter=makePrinterForConfiguration(configurationFactory);
  PrintWriter out=new PrintWriter(new LoggingWriter(log,Type.INFO));
  columnPrinter.print(out);
  out.flush();
  if (!unusedProperties.isEmpty()) {
    log.warn("UNUSED PROPERTIES");
    for (    Entry<String,String> unusedProperty : unusedProperties.entrySet()) {
      log.warn("%s=%s",unusedProperty.getKey(),unusedProperty.getValue());
    }
    log.warn("");
  }
}
 

Example 15

From project Airports, under directory /src/com/nadmm/airports/utils/.

Source file: DataUtils.java

  15 
vote

public static String getTraconId(String name){
  for (  Entry<String,String> entry : sTracons.entrySet()) {
    if (name.equals(entry.getValue())) {
      return entry.getKey();
    }
  }
  return "";
}
 

Example 16

From project AlgorithmsNYC, under directory /ALGO101/UNIT_04/graph/.

Source file: UndirectedGraph.java

  15 
vote

@Override public String toString(){
  StringBuilder sb=new StringBuilder();
  sb.append("Graph: ").append(name).append(", size=").append(size()).append("\n");
  for (  Entry<Integer,ArrayList<Integer>> entry : data.entrySet())   sb.append("node=").append(entry.getKey()).append(", edges= ").append(entry.getValue()).append("\n");
  return sb.toString();
}
 

Example 17

From project alljoyn_java, under directory /src/org/alljoyn/bus/.

Source file: InterfaceDescription.java

  15 
vote

private Status addProperties(Class<?> busInterface) throws AnnotationBusException {
  for (  Property property : properties.values()) {
    int access=((property.get != null) ? READ : 0) | ((property.set != null) ? WRITE : 0);
    Status status=addProperty(property.name,property.signature,access);
    if (status != Status.OK) {
      return status;
    }
    for (    Entry<String,String> entry : property.annotations.entrySet()) {
      addPropertyAnnotation(property.name,entry.getKey(),entry.getValue());
    }
  }
  return Status.OK;
}
 

Example 18

From project AmDroid, under directory /httpclientandroidlib/src/ch/boye/httpclientandroidlib/impl/conn/.

Source file: IdleConnectionHandler.java

  15 
vote

/** 
 * Closes connections that have been idle for at least the given amount of time.
 * @param idleTime the minimum idle time, in milliseconds, for connections to be closed
 */
public void closeIdleConnections(long idleTime){
  long idleTimeout=System.currentTimeMillis() - idleTime;
  if (log.isDebugEnabled()) {
    log.debug("Checking for connections, idle timeout: " + idleTimeout);
  }
  for (  Entry<HttpConnection,TimeValues> entry : connectionToTimes.entrySet()) {
    HttpConnection conn=entry.getKey();
    TimeValues times=entry.getValue();
    long connectionTime=times.timeAdded;
    if (connectionTime <= idleTimeout) {
      if (log.isDebugEnabled()) {
        log.debug("Closing idle connection, connection time: " + connectionTime);
      }
      try {
        conn.close();
      }
 catch (      IOException ex) {
        log.debug("I/O error closing connection",ex);
      }
    }
  }
}
 

Example 19

From project anadix, under directory /integration/anadix-ant/src/main/java/org/anadix/utils/.

Source file: AnalyzerAntTask.java

  15 
vote

/** 
 * {@inheritDoc} 
 */
@Override public void execute() throws BuildException {
  log("Starting...",Project.MSG_INFO);
  Analyzer a=createAnalyzer();
  log("Created an instance of analyzer",Project.MSG_INFO);
  Map<String,Report> results=analyze(a,sourcesDir);
  for (  Entry<String,Report> entry : results.entrySet()) {
    Anadix.formatReport(entry.getValue(),entry.getKey());
  }
}
 

Example 20

From project and-bible, under directory /AndBible/src/net/bible/service/readingplan/.

Source file: ReadingPlanDao.java

  15 
vote

/** 
 * get a list of all days readings in a plan
 */
public List<OneDaysReadingsDto> getReadingList(String planName){
  ReadingPlanInfoDto planInfo=getReadingPlanInfoDto(planName);
  Properties properties=getPlanProperties(planName);
  List<OneDaysReadingsDto> list=new ArrayList<OneDaysReadingsDto>();
  for (  Entry<Object,Object> entry : properties.entrySet()) {
    String key=(String)entry.getKey();
    String value=(String)entry.getValue();
    if (StringUtils.isNumeric(key)) {
      int day=Integer.parseInt(key);
      OneDaysReadingsDto daysReading=new OneDaysReadingsDto(day,value,planInfo);
      list.add(daysReading);
    }
  }
  Collections.sort(list);
  return list;
}
 

Example 21

From project android-client, under directory /xwiki-android-core/src/org/xwiki/android/rest/transformation/.

Source file: XModelTranslator_XML.java

  15 
vote

public Object toObject(XSimpleObject xso){
  Object obj=new Object();
  obj.id=xso.getId();
  obj.guid=xso.getGuid();
  obj.pageId=xso.getPageid();
  obj.wiki=xso.getWiki();
  obj.space=xso.getSpace();
  obj.pageName=xso.getPageName();
  obj.number=xso.getNumber();
  obj.className=xso.getClassName();
  obj.headline=xso.getHeadline();
  Map<String,XProperty> xprops=xso.getProperties();
  Set<Entry<String,XProperty>> entrySet=xprops.entrySet();
  List<Property> plist=new ArrayList<Property>();
  for (  Entry<String,XProperty> entry : entrySet) {
    XProperty xp=entry.getValue();
    String pName=entry.getKey();
    if (xp != null) {
      Property p=new Property();
      p.setName(pName);
      p.setType(xp.getType());
      p.setValue(xp.toString());
      Map<String,java.lang.Object> attrs=xp.getAllAttributes();
      Set<Entry<String,java.lang.Object>> atrEntrySet=attrs.entrySet();
      List<Attribute> attrList=new ArrayList();
      for (      Entry<String,java.lang.Object> atrEn : atrEntrySet) {
        Attribute atr=new Attribute();
        atr.setName(atrEn.getKey());
        atr.setValue(atrEn.getValue().toString());
        attrList.add(atr);
      }
      plist.add(p.withAttributes(attrList));
    }
  }
  return obj.withProperties(plist);
}
 

Example 22

From project android-database-sqlcipher, under directory /src/net/sqlcipher/database/.

Source file: SQLiteQueryBuilder.java

  15 
vote

private String[] computeProjection(String[] projectionIn){
  if (projectionIn != null && projectionIn.length > 0) {
    if (mProjectionMap != null) {
      String[] projection=new String[projectionIn.length];
      int length=projectionIn.length;
      for (int i=0; i < length; i++) {
        String userColumn=projectionIn[i];
        String column=mProjectionMap.get(userColumn);
        if (column != null) {
          projection[i]=column;
          continue;
        }
        if (!mStrictProjectionMap && (userColumn.contains(" AS ") || userColumn.contains(" as "))) {
          projection[i]=userColumn;
          continue;
        }
        throw new IllegalArgumentException("Invalid column " + projectionIn[i]);
      }
      return projection;
    }
 else {
      return projectionIn;
    }
  }
 else   if (mProjectionMap != null) {
    Set<Entry<String,String>> entrySet=mProjectionMap.entrySet();
    String[] projection=new String[entrySet.size()];
    Iterator<Entry<String,String>> entryIter=entrySet.iterator();
    int i=0;
    while (entryIter.hasNext()) {
      Entry<String,String> entry=entryIter.next();
      if (entry.getKey().equals(BaseColumns._COUNT)) {
        continue;
      }
      projection[i++]=entry.getValue();
    }
    return projection;
  }
  return null;
}
 

Example 23

From project Android-Simple-Social-Sharing, under directory /SimpleSocialSharing/src/com/nostra13/socialsharing/facebook/.

Source file: FacebookFacade.java

  15 
vote

private String buildActionsString(Map<String,String> actionsMap){
  JSONObject actionsObject=new JSONObject();
  Set<Entry<String,String>> actionEntries=actionsMap.entrySet();
  for (  Entry<String,String> actionEntry : actionEntries) {
    try {
      actionsObject.put(RequestParameter.NAME,actionEntry.getKey());
      actionsObject.put(RequestParameter.LINK,actionEntry.getValue());
    }
 catch (    JSONException e) {
      Log.e(TAG,e.getMessage(),e);
    }
  }
  return actionsObject.toString();
}
 

Example 24

From project android-tether, under directory /src/og/android/tether/system/.

Source file: WebserviceTask.java

  15 
vote

public static void report(String url,HashMap<String,Object> paramMap){
  List<BasicNameValuePair> params=new ArrayList<BasicNameValuePair>();
  Set<Entry<String,Object>> a=paramMap.entrySet();
  for (  Entry<String,Object> e : a) {
    Object o=e.getValue();
    if (o != null) {
      params.add(new BasicNameValuePair(e.getKey(),o.toString()));
    }
  }
  try {
    HttpResponse response=makeRequest(url,params);
    StatusLine status=response.getStatusLine();
    Log.d(MSG_TAG,"Request returned status " + status);
    if (status.getStatusCode() == 200) {
      HttpEntity entity=response.getEntity();
      Log.d(MSG_TAG,"Request returned: " + entity.getContent());
    }
  }
 catch (  Exception e) {
    Log.d(MSG_TAG,"Can't report stats '" + url + "' ("+ e.toString()+ ").");
  }
}
 

Example 25

From project android-thaiime, under directory /latinime/src/com/sugree/inputmethod/latin/.

Source file: UserUnigramDictionary.java

  15 
vote

@Override protected Void doInBackground(Void... v){
  SQLiteDatabase db=mDbHelper.getWritableDatabase();
  Set<Entry<String,Integer>> mEntries=mMap.entrySet();
  for (  Entry<String,Integer> entry : mEntries) {
    Integer freq=entry.getValue();
    db.delete(USER_UNIGRAM_DICT_TABLE_NAME,COLUMN_WORD + "=? AND " + COLUMN_LOCALE+ "=?",new String[]{entry.getKey(),mLocale});
    if (freq != null) {
      db.insert(USER_UNIGRAM_DICT_TABLE_NAME,null,getContentValues(entry.getKey(),freq,mLocale));
    }
  }
  return null;
}
 

Example 26

From project AndroidLab, under directory /src/src/de/tubs/ibr/android/ldap/core/activities/.

Source file: ConflictActivity.java

  15 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  final Intent i=getIntent();
  int rawContactId=i.getIntExtra("id",-1);
  if (rawContactId != -1) {
    showContact(rawContactId);
  }
 else {
    LinkedHashMap<Integer,Bundle> contactlist=ContactManager.loadContactList(this);
    for (    Entry<Integer,Bundle> contact : contactlist.entrySet()) {
      if (contact.getValue().getString(ContactManager.LDAP_SYNC_STATUS_KEY).startsWith(ContactManager.SYNC_STATUS_CONFLICT)) {
        rawContactId=contact.getKey();
        HashMap<String,String> listitem=new HashMap<String,String>();
        listitem.put("Value1",contact.getValue().getString(AttributeMapper.FULL_NAME));
        listitem.put("Value2","" + contact.getKey());
        entryList.add(listitem);
      }
    }
    if (entryList.size() == 1) {
      showContact(rawContactId);
    }
 else     if (entryList.size() > 1) {
      showList();
    }
  }
}
 

Example 27

From project androidtracks, under directory /src/org/sfcta/cycletracks/.

Source file: SaveTrip.java

  15 
vote

void preparePurposeButtons(){
  purpButtons.put(R.id.ToggleCommute,(ToggleButton)findViewById(R.id.ToggleCommute));
  purpButtons.put(R.id.ToggleSchool,(ToggleButton)findViewById(R.id.ToggleSchool));
  purpButtons.put(R.id.ToggleWorkRel,(ToggleButton)findViewById(R.id.ToggleWorkRel));
  purpButtons.put(R.id.ToggleExercise,(ToggleButton)findViewById(R.id.ToggleExercise));
  purpButtons.put(R.id.ToggleSocial,(ToggleButton)findViewById(R.id.ToggleSocial));
  purpButtons.put(R.id.ToggleShopping,(ToggleButton)findViewById(R.id.ToggleShopping));
  purpButtons.put(R.id.ToggleErrand,(ToggleButton)findViewById(R.id.ToggleErrand));
  purpButtons.put(R.id.ToggleOther,(ToggleButton)findViewById(R.id.ToggleOther));
  purpDescriptions.put(R.id.ToggleCommute,"<b>Commute:</b> this bike trip was primarily to get between home and your main workplace.");
  purpDescriptions.put(R.id.ToggleSchool,"<b>School:</b> this bike trip was primarily to go to or from school or college.");
  purpDescriptions.put(R.id.ToggleWorkRel,"<b>Work-Related:</b> this bike trip was primarily to go to or from a business related meeting, function, or work-related errand for your job.");
  purpDescriptions.put(R.id.ToggleExercise,"<b>Exercise:</b> this bike trip was primarily for exercise, or biking for the sake of biking.");
  purpDescriptions.put(R.id.ToggleSocial,"<b>Social:</b> this bike trip was primarily for going to or from a social activity, e.g. at a friend's house, the park, a restaurant, the movies.");
  purpDescriptions.put(R.id.ToggleShopping,"<b>Shopping:</b> this bike trip was primarily to purchase or bring home goods or groceries.");
  purpDescriptions.put(R.id.ToggleErrand,"<b>Errand:</b> this bike trip was primarily to attend to personal business such as banking, a doctor  visit, going to the gym, etc.");
  purpDescriptions.put(R.id.ToggleOther,"<b>Other:</b> if none of the other reasons applied to this trip, you can enter comments below to tell us more.");
  CheckListener cl=new CheckListener();
  for (  Entry<Integer,ToggleButton> e : purpButtons.entrySet()) {
    e.getValue().setOnCheckedChangeListener(cl);
  }
}
 

Example 28

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

Source file: Joiner.java

  15 
vote

/** 
 * Appends the string representation of each entry of  {@code map}, using the previously configured separator and key-value separator, to  {@code appendable}.
 */
public <A extends Appendable>A appendTo(A appendable,Map<?,?> map) throws IOException {
  checkNotNull(appendable);
  Iterator<? extends Map.Entry<?,?>> iterator=map.entrySet().iterator();
  if (iterator.hasNext()) {
    Entry<?,?> entry=iterator.next();
    appendable.append(joiner.toString(entry.getKey()));
    appendable.append(keyValueSeparator);
    appendable.append(joiner.toString(entry.getValue()));
    while (iterator.hasNext()) {
      appendable.append(joiner.separator);
      Entry<?,?> e=iterator.next();
      appendable.append(joiner.toString(e.getKey()));
      appendable.append(keyValueSeparator);
      appendable.append(joiner.toString(e.getValue()));
    }
  }
  return appendable;
}
 

Example 29

From project android_external_libphonenumber, under directory /java/src/com/android/i18n/phonenumbers/geocoding/.

Source file: FlyweightMapStorage.java

  15 
vote

@Override public void readFromSortedMap(SortedMap<Integer,String> sortedAreaCodeMap){
  SortedSet<String> descriptionsSet=new TreeSet<String>();
  numOfEntries=sortedAreaCodeMap.size();
  prefixSizeInBytes=getOptimalNumberOfBytesForValue(sortedAreaCodeMap.lastKey());
  phoneNumberPrefixes=ByteBuffer.allocate(numOfEntries * prefixSizeInBytes);
  int index=0;
  for (  Entry<Integer,String> entry : sortedAreaCodeMap.entrySet()) {
    int prefix=entry.getKey();
    storeWordInBuffer(phoneNumberPrefixes,prefixSizeInBytes,index++,prefix);
    possibleLengths.add((int)Math.log10(prefix) + 1);
    descriptionsSet.add(entry.getValue());
  }
  descIndexSizeInBytes=getOptimalNumberOfBytesForValue(descriptionsSet.size() - 1);
  descriptionIndexes=ByteBuffer.allocate(numOfEntries * descIndexSizeInBytes);
  descriptionPool=new String[descriptionsSet.size()];
  descriptionsSet.toArray(descriptionPool);
  index=0;
  for (int i=0; i < numOfEntries; i++) {
    int prefix=readWordFromBuffer(phoneNumberPrefixes,prefixSizeInBytes,i);
    String description=sortedAreaCodeMap.get(prefix);
    int positionInDescriptionPool=Arrays.binarySearch(descriptionPool,description,new Comparator<String>(){
      public int compare(      String o1,      String o2){
        return o1.compareTo(o2);
      }
    }
);
    storeWordInBuffer(descriptionIndexes,descIndexSizeInBytes,index++,positionInDescriptionPool);
  }
}
 

Example 30

From project android_packages_apps_Exchange, under directory /src/com/android/exchange/adapter/.

Source file: CalendarSyncAdapter.java

  15 
vote

private void logEventColumns(ContentValues cv,String reason){
  if (Eas.USER_LOG) {
    StringBuilder sb=new StringBuilder("Event invalid, " + reason + ", skipping: Columns = ");
    for (    Entry<String,Object> entry : cv.valueSet()) {
      sb.append(entry.getKey());
      sb.append('/');
    }
    userLog(TAG,sb.toString());
  }
}
 

Example 31

From project android_packages_apps_Gallery2, under directory /src/com/android/gallery3d/data/.

Source file: DataManager.java

  15 
vote

public void mapMediaItems(ArrayList<Path> list,ItemConsumer consumer,int startIndex){
  HashMap<String,ArrayList<PathId>> map=new HashMap<String,ArrayList<PathId>>();
  int n=list.size();
  for (int i=0; i < n; i++) {
    Path path=list.get(i);
    String prefix=path.getPrefix();
    ArrayList<PathId> group=map.get(prefix);
    if (group == null) {
      group=new ArrayList<PathId>();
      map.put(prefix,group);
    }
    group.add(new PathId(path,i + startIndex));
  }
  for (  Entry<String,ArrayList<PathId>> entry : map.entrySet()) {
    String prefix=entry.getKey();
    MediaSource source=mSourceMap.get(prefix);
    source.mapMediaItems(entry.getValue(),consumer);
  }
}
 

Example 32

From project android_packages_apps_QuickSearchBox, under directory /tests/src/com/android/quicksearchbox/.

Source file: ShortcutRepositoryTest.java

  15 
vote

static <A extends Comparable<A>,B extends Comparable<B>>List<A> sortByValues(Map<A,B> map){
  Comparator<Map.Entry<A,B>> comp=new Comparator<Map.Entry<A,B>>(){
    public int compare(    Entry<A,B> object1,    Entry<A,B> object2){
      int diff=object1.getValue().compareTo(object2.getValue());
      if (diff != 0) {
        return diff;
      }
 else {
        return object1.getKey().compareTo(object2.getKey());
      }
    }
  }
;
  ArrayList<Map.Entry<A,B>> sorted=new ArrayList<Map.Entry<A,B>>(map.size());
  sorted.addAll(map.entrySet());
  Collections.sort(sorted,comp);
  ArrayList<A> out=new ArrayList<A>(sorted.size());
  for (  Map.Entry<A,B> e : sorted) {
    out.add(e.getKey());
  }
  return out;
}
 

Example 33

From project android_packages_inputmethods_LatinIME, under directory /java/src/com/android/inputmethod/latin/.

Source file: UserUnigramDictionary.java

  15 
vote

@Override protected Void doInBackground(Void... v){
  SQLiteDatabase db=mDbHelper.getWritableDatabase();
  Set<Entry<String,Integer>> mEntries=mMap.entrySet();
  for (  Entry<String,Integer> entry : mEntries) {
    Integer freq=entry.getValue();
    db.delete(USER_UNIGRAM_DICT_TABLE_NAME,COLUMN_WORD + "=? AND " + COLUMN_LOCALE+ "=?",new String[]{entry.getKey(),mLocale});
    if (freq != null) {
      db.insert(USER_UNIGRAM_DICT_TABLE_NAME,null,getContentValues(entry.getKey(),freq,mLocale));
    }
  }
  return null;
}
 

Example 34

From project Anki-Android, under directory /src/com/ichi2/anki/.

Source file: Deck.java

  15 
vote

private void updateDynamicIndices(){
  Log.i(AnkiDroidApp.TAG,"updateDynamicIndices - Updating indices...");
  HashMap<String,String> indices=new HashMap<String,String>();
  indices.put("intervalDesc","(type, isDue, priority desc, interval desc)");
  indices.put("intervalAsc","(type, isDue, priority desc, interval)");
  indices.put("randomOrder","(type, isDue, priority desc, factId, ordinal)");
  indices.put("dueAsc","(type, isDue, priority desc, due)");
  indices.put("dueDesc","(type, isDue, priority desc, due desc)");
  ArrayList<String> required=new ArrayList<String>();
  if (mRevCardOrder == REV_CARDS_OLD_FIRST) {
    required.add("intervalDesc");
  }
  if (mRevCardOrder == REV_CARDS_NEW_FIRST) {
    required.add("intervalAsc");
  }
  if (mRevCardOrder == REV_CARDS_RANDOM) {
    required.add("randomOrder");
  }
  if (mRevCardOrder == REV_CARDS_DUE_FIRST || mNewCardOrder == NEW_CARDS_OLD_FIRST || mNewCardOrder == NEW_CARDS_RANDOM) {
    required.add("dueAsc");
  }
  if (mNewCardOrder == NEW_CARDS_NEW_FIRST) {
    required.add("dueDesc");
  }
  Set<Entry<String,String>> entries=indices.entrySet();
  Iterator<Entry<String,String>> iter=entries.iterator();
  while (iter.hasNext()) {
    Entry<String,String> entry=iter.next();
    if (required.contains(entry.getKey())) {
      AnkiDatabaseManager.getDatabase(mDeckPath).getDatabase().execSQL("CREATE INDEX IF NOT EXISTS " + "ix_cards_" + entry.getKey() + " ON cards "+ entry.getValue());
    }
 else {
      AnkiDatabaseManager.getDatabase(mDeckPath).getDatabase().execSQL("DROP INDEX IF EXISTS " + "ix_cards_" + entry.getKey());
    }
  }
}
 

Example 35

From project ANNIS, under directory /annis-gui/src/main/java/annis/gui/resultview/.

Source file: ResultViewPanel.java

  15 
vote

public Set<String> getVisibleTokenAnnos(){
  TreeSet<String> result=new TreeSet<String>();
  for (  Entry<String,Boolean> e : tokenAnnoVisible.entrySet()) {
    if (e.getValue().booleanValue() == true) {
      result.add(e.getKey());
    }
  }
  return result;
}
 

Example 36

From project ant4eclipse, under directory /org.ant4eclipse.ant.jdt/src/org/ant4eclipse/ant/jdt/ecj/.

Source file: CompilerOptionsProvider.java

  15 
vote

/** 
 * This function alters the supplied options so exported preferences containing jdt compiler settings will be altered while removing the preference related prefix.
 * @param options The options currently used. Maybe an exported preferences file. Not <code>null</code>.
 * @return The altered settings. Not <code>null</code>.
 */
private static final StringMap convertPreferences(StringMap options){
  StringMap result=new StringMap();
  for (  Map.Entry<String,String> entry : options.entrySet()) {
    if (entry.getKey().startsWith(PREFS_INSTANCE)) {
      String key=entry.getKey().substring(PREFS_INSTANCE.length());
      if (key.startsWith(PREFS_JDTTYPE)) {
        key=key.substring(PREFS_JDTTYPE.length());
        result.put(key,entry.getValue());
      }
    }
 else {
      result.put(entry.getKey(),entry.getValue());
    }
  }
  return result;
}
 

Example 37

From project any23, under directory /api/src/main/java/org/apache/any23/rdf/.

Source file: Prefixes.java

  15 
vote

public static Prefixes createFromMap(Map<String,String> prefixesToNamespaceURIs,boolean areVolatile){
  Prefixes result=new Prefixes();
  for (  Entry<String,String> entry : prefixesToNamespaceURIs.entrySet()) {
    if (areVolatile) {
      result.addVolatile(entry.getKey(),entry.getValue());
    }
 else {
      result.add(entry.getKey(),entry.getValue());
    }
  }
  return result;
}
 

Example 38

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/dictionaries/.

Source file: AutoDictionary.java

  15 
vote

public void flushToDB(){
  SQLiteDatabase db=mDbHelper.getWritableDatabase();
  Set<Entry<String,Integer>> mEntries=mMap.entrySet();
  for (  Entry<String,Integer> entry : mEntries) {
    Integer freq=entry.getValue();
    db.delete(AUTODICT_TABLE_NAME,COLUMN_WORD + "=? AND " + COLUMN_LOCALE+ "=?",new String[]{entry.getKey(),mLocale});
    if (freq != null) {
      db.insert(AUTODICT_TABLE_NAME,null,getContentValues(entry.getKey(),freq,mLocale));
    }
  }
}
 

Example 39

From project api, under directory /weld-spi/src/main/java/org/jboss/weld/bootstrap/api/helpers/.

Source file: SimpleServiceRegistry.java

  15 
vote

public Iterator<Service> iterator(){
  return new ValueIterator<Class<? extends Service>,Service>(){
    @Override protected Iterator<Entry<Class<? extends Service>,Service>> delegate(){
      return services.entrySet().iterator();
    }
  }
;
}
 

Example 40

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

Source file: URLConfigurationSource.java

  15 
vote

/** 
 * Retrieve the content of the property files. For each poll, it always returns the complete union of properties defined in all URLs. If one property is defined in content of more than one URL, the value in file later on the list will override the value in the previous one. 
 * @param initial this parameter is ignored by the implementation
 * @param checkPoint this parameter is ignored by the implementation
 * @throws IOException IOException occurred in file operation
 */
@Override public PollResult poll(boolean initial,Object checkPoint) throws IOException {
  if (configUrls == null || configUrls.length == 0) {
    return PollResult.createFull(null);
  }
  Map<String,Object> map=new HashMap<String,Object>();
  for (  URL url : configUrls) {
    Properties props=new Properties();
    InputStream fin=url.openStream();
    props.load(fin);
    fin.close();
    for (    Entry<Object,Object> entry : props.entrySet()) {
      map.put((String)entry.getKey(),entry.getValue());
    }
  }
  return PollResult.createFull(map);
}
 

Example 41

From project Archimedes, under directory /br.org.archimedes.core/src/br/org/archimedes/factories/.

Source file: QuickMoveFactory.java

  15 
vote

@Override protected void drawVisualHelper(Point start,Point end){
  if (start.equals(end)) {
    return;
  }
  Vector vector=new Vector(start,end);
  OpenGLWrapper wrapper=br.org.archimedes.Utils.getOpenGLWrapper();
  Map<Element,Collection<Point>> movableClones=createClones(pointsToMove);
  for (  Entry<Element,Collection<Point>> association : movableClones.entrySet()) {
    Element toMove=association.getKey();
    Collection<Point> points=association.getValue();
    try {
      toMove.move(points,vector);
      toMove.drawClone(wrapper);
    }
 catch (    NullArgumentException e) {
      e.printStackTrace();
    }
  }
  wrapper.setLineStyle(OpenGLWrapper.STIPPLED_LINE);
  wrapper.drawFromModel(start,end);
  wrapper.setLineStyle(OpenGLWrapper.CONTINUOUS_LINE);
}
 

Example 42

From project ardverk-commons, under directory /src/main/java/org/ardverk/collection/.

Source file: FixedSizeHashSet.java

  15 
vote

public FixedSizeHashSet(int initialCapacity,float loadFactor,boolean accessOrder,int maxSize){
  map=new FixedSizeHashMap<E,Object>(initialCapacity,loadFactor,accessOrder,maxSize){
    private static final long serialVersionUID=-2214875570521398012L;
    @Override protected boolean removeEldestEntry(    Map.Entry<E,Object> eldest){
      return FixedSizeHashSet.this.removeEldestEntry(eldest.getKey());
    }
    @Override protected void removing(    Entry<E,Object> eldest){
      FixedSizeHashSet.this.removing(eldest.getKey());
    }
  }
;
}
 

Example 43

From project ardverk-dht, under directory /components/core/src/main/java/org/ardverk/dht/routing/.

Source file: DefaultRouteTable.java

  15 
vote

private synchronized void selectR(final KUID contactId,final Collection<Contact> dst,final int count){
  if (contactId == null) {
    throw new NullPointerException("contactId");
  }
  if (dst.size() >= count) {
    return;
  }
  buckets.select(contactId,new Cursor<KUID,DefaultBucket>(){
    @Override public Decision select(    Entry<? extends KUID,? extends DefaultBucket> entry){
      DefaultBucket bucket=entry.getValue();
      return bucket.select(contactId,dst,count);
    }
  }
);
}
 

Example 44

From project arquillian-container-jbossas, under directory /jbossas-embedded-6/src/main/java/org/jboss/arquillian/container/jbossas/embedded_6/.

Source file: JBossASExceptionTransformer.java

  15 
vote

@Override public Throwable transform(Throwable exception){
  IncompleteDeploymentException incompleteDeploymentException=findIncompleteDeploymentException(exception);
  if (incompleteDeploymentException != null) {
    for (    Entry<String,Throwable> entry : incompleteDeploymentException.getIncompleteDeployments().getContextsInError().entrySet()) {
      return entry.getValue();
    }
  }
  return null;
}
 

Example 45

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

private static final <T>void getDefinedClasses(Collection<String> classNames,Collection<Class<T>> needleImpls,Archive<?> archive,Class<T> needle){
  if (isEarArchive(archive)) {
    for (    JavaArchive jar : getScannableNestedArchives(archive,JavaArchive.class,AssetUtil.JAR_FILTER)) {
      getDefinedClasses(classNames,needleImpls,jar,needle);
    }
    for (    WebArchive war : getScannableNestedArchives(archive,WebArchive.class,AssetUtil.WAR_FILTER)) {
      getDefinedClasses(classNames,needleImpls,war,needle);
    }
  }
 else   if (isWarArchive(archive)) {
    ByteAssetClassLoader cl=new ByteAssetClassLoader(archive,ArchiveType.WAR);
    for (    Entry<ArchivePath,Node> node : archive.getContent(AssetUtil.CLASS_FILTER).entrySet()) {
      getDefinedClasses(classNames,needleImpls,ArchiveType.WAR,node.getKey(),node.getValue(),needle,cl);
    }
    for (    JavaArchive jar : getScannableNestedArchives(archive,JavaArchive.class,AssetUtil.JAR_FILTER)) {
      getDefinedClasses(classNames,needleImpls,jar,needle);
    }
  }
 else   if (isJarArchive(archive)) {
    ByteAssetClassLoader cl=new ByteAssetClassLoader(archive,ArchiveType.JAR);
    for (    Entry<ArchivePath,Node> node : archive.getContent(AssetUtil.CLASS_FILTER).entrySet()) {
      getDefinedClasses(classNames,needleImpls,ArchiveType.JAR,node.getKey(),node.getValue(),needle,cl);
    }
  }
}
 

Example 46

From project arquillian-container-osgi, under directory /container-common/src/main/java/org/jboss/arquillian/container/osgi/.

Source file: AbstractOSGiApplicationArchiveProcessor.java

  15 
vote

private void enhanceApplicationArchive(Archive<?> appArchive,TestClass testClass,Manifest manifest){
  if (ClassContainer.class.isAssignableFrom(appArchive.getClass()) == false)   throw new IllegalArgumentException("ClassContainer expected: " + appArchive);
  Class<?> javaClass=testClass.getJavaClass();
  String path=javaClass.getName().replace('.','/') + ".class";
  if (appArchive.contains(path) == false)   ((ClassContainer<?>)appArchive).addClass(javaClass);
  final OSGiManifestBuilder builder=OSGiManifestBuilder.newInstance();
  Attributes attributes=manifest.getMainAttributes();
  for (  Entry<Object,Object> entry : attributes.entrySet()) {
    String key=entry.getKey().toString();
    String value=(String)entry.getValue();
    if (key.equals("Manifest-Version"))     continue;
    if (key.equals(Constants.IMPORT_PACKAGE)) {
      String[] imports=value.split(",");
      builder.addImportPackages(imports);
      continue;
    }
    if (key.equals(Constants.EXPORT_PACKAGE)) {
      String[] exports=value.split(",");
      builder.addExportPackages(exports);
      continue;
    }
    builder.addManifestHeader(key,value);
  }
  builder.addExportPackages(javaClass);
  addImportsForClass(builder,javaClass);
  builder.addImportPackages("org.jboss.arquillian.container.test.api","org.jboss.arquillian.junit","org.jboss.arquillian.osgi","org.jboss.arquillian.test.api");
  builder.addImportPackages("org.jboss.shrinkwrap.api","org.jboss.shrinkwrap.api.asset","org.jboss.shrinkwrap.api.spec");
  builder.addImportPackages("org.junit","org.junit.runner","javax.inject","org.osgi.framework");
  appArchive.delete(ArchivePaths.create(JarFile.MANIFEST_NAME));
  appArchive.add(new Asset(){
    public InputStream openStream(){
      return builder.openStream();
    }
  }
,JarFile.MANIFEST_NAME);
}
 

Example 47

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

Source file: PropertiesParser.java

  15 
vote

public void addProperties(ArquillianDescriptor descriptor,Properties properties){
  if (descriptor == null) {
    throw new IllegalArgumentException("Descriptor must be specified");
  }
  if (properties == null) {
    throw new IllegalArgumentException("Properties must be specified");
  }
  Set<Entry<Object,Object>> filteredProps=filterProperties(properties);
  for (  Entry<Object,Object> entry : filteredProps) {
    for (    Handler handler : handlers) {
      if (handler.handle(String.valueOf(entry.getKey()),String.valueOf(entry.getValue()),descriptor)) {
        break;
      }
    }
  }
}
 

Example 48

From project arquillian-extension-drone, under directory /drone-webdriver/src/main/java/org/jboss/arquillian/drone/webdriver/factory/remote/reusable/.

Source file: ReusedSessionStoreImpl.java

  15 
vote

@Override public ReusedSession pull(InitializationParameter key){
synchronized (rawStore) {
    LinkedList<ByteArray> queue=null;
    for (    Entry<ByteArray,LinkedList<ByteArray>> entry : rawStore.entrySet()) {
      InitializationParameter candidate=entry.getKey().as(InitializationParameter.class);
      if (candidate != null && candidate.equals(key)) {
        queue=entry.getValue();
        break;
      }
    }
    if (queue == null || queue.isEmpty()) {
      return null;
    }
    LinkedList<RawDisposableReusedSession> sessions=getValidSessions(queue);
    if (sessions == null || sessions.isEmpty()) {
      return null;
    }
    RawDisposableReusedSession disposableSession=sessions.getLast();
    disposableSession.dispose();
    return disposableSession.getSession();
  }
}
 

Example 49

From project arquillian-extension-jacoco, under directory /src/main/java/org/jboss/arquillian/extension/jacoco/client/.

Source file: ApplicationArchiveInstrumenter.java

  15 
vote

private void processArchive(Archive<?> archive){
  Map<ArchivePath,Node> classes=archive.getContent(Filters.include(".*\\.class"));
  for (  Entry<ArchivePath,Node> entry : classes.entrySet()) {
    Asset original=entry.getValue().getAsset();
    archive.delete(entry.getKey());
    archive.add(new InstrumenterAsset(original),entry.getKey());
  }
  Map<ArchivePath,Node> jars=archive.getContent();
  for (  Entry<ArchivePath,Node> entry : jars.entrySet()) {
    Asset asset=entry.getValue().getAsset();
    if (asset instanceof ArchiveAsset) {
      Archive<?> subArchive=((ArchiveAsset)asset).getArchive();
      processArchive(subArchive);
    }
  }
}
 

Example 50

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

Source file: ConfigurationImporter.java

  15 
vote

private Map<String,String> convertKeys(Properties properties){
  Map<String,String> convertedFieldsWithValues=new HashMap<String,String>();
  for (  Entry<Object,Object> property : properties.entrySet()) {
    String key=(String)property.getKey();
    String value=(String)property.getValue();
    convertedFieldsWithValues.put(convertFromPropertyKey(key),value);
  }
  return convertedFieldsWithValues;
}
 

Example 51

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

Source file: ConfigurationImporter.java

  15 
vote

private Map<String,String> convertKeys(Properties properties){
  Map<String,String> convertedFieldsWithValues=new HashMap<String,String>();
  for (  Entry<Object,Object> property : properties.entrySet()) {
    String key=(String)property.getKey();
    String value=(String)property.getValue();
    convertedFieldsWithValues.put(convertFromPropertyKey(key),value);
  }
  return convertedFieldsWithValues;
}
 

Example 52

From project arquillian-extension-warp, under directory /ftest/src/main/java/org/jboss/arquillian/warp/ftest/.

Source file: TestingServlet.java

  15 
vote

@Override protected void doGet(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException {
  resp.setContentType("text/html");
  PrintWriter out=resp.getWriter();
  out.write("hello there\n");
  for (  Entry<String,String[]> entry : req.getParameterMap().entrySet()) {
    out.write(entry.getKey() + " = ");
    for (    String value : entry.getValue()) {
      out.write(value);
      out.write(", ");
    }
    out.write("\n");
  }
  out.close();
}
 

Example 53

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 the interceptor instance, or null, if such instance isn't registered.
 * @param interceptor the instance of interceptor to remove
 * @return removed interceptor or null, if such interceptor ins't registered
 */
@Override public CommandInterceptor unregisterInterceptor(CommandInterceptor interceptor){
  Class<? extends CommandInterceptor> typeToRemove=null;
  for (  Entry<Class<? extends CommandInterceptor>,CommandInterceptor> entry : interceptors.entrySet()) {
    if (entry.getValue().equals(interceptor)) {
      typeToRemove=entry.getKey();
      break;
    }
  }
  return interceptors.remove(typeToRemove);
}
 

Example 54

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

Source file: OverallStatistics.java

  15 
vote

@Override public void onSuiteCompleted(){
  printerWriter.println();
  printerWriter.println("=====================");
  printerWriter.println("  Overall Statistics:");
  for (  Entry<ResultConclusion,AtomicLong> entry : conclusionStatistics.entrySet()) {
    long count=entry.getValue().get();
    if (count > 0) {
      printerWriter.println("  " + entry.getKey() + ": "+ count);
    }
  }
  printerWriter.println("=====================");
  printerWriter.flush();
}
 

Example 55

From project arquillian_deprecated, under directory /containers/jbossas-embedded-6/src/main/java/org/jboss/arquillian/container/jbossas/embedded_6/.

Source file: JBossASExceptionTransformer.java

  15 
vote

@Override public Throwable transform(Throwable exception){
  IncompleteDeploymentException incompleteDeploymentException=findIncompleteDeploymentException(exception);
  if (incompleteDeploymentException != null) {
    for (    Entry<String,Throwable> entry : incompleteDeploymentException.getIncompleteDeployments().getContextsInError().entrySet()) {
      return entry.getValue();
    }
  }
  return null;
}
 

Example 56

From project as3-commons-jasblocks, under directory /src/main/java/org/as3commons/asblocks/impl/.

Source file: ASTASProject.java

  15 
vote

@Override public IASFile getFileForCompilationUnit(IASCompilationUnit unit){
  for (  Entry<String,IASFile> set : files.entrySet()) {
    IASFile file=set.getValue();
    if (file.getCompilationUnit().equals(unit)) {
      return file;
    }
  }
  return null;
}
 

Example 57

From project astyanax, under directory /src/main/java/com/netflix/astyanax/connectionpool/impl/.

Source file: AbstractHostPartitionConnectionPool.java

  15 
vote

@Override public void shutdown(){
  ConnectionPoolMBeanManager.getInstance().unregisterMonitor(config.getName(),this);
  for (  Entry<Host,HostConnectionPool<CL>> pool : hosts.entrySet()) {
    pool.getValue().shutdown();
  }
  latencyScoreStrategy.shutdown();
}
 

Example 58

From project ATHENA, under directory /core/apa/src/main/java/org/fracturedatlas/athena/apa/impl/jpa/.

Source file: JpaApaAdapter.java

  15 
vote

@Override public PTicket patchRecord(Object idToPatch,String type,PTicket patchRecord){
  EntityManager em=this.emf.createEntityManager();
  try {
    JpaRecord existingRecord=getTicket(type,idToPatch);
    if (existingRecord == null) {
      throw new ApaException("Record with id [" + idToPatch + "] was not found to patch");
    }
    if (patchRecord == null) {
      return existingRecord.toClientTicket();
    }
    em.getTransaction().begin();
    for (    Entry<String,List<String>> entry : patchRecord.getProps().entrySet()) {
      TicketProp prop=getTicketProp(entry.getKey(),type,idToPatch);
      if (prop != null) {
        prop=em.merge(prop);
        existingRecord.getTicketProps().remove(prop);
        em.remove(prop);
        existingRecord=em.merge(existingRecord);
      }
    }
    List<TicketProp> propsToSave=buildProps(type,existingRecord,patchRecord,em);
    for (    TicketProp prop : propsToSave) {
      enforceStrict(prop.getPropField(),prop.getValueAsString());
      prop=(TicketProp)em.merge(prop);
      existingRecord.addTicketProp(prop);
    }
    existingRecord=saveRecord(existingRecord,em);
    em.getTransaction().commit();
    return existingRecord.toClientTicket();
  }
  finally {
    cleanup(em);
  }
}