text:
package it.sephiroth.android.library.tooltip;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.util.Log;

import static it.sephiroth.android.library.tooltip.TooltipManager.DBG;

class TooltipTextDrawable extends Drawable {
	static final String TAG = "ToolTipTextDrawable";

	private final RectF rectF;
	private final Path path;
	private Point point;

	private final Paint bgPaint;
	private final Paint stPaint;

	private final float arrowRatio;
	private final float ellipseSize;
	private final int strokeWidth;
	private final int strokeColor;
	private final int backgroundColor;

	private int padding = 0;
	private int arrowWeight = 0;

	private TooltipManager.Gravity gravity;

	public TooltipTextDrawable(final Context context, final TooltipManager.Builder builder) {

		TypedArray theme =
			context.getTheme().obtainStyledAttributes(null, R.styleable.TooltipLayout, builder.defStyleAttr, builder.defStyleRes);
		this.ellipseSize = theme.getDimensionPixelSize(R.styleable.TooltipLayout_ttlm_cornerRadius, 4);
		this.strokeWidth = theme.getDimensionPixelSize(R.styleable.TooltipLayout_ttlm_strokeWeight, 30);
		this.backgroundColor = theme.getColor(R.styleable.TooltipLayout_ttlm_backgroundColor, 0);
		this.strokeColor = theme.getColor(R.styleable.TooltipLayout_ttlm_strokeColor, 0);
		this.arrowRatio = theme.getFloat(R.styleable.TooltipLayout_ttlm_arrowRatio, 1.4f);
		theme.recycle();

		this.rectF = new RectF();

		if (backgroundColor != 0) {
			bgPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
			bgPaint.setColor(this.backgroundColor);
			bgPaint.setStyle(Paint.Style.FILL);
		}
		else {
			bgPaint = null;
		}

		if (strokeColor != 0) {
			stPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
			stPaint.setColor(strokeColor);
			stPaint.setStyle(Paint.Style.STROKE);
			stPaint.setStrokeWidth(strokeWidth);
		}
		else {
			stPaint = null;
		}

		path = new Path();
	}

	private void calculatePath(Rect outBounds) {
		if (DBG) Log.i(TAG, "calculateBounds, padding: " + padding + ", gravity: " + gravity);

		int left = outBounds.left + padding;
		int top = outBounds.top + padding;
		int right = outBounds.right - padding;
		int bottom = outBounds.bottom - padding;

		final float max_y = bottom - ellipseSize;
		final float max_x = right - ellipseSize;
		final float min_y = top + ellipseSize;
		final float min_x = left + ellipseSize;

		if (DBG) {
			Log.v(TAG, "left: " + left);
			Log.v(TAG, "top: " + top);
			Log.v(TAG, "right: " + right);
			Log.v(TAG, "bottom: " + bottom);
			Log.v(TAG, "min_y: " + min_y);
			Log.v(TAG, "max_y: " + max_y);
			Log.v(TAG, "arrowWeight: " + arrowWeight);
			Log.v(TAG, "point: " + point);
		}

		boolean drawPoint = false;

		if (null != point && null != gravity) {

			if (gravity == TooltipManager.Gravity.RIGHT || gravity == TooltipManager.Gravity.LEFT) {
				if (point.y >= top && point.y <= bottom) {
					if (top + point.y + arrowWeight > max_y) {
						point.y = (int) (max_y - arrowWeight - top);
					}
					else if (top + point.y - arrowWeight < min_y) {
						point.y = (int) (min_y + arrowWeight - top);
					}
					drawPoint = true;
				}
			}
			else {
				if (point.x >= left && point.x <= right) {
					if (point.x >= left && point.x <= right) {
						if (left + point.x + arrowWeight > max_x) {
							point.x = (int) (max_x - arrowWeight - left);
						}
						else if (left + point.x - arrowWeight < min_x) {
							point.x = (int) (min_x + arrowWeight - left);
						}
						drawPoint = true;
					}
				}
			}

			if (DBG) Log.w(TAG, "point: " + point);

			path.reset();

			// clamp the point..
			if (point.y < top) point.y = (int) (top);
			else if (point.y > bottom) point.y = (int) (bottom);
			if (point.x < left) point.x = (int) (left);
			if (point.x > right) point.x = (int) (right);

			// top/left
			path.moveTo(left + ellipseSize, top);

			if (drawPoint && gravity == TooltipManager.Gravity.BOTTOM) {
				path.lineTo(left + point.x - arrowWeight, top);
				path.lineTo(left + point.x, outBounds.top);
				path.lineTo(left + point.x + arrowWeight, top);
			}

			// top/right
			path.lineTo(right - ellipseSize, top);
			path.quadTo(right, top, right, top + ellipseSize);

			if (drawPoint && gravity == TooltipManager.Gravity.LEFT) {
				path.lineTo(right, top + point.y - arrowWeight);
				path.lineTo(outBounds.right, top + point.y);
				path.lineTo(right, top + point.y + arrowWeight);
			}

			// bottom/right
			path.lineTo(right, bottom - ellipseSize);
			path.quadTo(right, bottom, right - ellipseSize, bottom);

			if (drawPoint && gravity == TooltipManager.Gravity.TOP) {
				path.lineTo(left + point.x + arrowWeight, bottom);
				path.lineTo(left + point.x, outBounds.bottom);
				path.lineTo(left + point.x - arrowWeight, bottom);
			}

			// bottom/left
			path.lineTo(left + ellipseSize, bottom);
			path.quadTo(left, bottom, left, bottom - ellipseSize);

			if (drawPoint && gravity == TooltipManager.Gravity.RIGHT) {
				path.lineTo(left, top + point.y + arrowWeight);
				path.lineTo(outBounds.left, top + point.y);
				path.lineTo(left, top + point.y - arrowWeight);
			}

			// top/left
			path.lineTo(left, top + ellipseSize);
			path.quadTo(left, top, left + ellipseSize, top);
		}
		else {
			rectF.set(left, top, right, bottom);
			path.addRoundRect(rectF, ellipseSize, ellipseSize, Path.Direction.CW);
		}
	}

	@Override
	public void draw(final Canvas canvas) {

		if (null != bgPaint) {
			canvas.drawPath(path, bgPaint);
		}

		if (null != stPaint) {
			canvas.drawPath(path, stPaint);
		}
	}

	@Override
	protected void onBoundsChange(final Rect bounds) {
		if (DBG) Log.i(TAG, "onBoundsChange");
		super.onBoundsChange(bounds);
		calculatePath(bounds);
	}

	@Override
	public void setAlpha(final int alpha) {
	}

	@Override
	public void setColorFilter(final ColorFilter cf) {
	}

	@Override
	public int getOpacity() {
		return 0;
	}

	public void setDestinationPoint(final Point point) {
		this.point = new Point(point);
	}

	public void setAnchor(final TooltipManager.Gravity gravity, int padding) {
		this.gravity = gravity;
		this.padding = padding;
		this.arrowWeight = (int) ((float) padding / arrowRatio);
	}
}


text:
layout: post
cover: false
title: Implementing your own meta reducer like reset
date:   2017-02-15
subclass: 'post'
categories: 'casper'
published: false
disqus: true
---

## Implementing your a meta reducer like reset

A few weeks ago, I was asked if it was possible to implement some logic to clear the store, or at least reset is, when a user logged out. If you know what a meta reducer is, this is really easy to implement. I'll show you in the next paragraphs, what a meta reducer is and how we can implement one ourselves. We will create one to reset the store back to it's iniital state as soon as a user logs out.

#### What is a meta reducer?

When u are using Redux or @ngrx/store, you have to implement reducers to teach your store how to update the state. At init time, you have to pass a single reducer to the store, this one is called your root reducer. Of course, you don't put all your logic in a single reducer.

For this, Redux provides you with a utility method called 'combineReducers'. What this method does for you is turn this:

```typescript
econst usersReducer = () => {....};
const tweetsReducer = () => {....};

const rootReducer = combineReducers({
    users: usersReducer,
    tweets: tweetsReducer
});
```

into the following reducer tree:

redpajama_set_name: RedPajamaGithub


text:
package org.apache.sysds.test.functions.compress.instructionsSpark;

public class CompressedSparkInstructionsTestDense extends CompressedSparkInstructionsTest {

	@Override
	public double getDensity() {
		return 1.0;
	}
}


text:
LOG_SETUP("attribute_node_test");

using search::AttributeContext;
using search::AttributeFactory;
using search::AttributeManager;
using search::AttributeVector;
using search::IntegerAttribute;
using search::FloatingPointAttribute;
using search::StringAttribute;
using search::SingleBoolAttribute;
using search::attribute::BasicType;
using search::attribute::CollectionType;
using search::attribute::Config;
using search::attribute::IAttributeVector;
using search::attribute::getUndefined;
using search::expression::AttributeNode;
using search::expression::EnumResultNode;
using search::expression::EnumResultNodeVector;
using search::expression::FloatResultNode;
using search::expression::FloatResultNodeVector;
using search::expression::Int8ResultNode;
using search::expression::BoolResultNode;
using search::expression::Int8ResultNodeVector;
using search::expression::IntegerResultNodeVector;
using search::expression::IntegerResultNode;
using search::expression::ResultNode;
using search::expression::ResultNodeVector;
using search::expression::StringResultNode;
using search::expression::StringResultNodeVector;
using search::expression::test::makeAttributeMapLookupNode;
using vespalib::BufferRef;

