Author: mukulg
Date: Thu Mar 24 07:27:30 2011
New Revision: 1084864

URL: http://svn.apache.org/viewvc?rev=1084864&view=rev
Log:
doing slight renaming of methods and improving javadocs.

Modified:
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2Value.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java?rev=1084864&r1=1084863&r2=1084864&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java
 Thu Mar 24 07:27:30 2011
@@ -303,10 +303,10 @@ public class XMLAssertPsychopathXPath2Im
         if (simpleTypeDefn.getVariety() == 
XSSimpleTypeDefinition.VARIETY_ATOMIC) {
             // evaluating assertions for "simpleType -> restriction" (not 
derived by union)
             if (isAttribute) {
-                setXDMTypedValueFor$value(fCurrentAssertDomNode, value, null, 
simpleTypeDefn, false, fXpath2DynamicContext);
+                setXDMTypedValueOf$value(fCurrentAssertDomNode, value, null, 
simpleTypeDefn, false, fXpath2DynamicContext);
             }
             else {
-                setXDMTypedValueFor$value(fCurrentAssertDomNode, value, null, 
null, false, fXpath2DynamicContext);
+                setXDMTypedValueOf$value(fCurrentAssertDomNode, value, null, 
null, false, fXpath2DynamicContext);
             }
             AssertionError assertError = evaluateOneAssertion(element, 
assertImpl, value, false, false);
             if (assertError != null) {
@@ -345,7 +345,7 @@ public class XMLAssertPsychopathXPath2Im
                 StringTokenizer listStrTokens = new StringTokenizer(value, " 
\n\t\r");
                 while (listStrTokens.hasMoreTokens()) {
                     String listItemStrValue = listStrTokens.nextToken();
-                    setValueOf$valueForSTVarietyList(fCurrentAssertDomNode, 
listItemStrValue, listItemType, false, fXpath2DynamicContext);                  
      
+                    
setXDMTypedValueOf$valueForSTVarietyList(fCurrentAssertDomNode, 
listItemStrValue, listItemType, false, fXpath2DynamicContext);                  
      
                     AssertionError assertError = evaluateOneAssertion(element, 
itemTypeAssert, listItemStrValue, false, true);                        
                     if (assertError != null) {
                         assertError.setIsTypeDerivedFromList(false);
@@ -367,7 +367,7 @@ public class XMLAssertPsychopathXPath2Im
         AssertionError assertError = null;
         
         if (isTypeDerivedFromList) {
-            setValueOf$valueForSTVarietyList(fCurrentAssertDomNode, 
listStrValue, itemType, isTypeDerivedFromList, fXpath2DynamicContext);
+            setXDMTypedValueOf$valueForSTVarietyList(fCurrentAssertDomNode, 
listStrValue, itemType, isTypeDerivedFromList, fXpath2DynamicContext);
             assertError = evaluateOneAssertion(element, assertImpl, 
listStrValue, xpathContextExists, true);
             if (assertError != null) {
                 assertError.setIsTypeDerivedFromList(isTypeDerivedFromList);
@@ -380,7 +380,7 @@ public class XMLAssertPsychopathXPath2Im
             StringTokenizer listStrTokens = new StringTokenizer(listStrValue, 
" \n\t\r");
             while (listStrTokens.hasMoreTokens()) {
                 String listItemStrValue = listStrTokens.nextToken();
-                setValueOf$valueForSTVarietyList(fCurrentAssertDomNode, 
listItemStrValue, itemType, isTypeDerivedFromList, fXpath2DynamicContext);      
                  
+                
setXDMTypedValueOf$valueForSTVarietyList(fCurrentAssertDomNode, 
listItemStrValue, itemType, isTypeDerivedFromList, fXpath2DynamicContext);      
                  
                 assertError = evaluateOneAssertion(element, assertImpl, 
listItemStrValue, xpathContextExists, true);
                 if (assertError != null) {
                     reportAssertionsError(assertError);    
@@ -414,7 +414,7 @@ public class XMLAssertPsychopathXPath2Im
             } 
          }
          else if (isTypeDerivedFromUnion) {
-             setValueOf$valueForSTVarietyUnion(value, memberTypes, 
fXpath2DynamicContext);
+             setXDMTypedValueOf$valueForSTVarietyUnion(value, memberTypes, 
fXpath2DynamicContext);
              AssertionError assertError = evaluateOneAssertion(element, 
assertImpl, value, false, false);
              if (assertError != null) {
                  isValueValid = false;
@@ -434,7 +434,7 @@ public class XMLAssertPsychopathXPath2Im
         
         if (value != null) {
             // complex type with simple content
-            setXDMTypedValueFor$value(fCurrentAssertDomNode, value, null, 
null, false, fXpath2DynamicContext);
+            setXDMTypedValueOf$value(fCurrentAssertDomNode, value, null, null, 
false, fXpath2DynamicContext);
         } else {
             // complex type with complex content. set xpath context variable 
$value to an empty sequence.
             fXpath2DynamicContext.set_variable(new 
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"), 
XSTypeHelper.getXPath2ResultSequence(new ArrayList()));
@@ -554,7 +554,7 @@ public class XMLAssertPsychopathXPath2Im
                         for (Iterator iter = assertFacets.iterator(); 
iter.hasNext(); ) {
                             XSAssertImpl assertImpl = (XSAssertImpl) 
iter.next();
                             try {
-                               
setXDMTypedValueFor$value(fCurrentAssertDomNode, value, memType, null, false, 
fXpath2DynamicContext);
+                               setXDMTypedValueOf$value(fCurrentAssertDomNode, 
value, memType, null, false, fXpath2DynamicContext);
                                AssertionError assertError = 
evaluateOneAssertion(element, assertImpl, value, false, false);
                                if (assertError == null) {
                                    assertsSucceeded++;  

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2Value.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2Value.java?rev=1084864&r1=1084863&r2=1084864&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2Value.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2Value.java
 Thu Mar 24 07:27:30 2011
@@ -43,21 +43,21 @@ public interface XSAssertionXPath2Value 
      * Given a string value, this method sets an XPath 2.0 typed value for 
variable "$value" in XPath dynamic context. This method may
      * delegate to other methods of this interface for doing its 
responsibilities.
      */
-    public void setXDMTypedValueFor$value(Element currentAssertDomRootElem, 
String value, XSSimpleTypeDefinition listOrUnionType, XSTypeDefinition 
attrType, boolean isTypeDerivedFromList, DynamicContext xpath2DynamicContext) 
throws Exception;
+    public void setXDMTypedValueOf$value(Element currentAssertDomRootElem, 
String value, XSSimpleTypeDefinition listOrUnionType, XSTypeDefinition 
attrType, boolean isTypeDerivedFromList, DynamicContext xpath2DynamicContext) 
throws Exception;
     
     /*
      * Given a string value, this method sets an XPath 2.0 typed value for 
variable "$value" in XPath dynamic context, when the value is for simpleType 
variety atomic. 
      */
-    public void setValueOf$valueForSTVarietyAtomic(String value, short 
xsdTypecode, DynamicContext xpath2DynamicContext);
+    public void setXDMTypedValueOf$valueForSTVarietyAtomic(String value, short 
xsdTypecode, DynamicContext xpath2DynamicContext);
     
     /*
      * Given a string value, this method sets an XPath 2.0 typed value for 
variable "$value" in XPath dynamic context, when the value is for simpleType 
variety list. 
      */
-    public void setValueOf$valueForSTVarietyList(Element 
currentAssertDomRootElem, String listStrValue, XSSimpleTypeDefinition itemType, 
boolean isTypeDerivedFromList, DynamicContext xpath2DynamicContext) throws 
Exception;
+    public void setXDMTypedValueOf$valueForSTVarietyList(Element 
currentAssertDomRootElem, String listStrValue, XSSimpleTypeDefinition itemType, 
boolean isTypeDerivedFromList, DynamicContext xpath2DynamicContext) throws 
Exception;
     
     /*
      * Given a string value, this method sets an XPath 2.0 typed value for 
variable "$value" in XPath dynamic context, when the value is for simpleType 
variety union. 
      */
-    public void setValueOf$valueForSTVarietyUnion(String value, XSObjectList 
memberTypes, DynamicContext xpath2DynamicContext);
+    public void setXDMTypedValueOf$valueForSTVarietyUnion(String value, 
XSObjectList memberTypes, DynamicContext xpath2DynamicContext);
 
 }

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java?rev=1084864&r1=1084863&r2=1084864&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java
 Thu Mar 24 07:27:30 2011
@@ -105,9 +105,10 @@ public class XSAssertionXPath2ValueImpl 
     
 
     /*
-     * Given a string value, this method sets an XPath 2.0 typed value for 
variable "$value" in XPath dynamic context.
+     * Given a string value, this method sets an XPath 2.0 typed value for 
variable "$value" in XPath dynamic context. This method delegates
+     * to other methods of interface XSAssertionXPath2Value to carry some of 
it's tasks.
      */
-    public void setXDMTypedValueFor$value(Element currentAssertDomRootElem, 
String value, XSSimpleTypeDefinition listOrUnionType, XSTypeDefinition 
attrType, boolean isTypeDerivedFromList, DynamicContext xpath2DynamicContext) 
throws Exception {
+    public void setXDMTypedValueOf$value(Element currentAssertDomRootElem, 
String value, XSSimpleTypeDefinition listOrUnionType, XSTypeDefinition 
attrType, boolean isTypeDerivedFromList, DynamicContext xpath2DynamicContext) 
throws Exception {
         
         // dummy schema short code initializer
         short xsdTypecode = -100;
@@ -126,21 +127,21 @@ public class XSAssertionXPath2ValueImpl 
             }
             else {
                xsdTypecode = getXercesXSDTypeCodeFor$value(listOrUnionType);
-               setValueOf$valueForSTVarietyAtomic(value, xsdTypecode, 
xpath2DynamicContext);
+               setXDMTypedValueOf$valueForSTVarietyAtomic(value, xsdTypecode, 
xpath2DynamicContext);
             }
         }
         else {
            if (attrType != null) {
               // is value of an attribute
               xsdTypecode = getXercesXSDTypeCodeFor$value(attrType);
-              setValueOf$valueForSTVarietyAtomic(value, xsdTypecode, 
xpath2DynamicContext);
+              setXDMTypedValueOf$valueForSTVarietyAtomic(value, xsdTypecode, 
xpath2DynamicContext);
            }
            else {
               // is "simple type" value of an element
               PSVIElementNSImpl currentAssertPSVINode = (PSVIElementNSImpl) 
currentAssertDomRootElem;
               XSTypeDefinition typeDef = 
currentAssertPSVINode.getTypeDefinition();
               if (typeDef instanceof XSComplexTypeDefinition && 
((XSComplexTypeDefinition) typeDef).getSimpleType() != null) {
-                  setValueOf$valueForCTWithSimpleContent(value, 
(XSComplexTypeDefinition) typeDef, xpath2DynamicContext);
+                  setXDMValueOf$valueForCTWithSimpleContent(value, 
(XSComplexTypeDefinition) typeDef, xpath2DynamicContext);
               }
               else if (typeDef instanceof XSComplexTypeDefinition && 
((XSComplexTypeDefinition) typeDef).getSimpleType() == null) {
                   // set xpath context variable $value to an empty sequence
@@ -148,45 +149,62 @@ public class XSAssertionXPath2ValueImpl 
               }
               else {
                   xsdTypecode = getXercesXSDTypeCodeFor$value(typeDef);
-                  setValueOf$valueForSTVarietyAtomic(value, xsdTypecode, 
xpath2DynamicContext);
+                  setXDMTypedValueOf$valueForSTVarietyAtomic(value, 
xsdTypecode, xpath2DynamicContext);
               }
            }
         }
         
-    } // setXDMTypedValueFor$value
+    } // setXDMTypedValueOf$value
     
     
     /*
      * Given a string value, this method sets an XPath 2.0 typed value for 
variable "$value" in XPath dynamic context, when the value is for simpleType 
variety atomic. 
      */
-    public void setValueOf$valueForSTVarietyAtomic(String value, short 
xsdTypecode, DynamicContext xpath2DynamicContext) {
+    public void setXDMTypedValueOf$valueForSTVarietyAtomic(String value, short 
xsdTypecode, DynamicContext xpath2DynamicContext) {
         AnyType psychoPathType = 
SchemaTypeValueFactory.newSchemaTypeValue(xsdTypecode, value);
         xpath2DynamicContext.set_variable(new 
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"), 
(AnyAtomicType) psychoPathType);
-    } // setValueOf$valueForSTVarietyAtomic
+    } // setXDMTypedValueOf$valueForSTVarietyAtomic
     
     
     /*
      * Given a string value, this method sets an XPath 2.0 typed value for 
variable "$value" in XPath dynamic context, when the value is for simpleType 
variety list. 
      */
-    public void setValueOf$valueForSTVarietyList(Element 
currentAssertDomRootElem, String listStrValue, XSSimpleTypeDefinition itemType, 
boolean isTypeDerivedFromList, DynamicContext xpath2DynamicContext) throws 
Exception {
+    public void setXDMTypedValueOf$valueForSTVarietyList(Element 
currentAssertDomRootElem, String listStrValue, XSSimpleTypeDefinition itemType, 
boolean isTypeDerivedFromList, DynamicContext xpath2DynamicContext) throws 
Exception {
         
         XSObjectList memberTypes = itemType.getMemberTypes();
         if (memberTypes.getLength() > 0) {
             // the list's item type has variety 'union'
             XSSimpleTypeDefinition actualListItemType = 
getActualListItemTypeForVarietyUnion(memberTypes, listStrValue);
             // set a schema 'typed value' to variable $value
-            setXDMTypedValueFor$value(currentAssertDomRootElem, listStrValue, 
actualListItemType, null, false, xpath2DynamicContext);
+            setXDMTypedValueOf$value(currentAssertDomRootElem, listStrValue, 
actualListItemType, null, false, xpath2DynamicContext);
         } 
         else {
-            setXDMTypedValueFor$value(currentAssertDomRootElem, listStrValue, 
itemType, null, isTypeDerivedFromList, xpath2DynamicContext); 
+            setXDMTypedValueOf$value(currentAssertDomRootElem, listStrValue, 
itemType, null, isTypeDerivedFromList, xpath2DynamicContext); 
         }
 
-    } // setValueOf$valueForSTVarietyList
+    } // setXDMTypedValueOf$valueForSTVarietyList
+        
+    
+    /*
+     * Given a string value, this method sets an XPath 2.0 typed value for 
variable "$value" in XPath dynamic context, when the value is for simpleType 
variety union. 
+     */
+    public void setXDMTypedValueOf$valueForSTVarietyUnion(String value, 
XSObjectList memberTypes, DynamicContext xpath2DynamicContext) {        
+        // check member types of union in order to find that which member type 
can successfully validate the string value
+        // first, and set value of XPath2 context variable $value using the 
member type found as its type annotation.
+        for (int memTypeIdx = 0; memTypeIdx < memberTypes.getLength(); 
memTypeIdx++) {
+            XSSimpleType simpleTypeDv = (XSSimpleType) 
memberTypes.item(memTypeIdx);
+            if (XSTypeHelper.isValueValidForASimpleType(value, simpleTypeDv)) {
+               setXDMTypedValueOf$valueForSTVarietyAtomic(value, 
getXercesXSDTypeCodeFor$value(simpleTypeDv), xpath2DynamicContext);
+               break;
+            }            
+        }        
+    } // setXDMTypedValueOf$valueForSTVarietyUnion
+    
     
     /*
      * Given a string value, this method sets an XPath 2.0 typed value for 
variable "$value" in XPath dynamic context, if element has a complex type with 
simple content. 
      */
-    private void setValueOf$valueForCTWithSimpleContent(String value, 
XSComplexTypeDefinition typeDef, DynamicContext xpath2DynamicContext) {
+    private void setXDMValueOf$valueForCTWithSimpleContent(String value, 
XSComplexTypeDefinition typeDef, DynamicContext xpath2DynamicContext) {
         
         XSComplexTypeDefinition cmplxTypeDef = 
(XSComplexTypeDefinition)typeDef;
         XSSimpleTypeDefinition complexTypeSimplContentType = 
cmplxTypeDef.getSimpleType();
@@ -221,30 +239,14 @@ public class XSAssertionXPath2ValueImpl 
             // simple content type has variety xs:union
             XSSimpleTypeDefinition simpleContentTypeForUnion = 
getActualListItemTypeForVarietyUnion(complexTypeSimplContentType.getMemberTypes(),
 value);
             xpath2DynamicContext.set_variable(new 
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"), 
-                                         
SchemaTypeValueFactory.newSchemaTypeValue(simpleContentTypeForUnion.getBuiltInKind(),
 value));
+                                              
SchemaTypeValueFactory.newSchemaTypeValue(simpleContentTypeForUnion.getBuiltInKind(),
 value));
         }
         else {
             // simple content type has variety atomic
-            setValueOf$valueForSTVarietyAtomic(value, 
getXercesXSDTypeCodeFor$value(cmplxTypeDef.getSimpleType()), 
xpath2DynamicContext);
+            setXDMTypedValueOf$valueForSTVarietyAtomic(value, 
getXercesXSDTypeCodeFor$value(cmplxTypeDef.getSimpleType()), 
xpath2DynamicContext);
         }
           
-    } // setValueOf$valueForCTWithSimpleContent
-    
-    
-    /*
-     * Given a string value, this method sets an XPath 2.0 typed value for 
variable "$value" in XPath dynamic context, when the value is for simpleType 
variety union. 
-     */
-    public void setValueOf$valueForSTVarietyUnion(String value, XSObjectList 
memberTypes, DynamicContext xpath2DynamicContext) {        
-        // check member types of union in order to find that which member type 
can successfully validate the string value
-        // first, and set value of XPath2 context variable $value using the 
member type found as its type annotation.
-        for (int memTypeIdx = 0; memTypeIdx < memberTypes.getLength(); 
memTypeIdx++) {
-            XSSimpleType simpleTypeDv = (XSSimpleType) 
memberTypes.item(memTypeIdx);
-            if (XSTypeHelper.isValueValidForASimpleType(value, simpleTypeDv)) {
-               setValueOf$valueForSTVarietyAtomic(value, 
getXercesXSDTypeCodeFor$value(simpleTypeDv), xpath2DynamicContext);
-               break;
-            }            
-        }        
-    } // setValueOf$valueForSTVarietyUnion
+    } // setXDMValueOf$valueForCTWithSimpleContent
     
     
     /* 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to