public abstract class Link extends ServiceModule
Tree structure is used to store any
related path information to a set of sources, that are themselves stored in a Thresholds
structure at the end of each path, inside a TreeNode. There are three default derived versions:
Link_B does not have any memory restrictions. It will also only increment weight
values and not decrement them.
Link_NM does not have any memory restrictions, but will decrement weight values as
well as increment them.
Link_M restricts the linking structure based on the memory (allowed numbers of entries)
and some other options. It also increments and decrements weight values.
| Modifier and Type | Field and Description |
|---|---|
protected int |
linkCount
Total number of sources at the link level
|
protected LinkSpec |
linkSpec
This stores the original linking configuration, which is used to initialise the
thresholds structures.
|
protected org.ai_heuristic.tree.Tree |
linkTree
The dynamic links structure that lists source references.
|
protected int |
maxNegative
The maximum number of allowed negative entries for each link
|
protected int |
monitorCount
Total number of sources at the monitor level
|
protected int |
possibleCount
Total number of sources at the possible level
|
protected long |
timeStamp
A time stamp indicating the time that a particular source reference is
added.
|
shutDownpasswordHandler, service, serviceTypejarFile, syncOn, uuid| Constructor and Description |
|---|
Link()
Creates a new instance of Link.
|
Link(Service service,
PasswordHandler pHandler)
Creates a new instance of Link.
|
Link(Service service,
PasswordHandler pHandler,
LinkSpec thisLinkSpec)
Creates a new instance of Link.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.ArrayList<?> |
addDynamicLinks(java.util.ArrayList sourceList)
Add sources related by some event to the component.
|
java.util.ArrayList<?> |
addDynamicLinks(java.util.ArrayList sourceList,
java.util.ArrayList<java.lang.String> conceptList)
Add sources related by some event to the component.
|
java.util.ArrayList<?> |
addDynamicLinks(java.util.ArrayList sourceList,
java.util.ArrayList<java.lang.String> conceptList,
java.util.ArrayList negative)
Add sources related by some event to the component.
|
java.lang.String |
dynamicLinksToString(boolean allLevels,
java.lang.String indent)
Return all linked sources as a string-based description.
|
org.licas_xml.abs.Element |
dynamicLinksToXml(boolean allLevels,
boolean configValues)
Return all linked sources as a list of XML elements.
|
int |
getCurrentCount(int thresholdType)
Get the current number of entries for the threshold level.
|
java.util.ArrayList<org.licas_xml.abs.Element> |
getLinkElements(org.licas_xml.abs.Element rootElem)
Parse the XML description to retrieve a list of linked sources from it.
|
java.util.ArrayList<java.lang.Object> |
getLinkSources(java.util.ArrayList<java.lang.String> concepts,
java.util.ArrayList<java.lang.Object> negativeConcepts)
Return a list of sources linked to the current source, using the
specified concept path.
|
org.ai_heuristic.tree.Tree |
getLinkTree()
Get the list of related sources
|
long |
getThresholdCount(int thresholdLevel)
Get the total number of sources stored as links in all threshold structures.
|
long |
getThresholdCount(org.ai_heuristic.tree.TreeNode treeNode,
int thresholdLevel)
Get the total number of sources stored as links in all threshold structures.
|
java.util.HashMap<java.lang.String,java.lang.Long> |
getTotalInstancesCount()
Count the number of instances of each source type in the different threshold structures.
|
protected void |
getTotalInstancesCount(org.ai_heuristic.tree.TreeNode treeNode,
java.util.HashMap<java.lang.String,java.lang.Long> totalInstances)
Count the number of instances of each source type in the different threshold structures.
|
protected java.lang.String |
getUuid(java.lang.Object componentObj)
Return the id of the component.
|
org.licas_xml.abs.Element |
linkQuery(LinkQueryConfig queryConfig)
Perform a query over the link paths to return matching sources.
|
protected void |
resetRelatedThresholds()
Reset all end linking threshold structures to the original specification.
|
protected void |
resetRelatedThresholds(org.ai_heuristic.tree.TreeNode nextSources)
Reset the next end linking threshold structure to the original specification.
|
protected void |
resetUpdatedThresholds()
Reset all end linking threshold structure updates to zero, for a new update batch.
|
protected void |
resetUpdatedThresholds(org.ai_heuristic.tree.TreeNode nextSources)
Reset the next end linking threshold structure updates to zero, for a new update batch.
|
void |
resetValues()
Reset the values
|
void |
setThresholds(org.licas_xml.abs.Element thresholdsXml)
Set the initial threshold values for this component.
|
void |
setThresholds(LinkSpec copyLinkSpec)
Set the initial threshold values for this component.
|
void |
setThresholds(Thresholds copyTo)
Set the threshold values for the
Thresholds parameter. |
protected abstract 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.
|
void |
xmlToDynamicLinks(org.licas_xml.abs.Element linksElem)
Parse the xml description and fill the link spec and structure with the dynamic links.
|
getShutDown, 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 long timeStamp
protected org.ai_heuristic.tree.Tree linkTree
protected LinkSpec linkSpec
protected int linkCount
protected int monitorCount
protected int possibleCount
protected int maxNegative
public Link()
throws java.lang.Exception
setServiceDetails later.java.lang.Exception - any error.public Link(Service service, PasswordHandler pHandler) throws java.lang.Exception
service - the parent service.pHandler - the parent password handler.java.lang.Exception - any error.public Link(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.protected abstract 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
theThresholds - 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.public void resetValues()
public void setThresholds(LinkSpec copyLinkSpec) throws java.lang.Exception
copyLinkSpec - a full config description for any threshold objects.java.lang.Exception - any error.public void setThresholds(org.licas_xml.abs.Element thresholdsXml)
throws java.lang.Exception
thresholdsXml - the root config element.java.lang.Exception - any error.public void setThresholds(Thresholds copyTo) throws java.lang.Exception
Thresholds parameter. The object that is
passed in is set with the default values for this service.copyTo - the threshold object to set values for.java.lang.Exception - any error.protected void resetRelatedThresholds()
throws java.lang.Exception
java.lang.Exception - any error.protected void resetRelatedThresholds(org.ai_heuristic.tree.TreeNode nextSources)
throws java.lang.Exception
nextSources - next sources root node.java.lang.Exception - any error.protected void resetUpdatedThresholds()
throws java.lang.Exception
java.lang.Exception - any error.protected void resetUpdatedThresholds(org.ai_heuristic.tree.TreeNode nextSources)
throws java.lang.Exception
nextSources - next sources root node.java.lang.Exception - any error.public java.util.ArrayList<?> addDynamicLinks(java.util.ArrayList sourceList)
throws java.lang.Exception
Const.LINKS is added.sourceList - the list of source URIs to add, or link URIs to update.java.lang.Exception - any error.public java.util.ArrayList<?> addDynamicLinks(java.util.ArrayList sourceList,
java.util.ArrayList<java.lang.String> conceptList)
throws java.lang.Exception
sourceList - the list of source URIs to add, or link URIs to update.conceptList - the list of concepts that make up the linking path.
This should not be null and include at least 1 value.java.lang.Exception - any error.public java.util.ArrayList<?> addDynamicLinks(java.util.ArrayList sourceList,
java.util.ArrayList<java.lang.String> conceptList,
java.util.ArrayList negative)
throws java.lang.Exception
sourceList - the list of source URIs to add, or link URIs to update.conceptList - the list of concepts that make up the linking path.
This should not be null and include at least 1 value. If not, then a concept list
with a single dummy value of Const.LINKS is used.negative - a list of negative comparisons. This can be empty.java.lang.Exception - any error.public java.util.HashMap<java.lang.String,java.lang.Long> getTotalInstancesCount()
throws java.lang.Exception
java.lang.Exception - any error.protected void getTotalInstancesCount(org.ai_heuristic.tree.TreeNode treeNode,
java.util.HashMap<java.lang.String,java.lang.Long> totalInstances)
throws java.lang.Exception
treeNode - next sources list.totalInstances - instances count.java.lang.Exception - any error.public long getThresholdCount(int thresholdLevel)
thresholdLevel - the threshold level: link, monitor or possible.public long getThresholdCount(org.ai_heuristic.tree.TreeNode treeNode,
int thresholdLevel)
treeNode - next list of sources.thresholdLevel - the threshold level: link, monitor or possible.public java.lang.String dynamicLinksToString(boolean allLevels,
java.lang.String indent)
throws java.lang.Exception
allLevels - if true, return all 3 levels, if false only return the top link level
references.indent - for formatting purposes, can be null.java.lang.Exception - any error.public org.licas_xml.abs.Element dynamicLinksToXml(boolean allLevels,
boolean configValues)
throws java.lang.Exception
allLevels - if true, return all 3 levels, if false only return the top link level
references.configValues - if false, return just the path and source info.
If true, include other values, such as config, as well.java.lang.Exception - any error.public java.util.ArrayList<org.licas_xml.abs.Element> getLinkElements(org.licas_xml.abs.Element rootElem)
rootElem - the root tree element to parse from.public void xmlToDynamicLinks(org.licas_xml.abs.Element linksElem)
throws java.lang.Exception
linksElem - the dynamic links description.java.lang.Exception - any error.public java.util.ArrayList<java.lang.Object> getLinkSources(java.util.ArrayList<java.lang.String> concepts,
java.util.ArrayList<java.lang.Object> negativeConcepts)
throws java.lang.Exception
concepts - the list of concepts to match the path keys to.negativeConcepts - a list of concepts that would stop the link being used.
This is typically null.java.lang.Exception - any error.public org.licas_xml.abs.Element linkQuery(LinkQueryConfig queryConfig) throws java.lang.Exception
queryConfig - the query configuration.java.lang.Exception - any error.public int getCurrentCount(int thresholdType)
thresholdType - the threshold structure type.protected java.lang.String getUuid(java.lang.Object componentObj)
componentObj - the component representation.public org.ai_heuristic.tree.Tree getLinkTree()