namespace {

vespalib::string stringValue(const ResultNode &result, const IAttributeVector &attr) {
    if (result.inherits(EnumResultNode::classId)) {
        auto enumHandle = result.getEnum();
        auto &stringAttr = dynamic_cast<const StringAttribute &>(attr);
        return vespalib::string(stringAttr.getFromEnum(enumHandle));
    }
    char buf[100];
    BufferRef bref(&buf[0], sizeof(buf));
    auto sbuf = result.getString(bref);
    return vespalib::string(sbuf.c_str(), sbuf.c_str() + sbuf.size());
}

struct AttributeManagerFixture
{
    AttributeManager mgr;

    AttributeManagerFixture();
    ~AttributeManagerFixture();
    template <typename AttributeType, typename ValueType>
    void buildAttribute(const vespalib::string &name, BasicType type, std::vector<ValueType> values);
    void buildStringAttribute(const vespalib::string &name, std::vector<vespalib::string> values);
    void buildBoolAttribute(const vespalib::string &name, std::vector<bool> values);
    void buildFloatAttribute(const vespalib::string &name, std::vector<double> values);
    void buildIntegerAttribute(const vespalib::string &name, BasicType type, std::vector<IAttributeVector::largeint_t> values);
    template <typename AttributeType, typename ValueType>
    void buildArrayAttribute(const vespalib::string &name, BasicType type, std::vector<std::vector<ValueType>> values);
    void buildStringArrayAttribute(const vespalib::string &name,std::vector<std::vector<vespalib::string>> values);
    void buildFloatArrayAttribute(const vespalib::string &name, std::vector<std::vector<double>> values);
    void buildIntegerArrayAttribute(const vespalib::string &name, BasicType type, std::vector<std::vector<IAttributeVector::largeint_t>> values);
};

AttributeManagerFixture::AttributeManagerFixture()
    : mgr()
{
    buildStringAttribute("sfield", { "n1", ""});
    buildBoolAttribute("bfield", { true, false,false,true,true,false });
    buildIntegerAttribute("ifield", BasicType::INT8, { 10, getUndefined<int8_t>() });
    buildFloatAttribute("ffield", { 110.0, getUndefined<double>() });
    buildStringArrayAttribute("array.name", {{"n1.1", "n1.2"}, {"n2"}, {}});
    buildIntegerArrayAttribute("array.val", BasicType::INT8, {{ 10, 11}, {20, 21 }, {}});
    buildFloatArrayAttribute("array.fval", {{ 110.0}, { 120.0, 121.0 }, {}});
    buildStringArrayAttribute("smap.key", {{"k1.1", "k1.2"}, {"k2"}, {}});
    buildStringArrayAttribute("smap.value.name", {{"n1.1", "n1.2"}, {"n2"}, {}});
    buildIntegerArrayAttribute("smap.value.val", BasicType::INT8, {{ 10, 11}, {20, 21 }, {}});
    buildFloatArrayAttribute("smap.value.fval", {{ 110.0}, { 120.0, 121.0 }, {}});
    buildStringArrayAttribute("map.key", {{"k1.1", "k1.2"}, {"k2"}, {}});
    buildStringArrayAttribute("map.value", {{"n1.1", "n1.2"}, {"n2"}, {}});
    buildStringAttribute("keyfield1", {"k1.2", "k2", "k3"});
    buildStringAttribute("keyfield2", {"k1.1", "k1", "k1"});
}

AttributeManagerFixture::~AttributeManagerFixture() = default;

template <typename AttributeType, typename ValueType>
void
AttributeManagerFixture::buildAttribute(const vespalib::string &name, BasicType type,
                                        std::vector<ValueType> values)
{
    Config cfg(type, CollectionType::Type::SINGLE);
    auto attrBase = AttributeFactory::createAttribute(name, cfg);
    EXPECT_TRUE(attrBase);
    auto attr = std::dynamic_pointer_cast<AttributeType>(attrBase);
    EXPECT_TRUE(attr);
    attr->addReservedDoc();
    for (const std::conditional_t<std::is_same_v<bool, ValueType>, bool, ValueType&> value : values) {
        uint32_t docId = 0;
        EXPECT_TRUE(attr->addDoc(docId));
        EXPECT_NOT_EQUAL(0u, docId);
        attr->update(docId, value);
        attr->commit();
    }
    EXPECT_TRUE(mgr.add(attr));
}

void
AttributeManagerFixture::buildStringAttribute(const vespalib::string &name,
                                              std::vector<vespalib::string> values)
{
    buildAttribute<StringAttribute, vespalib::string>(name, BasicType::Type::STRING, std::move(values));
}

void
AttributeManagerFixture::buildFloatAttribute(const vespalib::string &name,
                                             std::vector<double> values)
{
    buildAttribute<FloatingPointAttribute, double>(name, BasicType::Type::DOUBLE, std::move(values));
}

void
AttributeManagerFixture::buildIntegerAttribute(const vespalib::string &name, BasicType type,
                                               std::vector<IAttributeVector::largeint_t> values)
{
    buildAttribute<IntegerAttribute, IAttributeVector::largeint_t>(name, type, std::move(values));
}

void
AttributeManagerFixture::buildBoolAttribute(const vespalib::string &name,
                                            std::vector<bool> values)
{
    buildAttribute<SingleBoolAttribute>(name, BasicType::BOOL, std::move(values));
}

template <typename AttributeType, typename ValueType>
void
AttributeManagerFixture::buildArrayAttribute(const vespalib::string &name, BasicType type,
                                             std::vector<std::vector<ValueType>> values)
{
    Config cfg(type, CollectionType::Type::ARRAY);
    auto attrBase = AttributeFactory::createAttribute(name, cfg);
    EXPECT_TRUE(attrBase);
    auto attr = std::dynamic_pointer_cast<AttributeType>(attrBase);
    EXPECT_TRUE(attr);
    attr->addReservedDoc();
    for (const auto &docValues : values) {
        uint32_t docId = 0;
        EXPECT_TRUE(attr->addDoc(docId));
        EXPECT_NOT_EQUAL(0u, docId);
        for (const auto &value : docValues) {
            attr->append(docId, value, 1);
        }
        attr->commit();
    }
    EXPECT_TRUE(mgr.add(attr));
}

void
AttributeManagerFixture::buildStringArrayAttribute(const vespalib::string &name,
                                              std::vector<std::vector<vespalib::string>> values)
{
    buildArrayAttribute<StringAttribute, vespalib::string>(name, BasicType::Type::STRING, std::move(values));
}

void
AttributeManagerFixture::buildFloatArrayAttribute(const vespalib::string &name,
                                             std::vector<std::vector<double>> values)
{
    buildArrayAttribute<FloatingPointAttribute, double>(name, BasicType::Type::DOUBLE, std::move(values));
}

void
AttributeManagerFixture::buildIntegerArrayAttribute(const vespalib::string &name,
                                                    BasicType type,
                                                    std::vector<std::vector<IAttributeVector::largeint_t>> values)
{
    buildArrayAttribute<IntegerAttribute, IAttributeVector::largeint_t>(name, type, std::move(values));
}

struct Fixture
{
    AttributeManagerFixture             attrs;
    AttributeContext                    context;
    Fixture();
    ~Fixture();
    std::unique_ptr<AttributeNode> makeNode(const vespalib::string &attributeName, bool useEnumOptimiation = false, bool preserveAccurateTypes = false);
    void assertInts(std::vector<IAttributeVector::largeint_t> expVals, const vespalib::string &attributteName, bool preserveAccurateTypes = false);
    void assertBools(std::vector<bool> expVals, const vespalib::string &attributteName, bool preserveAccurateTypes = false);
    void assertStrings(std::vector<vespalib::string> expVals, const vespalib::string &attributteName, bool useEnumOptimization = false);
    void assertFloats(std::vector<double> expVals, const vespalib::string &attributteName);
    void assertIntArrays(std::vector<std::vector<IAttributeVector::largeint_t>> expVals, const vespalib::string &attributteName, bool preserveAccurateTypes = false);
    void assertStringArrays(std::vector<std::vector<vespalib::string>> expVals, const vespalib::string &attributteName, bool useEnumOptimization = false);
    void assertFloatArrays(std::vector<std::vector<double>> expVals, const vespalib::string &attributteName);
};

Fixture::Fixture()
    : attrs(),
      context(attrs.mgr)
{
}

Fixture::~Fixture() = default;

std::unique_ptr<AttributeNode>
Fixture::makeNode(const vespalib::string &attributeName, bool useEnumOptimization, bool preserveAccurateTypes)
{
    std::unique_ptr<AttributeNode> node;
    if (attributeName.find('{') == vespalib::string::npos) {
        node = std::make_unique<AttributeNode>(attributeName);
    } else {
        node = makeAttributeMapLookupNode(attributeName);
    }
    if (useEnumOptimization) {
        node->useEnumOptimization();
    }
    AttributeNode::Configure configure(context);
    node->select(configure, configure);
    node->prepare(preserveAccurateTypes);
    return node;
}

void
Fixture::assertInts(std::vector<IAttributeVector::largeint_t> expVals, const vespalib::string &attributeName, bool preserveAccurateTypes)
{
    auto node = makeNode(attributeName, false, preserveAccurateTypes);
    uint32_t docId = 0;
    for (const auto &expDocVal : expVals) {
        ++docId;
        node->setDocId(docId);
        node->execute();
        const auto &result = *node->getResult();
        if (preserveAccurateTypes) {
            ASSERT_TRUE(result.inherits(Int8ResultNode::classId));
        } else {
            ASSERT_TRUE(result.inherits(IntegerResultNode::classId));
        }
        IAttributeVector::largeint_t docVal = result.getInteger();
        EXPECT_EQUAL(expDocVal, docVal);
    }
}

void
Fixture::assertBools(std::vector<bool> expVals, const vespalib::string &attributeName, bool preserveAccurateTypes)
{
    auto node = makeNode(attributeName, false, preserveAccurateTypes);
    uint32_t docId = 0;
    for (const auto expDocVal : expVals) {
        ++docId;
        node->setDocId(docId);
        node->execute();
        const auto &result = *node->getResult();

        ASSERT_TRUE(result.inherits(BoolResultNode::classId));
        const BoolResultNode & bResult = static_cast<const BoolResultNode &>(result);

        EXPECT_EQUAL(expDocVal, bResult.getBool());
    }
}

void
Fixture::assertStrings(std::vector<vespalib::string> expVals, const vespalib::string &attributeName, bool useEnumOptimization)
{
    auto node = makeNode(attributeName, useEnumOptimization);
    uint32_t docId = 0;
    for (const auto &expDocVal : expVals) {
        ++docId;
        node->setDocId(docId);
        node->execute();
        const auto &result = *node->getResult();
        if (useEnumOptimization) {
            ASSERT_TRUE(result.inherits(EnumResultNode::classId));
        } else {
            ASSERT_TRUE(result.inherits(StringResultNode::classId));
        }
        vespalib::string docVal = stringValue(result, *node->getAttribute());
        EXPECT_EQUAL(expDocVal, docVal);
    }
}

void
Fixture::assertFloats(std::vector<double> expVals, const vespalib::string &attributeName)
{
    auto node = makeNode(attributeName);
    uint32_t docId = 0;
    for (const auto &expDocVal : expVals) {
        ++docId;
        node->setDocId(docId);
        node->execute();
        const auto &result = *node->getResult();
        ASSERT_TRUE(result.inherits(FloatResultNode::classId));
        double docVal = result.getFloat();
        EXPECT_EQUAL(std::isnan(expDocVal), std::isnan(docVal));
        if (!std::isnan(expDocVal)) {
            EXPECT_EQUAL(expDocVal, docVal);
        }
    }
}

void
Fixture::assertIntArrays(std::vector<std::vector<IAttributeVector::largeint_t>> expVals, const vespalib::string &attributeName, bool preserveAccurateTypes)
{
    auto node = makeNode(attributeName, false, preserveAccurateTypes);
    uint32_t docId = 0;
    for (const auto &expDocVals : expVals) {
        ++docId;
        node->setDocId(docId);
        node->execute();
        const auto &result = *node->getResult();
        ASSERT_TRUE(result.inherits(ResultNodeVector::classId));
        const auto &resultVector = static_cast<const ResultNodeVector &>(result);
        if (preserveAccurateTypes) {
            ASSERT_TRUE(result.inherits(Int8ResultNodeVector::classId));
        } else {
            ASSERT_TRUE(result.inherits(IntegerResultNodeVector::classId));
        }
        std::vector<IAttributeVector::largeint_t> docVals;
        for (size_t i = 0; i < resultVector.size(); ++i) {
            docVals.push_back(resultVector.get(i).getInteger());
        }
        EXPECT_EQUAL(expDocVals, docVals);
    }
}

void
Fixture::assertStringArrays(std::vector<std::vector<vespalib::string>> expVals, const vespalib::string &attributeName, bool useEnumOptimization)
{
    auto node = makeNode(attributeName, useEnumOptimization);
    uint32_t docId = 0;
    for (const auto &expDocVals : expVals) {
        ++docId;
        node->setDocId(docId);
        node->execute();
        const auto &result = *node->getResult();
        ASSERT_TRUE(result.inherits(ResultNodeVector::classId));
        const auto &resultVector = static_cast<const ResultNodeVector &>(result);
        if (useEnumOptimization) {
            ASSERT_TRUE(result.inherits(EnumResultNodeVector::classId));
        } else {
            ASSERT_TRUE(result.inherits(StringResultNodeVector::classId));
        }
        std::vector<vespalib::string> docVals;
        for (size_t i = 0; i < resultVector.size(); ++i) {
            docVals.push_back(stringValue(resultVector.get(i), *node->getAttribute()));
        }
        EXPECT_EQUAL(expDocVals, docVals);
    }
}

void
Fixture::assertFloatArrays(std::vector<std::vector<double>> expVals, const vespalib::string &attributeName)
{
    auto node = makeNode(attributeName);
    uint32_t docId = 0;
    for (const auto &expDocVals : expVals) {
        ++docId;
        node->setDocId(docId);
        node->execute();
        const auto &result = *node->getResult();
        ASSERT_TRUE(result.inherits(ResultNodeVector::classId));
        const auto &resultVector = static_cast<const ResultNodeVector &>(result);
        ASSERT_TRUE(result.inherits(FloatResultNodeVector::classId));
        std::vector<double> docVals;
        for (size_t i = 0; i < resultVector.size(); ++i) {
            docVals.push_back(resultVector.get(i).getFloat());
        }
        EXPECT_EQUAL(expDocVals.size(), docVals.size());
        for (size_t i = 0; i < expDocVals.size(); ++i) {
            EXPECT_EQUAL(std::isnan(expDocVals[i]), std::isnan(docVals[i]));
            if (!std::isnan(expDocVals[i])) {
                EXPECT_EQUAL(expDocVals[i], docVals[i]);
            }
        }
    }
}

TEST_F("test single values", Fixture)
{
    TEST_DO(f.assertBools({ true, false,false,true,true,false }, "bfield"));
    TEST_DO(f.assertBools({ true, false,false,true,true,false }, "bfield", true));
    TEST_DO(f.assertInts({ 10, getUndefined<int8_t>()}, "ifield"));
    TEST_DO(f.assertInts({ 10, getUndefined<int8_t>()}, "ifield", true));
    TEST_DO(f.assertStrings({ "n1", "" }, "sfield"));
    TEST_DO(f.assertStrings({ "n1", "" }, "sfield", true));
    TEST_DO(f.assertFloats({ 110.0, getUndefined<double>() }, "ffield"));
}

TEST_F("Test array values", Fixture)
{
    TEST_DO(f.assertIntArrays({{ 10, 11}, {20, 21 }, {}}, "array.val"));
    TEST_DO(f.assertIntArrays({{ 10, 11}, {20, 21 }, {}}, "array.val", true));
    TEST_DO(f.assertStringArrays({{"n1.1", "n1.2"}, {"n2"}, {}}, "array.name"));
    TEST_DO(f.assertStringArrays({{"n1.1", "n1.2"}, {"n2"}, {}}, "array.name", true));
    TEST_DO(f.assertFloatArrays({{ 110.0}, { 120.0, 121.0 }, {}}, "array.fval"));
    TEST_DO(f.assertStringArrays({{"k1.1", "k1.2"}, {"k2"}, {}}, "smap.key"));
    TEST_DO(f.assertStringArrays({{"n1.1", "n1.2"}, {"n2"}, {}}, "smap.value.name"));
    TEST_DO(f.assertIntArrays({{ 10, 11}, {20, 21 }, {}}, "smap.value.val"));
    TEST_DO(f.assertFloatArrays({{ 110.0}, { 120.0, 121.0 }, {}}, "smap.value.fval"));
    TEST_DO(f.assertStringArrays({{"k1.1", "k1.2"}, {"k2"}, {}}, "map.key"));
    TEST_DO(f.assertStringArrays({{"n1.1", "n1.2"}, {"n2"}, {}}, "map.value"));
}

TEST_F("test keyed values", Fixture)
{
    TEST_DO(f.assertStrings({"n1.1", "", ""}, "smap{\"k1.1\"}.name"));
    TEST_DO(f.assertStrings({"n1.2", "", ""}, "smap{\"k1.2\"}.name"));
    TEST_DO(f.assertStrings({"", "n2", ""}, "smap{\"k2\"}.name"));
    TEST_DO(f.assertStrings({"", "", ""}, "smap{\"k5\"}.name"));
    TEST_DO(f.assertFloats({ 110.0, getUndefined<double>(), getUndefined<double>()}, "smap{\"k1.1\"}.fval"));
    TEST_DO(f.assertFloats({ getUndefined<double>(), getUndefined<double>(), getUndefined<double>()}, "smap{\"k1.2\"}.fval"));
    TEST_DO(f.assertFloats({ getUndefined<double>(), 120.0, getUndefined<double>()}, "smap{\"k2\"}.fval"));
    TEST_DO(f.assertFloats({ getUndefined<double>(), getUndefined<double>(), getUndefined<double>()}, "smap{\"k5\"}.fval"));
    TEST_DO(f.assertInts({ 10, getUndefined<int8_t>(), getUndefined<int8_t>()}, "smap{\"k1.1\"}.val"));
    TEST_DO(f.assertInts({ 11, getUndefined<int8_t>(), getUndefined<int8_t>()}, "smap{\"k1.2\"}.val"));
    TEST_DO(f.assertInts({ getUndefined<int8_t>(), 20, getUndefined<int8_t>()}, "smap{\"k2\"}.val"));
    TEST_DO(f.assertInts({ getUndefined<int8_t>(), getUndefined<int8_t>(), getUndefined<int8_t>()}, "smap{\"k5\"}.val"));
    TEST_DO(f.assertStrings({"n1.1", "", ""}, "map{\"k1.1\"}"));
    TEST_DO(f.assertStrings({"n1.2", "", ""}, "map{\"k1.2\"}"));
    TEST_DO(f.assertStrings({"", "n2", ""}, "map{\"k2\"}"));
    TEST_DO(f.assertStrings({"", "", ""}, "map{\"k5\"}"));
}

TEST_F("test indirectly keyed values", Fixture)
{
    TEST_DO(f.assertStrings({"n1.2", "n2", ""}, "map{attribute(keyfield1)}"));
    TEST_DO(f.assertStrings({"n1.1", "", ""}, "map{attribute(keyfield2)}"));
    TEST_DO(f.assertStrings({"n1.2", "n2", ""}, "smap{attribute(keyfield1)}.name"));
    TEST_DO(f.assertStrings({"n1.1", "", ""}, "smap{attribute(keyfield2)}.name"));
    TEST_DO(f.assertFloats({ getUndefined<double>(), 120.0, getUndefined<double>()}, "smap{attribute(keyfield1)}.fval"));
    TEST_DO(f.assertFloats({ 110.0, getUndefined<double>(), getUndefined<double>()}, "smap{attribute(keyfield2)}.fval"));
    TEST_DO(f.assertInts({ 11, 20, getUndefined<int8_t>()}, "smap{attribute(keyfield1)}.val"));
    TEST_DO(f.assertInts({ 10, getUndefined<int8_t>(), getUndefined<int8_t>()}, "smap{attribute(keyfield2)}.val"));
}

}

