void Preferences::onChangeHedgeSelection(int) {
            fl::Engine* engine = Model::Default()->engine();
            if (ui->ckx_any->isChecked() and not engine->hasHedge(Any().name()))
                engine->addHedge(new Any);
            else if (not ui->ckx_any->isChecked() and engine->hasHedge(Any().name()))
                delete engine->removeHedge(Any().name());

            if (ui->ckx_extremely->isChecked() and not engine->hasHedge(Extremely().name()))
                engine->addHedge(new Extremely);
            else if (not ui->ckx_extremely->isChecked() and engine->hasHedge(Extremely().name()))
                delete engine->removeHedge(Extremely().name());

            if (ui->ckx_not->isChecked() and not engine->hasHedge(Not().name()))
                engine->addHedge(new Not);
            else if (not ui->ckx_not->isChecked() and engine->hasHedge(Not().name()))
                delete engine->removeHedge(Not().name());

            if (ui->ckx_seldom->isChecked() and not engine->hasHedge(Seldom().name()))
                engine->addHedge(new Seldom);
            else if (not ui->ckx_seldom->isChecked() and engine->hasHedge(Seldom().name()))
                delete engine->removeHedge(Seldom().name());

            if (ui->ckx_somewhat->isChecked() and not engine->hasHedge(Somewhat().name()))
                engine->addHedge(new Somewhat);
            else if (not ui->ckx_somewhat->isChecked() and engine->hasHedge(Somewhat().name()))
                delete engine->removeHedge(Somewhat().name());

            if (ui->ckx_very->isChecked() and not engine->hasHedge(Very().name()))
                engine->addHedge(new Very);
            else if (not ui->ckx_very->isChecked() and engine->hasHedge(Very().name()))
                delete engine->removeHedge(Very().name());

            Window::mainWindow()->fixDependencies();
        }
