Java Doc for AmmoProjectionExpanderPlugin.java in  » Science » Cougaar12_4 » org » cougaar » logistics » plugin » trans » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Science » Cougaar12_4 » org.cougaar.logistics.plugin.trans 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.cougaar.logistics.plugin.trans.AmmoLowFidelityExpanderPlugin
   org.cougaar.logistics.plugin.trans.AmmoProjectionExpanderPlugin

AmmoProjectionExpanderPlugin
public class AmmoProjectionExpanderPlugin extends AmmoLowFidelityExpanderPlugin (Code)
Takes PROJECT_SUPPLY tasks and converts them into TRANSPORT tasks with a RESERVATION prep.



Field Summary
final public static  StringAMMO_CATEGORY_CODE
    
public  longCHUNK_DAYS
    
protected  booleanFIND_FOR_UNIT_PREP_ON_TASK
    
public static  longMILLIS_PER_DAY
    
final public static  StringMILVAN_NSN
    
final public static  doublePACKING_LIMIT
    
public static  doubleSECS_PER_DAY
    
public static  StringSTART
    
final public static  longTASK_TRANSMISSION_DELAY
    
protected  MapchildToParent
    
protected  ListdefaultUnit
    
protected  UTILFilterCallbackmyTaskCallback
    
public  TaskUtilstaskUtils
    
 inttotal
    
protected  MaptypeToTasks
    
protected  MapuidToTask
    


Method Summary
protected  voidaddContentsInfo(GLMAsset container, String nomen, String typeID, String unit, double massInSTons)
    
protected  voidaddToEstimatedAR(PlanElement exp, AspectValue rate)
    
protected  AggregateAssetcreateDeliveredAsset(Task originalTask, Asset originalAsset, int quantity)
    
protected  TaskcreateSubtask(Task parentTask, Asset directObject, Date early, Date best, Date late, long bestTime, long daysSoFar, Date lastBestDate, String itemNomen, double massInSTons)
     Create the transport reservation subtask of the parent.
protected  UTILFilterCallbackcreateThreadCallback(UTILGenericListener bufferingThread)
    
protected  voiddealWithReservedTask(Task task, Task reservedTask, Task reservedParent)
    
 Called from processTasks.
protected  CollectionfindForPreps(Task task)
     Look on task for what unit the ammo is for.
protected  longgetBestTime(Date early, Date best, long daysSoFar)
    
protected  doublegetContainerTons(Container container)
    
public  DategetEarlyDate(Task t)
    
public  DategetLateDate(Task t)
    
protected  DategetLatestParentEndDate(Task transport, Task reserved)
     Must check best dates of Supply task parents.
protected  DategetLatestParentEndDate(Task transport, String reservedAmmoType)
     Must check best dates of Supply task parents.
protected  ListgetMatchingTasksByType(Task task, Collection units, boolean isReserved)
     Find those tasks of the same ammo type and try to find tasks that overlap in time with the given task.
protected  AssetgetMilvanDirectObject(String itemNomen, String itemID, String unit, double massInSTons)
    
protected  TaskgetParentTask(Task child)
     Queries the uid->task map for the parent task of the child...
protected  doublegetScaledRate(PlanElement planElement)
    
 scale the rate to make it the rate over the time of the performance of the 
 task, so that when the inventory does days*rate, they come up with the original
 requested quantity.
public  VectorgetSubtasks(Task parentTask)
     Implemented for UTILExpanderPlugin interface Break up project supply tasks into reserved transport tasks for discrete periods of time.
protected  AssetgetTrimmedDirectObject(Asset directObject, double factor)
     Assumes the direct object is either an asset group or a container (milvan).
protected  CollectiongetTypesInContainer(Task task)
    
protected  EnumerationgetValidEndDateRanges(Preference endDatePref)
    
public  voidhandleProjectSupplyTask(Task t)
    
public  voidhandleTransportTask(Task task1, Map reservedToActual)
    
public  booleaninterestingTask(Task task)
     State that we are interested in all transport tasks
Parameters:
  task - the task to test.
public  booleanisEqual(AllocationResult thisAR, AllocationResult that)
     checks to see if the AllocationResult is equal to this one. We have to use this copy of the AllocationResult.isEqual because we want to to skip equals comparison of DEMANDRATE and START_TIME aspects.
protected  booleanisReservedTask(Task task)
    
public  voidlocalSetup()
    
