/*
- * todesbaum-lib -
- * Copyright (C) 2006 David Roden
+ * jSite - PriorityClass.java - Copyright © 2006–2012 David Roden
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* immediate mode large file downloads, not to disk), <code>updatable</code>
* (updatable site checks), <code>bulk</code> (large file downloads to disk),
* <code>prefetch</code>, <code>minimum</code>.
- *
+ *
* @author David Roden <droden@gmail.com>
* @version $Id$
*/
/**
* Creates a new priority class with the specified name and value.
- *
+ *
* @param name
* The name of the priority class
* @param value
/**
* Returns the name of this priority class.
- *
+ *
* @return The name of this priority class
*/
public String getName() {
/**
* Returns the value of this priority class.
- *
+ *
* @return The value of this priority class
*/
public int getValue() {
return value;
}
+ //
+ // STATIC METHODS
+ //
+
+ /**
+ * Returns the priority class with the given name, matched case-insensitive.
+ *
+ * @param value
+ * The name of the priority
+ * @return The priority with the given name, or {@code null} if no priority
+ * matches the given name
+ */
+ public static PriorityClass valueOf(String value) {
+ for (PriorityClass priorityClass : new PriorityClass[] { MINIMUM, PREFETCH, BULK, UPDATABLE, SEMI_INTERACTIVE, INTERACTIVE, MAXIMUM }) {
+ if (priorityClass.getName().equalsIgnoreCase(value)) {
+ return priorityClass;
+ }
+ }
+ return null;
+ }
+
}