void ComponentLayoutEditor::updateFrames ()
{
    selectedComponents.deselectAll();
    frames.clear ();

    if (target != NULL)
    {
        Component* t = (Component*) target.getComponent ();
        int n = t->getNumChildComponents ();

        for (int i = 0; i < n; i++)
        {
            Component* c = t->getChildComponent (i);

            if (c)
            {
                ComponentOverlay* alias = createAlias (c);

                if (alias)
                {
                    alias->setName (c->getName());
                    setComponentBoundsProperties (alias, alias->getBounds());
                    frames.add (alias);
                    addAndMakeVisible (alias);
                }
            }
        }
    }
}
Esempio n. 2
0
void ComponentLayoutEditor::updateFrames ()
{
   int compIndex = 0;
   frames.clear ();
   
   if (target != NULL)
      //if (target && !target->hasBeenDeleted ())
   {
      Component* t = (Component*) target.getComponent ();

      int n = t->getNumChildComponents ();
      for (int i=0; i<n; i++)
      {
         Component* c = t->getChildComponent (i);
		 String type(typeid(*c).name());
		 if (c)
         {
                ChildAlias* alias = createAlias (c, type, compIndex++);
				//pass on relative X and Y's to alias components so they are plant aware...
				alias->getProperties().set("plantX", var(c->getProperties().getWithDefault(var::identifier("plantX"), 0)));
                alias->getProperties().set("plantY", var(c->getProperties().getWithDefault(var::identifier("plantY"), 0)));				
				if (alias)
                {
                frames.add (alias);
                addAndMakeVisible (alias);
                }
         }
      }
   }
}
Esempio n. 3
0
void OptimizerTest::setupExpressions() {
  literal_0_ = E::ScalarLiteral::Create(TypedValue(0),
                                        TypeFactory::GetType(kInt, false /* nullable */));
  literal_1_ = E::ScalarLiteral::Create(TypedValue(1),
                                        TypeFactory::GetType(kInt, false /* nullable */));
  alias_0_ = createAlias(literal_0_,
                         "literal_0" /* attribute_name */,
                         "dummy_table" /* relation_name */);
  alias_1_ = createAlias(literal_1_,
                         "literal_1" /* attribute_name */,
                         "dummy_table" /* relation_name */);
  attribute_reference_0_ = E::ToRef(alias_0_);
  attribute_reference_1_ = E::ToRef(alias_1_);

  filter_predicate_0_ = E::ComparisonExpression::Create(
      ComparisonFactory::GetComparison(ComparisonID::kNotEqual),
      relation_attribute_reference_0_0_,
      relation_attribute_reference_0_2_);
  filter_predicate_1_ = E::ComparisonExpression::Create(
      ComparisonFactory::GetComparison(ComparisonID::kGreater),
      relation_attribute_reference_1_0_,
      literal_0_);
  hash_join_predicate_0_1_ = E::ComparisonExpression::Create(
      ComparisonFactory::GetComparison(ComparisonID::kEqual),
      relation_attribute_reference_0_0_,
      relation_attribute_reference_1_0_);
  non_hash_join_predicate_0_1_ = E::ComparisonExpression::Create(
      ComparisonFactory::GetComparison(ComparisonID::kGreater),
      relation_attribute_reference_0_0_,
      relation_attribute_reference_1_0_);
  add_literal_0_ = E::BinaryExpression::Create(
      BinaryOperationFactory::GetBinaryOperation(BinaryOperationID::kAdd),
      relation_attribute_reference_0_0_,
      literal_0_);
  alias_add_literal_0_ = E::Alias::Create(
      optimizer_context()->nextExprId(),
      add_literal_0_,
      "add_literal_0" /* attribute_name */,
      "add_literal_0" /* attribute_alias */,
      "" /* relation_name */);
}
Esempio n. 4
0
// This function execute builtin functions
void do_it(int bi) {
	
	switch(comtab[bi].builtin) {
		case BYE: goodbye = 1;	// Set global goodbye variable to true
			break;

		case CDHOME: 
				goHome();
			break;

		case CD: 	// Go to specified path
				gotoDir(bi);
			break;

		case SETALIAS: // Adding alias to the alias table
				printf("adding alias to table\n");
				createAlias(comtab[curr_cmd].atptr->args[0], comtab[curr_cmd].atptr->args[1]);
				printf("Done adding alias to table\n");
			break;

		case UNALIAS:
				removeAlias(comtab[curr_cmd].atptr->args[0]);
			break;

		case PRINTALIAS:	// Print either a specific alias or all aliases
				if( comtab[curr_cmd].nargs == 0) {
					printf("calling\n");
					listAliases();		// Print all aliases
				}
				else {
					printAnAlias(comtab[curr_cmd].atptr->args[0]);	// Print specific alias
				}		
			break;

		case SETENV: 	// Set environment
				if( putenv( strcat(strcat(comtab[curr_cmd].atptr->args[0],"="),comtab[curr_cmd].atptr->args[1]) ) != 0) {
					printf("%s\n", strerror(errno));
				}
			break;
		case UNSETENV: 	// Removing environment variables
			if( unsetenv(comtab[bi].atptr->args[0]) == -1) {
				printf("%s\n", strerror(errno));
			}
			break;
		case PRINTENV: 	// Print environment variables
			printallEnv();
			break;
	}
}
void ComponentLayoutManager::updateFrames ()
{
    frames.clear ();

    if (target && !target->hasBeenDeleted ())
    {
        Component* t = (Component*) target->getComponent ();

        int n = t->getNumChildComponents ();
        for (int i=0; i<n; i++)
        {
            Component* c = t->getChildComponent (i);
            if (c)
            {
                ChildAlias* alias = createAlias (c);
                if (alias)
                {
                    frames.add (alias);
                    addAndMakeVisible (alias);
                }
            }
        }
    }
}
TEST_F(JoinTest, HashJoinOnSelection) {
  // Project -- HashJoin -- Project
  //                     -- Project -- Filter
  const L::HashJoinPtr hash_join =
      L::HashJoin::Create(logical_project_0_,
                          logical_project_on_filter_1_,
                          {relation_attribute_reference_0_0_},
                          {relation_attribute_reference_1_0_},
                          nullptr /* residual_predicate */,
                          L::HashJoin::JoinType::kInnerJoin);
  // References an attribute created by the left underlying project of the hash
  // join.
  const E::AliasPtr alias_on_alias_reference = E::Alias::Create(
      optimizer_context()->nextExprId(),
      E::ToRef(alias_add_literal_0_),
      "alias_on_alias_reference", /* attribute_name */
      "alias_on_alias_reference", /* attribute_alias */
      "join_test_relation" /* relation_name */);
  const E::AliasPtr alias_on_alias_reference_after_pullup =
      std::static_pointer_cast<const E::Alias>(alias_on_alias_reference->copyWithNewChildren(
          {alias_add_literal_0_->expression()} /* new_children */));
  input_logical_ = L::Project::Create(
      hash_join, {alias_on_alias_reference} /* project_expressions */);
  // Since the right Selection for the join have a filter, it will not be pulled
  // up.
  expected_physical_ = P::HashJoin::Create(
      physical_table_reference_0_,
      physical_project_on_filter_1_,
      {relation_attribute_reference_0_0_},
      {relation_attribute_reference_1_0_},
      E::PredicatePtr(),
      E::PredicatePtr(),
      {alias_on_alias_reference_after_pullup} /* project_expressions */,
      P::HashJoin::JoinType::kInnerJoin);
  EXPECT_CORRECT_PHYSICAL();

  // HashJoin -- Project
  //          -- Project
  const E::AliasPtr alias_on_attribute_reference =
      createAlias(relation_attribute_reference_1_0_, "alias_on_reference",
                  "join_test_relation");
  const L::ProjectPtr logical_project_on_attribute_reference =
      L::Project::Create(
          logical_table_reference_1_,
          {alias_on_attribute_reference} /* project_expressions */);
  const P::PhysicalPtr physical_project_on_attribute_reference =
      P::Selection::Create(
          physical_table_reference_1_,
          logical_project_on_attribute_reference->project_expressions(),
          E::PredicatePtr());
  physical_generator()->setBestPhysicalForLogical(
      logical_project_on_attribute_reference,
      physical_project_on_attribute_reference);

  // The left Project cannot be pulled up, while the right can be.
  input_logical_ = L::HashJoin::Create(logical_project_0_,
                                       logical_project_on_attribute_reference,
                                       {E::ToRef(alias_add_literal_0_)},
                                       {relation_attribute_reference_1_0_},
                                       nullptr /* residual_predicate */,
                                       L::HashJoin::JoinType::kInnerJoin);
  std::vector<E::NamedExpressionPtr> project_expressions(
      E::ToNamedExpressions(physical_project_0_->getOutputAttributes()));
  project_expressions.push_back(alias_on_attribute_reference);
  expected_physical_ =
      P::HashJoin::Create(physical_project_0_,
                          physical_table_reference_1_,
                          {E::ToRef(alias_add_literal_0_)},
                          {relation_attribute_reference_1_0_},
                          E::PredicatePtr(),
                          E::PredicatePtr(),
                          project_expressions,
                          P::HashJoin::JoinType::kInnerJoin);
  EXPECT_CORRECT_PHYSICAL();
}