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


Java CSVRecord.size方法代码示例

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


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

示例1: getUniqueFields

import org.apache.commons.csv.CSVRecord; //导入方法依赖的package包/类
private static String[] getUniqueFields(File inFile) throws IOException {
	CSVParser parser = new CSVParser(new BufferedReader(new FileReader(inFile)),
			CSVFormat.EXCEL.withNullString(NULL_STRING));
	// first record used as header
	CSVRecord header = parser.iterator().next();
	List<String> uniqueFields = new ArrayList<String>();
	for(int i = 0; i < header.size(); i++) {
		String col = header.get(i);
		if (!uniqueFields.contains(col)) {
			// we can add it directly
			uniqueFields.add(col);
		} else {
			// disambiguate by appending index
			uniqueFields.add(col + "_" + i);
		}
	}
	return uniqueFields.toArray(new String[0]);
}
 
开发者ID:mitdbg,项目名称:imputedb,代码行数:19,代码来源:HeapFileEncoder.java

示例2: createTagPool

import org.apache.commons.csv.CSVRecord; //导入方法依赖的package包/类
private List<TagPool> createTagPool(CSVParser parser) throws BuenOjoCSVParserException{
	ArrayList<TagPool> list = new ArrayList<>();
	for (CSVRecord record : parser) {
		String name = record.get(TagPoolColumn.TAG.ordinal()).toString();

     	Tag tag = tagMap.get(name);
     	

     	for (int i = TagPoolColumn.SIMILAR_1.ordinal(); (i <record.size()) && i <= TagPoolColumn.SIMILAR_3.ordinal(); i++) {
     		String similarTagName = record.get(i);
     		if (similarTagName != null && !StringUtils.isAnyEmpty(similarTagName)){
     			Tag similarTag = tagMap.get(similarTagName);
     			
     			if (similarTag != null){
	     			TagPool tagPool = new TagPool();
	     			tagPool.setTag(tag);
	     			tagPool.setSimilarTag(similarTag);
	     			tagPool.setSimilarity(i);
	     			list.add(tagPool);
     			} else {
     				throw new BuenOjoCSVParserException("no se pudo obtener la etiqueta con nombre: '"+similarTagName+"'");
     			}
     		}
     	}
	}
	return list;
	
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:29,代码来源:TagPoolCSVParser.java

示例3: load

import org.apache.commons.csv.CSVRecord; //导入方法依赖的package包/类
public static void load(File location, AbstractDataModel sAbstractData) {
    CSVHParser parser = FileUtils.getCSVHParser(location);
    if (parser != null) {
        for (CSVRecord crecord : parser.getRecords()) {
            List record = sAbstractData.getNewRecord();
            for (int i = 0; i < crecord.size(); i++) {
                record.add(crecord.get(i));
            }
            sAbstractData.addRecord(record);
        }
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:13,代码来源:CSVUtils.java

示例4: loadFileinTable

import org.apache.commons.csv.CSVRecord; //导入方法依赖的package包/类
public static void loadFileinTable(File file, JTable table) {
    if (file.exists()) {
        try (Reader in = new FileReader(file)) {
            CSVParser parser = CSVFormat.EXCEL.withHeader().withSkipHeaderRecord().withIgnoreEmptyLines().parse(in);
            if (!parser.getHeaderMap().isEmpty()) {
                DefaultTableModel model = (DefaultTableModel) table.getModel();
                for (String columnHeader : parser.getHeaderMap().keySet()) {
                    if (!columnHeader.trim().isEmpty()) {
                        model.addColumn(columnHeader);
                    }
                }
                List<CSVRecord> records = parser.getRecords();
                for (CSVRecord record : records) {
                    Object[] row = new Object[record.size()];
                    for (int i = 0; i < record.size(); i++) {
                        row[i] = record.get(i);
                    }
                    model.addRow(row);
                }
            }
        } catch (IOException ex) {
            LOGGER.log(Level.SEVERE, null, ex);
        }
    } else {
        LOGGER.log(Level.SEVERE, "File [{0}] doesn''t exist", file.getAbsolutePath());
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:28,代码来源:FileUtils.java

示例5: loadStep

import org.apache.commons.csv.CSVRecord; //导入方法依赖的package包/类
private void loadStep(CSVRecord record) {
    for (int i = 0; i < record.size(); i++) {
        stepDetails.add(record.get(i));
    }
    while (stepDetails.size() != HEADERS.values().length) {
        stepDetails.add("");
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:9,代码来源:TestStep.java

示例6: loadStep

import org.apache.commons.csv.CSVRecord; //导入方法依赖的package包/类
private void loadStep(CSVRecord record) {
    for (int i = 0; i < record.size(); i++) {
        exeStepDetails.add(record.get(i));
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:6,代码来源:ExecutionStep.java

示例7: getString

import org.apache.commons.csv.CSVRecord; //导入方法依赖的package包/类
public static String getString(CSVRecord record, int index) {
    return index < record.size() ? StringUtils.trim(record.get(index)) : null;
}
 
开发者ID:snowplow,项目名称:iab-spiders-and-robots-java-client,代码行数:4,代码来源:CsvUtils.java


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