Click here to Skip to main content
15,906,766 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
my probelm is the type or name space name BufferedReadercould not be found (are u missing assembly reference or directive)


HTML
using System;
using System.Runtime.Remoting;
using System.IO;
using System.Threading;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/// 
/// <summary>
/// @author Laxman
/// </summary>
public class Master
{

	internal BufferedReader br;
	internal long volume;
	internal int velocity;
	internal string data; //variety
	internal long mmemory; //master memory
	internal int mLowEnd;
	internal int mHighEnd;
	internal long mCpuCap; // master cpu memory
	internal int mcLowEnd;
	internal int mcHighEnd;
	internal int noOfSlaves; //slaves
	internal long smemorycap; //slave memory
	internal int sLowEnd;
	internal int sHighEnd;
	internal int sRandom;
	internal int sClustered;
	internal long sCpuCap; // slave cpu memory
	internal int scLowEnd;
	internal int scHighEnd;
	internal int scRandom;
	internal int scClustered;
	internal long startTime;
	internal long endTime;

	internal Master()
	{
		try
		{
            br = new BufferedReaderInputStreamReader(System.@in);

		}
		catch (Exception e)
		{
			Console.WriteLine(e);
		}

	}

	public virtual void readInput()
	{
		try
		{
			Console.WriteLine("Volume (enter the volume of the bigdata in TB):");
            volume = Convert.ToInt64(Console.ReadLine());
			Console.WriteLine("Velocity (enter the velocity of the bigdata in bps):");
            velocity = Convert.ToInt32(Console.ReadLine());
			Console.WriteLine("Variety (enter the mix of the bigdata, the format to be determined by you):");
			data = br.readLine();
			Console.WriteLine("Master node memory (enter the memory capacity range of the master node in increments of 10GB)");
            mmemory = Convert.ToInt64(Console.ReadLine());

			Console.WriteLine("Enter the low end in GB:");
            mLowEnd = Convert.ToInt32(Console.ReadLine());
			Console.WriteLine("Enter the high end in GB:");
            mHighEnd = Convert.ToInt32(Console.ReadLine());
			Console.WriteLine("Master node CPU (enter the CPU capacity range of the master node in increments of 10GHz)");
            mCpuCap = Convert.ToInt64(Console.ReadLine());
			Console.WriteLine("Enter the low end in GHz:");
            mcHighEnd = Convert.ToInt32(Console.ReadLine());
			Console.WriteLine("Enter the high end in GHz:");
            mcLowEnd = Convert.ToInt32(Console.ReadLine());
			Console.WriteLine("Enter the number of slave nodes (1 - n):");
            noOfSlaves = Convert.ToInt32(Console.ReadLine());

			Console.WriteLine("Enter the connectivity (enter 1 to n for 1:1 to 1:n connectivity, respectively):");
			Console.WriteLine("Enter the memory capacity range of the slave nodes in increments of 10GB Enter the low end in GB:");
            smemorycap = Convert.ToInt64(Console.ReadLine());
			Console.WriteLine("Enter the low end in GB:");
            sLowEnd = Convert.ToInt32(Console.ReadLine());
			Console.WriteLine("Enter the high end in GB:");
            sHighEnd = Convert.ToInt32(Console.ReadLine());
			Console.WriteLine("Enter the memory capacity distribution (r for random, c for clustered):");
			Console.WriteLine("random");
            sRandom = Convert.ToInt32(Console.ReadLine());
			Console.WriteLine("clustered");
            sClustered = Convert.ToInt32(Console.ReadLine());
			Console.WriteLine("Enter the CPU capacity range of the slave nodes in increments of 10GHz");
            sCpuCap = Convert.ToInt64(Console.ReadLine());
			Console.WriteLine("Enter the low end in GHz:");
            scLowEnd = Convert.ToInt32(Console.ReadLine());
			Console.WriteLine("Enter the high end in GHz:");
            scHighEnd = Convert.ToInt32(Console.ReadLine());

			Console.WriteLine("Enter the CPU capacity distribution (r for random, c for clustered):");
			Console.WriteLine("random");
            scRandom = Convert.ToInt32(Console.ReadLine());
			Console.WriteLine("clustered");
            scClustered = Convert.ToInt32(Console.ReadLine());

		}
		catch (Exception e)
		{
			Console.WriteLine(e);
		}

	}

