@Override
    public String toString() {
        if (!this.hasFilter())
            return "graphfilter[none]";
        StringBuilder builder = new StringBuilder("graphfilter[");
        boolean needDelimiter = false;
        if (this.hasVertexFilter()) {
            builder.append(this.vertexFilter);
            needDelimiter = true;
        }
        if (this.hasEdgeFilter()) {
            if (needDelimiter) {
                builder.append(",");
            }
            builder.append(this.edgeFilter);
            needDelimiter = true;
        }
        if (this.hasVertexPropertyFilter()) {
            if (needDelimiter) {
                builder.append(",");
            }
            builder.append(this.vertexPropertyFilter);
        }
        return builder.append("]").toString();
    }
Get the legality of a particular edge direction.

@param direction the direction of the edge.
@return the {@link Legal} of the edge direction.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/computer/GraphFilter.java