src/org/ohmage/domain/MobilityPoint.java
public final JSONObject toJson(
					final Collection<ColumnKey> columns) 
					throws JSONException, DomainException {
				
				if(columns == null) {
					throw new DomainException(
							"The columns list cannot be null.");
				}
				
				JSONObject result = new JSONObject();
				
				if(columns.contains(MobilityColumnKey.SENSOR_DATA) ||
					columns.contains(SensorDataColumnKey.ACCELEROMETER_DATA) ||
					columns.contains(AccelDataColumnKey.X)) {
					
					result.put(AccelDataColumnKey.X.toString(false), x);
				}

				if(columns.contains(MobilityColumnKey.SENSOR_DATA) ||
					columns.contains(SensorDataColumnKey.ACCELEROMETER_DATA) ||
					columns.contains(AccelDataColumnKey.Y)) {
					
					result.put(AccelDataColumnKey.Y.toString(false), y);
				}

				if(columns.contains(MobilityColumnKey.SENSOR_DATA) ||
					columns.contains(SensorDataColumnKey.ACCELEROMETER_DATA) ||
					columns.contains(AccelDataColumnKey.Z)) {
					
					result.put(AccelDataColumnKey.Z.toString(false), z);
				}
				
				return result;
			}
/**
			 * Creates a JSONObject that represents the accelerometer data with
			 * only the information whose column value is present.
			 * 
			 * @param columns A collection of columns dictating which variables
			 * 				  should be included in the resulting object. If 
			 * 				  this is empty, an empty JSONObject will be 
			 * 				  returned. This cannot be null and if all columns 
			 * 				  are desired, a quick fix is to use
			 * 				  {@link AccelDataColumnKey#ALL_COLUMNS}.
			 * 
			 * @return Returns a JSONObject that represents this object with 
			 * 		   only the requested columns.
			 * 
			 * @throws JSONException There was an error building the 
			 * 						 JSONObject.
			 * 
			 * @throws DomainException The columns collection was null.
			 */
Creates a JSONObject that represents the accelerometer data with
only the information whose column value is present.

@param columns A collection of columns dictating which variables
should be included in the resulting object. If
this is empty, an empty JSONObject will be
returned. This cannot be null and if all columns
are desired, a quick fix is to use
AccelDataColumnKey#ALL_COLUMNS.

@return Returns a JSONObject that represents this object with
only the requested columns.

@throws JSONException There was an error building the
JSONObject.

@throws DomainException The columns collection was null.
Creates a JSONObject that represents the accelerometer data with only the information whose column value is present . @param columns A collection of columns dictating which variables should be included in the resulting object . If this is empty an empty JSONObject will be returned . This cannot be null and if all columns are desired a quick fix is to use AccelDataColumnKey#ALL_COLUMNS . @return Returns a JSONObject that represents this object with only the requested columns . @throws JSONException There was an error building the JSONObject . @throws DomainException The columns collection was null .
public final JSONObject toJson(
					final Collection<ColumnKey> columns) 
					throws JSONException, DomainException {
				if(columns == null) {
					throw new DomainException(
							"The columns list cannot be null.");
				}
				JSONObject result = new JSONObject();
				if(columns.contains(MobilityColumnKey.SENSOR_DATA) ||
					columns.contains(SensorDataColumnKey.ACCELEROMETER_DATA) ||
					columns.contains(AccelDataColumnKey.X)) {
					result.put(AccelDataColumnKey.X.toString(false), x);
				}
				if(columns.contains(MobilityColumnKey.SENSOR_DATA) ||
					columns.contains(SensorDataColumnKey.ACCELEROMETER_DATA) ||
					columns.contains(AccelDataColumnKey.Y)) {
					result.put(AccelDataColumnKey.Y.toString(false), y);
				}
				if(columns.contains(MobilityColumnKey.SENSOR_DATA) ||
					columns.contains(SensorDataColumnKey.ACCELEROMETER_DATA) ||
					columns.contains(AccelDataColumnKey.Z)) {
					result.put(AccelDataColumnKey.Z.toString(false), z);
				}
				return result;
			}
public final JSONObject toJson ( final Collection < ColumnKey > columns ) throws JSONException , DomainException { if ( columns == null ) { throw new DomainException ( "The columns list cannot be null." ) ; } JSONObject result = new JSONObject ( ) ; if ( columns . contains ( MobilityColumnKey . SENSOR_DATA ) || columns . contains ( SensorDataColumnKey . ACCELEROMETER_DATA ) || columns . contains ( AccelDataColumnKey . X ) ) { result . put ( AccelDataColumnKey . X . toString ( false ) , x ) ; } if ( columns . contains ( MobilityColumnKey . SENSOR_DATA ) || columns . contains ( SensorDataColumnKey . ACCELEROMETER_DATA ) || columns . contains ( AccelDataColumnKey . Y ) ) { result . put ( AccelDataColumnKey . Y . toString ( false ) , y ) ; } if ( columns . contains ( MobilityColumnKey . SENSOR_DATA ) || columns . contains ( SensorDataColumnKey . ACCELEROMETER_DATA ) || columns . contains ( AccelDataColumnKey . Z ) ) { result . put ( AccelDataColumnKey . Z . toString ( false ) , z ) ; } return result ; }
Creates a JSONObject that represents the accelerometer data with
 only the information whose column value is present.
Creates a JSONObject that represents the accelerometer data with only the information whose column value is present .