code: private void populateCompartmentOccurencesMap(Glyph targetGlyph,  HashMap<String, Integer> compartmentIDandOccurenceMap)
      {
          String rootID = "root";
  
          // if compartment ref of targetGlyph node is not null, increment its occurence by 1
          if(targetGlyph.getCompartmentRef() != null)
          {
              Glyph  containerCompartment = (Glyph)targetGlyph.getCompartmentRef();
              String compartmentID = containerCompartment.getId();
              Integer compartmentOccurrenceValue = compartmentIDandOccurenceMap.get(compartmentID);
  
              if( compartmentOccurrenceValue != null)
              {
                  compartmentIDandOccurenceMap.put(compartmentID, compartmentOccurrenceValue + 1);
              }
              else
                  compartmentIDandOccurenceMap.put(compartmentID, 1);
          }
          // else targetGlyph is in root graph so increment root graphs counter value by 1
          else
          {
              Integer compartmentOccurrenceValue = compartmentIDandOccurenceMap.get(rootID);
  
              if( compartmentOccurrenceValue != null)
              {
                  compartmentIDandOccurenceMap.put(rootID, compartmentOccurrenceValue + 1);
              }
              else
                  compartmentIDandOccurenceMap.put(rootID, 1);
          }
      }
docs: Updates a hashmap by incrementing the number of nodes in the compartment glyph that includes targetGlyph.
  It is assumed that given hashmap includes compartment ids' as keys and number of nodes as values.This method
  is an utility method that will be used to populate a hashmap while determining the compartment node of a process
  node by majority rule.
  
  @param targetGlyph glyph whose occurence will be updated in the given hashmap.
  @param compartmentIDandOccurenceMap  Map that references number of nodes in a compartment by compartment ids .