Ok... i'm working with some Matrix. Specifically inverting them with the Gauss algorithm. the inversion succeded, but when i restart the activity that takes the input matrix, the result, which is enlistened in an Arraylist gets overwrited by the previous operations.
switch(n){
case 2: identityMatrix = Matrix.ID_MATRIX_OR2;
break;
case 3: identityMatrix = Matrix.ID_MATRIX_OR3;
break;
case 4: identityMatrix = Matrix.ID_MATRIX_OR4;
}
when it execute this code the 2nd time i request an inversion, instead of the identity matrix it copies the value of the PREVIOUS inverted matrix, which is TEMPORARILY stored in "identityMatrix" , on the new inversion "identityMatrix" became null again
Checking in debug the "Matrix.ID_MATRIX_OR"number where modified.
THAT SHOUDLN'T BE as they are declared as -- PROTECTED FINAL STATIC --
protected final static Fraction[][] ID_MATRIX_OR2 = { {ONE_M,ZERO_M},
{ZERO_M,ONE_M}};
protected final static Fraction[][] ID_MATRIX_OR3 = { {ONE_M,ZERO_M,ZERO_M},
{ZERO_M,ONE_M,ZERO_M},
{ZERO_M,ZERO_M,ONE_M}};
protected final static Fraction[][] ID_MATRIX_OR4 = { {ONE_M,ZERO_M,ZERO_M,ZERO_M},
{ZERO_M,ONE_M,ZERO_M,ZERO_M},
{ZERO_M,ZERO_M,ONE_M,ZERO_M},
{ZERO_M,ZERO_M,ZERO_M,ONE_M}};
where ONE_M and ZERO_M are custom object Fraction, that values are 1 and 0 and they also are PROTECTED STATIC FINAL.
So why they get modified? shouldn't the final modifier prevent this?
or should I search for something like the flush() method to start new?