aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/Null
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/Null')
-rw-r--r--OpenSim/Data/Null/NullGenericDataHandler.cs41
1 files changed, 41 insertions, 0 deletions
diff --git a/OpenSim/Data/Null/NullGenericDataHandler.cs b/OpenSim/Data/Null/NullGenericDataHandler.cs
index dd9d190..0b6e49b 100644
--- a/OpenSim/Data/Null/NullGenericDataHandler.cs
+++ b/OpenSim/Data/Null/NullGenericDataHandler.cs
@@ -42,6 +42,47 @@ namespace OpenSim.Data.Null
42 /// </summary> 42 /// </summary>
43 public class NullGenericDataHandler 43 public class NullGenericDataHandler
44 { 44 {
45 protected List<T> Get<T>(string field, string val, List<T> inputEntities)
46 {
47 List<T> entities = inputEntities;
48
49 entities
50 = entities.Where(
51 e =>
52 {
53 FieldInfo fi = typeof(T).GetField(field);
54 if (fi == null)
55 throw new NotImplementedException(string.Format("No field {0} for val {1}", field, val));
56
57 return fi.GetValue(e).ToString() == val;
58 }
59 ).ToList();
60
61 return entities;
62 }
63
64 protected List<T> Get<T>(string field, string[] vals, List<T> inputEntities)
65 {
66 List<T> entities = new List<T>();
67
68 for (int i = 0; i < vals.Length; i++)
69 {
70 entities.AddRange (inputEntities.Where(
71 e =>
72 {
73 FieldInfo fi = typeof(T).GetField(field);
74 if (fi == null)
75 throw new NotImplementedException(string.Format("No field {0} for val {1}", field, vals[i]));
76
77 return fi.GetValue(e).ToString() == vals[i];
78 }
79 ).ToList()
80 );
81 }
82 return entities;
83 }
84
85
45 protected List<T> Get<T>(string[] fields, string[] vals, List<T> inputEntities) 86 protected List<T> Get<T>(string[] fields, string[] vals, List<T> inputEntities)
46 { 87 {
47 List<T> entities = inputEntities; 88 List<T> entities = inputEntities;