예제 #1
0
파일: Usage.java 프로젝트: nqzero/kilim
 /**
  * This is the standard liveness calculation (Dragon Book, section 10.6). At each BB (and its
  * corresponding usage), we evaluate "in" using use and def. in = use U (out \ def) where out = U
  * succ.in, for all successors
  *
  * <p>this algorithm has been modified to treat catch blocks as occurring anywhere ie, that vars
  * defined in a try may never be set however, this only applies to vars that have been defined at
  * least once (ie, born)
  */
 public boolean evalLiveIn(ArrayList<Usage> succUsage, ArrayList<Handler> handUsage) {
   BitSet out = new BitSet(nLocals);
   BitSet old_in = (BitSet) in.clone();
   if (handUsage == null) handUsage = new ArrayList();
   if (succUsage.size() == 0) {
     in = use;
   } else {
     // calculate out = U succ.in
     out = (BitSet) succUsage.get(0).in.clone();
     for (int i = 1; i < succUsage.size(); i++) {
       out.or(succUsage.get(i).in);
     }
     // calc out \ def == out & ~def == ~(out | def)
     // unless a var has been def'd in all catch blocks, assume it may fail to def
     BitSet def1 = (BitSet) def.clone();
     for (Handler handle : handUsage) def1.and(handle.catchBB.usage.def);
     def1.flip(0, nLocals);
     out.and(def1);
     for (Handler handler : handUsage) out.or(handler.catchBB.usage.use);
     // catch block vars may be def'd in this block, but we can't easily know if the
     // def has occurred before the throw
     // if the var has never been def'd (or was a parameter), then it can't be live
     out.and(born);
     out.or(use);
     in = out;
   }
   return !(in.equals(old_in));
 }
예제 #2
0
  protected int freeBit(HierNode<T> x, HierNode<T> z) {
    // System.out.println( "Looking for a free bit in node " + x );
    BitSet forbid = new BitSet(this.size());
    forbid.or(x.getBitMask());
    for (HierNode<T> y : getNodes()) {

      if (superset(y, x) > 0) {
        // System.out.println( "\t\t Subtype " + y + " contributes " + toBinaryString(
        // y.getBitMask() ) );
        forbid.or(y.getBitMask());
      }

      if (z != null) {
        if (superset(y, z) > 0) {
          //                  System.out.println( "\t\t Subtype " + y + " contributes " +
          // toBinaryString( y.getBitMask() ) );
          forbid.or(y.getBitMask());
        }
      }

      if (superset(x, y) < 0) {
        BitSet diff = singleBitDiff(x.getBitMask(), y.getBitMask());
        // System.out.println( "\t\t Incomparable " + y + " contributes " + toBinaryString( diff )
        // );
        forbid.or(diff);
      }
    }
    // System.out.println( "\t Forbidden mask " + toBinaryString( forbid ) );
    return firstZero(forbid);
  }
