Java Code Examples for org.apache.commons.lang3.tuple.MutablePair#getKey()

The following examples show how to use org.apache.commons.lang3.tuple.MutablePair#getKey() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommentsNodeImpl.java    From Diorite with MIT License 6 votes vote down vote up
@Override
@Nullable
public String getComment(String path)
{
    MutablePair<String, CommentsNodeImpl> nodePair = this.dataMap.get(path);
    if (nodePair != null)
    {
        String comment = nodePair.getLeft();
        if (comment != null)
        {
            return comment;
        }
    }
    MutablePair<String, CommentsNodeImpl> anyNodePair = this.dataMap.get(ANY);
    if (anyNodePair != null)
    {
        return anyNodePair.getKey();
    }
    return null;
}
 
Example 2
Source File: OperatorUtil.java    From doctorkafka with Apache License 2.0 5 votes vote down vote up
public static MutablePair<Double, Double> getSysNetworkTraffic(long samplingWindowInMs)
    throws Exception {
  MutablePair<Long, Long> startNumbers = getProcNetDevStats();
  Thread.sleep(samplingWindowInMs);
  MutablePair<Long, Long> endNumbers = getProcNetDevStats();

  double inRate = (endNumbers.getKey() - startNumbers.getKey()) * 1000.0 / samplingWindowInMs;
  double outRate =
      (endNumbers.getValue() - startNumbers.getValue()) * 1000.0 / samplingWindowInMs;
  MutablePair<Double, Double> result = new MutablePair<>(inRate, outRate);
  return result;
}