//----------------------- private implementation details ----------------------- private static string ChangeAttributes(string symbol, ICandleSymbolAttribute attribute, params ICandleSymbolAttribute[] attributes) { symbol = ChangeAttribute(symbol, attribute); foreach (ICandleSymbolAttribute a in attributes) { symbol = ChangeAttribute(symbol, a); } return(symbol); }
private CandleSymbol(string symbol, ICandleSymbolAttribute attribute, params ICandleSymbolAttribute[] attributes) { this.symbol = Normalize(ChangeAttributes(symbol, attribute, attributes)); attribute.CheckInAttributeImpl(this); foreach (ICandleSymbolAttribute a in attributes) { a.CheckInAttributeImpl(this); } InitTransientFields(); }
public void CandleSymbolParamsTest(CandleSymbolTestCase testCase) { if (testCase.attrs == null) { Assert.AreEqual(testCase.expected, CandleSymbol.ValueOf(testCase.baseSymbol).ToString()); } else if (testCase.attrs.Length == 1) { Assert.AreEqual(testCase.expected, CandleSymbol.ValueOf(testCase.baseSymbol, testCase.attrs[0]).ToString()); } else { var nextAttrs = new ICandleSymbolAttribute[testCase.attrs.Length - 1]; Array.Copy(testCase.attrs, 1, nextAttrs, 0, testCase.attrs.Length - 1); Assert.AreEqual(testCase.expected, CandleSymbol.ValueOf(testCase.baseSymbol, testCase.attrs[0], nextAttrs).ToString()); } }
private CandleSymbol(string symbol, ICandleSymbolAttribute attribute) { this.symbol = Normalize(ChangeAttribute(symbol, attribute)); attribute.CheckInAttributeImpl(this); InitTransientFields(); }
private static string ChangeAttribute(string symbol, ICandleSymbolAttribute attribute) { return(attribute.ChangeAttributeForSymbol(symbol)); }
/// <summary> /// Converts the given string symbol into the candle symbol object with the specified attributes set. /// </summary> /// <param name="symbol">the string symbol.</param> /// <param name="attribute">the attribute to set.</param> /// <param name="attributes">more attributes to set.</param> /// <returns>the candle symbol object.</returns> public static CandleSymbol ValueOf(string symbol, ICandleSymbolAttribute attribute, params ICandleSymbolAttribute[] attributes) { return(new CandleSymbol(symbol, attribute, attributes)); }
/// <summary> /// Converts the given string symbol into the candle symbol object with the specified attribute set. /// </summary> /// <param name="symbol">the string symbol.</param> /// <param name="attribute">the attribute to set.</param> /// <returns>the candle symbol object.</returns> public static CandleSymbol ValueOf(string symbol, ICandleSymbolAttribute attribute) { return(new CandleSymbol(symbol, attribute)); }