public void label(Way way,EnumSet<EdgeStore.EdgeFlag> forwardFlags,EnumSet<EdgeStore.EdgeFlag> backFlags){
  if (!forwardFlags.contains(EdgeStore.EdgeFlag.ALLOWS_CAR) && !backFlags.contains(EdgeStore.EdgeFlag.ALLOWS_CAR)) {
    forwardFlags.add(EdgeStore.EdgeFlag.BIKE_LTS_1);
    backFlags.add(EdgeStore.EdgeFlag.BIKE_LTS_1);
    return;
  }
  if (way.hasTag("highway","service"))   return;
  if (way.hasTag("highway","residential") || way.hasTag("highway","living_street")) {
    forwardFlags.add(EdgeStore.EdgeFlag.BIKE_LTS_1);
    backFlags.add(EdgeStore.EdgeFlag.BIKE_LTS_1);
    return;
  }
  boolean hasForwardLane=false;
  boolean hasBackwardLane=false;
  if (way.hasTag("cycleway","lane")) {
    hasForwardLane=hasBackwardLane=true;
  }
  if (way.hasTag("cycleway:left","lane") || way.hasTag("cycleway","opposite") || way.hasTag("cycleway:right","opposite")) {
    hasBackwardLane=true;
  }
  if (way.hasTag("cycleway:left","opposite") || way.hasTag("cycleway:right","lane")) {
    hasForwardLane=true;
  }
  double maxSpeed=Double.NaN;
  if (way.hasTag("maxspeed")) {
    maxSpeed=getSpeedKmh(way.getTag("maxspeed"));
    if (Double.isNaN(maxSpeed)) {
      LOG.warn("Unable to parse maxspeed tag {}",way.getTag("maxspeed"));
    }
  }
  int lanes=Integer.MAX_VALUE;
  if (way.hasTag("lanes")) {
    try {
      lanes=Integer.parseInt(way.getTag("lanes"));
    }
 catch (    NumberFormatException e) {
      LOG.warn("Unable to parse lane specification {}",way.getTag("lanes"));
    }
  }
  EdgeStore.EdgeFlag defaultLts=EdgeStore.EdgeFlag.BIKE_LTS_3;
  if (lanes <= 3 && maxSpeed <= 25 * 1.61)   defaultLts=EdgeStore.EdgeFlag.BIKE_LTS_2;
  if (lanes == Integer.MAX_VALUE && maxSpeed <= 25 * 1.61)   defaultLts=EdgeStore.EdgeFlag.BIKE_LTS_2;
  if (way.hasTag("highway","unclassified") || way.hasTag("highway","tertiary") || way.hasTag("highway","tertiary_link")) {
    if (lanes <= 3 && Double.isNaN(maxSpeed))     defaultLts=EdgeStore.EdgeFlag.BIKE_LTS_2;
    if (hasForwardLane) {
      forwardFlags.add(EdgeStore.EdgeFlag.BIKE_LTS_2);
    }
 else {
      forwardFlags.add(defaultLts);
    }
    if (hasBackwardLane) {
      backFlags.add(EdgeStore.EdgeFlag.BIKE_LTS_2);
    }
 else {
      backFlags.add(defaultLts);
    }
  }
 else {
    if (hasForwardLane) {
      forwardFlags.add(defaultLts);
    }
    if (hasBackwardLane) {
      backFlags.add(defaultLts);
    }
  }
  if (!forwardFlags.contains(EdgeStore.EdgeFlag.BIKE_LTS_1) && !forwardFlags.contains(EdgeStore.EdgeFlag.BIKE_LTS_2) && !forwardFlags.contains(EdgeStore.EdgeFlag.BIKE_LTS_3)&& !forwardFlags.contains(EdgeStore.EdgeFlag.BIKE_LTS_4))   forwardFlags.add(EdgeStore.EdgeFlag.BIKE_LTS_4);
  if (!backFlags.contains(EdgeStore.EdgeFlag.BIKE_LTS_1) && !backFlags.contains(EdgeStore.EdgeFlag.BIKE_LTS_2) && !backFlags.contains(EdgeStore.EdgeFlag.BIKE_LTS_3)&& !backFlags.contains(EdgeStore.EdgeFlag.BIKE_LTS_4))   backFlags.add(EdgeStore.EdgeFlag.BIKE_LTS_4);
}

