wudsn-ide/com.wudsn.ide.lng/src/com/wudsn/ide/lng/HardwareUtility.java
2021-09-28 13:39:39 +02:00

60 lines
1.9 KiB
Java

/**
* Copyright (C) 2009 - 2021 <a href="https://www.wudsn.com" target="_top">Peter Dell</a>
*
* This file is part of WUDSN IDE.
*
* WUDSN IDE is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* WUDSN IDE is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with WUDSN IDE. If not, see <http://www.gnu.org/licenses/>.
*/
package com.wudsn.ide.lng;
import com.wudsn.ide.base.hardware.Hardware;
import com.wudsn.ide.lng.compiler.CompilerFileWriter;
import com.wudsn.ide.lng.compiler.writer.AppleFileWriter;
/**
* Map value of {@link Hardware} to icon paths and descriptors.
*
* @author Peter Dell
*
* TODO: Move to right place/class
*/
public final class HardwareUtility {
/**
* Creation is private.
*/
private HardwareUtility() {
}
/**
* Gets the compiler file writer a hardware.
*
* @param hardware The hardware, not <code>null</code>.
* @return The image descriptor for the hardware image, not <code>null</code>.
* @since 1.6.4
*/
public static CompilerFileWriter getCompilerFileWriter(Hardware hardware) {
if (hardware == null) {
throw new IllegalArgumentException("Parameter 'hardware' must not be null.");
}
CompilerFileWriter compilerFileWriter;
if (hardware.equals(Hardware.APPLE2)) {
compilerFileWriter = new AppleFileWriter();
} else {
compilerFileWriter = new CompilerFileWriter();
}
return compilerFileWriter;
}
}