/*
 * Copyright © 2014 Cask Data, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package co.cask.cdap.api;

/**
 * Carries system resources requirements.
 */
public final class Resources {

  private static final int DEFAULT_VIRTUAL_CORES = 1;
  private static final int DEFAULT_MEMORY_MB = 512;

  private final int virtualCores;
  private final int memoryMB;

  /**
   * Constructs a Resources instance that represents 1 virtual core and 512MB of memory.
   */
  public Resources() {
    this(DEFAULT_MEMORY_MB, DEFAULT_VIRTUAL_CORES);
  }

  /**
   * Constructs a Resources instance that represents 1 virtual core and custom memory size.
   *
   * @param memoryMB memory requirement in MB.
   */
  public Resources(int memoryMB) {
    this(memoryMB, DEFAULT_VIRTUAL_CORES);
  }

  /**
   * Constructs a Resources instance.
   *
   * @param memoryMB memory requirement in MB.
   * @param cores number of virtual cores.
   */
  public Resources(int memoryMB, int cores) {
    this.memoryMB = memoryMB;
    this.virtualCores = cores;
  }

  /**
   * Returns the number of virtual cores.
   */
  public int getVirtualCores() {
    return virtualCores;
  }

  /**
   * Returns the memory size in MB.
   */
  public int getMemoryMB() {
    return memoryMB;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }

    Resources that = (Resources) o;
    return (this.memoryMB == that.memoryMB) && (this.virtualCores == that.virtualCores);
  }

  @Override
  public int hashCode() {
    int result = memoryMB;
    result = 31 * result + virtualCores;
    return result;
  }
}

@@ -1771,439 +1771,7 @@
 %0A  %7D
-%0A%0A  @Override%0A  public boolean equals(Object o) %7B%0A    if (this == o) %7B%0A      return true;%0A    %7D%0A    if (o == null %7C%7C getClass() != o.getClass()) %7B%0A      return false;%0A    %7D%0A%0A    Resources that = (Resources) o;%0A    return (this.memoryMB == that.memoryMB) && (this.virtualCores == that.virtualCores);%0A  %7D%0A%0A  @Override%0A  public int hashCode() %7B%0A    int result = memoryMB;%0A    result = 31 * result + virtualCores;%0A    return result;%0A  %7D
 %0A%7D%0A

Remove Resources' equals, hashCode methods