package jpower.core;

/**
 * Operating System Utilities
 */
public final class OperatingSystem
{
   private static final OperatingSystem current = forName(System.getProperty("os.name"));

   private final String name;

   private OperatingSystem(String name)
   {
      this.name = name.toLowerCase();
   }

   /**
    * Gets the Current Operating System
    *
    * @return Current OS
    */
   public static OperatingSystem current()
   {
      return current;
   }

   /**
    * Gets the specified Operating System
    * @param name OS Name
    * @return Operating System
    */
   public static OperatingSystem forName(String name)
   {
      return new OperatingSystem(name);
   }

   /**
    * Checks if the Current OS is Windows
    * @return true if Windows, otherwise false
    */
   public boolean isWindows()
   {
      return name.contains("win");
   }

   /**
    * Checks if the Current OS is Mac OSX
    * @return true if Mac OSX, otherwise false
    */
   public boolean isMac()
   {
      return name.contains("mac");
   }

   /**
    * Checks if the Current OS is Unix
    * @return true if Unix, otherwise false
    */
   public boolean isUnix()
   {
      return name.contains("nix") || name.contains("nux") || name.contains("aix");
   }

   /**
    * Checks if the Current OS is Solaris
    * @return true if Solaris, otherwise false
    */
   public boolean isSolaris()
   {
      return name.contains("sunos");
   }

   /**
    * Checks if the OS could not be determined
    * @return true if not determined, otherwise false
    */
   public boolean isUnknown()
   {
      return !(isUnix() || isSolaris() || isMac() || isWindows());
   }

   /**
    * Checks if the OS is Case Sensitive
    * @return true if case sensitive, otherwise false
    */
   public boolean isCaseSensitive()
   {
      return isUnix();
   }

   /**
    * Checks if the Operating System is the same as the Current Operating System
    * @return true if the current os, otherwise false
    */
   public boolean isCurrent()
   {
      return current().name.equals(name);
   }

   /**
    * Gets the OS Version
    * @return OS Version if the instance is the Current OS, otherwise "unknown"
    */
   public String version()
   {
      return isCurrent() ? System.getProperty("os.version") : "unknown";
   }

   /**
    * Gets the Line Separator for the OS
    * @return Line Separator
    */
   public String lineSeparator()
   {
      if (isUnix() || isMac())
      {
         return "\n";
      }
      else if (isWindows())
      {
         return "\r\n";
      }
      else
      {
         return "\n";
      }
   }

   /**
    * Gets the OS Name
    * @return OS Name
    */
   public String getName()
   {
      return name;
   }
}

@@ -317,23 +317,22 @@
    * Get
-s
  the 
-C
+c
 urrent O
@@ -346,22 +346,17 @@
 g System
-%0A    *
+.
 %0A    * @
@@ -468,25 +468,24 @@
 **%0A    * Get
-s
  the specifi
@@ -495,32 +495,33 @@
 Operating System
+.
 %0A    * @param na
@@ -688,33 +688,32 @@
 %0A    * Check
-s
  if the 
 Current OS i
@@ -696,34 +696,40 @@
 heck if the 
-Current OS
+Operating System
  is Windows%0A
@@ -727,16 +727,17 @@
  Windows
+.
 %0A    * @
@@ -873,33 +873,32 @@
 %0A    * Check
-s
  if the 
 Current OS i
@@ -881,34 +881,40 @@
 heck if the 
-Current OS
+Operating System
  is Mac OSX%0A
@@ -911,17 +911,19 @@
 s Mac OS
-X
+ X.
 %0A    * @
@@ -1055,33 +1055,32 @@
 %0A    * Check
-s
  if the 
 Current OS i
@@ -1071,26 +1071,32 @@
 the 
-Current OS
+Operating System
  is Unix
 %0A   
@@ -1091,16 +1091,23 @@
  is Unix
+-based.
 %0A    * @
@@ -1289,25 +1289,24 @@
  * Check
-s
  if the 
 Current 
@@ -1297,26 +1297,32 @@
  if the 
-Current OS
+Operating System
  is Sola
@@ -1324,16 +1324,17 @@
  Solaris
+.
 %0A    * @
@@ -1468,33 +1468,32 @@
  /**%0A    * Check
-s
  if the OS could
@@ -1485,17 +1485,31 @@
 if the O
-S
+perating System
  could n
@@ -1524,16 +1524,17 @@
 termined
+.
 %0A    * @
@@ -1705,33 +1705,32 @@
  /**%0A    * Check
-s
  if the OS is Ca
@@ -1726,27 +1726,41 @@
 he O
-S
+perating System
  is 
-Case S
+case-s
 ensitive
 %0A   
@@ -1755,16 +1755,17 @@
 ensitive
+.
 %0A    * @
@@ -1783,17 +1783,17 @@
  if case
- 
+-
 sensitiv
@@ -1910,16 +1910,16 @@
 heck
-s
  if th
-e
+is
  Ope
@@ -1939,48 +1939,33 @@
  is 
-the same as
+equal to
  the 
-C
+c
 urrent 
-Operating System
+one.
 %0A   
@@ -2125,24 +2125,38 @@
  Get
-s
  the O
-S V
+perating System v
 ersion
+.
 %0A   
@@ -2370,20 +2370,19 @@
  Get
-s
  the 
-L
+l
 ine 
-S
+s
 epar
@@ -2394,18 +2394,33 @@
 for the 
-OS
+operating system.
 %0A    * @
@@ -2698,21 +2698,35 @@
  Get
-s
  the O
-S N
+perating System n
 ame
+.
 %0A   

Make a few documentation changes.