@Contract("_,true->!null")
  Segment getSegment(int id, boolean create) {
    int segmentIndex = segmentIndex(id);
    Segment segment = segments.get(segmentIndex);
    if (segment != null || !create) {
      return segment;
    }
    return segments.cacheOrGet(segmentIndex, new Segment(this));
  }
@Contract("_,true->!null")
  Segment getSegment(int id, boolean create)