Serializable
Concept
, Item.StringKeyItem
, Task
, TaskLink
, TermLink
public abstract class Item<K> extends Object implements Serializable
It has a key and a budget. Cannot be cloned
Modifier and Type | Class | Description |
---|---|---|
static class |
Item.ItemPriorityComparator<E extends Item> |
|
static class |
Item.StringKeyItem |
Modifier and Type | Field | Description |
---|---|---|
BudgetValue |
budget |
The budget of the Item, consisting of 3 numbers
|
Modifier | Constructor | Description |
---|---|---|
|
Item() |
|
protected |
Item(BudgetValue budget) |
Constructor with initial budget
|
Modifier and Type | Method | Description |
---|---|---|
void |
decDurability(float v) |
Decrease durability value
|
void |
decPriority(float v) |
Decrease priority value
|
boolean |
equals(Object obj) |
|
BudgetValue |
getBudget() |
|
float |
getDurability() |
Get durability value
|
float |
getPriority() |
Get priority value
|
static float |
getPrioritySum(Iterable<? extends Item> c) |
|
float |
getQuality() |
Get quality value
|
int |
hashCode() |
|
void |
incDurability(float v) |
Increase durability value
|
void |
incPriority(float v) |
Increase priority value
|
Item |
merge(Item that) |
Merge with another Item with identical key
|
abstract K |
name() |
Get the current key
|
void |
setDurability(float v) |
Set durability value
|
void |
setPriority(float v) |
Set priority value
|
void |
setQuality(float v) |
Set quality value
|
String |
toString() |
Return a String representation of the Item
|
String |
toStringExternal() |
Return a String representation of the Item after simplification
|
String |
toStringExternal2() |
similar to toStringExternal but includes budget afterward
|
String |
toStringLong() |
public final BudgetValue budget
public Item()
protected Item(BudgetValue budget)
budget
- The initial budgetpublic abstract K name()
public float getPriority()
public void setPriority(float v)
v
- Set a new priority valuepublic void incPriority(float v)
v
- The amount of increasepublic void decPriority(float v)
v
- The amount of decreasepublic float getDurability()
public void setDurability(float v)
v
- The new durability valuepublic void incDurability(float v)
v
- The amount of increasepublic void decDurability(float v)
v
- The amount of decreasepublic float getQuality()
public void setQuality(float v)
v
- The new quality valuepublic Item merge(Item that)
that
- The Item to be mergedpublic String toString()
public String toStringExternal()
public String toStringExternal2()
public String toStringLong()
public BudgetValue getBudget()
Copyright © 2020 OpenNARS. All rights reserved.