当前位置: 首页>>代码示例>>Java>>正文


Java VoltTableRow.getDouble方法代码示例

本文整理汇总了Java中org.voltdb.VoltTableRow.getDouble方法的典型用法代码示例。如果您正苦于以下问题:Java VoltTableRow.getDouble方法的具体用法?Java VoltTableRow.getDouble怎么用?Java VoltTableRow.getDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.voltdb.VoltTableRow的用法示例。


在下文中一共展示了VoltTableRow.getDouble方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: reduce

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
@Override
public void reduce(Long key, Iterator<VoltTableRow> rows) {
    double sum_ol_amount = 0;
    
    VoltTableRow row = null;
    for (VoltTableRow r : CollectionUtil.iterable(rows)) {
        assert(r != null);
        row = r;
        sum_ol_amount += row.getDouble(3);
    } // FOR

    Object new_row[] = {
            key,
            row.getLong(1),
            row.getLong(2),
            sum_ol_amount,
            row.getTimestampAsTimestamp(4)
    };
    this.reduceEmit(new_row);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:21,代码来源:MRquery3.java

示例2: map

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
@Override
public void map(VoltTableRow row) {
    long key = row.getLong(0); // A_NAME
    long quantity = row.getLong(1);
    double amount = row.getDouble(2);
    double price = row.getDouble(3);
    long ct = row.getLong(4);
    Object new_row[] = {
            key,
            quantity, // FIXME row.getLong(1)
            amount,
            price,
            ct
    };
    this.mapEmit(key, new_row);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:17,代码来源:MRqueryJoinAgg.java

示例3: rowToString

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
public static String rowToString(VoltTableRow row) {
    Double lat = row.getDouble("a_lat");
    Double lon = row.getDouble("a_lon");
    Double temp = row.getDouble("a_temp");
    Double sal = row.getDouble("a_salinity");

    return "[ " + lat + " " + lon + " " + temp + " " + sal + " ]";
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:9,代码来源:MultiSteering.java

示例4: run

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
public long run(int partId, VoltTable sp4Data, long[] extraArgs) {
  	
for (int i=0; i < sp4Data.getRowCount(); i++) {
	VoltTableRow row = sp4Data.fetchRow(i);
	double tradePrice = row.getDouble("T_TRADE_PRICE");
	double quantity = (double)row.getLong("T_QTY");
	Double commission = row.getDouble("T_COMM");
	Double fee = row.getDouble("T_CHRG");
	long tradeID = row.getLong("T_ID");
	long batchID = row.getLong("batch_id");
	String messageText = "";
	String messageData = "";
	
	if(commission != null && commission > tradePrice*quantity){
		messageText = "Invalid trade commission";
		messageData = "T_ID=" + tradeID + ", T_COMM=" + commission;
		voltQueueSQL(insertMessage, batchID,"DimTrade","Alert",messageText,messageData,partId);
	}
	if(fee != null && fee > tradePrice*quantity){
		messageText = "Invalid trade fee";
		messageData = "T_ID=" + tradeID + ", T_CHRG=" + fee;
		voltQueueSQL(insertMessage, batchID, "DimTrade","Alert",messageText,messageData,partId);
	}

	voltQueueSQL(insertDimTrade, row.getLong("T_ID"), row.getLong("SK_BrokerID"), row.getLong("SK_CreateDateID"),
			row.getLong("SK_CreateTimeID"), row.getLong("SK_CloseDateID"), row.getLong("SK_CloseTimeID"),
			row.getString("Status"), row.getString("Type"), (short) row.getLong("T_IS_CASH"),
			row.getLong("SK_SecurityID"), row.getLong("SK_CompanyID"), (int) row.getLong("T_QTY"),
			row.getDouble("T_BID_PRICE"), row.getLong("SK_CustomerID"), row.getLong("SK_AccountID"),
			row.getString("T_EXEC_NAME"), row.getDouble("T_TRADE_PRICE"), row.getDouble("T_CHRG"),
			row.getDouble("T_COMM"), row.getDouble("T_TAX"), row.getLong("batch_id"), partId);
	
	voltExecuteSQL();
}
      // Set the return value to 0: successful vote
      return TPCDIConstants.PROC_SUCCESSFUL;
  }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:38,代码来源:SP5InsertTrade.java

示例5: map

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
@Override
public void map(VoltTableRow row) {
    long key = row.getLong(0); // A_NAME
    long quantity = row.getLong(1);
    double amount = row.getDouble(2);
    long ct = row.getLong(3);
    Object new_row[] = {
            key,
            quantity, // FIXME row.getLong(1)
            amount,
            ct
    };
    this.mapEmit(key, new_row);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:15,代码来源:MRquery1.java

示例6: map

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
@Override
public void map(VoltTableRow row) {
    long key = row.getLong(0);
    Object new_row[] = {
            key,
            row.getLong(1),
            row.getLong(2),
            row.getDouble(3),
            row.getTimestampAsTimestamp(4)
    };
    this.mapEmit(key, new_row);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:13,代码来源:MRquery3.java

示例7: map

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
@Override
public void map(VoltTableRow row) {
    double value = row.getDouble(0);
    Object new_row[] = {
            0.1,
            value
    };
    this.mapEmit(0.1, new_row);
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:10,代码来源:MRquery6.java

示例8: run

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
public VoltTable run() {

        voltQueueSQL(getCurrentLocation);
        VoltTable i[] = voltExecuteSQL();

        Double lat = i[0].fetchRow(0).getDouble("c_lat");
        Double lon = i[0].fetchRow(0).getDouble("c_lon");
        Integer month = new Integer((int) i[0].fetchRow(0).getLong("c_month"));

//        Double a = SeaflowUtil.roundToHalf(lon);
//        Double b = SeaflowUtil.roundToHalf(lat);

        int k = 3;

        List<Double> tempMult = new ArrayList<>();
        List<Double> salMult = new ArrayList<>();
        List<Vector2D> tempVect = new ArrayList<>();
        List<Vector2D> salVect = new ArrayList<>();

        voltQueueSQL(getTemperatureStrip, lon - k, lat + k, lon - k, lat + k, month);
        VoltTable v = voltExecuteSQL()[0];

        for (int j = 0; j < v.getRowCount(); j++) {
            VoltTableRow row = v.fetchRow(j);

            Double thisLat = row.getDouble("a_lat");
            if (row.wasNull()) continue;

            Double thisLon = row.getDouble("a_lon");
            if (row.wasNull() || thisLon == lon || thisLat == lat) continue;

            Double thisTemp = row.getDouble("a_temp");
            if (!row.wasNull()) {
                tempVect.add(new Vector2D(1 / (thisLon - lon), 1 / (thisLat - lat)));
                tempMult.add(thisTemp);
            }

            Double thisSal = row.getDouble("a_salinity");
            if (!row.wasNull()) {
                salVect.add(new Vector2D(1 / (thisLon - lon), 1 / (thisLat - lat)));
                salMult.add(thisSal);
            }
        }

        Vector2D posTempSum = new Vector2D(tempMult, tempVect);
        Vector2D posSaltSum = new Vector2D(salMult, salVect);

        Vector2D posTempPosSaltSum = new Vector2D(1.0, posTempSum, 1.0, posSaltSum);
        Vector2D posTempNegSaltSum = new Vector2D(1.0, posTempSum, -1.0, posSaltSum);
        Vector2D negTempPosSaltSum = new Vector2D(-1.0, posTempSum, 1.0, posSaltSum);
        Vector2D negTempNegSaltSum = new Vector2D(-1.0, posTempSum, -1.0, posSaltSum);


        double posTempDegrees = toDegrees(posTempSum);
        double posSaltDegrees = toDegrees(posSaltSum);
        double negTempDegrees = (posTempDegrees + 180.0) % 360.0;
        double negSaltDegrees = (posSaltDegrees + 180.0) % 360.0;

        double posTempSaltPosSaltDegrees = toDegrees(posTempPosSaltSum);
        double posTempSaltNegSaltDegrees = toDegrees(posTempNegSaltSum);
        double negTempSaltPosSaltDegrees = toDegrees(negTempPosSaltSum);
        double negTempSaltNegSaltDegrees = toDegrees(negTempNegSaltSum);

        voltQueueSQL(multiUpdateSteering, posTempDegrees, negTempDegrees, posSaltDegrees, negSaltDegrees, posTempSaltPosSaltDegrees, posTempSaltNegSaltDegrees, negTempSaltPosSaltDegrees, negTempSaltNegSaltDegrees);
        voltQueueSQL(getSteering);

        VoltTable result[] = voltExecuteSQL();

        return result[1];

    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:72,代码来源:MultiSteering.java

示例9: run

import org.voltdb.VoltTableRow; //导入方法依赖的package包/类
public VoltTable run() {

        voltQueueSQL(getCurrentLocation);
        VoltTable i[] = voltExecuteSQL();

        Double lat = i[0].fetchRow(0).getDouble("c_lat");
        Double lon = i[0].fetchRow(0).getDouble("c_lon");
        Integer month = new Integer( (int) i[0].fetchRow(0).getLong("c_month"));

//        Double a = SeaflowUtil.roundToHalf(lon);
//        Double b = SeaflowUtil.roundToHalf(lat);

        int k = 3;

        List<Double> mult = new ArrayList<>();
        List<Vector2D> vect = new ArrayList<>();

        voltQueueSQL(getTemperatureStrip, lon-k, lat+k, lon-k, lat+k, month);
        VoltTable v = voltExecuteSQL()[0];

        for(int j=0; j < v.getRowCount(); j++) {
            VoltTableRow row = v.fetchRow(j);
            Double thisLat = row.getDouble("a_lat");
            Double thisLon = row.getDouble("a_lon");
            Double thisTemp = row.getDouble("a_temp");
            if(row.wasNull())
            	continue;

            if(thisLon != lon && thisLat != lat) {
                vect.add( new Vector2D( 1 / (thisLon - lon), 1 / ( thisLat - lat)) );
                mult.add( thisTemp );
            }
        }

        
        Vector2D sum = new Vector2D(mult, vect);

        double tangent = Math.abs(sum.getY().doubleValue()) / Math.abs(sum.getX().doubleValue());
        double degrees = Math.toDegrees(Math.atan(tangent));
        
        if (sum.getX() >= 0 && sum.getY() >= 0) {
            degrees += 0.0;
        } else if (sum.getX() <= 0 && sum.getY() >= 0) {
            degrees += 90.0;
        } else if (sum.getX() <= 0 && sum.getY() <= 0) {
            degrees += 180.0;
        } else if(sum.getX() >= 0 && sum.getY() <= 0) {
            degrees += 270.0;
        }

        voltQueueSQL(updateSteering, degrees);
        voltQueueSQL(getSteering);

        VoltTable result[] = voltExecuteSQL();

        return result[1];

    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:59,代码来源:Steering.java


注:本文中的org.voltdb.VoltTableRow.getDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。