Class SearchResult

java.lang.Object
kkchengaf.EnchantmentOrder.SearchResult

public class SearchResult extends Object
A class that store the Search Result, Extends this class as you like
  • Constructor Details

    • SearchResult

      public SearchResult(ArrayList<Integer> weightOrder, BinaryTree btree, Integer anvilCost, Integer enchantmentCost)
      Constructor of the search result
      Parameters:
      weightOrder - , ArrayList of sorted weight
      btree - , BinaryTree of the optimal order
      anvilCost - , the total anvil cost of the result
      enchantmentCost - , the total enchantment cost of the result
  • Method Details

    • getWeightOrder

      public ArrayList<Integer> getWeightOrder()
      get the ArrayList of sorted weight
      Returns:
      ArrayList Integer
    • getBTree

      public BinaryTree getBTree()
      get the Binary Tree
      Returns:
      BinaryTree
    • getAnvilCost

      public Integer getAnvilCost()
      get the total cost of prior work penalty
      Returns:
      Integer
    • getEnchantmentCost

      public Integer getEnchantmentCost()
      get the total cost of the enchantments weights
      Returns:
      Integer
    • toString

      public String toString()
      to String, return the costs, the sorted weights and the tree structure string
      Overrides:
      toString in class Object
      Returns:
      String
    • parseTree

      public Integer parseTree(HashMap<Integer,Integer> input)
      Wrapper to tree.parseTree(arrayList, hashmap)
      Parameters:
      input - , hashmap input
      Returns:
      the total cost to combine all items
    • parseTreeString

      public Integer parseTreeString(HashMap<String,Integer> input)
      String version of searchResult.parseTree, Wrapper to tree.parseTree(arrayList, hashmap)
      Parameters:
      input - , hashmap input
      Returns:
      the total cost to combine all items
    • traversal

      public void traversal(EnchantStep f)
      Wrapper to searchResult.getBTree().traversal(root, f)
      Parameters:
      f - , the function to handle the node information
    • printResult

      public void printResult()
      Override this function as you like, or just call this.traversal(f)