br.close();
}
@Override
public Data readData() {
Data toBeSent=null;
List fileLines = null;
String[] firstLine;
String[] pileNodeCoLine;
String[] ModOfSubReactionLine;
String[] lateralSoilMovementLine;
String[] limitSoilPressureLine;
String[] pileCoLine;
while(true){
try {
fileLines= readAll();
} catch (IOException ex) {
Logger.getLogger(CSVReader.class.getName()).log(Level.SEVERE, null, ex);
toBeSent = null;
break;
}
try{
firstLine = (String[]) fileLines.get(0);
pileNodeCoLine = (String[]) fileLines.get(1);
ModOfSubReactionLine = (String[])fileLines.get(2);
lateralSoilMovementLine = (String[]) fileLines.get(3);
limitSoilPressureLine = (String[]) fileLines.get(4);
pileCoLine = (String[])fileLines.get(5);
}catch(IndexOutOfBoundsException ex){
toBeSent = null;
break;
}
int numOfElements = Integer.parseInt(firstLine[0]);
double pileLength = Double.parseDouble(firstLine[1]);
double EI = Double.parseDouble(firstLine[2]);
double pileDiameter = Double.parseDouble(firstLine[3]);
int noOfPiles = Integer.parseInt(firstLine[4]);
double poissonRation = Double.parseDouble(firstLine[5]);
int iterationNo = Integer.parseInt(firstLine[6]);
toBeSent = new Data();
toBeSent.setNumOfElements(numOfElements);
toBeSent.setPileLength(pileLength);
toBeSent.setEI(EI);
toBeSent.setPileDiameter(pileDiameter);
toBeSent.setNumOfPiles(noOfPiles);
toBeSent.setPoissonRation(poissonRation);
toBeSent.setIterationNumber(iterationNo);
for(int elNo=0;elNo<=numOfElements;elNo++){
double tmpPileNodeCo = 0;
tmpPileNodeCo = Double.parseDouble(pileNodeCoLine[elNo]);
toBeSent.addPileNodeCoordinate(tmpPileNodeCo);
}
for(int elNo=0;elNo<=numOfElements;elNo++){
double tmpModOfSubReaction = 0;
tmpModOfSubReaction = Double.parseDouble(ModOfSubReactionLine[elNo]);
toBeSent.addModOfSubgradeReaction(tmpModOfSubReaction);
}
for(int elNo=0;elNo<=numOfElements;elNo++){
double tmpLateralSoilMovement = 0;
tmpLateralSoilMovement = Double.parseDouble(lateralSoilMovementLine[elNo]);
toBeSent.addLateralSoilMovement(tmpLateralSoilMovement);
}
for(int elNo=0;elNo<=numOfElements;elNo++){
double tmplimitSoilPressure = 0;
tmplimitSoilPressure = Double.parseDouble(limitSoilPressureLine[elNo]);
toBeSent.addLimitSoilPressure(tmplimitSoilPressure);
}
for(int elNo=0;elNo<=noOfPiles;elNo++){
double tmpPileCo = 0;
tmpPileCo = Double.parseDouble(pileCoLine[elNo]);
toBeSent.addPileNodeCoordinate(tmpPileCo);
}
break;
}