Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
j5155 committed Dec 2, 2024
2 parents 4ddc5e7 + 222982f commit f3a28d3
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 50 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ jobs:
- name: Publish to Dairy Snapshots
run: ./gradlew publishAllPublicationsToDairyReleasesRepository
env:
ORG_GRADLE_PROJECT_dairyReleasesUsername: ${{ secrets.RELEASES_USERNAME }}
ORG_GRADLE_PROJECT_dairyReleasesPassword: ${{ secrets.RELEASES_PASSWORD }}
ORG_GRADLE_PROJECT_dairyReleasesUsername: ${{ secrets.SNAPSHOTS_USERNAME }}
ORG_GRADLE_PROJECT_dairyReleasesPassword: ${{ secrets.SNAPSHOTS_PASSWORD }}
48 changes: 0 additions & 48 deletions .github/workflows/snapshots.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package page.j5155.expressway.ftc.actions

import com.acmerobotics.dashboard.telemetry.TelemetryPacket
import page.j5155.expressway.core.actions.Condition
import page.j5155.expressway.core.actions.InitLoopCondAction
import java.util.function.Consumer
import java.util.function.Supplier

/**
* This class builds an InitLoopCondAction
* @param condition the condition for the action to complete
*/
class ActionBuilder(val condition: Condition) {

private var initInternal: Supplier<Unit> = Supplier { }
private var loopInternal: Consumer<TelemetryPacket> = Consumer { }
private var cleanupInternal: Supplier<Unit> = Supplier { }

/**
* Set the initialization function
* @param init the initialization function
*/
fun setInit(init: Supplier<Unit>): ActionBuilder {
initInternal = init
return this
}

/**
* Set the loop function
* @param loop the loop function
*/
fun setLoop(loop: Consumer<TelemetryPacket>): ActionBuilder {
loopInternal = loop
return this
}

/**
* Set the cleanup function
* @param cleanup the cleanup function
*/
fun setCleanup(cleanup: Supplier<Unit>): ActionBuilder {
cleanupInternal = cleanup
return this
}

/**
* Builds the InitLoopCondAction
*/
fun build(): InitLoopCondAction {
return object: InitLoopCondAction(condition) {
override fun init() = initInternal.get()

override fun loop(p: TelemetryPacket) = loopInternal.accept(p)

override fun cleanup() = cleanupInternal.get()
}
}
}

0 comments on commit f3a28d3

Please sign in to comment.