예제 #3
0
  /**
   * Prob0 precomputation algorithm. i.e. determine the states of an STPG which, with min/max
   * probability 0, reach a state in {@code target}, while remaining in those in @{code remain}.
   * {@code min}=true gives Prob0E, {@code min}=false gives Prob0A.
   *
   * @param stpg The STPG
   * @param remain Remain in these states (optional: null means "all")
   * @param target Target states
   * @param min1 Min or max probabilities for player 1 (true=lower bound, false=upper bound)
   * @param min2 Min or max probabilities for player 2 (true=min, false=max)
   */
  public BitSet prob0(STPG stpg, BitSet remain, BitSet target, boolean min1, boolean min2) {
    int n, iters;
    BitSet u, soln, unknown;
    boolean u_done;
    long timer;

    // Start precomputation
    timer = System.currentTimeMillis();
    if (verbosity >= 1)
      mainLog.println(
          "Starting Prob0 (" + (min1 ? "min" : "max") + (min2 ? "min" : "max") + ")...");

    // Special case: no target states
    if (target.cardinality() == 0) {
      soln = new BitSet(stpg.getNumStates());
      soln.set(0, stpg.getNumStates());
      return soln;
    }

    // Initialise vectors
    n = stpg.getNumStates();
    u = new BitSet(n);
    soln = new BitSet(n);

    // Determine set of states actually need to perform computation for
    unknown = new BitSet();
    unknown.set(0, n);
    unknown.andNot(target);
    if (remain != null) unknown.and(remain);

    // Fixed point loop
    iters = 0;
    u_done = false;
    // Least fixed point - should start from 0 but we optimise by
    // starting from 'target', thus bypassing first iteration
    u.or(target);
    soln.or(target);
    while (!u_done) {
      iters++;
      // Single step of Prob0
      stpg.prob0step(unknown, u, min1, min2, soln);
      // Check termination
      u_done = soln.equals(u);
      // u = soln
      u.clear();
      u.or(soln);
    }

    // Negate
    u.flip(0, n);

    // Finished precomputation
    timer = System.currentTimeMillis() - timer;
    if (verbosity >= 1) {
      mainLog.print("Prob0 (" + (min1 ? "min" : "max") + (min2 ? "min" : "max") + ")");
      mainLog.println(" took " + iters + " iterations and " + timer / 1000.0 + " seconds.");
    }

    return u;
  }
예제 #4
0
 void computeIn(LinkedList<Vertex> worklist) {
   int i;
   BitSet old;
   BitSet ne;
   Vertex v;
   ListIterator<Vertex> iter;
   iter = succ.listIterator();
   while (iter.hasNext()) {
     v = iter.next();
     out.or(v.in);
   }
   old = in;
   in = new BitSet();
   in.or(out);
   in.andNot(def);
   in.or(use);
   if (!in.equals(old)) {
     iter = pred.listIterator();
     while (iter.hasNext()) {
       v = iter.next();
       if (!v.listed) {
         worklist.addLast(v);
         v.listed = true;
       }
     }
   }
 }
  private BlockDataFlowState generateDFState(CFGBlock block) {
    int totalGlobals = this.uniqueGlobals.get(block.getMethodName()).size();

    // Get the original inBitSet for this block
    BitSet origIn;
    if (this.cfgBlocksState.containsKey(block)) {
      origIn = this.cfgBlocksState.get(block).getIn();
    } else {
      origIn = new BitSet(totalGlobals);
      origIn.set(0, totalGlobals);
    }

    // Calculate the in BitSet by taking intersection of predecessors
    BlockDataFlowState bFlow = new BlockDataFlowState(totalGlobals);

    // If there exist at least one successor, set Out to all True
    if (block.getSuccessors().size() > 0) {
      bFlow.getOut().set(0, totalGlobals);
    }

    BitSet out = bFlow.getOut();
    for (CFGBlock pred : block.getSuccessors()) {
      if (this.cfgBlocksState.containsKey(pred)) {
        out.and(this.cfgBlocksState.get(pred).getIn());
      }
    }

    calculateGenKillSets(block, bFlow);

    // Calculate Out
    BitSet in = bFlow.getIn(); // IN = (OUT - KILL) U GEN
    in.or(out);
    in.xor(bFlow.getKill());
    in.or(bFlow.getGen());

    if (!in.equals(origIn)) {
      // Add successors to cfgBlocks list
      for (CFGBlock pred : block.getPredecessors()) {
        if (!cfgBlocksToProcess.contains(pred)) {
          cfgBlocksToProcess.add(pred);
        }
      }
    }

    // Remove this block, since it has been processed
    cfgBlocksToProcess.remove(block);

    return bFlow;
  }
예제 #6
0
 /** Performs a deep copy on <i>other</i>. */
 public TArticle(TArticle other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   if (other.isSetTitle()) {
     this.title = other.title;
   }
   if (other.isSetContent()) {
     this.content = other.content;
   }
   if (other.isSetSummary()) {
     this.summary = other.summary;
   }
   this.publishTime = other.publishTime;
   if (other.isSetOriginalUrl()) {
     this.originalUrl = other.originalUrl;
   }
   if (other.isSetArticleFrom()) {
     this.articleFrom = other.articleFrom;
   }
   this.articleType = other.articleType;
   this.topDay = other.topDay;
   if (other.isSetImageItems()) {
     List<TImageItem> __this__imageItems = new ArrayList<TImageItem>();
     for (TImageItem other_element : other.imageItems) {
       __this__imageItems.add(new TImageItem(other_element));
     }
     this.imageItems = __this__imageItems;
   }
   if (other.isSetArticleUuid()) {
     this.articleUuid = other.articleUuid;
   }
 }
