[Mulgara-svn] r1394 - trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd

ronald at mulgara.org ronald at mulgara.org
Wed Dec 3 09:25:58 UTC 2008


Author: ronald
Date: 2008-12-03 01:25:57 -0800 (Wed, 03 Dec 2008)
New Revision: 1394

Modified:
   trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformation.java
   trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformationUnitTest.java
Log:
Code formatting fixes.


Modified: trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformation.java
===================================================================
--- trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformation.java	2008-12-03 00:42:41 UTC (rev 1393)
+++ trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformation.java	2008-12-03 09:25:57 UTC (rev 1394)
@@ -69,11 +69,9 @@
  *      Australian Commonwealth Government, Department of Defence</a>
  * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
  */
-class IntervalTransformation implements SymbolicTransformation
-{
+class IntervalTransformation implements SymbolicTransformation {
   /** Logger.  */
-  private static final Logger logger =
-    Logger.getLogger(IntervalTransformation.class.getName());
+  private static final Logger logger = Logger.getLogger(IntervalTransformation.class);
 
   /**
    * The node representing the &lt; relation between <tt>xsd:double</tt>s.
@@ -102,8 +100,7 @@
    * @param greaterThan  property representing &gt; for <tt>xsd:double</tt>s,
    *   never <code>null</code>
    */
-  IntervalTransformation(URI modelTypeURI, URIReferenceImpl lessThan, URIReferenceImpl greaterThan)
-  {
+  IntervalTransformation(URI modelTypeURI, URIReferenceImpl lessThan, URIReferenceImpl greaterThan) {
     assert lessThan    != null;
     assert greaterThan != null;
 
@@ -118,8 +115,7 @@
   //
 
   public void transform(SymbolicTransformationContext context, MutableLocalQuery mutableLocalQuery)
-    throws SymbolicTransformationException
-  {
+        throws SymbolicTransformationException {
     ConstraintExpression constraintExpression =
       transformExpression(context, mutableLocalQuery.getConstraintExpression());
 
@@ -143,8 +139,7 @@
    *   returned
    */
   ConstraintExpression transformExpression(SymbolicTransformationContext context, ConstraintExpression constraintExpression)
-    throws SymbolicTransformationException
-  {
+        throws SymbolicTransformationException {
     // Validate "constraintExpression" parameter
     if (constraintExpression == null) {
       throw new IllegalArgumentException("Null \"constraintExpression\" parameter"
@@ -157,18 +152,15 @@
 
     if (constraintExpression instanceof ConstraintConjunction) {
       return transformConjunction(context, (ConstraintConjunction) constraintExpression);
-    }
-    else if (constraintExpression instanceof ConstraintImpl) {
+    } else if (constraintExpression instanceof ConstraintImpl) {
       return transformConstraint(context, (ConstraintImpl) constraintExpression);
-    }
-    else {
+    } else {
       return null;  // don't modify constraints we don't understand
     }
   }
 
   private ConstraintExpression transformConjunction(SymbolicTransformationContext context, ConstraintConjunction constraintConjunction)
-    throws SymbolicTransformationException
-  {
+        throws SymbolicTransformationException {
     if (logger.isDebugEnabled()) {
       logger.debug("Transforming conjunction " + constraintConjunction);
     }
@@ -239,9 +231,9 @@
       // Convert the list of conjoined terms into a ConstraintExpression
       ConstraintExpression result;
       switch (newElements.size()) {
-      case 0:  result = ConstraintFalse.INSTANCE;  break;
-      case 1:  result = (ConstraintExpression) newElements.get(0);  break;
-      default: result = new ConstraintConjunction(newElements);
+        case 0:  result = ConstraintFalse.INSTANCE;  break;
+        case 1:  result = (ConstraintExpression) newElements.get(0);  break;
+        default: result = new ConstraintConjunction(newElements);
       }
       assert result != null;
 
@@ -254,8 +246,7 @@
   }
 
   private ConstraintExpression transformConstraint(SymbolicTransformationContext context, ConstraintImpl constraintImpl)
-    throws SymbolicTransformationException
-  {
+        throws SymbolicTransformationException {
     assert constraintImpl != null;
 
     Variable variable;
@@ -289,11 +280,9 @@
     // Figure out the direction of bounding, assuming [$var op value] order
     if (constraintImpl.getElement(1).equals(lessThan)) {
       boundedBelow = false;
-    }
-    else if (constraintImpl.getElement(1).equals(greaterThan)) {
+    } else if (constraintImpl.getElement(1).equals(greaterThan)) {
       boundedBelow = true;
-    }
-    else {
+    } else {
       logger.debug("Predicate not recognised by IntervalTransformation");
       return null;
     }
@@ -303,8 +292,7 @@
       if (constraintImpl.getElement(2) instanceof Variable) {
         logger.debug("Both Subject and Object are Variables, returning null");
         return null;
-      }
-      else {
+      } else {
         variable = (Variable) constraintImpl.getElement(0);
         double value = Double.parseDouble(
           ((Literal) constraintImpl.getElement(2)).getLexicalForm()

Modified: trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformationUnitTest.java
===================================================================
--- trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformationUnitTest.java	2008-12-03 00:42:41 UTC (rev 1393)
+++ trunk/src/jar/resolver-xsd/java/org/mulgara/resolver/xsd/IntervalTransformationUnitTest.java	2008-12-03 09:25:57 UTC (rev 1394)
@@ -70,11 +70,9 @@
  *
  * @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
  */
-public class IntervalTransformationUnitTest extends TestCase
-{
+public class IntervalTransformationUnitTest extends TestCase {
   /** Logger */
-  private static Logger logger =
-    Logger.getLogger(IntervalTransformationUnitTest.class.getName());
+  private static Logger logger = Logger.getLogger(IntervalTransformationUnitTest.class);
 
   private URIReferenceImpl greaterThan;
 
@@ -115,8 +113,7 @@
    *
    * @param name the name of the test
    */
-  public IntervalTransformationUnitTest(String name)
-  {
+  public IntervalTransformationUnitTest(String name) {
     super(name);
   }
 
@@ -125,8 +122,7 @@
    *
    * @return the test suite
    */
-  public static Test suite()
-  {
+  public static Test suite() {
     TestSuite suite = new TestSuite();
 
     suite.addTest(new IntervalTransformationUnitTest("test1Transform"));
@@ -143,8 +139,7 @@
   /**
    * Create test instance.
    */
-  public void setUp() throws Exception
-  {
+  public void setUp() throws Exception {
     greaterThan     = new URIReferenceImpl(new URI(Mulgara.NAMESPACE + "lt"));
     lessThan        = new URIReferenceImpl(new URI(Mulgara.NAMESPACE + "gt"));
 
@@ -174,8 +169,7 @@
    *
    * @param args the command line arguments
    */
-  public static void main(String[] args)
-  {
+  public static void main(String[] args) {
     junit.textui.TestRunner.run(suite());
   }
 
@@ -186,8 +180,7 @@
   /**
    * Test #1 for the {@link IntervalTransformation#transform} method.
    */
-  public void test1Transform() throws Exception
-  {
+  public void test1Transform() throws Exception {
     try {
       intervalTransformation.transformExpression(context, (ConstraintExpression) null);
       fail("Expected an IllegalArgumentException");
@@ -200,8 +193,7 @@
   /**
    * Test #2 for the {@link IntervalTransformation#transform} method.
    */
-  public void test2Transform() throws Exception
-  {
+  public void test2Transform() throws Exception {
     assertNull(intervalTransformation.transformExpression(context, ConstraintTrue.INSTANCE));
   }
 
@@ -210,8 +202,7 @@
    *
    * This transforms a single {@link ConstraintImpl}.
    */
-  public void test3Transform() throws Exception
-  {
+  public void test3Transform() throws Exception {
     Variable x = new Variable("x");
 
     assertEquals(
@@ -231,8 +222,7 @@
    *
    * This transforms a single {@link ConstraintConjunction}.
    */
-  public void test4Transform() throws Exception
-  {
+  public void test4Transform() throws Exception {
     Variable x = new Variable("x");
 
     assertEquals(new IntervalConstraint(
@@ -255,8 +245,7 @@
    * This transforms a {@link ConstraintConjunction} containing
    * {@link IntervalConstraint}s over different variables.
    */
-  public void test5Transform() throws Exception
-  {
+  public void test5Transform() throws Exception {
     Variable x = new Variable("x");
     Variable y = new Variable("y");
 
@@ -296,8 +285,7 @@
    * This checks that xsd models will be transformed in the presence of
    * non-xsd models which will be preserved.
    */
-  public void test7PreserveNonXSD() throws Exception
-  {
+  public void test7PreserveNonXSD() throws Exception {
     Variable x = new Variable("x");
 
     assertEquals(




More information about the Mulgara-svn mailing list