本文整理汇总了Java中nars.entity.Item类的典型用法代码示例。如果您正苦于以下问题:Java Item类的具体用法?Java Item怎么用?Java Item使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Item类属于nars.entity包,在下文中一共展示了Item类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBag
import nars.entity.Item; //导入依赖的package包/类
public void testBag(final boolean arraylist, final int levels, final int capacity, final int forgetRate) {
totalPriority = 0;
totalMass = 0;
totalMaxItemsPerLevel = totalMinItemsPerLevel = 0;
Performance p = new Performance((arraylist ? "DequeArray" : "LinkedList")+","+levels+","+ capacity, repeats, warmups) {
@Override public void init() { }
@Override
public void run(boolean warmup) {
DefaultBag<Item> b = new DefaultBag<Item>(levels, capacity, forgetRate) {
@Override
protected Deque<Item> newLevel() {
if (arraylist)
return super.newLevel();
return new LinkedList<Item>();
}
};
randomBagIO(b, randomAccesses, insertRatio);
if (!warmup) {
totalPriority += b.getAveragePriority();
totalMass += b.getMass();
totalMinItemsPerLevel += b.getMinItemsPerLevel();
totalMaxItemsPerLevel += b.getMaxItemsPerLevel();
}
}
}.printCSV();
//items per level min
//items per lvel max
//avg prioirty
//avg norm mass
//System.out.print((totalMinItemsPerLevel/p.repeats) + ",");
System.out.print((totalMaxItemsPerLevel/p.repeats) + ",");
System.out.print(totalPriority/p.repeats + ",");
System.out.print(totalMass/repeats/((float)levels) + ",");
System.out.println();
}
示例2: toStringLongIfNotNull
import nars.entity.Item; //导入依赖的package包/类
private String toStringLongIfNotNull(Item item, String title) {
return item == null ? "" : "\n " + title + ":\n" +
item.toStringLong();
}
示例3: toStringLongIfNotNull
import nars.entity.Item; //导入依赖的package包/类
private String toStringLongIfNotNull(Item item, String title) {
return item == null ? "" : "\n " + title + ":\n"
+ item.toStringLong();
}