Files
PDFPatcher/App/Model/PdfPath/IPathFunction.cs
T
2021-12-24 20:35:03 +08:00

33 lines
545 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
}
}