/* * [Video.java] * * Summary: enum constants for onboard video. * * Copyright: (c) 2011-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.7+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2011-04-09 initial version. */ package com.mindprod.mother; /** * enum constants for onboard video. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2011-04-09 initial version. * @since 2011-04-09 */ public enum Video { UNKNOWN, NONE( "None", "support", "supports", "Lucid", "Multi-Graphics Technology" ), // must use video card AMD( "AMD", "690G", "740G", "760G", "780G", "785G", "790GX", "880G", "890GX", "AMD Radeon HD 6310" ), ATI( "ATI", "Radeon", "Crossfire" ), INTEL( "Intel", "H55", "H57", "H61", "H67", "945GC" ), NVIDIA( "NVIDIA", "GeForce", "630a", "GeForce 8100", "GeForce 8200", "nForce 750a" ), REALTEK( "Realtek" ), S3( "S3", "UniChrome" ), SIS( "Sis" ), TRIDENT( "Trident" ), VIA( "VIA", "Chrome9" ), VIAS3( "VIA/S3" ); /** * cannot use String... here, only in parm list alternate input names for the alias */ private final String[] aliases; /** * constructor for an enum constant * * @param aliases other names for string input */ Video( String... aliases ) { this.aliases = aliases; } /** * convert alias string to equivalent canonical enum constant, like valueOf but accepts aliases too, and does not * care about case. * * @param s alias as string * * @return equivalent AppCat enum constant */ public static Video valueOfAlias( String s ) { s = s.trim(); try { return valueOf( s.toUpperCase() ); } catch ( IllegalArgumentException e ) { // usual method failed, try looking up alias // This seems long winded, why no HashSet? // Because Java won't let me access a static common // lookup in the enum constructors. for ( Video candidateEnum : Video.values() ) { for ( String candidateString : candidateEnum.aliases ) { if ( candidateString.equalsIgnoreCase( s ) ) { return candidateEnum; } } } // fell out the bottom of search over all enums and aliases // give up throw new IllegalArgumentException( "unknown Video: " + s ); } } /** * ordinary toString * * @return upper and lower case name for the manufacturer. */ public String toString() { if ( aliases.length > 0 ) { return aliases[ 0 ]; } else { return name(); } } }