static void computeCallerMap(JsonElement jsonElt,boolean topLevel,Map<String,Map<String,Set<JsonElement>>> callerMap){
  JsonArray childrenArray=Utils.getChildrenArray(jsonElt);
  String sig=Utils.getFieldValueAsString(jsonElt,"signature");
  if (childrenArray != null) {
    for (int i=0; i < childrenArray.size(); i++) {
      JsonElement child=childrenArray.get(i);
      if (child.isJsonObject() && !Utils.isEmptyJsonObject(child)) {
        JsonObject childObj=child.getAsJsonObject();
        String childSig=Utils.getFieldValueAsString(childObj,"signature");
        if (!topLevel) {
          Map<String,Set<JsonElement>> callers=callerMap.get(childSig);
          if (callers == null) {
            callers=new HashMap<String,Set<JsonElement>>();
            callerMap.put(childSig,callers);
          }
          Set<JsonElement> calls=callers.get(sig);
          if (calls == null) {
            calls=new HashSet<JsonElement>();
            callers.put(sig,calls);
          }
          calls.add(jsonElt);
        }
        computeCallerMap(childObj,false,callerMap);
      }
    }
  }
}

static void computeCallerMap ( JsonElement jsonElt , boolean topLevel , Map < String , Map < String , Set < JsonElement > > > callerMap ) { JsonArray childrenArray = Utils . getChildrenArray ( jsonElt ) ; String sig = Utils . getFieldValueAsString ( jsonElt , "signature" ) ; if ( childrenArray != null ) { for ( int i = 0 ; i < childrenArray . size ( ) ; i ++ ) { JsonElement child = childrenArray . get ( i ) ; if ( child . isJsonObject ( ) && ! Utils . isEmptyJsonObject ( child ) ) { JsonObject childObj = child . getAsJsonObject ( ) ; String childSig = Utils . getFieldValueAsString ( childObj , "signature" ) ; if ( ! topLevel ) { Map < String , Set < JsonElement > > callers = callerMap . get ( childSig ) ; if ( callers == null ) { callers = new HashMap < String , Set < JsonElement > > ( ) ; callerMap . put ( childSig , callers ) ; } Set < JsonElement > calls = callers . get ( sig ) ; if ( calls == null ) { calls = new HashSet < JsonElement > ( ) ; callers . put ( sig , calls ) ; } calls . add ( jsonElt ) ; } computeCallerMap ( childObj , false , callerMap ) ; } } } }
processes a json element ( representing a caller in a source call graph ) and its children elements ( representing the callees ) , adds the corresponding calls to the caller map and do this recursively till the entire tree rooted at the json element is processed .
