LocationTabController::LocationTabController(const model::Model & model,
                                             const QString& modelTempDir)
  : MainTabController(new LocationTabView(model,modelTempDir))
{
  LocationView * locationView = new LocationView(model, modelTempDir);
  mainContentWidget()->addSubTab("Weather File && Design Days",locationView,WEATHER_FILE);

  LifeCycleCostsView * lifeCycleCostsView = new LifeCycleCostsView(model);
  mainContentWidget()->addSubTab("Life Cycle Costs",lifeCycleCostsView,LIFE_CYCLE_COSTS);

  QLabel * label;

  label = new QLabel();
  label->setPixmap(QPixmap(":/images/utility_calibration_warning.png"));
  label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);

  m_utilityBillsController = std::shared_ptr<UtilityBillsController>(new UtilityBillsController(model));

  m_utilityBillsStackedWidget = new QStackedWidget();
  m_warningWidgetIndex = m_utilityBillsStackedWidget->addWidget(label);
  m_visibleWidgetIndex = m_utilityBillsStackedWidget->addWidget(m_utilityBillsController->subTabView()); 

  mainContentWidget()->addSubTab("Utility Bills",m_utilityBillsStackedWidget,UTILITY_BILLS);

  // Determine if the utility bill sub-tab is shown
  boost::optional<model::YearDescription> yearDescription = model.yearDescription();
  if (yearDescription){
    boost::optional<int> calendarYear = yearDescription.get().calendarYear();
    if (calendarYear){
      boost::optional<model::WeatherFile> weatherFile = model.weatherFile();
      if (weatherFile){
        boost::optional<model::RunPeriod> runPeriod = model.getOptionalUniqueModelObject<model::RunPeriod>();
        if (runPeriod.is_initialized()){
          m_utilityBillsStackedWidget->setCurrentIndex(m_visibleWidgetIndex);
        }
        else {
          m_utilityBillsStackedWidget->setCurrentIndex(m_warningWidgetIndex);
        }
      }
    }
  }

  // Hack code to remove when tab active
  label = new QLabel();
  label->setPixmap(QPixmap(":/images/coming_soon_utility_rates.png"));
  label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
  mainContentWidget()->addSubTab("Utility Rates",label,UTILITY_RATES);

  // Hack code to remove when tab active
  //label = new QLabel();
  //label->setPixmap(QPixmap(":/images/coming_soon_ground_temperature.png"));
  //label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
  //mainContentWidget()->addSubTab("Ground Temperature",label,GROUND_TEMPERATURE);

  // Hack code to remove when tab active
  //label = new QLabel();
  //label->setPixmap(QPixmap(":/images/coming_soon_water_mains_temperature.png"));
  //label->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
  //mainContentWidget()->addSubTab("Water Mains Temperature",label,WATER_MAINS_TEMPERATURE);
}
void EmberEntityModelAction::activate(EntityMapping::ChangeContext& context)
{
	Model::Model* model = Model::ModelRepresentationManager::getSingleton().getModelForEntity(mEntity);
	if (!model || model->getDefinition()->getName() != mModelName) {
		mEntity.setGraphicalRepresentation(0);
		model = Model::Model::createModel(mScene.getSceneManager(), mModelName, mEntity.getId());
		model->setVisible(mEntity.isVisible());

		//if the model definition isn't valid, use a placeholder
		if (!model->getDefinition()->isValid()) {
			S_LOG_FAILURE( "Could not find " << mModelName << ", using placeholder.");
			//add a placeholder model
			Model::ModelDefinitionPtr modelDef = model->getDefinition();
			modelDef->createSubModelDefinition("3d_objects/primitives/models/box.mesh")->createPartDefinition("main")->setShow(true);
			modelDef->setValid(true);
			modelDef->reloadAllInstances();
		}

		Model::ModelRepresentation* representation = new Model::ModelRepresentation(mEntity, *model, mScene, mMapping);
		mEntity.setGraphicalRepresentation(representation);
		representation->initFromModel();


	}
}
Exemple #3
0
TEST(FilePersistence, LoadMultipleUnits)
{
	QString testDir = ":/FilePersistence/test/persisted";
	Model::Model model;
	FileStore store;
	store.setBaseFolder(testDir);

	model.load(&store, "units");
	TestNodes::BinaryNode* root = dynamic_cast<TestNodes::BinaryNode*> (model.root());

	CHECK_STR_EQUAL("BinaryNode", root->typeName() );
	CHECK_STR_EQUAL("Root", root->name()->get() );
	CHECK_CONDITION(root->left() != nullptr);
	CHECK_CONDITION(root->right() != nullptr);
	CHECK_STR_EQUAL("BinaryNodePersistenceUnit", root->left()->typeName() );
	CHECK_STR_EQUAL("Left child", root->left()->name()->get() );
	CHECK_CONDITION(root->left()->left() != nullptr);
	CHECK_CONDITION(root->left()->right() == nullptr);
	CHECK_STR_EQUAL("BinaryNode", root->left()->left()->typeName() );
	CHECK_STR_EQUAL("in a new unit", root->left()->left()->name()->get() );
	CHECK_CONDITION(root->left()->left()->left() == nullptr);
	CHECK_CONDITION(root->left()->left()->right() == nullptr);
	CHECK_STR_EQUAL("BinaryNode", root->right()->typeName() );
	CHECK_STR_EQUAL("Right child", root->right()->name()->get() );
	CHECK_CONDITION(root->right()->left() == nullptr);
	CHECK_CONDITION(root->right()->right() == nullptr);
}
Object model_rank_text(Object self, Object text) {
  Model::Model *model = from_ruby<Model::Model *>(self);
  string example_text = from_ruby<string>(text);
  Array indexes;
  
  vector<Classifier::Score> *ranks = model->rank_text(example_text);
  for(unsigned int i = 0; i < ranks->size(); i++)
    indexes.push(ranks->at(i).category);

  delete ranks;
  return indexes;
}
Exemple #5
0
TEST(OOModel, SimpleProjectTest)
{
	Model::Model model;
	Project* root = dynamic_cast<Project*> (model.createRoot("Project"));

	CHECK_CONDITION(root != nullptr);
	CHECK_CONDITION(root->name().isEmpty());
	model.beginModification(root, "setName");
	root->setName("prj");
	model.endModification();
	CHECK_STR_EQUAL("prj", root->name());
}
Exemple #6
0
TEST(OOModel, SimpleClassTest)
{
	Model::Model model;
	Class* root = dynamic_cast<Class*> (model.createRoot("Class"));

	CHECK_CONDITION(root != nullptr);
	CHECK_CONDITION(root->name().isEmpty());
	model.beginModification(root, "setName");
	root->setName("Test");
	model.endModification();
	CHECK_STR_EQUAL("Test", root->name());
}
Object model_rank(Object self, Object ex) {
  Model::Model *model = from_ruby<Model::Model *>(self);
  DataSet::Example *example = from_ruby<DataSet::Example *>(ex);
  Array indexes;
  
  vector<Classifier::Score> *ranks = model->rank(example);
  for(unsigned int i = 0; i < ranks->size(); i++)
    indexes.push(ranks->at(i).category);

  delete ranks;
  return indexes;
}
Object model_rank_text_names(Object self, Object text) {
  Model::Model *model = from_ruby<Model::Model *>(self);
  string example_text = from_ruby<string>(text);
  Array names;
  
  vector<Classifier::Score> *ranks = model->rank_text(example_text);
  DataSet::NominalFeature *categories = model->data_set->category_feature();
  for(unsigned int i = 0; i < ranks->size(); i++)
    names.push(categories->names[ranks->at(i).category]);
  
  delete ranks;
  return names;
}
static util::StringVector getReferenceLabels(network::Bundle& bundle,
    const model::Model& model)
{
    if(bundle.contains("referenceLabels"))
    {
        util::StringVector labels;

        auto& referenceLabels = bundle["referenceLabels"].get<matrix::LabelVector>();

        for(auto& referenceLabel : referenceLabels)
        {
            labels.push_back(std::string());

            for(auto& grapheme : referenceLabel)
            {
                labels.back() += model.getOutputLabel(grapheme);
            }
        }

        return labels;
    }

    auto& referenceActivations =
        bundle["referenceActivations"].get<matrix::MatrixVector>().front();

    return convertActivationsToLabels(std::move(referenceActivations), model);
}
Exemple #10
0
TEST(FilePersistence, LoadRootOnly)
{
	QString testDir = ":/FilePersistence/test/persisted";
	Model::Model model;
	FileStore store;
	store.setBaseFolder(testDir);

	model.load(&store, "rootOnly");
	TestNodes::BinaryNode* root = dynamic_cast<TestNodes::BinaryNode*> (model.root());

	CHECK_CONDITION(root);
	CHECK_STR_EQUAL("BinaryNode", root->typeName() );
	CHECK_STR_EQUAL("Title", root->name()->get() );
	CHECK_CONDITION(root->left() == nullptr);
	CHECK_CONDITION(root->right() == nullptr);
}
Object quarry_rank_text_names_from_binary_model(Object path, Object text) {
  string model_path = from_ruby<string>(path);
  string example_text = from_ruby<string>(text);
  Array names;
  
  Storage::Binary reader(model_path);
  Model::Model *model = reader.read_model();
  
  vector<Classifier::Score> *ranks = model->rank_text(example_text);
  DataSet::NominalFeature *categories = model->data_set->category_feature();
  for(unsigned int i = 0; i < ranks->size(); i++)
    names.push(categories->names[ranks->at(i).category]);
  
  delete ranks;
  delete model;
  return names;
}
Exemple #12
0
TEST(FilePersistence, LoadingList)
{
	QString testDir = ":/FilePersistence/test/persisted";
	Model::Model model;
	FileStore store;
	store.setBaseFolder(testDir);

	model.load(&store, "partial");
	TestNodes::PartialList* root = dynamic_cast<TestNodes::PartialList*> (model.root());
	CHECK_CONDITION(root != nullptr);

	Model::List* list = root->list();

	CHECK_CONDITION(list != nullptr);
	CHECK_STR_EQUAL("List", list->typeName() );
	CHECK_CONDITION(list->isFullyLoaded() == false);
	CHECK_INT_EQUAL(1, list->id());

	list->loadFully(store);

	CHECK_CONDITION(list->isFullyLoaded());
	CHECK_INT_EQUAL(4, list->size());

	Model::Text* one = list->at<Model::Text>(0);
	Model::Text* two = list->at<Model::Text>(1);
	Model::Text* three = list->at<Model::Text>(2);
	Model::Text* four = list->at<Model::Text>(3);

	CHECK_CONDITION(one != nullptr);
	CHECK_STR_EQUAL("one", one->get());
	CHECK_INT_EQUAL(2, one->id());

	CHECK_CONDITION(two != nullptr);
	CHECK_STR_EQUAL("two", two->get());
	CHECK_INT_EQUAL(3, two->id())

	CHECK_CONDITION(three != nullptr);
	CHECK_STR_EQUAL("three", three->get());
	CHECK_INT_EQUAL(4, three->id())

	CHECK_CONDITION(four != nullptr);
	CHECK_STR_EQUAL("four", four->get());
	CHECK_INT_EQUAL(5, four->id());

}
Exemple #13
0
TEST(VisualizationBase, ExtendableTest)
{
	Model::Model* model = new Model::Model();
	Model::List* list = static_cast<Model::List*> (model->createRoot("List"));

	model->beginModification(list, "set");
	TestNodes::BinaryNode* first = new TestNodes::BinaryNode();
	list->append(first);
	TestNodes::BinaryNode* second = new TestNodes::BinaryNode();
	list->append(second);
	Model::Text* third = new Model::Text();
	list->append(third);

	first->name()->set("First node");
	TestNodes::BinaryNode* left = new TestNodes::BinaryNode();
	first->setLeft(left);
	TestNodes::BinaryNode* right = new TestNodes::BinaryNode();
	first->setRight(right);
	left->name()->set("left node");
	right->name()->set("right node");

	second->name()->set("Empty node");

	third->set("Some independent text");

	list->append(new TestBoxNode("someText"));
	list->append(new TestBoxNode("stretch", true));

	model->endModification();

	auto top = new RootItem(list);
	auto scene = VisualizationManager::instance().mainScene();
	scene->addTopLevelItem( top );
	QApplication::processEvents();

	VList* l = dynamic_cast<VList*> (top->item());
	l->itemAt<VExtendable>(1)->setExpanded(false);
	scene->scheduleUpdate();
	scene->listenToModel(model);

	CHECK_CONDITION(scene);
}
static util::StringVector convertActivationsToGraphemeLabels(matrix::Matrix&& activations,
    const model::Model& model)
{
    assert(activations.size().size() >= 3);

    if(activations.size().size() > 3)
    {
        activations = reshape(activations,
            {activations.size().front(),
             activations.size()[1],
             activations.size().product() / (activations.size().front() * activations.size()[1])});
    }

    size_t timesteps     = activations.size()[2];
    size_t miniBatchSize = activations.size()[1];
    size_t graphemes     = activations.size()[0];

    util::StringVector labels;

    for(size_t miniBatch = 0; miniBatch < miniBatchSize; ++miniBatch)
    {
        std::string currentLabel;

        size_t currentGrapheme = graphemes;

        for(size_t timestep = 0; timestep < timesteps; ++timestep)
        {
            size_t maxGrapheme = 0;
            double maxValue    = std::numeric_limits<double>::min();

            for(size_t grapheme = 0; grapheme < graphemes; ++grapheme)
            {
                if(activations(grapheme, miniBatch, timestep) >= maxValue)
                {
                    maxValue    = activations(grapheme, miniBatch, timestep);
                    maxGrapheme = grapheme;
                }
            }

            if(maxGrapheme != currentGrapheme)
            {
                currentGrapheme = maxGrapheme;
                auto newGrapheme = model.getOutputLabel(maxGrapheme);

                currentLabel.insert(currentLabel.end(), newGrapheme.begin(), newGrapheme.end());
            }

        }

        labels.push_back(currentLabel);
    }

    return labels;
}
Exemple #15
0
TEST(InteractionBase, TextSelect)
{
	Scene* scene = new Scene();

	Model::Model* model = new Model::Model();
	Model::List* list = static_cast<Model::List*> (model->createRoot("List"));

	model->beginModification(list, "set");
	TestNodes::BinaryNode* first = new TestNodes::BinaryNode();
	list->append(first);
	TestNodes::BinaryNode* second = new TestNodes::BinaryNode();
	list->append(second);
	Model::Text* third = new Model::Text();
	list->append(third);

	first->name()->set("First node");
	TestNodes::BinaryNode* left = new TestNodes::BinaryNode();
	first->setLeft(left);
	TestNodes::BinaryNode* right = new TestNodes::BinaryNode();
	first->setRight(right);
	left->name()->set("left node");
	right->name()->set("right node");

	second->name()->set("Empty node");

	third->set("Some independent text");
	model->endModification();

	VList* l = dynamic_cast<VList*> (scene->renderer()->render(nullptr, list));
	scene->addTopLevelItem(l);
	scene->scheduleUpdate();
	QApplication::processEvents();

	l->at<VExtendable>(0)->setExpanded();
	scene->scheduleUpdate();
	scene->listenToModel(model);

	// Create view
	MainView* view = new MainView(scene);
	CHECK_CONDITION(view != nullptr);
}
Exemple #16
0
	void handleKeyPressed( ::sf::Keyboard::Key code )
	{
		switch( code )
		{
		case ::sf::Keyboard::W:
			m_model.setThrustOn( true, 0 );
		break;
		case ::sf::Keyboard::S:
			m_model.setBackThrustOn( true, 0 );
		break;
		case ::sf::Keyboard::A:
			m_model.setLeftThrustOn( true, 0 );
		break;
		case ::sf::Keyboard::D:
			m_model.setRightThrustOn( true, 0 );
		break;
		case ::sf::Keyboard::Q:
			m_model.setCCWRotOn( true, 0 );
		break;
		case ::sf::Keyboard::E:
			m_model.setCRotOn( true, 0 );
		break;

		default:
		break;
		}
	}
