BrightSide Workbench Full Report + Source Code
org.turro.phase.Phase Class Referenceabstract
Inheritance diagram for org.turro.phase.Phase:
Collaboration diagram for org.turro.phase.Phase:

Public Member Functions

 Phase (PhaseDefinition current)
 
PhaseDefinition getCurrent ()
 
boolean isAutoChanging ()
 
boolean isChanged ()
 
synchronized void checkStatus (Date now)
 
synchronized void changeTo (PhaseDefinition newPhase)
 
boolean canChangeTo (PhaseDefinition newPhase)
 
String getName ()
 
SortedSet< PhaseDefinitiongetPossiblePhases ()
 

Protected Member Functions

abstract PhaseDefinition doCheckPhase (Date now)
 
abstract PhaseDefinition doChangeTo (PhaseDefinition newPhase)
 
void onChanging (PhaseDefinition newStatus)
 
void onChanged (PhaseDefinition newStatus)
 
SortedSet< PhaseDefinitionallPhases ()
 

Protected Attributes

PhaseDefinition current
 
boolean autoChanging = false
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 29 of file Phase.java.

Constructor & Destructor Documentation

◆ Phase()

org.turro.phase.Phase.Phase ( PhaseDefinition  current)

Definition at line 34 of file Phase.java.

34  {
35  this.current = current;
36  }
PhaseDefinition current
Definition: Phase.java:31

Member Function Documentation

◆ allPhases()

SortedSet<PhaseDefinition> org.turro.phase.Phase.allPhases ( )
protected

Definition at line 87 of file Phase.java.

87  {
88  return PhaseDefinitions.instance();
89  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ canChangeTo()

boolean org.turro.phase.Phase.canChangeTo ( PhaseDefinition  newPhase)

Definition at line 76 of file Phase.java.

76  {
77  return !current.equals(newPhase);
78  }
Here is the caller graph for this function:

◆ changeTo()

synchronized void org.turro.phase.Phase.changeTo ( PhaseDefinition  newPhase)

Definition at line 65 of file Phase.java.

65  {
66  PhaseDefinition tmp = current;
67  onChanging(newPhase);
68  current = doChangeTo(newPhase);
69  changed = !current.equals(tmp);
71  }
void onChanged(PhaseDefinition newStatus)
Definition: Phase.java:85
abstract PhaseDefinition doChangeTo(PhaseDefinition newPhase)
void onChanging(PhaseDefinition newStatus)
Definition: Phase.java:84
Here is the call graph for this function:

◆ checkStatus()

synchronized void org.turro.phase.Phase.checkStatus ( Date  now)

Definition at line 50 of file Phase.java.

50  {
51  PhaseDefinition newPhase = doCheckPhase(now);
52  if(current == null || (!newPhase.equals(current) && canChangeTo(newPhase))) {
53  autoChanging = true;
54  try {
55  onChanging(newPhase);
56  newPhase = doChangeTo(newPhase);
57  onChanged(newPhase);
58  current = newPhase;
59  } finally {
60  autoChanging = false;
61  }
62  }
63  }
abstract PhaseDefinition doCheckPhase(Date now)
boolean canChangeTo(PhaseDefinition newPhase)
Definition: Phase.java:76
boolean autoChanging
Definition: Phase.java:32
Here is the call graph for this function:

◆ doChangeTo()

abstract PhaseDefinition org.turro.phase.Phase.doChangeTo ( PhaseDefinition  newPhase)
abstractprotected

Reimplemented in org.turro.dossier.project.ProjectPhaseWrapper.

Here is the caller graph for this function:

◆ doCheckPhase()

abstract PhaseDefinition org.turro.phase.Phase.doCheckPhase ( Date  now)
abstractprotected

Reimplemented in org.turro.dossier.project.ProjectPhaseWrapper.

Here is the caller graph for this function:

◆ getCurrent()

PhaseDefinition org.turro.phase.Phase.getCurrent ( )

Definition at line 38 of file Phase.java.

38  {
39  return current;
40  }

◆ getName()

String org.turro.phase.Phase.getName ( )

Definition at line 80 of file Phase.java.

80  {
81  return current.toString();
82  }

◆ getPossiblePhases()

SortedSet<PhaseDefinition> org.turro.phase.Phase.getPossiblePhases ( )

Definition at line 91 of file Phase.java.

91  {
92  SortedSet<PhaseDefinition> possible = new TreeSet<>();
93  for(PhaseDefinition phase : allPhases()) {
94  if(canChangeTo(phase)) {
95  possible.add(phase);
96  }
97  }
98  return possible;
99  }
SortedSet< PhaseDefinition > allPhases()
Definition: Phase.java:87
Here is the call graph for this function:

◆ isAutoChanging()

boolean org.turro.phase.Phase.isAutoChanging ( )

Definition at line 42 of file Phase.java.

42  {
43  return autoChanging;
44  }

◆ isChanged()

boolean org.turro.phase.Phase.isChanged ( )

Definition at line 46 of file Phase.java.

46  {
47  return changed;
48  }

◆ onChanged()

void org.turro.phase.Phase.onChanged ( PhaseDefinition  newStatus)
protected

Definition at line 85 of file Phase.java.

85 {}
Here is the caller graph for this function:

◆ onChanging()

void org.turro.phase.Phase.onChanging ( PhaseDefinition  newStatus)
protected

Definition at line 84 of file Phase.java.

84 {}
Here is the caller graph for this function:

Member Data Documentation

◆ autoChanging

boolean org.turro.phase.Phase.autoChanging = false
protected

Definition at line 32 of file Phase.java.

◆ current

PhaseDefinition org.turro.phase.Phase.current
protected

Definition at line 31 of file Phase.java.


The documentation for this class was generated from the following file: