org.cip4.jdflib.util
Class StatusCounter

java.lang.Object
  extended by org.cip4.jdflib.util.StatusCounter

public class StatusCounter
extends Object

Utility class for status JDF and JMF

Author:
prosirai

Field Summary
protected  VString m_ignoreParts
           
protected  JDFNode m_Node
           
protected  VJDFAttributeMap m_vPartMap
           
protected  HashSet<String> setCopyResInfo
           
protected  HashSet<String> setTrackWaste
           
 
Constructor Summary
StatusCounter(JDFNode node, VJDFAttributeMap vPartMap, VElement vResLinks)
          construct a StatusUtil for a node n
 
Method Summary
 int addEmployee(JDFEmployee employee)
           
 void addIgnorePart(JDFResource.EnumPartIDKey key)
          set the partIDKeys to be ignored
 void addModule(String moduleID, String moduleType)
           
 void addPhase(String refID, double amount, double waste, boolean sumTotal)
          add the amount specified by amount and waste to the resource with id refID
 void clearAmounts(String refID)
          clear all the amounts in the resource with id refID
 boolean clearEmployees()
           
 JDFResourceLink[] getAmountLinks()
          get all total amounts of all tracked resources
 double getCurrentCounter()
           
 String getDeviceID()
           
 JDFDoc getDocJMFNotification(boolean bClean)
           
 JDFDoc getDocJMFPhaseTime()
           
 JDFDoc getDocJMFResource()
           
 Vector<JDFEmployee> getEmpoyees()
           
 String getFirstRefID()
          get the refID of the first resource, i.e. the Resource that is being tracked in status messages
 VString getIcsVersions()
           
protected  org.cip4.jdflib.util.StatusCounter.LinkAmount getLinkAmount(int n)
          get the matching LinkAmount out of this
protected  org.cip4.jdflib.util.StatusCounter.LinkAmount getLinkAmount(String refID)
          get the matching LinkAmount out of this
 String getLinkID(String refID)
          get the matching LinkAmount out of this
 VString getModuleeID()
           
 NodeIdentifier getNodeIDentifier()
           
 double getPercentComplete()
           
 double getPhaseAmount(String refID)
          get the total the amount of the resource with id refID
 double[] getPhaseAmounts()
          get all phaseamounts of all tracked resources
 double getPhaseWaste(String refID)
          get the total the amount of the resource with id refID
 double[] getPhaseWastes()
          get all phase waste amounts of all tracked resources
 double getPlannedAmount(String refID)
           
 double getPlannedWaste(String refID)
           
 String getQueueEntryID()
           
 JDFDate getStartDate()
           
 JDFAutoDeviceInfo.EnumDeviceStatus getStatus()
           
 String getStatusDetails()
           
 double getTotalAmount(String refID)
          get the total the amount of the resource with id refID
 double[] getTotalAmounts()
          get all total amounts of all tracked resources
 double getTotalCounter()
           
 double getTotalWaste(String refID)
          get the total the amount of the resource with id refID
 double[] getTotalWastes()
          get all total amounts of all tracked resources
 boolean removeEmployee(JDFEmployee employee)
           
 void replaceEmployees(Vector<JDFEmployee> employees)
          replace all employees in this - update phases if necessary
 void setActiveNode(JDFNode node, VJDFAttributeMap vPartMap, VElement vResLinks)
          set the currently active node
 void setCopyResInResInfo(String _refID, boolean b)
          set copying the resource into resourceInfo on or off for the resourcelink rl
 void setCurrentCounter(double _currentCounter)
           
 void setDeviceID(String deviceid)
           
 JDFNotification setEvent(String eventID, String eventValue, String comment)
          set event, append the Event element and optionally the comment
