| java.lang.Object org.cougaar.lib.util.UTILAsset org.cougaar.glm.util.AssetUtil
AssetUtil | public class AssetUtil extends UTILAsset (Code) | | This class contains utility functions for getting
Assets.
|
Method Summary | |
public Vector | ExpandAsset(PlanningFactory theFactory, Asset asset)
convert an AssetGroup/AggregateAsset into it's component assets,
recursing through any contained AssetGroup/AggregateAssets as
needed.
Note : Convoys are AssetGroups, so the contents of the convoy
will also appear on the result list.
Will take an aggregate asset and create new instances that are
copies of the asset of the aggregation. | public boolean | checkTaskAgainstRoleSchedule(Asset a, Task t) Check to see if the task fits in the role schedule of the asset.
DON'T perform any allocation, assignment, etc. | public Organization | findPortOrg(GeolocLocation loc, Enumeration ports_en, String myClusterName) Utility method - find the organization corresponding to the port at
the given location
Parameters: loc - he location Parameters: ports_en - a list of ports to search: probably obtained by a call togetOrganizationAssets() Parameters: myClusterName - used for logger.isDebugEnabled()()ging purposes. | protected synchronized int | getLatestUID() | public GeolocLocation | getMostRecentKnownPosition(Asset a, Date time) Necessary for accurate ship location computation.
NOTE that travel isn't taken into account in that if the time specified
is in the middle of the time when the asset is traveling between tasks,
the position reported will be the end of the last task. | public String | getNodeNames(TransportationRoute route) Inefficient... | public Organization | getOrg(HashMap table, String geolocCode) Finds the organization with the given geolocCode in the given table. | public Organization | getOrgAsst(Iterator assets, String desiredRole) Utility method for finding organization/cluster assets. | public List | getOrgAssts(Iterator assets, String desiredRole) Utility method for finding organization/cluster assets. | public List | getOrgList(HashMap table, String geolocCode) | public GeolocLocation | getOrgLocation(Organization o) | public Organization | getSelf(Enumeration clusterAssets) This call gets oneself as an organization asset. | public String | getUniqueTag(Asset a) | public boolean | hasOrg(HashMap table, String geolocCode) | public boolean | isAmmo(Asset asset) check to see if an asset represents ammo
works with an aggregate asset too. | public boolean | isAmmoPort(Asset p) | public boolean | isCargoPort(Asset p) | public boolean | isConsumable(Asset asset) | public boolean | isPallet(Asset asset) | public boolean | isPassenger(Asset asset) | public boolean | isPrepoTask(Task t)
See if a task is a prepo task (i.e. | public boolean | isRepairable(Asset asset) | public boolean | isStandardContainer(Asset a) | public boolean | isVehicle(Asset a) Determines if the asset passed in is a vehicle (for purposes of ship
loading) or not. | public boolean | isVehicleOrAircraft(Asset a) Determines if the asset passed in is a vehicle (for purposes of ship
loading) or not OR is a crated aircraft. | final public Convoy | makeConvoy(PlanningFactory root, String uniqueID) | public HashMap | orgAssetLocation(List organizations) creates a HashMap of organizations with their geolocCodes as keys. | public void | setMaxCubicFt(double max) These control how big something must be before it is made into
distinct assets instead of remaining within an aggregate asset. | public void | setMaxSqFt(double max) | public Area | totalAdjustedArea(Asset asset) | public Volume | totalAdjustedVolume(Asset asset) | public Area | totalArea(Asset asset) | public Area | totalArea(Asset asset, boolean ignoreContainers) | public long | totalContainers(Asset asset) | public double | totalCubicMeters(Asset asset) | public Mass | totalMass(Asset asset) | public double | totalSquareFeet(Asset asset) helper function, gets the total square feet footprint of an asset
( regardless of whether it's
an Asset, AssetGroup, AggregateAsset, or whatever)
Parameters: asset - the asset double the area of the asset in sqr. | public double | totalTons(Asset asset) | public Volume | totalVolume(Asset asset) | public Volume | totalVolume(Asset asset, boolean ignoreVehiclesAndContainers) |
AMMO_PORT_ROLE | final public static Role AMMO_PORT_ROLE(Code) | | |
AMMO_PORT_ROLE_ALT | final public static Role AMMO_PORT_ROLE_ALT(Code) | | |
CARGO_PORT_ROLE | final public static Role CARGO_PORT_ROLE(Code) | | |
latestUID | protected int latestUID(Code) | | |
ExpandAsset | public Vector ExpandAsset(PlanningFactory theFactory, Asset asset)(Code) | |
convert an AssetGroup/AggregateAsset into it's component assets,
recursing through any contained AssetGroup/AggregateAssets as
needed.
Note : Convoys are AssetGroups, so the contents of the convoy
will also appear on the result list.
Will take an aggregate asset and create new instances that are
copies of the asset of the aggregation. These will have
item id's like "xxx-7_of_9_from_yyy", where xxx is the original id,
the quantity of the aggregate asset is 9, and yyy is the number of times
this method has been called. Yes, you might ask, why not use the
aggregate's UID? Well this seems to be null. Why not the agg's asset?
Well, this is just a prototype, so two different aggregations will
have the same asset, giving us the same UID.
This allows the receipt of two aggregates of the same type of object
creating distinct subobjects. Otherwise a M1A1-7_of_9 from one aggregate
would be equals() and hashcode() equal to a M1A1-7_of_9 from another.
This is needed since now Assets are equal on the basis of type and item
PG equality. (01/23/99 GWFV)
Will not break up aggregate
assets where the items are smaller than one cubic foot.
Parameters: asset - AssetGroup/AggreateAsset to divide Vector of sub-objects |
checkTaskAgainstRoleSchedule | public boolean checkTaskAgainstRoleSchedule(Asset a, Task t)(Code) | | Check to see if the task fits in the role schedule of the asset.
DON'T perform any allocation, assignment, etc. just check for
enough space.
FOR NOW, (!!FIXIT!!) we're assuming the ship is EMPTY unless
fully allocated, i.e. you have to manage the loading yourself
without actually adding something on the ship until you add
everything in one big block. You can actually get into the guts
of the asset and check the role schedule for yourself if you really
want to, but it's kind of ugly.
There are two possible legal cases (i.e. no nulls or other errors) in
which this method will return false: the role schedule doesn't have
availability for a task, or the role schedule already has plan elements
in the time window where we want the task to fit that make the schedule
unfeasible.
|
findPortOrg | public Organization findPortOrg(GeolocLocation loc, Enumeration ports_en, String myClusterName)(Code) | | Utility method - find the organization corresponding to the port at
the given location
Parameters: loc - he location Parameters: ports_en - a list of ports to search: probably obtained by a call togetOrganizationAssets() Parameters: myClusterName - used for logger.isDebugEnabled()()ging purposes. the port that matches the location. |
getLatestUID | protected synchronized int getLatestUID()(Code) | | |
getMostRecentKnownPosition | public GeolocLocation getMostRecentKnownPosition(Asset a, Date time)(Code) | | Necessary for accurate ship location computation.
NOTE that travel isn't taken into account in that if the time specified
is in the middle of the time when the asset is traveling between tasks,
the position reported will be the end of the last task. This is as intended.
If the time specified is in the middle of a task, we interpolate. (!!FIXIT!!)
GeolocLocation representing the current position of the assetat the time specified. returns null if none found |
getOrg | public Organization getOrg(HashMap table, String geolocCode)(Code) | | Finds the organization with the given geolocCode in the given table.
Parameters: table - the table to search Parameters: geolocCode - the string to search for Organization the organization with the geolocCode. |
getOrgAsst | public Organization getOrgAsst(Iterator assets, String desiredRole)(Code) | | Utility method for finding organization/cluster assets.
Parameters: assets - the Enumeration of assets received from the asset container Parameters: desiredRole - a string describing the capable role of an organizationthe string is defined in the mycluster-prototype-ini.dat file in the topsconfig directory. Organization that has the role described in desiredRole |
getOrgAssts | public List getOrgAssts(Iterator assets, String desiredRole)(Code) | | Utility method for finding organization/cluster assets.
Parameters: assets - the Enumeration of assets received from the asset container Parameters: desiredRole - a string describing the capable role of an organizationthe string is defined in the mycluster-prototype-ini.dat file in the topsconfig directory. Organization that has the role described in desiredRole |
getSelf | public Organization getSelf(Enumeration clusterAssets)(Code) | | This call gets oneself as an organization asset.
Parameters: clusterAssets - the En of assets received from the asset container Organization which represents current cluster |
isAmmo | public boolean isAmmo(Asset asset)(Code) | | check to see if an asset represents ammo
works with an aggregate asset too.
Something is ammo it's an instance of org.cougaar.glm.ldm.asset.Ammunition OR
The type identification PG's nomenclature is Ammunition
See Also: org.cougaar.glm.ldm.asset.Ammunition Parameters: asset - the asset to check boolean |
isAmmoPort | public boolean isAmmoPort(Asset p)(Code) | | test if port is an ammo port
Parameters: p - Organization to be tested true if is an ammo port |
isCargoPort | public boolean isCargoPort(Asset p)(Code) | | test if organization is a non-ammo port
Parameters: p - Organization to be tested true if it is a generic port |
isConsumable | public boolean isConsumable(Asset asset)(Code) | | check to see if an asset represents a consumable
Parameters: asset - the asset to check boolean |
isPallet | public boolean isPallet(Asset asset)(Code) | | check to see if an asset represents a Pallet
Parameters: asset - the asset to check boolean |
isPassenger | public boolean isPassenger(Asset asset)(Code) | | check to see if an asset represents a passenger
Parameters: asset - the asset to check boolean |
isPrepoTask | public boolean isPrepoTask(Task t)(Code) | |
See if a task is a prepo task (i.e.
already packed in a ship hanging arround
in the middle of the ocean somewhere).
The check is made to see if the task has a WITH
preposition.
We look up the ship referred to by the String (Ship ID)
in GlobalSea, where the ships are owned.
Parameters: t - task to check boolean |
isRepairable | public boolean isRepairable(Asset asset)(Code) | | check to see if an asset represents a repairable
Parameters: asset - the asset to check boolean |
isStandardContainer | public boolean isStandardContainer(Asset a)(Code) | | Determines if the asset passed in is a standard container or not
|
isVehicle | public boolean isVehicle(Asset a)(Code) | | Determines if the asset passed in is a vehicle (for purposes of ship
loading) or not.
|
isVehicleOrAircraft | public boolean isVehicleOrAircraft(Asset a)(Code) | | Determines if the asset passed in is a vehicle (for purposes of ship
loading) or not OR is a crated aircraft.
These items are packed on ship by area.
|
orgAssetLocation | public HashMap orgAssetLocation(List organizations)(Code) | | creates a HashMap of organizations with their geolocCodes as keys.
Parameters: organizations - the en of organizations to be put in the hashmap HashMap the newly constructed table with geolocCodes as keys,and the corresponding organization as object. |
setMaxCubicFt | public void setMaxCubicFt(double max)(Code) | | These control how big something must be before it is made into
distinct assets instead of remaining within an aggregate asset.
|
setMaxSqFt | public void setMaxSqFt(double max)(Code) | | |
totalAdjustedArea | public Area totalAdjustedArea(Asset asset)(Code) | | get the total Area of an asset regardless of whether it's
an Asset, AssetGroup, AggregateAsset, or whatever
BUT adjusted for the peculiar semantics of asset handling in GlobalSea
>Vehicles only have footprint area
>Containers only have volume
Parameters: asset - the asset Area the total area of the asset |
totalAdjustedVolume | public Volume totalAdjustedVolume(Asset asset)(Code) | | get the total Volume of an asset
( regardless of whether it's
an Asset, AssetGroup, AggregateAsset, or whatever)
Parameters: asset - the asset Volume the total volume of the asset |
totalArea | public Area totalArea(Asset asset)(Code) | | get the total Area of an asset regardless of whether it's
an Asset, AssetGroup, AggregateAsset, or whatever
Parameters: asset - the asset Area the total area of the asset |
totalArea | public Area totalArea(Asset asset, boolean ignoreContainers)(Code) | | |
totalContainers | public long totalContainers(Asset asset)(Code) | | |
totalCubicMeters | public double totalCubicMeters(Asset asset)(Code) | | helper function, gets the total volume of an asset
( regardless of whether it's
an Asset, AssetGroup, AggregateAsset, or whatever)
Parameters: asset - the asset double the volume of the asset in cubic meters |
totalMass | public Mass totalMass(Asset asset)(Code) | | get the total Mass of an asset
( regardless of whether it's
an Asset, AssetGroup, AggregateAsset, or whatever)
Parameters: asset - the asset Mass the total mass of the asset |
totalSquareFeet | public double totalSquareFeet(Asset asset)(Code) | | helper function, gets the total square feet footprint of an asset
( regardless of whether it's
an Asset, AssetGroup, AggregateAsset, or whatever)
Parameters: asset - the asset double the area of the asset in sqr. ft. |
totalTons | public double totalTons(Asset asset)(Code) | | helper function, gets the total mass of an asset
( regardless of whether it's
an Asset, AssetGroup, AggregateAsset, or whatever)
Parameters: asset - the asset double the mass of the asset in cubic meters |
totalVolume | public Volume totalVolume(Asset asset)(Code) | | get the total Volume of an asset
( regardless of whether it's
an Asset, AssetGroup, AggregateAsset, or whatever)
Parameters: asset - the asset Volume the total volume of the asset |
totalVolume | public Volume totalVolume(Asset asset, boolean ignoreVehiclesAndContainers)(Code) | | |
|
|