public boolean incrementFeatureValue()

in graphjet-core/src/main/java/com/twitter/graphjet/hashing/ArrayBasedIntToIntArrayMap.java [198:218]


  public boolean incrementFeatureValue(int key, byte edgeType) {
    if (edgeType == FAVORITE_ACTION || edgeType == RETWEET_ACTION || edgeType == REPLY_ACTION
      || edgeType == QUOTE_ACTION) {
      // Get the starting position of the key.
      int position = readerAccessibleInfo.nodeInfo.getFirstValue(key);
      int featurePosition = getFeaturePosition(position, edgeType);
      int incrementValue = getIncrementValue(edgeType);
      int currentEntry = readerAccessibleInfo.edges.getEntry(featurePosition);
      int currentFeatureValue = getFeatureValue(currentEntry, edgeType);

      // Prevent overflow. Skip counting when the feature value reaches overflow value.
      if (currentFeatureValue == INTEGER_TOP_TWO_BYTE_OVERFLOW) {
        return false;
      }

      readerAccessibleInfo.edges.incrementEntry(featurePosition, incrementValue);
      return true;
    }

    return false;
  }