/** * Defines the bits reserved for storing turn restriction and turn cost * <p> * * @param shift bit offset for the first bit used by this encoder * @return incremented shift value pointing behind the last used bit */ public int defineTurnBits(int index, int shift) { if (maxTurnCosts == 0) return shift; // optimization for turn restrictions only else if (maxTurnCosts == 1) { turnRestrictionBit = 1L << shift; return shift + 1; } int turnBits = Helper.countBitValue(maxTurnCosts); turnCostEncoder = new EncodedValue("TurnCost", shift, turnBits, 1, 0, maxTurnCosts) { // override to avoid expensive Math.round @Override public final long getValue(long flags) { // find value flags &= mask; flags >>>= shift; return flags; } }; return shift + turnBits; }
/** * Defines the bits reserved for storing turn restriction and turn cost * <p> * * @param shift bit offset for the first bit used by this encoder * @return incremented shift value pointing behind the last used bit */ public int defineTurnBits(int index, int shift) { if (maxTurnCosts == 0) return shift; // optimization for turn restrictions only else if (maxTurnCosts == 1) { turnRestrictionBit = 1L << shift; return shift + 1; } int turnBits = Helper.countBitValue(maxTurnCosts); turnCostEncoder = new EncodedValue("TurnCost", shift, turnBits, 1, 0, maxTurnCosts) { // override to avoid expensive Math.round @Override public final long getValue(long flags) { // find value flags &= mask; flags >>>= shift; return flags; } }; return shift + turnBits; }
/** * Defines the bits reserved for storing turn restriction and turn cost * <p> * * @param shift bit offset for the first bit used by this encoder * @return incremented shift value pointing behind the last used bit */ public int defineTurnBits(int index, int shift) { if (maxTurnCosts == 0) return shift; // optimization for turn restrictions only else if (maxTurnCosts == 1) { turnRestrictionBit = 1L << shift; return shift + 1; } int turnBits = Helper.countBitValue(maxTurnCosts); turnCostEncoder = new EncodedValue("TurnCost", shift, turnBits, 1, 0, maxTurnCosts) { // override to avoid expensive Math.round @Override public final long getValue(long flags) { // find value flags &= mask; flags >>>= shift; return flags; } }; return shift + turnBits; }
int turnBits = Helper.countBitValue(maxTurnCosts); turnCostEncoder = new EncodedValue("TurnCost", shift, turnBits, 1, 0, maxTurnCosts)