Examples of IntValueHolder


Examples of com.senseidb.indexing.activity.time.TimeAggregatedActivityValues.IntValueHolder

  @Test
  public void test1MinutesMoreThanActivities() {
    int capacity = 1;
    TimeHitsHolder timeHitsHolder = new TimeHitsHolder(capacity);
    IntValueHolder[] intValueHolders = new IntValueHolder[3];
    intValueHolders[0] = new IntValueHolder(new ActivityIntValues(capacity), "10m", 10);
    intValueHolders[1] = new IntValueHolder(new ActivityIntValues(capacity), "5m", 5);
    intValueHolders[2] = new IntValueHolder(new ActivityIntValues(capacity), "2m", 2);
    intValueHolders[0].activityIntValues.fieldValues[0] = 5;
    intValueHolders[1].activityIntValues.fieldValues[0] = 3;
    intValueHolders[2].activityIntValues.fieldValues[0] = 1;
    TimeAggregatedActivityValues.initTimeHits(timeHitsHolder, intValueHolders, 1, 10);
    assertTrue(Arrays.equals(new int[] {1, 1, 1, 1, 1, 0, 0, 0, 0}, timeHitsHolder.getActivities(0).array));
View Full Code Here

Examples of com.senseidb.indexing.activity.time.TimeAggregatedActivityValues.IntValueHolder

  @Test
  public void test2ActivitiesMoreThanMinutes() {
    int capacity = 1;
    TimeHitsHolder timeHitsHolder = new TimeHitsHolder(capacity);
    IntValueHolder[] intValueHolders = new IntValueHolder[3];
    intValueHolders[0] = new IntValueHolder(new ActivityIntValues(capacity), "10m", 10);
    intValueHolders[1] = new IntValueHolder(new ActivityIntValues(capacity), "5m", 5);
    intValueHolders[2] = new IntValueHolder(new ActivityIntValues(capacity), "2m", 2);
    intValueHolders[0].activityIntValues.fieldValues[0] = 50;
    intValueHolders[1].activityIntValues.fieldValues[0] = 10;
    intValueHolders[2].activityIntValues.fieldValues[0] = 1;
    TimeAggregatedActivityValues.initTimeHits(timeHitsHolder, intValueHolders, 1, 10);
    assertTrue(Arrays.equals(new int[] {8, 8, 8, 8, 8, 3, 3, 3, 1, 0}, timeHitsHolder.getActivities(0).array));
View Full Code Here

Examples of com.senseidb.indexing.activity.time.TimeAggregatedActivityValues.IntValueHolder

  @Test
  public void test3SingleActivities() {
    int capacity = 1;
    TimeHitsHolder timeHitsHolder = new TimeHitsHolder(capacity);
    IntValueHolder[] intValueHolders = new IntValueHolder[3];
    intValueHolders[0] = new IntValueHolder(new ActivityIntValues(capacity), "10m", 1);
    intValueHolders[1] = new IntValueHolder(new ActivityIntValues(capacity), "5m", 1);
    intValueHolders[2] = new IntValueHolder(new ActivityIntValues(capacity), "2m", 1);
    intValueHolders[0].activityIntValues.fieldValues[0] = 50;
    intValueHolders[1].activityIntValues.fieldValues[0] = 10;
    intValueHolders[2].activityIntValues.fieldValues[0] = 1;
    TimeAggregatedActivityValues.initTimeHits(timeHitsHolder, intValueHolders, 1, 10);   
    assertTrue(Arrays.toString( timeHitsHolder.getActivities(0).array), Arrays.equals(new int[] {1}, timeHitsHolder.getActivities(0).array));
View Full Code Here

Examples of com.senseidb.indexing.activity.time.TimeAggregatedActivityValues.IntValueHolder

      }
      if (currentTime - times.get(activityIndex) < intActivityValues[intActivityValues.length - 1].timeInMinutes) {
        break;
      }
      for (int aggregateIndex = intActivityValues.length - 1; aggregateIndex >= minimumAggregateIndex; aggregateIndex--) {
        IntValueHolder intValueHolder = intActivityValues[aggregateIndex];       
        int currentElapsedTime = currentTime - times.get(activityIndex);
        //activity is current
        if (currentElapsedTime < intValueHolder.timeInMinutes) {
          minimumAggregateIndex = aggregateIndex + 1;
          break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.