Commit a9165476 authored by lafabregue's avatar lafabregue

add svn tracking

parent c8dae14a
12
\ No newline at end of file
12
\ No newline at end of file
package jcl.jcld.queues;
import java.util.concurrent.ConcurrentLinkedQueue;
/**
*
* Cette classe abstraite contient une FIFO contenant des chaines de ceracteres
* pour la console, cette FIFO est commune a MAclaw et Hybrid classifiaction.
* les autre FIFO dpende de la classifiaction utilisee
*
* les classes OutputFIFOMaclaw et OutputFIFOHybrid hritent de cette classe.
*
* @author Schmitt Olivier
*
*/
public abstract class OutputFIFO {
/** */
private static final long serialVersionUID = 1L;
/** FIFOs pour la methode hybride */
public static final int HYBRID = 300;
/** FIFOs pour la methode Maclaw */
public static final int MACLAW = 400;
/** la FIFO de chaine de caratere */
public static final int QPRINT = 0;
/** la FIFO des rsultat pour Hybrid */
public static final int QCLASSIF = 1;
/** la FIFO d'info du panel evolution Hybrid */
public static final int QINFO = 2;
/** la FIFO des r�sultat de Maclaw */
public static final int QLEARNINGRESULT = 4;
/** nombre de thread de transfert fini */
protected int finishedThread = 0;
/**
* FIFO de chaine de caractere console a afficher chez le client(Samarah +
* Maclaw)
*/
protected ConcurrentLinkedQueue<String> queuePrint = null;
/**
* cr�� la file d'envoie FIFO de chaines de carateres
*
*/
public OutputFIFO() {
this.queuePrint = new ConcurrentLinkedQueue<String>();
}
/**
* rajoute un objet de type corespondant dans une FIFO donnee.
*
* @param queue
* entier corespondand au type de la FIFO
* @param o
* objet a rajouter dans la FIFO
*/
public abstract void putQueue(int queue, Object o);
/**
*
* retire un objet d'une des FIFO et renvoie le resultat
*
* @param queue
* entier corespondand au type de la FIFO
* @return Object object qui a ete retire de la FIFO
*/
public abstract Object sendQueue(int queue);
/**
* fonction indiquant qu'un nouveau Thread d'envoi de donnees a �t� fini,
*
*/
public void addFinishedThread() {
this.finishedThread++;
}
/**
* verifie si tout les Threads d'envoi on ete fini,
*
* @return boolean vrai si tous fini, faux sinon.
*
*/
public abstract boolean isFinished();
}
package jcl.learning.methods.multistrategy.modular.maclae;
import geal.Individual;
import geal.IndividualParameters;
import jcl.evaluation.clustering.ClusteringEvaluation;
import jcl.learning.LearningParameters;
/**
*
* @author Alexandre BLANSCHE
*
*/
public class MaclaeIndividualParameters extends IndividualParameters {
/**
*
*/
private static final long serialVersionUID = -3906229867063273172L;
private LearningParameters parameters = null;
private double alpha = 4;
private double proximityCoefficient = -Math.log(2);
private int internalQuality = ClusteringEvaluation.WG;
private final boolean fuzzy;
/**
*
* @param parameters
* @param alpha
* @param phi
* @param internalQuality
*/
public MaclaeIndividualParameters(final LearningParameters parameters,
final double alpha, final double phi, final int internalQuality,
final boolean fuzzy) {
this.parameters = parameters;
this.alpha = alpha;
this.proximityCoefficient = -Math.log(1 / phi);
this.internalQuality = internalQuality;
this.fuzzy = fuzzy;
}
/**
*
* @return ?
*/
public LearningParameters getParameters() {
return this.parameters;
}
/**
*
* @return ?
*/
public double getAlpha() {
return this.alpha;
}
/**
*
* @return ?
*/
public boolean getFuzzy() {
return this.fuzzy;
}
/**
*
* @return ?
*/
public double getProximityCoefficient() {
return this.proximityCoefficient;
}
/**
*
* @return ?
*/
public int getInternalQuality() {
return this.internalQuality;
}
@Override
public Individual getIndividualInstance(final int index) {
return new MaclaeIndividual(this, index);
}
}
package jcl.data.random;
/**
*
* @author Alexandre BLANSCHE
*/
public class DistributionParameters {
/** */
private int correlations = 1;
/** */
private double mu = 0;
/** */
private boolean relevant = true;
/** */
private double sigma = 0;
/**
* <p>
* </p>
*
* @param mu
* @param sigma
* @param relevant
* @param correlations
*/
public DistributionParameters(final double mu, final double sigma,
final boolean relevant, final int correlations) {
this.mu = mu;
this.sigma = sigma;
this.relevant = relevant;
this.correlations = correlations;
}
/**
* @return ???
*/
public int getCorrelations() {
return this.correlations;
}
/**
* @return ???
*/
public double getMu() {
return this.mu;
}
/**
* @return ???
*/
public boolean getRelevant() {
return this.relevant;
}
/**
* @return ???
*/
public double getSigma() {
return this.sigma;
}
}
/*
* @(#)ArrayList.java 1.56 06/04/21
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*/
package jcl.data.sequence;
import java.util.Arrays;
/**
* Resizable-array implementation of the <tt>List</tt> interface. Implements all
* optional list operations, and permits all elements, including <tt>null</tt>.
* In addition to implementing the <tt>List</tt> interface, this class provides
* methods to manipulate the size of the array that is used internally to store
* the list. (This class is roughly equivalent to <tt>Vector</tt>, except that
* it is unsynchronized.)
* <p>
*
* The <tt>size</tt>, <tt>isEmpty</tt>, <tt>get</tt>, <tt>set</tt>,
* <tt>iterator</tt>, and <tt>listIterator</tt> operations run in constant time.
* The <tt>add</tt> operation runs in <i>amortized constant time</i>, that is,
* adding n elements requires O(n) time. All of the other operations run in
* linear time (roughly speaking). The constant factor is low compared to that
* for the <tt>LinkedList</tt> implementation.
* <p>
*
* Each <tt>ArrayList</tt> instance has a <i>capacity</i>. The capacity is the
* size of the array used to store the elements in the list. It is always at
* least as large as the list size. As elements are added to an ArrayList, its
* capacity grows automatically. The details of the growth policy are not
* specified beyond the fact that adding an element has constant amortized time
* cost.
* <p>
*
* An application can increase the capacity of an <tt>ArrayList</tt> instance
* before adding a large number of elements using the <tt>ensureCapacity</tt>
* operation. This may reduce the amount of incremental reallocation.
*
* <p>
* <strong>Note that this implementation is not synchronized.</strong> If
* multiple threads access an <tt>ArrayList</tt> instance concurrently, and at
* least one of the threads modifies the list structurally, it <i>must</i> be
* synchronized externally. (A structural modification is any operation that
* adds or deletes one or more elements, or explicitly resizes the backing
* array; merely setting the value of an element is not a structural
* modification.) This is typically accomplished by synchronizing on some object
* that naturally encapsulates the list.
*
* If no such object exists, the list should be "wrapped" using the
* {@link Collections#synchronizedList Collections.synchronizedList} method.
* This is best done at creation time, to prevent accidental unsynchronized
* access to the list:
*
* <pre>
* List list = Collections.synchronizedList(new ArrayList(...));
* </pre>
*
* <p>
* The iterators returned by this class's <tt>iterator</tt> and
* <tt>listIterator</tt> methods are <i>fail-fast</i>: if the list is
* structurally modified at any time after the iterator is created, in any way
* except through the iterator's own <tt>remove</tt> or <tt>add</tt> methods,
* the iterator will throw a {@link ConcurrentModificationException}. Thus, in
* the face of concurrent modification, the iterator fails quickly and cleanly,
* rather than risking arbitrary, non-deterministic behavior at an undetermined
* time in the future.
* <p>
*
* Note that the fail-fast behavior of an iterator cannot be guaranteed as it
* is, generally speaking, impossible to make any hard guarantees in the
* presence of unsynchronized concurrent modification. Fail-fast iterators throw
* <tt>ConcurrentModificationException</tt> on a best-effort basis. Therefore,
* it would be wrong to write a program that depended on this exception for its
* correctness: <i>the fail-fast behavior of iterators should be used only to
* detect bugs.</i>
* <p>
*
* This class is a member of the <a href="{@docRoot}
* /../technotes/guides/collections/index.html"> Java Collections Framework</a>.
*
* @author Josh Bloch
* @author Neal Gafter
* @version 1.56, 04/21/06
* @see Collection
* @see List
* @see LinkedList
* @see Vector
* @since 1.2
*/
public class DoubleArrayList {
private static final long serialVersionUID = 8683452581122892189L;
/**
* The array buffer into which the elements of the ArrayList are stored. The
* capacity of the ArrayList is the length of this array buffer.
*/
private transient double[] elementData;
/**
* The size of the ArrayList (the number of elements it contains).
*
* @serial
*/
private int size;
/**
* Constructs an empty list with the specified initial capacity.
*
* @param initialCapacity
* the initial capacity of the list
* @exception IllegalArgumentException
* if the specified initial capacity is negative
*/
public DoubleArrayList(int initialCapacity) {
super();
if (initialCapacity < 0) throw new IllegalArgumentException("Illegal Capacity: " + initialCapacity);
this.elementData = new double[initialCapacity];
}
/**
* Constructs an empty list with an initial capacity of ten.
*/
public DoubleArrayList() {
this(10);
}
/**
* Returns the number of elements in this list.
*
* @return the number of elements in this list
*/
public int size() {
return size;
}
/**
* Returns <tt>true</tt> if this list contains no elements.
*
* @return <tt>true</tt> if this list contains no elements
*/
public boolean isEmpty() {
return size == 0;
}
/**
* Returns an array containing all of the elements in this list in proper
* sequence (from first to last element).
*
* <p>
* The returned array will be "safe" in that no references to it are
* maintained by this list. (In other words, this method must allocate a new
* array). The caller is thus free to modify the returned array.
*
* <p>
* This method acts as bridge between array-based and collection-based APIs.
*
* @return an array containing all of the elements in this list in proper
* sequence
*/
public double[] toArray() {
return Arrays.copyOf(elementData, size);
}
/**
* Returns the element at the specified position in this list.
*
* @param index
* index of the element to return
* @return the element at the specified position in this list
* @throws IndexOutOfBoundsException
* {@inheritDoc}
*/
public double get(int index) {
RangeCheck(index);
return elementData[index];
}
/**
* Replaces the element at the specified position in this list with the
* specified element.
*
* @param index
* index of the element to replace
* @param element
* element to be stored at the specified position
* @return the element previously at the specified position
* @throws IndexOutOfBoundsException
* {@inheritDoc}
*/
public double set(int index, double element) {
RangeCheck(index);
double oldValue = elementData[index];
elementData[index] = element;
return oldValue;
}
public void ensureCapacity(int minCapacity) {
int oldCapacity = elementData.length;
if (minCapacity > oldCapacity) {
int newCapacity = (oldCapacity * 3) ;
if (newCapacity < minCapacity) newCapacity = minCapacity;
// minCapacity is usually close to size, so this is a win:
elementData = Arrays.copyOf(elementData, newCapacity);
}
}
/**
* Appends the specified element to the end of this list.
*
* @param e
* element to be appended to this list
* @return <tt>true</tt> (as specified by {@link Collection#add})
*/
public boolean add(double e) {
ensureCapacity(size + 1); // Increments modCount!!
elementData[size++] = e;