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

edu.jhuapl.dorset.agents.EchoAgent Maven / Gradle / Ivy

Go to download

A collection of agents that provide general functionality like answer math questions or give the current time.

The newest version!
/*
 * Copyright 2016 The Johns Hopkins University Applied Physics Laboratory LLC
 * All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package edu.jhuapl.dorset.agents;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import edu.jhuapl.dorset.agents.AbstractAgent;
import edu.jhuapl.dorset.agents.AgentRequest;
import edu.jhuapl.dorset.agents.AgentResponse;
import edu.jhuapl.dorset.agents.Description;

/**
 * Echoes back the text that it receives
 */
public class EchoAgent extends AbstractAgent {
    private final Logger logger = LoggerFactory.getLogger(EchoAgent.class);

    private static final String SUMMARY = "Echoes anything submitted";
    private static final String EXAMPLE = "You are the best";

    /**
     * Create an echo agent
     */
    public EchoAgent() {
        setDescription(new Description("echo", SUMMARY, EXAMPLE));
    }

    @Override
    public AgentResponse process(AgentRequest request) {
        logger.debug("Handling the request: " + request.getText());
        return new AgentResponse(request.getText());
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy