/*
 * $Id: Options.java,v 1.1 2004/11/22 12:51:17 koppy Exp $
 *
 * Copyright (c) Siemens AG 2008 
 *           (c) Universität Paderborn 2008 
 * Licensed under EUPL 1.1. 
 * 
 * Created on 19.11.2004
 *
 * $Log: Options.java,v $
 * Revision 1.1  2004/11/22 12:51:17  koppy
 * *** empty log message ***
 *
 */
package vkc.util;

/**
 * Simple wrapper to handle the given
 * command line options
 * <p>
 */
public class Options {
	private String[] options;

	public Options( String[] options ) {
		this.options = options;
	}

	public boolean has( String name ) {
		if( options == null ) {
			return false;
		}
		
		for ( int i = 0; i < options.length; i++ ) {
			if ( options[i].equals( "-" + name ) ) {
				return true;
			}
		}
		
		return false;
	}

	public String getOption( String name ) {
		if( options == null ) {
			return null;
		}
		
		for ( int i = 0; i < options.length - 1; i++ ) {
			if ( options[i].equals( "-" + name ) ) {
				return options[ i + 1 ];
			}
		}
		
		return null;
	}

	public boolean isEmpty(){
		return  options == null || options.length < 1;
	}
}
