Esempio n. 1
0
        public void CanCorrectlyBuildGraph1()
        {
            var builder = new ContainerBuilder();

            builder.RegisterType <A1>().SingleInstance();
            builder.RegisterType <CD1>().As <IC1, ID1>().SingleInstance();
            builder.RegisterType <E1>().SingleInstance();
            builder.Register(ctr => new B1(ctr.Resolve <A1>()));

            var target = builder.Build();

            E1  e = target.Resolve <E1>();
            A1  a = target.Resolve <A1>();
            B1  b = target.Resolve <B1>();
            IC1 c = target.Resolve <IC1>();
            ID1 d = target.Resolve <ID1>();

            Assert.IsInstanceOf <CD1>(c);
            CD1 cd = (CD1)c;

            Assert.AreSame(a, b.A);
            Assert.AreSame(a, cd.A);
            Assert.AreNotSame(b, cd.B);
            Assert.AreSame(c, e.C);
            Assert.AreNotSame(b, e.B);
            Assert.AreNotSame(e.B, cd.B);
        }
 public void HasInterfaces()
 {
     IA  a   = A.Create();
     IB  b   = B.Create();
     IC1 c1  = C1.Create();
     IA  ac  = c1;
     IC2 c2  = C2.Create();
     IA  ac2 = c2;
 }
Esempio n. 3
0
 public E1(B1 b, IC1 c)
 {
     B = b;
     C = c;
 }
Esempio n. 4
0
 public E1(B1 b, IC1 c)
 {
     B = b;
     C = c;
 }
Esempio n. 5
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void main(String[] args) throws java.io.IOException
    public static void Main(string[] args)
    {
        string str = null; string strng = null; string str1 = null; string line = null; string line1 = null; string[] splitLine = null;
        int    j = 0, k = 0;

        IC1 sy = new IC1();

        // reading input file
        StreamReader fr = new StreamReader("Input1.txt");
        //StreamReader br = new StreamReader(fr);
        StreamReader fr2 = new StreamReader("Input1.txt");
        //StreamReader br2 = new StreamReader(fr2);

        // reading parsing table
        StreamReader fr1 = new StreamReader("Parse.csv");

        //StreamReader br1 = new StreamReader(fr1);
        line = fr1.ReadLine();
        // loading parse table in an array
        j = 0;
        while ((line = fr1.ReadLine()) != null)
        {
            splitLine = line.Split(",", true);
            k         = 0;
            for (int i = 1; i < splitLine.Length; i++)
            {
                sy.parTable[j][k] = splitLine[i];
                k++;
            }
            j++;
        }

        for (int g = 0; g < sy.parTable.Length; g++)
        {
            Console.Write(g + "\t");
            for (int h = 0; h < splitLine.Length; h++)
            {
                Console.Write(sy.parTable[g][h] + "\t");
            }
            Console.WriteLine();
        }
        Console.WriteLine("\nCode Gen\n");
        sy.st.Push("0");
        inputString.Push("$");
        IC1.value = "started";

//		System.out.print("\n\nStack\tSymbol\tInput String\tAction\n");
//		System.out.print(Arrays.toString(sy.st.toArray()) + "\t");
//		System.out.print(Arrays.toString(sy.symbol.toArray()) + "\t");
//		System.out.print(Arrays.toString(inputString.toArray()) + "\t");

        // execute token wise
        strng = fr2.ReadLine();
        // str = br.ReadLine();
        while ((str = fr.ReadLine()) != null)
        {
            if ((fr2.ReadLine() == null))
            {
                readOneLine = 1;
            }
            string token = sy.lex(str);
        }
        if (value.Equals("ACCEPT"))
        {
            Console.WriteLine("STRING ACCEPTED");
        }
        else
        {
            Console.WriteLine("STRING REJECTED");
        }
    }
Esempio n. 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static void main(String[] args) throws java.io.IOException
	public static void Main(string[] args)
	{

		string str = null; string strng = null; string str1 = null; string line = null; string line1 = null; string[] splitLine = null;
		int j = 0, k = 0;

		IC1 sy = new IC1();

		// reading input file
		StreamReader fr = new StreamReader("Input1.txt");
		//StreamReader br = new StreamReader(fr);
		StreamReader fr2 = new StreamReader("Input1.txt");
		//StreamReader br2 = new StreamReader(fr2);

		// reading parsing table
		StreamReader fr1 = new StreamReader("Parse.csv");
		//StreamReader br1 = new StreamReader(fr1);
		line = fr1.ReadLine();
		// loading parse table in an array
		j = 0;
		while ((line = fr1.ReadLine()) != null)
		{
			splitLine = line.Split(",", true);
			k = 0;
			for (int i = 1; i < splitLine.Length; i++)
			{
				sy.parTable[j][k] = splitLine[i];
				k++;
			}
			j++;
		}

		for (int g = 0; g < sy.parTable.Length; g++)
		{
			Console.Write(g + "\t");
			for (int h = 0; h < splitLine.Length; h++)
			{
				Console.Write(sy.parTable[g][h] + "\t");
			}
			Console.WriteLine();
		}
		Console.WriteLine("\nCode Gen\n");
		sy.st.Push("0");
		inputString.Push("$");
		IC1.value = "started";

//		System.out.print("\n\nStack\tSymbol\tInput String\tAction\n");
//		System.out.print(Arrays.toString(sy.st.toArray()) + "\t");
//		System.out.print(Arrays.toString(sy.symbol.toArray()) + "\t");
//		System.out.print(Arrays.toString(inputString.toArray()) + "\t");

		// execute token wise
		strng = fr2.ReadLine();
		// str = br.ReadLine();
		while ((str = fr.ReadLine()) != null)
		{
				if ((fr2.ReadLine() == null))
				{
				readOneLine = 1;
				}
			string token = sy.lex(str);
		}
		if (value.Equals("ACCEPT"))
		{
			Console.WriteLine("STRING ACCEPTED");
		}
		else
		{
			Console.WriteLine("STRING REJECTED");
		}
	}
Esempio n. 7
0
 public E1(B1 b, IC1 c)
 {
     this.B = b;
     this.C = c;
 }