Judges whether a table is a wide table or not by considering the width of
the table

@param tc
the object of the table candidates
13074
private void isWideTable(TableCandidate tc) {
	float docWidth = m_docInfo.getMaxX() - m_docInfo.getMinX();
	if ((((tc.getCaptionX() > ((docWidth - 30) / (float) 4.0)
		+ m_docInfo.getMinX())) && (tc.getCaptionX() < docWidth / 2.5))
		|| (tc.getCaptonEndX() - tc.getCaptionX() > docWidth
			/ (float) 1.85)) {
	    tc.setWideTable(true);
	    // System.out.println();
	    // System.out.println("This is a wide table? " + tc.isWideTable());
	} else {
	    // System.out.println();
	    // System.out.println("This is a single-doc-column table!");
	}
    }
254128
public void setTable(final Table table) {
        if (table != _tableRef.get()) {
            _tableRef.set(table);

            if (table == null) {
                _comboBox.setEmptyModel();
            } else {
                _comboBox.setModel(table);
            }
        }
    }
245086
public void setColumnWidth(int width)
    {
        content = new Dimension(0, 0);
        content.width = width;
        bounds.width = content.width;
    }
472414
public boolean hasLogicTable(final String logicTableName) {
        for (TableRule each : tableRules) {
            if (each.getLogicTable().equals(logicTableName.toLowerCase())) {
                return true;
            }
        }
        return false;
    }
277282
private void getColumnBoundaryWithoutHeading(TableCandidate tc) {
    	int heads = tc.getHeadingLineNumber() +1;
    	int MAXcolumnNum = tc.getMaxColumnNumber();
    	int footnoteLineIndex = tc.getFootnoteBeginRow();
    	TableRow row;
    	if(MAXcolumnNum==0) return;
    	
    	float[] leftX_tableColumns = new float[MAXcolumnNum*4];
		float[] rightX_tableColumns = new float[MAXcolumnNum*4];
		for (int qq=0; qq<MAXcolumnNum*4; qq++) {
			leftX_tableColumns[qq]=1000.0f;
			rightX_tableColumns[qq] = 0.0f; 
		}
		int cc=1;
		
		boolean fullRowExists = false;
		int maxTextPieceInTableContent = 0;
		/*
		 * Checks whether there is a data line that has the max number of the text pieces
		 */
		for (int pp=heads; pp<footnoteLineIndex; pp++) {
			row = tc.getRows().get(pp);
			if (maxTextPieceInTableContent<row.getCells().size())
					maxTextPieceInTableContent = row.getCells().size();
		}
		if (maxTextPieceInTableContent==MAXcolumnNum) fullRowExists=true;
		/*
		 * Adjusts leftX_tableColumns and rightX_tableColumns based on the cells
		 */
		for (int pp=heads; pp<footnoteLineIndex; pp++) {
			row = tc.getRows().get(pp);
			if (pp==heads) {
				leftX_tableColumns[0]= row.getCells().get(0).getX(); 		//pmoj.cmdX_thisTable[heads][0];
				rightX_tableColumns[0] = row.getCells().get(0).getEndX();  //rightX_tableColumns[0]=pmoj.cmdEndX_thisTable[heads][0];
			}
			
			if( ((fullRowExists==true) && (row.getCells().size() == MAXcolumnNum)) || (fullRowExists == false)){
				/*
				 * Each text piece/cell in a row
				 */
				for (int qq=0; qq< row.getCells().size(); qq++) {
					/*
					 * Gets a new leftmost column
					 */
					if ( ((leftX_tableColumns[0]- row.getCells().get(qq).getEndX())>m_docInfo.getAverageXGap()*2.0) 
					&&  (row.getCells().get(qq).getEndX()>0.0f) ){
						for (int ii=cc; ii>0; ii--) {
							leftX_tableColumns[ii] = leftX_tableColumns[ii-1];
							rightX_tableColumns[ii] = rightX_tableColumns[ii-1];
						}
						leftX_tableColumns[0]=row.getCells().get(qq).getX();
						rightX_tableColumns[0]=row.getCells().get(qq).getEndX();
						cc++;
					}
					else {
						/*
						 * Gets a new rightmost column
						 */
						if ( ( (row.getCells().get(qq).getX()-rightX_tableColumns[cc-1])>m_docInfo.getAverageXGap()*2.0) 
						&& (row.getCells().get(qq).getX()<1000.0f) ){
							leftX_tableColumns[cc]=row.getCells().get(qq).getX();
							rightX_tableColumns[cc]=row.getCells().get(qq).getEndX();
							cc++;
						}
						/*
						 * A new column 
						 */
						else {
							int thisC = 1;
							boolean newMidColumn = false;
							while (thisC<cc) {
								if ( ((row.getCells().get(qq).getX()-rightX_tableColumns[thisC-1])>m_docInfo.getAverageXGap()*2.0) 
								&& ((leftX_tableColumns[thisC]-row.getCells().get(qq).getEndX())>m_docInfo.getAverageXGap() * 2.0) 
								&& (row.getCells().get(qq).getX()<1000.0f) && (row.getCells().get(qq).getEndX()>0.0f)) {
									for (int ii=cc; ii>thisC; ii--) {
										leftX_tableColumns[ii] = leftX_tableColumns[ii-1];
										rightX_tableColumns[ii] = rightX_tableColumns[ii-1];
									}
									cc++;
									leftX_tableColumns[thisC]=row.getCells().get(qq).getX();
									rightX_tableColumns[thisC]=row.getCells().get(qq).getEndX();
									newMidColumn=true;
									break;
								}
								thisC++;
							}
							if (newMidColumn==false) {
								thisC = 0; 
								cc = adjustAColumn(cc, row.getCells().get(qq).getX(), row.getCells().get(qq).getEndX(), leftX_tableColumns, rightX_tableColumns);
								tc.setColumnNum(cc);
							}
						}//end{middleColumn}
					}//end {else}
				}//end{for all pieces in a line}
			}//end if()
		}//end for()
		
		
		/*
		 * Adjusts columns with the information of heading rows
		 */
		for (int pp=0; pp<heads; pp++) {		
			int cellsThisLine = tc.getRows().get(pp).getCells().size();
			for (int dd=0; dd<cellsThisLine; dd++) {
				float b = tc.getRows().get(pp).getCells().get(dd).getX();
				float e = tc.getRows().get(pp).getCells().get(dd).getEndX();
				cc = adjustAColumn(cc, b, e, leftX_tableColumns, rightX_tableColumns);
			}//end(for)
		}//end(for)
		tc.setColumnNum(cc);
		tc.setLeftX_tableColumns(leftX_tableColumns);
		tc.setRightX_tableColumns(rightX_tableColumns);
	}
