Пример #1
0
 /**
  * Creates a new instance of the appropriate platform-specific {@link HardwareAbstractionLayer}.
  *
  * @return A new instance of {@link HardwareAbstractionLayer}.
  */
 public HardwareAbstractionLayer getHardware() {
   if (this._hardware == null) {
     switch (this.currentPlatformEnum) {
       case WINDOWS:
         this._hardware = new WindowsHardwareAbstractionLayer();
         break;
       case LINUX:
         this._hardware = new LinuxHardwareAbstractionLayer();
         break;
       case MACOSX:
         this._hardware = new MacHardwareAbstractionLayer();
         break;
       default:
         throw new RuntimeException("Operating system not supported: " + Platform.getOSType());
     }
   }
   return this._hardware;
 }
Пример #2
0
 /**
  * Creates a new instance of the appropriate platform-specific {@link OperatingSystem}.
  *
  * @return A new instance of {@link OperatingSystem}.
  */
 public OperatingSystem getOperatingSystem() {
   if (this._os == null) {
     switch (this.currentPlatformEnum) {
       case WINDOWS:
         this._os = new WindowsOperatingSystem();
         break;
       case LINUX:
         this._os = new LinuxOperatingSystem();
         break;
       case MACOSX:
         this._os = new MacOperatingSystem();
         break;
       default:
         throw new RuntimeException("Operating system not supported: " + Platform.getOSType());
     }
   }
   return this._os;
 }