Package java.util

Examples of java.util.Map


        node.setGroupingElements(groupingElements);  
        CommandContext context = new CommandContext("pid", "test", null, null, 1);    //$NON-NLS-1$ //$NON-NLS-2$
       
        FakeDataManager dataMgr = new FakeDataManager();
        dataMgr.setThrowBlocked(true);
        Map valueMap = new HashMap();
        valueMap.put(new Integer(0), new Integer(1));
        valueMap.put(new Integer(1), new Integer(2));
        valueMap.put(new Integer(2), new Integer(3));
        valueMap.put(new Integer(3), new Integer(4));
        valueMap.put(new Integer(4), new Integer(5));
        dataMgr.defineCodeTable("pm1.g1", "e1", "e2", valueMap); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
                  
        List[] expected = new List[] {
            Arrays.asList(new Object[] { null,           new Integer(1), new Long(4), new Long(4) }),
            Arrays.asList(new Object[] { new Integer(0), new Integer(1), new Long(5), new Long(5) }),
View Full Code Here


            Arrays.asList(new Object[] { new Integer(4), new Integer(5) })   
                };

        dataMgr = new FakeDataManager();
        dataMgr.setThrowBlocked(true);
        Map valueMap = new HashMap();
        valueMap.put(new Integer(1), new Integer(2));
        valueMap.put(new Integer(2), new Integer(3));
        valueMap.put(new Integer(3), new Integer(4));
        valueMap.put(new Integer(4), new Integer(5));
        valueMap.put(new Integer(5), new Integer(6));
        valueMap.put(new Integer(10), new Integer(7));
        valueMap.put(new Integer(11), new Integer(8));
        dataMgr.defineCodeTable("pm1.g1", "e1", "e2", valueMap);         //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
               
        helpTestJoin();       
    }   
View Full Code Here

     */
    void setProperty(Integer propertyID, Object value) {
        if (value != null){
            // Get the default for the property ...
            final Object defaultValue = MappingNodeConstants.Defaults.DEFAULT_VALUES.get(propertyID);
            final Map props = getNodeProperties();      // props is never null
            if ( !value.equals(defaultValue) ) {        // we know value is not null
                // Set the value only if different than the default; note that the 'getProperty'
                // method is returning the default if there isn't a value
                props.put(propertyID, value);
            } else {
                // The value is equal to the default, so because we didn't set it
                // we have to make sure to remove any existing value ...
                props.remove(propertyID);
            }
        }
    }
