public class Neuron extends Object implements Serializable
Modifier and Type | Method and Description |
---|---|
boolean |
compareAndSetFeatures(double[] expect,
double[] update)
Tries to atomically update the neuron's features.
|
double[] |
getFeatures()
Gets the neuron's features.
|
long |
getIdentifier()
Gets the neuron's identifier.
|
int |
getSize()
Gets the length of the feature set.
|
public long getIdentifier()
public int getSize()
public double[] getFeatures()
public boolean compareAndSetFeatures(double[] expect, double[] update)
retrieves the current state
,
and uses it to compute the new state.
During this computation, another thread might have done the same
thing, and updated the state: If the current thread were to proceed
with its own update, it would overwrite the new state (which might
already have been used by yet other threads).
To prevent this, the method does not perform the update when a
concurrent modification has been detected, and returns false
.
When this happens, the caller should fetch the new current state,
redo its computation, and call this method again.expect
- Current values of the features, as assumed by the caller.
Update will never succeed if the contents of this array does not match
the values returned by getFeatures()
.update
- Features's new values.true
if the update was successful, false
otherwise.DimensionMismatchException
- if the length of update
is
not the same as specified in the constructor
.Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.