	public virtual void simulation()
	{

		try
		{
			   startTime = DateTimeHelperClass.CurrentUnixTimeMillis();

			string[] newFile = SplitFile.splitFile(new File(data), 2);

			Console.WriteLine("Slaves connected in sequencial");
			NewFileSplit nfs = new NewFileSplit();
			nfs.fileSplit(newFile[0], noOfSlaves / 2);

			Console.WriteLine("Slaves connected in Parllel");
			Filesplit fs = new Filesplit();
			fs.fileSplit(newFile[1], noOfSlaves - (noOfSlaves / 2));
			int fileCount = 0;
			for (int i = 0; i < noOfSlaves - (noOfSlaves / 2); i++)
			{

				MyThread m = new MyThread(newFile[1] + "_" + ++fileCount, noOfSlaves - (noOfSlaves / 2));
				m.Start();

			}


		}
		catch (Exception e)
		{
			Console.WriteLine(e);
		}


	}

	public virtual void viewOutput()
	{
		try
		{


			Console.WriteLine("Volume: ....." + volume);
			Console.WriteLine("Velocity: ....." + velocity);
			Console.WriteLine("Master node memory low end: ....." + mLowEnd);
			Console.WriteLine("Master node memory high end: ....." + mHighEnd);
			Console.WriteLine("Master node CPU low end: ....." + mcLowEnd);
			Console.WriteLine("Master node CPU high end: ....." + mcHighEnd);
			Console.WriteLine("Number of slave nodes: ....." + noOfSlaves);
			Console.WriteLine("Connectivity: 1:.....");
			Console.WriteLine("Slave node memory capacity low end: ....." + sLowEnd);
			Console.WriteLine("Slave node memory capacity high end: ....." + sHighEnd);
			Console.WriteLine("Slave node memory capacity distribution: ....." + sRandom + ", " + sClustered);
			Console.WriteLine("Slave node CPU capacity low end: ....." + sLowEnd);
			Console.WriteLine("Slave node CPU capacity high end: ....." + scHighEnd);
			Console.WriteLine("Slave node CPU capacity distribution: ....." + scRandom + ", " + scClustered);
			endTime = DateTimeHelperClass.CurrentUnixTimeMillis();

		}
		catch (Exception e)
		{
			Console.WriteLine(e);
		}
	}

	public virtual void calculataThroughPut()
	{
		try
		{
			Thread.Sleep(5000);
			// System.out.println("Throughput (conventional):");
			double throughput = endTime - startTime;
			double throughputCon = 300;
			Console.WriteLine("ThroughPut (conventional)" + throughputCon);
			Console.WriteLine("Throughput (bigdata):" + throughput);
			Console.WriteLine("Speedup factor ((Thput_Bigdata  - Thput_conv)/Thput_conv):   ");
			double result = ((throughput - throughputCon) / throughputCon);
			Console.Write(result);
		}
		catch (Exception e)
		{
			Console.WriteLine(e);
		}
	}

	public static void Main(string[] args)
	{
		Master m = new Master();

		m.readInput();
		m.simulation();
		m.viewOutput();
		m.calculataThroughPut();
	}
}



I want correct solution .i think using reference ,please help me.
Posted
Updated 5-Nov-13 8:00am
v4
Comments
Ron Beyer 5-Nov-13 13:24pm    
Looks like you copy/pasted some java code, BufferedReader is a java class, not a c++ one. What are you trying to do with that stream?
Ron Beyer 5-Nov-13 14:17pm    
You need to completely remove the line br = new BufferedReader.... I figured that was implied but I guess not.

1 solution

For each br.ReadLine, simply replace with:

Console.ReadLine()

BufferedReader is a java class, and System.in does not exist either. There is no reason to set up a stream in C# for reading from the console.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900