Package physicsConstants

Source Code of physicsConstants.PhysicsConstants

package physicsConstants;

import lipstone.joshua.parser.exceptions.ParserException;
import lipstone.joshua.parser.exceptions.PluginConflictException;
import lipstone.joshua.parser.plugin.ParserPlugin;
import lipstone.joshua.parser.plugin.helpdata.Keyword;
import lipstone.joshua.parser.plugin.types.KeywordPlugin;

public class PhysicsConstants extends ParserPlugin implements KeywordPlugin {
 
  @Override
  public String getKeywordData(String keyword) throws ParserException {
    if (keyword.equals("g"))
      return "9.80";
    if (keyword.equals("G"))
      return "(6.67384*10^-11)";
    if (keyword.equals("MSun"))
      return "(1.9891*10^30)";
    if (keyword.equals("MEarth"))
      return "(5.972*10^24)";
    if (keyword.equals("h"))
      return "(6.626068*10^(-34))";
    if (keyword.equals("ke"))
      return "(8.987551787368*10^9)";
    if (keyword.equals("Me"))
      return "(9.10938188*10^(-31))";
    if(keyword.equals("c"))
      return "(299792458)";
    return null;
  }
 
  @Override
  public void loadKeywords() throws PluginConflictException {
    addKeyword(new Keyword("g", "the gravitational force on Earth's surface, 9.80", this));
    addKeyword(new Keyword("G", "Newton's gravitational constant", this));
    addKeyword(new Keyword("MSun", "The mass of the Sun", this));
    addKeyword(new Keyword("MEarth", "The mass of the Earth", this));
    addKeyword(new Keyword("h", "Planck's Constant", this));
    addKeyword(new Keyword("ke", "Coulomb's Constant", this));
    addKeyword(new Keyword("Melectron", "Mass of an electron", this));
    addKeyword(new Keyword("c", "The speed of light in meters per second", this));
  }
 
  @Override
  public void unloadKeywords() {/*Nothing to do here*/}
 
TOP

Related Classes of physicsConstants.PhysicsConstants

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.