overwrites existing values
 void setFirstRefID(String resID)
          set the id of the resource to be tracked in phasetimes, i.e.
 void setIcsVersions(VString icsVersions)
           
 void setOperationMode(JDFAutoDeviceInfo.EnumDeviceOperationMode _operationMode)
           
 void setPercentComplete(double percent)
          set percentComplete to percent
 boolean setPhase(JDFElement.EnumNodeStatus nodeStatus, String nodeStatusDetails, JDFAutoDeviceInfo.EnumDeviceStatus deviceStatus, String deviceStatusDetails)
          Set the Status and StatusDetails of this node update the PhaseTime audit or append a new phasetime as appropriate also prepare a status JMF
 void setPhase(String refID, double amount, double waste)
          set the phase the amount specified by amount and waste to the resource with id refID
 void setPhaseTimeAmounts(boolean bAddAmount)
           
 JDFProcessRun setProcessResult(JDFElement.EnumNodeStatus endStatus)
           
 void setQueueEntryID(String _queueEntryID)
           
 JDFResourceAudit setResourceAudit(String resID, JDFAutoResourceAudit.EnumReason reason)
           
 void setTotal(String refID, double amount, boolean bWaste)
          set the total amount specified by amount and waste to the resource with id refID usually called when reading resource audits or resource signals
 void setTotalCounter(double _totalCounter)
           
 void setTrackWaste(String resID, boolean b)
          set waste tracking on or off for the resourcelink rl
 void setWorkType(JDFAutoMISDetails.EnumWorkType _workType)
          sets the MISDetails/@WorkType for default audis, resource audits and phaseTime elements
static void sleep(int millis)
          Deprecated. use ThreadUtil.sleep()
 String toString()
           
 void updatePercentComplete(double percent)
          update percentComplete by percent
 void writeAll()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_Node

protected JDFNode m_Node

m_vPartMap

protected VJDFAttributeMap m_vPartMap

m_ignoreParts

protected VString m_ignoreParts

setTrackWaste

protected HashSet<String> setTrackWaste

setCopyResInfo

protected HashSet<String> setCopyResInfo
Constructor Detail

StatusCounter

public StatusCounter(JDFNode node,
                     VJDFAttributeMap vPartMap,
                     VElement vResLinks)
construct a StatusUtil for a node n

Parameters:
node - the JDFNode that is being processed
vPartMap - the map of Parts that is being processed excluding the waste partition
vResLinks - the reslinks that are tracked for amount handling
Method Detail

getTotalCounter

public double getTotalCounter()
Returns:
the total counter value

setTotalCounter

public void setTotalCounter(double _totalCounter)
Parameters:
_totalCounter -

getCurrentCounter

public double getCurrentCounter()
Returns:
the value of currentCounter

setCurrentCounter

public void setCurrentCounter(double _currentCounter)
Parameters:
_currentCounter -

addEmployee

public int addEmployee(JDFEmployee employee)
Parameters:
employee -
Returns:

removeEmployee

public boolean removeEmployee(JDFEmployee employee)
Parameters:
employee -
Returns:

getEmpoyees

public Vector<JDFEmployee> getEmpoyees()
Returns:
the vector of currently registered employees

clearEmployees

public boolean clearEmployees()
Returns:

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

writeAll

public void writeAll()

setPhaseTimeAmounts

public void setPhaseTimeAmounts(boolean bAddAmount)
Parameters:
bAddAmount - if true, amounts are added to phasetimes

setActiveNode

public void setActiveNode(JDFNode node,
                          VJDFAttributeMap vPartMap,
                          VElement vResLinks)
set the currently active node

Parameters:
node - the JDFNode that is being processed
vPartMap - the map of Parts that is being processed excluding the waste partition
vResLinks - the reslinks that are tracked for amount handling

sleep

@Deprecated
public static void sleep(int millis)
Deprecated. use ThreadUtil.sleep()

simple sleep wrapper that catches its exception

Parameters:
millis -

getLinkAmount

protected org.cip4.jdflib.util.StatusCounter.LinkAmount getLinkAmount(String refID)
get the matching LinkAmount out of this

