Package com.wesabe.api.accounts.analytics.TagHierarchy

Examples of com.wesabe.api.accounts.analytics.TagHierarchy.Node


      assertThat(italian.getChildren()).isEmpty();
    }
   
    @Test
    public void itUsesCreditCardAsATopTag() throws Exception {
      final Node creditcard = hierarchy.getChildren().get(tag("creditcard"));
      assertThat(creditcard.getSum().getAmount()).isEqualTo(money("50.00", USD));
      assertThat(creditcard.getSum().getCount()).isEqualTo(1);
    }
View Full Code Here


      assertThat(creditcard.getSum().getCount()).isEqualTo(1);
    }
   
    @Test
    public void itNestsTheFeeTagUnderCreditCard() throws Exception {
      final Node creditcard = hierarchy.getChildren().get(tag("creditcard"));
      final Node fee = creditcard.getChildren().get(tag("fee"));
      assertThat(fee.getSum().getAmount()).isEqualTo(money("50.00", USD));
      assertThat(fee.getSum().getCount()).isEqualTo(1);
      assertThat(fee.getChildren()).isEmpty();
    }
View Full Code Here

      assertThat(fee.getChildren()).isEmpty();
    }
   
    @Test
    public void itUsesRestaurantAsATopTag() throws Exception {
      final Node restaurant = hierarchy.getChildren().get(tag("restaurant"));
      assertThat(restaurant.getSum().getAmount()).isEqualTo(money("5.00", USD));
      assertThat(restaurant.getSum().getCount()).isEqualTo(1);
    }
View Full Code Here

      assertThat(restaurant.getSum().getCount()).isEqualTo(1);
    }
   
    @Test
    public void itNestsTheCoffeeTagUnderCreditCard() throws Exception {
      final Node restaurant = hierarchy.getChildren().get(tag("restaurant"));
      final Node coffee = restaurant.getChildren().get(tag("coffee"));
      assertThat(coffee.getSum().getAmount()).isEqualTo(money("5.00", USD));
      assertThat(coffee.getSum().getCount()).isEqualTo(1);
      assertThat(coffee.getChildren()).isEmpty();
    }
View Full Code Here

      assertThat(coffee.getChildren()).isEmpty();
    }
   
    @Test
    public void itUsesRentAsATopTag() throws Exception {
      final Node rent = hierarchy.getChildren().get(tag("rent"));
      assertThat(rent.getSum().getAmount()).isEqualTo(money("1500.00", USD));
      assertThat(rent.getSum().getCount()).isEqualTo(1);
      assertThat(rent.getChildren()).isEmpty();
    }
View Full Code Here

   
    @Before
    public void setup() throws Exception {
      this.food = new Tag("food");
      this.sum = new SumOfMoney(money("20.12", USD), 12);
      this.root = new Node(food, sum, ImmutableList.<Node>of());
    }
View Full Code Here

      this.restaurants = new Tag("restaurants");
      this.restaurantSpending = new SumOfMoney(money("60.00", USD), 6);
      this.groceries = new Tag("groceries");
      this.grocerySpending = new SumOfMoney(money("40.00", USD), 4);

      this.restaurantNode = new Node(restaurants, restaurantSpending, ImmutableList.<Node>of());
      this.groceryNode = new Node(groceries, grocerySpending, ImmutableList.<Node>of());
      this.foodNode = new Node(food, foodSpending, ImmutableList.of(restaurantNode, groceryNode));
    }
View Full Code Here

    @Before
    public void setup() throws Exception {
      this.food = new Tag("food");
      this.foodSpending = new SumOfMoney(money("100.00", USD), 10);
      this.total = new SumOfMoney(money("100.00", USD), 10);
      this.foodNode = new Node(food, foodSpending, ImmutableList.<Node>of());
      this.hierarchy = new TagHierarchy(ImmutableList.of(foodNode), total);
    }
View Full Code Here

    for (Txaction txaction : untaggedTxactions) {
      sum = sum.add(txaction.getConvertedAmount(currency, exchangeRateMap).abs());
    }
   
    if (!untaggedTxactions.isEmpty()) {
      nodes.add(new Node(UNTAGGED, new SumOfMoney(sum, untaggedTxactions.size()), ImmutableList.<Node>of()));
    }
   
    return new TagHierarchy(nodes, new SumOfMoney(total, totalCount));
  }
View Full Code Here

    // summarize each set of txactions
    final List<Node> nodes = Lists.newArrayList();
    for (Tag tag : txactionsByTag.keySet()) {
      final Collection<Txaction> taggedTxactions = txactionsByTag.get(tag);
     
      final Node node = new Node(tag,
        new SumOfMoney(sumForTag(taggedTxactions, tag, currency), taggedTxactions.size()),
        build(tagRankings, taggedTxactions, tagImportanceScheme, currency, maxTags)
      );
      nodes.add(node);
    }
View Full Code Here

TOP

Related Classes of com.wesabe.api.accounts.analytics.TagHierarchy.Node

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.