Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B90069B62 for ; Mon, 19 Mar 2012 11:52:32 +0000 (UTC) Received: (qmail 34962 invoked by uid 500); 19 Mar 2012 11:52:32 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 34887 invoked by uid 500); 19 Mar 2012 11:52:32 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 34878 invoked by uid 99); 19 Mar 2012 11:52:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Mar 2012 11:52:32 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Mar 2012 11:52:31 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 15E3C2388865 for ; Mon, 19 Mar 2012 11:52:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1302383 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java Date: Mon, 19 Mar 2012 11:52:11 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120319115211.15E3C2388865@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sebb Date: Mon Mar 19 11:52:10 2012 New Revision: 1302383 URL: http://svn.apache.org/viewvc?rev=1302383&view=rev Log: eol native Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java (contents, props changed) Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java?rev=1302383&r1=1302382&r2=1302383&view=diff ============================================================================== --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java (original) +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java Mon Mar 19 11:52:10 2012 @@ -1,88 +1,88 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.commons.csv; - -import java.io.Serializable; -import java.util.Arrays; -import java.util.Iterator; -import java.util.Map; - -/** - * A CSV record - * - * @author Emmanuel Bourg - */ -public class CSVRecord implements Serializable, Iterable { - - private static final String[] EMPTY_STRING_ARRAY = new String[0]; - - /** The values of the record */ - private final String[] values; - - /** The column name to index mapping. */ - private final Map mapping; - - CSVRecord(String[] values, Map mapping) { - this.values = values != null ? values : EMPTY_STRING_ARRAY; - this.mapping = mapping; - } - - /** - * Returns a value by index. - * - * @param i the index of the column retrieved - */ - public String get(int i) { - return values[i]; - } - - /** - * Returns a value by name. - * - * @param name the name of the column retrieved - */ - public String get(String name) { - if (mapping == null) { - throw new IllegalStateException("No header was specified, the record values can't be accessed by name"); - } - - Integer index = mapping.get(name); - - return index != null ? values[index.intValue()] : null; - } - - public Iterator iterator() { - return Arrays.asList(values).iterator(); - } - - String[] values() { - return values; - } - - /** - * Returns the number of values in this record. - */ - public int size() { - return values.length; - } - - @Override - public String toString() { - return Arrays.toString(values); - } -} +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.commons.csv; + +import java.io.Serializable; +import java.util.Arrays; +import java.util.Iterator; +import java.util.Map; + +/** + * A CSV record + * + * @author Emmanuel Bourg + */ +public class CSVRecord implements Serializable, Iterable { + + private static final String[] EMPTY_STRING_ARRAY = new String[0]; + + /** The values of the record */ + private final String[] values; + + /** The column name to index mapping. */ + private final Map mapping; + + CSVRecord(String[] values, Map mapping) { + this.values = values != null ? values : EMPTY_STRING_ARRAY; + this.mapping = mapping; + } + + /** + * Returns a value by index. + * + * @param i the index of the column retrieved + */ + public String get(int i) { + return values[i]; + } + + /** + * Returns a value by name. + * + * @param name the name of the column retrieved + */ + public String get(String name) { + if (mapping == null) { + throw new IllegalStateException("No header was specified, the record values can't be accessed by name"); + } + + Integer index = mapping.get(name); + + return index != null ? values[index.intValue()] : null; + } + + public Iterator iterator() { + return Arrays.asList(values).iterator(); + } + + String[] values() { + return values; + } + + /** + * Returns the number of values in this record. + */ + public int size() { + return values.length; + } + + @Override + public String toString() { + return Arrays.toString(values); + } +} Propchange: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVRecord.java ------------------------------------------------------------------------------ svn:eol-style = native