public void setTsEnd() { for (Tree appT : timesT.getParentT().getParentT().getChildTs()) if (appT.getMtlO() instanceof App) this.appT = appT; duration = TsTask._1s; if (appT != null) { App appO = (App) appT.getMtlO(); int hms = TsTask._1s; if (appO.getUnit().equals("h")) hms = TsTask._1h; else if (appO.getUnit().equals("min")) hms = TsTask._1m; Integer appValue = 1; if (appO.getAppapp() != null) appValue = appO.getAppapp(); duration = appValue * hms; } MObject timesO = timesT.getMtlO(); if (timesO != null && timesO instanceof Times && TsTask.apporder_endBeforeBegin.equals(((Times) timesO).getApporder())) { this.tsEnd = new Timestamp(ts.getTime()); this.ts = new Timestamp(tsEnd.getTime() - duration); } else { this.tsEnd = new Timestamp(ts.getTime() + duration); } }