예제 #1
0
void CarClass::setNewCar(string brand,unsigned int price ,TDate date, TStatus status, int id){
	setID(id);
	setbrand(brand);
	setPrice(price);
    setmanufactureDate(date);
    setStatus(OK);	
}
예제 #2
0
Weapon::Weapon(std::string name, bool hold, int precision, int damage, int price, int rarity)
{
	setName(name);
	m_hold = hold;
	m_precision = precision;
	m_damage = damage;
	setPrice(price);
	setRarity(rarity);
    m_itemid = 0;
}
예제 #3
0
Weapon::Weapon(void)
{
	setName("Weapon");
	m_hold = false;
	m_precision = 0;
	m_damage = 0;
	setPrice(0);
	setRarity(0);
    m_itemid = 0;
}
void Earth::Reset(string num)
{
	setReset(true);
	setNum(num);
	setPrice(45555.99);
	resetiOS();
	resetAndroid();
	fourXfour = false;
	superCharged = false;

}
예제 #5
0
void Air::Reset(string num)
{
	setReset(true);
	setNum(num);
	setPrice(75555.99);
	setiOS(false);
	setAndroid(false);
	rotorType = "Basic";
	autoPilot = false;
	highAltitude = false;
}
예제 #6
0
void Earth::Reset(string num)
{
	setReset(true);
	setNum(num);
	setPrice(45555.99);
	setiOS(false);
	setAndroid(false);
	wheelType = "Basic";
	fourXfour = false;
	superCharged = false;

}
예제 #7
0
파일: item.cpp 프로젝트: albertca/frePPLe
DECLARE_EXPORT void Item::endElement(XMLInput& pIn, const Attribute& pAttr, const DataElement& pElement)
{
  if (pAttr.isA(Tags::tag_operation))
  {
    Operation *o = dynamic_cast<Operation*>(pIn.getPreviousObject());
    if (o) setOperation(o);
    else throw LogicException("Incorrect object type during read operation");
  }
  else if (pAttr.isA(Tags::tag_price))
    setPrice(pElement.getDouble());
  else
  {
    HasDescription::endElement(pIn, pAttr, pElement);
    HasHierarchy<Item>::endElement(pIn, pAttr, pElement);
  }
}
예제 #8
0
Book::Book(const string& aName,
           int aCode,
           double aPrice,
           int aRating,
           const string& aComment,
           const string& aAuthor,
           const string& aTitle,
           const string& aIsbn) :
author(aAuthor), title(aTitle), isbn(aIsbn) // eigene Attribute 
{
  setName(aName);            // Attribute der Basisklasse
  setCode(aCode);
  setPrice(aPrice);
  setRating(aRating);
  setComment(aComment);
}
예제 #9
0
파일: CWeapon.cpp 프로젝트: phabh/warbugs
//Métodos da CObject
CWeapon::CWeapon(TypeItens nome, EstadoItem estado, int preco, bool isdropable, Raca raca, int mod, int danM, int danX, int spd, int rng, int dur, int nM)
{
	setID(-1);
	setDurability(dur);
	setBaseID(nome);
	setEstado(estado);
	setPrice(preco);
	setDropable(isdropable);
	_raca = raca;
	_modificador = mod;
	_danoMin = danM;
	_danoMax = danX;
	_velocidade = spd;
	_alcance = rng;
	_nivelMagico = nM;
}
예제 #10
0
int ShoeDescription::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 1)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 1;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = size(); break;
        case 1: *reinterpret_cast< QColor*>(_v) = color(); break;
        case 2: *reinterpret_cast< QString*>(_v) = brand(); break;
        case 3: *reinterpret_cast< qreal*>(_v) = price(); break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setSize(*reinterpret_cast< int*>(_v)); break;
        case 1: setColor(*reinterpret_cast< QColor*>(_v)); break;
        case 2: setBrand(*reinterpret_cast< QString*>(_v)); break;
        case 3: setPrice(*reinterpret_cast< qreal*>(_v)); break;
        }
        _id -= 4;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 4;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 4;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
