Skip to content

Commit ce2f605

Browse files
authored
Merge pull request #27 from DeepBlueRobotics/documentation
Publish Javadocs to GitHub Pages
2 parents 3fb1b3c + 8816ee7 commit ce2f605

6 files changed

Lines changed: 67 additions & 20 deletions

File tree

.github/workflows/javadoc.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Deploy Javadoc
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
build-javadoc:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
submodules: 'recursive'
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 11
19+
- name: Generate Javadoc
20+
run: ./gradlew javadoc
21+
- name: Build Artifact
22+
uses: actions/upload-pages-artifact@v1.0.5
23+
with:
24+
path: ./build/docs/javadoc
25+
deploy-javadoc:
26+
needs: build-javadoc
27+
permissions:
28+
pages: write
29+
id-token: write
30+
environment:
31+
name: github-pages
32+
url: ${{ steps.deployment.outputs.page_url }}
33+
runs-on: ubuntu-latest
34+
steps:
35+
- name: Deploy to GitHub Pages
36+
id: deployment
37+
uses: actions/deploy-pages@v1.2.3

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# FRC Team 199 Library
22

3-
This projects builds `lib199.jar` which contains code that reuse across projects/years.
3+
This projects builds `lib199.jar` which contains code that reuse across projects/years. The javadocs can be found [here](https://deepbluerobotics.github.io/lib199/).

src/main/java/org/carlmontrobotics/lib199/Mocks.java

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,46 +39,49 @@ public final class Mocks {
3939
// 4) Mock invocations are cleared -> throws NullPointerException
4040
Lib199Subsystem.registerPeriodic(() -> MOCKS.removeIf(CLEAR_INVOCATIONS_ON_REFERENCED_MOCK_IF_REFERNCE_NOT_CLEARED));
4141
}
42-
42+
4343
/**
4444
* Attempts to create an instance of a class in which some or all of the classes methods are replaced with a mocked implementation
45-
* @param T the class type which will be mocked
46-
* @param U the class type which will be used to provide method implementations
45+
* @param <T> the class type which will be mocked
46+
* @param <U> the class type which will be used to provide method implementations
4747
* @param classToMock the class type which will be mocked
4848
* @param implClass the object to which to try to forward method calls
4949
* @param interfaces a list of interfaces which the mocked object should extend
5050
* @return an instance of <code>T</code> in which some or all of the classes methods are replaced with a mocked implementation from <code>U</code>
51-
* @see #createMock(java.lang.Class, java.lang.Object, java.lang.Class...)
51+
* @see #createMock(Class, Object, boolean, Class...)
52+
* @see #createMock(Class, Object, Answer, Class...)
5253
*/
5354
public static <T, U> T createMock(Class<T> classToMock, U implClass, Class<?>... interfaces) {
5455
return createMock(classToMock, implClass, true, interfaces);
5556
}
56-
57+
5758
/**
5859
* Attempts to create an instance of a class in which some or all of the classes methods are replaced with a mocked implementation
59-
* @param T the class type which will be mocked
60-
* @param U the class type which will be used to provide method implementations
60+
* @param <T> the class type which will be mocked
61+
* @param <U> the class type which will be used to provide method implementations
6162
* @param classToMock the class type which will be mocked
6263
* @param implClass the object to which to try to forward method calls
6364
* @param forwardUnknownCalls whether methods which are not overriden will call their real methods
6465
* @param interfaces a list of interfaces which the mocked object should extend
6566
* @return an instance of <code>T</code> in which some or all of the classes methods are replaced with a mocked implementation from <code>U</code>
66-
* @see #createMock(java.lang.Class, java.lang.Object)
67+
* @see #createMock(Class, Object, Class...)
68+
* @see #createMock(Class, Object, Answer, Class...)
6769
*/
6870
public static <T, U> T createMock(Class<T> classToMock, U implClass, boolean forwardUnknownCalls, Class<?>... interfaces) {
6971
return createMock(classToMock, implClass, forwardUnknownCalls ? InvocationOnMock::callRealMethod : new ReturnsSmartNulls(), interfaces);
7072
}
71-
73+
7274
/**
7375
* Attempts to create an instance of a class in which some or all of the classes methods are replaced with a mocked implementation
74-
* @param T the class type which will be mocked
75-
* @param U the class type which will be used to provide method implementations
76+
* @param <T> the class type which will be mocked
77+
* @param <U> the class type which will be used to provide method implementations
7678
* @param classToMock the class type which will be mocked
7779
* @param implClass the object to which to try to forward method calls
7880
* @param defaultAnswer The answer to use when no overriden implementation is found
7981
* @param interfaces a list of interfaces which the mocked object should extend
8082
* @return an instance of <code>T</code> in which some or all of the classes methods are replaced with a mocked implementation from <code>U</code>
81-
* @see #createMock(java.lang.Class, java.lang.Object)
83+
* @see #createMock(Class, Object, Class...)
84+
* @see #createMock(Class, Object, boolean, Class...)
8285
*/
8386
public static <T, U> T createMock(Class<T> classToMock, U implClass, Answer<Object> defaultAnswer, Class<?>... interfaces) {
8487
HashMap<Method, InvokableMethod> methods = new HashMap<>();
@@ -104,7 +107,13 @@ public static <T, U> T createMock(Class<T> classToMock, U implClass, Answer<Obje
104107
T mock = mock(classToMock, settings);
105108
return mock;
106109
}
107-
110+
111+
/**
112+
* Lists all of the methods available in the provided base class and interface classes
113+
* @param base The base class to search
114+
* @param interfaces Additional interface classes to search
115+
* @return An array of all the detected methods
116+
*/
108117
public static Method[] listMethods(Class<?> base, Class<?>... interfaces) {
109118
ArrayList<Method> out = new ArrayList<>();
110119
out.addAll(Arrays.asList(base.getMethods()));
@@ -114,7 +123,7 @@ public static Method[] listMethods(Class<?> base, Class<?>... interfaces) {
114123

115124
/**
116125
* A wrapper for the underlying Mockito method which automatically calls {@link Mockito#clearInvocations(Object...)} to prevent memory leaks
117-
*
126+
*
118127
* @see Mockito#mock(Class)
119128
*/
120129
public static <T> T mock(Class<T> classToMock) {
@@ -187,6 +196,6 @@ public Object answer(InvocationOnMock invocation) throws Throwable {
187196

188197
private static interface InvokableMethod {
189198
public Object invoke(Object object, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException;
190-
}
199+
}
191200

192201
}

src/main/java/org/carlmontrobotics/lib199/MotorControllerFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public static UsbCamera configureCamera() {
136136
}
137137

138138
/**
139-
* This method is equivilent to calling {@link #configureCamera()} {@link numCameras} times.
139+
* This method is equivilent to calling {@link #configureCamera()} {@code numCameras} times.
140140
* The last camera will be set as the primary Camera feed.
141141
* To change it, call {@code CameraServer.getServer().setSource()}.
142142
*

src/main/java/org/carlmontrobotics/lib199/logging/Log.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.apache.commons.csv.CSVFormat;
1010

1111
import edu.wpi.first.wpilibj.RobotController;
12+
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
1213

1314
/**
1415
* Provides an interface through which to access the logging code
@@ -336,8 +337,8 @@ public static void setDataLogInterval(int interval) {
336337

337338
/**
338339
* Logs data to the data file or returns if determined by the data logging interval where each interval unit represents one logData call
339-
* @see #getDataLoginterval()
340-
* @see #setDataLoginterval(int)
340+
* @see #getDataLogInterval()
341+
* @see #setDataLogInterval(int)
341342
*/
342343
public static void logData() {
343344
if(GlobalLogInfo.isDataDisabled()) {

src/main/java/org/carlmontrobotics/lib199/swerve/SwerveMath.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public static double[] computeSetpoints(double normalizedSpeed, double angle, do
131131

132132
/**
133133
* Determines whether or not the robot should take the reverse direction to get to angle.
134-
* e.g. if the robot was to turn 3&#960/2 radians clockwise, it would be better to turn &#960/2 radians counter-clockwsie.
134+
* e.g. if the robot was to turn 3&#960;/2 radians clockwise, it would be better to turn &#960;/2 radians counter-clockwsie.
135135
* Credit to Team 100 for their code.
136136
*
137137
* @param angle The desired angle between -0.5 and 0.5

0 commit comments

Comments
 (0)