static void complexity(FILE *f, SmiNode *row, SmiNode *col, void *data) { int *cmplx = (int *) data; SmiType *smiType; unsigned long min, max; smiType = smiGetNodeType(col); if (! smiType) { return; } switch (smiType->basetype) { case SMI_BASETYPE_INTEGER32: case SMI_BASETYPE_UNSIGNED32: case SMI_BASETYPE_ENUM: *cmplx += 1; break; case SMI_BASETYPE_OCTETSTRING: case SMI_BASETYPE_OBJECTIDENTIFIER: case SMI_BASETYPE_BITS: *cmplx += 2; min = getMinSize(smiType); max = getMaxSize(smiType); if (min != max) { *cmplx += 1; } break; default: /* ignore everything else */ break; } }
bool Orchard::legalInput(int i, int j) { int fieldSize = getMaxSize(); if (i < 0 || j < 0 || i >= fieldSize || j >= fieldSize) { return false; } return true; }
void AbstractWindow::updateContainerLayout(void) { if(getParentContainer() != NULL) { Inherited::updateContainerLayout(); } else if(getSize() != getPreferredSize()) { Vec2f Size(osgMax(osgMin(getPreferredSize().x(), getMaxSize().x()), getMinSize().x()), osgMax(osgMin(getPreferredSize().y(), getMaxSize().y()), getMinSize().y())); if(getSize() != Size) { setSize(Size); } } }
const NAString ElemDDLFileAttrMaxSize::displayLabel2() const { char buffer[80]; sprintf(buffer, "%d", getMaxSize()); return NAString("Size: ") + NAString(buffer); }
Tetra* GpTetra::makeNewTetra(Node* nd1,Node* nd2,Node* nd3,Node* nd4) { Tetra* ptet; int n = (int)tetra.size(); if(n >= getMaxSize()) { Errors err(1, "Tetra* GpTetra::makeNewTetra(Node *nd1,Node *nd2,Node *nd3,Node *nd4)", "number os tetrahedras is max"); throw err; } int id = (int)tetra.size() + 1; ptet = new Tetra(id,nd1,nd2,nd3,nd4); if(!ptet) { Errors err(-1, "Tetra* Tetgen::makeNewItem(Node *p0,Node *p1,Node *p2,Node *p3)", "failed making new object"); throw err; } tetra.push_back(ptet); return ptet; }
bool PointChunk::operator == (const StateChunk &other) const { PointChunk const *tother = dynamic_cast<PointChunk const*>(&other); if(!tother) return false; if(tother == this) return true; if(getSize() != tother->getSize() || getSmooth() != tother->getSmooth() || getMinSize() != tother->getMinSize() || getMaxSize() != tother->getMaxSize() || getConstantAttenuation() != tother->getConstantAttenuation() || getLinearAttenuation() != tother->getLinearAttenuation() || getQuadraticAttenuation() != tother->getQuadraticAttenuation() || getFadeThreshold() != tother->getFadeThreshold() || getSprite() != tother->getSprite() || getRMode() != tother->getRMode() ) { return false; } return true; }
//##ModelId=4C31F9F801D4 void fluid::glExtension::btGLTexture1D::create(GLint sz, GLint internalFormat, GLint clr) { TEST_ASSERT_MSG(sz <= getMaxSize(), "Image Size Out Of Bounds."); if(texture != -1) glDeleteTextures(1,&texture); glGenTextures(1,&texture); glBindTexture(GL_TEXTURE_1D,texture); GLint* clrData=(GLint*)malloc(sz << 2); for(int i=0;i < sz;i++) clrData[i]=clr; glTexImage1D(GL_TEXTURE_1D,0,internalFormat,sz,0,GL_RGBA,GL_UNSIGNED_BYTE,clrData); free(clrData); parameter.szWidth=sz; parameter.internalFormat=internalFormat; parameter.magFilter=GL_NEAREST; parameter.minFilter=GL_NEAREST; parameter.wrapModeS=GL_CLAMP_TO_EDGE; setParameterSet(¶meter); glBindTexture(GL_TEXTURE_1D,0); }
QSizeF WindowController::getMinSizeAspectRatioCorrect() const { const auto min = getMinSize(); const auto max = getMaxSize(); if (min > max) return _getAspectRatioSize().scaled(max, Qt::KeepAspectRatio); return _getAspectRatioSize().scaled(min, Qt::KeepAspectRatioByExpanding); }
PackedNode* PackedNode::createNode(const char characterSize, const char* characters, const bool isLastSibling, const int deltaScore, const int firstChildOffset) { char* memory = new char[getMaxSize()]; return createNode(memory, characterSize, characters, isLastSibling, deltaScore, firstChildOffset); }
Size FlowLayout::getSizeWith(const Size&,size_func) const { if(_ctrls.size() == 0) return Size(); Size size = _sameSize ? getMaxSize() : getTotalSize(); if(_orientation == HORIZONTAL) return Size(size.width * _ctrls.size() + _gap * (_ctrls.size() - 1),size.height); return Size(size.width,size.height * _ctrls.size() + _gap * (_ctrls.size() - 1)); }
void Hashtable::showStatistic(){ printf("\n\nAll Cells: %d\n", sizeTable); printf("Occupied Cells: %d\n", occupiedCells); printf("Free Cells: %d\n", sizeTable - occupiedCells); loadFactor = (double)occupiedCells/sizeTable; printf("Load Factor: %.8f\n", loadFactor); printf("Count of Conflicts: %d\n", numberOfConflicts); printf("Max Size of Cell: %d\n\n", getMaxSize()); }
BSONObj ShardType::toBSON() const { BSONObjBuilder builder; if (_name) builder.append(name(), getName()); if (_host) builder.append(host(), getHost()); if (_draining) builder.append(draining(), getDraining()); if (_maxSize) builder.append(maxSize(), getMaxSize()); if (_tags) builder.append(tags(), getTags()); return builder.obj(); }
/* get the size of the giant connected cluster */ int getGiantClusterSize(struct network * target) { int size; struct CLSTS * clsts; clsts=NULL; getCLSTS(target, &clsts); size=getMaxSize(clsts); freeCLSTS(clsts); return size; }
void GetEntry(TTree *tree,Long64_t entry = 0,Int_t getall = 0) { for (unsigned int i = 0; i < getMaxSize(); i++) { for (unsigned int j = 0; j < branches.size(); j++) { if (variables[j].size() == 1) continue; tree->SetBranchAddress(branches[j],variables[j][i]); } tree->GetEntry(entry,getall); } }
static unsigned long getMaxSize(SmiType *smiType) { SmiRange *smiRange; SmiType *parentType; SmiNamedNumber *nn; unsigned int max = 0, size; switch (smiType->basetype) { case SMI_BASETYPE_BITS: case SMI_BASETYPE_OCTETSTRING: size = 65535; break; case SMI_BASETYPE_OBJECTIDENTIFIER: size = 128; break; default: return 0xffffffff; } if (smiType->basetype == SMI_BASETYPE_BITS) { for (nn = smiGetFirstNamedNumber(smiType); nn; nn = smiGetNextNamedNumber(nn)) { if (nn->value.value.unsigned32 > max) { max = nn->value.value.unsigned32; } } size = (max / 8) + 1; return size; } for (smiRange = smiGetFirstRange(smiType); smiRange ; smiRange = smiGetNextRange(smiRange)) { if (smiRange->maxValue.value.unsigned32 > max) { max = smiRange->maxValue.value.unsigned32; } } if (max > 0 && max < size) { size = max; } parentType = smiGetParentType(smiType); if (parentType) { unsigned int psize = getMaxSize(parentType); if (psize < size) { size = psize; } } return size; }
QSize DockPixelStreamer::constrainSize(const QSize& size) const { QSize minSize = getMinSize(); QSize maxSize = getMaxSize(); if (size.width() < minSize.width() || size.height() < minSize.height()) return minSize; if (size.width() > maxSize.width() || size.height() > maxSize.height()) return maxSize; return size; }
NATraceList ElemDDLPartitionSystem::getDetailInfo() const { NAString detailText; NATraceList detailTextList; detailTextList.append(displayLabel1()); // add or drop detailTextList.append(displayLabel2()); // location name detailTextList.append(displayLabel3()); // location name type // // file attributes for this partition // detailTextList.append("File attributes:"); detailText = " max size spec? "; detailText += YesNo(isMaxSizeSpecified()); detailTextList.append(detailText); detailText = " maxsizunbound? "; detailText += YesNo(isMaxSizeUnbounded()); detailTextList.append(detailText); detailText = " max size: "; detailText += LongToNAString((Lng32)getMaxSize()); detailTextList.append(detailText); #pragma nowarn(1506) // warning elimination ElemDDLFileAttrMaxSize maxSizeFileAttr(getMaxSize(), getMaxSizeUnit()); #pragma warn(1506) // warning elimination detailText = " max size unit: "; detailText += maxSizeFileAttr.getMaxSizeUnitAsNAString();; detailTextList.append(detailText); return detailTextList; }
QSizeF WindowController::getMinSize() const { if (_targetIsFullscreen()) { const auto size = _getPreferredDimensions(); const auto targetSize = size.scaled(_group.size(), Qt::KeepAspectRatio); return std::min(targetSize, getMaxSize()); } const auto minContentSize = QSizeF{_window.getContent().getMinDimensions()}; const auto minSize = QSizeF{ui::getMinWindowSize(), ui::getMinWindowSize()}; return std::max(minContentSize, minSize); }
void ContentWindowController::constrainSize( QSizeF& windowSize ) const { const QSizeF& maxSize = getMaxSize(); if( windowSize > maxSize ) { windowSize.scale( maxSize, Qt::KeepAspectRatio ); return; } const QSizeF& minSize = getMinSize(); if( windowSize < minSize ) windowSize = _contentWindow->getCoordinates().size(); }
void TestVector::all() { emptyConstructor(); paramConstructor(); copyConstructor(); assignmentOperator(); get(); getSize(); getMaxSize(); insert(); clear(); empty(); increaseSize(); }
void testApp::setup() { ofSetWindowTitle(appName); ofSetVerticalSync(true); ofSetLogLevel(OF_LOG_VERBOSE); ofSeedRandom(0); PhotoManager::setup("~/Desktop/3rdiStream/resized/"); setupOsc(); ofxVec2f size = getMaxSize(); surface.setup(size, ofxVec2f(60, 100)); wall.setup(surface); }
Status ShardType::validate() const { if (!_name.is_initialized() || _name->empty()) { return Status(ErrorCodes::NoSuchKey, str::stream() << "missing " << name.name() << " field"); } if (!_host.is_initialized() || _host->empty()) { return Status(ErrorCodes::NoSuchKey, str::stream() << "missing " << host.name() << " field"); } if (_maxSize.is_initialized() && getMaxSize() < 0) { return Status(ErrorCodes::BadValue, str::stream() << "maxSize can't be negative"); } return Status::OK(); }
int toprsGadlReader::getNumberOfSamples( int reduced_res_level /*= 0*/ ) const { int result = 0; if ( isOpen() && isValidRLevel(reduced_res_level) ) {//xizhi //if(theOverview.valid() && theOverview->isValidRLevel(reduced_res_level)) //{ // result = theOverview->getNumberOfLines(reduced_res_level); //} //else { int x, y; getMaxSize(reduced_res_level, x, y); result = x; } } return result; }
bool FlowLayout::rearrange() { if(!_p || _ctrls.size() == 0) return false; bool res = false; gsize_t pad = _p->getTheme().getPadding(); Size size = _p->getSize() - Size(pad * 2,pad * 2); Size all = _sameSize ? getMaxSize() : getTotalSize(); Pos pos(pad,pad); if(_orientation == VERTICAL) { swap(size.width,size.height); swap(all.width,all.height); } gsize_t totalWidth = all.width * _ctrls.size() + _gap * (_ctrls.size() - 1); pos.y = size.height / 2 - all.height / 2; switch(_align) { case FRONT: break; case CENTER: pos.x = (size.width / 2) - (totalWidth / 2); break; case BACK: pos.x = pad + size.width - totalWidth; break; } if(_orientation == VERTICAL) { swap(pos.x,pos.y); swap(all.width,all.height); } for(auto it = _ctrls.begin(); it != _ctrls.end(); ++it) { Size csize = _sameSize ? all : (*it)->getPreferredSize(); res |= configureControl(*it,pos,csize); if(_orientation == VERTICAL) pos.y += csize.height + _gap; else pos.x += csize.width + _gap; } return res; }
void WindowController::constrainSize(QSizeF& windowSize, const Window::ResizePolicy policy) const { const auto snapToAspectRatio = policy == Window::KEEP_ASPECT_RATIO && _window.getContent().isZoomed(); const auto tryKeepAspectRatio = policy == Window::KEEP_ASPECT_RATIO && !_window.getContent().isZoomed(); const auto keepAspectRatio = tryKeepAspectRatio || _mustKeepAspectRatio(windowSize); if (keepAspectRatio) _constrainAspectRatio(windowSize); windowSize = geometry::constrain(windowSize, getMinSize(), getMaxSize(), keepAspectRatio); if (snapToAspectRatio && _isCloseToContentAspectRatio(windowSize)) windowSize = geometry::adjustAspectRatio(windowSize, _getContentSize()); }
toprsIRect toprsGadlReader::getImageRectangle( int reduced_res_level /*= 0*/ ) const { toprsIRect result; result.makeNAN(); int x, y; getMaxSize(reduced_res_level, x, y); if(x&&y) { return toprsIRect(0, 0, x - 1, y - 1); } if (result.hasNAN()) { return toprsImageReader::getImageRectangle(reduced_res_level); } return result; }
void testApp::update() { while(oscReceiver.hasWaitingMessages()) { ofxOscMessage message; oscReceiver.getNextMessage(&message); string address = message.getAddress(); if(address.compare("mouse") == 0) { ofxVec2f maxSize = getMaxSize(); forces.clear(); for(int i = 0; i < message.getNumArgs(); i += 2) { float x = message.getArgAsFloat(i + 0); float y = message.getArgAsFloat(i + 1); ofxVec2f cur(x, y); cur *= maxSize; forces.push_back(cur); } surface.update(forces); wall.update(); } else if(address.compare("debug") == 0) { ofxMultiscreen::debug = !ofxMultiscreen::debug; } } }
int main() { int errCode; srand((unsigned)time(NULL));//初始化随机数种子 if(init(RECV_DATA_PATH) != 0) return -1; int fileseize = getMaxSize(RECV_DATA_PATH); errCode = recvAndParase(fileseize-3, 2); for(int i = fileseize; i > 0; --i) { errCode = recvAndParase(i, fileseize-i); printf("解析返回[%d]\n", errCode); destroy(); init(RECV_DATA_PATH); } return 0; }
void CCBControlButton::needsLayout() { Label *label = static_cast<Label*>(this->getTitleLabel()); if (label) { label->setScale(1); label->setOpacity(getTitleOpacityForState(_state)); } ControlButton::needsLayout(); Size maxSize(getMaxSize()); float scale = 1.0f; if (label) { Size labelSize(label->getBoundingBox().size); float scaleX = 1.f, scaleY = 1.f; if (maxSize.width > 0 && maxSize.width - (this->getHorizontalOrigin() * 2) < labelSize.width) { scaleX = (maxSize.width - (this->getHorizontalOrigin() * 2)) / labelSize.width; } if (maxSize.height > 0 && maxSize.height - (this->getVerticalMargin() * 2) < labelSize.height) { scaleY = (maxSize.height - (this->getVerticalMargin() * 2)) / labelSize.height; } if (scaleX > 0.f && scaleY > 0.f) { scale = std::min(scaleX, scaleY); } else { scale = std::max(scaleX, scaleY); } label->setScale(scale); cocos2d::Point position = label->getPosition(); position.x += this->_shadowOffset.width/2.f; position.y += this->_shadowOffset.height/2.f; label->setPosition(position); //DuongNT //label->setFontFillColor(getTitleColorForState(_state)); label->setColor(Color3B(getFontColor())); } if (this->getBackgroundSprite() != NULL) { cocos2d::Size size = this->getBackgroundSprite()->getContentSize(); size.width += abs(this->_shadowOffset.width)+this->_shadowBlurRadius*2.f; size.height += abs(this->_shadowOffset.height)+this->_shadowBlurRadius*2.f; if (size.width < this->_preferredSize.width) { size.width = this->_preferredSize.width; } if (size.height < this->_preferredSize.height) { size.height = this->_preferredSize.height; } if (maxSize.width > 0.f && size.width > maxSize.width) { size.width = maxSize.width; } if (maxSize.height > 0.f && size.height > maxSize.height) { size.height = maxSize.height; } this->getBackgroundSprite()->setContentSize(size); } }
void EvolutionOfMorphologyAndBehavior::prepareCreatures() { for (int i = 0; i < getPopulationSize(); ++i) { Creature& creature = getCreature(i); creature.reset(); double* position = getPsoModel().getParticle(i).getPosition(); int particle_index = 0; //Morphology //[index] int morphology_index = (int) Math::scale(0, 100, position[particle_index++], 0, getNumberOfMorphologies()); setCreaturesMorphologyIndex(i, morphology_index); setup(creature, getMorphology(morphology_index)); getMorphology(morphology_index).addFitness(1.0); //BodyPart //[ shape | size-x | size-y | size-z | mass ] * creature.getBodyParts(); for (int j = 0; j < creature.getNumberOfBodyParts(); ++j) { creature.getBodyPart(j).setShape(getShape(position[particle_index++])); creature.getBodyPart(j).setSizeX(Math::scale(0, 100, position[particle_index++], getMinSize(), getMaxSize())); creature.getBodyPart(j).setSizeY(Math::scale(0, 100, position[particle_index++], getMinSize(), getMaxSize())); creature.getBodyPart(j).setSizeZ(Math::scale(0, 100, position[particle_index++], getMinSize(), getMaxSize())); creature.getBodyPart(j).setMass(Math::scale(0, 100, position[particle_index++], getMinMass(), getMaxMass())); } //Constraints //[ parent-connection-point | connection-point | // cone-swing-x | cone-twist-y | cone-swing-z ] * creature.getConstraints(); for (int j = 0; j < creature.getNumberOfConstraints(); ++j) { creature.getConstraint(j).setType(Constraint::CT_CONE_TWIST); creature.getConstraint(j).setConnectionA((int) Math::scale(0, 100, position[particle_index++], 0, Constraint::MAX_CONNECTION_POINTS)); creature.getConstraint(j).setConnectionB((int) Math::scale(0, 100, position[particle_index++], 0, Constraint::MAX_CONNECTION_POINTS)); creature.getConstraint(j).setConeSwingX(Math::scale(0, 100, position[particle_index++], Constraint::CONE_MIN_SWING, Constraint::CONE_MAX_SWING)); creature.getConstraint(j).setConeTwistY(Math::scale(0, 100, position[particle_index++], Constraint::CONE_MIN_TWIST, Constraint::CONE_MAX_TWIST)); creature.getConstraint(j).setConeSwingZ(Math::scale(0, 100, position[particle_index++], Constraint::CONE_MIN_SWING, Constraint::CONE_MAX_SWING)); } //NeuralNetwork //[ weight ] * creature.getNeuralNetwork().getTotalNumberOfWeights(); NeuralNetwork& nn = creature.getNeuralNetwork(); int layers = nn.getNumberOfLayers(); for (int j = 1; j < layers; ++j) { int neurons = nn.getLayer(j).getNumberOfNeurons(); for (int k = 0; k < neurons; ++k) { int inputs = nn.getLayer(j).getNeuron(k).getNumberOfInputs(); for (int l = 0; l < inputs; l++) { nn.getLayer(j).getNeuron(k).setInput(l, Math::scale(0, 100, position[particle_index++], -1.0, 1.0)); } nn.getLayer(j).getNeuron(k).setThreshold( Math::scale(0, 100, position[particle_index++], -1.0, 1.0)); } } creature.set(); } }