cool-core/src/main/java/com/nus/cool/core/cohort/ExtendedCohortSelection.java
public void selectAgeActivities(int ageOff, int ageEnd, BitSet bs, 
			BitSet ageDelimiters, Map<Integer, List<Double>> cohortCells) {
		checkArgument(ageOff < ageEnd);
		// enable the dimension-based ageby operator to be processed in the same way
		// as event-based ageby operator
		int fieldID = tableSchema.getFieldID(q.getAgeField().getField());
		if (fieldID != tableSchema.getActionField() &&
				fieldID != tableSchema.getActionTimeField()) {        	
			bs.and(ageDelimiters);
			int pos = ageDelimiters.nextSetBit(ageOff);
			int lastSetbit = pos;
			InputVector inputVector = this.chunk.getField(fieldID).getValueVector();
			while(pos >= 0 && pos < ageEnd) {
				lastSetbit = pos;
				inputVector.skipTo(pos);
				int lastValue = inputVector.next();                
				while(++pos < ageEnd) {
					if (ageDelimiters.get(pos) && inputVector.next() == lastValue) {
						ageDelimiters.clear(pos);
						lastSetbit = pos;
					}
					else {
						pos = ageDelimiters.nextSetBit(pos);                        
						break;
					}
				}
			}

			// clear the first setbit and set the the bit next to the last set bit
			// so as to enable the resulting delimiters 
			// to be consistent with event-based ageby operator
			if ((pos = ageDelimiters.nextSetBit(ageOff)) >= 0) {
				ageDelimiters.clear(pos);
				checkArgument(!ageDelimiters.get(lastSetbit + 1));
				ageDelimiters.set(lastSetbit + 1);
			}
		}

		// Columnar processing strategy ...
		// TODO: now we update the stats (min, max, avg) only if the field is "value"
		for (Map.Entry<String, FieldFilter> entry : ageFilters.entrySet()) {
			FieldFilter ageFilter = entry.getValue();
			filterAgeActivity(ageOff, ageEnd, bs, chunk.getField(entry.getKey()).getValueVector(), 
					ageFilter, cohortCells, (entry.getKey().equals("value")));            
		}      
	}
/**
	 * Select age activity tuples bounded by [ageOff, ageEnd)
	 * 
	 * @param ageOff
	 *            the start position of age tuples
	 * @param ageEnd
	 *            the end position of age tuples
	 * @param bs
	 *            the hit position list of all qualified tuples
	 */
Select age activity tuples bounded by [ageOff, ageEnd)

@param ageOff
the start position of age tuples
@param ageEnd
the end position of age tuples
@param bs
the hit position list of all qualified tuples
Select age activity tuples bounded by [ ageOff ageEnd ) @param ageOff the start position of age tuples @param ageEnd the end position of age tuples @param bs the hit position list of all qualified tuples
public void selectAgeActivities(int ageOff, int ageEnd, BitSet bs, 
			BitSet ageDelimiters, Map<Integer, List<Double>> cohortCells) {
		checkArgument(ageOff < ageEnd);
		int fieldID = tableSchema.getFieldID(q.getAgeField().getField());
		if (fieldID != tableSchema.getActionField() &&
				fieldID != tableSchema.getActionTimeField()) {        	
			bs.and(ageDelimiters);
			int pos = ageDelimiters.nextSetBit(ageOff);
			int lastSetbit = pos;
			InputVector inputVector = this.chunk.getField(fieldID).getValueVector();
			while(pos >= 0 && pos < ageEnd) {
				lastSetbit = pos;
				inputVector.skipTo(pos);
				int lastValue = inputVector.next();                
				while(++pos < ageEnd) {
					if (ageDelimiters.get(pos) && inputVector.next() == lastValue) {
						ageDelimiters.clear(pos);
						lastSetbit = pos;
					}
					else {
						pos = ageDelimiters.nextSetBit(pos);                        
						break;
					}
				}
			}
			if ((pos = ageDelimiters.nextSetBit(ageOff)) >= 0) {
				ageDelimiters.clear(pos);
				checkArgument(!ageDelimiters.get(lastSetbit + 1));
				ageDelimiters.set(lastSetbit + 1);
			}
		}
		for (Map.Entry<String, FieldFilter> entry : ageFilters.entrySet()) {
			FieldFilter ageFilter = entry.getValue();
			filterAgeActivity(ageOff, ageEnd, bs, chunk.getField(entry.getKey()).getValueVector(), 
					ageFilter, cohortCells, (entry.getKey().equals("value")));            
		}      
	}
public void selectAgeActivities ( int ageOff , int ageEnd , BitSet bs , BitSet ageDelimiters , Map < Integer , List < Double > > cohortCells ) { checkArgument ( ageOff < ageEnd ) ; int fieldID = tableSchema . getFieldID ( q . getAgeField ( ) . getField ( ) ) ; if ( fieldID != tableSchema . getActionField ( ) && fieldID != tableSchema . getActionTimeField ( ) ) { bs . and ( ageDelimiters ) ; int pos = ageDelimiters . nextSetBit ( ageOff ) ; int lastSetbit = pos ; InputVector inputVector = this . chunk . getField ( fieldID ) . getValueVector ( ) ; while ( pos >= 0 && pos < ageEnd ) { lastSetbit = pos ; inputVector . skipTo ( pos ) ; int lastValue = inputVector . next ( ) ; while ( ++ pos < ageEnd ) { if ( ageDelimiters . get ( pos ) && inputVector . next ( ) == lastValue ) { ageDelimiters . clear ( pos ) ; lastSetbit = pos ; } else { pos = ageDelimiters . nextSetBit ( pos ) ; break ; } } } if ( ( pos = ageDelimiters . nextSetBit ( ageOff ) ) >= 0 ) { ageDelimiters . clear ( pos ) ; checkArgument ( ! ageDelimiters . get ( lastSetbit + 1 ) ) ; ageDelimiters . set ( lastSetbit + 1 ) ; } } for ( Map . Entry < String , FieldFilter > entry : ageFilters . entrySet ( ) ) { FieldFilter ageFilter = entry . getValue ( ) ; filterAgeActivity ( ageOff , ageEnd , bs , chunk . getField ( entry . getKey ( ) ) . getValueVector ( ) , ageFilter , cohortCells , ( entry . getKey ( ) . equals ( "value" ) ) ) ; } }
Select age activity tuples bounded by [ageOff, ageEnd)
Select age activity tuples bounded by [ ageOff ageEnd )
// enable the dimension-based ageby operator to be processed in the same way // as event-based ageby operator // clear the first setbit and set the the bit next to the last set bit // so as to enable the resulting delimiters  // to be consistent with event-based ageby operator // Columnar processing strategy ... // TODO: now we update the stats (min, max, avg) only if the field is "value"