package com.godoro.hadoop.example;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import org.apache.hadoop.io.Writable;
public class SalesWritable implements Writable {
private int salesQuantity;
private double salesPrice;
private double lineAmount;
public SalesWritable() {
}
@Override
public void write(DataOutput output) throws IOException {
output.writeInt(salesQuantity);
output.writeDouble(salesPrice);
output.writeDouble(lineAmount);
}
@Override
public void readFields(DataInput input) throws IOException {
salesQuantity = input.readInt();
salesPrice = input.readDouble();
lineAmount = input.readDouble();
}
public int getSalesQuantity() {
return salesQuantity;
}
public void setSalesQuantity(int salesQuantity) {
this.salesQuantity = salesQuantity;
}
public double getSalesPrice() {
return salesPrice;
}
public void setSalesPrice(double salesPrice) {
this.salesPrice = salesPrice;
}
public double getLineAmount() {
return lineAmount;
}
public void setLineAmount(double lineAmount) {
this.lineAmount = lineAmount;
}
@Override
public String toString() {
return salesQuantity + " " + salesPrice + " " + lineAmount;
}
}
Dosyayı İndir