Package com.senseidb.indexing.activity.primitives

Examples of com.senseidb.indexing.activity.primitives.ActivityIntValues


  @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


  @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

  @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

    this.fieldName = fieldName;
    intActivityValues = new IntValueHolder[times.size()];
    int index = 0;
    for(String time : times) {
      int timeInMinutes = extractTimeInMinutes(time);     
      ActivityIntValues activityIntValues = (ActivityIntValues) ActivityPrimitiveValues.createActivityPrimitiveValues(activityPersistenceFactory, int.class, fieldName + ":" + time, count);
         
      this.valuesMap.put(time, activityIntValues);
      intActivityValues[index++] = new IntValueHolder(activityIntValues, time, timeInMinutes);
    }
    defaultIntValues = (ActivityIntValues) ActivityPrimitiveValues.createActivityPrimitiveValues(activityPersistenceFactory, int.class, fieldName, count);
View Full Code Here

    SenseiStarter.rmrf(file);
  }
 
  public void test1() {

    ActivityIntValues intValues = (ActivityIntValues) ActivityPrimitiveValues.createActivityPrimitiveValues(ActivityPersistenceFactory.getInstance(getDirPath(), new ActivityConfig()), int.class, "likes", 0);

       
    long time = System.currentTimeMillis();
    for (int i = 0; i < 1000000; i++) {
      boolean update = intValues.update(i, "+1");
      if (update) {
        intValues.prepareFlush().run();
      }     
      if (i%1000000 == 0) {
        System.out.println(i);
      }
    }
    System.out.println("ElapsedTime = " + (System.currentTimeMillis() - time));
    intValues.close();
  }
View Full Code Here

TOP

Related Classes of com.senseidb.indexing.activity.primitives.ActivityIntValues

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.