예제 #7
0
  public static void main(String[] args) {
    BitSet bits1 = new BitSet(16);
    BitSet bits2 = new BitSet(16);

    for (int i = 0; i < 16; i++) {
      if ((i % 2) == 0) bits1.set(i);
      if ((i % 5) != 0) bits2.set(i);
    }
    System.out.println("Initial pattern in bits1: ");
    System.out.println(bits1);
    System.out.println("\nInitial pattern in bits2: ");
    System.out.println(bits2);

    // AND bits
    bits2.and(bits1);
    System.out.println("\nbits2 AND bits1: ");
    System.out.println(bits2);

    // OR bits
    bits2.or(bits1);
    System.out.println("\nbits2 OR bits1:  ");
    System.out.println(bits2);

    // XOR bits
    bits2.xor(bits1);
    System.out.println("\nbits2 XOR bits1: ");
    System.out.println(bits2);
  }
 /** Performs a deep copy on <i>other</i>. */
 public OrderPlacedByClient(OrderPlacedByClient other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   if (other.isSetChosenItems()) {
     List<ChosenMenuItem> __this__chosenItems = new ArrayList<ChosenMenuItem>();
     for (ChosenMenuItem other_element : other.chosenItems) {
       __this__chosenItems.add(new ChosenMenuItem(other_element));
     }
     this.chosenItems = __this__chosenItems;
   }
   this.expectedPrice = other.expectedPrice;
   this.userId = other.userId;
   if (other.isSetHowWillPay()) {
     this.howWillPay = other.howWillPay;
   }
   this.pickUp = other.pickUp;
   if (other.isSetAddress()) {
     this.address = other.address;
   }
   if (other.isSetPhoneNumber()) {
     this.phoneNumber = other.phoneNumber;
   }
   this.timestamp = other.timestamp;
   this.tableId = other.tableId;
   if (other.isSetPhoneId()) {
     this.phoneId = other.phoneId;
   }
   this.orderId = other.orderId;
   if (other.isSetUsername()) {
     this.username = other.username;
   }
 }
 /** The longest dep set of the sub-sequence s[0..idx]. */
 public static BitSet longestDepSet(Sequence s, int idx) {
   if (s.size() == 0) throw new IllegalArgumentException("size must be greater than 0.");
   if (idx < 0 || idx >= s.size()) throw new IllegalArgumentException();
   assert s.size() <= maxlength;
   int max = -1;
   int maxidx = -1;
   for (int i = 0; i <= idx; i++) {
     BitSet set = sets[i];
     set.clear();
     set.set(i);
     lastuse[i] = i;
     for (Variable invar : s.getInputs(i)) {
       set.or(sets[lastuse[invar.index]]);
       lastuse[invar.index] = i;
     }
     int size = set.cardinality();
     if (size > max) {
       max = size;
       maxidx = i;
     }
   }
   for (int i = 0; i < s.size(); i++) {
     // System.out.println("@ " + sets[i]);
   }
   return sets[maxidx];
 }
