public class Link_M extends Link
| Modifier and Type | Field and Description |
|---|---|
protected java.util.HashMap<java.lang.String,java.lang.Integer> |
linkBorrowed
Link source slots borrowed from another component.
|
protected int |
linkBorrowedCount
Total number of link sources borrowed
|
protected java.util.HashMap<java.lang.String,java.lang.Integer> |
linkLent
Link source slots lent to another component.
|
protected Thresholds |
minThresholds
The threshold values that store the currently selected minimum source.
|
protected java.util.HashMap<java.lang.String,java.lang.Integer> |
monitorBorrowed
Monitor source slots borrowed from another component.
|
protected int |
monitorBorrowedCount
Total number of monitor sources borrowed
|
protected java.util.HashMap<java.lang.String,java.lang.Integer> |
monitorLent
Monitor source slots lent to another component.
|
protected java.util.HashMap<java.lang.String,java.lang.Integer> |
possibleBorrowed
Possible source slots borrowed from another component.
|
protected int |
possibleBorrowedCount
Total number of possible sources borrowed
|
protected java.util.HashMap<java.lang.String,java.lang.Integer> |
possibleLent
Possible source slots lent to another component.
|
linkCount, linkSpec, linkTree, maxNegative, monitorCount, possibleCount, timeStampshutDownpasswordHandler, service, serviceTypejarFile, syncOn, uuid| Constructor and Description |
|---|
Link_M()
Creates a new instance of Link_M.
|
Link_M(Service service,
PasswordHandler pHandler)
Creates a new instance of Link_M.
|
Link_M(Service service,
PasswordHandler pHandler,
LinkSpec thisLinkSpec)
Creates a new instance of Link_M.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
addNewSource(java.util.ArrayList<java.lang.String> conceptPath,
java.lang.Object source,
Thresholds thisThresholds,
long timeStamp,
boolean updateIndividual)
Add or update the new source swapping other sources if required.
|
int |
askForMemory(int thresholdType,
int slotNumber)
Ask the components stored here for any available memory they are not using.
|
void |
changeBorrowedMemory(java.lang.String componentID,
int thresholdType,
int memory)
Update the appropriate memory structure to record the new borrowed amount of memory.
|
void |
changeCurrentMemory(int thresholdType,
int memory)
Update the appropriate memory structure to record the new allowed amount of memory.
|
void |
changeLentMemory(java.lang.String componentID,
int thresholdType,
int memory)
Update the appropriate memory structure to record the new lent amount of memory.
|
void |
checkAllMemory()
Check memory in all structures to make sure it totals to correct amount.
|
void |
checkCurrentMemory(int thresholdType)
Check that the memory for the threshold level is OK.
|
int |
getCurrentMemory(int thresholdType)
Get the current working amount of memory for the threshold level.
|
int |
getMemory(int thresholdType,
int slotNumber,
java.util.ArrayList<java.lang.String> conceptPath)
Tell a component to give up some memory as the lender wants it back.
|
protected ThresholdSource |
getMinimumSource(int thresholdType,
java.util.ArrayList<java.lang.String> keyValues,
java.util.ArrayList<java.lang.String> conceptPath,
org.ai_heuristic.tree.TreeNode treeNode,
ThresholdSource minTSource)
Get the minimum source details.
|
protected ThresholdSource |
getMinimumSource(int thresholdType,
java.util.ArrayList<java.lang.String> conceptPath,
java.lang.String sourceType)
Get the minimum source details in the specified threshold structure.
|
int |
getOriginalMemory(int thresholdType)
Get the original working amount of memory for the threshold level.
|
int |
memoryToLend(int thresholdType)
Return the amount of memory that this component can lend.
|
protected void |
moveSourceDown(Thresholds theThresholds,
int thresholdType,
java.lang.Object source)
Move the specified source in the linkSpec structure down to the next level.
|
protected void |
moveSourcesDown(java.util.ArrayList<java.lang.String> conceptPath,
java.util.ArrayList<java.lang.Object> sources,
Thresholds thisThresholds)
Move any sources not used in the answer down a level if required.
|
protected void |
moveSourceUp(Thresholds theThresholds,
int thresholdType,
java.lang.Object source)
Move the specified source in the linkSpec structure up to the next level.
|
void |
releaseMemory(java.lang.String componentID,
int thresholdType,
int slotNumber,
java.util.ArrayList<java.lang.String> conceptPath)
The component must remove the specified number of slots from its relative structure.
|
void |
removeSource(Thresholds theThresholds,
int thresholdType,
java.lang.Object source)
Remove the specified source from the linkSpec structure.
|
void |
resetValues()
Reset the values
|
int |
totalBorrowedMemory(int thresholdLevel)
Return the total amount of memory this component has borrowed.
|
int |
totalLentMemory(int thresholdLevel)
Return the total amount of memory this component has lent.
|
protected void |
updateThresholds(Thresholds theThresholds,
java.util.ArrayList<java.lang.String> conceptPath,
java.util.ArrayList newSources,
long timeStamp,
java.util.ArrayList sourcesAdded,
java.util.ArrayList negative)
Update the linkSpec structure.
|
addDynamicLinks, addDynamicLinks, addDynamicLinks, dynamicLinksToString, dynamicLinksToXml, getCurrentCount, getLinkElements, getLinkSources, getLinkTree, getThresholdCount, getThresholdCount, getTotalInstancesCount, getTotalInstancesCount, getUuid, linkQuery, resetRelatedThresholds, resetRelatedThresholds, resetUpdatedThresholds, resetUpdatedThresholds, setThresholds, setThresholds, setThresholds, xmlToDynamicLinksgetShutDown, interrupt, setShutDown, setShutDowncanAccess, canAccessTemp, getPasswordHandler, getPasswordHandler, getServerPassword, getServicePassword, getServiceType, isAdminKey, setServiceDetails, setServiceTypegetJarFile, getUUID, loadObject, setJarFile, setUUID, threadAliveStateactiveCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetUUID, setJarFile, setUUIDprotected Thresholds minThresholds
protected int linkBorrowedCount
protected int monitorBorrowedCount
protected int possibleBorrowedCount
protected java.util.HashMap<java.lang.String,java.lang.Integer> linkLent
protected java.util.HashMap<java.lang.String,java.lang.Integer> linkBorrowed
protected java.util.HashMap<java.lang.String,java.lang.Integer> monitorLent
protected java.util.HashMap<java.lang.String,java.lang.Integer> monitorBorrowed
protected java.util.HashMap<java.lang.String,java.lang.Integer> possibleLent
protected java.util.HashMap<java.lang.String,java.lang.Integer> possibleBorrowed
public Link_M()
throws java.lang.Exception
setServiceDetails later.java.lang.Exception - any error.public Link_M(Service service, PasswordHandler pHandler) throws java.lang.Exception
service - the parent service.pHandler - the parent password handler.java.lang.Exception - any error.public Link_M(Service service, PasswordHandler pHandler, LinkSpec thisLinkSpec) throws java.lang.Exception
service - the parent service.pHandler - the parent password handler.thisLinkSpec - the config to use for initialising the thresholds structures.java.lang.Exception - any error.public void resetValues()
resetValues in class Linkprotected void updateThresholds(Thresholds theThresholds, java.util.ArrayList<java.lang.String> conceptPath, java.util.ArrayList newSources, long timeStamp, java.util.ArrayList sourcesAdded, java.util.ArrayList negative) throws java.lang.Exception
updateThresholds in class LinktheThresholds - the linkSpec structure.conceptPath - a preferred path to find in the tree.newSources - list of sources to add or update.timeStamp - time stamp for update.sourcesAdded - a list of all added sources over all of the update calls.negative - a list of negative source results.java.lang.Exception - any error.protected boolean addNewSource(java.util.ArrayList<java.lang.String> conceptPath,
java.lang.Object source,
Thresholds thisThresholds,
long timeStamp,
boolean updateIndividual)
throws java.lang.Exception
conceptPath - a preferred path to find in the tree.source - the representation of the source used.thisThresholds - the parent thresholds structure.timeStamp - the current time for adding sources.updateIndividual - true if update individual links only.java.lang.Exception - any error.protected void moveSourcesDown(java.util.ArrayList<java.lang.String> conceptPath,
java.util.ArrayList<java.lang.Object> sources,
Thresholds thisThresholds)
throws java.lang.Exception
conceptPath - a preferred path to find in the tree.sources - the representations of the sources used.thisThresholds - the linkSpec structure.java.lang.Exception - any error.protected ThresholdSource getMinimumSource(int thresholdType, java.util.ArrayList<java.lang.String> conceptPath, java.lang.String sourceType) throws java.lang.Exception
thresholdType - The threshold structure to query: link, monitor or possible.conceptPath - a preferred path to find in the tree.sourceType - the type of source currently being added.java.lang.Exception - any error.protected ThresholdSource getMinimumSource(int thresholdType, java.util.ArrayList<java.lang.String> keyValues, java.util.ArrayList<java.lang.String> conceptPath, org.ai_heuristic.tree.TreeNode treeNode, ThresholdSource minTSource) throws java.lang.Exception
thresholdType - The threshold structure to query: link, monitor or possible.keyValues - list of actual related sources key values.conceptPath - a preferred path to find in the tree.treeNode - next related sources structure.minTSource - the current minimum threshold source.java.lang.Exception - any error.protected void moveSourceDown(Thresholds theThresholds, int thresholdType, java.lang.Object source) throws java.lang.Exception
theThresholds - the linkSpec structure.thresholdType - the threshold level moving down from.source - the source representation.java.lang.Exception - any error.protected void moveSourceUp(Thresholds theThresholds, int thresholdType, java.lang.Object source) throws java.lang.Exception
theThresholds - the linkSpec structure.thresholdType - the threshold level moving up from.source - the source representation.java.lang.Exception - any error.public void removeSource(Thresholds theThresholds, int thresholdType, java.lang.Object source) throws java.lang.Exception
theThresholds - the linkSpec structure.thresholdType - the threshold level.source - the source representation.java.lang.Exception - any error.public void changeCurrentMemory(int thresholdType,
int memory)
throws java.lang.Exception
thresholdType - the threshold structure type.memory - the amount of change. Can be positive or negative.java.lang.Exception - any error.public void releaseMemory(java.lang.String componentID,
int thresholdType,
int slotNumber,
java.util.ArrayList<java.lang.String> conceptPath)
throws java.lang.Exception
componentID - the id for the component retrieving its memory.thresholdType - the threshold structure.slotNumber - the number of slots to release.conceptPath - a preferred path to find in the tree.java.lang.Exception - any error.public int askForMemory(int thresholdType,
int slotNumber)
throws java.lang.Exception
thresholdType - the threshold structure type.slotNumber - number of slots to release.java.lang.Exception - any error.public int getMemory(int thresholdType,
int slotNumber,
java.util.ArrayList<java.lang.String> conceptPath)
throws java.lang.Exception
thresholdType - the threshold structure type.slotNumber - number of slots to release.conceptPath - a preferred path to find in the tree.java.lang.Exception - any error.public int memoryToLend(int thresholdType)
throws java.lang.Exception
thresholdType - the threshold structure type.java.lang.Exception - any error.public void changeLentMemory(java.lang.String componentID,
int thresholdType,
int memory)
throws java.lang.Exception
componentID - the id of the component lending/retrieving its memory.thresholdType - the threshold structure type.memory - the amount of change. Can be positive or negative.java.lang.Exception - any error.public void changeBorrowedMemory(java.lang.String componentID,
int thresholdType,
int memory)
throws java.lang.Exception
componentID - the id of the component lending/retrieving its memory.thresholdType - the threshold structure type.memory - the amount of change. Can be positive or negative.java.lang.Exception - any error.public int totalBorrowedMemory(int thresholdLevel)
throws java.lang.Exception
thresholdLevel - the threshold structure level.java.lang.Exception - any error.public int totalLentMemory(int thresholdLevel)
throws java.lang.Exception
thresholdLevel - the threshold structure level.java.lang.Exception - any error.public void checkCurrentMemory(int thresholdType)
throws java.lang.Exception
thresholdType - the threshold level.java.lang.Exception - any error.public void checkAllMemory()
throws java.lang.Exception
java.lang.Exception - any error.public int getCurrentMemory(int thresholdType)
thresholdType - the threshold structure type.public int getOriginalMemory(int thresholdType)
thresholdType - the threshold structure type.