protected  GLMAssetmakeMilvan()
    
protected  StringmakeMilvanID()
    
protected  AllocationResultmakeSuccessfulDisposition(Task task)
    
public  booleannearlyEquals(AspectValue[] avs1, AspectValue[] avs2)
     checks to see that two aspect value arrays are equal skips comparison of DEMANDRATE and START_TIME aspects.
protected  intnumTasksInWorkflow(Workflow workflow)
    
protected  booleanownWorkflow(Task task)
    
public  voidprocessTasks(List tasks)
    
public  voidreportChangedExpansion(Expansion cpe)
    
 Report to superior that the expansion has changed.
protected  StringreportContentTypes(Task task, Task examinedTask)
    
public  voidsetLoggingService(LoggingService bs)
     rely upon load-time introspection to set these services - don't worry about revokation.
public  voidsetupFilters()
    
protected  booleantaskInWorkflow(Task task, Workflow workflow)
    
protected  booleantransportDateWithinReservedWindow(Task transport, Task reserved)
     Must check best dates of Supply task parents.
protected  Stringuids(String[] array)
    
protected  StringuidsWorkflow(Task task)
    
protected  voidupdateMap(Map reservedToActual, Task actual, Task reserved)
    

Field Detail
AMMO_CATEGORY_CODE
final public static String AMMO_CATEGORY_CODE(Code)



CHUNK_DAYS
public long CHUNK_DAYS(Code)



FIND_FOR_UNIT_PREP_ON_TASK
protected boolean FIND_FOR_UNIT_PREP_ON_TASK(Code)



MILLIS_PER_DAY
public static long MILLIS_PER_DAY(Code)



MILVAN_NSN
final public static String MILVAN_NSN(Code)



PACKING_LIMIT
final public static double PACKING_LIMIT(Code)



SECS_PER_DAY
public static double SECS_PER_DAY(Code)



START
public static String START(Code)



TASK_TRANSMISSION_DELAY
final public static long TASK_TRANSMISSION_DELAY(Code)



childToParent
protected Map childToParent(Code)



defaultUnit
protected List defaultUnit(Code)



myTaskCallback
protected UTILFilterCallback myTaskCallback(Code)



taskUtils
public TaskUtils taskUtils(Code)



total
int total(Code)



typeToTasks
protected Map typeToTasks(Code)



uidToTask
protected Map uidToTask(Code)





Method Detail
addContentsInfo
protected void addContentsInfo(GLMAsset container, String nomen, String typeID, String unit, double massInSTons)(Code)



addToEstimatedAR
protected void addToEstimatedAR(PlanElement exp, AspectValue rate)(Code)



createDeliveredAsset
protected AggregateAsset createDeliveredAsset(Task originalTask, Asset originalAsset, int quantity)(Code)
create aggregate asset aggregating the direct object's prototype *



createSubtask
protected Task createSubtask(Task parentTask, Asset directObject, Date early, Date best, Date late, long bestTime, long daysSoFar, Date lastBestDate, String itemNomen, double massInSTons)(Code)
Create the transport reservation subtask of the parent.



createThreadCallback
protected UTILFilterCallback createThreadCallback(UTILGenericListener bufferingThread)(Code)



dealWithReservedTask
protected void dealWithReservedTask(Task task, Task reservedTask, Task reservedParent)(Code)
 Called from processTasks. 
 Compares transport reservation and overlapping actual transport task.
 Creates a replacement for existing reserved task, if there is any time
 span left where it doesn't overlap the actual task.  If the actual completely 
 overlaps the reservation, creates a successful disposition for the task.
 If there is partial overlap, adjusts the earliest arrival date on the reserved task
 to be equal to the best date of the actual and updates the contents pg of the direct
 object to indicate a smaller weight.
 As a convenience, adds the START prep to the reserved task, indicating the start
 of the period of the reservation.  This is used in transportDateWithinReservedWindow to
 determine if an actual falls in the span of a reservation and to indicate whether
 a transport task is indeed a reservation.
 

Parameters:
  task - actual transport task
Parameters:
  reservedTask - reserved transport task to be replaced



findForPreps
protected Collection findForPreps(Task task)(Code)
Look on task for what unit the ammo is for. Generally this will be 191-ORDN. If FIND_FOR_UNIT_PREP_ON_TASK is false, just use agent identifier (OSC).



