当前位置: 首页>>代码示例>>Java>>正文


Java TLongObjectProcedure类代码示例

本文整理汇总了Java中gnu.trove.procedure.TLongObjectProcedure的典型用法代码示例。如果您正苦于以下问题:Java TLongObjectProcedure类的具体用法?Java TLongObjectProcedure怎么用?Java TLongObjectProcedure使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TLongObjectProcedure类属于gnu.trove.procedure包,在下文中一共展示了TLongObjectProcedure类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: retainEntries

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings({"unchecked"})
public boolean retainEntries( TLongObjectProcedure<? super V> procedure ) {
    boolean modified = false;
    byte[] states = _states;
    long[] keys = _set;
    V[] values = _values;

    // Temporarily disable compaction. This is a fix for bug #1738760
    tempDisableAutoCompaction();
    try {
        for ( int i = keys.length; i-- > 0; ) {
            if ( states[i] == FULL && ! procedure.execute( keys[i], values[i] ) ) {
                removeAt( i );
                modified = true;
            }
        }
    }
    finally {
        reenableAutoCompaction( true );
    }

    return modified;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:25,代码来源:TLongObjectHashMap.java

示例2: toString

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
public String toString() {
    final StringBuilder buf = new StringBuilder("{");
    forEachEntry(new TLongObjectProcedure<V>() {
        private boolean first = true;
        public boolean execute(long key, Object value) {
            if ( first ) first = false;
            else buf.append( "," );

            buf.append(key);
            buf.append("=");
            buf.append(value);
            return true;
        }
    });
    buf.append("}");
    return buf.toString();
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:18,代码来源:TLongObjectHashMap.java

示例3: retainEntries

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
public boolean retainEntries( TLongObjectProcedure<? super V> procedure ) {
    boolean modified = false;
    byte[] states = _states;
    long[] keys = _set;
    V[] values = _values;

    // Temporarily disable compaction. This is a fix for bug #1738760
    tempDisableAutoCompaction();
    try {
        for ( int i = keys.length; i-- > 0; ) {
            if ( states[i] == FULL && ! procedure.execute( keys[i], values[i] ) ) {
                removeAt( i );
                modified = true;
            }
        }
    }
    finally {
        reenableAutoCompaction( true );
    }

    return modified;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:24,代码来源:TLongObjectHashMap.java

示例4: retainEntries

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean retainEntries( TLongObjectProcedure<? super V> procedure ) {
    boolean modified = false;
    byte[] states = _states;
    long[] keys = _set;
    V[] values = _values;

    // Temporarily disable compaction. This is a fix for bug #1738760
    tempDisableAutoCompaction();
    try {
        for ( int i = keys.length; i-- > 0; ) {
            if ( states[i] == FULL && ! procedure.execute( keys[i], values[i] ) ) {
                removeAt( i );
                modified = true;
            }
        }
    }
    finally {
        reenableAutoCompaction( true );
    }

    return modified;
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:25,代码来源:TLongObjectHashMap.java

示例5: toString

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
@Override
public String toString() {
    final StringBuilder buf = new StringBuilder("{");
    forEachEntry(new TLongObjectProcedure<V>() {
        private boolean first = true;
        @Override
        public boolean execute(long key, Object value) {
            if ( first ) first = false;
            else buf.append( "," );

            buf.append(key);
            buf.append("=");
            buf.append(value);
            return true;
        }
    });
    buf.append("}");
    return buf.toString();
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:20,代码来源:TLongObjectHashMap.java

示例6: retainEntries

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings({"unchecked"})
public boolean retainEntries( TLongObjectProcedure<V> procedure ) {
    boolean modified = false;
    byte[] states = _states;
    long[] keys = _set;
    V[] values = _values;

    // Temporarily disable compaction. This is a fix for bug #1738760
    tempDisableAutoCompaction();
    try {
        for ( int i = keys.length; i-- > 0; ) {
            if ( states[i] == FULL && ! procedure.execute( keys[i], values[i] ) ) {
                removeAt( i );
                modified = true;
            }
        }
    }
    finally {
        reenableAutoCompaction( true );
    }

    return modified;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:25,代码来源:TLongObjectHashMap.java

示例7: writeBinary

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
@Override
public void writeBinary(final DataOutput out) throws IOException {
	out.writeLong(this.size());
	this.forEachEntry(new TLongObjectProcedure<TimeFrequency>() {

		@Override
		public boolean execute(long a, TimeFrequency b) {
			try {
				b.writeBinary(out);
			} catch (final IOException e) {
				return false;
			}
			return true;
		}
	});
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:17,代码来源:TimeFrequencyHolder.java

示例8: forEachEntry

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings({"unchecked"})
public boolean forEachEntry( TLongObjectProcedure<? super V> procedure ) {
    byte[] states = _states;
    long[] keys = _set;
    V[] values = _values;
    for (int i = keys.length; i-- > 0;) {
        if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
            return false;
        }
    }
    return true;
}
 
开发者ID:JianpingZeng,项目名称:xcc,代码行数:14,代码来源:TLongObjectHashMap.java

示例9: forEachEntry

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
public boolean forEachEntry( TLongObjectProcedure<? super V> procedure ) {
    byte[] states = _states;
    long[] keys = _set;
    V[] values = _values;
    for (int i = keys.length; i-- > 0;) {
        if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
            return false;
        }
    }
    return true;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:13,代码来源:TLongObjectHashMap.java

示例10: forEachEntry

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public boolean forEachEntry( TLongObjectProcedure<? super V> procedure ) {
    byte[] states = _states;
    long[] keys = _set;
    V[] values = _values;
    for (int i = keys.length; i-- > 0;) {
        if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
            return false;
        }
    }
    return true;
}
 
开发者ID:palantir,项目名称:trove-3.0.3,代码行数:14,代码来源:TLongObjectHashMap.java

示例11: forEachEntry

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings({"unchecked"})
public boolean forEachEntry( TLongObjectProcedure<V> procedure ) {
    byte[] states = _states;
    long[] keys = _set;
    V[] values = _values;
    for (int i = keys.length; i-- > 0;) {
        if (states[i] == FULL && ! procedure.execute(keys[i],values[i])) {
            return false;
        }
    }
    return true;
}
 
开发者ID:major2015,项目名称:easyrec_major,代码行数:14,代码来源:TLongObjectHashMap.java

示例12: readTimeIndex

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
/**
 * Read a {@link TimeFrequencyHolder} from a {@link Path}. Path is assumed
 * to be a directory containing many {@link TimeFrequencyHolder} instances.
 *
 * @param indexOut
 * @return a new {@link TimeFrequencyHolder}
 * @throws IOException
 */
public static TimeFrequencyHolder readTimeIndex(Path indexOut) throws IOException {
	if (!HadoopToolsUtil.fileExists(indexOut.toString())) {
		return null;
	}
	System.out.println("Reading time index from: " + indexOut);
	final TimeFrequencyHolder tfh = new TimeFrequencyHolder();

	final FileSystem fs = HadoopToolsUtil.getFileSystem(indexOut);
	final FileStatus[] indexParts = fs.listStatus(indexOut);
	for (final FileStatus fileStatus : indexParts) {
		System.out.println("Reading index part: " + fileStatus.getPath());
		FSDataInputStream in = null;
		try {
			in = fs.open(fileStatus.getPath());
			final TimeFrequencyHolder tempTfh = IOUtils.read(in, TimeFrequencyHolder.class);
			tempTfh.forEachEntry(new TLongObjectProcedure<TimeFrequency>() {
				@Override
				public boolean execute(long a, TimeFrequency b) {
					tfh.put(a, b); // This is safe because each time
					// frequency should contain completely
					// unique times!
					return true;
				}
			});
		} finally {
			in.close();
		}
	}
	tfh.recalculateCumulativeFrequencies();
	return tfh;

}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:41,代码来源:CountTweetsInTimeperiod.java

示例13: clear

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
private void clear(final CommandSender sender, final World world) {
    final TInt21TripleObjectHashMap<?> registry = plugin.getWorldRegistry().get(world.getName());
    if (registry == null) {
        sender.sendMessage("[Sprout] World [" + world.getName() + "] has no registry of sprouts.");
        return;
    }
    sender.sendMessage("[Sprout] Clearing all sprouts for world [" + world.getName() + "]. WARNING: THIS MAY TAKE SOME TIME...");
    ((SaveThread) ThreadRegistry.get(world.getName())).clear();
    registry.getInternalMap().forEachEntry(new TLongObjectProcedure<Object>() {
        @Override
        public boolean execute(long l, Object o) {
            final Sprout sprout = (Sprout) o;
            if (sprout != null) {
                final int x = Int21TripleHashed.key1(l);
                final int y = Int21TripleHashed.key2(l);
                final int z = Int21TripleHashed.key3(l);

                final Block block = Bukkit.getWorld(world.getName()).getBlockAt(x, y, z);
                ((SpoutBlock) block).setCustomBlock(null);
                block.setType(Material.AIR);
                ((SaveThread) ThreadRegistry.get(world.getName())).remove(l, (SimpleSprout) sprout);
            }
            return true;
        }
    });
    registry.clear();
    GrowthTask.schedule(plugin, false, world);
}
 
开发者ID:AlmuraDev,项目名称:Sprout,代码行数:29,代码来源:SproutExecutor.java

示例14: dropAll

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
public void dropAll() {         
	if (configuration instanceof H2Configuration) {  
		db.directQuery("delete FROM `sprouts` where stillGrowing > 0");
	} else if (configuration instanceof SQLiteConfiguration) {
		db.directQuery("delete FROM `sprouts` where stillGrowing > 0");
	} else { // Should be MySQL
		db.directQuery("delete FROM `sprout`.`sprouts` where stillGrowing > 0");
	}
    
	
    for (final World world : Bukkit.getWorlds()) {
        final TInt21TripleObjectHashMap<?> registry = plugin.getWorldRegistry().get(world.getName());
        if (registry == null) {
            continue;
        }
        saved = 0;
        registry.getInternalMap().forEachEntry(new TLongObjectProcedure<Object>() {
            @Override
            public boolean execute(long l, Object o) {
                final SimpleSprout sprout = (SimpleSprout) o;
                if (sprout.isFullyGrown()) {
                    return true;
                }
                final int x = Int21TripleHashed.key1(l);
                final int y = Int21TripleHashed.key2(l);
                final int z = Int21TripleHashed.key3(l);
                db.save(new Sprouts(world.getName(), Int21TripleHashed.key(x, y, z), sprout.getName(), sprout.getAge(), !sprout.isFullyGrown()));
                saved += 1;
                return true;
            }
        });
        Bukkit.getLogger().info("[Sprout] Saving World: " + world.getName() + " Sprouts: " + saved);
    }
}
 
开发者ID:AlmuraDev,项目名称:Sprout,代码行数:35,代码来源:SimpleSQLStorage.java

示例15: indexCountries

import gnu.trove.procedure.TLongObjectProcedure; //导入依赖的package包/类
private void indexCountries(final AddressIndexWriter addressIndexWriter) {
    kladrCache.forEachCountry(new TLongObjectProcedure<Country>() {
        public boolean execute(long kladrCode, Country country) {
            addressIndexWriter.write(country.getIndex(), addressBuilder.buildFor(country));
            return true;
        }
    });
}
 
开发者ID:jamel,项目名称:kladr,代码行数:9,代码来源:KladrIndexer.java


注:本文中的gnu.trove.procedure.TLongObjectProcedure类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。