@ SuppressWarnings ( "unchecked" ) @ Override protected boolean doFirst ( ListIterator < Step < ? , ? > > stepIterator , Step < ? , ? > step , MutableInt pathCount ) { if ( step instanceof SelectOneStep ) { if ( stepIterator . hasNext ( ) ) { stepIterator . next ( ) ; return true ; } else { return false ; } } if ( ! ( step instanceof VertexStep || step instanceof EdgeVertexStep || step instanceof ChooseStep || step instanceof OptionalStep ) ) { return false ; } if ( step instanceof OptionalStep ) { if ( unoptimizableOptionalStep ( ( OptionalStep < ? > ) step ) ) { return false ; } } if ( step instanceof ChooseStep ) { if ( unoptimizableChooseStep ( ( ChooseStep < ? , ? , ? > ) step ) ) { return false ; } } this . sqlgStep = constructSqlgStep ( step ) ; TraversalHelper . insertBeforeStep ( this . sqlgStep , step , this . traversal ) ; return true ; }
EdgeOtherVertexStep can not be optimized as the direction information is lost .