public boolean valid() {
    boolean validEnding = declaration.charAt(declaration.length() - 1) == ';';
    for (int i = declaration.indexOf(")") + 1; i >= 0 && i < declaration.length() - 1 && validEnding; i++) {
      validEnding = declaration.charAt(i) == ' ';
    }
    return valid && validReturnType(returnType) && validIdentifier(identifier) && validParameters(parameters) && validEnding;
  }