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

de.invation.code.toval.file.HMDFileParser Maven / Gradle / Ivy

Go to download

TOVAL comprises a set of java classes for common programming issues. It includes utils for arrays, lists, sets and collections for convenient handling and modification, but also support for mathematic definitions concerning logic (clauses + resolution) together with some algorithms for permutations, powersets and resolution. Additionally it contains a number of types for multisets, matrices with object keys and much more.

The newest version!
package de.invation.code.toval.file;

import java.nio.charset.Charset;
import java.util.HashSet;
import java.util.Set;

import de.invation.code.toval.validate.ParameterException;


public class HMDFileParser extends LineBasedFileTransformer {
	
	public HMDFileParser(){
		super();
	}
	
	public HMDFileParser(Charset charset) throws ParameterException{
		super(charset);
	}

	@Override
	protected Set transformLine(String line) {
		Set result = new HashSet();
		result.add(line.substring(1, line.length()));
		return result;
	}

	public static void main(String[] args) throws Exception{
		if(args.length < 1 || args.length > 2){
			System.out.println("Usage: FileParser [charset] filename");
			return;
		}
		LineBasedFileTransformer parser;
		if(args.length == 2){
			parser = new HMDFileParser(Charset.forName(args[0]));
			parser.parseFile(args[1]);
		} else {
			parser = new HMDFileParser();
			parser.parseFile(args[0]);
		}
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy