You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2007/05/05 02:34:08 UTC

svn commit: r535426 - /jakarta/jmeter/branches/rel-2-2/src/jorphan/org/apache/commons/cli/avalon/CLOptionDescriptor.java

Author: sebb
Date: Fri May  4 17:34:07 2007
New Revision: 535426

URL: http://svn.apache.org/viewvc?view=rev&rev=535426
Log:
Remove deprecated methods; remove duplicate output in toString()

Modified:
    jakarta/jmeter/branches/rel-2-2/src/jorphan/org/apache/commons/cli/avalon/CLOptionDescriptor.java

Modified: jakarta/jmeter/branches/rel-2-2/src/jorphan/org/apache/commons/cli/avalon/CLOptionDescriptor.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/jorphan/org/apache/commons/cli/avalon/CLOptionDescriptor.java?view=diff&rev=535426&r1=535425&r2=535426
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/src/jorphan/org/apache/commons/cli/avalon/CLOptionDescriptor.java (original)
+++ jakarta/jmeter/branches/rel-2-2/src/jorphan/org/apache/commons/cli/avalon/CLOptionDescriptor.java Fri May  4 17:34:07 2007
@@ -25,7 +25,6 @@
  * array of <code>CLOptionDescriptor</code>s, and passes it to
  * {@link CLArgsParser#CLArgsParser(String[], CLOptionDescriptor[])}.
  * 
- * @version $Revision$ $Date$
  * @see CLArgsParser
  * @see CLUtil
  */
@@ -68,10 +67,17 @@
 	 *            description of option usage
 	 */
 	public CLOptionDescriptor(final String name, final int flags, final int id, final String description) {
-		this(name, flags, id, description, ((flags & CLOptionDescriptor.DUPLICATES_ALLOWED) > 0) ? new int[0]
-				: new int[] { id });
+
+		checkFlags(flags);
+
+		m_id = id;
+		m_name = name;
+		m_flags = flags;
+		m_description = description;
+		m_incompatible = ((flags & DUPLICATES_ALLOWED) > 0) ? new int[0] : new int[] { id };
 	}
 
+
 	/**
 	 * Constructor.
 	 * 
@@ -84,17 +90,25 @@
 	 * @param description
 	 *            description of option usage
 	 * @param incompatible
-	 *            an array listing the ids of all incompatible options
-	 * @deprecated use the version with the array of CLOptionDescriptor's
+	 *            descriptors for incompatible options
 	 */
 	public CLOptionDescriptor(final String name, final int flags, final int id, final String description,
-			final int[] incompatible) {
+			final CLOptionDescriptor[] incompatible) {
+
+		checkFlags(flags);
+		
 		m_id = id;
 		m_name = name;
 		m_flags = flags;
 		m_description = description;
-		m_incompatible = incompatible;
 
+		m_incompatible = new int[incompatible.length];
+		for (int i = 0; i < incompatible.length; i++) {
+			m_incompatible[i] = incompatible[i].getId();
+		}
+	}
+
+	private void checkFlags(final int flags) {
 		int modeCount = 0;
 		if ((ARGUMENT_REQUIRED & flags) == ARGUMENT_REQUIRED) {
 			modeCount++;
@@ -119,39 +133,6 @@
 	}
 
 	/**
-	 * Constructor.
-	 * 
-	 * @param name
-	 *            the name/long option
-	 * @param flags
-	 *            the flags
-	 * @param id
-	 *            the id/character option
-	 * @param description
-	 *            description of option usage
-	 */
-	public CLOptionDescriptor(final String name, final int flags, final int id, final String description,
-			final CLOptionDescriptor[] incompatible) {
-		m_id = id;
-		m_name = name;
-		m_flags = flags;
-		m_description = description;
-
-		m_incompatible = new int[incompatible.length];
-		for (int i = 0; i < incompatible.length; i++) {
-			m_incompatible[i] = incompatible[i].getId();
-		}
-	}
-
-	/**
-	 * @deprecated Use the correctly spelled {@link #getIncompatible} instead.
-	 * @return the array of incompatible option ids
-	 */
-	protected final int[] getIncompatble() {
-		return getIncompatible();
-	}
-
-	/**
 	 * Get the array of incompatible option ids.
 	 * 
 	 * @return the array of incompatible option ids
@@ -205,8 +186,6 @@
 	 */
 	public final String toString() {
 		final StringBuffer sb = new StringBuffer();
-		sb.append("[OptionDescriptor ");
-		sb.append(m_name);
 		sb.append("[OptionDescriptor ");
 		sb.append(m_name);
 		sb.append(", ");



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org