Parameters:
refID - the refID, name or usage of the resource of the bag - this MUST match the refID of a ResourceLink
Returns:
the LinkAmount with matching refID, null if none found or bags is null

getLinkID

public String getLinkID(String refID)
get the matching LinkAmount out of this

Parameters:
refID - the refID, name or usage of the resource of the bag - this MUST match the refID of a ResourceLink
Returns:
the actual refID of the matching resLink, null if none found or bags is null

getLinkAmount

protected org.cip4.jdflib.util.StatusCounter.LinkAmount getLinkAmount(int n)
get the matching LinkAmount out of this

Parameters:
n - the index of the resource of the bag - this MUST match the refID of a ResourceLink
Returns:
the LinkAmount with matching n, null if none found or bags is null

getFirstRefID

public String getFirstRefID()
get the refID of the first resource, i.e. the Resource that is being tracked in status messages

Returns:
the rRef of the prime resource link

setFirstRefID

public void setFirstRefID(String resID)
set the id of the resource to be tracked in phasetimes, i.e. THE resource that is counted

Parameters:
resID -

addIgnorePart

public void addIgnorePart(JDFResource.EnumPartIDKey key)
set the partIDKeys to be ignored

Parameters:
key -

clearAmounts

public void clearAmounts(String refID)
clear all the amounts in the resource with id refID

Parameters:
refID - id of the resource

setPhase

public void setPhase(String refID,
                     double amount,
                     double waste)
set the phase the amount specified by amount and waste to the resource with id refID

Parameters:
refID - , type or usage of the resource, if null all are updated
amount - the amount for this phase
waste - the waste for this phase

addPhase

public void addPhase(String refID,
                     double amount,
                     double waste,
                     boolean sumTotal)
add the amount specified by amount and waste to the resource with id refID

Parameters:
refID - , type or usage of the resource, if null all are updated
amount -
waste -
sumTotal - if true, also sum up the total amounts, else only phase

setTotal

public void setTotal(String refID,
                     double amount,
                     boolean bWaste)
set the total amount specified by amount and waste to the resource with id refID usually called when reading resource audits or resource signals

Parameters:
refID - , type or usage of the resource, if null all are updated
amount - the amount to set
bWaste - if true, set total waste, else set total good

getTotalAmount

public double getTotalAmount(String refID)
get the total the amount of the resource with id refID

Parameters:
refID - , type or usage of the resource,
Returns:

getTotalAmounts

public double[] getTotalAmounts()
get all total amounts of all tracked resources

Returns:

getAmountLinks

public JDFResourceLink[] getAmountLinks()
get all total amounts of all tracked resources

Returns:

getPhaseAmounts

public double[] getPhaseAmounts()
get all phaseamounts of all tracked resources

Returns:

getPercentComplete

public double getPercentComplete()
Returns:
the percent completed of the current node

getPhaseAmount

public double getPhaseAmount(String refID)
get the total the amount of the resource with id refID

Parameters:
refID - , type or usage of the resource,
Returns:

getTotalWaste

public double getTotalWaste(String refID)
get the total the amount of the resource with id refID

Parameters:
refID - , type or usage of the resource,
Returns:

getTotalWastes

public double[] getTotalWastes()
get all total amounts of all tracked resources

Returns:

getPhaseWastes

public double[] getPhaseWastes()
get all phase waste amounts of all tracked resources

Returns:

getPhaseWaste

public double getPhaseWaste(String refID)
get the total the amount of the resource with id refID

Parameters:
refID - , type or usage of the resource,
Returns:

setEvent

public JDFNotification setEvent(String eventID,
                                String eventValue,
                                String comment)
set event, append the Event element and optionally the comment
overwrites existing values

Parameters:
eventID - Event/@EventID to set
eventValue - Event/@EventValue to set
comment - the comment text, if null no comment is set
Returns:

setPhase

public boolean setPhase(JDFElement.EnumNodeStatus nodeStatus,
                        String nodeStatusDetails,
                        JDFAutoDeviceInfo.EnumDeviceStatus deviceStatus,
                        String deviceStatusDetails)
