Examples of MutableInt


Examples of com.garbagemule.MobArena.util.MutableInt

            ints = new HashMap<String, MutableInt>();
        }

        ints.clear();

        ints.put("kills", new MutableInt());
        ints.put("dmgDone", new MutableInt());
        ints.put("dmgTaken", new MutableInt());
        ints.put("swings", new MutableInt());
        ints.put("hits", new MutableInt());
        ints.put("lastWave", new MutableInt());
    }
View Full Code Here

Examples of com.garbagemule.MobArena.util.MutableInt

            plugin.saveConfig();
        }
       
        // Populate the limits map using the values in the config-file.
        for (ArenaClass ac : classes.values()) {
            classLimits.put(ac, new MutableInt(limits.getInt(ac.getConfigName(), -1)));
        }
    }
View Full Code Here

Examples of com.garbagemule.MobArena.util.MutableInt

     * @return true/false
     */
    public boolean canPlayerJoinClass(ArenaClass ac) {
        if (classLimits.get(ac) == null) {
            limits.set(ac.getConfigName(), -1);
            classLimits.put(ac, new MutableInt(-1));
            classesInUse.put(ac, new HashSet<String>());
        }
       
        if (classLimits.get(ac).value() <= -1)
            return true;
View Full Code Here

Examples of de.sciss.util.MutableInt

  {
    int          idx      = editIndexOf( readSpan.start, true, ce );
    if( idx < 0 ) idx = -(idx + 2);
    final long      startR    = decimHelps[sub].roundAdd - readSpan.start;
    final List      coll    = editGetCollByStart( ce );
    final MutableInt  readyLen  = new MutableInt( 0 );
    final MutableInt  busyLen    = new MutableInt( 0 );
    DecimatedStake  stake;
    int          chunkLen, discrepancy;
    Span        subSpan;
    int          readOffset, nextOffset = dataOffset;
    int          len      = (int) (readSpan.getLength() >> decimHelps[ sub ].shift);

    while( (len > 0) && (idx < coll.size()) ) {
      stake    = (DecimatedStake) coll.get( idx );
      subSpan    = new Span( Math.max( stake.getSpan().start, readSpan.start ),
                  Math.min( stake.getSpan().stop, readSpan.stop ));
      stake.readFrames( sub, data, nextOffset, subSpan, readyLen, busyLen );
      chunkLen  = readyLen.value() + busyLen.value();
      readOffset  = nextOffset + readyLen.value(); // chunkLen;
      nextOffset  = (int) ((subSpan.stop + startR) >> decimHelps[ sub ].shift) + dataOffset;
      discrepancy  = nextOffset - readOffset;
      len      -= readyLen.value() + discrepancy;
      if( busyLen.value() == 0 ) {
        if( discrepancy > 0 ) {
          if( readOffset > 0 ) {
            for( int i = readOffset, k = readOffset - 1; i < nextOffset; i++ ) {
              for( int j = 0; j < data.length; j++ ) {
                data[ j ][ i ] = data[ j ][ k ];
              }
            }
          }
        }
      } else {
        busyList.add( new Span( subSpan.stop - (subSpan.getLength() * busyLen.value() / chunkLen),
                    subSpan.stop ));
        for( int i = Math.max( 0, readOffset ); i < nextOffset; i++ ) {
          for( int j = 0; j < data.length; j++ ) {
            data[ j ][ i ] = 0f;
          }
View Full Code Here

Examples of de.sciss.util.MutableInt

  {
    int          idx      = editIndexOf( readSpan.start, true, ce );
    if( idx < 0 ) idx = -(idx + 2);
    final long      startR    = decimHelps[ sub ].roundAdd - readSpan.start;
    final List      coll    = editGetCollByStart( ce );
    final MutableInt  readyLen  = new MutableInt( 0 );
    final MutableInt  busyLen    = new MutableInt( 0 );
    // someReady is a transient trick to keep a newly opened documented
    // responsive (since it's zoomed out completely and due to the missing
    // decimation drawWaveform would take ages)
    boolean        someReady  = false;
    DecimatedStake    stake;
    int          chunkLen, discrepancy;
    Span        subSpan;
    int          readOffset, nextOffset = dataOffset;
    int          len      = (int) (readSpan.getLength() >> decimHelps[ sub ].shift );
   
    while( (len > 0) && (idx < coll.size()) ) {
      stake    = (DecimatedStake) coll.get( idx );
      subSpan    = new Span( Math.max( stake.getSpan().start, readSpan.start ),
                  Math.min( stake.getSpan().stop, readSpan.stop ));
      stake.readFrames( sub, data, nextOffset, subSpan, readyLen, busyLen );
      chunkLen  = readyLen.value() + busyLen.value();
      readOffset  = nextOffset + readyLen.value(); // chunkLen;
      nextOffset  = (int) ((subSpan.stop + startR) >> decimHelps[ sub ].shift) + dataOffset;
      discrepancy  = nextOffset - readOffset;
      len      -= readyLen.value() + discrepancy;
      if( readyLen.value() > 0 ) someReady = true;
      if( busyLen.value() == 0 ) {
        if( discrepancy > 0 ) {
          if( readOffset > 0 ) {
            for( int i = readOffset, k = readOffset - 1; i < nextOffset; i++ ) {
              for( int j = 0; j < data.length; j++ ) {
                data[ j ][ i ] = data[ j ][ k ];
              }
            }
          }
        }
      } else {
        final Span busySpan = new Span( subSpan.stop - (subSpan.getLength() * busyLen.value() / chunkLen),
                                        subSpan.stop );
        final int busyLastIdx = busyList.size() - 1;
        if( busyLastIdx >= 0 ) {
          final Span busySpan2 = (Span) busyList.get( busyLastIdx );
          if( busySpan.touches( busySpan2 )) {
View Full Code Here

Examples of dovetaildb.util.MutableInt

  }
 
  static final class ReadWriteLocker {
    final TIntObjectHashMap<MutableInt> map = new TIntObjectHashMap<MutableInt>();
    public void lockForRead(int i) {
      MutableInt val;
      synchronized(map) {
        if (! map.containsKey(i)) {
          map.put(i, new MutableInt(1));
          return;
        }
        val = map.get(i);
      }
      synchronized(val)  {
        while (val.get() == -1) {
          try {
            val.wait();
          } catch (InterruptedException e) {
            throw new RuntimeException(e);
          }
        }
        val.incr();
      }
    }
View Full Code Here

Examples of hivemall.utils.lang.mutable.MutableInt

        IMapIterator<String, MutableInt> itor = map.entries();
        Assert.assertFalse(itor.hasNext());

        final int numEntries = 1000000;
        for(int i = 0; i < numEntries; i++) {
            map.put(Integer.toString(i), new MutableInt(i));
        }

        final MutableInt probe = new MutableInt();
        itor = map.entries();
        Assert.assertTrue(itor.hasNext());
        while(itor.hasNext()) {
            Assert.assertFalse(itor.next() == -1);
            String k = itor.getKey();
            itor.getValue(probe);
            Assert.assertEquals(Integer.valueOf(k).intValue(), probe.intValue());
        }
        Assert.assertEquals(-1, itor.next());
    }
View Full Code Here

Examples of org.antlr.v4.misc.MutableInt

    for (Map.Entry<String, MutableInt> entry : a.entrySet()) {
      result.get(entry.getKey()).v = entry.getValue().v;
    }

    for (Map.Entry<String, MutableInt> entry : b.entrySet()) {
      MutableInt slot = result.get(entry.getKey());
      slot.v = Math.max(slot.v, entry.getValue().v);
    }

    return result;
  }
View Full Code Here

Examples of org.apache.commons.lang.mutable.MutableInt

        xpath.addNamespace("m1", "http://services.samples/xsd2");
        return xpath;
    }

    private void test(ValidateMediator validate, MessageContext synCtx, boolean expectFail) {
        final MutableInt onFailInvoked = new MutableInt();
        TestMediator testMediator = new TestMediator();
        testMediator.setHandler(
                new TestMediateHandler() {
                    public void handle(MessageContext synCtx) {
                        onFailInvoked.setValue(1);
                    }
                });
        // set dummy mediator to be called on fail
        validate.addChild(testMediator);
        validate.mediate(synCtx);
        if (expectFail) {
            assertTrue("Expected ValidateMediator to trigger fail sequence",
                    onFailInvoked.intValue() == 1);
        } else {
            assertTrue("ValidateMediator unexpectedly triggered fail sequence",
                    onFailInvoked.intValue() == 0);
        }
    }
View Full Code Here

Examples of org.apache.commons.lang.mutable.MutableInt

    protected Object parseValue(String argStr, MutableInt parsePos) {
        return parseObject(storeDef.getValueSerializer(), argStr, parsePos);
    }

    protected void processPut(String putArgStr) {
        MutableInt parsePos = new MutableInt(0);
        Object key = parseKey(putArgStr, parsePos);
        putArgStr = putArgStr.substring(parsePos.intValue());
        Object value = parseValue(putArgStr, parsePos);
        client.put(key, value);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.