public void UpdateIndices() { var metaCol = m_SourceTable.GetMetaData().GetColumnByIndex(m_columnIndex); var col = m_SourceTable.GetColumnByIndex(m_columnIndex); if (metaCol == null || col == null) { UnityEngine.Debug.LogError("No column index " + m_columnIndex + " on table '" + m_SourceTable.GetName() + "'"); indices = new long[0]; } var t = metaCol.Type; Matcher m; if (t == typeof(string)) { var ssm = new SubStringMatcher(); ssm.value = m_matchString; m = ssm; } else { m = ColumnCreator.CreateConstMatcher(t, m_matchString); if (m == null) { indices = new long[0]; return; } } var matchIndices = col.GetMatchIndex(m_Range, m); indices = matchIndices; }
/// <summary> /// Query the string builder to find the first index of x /// </summary> /// <param name="x">the sought-after substring</param> /// <returns>the index where the substring is found, if found, -1 otherwise</returns> /// <exception cref="ArgumentNullException">x was null.</exception> public readonly int IndexOf([NotNull] string x) { if (x == null) { throw new ArgumentNullException(nameof(x)); } if (_sb.Length == 0) { return(-1); } if (x.Length == 0) { return(-1); } return(SubStringMatcher.FindFirstIndexOfSubString(_sb, x)); }
public void UpdateIndices() { var metaCol = m_SourceTable.GetMetaData().GetColumnByIndex(m_columnIndex); var col = m_SourceTable.GetColumnByIndex(m_columnIndex); if (metaCol == null || col == null) { UnityEngine.Debug.LogError("No column index " + m_columnIndex + " on table '" + m_SourceTable.GetName() + "'"); indices = new long[0]; } Matcher m = null; string matchStr = m_matchString; switch (metaCol.Type.comparisonMethod) { case DataMatchMethod.AsString: m = new SubStringMatcher(); break; case DataMatchMethod.AsEnum: m = new NumericMatcher(); var enumType = typeof(DiffTable.DiffResult); var parsed = (DiffTable.DiffResult)Enum.Parse(enumType, matchStr, true); if (Enum.IsDefined(enumType, parsed)) { matchStr = ((int)parsed).ToString(); } else { matchStr = "0"; } break; case DataMatchMethod.AsNumber: m = new NumericMatcher(); break; } m.SetMatchPredicate(matchStr); var matchIndices = col.GetMatchIndex(m_Range, m); indices = matchIndices; }