private Dictionary<int, List<InnerQuery>> getQueries(string object1, string object2, int distance, int limit, List<string> ignoredObjects = null, List<string> ignoredProperties = null, int avoidCycles = 0)
{
Dictionary<int, List<InnerQuery>> queries = new Dictionary<int, List<InnerQuery>>();
Dictionary<string, List<string>> options = new Dictionary<string, List<string>>();
//May generate null
options["object1"] = stringToLoist(object1);
options["object2"] = stringToLoist(object2);
options["limit"] = stringToLoist(limit.ToString());
options["ignoredObjects"] = ignoredObjects;
options["ignoredProperties"] = ignoredProperties;
options["avoidCycles"] = stringToLoist(avoidCycles.ToString());
// get direct connection in both directions
//queries[distance] = new ArrayCollection();
//(queries[distance] as ArrayCollection).addItem(new Array(direct(object1, object2, distance, options), connectedDirectly));
//(queries[distance] as ArrayCollection).addItem(new Array(direct(object2, object1, distance, options), connectedDirectlyInverted));
//we substitiued ArrayCollection with a list and passed the list to the dictionary
var tempList = new List<InnerQuery>();
var tempInnerQuery = new InnerQuery();
tempInnerQuery.queryText = direct(object1, object2, distance, options);
tempInnerQuery.connectState = connectionType.connectedDirectly;
tempInnerQuery.object1 = object1;
tempInnerQuery.object2 = object2;
tempList.Add(tempInnerQuery);
tempInnerQuery = new InnerQuery();
tempInnerQuery.queryText = direct(object2, object1, distance, options);
tempInnerQuery.connectState = connectionType.connectedDirectlyInverted;
tempInnerQuery.object1 = object2;
tempInnerQuery.object2 = object1;
tempList.Add(tempInnerQuery);
//queries.Add(distance, tempList);
//ended substitution
for (int a = 1; a <= distance; a++)
{
for (int b = 1; b <= distance; b++)
{
if ((a + b) == distance)
{
//(queries[distance] as ArrayCollection).addItem(new Array(connectedViaAMiddleObject(object1, object2, a, b, true, options), connectedViaMiddle));
//tempList = new List<InnerQuery>();
tempInnerQuery = new InnerQuery();
tempInnerQuery.queryText = connectedViaAMiddleObject(object1, object2, a, b, true, options);
tempInnerQuery.connectState = connectionType.connectedViaMiddle;
tempInnerQuery.object1 = object1;
tempInnerQuery.object2 = object2;
tempList.Add(tempInnerQuery);
tempInnerQuery = new InnerQuery();
tempInnerQuery.queryText = connectedViaAMiddleObject(object1, object2, a, b, false, options);
tempInnerQuery.connectState = connectionType.connectedViaMiddleInverted;
tempInnerQuery.object1 = object1;
tempInnerQuery.object2 = object2;
tempList.Add(tempInnerQuery);
//(queries[distance] as ArrayCollection).addItem(new Array(connectedViaAMiddleObject(object1, object2, a, b, false, options), connectedViaMiddleInverted));
}
}
}
queries.Add(distance, tempList);
//substitution of the above code:
return queries;
}