getBestTime
protected long getBestTime(Date early, Date best, long daysSoFar)(Code)
make sure best time is before or equal to best time on task



getContainerTons
protected double getContainerTons(Container container)(Code)
assumes only one type of ammo in container -- true for reservations



getEarlyDate
public Date getEarlyDate(Task t)(Code)



getLateDate
public Date getLateDate(Task t)(Code)



getLatestParentEndDate
protected Date getLatestParentEndDate(Task transport, Task reserved)(Code)
Must check best dates of Supply task parents. Remember to round to end of day! A task arriving at midnight + 1 sec of a day counts for the whole day against the projection.



getLatestParentEndDate
protected Date getLatestParentEndDate(Task transport, String reservedAmmoType)(Code)
Must check best dates of Supply task parents.



getMatchingTasksByType
protected List getMatchingTasksByType(Task task, Collection units, boolean isReserved)(Code)
Find those tasks of the same ammo type and try to find tasks that overlap in time with the given task.
Parameters:
  task - to look for matching tasks for
Parameters:
  units - units the task is for
Parameters:
  isReserved - is the task a reserved (project supply child) task List of tasks that are for the same type of ammo, same unit, and for an overlapping period of time



getMilvanDirectObject
protected Asset getMilvanDirectObject(String itemNomen, String itemID, String unit, double massInSTons)(Code)



getParentTask
protected Task getParentTask(Task child)(Code)
Queries the uid->task map for the parent task of the child... must do this since child task has a uid reference to the parent task not an actual reference.



getScaledRate
protected double getScaledRate(PlanElement planElement)(Code)
 scale the rate to make it the rate over the time of the performance of the 
 task, so that when the inventory does days*rate, they come up with the original
 requested quantity.
 The problem is that we're translating from one meaning of start and end date to another.
 The start->end date window on a project supply task means "I need X widgets per day, each
 day, over this period."  The transportation start->end window means "The move started on this
 day and ended on this other day."  So they mean different things.
 



getSubtasks
public Vector getSubtasks(Task parentTask)(Code)
Implemented for UTILExpanderPlugin interface Break up project supply tasks into reserved transport tasks for discrete periods of time. Takes the (demand rate X period) of the project supply task and breaks this up total ammo up across several subtasks, one per month. Called from handleTask, which is called from HandleProjectSupplyTask
See Also:   AmmoProjectionExpanderPlugin.handleProjectSupplyTask transport subtasks for the parent project supply



getTrimmedDirectObject
protected Asset getTrimmedDirectObject(Asset directObject, double factor)(Code)
Assumes the direct object is either an asset group or a container (milvan). If it's a container, updates the contentsPG to reflect a new weight that is the old multiplied by factor (0.0 < factor < 1.0). Called from dealWithReservedTask.
Parameters:
  directObject - old container or asset group
Parameters:
  factor - to reduce container weight by new or old milvan with updated contentsPG
See Also:   AmmoProjectionExpanderPlugin.dealWithReservedTask



getTypesInContainer
protected Collection getTypesInContainer(Task task)(Code)
all the ammo types inside the task's milvan



getValidEndDateRanges
protected Enumeration getValidEndDateRanges(Preference endDatePref)(Code)



handleProjectSupplyTask
public void handleProjectSupplyTask(Task t)(Code)
Handle a task with verb Supply



handleTransportTask
public void handleTransportTask(Task task1, Map reservedToActual)(Code)
 find matching reservation transport task
 see if date overlaps
 if it does, publish remove it and replace it with one with altered date span and quantity
 OK - could be MUCH more efficient - blackboard queries are extremely slow!
 



interestingTask
public boolean interestingTask(Task task)(Code)
State that we are interested in all transport tasks
Parameters:
  task - the task to test. true if the tasks verb is SUPPLY, false otherwise



isEqual
public boolean isEqual(AllocationResult thisAR, AllocationResult that)(Code)
checks to see if the AllocationResult is equal to this one. We have to use this copy of the AllocationResult.isEqual because we want to to skip equals comparison of DEMANDRATE and START_TIME aspects. (why?) Mainly we need our own version of AspectValue.nearlyEquals
Parameters:
  thisAR -
Parameters:
  that - boolean



isReservedTask
protected boolean isReservedTask(Task task)(Code)



localSetup
public void localSetup()(Code)



makeMilvan
protected GLMAsset makeMilvan()(Code)
An ancillary method that creates an asset that represents a MILVAN (military container) carrying ammunition