TEST_MAIN() { TEST_RUN_ALL(); }


text:
package com.tjazi.security.service;

import java.util.UUID;

/**
 * Created by kwasiak on 01/08/15.
 */
public interface SecurityUserProfileService {

    boolean areCredentialsValid(UUID profileUuid, String password);
    void registerNewSecurityUserProfile(UUID profileUuid, String password);
}


text:
//
//  Product.m
//  QuoteApp
//
//  Created by Pavel Vilbik on 14.2.14.

#import "Product.h"

@implementation Product

- (NSDictionary *)hostToKinveyPropertyMapping
{
    //Kinvey: Mapping Function
    //      client property : backend column
    //      ----------------:---------------------------------------
    return @{@"entityId"	: KCSEntityKeyId,       //kinveyId maps to _id
			 @"meta"        : KCSEntityKeyMetadata, //meta maps to metadata
			 @"title"       : @"title",             //title maps to title
			 @"descriptions": @"description",       //description maps to description
			 @"thumbnailID" : @"thumbnailID",       //thumbnailID maps to thumbnailID
			 @"imageID"     : @"imageID"};          //imageID maps to imageID
}

+ (NSArray *)textFieldsName{
    return @[@"title"];
}

@end


text:
package gov.nasa.jpl.mbee.mdk.docgen.view;

