本文整理匯總了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();
}