本文整理汇总了Java中org.supercsv.cellprocessor.ParseDouble类的典型用法代码示例。如果您正苦于以下问题:Java ParseDouble类的具体用法?Java ParseDouble怎么用?Java ParseDouble使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParseDouble类属于org.supercsv.cellprocessor包,在下文中一共展示了ParseDouble类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProcessors
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
private static CellProcessor[] getProcessors() {
final CellProcessor[] processors = new CellProcessor[]{
new ParseInt(), // id (must be unique)
new NotNull(), // address
new NotNull(), // horario
new ParseDouble(), //lat
new ParseDouble(), //long
new NotNull(), // name
new Optional(), // phone
new Optional(), // locality
new Optional(), // province
new Optional(), // postal_code
};
return processors;
}
示例2: getCellProcessors
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
private CellProcessor[] getCellProcessors() {
return new CellProcessor[]{
//@formatter:off
null, // airport ID
new Optional(), // name
new Optional(), // city
new Optional(), // country
new Optional(new ParseAirportCode()), // iataCode
new Optional(new ParseAirportCode()), // icaoCode
new Optional(new ParseDouble()), // latitude
new Optional(new ParseDouble()), // longitude
null, // altitude
null, // Timezone
null, // DST
null, // Tz database time zone
null, // Type
null, // Source
//@formatter:on
};
}
示例3: getProcessors
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
/** This method returns array of cellprocessor for parsing csv.
* @return CellProcessor[] array
* */
private CellProcessor[] getProcessors(){
CellProcessor[] processors = new CellProcessor[]{
new NotNull(new ParseLong()), //instrument_token
new NotNull(new ParseLong()), //exchange_token
new NotNull(), //trading_symbol
new Optional(), //company name
new NotNull(new ParseDouble()), //last_price
new Optional(), //expiry
new Optional(), //strike
new NotNull(new ParseDouble()), //tick_size
new NotNull(new ParseInt()), //lot_size
new NotNull(), //instrument_type
new NotNull(), //segment
new NotNull() //exchange
};
return processors;
}
示例4: getMfProcessors
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
/** This method returns array of cellprocessor for parsing mutual funds csv.
* @return CellProcessor[] array
* */
private CellProcessor[] getMfProcessors(){
CellProcessor[] processors = new CellProcessor[]{
new Optional(), //tradingsymbol
new Optional(), //amc
new Optional(), //name
new Optional(new ParseInt()), //purchase_allowed
new Optional(new ParseInt()), //redemption_allowed
new Optional(new ParseDouble()), //minimum_purchase_amount
new Optional(new ParseDouble()), //purchase_amount_multiplier
new Optional(new ParseDouble()), //minimum_additional_purchase_amount
new Optional(new ParseDouble()), //minimum_redemption_quantity
new Optional(new ParseDouble()), //redemption_quantity_multiplier
new Optional(), //dividend_type
new Optional(), //scheme_type
new Optional(), //plan
new Optional(), //settlement_type
new Optional(new ParseDouble()), //last_price
new Optional() //last_price_date
};
return processors;
}
示例5: loadData
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
public void loadData() {
System.out.println("Loading the Data");
// load the current transactions
String[] nameMapping = new String[] { "customerId", "productId",
"quantity", "retailPrice", "id", "markUp", "orderStatus" };
CellProcessor[] processors = new CellProcessor[] { new NotNull(),// customerId
new NotNull(),// productId
new ParseInt(),// quantity
new ParseDouble(),// retailsPrice
new NotNull(),// transactionId
new ParseDouble(),// markUp
new NotNull() // order status
};
loadCurrentTransactions("current_transactions.csv", nameMapping,
processors);
System.out
.println("*************************************************************");
System.out
.println("********************PLAYING TRANSACTIONS*********************");
System.out
.println("*************************************************************");
start();
}
示例6: createTypes
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
public static void createTypes()
{
typeHash.put("DECIMAL", new ParseDouble());
typeHash.put("STRING", new NotNull());
typeHash.put("DATE", new ParseDate("MM/dd/yyyy"));
typeHash.put("NUMBER", new ParseInt());
typeHash.put("BOOLEAN", new ParseBool());
// now the optionals
typeHash.put("DECIMAL_OPTIONAL", new Optional(new ParseDouble()));
typeHash.put("STRING_OPTIONAL", new Optional());
typeHash.put("DATE_OPTIONAL", new Optional(new ParseDate("MM/dd/yyyy")));
typeHash.put("NUMBER_OPTIONAL", new Optional(new ParseInt()));
typeHash.put("BOOLEAN_OPTIONAL", new Optional(new ParseBool()));
}
示例7: getCellProcessors
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
private CellProcessor[] getCellProcessors() {
CellProcessor string = null;
CellProcessor optional = new Optional();
CellProcessor number = new ParseDouble();
//@formatter:off
return new CellProcessor[]{
string, // 0: openLCA ID
optional, // 1: openLCA name
string, // 2: openLCA property ID
optional, // 3: openLCA property name
string, // 4: openLCA unit ID
optional, // 5: openLCA unit name
string, // 6: ecoinvent ID
string, // 7: ecoinvent name
string, // 8: ecoinvent unit ID
string, // 9: ecoinvent unit name
string, // 10: ecoinvent sub-compartment ID
string, // 11: ecoinvent compartment name
string, // 12: ecoinvent sub-compartment name
number // 13: conversion factor
};
//@formatter:on
}
示例8: getCellProcessors
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
private CellProcessor[] getCellProcessors() {
CellProcessor notNull = new NotNull();
CellProcessor optional = new Optional();
CellProcessor number = new ParseDouble();
return new CellProcessor[] { notNull, // 0: sp name
notNull, // 1: sp compartment
optional, // 2: sp sub-compartment
notNull, // 3: sp unit
notNull, // 4: olca flow id
optional, // 5: olcd flow name
notNull, // 6: olca property id
optional, // 7: olca property name
notNull, // 8: olca unit id
optional, // 9: olca unit name
number // 10: conversion factor
};
}
示例9: cellProcessors
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
private static CellProcessor[] cellProcessors(int columns) {
ArrayList<CellProcessor> ret = new ArrayList<>();
ret.add(new NotNull());
for(int i = 0; i < columns; i++) {
ret.add(new ParseDouble());
}
return ret.toArray(new CellProcessor[ret.size()]);
}
示例10: initialise
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
public void initialise(String[] properties, CellProcessor[] processors)
{
for (int i = 0; i < getFields().size(); i++) {
FIELD_TYPE type = getFields().get(i).type;
properties[i] = getFields().get(i).name;
if (type == FIELD_TYPE.DOUBLE) {
processors[i] = new Optional(new ParseDouble());
} else if (type == FIELD_TYPE.INTEGER) {
processors[i] = new Optional(new ParseInt());
} else if (type == FIELD_TYPE.FLOAT) {
processors[i] = new Optional(new ParseDouble());
} else if (type == FIELD_TYPE.LONG) {
processors[i] = new Optional(new ParseLong());
} else if (type == FIELD_TYPE.SHORT) {
processors[i] = new Optional(new ParseInt());
} else if (type == FIELD_TYPE.STRING) {
processors[i] = new Optional();
} else if (type == FIELD_TYPE.CHARACTER) {
processors[i] = new Optional(new ParseChar());
} else if (type == FIELD_TYPE.BOOLEAN) {
processors[i] = new Optional(new ParseChar());
} else if (type == FIELD_TYPE.DATE) {
processors[i] = new Optional(new ParseDate("dd/MM/yyyy"));
}
}
}
示例11: addParseDouble
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
/**
* Get cellprocessor to parse String as Double.
*
* @param cellProcessor
* next processor in the chain.
* @return CellProcessor
*/
private static CellProcessor addParseDouble(CellProcessor cellProcessor)
{
if (cellProcessor == null) {
return new ParseDouble();
}
return new ParseDouble((DoubleCellProcessor)cellProcessor);
}
示例12: open
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
/**
*
* @param conf
* @param context
* @param collector
*/
@Override
public void open(Map conf, TopologyContext context, SpoutOutputCollector collector) {
this.collector = collector;
CellProcessor[] p = {new Optional(), new Optional(),
new Optional(new Token(" ", null, new ParseDate("yyyy-MM-dd HH:mm:ss.SSS", true))),
new Optional(new ParseDouble()), new Optional(new ParseDouble()), new Optional()};
this.processors = p;
File[] files = (new File("src/test/resources")).listFiles();
ComparableFileByModified[] pairs = new ComparableFileByModified[files.length];
for (int i = 0; i < files.length; i++) {
pairs[i] = new ComparableFileByModified(files[i]);
}
Arrays.sort(pairs);
this.beanReader = new CsvBeanReader[files.length];
for (int i = 0; i < pairs.length; i++) {
try {
this.beanReader[i] = new CsvBeanReader(new FileReader(pairs[i].f), CsvPreference.STANDARD_PREFERENCE);
} catch (FileNotFoundException ex) {
Logger.getLogger(EsperBoltStressTest.class.getName()).log(Level.SEVERE, null, ex);
this.beanReader[i] = null;
}
}
this.beanReaderCount = 0;
startMilis = System.currentTimeMillis();
}
示例13: test4
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
public static void test4(RandomLineAccessFile file) throws Exception{
CsvMapReader reader = new CsvMapReader(file.getReader(), CsvPreference.STANDARD_PREFERENCE);
String[] header = reader.getCSVHeader(false);
for(String s : header) System.out.print(s + "|");
System.out.println();
CellProcessor[] processor = new CellProcessor[]{new Optional(), new ParseDouble(), new ParseLong(), new Optional(), new Optional(), new Optional()};
Map<String, ? super Object> row = reader.read(header, processor);
while(row != null && row.size() != 0){
for(Object data : row.values()) System.out.print(data + "|");
row = reader.read(header, processor);
System.out.println();
}
reader.close();
}
示例14: createCellProcessorsByHeader
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
private Map<String, CellProcessor> createCellProcessorsByHeader() {
Map<String, CellProcessor> cellProcessors = new HashMap<String, CellProcessor>();
cellProcessors.put("device_info_serial", new NotNull(new ParseInt()));
cellProcessors.put("date_time", new JodaTimeCellProcessor().withSupportForPattern(Constants.DATE_TIME_PATTERN_POSTGRES));
cellProcessors.put("latitude", new NotNull(new ParseDouble()));
cellProcessors.put("longitude", new NotNull(new ParseDouble()));
cellProcessors.put("altitude", new NotNull(new ParseInt()));
cellProcessors.put("pressure", new NullWarningCellProcessor(new Optional(new ParseInt()), printer, "pressure"));
cellProcessors.put("temperature", new NullWarningCellProcessor(new Optional(new ParseDouble()), printer, "temperature"));
cellProcessors.put("satellites_used",
new NullWarningCellProcessor(new Optional(new ParseInt()), printer, "satellites_used"));
cellProcessors.put("gps_fixtime", new NotNull(new ParseDouble()));
cellProcessors.put("positiondop", new NotNull(new ParseDouble()));
cellProcessors.put("h_accuracy", new NullWarningCellProcessor(new Optional(new ParseDouble()), printer, "h_accuracy"));
cellProcessors.put("v_accuracy", new NullWarningCellProcessor(new Optional(new ParseDouble()), printer, "v_accuracy"));
cellProcessors.put("x_speed", new NullWarningCellProcessor(new Optional(new ParseDouble()), printer, "x_speed"));
cellProcessors.put("y_speed", new NullWarningCellProcessor(new Optional(new ParseDouble()), printer, "y_speed"));
cellProcessors.put("z_speed", new NullWarningCellProcessor(new Optional(new ParseDouble()), printer, "z_speed"));
cellProcessors.put("speed_accuracy",
new NullWarningCellProcessor(new Optional(new ParseDouble()), printer, "speed_accuracy"));
cellProcessors.put("location", new NotNull());
cellProcessors.put("userflag", new NotNull(new ParseInt()));
cellProcessors.put("speed_2d", new NullWarningCellProcessor(new Optional(new ParseDouble()), printer, "speed_2d"));
cellProcessors.put("speed_3d", new NullWarningCellProcessor(new Optional(new ParseDouble()), printer, "speed_3d"));
cellProcessors.put("direction", new NullWarningCellProcessor(new Optional(new ParseDouble()), printer, "direction"));
cellProcessors.put("altitude_agl",
new NullWarningCellProcessor(new Optional(new ParseDouble()), printer, "altitude_agl"));
return cellProcessors;
}
示例15: getProcessors
import org.supercsv.cellprocessor.ParseDouble; //导入依赖的package包/类
private CellProcessor[] getProcessors() {
return new CellProcessor[] { new ParseInt(), // device id
new JodaTimeCellProcessor().withSupportForPattern(Constants.DATE_TIME_PATTERN_POSTGRES), // timestamp
new ConvertNullTo(Double.NaN, new ParseDouble()), // speed
new ConvertNullTo(Double.NaN, new ParseDouble()), // longitude
new ConvertNullTo(Double.NaN, new ParseDouble()), // latitude
new ConvertNullTo(Double.NaN, new ParseDouble()), // altitude
new ConvertNullTo(Double.NaN, new ParseDouble()), // tspeed
new ConvertNullTo(-1, new ParseInt()), // index
new ConvertNullTo(Double.NaN, new ParseDouble()), // x
new ConvertNullTo(Double.NaN, new ParseDouble()), // y
new ConvertNullTo(Double.NaN, new ParseDouble()) // z
};
}