class OSMTurnRelation {

    public Collection<TurnCostTableEntry> getRestrictionAsEntries(TurnCostEncoder encoder,
                                                                  EdgeExplorer edgeOutExplorer, EdgeExplorer edgeInExplorer, OSMReader osmReader) {
        int nodeVia = osmReader.getInternalNodeIdOfOsmNode(this.viaOsmNodeId);

        try {
            // street with restriction was not included (access or tag limits etc)
            if (nodeVia == OSMReader.EMPTY_NODE)
                return Collections.emptyList();

            int edgeIdFrom = EdgeIterator.NO_EDGE;

            // get all incoming edges and receive the edge which is defined by fromOsm
            EdgeIterator iter = edgeInExplorer.setBaseNode(nodeVia);

            while (iter.next()) {
                if (osmReader.getOsmIdOfInternalEdge(iter.getEdge()) == this.fromOsmWayId) {
                    edgeIdFrom = iter.getEdge();
                    break;
                }
            }

            if (edgeIdFrom == EdgeIterator.NO_EDGE)
                return Collections.emptyList();

            final Collection<TurnCostTableEntry> entries = new ArrayList<TurnCostTableEntry>();
            // get all outgoing edges of the via node
            iter = edgeOutExplorer.setBaseNode(nodeVia);
            // for TYPE_ONLY_* we add ALL restrictions (from, via, * ) EXCEPT the given turn
            // for TYPE_NOT_*  we add ONE restriction  (from, via, to)
            while (iter.next()) {
                int edgeId = iter.getEdge();
                long wayId = osmReader.getOsmIdOfInternalEdge(edgeId);
                if (edgeId != edgeIdFrom && this.restriction == Type.ONLY && wayId != this.toOsmWayId
                        || this.restriction == Type.NOT && wayId == this.toOsmWayId && wayId >= 0) {
                    final TurnCostTableEntry entry = new TurnCostTableEntry();
                    entry.nodeVia = nodeVia;
                    entry.edgeFrom = edgeIdFrom;
                    entry.edgeTo = iter.getEdge();
                    entry.flags = encoder.getTurnFlags(true, 0);
                    entries.add(entry);

                    if (this.restriction == Type.NOT)
                        break;
                }
            }
            return entries;
        } catch (Exception e) {
            throw new IllegalStateException("Could not built turn table entry for relation of node with osmId:" + this.viaOsmNodeId, e);
        }
    }

      OSMTurnRelation(long fromWayID, long viaNodeID, long toWayID, Type restrictionType);

}