Simplify method in AbstractEAIndividual
This commit is contained in:
parent
1cec889331
commit
60f16a39c6
@ -1068,7 +1068,7 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For any AbstractEAIndividual try retrieve its position as double[].
|
* For any AbstractEAIndividual try to retrieve its position as double[].
|
||||||
* Returns null if there is no conversion available. Makes shallow copies if
|
* Returns null if there is no conversion available. Makes shallow copies if
|
||||||
* possible.
|
* possible.
|
||||||
*
|
*
|
||||||
@ -1100,20 +1100,8 @@ public abstract class AbstractEAIndividual implements IndividualInterface, java.
|
|||||||
* @return double valued position of an individual or null
|
* @return double valued position of an individual or null
|
||||||
*/
|
*/
|
||||||
public static double[] getDoublePosition(AbstractEAIndividual indy) {
|
public static double[] getDoublePosition(AbstractEAIndividual indy) {
|
||||||
if (indy instanceof InterfaceESIndividual) {
|
double[] position = getDoublePositionShallow(indy);
|
||||||
return ((InterfaceESIndividual) indy).getDGenotype().clone();
|
return position;
|
||||||
} else if (indy instanceof InterfaceDataTypeDouble) {
|
|
||||||
return ((InterfaceDataTypeDouble) indy).getDoubleData().clone();
|
|
||||||
} else if (indy instanceof InterfaceDataTypeInteger) {
|
|
||||||
int[] intData = ((InterfaceDataTypeInteger) indy).getIntegerData();
|
|
||||||
double[] pos = new double[intData.length];
|
|
||||||
for (int i = 0; i < intData.length; i++) {
|
|
||||||
pos[i] = (double) intData[i];
|
|
||||||
}
|
|
||||||
return pos;
|
|
||||||
} // TODO check some more types here?
|
|
||||||
EVAERROR.errorMsgOnce("Unhandled case in AbstractEAIndividual.getDoublePosition()!");
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user