Package cs412.hw3.item

Examples of cs412.hw3.item.Item


    return this;
  }

  public void checkCanCraft(Player player) {
    for (int i = 0; i < costs.size(); i++) {
      Item item = costs.get(i);
      if (item instanceof ResourceItem) {
        ResourceItem ri = (ResourceItem) item;
        if (!player.inventory.hasResources(ri.resource, ri.count)) {
          canCraft = false;
          return;
View Full Code Here


  public abstract void craft(Player player);

  public void deductCost(Player player) {
    for (int i = 0; i < costs.size(); i++) {
      Item item = costs.get(i);
      if (item instanceof ResourceItem) {
        ResourceItem ri = (ResourceItem) item;
        player.inventory.removeResource(ri.resource, ri.count);
      }
    }
View Full Code Here

      screen.render(xo, 2 * 8, recipe.resultTemplate.getSprite(), recipe.resultTemplate.getColor(), 0);
      Font.draw("" + hasResultItems, screen, xo + 8, 2 * 8, Color.get(-1, 555, 555, 555));

      List<Item> costs = recipe.costs;
      for (int i = 0; i < costs.size(); i++) {
        Item item = costs.get(i);
        int yo = (5 + i) * 8;
        screen.render(xo, yo, item.getSprite(), item.getColor(), 0);
        int requiredAmt = 1;
        if (item instanceof ResourceItem) {
          requiredAmt = ((ResourceItem) item).count;
        }
        int has = player.inventory.count(item);
View Full Code Here

    if (len == 0) selected = 0;
    if (selected < 0) selected += len;
    if (selected >= len) selected -= len;

    if (input.attack.clicked && len > 0) {
      Item item = player.inventory.items.remove(selected);
      player.activeItem = item;
      game.setMenu(null);
    }
  }
View Full Code Here

      double ig_ub_DB_CARDINALITY = myDBRef.IGub(P, ai);
      if(maxIG > ig_ub_DB_CARDINALITY){
        //skip mining on Db
      }
      else{
        ConditionalDB cond_db_for_B = myDBRef.getConditionalDBForPattern(B);
        FPTree Pb = cond_db_for_B.buildConditionalFPTree();
        if(Pb.getCount() == P.getCount()){
          System.out.println("skipping an entire branch since support is the same");
        }else{
          branch_and_bound(Pb,s,B);
        }
View Full Code Here

  public void processFile(String filePath){
    try {
      BufferedReader br = new BufferedReader(new FileReader(new File(filePath)));
      String line = br.readLine();
      while(line != null){
        Transaction t = readTransaction(line);
        dbRef.addTransaction(t);
        line = br.readLine();
      }
    } catch (Exception e) {
      Log.writeError(e.getMessage());
View Full Code Here

    int largest = Integer.valueOf(i.getItemName()).intValue();
    if(Double.isNaN(largestItemFoundInit) ||  largest > largestItemFound){
      largestItemFound = largest;
    }
    String classLabel = t.nextToken();
    Transaction tran = new Transaction(TID++,classLabel,items);
    return tran;
  }
View Full Code Here

  public void processFile(String filePath){
    try {
      BufferedReader br = new BufferedReader(new FileReader(new File(filePath)));
      String line = br.readLine();
      while(line != null){
        Transaction t = readTransaction(line);
        modifyTransaction(t);
        tranList.add(t);
        line = br.readLine();
      }
    } catch (Exception e) {
View Full Code Here

    while(t.countTokens() > 1){
      items.add(new Item(t.nextToken()));
    }

    String classLabel = t.nextToken();
    Transaction tran = new Transaction(TID++,classLabel,items);
    return tran;
  }
View Full Code Here

    recentNodeLinkForItem.put(newChild.getLabel().getItemName(), newChild);
  }

  public static void main(String[] args){
    List<Transaction> trans = new ArrayList<Transaction>();
    trans.add( new Transaction(1,"0","m","o","n","k","e","y"));
    trans.add( new Transaction(2,"1","d","o","n","k","e","y"));
    trans.add( new Transaction(3,"1","m","a","k","e"));
    trans.add( new Transaction(4,"0","m","u","c","k","y"));
    trans.add( new Transaction(5,"0","c","o","o","k","i","e"));
    int min_sup = 3;
    TransactionDB db = new TransactionDB(min_sup);
    db.addTransactions(trans);
    FPTreeBuilder builder = new FPTreeBuilder(db);
   
View Full Code Here

TOP

Related Classes of cs412.hw3.item.Item

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.