167706
public static boolean isTableMaterializeViewSource(org.voltdb.catalog.Database database,
                                                       org.voltdb.catalog.Table table)
    {
        CatalogMap<Table> tables = database.getTables();
        for (Table t : tables) {
            Table matsrc = t.getMaterializer();
            if ((matsrc != null) && (matsrc.getRelativeIndex() == table.getRelativeIndex())) {
                return true;
            }
        }
        return false;
    }
1058068
public boolean isTableSpatial( String tableName ) throws Exception {
        GeometryColumn geometryColumns = getGeometryColumnsForTable(tableName);
        return geometryColumns != null;
    }
1286784
public static boolean columnExist(CSTable table, String name) {
        for (int i = 1; i <= table.getColumnCount(); i++) {
            if (table.getColumnName(i).startsWith(name)) {
                return true;
            }
        }
        return false;
    }
545022
public boolean setTableType(Session session, int newType) {

        int currentType = table.getTableType();

        if (currentType == newType) {
            return false;
        }

        switch (newType) {

            case TableBase.CACHED_TABLE :
                break;

            case TableBase.MEMORY_TABLE :
                break;

            default :
                return false;
        }

        Table tn;

        try {
            tn = table.moveDefinition(session, newType, null, null, null, -1,
                                      0, emptySet, emptySet);

            tn.moveData(session, table, -1, 0);
            updateConstraints(tn, emptySet);
        } catch (HsqlException e) {
            return false;
        }

        setNewTableInSchema(tn);
        database.persistentStoreCollection.releaseStore(table);

        table = tn;

        database.schemaManager.recompileDependentObjects(table);

        return true;
    }