TEST(FilePersistence, SaveList)
{
	QString testDir = QDir::tempPath() + "/Envision/FilePersistence/tests";
	Model::Model model;
	FileStore store;
	store.setBaseFolder(testDir);

	TestNodes::PartialList* root = dynamic_cast<TestNodes::PartialList*> (model.createRoot("PartialList"));

	model.beginModification(root, "create ");
	Model::Text* one = new Model::Text();
	one->set("one");
	root->list()->append(one);
	Model::Text* two = new Model::Text();
	two->set("two");
	root->list()->append(two);
	Model::Text* three = new Model::Text();
	three->set("three");
	root->list()->append(three);
	Model::Text* four = new Model::Text();
	four->set("four");
	root->list()->append(four);
	model.endModification();

	model.setName("partial");
	model.save(&store);

	CHECK_TEXT_FILES_EQUAL(":/FilePersistence/test/persisted/partial/partial", testDir + "/partial/partial");
}
Exemple #18
0
TEST(FilePersistence, SaveMultipleUnits)
{
	QString testDir = QDir::tempPath() + QDir::toNativeSeparators("/Envision/FilePersistence/tests");
	Model::Model model;
	FileStore store;
	store.setBaseFolder(testDir);

	TestNodes::BinaryNode* root = dynamic_cast<TestNodes::BinaryNode*> (model.createRoot("BinaryNode"));

	model.beginModification(root, "set title");
	root->name()->set("Root");
	TestNodes::BinaryNode* left = root->setLeft<TestNodes::BinaryNodePersistenceUnit>();
	TestNodes::BinaryNode* right = root->setRight<TestNodes::BinaryNode>();

	left->name()->set("Left child");
	TestNodes::BinaryNode* leftleft = left->setLeft<TestNodes::BinaryNode>();
	leftleft->name()->set("in a new unit");
	right->name()->set("Right child");
	model.endModification();

	model.setName("units");
	model.save(&store);
	CHECK_TEXT_FILES_EQUAL(":/FilePersistence/test/persisted/units/units", testDir + "/units/units");
	CHECK_TEXT_FILES_EQUAL(":/FilePersistence/test/persisted/units/2", testDir + "/units/2");
}
static util::StringVector convertActivationsToLabels(matrix::Matrix&& activations,
    const model::Model& model)
{
    if(model.hasAttribute("UsesGraphemes") && model.getAttribute<bool>("UsesGraphemes"))
    {
        return convertActivationsToGraphemeLabels(std::move(activations), model);
    }

    if(activations.size().size() > 2)
    {
        activations = reshape(activations,
            {activations.size().front(),
             activations.size().product() / activations.size().front()});
    }

    size_t samples = activations.size()[1];
    size_t columns = activations.size()[0];

    util::StringVector labels;

    for(size_t sample = 0; sample < samples; ++sample)
    {
        size_t maxColumn = 0;
        double maxValue  = 0.0f;

        for(size_t column = 0; column < columns; ++column)
        {
            if(activations(column, sample) >= maxValue)
            {
                maxValue  = activations(column, sample);
                maxColumn = column;
            }
        }

        labels.push_back(model.getOutputLabel(maxColumn));
    }

    return labels;
}
Exemple #20
0
TEST(FilePersistence, LoadingTypedList)
{
	QString testDir = ":/FilePersistence/test/persisted";
	Model::Model model;
	FileStore store;
	store.setBaseFolder(testDir);

	model.load(&store, "typedList");
	Model::TypedList<Model::Text>* list = dynamic_cast<Model::TypedList<Model::Text>*> (model.root());
	CHECK_CONDITION(list != nullptr);

	CHECK_STR_EQUAL("TypedListOfText", list->typeName() );
	CHECK_INT_EQUAL(2, list->size());

	Model::Text* one = list->at(0);
	Model::Text* two = list->at(1);

	CHECK_CONDITION(one != nullptr);
	CHECK_STR_EQUAL("one", one->get());

	CHECK_CONDITION(two != nullptr);
	CHECK_STR_EQUAL("two", two->get());
}
 void ForwardTranslator::logUntranslatedObjects(const model::Model& model)
 {
   auto allModelObjects = model.modelObjects();
   for(const auto & mo : allModelObjects) {
     // If mo is not in m_translatedObjects
     if(m_translatedObjects.find(mo.handle()) == m_translatedObjects.end()) {
       // If mo.iddObjectType is not int the m_ignoreTypes list
       if(std::find(m_ignoreTypes.begin(),m_ignoreTypes.end(),mo.iddObjectType()) == m_ignoreTypes.end()) {
         // If mo is not in the m_ignoreObjects list
         if(std::find(m_ignoreObjects.begin(),m_ignoreObjects.end(),mo.handle()) == m_ignoreObjects.end()) {
           LOG(Error,mo.briefDescription() << " was not translated.");
         } 
       }
     }
   }
 }
