View Javadoc

1   // UnionBitVectorFact.java, created Mar 22, 2004 2:10:20 PM 2004 by jwhaley
2   // Copyright (C) 2004 John Whaley <jwhaley@alum.mit.edu>
3   // Licensed under the terms of the GNU LGPL; see COPYING for details.
4   package joeq.Compiler.Dataflow;
5   
6   import jwutil.math.BitString;
7   
8   /***
9    * UnionBitVectorFact
10   * 
11   * @author jwhaley
12   * @version $Id: UnionBitVectorFact.java 1931 2004-09-22 22:17:47Z joewhaley $
13   */
14  public class UnionBitVectorFact extends BitVectorFact {
15  
16      protected UnionBitVectorFact(int size) {
17          super(size);
18      }
19      
20      protected UnionBitVectorFact(BitString s) {
21          super(s);
22      }
23      
24      /* (non-Javadoc)
25       * @see joeq.Compiler.Dataflow.Fact#merge(joeq.Compiler.Dataflow.Fact)
26       */
27      public Fact merge(Fact that) {
28          BitVectorFact r = (BitVectorFact) that;
29          BitString s = new BitString(this.fact.size());
30          s.or(this.fact);
31          boolean b = s.or(r.fact);
32          if (!b) return this;
33          else return new UnionBitVectorFact(s);
34      }
35      
36      public BitVectorFact makeNew(BitString s) {
37          return new UnionBitVectorFact(s);
38      }
39  }