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

com.greenpepper.interpreter.flow.AbstractAction Maven / Gradle / Ivy

The newest version!
package com.greenpepper.interpreter.flow;

import static com.greenpepper.util.CollectionUtil.filter;
import static com.greenpepper.util.CollectionUtil.joinAsString;
import static com.greenpepper.util.CollectionUtil.toArray;

import java.util.List;

import com.greenpepper.Call;
import com.greenpepper.reflect.Fixture;
import com.greenpepper.reflect.Message;
import com.greenpepper.reflect.NoSuchMessageException;
import com.greenpepper.util.NotBlank;

/**
 * 

Abstract AbstractAction class.

* * @author oaouattara * @version $Id: $Id */ public abstract class AbstractAction { private final Iterable cells; /** *

Constructor for AbstractAction.

* * @param cells a {@link java.lang.Iterable} object. */ public AbstractAction( Iterable cells ) { this.cells = cells; } /** *

Getter for the field cells.

* * @return a {@link java.lang.Iterable} object. */ protected Iterable getCells() { return this.cells; } /** *

checkAgainst.

* * @param fixture a {@link com.greenpepper.reflect.Fixture} object. * @return a {@link com.greenpepper.Call} object. * @throws java.lang.Exception if any. */ public Call checkAgainst( Fixture fixture ) throws Exception { return call( fixture.check( name() ) ); } /** *

call.

* * @param message a {@link com.greenpepper.reflect.Message} object. * @return a {@link com.greenpepper.Call} object. * @throws com.greenpepper.reflect.NoSuchMessageException if any. */ protected Call call( Message message ) throws NoSuchMessageException { Call call = new Call( message ); call.addInput( arguments() ); return call; } /** *

keywords.

* * @return a {@link java.util.List} object. */ protected abstract List keywords(); /** *

parameters.

* * @return a {@link java.util.List} object. */ protected abstract List parameters(); /** *

arguments.

* * @return an array of {@link java.lang.String} objects. */ public String[] arguments() { return toArray( parameters() ); } /** *

name.

* * @return a {@link java.lang.String} object. */ public String name() { return joinAsString( toArray( filter ( keywords(), new NotBlank() ) ), " "); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy