Package dev.turboism.sdk.cubism.worktime
Record Class ProjectWorkTimeSnapshot
java.lang.Object
java.lang.Record
dev.turboism.sdk.cubism.worktime.ProjectWorkTimeSnapshot
- Record Components:
editorForeground- whether the Cubism process was foreground at the observationsessionForegroundTime- foreground time of the project that is open now; zero while no project is open, because idle editor time is not project workactiveProject- project whose tab was active, empty when none was openprojects- all projects with recorded work time, ordered for displayobservedAt- the instant this snapshot was observed
@CubismEditor
public record ProjectWorkTimeSnapshot(boolean editorForeground, Duration sessionForegroundTime, Optional<ProjectWorkTime> activeProject, List<ProjectWorkTime> projects, Instant observedAt)
extends Record
Immutable view of the runtime work-time tracker at one observation.
projects is ordered by descending ProjectWorkTime.totalTime(), with the
project name as a deterministic tie-breaker. The active project, when present, is also one
of the listed projects.
-
Constructor Summary
ConstructorsConstructorDescriptionProjectWorkTimeSnapshot(boolean editorForeground, Duration sessionForegroundTime, Optional<ProjectWorkTime> activeProject, List<ProjectWorkTime> projects, Instant observedAt) Creates an instance of aProjectWorkTimeSnapshotrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theactiveProjectrecord component.booleanReturns the value of theeditorForegroundrecord component.static ProjectWorkTimeSnapshotReturns the canonical empty snapshot atobservedAt.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theobservedAtrecord component.Looks up one recorded project by its opaque key.projects()Returns the value of theprojectsrecord component.Returns the value of thesessionForegroundTimerecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ProjectWorkTimeSnapshot
public ProjectWorkTimeSnapshot(boolean editorForeground, Duration sessionForegroundTime, Optional<ProjectWorkTime> activeProject, List<ProjectWorkTime> projects, Instant observedAt) Creates an instance of aProjectWorkTimeSnapshotrecord class.- Parameters:
editorForeground- the value for theeditorForegroundrecord componentsessionForegroundTime- the value for thesessionForegroundTimerecord componentactiveProject- the value for theactiveProjectrecord componentprojects- the value for theprojectsrecord componentobservedAt- the value for theobservedAtrecord component
-
-
Method Details
-
empty
Returns the canonical empty snapshot atobservedAt. -
project
Looks up one recorded project by its opaque key. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
editorForeground
public boolean editorForeground()Returns the value of theeditorForegroundrecord component.- Returns:
- the value of the
editorForegroundrecord component
-
sessionForegroundTime
Returns the value of thesessionForegroundTimerecord component.- Returns:
- the value of the
sessionForegroundTimerecord component
-
activeProject
Returns the value of theactiveProjectrecord component.- Returns:
- the value of the
activeProjectrecord component
-
projects
Returns the value of theprojectsrecord component.- Returns:
- the value of the
projectsrecord component
-
observedAt
Returns the value of theobservedAtrecord component.- Returns:
- the value of the
observedAtrecord component
-