import gov.nasa.jpl.mbee.mdk.docgen.view.impl.DocGenViewFactoryImpl;
import org.eclipse.emf.ecore.EFactory;

/**
 *  The Factory for the model. It provides a
 * create method for each non-abstract class of the model.
 *
 * @generated
 * @see DocGenViewPackage
 */
public interface DocGenViewFactory extends EFactory {
    /**
     * The singleton instance of the factory.
     *
     * @generated
     */
    DocGenViewFactory eINSTANCE = DocGenViewFactoryImpl.init();

    /**
     * Returns a new object of class 'Col Spec'.
     *
     * @return a new object of class 'Col Spec'.
     * @generated
     */
    ColSpec createColSpec();

    /**
     * Returns a new object of class 'Image'.
     *
     *
     * @return a new object of class 'Image'.
     * @generated
     */
    Image createImage();

    /**
     * Returns a new object of class 'List'.
     *
     *
     * @return a new object of class 'List'.
     * @generated
     */
    List createList();

    /**
     * Returns a new object of class 'List Item'.
     *
     * @return a new object of class 'List Item'.
     * @generated
     */
    ListItem createListItem();

    /**
     * Returns a new object of class 'Paragraph'.
     *
     * @return a new object of class 'Paragraph'.
     * @generated
     */
    Paragraph createParagraph();

    /**
     * Returns a new object of class 'Table'.
     *
     *
     * @return a new object of class 'Table'.
     * @generated
     */
    Table createTable();

    /**
     * Returns a new object of class 'Table Entry'.
     *
     * @return a new object of class 'Table Entry'.
     * @generated
     */
    TableEntry createTableEntry();

    /**
     * Returns a new object of class 'Text'.
     *
     *
     * @return a new object of class 'Text'.
     * @generated
     */
    Text createText();

    /**
     * Returns a new object of class 'Table Row'.
     *
     * @return a new object of class 'Table Row'.
     * @generated
     */
    TableRow createTableRow();

    /**
     * Returns a new object of class 'MD Editable Table'.
     *
     * @return a new object of class 'MD Editable Table'.
     * @generated
     */
    MDEditableTable createMDEditableTable();

    /**
     * Returns the package supported by this factory.
     *
     *
     * @return the package supported by this factory.
     * @generated
     */
    DocGenViewPackage getDgviewPackage();

} // DocGenViewFactory


text:
using System.Windows.Forms;
using OpenLiveWriter.Controls;
using OpenLiveWriter.PostEditor.PostPropertyEditing.CategoryControl;

