ShardTable Decorate
@param shardCount   shard table count
493187
function ShardTable(shardCount) {
    return (target) => {
        const args = {
            shardCount,
            className: target.name,
        };
        if (args.className.indexOf('_') < 0) {
            EntityStorage_1.EntityStorage.instance.shardTableMetadataStorage[target.name] = args;
        }
    };
}
134828
public void addTable(Object objKey, BaseTable table)
    {
        if (m_mapTable == null)
            m_mapTable = new Hashtable<Object,BaseTable>();
        if (objKey == null)
            objKey = new Integer(m_mapTable.size());
        m_mapTable.put(objKey, table);
    }
1057859
def set_processed_counts(self, shards_processed, shards_status):
    
    chart = google_chart_api.BarChart()

    def filter_status(status_to_filter):
      return [count if status == status_to_filter else 0
              for count, status in zip(shards_processed, shards_status)]

    if shards_status:
      # Each index will have only one non-zero count, so stack them to color-
      # code the bars by status
      # These status values are computed in _update_state_from_shard_states,
      # in mapreduce/handlers.py.
      chart.stacked = True
      chart.AddBars(filter_status("unknown"), color="404040")
      chart.AddBars(filter_status("success"), color="00ac42")
      chart.AddBars(filter_status("running"), color="3636a9")
      chart.AddBars(filter_status("aborted"), color="e29e24")
      chart.AddBars(filter_status("failed"), color="f6350f")
    else:
      chart.AddBars(shards_processed)

    shard_count = len(shards_processed)

    if shard_count > 95:
      # Auto-spacing does not work for large numbers of shards.
      pixels_per_shard = 700.0 / shard_count
      bar_thickness = int(pixels_per_shard * .9)

      chart.style = bar_chart.BarChartStyle(bar_thickness=bar_thickness,
        bar_gap=0.1, use_fractional_gap_spacing=True)

    if shards_processed and shard_count <= 95:
      # Adding labels puts us in danger of exceeding the URL length, only
      # do it when we have a small amount of data to plot.
      # Only 16 labels on the whole chart.
      stride_length = max(1, shard_count / 16)
      chart.bottom.labels = []
      for x in xrange(shard_count):
        if (x % stride_length == 0 or
            x == shard_count - 1):
          chart.bottom.labels.append(x)
        else:
          chart.bottom.labels.append("")
      chart.left.labels = ["0", str(max(shards_processed))]
      chart.left.min = 0

    self.chart_width = min(700, max(300, shard_count * 20))
    self.chart_url = chart.display.Url(self.chart_width, 200)
481021
public void setShards(java.util.Collection<Shard> shards) {
        if (shards == null) {
            this.shards = null;
            return;
        }

        this.shards = new java.util.ArrayList<Shard>(shards);
    }
149784
private static <E> Counter<Integer> collectCountCounts(Counter<E> counts) {
    Counter<Integer> cc = new ClassicCounter<Integer>(); // counts of counts
    for (Map.Entry<E, Double> entry : counts.entrySet()) {
      //E item = entry.getKey();
      Integer count = (int) Math.round(entry.getValue());
      cc.incrementCount(count);
    }
    return cc;
  }
1160878
def increment(self, counter_name, delta=1):
    
    self._shard_state.counters_map.increment(counter_name, delta)
188804
public void incrementCount2D(K first, K second, double count) {
    if (depth != 2) {
      wrongDepth(); //throws exception
    }

    this.addToTotal(count);
    GeneralizedCounter<K> next = this.conditionalizeHelper(first);
    next.incrementCount1D(second, count);
  }
1111554
public void count(final Stat name, final int count) {
        Integer value = counters.get(name);
        value = value == null ? count : value + count;
        counters.put(name, value);
    }
1332451
def shard_id(self):
        """"""
        count = self._state.shard_count
        if count is None:
            return None
        return (self.id >> 22) % count
