Code Search for Developers
 
 
  

MyPropertySheet.java from Texai at Krugle


Show MyPropertySheet.java syntax highlighted

/*
 * MyPropertySheet.java
 *
 * Created on February 14, 2007, 1:05 PM
 *
 * Description:
 *
 * Copyright (C) 2007 Stephen L. Reed.
 *
 * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

package edu.cmu.sphinx.linguist.language.ngram.large;

import edu.cmu.sphinx.util.LogMath;
import edu.cmu.sphinx.util.props.Configurable;
import edu.cmu.sphinx.util.props.ConfigurationManager;
import edu.cmu.sphinx.util.props.PropertyException;
import edu.cmu.sphinx.util.props.PropertySheet;
import java.io.PrintStream;
import java.net.URL;
import java.util.HashMap;
import java.util.List;
import java.util.logging.Logger;
import org.texai.util.TexaiException;

/**
 *
 * @author reed
 */
public final class MyPropertySheet implements PropertySheet {
  
  /** the property dictionary, name --> value */
  final HashMap<String, Object> propertyDictionary = new HashMap<String, Object>(); 
  
  
  /** Creates a new instance of MyPropertySheet. */
  public MyPropertySheet() {
    super();
  }
  
  /**
   * Sets the given property to the given name
   *
   * @param name
   *            the simple property name
   * @param value
   *            the value for the property
   *
   *
   */
  public void setString(String name, String value) throws PropertyException {
    throw new TexaiException("not implemented");
  }
  
  /**
   * Sets the given property to the given name
   *
   * @param name
   *            the simple property name
   * @param value
   *            the value for the property
   */
  public void setInt(String name, int value) throws PropertyException {
    throw new TexaiException("not implemented");
  }
  
  /**
   * Sets the given property to the given name
   *
   * @param name
   *            the simple property name
   * @param value
   *            the value for the property
   */
  public void setFloat(String name, float value) throws PropertyException {
    propertyDictionary.put(name, Float.valueOf(value));
  }
  

  /**
   * Gets the value associated with this name
   *
   * @param name
   *            the name
   * @param defaultValue
   *            the default value for the property
   * @return the value
   */
  public String getString(String name, String defaultValue) throws PropertyException {
    throw new TexaiException("not implemented");
  }
  

  
  /**
   * Sets the raw property to the given name
   *
   * @param key
   *            the simple property name
   * @param val
   *            the value for the property
   */
  public void setRaw(String key, Object val) throws PropertyException {
    throw new TexaiException("not implemented");
  }
  

  /**
   * Gets the value associated with this name
   *
   * @param name
   *            the name
   * @param defaultValue
   *            the default value for the property
   * @return the value
   * @throws PropertyException
   *             if the named property is not of this type
   */
  public int getInt(String name, int defaultValue) throws PropertyException {
    throw new TexaiException("not implemented");
  }
  

  /**
   * Gets the value associated with this name
   *
   * @param name
   *            the name
   * @param defaultValue
   *            the default value
   * @return the value
   * @throws PropertyException
   *             if the named property is not of this type
   */
  public float getFloat(String name, float defaultValue) throws PropertyException {
    if (!propertyDictionary.containsKey(name)) {
      return defaultValue;
    } else {
      return ((Float) propertyDictionary.get(name)).floatValue();
    }
  }
  

  /**
   * Gets the value associated with this name
   *
   * @param name
   *            the name
   * @param defaultValue
   *            the default value
   * @return the value
   * @throws PropertyException
   *             if the named property is not of this type
   */
  public double getDouble(String name, double defaultValue) throws PropertyException {
    throw new TexaiException("not implemented");
  }
  

  /**
   * Sets the value property with this name
   *
   * @param name
   *            the simple property name
   * @param val
   *            the value for the property
   */
  public void setBoolean(String name, boolean val) throws PropertyException {
    propertyDictionary.put(name, Boolean.valueOf(val));
  }
  
