All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.skjolber.stcsv.column.bi.BooleanCsvColumnValueConsumer Maven / Gradle / Ivy

There is a newer version: 1.0.25
Show newest version
package com.github.skjolber.stcsv.column.bi;

public class BooleanCsvColumnValueConsumer implements CsvColumnValueConsumer {

	protected final ObjBooleanConsumer setter;
		
	public BooleanCsvColumnValueConsumer(ObjBooleanConsumer setter) {
		this.setter = setter;
	}

	@Override
	public void consume(T object, char[] array, int start, int end) {
		
		setter.accept(object, parseBoolean(array, start, end));
	}

	public static boolean parseBoolean(char[] array, int start, int end) {
		return end - start == 4 && 
		(array[start] == 't' || array[start] == 'T') &&
		(array[++start] == 'r' || array[start] == 'R') &&
		(array[++start] == 'u' || array[start] == 'U') &&
		(array[++start] == 'e' || array[start] == 'E');
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy