@Override public String toString() { StringBuilder sb = new StringBuilder("---------------- SyntaxContainer ---------------------"); sb.append(LINE_SEPARATOR); sb.append("origText = "); sb.append(origText); sb.append(LINE_SEPARATOR); sb.append("Valid = "); sb.append(Boolean.toString(valid)); sb.append(LINE_SEPARATOR); sb.append("Error = "); sb.append(error.toString()); sb.append(LINE_SEPARATOR); sb.append("CrossRefObjlist = "); for (String cro : getCrossRefObjList()) { sb.append(cro).append(", "); } sb.append("Syntax object list:"); for (SyntaxObject obj : objList) { sb.append(" "); sb.append(LINE_SEPARATOR); sb.append(obj.toString()); } return sb.toString(); }
public SyntaxObjectType getPreviousSyntaxObjectType(int steps) { SyntaxObjectType retval = SyntaxObjectType.END; if (objList.size() > steps) { SyntaxObject obj = objList.get(objList.size() - 1 - steps); retval = obj.getType(); } return retval; }
public boolean contains(SyntaxObjectType type, String val) { boolean retval = false; for (SyntaxObject obj : objList) { if ((obj.getType() == type) && val.equalsIgnoreCase(obj.getBody())) { retval = true; break; } } return retval; }
public String getPreviousSyntaxObject(int steps, SyntaxObjectType type) { String retval = ""; if (objList.size() > steps) { SyntaxObject obj = objList.get(objList.size() - 1 - steps); if (obj.getType() == type) { retval = obj.getBody(); } } if ("".equals(retval) && ((type == SyntaxObjectType.CROSS_REF_OBJ) || (type == SyntaxObjectType.SEARCH_OBJECT))) { retval = objList.getFirst().getBody(); } return retval; }
public ArrayList<String> getCrossRefObjList() { ArrayList<String> retval = new ArrayList<String>(); String searchObj = getObjSingularName(getSearchObjectStr()); for (SyntaxObject obj : objList) { if (obj.getType() == SyntaxObjectType.CROSS_REF_OBJ) { String objSingularName = getObjSingularName(obj.getBody()); if ((!retval.contains(objSingularName)) && searchObj != null && !searchObj.equals(objSingularName)) { retval.add(objSingularName); } } } return retval; }