namespace OpenLiveWriter.PostEditor.PostPropertyEditing
{
    partial class PostPropertiesForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
            this.panel1 = new System.Windows.Forms.Panel();
            this.labelPageOrder = new System.Windows.Forms.Label();
            this.textPageOrder = new OpenLiveWriter.Controls.NumericTextBox();
            this.labelPageParent = new System.Windows.Forms.Label();
            this.comboPageParent = new OpenLiveWriter.PostEditor.PostPropertyEditing.PageParentComboBox();
            this.labelCategories = new System.Windows.Forms.Label();
            this.categoryDropDown = new OpenLiveWriter.PostEditor.PostPropertyEditing.CategoryControl.CategoryDropDownControlM1();
            this.labelTags = new System.Windows.Forms.Label();
            this.textTags = new OpenLiveWriter.Controls.AutoCompleteTextbox();
            this.labelPublishDate = new System.Windows.Forms.Label();
            this.datePublishDate = new OpenLiveWriter.PostEditor.PostPropertyEditing.PublishDateTimePicker();
            this.labelComments = new System.Windows.Forms.Label();
            this.comboComments = new System.Windows.Forms.ComboBox();
            this.labelPings = new System.Windows.Forms.Label();
            this.comboPings = new System.Windows.Forms.ComboBox();
            this.labelAuthor = new System.Windows.Forms.Label();
            this.labelSlug = new System.Windows.Forms.Label();
            this.textSlug = new System.Windows.Forms.TextBox();
            this.labelPassword = new System.Windows.Forms.Label();
            this.textPassword = new System.Windows.Forms.TextBox();
            this.labelExcerpt = new System.Windows.Forms.Label();
            this.textExcerpt = new System.Windows.Forms.TextBox();
            this.labelTrackbacks = new System.Windows.Forms.Label();
            this.textTrackbacks = new System.Windows.Forms.TextBox();
            this.buttonClose = new System.Windows.Forms.Button();
            this.panelComboAuthorIsolate = new System.Windows.Forms.Panel();
            this.comboAuthor = new OpenLiveWriter.Controls.DelayedFetchComboBox(this.components);
            this.flowLayoutPanel.SuspendLayout();
            this.panelComboAuthorIsolate.SuspendLayout();
            this.SuspendLayout();
            //
            // flowLayoutPanel
            //
            this.flowLayoutPanel.AutoScroll = true;
            this.flowLayoutPanel.Controls.Add(this.panel1);
            this.flowLayoutPanel.Controls.Add(this.labelPageOrder);
            this.flowLayoutPanel.Controls.Add(this.textPageOrder);
            this.flowLayoutPanel.Controls.Add(this.labelPageParent);
            this.flowLayoutPanel.Controls.Add(this.comboPageParent);
            this.flowLayoutPanel.Controls.Add(this.labelCategories);
            this.flowLayoutPanel.Controls.Add(this.categoryDropDown);
            this.flowLayoutPanel.Controls.Add(this.labelTags);
            this.flowLayoutPanel.Controls.Add(this.textTags);
            this.flowLayoutPanel.Controls.Add(this.labelPublishDate);
            this.flowLayoutPanel.Controls.Add(this.datePublishDate);
            this.flowLayoutPanel.Controls.Add(this.labelComments);
            this.flowLayoutPanel.Controls.Add(this.comboComments);
            this.flowLayoutPanel.Controls.Add(this.labelPings);
            this.flowLayoutPanel.Controls.Add(this.comboPings);
            this.flowLayoutPanel.Controls.Add(this.labelAuthor);
            this.flowLayoutPanel.Controls.Add(this.panelComboAuthorIsolate);
            this.flowLayoutPanel.Controls.Add(this.labelSlug);
            this.flowLayoutPanel.Controls.Add(this.textSlug);
            this.flowLayoutPanel.Controls.Add(this.labelPassword);
            this.flowLayoutPanel.Controls.Add(this.textPassword);
            this.flowLayoutPanel.Controls.Add(this.labelExcerpt);
            this.flowLayoutPanel.Controls.Add(this.textExcerpt);
            this.flowLayoutPanel.Controls.Add(this.labelTrackbacks);
            this.flowLayoutPanel.Controls.Add(this.textTrackbacks);
            this.flowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
            this.flowLayoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
            this.flowLayoutPanel.Location = new System.Drawing.Point(12, 12);
            this.flowLayoutPanel.Name = "flowLayoutPanel";
            this.flowLayoutPanel.Size = new System.Drawing.Size(228, 360);
            this.flowLayoutPanel.TabIndex = 0;
            this.flowLayoutPanel.WrapContents = false;
            this.flowLayoutPanel.ClientSizeChanged += new System.EventHandler(this.flowLayoutPanel_ClientSizeChanged);
            //
            // panel1
            //
            this.panel1.Location = new System.Drawing.Point(0, 0);
            this.panel1.Margin = new System.Windows.Forms.Padding(0);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(200, 1);
            this.panel1.TabIndex = 10;
            //
            // labelPageOrder
            //
            this.labelPageOrder.AutoSize = true;
            this.labelPageOrder.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.labelPageOrder.Location = new System.Drawing.Point(3, 1);
            this.labelPageOrder.Name = "labelPageOrder";
            this.labelPageOrder.Size = new System.Drawing.Size(64, 15);
            this.labelPageOrder.TabIndex = 2;
            this.labelPageOrder.Text = "Page order";
            //
            // textPageOrder
            //
            this.textPageOrder.Location = new System.Drawing.Point(3, 19);
            this.textPageOrder.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
            this.textPageOrder.Name = "textPageOrder";
            this.textPageOrder.Size = new System.Drawing.Size(72, 23);
            this.textPageOrder.TabIndex = 3;
            //
            // labelPageParent
            //
            this.labelPageParent.AutoSize = true;
            this.labelPageParent.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.labelPageParent.Location = new System.Drawing.Point(3, 54);
            this.labelPageParent.Name = "labelPageParent";
            this.labelPageParent.Size = new System.Drawing.Size(70, 15);
            this.labelPageParent.TabIndex = 4;
            this.labelPageParent.Text = "Page parent";
            //
            // comboPageParent
            //
            this.comboPageParent.Dock = System.Windows.Forms.DockStyle.Fill;
            this.comboPageParent.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
            this.comboPageParent.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboPageParent.FormattingEnabled = true;
            this.comboPageParent.IntegralHeight = false;
            this.comboPageParent.Location = new System.Drawing.Point(3, 72);
            this.comboPageParent.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
            this.comboPageParent.Name = "comboPageParent";
            this.comboPageParent.Size = new System.Drawing.Size(200, 24);
            this.comboPageParent.TabIndex = 5;
            //
            // labelCategories
            //
            this.labelCategories.AutoSize = true;
            this.labelCategories.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.labelCategories.Location = new System.Drawing.Point(3, 108);
            this.labelCategories.Name = "labelCategories";
            this.labelCategories.Size = new System.Drawing.Size(63, 15);
            this.labelCategories.TabIndex = 6;
            this.labelCategories.Text = "Categories:";
            //
            // categoryDropDown
            //
            this.categoryDropDown.AccessibleName = "Categories";
            this.categoryDropDown.Dock = System.Windows.Forms.DockStyle.Fill;
            this.categoryDropDown.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
            this.categoryDropDown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.categoryDropDown.IntegralHeight = false;
            this.categoryDropDown.Items.AddRange(new object[] {
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            ""});
            this.categoryDropDown.Location = new System.Drawing.Point(3, 126);
            this.categoryDropDown.Margin = new Padding(3, 3, 3, 12);
            this.categoryDropDown.Name = "categoryDropDown";
            this.categoryDropDown.Size = new System.Drawing.Size(200, 24);
            this.categoryDropDown.TabIndex = 7;
            //
            // labelTags
            //
            this.labelTags.AutoSize = true;
            this.labelTags.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.labelTags.Location = new System.Drawing.Point(3, 153);
            this.labelTags.Name = "labelTags";
            this.labelTags.Size = new System.Drawing.Size(32, 15);
            this.labelTags.TabIndex = 8;
            this.labelTags.Text = "Tags:";
            //
            // textTags
            //
            this.textTags.DefaultText = null;
            this.textTags.Dock = System.Windows.Forms.DockStyle.Fill;
            this.textTags.ForeColor = System.Drawing.SystemColors.GrayText;
            this.textTags.Location = new System.Drawing.Point(3, 171);
            this.textTags.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
            this.textTags.Name = "textTags";
            this.textTags.ShowButton = true;
            this.textTags.Size = new System.Drawing.Size(200, 23);
            this.textTags.TabIndex = 9;
            //
            // labelPublishDate
            //
            this.labelPublishDate.AutoSize = true;
            this.labelPublishDate.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.labelPublishDate.Location = new System.Drawing.Point(3, 206);
            this.labelPublishDate.Name = "labelPublishDate";
            this.labelPublishDate.Size = new System.Drawing.Size(72, 15);
            this.labelPublishDate.TabIndex = 11;
            this.labelPublishDate.Text = "Publish date:";
            //
            // datePublishDate
            //
            this.datePublishDate.CustomFormat = "M/d/yyyy, h:mm tt";
            this.datePublishDate.Dock = System.Windows.Forms.DockStyle.Fill;
            this.datePublishDate.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
            this.datePublishDate.Location = new System.Drawing.Point(3, 224);
            this.datePublishDate.RightToLeftLayout = true;
            this.datePublishDate.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
            this.datePublishDate.Name = "datePublishDate";
            this.datePublishDate.ShowCheckBox = true;
            this.datePublishDate.Size = new System.Drawing.Size(200, 23);
            this.datePublishDate.TabIndex = 12;
            //
            // labelComments
            //
            this.labelComments.AutoSize = true;
            this.labelComments.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.labelComments.Location = new System.Drawing.Point(3, 259);
            this.labelComments.Name = "labelComments";
            this.labelComments.Size = new System.Drawing.Size(66, 15);
            this.labelComments.TabIndex = 13;
            this.labelComments.Text = "Comments";
            //
            // comboComments
            //
            this.comboComments.Dock = System.Windows.Forms.DockStyle.Fill;
            this.comboComments.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboComments.FormattingEnabled = true;
            this.comboComments.Location = new System.Drawing.Point(3, 277);
            this.comboComments.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
            this.comboComments.Name = "comboComments";
            this.comboComments.Size = new System.Drawing.Size(200, 23);
            this.comboComments.TabIndex = 14;
            //
            // labelPings
            //
            this.labelPings.AutoSize = true;
            this.labelPings.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.labelPings.Location = new System.Drawing.Point(3, 312);
            this.labelPings.Name = "labelPings";
            this.labelPings.Size = new System.Drawing.Size(36, 15);
            this.labelPings.TabIndex = 15;
            this.labelPings.Text = "Pings";
            //
            // comboPings
            //
            this.comboPings.Dock = System.Windows.Forms.DockStyle.Fill;
            this.comboPings.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboPings.FormattingEnabled = true;
            this.comboPings.Location = new System.Drawing.Point(3, 330);
            this.comboPings.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
            this.comboPings.Name = "comboPings";
            this.comboPings.Size = new System.Drawing.Size(200, 23);
            this.comboPings.TabIndex = 16;
            //
            // labelAuthor
            //
            this.labelAuthor.AutoSize = true;
            this.labelAuthor.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.labelAuthor.Location = new System.Drawing.Point(3, 365);
            this.labelAuthor.Name = "labelAuthor";
            this.labelAuthor.Size = new System.Drawing.Size(44, 15);
            this.labelAuthor.TabIndex = 17;
            this.labelAuthor.Text = "Author";
            //
            // labelSlug
            //
            this.labelSlug.AutoSize = true;
            this.labelSlug.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.labelSlug.Location = new System.Drawing.Point(3, 418);
            this.labelSlug.Name = "labelSlug";
            this.labelSlug.Size = new System.Drawing.Size(30, 15);
            this.labelSlug.TabIndex = 19;
            this.labelSlug.Text = "Slug";
            //
            // textSlug
            //
            this.textSlug.Dock = System.Windows.Forms.DockStyle.Fill;
            this.textSlug.Location = new System.Drawing.Point(3, 436);
            this.textSlug.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
            this.textSlug.Name = "textSlug";
            this.textSlug.Size = new System.Drawing.Size(200, 23);
            this.textSlug.TabIndex = 20;
            //
            // labelPassword
            //
            this.labelPassword.AutoSize = true;
            this.labelPassword.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.labelPassword.Location = new System.Drawing.Point(3, 471);
            this.labelPassword.Name = "labelPassword";
            this.labelPassword.Size = new System.Drawing.Size(57, 15);
            this.labelPassword.TabIndex = 21;
            this.labelPassword.Text = "Password";
            //
            // textPassword
            //
            this.textPassword.Dock = System.Windows.Forms.DockStyle.Fill;
            this.textPassword.Location = new System.Drawing.Point(3, 489);
            this.textPassword.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
            this.textPassword.Name = "textPassword";
            this.textPassword.Size = new System.Drawing.Size(200, 23);
            this.textPassword.TabIndex = 22;
            //
            // labelExcerpt
            //
            this.labelExcerpt.AutoSize = true;
            this.labelExcerpt.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.labelExcerpt.Location = new System.Drawing.Point(3, 524);
            this.labelExcerpt.Name = "labelExcerpt";
            this.labelExcerpt.Size = new System.Drawing.Size(45, 15);
            this.labelExcerpt.TabIndex = 23;
            this.labelExcerpt.Text = "Excerpt";
            //
            // textExcerpt
            //
            this.textExcerpt.AcceptsReturn = true;
            this.textExcerpt.Dock = System.Windows.Forms.DockStyle.Fill;
            this.textExcerpt.Location = new System.Drawing.Point(3, 542);
            this.textExcerpt.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
            this.textExcerpt.Multiline = true;
            this.textExcerpt.Name = "textExcerpt";
            this.textExcerpt.Size = new System.Drawing.Size(200, 81);
            this.textExcerpt.TabIndex = 24;
            //
            // labelTrackbacks
            //
            this.labelTrackbacks.AutoSize = true;
            this.labelTrackbacks.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.labelTrackbacks.Location = new System.Drawing.Point(3, 635);
            this.labelTrackbacks.Name = "labelTrackbacks";
            this.labelTrackbacks.Size = new System.Drawing.Size(66, 15);
            this.labelTrackbacks.TabIndex = 25;
            this.labelTrackbacks.Text = "Trackbacks:";
            //
            // textTrackbacks
            //
            this.textTrackbacks.AcceptsReturn = true;
            this.textTrackbacks.Dock = System.Windows.Forms.DockStyle.Fill;
            this.textTrackbacks.Location = new System.Drawing.Point(3, 653);
            this.textTrackbacks.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
            this.textTrackbacks.Name = "textTrackbacks";
            this.textTrackbacks.Size = new System.Drawing.Size(200, 23);
            this.textTrackbacks.TabIndex = 26;
            //
            // buttonClose
            //
            this.buttonClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.buttonClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.buttonClose.FlatStyle = FlatStyle.System;
            this.buttonClose.Location = new System.Drawing.Point(166, 384);
            this.buttonClose.Name = "buttonClose";
            this.buttonClose.Size = new System.Drawing.Size(75, 23);
            this.buttonClose.TabIndex = 1;
            this.buttonClose.Text = "Close";
            this.buttonClose.UseVisualStyleBackColor = true;
            this.buttonClose.Click += new System.EventHandler(this.buttonClose_Click);
            //
            // panelComboAuthorIsolate
            //
            this.panelComboAuthorIsolate.Controls.Add(this.comboAuthor);
            this.panelComboAuthorIsolate.Location = new System.Drawing.Point(3, 383);
            this.panelComboAuthorIsolate.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            this.panelComboAuthorIsolate.Margin = new System.Windows.Forms.Padding(3, 3, 3, 12);
            this.panelComboAuthorIsolate.Name = "panelComboAuthorIsolate";
            this.panelComboAuthorIsolate.Size = new System.Drawing.Size(200, 23);
            this.panelComboAuthorIsolate.TabIndex = 18;
            //
            // comboAuthor
            //
            this.comboAuthor.Dock = System.Windows.Forms.DockStyle.Fill;
            this.comboAuthor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.comboAuthor.FormattingEnabled = true;
            this.comboAuthor.Location = new System.Drawing.Point(0, 0);
            this.comboAuthor.Margin = new System.Windows.Forms.Padding(0);
            this.comboAuthor.Name = "comboAuthor";
            this.comboAuthor.Size = new System.Drawing.Size(200, 23);
            this.comboAuthor.TabIndex = 19;
            //
            // PostPropertiesForm
            //
            this.AcceptButton = this.buttonClose;
            this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
            this.BackColor = System.Drawing.SystemColors.Window;
            this.CancelButton = this.buttonClose;
            this.ClientSize = new System.Drawing.Size(252, 417);
            this.Controls.Add(this.buttonClose);
            this.Controls.Add(this.flowLayoutPanel);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
            this.Name = "PostPropertiesForm";
            this.Padding = new System.Windows.Forms.Padding(12, 12, 12, 45);
            this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
            this.Text = "Post Properties";
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.PostPropertiesForm_FormClosing);
            this.flowLayoutPanel.ResumeLayout(false);
            this.flowLayoutPanel.PerformLayout();
            this.panelComboAuthorIsolate.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel;
        private System.Windows.Forms.Button buttonClose;
        private System.Windows.Forms.Label labelPageOrder;
        private NumericTextBox textPageOrder;
        private System.Windows.Forms.Label labelPageParent;
        private PageParentComboBox comboPageParent;
        private System.Windows.Forms.Label labelCategories;
        private CategoryDropDownControlM1 categoryDropDown;
        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Label labelTags;
        private AutoCompleteTextbox textTags;
        private System.Windows.Forms.Label labelPublishDate;
        private PublishDateTimePicker datePublishDate;
        private System.Windows.Forms.Label labelComments;
        private System.Windows.Forms.ComboBox comboComments;
        private System.Windows.Forms.Label labelPings;
        private System.Windows.Forms.ComboBox comboPings;
        private System.Windows.Forms.Label labelAuthor;
        private System.Windows.Forms.Label labelSlug;
        private System.Windows.Forms.TextBox textSlug;
        private System.Windows.Forms.Label labelPassword;
        private System.Windows.Forms.TextBox textPassword;
        private System.Windows.Forms.Label labelExcerpt;
        private System.Windows.Forms.TextBox textExcerpt;
        private System.Windows.Forms.Label labelTrackbacks;
        private System.Windows.Forms.TextBox textTrackbacks;
        private System.Windows.Forms.Panel panelComboAuthorIsolate;
        private DelayedFetchComboBox comboAuthor;
    }
}