Set the Status and StatusDetails of this node update the PhaseTime audit or append a new phasetime as appropriate also prepare a status JMF

Parameters:
nodeStatus - the new status of the node
nodeStatusDetails - the new statusDetails of the node
deviceStatus - the new status of the device
deviceStatusDetails - the new statusDetails of the device
Returns:
true if the status changed

getDocJMFPhaseTime

public JDFDoc getDocJMFPhaseTime()
Returns:
the docJMFPhaseTime

getDocJMFResource

public JDFDoc getDocJMFResource()
Returns:
the docJMFResource

getDocJMFNotification

public JDFDoc getDocJMFNotification(boolean bClean)
Parameters:
bClean -
Returns:
the docJMFNotification

getDeviceID

public String getDeviceID()
Returns:
the m_deviceID

getModuleeID

public VString getModuleeID()
Returns:
the m_moduleID

setDeviceID

public void setDeviceID(String deviceid)
Parameters:
deviceid - the m_deviceID to set

addModule

public void addModule(String moduleID,
                      String moduleType)
Parameters:
moduleID -
moduleType -

setTrackWaste

public void setTrackWaste(String resID,
                          boolean b)
set waste tracking on or off for the resourcelink rl

Parameters:
resID - the resource id to the resource to track
b - tracking on or off

setCopyResInResInfo

public void setCopyResInResInfo(String _refID,
                                boolean b)
set copying the resource into resourceInfo on or off for the resourcelink rl

Parameters:
_refID - the refid of the resourcelink to the resource to copy
b - tracking on or off

setResourceAudit

public JDFResourceAudit setResourceAudit(String resID,
                                         JDFAutoResourceAudit.EnumReason reason)
Parameters:
resID - the resource ID to set/track reason for the audit
reason -
Returns:
JDFResourceAudit the generated audit

setProcessResult

public JDFProcessRun setProcessResult(JDFElement.EnumNodeStatus endStatus)
Parameters:
endStatus -
Returns:

setQueueEntryID

public void setQueueEntryID(String _queueEntryID)
Parameters:
_queueEntryID -

getQueueEntryID

public String getQueueEntryID()
Returns:
queueEntryID

setWorkType

public void setWorkType(JDFAutoMISDetails.EnumWorkType _workType)
sets the MISDetails/@WorkType for default audis, resource audits and phaseTime elements

Parameters:
_workType - the worktype to set, if null no MISDetails and no Worktype are added. closes all ongoing phases and starts a new phase

getStatus

public JDFAutoDeviceInfo.EnumDeviceStatus getStatus()
Returns:

getStatusDetails

public String getStatusDetails()
Returns:

getStartDate

public JDFDate getStartDate()
Returns:

setOperationMode

public void setOperationMode(JDFAutoDeviceInfo.EnumDeviceOperationMode _operationMode)
Parameters:
_operationMode -

getPlannedAmount

public double getPlannedAmount(String refID)
Parameters:
refID - the resource ID or name
Returns:
the planned amount for the resource

getPlannedWaste

public double getPlannedWaste(String refID)
Parameters:
refID - the resource ID or name
Returns:
the planned waste for the resource

getNodeIDentifier

public NodeIdentifier getNodeIDentifier()
Returns:
the nodeID

setPercentComplete

public void setPercentComplete(double percent)
set percentComplete to percent

Parameters:
percent - the percentage to set

updatePercentComplete

public void updatePercentComplete(double percent)
update percentComplete by percent

Parameters:
percent - the percentage to increment

setIcsVersions

public void setIcsVersions(VString icsVersions)
Parameters:
icsVersions - the icsVersions to set

getIcsVersions

public VString getIcsVersions()
Returns:
the icsVersions

replaceEmployees

public void replaceEmployees(Vector<JDFEmployee> employees)
replace all employees in this - update phases if necessary

Parameters:
employees -


Copyright © 2013. All Rights Reserved.