Package EnchantmentOrder
Class NodeValue
java.lang.Object
kkchengaf.EnchantmentOrder.NodeValue
Class that store information of a tree node,
cost: the cost of enchantment weight,
prior: the cost of prior work penalty,
enchant: the mapping of id:lv of the enchantments of this node
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Check if two node values are equalgetCost()
get the equivalent cost of the enchantmentsget the enchantmentsget the height, 0 for leavesgetPrior()
get the prior work penalty, non 0 for non leaf nodesboolean
isItem()
check whether this item is non bookvoid
set the equivalent cost of the enchantmentsvoid
setEnchant
(HashMap<Integer, Integer> enchant) set the enchantmentsvoid
set the heightvoid
set the prior work penaltytoString()
to String value, return "" if enchantment is null, return "item" for the item to be combined, return the enchantments for the books
-
Constructor Details
-
NodeValue
public NodeValue()default constructor -
NodeValue
construct the NodeValue- Parameters:
c
- , the equivalent enchantment weighth
- , the height of the node, 0 for leavesp
- , the prior work penaltye
- , the HashMap Integer,Integer of the enchantments
-
-
Method Details
-
equals
Check if two node values are equal -
setCost
set the equivalent cost of the enchantments- Parameters:
cost
- , Integer
-
setEnchant
set the enchantments- Parameters:
enchant
- , Hashmap
-
setHeight
set the height- Parameters:
h
- , Integer
-
setPrior
set the prior work penalty- Parameters:
prior
- , Integer
-
getCost
get the equivalent cost of the enchantments- Returns:
- Integer
-
getHeight
get the height, 0 for leaves- Returns:
- Integer
-
getPrior
get the prior work penalty, non 0 for non leaf nodes- Returns:
- Integer
-
getEnchant
get the enchantments- Returns:
- HashMap
-
isItem
public boolean isItem()check whether this item is non book- Returns:
- boolean
-
toString
to String value, return "" if enchantment is null, return "item" for the item to be combined, return the enchantments for the books
-