Пример #1
0
/// APLSubscriptFunction
void SubscriptFunction::applyOp
(
    Expr& target,
    APLValue* left,
    APLValue* right
)
{
    if (right->shape()->length() >= 2)
    {
        target = error("subscript requires vector second arg");
        return;
    }
    int rsize = right->size();
    int lsize = lastSize(left->shape());
    int extent = (left->size() / lsize)* rsize;

    APLValue* newval = new APLValue(replaceLast(left->shape(), rsize),
    extent);

    for (int i = 0; i < extent; i++)
    {
        newval->atPut
        (
            i,
            left->at((i / rsize)* lsize + (right->at(i % rsize) - 1))
        );
    }
    target = newval;
}
Пример #2
0
/**
  This function tests application's icon. It is called from TestAppInfoL function.
*/	
void CT_LocaleStep::TestAppIconL(TSize aSize)
	{
	CApaMaskedBitmap* icon = CApaMaskedBitmap::NewLC();
	TSize lastSize(0,0);

	TInt ret = iLs.GetAppIcon(KUidTestApp, aSize, *icon);
	TEST(ret == KErrNone);
	// Returned icon size should be exactly same as asked.
	TEST(icon->SizeInPixels().iWidth * icon->SizeInPixels().iHeight == aSize.iWidth * aSize.iHeight);
	
	CleanupStack::PopAndDestroy(icon);
	}
	void ElementList::_StackElements(){
		glm::vec2 lastSize(0);
		_v3LastPosition = glm::vec3(0);
		for (std::vector<UIElement*>::iterator it = OrderedElements.begin(); it != OrderedElements.end(); it++){
			if (_bUpDown == true){
				_v3LastPosition = glm::vec3(0,_v3LastPosition.y + lastSize.y,0);
			}else{
				_v3LastPosition = glm::vec3(0,_v3LastPosition.y - lastSize.y,0);
			}
			(*it)->setTranslate(_v3LastPosition);
			lastSize = (*it)->getSize();
		}
	}
Пример #4
0
void CompressionFunction::applyOp(Expr& target, APLValue* left,
APLValue* right)
{
    if (left->shape()->length() >= 2)
    {
        target = error("compression requires vector left arg");
        return;
    }
    int lsize = left->size();   // works for both scalar and vec
    int rsize = lastSize(right->shape());
    if (lsize != rsize)
    {
        target = error("compression conformability error");
        return;
    }
    // compute the number of non-zero values
    int i, nsize;
    nsize = 0;
    for (i = 0; i < lsize; i++)
    {
        if (left->at(i))
        {
            nsize++;
        }
    }

    // now compute the new size
    int rextent = right->size();
    int extent = (rextent / lsize)* nsize;

    APLValue* newval =
        new APLValue(replaceLast(right->shape(), nsize), extent);

    // now fill in the values
    int index = 0;
    for (i = 0; i <= rextent; i++)
    {
        if (left->at(i % lsize))
        {
            newval->atPut(index++, right->at(i));
        }
    }
    target = newval;
}
Пример #5
0
void APLReduction::applyOp(Expr& target, APLValue* arg)
{
    // compute the size of the new expression
    int rowextent = lastSize(arg->shape());
    int extent = arg->size() / rowextent;
    APLValue* newval = new APLValue(removeLast(arg->shape()), extent);

    while (--extent >= 0)
    {
        int start = (extent + 1)* rowextent - 1;
        int newint = arg->at(start);
        for (int i = rowextent - 2; i >= 0; i--)
        {
            newint = fun(arg->at(--start), newint);
        }
        newval->atPut(extent, newint);
    }

    target = newval;
}