예제 #11
0
void MenuBoxManager::setBoxWithList(Vector<ImageInfoParser*> imgInfo)
{
    if(_vButton.size() > 0)
    {
        log("ButtonVector has data will be remove");
        _vButton.clear();
    }
    if(getChildByTag(TAG_MENUBOXLIST))
    {
        getChildByTag(TAG_MENUBOXLIST)->removeFromParent();
    }
    for(int i = 0 ; i < imgInfo.size() ; i++)
    {
        ImageInfoParser* info = static_cast<ImageInfoParser*>(imgInfo.at(i));

        auto button = ui::Button::create("Main_BoxUp-hd.png", "Main_BoxDown-hd.png", "Main_BoxDown-hd.png");
        //        button->setTitleText("text");
        button->setTag(TAG_MAIN_BOX + info->getidx()->intValue());
        button->addTouchEventListener([&](Ref* sender, ui::Widget::TouchEventType type) {
            switch (type)
            {
            case ui::Widget::TouchEventType::BEGAN:

                break;
            case ui::Widget::TouchEventType::ENDED:

                buttonCallBack(sender);
                break;
            default:
                break;
            }
        });




        setTypeTitle(button, info->gettitle()->getCString());
        setTypeInfo(button, __String::createWithFormat("%s / %s",info->getspace()->getCString(),info->getair()->getCString())->getCString());
        setPrice(button, __String::createWithFormat("%s", info->getprice()->getCString())->intValue());
        setImageWithName(button, __String::createWithFormat("%s", info->getimgName()->getCString())->getCString());

        _vButton.pushBack(button);
    }
    setListView();
}
예제 #12
0
파일: item.cpp 프로젝트: albertca/frePPLe
DECLARE_EXPORT int Item::setattro(const Attribute& attr, const PythonObject& field)
{
  if (attr.isA(Tags::tag_name))
    setName(field.getString());
  else if (attr.isA(Tags::tag_description))
    setDescription(field.getString());
  else if (attr.isA(Tags::tag_category))
    setCategory(field.getString());
  else if (attr.isA(Tags::tag_subcategory))
    setSubCategory(field.getString());
  else if (attr.isA(Tags::tag_price))
    setPrice(field.getDouble());
  else if (attr.isA(Tags::tag_owner))
  {
    if (!field.check(Item::metadata))
    {
      PyErr_SetString(PythonDataException, "item owner must be of type item");
      return -1;
    }
    Item* y = static_cast<Item*>(static_cast<PyObject*>(field));
    setOwner(y);
  }
  else if (attr.isA(Tags::tag_operation))
  {
    if (!field.check(Operation::metadata))
    {
      PyErr_SetString(PythonDataException, "item operation must be of type operation");
      return -1;
    }
    Operation* y = static_cast<Operation*>(static_cast<PyObject*>(field));
    setOperation(y);
  }
  else if (attr.isA(Tags::tag_hidden))
    setHidden(field.getBool());
  else
    return -1;
  return 0;
}
예제 #13
0
void Component::editMargin(double margin)
{
    this->margin = margin;
    setPrice();
}
예제 #14
0
void Contract::setPrice(double ask, double bid)
{
    setPrice(0, ask, bid);
}
    void MamdaOrderBookPriceLevel::setAsDifference (
        const MamdaOrderBookPriceLevel&  lhs,
        const MamdaOrderBookPriceLevel&  rhs)
    {
        assert (lhs.getPrice() == rhs.getPrice());

        MamdaOrderBookPriceLevel::iterator lhsEnd  = end();
        MamdaOrderBookPriceLevel::iterator lhsIter = begin();
        MamdaOrderBookPriceLevel::iterator rhsEnd  = end();
        MamdaOrderBookPriceLevel::iterator rhsIter = begin();

        while ((lhsIter != lhsEnd) && (rhsIter != rhsEnd))
        {
            const char*      lhsId   = NULL;
            const char*      rhsId   = NULL;
            mama_quantity_t  lhsSize = 0.0;
            mama_quantity_t  rhsSize = 0.0;

            if (lhsIter != lhsEnd)
            {
                const MamdaOrderBookEntry* entry = *lhsIter;
                lhsId   = entry->getId();
                lhsSize = entry->getSize();
            }
            if (rhsIter != rhsEnd)
            {
                const MamdaOrderBookEntry* entry = *rhsIter;
                rhsId   = entry->getId();
                rhsSize = entry->getSize();
            }

            if (lhsId && rhsId)
            {
                if (strcmp(lhsId,rhsId)==0)
                {
                    // Same ID, maybe different size.
                    if (mama_isQuantityEqual (lhsSize, rhsSize))
                    {
                        MamdaOrderBookEntry* updateEntry =
                            new MamdaOrderBookEntry (**rhsIter);
                        updateEntry->setAction(
                            MamdaOrderBookEntry::MAMDA_BOOK_ACTION_UPDATE);
                        addEntry (updateEntry);
                    }
                    ++lhsIter;
                    ++rhsIter;
                    continue;
                }
                else
                {
                    // Different ID (either something exists on the LHS
                    // and not on RHS or vice versa).
                    MamdaOrderBookPriceLevel::const_iterator rhsFound = 
                        findEntryAfter (rhsIter, lhsId);
                    if (rhsFound != rhsEnd)
                    {
                        // The ID from the LHS was found on the RHS, so
                        // there must have been additional entries on the
                        // RHS, which we now need to add.
                        do
                        {
                            MamdaOrderBookEntry* entry =
                                new MamdaOrderBookEntry(**rhsIter);
                            addEntry (entry);
                            ++rhsIter;
                        }
                        while (rhsIter != rhsFound);
                    }
                    else
                    {
                        // The ID from the LHS was not present on the RHS,
                        // so add the LHS entry.  Note: it would probably
                        // be faster to iterate over the LHS side rather
                        // than begin the loop again.
                        MamdaOrderBookEntry* entry =
                            new MamdaOrderBookEntry(**lhsIter);
                        addEntry (entry);
                        ++lhsIter;
                    }
                }
            }
        }

        setPrice (rhs.getPrice());
        setSizeChange (rhs.getSize() - lhs.getSize());
        setSize (rhs.getSize());
        setNumEntries (rhs.getNumEntries());
        setAction (MamdaOrderBookPriceLevel::MAMDA_BOOK_ACTION_UPDATE);
        setTime (rhs.getTime());
        setSide (rhs.getSide());
    }
