1 00:00:00,490 --> 00:00:04,232 I'm back in our workspaces project and we're ready to use our doc annotation and 2 00:00:04,232 --> 00:00:05,287 the MathUtils class. 3 00:00:05,287 --> 00:00:10,453 First, we'll need to import the annotation itself, 4 00:00:10,453 --> 00:00:14,847 import com.teamtreehouse.docgen.Doc. 5 00:00:14,847 --> 00:00:18,020 We'll start by applying the annotation to the class itself. 6 00:00:18,020 --> 00:00:21,610 And in this annotation, we'll need to include just a description since 7 00:00:21,610 --> 00:00:24,850 parameters and return types will not apply to the class. 8 00:00:25,900 --> 00:00:28,530 You can list the annotation on separate lines if you'd like to keep it well 9 00:00:28,530 --> 00:00:29,560 formatted. 10 00:00:29,560 --> 00:00:35,980 I'll say that this is a Utility class for commonly used math functions. 11 00:00:38,130 --> 00:00:41,505 Notice that I've had to explicitly list D-E-S-C. 12 00:00:42,590 --> 00:00:46,620 Remember, the only time you can omit the element name is when the element name 13 00:00:46,620 --> 00:00:48,770 is exactly value. 14 00:00:48,770 --> 00:00:52,810 Now, let's add some annotations to a few methods and make some of them incomplete 15 00:00:52,810 --> 00:00:56,910 just to verify that our tool is able to catch both successes and failures. 16 00:00:58,480 --> 00:01:03,170 For the triangle area method, I'll include a description for only one parameter. 17 00:01:03,170 --> 00:01:07,600 So include our doc annotation, I'll put this on three separate lines. 18 00:01:07,600 --> 00:01:14,660 For the description, I'll write that it calculates the area of a triangle. 19 00:01:14,660 --> 00:01:15,640 I'll abbreviate here. 20 00:01:16,720 --> 00:01:21,300 For the parameters, again, I will include a description for just one parameter. 21 00:01:21,300 --> 00:01:24,808 And again, our params element is a string array, so 22 00:01:24,808 --> 00:01:28,577 I'll have to use array notation with the curly braces. 23 00:01:35,017 --> 00:01:41,517 And for the returnVal, I will say returns the calculated area of the triangle. 24 00:01:44,997 --> 00:01:46,445 Cool. 25 00:01:46,445 --> 00:01:50,142 For the distance method, I'll make the returnVal an empty string. 26 00:01:57,862 --> 00:02:01,580 I'll include as its description that it calculates 27 00:02:01,580 --> 00:02:04,460 the distance between the given points. 28 00:02:07,800 --> 00:02:11,762 I'll include descriptions for both parameters, 29 00:02:11,762 --> 00:02:15,631 the first one being the coordinates of one point, 30 00:02:15,631 --> 00:02:19,975 the second one being the coordinates of another point. 31 00:02:24,055 --> 00:02:28,190 And finally, the returnVal, as I said, I will leave as an empty string. 32 00:02:29,840 --> 00:02:33,850 As for the quadraticRoots method, I'll leave this one out completely and 33 00:02:33,850 --> 00:02:35,520 go right to the epsilon method. 34 00:02:36,960 --> 00:02:40,941 For this one, I'll include only a description since it has no parameters and 35 00:02:40,941 --> 00:02:41,867 is a void method. 36 00:02:46,467 --> 00:02:51,467 I'll say that this displays the value of epsilon. 37 00:02:55,347 --> 00:02:58,499 The arePointsClose method won't need documentation 38 00:02:58,499 --> 00:03:02,450 to pass our tools test since it's a private method. 39 00:03:02,450 --> 00:03:03,550 And there you have it, 40 00:03:03,550 --> 00:03:07,370 a class that utilizes the annotation that we wrote ourselves. 41 00:03:07,370 --> 00:03:09,890 The writing of the doc annotation was fairly brief. 42 00:03:09,890 --> 00:03:13,620 The lengthier work for us will come in the form of examining the presence of our 43 00:03:13,620 --> 00:03:18,520 annotation on classes and methods through a technique called reflection. 44 00:03:18,520 --> 00:03:19,610 More on that next.