EASE.Factories
Class Factory

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--EASE.Factories.Factory
Direct Known Subclasses:
NumberFactory, VectorFactory

public class Factory
extends java.lang.Thread
implements Constants

This is the class for a generic factory.


Field Summary
 boolean asleep
           
protected  Debugger debugger
           
private  boolean debuggingOn
           
private  java.lang.Object defaultOutput
           
private  java.util.Vector engineers
           
private  java.util.Vector listeners
           
protected  java.lang.String name
           
protected  java.lang.Object nextProposed
           
private  int noOfEngineers
           
protected  java.lang.Object output
           
(package private)  java.lang.Double paused
           
 boolean reallyasleep
           
 
Fields inherited from class java.lang.Thread
contextClassLoader, daemon, eetop, group, inheritedAccessControlContext, initial_stack_memory, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, PrivateInfo, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadQ, values
 
Constructor Summary
Factory(java.lang.String name, java.lang.ThreadGroup group)
           
Factory(java.lang.String name, java.lang.ThreadGroup group, java.lang.Object defaultOutput)
           
 
Method Summary
 void addEngineer(InstantiatedEngineer eng)
          Function to allow engineers to register their interest in the factory.
 void addListener(NegotiationListener l)
           
private  double calcSatis(double priority, double satisfaction)
           
protected  java.lang.Object getDefaultOutput()
           
 java.lang.String getFactoryName()
           
 java.util.Vector getRegisteredEngineers()
           
protected  java.lang.Object nextProposed(java.lang.Object lastProposed)
          Function to come up with a new suggested value for the factory output.
 java.lang.Object output()
          This is the function that the agent controller will call to get the output from the thread.
private  boolean reevaluateBest(java.util.Vector engineers, java.lang.Object output, double[] outputSatis, int noEngineers)
           
 void removeEngineer(InstantiatedEngineer eng)
          Function to allow engineers to finish with the factory.
 void removeListener(NegotiationListener l)
           
 void run()
           
 void safeSuspend()
          Used to stop the factory safely
 void setFactoryName(java.lang.String name)
           
private  void swap(double[] arr, int i)
          Swap array element with next array element
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

asleep

public boolean asleep

reallyasleep

public boolean reallyasleep

listeners

private java.util.Vector listeners

engineers

private java.util.Vector engineers

noOfEngineers

private int noOfEngineers

name

protected java.lang.String name

nextProposed

protected java.lang.Object nextProposed

output

protected java.lang.Object output

defaultOutput

private java.lang.Object defaultOutput

debuggingOn

private boolean debuggingOn

debugger

protected Debugger debugger

paused

final java.lang.Double paused
Constructor Detail

Factory

public Factory(java.lang.String name,
               java.lang.ThreadGroup group,
               java.lang.Object defaultOutput)

Factory

public Factory(java.lang.String name,
               java.lang.ThreadGroup group)
Method Detail

run

public void run()
Overrides:
run in class java.lang.Thread

reevaluateBest

private boolean reevaluateBest(java.util.Vector engineers,
                               java.lang.Object output,
                               double[] outputSatis,
                               int noEngineers)

calcSatis

private double calcSatis(double priority,
                         double satisfaction)

output

public java.lang.Object output()
This is the function that the agent controller will call to get the output from the thread. It should be known elsewhere? how to interpret the object.


addEngineer

public void addEngineer(InstantiatedEngineer eng)
Function to allow engineers to register their interest in the factory.


removeEngineer

public void removeEngineer(InstantiatedEngineer eng)
Function to allow engineers to finish with the factory.


nextProposed

protected java.lang.Object nextProposed(java.lang.Object lastProposed)
Function to come up with a new suggested value for the factory output. Obviously this does nothing. Subclasses of factory should do an interesting implementation.


swap

private void swap(double[] arr,
                  int i)
Swap array element with next array element

safeSuspend

public void safeSuspend()
Used to stop the factory safely

getRegisteredEngineers

public java.util.Vector getRegisteredEngineers()

addListener

public void addListener(NegotiationListener l)

removeListener

public void removeListener(NegotiationListener l)

getFactoryName

public java.lang.String getFactoryName()

setFactoryName

public void setFactoryName(java.lang.String name)

getDefaultOutput

protected java.lang.Object getDefaultOutput()