public DependencyStructure(CloudMakefile cloudMakefile, string debugFilename) { CloudManager.WriteLine(debugFilename, "CloudMakefile: " + cloudMakefile.ToString()); _cloudMakefile = cloudMakefile; _entries = new List <string> (); _policies = cloudMakefile.GetPolicies(); _inputs = new List <List <int> > (); _outputs = new List <List <int> > (); for (int i = 0; i < _policies.Count; i++) { _inputs.Add(new List <int> ()); _outputs.Add(new List <int> ()); } _reverseInputs = new List <List <int> > (); _reverseOutputs = new List <List <int> > (); _entryTokens = new HashSet <int> (); _policyTokens = new HashSet <int> (); _order = cloudMakefile.GetOrder(); _configFiles = new HashSet <string> (); _modifiedConfigFiles = new HashSet <string> (); _cloudMakeConfigFiles = new HashSet <string> (); _modifiedCloudMakeConfigFiles = new HashSet <string> (); _debugFilename = debugFilename; }
public CloudMakefile(CloudMakefile cloudMakefile) { List <HashSet <int> > inputs = cloudMakefile.GetInputs(); List <HashSet <int> > outputs = cloudMakefile.GetOutputs(); List <HashSet <int> > reverseInputs = cloudMakefile.GetReverseInputs(); List <HashSet <int> > reverseOutputs = cloudMakefile.GetReverseOutputs(); List <HashSet <int> > order = cloudMakefile.GetOrder(); _inputs = new List <HashSet <int> > (); for (int i = 0; i < inputs.Count; i++) { _inputs.Add(new HashSet <int> (inputs [i])); } _outputs = new List <HashSet <int> > (); for (int i = 0; i < outputs.Count; i++) { _outputs.Add(new HashSet <int> (outputs [i])); } _reverseInputs = new List <HashSet <int> > (); for (int i = 0; i < reverseInputs.Count; i++) { _reverseInputs.Add(new HashSet <int> (reverseInputs [i])); } _reverseOutputs = new List <HashSet <int> > (); for (int i = 0; i < reverseOutputs.Count; i++) { _reverseOutputs.Add(new HashSet <int> (reverseOutputs [i])); } _dfas = new List <DFA> (cloudMakefile.GetDFAs()); _policies = new List <string> (cloudMakefile.GetPolicies()); _order = new List <HashSet <int> > (); for (int i = 0; i < order.Count; i++) { _order.Add(new HashSet <int> (order [i])); } }
public CloudMakefile(CloudMakefile cloudMakefile, List <int> selectedPolicies) : this() { List <HashSet <int> > inputs = cloudMakefile.GetInputs(); List <HashSet <int> > outputs = cloudMakefile.GetOutputs(); List <DFA> dfas = cloudMakefile.GetDFAs(); List <string> policies = cloudMakefile.GetPolicies(); List <HashSet <int> > order = cloudMakefile.GetOrder(); Dictionary <int, int> dfaTransform = new Dictionary <int, int> (); int dfaCount = 0; int newDfaIndex; int count = -1; for (int newPolicyIndex = 0; newPolicyIndex < selectedPolicies.Count; newPolicyIndex++) { int oldPolicyIndex = selectedPolicies [newPolicyIndex]; _inputs.Add(new HashSet <int> ()); _outputs.Add(new HashSet <int> ()); foreach (int oldDfaIndex in inputs[oldPolicyIndex]) { if (!dfaTransform.ContainsKey(oldDfaIndex)) { dfaTransform [oldDfaIndex] = dfaCount; _dfas.Add(dfas [oldDfaIndex]); dfaCount++; _reverseInputs.Add(new HashSet <int> ()); _reverseOutputs.Add(new HashSet <int> ()); } newDfaIndex = dfaTransform [oldDfaIndex]; _inputs [newPolicyIndex].Add(newDfaIndex); _reverseInputs [newDfaIndex].Add(newPolicyIndex); } foreach (int oldDfaIndex in outputs[oldPolicyIndex]) { if (!dfaTransform.ContainsKey(oldDfaIndex)) { dfaTransform [oldDfaIndex] = dfaCount; _dfas.Add(dfas [oldDfaIndex]); dfaCount++; _reverseInputs.Add(new HashSet <int> ()); _reverseOutputs.Add(new HashSet <int> ()); } newDfaIndex = dfaTransform [oldDfaIndex]; _outputs [newPolicyIndex].Add(newDfaIndex); _reverseOutputs [newDfaIndex].Add(newPolicyIndex); } _policies.Add(policies [oldPolicyIndex]); } for (int i = 0; i < order.Count; i++) { bool created = false; foreach (int oldPolicyIndex in order[i]) { if (selectedPolicies.Contains(oldPolicyIndex)) { if (!created) { _order.Add(new HashSet <int> ()); created = true; count += 1; } _order [count].Add(selectedPolicies.IndexOf(oldPolicyIndex)); } } } }