Class Environment


  • public class Environment
    extends java.lang.Object
    Static utility functions regarding the environment of EASy.
    Author:
    El-Sharkawy
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Environment()
      Should avoid instances of this class.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean isWinOS()
      Checks whether this program is currently running on a Windows machine.
      private static int parseVersionPart​(java.lang.String version, int part)
      Parses the numerical version part from version.
      static boolean runsInEclipse()
      Checks whether EASy runs inside of Eclipse.
      static java.io.File toFile​(java.net.URL localURL)
      Converts the given URL to an File.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Environment

        private Environment()
        Should avoid instances of this class.
    • Method Detail

      • runsInEclipse

        public static boolean runsInEclipse()
        Checks whether EASy runs inside of Eclipse. Overridden to non-eclipse if system property easy.notInEclipse is somehow set.
        Returns:
        true if EASy runs inside of Eclipse, false otherwise.
      • parseVersionPart

        private static int parseVersionPart​(java.lang.String version,
                                            int part)
        Parses the numerical version part from version.
        Parameters:
        version - the textual representation of the (Eclipse) version
        part - the 0-based index for the part to parse
        Returns:
        the version number or 0 for no result
      • isWinOS

        public static boolean isWinOS()
        Checks whether this program is currently running on a Windows machine.
        Returns:
        true if The current OS is a windows machine, false otherwise.
      • toFile

        public static java.io.File toFile​(java.net.URL localURL)
        Converts the given URL to an File. The URL must point to an element inside the local file system. This method should be used to resolve URL given be Eclipse for resolving locally installed resources. This method should be aware of the white space problem, which may occur if working with URIs.
        Parameters:
        localURL - An url pointing to a local resource, must not be null.
        Returns:
        An file object pointing to the same address, which is able to handle white spaces inside the path.