public Limits( int minimumTasks, int maxmumTasks, int minimumProcessors, int maximumProcessors, double minimumProcessorsFrequencies, double maximumProcessorsFrequencies, int minimumRAM, int maximumRAM, int minimumDownload, int maximumDownload, int minimumUpload, int maximumUpload) { MinimumTasks = minimumTasks; MaximumTasks = maxmumTasks; MinimumProcessors = minimumProcessors; MaximumProcessors = maximumProcessors; MinimumProcessorsFrequencies = minimumProcessorsFrequencies; MaximumProcessorsFrequencies = maximumProcessorsFrequencies; MinimumRAM = minimumRAM; MaximumRAM = maximumRAM; MinimumDownload = minimumDownload; MaximumDownload = maximumDownload; MinimumUpload = minimumUpload; MaximumUpload = maximumUpload; OpeningClosingSection = new PairSection( CffKeywords.OPENING_LIMITS, CffKeywords.CLOSING_LIMITS); }
public CffLimits() { LimitData = new Limits(); LimitPairSection = new PairSection( CffKeywords.OPENING_LIMITS, CffKeywords.CLOSING_LIMITS); }
public CffProgram() { Program = new ProgramInfo(); ProgramPairSection = new PairSection( CffKeywords.OPENING_PROGRAM, CffKeywords.CLOSING_PROGRAM); }
public CffRemoteCommunication() { RemoteCommunication = new RemoteCommunication(); RemoteCommunicationSection = new PairSection( CffKeywords.OPENING_REMOTE_COMMUNICATION, CffKeywords.CLOSING_REMOTE_COMMUNICATION); }
public CffLogFile() { LogFileSection = new PairSection( CffKeywords.OPENING_LOGFILE, CffKeywords.CLOSING_LOGFILE); LogFile = null; }
public CffLocalCommunication() { LocalCommunication = new LocalCommunication(); LocalCommunicationSection = new PairSection( CffKeywords.OPENING_LOCAL_COMMUNICATION, CffKeywords.CLOSING_LOCAL_COMMUNICATION); }
public ProgramInfo(double duration, int tasks, int processors) { Duration = duration; Tasks = tasks; Processors = processors; OpeningClosingSection = new PairSection( CffKeywords.OPENING_PROGRAM, CffKeywords.CLOSING_PROGRAM); }
public ProcessorType(string name, double coefficient2, double coefficient1, double coefficient0) { Name = name; C2 = coefficient2; C1 = coefficient1; C0 = coefficient0; OpeningClosingSection = new PairSection( CffKeywords.OPENING_PROCESSOR_TYPE, CffKeywords.CLOSING_PROCESSOR_TYPE); }
public CffTasks() { TasksSection = new PairSection( CffKeywords.OPENING_TASKS, CffKeywords.CLOSING_TASKS); Tasks = new List <Task>(); TaskPair = new KeywordPair( CffKeywords.OPENING_TASK, CffKeywords.CLOSING_TASK); CffTaskExtraction = new CffTask(); }
public CffProcessorTypes() { ProcessorTypesSection = new PairSection( CffKeywords.OPENING_PROCESSOR_TYPES, CffKeywords.CLOSING_PROCESSOR_TYPES); ProcessorTypes = new List <ProcessorType>(); ProcessorTypePair = new KeywordPair( CffKeywords.OPENING_PROCESSOR_TYPE, CffKeywords.CLOSING_PROCESSOR_TYPE); CffProcessorTypeExtraction = new CffProcessorType(); }
public CffProcessors() { ProcessorsSection = new PairSection( CffKeywords.OPENING_PROCESSORS, CffKeywords.CLOSING_PROCESSORS); Processors = new List <Processor>(); ProcessorPair = new KeywordPair( CffKeywords.OPENING_PROCESSOR, CffKeywords.CLOSING_PROCESSOR); CffProcessorkExtraction = new CffProcessor(); }
public Allocation(int id, Map mapData) { ID = id; MapData = mapData; MapMatrix = null; OpeningClosingSection = new PairSection( TaffKeywords.OPENING_ALLOCATION, TaffKeywords.CLOSING_ALLOCATION); Runtime = 0; Energy = 0; }
public Processor( int id, string type, double frequency, int ram, int download, int upload) { ID = id; Type = type; Frequency = frequency; RAM = ram; Download = download; Upload = upload; OpeningClosingSection = new PairSection( CffKeywords.OPENING_PROCESSOR, CffKeywords.CLOSING_PROCESSOR); }
public Task( int id, int runtime, int referenceFrequency, int ram, int download, int upload) { ID = id; Runtime = runtime; ReferenceFrequency = referenceFrequency; RAM = ram; Download = download; Upload = upload; OpeningClosingSection = new PairSection( CffKeywords.OPENING_TASK, CffKeywords.CLOSING_TASK); }
public bool ValidateFile(string taffFilename, Validations validations) { if (taffFilename == null) { return(false); } int beforeNumOfError, afterNumOfError; beforeNumOfError = validations.ErrorValidationManager.Errors.Count; TaffFilename = taffFilename; // Extract and validate the configuration data section GetCffFilename(taffFilename, validations); // Validate the rest of the taff file KeywordPair allocationPair = new KeywordPair( TaffKeywords.OPENING_ALLOCATION, TaffKeywords.CLOSING_ALLOCATION); PairSection openClosingAllocations = new PairSection( TaffKeywords.OPENING_ALLOCATIONS, TaffKeywords.CLOSING_ALLOCATIONS); StreamReader streamReader = new StreamReader(taffFilename); TaffAllocations taffAllocations = new TaffAllocations(); int lineNumber = 1; string line; validations.Filename = taffFilename; while (!streamReader.EndOfStream) { line = streamReader.ReadLine(); line = line.Trim(); validations.LineNumber = lineNumber.ToString(); // Check if keyword is valid or not validations.CheckValidKeyword(line, TaffKeywords.KEYWORD_DICT); // Count Allocation Section allocationPair.CheckValidKeyword(line); // Check whether the line starts Opening/Closing Allocations section // If yes, mark it exist openClosingAllocations.MarkSection(line, lineNumber); // Validate and extract data in the Allocations section if (openClosingAllocations.ValidSectionPair[0] && !openClosingAllocations.ValidSectionPair[1]) { // Check whether Allocations section exists and // whether line strt with the expected keyword, "COUNT", "TASKS" // and "PROCESSORS" Count = taffAllocations.ExtractCount(Count, line, validations); NumberOfTasks = taffAllocations.ExtractNumOfTasks(NumberOfTasks, line, validations); NumberOfProcessors = taffAllocations.ExtractNumOfProcessors(NumberOfProcessors, line, validations); // Check whether the reader goes within the Allocation section taffAllocations.MarkInsideAllocation(line, lineNumber, validations); // Extract new allocation Allocation newAllocation = taffAllocations.ExtractAllocation(line, NumberOfProcessors, NumberOfTasks, validations); if (newAllocation != null) { Allocations.Add(newAllocation); } } lineNumber++; } streamReader.Close(); // Checking whether the Allocations section exists openClosingAllocations.CheckValidPair(validations, taffFilename); // Validate Allocation taffAllocations.ScanErrors( Count, NumberOfTasks, NumberOfProcessors, allocationPair, taffFilename, validations); AllocationInFileCount = allocationPair.CalculateNumOfPair(); afterNumOfError = validations.ErrorValidationManager.Errors.Count; // Console.WriteLine($"{Count} | {NumberOfTasks} | {NumberOfProcessors}"); // Console.WriteLine($"{Allocations.Count} | {allocationPair.CalculateNumOfPair()}"); return(beforeNumOfError == afterNumOfError); }
public RemoteCommunication(Map mapData) : base(mapData) { OpeningClosingSection = new PairSection( CffKeywords.OPENING_REMOTE_COMMUNICATION, CffKeywords.CLOSING_REMOTE_COMMUNICATION); }
public static string ExtractCff(string taffFilename, Validations validations) { string cffFilename = null; string line, expectedCffFilename = null; StreamReader streamReader = new StreamReader(taffFilename); PairSection openClosingConfigData = new PairSection( TaffKeywords.OPENING_CONFIG_DATA, TaffKeywords.CLOSING_CONFIG_DATA); int lineNumber = 1; validations.Filename = taffFilename; // Check whether taffFilename has .taff extension validations.LineNumber = ""; if (validations.CheckExtension(taffFilename, TaffKeywords.FILE_EXTENSION)) { expectedCffFilename = FilesUtils.ReplaceExtension( taffFilename, CffKeywords.FILE_EXTENSION); } else { return(null); } while (!streamReader.EndOfStream) { line = streamReader.ReadLine(); line = line.Trim(); validations.LineNumber = lineNumber.ToString(); // Check whether the line starts Opening Configuration Data section // If yes, mark it exist openClosingConfigData.StartWithOpeningSection(line, lineNumber); // Check whether the line starts Closing Configuration Data section // If yes, mark it exist, and stop the loop if (openClosingConfigData.StartWithClosingSection(line, lineNumber)) { break; } // Check whether Opening Configuration Data section exists and // whether line start with the expected keyword, "FILENAME" if (openClosingConfigData.ValidSectionPair[0] && line.StartsWith(TaffKeywords.CONFIG_FILENAME)) { // Check whether the pair of key-value exists string[] lineData = validations.CheckPairKeyValue( line, TaffKeywords.CONFIG_FILENAME, $"\"{expectedCffFilename}\""); if (lineData != null) { // Check whether the value in the above pair is valid cffFilename = validations.CheckTextValueExist( lineData[1], cffFilename, expectedCffFilename); } // Check whether the value in the above pair has the valid extension (.cff), // and check the filename has no invalia file character bool cffExtensionValid = cffFilename != null && validations.CheckExtension(cffFilename, CffKeywords.FILE_EXTENSION); bool noInvalidaFilenameChars = cffExtensionValid && validations.CheckInvalidFileNameChars(cffFilename); if (noInvalidaFilenameChars) { string filePath = Path.GetDirectoryName(taffFilename); cffFilename = $"{filePath}{Path.DirectorySeparatorChar}{cffFilename}"; validations.CheckFileExists(cffFilename); } } lineNumber++; } streamReader.Close(); // Checking whether the configuration data section exists openClosingConfigData.CheckValidPair(validations, taffFilename); // Check whether the cffFilename has been assigned a value or not validations.CheckProcessedFileExists(cffFilename, expectedCffFilename); return(cffFilename); }
public LocalCommunication(Map mapData) : base(mapData) { OpeningClosingSection = new PairSection( CffKeywords.OPENING_LOCAL_COMMUNICATION, CffKeywords.CLOSING_LOCAL_COMMUNICATION); }