Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System.Collections.Generic;
using OSIsoft.AF;
using OSIsoft.AF.Search;
namespace ElementSearch
{
public class AFElementSearchBuilder
{
private AFDatabase _database;
private string _name;
private IList<AFSearchToken> _tokens;
public static AFElementSearchBuilder Create()
{
return new AFElementSearchBuilder();
}
private AFElementSearchBuilder()
{
_database = new PISystems().DefaultPISystem.Databases.DefaultDatabase;
_name = "AFElementSearch";
_tokens = new List<AFSearchToken>();
}
public AFElementSearchBuilder SetDatabase(AFDatabase database)
{
_database = database;
return this;
}
public AFElementSearchBuilder SetName(string name)
{
_name = name;
return this;
}
public AFElementSearchBuilder AddToken(AFSearchToken searchToken)
{
_tokens.Add(searchToken);
return this;
}
public AFElementSearch Build()
{
return new AFElementSearch(_database, _name, _tokens);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.