@ Override public void enterGraph ( GDLParser . GraphContext graphContext ) { inGraph = true ; String variable = getVariable ( graphContext . header ( ) ) ; Graph g ; if ( variable != null && userGraphCache . containsKey ( variable ) ) { g = userGraphCache . get ( variable ) ; } else { g = initNewGraph ( graphContext ) ; if ( variable != null ) { userGraphCache . put ( variable , g ) ; } else { variable = String . format ( ANONYMOUS_GRAPH_VARIABLE , g . getId ( ) ) ; autoGraphCache . put ( variable , g ) ; } g . setVariable ( variable ) ; graphs . add ( g ) ; } currentGraphId = g . getId ( ) ; }
Called when parser enters a graph context .