Example #2
0
void circuits( SD sd, Signal Init, Signal Clock, 
  Signal w, Signal x, Signal y, Signal z )
{
  Module( (sd, "circuits"), (Init, Clock), (w, x, y, z) );

  // Insert your declarations for any auxiliary Signals here
  
  Signal W, X, Y, Z;

  // Insert your DFFs here
  
  Dff( SD("1b"), ( Init, W, Clock, Zero ), w );
  Dff( SD("2b"), ( Zero, X, Clock, Init ), x );
  Dff( SD("3b"), ( Init, Y, Clock, Zero ), y );
  Dff( SD("4b"), ( Zero, Z, Clock, Init ), z );

  // Insert your combinational logic here (Not, And, Or gates)
  
  Signal notx, noty, notz;
  Not ( SD(sd,"1d"), x, notx );
  Not ( SD(sd,"2d"), y, noty );
  Not ( SD(sd,"3d"), z, notz );
  
  Signal and1, and2, and3, and4;
  And ( SD(sd,"1e"), (notx, noty), and1 );
  And ( SD(sd,"2e"), (x, notz), and2 );                                        
  And ( SD(sd,"3e"), (w, y), and3 ); 
  And ( SD(sd,"4e"), (noty, notz), and4 );
  
  Or ( SD(sd,"1f"), (and1, and1), W ); 
  Or ( SD(sd,"2f"), (and2, and3), X ); 
  Or ( SD(sd,"3f"), (z, z), Y ); 
  Or ( SD(sd,"4f"), (and4, and4), Z ); 

}
Example #3
0
void alu(SD(sd),
   const Signals& A,
   const Signals& B,
   const Signal& Cin,
   const Signal& Ainvert,
   const Signal& Binvert,
   const Signal& Unsgn,
   const Signals& Op,

   const Signals& Res,
   const Signal& C,
   const Signal& V)
{
   Module((sd, "32 Bit ALU"),
      (A,B,Cin,Ainvert,Binvert,Unsgn,Op),
      (Res,C,V)
   );

   Signal Cout(NUM_BITS);

   Signal lessIn;
   Signal lessOut;

   Signal notV;
   Signal notMSB;
   Signal notUnsgn;

   Signal lessJunk(NUM_BITS-1);
   Signal set;
   Signal setIntrm(3);

   Signal Prod1;
   Signal Prod2;

   oneBitALU(SD(sd, "1d"), A[0], B[0], Cin, lessIn, Ainvert, Binvert, Op,
    Res[0], Cout[0], lessJunk[0]);

   for (int i = 1; i < NUM_BITS-1; ++i)
      oneBitALU(SD(sd,"1d"), A[i], B[i], Cout[i-1], Zero, Ainvert, Binvert, Op,
       Res[i], Cout[i], lessJunk[i]);

   oneBitALU(SD(sd,"1d"), A[NUM_BITS-1], B[NUM_BITS-1], Cout[NUM_BITS-2], Zero,
    Ainvert, Binvert, Op, Res[NUM_BITS-1], C, lessOut);

   Not(SD(sd, "1d"), V, notV);
   Not(SD(sd, "1d"), Res[NUM_BITS-1], notMSB);
   Not(SD(sd, "1d"), Unsgn, notUnsgn);

   And(SD(sd, "1d"), (notUnsgn, notV, Res[NUM_BITS-1]), setIntrm[0]);
   And(SD(sd, "1d"), (notUnsgn, V, notMSB), setIntrm[1]);
   And(SD(sd, "1d"), (Unsgn, V), setIntrm[2]);

   Or(SD(sd, "1d"), setIntrm, set);
   And(SD(sd, "1d"), (set, lessOut), lessIn);

   Iand(SD(sd, "1d"), (Res[NUM_BITS-1]), (A[NUM_BITS-1],B[NUM_BITS-1]), Prod1);
   Iand(SD(sd, "1d"), (A[NUM_BITS-1], B[NUM_BITS-1]), (Res[NUM_BITS-1]), Prod2);
   Or(SD(sd, "1d"), (Prod1, Prod2), V);
}
Example #4
0
func Flacker()
{
  if(Not(Random(15))) And(CastObjects(SU3V,Sum(1,Random(1)),Sum(5,Random(15)),Sum(-14,Random(28)),Sum(1,Random(2))),Sound("Spark*"));
  if(Not(Random(2))) return(0);
  if(Random(6)) return(ObjectSetAction(Local(0),"Neon")&&SetAction("FlackerAn"));
  if(Random(6)) return(ObjectSetAction(Local(0),"Aus")&&SetAction("FlackerAus"));
  return(1);
}
Example #5
0
static Node *
bin_minimal(Node *ptr)
{       if (ptr)
	switch (ptr->ntyp) {
	case IMPLIES:
		return tl_nn(OR, Not(ptr->lft), ptr->rgt);
	case EQUIV:
		return tl_nn(OR, 
			     tl_nn(AND,dupnode(ptr->lft),dupnode(ptr->rgt)),
			     tl_nn(AND,Not(ptr->lft),Not(ptr->rgt)));
	}
	return ptr;
}
Example #6
0
TEST_F(VanishesBeforeTest, Dimensionless) {
  double const y = 3000.0 * std::numeric_limits<double>::epsilon();
  EXPECT_THAT(y, VanishesBefore(1000.0, 6));
  EXPECT_THAT(2 * y, Not(VanishesBefore(1000.0, 6)));
  double const δy = e / 100.0;
  double e_accumulated = 0.0;
  for (int i = 1; i <= 100.0; ++i) {
    e_accumulated += δy;
  }
  EXPECT_THAT(e_accumulated, Ne(e));
  EXPECT_THAT(e_accumulated - e, Not(VanishesBefore(e, 4)));
  EXPECT_THAT(e_accumulated - e, VanishesBefore(e, 1));
}
Example #7
0
TEST_F(VanishesBeforeTest, Quantity) {
  Speed v1 = 1 * Knot;
  Speed const v2 = 3 * v1 * std::numeric_limits<double>::epsilon();
  EXPECT_THAT(v2, VanishesBefore(v1, 3));
  EXPECT_THAT(2 * v2, Not(VanishesBefore(v1, 3)));
  Speed const δv = v1 / 100;
  Speed v_accumulated;
  for (int i = 1; i <= 100; ++i) {
    v_accumulated += δv;
  }
  EXPECT_THAT(v_accumulated, Ne(v1));
  EXPECT_THAT(v_accumulated - v1, Not(VanishesBefore(v1, 8)));
  EXPECT_THAT(v_accumulated - v1, VanishesBefore(v1, 4));
}
void circuits( SD sd, Signal Init, Signal Clock, 
  Signal w, Signal x, Signal y, Signal z )
{
  Module( (sd, "circuits"), (Init, Clock), (w, x, y, z) );

  // Insert your declarations for any auxiliary Signals here
  Signal notw, notx, noty, notz, W, X, Y, Z;
  // Insert your DFFs here
  Dff (SD(sd,"2g"), (Init, W, Clock, Zero), w);
  Dff (SD(sd,"3g"), (Zero, X, Clock, Init), x);
  Dff (SD(sd,"4g"), (Init, Y, Clock, Zero), y);
  Dff (SD(sd,"5g"), (Zero, Z, Clock, Init), z);

  // Insert your combinational logic here (Not, And, Or gates)
  Not (SD(sd,"2b"), w, notw);
  Not (SD(sd,"3b"), x, notx);
  Not (SD(sd,"4b"), y, noty);
  Not (SD(sd,"5b"), z, notz);



  // W = wx + yz + wy' 
  Signal wfirst, wsecond, wthird;
  And (SD(sd, "2c"), (w, x), wfirst);
  And (SD(sd, "3c"), (y, z), wsecond);
  And (SD(sd, "4c"), (w, noty), wthird);
  Or (SD(sd, "5c"), (wfirst, wsecond, wthird), W);


  // X = xz' + wz + wy
  Signal xfirst, xsecond, xthird;
  And (SD(sd, "2d"), (x, notz), xfirst);
  And (SD(sd, "3d"), (w, z), xsecond);
  And (SD(sd, "4d"), (w, y), xthird);
  Or (SD(sd, "6d"), (xfirst, xsecond, xthird), X);

  // Y = y'z + xy + wy'
  Signal yfirst, ysecond, ythird;
  And (SD(sd, "2e"), (noty, z), yfirst);
  And (SD(sd, "3e"), (x, y), ysecond);
  And (SD(sd, "4e"), (w, noty), ythird); 
  Or (SD(sd, "5e"), (yfirst, ysecond, ythird), Y);

  // Z = wx + w'z' + x'y'z 
  Signal zfirst, zsecond, zthird;
  And (SD(sd, "2f"), (w, x), zfirst);
  And (SD(sd, "3f"), (notw, notz), zsecond);
  And (SD(sd, "4f"), (notx, noty, z), zthird);
  Or (SD(sd, "5f"), (zfirst, zsecond, zthird), Z);
}
void simnet()
{
  Signal w, x, y, z, Present, a, b, c, d, e, f, g;
  Signal Strobe(1);
  Signal ResetA(1);
  Signal ResetB(1);
  

  Pulser ((SD("1a"), "r -- Reset counter"), ResetA, 'r',10000);
  Pulser ((SD("2a"), "s -- Strobe counter"), Strobe, 's', 10000);

  Not(SD("1b"), ResetA, ResetB); 

  Counter((SD("1c-2c"), "4-bit counter"), (ResetB, Strobe), (w,x,y,z));

 circuits( SD("1d-4d"), w, x, y, z, Present, a, b, c, d, e, f, g);

  Probe(( SD("1g"),"Present"), Present );
  Probe( (SD("2f-2h"),"a"), a );
  Probe( (SD("3f-4f"),"f"), f );
  Probe( (SD("3h-4h"),"b"), b );  
  Probe( (SD("5f-5h"),"g"), g );
  Probe( (SD("6f-7f"),"e"), e);
  Probe( (SD("6h-7h"),"c"), c);
  Probe( (SD("8f-8h"),"d"), d); 
}
TEST_F(BodyCentredNonRotatingDynamicFrameTest, Serialization) {
  serialization::DynamicFrame message;
  small_frame_->WriteToMessage(&message);

  EXPECT_TRUE(message.HasExtension(
      serialization::BodyCentredNonRotatingDynamicFrame::extension));
  auto const extension = message.GetExtension(
      serialization::BodyCentredNonRotatingDynamicFrame::extension);
  EXPECT_TRUE(extension.has_centre());
  EXPECT_EQ(1, extension.centre());

  auto const read_small_frame =
      DynamicFrame<ICRS, Small>::ReadFromMessage(message, ephemeris_.get());
  EXPECT_THAT(read_small_frame, Not(IsNull()));

  Instant const t = t0_ + period_;
  DegreesOfFreedom<Small> const point_dof =
      {Displacement<Small>({10 * Metre, 20 * Metre, 30 * Metre}) +
           Small::origin,
       Velocity<Small>({3 * Metre / Second,
                        2 * Metre / Second,
                        1 * Metre / Second})};
  EXPECT_EQ(small_frame_->GeometricAcceleration(t, point_dof),
            read_small_frame->GeometricAcceleration(t, point_dof));
}
Example #11
0
void circuit( SD sd, Signal a, Signal b, Signal c, Signal d, Signal F )
{
  Module( (sd, "circuit"), (a, b, c, d), (F) );
 
  Signal notb, notc, notd;
  Signal and1, and2;                      // Intermediate objects 
 
  Not ( SD(sd,"2a"), b, notb );           // NOT gates
  Not ( SD(sd,"3a"), c, notc );
  Not ( SD(sd,"4a"), d, notd );
 
  And ( SD(sd,"2c"), (a, notb), and1 );   // AND gates                                     
  And ( SD(sd,"3c"), (b, notc, notd), and2 );    
 
  Or ( SD(sd,"2e"), (and1, and2), F );    // OR gate
}
void simnet()
{
  Signal w, x, y, z, Present, a, b, c, d, e, f, g;

  Signal Strobe (1);
  Signal ResetA (1);
  Signal ResetB (1);
  Signal Output (4);

  Pulser ((SD("1a"), "r -- Reset counter"),  ResetA, 'r', 10000);
  Pulser ((SD("2a"), "s -- Strobe counter"), Strobe, 's', 10000);

  Not (SD("1b"), ResetA, ResetB);

  Counter ((SD("1c-2c"), "4-bit counter"), (ResetB, Strobe),(w,x,y,z));

  circuits( SD("1d-4d"), w, x, y, z, Present, a, b, c, d, e, f, g);

  Probe((SD("0d"), "Present"), Present);
  Probe((SD("1f"), "a"), a);
  Probe((SD("2g"), "b"), b);
  Probe((SD("4g"), "c"), c);
  Probe((SD("5f"), "d"), d);
  Probe((SD("4e"), "e"), e);
  Probe((SD("2e"), "f"), f);
  Probe((SD("3f"), "g"), g);
}
Example #13
0
int main(int argc, char **argv){

    QApplication app(argc, argv);

    notepad Not(&app);//constroi
    Not.show();//mostra
    Not.setarTexto("texto");

    janela win;


    welcome_window wwin;
    wwin.setText("OK");
    wwin.show();
    win.show();

    QObject::connect(&wwin,SIGNAL(clicked()),&Not, SLOT(exibirTexto()));
    QObject::connect(&wwin,SIGNAL(clicked()),&Not, SLOT(incremContador()));
    QObject::connect(&wwin,SIGNAL(clicked()),&Not, SLOT(incremContador2()));
    QObject::connect(&wwin,SIGNAL(clicked()),&Not, SLOT(setBarra()));
    //QObject::connect(&wwin,SIGNAL(clicked()),&Not, SLOT(som()));


    return app.exec();

}
TEST_F(BodySurfaceDynamicFrameTest, Serialization) {
  serialization::DynamicFrame message;
  big_frame_->WriteToMessage(&message);

  EXPECT_TRUE(message.HasExtension(
      serialization::BodySurfaceDynamicFrame::extension));
  auto const extension = message.GetExtension(
      serialization::BodySurfaceDynamicFrame::extension);
  EXPECT_TRUE(extension.has_centre());
  EXPECT_EQ(0, extension.centre());

  auto const read_big_frame =
      DynamicFrame<ICRFJ2000Equator, BigSmallFrame>::ReadFromMessage(
          ephemeris_.get(), message);
  EXPECT_THAT(read_big_frame, Not(IsNull()));

  Instant const t = t0_ + period_;
  DegreesOfFreedom<BigSmallFrame> const point_dof =
      {Displacement<BigSmallFrame>({10 * Metre, 20 * Metre, 30 * Metre}) +
           BigSmallFrame::origin,
       Velocity<BigSmallFrame>({3 * Metre / Second,
                                2 * Metre / Second,
                                1 * Metre / Second})};
  EXPECT_EQ(big_frame_->GeometricAcceleration(t, point_dof),
            read_big_frame->GeometricAcceleration(t, point_dof));
}
Example #15
0
public func Advance()
{
    // Letzten Vertex ermitteln
    var iLastVertex = GetVertexNum() - 1;
    // Einschlag im Boden
    if (GBackSemiSolid(GetVertex(iLastVertex, 0) - GetX(), GetVertex(iLastVertex, 1) - GetY()))
        return(Remove());
    // Schon über fünf Schritte fortgeschritten: Schaden an Objekten verursachen
    if (iLastVertex > 5)
        BlastObjects(GetVertex(iLastVertex, 0), GetVertex(iLastVertex, 1), 3);
    // Neuen Schritt durchführen
    if (Not(AddVertex(GetVertex(iLastVertex, 0) + Local(0) + Random(Local(1)),
                      GetVertex(iLastVertex, 1) + Local(2) + Random(Local(3)) )))
        return(Remove());
    // Anziehung an ein Zielobjekt prüfen
    var pTarget;
    iLastVertex = GetVertexNum() - 1;
    if (iLastVertex > 7)
        if (pTarget = FindObject( 0,
                                  GetVertex(iLastVertex, 0) - GetX() - 50,
                                  GetVertex(iLastVertex, 1) - GetY() - 50,
                                  100,
                                  100,
                                  OCF_AttractLightning() ))
            Attraction(pTarget);
}
Example #16
0
void TestQuery::constructor()
{
  QcSqlField field1("field1");
  QcSqlField field2("field2");
  QcSqlField field3("field3");

  check_sql(field1 == 1, "field1 = 1");
  check_sql(field1 != 1, "field1 != 1");
  check_sql(field1 < 1, "field1 < 1");
  check_sql(field1 > 1, "field1 > 1");
  check_sql(field1 <= 1, "field1 <= 1");
  check_sql(field1 >= 1, "field1 >= 1");

  // check_sql(not field1 == 1, "(NOT field1 = 1)");
  check_sql(Not(field1 == 1), "(NOT field1 = 1)");
  check_sql(field1 == 1 and field2 == 2, "(field1 = 1 AND field2 = 2)");
  check_sql(field1 == 1 or field2 == 2, "(field1 = 1 OR field2 = 2)");
  check_sql((field1 == 1 and field2 == 2) or field3 == 3,
            "((field1 = 1 AND field2 = 2) OR field3 = 3)");

  QcDatabase database; // Flavour is ANSI
  QcDatabaseTable table(&database, "table");

  check_sql(table.sql_query(), "");

  check_sql(table.sql_query().all(), "SELECT * FROM table;");
  check_sql(table.sql_query().add_column(field1).all(), "SELECT field1 FROM table;");
  check_sql(table.sql_query().add_column(field1).add_column(field2).all().filter(field1 > 1),
            "SELECT field1, field2 FROM table WHERE field1 > 1;");
  check_sql(table.sql_query().add_column(field1).add_column(field2).all().filter((field1 > 1 and field1 < 10) or field2 > 2),
            "SELECT field1, field2 FROM table WHERE ((field1 > 1 AND field1 < 10) OR field2 > 2);");
  check_sql(table.sql_query().order_by(field1).all(),
            "SELECT * FROM table ORDER BY field1;");
  check_sql(table.sql_query().order_by(field1.desc()).all(),
            "SELECT * FROM table ORDER BY field1 DESC;");

  // Fixme: ->as
  check_sql(table.sql_query().add_column(Min(field1)->as("min_field1")).all(),
            "SELECT MIN(field1) AS min_field1 FROM table;");

  // Fixme: INSERT INTO table VALUES (?, ...);
  check_sql(table.sql_query().add_column(field1).insert(),
            "INSERT INTO table (field1) VALUES (?);");
  check_sql(table.sql_query().add_column(field1).add_column(field2).insert(),
            "INSERT INTO table (field1, field2) VALUES (?, ?);");

  check_sql(table.sql_query().add_column(field1).update().filter(field1 > 1),
            "UPDATE table SET field1 = ? WHERE field1 > 1;");
  check_sql(table.sql_query().add_column(field1).add_column(field2).update().filter(field1 > 1),
            "UPDATE table SET field1 = ?, field2 = ? WHERE field1 > 1;");

  check_sql(table.sql_query().delete_().filter(field1 > 1),
            "DELETE FROM table WHERE field1 > 1;");

  check_sql(table.sql_query().add_column(ST_AsBinary(field1)).all(),
            "SELECT ST_AsBinary(field1) FROM table;");
  check_sql(table.sql_query().add_column(field1).add_column(field2, ST_GeomFromWKB()).insert(),
            "INSERT INTO table (field1, field2) VALUES (?, ST_GeomFromWKB(?));");
}
PredicateComposition::Predicate<ValueType>
PredicateComposition::OrNot( const Predicate<ValueType>& func_left,
			     const Predicate<ValueType>& func_right )
{
    return std::bind( std::logical_or<bool>(),
		      std::bind(func_left,std::placeholders::_1),
		      std::bind(Not(func_right),std::placeholders::_1) );
}
Example #18
0
 HedgeFactory::HedgeFactory() : ConstructionFactory<Hedge*>("Hedge") {
     registerConstructor("", fl::null);
     registerConstructor(Any().name(), &(Any::constructor));
     registerConstructor(Extremely().name(), &(Extremely::constructor));
     registerConstructor(Not().name(), &(Not::constructor));
     registerConstructor(Seldom().name(), &(Seldom::constructor));
     registerConstructor(Somewhat().name(), &(Somewhat::constructor));
     registerConstructor(Very().name(), &(Very::constructor));
 }
