Package java.util.Map

Examples of java.util.Map.Entry


    public int getSingleViolation(TreeMap<Integer, Event> treeMapRaster,
            Map<Event, Integer> problemMap) {
        int counter = 0;
        int currentDay;
        Integer newTime;
        Entry entry = treeMapRaster.ceilingEntry(0);

        while (entry != null) {
            int time = (Integer) entry.getKey();
            currentDay = time / dayDuration;
            newTime = treeMapRaster.higherKey(time);
            if (newTime == null) {
                counter++;
                increaseProblemCounter(problemMap, (Event) entry.getValue());
                break;
            } else if (newTime / dayDuration > currentDay) {

                counter++;
                increaseProblemCounter(problemMap, (Event) entry.getValue());
                //we want that time = newTime for the next iteration
                newTime--;
            } else {
                //there couldn't be a violation on currentDay (at least two ti's found)
                newTime = dayDuration * (currentDay + 1) - 1;
View Full Code Here


    public int getSuccessiveViolation(TreeMap raster, Map<Event, Integer> problemMap) {
        int counter = 0;
        int lastTime = 0;
        List<Event> allTIs = new ArrayList<Event>(5);
        for (Object o : raster.entrySet()) {
            Entry entry = (Entry) o;
            int time = (Integer) entry.getKey();
            if (time / dayDuration == lastTime / dayDuration
                    && time - lastTime < 2) {
                // Event with 'time' could be involved in a violation
                lastTime = time;
                allTIs.add((Event) entry.getValue());
                continue;
            }

            // Next day or 'time' is not a consecutive to 'lastTime'
            if (allTIs.size() > 2) {
                counter += allTIs.size() - 2;
                increaseProblemCounter(problemMap, allTIs);
            }

            // Now Event with 'time' could be involved in a violation, too!
            lastTime = time;
            allTIs.clear();
            allTIs.add((Event) entry.getValue());
        }

        if (allTIs.size() > 2) {
            counter += allTIs.size() - 2;
            increaseProblemCounter(problemMap, allTIs);
View Full Code Here

      Transformer transformer = transformerFactory.newTransformer(xslStreamSource);
      if(props != null) {
          Iterator iter = props.entrySet().iterator();
          while(iter.hasNext()) {
              Entry entry = (Entry)iter.next();
              transformer.setParameter((String)entry.getKey(), (String)entry.getValue());
          }
      }
      return transformer;
   }
View Full Code Here

        }

        public void removeOlderThan(long timestamp) {
            final Iterator i = frameAssemblers.entrySet().iterator();
            while (i.hasNext()) {
                final Entry e = (Entry) i.next();
                final Long entryTimestamp = (Long) e.getKey();
                if (entryTimestamp.longValue() < timestamp) {
                    if (TRACE)
                    {
                        System.out.println("Discarding incomplete frame older than " + timestamp + ", ts=" + entryTimestamp);
                    }
View Full Code Here

    private HashMap getCopyMap(HashMap map) {
        HashMap retVal = new HashMap();
        if(map != null){
            Set entries = map.entrySet();
            for (Iterator it = entries.iterator(); it.hasNext();) {
                Entry entry = (Entry) it.next();
                if (entry.getValue() instanceof List) {
                    retVal.put(entry.getKey(), getCopyBookmarks((List) entry.getValue()));
                } else {
                    retVal.put(entry.getKey(), entry.getValue());
                }
            }
        }
        return retVal;
    }
View Full Code Here

      }
     
      BucketMap rowMap = (BucketMap) bucketMaps.get(row);
      for (int i = row; rowMap != null && i < rowBucketCount; ++i)
      {
        Entry totalEntry = rowMap.getTotalEntry();
        rowMap = totalEntry == null ? null : (BucketMap) totalEntry.getValue();
      }

      for (int col = 0; col <= rowRetrColMax[row]; ++col)
      {
        BucketMap colMap = rowMap;
       
        if (col < colBucketCount - 1)
        {
          if (row == rowBucketCount)
          {
            rowMap = (BucketMap) bucketMaps.get(rowBucketCount + col + 1);
          }
          else if (rowMap != null)
          {
            rowMap = (BucketMap) rowMap.get((Bucket) vals.get(rowBucketCount + col));
          }
        }
       
        if (!retrieveTotal[row][col])
        {
          continue;
        }
       
        for (int i = col + 1; colMap != null && i < colBucketCount; ++i)
        {
          colMap = (BucketMap) colMap.getTotalEntry().getValue();
        }
       
        if (colMap != null)
        {
          if (col == colBucketCount)
          {
            MeasureValue[] measureValues = (MeasureValue[]) colMap.get((Bucket) vals.get(rowBucketCount + colBucketCount - 1));
            if (measureValues != null)
            {
              totals[row][col] = getUserMeasureValues(measureValues);
            }
          }
          else
          {
            Map.Entry totalEntry = colMap.getTotalEntry();
            if (totalEntry != null)
            {
              MeasureValue[] totalValues = (MeasureValue[]) totalEntry.getValue();
              totals[row][col] = getUserMeasureValues(totalValues);
            }
          }
        }
       
View Full Code Here

            buffer.append("\n<br>Options:<ul>");
            Map options = entry.getOptions();
            Iterator iter = options.entrySet().iterator();
            while (iter.hasNext())
            {
               Entry e = (Entry) iter.next();
               buffer.append("<li>");
               buffer.append("name=" + e.getKey());
               buffer.append(", value=" + e.getValue());
               buffer.append("</li>\n");
            }
            buffer.append("</ul>\n");
         }
      }
View Full Code Here

            if (!(o instanceof Entry))
            {
                return false;
            }

            Entry e = (Entry)o;
            return (key == null ? e.getKey() == null : key.equals(e.getKey())) &&
                   (value == null ? e.getValue() == null : value.equals(e.getValue()));
        }
View Full Code Here

    try
    {
      writeInt(headers.size());
      for (Iterator it = headers.entrySet().iterator(); it.hasNext(); )
      {
        Entry entry = (Entry) it.next();
        writeInt((Integer)entry.getKey());
        writeObject(entry.getValue());
      }
    }
      catch (Exception ex)
      {
        Constants.ahessianLogger.warn("", ex);
View Full Code Here

    {
        if (!validateElementType(element))
        {
            return false;
        }
        Entry entry = (Entry)element;

        return mapStore.containsKey(sm, entry.getKey());
    }
View Full Code Here

TOP

Related Classes of java.util.Map.Entry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.