17 using System.Collections.Generic;
18 using System.Globalization;
20 using Spatial4n.Core.Exceptions;
22 namespace Lucene.Net.Spatial.Queries
27 private static readonly Dictionary<String, SpatialOperation> registry =
new Dictionary<string, SpatialOperation>();
28 private static readonly IList<SpatialOperation> list =
new List<SpatialOperation>();
50 private readonly
bool scoreIsMeaningful;
51 private readonly
bool sourceNeedsArea;
52 private readonly
bool targetNeedsArea;
53 private readonly String name;
55 protected SpatialOperation(String name,
bool scoreIsMeaningful,
bool sourceNeedsArea,
bool targetNeedsArea)
58 this.scoreIsMeaningful = scoreIsMeaningful;
59 this.sourceNeedsArea = sourceNeedsArea;
60 this.targetNeedsArea = targetNeedsArea;
61 registry[name] =
this;
62 registry[name.ToUpper(CultureInfo.CreateSpecificCulture(
"en-US"))] =
this;
69 if (!registry.TryGetValue(v, out op) || op == null)
71 if (!registry.TryGetValue(v.ToUpper(CultureInfo.CreateSpecificCulture(
"en-US")), out op) || op == null)
72 throw new ArgumentException(
"Unknown Operation: " + v,
"v");
77 public static IList<SpatialOperation> Values()
84 return tst.Any(t => op == t);
90 public bool IsScoreIsMeaningful()
92 return scoreIsMeaningful;
95 public bool IsSourceNeedsArea()
97 return sourceNeedsArea;
100 public bool IsTargetNeedsArea()
102 return targetNeedsArea;
105 public String GetName()
110 public override String ToString()