예제 #10
0
 /** Performs a deep copy on <i>other</i>. */
 public Appl(Appl other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   if (other.isSetId()) {
     this.id = other.id;
   }
   if (other.isSetType()) {
     this.type = other.type;
   }
   this.excuteAction = other.excuteAction;
   if (other.isSetExcuteDescribe()) {
     this.excuteDescribe = other.excuteDescribe;
   }
   if (other.isSetPkgName()) {
     this.pkgName = other.pkgName;
   }
   if (other.isSetLevel()) {
     this.level = other.level;
   }
   if (other.isSetCategory()) {
     this.category = other.category;
   }
   if (other.isSetName()) {
     this.name = other.name;
   }
 }
  public boolean verify(String message, Signature signature, PublicKey publicKey) throws Exception {
    if (!(publicKey instanceof PublicKeyLamport)) {
      throw new Exception("Wrong Type of Signing Key");
    }

    final PublicKeyLamport publicKeyLamport = (PublicKeyLamport) publicKey;

    if (!(signature instanceof SignatureLamport)) {
      throw new Exception("Wrong Type of Signature");
    }

    final SignatureLamport signatureLamport = (SignatureLamport) signature;
    final BitSet messageBits = new BitSet(this.k);
    messageBits.or(BitSet.valueOf(message.getBytes()));

    // verification algorithm
    for (int i = 0; i < this.k; ++i) {
      final Hash hashX = this.h.hash(signatureLamport.getSig(i).toByteArray());
      final Hash hashY =
          !messageBits.get(i) ? publicKeyLamport.getY1(i) : publicKeyLamport.getY2(i);
      if (!hashX.equals(hashY)) {
        return false;
      }
    }

    return true;
  }
예제 #12
0
 /** Performs a deep copy on <i>other</i>. */
 public ChosenMenuItem(ChosenMenuItem other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   this.menuItemId = other.menuItemId;
   if (other.isSetSingleChoiceOptions()) {
     List<org.pocketcampus.platform.sdk.shared.common.ChosenSingleChoiceOption>
         __this__singleChoiceOptions =
             new ArrayList<org.pocketcampus.platform.sdk.shared.common.ChosenSingleChoiceOption>();
     for (org.pocketcampus.platform.sdk.shared.common.ChosenSingleChoiceOption other_element :
         other.singleChoiceOptions) {
       __this__singleChoiceOptions.add(
           new org.pocketcampus.platform.sdk.shared.common.ChosenSingleChoiceOption(
               other_element));
     }
     this.singleChoiceOptions = __this__singleChoiceOptions;
   }
   if (other.isSetMultiChoiceOptions()) {
     List<org.pocketcampus.platform.sdk.shared.common.ChosenMultiChoiceOption>
         __this__multiChoiceOptions =
             new ArrayList<org.pocketcampus.platform.sdk.shared.common.ChosenMultiChoiceOption>();
     for (org.pocketcampus.platform.sdk.shared.common.ChosenMultiChoiceOption other_element :
         other.multiChoiceOptions) {
       __this__multiChoiceOptions.add(
           new org.pocketcampus.platform.sdk.shared.common.ChosenMultiChoiceOption(other_element));
     }
     this.multiChoiceOptions = __this__multiChoiceOptions;
   }
   if (other.isSetComments()) {
     this.comments = other.comments;
   }
 }
예제 #13
0
 protected void inheritMerged(HierNode<T> x) {
   BitSet mask = new BitSet(x.getBitMask() != null ? x.getBitMask().length() : 1);
   for (HierNode<T> p : x.getParents()) {
     mask.or(p.getBitMask());
   }
   updateMask(x, mask);
 }
예제 #14
0
  @Override
  public void fixSomeVariables(ICause cause) throws ContradictionException {
    // this is called after restart
    // if required, force the cut and explain the cut
    if (forceCft) {
      explainCut();
      nbFixedVariables = related2cut.cardinality();
      nbCall = 0;
      increaseLimit();
    }
    // then fix variables
    // this part is specific: a fake decision path has to be created
    nbCall++;
    restrictLess();
    notFrozen.clear();
    notFrozen.or(related2cut);
    for (; !notFrozen.isEmpty() && notFrozen.cardinality() > nbFixedVariables; ) {
      int idx = selectVariable();
      notFrozen.clear(idx);
    }
    assert mSolver.getSearchLoop().getLastDecision() == RootDecision.ROOT;
    // add the first refuted decisions
    int first = notFrozen.nextSetBit(0);
    for (int i = (first > -1 ? refuted.nextSetBit(first) : first);
        i > -1;
        i = refuted.nextSetBit(i + 1)) {
      notFrozen.clear(i);
    }

    // add unrelated
    notFrozen.or(unrelated);

    // then build the fake decision path
    last = null;
    //        LOGGER.debug("relax cut {}", notFrozen.cardinality());
    for (int id = notFrozen.nextSetBit(0);
        id >= 0 && id < path.size();
        id = notFrozen.nextSetBit(id + 1)) {
      //            last = ExplanationToolbox.mimic(path.get(id)); // required because some
      // unrelated decisions can be refuted
      if (path.get(id).hasNext()) {
        last = path.get(id).duplicate();
        if (refuted.get(id)) last.buildNext();
        ExplanationToolbox.imposeDecisionPath(mSolver, last);
      }
    }
  }
