コード例 #1
0
int AbstractTableView::scaleFromUint64ToScrollBarRange(dsint value)
{
    if(mScrollBarAttributes.is64 == true)
    {
        dsint wValue = ((dsint)value) >> mScrollBarAttributes.rightShiftCount;
        dsint wValueMax = ((dsint)getRowCount() - 1) >> mScrollBarAttributes.rightShiftCount;

        if(value == ((dsint)getRowCount() - 1))
            return (int)(verticalScrollBar()->maximum());
        else
            return (int)((dsint)((dsint)verticalScrollBar()->maximum() * (dsint)wValue) / (dsint)wValueMax);
    }
コード例 #2
0
// Returns the index of the new column
void Tableau::addSlackColumn() {
  m_slackCount++;
  const int c = getSlackColumn(m_slackCount);
  if(getWidth() == m_table[0].m_a.size()) {
    for(int row = 0; row < getRowCount(); row++) {
      m_table[row].m_a.add(c,0);
    }
  } else {
    for(int row = 0; row < getRowCount(); row++) {
      m_table[row].m_a[c] = 0;
    }
  }
}
コード例 #3
0
 void applyTanh() {
     for (int rowIndex = 0; rowIndex < getRowCount(); ++rowIndex) {
         for (int columnIndex = 0; columnIndex < getColumnCount(); ++columnIndex) {
             data[rowIndex][columnIndex] = tanh(data[rowIndex][columnIndex]);
         }
     }
 }
コード例 #4
0
ファイル: ext_mysql.cpp プロジェクト: 191919/hhvm
Variant HHVM_FUNCTION(mysql_num_rows, const Resource& result) {
  auto res = php_mysql_extract_result(result);
  if (res) {
    return res->getRowCount();
  }
  return false;
}
コード例 #5
0
 void applyScale(float scale) {
     for (int rowIndex = 0; rowIndex < getRowCount(); ++rowIndex) {
         for (int columnIndex = 0; columnIndex < getColumnCount(); ++columnIndex) {
             data[rowIndex][columnIndex] *= scale;
         }
     }
 }
コード例 #6
0
ファイル: CallerAliasDB.cpp プロジェクト: LordGaav/sipxecs
CallerAliasDB::CallerAliasDB( const UtlString& name )
: mDatabaseName( name )
, mTableLoaded ( true )
{
   // Access the shared table databse
   SIPDBManager* pSIPDBManager = SIPDBManager::getInstance();
   mpFastDB = pSIPDBManager->getDatabase(name);

   // If we are the first process to attach
   // then we need to load the DB
   int users = pSIPDBManager->getNumDatabaseProcesses(name);
   OsSysLog::add(FAC_SUPERVISOR, PRI_DEBUG,
                 "CallerAliasDB::_ users = %d, mTableLoaded = %d",
                 users, mTableLoaded);
   if ( users == 1 || ( users > 1 && mTableLoaded == false ) )
   {
      OsSysLog::add(FAC_DB, PRI_DEBUG, "CallerAliasDB::_ about to load");
      mTableLoaded = false;
      // Load the file implicitly
      if (this->load() == OS_SUCCESS)
      {
         mTableLoaded = true;
         OsSysLog::add(FAC_DB, PRI_DEBUG, "CallerAliasDB::_ table successfully loaded");
      }
   }
   OsSysLog::add(FAC_SUPERVISOR, PRI_DEBUG,
                 "CallerAliasDB::_ rows in table = %d",
                 getRowCount());
}
コード例 #7
0
ファイル: Matrix_classes.cpp プロジェクト: erakli/MAI_works
bool CMatrix::checkSymmetric() const{
	UINT Col = getColCount(), Row = getRowCount();
	bool flag = true;
	if (Col == Row)
	{
		UINT i = 0, j;
		while ((i < Row) && flag)
		{
			j = i + 1;
			while (j < Col)
			{
				if ((*this)[i][j] != (*this)[j][i]){
					flag = false;
					break;
				}
				j++;
			} // while (j < Col)
			i++;
		} // while ((i < Row) && flag)
	}
	else
	{
		flag = false;
	}
	
	return flag;
}
コード例 #8
0
ファイル: Screen.cpp プロジェクト: rgmabs19357/gameseer
Screen* ScreenMgr::getScreen(ResourceID id){
	uint32_t row = GetRow(id);
	uint32_t col = GetCol(id);
	if ( row-1 >=0 && col-1 >=0 && row -1 < getRowCount() && col -1 < getColCount()){
		return screens_[GetRow(id)-1][GetCol(id)-1];
	}else return 0;
}
ExecStreamResult LcsCountAggExecStream::execute(
    ExecStreamQuantum const &quantum)
{
    if (pOutAccessor->hasPendingEOS()
        || pOutAccessor->getState() == EXECBUF_EOS)
    {
        return EXECRC_EOS;
    }
    ExecStreamResult rc = LcsRowScanExecStream::execute(quantum);
    if (rc != EXECRC_EOS) {
        return rc;
    }
    // Write out final row count.
    pOutAccessor->clear();
    RecordNum nRows = getRowCount();
    getProjOutputTupleData()[0].pData = reinterpret_cast<PConstBuffer>(&nRows);
    pOutputTupleAccessor->marshal(
        getProjOutputTupleData(), outputTupleBuffer.get());
    pOutAccessor->provideBufferForConsumption(
        outputTupleBuffer.get(),
        outputTupleBuffer.get()
        + pOutputTupleAccessor->getCurrentByteCount());
    pOutAccessor->markEOS();
    return EXECRC_BUF_OVERFLOW;
}
コード例 #10
0
ファイル: Matrix_classes.cpp プロジェクト: erakli/MAI_works
CMatrix CMatrix::operator * (const CMatrix &arg)
{
	auto rows = getRowCount(), cols = arg.getColCount(),
		p = getColCount(), // = RowCount у второй матрицы
		p2 = arg.getRowCount();

	/* избыточно, ввести обработчик */
	if (p == p2) // ширина первой матрицы равна высоте второй?
	{
		CMatrix Res(rows, cols);
			for (auto i = 0; i < rows; i++)
			{
				for (auto j = 0; j < cols; j++)
				{
					for (auto k = 0; k < p; k++)
					{
						Res[i][j] += (*this)[i][k] * arg[k][j];
					}
				}
			}
			return Res;
	}
	else // не равна
	{
		return CMatrix(rows, cols); // возвращаем нулевую матрицу
	}
	
}
コード例 #11
0
ファイル: syntaxhighlighter.cpp プロジェクト: gt945/gede
QVector<TextField*> SyntaxHighlighter::getRow(unsigned int rowIdx)
{
    assert(rowIdx < getRowCount());
    
    Row *row = m_rows[rowIdx];
    return row->m_fields;
}
コード例 #12
0
ファイル: LaB08.cpp プロジェクト: Xambey/something
Matrix<_Type> invert()
	{
		int size = getRowCount();
		if (size != getColCount()){
			throw MatrixException("Invalid size");
			return *this;
			
		}
	Matrix<_Type> result(size, size, 0);
	_Type det = determinant();
	
	if (det == 0)
	{
		throw MatrixException("Determinant = 0");
		return *this;
		
	}
	_Type temp;
	bool _invert = false;
	for (int i = 0; i < size; i++) {
		for (int j = 0; j < size; j++) {
			temp = _invert ? 0 : 1;
			temp = minor(i, j);
			temp /= det;
			result.put(i, j, temp);
			_invert = !_invert;
			
		}
		
	}
	result = result.transposition();
	return result;
		
	}
コード例 #13
0
void ControlsTab::reSizeTo(RECT & rc)
{
	TabBar::reSizeTo(rc);
	rc.left += marge;
	rc.top += marge;

	//-- We do those dirty things 
	//-- because it's a "vertical" tab control
	if (_isVertical)
	{
		rc.right -= 40;
		rc.bottom -= 20;
		if (getRowCount() == 2)
		{
			rc.right -= 20;
		}
	}
	//-- end of dirty things
	rc.bottom -= 55;
	rc.right -= 20;

	(*_pWinVector)[_current]._dlg->reSizeTo(rc);
	(*_pWinVector)[_current]._dlg->redraw();

}
コード例 #14
0
 void applyDerivativeOfTanh() {
     for (int rowIndex = 0; rowIndex < getRowCount(); ++rowIndex) {
         for (int columnIndex = 0; columnIndex < getColumnCount(); ++columnIndex) {
             float v = tanh(data[rowIndex][columnIndex]);
             data[rowIndex][columnIndex] = 1 - v * v;
         }
     }
 }
コード例 #15
0
TreePath FixedHeightTreeModelLayout::getPathClosestTo(const Pnt2f& Loc) const
{
    //Determine the row
    UInt32 Row(osgMin<UInt32>(Loc.y()/getRowHeight(),getRowCount()-1));

    //Get the Path for that row
    return getPathForRow(Row);
}
コード例 #16
0
 void addBy(Matrix const& matrix)
 {
     for (int rowIndex = 0; rowIndex < getRowCount(); ++rowIndex) {
         for (int columnIndex = 0; columnIndex < getColumnCount(); ++columnIndex) {
             data[rowIndex][columnIndex] += matrix[rowIndex][columnIndex];
         }
     }
 }
コード例 #17
0
/**
 * @brief       This method has been reimplemented. It repaints the table when the height changes.
 *
 * @param[in]   event       Resize event
 *
 * @return      Nothing.
 */
void AbstractTableView::resizeEvent(QResizeEvent* event)
{
    if(event->size().height() != event->oldSize().height())
    {
        updateScrollBarRange(getRowCount());
        mShouldReload = true;
    }
    QWidget::resizeEvent(event);
}
コード例 #18
0
ファイル: SoapExecution.cpp プロジェクト: treiche/db_agg
bool SoapExecution::process() {

    if (lastOffset == 0) {
        LOG_DEBUG("process url = " << getUrl()->getUrl());
        LOG_DEBUG("query: '" << getSql() << "'");

        prepareQuery();

        shared_ptr<Event> ev(new ExecutionStateChangeEvent(getId(),"CONNECTED"));
        fireEvent(ev);
    }

    auto source = getInPorts().at(0)->getResult();

    uint64_t row;
    for (row = lastOffset; row < lastOffset + chunkSize; row++) {
        auto range = TableDataFactory::getInstance().range(source,row,chunkSize);
        xmlNodePtr result = inputTemplate.transform(range);
        string response = callServer(getUrl(),as_string(result));
        auto rangeResult = outputTemplate.transform(response);
        if (!resultTable) {
            resultTable = TableDataFactory::getInstance().create("text",rangeResult->getColumns());
        }
        for (uint64_t rrow = 0; rrow < rangeResult->getRowCount(); rrow++) {
            vector<string> rv;
            for (uint32_t rcol = 0; rcol < rangeResult->getColCount(); rcol++) {
                rv.push_back(rangeResult->getValue(rrow,rcol));
            }
            resultTable->addRow(rv);
        }
    }

    shared_ptr<Event> rde(new ReceiveDataEvent(getId(),resultTable->getRowCount()));
    fireEvent(rde);

    if (row >= source->getRowCount()) {
        setResult("",resultTable);
        setState(QueryExecutionState::DONE);
        return true;
    }
    lastOffset = row;
    return false;
}
コード例 #19
0
ファイル: Matrix.cpp プロジェクト: S391D4002S576/ParFM
	template <class R> CMatrix<R> CMatrix<R>::getSubMatrix(int startRow, int rowCount, int startCol, int colCount) const {
		ASSERT((0 <= startRow) && (startRow + rowCount <= getRowCount()));
		ASSERT((0 <= startCol) && (startCol + colCount <= getColumnCount()));

		CMatrix<R> result = CMatrix<R>(colCount);

		for (int q = startRow; q < startRow + rowCount; q++) {
			result.addRow(rows[q]->getSubVector(startCol, colCount));
		}

		return result;
	}
コード例 #20
0
ファイル: Matrix_classes.cpp プロジェクト: erakli/MAI_works
CMatrix CMatrix::flip(){
	int Col = getColCount(), Row = getRowCount();
	CMatrix Res(Col, Row);
	for (int i = 0; i < Col; i++)
	{
		for (int j = 0; j < Row; j++)
		{ 
			Res[i][j] = (*this)[j][i];
		}
	}
	return Res;
}
コード例 #21
0
ファイル: Matrix_classes.cpp プロジェクト: erakli/MAI_works
CMatrix CMatrix::operator * (const TYPE num){
	UINT n = getRowCount(), m = getColCount();
	CMatrix Res(n, m);
	for (UINT i = 0; i < n; i++)
	{
		for (UINT j = 0; j < m; j++)
		{
			Res[i][j] = (*this)[i][j] * num;
		}
	}
	return Res;
}
コード例 #22
0
/**
 * @brief       This virtual method is called at the end of the vertSliderActionSlot(...) method.
 *              It allows changing the table offset according to the action type, the old table offset
 *              and delta between the old and the new table offset.
 *
 * @param[in]   type      Type of action (Refer to the QAbstractSlider::SliderAction enum)
 * @param[in]   value     Old table offset
 * @param[in]   delta     Scrollbar value delta compared to the previous state
 *
 * @return      Return the value of the new table offset.
 */
dsint AbstractTableView::sliderMovedHook(int type, dsint value, dsint delta)
{
    Q_UNUSED(type);
    dsint wValue = value + delta;
    dsint wMax = getRowCount() - getViewableRowsCount() + 1;

    // Bounding
    wValue = wValue > wMax ? wMax : wValue;
    wValue = wValue < 0 ? 0 : wValue;

    return wValue;
}
コード例 #23
0
ファイル: Matrix_classes.cpp プロジェクト: erakli/MAI_works
CMatrix CMatrix::operator * (const TYPE num)
{
	auto rows = getRowCount(), cols = getColCount();
	CMatrix Res(rows, cols);
	for (auto i = 0; i < rows; i++)
	{
		for (auto j = 0; j < cols; j++)
		{
			Res[i][j] = (*this)[i][j] * num;
		}
	}
	return Res;
}
コード例 #24
0
ファイル: ExtendedTableData.cpp プロジェクト: treiche/db_agg
void ExtendedTableData::init(vector<ColRef> colRefs) {
    assert(colRefs.size() > 0);
    this->colRefs = colRefs;
    setRowCount(colRefs[0].getTable()->getRowCount());
    vector<ColDef> colDefs;
    for (auto& colRef:colRefs) {
        if (colRef.getTable()->getRowCount() != getRowCount()) {
            throw runtime_error("tables need same row count to be extendable");
        }
        colDefs.push_back(colRef.getTable()->getColumns()[colRef.getColIdx()]);
    }
    setColumns(colDefs);
}
コード例 #25
0
ファイル: Matrix_classes.cpp プロジェクト: erakli/MAI_works
CMatrix CMatrix::flip(){
	UINT Col = getColCount(), Row = getRowCount();
	CMatrix Res(Row, Col);

	for (UINT i = 0; i < Row; i++)
	{
		for (UINT j = 0; j < Col; j++)
		{ 
			Res[i][j] = (*this)[j][i];
		}
	}
	return Res;
}
コード例 #26
0
ファイル: Matrix.cpp プロジェクト: radixvinni/aal
  Matrix& Matrix::gausRightTrianForEquation(Polynom & right)
  {
    if ((getCoding() == ON_LINE) && (getTrianType() == NONE))
    {
      uint maxDigits = 0, row = getRowCount();
      for (uint i = 0; i < row; i++)
        if (maxDigits < plMatrix[i]->getNumberDigits())
          maxDigits = plMatrix[i]->getNumberDigits();

      uint activeRow = 0;
      int activeCol = maxDigits - 1;
      while ((activeRow < row)&&(activeCol >= 0))
      {
        uint max = 0, j = activeRow, digit;
        for (uint i = activeRow; i < row; i++)
        {
          digit = plMatrix[i]->getDigit(activeCol);
          if (max < digit)
          {
            max = digit;
            j = i;
          }
        }
        if (max)
        {
          uint r = degree(max);
          uint ar = 1<<r;
          if (plMatrix[activeRow]->getDigit((uint)activeCol) < ar)
          {
            plMatrix[activeRow]->Xor(*plMatrix[j], *plMatrix[activeRow]);
            right.setBit(activeRow, right.getBit(j)^right.getBit(activeRow));
          }
          for (uint i = activeRow + 1; i < row; i++)
          {
            if (plMatrix[i]->getDigit((uint)activeCol) >= ar)
            {
              plMatrix[i]->Xor(*plMatrix[i], *plMatrix[activeRow]);
              right.setBit(i, right.getBit(i)^right.getBit(activeRow));
            }
          }
          activeRow++;
        }
        else
          activeCol--;
      }
      setTrianType(RIGHT);
    }
    else
        throw new Exception("Матрица должна быть упакована по строкам и не приведена к треугольному виду");
    return *this;
  }
コード例 #27
0
ファイル: Matrix_classes.cpp プロジェクト: erakli/MAI_works
// вычисление определителя матрицы по методу Гаусса
TYPE CMatrix::detGauss() const{
	if (checkSquare())
	{
		CMatrix temp = *this;
		
		int n = getRowCount();
		if (n == 1)
		{
			return temp[0][0]; // в случае, если матрица состоит из одного эл-та
		}

		for (int i = 0; i < n; i++)
		{
			if (temp[i][i] == 0)
			{
				int k = i + 1;
				if (k >= n) return 0; // последний элемент оказался нулевым

				while ((k < n) && (temp[k][i] == 0)) k++;

				if (temp[k][i] != 0)
				{
					for (int p = i; p < n; p++)	temp[i][p] += temp[k][p];
				}
				else
				{
					return 0;
				}
			} // проверили текущий диагональный элемент на 0

			for (int j = n - 1; j >= i; j--)
			{
				for (int p = i + 1; p < n; p++)
				{
					temp[p][j] -= temp[i][j] * (temp[p][i] / temp[i][i]);
				}
			}
		}

		TYPE result = 1;
		for (int i = 0; i < n; i++)
		{
			result *= temp[i][i];
		}
		
		return result;
	}
//	else return INFINITY;
	else return sizeof(TYPE);
}
コード例 #28
0
std::string CategoryController::getName(int index) const
{
	assert(index >= 1 && index <= getRowCount());

	std::vector<std::string> categories;

	for (int i = 1; i <= _gameController->getRowCount(); ++i)
	{
		if (std::find(categories.begin(), categories.end(), _gameController->getCategory(i)) == categories.end())
			categories.push_back(_gameController->getCategory(i));
	}

	return categories[index-1];
}
コード例 #29
0
ファイル: mysql_common.cpp プロジェクト: 2bj/hhvm
bool MySQLResult::seekRow(int64_t row) {
  if (row < 0 || row >= getRowCount()) {
    raise_warning("Unable to jump to row %" PRId64 " on MySQL result index %d",
                    row, o_getId());
    return false;
  }

  if (!m_localized) {
    mysql_data_seek(m_res, (my_ulonglong)row);
  } else {
    m_current_row = m_rows->begin();
    for (int i = 0; i < row; i++) m_current_row++;
    m_row_ready = false;
  }
  return true;
}
コード例 #30
0
ファイル: Matrix_classes.cpp プロジェクト: erakli/MAI_works
// определение положительно определённой матрицы
bool CMatrix::PositiveDef() const{
	bool flag = true;
	if (checkSymmetric())
	{
		int n = getRowCount();
		for (int i = 1; (i <= n) && (flag); i++)
		{
			CMatrix temp = *this;
			temp.setSize(i, i);
			if (temp.detGauss() <= 0) flag = false; // у нас неположительно определённая матрица
		}
	}
	else flag = false;

	return flag;
}