src/org/ohmage/domain/MobilityPoint.java
public final void toCsvRow(
			final List<ColumnKey> columns, 
			final List<Object> result)
			throws DomainException {
		
		if(columns == null) {
			throw new DomainException(
					"The list of columns cannot be null.");
		}
		else if(result == null) {
			throw new DomainException(
					"The list of results cannot be null.");
		}
		else if(columns.size() != result.size()) {
			throw new DomainException(
					"The columns list and the result list were different lengths.");
		}
		
		int index;
		
		if((index = columns.indexOf(MobilityColumnKey.ID)) != -1) {
			result.set(index, id);
		}
		
		if((index = columns.indexOf(MobilityColumnKey.MODE)) != -1) {
			result.set(index, mode.toString().toLowerCase());
		}
		
		if((index = columns.indexOf(MobilityColumnKey.TIME)) != -1) {
			result.set(index, time);
		}
		
		if((index = columns.indexOf(MobilityColumnKey.TIMESTAMP)) != -1) {
			DateTime dateTime = new DateTime(time, timezone);
			DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
			builder.appendPattern(DATE_TIME_FORMAT);
			
			result.set(index, builder.toFormatter().print(dateTime));
		}
		
		if((index = columns.indexOf(MobilityColumnKey.TIMEZONE)) != -1) {
			result.set(index, timezone.getID());
		}
		
		if((index = columns.indexOf(MobilityColumnKey.SUB_TYPE)) != -1) {
			result.set(index, subType.toString().toLowerCase());
		}
		
		if((index = columns.indexOf(LocationColumnKey.STATUS)) != -1) {
			result.set(index, locationStatus.toString().toLowerCase());
		}
		
		if(columns.contains(MobilityColumnKey.LOCATION) ||
				LocationColumnKey.containsLocationColumnKey(columns)) {
			
			if(location != null) {
				location.toCsvRow(columns, result);
			}
		}
		
		if(SubType.SENSOR_DATA.equals(subType)) {
			if(columns.contains(MobilityColumnKey.SENSOR_DATA) ||
				SensorDataColumnKey.containsSensorDataColumnKey(columns)) {
			
				sensorData.toCsvRow(columns, result);
			}
			
			if(columns.contains(MobilityColumnKey.CLASSIFIER_DATA) ||
				ClassifierDataColumnKey.containsClassifierDataColumnKey(columns)) {
				
				classifierData.toCsvRow(columns, result);
			}
		}
	}
/**
	 * Populates the indices in 'result' with a value referenced by 'columns'.
	 * For example, if the third value in 'columns' is Mobility's time column
	 * key, the third value in the result list will be set to this Mobility
	 * point's time. This means that the result list must already be populated
	 * with exactly as many values as exist in 'columns'.
	 *
	 * @param columns The columns to populate in the result list.
	 * 
	 * @param result The result list whose values will be overridden by their
	 * 				 values in this Mobility point in their respective  
	 * 				 indices.
	 * 
	 * @throws DomainException The columns or result list was null or weren't
	 * 						   the same length.
	 */
Populates the indices in 'result' with a value referenced by 'columns'.
For example, if the third value in 'columns' is Mobility's time column
key, the third value in the result list will be set to this Mobility
point's time. This means that the result list must already be populated
with exactly as many values as exist in 'columns'.

@param columns The columns to populate in the result list.

@param result The result list whose values will be overridden by their
values in this Mobility point in their respective
indices.

