org.jwalk.out
Class AlgebraReport

java.lang.Object
  extended by org.jwalk.out.Report
      extended by org.jwalk.out.ProtocolReport
          extended by org.jwalk.out.AlgebraReport

public class AlgebraReport
extends ProtocolReport

AlgebraReport is a report on the test class's algebraic structure. An AlgebraReport is responsible for formatting the data generated by an AlgebraWalker, which estimated the algebraic category of each of the test class's constructors and methods. It also provides direct access to the test class and its constructors and methods; and allows clients to request the algebraic Category of each constructor and method.

Version:
1.0
Author:
Anthony Simons

Field Summary
 
Fields inherited from class org.jwalk.out.Report
edition, walker
 
Constructor Summary
AlgebraReport(AlgebraWalker walker)
          Creates an AlgebraReport.
 
Method Summary
protected  java.lang.String banner()
          Creates a text banner to use at the start of the report.
 java.lang.String getContent()
          Returns the content this AlgebraReport as formatted text.
 AlgebraWalker getJWalker()
          Return the AlgebraWalker which was the source of this report.
 boolean isObserver(java.lang.reflect.Member member)
          Reports if a member is an OBSERVER, in the algebraic sense.
 boolean isPrimitive(java.lang.Enum<?> value)
          Reports if an enumerated constant is primitive.
 boolean isPrimitive(java.lang.reflect.Member member)
          Reports if a member is a CONSTRUCTOR, in the algebraic sense.
 boolean isTransformer(java.lang.reflect.Member member)
          Reports if a member is a TRANSFORMER, in the algebraic sense.
 
Methods inherited from class org.jwalk.out.ProtocolReport
getConstants, getConstructors, getMethods, getTestClass, isAbstract, toString, toString, toString
 
Methods inherited from class org.jwalk.out.Report
getEdition, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AlgebraReport

public AlgebraReport(AlgebraWalker walker)
Creates an AlgebraReport. Extracts all the report data from a walker which must be (at least) an AlgebraWalker which explored the algebraic structure of the test class.

Parameters:
walker - the AlgebraWalker used to explore the test class.
Method Detail

getJWalker

public AlgebraWalker getJWalker()
Return the AlgebraWalker which was the source of this report. This method narrows the return type from JWalker to AlgebraWalker.

Overrides:
getJWalker in class ProtocolReport
Returns:
the AlgebraWalker which dispatched this report.

isPrimitive

public boolean isPrimitive(java.lang.Enum<?> value)
Reports if an enumerated constant is primitive.

Parameters:
value - the enumerated constant.
Returns:
true.

isPrimitive

public boolean isPrimitive(java.lang.reflect.Member member)
Reports if a member is a CONSTRUCTOR, in the algebraic sense. Reports if a Field, Constructor or Method is a primitive construction. A Field is assumed to be an enumerated constant, so is primitive. A Constructor is primitive if it cannot be derived. A Method is primitive if it drives the object into new, previously unreached states.

Parameters:
member - a Field, Constructor or Method.
Returns:
true if the Member is a primitive construction.

isTransformer

public boolean isTransformer(java.lang.reflect.Member member)
Reports if a member is a TRANSFORMER, in the algebraic sense. Reports if a Field, Constructor or Method is a derived transformer. A Field is always primitive, not a transformer. A Constructor is a transformer, if it can be derived from more fundamental Constructors. A Method is a transformer if it drives the object into previously visited states.

Parameters:
member - a Field, Constructor or Method.
Returns:
true if the Member is a transformer operation.

isObserver

public boolean isObserver(java.lang.reflect.Member member)
Reports if a member is an OBSERVER, in the algebraic sense. Reports if a Field, Constructor or Method is an observer operation. Neither a Field (assumed to be a constant), nor a Constructor can qualify as an observer, since these return new objects. A Method is an observer if it inspects the object and leaves its state unchanged.

Parameters:
member - a Field, Constructor or Method.
Returns:
true if the Member is an observer operation.

banner

protected java.lang.String banner()
Creates a text banner to use at the start of the report. This is sensitive to whether the test class was a public class, an abstract class, or an interface.

Overrides:
banner in class ProtocolReport

getContent

public java.lang.String getContent()
Returns the content this AlgebraReport as formatted text. The returned text has a banner announcing the algebraic analysis, followed by three subsections respectively listing the primitive, transformer and observer operations of the test class. This analysis is only a best approximation. This method implements toString() for AlgebraReport.

Overrides:
getContent in class ProtocolReport
Returns:
a formatted textual report.