preliminary implementation of FindInternal for PropertyListObjectModel

This commit is contained in:
Michael Becker 2020-09-20 01:08:03 -04:00
parent 1221a7aacc
commit 10b1bf871a
No known key found for this signature in database
GPG Key ID: 506F54899E2BFED7

View File

@ -20,6 +20,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
using System;
using System.Collections.Generic;
using System.Reflection;
namespace UniversalEditor.ObjectModels.PropertyList
@ -263,5 +264,36 @@ namespace UniversalEditor.ObjectModels.PropertyList
private string mvarTitle = String.Empty;
public string Title { get { return mvarTitle; } set { mvarTitle = value; } }
private CriteriaObject[] _CriteriaObjects = null;
private CriteriaProperty propName = new CriteriaProperty("Name", typeof(string));
protected override CriteriaObject[] GetCriteriaObjectsInternal()
{
if (_CriteriaObjects == null)
{
_CriteriaObjects = new CriteriaObject[]
{
new CriteriaObject("Property", new CriteriaProperty[]
{
propName,
new CriteriaProperty("Value", typeof(string))
})
};
}
return _CriteriaObjects;
}
protected override CriteriaResult[] FindInternal(CriteriaQuery query)
{
List<CriteriaResult> list = new List<CriteriaResult>();
for (int i = 0; i < this.Items.Count; i++)
{
if (query.Check(propName, this.Items[i].Name))
{
list.Add(new CriteriaResult(this.Items[i]));
break;
}
}
return list.ToArray();
}
}
}