TEST(FilePersistence, ReSaveList)
{
	QString srcDir(":/FilePersistence/test/persisted");
	QString destDir(QDir::tempPath() + "/Envision/FilePersistence/tests");

	QFile src(srcDir + "/partial/partial");
	QFile dest(destDir + "/partialResave/partialResave");

	if (dest.exists())
	{
		bool removed = dest.remove();
		CHECK_CONDITION(removed);
	}

	if (!QDir(destDir + "/partialResave").exists())
	{
		bool createdDir = QDir().mkpath(destDir + "/partialResave");
		CHECK_CONDITION(createdDir);
	}
	bool copied = src.copy(dest.fileName());
	CHECK_CONDITION(copied);

	bool permissionOk = dest.setPermissions(QFile::ReadOwner | QFile::WriteOwner);
	CHECK_CONDITION(permissionOk);

	Model::Model model;
	FileStore store;
	store.setBaseFolder(destDir);

	model.load(&store, "partialResave");
	TestNodes::PartialList* root = dynamic_cast<TestNodes::PartialList*> (model.root());

	CHECK_CONDITION(root->list()->isFullyLoaded() == false);

	model.beginModification(root->list(), "fake modification ");
	model.endModification();

	CHECK_CONDITION(root->list()->isFullyLoaded() == false);
	model.setName("partialResave");
	model.save(&store);
	CHECK_CONDITION(root->list()->isFullyLoaded() == false);

	CHECK_TEXT_FILES_EQUAL(":/FilePersistence/test/persisted/partialResave/partialResave", destDir + "/partialResave/partialResave");
}
Exemple #23
0
TEST(FilePersistence, SaveRootOnly)
{
	QString testDir = QDir::tempPath() + "/Envision/FilePersistence/tests";
	Model::Model model;
	FileStore store;
	store.setBaseFolder(testDir);

	TestNodes::BinaryNode* root = dynamic_cast<TestNodes::BinaryNode*> (model.createRoot("BinaryNode"));

	model.beginModification(root->name(), "set title");
	root->name()->set("Title");
	model.endModification();

	model.setName("rootOnly");
	model.save(&store);

	CHECK_TEXT_FILES_EQUAL(":/FilePersistence/test/persisted/rootOnly/rootOnly", testDir + "/rootOnly/rootOnly");
}
Exemple #24
0
TEST(FilePersistence, SavingTypedList)
{
	QString testDir = QDir::tempPath() + "/Envision/FilePersistence/tests";
	Model::Model model;
	FileStore store;
	store.setBaseFolder(testDir);

	Model::TypedList<Model::Text>* list = dynamic_cast<Model::TypedList<Model::Text>*> (model.createRoot("TypedListOfText"));

	model.beginModification(list, "create");
	Model::Text* one = new Model::Text();
	one->set("one");
	list->append(one);
	Model::Text* two = new Model::Text();
	two->set("two");
	list->append(two);
	model.endModification();

	model.setName("typedList");
	model.save(&store);

	CHECK_TEXT_FILES_EQUAL(":/FilePersistence/test/persisted/typedList/typedList", testDir + "/typedList/typedList");
}
Exemple #25
0
TEST(OOModel, JavaLibraryAndHelloWorldTest)
{
	Model::Model model;
	Project* prj = dynamic_cast<Project*> (model.createRoot("Project"));

	model.beginModification(prj, "build simple java library and a hello world app");
	prj->setName("HelloWorld");

	// Build a simple Java Library
	Library* java = prj->libraries()->append<Library>();
	java->setName("Java");

	Class* string = java->classes()->append<Class>();
	string->setName("String");
	string->setVisibility(Visibility::PUBLIC);

	Module* io = java->modules()->append<Module>();
	io->setName("io");

	Class* printstream = io->classes()->append<Class>();
	printstream->setName("PrintStream");
	printstream->setVisibility(Visibility::PUBLIC);

	Method* println = printstream->methods()->append<Method>();
	println->setName("println");
	println->setVisibility(Visibility::PUBLIC);

	FormalArgument* arg = println->arguments()->append<FormalArgument>();
	arg->setName("x");
	NamedType* argType = arg->setType<NamedType>();
	argType->type()->ref()->set("class:String");

	Class* system = java->classes()->append<Class>();
	system->setName("System");
	system->setVisibility(Visibility::PUBLIC);
	Field* out = system->fields()->append<Field>();
	out->setName("out");
	out->setVisibility(Visibility::PUBLIC);
	out->setStorageSpecifier(StorageSpecifier::CLASS_VARIABLE);
	NamedType* outtype = out->setType<NamedType>();
	outtype->type()->ref()->set("class:PrintStream");
	outtype->type()->setPrefix<ReferenceExpression>()->ref()->set("mod:io");

	// Build a simple HelloWorld Application
	Class* hello = prj->classes()->append<Class>();
	hello->setName("HelloWorld");
	hello->setVisibility(Visibility::PUBLIC);
	Method* main = hello->methods()->append<Method>();

	main->setName("main");
	main->setVisibility(Visibility::PUBLIC);
	main->setStorageSpecifier(StorageSpecifier::CLASS_VARIABLE);
	//TODO make an array argument

	MethodCallStatement* callPrintln = main->items()->append<MethodCallStatement>();
	StringLiteral* helloStr = callPrintln->arguments()->append<StringLiteral>();
	helloStr->setValue("Hello World");
	callPrintln->ref()->set("met:println");

	VariableAccess* va = callPrintln->setPrefix<VariableAccess>();
	va->ref()->set("field:out");

	ReferenceExpression* ref = va->setPrefix<ReferenceExpression>();
	ref->ref()->set("lib:Java,class:System");

	model.endModification();

	CHECK_STR_EQUAL("Java", java->name());
	CHECK_CONDITION(callPrintln->methodDefinition() != nullptr);
	CHECK_CONDITION(callPrintln->methodDefinition() == println);
}