/// <summary> /// Converts an AttributeOperand to a displayable string. /// </summary> public override string ToString(INodeTable nodeTable) { StringBuilder buffer = new StringBuilder(); INode node = nodeTable.Find(TypeDefinitionId); if (node != null) { buffer.AppendFormat("{0}", TypeDefinitionId); } else { buffer.AppendFormat("{0}", TypeDefinitionId); } if (BrowsePath != null && BrowsePath.Count > 0) { buffer.AppendFormat("{0}", Format(BrowsePath)); } if (!String.IsNullOrEmpty(IndexRange)) { buffer.AppendFormat("[{0}]", NumericRange.Parse(IndexRange)); } return(buffer.ToString()); }
/// <summary> /// Converts an AttributeOperand to a displayable string. /// </summary> /// <param name="nodeTable">The node table.</param> /// <returns>AttributeOperand as a displayable string.</returns> public override string ToString(INodeTable nodeTable) { StringBuilder buffer = new StringBuilder(); INode node = nodeTable.Find(m_nodeId); if (node != null) { buffer.AppendFormat("{0}", NodeId); } else { buffer.AppendFormat("{0}", NodeId); } if (!RelativePath.IsEmpty(BrowsePath)) { buffer.AppendFormat("/{0}", BrowsePath.Format(nodeTable.TypeTree)); } if (!String.IsNullOrEmpty(IndexRange)) { buffer.AppendFormat("[{0}]", NumericRange.Parse(IndexRange)); } if (!String.IsNullOrEmpty(Alias)) { buffer.AppendFormat("- '{0}'", Alias); } return(buffer.ToString()); }
/// <summary> /// Converts an LiteralOperand to a displayable string. /// </summary> /// <param name="table">The table.</param> /// <returns>LiteralOperand as a displayable string.</returns> public override string ToString(INodeTable table) { ExpandedNodeId nodeId = Value.Value as ExpandedNodeId; if (nodeId == null) { nodeId = Value.Value as NodeId; } if (nodeId != null) { INode node = table.Find(nodeId); if (node != null) { return(Utils.Format("{0} ({1})", node, nodeId)); } } return(Utils.Format("{0}", Value)); }
/// <summary> /// Converts an ContentFilterElement to a displayable string. /// </summary> /// <param name="nodeTable">The node table.</param> /// <returns>ContentFilterElement as a displayable string.</returns> public virtual string ToString(INodeTable nodeTable) { List<FilterOperand> operands = GetOperands(); string operand1 = (operands.Count > 0)?operands[0].ToString(nodeTable):null; string operand2 = (operands.Count > 1)?operands[1].ToString(nodeTable):null; string operand3 = (operands.Count > 2)?operands[2].ToString(nodeTable):null; StringBuilder buffer = new StringBuilder(); switch (FilterOperator) { case FilterOperator.OfType: case FilterOperator.InView: case FilterOperator.IsNull: case FilterOperator.Not: { buffer.AppendFormat("{0} '{1}'", FilterOperator, operand1); break; } case FilterOperator.And: case FilterOperator.Equals: case FilterOperator.GreaterThan: case FilterOperator.GreaterThanOrEqual: case FilterOperator.LessThan: case FilterOperator.LessThanOrEqual: case FilterOperator.Like: case FilterOperator.Or: { buffer.AppendFormat("'{1}' {0} '{2}'", FilterOperator, operand1, operand2); break; } case FilterOperator.Between: { buffer.AppendFormat("'{1}' <= '{0}' <= '{2}'", operand1, operand2, operand3); break; } case FilterOperator.Cast: { buffer.AppendFormat("({1}){0}", operand1, operand2); break; } case FilterOperator.InList: { buffer.AppendFormat("'{0}' in {", operand1); for (int ii = 1; ii < operands.Count; ii++) { if (ii < operands.Count-1) { buffer.Append(", "); } buffer.AppendFormat("'{0}'", operands[ii].ToString()); } buffer.Append("}"); break; } case FilterOperator.RelatedTo: { buffer.AppendFormat("'{0}' ", operand1); string referenceType = operand2; if (operands.Count > 1) { LiteralOperand literalOperand = operands[1] as LiteralOperand; if (literalOperand != null) { INode node = nodeTable.Find(literalOperand.Value.Value as NodeId); if (node != null) { referenceType = Utils.Format("{0}", node); } } } buffer.AppendFormat("{0} '{1}'", referenceType, operand2); if (operand3 != null) { buffer.AppendFormat("Hops='{0}'", operand3); } break; } } return buffer.ToString(); }
/// <summary> /// Converts an LiteralOperand to a displayable string. /// </summary> /// <param name="table">The table.</param> /// <returns>LiteralOperand as a displayable string.</returns> public override string ToString(INodeTable table) { ExpandedNodeId nodeId = Value.Value as ExpandedNodeId; if (nodeId == null) { nodeId = Value.Value as NodeId; } if (nodeId != null) { INode node = table.Find(nodeId); if (node != null) { return Utils.Format("{0} ({1})", node, nodeId); } } return Utils.Format("{0}", Value); }
/// <summary> /// Converts an AttributeOperand to a displayable string. /// </summary> /// <param name="nodeTable">The node table.</param> /// <returns>AttributeOperand as a displayable string.</returns> public override string ToString(INodeTable nodeTable) { StringBuilder buffer = new StringBuilder(); INode node = nodeTable.Find(m_nodeId); if (node != null) { buffer.AppendFormat("{0}", NodeId); } else { buffer.AppendFormat("{0}", NodeId); } if (!RelativePath.IsEmpty(BrowsePath)) { buffer.AppendFormat("/{0}", BrowsePath.Format(nodeTable.TypeTree)); } if (!String.IsNullOrEmpty(IndexRange)) { buffer.AppendFormat("[{0}]", NumericRange.Parse(IndexRange)); } if (!String.IsNullOrEmpty(Alias)) { buffer.AppendFormat("- '{0}'", Alias); } return buffer.ToString(); }
/// <summary> /// Converts an ContentFilterElement to a displayable string. /// </summary> /// <param name="nodeTable">The node table.</param> /// <returns>ContentFilterElement as a displayable string.</returns> public virtual string ToString(INodeTable nodeTable) { List <FilterOperand> operands = GetOperands(); string operand1 = (operands.Count > 0)?operands[0].ToString(nodeTable):null; string operand2 = (operands.Count > 1)?operands[1].ToString(nodeTable):null; string operand3 = (operands.Count > 2)?operands[2].ToString(nodeTable):null; StringBuilder buffer = new StringBuilder(); switch (FilterOperator) { case FilterOperator.OfType: case FilterOperator.InView: case FilterOperator.IsNull: case FilterOperator.Not: { buffer.AppendFormat("{0} '{1}'", FilterOperator, operand1); break; } case FilterOperator.And: case FilterOperator.Equals: case FilterOperator.GreaterThan: case FilterOperator.GreaterThanOrEqual: case FilterOperator.LessThan: case FilterOperator.LessThanOrEqual: case FilterOperator.Like: case FilterOperator.Or: { buffer.AppendFormat("'{1}' {0} '{2}'", FilterOperator, operand1, operand2); break; } case FilterOperator.Between: { buffer.AppendFormat("'{1}' <= '{0}' <= '{2}'", operand1, operand2, operand3); break; } case FilterOperator.Cast: { buffer.AppendFormat("({1}){0}", operand1, operand2); break; } case FilterOperator.InList: { buffer.AppendFormat("'{0}' in {", operand1); for (int ii = 1; ii < operands.Count; ii++) { if (ii < operands.Count - 1) { buffer.Append(", "); } buffer.AppendFormat("'{0}'", operands[ii].ToString()); } buffer.Append("}"); break; } case FilterOperator.RelatedTo: { buffer.AppendFormat("'{0}' ", operand1); string referenceType = operand2; if (operands.Count > 1) { LiteralOperand literalOperand = operands[1] as LiteralOperand; if (literalOperand != null) { INode node = nodeTable.Find(literalOperand.Value.Value as NodeId); if (node != null) { referenceType = Utils.Format("{0}", node); } } } buffer.AppendFormat("{0} '{1}'", referenceType, operand2); if (operand3 != null) { buffer.AppendFormat("Hops='{0}'", operand3); } break; } } return(buffer.ToString()); }
/// <summary> /// Converts an AttributeOperand to a displayable string. /// </summary> public override string ToString(INodeTable nodeTable) { StringBuilder buffer = new StringBuilder(); INode node = nodeTable.Find(TypeDefinitionId); if (node != null) { buffer.AppendFormat("{0}", TypeDefinitionId); } else { buffer.AppendFormat("{0}", TypeDefinitionId); } if (BrowsePath != null && BrowsePath.Count > 0) { buffer.AppendFormat("{0}", Format(BrowsePath)); } if (!String.IsNullOrEmpty(IndexRange)) { buffer.AppendFormat("[{0}]", NumericRange.Parse(IndexRange)); } return buffer.ToString(); }