info.simongibbs.scoof
Class CodeBase

java.lang.Object
  extended byinfo.simongibbs.scoof.CodeBase

public class CodeBase
extends java.lang.Object

Manages the execution of a search process and co-ordinates all related activities.

Version:
$Revision: 1.7 $
Author:
Simon Gibbs

Field Summary
static int DEFAULT_BLOCK_SIZE
           
 
Constructor Summary
CodeBase(java.lang.String name, java.io.File root)
          Constructor for CodeBase.
 
Method Summary
 void announceTarget(Target newTarget)
           
 java.util.Collection getBadFiles()
          Provides access to the bag of files which could not be opened or processed sucessfully.
 int getBlockSize()
          Retrieves the number of normalised lines to use to form a block for hash generation.
 java.util.Collection getHits()
          Returns the final prepared data, although there is no guarantee of completeness unless the spider and worker threads have been checked.
 java.lang.String getName()
          Returns the name.
 java.util.Collection getPassages()
          Provides access to the individual code passages built in audit mode.
 Spider getSpider()
          Returns a reference to the associated Spider.
 java.util.List getTargets()
          Provides access to the new file queue.
 java.util.Collection getTaskList()
          Obtain a collection of outstanding tasks.
 boolean isInAuditMode()
          Audit mode signals to collaborating classes to append identified passages to the passages collection.
static void main(java.lang.String[] args)
           
 SearchTask nextTask()
           
 void search()
          Triggers a spider thread and starts work on the queue.
 void setBlockSize(int i)
          Sets a new block size, hashes will be generated for this number of consecutive lines.
 void setInAuditMode(boolean inAuditMode)
          Specify audit modality.
 void setSpider(Spider spider)
          Supplies a Spider so that Spidering can occur.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BLOCK_SIZE

public static final int DEFAULT_BLOCK_SIZE
See Also:
Constant Field Values
Constructor Detail

CodeBase

public CodeBase(java.lang.String name,
                java.io.File root)
Constructor for CodeBase.

Parameters:
name - the name of the product under analysis.
root - a starting point for a Spider.
Method Detail

isInAuditMode

public boolean isInAuditMode()
Audit mode signals to collaborating classes to append identified passages to the passages collection. This is additional to the hashed hits and allows the program performance to be verified.

Returns:
true if passages are to be kept

setInAuditMode

public void setInAuditMode(boolean inAuditMode)
Specify audit modality.

Parameters:
inAuditMode -

getPassages

public java.util.Collection getPassages()
Provides access to the individual code passages built in audit mode.

Returns:
Collection comment passages

getHits

public java.util.Collection getHits()
Returns the final prepared data, although there is no guarantee of completeness unless the spider and worker threads have been checked.

Returns:
Collection

getName

public java.lang.String getName()
Returns the name.

Returns:
String

getBadFiles

public java.util.Collection getBadFiles()
Provides access to the bag of files which could not be opened or processed sucessfully.


getTargets

public java.util.List getTargets()
Provides access to the new file queue.

Returns:
List

search

public void search()
Triggers a spider thread and starts work on the queue. Blocks untill the entire process is complete.


announceTarget

public void announceTarget(Target newTarget)

nextTask

public SearchTask nextTask()

main

public static void main(java.lang.String[] args)

getBlockSize

public int getBlockSize()
Retrieves the number of normalised lines to use to form a block for hash generation.

Returns:
int prefered block size

setBlockSize

public void setBlockSize(int i)
Sets a new block size, hashes will be generated for this number of consecutive lines.

Parameters:
i -

getSpider

public Spider getSpider()
Returns a reference to the associated Spider.

Returns:
Spider

getTaskList

public java.util.Collection getTaskList()
Obtain a collection of outstanding tasks.

Returns:
Collection

setSpider

public void setSpider(Spider spider)
Supplies a Spider so that Spidering can occur.

Parameters:
spider -