//Default constructor without parameters sets Name & Unit to "", Quantity &  Price to 0
ClubItems::ClubItems()
{ setItemName("");
  setUnit("");
  setQuantity(0);
  setPrice(0.0);
}
예제 #17
0
파일: Item.cpp 프로젝트: zvet80/CppCourse
Item::Item(string id, string name, float price)
{
	setId(id);
	setName(name);
	setPrice(price);
}
//Constructor with 2 strings an interger and a double as parameters to initialize 
//Item Name, Unit, Quantity, and Price
ClubItems::ClubItems(string itemNameIn, string unitIn, int quantityIn, double priceIn)
{  setItemName(itemNameIn);
   setUnit(unitIn);
   setQuantity(quantityIn);
   setPrice(priceIn);
}
예제 #19
0
bool ShopPanel::init()
{
	/*for(auto node:_buttons->getChildren())
	{
	auto button = static_cast<Button*>(node);
	button->addTouchEventListener(CC_CALLBACK_2(ShopPanel::onButtonClicked, this));
	}*/
	
	//_container->setTouchEnabled(true);
	_container->setAnchorPoint(Vec2(0,0));
	_listView = static_cast<ListView*>(Helper::seekWidgetByName(_root, "ListView_content"));

	_goodPan = static_cast<Layout*>(Helper::seekWidgetByName(_root, "Panel_good"));
	_goodPan->retain();
	_goodPan->removeFromParent();

	_listView->addEventListener((ui::ListView::ccListViewCallback)CC_CALLBACK_2(ShopPanel::selectedItemEvent, this));
	_listView->addEventListener((ui::ListView::ccScrollViewCallback)CC_CALLBACK_2(ShopPanel::selectedItemEventScrollView,this));

	//_title = Label::create("","Arial",20);
	//_title->setColor(Color3B::BLACK);
	//_title->setPosition(0, _container->getSize().height / 2 - 30);
	//_container->addChild(_title);

	//_label = Label::create("","Arial",17);
	//_label->setColor(Color3B::BLACK);
	//_label->setLineBreakWithoutSpace(true);
	//_label->setAnchorPoint(Vec2(0,0));

	//_label->setDimensions(_scrollView->getSize().width,0);

	////_label->setPositionY(_scrollView->getSize().height / 2);
	////_label->setPositionX(_scrollView->getSize().width / 2);

	//_scrollView->addChild(_label);

	//auto clipper = ClippingNode::create();
	//clipper->setContentSize(_scrollView->getSize());
	////clipper->setPositionY(_scrollView->getSize().height / 2 + _scrollView->getPosition().y);
	////clipper->setAnchorPoint(Vec2(0.5, 0.5));
	//_container->addChild(clipper);

	//auto stencil = DrawNode::create();
	//Vec2 rectangle[4];
	//rectangle[0] = Vec2(-clipper->getContentSize().width / 2, -clipper->getContentSize().height / 2);
	//rectangle[1] = Vec2(-clipper->getContentSize().width / 2, clipper->getContentSize().height / 2);
	//rectangle[2] = Vec2(clipper->getContentSize().width / 2, clipper->getContentSize().height / 2);
	//rectangle[3] = Vec2(clipper->getContentSize().width / 2, -clipper->getContentSize().height / 2);

	//Color4F white(1, 1, 1, 1);
	//stencil->drawPolygon(rectangle, 4, white, 1, white);
	//clipper->setStencil(stencil);

	//_scrollView->retain();
	//_scrollView->removeFromParent();
	//clipper->addChild(_scrollView);
	//_scrollView->release();

	auto goodNum = cocos2d::Value(PlotScript::sharedHD()->getLuaVarString("script/Test.lua", "goodsNum")).asInt();

	for(int i = 1; i <= goodNum; i++)
	{
		auto goodName = "good" + cocos2d::Value(i).asString();
		auto content = PlotScript::sharedHD()->getLuaVarString("script/Test.lua", goodName.c_str());
		ValueMap valueMap;
		stringToValueMap(std::string(content), valueMap);
		int lock = valueMap["lock"].asInt();
		if(conditions[goodName+"_unlock"].intValue() == 1)
			lock = 0;
		if(lock == 0)
		{
			auto goodPan = _goodPan->clone();
			auto goodUnit = GoodUnit::create(i);

			ValueMap model;
			model["typeId"] = valueMap["typeId"];
			auto good = CellFactory::getInstance()->createCell(model);
			goodUnit->setGood(good);
			goodUnit->setPrice(valueMap["price"].asInt());
			goodUnit->setNum(valueMap["num"].asInt());
			goodUnit->setView(goodPan);
			_goodsUnit.pushBack(goodUnit);

			goodPan->setTag(i);
			_listView->pushBackCustomItem(goodPan);
		}
	}
	
	_container->setScale(0.85f);
	_container->setOpacity(200);
	_container->runAction(FadeIn::create(0.2));
	_container->runAction(ScaleTo::create(0.2,1.0f,1.0f,1.0f));

	_root->setTouchEnabled(true);
	_container->setTouchEnabled(false);
	_root->addTouchEventListener(CC_CALLBACK_2(ShopPanel::onButtonClicked, this));
	setKeyboardEnabled(true);
	return true;
}
예제 #20
0
/*********************************************************************
** Description: Default constructor
** sets name to "", price to 0.0 and quantity to 0.
*********************************************************************/
Item::Item()
{
	setName("");
	setPrice(0.0);
	setQuantity(0);
}
예제 #21
0
void Group8Strategy::processTrade(const Trade &t)
{
    if (m_magic.contains(t.instrument())) {
        MagicData &data = m_magic[t.instrument()];

        if (t.price() >= data.previousPrice) {
            if (data.isRising == false) {
                data.currentConsecutiveChanges = 0;
            }
            data.isRising = true;
        } else {
            if (data.isRising == true) {
                data.currentConsecutiveChanges = 0;
            }
            data.isRising = false;
        }

        data.previousPrice = t.price();
        data.previousVolume = t.volume();

        data.currentConsecutiveChanges++;


        if (5 <= data.currentConsecutiveChanges && t.time().secsTo(QTime(16,00)) >= 50) {
            data.currentConsecutiveChanges = 0;

                if (data.isRising) {
                        auto r = Record::Ptr::create();
                        r->setBidId(6666);
                        r->setAskId(0);
                        r->setBidOrAsk(Record::BidAsk::Bid);
                        r->setDate(t.date());
                        r->setTime(t.time());
                        r->setInstrument(t.instrument());
                        r->setType(Record::Type::ENTER);
                        r->setVolume(data.previousVolume);
                        r->setPrice(t.price());
                        r->setValue(r->price() * r->volume());
                        emit newRecordCreated(r);
                        qDebug() << "created a bid";

                        //this is bad
                        data.totalBought += data.previousVolume;
                } else {
                       auto r = Record::Ptr::create();
                        r->setAskId(6666);
                        r->setBidId(0);
                        r->setBidOrAsk(Record::BidAsk::Ask);
                        r->setDate(t.date());
                        r->setTime(t.time());
                        r->setInstrument(t.instrument());
                        r->setType(Record::Type::ENTER);
                        r->setVolume(data.totalBought-data.totalSold);
                        r->setPrice(t.price());
                        r->setValue(r->price() * r->volume());
                        emit newRecordCreated(r);

                        qDebug() << "created a ask";

                        //this is bad.
                        data.totalSold += data.totalBought-data.totalSold;

                }


        }
        //qDebug() << abs(QTime(15,40).secsTo(t.time()));
        //qDebug() <<(data.totalBought-data.totalSold);

        if( abs(QTime(16,00).secsTo(t.time())) < 50 && (data.totalBought-data.totalSold) > 0) {
            qDebug() << data.totalBought-data.totalSold;
            data.currentConsecutiveChanges = 0;
            auto r = Record::Ptr::create();
             r->setAskId(6666);
             r->setBidId(0);
             r->setBidOrAsk(Record::BidAsk::Ask);
             r->setDate(t.date());
             r->setTime(t.time());
             r->setInstrument(t.instrument());
             r->setType(Record::Type::ENTER);
             r->setVolume(data.totalBought-data.totalSold);
             r->setPrice(t.price());
             r->setValue(r->price() * r->volume());
             emit newRecordCreated(r);

             //this is bad.
             data.totalSold += data.totalBought-data.totalSold;
        }
    }
}
예제 #22
0
/*********************************************************************
** Description: Constructor with arguments. Calls appropriate setters.
*********************************************************************/
Item::Item(std::string name, double price, int quantity)
{
	setName(name);
	setPrice(price);
	setQuantity(quantity);
}