makeMilvanID
protected String makeMilvanID()(Code)



makeSuccessfulDisposition
protected AllocationResult makeSuccessfulDisposition(Task task)(Code)
Makes allocation result with aspect values that echo the task preferences
Parameters:
  task - to dispose successful allocation result with aspect values taken from task prefs



nearlyEquals
public boolean nearlyEquals(AspectValue[] avs1, AspectValue[] avs2)(Code)
checks to see that two aspect value arrays are equal skips comparison of DEMANDRATE and START_TIME aspects. We have to skip start time, since it doesn't mean the same in the inventory world as in the transportation world.
Parameters:
  avs1 - first set
Parameters:
  avs2 - second set true if the same



numTasksInWorkflow
protected int numTasksInWorkflow(Workflow workflow)(Code)



ownWorkflow
protected boolean ownWorkflow(Task task)(Code)



processTasks
public void processTasks(List tasks)(Code)
Implemented for UTILBufferingPlugin interface
Parameters:
  tasks - that have been buffered up to this point
See Also:   org.cougaar.lib.filter.UTILBufferingPlugin.processTasks



reportChangedExpansion
public void reportChangedExpansion(Expansion cpe)(Code)
 Report to superior that the expansion has changed. 
 An override is needed here for two reasons :
 1) to add the DEMANDRATE preference value into the allocation result, 
 since downstream plugins won't set this aspect.
 2) echo the start time preference in the allocation result (why?)
 No allocation results flow upward unless reported confidence reaches 100%.
 

Parameters:
  cpe - Expansion that has changed.
See Also:   org.cougaar.lib.filter.UTILPluginAdapter.updateAllocationResult



reportContentTypes
protected String reportContentTypes(Task task, Task examinedTask)(Code)
a report on all the ammo types inside both tasks' milvan



setLoggingService
public void setLoggingService(LoggingService bs)(Code)
rely upon load-time introspection to set these services - don't worry about revokation.



setupFilters
public void setupFilters()(Code)
Uses a special callback that maintains two maps : a uidToTask map so we can do parent task lookup efficiently AND a typeToTasks map so we can look up a list of tasks by what ammo type they are
See Also:   AmmoProjectionExpanderPlugin.getMatchingTasksByType



taskInWorkflow
protected boolean taskInWorkflow(Task task, Workflow workflow)(Code)



transportDateWithinReservedWindow
protected boolean transportDateWithinReservedWindow(Task transport, Task reserved)(Code)
Must check best dates of Supply task parents. Fix for bug #12467 and #12468. The problem is that the packer can aggregate supply tasks for two different ammo types into one milvan, and the EARLIER of the two dates becomes the END_TIME best for the MP Transport task. It was this time I was using to determine overlap of the Transport Reservation that's derived from the ProjectSupply. E.g. the packer can make: Parent #1 : C380 arrive at 10/18 Parent #2 : A986 arrive at 10/15 -> MPTask with milvan arrive at 10/15 - don't want to make parent #2 be late So when we try to find the overlap with a Reservation: C380 from 9/25->10/20 if we use the MPTask's arrival time, the overlap results in a Reservation from 10/15->10/20 not from 10/18->10/20. Since the packer may do different packings from run-to-run, the quantities of Reserved ammo varies from run to run (and potentially the # of milvans).
Parameters:
  transport - - actual transport task
Parameters:
  reserved - projected transport task true if transport task overlaps in time with the reserved task



uids
protected String uids(String[] array)(Code)



uidsWorkflow
protected String uidsWorkflow(Task task)(Code)



updateMap
protected void updateMap(Map reservedToActual, Task actual, Task reserved)(Code)



Fields inherited from org.cougaar.logistics.plugin.trans.AmmoLowFidelityExpanderPlugin
protected GLMPrepPhrase glmPrepHelper(Code)(Java Doc)

Methods inherited from org.cougaar.logistics.plugin.trans.AmmoLowFidelityExpanderPlugin
protected List getPrunedTaskList(List tasks)(Code)(Java Doc)
public Vector getSubtasks(Task parentTask)(Code)(Java Doc)
public boolean interestingTask(Task task)(Code)(Java Doc)
public void localSetup()(Code)(Java Doc)
Task makeTask(Task parentTask, Asset directObject)(Code)(Java Doc)
public void processTasks(java.util.List tasks)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.