/*
 * Copyright 2016 Open Networking Laboratory
 *
 * 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 org.onosproject.cpman.impl;

import org.onosproject.cpman.SystemInfo;

/**
 * Implementation class of storing system specification.
 */
public final class DefaultSystemInfo implements SystemInfo {
    private int numOfCores;
    private int numOfCpus;
    private int cpuSpeedMhz;
    private int totalMemoryMbytes;

    private DefaultSystemInfo(int numOfCores, int numOfCpus,
                              int cpuSpeedMhz, int totalMemoryMbytes) {
        this.numOfCores = numOfCores;
        this.numOfCpus = numOfCpus;
        this.cpuSpeedMhz = cpuSpeedMhz;
        this.totalMemoryMbytes = totalMemoryMbytes;
    }

    @Override
    public int coreCount() {
        return this.numOfCores;
    }

    @Override
    public int cpuCount() {
        return this.numOfCpus;
    }

    @Override
    public int cpuSpeed() {
        return this.cpuSpeedMhz;
    }

    @Override
    public int totalMemory() {
        return this.totalMemoryMbytes;
    }

    /**
     * ControlMetricsSystemSpec builder class.
     */
    public static final class Builder implements SystemInfo.Builder {
        private int numOfCores;
        private int numOfCpus;
        private int cpuSpeedMHz;
        private int totalMemoryBytes;

        @Override
        public SystemInfo.Builder numOfCores(int numOfCores) {
            this.numOfCores = numOfCores;
            return this;
        }

        @Override
        public Builder numOfCpus(int numOfCpus) {
            this.numOfCpus = numOfCpus;
            return this;
        }

        @Override
        public Builder cpuSpeed(int cpuSpeedMhz) {
            this.cpuSpeedMHz = cpuSpeedMhz;
            return this;
        }

        @Override
        public Builder totalMemory(int totalMemoryBytes) {
            this.totalMemoryBytes = totalMemoryBytes;
            return this;
        }

        @Override
        public DefaultSystemInfo build() {
            return new DefaultSystemInfo(numOfCores, numOfCpus, cpuSpeedMHz, totalMemoryBytes);
        }
    }
}

@@ -682,16 +682,109 @@
 mInfo;%0A%0A
+import java.util.Objects;%0A%0Aimport static com.google.common.base.MoreObjects.toStringHelper;%0A%0A
 /**%0A * I
@@ -905,32 +905,38 @@
 o %7B%0A    private 
+final 
 int numOfCores;%0A
@@ -939,32 +939,38 @@
 es;%0A    private 
+final 
 int numOfCpus;%0A 
@@ -972,32 +972,38 @@
 us;%0A    private 
+final 
 int cpuSpeedMhz;
@@ -1007,32 +1007,38 @@
 hz;%0A    private 
+final 
 int totalMemoryM
@@ -1636,24 +1636,24 @@
 lMemory() %7B%0A
-
         retu
@@ -1682,24 +1682,1052 @@
 tes;%0A    %7D%0A%0A
+%0A    @Override%0A    public int hashCode() %7B%0A        return Objects.hash(numOfCores, numOfCpus, cpuSpeedMhz, totalMemoryMbytes);%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj) %7B%0A        if (this == obj) %7B%0A            return true;%0A        %7D%0A        if (obj instanceof DefaultSystemInfo) %7B%0A            final DefaultSystemInfo other = (DefaultSystemInfo) obj;%0A            return Objects.equals(this.numOfCores, other.numOfCores) &&%0A                    Objects.equals(this.numOfCpus, other.numOfCpus) &&%0A                    Objects.equals(this.cpuSpeedMhz, other.cpuSpeedMhz) &&%0A                    Objects.equals(this.totalMemoryMbytes, other.totalMemoryMbytes);%0A        %7D%0A        return false;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A        return toStringHelper(this)%0A                .add(%22numOfCores%22, numOfCores)%0A                .add(%22numOfCpus%22, numOfCpus)%0A                .add(%22cpuSpeedMhz%22, cpuSpeedMhz)%0A                .add(%22totalMemoryMbytes%22, totalMemoryMbytes)%0A                .toString();%0A    %7D%0A%0A
     /**%0A    

Add equals, toString, hashCode methods for DefaultSystemInfo