KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > hp > hpl > jena > graph > query > ValuatorSet


1 /*
2   (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP, all rights reserved.
3   [See end of file]
4   $Id: ValuatorSet.java,v 1.5 2005/02/21 11:52:26 andy_seaborne Exp $
5 */

6
7 package com.hp.hpl.jena.graph.query;
8
9 import java.util.*;
10
11 import com.hp.hpl.jena.util.CollectionFactory;
12
13 /**
14     ValuatorSet - a set of Valuators, which can be added to and evaluated [only].
15
16     @author kers
17 */

18 public class ValuatorSet
19     {
20     private Set valuators = CollectionFactory.createHashedSet();
21     
22     public ValuatorSet()
23         {}
24     
25     /**
26          Answer this ValuatorSet after adding the Valuator <code>e</code> to it.
27     */

28     public ValuatorSet add( Valuator e )
29         {
30         valuators.add( e );
31         return this;
32         }
33         
34     /**
35          Answer true iff no Valuator in this set evaluates to <code>false</code>. The
36          Valuators are evaluated in an unspecified order, and evaluation ceases as
37          soon as any Valuator has returned false.
38     */

39     public boolean evalBool( IndexValues vv )
40         {
41         Iterator it = valuators.iterator();
42         while (it.hasNext())
43             if (((Valuator) it.next()).evalBool( vv ) == false) return false;
44         return true;
45         }
46                     
47     }
48
49 /*
50     (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
51     All rights reserved.
52
53     Redistribution and use in source and binary forms, with or without
54     modification, are permitted provided that the following conditions
55     are met:
56
57     1. Redistributions of source code must retain the above copyright
58        notice, this list of conditions and the following disclaimer.
59
60     2. Redistributions in binary form must reproduce the above copyright
61        notice, this list of conditions and the following disclaimer in the
62        documentation and/or other materials provided with the distribution.
63
64     3. The name of the author may not be used to endorse or promote products
65        derived from this software without specific prior written permission.
66
67     THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
68     IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
69     OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
70     IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
71     INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
72     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
73     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
74     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
75     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
76     THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
77 */
Popular Tags