當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。