### Question:
DataFlagEncoder extends AbstractFlagEncoder { @Override public long setAccess(long flags, boolean forward, boolean backward) { boolean isForward = isBit0Empty(flags); if (!isForward) { boolean tmp = forward; forward = backward; backward = tmp; } flags = forward ? flags | forwardBit : flags & ~forwardBit; flags = backward ? flags | backwardBit : flags & ~backwardBit; return flags; } DataFlagEncoder();  DataFlagEncoder(PMap properties);  DataFlagEncoder(int speedBits, double speedFactor, int maxTurnCosts); @Override int defineWayBits(int index, int shift); @Override long handleRelationTags(ReaderRelation relation, long oldRelationFlags); @Override long acceptWay(ReaderWay way); AccessValue getAccessValue(long flags); @Override long handleWayTags(ReaderWay way, long allowed, long relationFlags); static double stringToTons(String value); static double stringToMeter(String value); int getSpatialId(long flags); long setSpatialId(long flags, int id); @Override long reverseFlags(long flags); int getHighway(EdgeIteratorState edge); String getHighwayAsString(EdgeIteratorState edge); int getSurface(EdgeIteratorState edge); String getSurfaceAsString(EdgeIteratorState edge); int getTransportMode(EdgeIteratorState edge); boolean isTransportModeTunnel(EdgeIteratorState edge); boolean isTransportModeBridge(EdgeIteratorState edge); boolean isTransportModeFord(long flags); String getTransportModeAsString(EdgeIteratorState edge); double[] getTransportModeMap(Map<String, Double> map); boolean isRoundabout(EdgeIteratorState edge); int getAccessType(String accessStr); final boolean isForward(EdgeIteratorState edge, int accessType); @Override final boolean isForward(long flags); final boolean isBackward(EdgeIteratorState edge, int accessType); @Override final boolean isBackward(long flags); double getMaxspeed(EdgeIteratorState edge, int accessType, boolean reverse); double getHeight(EdgeIteratorState edge); double getWeight(EdgeIteratorState edge); double getWidth(EdgeIteratorState edge); @Override long flagsDefault(boolean forward, boolean backward); @Override long setAccess(long flags, boolean forward, boolean backward); @Override long setSpeed(long flags, double speed); @Override double getSpeed(long flags); @Override long setReverseSpeed(long flags, double speed); @Override double getReverseSpeed(long flags); @Override long setProperties(double speed, boolean forward, boolean backward); @Override double getMaxSpeed(); double getMaxPossibleSpeed(); @Override boolean supports(Class<?> feature); DataFlagEncoder setStoreHeight(boolean storeHeight); boolean isStoreHeight(); DataFlagEncoder setStoreWeight(boolean storeWeight); boolean isStoreWeight(); DataFlagEncoder setStoreWidth(boolean storeWidth); boolean isStoreWidth(); DataFlagEncoder setSpatialRuleLookup(SpatialRuleLookup spatialRuleLookup); @Override InstructionAnnotation getAnnotation(long flags, Translation tr); @Override int getVersion(); @Override String toString(); WeightingConfig createWeightingConfig(PMap pMap);  }### Answer:
@Test public void setAccess() { Graph graph = new GraphBuilder(encodingManager).create(); EdgeIteratorState edge = graph.edge(0, 1); edge.setFlags(encoder.setAccess(edge.getFlags(), true, true)); assertTrue(encoder.isForward(edge, motorVehicleInt)); assertTrue(encoder.isBackward(edge, motorVehicleInt)); edge.setFlags(encoder.setAccess(edge.getFlags(), true, false)); assertTrue(encoder.isForward(edge, motorVehicleInt)); assertFalse(encoder.isBackward(edge, motorVehicleInt)); edge = edge.detach(true); assertFalse(encoder.isForward(edge, motorVehicleInt)); assertTrue(encoder.isBackward(edge, motorVehicleInt)); edge = edge.detach(true); assertTrue(encoder.isForward(edge, motorVehicleInt)); assertFalse(encoder.isBackward(edge, motorVehicleInt)); edge.setFlags(encoder.setAccess(edge.getFlags(), false, false)); assertFalse(encoder.isForward(edge, motorVehicleInt)); assertFalse(encoder.isBackward(edge, motorVehicleInt)); }