/** * Provides the current platform. * * @param platforms the platform factory * @return the current platform */ public Platform provide(Platforms platforms) { return platforms.getCurrentPlatform(); } }
/** * Returns the platform given the operating system name, architecture and version. * * @param name the operating system name or symbolic name * @param arch the operating system architecture, or symbolic architecture * @param version the operating system version. May be {@code null} * @param javaVersion the java version * @return the corresponding platform */ public Platform getPlatform(String name, String arch, String version, String javaVersion) { Platform result; Name pname = getName(name); Arch parch = getArch(arch); Platform match = findMatch(name, pname, parch, version); result = getPlatform(match, parch, version, javaVersion); return result; }
/** * Compares two strings for equality. * * @param a the first string to compare. May be {@code null} * @param b the second string to compare. May be {@code null} * @return <tt>true</tt> if the strings match */ private boolean equals(String a, String b) { return equals(a, b, false); }
/** * Returns the platform family name for the current operating system. * This may query the underlying OS to determine the platform name. * * @return the corresponding platform family name */ protected Name getCurrentOSName(String name) { Name result = getName(name); if (result == Name.LINUX) { result = getLinuxName(); } return result; }
/** * Returns the current platform given the operating system name, architecture and version. * <p/> * This may query the underlying OS to determine the platform name. * * @param name the operating system name * @param arch the operating system architecture, or symbolic architecture * @param version the operating system version. May be {@code null} * @param javaVersion the java version. May be {@code null} * @return the corresponding platform */ public Platform getCurrentPlatform(String name, String arch, String version, String javaVersion) { Platform result; Name pname = getCurrentOSName(name); Arch parch = getArch(arch); Platform match = findMatch(name, pname, parch, version); result = getPlatform(match, parch, version, javaVersion); return result; }
if (runOn != null) Platform platform = new Platforms().getCurrentPlatform(); boolean found = false; for (Platform.Name name : runOn.value())
String path = getReleasePath(); if (path != null) List<String> text = getText(path); if (text != null) if (search(text, OsVersionConstants.REDHAT) || search(text, OsVersionConstants.RED_HAT)) else if (search(text, OsVersionConstants.FEDORA)) else if (search(text, OsVersionConstants.MANDRAKE)) else if (search(text, OsVersionConstants.MANDRIVA)) else if (search(text, OsVersionConstants.SUSE, true)) List<String> text = getText(OsVersionConstants.PROC_VERSION); if (text != null) if (search(text, OsVersionConstants.DEBIAN)) else if (search(text, OsVersionConstants.UBUNTU)) if (result == Name.LINUX && exists("/etc/debian_version"))
Platforms [] mainPlats; void setup() { size(750, 400); mainPlats = new Platforms[3]; mainPlats[0] = new Platforms(200, 200, 100, 15); mainPlats[1] = new Platforms(420, 300, 100, 15); mainPlats[2] = new Platforms(570, 350, 100, 15); } void draw() { level(); } void level() { mainPlats[0].displayPlat(); mainPlats[0].platMove(); mainPlats[0].platTransition(); mainPlats[1].displayPlat(); mainPlats[1].platMove(); mainPlats[1].platTransition(); mainPlats[2].displayPlat(); mainPlats[2].platMove(); mainPlats[2].platTransition(); }
/** * Returns the platform given the operating system name, architecture and version. * * @param name the operating system name or symbolic name * @param arch the operating system architecture, or symbolic architecture * @param version the operating system version. May be {@code null} * @return the corresponding platform */ public Platform getPlatform(String name, String arch, String version) { return getPlatform(name, arch, version, null); }
Platforms platforms = new Platforms(); Platform platform = platforms.getCurrentPlatform(); TargetFactory factory = new TargetFactory(new DefaultTargetPlatformFactory(dummy, platform, platforms)); Librarian librarian = new Librarian(factory, new Housekeeper());
/** * Returns the platform for the specified operating system name and architecture. * * @param name the operating system name or symbolic name * @param arch the operating system architecture, or symbolic architecture * @return the corresponding platform */ public Platform getPlatform(String name, String arch) { return getPlatform(name, arch, null); }
/** * Returns the platform for the specified operating system name and architecture. * <p/> * This may query the underlying OS to determine the platform name. * * @param name the operating system name * @param arch the operating system architecture, or symbolic architecture * @return the corresponding platform */ public Platform getCurrentPlatform(String name, String arch) { return getCurrentPlatform(name, arch, null); }
Platform platform = platforms.getPlatform(name, arch); if (platform.getName() == Platform.Name.UNKNOWN)
for (Platform platform : PLATFORMS) if ((pname == Name.UNKNOWN && equals(name, platform.getSymbolicName(), true)) || (pname != Name.UNKNOWN && pname == platform.getName())) boolean archMatch = arch == platform.getArch(); boolean optArchMatch = platform.getArch() == Arch.UNKNOWN; boolean versionMatch = version != null && equals(version, platform.getVersion()); boolean optVersionMatch = platform.getVersion() == null; boolean symbolicMatch = equals(name, platform.getSymbolicName(), true); if (archMatch)
/** * Returns the current platform given the operating system name, architecture and version. * <p/> * This may query the underlying OS to determine the platform name. * * @param name the operating system name * @param arch the operating system architecture, or symbolic architecture * @param version the operating system version. May be {@code null} * @return the corresponding platform */ public Platform getCurrentPlatform(String name, String arch, String version) { return getCurrentPlatform(name, arch, version, null); }
/** * Returns the current platform. * <p/> * This may query the underlying OS to determine the platform name. * * @return the current platform */ public Platform getCurrentPlatform() { return getCurrentPlatform(System.getProperty(OsVersionConstants.OSNAME), System.getProperty(OsVersionConstants.OSARCH), System.getProperty(OsVersionConstants.OSVERSION), System.getProperty("java.version")); }