View Full Code Here

  public static void main(String args[]) {
    if(args.length < 2) {
      usage();
      System.exit(0);
    }
    Map parameters = new HashMap();
    for(int i = 2 ; i < args.length ; i++) {
      boolean ok = parseParameter(args[i],parameters);
      if(!ok) System.exit(-1);
    }
    File f = new File(args[1]);
View Full Code Here

    // Give them v3 by default since they've (in theory) never used az2ui
    // Note: Users with any existing 3.x.x.x version will not get because
    //       they have the "ui" parameter set and there's logic above to
    //       exit early.
    try {
      Map map = FileUtil.readResilientConfigFile("azureus.statistics");
      if (map != null) {
        Map overallMap = (Map) map.get("all");
        if (overallMap != null) {
          long uptime = 0;
          Object uptimeObject = overallMap.get("uptime");
          if (uptimeObject instanceof Number) {
            uptime = ((Number) uptimeObject).longValue();
          }
          // during a previous azureus, we may have screwed up uptime
          // and it might be zero.. so check for that..
View Full Code Here

  }
 
  // used externally
  public Map decodeByteBuffer(ByteBuffer buffer, boolean internKeys) throws IOException {
    InputStream is = new BDecoderInputStreamArray(buffer);
    Map result = decode(is,internKeys);
    buffer.position(buffer.limit()-is.available());
    return result;
  }
View Full Code Here

   
    switch (tempByte) {
    case 'd' :
        //create a new dictionary object
     
      Map tempMap = new LightHashMap();

      try{
          //get the key  
       
        while (true) {
         
          dbis.mark(Integer.MAX_VALUE);

          tempByte = dbis.read();
          if(tempByte == 'e' || tempByte == -1)
            break; // end of map

          dbis.reset();
         
          // decode key strings manually so we can reuse the bytebuffer

          int keyLength = (int)getPositiveNumberFromStream(dbis, ':');

          if ( keyLength > MAX_MAP_KEY_SIZE ){
            byte[] remaining = new byte[128];
            getByteArrayFromStream(dbis, 128, remaining);
            String msg = "dictionary key is too large, max=" + MAX_MAP_KEY_SIZE + ": value=" + new String(remaining);
            System.err.println( msg );
            throw( new IOException( msg ));
          }
         
          if(keyLength < keyBytesBuffer.capacity())
          {
            keyBytesBuffer.position(0).limit(keyLength);
            keyCharsBuffer.position(0).limit(keyLength);
          } else {
            keyBytesBuffer = ByteBuffer.allocate(keyLength);
            keyCharsBuffer = CharBuffer.allocate(keyLength);
          }
         
          getByteArrayFromStream(dbis, keyLength, keyBytesBuffer.array());           

         
          keyDecoder.reset();
          keyDecoder.decode(keyBytesBuffer,keyCharsBuffer,true);
          keyDecoder.flush(keyCharsBuffer);
          String key = new String(keyCharsBuffer.array(),0,keyCharsBuffer.limit());
         
          // keys often repeat a lot - intern to save space
          if (internKeys)
            key = StringInterner.intern( key );
         
         

          //decode value

          Object value = decodeInputStream(dbis,nesting+1,internKeys);
         
          // value interning is too CPU-intensive, let's skip that for now
          /*if(value instanceof byte[] && ((byte[])value).length < 17)
          value = StringInterner.internBytes((byte[])value);*/

          if ( TRACE ){
            System.out.println( key + "->" + value + ";" );
          }
         
            // recover from some borked encodings that I have seen whereby the value has
            // not been encoded. This results in, for example,
            // 18:azureus_propertiesd0:e
            // we only get null back here if decoding has hit an 'e' or end-of-file
            // that is, there is no valid way for us to get a null 'value' here
         
          if ( value == null ){
           
            System.err.println( "Invalid encoding - value not serialsied for '" + key + "' - ignoring" );
           
            break;
          }
       
          if ( tempMap.put( key, value) != null ){
           
            Debug.out( "BDecoder: key '" + key + "' already exists!" );
          }
        }

View Full Code Here

      writer.println( indent + "]" );

    }else{

      Map  m = (Map)obj;

      Iterator  it = m.keySet().iterator();

      while( it.hasNext()){

        String  key = (String)it.next();

        if ( key.length() > 256 ){
          writer.print( indent + key.substring(0,256) + "... = " );
        }else{
          writer.print( indent + key + " = " );
        }

        print( writer, m.get(key), indent + "  ", true );
      }
    }
  }
View Full Code Here

  
        synchronized( handed_out ){
       
          Iterator  it = handed_out.values().iterator();
         
          Map  cap_map    = new TreeMap();
          Map  alloc_map  = new TreeMap();
         
          while( it.hasNext()){
           
            DirectByteBuffer  db = (DirectByteBuffer)it.next();
           
            if ( verbose ){
              String  trace = db.getTraceString();
             
              if ( trace != null ){
               
                System.out.println( trace );
              }
            }
           
            Integer cap   = new Integer( db.getBufferInternal().capacity());
            Byte  alloc   = new Byte( db.getAllocator());
           
            myInteger  c = (myInteger)cap_map.get(cap);
           
            if ( c == null ){
             
              c  = new myInteger();
             
              cap_map.put( cap, c );
            }
           
            c.value++;
           
          myInteger  a = (myInteger)alloc_map.get(alloc);
           
            if ( a == null ){
             
              a  = new myInteger();
             
              alloc_map.put( alloc, a );
            }
           
            a.value++;       
          }
         
          it = cap_map.keySet().iterator();
         
          while( it.hasNext()){
           
            Integer    key   = (Integer)it.next();
            myInteger  count   = (myInteger)cap_map.get( key );
           
                if( key.intValue() < 1024 ){
                 
                  System.out.print("[" +key.intValue()+ " x " +count.value+ "] ");
                 
                }else
                 
                  System.out.print("[" +key.intValue()/1024+ "K x " +count.value+ "] ");
                }
          }
         
          System.out.println();
         
        it = alloc_map.keySet().iterator();
         
          while( it.hasNext()){
           
            Byte    key   = (Byte)it.next();
            myInteger  count   = (myInteger)alloc_map.get( key );
           
                System.out.print("[" + DirectByteBuffer.AL_DESCS[key.intValue()]+ " x " +count.value+ "] ");
          }
         
          if ( cm != null ){
View Full Code Here

     
      for (Object object : availableDrives) {
        File f = (File) object;
        System.out.println(f.getAbsolutePath());

        Map driveInfo = AEWin32AccessInterface.getDriveInfo(f.getPath().charAt(0));
        for (Iterator iter = driveInfo.keySet().iterator(); iter.hasNext();) {
          Object key = (Object) iter.next();
          Object val = driveInfo.get(key);
          System.out.println(key + ": " + val);
        }
       
      }
     
View Full Code Here

TOP

Related Classes of java.util.Map

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.