예제 #15
0
 /** Performs a deep copy on <i>other</i>. */
 public SessionId(SessionId other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   this.tos = other.tos;
   if (other.isSetCamiproCookie()) {
     this.camiproCookie = other.camiproCookie;
   }
 }
예제 #16
0
파일: Usage.java 프로젝트: nqzero/kilim
 /**
  * evolve the born value a single iteration by mixing in either pred or combo
  *
  * @param pred if combo is null, use pred.born
  * @param combo if non-null, the value to mix in
  * @return true if the evolution resulted in a change in the born value
  */
 boolean evalBornIn(Usage pred, BitSet combo) {
   BitSet old = (BitSet) born.clone();
   if (combo == null) combo = pred.born;
   if (firstBorn) born.or(combo);
   else born.and(combo);
   firstBorn = false;
   return !old.equals(born);
 }
예제 #17
0
 /** Performs a deep copy on <i>other</i>. */
 public NamespaceListing(NamespaceListing other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   if (other.isSetName()) {
     this.name = other.name;
   }
   this.is_namespace = other.is_namespace;
 }
예제 #18
0
파일: GameData.java 프로젝트: Kobata/FML
 private void set(GameData data) {
   iBlockRegistry.set(data.iBlockRegistry);
   iItemRegistry.set(data.iItemRegistry);
   availabilityMap.clear();
   availabilityMap.or(data.availabilityMap);
   blockedIds.clear();
   blockedIds.addAll(data.blockedIds);
 }
예제 #19
0
 /** Performs a deep copy on <i>other</i>. */
 public T_QueryOrderResponse(T_QueryOrderResponse other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   this.responseCode = other.responseCode;
   this.transactionID = other.transactionID;
   if (other.isSetDescription()) {
     this.description = other.description;
   }
 }
  private void changeServiceDependencies(final double addFactor, final double removeFactor) {
    BitSet servicesInNeighbourhood[] = new BitSet[numNeighbourhoods];
    for (int s = 0; s < servicesInNeighbourhood.length; ++s) {
      servicesInNeighbourhood[s] = new BitSet();
    }

    IntAVLTreeSet serviceToNeighbourhoods[] = new IntAVLTreeSet[services.length];
    for (int s = 0; s < services.length; ++s) serviceToNeighbourhoods[s] = new IntAVLTreeSet();

    for (Process p : processes) {
      int n = machines[assignment[p.id]].neighborhood;
      int s = p.service;

      servicesInNeighbourhood[n].set(s);

      serviceToNeighbourhoods[s].add(n);
    }

    for (int sid = 0; sid < services.length; sid++) {
      IntAVLTreeSet neighbourhoods = serviceToNeighbourhoods[sid];

      BitSet intersection = null;
      for (int n : neighbourhoods) {
        if (intersection == null) {
          intersection = new BitSet();
          intersection.or(servicesInNeighbourhood[n]);
        } else intersection.and(servicesInNeighbourhood[n]);
      }

      // intersection - all possible services I can depend on

      for (int d : services[sid].dependencies) intersection.clear(d);

      intersection.clear(sid); // exclude itself
      // services we can add as new dependencies

      int[] list = new int[intersection.cardinality()];
      int i = 0;
      for (int q = intersection.nextSetBit(0); q >= 0; q = intersection.nextSetBit(q + 1)) {
        list[i++] = q;
      }
      MyArrayUtils.shuffle(list, random);

      int addCount = nextInt(0, 1 + (int) (addFactor * services[sid].dependencies.length));
      // addCount = 0;
      int removeCount = nextInt(0, 1 + (int) (addFactor * services[sid].dependencies.length));

      int[] newdependencies =
          org.apache.commons.lang.ArrayUtils.addAll(
              services[sid].dependencies,
              Arrays.copyOfRange(list, 0, Math.min(list.length, addCount)));
      MyArrayUtils.shuffle(newdependencies, random);

      services[sid].dependencies =
          Arrays.copyOfRange(newdependencies, 0, Math.max(0, newdependencies.length - removeCount));
    }
  }
 /** Performs a deep copy on <i>other</i>. */
 public HibariException(HibariException other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   this.timestamp = other.timestamp;
   this.what = other.what;
   if (other.isSetWhy()) {
     this.why = other.why;
   }
 }
