code: public boolean getCritical()
     {
        Boolean critical = (Boolean) getCachedValue(TaskField.CRITICAL);
        if (critical == null)
        {
           Duration totalSlack = getTotalSlack();
           ProjectProperties props = getParentFile().getProjectProperties();
           int criticalSlackLimit = NumberHelper.getInt(props.getCriticalSlackLimit());
           if (criticalSlackLimit != 0 && totalSlack.getDuration() != 0 && totalSlack.getUnits() != TimeUnit.DAYS)
           {
              totalSlack = totalSlack.convertUnits(TimeUnit.DAYS, props);
           }
           critical = Boolean.valueOf(totalSlack.getDuration() <= criticalSlackLimit && NumberHelper.getInt(getPercentageComplete()) != 100 && ((getTaskMode() == TaskMode.AUTO_SCHEDULED) || (getDurationText() == null && getStartText() == null && getFinishText() == null)));
           set(TaskField.CRITICAL, critical);
        }
        return (BooleanHelper.getBoolean(critical));
     }
docs: The Critical field indicates whether a task has any room in the schedule
  to slip, or if a task is on the critical path. The Critical field contains
  Yes if the task is critical and No if the task is not critical.
  
  @return boolean