1120592
def set_column_count(self, count):
        
        current_row_count = self.row_count()
        current_column_count = self.column_count()
        if count > current_column_count:
            cl = TableEditableItem if self._editable else TableItem
            for r_key in self.children.keys():
                row = self.children[r_key]
                for i in range(current_column_count, count):
                    row.append(cl(), str(i))
                    if self._editable:
                        row.children[str(i)].onchange.connect(
                            self.on_item_changed, int(r_key), int(i))
            self._update_first_row()
        elif count < current_column_count:
            for row in self.children.values():
                for i in range(count, current_column_count):
                    row.remove_child(row.children[str(i)])
        self._column_count = count
350
private void countPropertyReference(UsageStatistics usageStatistics,
			PropertyIdValue property, int count) {
		addPropertyCounters(usageStatistics, property);
		usageStatistics.propertyCountsReferences.put(property,
				usageStatistics.propertyCountsReferences.get(property) + count);
	}
1003771
public void appendPlaceholder(final ShardingPlaceholder shardingPlaceholder) {
        segments.add(shardingPlaceholder);
        currentSegment = new StringBuilder();
        segments.add(currentSegment);
    }
125947
@Nullable
    private TableReportEntryTable convertToTableReportEntryTable(
            String tableId,  Map<String, Object> map, Predicate<String> placementFilter,
            Predicate<Boolean> droppedFilter, Predicate<Boolean> facadeFilter) {

        // Check the filters for placement, dropped, and facade

        String placement = (String) map.get("placement");
        if (!placementFilter.apply(placement)) {
            return null;
        }

        Boolean dropped = Objects.firstNonNull((Boolean) map.get("dropped"), false);
        if (!droppedFilter.apply(dropped)) {
            return null;
        }

        Boolean facade = Objects.firstNonNull((Boolean) map.get("facade"), false);
        if (!facadeFilter.apply(facade)) {
            return null;
        }

        List<Integer> shards = Lists.newArrayList();

        // Aggregate the column, size and update statistics across all shards.

        TableStatistics.Aggregator aggregator = TableStatistics.newAggregator();

        Object shardJson = map.get("shards");

        if (shardJson != null) {
            Map<String, TableStatistics> shardMap = JsonHelper.convert(
                    shardJson, new TypeReference<Map<String, TableStatistics>>() {
            });

            for (Map.Entry<String, TableStatistics> entry : shardMap.entrySet()) {
                Integer shardId = Integer.parseInt(entry.getKey());
                shards.add(shardId);
                aggregator.add(entry.getValue());
            }
        }

        TableStatistics tableStatistics = aggregator.aggregate();
        Collections.sort(shards);

        return new TableReportEntryTable(tableId, placement, shards, dropped, facade, tableStatistics.getRecordCount(),
                tableStatistics.getColumnStatistics().toStatistics(),
                tableStatistics.getSizeStatistics().toStatistics(),
                tableStatistics.getUpdateTimeStatistics().toStatistics());
    }
586570
def incr_doc_count(klass, count)
      klass = klass.to_s
      doc_count = @cassandra.get(:totals, klass, "doc_count").values.last.to_i
      doc_count += count
      @cassandra.insert(:totals, klass, {"doc_count" => doc_count.to_s})
      @klass_doc_counts[klass.to_sym] = doc_count
    end
1339020
public void setCounts(Collection<E> keys, int count) {
    for (E key : keys) {
      setCount(key, count);
    }
  }
1262239
public int countCurrentDockerSlaves(final DockerSlaveTemplate template) throws Exception {
        int count = 0;
        List<Container> containers = getClient().listContainersCmd().exec();

        for (Container container : containers) {
            final Map<String, String> labels = container.getLabels();

            if (labels.containsKey(DOCKER_CLOUD_LABEL) && labels.get(DOCKER_CLOUD_LABEL).equals(getDisplayName())) {
                if (template == null) {
                    // count only total cloud capacity
                    count++;
                } else if (labels.containsKey(DOCKER_TEMPLATE_LABEL) &&
                        labels.get(DOCKER_TEMPLATE_LABEL).equals(template.getId())) {
                    count++;
                }
            }
        }

        return count;
    }
1320547
public HSlicePredicate<N> setCount(int count) {
    this.count = count;
    countSet = true;
    predicateType = PredicateType.Range;
    return this;
  }