text:
#include "qt/screenshoter.hpp"

#include "map/bookmark_helpers.hpp"
#include "map/bookmark_manager.hpp"
#include "map/framework.hpp"

#include "storage/storage.hpp"

#include "platform/downloader_defines.hpp"
#include "platform/preferred_languages.hpp"

#include "indexer/scales.hpp"

#include "base/file_name_utils.hpp"
#include "base/logging.hpp"
#include "base/string_utils.hpp"

#include <QtGui/QPixmap>

#include <chrono>
#include <fstream>
#include <functional>
#include <sstream>

namespace
{
bool ParsePoint(std::string const & s, char const * delim, m2::PointD & pt, int & zoom)
{
  // Order in string is: lat, lon, zoom.
  strings::SimpleTokenizer iter(s, delim);
  if (!iter)
    return false;

  double lat;
  double lon;
  int zoomLevel;
  if (strings::to_double(*iter, lat) && mercator::ValidLat(lat) && ++iter &&
      strings::to_double(*iter, lon) && mercator::ValidLon(lon) && ++iter &&
      strings::to_int(*iter, zoomLevel) &&
      zoomLevel >= 1 && zoomLevel <= scales::GetUpperStyleScale())
  {
    pt = mercator::FromLatLon(lat, lon);
    zoom = zoomLevel;
    return true;
  }
  return false;
}

bool ParseRect(std::string const & s, char const * delim, m2::RectD & rect)
{
  // Order in string is: latLeftBottom, lonLeftBottom, latRigthTop, lonRigthTop.
  strings::SimpleTokenizer iter(s, delim);
  if (!iter)
    return false;

  double latLeftBottom;
  double lonLeftBottom;
  double latRigthTop;
  double lonRigthTop;
  if (strings::to_double(*iter, latLeftBottom) && mercator::ValidLat(latLeftBottom) && ++iter &&
      strings::to_double(*iter, lonLeftBottom) && mercator::ValidLon(lonLeftBottom) && ++iter &&
      strings::to_double(*iter, latRigthTop) && mercator::ValidLat(latRigthTop) && ++iter &&
      strings::to_double(*iter, lonRigthTop) && mercator::ValidLon(lonRigthTop))
  {
    rect = m2::RectD(mercator::FromLatLon(latLeftBottom, lonLeftBottom),
                     mercator::FromLatLon(latRigthTop, lonRigthTop));
    return true;
  }
  return false;
}

bool ParsePointsStr(std::string const & pointsStr, std::list<std::pair<m2::PointD, int>> & points)
{
  strings::SimpleTokenizer tupleIter(pointsStr, ";");
  m2::PointD pt;
  int zoom;
  while (tupleIter)
  {
    if (ParsePoint(*tupleIter, ", \t", pt, zoom))
    {
      points.emplace_back(pt, zoom);
    }
    else
    {
      LOG(LWARNING, ("Failed to parse point and zoom:", *tupleIter));
      return false;
    }
    ++tupleIter;
  }
  return true;
}

bool ParseRectsStr(std::string const & rectsStr, std::list<m2::RectD> & rects)
{
  strings::SimpleTokenizer tupleIter(rectsStr, ";");
  m2::RectD rect;
  while (tupleIter)
  {
    if (ParseRect(*tupleIter, ", \t", rect))
    {
      rects.push_back(rect);
    }
    else
    {
      LOG(LWARNING, ("Failed to parse rect:", *tupleIter));
      return false;
    }
    ++tupleIter;
  }
  return true;
}
}  // namespace

