Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
themeEclipse
/**
 * Version and file information go here
 *
 * Copyright statement goes here
 */
package nl.gx.conventions;
/**
 * Class description goes here
 *
 * @author     Firstname Lastname
 */
public class Example {
  /**
   * Nice javadoc
   */
  public static int DUMMY_COUNT = 3;
  /**
   * Nice javadoc
   */
  public int myPublicSomethingElse;
  private String myPrivateSomething; // Private, therefore no javadoc mandatory
  /**
   * Constructor
   * @param something
   * @param somethingelse
   */
  public Example(String something, int somethingElse) {
    myPrivateSomething = something;
    myPublicSomethingElse = somethingElse;
  }
  /**
   * Getter for something
   * @return something
   */
  public String getSomething() {
    return myPrivateSomething;
  }
  /**
   * Setter for something
   * @param something
   */
  public void setSomething(String something) {
    myPrivateSomething = something;
  }
  /**
   * Makes it so
   * @param action action to perform
   */
  public void makeItSo(String action, int count) {
    boolean expression = action.equals("do") && count > DUMMY_COUNT;
    makeItSo(action, expression);
  }
  /**
   * Return 1 divided by given number
   * @param number the number to be divided
   */
  public int getError(int number) {
    // FIXME (ivol): this won’t work if myNumber equals 0
    return 1/number;
  }
  /**
   * Makes it so
   * @param action action to be performed
   * @param expression conditional expression which must be true to perform action
   */
  protected void makeItSo(String action, boolean expression) {
    if (expression) {
      // Perform the action
      try {
        performAction(action);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
    else {
      // Do nothing
    }
  }
  // No javadoc necessary for private method
  private void performAction(String action) throws Exception {
  }
  // No javadoc necessary for private method
  private int doComplexCalculation();
    // TODO must be implemented, return 0 for now
    return 0;
  }
}

 

 

 

 

 

 

 

...