Example #19
0
 std::string CppExporter::toString(const Hedge * hedge) const {
     if (hedge->name() == Any().name()) return "new fl::Any";
     if (hedge->name() == Extremely().name()) return "new fl::Extremely";
     if (hedge->name() == Not().name()) return "new fl::Not";
     if (hedge->name() == Seldom().name()) return "new fl::Seldom";
     if (hedge->name() == Somewhat().name()) return "new fl::Somewhat";
     if (hedge->name() == Very().name()) return "new fl::Very";
     return hedge->name();
 }
 std::string CppExporter::toString(const Hedge * hedge) const {
     if (hedge->name() == Any().name()) return "new " + fl("Any");
     if (hedge->name() == Extremely().name()) return "new " + fl("Extremely");
     if (hedge->name() == Not().name()) return "new " + fl("Not");
     if (hedge->name() == Seldom().name()) return "new " + fl("Seldom");
     if (hedge->name() == Somewhat().name()) return "new " + fl("Somewhat");
     if (hedge->name() == Very().name()) return "new " + fl("Very");
     return "new " + fl(hedge->name());
 }
Example #21
0
DoSomethingDifferent()
{
	This();
	Is();
	Not();
	A();
	Love();
	Song();
}
Example #22
0
void BBTransform::insertAssume(Value* condition, Checkpoint* cp, BB* bb,
                               BB::Instrs::iterator& position,
                               bool assumePositive) {
    position = bb->insert(position, (Instruction*)condition);
    auto assume = new Assume(condition, cp);
    if (!assumePositive)
        assume->Not();
    position = bb->insert(position + 1, assume);
    position++;
};
Example #23
0
static Node *bin_minimal(Node *ptr)
{       
	Node *a, *b;

	if (ptr)
	{
		switch (ptr->ntyp) 
		{
			case IMPLIES:
				return tl_nn(OR, Not(ptr->lft), ptr->rgt);

			case EQUIV:
				a = tl_nn(AND,dupnode(ptr->lft),dupnode(ptr->rgt));
				b = tl_nn(AND,Not(ptr->lft),Not(ptr->rgt));
				return tl_nn(OR, a, b); 
		}
	}
	return ptr;
}
Example #24
0
Node *
push_negation(Node *n)
{	Node *m;

	Assert(n->ntyp == NOT, n->ntyp);

	switch (n->lft->ntyp) {
	case TRUE:
		releasenode(0, n->lft);
		n->lft = ZN;
		n->ntyp = FALSE;
		break;
	case FALSE:
		releasenode(0, n->lft);
		n->lft = ZN;
		n->ntyp = TRUE;
		break;
	case NOT:
		m = n->lft->lft;
		releasenode(0, n->lft);
		n->lft = ZN;
		releasenode(0, n);
		n = m;
		break;
	case V_OPER:
		n->ntyp = U_OPER;
		goto same;
	case U_OPER:
		n->ntyp = V_OPER;
		goto same;
#ifdef NXT
	case NEXT:
		n->ntyp = NEXT;
		n->lft->ntyp = NOT;
		n->lft = push_negation(n->lft);
		break;
#endif
	case  AND:
		n->ntyp = OR;
		goto same;
	case  OR:
		n->ntyp = AND;

same:		m = n->lft->rgt;
		n->lft->rgt = ZN;

		n->rgt = Not(m);
		n->lft->ntyp = NOT;
		m = n->lft;
		n->lft = push_negation(m);
		break;
	}

	return rewrite(n);
}
Example #25
0
//击中与击不中
void HitorMiss(double *src,int width,int height,double *se1,int se1_width,int se1_height,double *se2,int se2_width,int se2_height,double *dst,Position *se1center,Position *se2center){
    
    double *temp1=(double *)malloc(sizeof(double)*width*height);
    double *temp2=(double *)malloc(sizeof(double)*width*height);
    Erode(src, width, height, temp1, width, height, se1, se1_width, se1_height, se1center);
    Not(src, temp2, width, height);
    Erode(temp2, width, height, temp2, width, height, se2, se2_width, se2_height, se2center);
    And(temp1, temp2, dst, width, height);
    free(temp1);
    free(temp2);
}
Example #26
0
static Node *bin_minimal(Node *ptr, Miscellaneous *miscell, int *cnt, char *uform, int *tl_yychar)
{       
	Node *a, *b;

	if (ptr)
	{
		switch (ptr->ntyp) 
		{
			case IMPLIES:
				return tl_nn(OR, Not(ptr->lft), ptr->rgt, miscell);

			case EQUIV:
				a = tl_nn(AND,dupnode(ptr->lft),dupnode(ptr->rgt), miscell);
				b = tl_nn(AND,Not(ptr->lft),Not(ptr->rgt), miscell);
				return tl_nn(OR, a, b, miscell); 

		}
	}
	return ptr;
}
TEST_F(HostapdManagerTest, RespectsHiddenSetting) {
  string config = HostapdManager().CreateHostapdConfig(
        kTestInterfaceName,
        cstr2vector(kTestSsidStr),
        true,
        kTestChannel,
        HostapdManager::EncryptionType::kOpen,
        vector<uint8_t>());
  EXPECT_THAT(config, HasSubstr("ignore_broadcast_ssid=1\n"));
  EXPECT_THAT(config, Not(HasSubstr("ignore_broadcast_ssid=0\n")));
}
TEST_F(HostapdManagerTest, CorrectlyInfersHwMode) {
  string config = HostapdManager().CreateHostapdConfig(
        kTestInterfaceName,
        cstr2vector(kTestSsidStr),
        true,
        44,
        HostapdManager::EncryptionType::kOpen,
        vector<uint8_t>());
  EXPECT_THAT(config, HasSubstr("hw_mode=a\n"));
  EXPECT_THAT(config, Not(HasSubstr("hw_mode=g\n")));
}
Example #29
0
Expression *NotExp::optimize(int result)
{   Expression *e;

    e1 = e1->optimize(result);
    if (e1->isConst() == 1)
    {
	e = Not(type, e1);
    }
    else
	e = this;
    return e;
}
void circuits( SD sd, Signal w, Signal x, Signal y, Signal z, 
  Signal Present, Signal a, Signal b, Signal c, Signal d, Signal e,
  Signal f, Signal g )    
{
  Module( (sd, "circuits"), (w, x, y, z), (Present, a, b, c, d, e, f, g) );


  Signal notz, notw,notx, noty;
  Signal and1, and2, and3, and4, and5, and6, and7, and8, and9, and10, and11,and12, and13,and14;

  Not(SD(sd, "e1-f8"), z, notz);
  Not(SD(sd, "g1-h8"), w, notw);
  Not(SD(sd, "i1-j8"), x, notx); 
  Not(SD(sd, "k1-l8"), y, noty); 

  And(SD(sd,"ab-be"), (y, z, notw), and1);
  And(SD(sd,"cb-de"), (noty, notz, x, notw), and2);
  And(SD(sd,"eb-fe"), (w, notx, noty), and3);
  And(SD(sd,"gb-he"), (notw, x), and4);
  And(SD(sd,"ib-je"), (w,notx,noty), and5);
  And(SD(sd,"kb-le"), (y,z,notw), and6);
  And(SD(sd,"mb-ne"), (w,notx,noty), and7);
  And(SD(sd,"ob-pe"), (noty,notz,notw,x), and8);
  And(SD(sd,"qb-re"), (y,z,notw,x), and9);
  And(SD(sd,"sb-te"), (noty,notz,w,notx), and10);
  And(SD(sd,"ub-ve"), (notw, x,y,z), and11);
  And(SD(sd,"wb-xe"), (w,notx,noty,z),and12);


  Or(SD(sd,"bg-cl"), (and1, and2, and3), Present);
  Or(SD(sd,"dg-el"), (and4,and5),a);
  Or(SD(sd,"fg-gl"), (and6,and7),b); 
  Or(SD(sd,"hg-il"), (One, One),c );
  Or(SD(sd,"jg-kl"), (and8,and9,and10),d);
  Or(SD(sd,"lg-ml"), (and11,and12),e);
  Or(SD(sd,"og-pl"), (One, One), f);
  Or(SD(sd,"sg-tl"), (One, One), g); 

 
}