1325211
public boolean hasTableOrColumnCaseSensitive(String table, String column) {

        boolean result = false;
        ResultSet set = null;

        try {
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(column)) {
                // Check if the column is given
                set = m_con.getMetaData().getColumns(null, null, table, column);
                if (set.next()) {
                    String colname = set.getString("COLUMN_NAME");
                    if (colname.equalsIgnoreCase(column)) {
                        result = true; // The column is available
                    }
                }
            } else if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(table)) {
                // Check the table
                set = m_con.getMetaData().getTables(null, null, table, null);
                if (set.next()) {
                    String tablename = set.getString("TABLE_NAME");
                    if (tablename.equalsIgnoreCase(table)) {
                        result = true;
                    }
                }
            }
        } catch (SQLException e) {
            e.printStackTrace();
            result = false;
        } finally {
            try {
                if (set != null) {
                    set.close();
                }
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
        return result;
    }
1194502
def tableexists(tablename):
    """"""
    result = True
    try:
        t = table(tablename, ack=False)
    except:
        result = False
    return result
1268441
public void setTablesToReload(java.util.Collection<TableToReload> tablesToReload) {
        if (tablesToReload == null) {
            this.tablesToReload = null;
            return;
        }

        this.tablesToReload = new java.util.ArrayList<TableToReload>(tablesToReload);
    }
1207241
public static void widthTable(XWPFTable table, float widthCM, int cols) {
        int width = (int)(widthCM/2.54*1440);
        CTTblPr tblPr = table.getCTTbl().getTblPr();
        if (null == tblPr) {
            tblPr = table.getCTTbl().addNewTblPr();
        }
        CTTblWidth tblW = tblPr.isSetTblW() ? tblPr.getTblW() : tblPr.addNewTblW();
        tblW.setType(0 == width ? STTblWidth.AUTO : STTblWidth.DXA);
        tblW.setW(BigInteger.valueOf(width));

        if (0 != width) {
            CTTblGrid tblGrid = table.getCTTbl().getTblGrid();
            if (null == tblGrid) {
                tblGrid = table.getCTTbl().addNewTblGrid();
            }

            for (int j = 0; j < cols; j++) {
                CTTblGridCol addNewGridCol = tblGrid.addNewGridCol();
                addNewGridCol.setW(BigInteger.valueOf(width / cols));
            }
        }
    }
416068
public static void exception(TraceComponent tc, Throwable t) {
    if(isTracing()) SibTr.exception(tc, t);

  }
694223
private function getRemainingColumnWidth(TcTable $table, $width) {
        if (!$this->maxWidth) {
            $margins = $table->getPdf()->getMargins();
            $content_width = $table->getPdf()->getPageWidth() - $margins['left'] - $margins['right'];
        } else {
            $content_width = $this->maxWidth;
        }
        $result = $content_width - (is_array($width) ? array_sum($width) : $width);
        return $result > 0 ? $result : 0;
    }
624728
public void getReferenceTableTexts(TableCandidate tc,
	    ArrayList<ArrayList<TextPiece>> linesByPage) {
	/*
	 * Gets the table caption beginning part, e.g., "Table 4"
	 */
	String thisCaption = tc.getCaption().replace(" ", "");
	char lastCharInThisKwd = tc.getKeyword().charAt(
		tc.getKeyword().length() - 1);
	int indexAfterKwd = thisCaption.indexOf(lastCharInThisKwd);
	int ii = indexAfterKwd + 1;
	int captionIndex_start = ii;
	int captionIndex_end = ii + 1;
	while ((ii < thisCaption.length() - 1)
		&& (captionIndex_end - captionIndex_start < 2)
		&& (captionIndex_end >= captionIndex_start)) { // for: Table 12
							       // 4 datasets.
							       // for such case,
							       // we may get
							       // "Tabl124" to
							       // start the
							       // reference text
							       // search,
							       // without the
							       // 2nd condition.
	    String nextChar = thisCaption.substring(ii, ii + 1);
	    if ((nextChar.compareToIgnoreCase(".") != 0)
		    && (nextChar.matches("[0-9]") == true)
		    && (nextChar.compareToIgnoreCase(":") != 0)
		    && (nextChar.compareToIgnoreCase(",") != 0))
		ii++;
	    else {
		captionIndex_end = ii;
		break;
	    }
	}
	String thisTableCaptionBeginning = thisCaption.substring(0, ii);
	/*
	 * Gets each character in the table caption beginning part
	 */
	int cationBeginningLength = thisTableCaptionBeginning.length();
	char[] charsInCaptionBeginning = new char[cationBeginningLength];
	for (int i = 0; i < cationBeginningLength; i++) {
	    charsInCaptionBeginning[i] = thisTableCaptionBeginning.charAt(i);
	}

	if (linesByPage != null && linesByPage.size() != 0
		&& thisTableCaptionBeginning.length() > 5) {
	    for (int k = 0; k < linesByPage.size(); k++) {
		ArrayList<TextPiece> linesThisPage = linesByPage.get(k);
		for (int j = 0; j < linesThisPage.size(); j++) {
		    String thisLine = linesThisPage.get(j).getText()
			    .replace(" ", "");
		    if ((k == tc.getPageId_thisTable())
			    && (j >= tc.getCaptionStartLine())
			    && (j <= tc.getCaptionEndLine())) {
		    }// filter out the table caption itself
		    else {
			if ((thisLine).contains(thisTableCaptionBeginning) == true) {
			    /*
			     * Finds the Index of the Table Caption beginning
			     * part in the matched document line. E.g., the "2"
			     * in "Table 2."
			     */
			    String thisLine_Orig = linesThisPage.get(j)
				    .getText();
			    int kk = thisLine
				    .indexOf(thisTableCaptionBeginning);

			    int beginIndex = thisLine_Orig.indexOf(
				    charsInCaptionBeginning[0], kk);
			    int endIndex = thisLine_Orig
				    .indexOf(
					    charsInCaptionBeginning[cationBeginningLength - 1],
					    beginIndex) + 1;
			    String thisPiece = "";
			    while (beginIndex < thisLine_Orig.length()
				    && endIndex < thisLine_Orig.length()
				    && (endIndex - beginIndex) > 5
				    && beginIndex >= 0 && endIndex > 0) {
				thisPiece = thisLine_Orig.substring(beginIndex,
					endIndex).replace(" ", "");
				/*
				 * for "Table 11", "thisPiece" can be "Table1"
				 */
				if (thisTableCaptionBeginning
					.startsWith(thisPiece)) {
				    while ((thisPiece.length() < thisTableCaptionBeginning
					    .length())
					    && (endIndex < thisLine_Orig
						    .length() - 1)) {
					endIndex++;
					thisPiece = thisLine_Orig.substring(
						beginIndex, endIndex).replace(
						" ", "");
				    }
				    break;
				} else {
				    beginIndex = thisLine_Orig.indexOf(
					    charsInCaptionBeginning[0],
					    endIndex);
				    endIndex = thisLine_Orig
					    .indexOf(
						    charsInCaptionBeginning[cationBeginningLength - 1],
						    beginIndex);
				}
			    }

			    if ((endIndex < thisLine_Orig.length() - 3)
				    && (endIndex > 0)
				    && (beginIndex >= 0)
				    && (thisLine_Orig.substring(endIndex,
					    endIndex + 2).matches("[ ][0-9]") == false)
				    && (thisLine_Orig.substring(endIndex,
					    endIndex + 2).matches("[0-9][.]") == false)
				    && (thisLine_Orig.substring(endIndex,
					    endIndex + 2).matches("[0-9][ ]") == false)
				    && (thisLine_Orig.substring(endIndex,
					    endIndex + 2).matches("[.][0-9]") == false)) {
				String firstHalfLine = thisLine_Orig.substring(
					0, beginIndex);
				String secondHalfLine = thisLine_Orig
					.substring(endIndex);

				/*
				 * Looks up all text of the reference
				 */
				int totalPeriodNum = 0;
				int periodNum_thisLine = 0;
				String curRef = "";
				int nextIndex = j;
				String line = secondHalfLine;
				while (nextIndex < linesThisPage.size() - 1) {
				    if ((k == tc.getPageId_thisTable())
					    && nextIndex <= tc.getBodyEndLine()
					    && nextIndex >= tc
						    .getBodyStartLine()) {
					break;
				    }
				    /*
				     * Gets the number of periods in the line.
				     * If the total period number < 2, get the
				     * whole line, otherwise, cut and break
				     */
				    for (int qq = 0; qq < line.length(); qq++) {
					if (line.substring(qq, qq + 1)
						.contentEquals(".") == true)
					    periodNum_thisLine++;
				    }
				    totalPeriodNum = totalPeriodNum
					    + periodNum_thisLine;
				    if (totalPeriodNum < 2) {
					curRef = curRef + " " + line;
					nextIndex++;
					line = linesThisPage.get(nextIndex)
						.getText();
					periodNum_thisLine = 0;
				    } else {
					if (totalPeriodNum == 2) {
					    if (periodNum_thisLine == 1) {
						String lines = line.substring(
							0,
							line.indexOf(".") + 1);
						curRef = curRef + " " + lines;
						break;
					    }
					    if (periodNum_thisLine == 2) {
						String lines = line
							.substring(
								0,
								line.lastIndexOf(".") + 1);
						curRef = curRef + " " + lines;
						break;
					    }
					}
					/*
					 * totalPeriodNum>2. In this case,
					 * periodNum_thisLine will >=2
					 */
					else {
					    int firstDot = line.indexOf(".");
					    int secondDot = line.indexOf(".",
						    firstDot);
					    String lines = line.substring(0,
						    secondDot + 1);
					    curRef = curRef + " " + lines;
					    break;
					}
				    }
				}

				/*
				 * Looks up the previous period "."
				 */
				totalPeriodNum = 0;
				periodNum_thisLine = 0;
				String preRef = "";
				int preIndex = j;
				line = firstHalfLine;
				while (preIndex > 0) {
				    if ((k == tc.getPageId_thisTable())
					    && preIndex <= tc.getBodyEndLine()
					    && preIndex >= tc
						    .getBodyStartLine()) {
					break;
				    }
				    /*
				     * Gets the period number in line, if total
				     * period number < 2, get the whole line,
				     * otherwise, cut and break
				     */
				    for (int qq = 0; qq < line.length(); qq++) {
					if (line.substring(qq, qq + 1)
						.contentEquals(".") == true)
					    periodNum_thisLine++;
				    }
				    totalPeriodNum = totalPeriodNum
					    + periodNum_thisLine;
				    if (totalPeriodNum < 2) {
					preRef = line + " " + preRef;
					preIndex--;
					line = linesThisPage.get(preIndex)
						.getText();
					periodNum_thisLine = 0;
				    } else {
					/*
					 * No matter this line has 1 or 2 ".",
					 * we get the part after the first "."
					 */
					if (totalPeriodNum == 2) {
					    String lines = line.substring(
						    line.indexOf(".") + 1,
						    line.length());
					    preRef = lines + " " + preRef;
					    break;
					}
					/*
					 * totalPeriodNum>2. In this case,
					 * periodNum_thisLine will >=2
					 */
					else {
					    int lastDot = line.lastIndexOf(".");
					    int secondLastDot = line.substring(
						    lastDot).lastIndexOf(".");
					    String lines = line.substring(
						    secondLastDot + 1,
						    line.length());
					    preRef = lines + " " + preRef;
					    break;
					}
				    }
				}

				String thisReference = preRef
					+ thisTableCaptionBeginning + curRef;
				// thisReference =
				// tc.replaceAllSpecialChracters(thisReference);

				String referenceText = tc.getRefText()
					+ "\n In PAGE " + (k + 1) + ": ..."
					+ thisReference + "...";
				tc.setRefText(referenceText);
			    }
			}
		    }
		}// end for
	    }
	} else {
	    tc.setRefText("");
	}

    }
1113055
public void widthTable(XWPFTable table, float widthCM, int rows, int cols) {
        TableTools.widthTable(table, widthCM, cols);
        TableTools.borderTable(table, 4);
    }