FileDocCategorySizeDatePackage
Assertions.javaAPI DocExample3646Sun Dec 14 22:47:36 GMT 2003oreilly.hcj.review

Assertions

public class Assertions extends Object
Class for checking syntax and comments for the assert section of the review chapter.
author
Robert (Kraythe) Simmons jr.

Fields Summary
Constructors Summary
Methods Summary
protected static voidhelperParseArgs(java.lang.String[] args)
__UNDOCUMENTED__

param
args __UNDOCUMENTED__
throws
IllegalArgumentException __UNDOCUMENTED__

		assert (args != null);
		assert (!Arrays.asList(args)
		               .contains(null));
		// --
		List arglist = Arrays.asList(args);
		Iterator iter = arglist.iterator();
		for (String argument = null; iter.hasNext(); argument = (String)iter.next()) {
			if (argument.startsWith("-D")) {
				if (argument.length() < 3) {
					int idx = arglist.indexOf(argument);
					throw new IllegalArgumentException("Argument" + idx
					                                   + " is not a legal property argument.");
				}
				int valueIdx = argument.indexOf('=");
				System.setProperty(argument.substring(2, valueIdx),
				                   argument.substring(valueIdx + 1));
				assert (System.getProperty(argument.substring(2, valueIdx)).equals(argument
				                                                                   .substring(valueIdx
				                                                                              + 1)));
			}
		}
	
protected static voidhelperParseArgs2(java.lang.String[] args)
__UNDOCUMENTED__

param
args __UNDOCUMENTED__
throws
IllegalArgumentException __UNDOCUMENTED__

		assert (args != null);
		assert (!Arrays.asList(args)
		               .contains(null));
		// --
		List arglist = Arrays.asList(args);
		Iterator iter = arglist.iterator();
		for (String argument = null; iter.hasNext(); argument = (String)iter.next()) {
			if (argument.startsWith("-D")) {
				if (argument.length() < 3) {
					int idx = arglist.indexOf(argument);
					throw new IllegalArgumentException("Argument" + idx
					                                   + " is not a legal property argument.");
				}
				int valueIdx = argument.indexOf('=");
				String key = argument.substring(2, valueIdx);
				String value = argument.substring(valueIdx + 1);
				System.setProperty(key, value);
				assert (System.getProperty(key).equals(value));
			}
		}
	
public static voidmain(java.lang.String[] args)
Main method.

param
args Command line arguments.

		helperParseArgs(args);
		Iterator iter = System.getProperties()
			                  .keySet()
			                  .iterator();
		for (String key = null; iter.hasNext(); key = (String)iter.next()) {
			assert (key != null);
			System.out.println(key + "=" + System.getProperty(key));
		}
	
public voidmouseClicked(java.awt.event.MouseEvent event)
__UNDOCUMENTED__

param
event __UNDOCUMENTED__

		Object source = event.getSource();
		assert (source != null);

		// ... do code using source