krysalis-version/src/main/org/krysalis/version/analysis Analyzer.java,1.1,1.2

[email protected]
Newsgroups gmane.comp.krysalis.cvs
Message-ID <[email protected]>
Update of /cvsroot/krysalis/krysalis-version/src/main/org/krysalis/version/analysis
In directory sc8-pr-cvs1:/tmp/cvs-serv20761/src/main/org/krysalis/version/analysis

Modified Files:
	Analyzer.java 
Log Message:
1) Renamed filename to (more descriptive) output
2) Work on Analyzer (detecting environment differences).

Index: Analyzer.java
===================================================================
RCS file: /cvsroot/krysalis/krysalis-version/src/main/org/krysalis/version/analysis/Analyzer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Analyzer.java	2 Nov 2003 22:11:12 -0000	1.1
--- Analyzer.java	3 Nov 2003 22:29:48 -0000	1.2
***************
*** 20,60 ****
  		VersionEnvironment current,
  		VersionEnvironment base) {
! 		AnnotationScratchpad analysis = new AnnotationScratchpad("Environment Analysis");
  		if ((null == current) && (null == base))
  			return analysis;
  
  		if (null == current) {
! 			analysis.warning("No version to compare against base: " + base);
  		}
  		else if (null == base) {
  			analysis.warning(
! 				"No version to compare against current: " + current);
  		}
  		else {
! 			analyzeJVM(analysis, current, base);
! 			analyzeVersionRegistry(
! 				analysis,
! 				current.getVersions(),
! 				base.getVersions());
  		}
  		return analysis;
  	}
  
! 	public static void analyzeJVM(
  		AnnotationScratchpad analysis,
  		VersionEnvironment current,
  		VersionEnvironment base) {
! 		analyzeMarkers(analysis, current.getJvmVersion(), base.getJvmVersion());
! 		analyzeMarkers(
! 			analysis,
! 			current.getJvmSpecificationVersion(),
! 			base.getJvmSpecificationVersion());
  	}
  
