當前位置: 首頁>>代碼示例>>Java>>正文


Java Row.getDouble方法代碼示例

本文整理匯總了Java中com.datastax.driver.core.Row.getDouble方法的典型用法代碼示例。如果您正苦於以下問題:Java Row.getDouble方法的具體用法?Java Row.getDouble怎麽用?Java Row.getDouble使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.datastax.driver.core.Row的用法示例。


在下文中一共展示了Row.getDouble方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getColValue

import com.datastax.driver.core.Row; //導入方法依賴的package包/類
public Object getColValue(Row row, String colName, DataType colType){	
	switch(colType.getName()){
	case VARCHAR: 
		return row.getString(colName);
	case UUID: 
		return row.getUUID(colName);
	case VARINT: 
		return row.getVarint(colName);
	case BIGINT: 
		return row.getLong(colName);
	case INT: 
		return row.getInt(colName);
	case FLOAT: 
		return row.getFloat(colName);	
	case DOUBLE: 
		return row.getDouble(colName);
	case BOOLEAN: 
		return row.getBool(colName);
	case MAP: 
		return row.getMap(colName, String.class, String.class);
	default: 
		return null;
	}
}
 
開發者ID:att,項目名稱:music,代碼行數:25,代碼來源:MusicDataStore.java

示例2: getUserLastGeoCoordinates

import com.datastax.driver.core.Row; //導入方法依賴的package包/類
/**
 * getUserLastGeoCoordinates
 * @param userId
 * @return user's last geo coordinates and null if it doesn't exist
 * @throws Exception
 */
public static GeoCoordinates getUserLastGeoCoordinates (
  UUID userId) throws Exception {
  
  ResultSet resultSet =
    UsersInfo.i().executeSyncSelectLastLocation(userId);
  
  if (resultSet.isExhausted() == false) {
    
    Row row = resultSet.one();
    
    double latitude =
      row.getDouble(UsersInfo.kLastLatitudeColumnName);
    double longitude =
      row.getDouble(UsersInfo.kLastLongitudeColumnName);
    
    return new GeoCoordinates(latitude, longitude);
  } else {
    
    return null;
  }
}
 
開發者ID:vangav,項目名稱:vos_instagram,代碼行數:28,代碼來源:GettersInl.java

示例3: getValue

import com.datastax.driver.core.Row; //導入方法依賴的package包/類
private Object getValue(Row musicRow, String colname) {
	ColumnDefinitions cdef = musicRow.getColumnDefinitions();
	String type = cdef.getType(colname).getName().toString().toUpperCase();
	switch (type) {
	case "BIGINT":
		return musicRow.getLong(colname);
	case "BOOLEAN":
		return musicRow.getBool(colname);
	case "BLOB":
		return musicRow.getBytes(colname);
	case "DOUBLE":
		return musicRow.getDouble(colname);
	case "INT":
		return musicRow.getInt(colname);
	case "TIMESTAMP":
		return musicRow.getTimestamp(colname);
	default:
		logger.error("UNEXPECTED COLUMN TYPE: columname="+colname+", columntype="+type);
		// fall thru
	case "VARCHAR":
		return musicRow.getString(colname);
	}
}
 
開發者ID:att,項目名稱:music,代碼行數:24,代碼來源:CassandraMixin.java

示例4: readRow

import com.datastax.driver.core.Row; //導入方法依賴的package包/類
private Object readRow(final Row row, final String name, final DataType colType) {
		switch (colType.getName()) {
		case BIGINT:
			return row.getLong(name);
		case BOOLEAN:
			return row.getBool(name);
		case DOUBLE:
			return row.getDouble(name);
		case FLOAT:
			return row.getFloat(name);
		case INT:
			return row.getInt(name);
		case MAP:
			return row.getMap(name, String.class, String.class);
		case UUID:
			return row.getUUID(name);
		case TEXT:
		case VARCHAR:
			return row.getString(name);
		case VARINT:
			return row.getVarint(name);
// These are not supported right now....
// ASCII
// BLOB
// COUNTER
// CUSTOM
// DECIMAL
// INET
// LIST
// SET
// TIMESTAMP
// TIMEUUID
// TUPLE
// UDT
		default:
			return null;
		}
	}
 
