Files
2022-01-06 09:08:16 +08:00

33 lines
543 B
C#

using System;
using System.Collections.Generic;
using System.Text;
namespace PDFPatcher.Model.PdfPath
{
interface IPathFunction
{
object Evaluate(DocumentObject source);
}
sealed class CurrentPosition : IPathFunction
{
#region IPathFunction 成员
public object Evaluate(DocumentObject source) {
if (source == null || source.Parent == null) {
return 0;
}
int i = 0;
foreach (var item in source.Parent.Children) {
++i;
if (item == source) {
return i;
}
}
return i;
}
#endregion
}
}