test_class.declarator: dc = new DateCalculator()
test_class.modifier: private final
test_class.original_string: private final DateCalculator dc = new DateCalculator();
test_class.type: DateCalculator
test_class.var_name: dc
test_class.file: Chapter04/datecalc-lib/src/test/java/com/steeplesoft/datecalc/DateCalculatorTest.java
test_class.identifier: DateCalculatorTest
test_case.body: @Test
      public void testDateMath() {
          final String expression = "today + 2 weeks 3 days";
          DateCalculatorResult result = dc.calculate(expression);
          Assert.assertNotNull(result.getDate().get(), "'" + expression + "' should have returned a result.");
      }
test_case.class_method_signature: DateCalculatorTest.testDateMath()
test_case.full_signature: @Test public void testDateMath()
test_case.identifier: testDateMath
test_case.invocations: calculate assertNotNull get getDate
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testDateMath()
focal_class.file: Chapter04/datecalc-lib/src/main/java/com/steeplesoft/datecalc/DateCalculator.java
focal_class.identifier: DateCalculator
focal_class.class_method_signature: DateCalculator.calculate(String text)
focal_class.full_signature: public DateCalculatorResult calculate(String text)
focal_class.identifier: calculate
focal_class.modifiers: public
focal_class.parameters: (String text)
focal_class.return: DateCalculatorResult
focal_class.signature: DateCalculatorResult calculate(String text)
focal_class.class_method_signature: DateCalculator.handleDateExpression(final Queue<Token> tokens)
focal_class.full_signature: private DateCalculatorResult handleDateExpression(final Queue<Token> tokens)
focal_class.identifier: handleDateExpression
focal_class.modifiers: private
focal_class.parameters: (final Queue<Token> tokens)
focal_class.return: DateCalculatorResult
focal_class.signature: DateCalculatorResult handleDateExpression(final Queue<Token> tokens)
focal_class.class_method_signature: DateCalculator.handleTimeExpression(final Queue<Token> tokens)
focal_class.full_signature: private DateCalculatorResult handleTimeExpression(final Queue<Token> tokens)
focal_class.identifier: handleTimeExpression
focal_class.modifiers: private
focal_class.parameters: (final Queue<Token> tokens)
focal_class.return: DateCalculatorResult
focal_class.signature: DateCalculatorResult handleTimeExpression(final Queue<Token> tokens)
focal_class.class_method_signature: DateCalculator.doTimeMath(final OperatorToken operatorToken, final TimeToken startTimeToken, final Queue<Token> tokens)
focal_class.full_signature: private DateCalculatorResult doTimeMath(final OperatorToken operatorToken, final TimeToken startTimeToken, final Queue<Token> tokens)
focal_class.identifier: doTimeMath
focal_class.modifiers: private
focal_class.parameters: (final OperatorToken operatorToken, final TimeToken startTimeToken, final Queue<Token> tokens)
focal_class.return: DateCalculatorResult
focal_class.signature: DateCalculatorResult doTimeMath(final OperatorToken operatorToken, final TimeToken startTimeToken, final Queue<Token> tokens)
focal_class.class_method_signature: DateCalculator.getTimeDiff(final OperatorToken operatorToken, final TimeToken startTimeToken, final Token thirdToken)
focal_class.full_signature: private DateCalculatorResult getTimeDiff(final OperatorToken operatorToken, final TimeToken startTimeToken, final Token thirdToken)
focal_class.identifier: getTimeDiff
focal_class.modifiers: private
focal_class.parameters: (final OperatorToken operatorToken, final TimeToken startTimeToken, final Token thirdToken)
focal_class.return: DateCalculatorResult
focal_class.signature: DateCalculatorResult getTimeDiff(final OperatorToken operatorToken, final TimeToken startTimeToken, final Token thirdToken)
focal_class.class_method_signature: DateCalculator.getDateDiff(final DateToken startDateToken, final Token thirdToken)
focal_class.full_signature: private DateCalculatorResult getDateDiff(final DateToken startDateToken, final Token thirdToken)
focal_class.identifier: getDateDiff
focal_class.modifiers: private
focal_class.parameters: (final DateToken startDateToken, final Token thirdToken)
focal_class.return: DateCalculatorResult
focal_class.signature: DateCalculatorResult getDateDiff(final DateToken startDateToken, final Token thirdToken)
focal_class.class_method_signature: DateCalculator.performDateMath(final DateToken startDateToken, final OperatorToken operatorToken,
              final Queue<Token> tokens)
focal_class.full_signature: private DateCalculatorResult performDateMath(final DateToken startDateToken, final OperatorToken operatorToken,
              final Queue<Token> tokens)
focal_class.identifier: performDateMath
focal_class.modifiers: private
focal_class.parameters: (final DateToken startDateToken, final OperatorToken operatorToken,
              final Queue<Token> tokens)
focal_class.return: DateCalculatorResult
focal_class.signature: DateCalculatorResult performDateMath(final DateToken startDateToken, final OperatorToken operatorToken,
              final Queue<Token> tokens)
focal_class.class_method_signature: DateCalculator.validateToken(final Token token, final Class<? extends Token> expected)
focal_class.full_signature: private void validateToken(final Token token, final Class<? extends Token> expected)
focal_class.identifier: validateToken
focal_class.modifiers: private
focal_class.parameters: (final Token token, final Class<? extends Token> expected)
focal_class.return: void
focal_class.signature: void validateToken(final Token token, final Class<? extends Token> expected)
focal_class.class_method_signature: DateCalculator.assertThat(boolean isTrue, String message)
focal_class.full_signature: private void assertThat(boolean isTrue, String message)
focal_class.identifier: assertThat
focal_class.modifiers: private
focal_class.parameters: (boolean isTrue, String message)
focal_class.return: void
focal_class.signature: void assertThat(boolean isTrue, String message)
focal_method.body: public DateCalculatorResult calculate(String text) {
          final DateCalcExpressionParser parser = new DateCalcExpressionParser();
          final Queue<Token> tokens = parser.parse(text);
  
          try {
              if (!tokens.isEmpty()) {
                  if (tokens.peek() instanceof DateToken) {
                      return handleDateExpression(tokens);
                  } else if (tokens.peek() instanceof TimeToken) {
                      return handleTimeExpression(tokens);
                  }
              }
          } catch (UnsupportedTemporalTypeException utte) {
              throw new DateCalcException(utte.getLocalizedMessage());
          }
          throw new DateCalcException("An invalid expression was given: " + text);
      }
focal_method.class_method_signature: DateCalculator.calculate(String text)
focal_method.full_signature: public DateCalculatorResult calculate(String text)
focal_method.identifier: calculate
focal_method.invocations: parse isEmpty peek handleDateExpression peek handleTimeExpression getLocalizedMessage
focal_method.modifiers: public
focal_method.parameters: (String text)
focal_method.return: DateCalculatorResult
focal_method.signature: DateCalculatorResult calculate(String text)