예제 #22
0
 /**
  * Given the current set of potential matching rules, obtain the rules which match the current
  * field defined either by key or anykey. The rules are represented by bitsets which are
  * intersected to return the remain potentially matching rules. If after bitset intersection, the
  * resulting bitset is empty, an exception is thrown to halt the search.
  *
  * @param src - the current set of potentially matching rules.
  * @param map - the data structure holding all the possible values defined by all flow space rules
  *     for given field.
  * @param key - the key (or field value) used to index the data structure.
  * @param anykey - the 'any' value for this field.
  * @param wildcards - the set of wildcards defined by this match
  * @param wild - the specific wildcard value for this field
  * @return - true if field was wildcarded and false otherwise.
  * @throws NoMatch - if the set of rules (ie. the src bitset) is empty after intersection.
  */
 private <K> boolean testEmpty(
     BitSet src, Map<K, BitSet> map, K key, K anykey, int wildcards, int wild) throws NoMatch {
   if ((wildcards & wild) != 0) return true;
   BitSet any = get(map, anykey);
   any.or(get(map, key));
   src.and(any);
   if (src.isEmpty()) throw new NoMatch("No Match");
   return false;
 }
예제 #23
0
 /** Performs a deep copy on <i>other</i>. */
 public IntString(IntString other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   this.myint = other.myint;
   if (other.isSetMyString()) {
     this.myString = other.myString;
   }
   this.underscore_int = other.underscore_int;
 }
예제 #24
0
 /** Performs a deep copy on <i>other</i>. */
 public KeyCount(KeyCount other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   if (other.isSetKey()) {
     this.key = new byte[other.key.length];
     System.arraycopy(other.key, 0, key, 0, other.key.length);
   }
   this.count = other.count;
 }
예제 #25
0
 /** Performs a deep copy on <i>other</i>. */
 public AppInfoResult(AppInfoResult other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   this.deviceId = other.deviceId;
   this.flowNum = other.flowNum;
   this.result = other.result;
   if (other.isSetAppdatainfo()) {
     this.appdatainfo = new AppDataInfo(other.appdatainfo);
   }
 }
예제 #26
0
 @Override
 public void or(Filter filter) {
   if (filter == null
       || !(filter instanceof BloomFilter)
       || filter.vectorSize != this.vectorSize
       || filter.nbHash != this.nbHash) {
     throw new IllegalArgumentException("filters cannot be or-ed");
   }
   bits.or(((BloomFilter) filter).bits);
 }
 /** Performs a deep copy on <i>other</i>. */
 public AchieveResult(AchieveResult other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   if (other.isSetScore()) {
     this.score = other.score;
   }
   this.isShot = other.isShot;
   if (other.isSetDetail()) {
     this.detail = other.detail;
   }
 }
 /** Performs a deep copy on <i>other</i>. */
 public ThriftTaskAttemptID(ThriftTaskAttemptID other) {
   __isset_bit_vector.clear();
   __isset_bit_vector.or(other.__isset_bit_vector);
   if (other.isSetTaskID()) {
     this.taskID = new ThriftTaskID(other.taskID);
   }
   this.attemptID = other.attemptID;
   if (other.isSetAsString()) {
     this.asString = other.asString;
   }
 }
예제 #29
0
  /** Performs a deep copy on <i>other</i>. */
  public StorageDescriptor(StorageDescriptor other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    if (other.isSetCols()) {
      List<FieldSchema> __this__cols = new ArrayList<FieldSchema>();
      for (FieldSchema other_element : other.cols) {
        __this__cols.add(new FieldSchema(other_element));
      }
      this.cols = __this__cols;
    }
    if (other.isSetLocation()) {
      this.location = other.location;
    }
    if (other.isSetInputFormat()) {
      this.inputFormat = other.inputFormat;
    }
    if (other.isSetOutputFormat()) {
      this.outputFormat = other.outputFormat;
    }
    this.compressed = other.compressed;
    this.numBuckets = other.numBuckets;
    if (other.isSetSerdeInfo()) {
      this.serdeInfo = new SerDeInfo(other.serdeInfo);
    }
    if (other.isSetBucketCols()) {
      List<String> __this__bucketCols = new ArrayList<String>();
      for (String other_element : other.bucketCols) {
        __this__bucketCols.add(other_element);
      }
      this.bucketCols = __this__bucketCols;
    }
    if (other.isSetSortCols()) {
      List<Order> __this__sortCols = new ArrayList<Order>();
      for (Order other_element : other.sortCols) {
        __this__sortCols.add(new Order(other_element));
      }
      this.sortCols = __this__sortCols;
    }
    if (other.isSetParameters()) {
      Map<String, String> __this__parameters = new HashMap<String, String>();
      for (Map.Entry<String, String> other_element : other.parameters.entrySet()) {

        String other_element_key = other_element.getKey();
        String other_element_value = other_element.getValue();

        String __this__parameters_copy_key = other_element_key;

        String __this__parameters_copy_value = other_element_value;

        __this__parameters.put(__this__parameters_copy_key, __this__parameters_copy_value);
      }
      this.parameters = __this__parameters;
    }
  }
예제 #30
0
  /** Performs a deep copy on <i>other</i>. */
  public Table(Table other) {
    __isset_bit_vector.clear();
    __isset_bit_vector.or(other.__isset_bit_vector);
    if (other.isSetTableName()) {
      this.tableName = other.tableName;
    }
    if (other.isSetDbName()) {
      this.dbName = other.dbName;
    }
    if (other.isSetOwner()) {
      this.owner = other.owner;
    }
    this.createTime = other.createTime;
    this.lastAccessTime = other.lastAccessTime;
    this.retention = other.retention;
    if (other.isSetSd()) {
      this.sd = new StorageDescriptor(other.sd);
    }
    if (other.isSetPartitionKeys()) {
      List<FieldSchema> __this__partitionKeys = new ArrayList<FieldSchema>();
      for (FieldSchema other_element : other.partitionKeys) {
        __this__partitionKeys.add(new FieldSchema(other_element));
      }
      this.partitionKeys = __this__partitionKeys;
    }
    if (other.isSetParameters()) {
      Map<String, String> __this__parameters = new HashMap<String, String>();
      for (Map.Entry<String, String> other_element : other.parameters.entrySet()) {

        String other_element_key = other_element.getKey();
        String other_element_value = other_element.getValue();

        String __this__parameters_copy_key = other_element_key;

        String __this__parameters_copy_value = other_element_value;

        __this__parameters.put(__this__parameters_copy_key, __this__parameters_copy_value);
      }
      this.parameters = __this__parameters;
    }
    if (other.isSetViewOriginalText()) {
      this.viewOriginalText = other.viewOriginalText;
    }
    if (other.isSetViewExpandedText()) {
      this.viewExpandedText = other.viewExpandedText;
    }
    if (other.isSetTableType()) {
      this.tableType = other.tableType;
    }
    if (other.isSetPrivileges()) {
      this.privileges = new PrincipalPrivilegeSet(other.privileges);
    }
  }