public void handleWayTags(int edgeId, EdgeIntAccess edgeIntAccess, ReaderWay way, IntsRef relationFlags) {
        // tagging like maxweight:conditional=no/none @ destination/delivery/forestry/service
        String condValue = way.getTag("maxweight:conditional", "");
        if (!condValue.isEmpty()) {
            String[] values = condValue.split("@");
            if (values.length == 2) {
                String key = values[0].trim();
                String value = values[1].trim();
                if ("no".equals(key) || "none".equals(key)) {
                    if (value.startsWith("(") && value.endsWith(")")) value = value.substring(1, value.length() - 1);
                    mweEnc.setEnum(false, edgeId, edgeIntAccess, MaxWeightExcept.find(value));
                    return;
                }
            }
        }

        // For tagging like vehicle:conditional=destination @ (weight>3.5) AND maxweight=3.5
        // For vehicle:conditional=no @ (weight>3.5) => NONE is used, which is consistent with max_weight being set to 3.5 in this case
        for (String restriction : HGV_RESTRICTIONS) {
            String value = way.getTag(restriction, "");
            int atIndex = value.indexOf("@");
            if (atIndex > 0) {
                double dec = OSMValueExtractor.conditionalWeightToTons(value);
                // set it only if the weight value is the same as in max_weight
                if (!Double.isNaN(dec)
                        && (stringToTons(way.getTag("maxweight", "")) == dec
                        || stringToTons(way.getTag("maxweightrating:hgv", "")) == dec
                        || stringToTons(way.getTag("maxgcweight", "")) == dec)) {
                    mweEnc.setEnum(false, edgeId, edgeIntAccess, MaxWeightExcept.find(value.substring(0, atIndex).trim()));
                    break;
                }
            }
        }
    }
@Test
    public void testConditionalTags() {
        EdgeIntAccess edgeIntAccess = new ArrayEdgeIntAccess(1);
        ReaderWay readerWay = new ReaderWay(1);
        readerWay.setTag("highway", "primary");
        readerWay.setTag("hgv:conditional", "no @ (weight > 7.5)");
        parser.handleWayTags(edgeId, edgeIntAccess, readerWay, relFlags);
        assertEquals(MaxWeightExcept.NONE, mwEnc.getEnum(false, edgeId, edgeIntAccess));

        // weight=5 is missing
        edgeIntAccess = new ArrayEdgeIntAccess(1);
        readerWay.clearTags();
        readerWay.setTag("highway", "primary");
        readerWay.setTag("vehicle:conditional", "delivery @ (weight > 5)");
        parser.handleWayTags(edgeId, edgeIntAccess, readerWay, relFlags);
        assertEquals(MaxWeightExcept.NONE, mwEnc.getEnum(false, edgeId, edgeIntAccess));

        edgeIntAccess = new ArrayEdgeIntAccess(1);
        readerWay.clearTags();
        readerWay.setTag("highway", "primary");
        readerWay.setTag("vehicle:conditional", "delivery @ (weight > 7.5)");
        readerWay.setTag("maxweight", "7.5");
        parser.handleWayTags(edgeId, edgeIntAccess, readerWay, relFlags);
        assertEquals(MaxWeightExcept.DELIVERY, mwEnc.getEnum(false, edgeId, edgeIntAccess));

        edgeIntAccess = new ArrayEdgeIntAccess(1);
        readerWay.clearTags();
        readerWay.setTag("highway", "primary");
        readerWay.setTag("hgv:conditional", "destination @ (maxweight > 5)");
        readerWay.setTag("maxweight", "5");
        parser.handleWayTags(edgeId, edgeIntAccess, readerWay, relFlags);
        assertEquals(MaxWeightExcept.DESTINATION, mwEnc.getEnum(false, edgeId, edgeIntAccess));
    }