namespace qt
{
Screenshoter::Screenshoter(ScreenshotParams const & screenshotParams, Framework & framework,
                           QOpenGLWidget * widget)
  : m_screenshotParams(screenshotParams)
  , m_framework(framework)
  , m_widget(widget)
{
  m_framework.GetStorage().Subscribe(
      std::bind(&Screenshoter::OnCountryChanged, this, std::placeholders::_1),
      [](storage::CountryId const &, downloader::Progress const &) {});
}

void Screenshoter::Start()
{
  if (m_state != State::NotStarted)
    return;

  if (m_screenshotParams.m_dstPath.empty())
    m_screenshotParams.m_dstPath = base::JoinPath(m_screenshotParams.m_kmlPath, "screenshots");

  LOG(LINFO, ("\nScreenshoter parameters:"
              "\n  mode:",
              m_screenshotParams.m_mode, "\n  kml_path:", m_screenshotParams.m_kmlPath,
              "\n  points:", m_screenshotParams.m_points, "\n  rects:", m_screenshotParams.m_rects,
              "\n  dst_path:", m_screenshotParams.m_dstPath,
              "\n  width:", m_screenshotParams.m_width, "\n  height:", m_screenshotParams.m_height,
              "\n  dpi_scale:", m_screenshotParams.m_dpiScale));

  if (!Platform::MkDirChecked(m_screenshotParams.m_dstPath))
  {
    ChangeState(State::FileError);
    return;
  }

  if (!PrepareItemsToProcess())
    return;

  ChangeState(State::Ready);
  ProcessNextItem();
}

void Screenshoter::ProcessNextItem()
{
  CHECK_EQUAL(m_state, State::Ready, ());

  switch (m_screenshotParams.m_mode)
  {
  case ScreenshotParams::Mode::KmlFiles: return PrepareToProcessKml();
  case ScreenshotParams::Mode::Points: return ProcessNextPoint();
  case ScreenshotParams::Mode::Rects: return ProcessNextRect();
  }
  UNREACHABLE();
}

void Screenshoter::PrepareToProcessKml()
{
  if (m_framework.GetBookmarkManager().AreSymbolSizesAcquired([this] { ProcessNextKml(); }))
    ProcessNextKml();
}

void Screenshoter::ProcessNextKml()
{
  std::string const postfix = "_" + languages::GetCurrentNorm();
  std::unique_ptr<kml::FileData> kmlData;
  while (kmlData == nullptr && !m_filesToProcess.empty())
  {
    auto const filePath = m_filesToProcess.front();
    m_filesToProcess.pop_front();
    m_nextScreenshotName = base::GetNameFromFullPathWithoutExt(filePath) + postfix;

    ChangeState(State::LoadKml);
    kmlData = LoadKmlFile(filePath, KmlFileType::Text);
    if (kmlData != nullptr && kmlData->m_bookmarksData.empty() && kmlData->m_tracksData.empty())
      kmlData.reset();
  }

  if (kmlData == nullptr)
  {
    ChangeState(State::Done);
    return;
  }

  kmlData->m_categoryData.m_visible = true;

  BookmarkManager::KMLDataCollection collection;
  collection.emplace_back("", std::move(kmlData));

  auto & bookmarkManager = m_framework.GetBookmarkManager();
  auto es = bookmarkManager.GetEditSession();
  auto const idList = bookmarkManager.GetBmGroupsIdList();
  for (auto catId : idList)
    es.DeleteBmCategory(catId);

  bookmarkManager.CreateCategories(std::move(collection), false);

  ChangeState(State::WaitPosition);
  auto const newCatId = bookmarkManager.GetBmGroupsIdList().front();
  m_framework.ShowBookmarkCategory(newCatId, false);
  WaitPosition();
}

void Screenshoter::ProcessNextRect()
{
  if (m_rectsToProcess.empty())
  {
    ChangeState(State::Done);
    return;
  }

  std::string const postfix = "_" + languages::GetCurrentNorm();
  std::stringstream ss;
  ss << "rect_" << std::setfill('0') << std::setw(4) << m_itemsCount - m_rectsToProcess.size()
     << postfix;

  m_nextScreenshotName = ss.str();

  auto const rect = m_rectsToProcess.front();
  m_rectsToProcess.pop_front();

  CHECK(rect.IsValid(), ());

  ChangeState(State::WaitPosition);
  m_framework.ShowRect(rect, -1 /* maxScale */, false /* animation */,
                       false /* useVisibleViewport */);
  WaitPosition();
}

void Screenshoter::ProcessNextPoint()
{
  if (m_pointsToProcess.empty())
  {
    ChangeState(State::Done);
    return;
  }

  std::string const postfix = "_" + languages::GetCurrentNorm();
  std::stringstream ss;
  ss << "point_" << std::setfill('0') << std::setw(4) << m_itemsCount - m_pointsToProcess.size()
     << postfix;

  m_nextScreenshotName = ss.str();

  auto const pointZoom = m_pointsToProcess.front();
  m_pointsToProcess.pop_front();

  ChangeState(State::WaitPosition);
  m_framework.SetViewportCenter(pointZoom.first, pointZoom.second, false /* animation */);
  WaitPosition();
}

void Screenshoter::PrepareCountries()
{
  CHECK(m_countriesToDownload.empty(), ());

  auto & storage = m_framework.GetStorage();

  int const kMinCountryZoom = 10;
  if (m_framework.GetDrawScale() >= kMinCountryZoom)
  {
    auto countryIds = m_framework.GetCountryInfoGetter().GetRegionsCountryIdByRect(m_framework.GetCurrentViewport(),
                                                                                false /* rough */);
    for (auto const & countryId : countryIds)
    {
      if (storage.CountryStatusEx(countryId) == storage::Status::ENotDownloaded)
      {
        ChangeState(State::WaitCountries);
        m_countriesToDownload.insert(countryId);
        storage.DownloadCountry(countryId, MapFileType::Map);
      }
    }
  }

  if (m_countriesToDownload.empty())
  {
    ChangeState(State::WaitGraphics);
    WaitGraphics();
  }
}

void Screenshoter::OnCountryChanged(storage::CountryId countryId)
{
  if (m_state != State::WaitCountries)
    return;

  auto const status = m_framework.GetStorage().CountryStatusEx(countryId);
  if (status == storage::Status::EOnDisk)
  {
    m_countriesToDownload.erase(countryId);
    if (m_countriesToDownload.empty())
    {
      ChangeState(State::WaitGraphics);
      auto const kDelay = std::chrono::seconds(3);
      GetPlatform().RunDelayedTask(Platform::Thread::File, kDelay, [this]{ WaitGraphics(); });
    }
  }
}

void Screenshoter::OnPositionReady()
{
  if (m_state != State::WaitPosition)
    return;
  PrepareCountries();
}

void Screenshoter::OnGraphicsReady()
{
  if (m_state != State::WaitGraphics)
    return;

  ChangeState(State::Ready);
  SaveScreenshot();
}

void Screenshoter::WaitPosition()
{
  m_framework.NotifyGraphicsReady(
      [this]() { GetPlatform().RunTask(Platform::Thread::Gui, [this] { OnPositionReady(); }); },
      false /* needInvalidate */);
}

void Screenshoter::WaitGraphics()
{
  m_framework.NotifyGraphicsReady(
      [this]() { GetPlatform().RunTask(Platform::Thread::Gui, [this] { OnGraphicsReady(); }); },
      true /* needInvalidate */);
}

void Screenshoter::SaveScreenshot()
{
  CHECK_EQUAL(m_state, State::Ready, ());

  if (!Platform::MkDirChecked(m_screenshotParams.m_dstPath))
  {
    ChangeState(State::FileError);
    return;
  }

  QSize screenshotSize(m_screenshotParams.m_width, m_screenshotParams.m_height);
  QImage framebuffer = m_widget->grabFramebuffer();
  ASSERT_EQUAL(framebuffer.width() % screenshotSize.width(), 0, ());
  ASSERT_EQUAL(framebuffer.height() % screenshotSize.height(), 0, ());
  QImage screenshot = framebuffer.scaled(screenshotSize);
  if (!screenshot.save(QString::fromStdString(base::JoinPath(m_screenshotParams.m_dstPath,
                                                             m_nextScreenshotName + ".png")),
                       "PNG", 100))
  {
    ChangeState(State::FileError);
    return;
  }
  m_nextScreenshotName.clear();

  ProcessNextItem();
}

void Screenshoter::ChangeState(State newState, std::string const & msg)
{
  m_state = newState;
  if (m_screenshotParams.m_statusChangedFn)
  {
    std::ostringstream ss;
    ss << "[" << m_itemsCount - GetItemsToProcessCount() << "/" << m_itemsCount
       << "] file: " << m_nextScreenshotName << " state: " << DebugPrint(newState);
    if (!msg.empty())
      ss << " msg: " << msg;
    LOG(LINFO, (ss.str()));
    m_screenshotParams.m_statusChangedFn(ss.str(), newState == Screenshoter::State::Done);
  }
}

size_t Screenshoter::GetItemsToProcessCount()
{
  switch (m_screenshotParams.m_mode)
  {
  case ScreenshotParams::Mode::KmlFiles: return m_filesToProcess.size();
  case ScreenshotParams::Mode::Points: return m_pointsToProcess.size();
  case ScreenshotParams::Mode::Rects: return m_rectsToProcess.size();
  }
  UNREACHABLE();
}

bool Screenshoter::PrepareItemsToProcess()
{
  switch (m_screenshotParams.m_mode)
  {
  case ScreenshotParams::Mode::KmlFiles: return PrepareKmlFiles();
  case ScreenshotParams::Mode::Points: return PreparePoints();
  case ScreenshotParams::Mode::Rects: return PrepareRects();
  }
  UNREACHABLE();
}

bool Screenshoter::PrepareKmlFiles()
{
  if (!Platform::IsDirectory(m_screenshotParams.m_kmlPath) &&
      !Platform::IsFileExistsByFullPath(m_screenshotParams.m_kmlPath))
  {
    ChangeState(State::FileError, "Invalid kml path.");
    return false;
  }

  if (!Platform::IsDirectory(m_screenshotParams.m_kmlPath))
  {
    m_filesToProcess.push_back(m_screenshotParams.m_kmlPath);
  }
  else
  {
    Platform::FilesList files;
    Platform::GetFilesByExt(m_screenshotParams.m_kmlPath, kKmlExtension, files);
    for (auto const & file : files)
    {
      auto const filePath = base::JoinPath(m_screenshotParams.m_kmlPath, file);
      m_filesToProcess.push_back(filePath);
    }
  }

  m_itemsCount = m_filesToProcess.size();
  return true;
}

bool Screenshoter::PreparePoints()
{
  if (!LoadPoints(m_screenshotParams.m_points))
  {
    ChangeState(State::ParamsError, "Invalid points.");
    return false;
  }
  m_itemsCount = m_pointsToProcess.size();
  return true;
}

bool Screenshoter::PrepareRects()
{
  if (!LoadRects(m_screenshotParams.m_rects))
  {
    ChangeState(State::ParamsError, "Invalid rects.");
    return false;
  }
  m_itemsCount = m_rectsToProcess.size();
  return true;
}

bool Screenshoter::LoadRects(std::string const & rects)
{
  if (Platform::IsFileExistsByFullPath(rects))
  {
    std::ifstream fin(rects);
    std::string line;
    while (std::getline(fin, line))
    {
      if (!ParseRectsStr(line, m_rectsToProcess))
      {
        m_rectsToProcess.clear();
        return false;
      }
    }
  }
  else if (!ParseRectsStr(rects, m_rectsToProcess))
  {
    m_rectsToProcess.clear();
    return false;
  }
  return !m_rectsToProcess.empty();
}

bool Screenshoter::LoadPoints(std::string const & points)
{
  if (Platform::IsFileExistsByFullPath(points))
  {
    std::ifstream fin(points);
    std::string line;
    while (std::getline(fin, line))
    {
      if (!ParsePointsStr(line, m_pointsToProcess))
      {
        m_pointsToProcess.clear();
        return false;
      }
    }
  }
  else if (!ParsePointsStr(points, m_pointsToProcess))
  {
    m_pointsToProcess.clear();
    return false;
  }
  return !m_pointsToProcess.empty();
}

std::string DebugPrint(Screenshoter::State state)
{
  switch (state)
  {
  case Screenshoter::State::NotStarted: return "NotStarted";
  case Screenshoter::State::LoadKml: return "LoadKml";
  case Screenshoter::State::WaitPosition: return "WaitPosition";
  case Screenshoter::State::WaitCountries: return "WaitCountries";
  case Screenshoter::State::WaitGraphics: return "WaitGraphics";
  case Screenshoter::State::Ready: return "Ready";
  case Screenshoter::State::FileError: return "FileError";
  case Screenshoter::State::ParamsError: return "ParamsError";
  case Screenshoter::State::Done: return "Done";
  }
  UNREACHABLE();
}

std::string DebugPrint(ScreenshotParams::Mode mode)
{
  switch (mode)
  {
  case ScreenshotParams::Mode::KmlFiles: return "KmlFiles";
  case ScreenshotParams::Mode::Points: return "Points";
  case ScreenshotParams::Mode::Rects: return "Rects";
  }
  UNREACHABLE();
}
}  // namespace qt


