/// <summary> /// Gets a list of neighbors from a response /// </summary> /// <returns>IEnumerable<INeighbor> List of neighbors</returns> public IEnumerable <INeighbor> GetListedNeighbors() { var result = new List <INeighbor>(); INeighbor neighbor = null; foreach (var item in _valueList) { if (item.Key == ResponseParserKeys.NeighborName) { if (neighbor != null) { result.Add(neighbor); } neighbor = new Neighbor { Name = item.Value }; } if (item.Key == ResponseParserKeys.NeighborStorage) { neighbor.Path = item.Value; } } if (neighbor != null) { result.Add(neighbor); } return(result); }
public double CalculateDistanceFrom(INeighbor other) { double distance; double[] distances = new double[mParameters.Count]; for (int i = 0; i < mParameters.Count; i++) { distances[i] = Math.Pow((mParameters[i] - other.GetParameter(i)), 2); } distance = Math.Sqrt(distances.Sum()); return(distance); }
public double CalculateDistanceFrom(INeighbor other) { throw new NotImplementedException("should use RecordNeighbor proerties instead"); }
/// <summary> /// <inheritdoc/> /// </summary> /// <param name="neighbor">Neighbor DTO with name and storage uri</param> public AddMount(INeighbor neighbor) { Command = $"mount {neighbor.Name} \"{neighbor.Path}\""; }