View Javadoc

1   /*
2    * Created on Jul 6, 2004
3    * 
4    * TODO To change the template for this generated file go to Window -
5    * Preferences - Java - Code Style - Code Templates
6    */
7   package net.sf.bddbddb.dataflow;
8   
9   import jwutil.math.BitString;
10  import jwutil.util.Assert;
11  import net.sf.bddbddb.IterationList;
12  import net.sf.bddbddb.dataflow.Problem.Fact;
13  
14  /***
15   * @author Collective
16   * @version $Id: UnionBitVectorFact.java 328 2004-10-16 02:45:30Z joewhaley $
17   */
18  public class UnionBitVectorFact extends BitVectorFact {
19      public UnionBitVectorFact(int setSize) {
20          super(setSize);
21      }
22  
23      public UnionBitVectorFact(BitString s) {
24          super(s);
25      }
26  
27      public UnionBitVectorFact create(BitString s) {
28          return new UnionBitVectorFact(s);
29      }
30  
31      public Fact join(Fact that) {
32          Assert._assert(location == ((BitVectorFact) that).location);
33          BitString thatS = ((BitVectorFact) that).fact;
34          BitString newS = new BitString(this.fact.size());
35          newS.or(this.fact);
36          boolean b = newS.or(thatS);
37          if (!b) return this;
38          UnionBitVectorFact f = create(newS);
39          f.location = this.location;
40          return f;
41      }
42  
43      public Fact copy(IterationList list) {
44          UnionBitVectorFact f = create(fact);
45          f.location = list;
46          return f;
47      }
48  }