! 	public static void analyzeVersionRegistry(
  		AnnotationScratchpad analysis,
  		VersionRegistry current,
  		VersionRegistry base) {
  
  		for (Iterator i = base.iterator(); i.hasNext();) {
  			VersionInformation baseInfo = (VersionInformation) i.next();
--- 20,87 ----
  		VersionEnvironment current,
  		VersionEnvironment base) {
! 		AnnotationScratchpad analysis =
! 			new AnnotationScratchpad("Environment Analysis");
  		if ((null == current) && (null == base))
  			return analysis;
  
+ 		boolean differences = false;
+ 
  		if (null == current) {
! 			analysis.warning(
! 				"No current environment to compare against base: " + base);
! 			differences = true;
  		}
  		else if (null == base) {
  			analysis.warning(
! 				"No base environment to compare against current: " + current);
! 			differences = true;
  		}
  		else {
! 
! 			differences |= analyzeJVM(analysis, current, base);
! 
! 			differences
! 				|= analyzeVersionRegistry(
! 					analysis,
! 					current.getVersions(),
! 					base.getVersions());
  		}
+ 
+ 		if (differences)
+ 			analysis.verbose("Differences between two environments");
+ 
  		return analysis;
  	}
  
! 	public static boolean analyzeJVM(
  		AnnotationScratchpad analysis,
  		VersionEnvironment current,
  		VersionEnvironment base) {
! 
! 		boolean differences =
! 			analyzeMarkers(
! 				analysis,
! 				current.getJvmVersion(),
! 				base.getJvmVersion());
! 		differences
! 			|= analyzeMarkers(
! 				analysis,
! 				current.getJvmSpecificationVersion(),
! 				base.getJvmSpecificationVersion());
! 
! 		if (differences)
! 			analysis.verbose(
! 				"Version differences between two JDK environments");
! 
! 		return differences;
  	}
  
! 	public static boolean analyzeVersionRegistry(
  		AnnotationScratchpad analysis,
  		VersionRegistry current,
  		VersionRegistry base) {
  
+ 		boolean differences = false;
+ 
  		for (Iterator i = base.iterator(); i.hasNext();) {
  			VersionInformation baseInfo = (VersionInformation) i.next();
***************
*** 62,129 ****
  				current.getInformation(baseInfo.getIdentifier());
  
! 			analyzeInfos(analysis, currentInfo, baseInfo);
  		}
  	}
  
! 	public static void analyzeInfos(
  		AnnotationScratchpad analysis,
  		VersionInformation current,
  		VersionInformation base) {
  
  		if ((null == current) && (null == base))
! 			return;
  
  		if (null == current) {
  			analysis.warning("No info to compare against base: " + base);
  		}
  		else if (null == base) {
  			analysis.warning("No info to compare against current: " + current);
  		}
  		else if (!current.equals(base)) {
! 			analysis.info(
! 				"Difference " + current + " : " + base);
! 
! 			analyzeMarkers(
! 				analysis,
! 				current.getVersionMarker(),
! 				base.getVersionMarker());
  		}
  		else
! 			analysis.verbose(
! 				"Match : " + base);
  	}
  
! 	public static void analyzeMarkers(
  		AnnotationScratchpad analysis,
  		VersionMarker current,
  		VersionMarker base) {
  
  		if ((null == current) && (null == base))
! 			return;
  
  		if (null == current) {
  			analysis.warning("No marker to compare against base: " + base);
  		}
  		else if (null == base) {
  			analysis.warning(
  				"No marker to compare against current: " + current);
  		}
  		else if (!current.equals(base)) {
! 			analysis.info("Difference " + current + " : " + base);
! 
! 			analyzeVersions(analysis, current.getVersion(), base.getVersion());
  		}
  		else
! 			analysis.verbose(
! 				"Match : " + base);
  	}
  
! 	public static void analyzeVersions(
  		AnnotationScratchpad analysis,
  		Version current,
  		Version base) {
  
  		if ((null == current) && (null == base))
! 			return;
  
  		if (null == current) {
--- 89,172 ----
  				current.getInformation(baseInfo.getIdentifier());
  
! 			differences |= analyzeInfos(analysis, currentInfo, baseInfo);
  		}
+ 
+ 		if (differences)
+ 			analysis.info("Version differences between two environments");
+ 
+ 		return differences;
  	}
  
! 	public static boolean analyzeInfos(
  		AnnotationScratchpad analysis,
  		VersionInformation current,
  		VersionInformation base) {
  
+ 		boolean differences = false;
+ 
  		if ((null == current) && (null == base))
! 			return false;
  
  		if (null == current) {
  			analysis.warning("No info to compare against base: " + base);
+ 			differences = true;
  		}
  		else if (null == base) {
  			analysis.warning("No info to compare against current: " + current);
+ 			differences = true;
  		}
  		else if (!current.equals(base)) {
! 			differences
! 				|= analyzeMarkers(
! 					analysis,
! 					current.getVersionMarker(),
! 					base.getVersionMarker());
  		}
  		else
! 			analysis.verbose("Match : " + base);
! 
! 		return differences;
  	}
  
! 	public static boolean analyzeMarkers(
  		AnnotationScratchpad analysis,
  		VersionMarker current,
  		VersionMarker base) {
  
+ 		boolean differences = false;
+ 
  		if ((null == current) && (null == base))
! 			return false;
  
  		if (null == current) {
  			analysis.warning("No marker to compare against base: " + base);
+ 			differences = true;
  		}
  		else if (null == base) {
  			analysis.warning(
  				"No marker to compare against current: " + current);
+ 			differences = true;
  		}
  		else if (!current.equals(base)) {
! 			differences
! 				|= analyzeVersions(
! 					analysis,
! 					current.getVersion(),
! 					base.getVersion());
  		}
  		else
! 			analysis.verbose("Match : " + base);
! 
! 		return differences;
  	}
  
! 	public static boolean analyzeVersions(
  		AnnotationScratchpad analysis,
  		Version current,
  		Version base) {
+ 		boolean differences = false;
  
  		if ((null == current) && (null == base))
! 			return false;
  
  		if (null == current) {
***************
*** 135,140 ****
  		}
  		else if (!current.equals(base)) {
- 			analysis.info("Difference " + current + " : " + base);
- 
  			if (!current.isCompatible(base))
  				analysis.error(
--- 178,181 ----
***************
*** 142,147 ****
  		}
  		else
! 			analysis.verbose(
! 				"Match : " + base);
  	}
  }
--- 183,189 ----
  		}
  		else
! 			analysis.verbose("Match : " + base);
! 
! 		return differences;
  	}
  }




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.