Eroxl's Notes
Call Graph

A call graph is a type of graph.md) that shows the relationships between different methods. Each node.md#Node) represents a method and each edge.md#Edge.md) (the lines on the graph.md)) represent that the method "A" calls method "B".

Example

Consider the following code

class JDayChooser {

   Calendar calendar;
   
   JDayChooser() {
      calendar = new Calendar();
      init();
   }

   void init() {
      drawDayNames();
      drawDays();
   }

   void drawDayNames() {
      int firstDayOfWeek = calendar.getFirstDayOfWeek();
   }

   void drawDays() { }
}

As is shown in the code the constructor JDayChooser calls both Calendar through the line calendar = new Calendar();, as well as init through the line init(); so they are both connected to the constructor.

Because Calendar is not in the package were analyzing we omit the sub calls of it so it has no arrows out of it. The next methods are called from init, which are the calls to drawDayNames and drawDays which both get arrows connecting them to init.

As is shown in the code drawDays doesn't call any other methods and drawDayNames calls Calendar.getFirstDayOfWeek with the code int firstDayOfWeek = calendar.getFirstDayOfWeek(); so it is connected to drawDayNames.