text:
<!DOCTYPE html>

    ##CONF_METATAGS##

    ##TITLE##

    <link rel="stylesheet" href="makeup/vendor/twbs/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="makeup/vendor/components/font-awesome/css/font-awesome.min.css">

    ##CONF_CSS_FILES##

    ##CONF_JS_FILES_HEAD##

    ##NAVBAR##

makeUp

##PAGE_TITLE##

    ##CONTENT##

© 2016 Martin J. Wolf

    ##CONF_JS_FILES_BODY##


text:
<?php
/* ***********************************************************************
THIS FILE WAS CREATED AUTOMATICALLY BY PHP MODEL/OBJECT CREATOR
MANUAL MODIFICATIONS WILL BE AUTOMATICALLY OVERWRITTEN
************************************************************************ */
abstract class GrcPool_View_Vote_Member_MODEL {

	public function __construct() { }

	private $_username = '';
	private $_id = 0;
	private $_questionId = 0;
	private $_answerId = 0;
	private $_time = 0;
	private $_memberId = 0;
	private $_rank = 0;
	private $_mag = 0.00;
	private $_balance = 0.00000000;
	private $_weight = 0.00000000;
	public function setUsername(string $string) {$this->_username=$string;}
	public function getUsername():string {return $this->_username;}
	public function setId(int $int) {$this->_id=$int;}
	public function getId():int {return $this->_id;}
	public function setQuestionId(int $int) {$this->_questionId=$int;}
	public function getQuestionId():int {return $this->_questionId;}
	public function setAnswerId(int $int) {$this->_answerId=$int;}
	public function getAnswerId():int {return $this->_answerId;}
	public function setTime(int $int) {$this->_time=$int;}
	public function getTime():int {return $this->_time;}
	public function setMemberId(int $int) {$this->_memberId=$int;}
	public function getMemberId():int {return $this->_memberId;}
	public function setRank(int $int) {$this->_rank=$int;}
	public function getRank():int {return $this->_rank;}
	public function setMag(float $float) {$this->_mag=$float;}
	public function getMag():float {return $this->_mag;}
	public function setBalance(float $float) {$this->_balance=$float;}
	public function getBalance():float {return $this->_balance;}
	public function setWeight(float $float) {$this->_weight=$float;}
	public function getWeight():float {return $this->_weight;}
}

abstract class GrcPool_View_Vote_Member_MODELDAO extends TableDAO {
	protected $_database = Constants::DATABASE_NAME;
	protected $_table = 'view_vote_member';
	protected $_model = 'GrcPool_View_Vote_Member_OBJ';
	protected $_primaryKey = '';
	protected $_fields = array(
		'username' => array('type'=>'STRING','dbType'=>'varchar(25)'),
		'id' => array('type'=>'INT','dbType'=>'int(11)'),
		'questionId' => array('type'=>'INT','dbType'=>'int(11)'),
		'answerId' => array('type'=>'INT','dbType'=>'int(11)'),
		'time' => array('type'=>'INT','dbType'=>'int(11)'),
		'memberId' => array('type'=>'INT','dbType'=>'int(11)'),
		'rank' => array('type'=>'INT','dbType'=>'smallint(3)'),
		'mag' => array('type'=>'FLOAT','dbType'=>'decimal(8,2)'),
		'balance' => array('type'=>'FLOAT','dbType'=>'decimal(16,8)'),
		'weight' => array('type'=>'FLOAT','dbType'=>'decimal(22,8)'),
	);
}


text:
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

#nullable disable

using osuTK;
using System;
using System.Collections.Generic;
using osu.Framework.Extensions.EnumExtensions;

namespace osu.Framework.Graphics.Containers
{
    /// <summary>
    /// Holds extension methods for <see cref="Container{T}"/>.
    /// </summary>
    public static class ContainerExtensions
    {
        /// <summary>
        /// Wraps the given <paramref name="drawable"/> with the given <paramref name="container"/>
        /// such that the <paramref name="container"/> can be used instead of the <paramref name="drawable"/>
        /// without affecting the layout. The <paramref name="container"/> must not contain any children before wrapping.
        /// </summary>
        /// <typeparam name="TContainer">The type of the <paramref name="container"/>.</typeparam>
        /// <typeparam name="TChild">The type of the children of <paramref name="container"/>.</typeparam>
        /// <param name="container">The <paramref name="container"/> that should wrap the given <paramref name="drawable"/>.</param>
        /// <param name="drawable">The <paramref name="drawable"/> that should be wrapped by the given <paramref name="container"/>.</param>
        /// <returns>The given <paramref name="container"/>.</returns>
        public static TContainer Wrap<TContainer, TChild>(this TContainer container, TChild drawable)
            where TContainer : Container<TChild>
            where TChild : Drawable
        {
            if (container.Children.Count != 0)
                throw new InvalidOperationException($"You may not wrap a {nameof(Container<TChild>)} that has children.");

            container.RelativeSizeAxes = drawable.RelativeSizeAxes;
            container.AutoSizeAxes = Axes.Both & ~drawable.RelativeSizeAxes;
            container.Anchor = drawable.Anchor;
            container.Origin = drawable.Origin;
            container.Position = drawable.Position;
            container.Rotation = drawable.Rotation;

            drawable.Position = Vector2.Zero;
            drawable.Rotation = 0;

            // For anchor/origin positioning to be preserved correctly,
            // relatively sized axes must be lifted to the wrapping container.
            if (container.RelativeSizeAxes.HasFlagFast(Axes.X))
            {
                container.Width = drawable.Width;
                drawable.Width = 1;
            }

            if (container.RelativeSizeAxes.HasFlagFast(Axes.Y))
            {
                container.Height = drawable.Height;
                drawable.Height = 1;
            }

            container.Add(drawable);

            return container;
        }

        /// <summary>
        /// Set a specified <paramref name="child"/> on <paramref name="container"/>.
        /// </summary>
        /// <typeparam name="TContainer">The container type.</typeparam>
        /// <typeparam name="TChild">The type of children contained by <paramref name="container"/>.</typeparam>
        /// <param name="container">The <paramref name="container"/> that will have a child set.</param>
        /// <param name="child">The <paramref name="child"/> that should be set to the <paramref name="container"/>.</param>
        /// <returns>The given <paramref name="container"/>.</returns>
        public static TContainer WithChild<TContainer, TChild>(this TContainer container, TChild child)
            where TContainer : IContainerCollection<TChild>
            where TChild : Drawable
        {
            container.Child = child;

            return container;
        }

        /// <summary>
        /// Set specified <paramref name="children"/> on <paramref name="container"/>.
        /// </summary>
        /// <typeparam name="TContainer">The container type.</typeparam>
        /// <typeparam name="TChild">The type of children contained by <paramref name="container"/>.</typeparam>
        /// <param name="container">The <paramref name="container"/> that will have children set.</param>
        /// <param name="children">The <paramref name="children"/> that should be set to the <paramref name="container"/>.</param>
        /// <returns>The given <paramref name="container"/>.</returns>
        public static TContainer WithChildren<TContainer, TChild>(this TContainer container, IEnumerable<TChild> children)
            where TContainer : IContainerCollection<TChild>
            where TChild : Drawable
        {
            container.ChildrenEnumerable = children;

            return container;
        }
    }
}