public void label ( Way way , EnumSet < EdgeStore . EdgeFlag > forwardFlags , EnumSet < EdgeStore . EdgeFlag > backFlags ) { if ( ! forwardFlags . contains ( EdgeStore . EdgeFlag . ALLOWS_CAR ) && ! backFlags . contains ( EdgeStore . EdgeFlag . ALLOWS_CAR ) ) { forwardFlags . add ( EdgeStore . EdgeFlag . BIKE_LTS_1 ) ; backFlags . add ( EdgeStore . EdgeFlag . BIKE_LTS_1 ) ; return ; } if ( way . hasTag ( "highway" , "service" ) ) return ; if ( way . hasTag ( "highway" , "residential" ) || way . hasTag ( "highway" , "living_street" ) ) { forwardFlags . add ( EdgeStore . EdgeFlag . BIKE_LTS_1 ) ; backFlags . add ( EdgeStore . EdgeFlag . BIKE_LTS_1 ) ; return ; } boolean hasForwardLane = false ; boolean hasBackwardLane = false ; if ( way . hasTag ( "cycleway" , "lane" ) ) { hasForwardLane = hasBackwardLane = true ; } if ( way . hasTag ( "cycleway:left" , "lane" ) || way . hasTag ( "cycleway" , "opposite" ) || way . hasTag ( "cycleway:right" , "opposite" ) ) { hasBackwardLane = true ; } if ( way . hasTag ( "cycleway:left" , "opposite" ) || way . hasTag ( "cycleway:right" , "lane" ) ) { hasForwardLane = true ; } double maxSpeed = Double . NaN ; if ( way . hasTag ( "maxspeed" ) ) { maxSpeed = getSpeedKmh ( way . getTag ( "maxspeed" ) ) ; if ( Double . isNaN ( maxSpeed ) ) { LOG . warn ( "Unable to parse maxspeed tag {}" , way . getTag ( "maxspeed" ) ) ; } } int lanes = Integer . MAX_VALUE ; if ( way . hasTag ( "lanes" ) ) { try { lanes = Integer . parseInt ( way . getTag ( "lanes" ) ) ; } catch ( NumberFormatException e ) { LOG . warn ( "Unable to parse lane specification {}" , way . getTag ( "lanes" ) ) ; } } EdgeStore . EdgeFlag defaultLts = EdgeStore . EdgeFlag . BIKE_LTS_3 ; if ( lanes <= 3 && maxSpeed <= 25 * 1.61 ) defaultLts = EdgeStore . EdgeFlag . BIKE_LTS_2 ; if ( lanes == Integer . MAX_VALUE && maxSpeed <= 25 * 1.61 ) defaultLts = EdgeStore . EdgeFlag . BIKE_LTS_2 ; if ( way . hasTag ( "highway" , "unclassified" ) || way . hasTag ( "highway" , "tertiary" ) || way . hasTag ( "highway" , "tertiary_link" ) ) { if ( lanes <= 3 && Double . isNaN ( maxSpeed ) ) defaultLts = EdgeStore . EdgeFlag . BIKE_LTS_2 ; if ( hasForwardLane ) { forwardFlags . add ( EdgeStore . EdgeFlag . BIKE_LTS_2 ) ; } else { forwardFlags . add ( defaultLts ) ; } if ( hasBackwardLane ) { backFlags . add ( EdgeStore . EdgeFlag . BIKE_LTS_2 ) ; } else { backFlags . add ( defaultLts ) ; } } else { if ( hasForwardLane ) { forwardFlags . add ( defaultLts ) ; } if ( hasBackwardLane ) { backFlags . add ( defaultLts ) ; } } if ( ! forwardFlags . contains ( EdgeStore . EdgeFlag . BIKE_LTS_1 ) && ! forwardFlags . contains ( EdgeStore . EdgeFlag . BIKE_LTS_2 ) && ! forwardFlags . contains ( EdgeStore . EdgeFlag . BIKE_LTS_3 ) && ! forwardFlags . contains ( EdgeStore . EdgeFlag . BIKE_LTS_4 ) ) forwardFlags . add ( EdgeStore . EdgeFlag . BIKE_LTS_4 ) ; if ( ! backFlags . contains ( EdgeStore . EdgeFlag . BIKE_LTS_1 ) && ! backFlags . contains ( EdgeStore . EdgeFlag . BIKE_LTS_2 ) && ! backFlags . contains ( EdgeStore . EdgeFlag . BIKE_LTS_3 ) && ! backFlags . contains ( EdgeStore . EdgeFlag . BIKE_LTS_4 ) ) backFlags . add ( EdgeStore . EdgeFlag . BIKE_LTS_4 ) ; }
set the lts for this way in the provided flags ( not taking into account any intersection lts at the moment )
