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

com.hn.translation.AbstractOnlineTranslator Maven / Gradle / Ivy

There is a newer version: 1.0.18
Show newest version
package com.hn.translation;

import java.util.HashMap;
import java.util.Map;

public abstract class AbstractOnlineTranslator
  implements Translator
{
  protected Map langMap = new HashMap();

  @Override
  public final String trans(LANG from, LANG targ, String query)
    throws Exception
  {
    String response = "";
    try
    {
      response = getResponse(from, targ, query);
      return parseString(response);
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
    return response;
  }

  protected abstract String getResponse(LANG from, LANG targ, String query)
    throws Exception;

  /**
   *
   * @param paramString
   * @return
   */
  protected abstract String parseString(String paramString);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy