/** * Creates the new instance that merges this and the given one via logical OR. * * @param that the other instance * @return this merged instance */ public Bitmask or(Bitmask that) { Bitmask copy = new Bitmask(this, that.bits.length << WORD_ADDRESS_BITS); return copy.orInPlace(that); }
/** * Push down the {@link #root} of this instance by adding a new {@link TreeVertex} as root and put the old * root as its child node. * * @param newRootChannelDescriptor will be wrapped in the new {@link #root} * @param newRootSettledIndices destination indices settled by the {@code newRootChannelDescriptor} * @param newToObsoleteRootConversion used to establish the {@link TreeEdge} between the old and new {@link #root} * @param costEstimate of the {@code newToObsoleteRootConversion} */ void reroot(ChannelDescriptor newRootChannelDescriptor, Bitmask newRootSettledIndices, ChannelConversion newToObsoleteRootConversion, double costEstimate) { // Exchange the root. final TreeVertex newRoot = new TreeVertex(newRootChannelDescriptor, newRootSettledIndices); final TreeEdge edge = newRoot.linkTo(newToObsoleteRootConversion, this.root, costEstimate); this.root = newRoot; // Update metadata. this.employedChannelDescriptors.add(newRootChannelDescriptor); this.settledDestinationIndices.orInPlace(newRootSettledIndices); this.costs += edge.costEstimate; }
final Tree ithTree = iterator.next(); combinationSettledIndices.orInPlace(ithTree.settledDestinationIndices); maxSettledIndices += ithTree.settledDestinationIndices.cardinality(); if (maxSettledIndices > combinationSettledIndices.cardinality()) {
channelsToIndicesChange.getField0(), key -> new Bitmask(this.destChannelDescriptorSets.size()) ).orInPlace(channelsToIndicesChange.getField1());
settledDestinationIndices.orInPlace(newSettledIndices);
this.reachableExistingDestinationChannelIndices.compute( existingDestinationChannel.getDescriptor(), (k, v) -> v == null ? new Bitmask(channelIndices) : v.orInPlace(channelIndices) ); if (existingDestinationChannel.getDescriptor().equals(this.sourceChannelDescriptor)) break;