/*
 * Copyright (c) 2002-2011 JSCAPE
 * 1147 S. 53rd Pl., Mesa, Arizona, 85206, U.S.A.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * JSCAPE. ("Confidential Information").  You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 *  the terms of the license agreement you entered into with JSCAPE.
 */

package com.jscape.inet.scp.protocol.marshaling;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Alex Usun
 */
public class CommandLine {

    public final String path;
    public final List<CommandOption> options;

    public static List<CommandOption> asList(CommandOption... options) {
        List<CommandOption> ret = new ArrayList<CommandOption>(options.length);
        for (CommandOption option : options) {
            if (option != null) {
                ret.add(option);
            }
        }

        return ret;
    }

    public CommandLine(String path, List<CommandOption> options) {
        this.path = path;
        this.options = options;
    }

    public CommandLine(String path, CommandOption... options) {
        this(path, asList(options));
    }

    public boolean contains(CommandOption option) {
        return this.options.contains(option);
    }

    @Override
    public String toString() {
        return "CommandLine {"
                + "path='" + this.path + '\''
                + ", options=" + this.options
                + '}';
    }

}