@throws DomainException The columns or result list was null or weren't
the same length.
Populates the indices in ' result ' with a value referenced by ' columns ' . For example if the third value in ' columns ' is Mobility ' s time column key the third value in the result list will be set to this Mobility point ' s time . This means that the result list must already be populated with exactly as many values as exist in ' columns ' . @param columns The columns to populate in the result list . @param result The result list whose values will be overridden by their values in this Mobility point in their respective indices . @throws DomainException The columns or result list was null or weren ' t the same length .
public final void toCsvRow(
			final List<ColumnKey> columns, 
			final List<Object> result)
			throws DomainException {
		if(columns == null) {
			throw new DomainException(
					"The list of columns cannot be null.");
		}
		else if(result == null) {
			throw new DomainException(
					"The list of results cannot be null.");
		}
		else if(columns.size() != result.size()) {
			throw new DomainException(
					"The columns list and the result list were different lengths.");
		}
		int index;
		if((index = columns.indexOf(MobilityColumnKey.ID)) != -1) {
			result.set(index, id);
		}
		if((index = columns.indexOf(MobilityColumnKey.MODE)) != -1) {
			result.set(index, mode.toString().toLowerCase());
		}
		if((index = columns.indexOf(MobilityColumnKey.TIME)) != -1) {
			result.set(index, time);
		}
		if((index = columns.indexOf(MobilityColumnKey.TIMESTAMP)) != -1) {
			DateTime dateTime = new DateTime(time, timezone);
			DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder();
			builder.appendPattern(DATE_TIME_FORMAT);
			result.set(index, builder.toFormatter().print(dateTime));
		}
		if((index = columns.indexOf(MobilityColumnKey.TIMEZONE)) != -1) {
			result.set(index, timezone.getID());
		}
		if((index = columns.indexOf(MobilityColumnKey.SUB_TYPE)) != -1) {
			result.set(index, subType.toString().toLowerCase());
		}
		if((index = columns.indexOf(LocationColumnKey.STATUS)) != -1) {
			result.set(index, locationStatus.toString().toLowerCase());
		}
		if(columns.contains(MobilityColumnKey.LOCATION) ||
				LocationColumnKey.containsLocationColumnKey(columns)) {
			if(location != null) {
				location.toCsvRow(columns, result);
			}
		}
		if(SubType.SENSOR_DATA.equals(subType)) {
			if(columns.contains(MobilityColumnKey.SENSOR_DATA) ||
				SensorDataColumnKey.containsSensorDataColumnKey(columns)) {
				sensorData.toCsvRow(columns, result);
			}
			if(columns.contains(MobilityColumnKey.CLASSIFIER_DATA) ||
				ClassifierDataColumnKey.containsClassifierDataColumnKey(columns)) {
				classifierData.toCsvRow(columns, result);
			}
		}
	}
public final void toCsvRow ( final List < ColumnKey > columns , final List < Object > result ) throws DomainException { if ( columns == null ) { throw new DomainException ( "The list of columns cannot be null." ) ; } else if ( result == null ) { throw new DomainException ( "The list of results cannot be null." ) ; } else if ( columns . size ( ) != result . size ( ) ) { throw new DomainException ( "The columns list and the result list were different lengths." ) ; } int index ; if ( ( index = columns . indexOf ( MobilityColumnKey . ID ) ) != - 1 ) { result . set ( index , id ) ; } if ( ( index = columns . indexOf ( MobilityColumnKey . MODE ) ) != - 1 ) { result . set ( index , mode . toString ( ) . toLowerCase ( ) ) ; } if ( ( index = columns . indexOf ( MobilityColumnKey . TIME ) ) != - 1 ) { result . set ( index , time ) ; } if ( ( index = columns . indexOf ( MobilityColumnKey . TIMESTAMP ) ) != - 1 ) { DateTime dateTime = new DateTime ( time , timezone ) ; DateTimeFormatterBuilder builder = new DateTimeFormatterBuilder ( ) ; builder . appendPattern ( DATE_TIME_FORMAT ) ; result . set ( index , builder . toFormatter ( ) . print ( dateTime ) ) ; } if ( ( index = columns . indexOf ( MobilityColumnKey . TIMEZONE ) ) != - 1 ) { result . set ( index , timezone . getID ( ) ) ; } if ( ( index = columns . indexOf ( MobilityColumnKey . SUB_TYPE ) ) != - 1 ) { result . set ( index , subType . toString ( ) . toLowerCase ( ) ) ; } if ( ( index = columns . indexOf ( LocationColumnKey . STATUS ) ) != - 1 ) { result . set ( index , locationStatus . toString ( ) . toLowerCase ( ) ) ; } if ( columns . contains ( MobilityColumnKey . LOCATION ) || LocationColumnKey . containsLocationColumnKey ( columns ) ) { if ( location != null ) { location . toCsvRow ( columns , result ) ; } } if ( SubType . SENSOR_DATA . equals ( subType ) ) { if ( columns . contains ( MobilityColumnKey . SENSOR_DATA ) || SensorDataColumnKey . containsSensorDataColumnKey ( columns ) ) { sensorData . toCsvRow ( columns , result ) ; } if ( columns . contains ( MobilityColumnKey . CLASSIFIER_DATA ) || ClassifierDataColumnKey . containsClassifierDataColumnKey ( columns ) ) { classifierData . toCsvRow ( columns , result ) ; } } }
Populates the indices in 'result' with a value referenced by 'columns'.
Populates the indices in ' result ' with a value referenced by ' columns ' .