/*
 * Copyright (C) 2016 Satomichi Nishihara
 *
 * This file is distributed under the terms of the
 * GNU General Public License. See the file `LICENSE'
 * in the root directory of the present distribution,
 * or http://www.gnu.org/copyleft/gpl.txt .
 */

package burai.com.env;

public class MacCPUInfo extends CPUInfo {

    public MacCPUInfo() {
        super();
    }

    @Override
    protected int countNumCPUs() {

        /*
         *  TODO: get #cpus for MacOS.
         */

        return 1;
    }
}

@@ -288,243 +288,1339 @@
 %0D%0A%0D%0A
-public class MacCPUInfo extends CPUInfo %7B%0D%0A%0D%0A    public MacCPUInfo() %7B%0D%0A        super();%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    protected int countNumCPUs() %7B%0D%0A%0D%0A        /*%0D%0A         *  TODO: get #cpus for MacOS.%0D%0A         */%0D%0A%0D%0A        return 1
+import java.io.BufferedReader;%0D%0Aimport java.io.IOException;%0D%0Aimport java.io.InputStreamReader;%0D%0A%0D%0Apublic class MacCPUInfo extends CPUInfo %7B%0D%0A%0D%0A    private static final String CHK_MAC_CPUCOM = %22system_profiler SPHardwareDataType%22;%0D%0A%0D%0A    private static final String CPU_WORD = %22Cores%22;%0D%0A%0D%0A    public MacCPUInfo() %7B%0D%0A        super();%0D%0A    %7D%0D%0A%0D%0A    @Override%0D%0A    protected int countNumCPUs() %7B%0D%0A%0D%0A        /*%0D%0A         *  TODO: get #cpus for MacOS.%0D%0A         */%0D%0A%0D%0A        int numCPUs = 0;%0D%0A%0D%0A        try %7B%0D%0A            Process process = Runtime.getRuntime().exec(CHK_MAC_CPUCOM);%0D%0A            BufferedReader in = new BufferedReader(new InputStreamReader(process%0D%0A                .getInputStream()));%0D%0A%0D%0A            String line = null;%0D%0A            while ((line = in.readLine()) != null) %7B%0D%0A                line = line.trim();%0D%0A                if (line.contains(CPU_WORD))%7B%0D%0A                    String%5B%5D nCPULine = line.split(%22 %22, 0);%0D%0A                    if (nCPULine.length == 0)%7B%0D%0A                        break;%0D%0A                    %7D%0D%0A                    else %7B%0D%0A                        numCPUs = Integer.parseInt(nCPULine%5BnCPULine.length -1%5D);%0D%0A                    %7D%0D%0A                %7D%0D%0A            %7D%0D%0A%0D%0A        %7D catch (IOException e) %7B%0D%0A            // TODO%0D%0A            e.printStackTrace();%0D%0A        %7D%0D%0A%0D%0A        return numCPUs
 ;%0D%0A 

check the number of CPU in Mac OS.