private static Map < Class < ? extends CoreAnnotation > , Set < TreeGraphNode > > getAllDependents ( TreeGraphNode node ) { Map < Class < ? extends CoreAnnotation > , Set < TreeGraphNode > > newMap = Generics . newHashMap ( ) ; for ( Class < ? > o : node . label . keySet ( ) ) { try { // The line below will exception unless it's a GrammaticalRelationAnnotation, // so the effect is that only the GrammaticalRelationAnnotation things get put into newMap o . asSubclass ( GrammaticalRelationAnnotation . class ) ; newMap . put ( ( Class < ? extends CoreAnnotation > ) o , ( Set < TreeGraphNode > ) node . label . get ( ( Class < ? extends CoreAnnotation > ) o ) ) ; //javac doesn't compile properly if generics are fully specified (but eclipse does...) } catch ( Exception e ) { // ignore a non-GrammaticalRelationAnnotation element } } return newMap ; }
Returns all the dependencies of a certain node .