// Path: public-java/io/iamcontent-cli/src/main/java/com/iamcontent/io/cli/CommandLineDriver.java
// public static String tidied(String command) {
// 	return command.trim().toLowerCase();
// }


import static com.iamcontent.io.cli.CommandLineDriver.tidied;
import java.util.function.Predicate;

/**
  IAmContent Public Libraries.
  Copyright (C) 2015-2021 Greg Elderfield
  @author Greg Elderfield, support@jarchitect.co.uk
 
  This program is free software; you can redistribute it and/or modify it under the terms of the
  GNU General Public License as published by the Free Software Foundation; either version 2 of 
  the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU General Public License for more details.

  You should have received a copy of the GNU General Public License along with this program;
  if not, write to the Free Software Foundation, Inc., 
  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
package com.iamcontent.io.cli;




/**
 * An abstract class for implementing command handlers (i.e. Predicates which execute any command that they
 * understand (as a side-effect), returning true when a command is executed, false otherwise).
 * @author Greg Elderfield
 */
public abstract class CommandHandler implements Predicate<String> {

	@Override
	public boolean test(String command) {
		try {

// Path: public-java/io/iamcontent-cli/src/main/java/com/iamcontent/io/cli/CommandLineDriver.java
// public static String tidied(String command) {
// 	return command.trim().toLowerCase();
// }


// Path: public-java/io/iamcontent-cli/src/main/java/com/iamcontent/io/cli/CommandHandler.java
import static com.iamcontent.io.cli.CommandLineDriver.tidied;
import java.util.function.Predicate;

/**
  IAmContent Public Libraries.
  Copyright (C) 2015-2021 Greg Elderfield
  @author Greg Elderfield, support@jarchitect.co.uk
 
  This program is free software; you can redistribute it and/or modify it under the terms of the
  GNU General Public License as published by the Free Software Foundation; either version 2 of 
  the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU General Public License for more details.

  You should have received a copy of the GNU General Public License along with this program;
  if not, write to the Free Software Foundation, Inc., 
  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
package com.iamcontent.io.cli;




/**
 * An abstract class for implementing command handlers (i.e. Predicates which execute any command that they
 * understand (as a side-effect), returning true when a command is executed, false otherwise).
 * @author Greg Elderfield
 */
public abstract class CommandHandler implements Predicate<String> {

	@Override
	public boolean test(String command) {
		try {

			return executeIfCommandMatches(tidied(command));
