inline void DiscretizedOption::reset(Size size) { QL_REQUIRE(method() == underlying_->method(), "option and underlying were initialized on " "different methods"); values_ = Array(size, 0.0); adjustValues(); }
void Graphics::drawMask() { QPainter p(this); QPen pen; pen.setWidth(3); pen.setColor(Qt::black); p.setPen(pen); p.drawLine(left, py(button), left, py(height() - top)); // linha vertical p.drawLine(left, py(button), width() - right, py(button)); // linha horizontal float maxValueReal = getMax(data); float maxValueAdjust = getMax(adjustValues()); int tamVerticalLine = py(button) - py(height() - top); int i = 1; while (tamVerticalLine % 10 != 0){ tamVerticalLine = py(button) - (py(height() - top)-i); i++; } p.drawLine(left, py(button), left, (py(height() - top)-i-5)); // linha vertical tamVerticalLine += 5; int distancia = (tamVerticalLine - 5) / 10; float jump = tamVerticalLine/maxValueAdjust; maxValueReal *= jump; jump = maxValueReal / 10; QString valueStr; float valueInt = 0; pen.setWidth(1); p.setPen(pen); p.drawText(left - 20, py(button) + 5,"0"); for (int i = 1; i <= 10; i++){ p.drawLine(left, py(button) - i*distancia, width() - right, py(button) - i * distancia); valueInt += jump; valueStr.setNum(valueInt); int index = 0; int pos = 0; foreach (QString v, valueStr){ if (v == ".") pos = index; index++; } valueStr = valueStr.mid(0,pos); p.drawText(left - 20, py(button) - i*distancia + 5, valueStr); } }
void eapsUta12Port::updateValues() { checkInTimeCount(); if( _emitVoltage || _emitPower || _emitResistance ) { getVoltage(); } if( _emitCurrent || _emitPower || _emitResistance ) { getCurrent(); } updateNumInTimeValues(); if( _setValueType != setValueType::setTypeNone && _autoAdjust ) { adjustValues(); } }
bool Graphics::drawLines() { QPainter p(this); p.setRenderHint(QPainter::Antialiasing); if (data.length() == 0) return false; QList < QList < float > > data = adjustValues(); int pX = 0; int pY = 0; int colunas = data[0].length(); int linhas = data.length(); int distance = (int) (width() - left - right * 2) / (colunas - 1); for (int i = 0; i < linhas; i++){ QPen pen; pX = left + 5; pY = button; for (int j = 0; j < colunas - 1; j++){ pen.setColor(colors[i]); pen.setWidth(2); p.setPen(pen); if (py(pY + data[i][j]) > maxLine) maxLine = py(pY + data[i][j]); if (py(pY + data[i][j+1]) > maxLine) maxLine = py(pY + data[i][j+1]); p.drawLine(pX, py(pY + data[i][j]), pX+distance, py(pY + data[i][j+1])); pen.setColor(colors[i]); pen.setWidth(5); p.setPen(pen); QPoint point; point.setX(pX); point.setY(py(pY + data[i][j])); p.drawPoint(point); point.setX(pX + distance); point.setY(py(pY + data[i][j+1])); p.drawPoint(point); pen.setColor(Qt::black); pen.setWidth(3); p.setPen(pen); p.drawLine(pX, py(button - 2), pX, py(button - 7)); // linhas demarcadoras pX += distance; } pen.setColor(Qt::black); pen.setWidth(3); p.setPen(pen); p.drawLine(pX, py(button - 2), pX, py(button - 7)); // linhas demarcadoras } return true; }
void DiscretizedBarrierOption::reset(Size size) { vanilla_.initialize(method(), time()); values_ = Array(size, 0.0); adjustValues(); }
void DiscretizedDermanKaniBarrierOption::reset(Size size) { unenhanced_.initialize(method(), time()); values_ = Array(size, 0.0); adjustValues(); }
void DiscretizedCallableFixedRateBond::reset(Size size) { values_ = Array(size, arguments_.redemption); adjustValues(); }
void DiscretizedVanillaOption::reset(Size size) { values_ = Array(size, 0.0); adjustValues(); }