  /**
   * Gets the value associated with this name
   *
   * @param name
   *            the name
   * @param defaultValue
   *            the default value
   * @return the value
   * @throws PropertyException
   *             if the named property is not of this type
   */
  public boolean getBoolean(String name, boolean defaultValue)
  throws PropertyException {
    if (!propertyDictionary.containsKey(name)) {
      return defaultValue;
    } else {
      return ((Boolean) propertyDictionary.get(name)).booleanValue();
    }
  }
  

  
  
  /**
   * Gets a resource associated with the given parameter name
   *
   * @param name the parameter name
   * @return the resource associated with the name or NULL if it
   * doesn't exist.
   * @throws PropertyException
   *             if the resource cannot be found
   */
  public URL getResource(String name) throws PropertyException {
    throw new TexaiException("not implemented");
  }
  

  
  /**
   * Gets a component associated with the given parameter name
   *
   * @param name
   *            the parameter name
   * @param type
   *            the desired component type
   * @return the component associated with the name
   * @throws PropertyException
   *             if the component does not exist or is of the wrong type.
   *
   */
  public Configurable getComponent(String name, Class type) throws PropertyException {
    throw new TexaiException("not implemented");
  }
  

  /**
   * Gets a list of components associated with the given parameter name
   *
   * @param name
   *            the parameter name
   * @param type
   *            the desired component type
   * @return the component associated with the name
   * @throws PropertyException
   *             if the component does not exist or is of the wrong type.
   *
   */
  public List getComponentList(String name, Class type) throws PropertyException {
    throw new TexaiException("not implemented");
  }
  

  /**
   * Gets the list of strings associated with this name
   *
   * @param name
   *            the name
   *
   * @return an array (possibly empty) of configurable strings
   * @throws PropertyException
   *             if the named property is not of this type
   */
  public List getStrings(String name) throws PropertyException {
    throw new TexaiException("not implemented");
  }
  

  /**
   * Retrieves the names of all the properties currently defined for this
   * property sheet
   *
   * @return the array of names
   */
  public String[] getNames() {
    throw new TexaiException("not implemented");
  }
  

  /**
   * Gets the raw value associated with this name
   *
   * @param name
   *            the name
   * @return the value as an object (it could be a String or a String[]
   *         depending upon the property type)
   */
  public Object getRaw(String name) throws PropertyException {
    throw new TexaiException("not implemented");
  }
  

  
  /**
   * Gets the raw value associated with this name, no global symbol
   * replacement is performed.
   *
   * @param name
   *            the name
   * @return the value as an object (it could be a String or a String[]
   *         depending upon the property type)
   */
  public Object getRawNoReplacment(String name) {
    throw new TexaiException("not implemented");
  }
  

  /**
   * Gets the owning property manager
   *
   * @return the property manager
   */
  public ConfigurationManager getPropertyManager() throws PropertyException {
    throw new TexaiException("not implemented");
  }
  

  
  
  /**
   * Returns a logger to use for this configurable component.
   * The logger can be configured with the property: 'logLevel' -
   * The default logLevel value is define by the global property
   * 'defaultLogLevel' (which defaults to WARNING).
   * @return the logger for this component
   * @throws PropertyException if an error occurs
   */
  public Logger getLogger() throws PropertyException {
    return Logger.getLogger(LogMath.class.getName());
  }
  

  
  /**
   * Dumps this sheet to the given stream
   *
   * @param out the print stream to dump the sheet on
   */
  public void dump(PrintStream out) {
    throw new TexaiException("not implemented");
  }
  

}




See more files for this project here

Texai

Texai is an chatbot that intelligently seeks to acquire knowledge and friendly behaviors.

Project homepage: http://sourceforge.net/projects/texai
Programming language(s): Java,Shell Script,XML
License: other

  MyBinaryLoader.java
  MyPropertySheet.java
  NGramImport.java
  file-format-description.txt