Clover Coverage Report
Coverage timestamp: Sun Mar 23 2008 08:24:39 GMT
5   90   2   1.67
0   17   0.8   3
3     1.33  
1    
 
 
  SubstringsNode       Line # 55 5 2 75% 0.75
 
No Tests
 
1    /*
2    * Copyright (c) 2000-2005, University of Salford
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions are met:
7    *
8    * Redistributions of source code must retain the above copyright notice, this
9    * list of conditions and the following disclaimer.
10    *
11    * Redistributions in binary form must reproduce the above copyright notice,
12    * this list of conditions and the following disclaimer in the documentation
13    * and/or other materials provided with the distribution.
14    *
15    * Neither the name of the University of Salford nor the names of its
16    * contributors may be used to endorse or promote products derived from this
17    * software without specific prior written permission.
18    *
19    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21    * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22    * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23    * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24    * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25    * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26    * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27    * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28    * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29    * POSSIBILITY OF SUCH DAMAGE.
30    */
31   
32    package issrg.pba.rbac.xmlpolicy.ifstatement;
33   
34    /**
35    * This is the class for Substrings node of the IF-statement. Its functionality
36    * is
37    * very much determined by OperationNode and StringInterpreter, which are
38    * configured to deliver the following semantics:
39    *
40    * <p>This operation expects two and only two Terms of type Types.STRING_TYPE,
41    * and
42    * returns a
43    * value of type Types.BOOLEAN_TYPE.
44    * The evaluation result is "true", if and only if the first string Term occurs
45    * somewhere in the second string Term.
46    *
47    * <p>StringInterpreter provides the default implementation
48    * of the Substrings operation.
49    *
50    * @see StringInterpreter
51    *
52    * @author A.Otenko
53    */
54   
 
55    public class SubstringsNode extends OperationNode {
56    public static final String SUBSTRINGS_NODE = "Substrings";
57   
58    /**
59    * Call this method to register the SubstringsNode with the XMLPolicyParser.
60    * It also
61    * registers the StringInterpreter in SUBSTRINGS_MODE.
62    *
63    * @see StringInterpreter
64    */
 
65  21 toggle public static void register(){
66  21 try{
67  21 issrg.pba.rbac.xmlpolicy.XMLPolicyParser.registerXMLNode(SUBSTRINGS_NODE, SubstringsNode.class);
68    }catch (NoSuchMethodException nsme){
69  0 nsme.printStackTrace();
70    }
71   
72  21 OperationNode.registerInterpreterForNode(SUBSTRINGS_NODE, new StringInterpreter(StringInterpreter.SUBSTRINGS_MODE));
73    }
74   
 
75  0 toggle protected SubstringsNode() {
76    }
77   
78    /**
79    * This constructor builds a SubstringsNode given the XMLPolicyParser and the
80    * set of
81    * attributes of this XML element. It expects that there are two and only two
82    * child nodes.
83    *
84    * @param p - the XMLPolicyParser that builds this SubstringsNode
85    * @param attr - the attributes of this XML element
86    */
 
87  2 toggle public SubstringsNode(issrg.pba.rbac.xmlpolicy.XMLPolicyParser p, org.xml.sax.Attributes attrs){
88  2 super(SUBSTRINGS_NODE, attrs, 2, 2);
89    }
90    }