開發者ID:att,項目名稱:music,代碼行數:39,代碼來源:MusicClient.java

示例5: getDoubleValue

import com.datastax.driver.core.Row; //導入方法依賴的package包/類
private Double getDoubleValue(Row row) {
    if (aggregation == Aggregation.MIN || aggregation == Aggregation.MAX
            || aggregation == Aggregation.SUM || aggregation == Aggregation.AVG) {
        return row.getDouble(DOUBLE_POS);
    } else {
        return null;
    }
}
 
開發者ID:osswangxining,項目名稱:iotplatform,代碼行數:9,代碼來源:AggregatePartitionsFunction.java

示例6: processRequest

import com.datastax.driver.core.Row; //導入方法依賴的package包/類
@Override
protected void processRequest (final Request request) throws Exception {

  // use the following request Object to process the request and set
  //   the response to be returned
  RequestUpdateLocation requestUpdateLocation =
    (RequestUpdateLocation)request.getRequestJsonBody();
  
  // get last user's location
  ResultSet resultSet =
    UsersInfo.i().executeSyncSelectLastLocation(
      requestUpdateLocation.getUserId() );
    
  Row row = resultSet.one();
  
  // extract location's coordinates
  double lastLatitude = row.getDouble(UsersInfo.kLastLatitudeColumnName);
  double lastLongitude = row.getDouble(UsersInfo.kLastLongitudeColumnName);
  
  // first time to update location?
  if (lastLatitude == 0.0 && lastLongitude == 0.0) {
    
    // get location's continent code
    ReverseGeoCode reverseGeoCode =
      ReverseGeoCoding.i().getReverseGeoCode(lastLatitude, lastLongitude);
    
    // get user's registration time
    
    resultSet =
      UsersInfo.i().executeSyncSelectRegistrationTime(
        requestUpdateLocation.getUserId() );
    
    long registrationTime =
      resultSet.one().getLong(UsersInfo.kRegistrationTimeColumnName);
    
    Calendar registrationCalendar =
      CalendarAndDateOperationsInl.getCalendarFromUnixTime(
        registrationTime);
    
    // dispatch analytics
    
    // ig_analytics.annual_regional_counters.increment_new_users
    request.getDispatcher().addDispatchMessage(
      AnnualRegionalCounters.i().getQueryDispatchableIncrementNewUsers(
        CalendarFormatterInl.concatCalendarFields(
          registrationCalendar,
          Calendar.YEAR)
          + Constants.kCassandraIdConcat
          + reverseGeoCode.getContinentCode() ) );
    
    // ig_analytics.daily_regional_counters.increment_new_users
    request.getDispatcher().addDispatchMessage(
      DailyRegionalCounters.i().getQueryDispatchableIncrementNewUsers(
        CalendarFormatterInl.concatCalendarFields(
          registrationCalendar,
          Calendar.YEAR,
          Calendar.MONTH,
          Calendar.DAY_OF_MONTH)
          + Constants.kCassandraIdConcat
          + reverseGeoCode.getContinentCode() ) );
  }
  
  // update last_latitude and last_longitude
  UsersInfo.i().executeSyncSetLastLocation(
    requestUpdateLocation.latitude,
    requestUpdateLocation.longitude,
    requestUpdateLocation.getUserId() );
  
  // set response
  ((ResponseUpdateLocation)request.getResponseBody() ).set(
    requestUpdateLocation.request_tracking_id,
    request.getStartTime() );
}
 
開發者ID:vangav,項目名稱:vos_instagram,代碼行數:74,代碼來源:HandlerUpdateLocation.java


注:本文中的com.datastax.driver.core.Row.getDouble方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。