private synchronized void addToParts(TablePart tablePart) throws OpenLCompilationException { String key = tablePart.getPartName(); TreeSet<TablePart> set = tableParts.get(key); if (set == null) { set = new TreeSet<TablePart>(); tableParts.put(key, set); } boolean res = set.add(tablePart); if (!res) { String message = "Duplicated TablePart part # = " + tablePart.getPart(); throw new OpenLCompilationException(message, null, null, makeSourceModule(tablePart.getTable())); } }
private void parseHeader(TablePart tablePart) throws OpenLCompilationException { GridCellSourceCodeModule src = new GridCellSourceCodeModule(tablePart.getTable()); String header = src.getCode(); Matcher m = pattern.matcher(header); if (!m.matches()) { String message = "Valid Syntax: TablePart <table_id> <row|column> <npart(1 to total_number_of_parts)> of <total_number_of_parts>"; throw new OpenLCompilationException(message, null, null, makeSourceModule(tablePart.getTable())); } String tableId = m.group(1); String colOrRow = m.group(2); String npart = m.group(3); String totalParts = m.group(4); tablePart.setPartName(tableId); tablePart.setPart(Integer.parseInt(npart)); tablePart.setSize(Integer.parseInt(totalParts)); tablePart.setVertical(colOrRow.equals("row")); }
throw new OpenLCompilationException(message, null, null, makeSourceModule(tablePart.getTable())); .getPart() + " has wrong number of parts: " + tablePart .getSize() + ". There are " + n + " parts with the same name"; throw new OpenLCompilationException(message, null, null, makeSourceModule(tablePart.getTable())); String message = "TablePart " + tablePart.getPartName() + " number " + tablePart .getPart() + " has wrong content."; throw new OpenLCompilationException(message, null, null, makeSourceModule(tablePart.getTable())); String message = "TablePart number " + tablePart .getPart() + " must use " + (vertical ? "row" : "column"); throw new OpenLCompilationException(message, null, null, makeSourceModule(tablePart.getTable())); null, null, makeSourceModule(tablePart.getTable())); } else { messages.add(OpenLMessagesUtils.newErrorMessage(message));