public Tuple(XmlElement elTuple) { XmlNodeList l = elTuple.GetElementsByTagName("field"); fields = new Field[l.Count]; for (int i = 0; i < l.Count; i++) { XmlElement elField = (XmlElement) l[i]; fields[i] = new Field(elField); } if (elTuple.HasAttribute("id")) { tupleID = new TupleID(elTuple.GetAttribute("id")); } if (elTuple.HasAttribute("creationTimestamp")) { creationTimestamp = long.Parse(elTuple.GetAttribute("creationTimestamp")); } if (elTuple.HasAttribute("lastModificationTimestamp")) { lastModificationTimestamp = long.Parse(elTuple.GetAttribute("lastModificationTimestamp")); } if (elTuple.HasAttribute("expiration")) { expiration = long.Parse(elTuple.GetAttribute("expiration")); } }
public bool Matches(Field field) { if (!Formal && !field.Formal) { return value == field.Value; } else { if (value != null) { if ((field.UpperBound != null) && (field.UpperBound.CompareTo(value) < 0)) { return false; } if ((field.LowerBound != null) && (field.LowerBound.CompareTo(value) > 0)) { return false; } return true; } else if (field.Value != null) { if ((upperBound != null) && (upperBound.CompareTo(field.Value) < 0)) { return false; } if ((lowerBound != null) && (lowerBound.CompareTo(field.Value) > 0)) { return false; } return true; } else { return type.Equals(field.GetType()); } } }
public static Field createWildCardField() { Field wcf = new Field(); wcf.fieldType = FieldType.WILDCARD; wcf.type = null; return wcf; }
public Tuple(Field[] fields) { this.fields = fields; }
public object Clone() { Field[] newFields = new Field[fields.Length]; for (int i = 0; i < fields.Length; i++) { newFields[i] = (Field)fields[i].Clone(); } Tuple t = new Tuple(newFields); t.Expiration = expiration; return t; }
public void Add(Object s) { Field[] newF = new Field[fields.Length + 1]; for (int i = 0; i < fields.Length; i++) { newF[i] = fields[i]; } if (s.GetType().Equals(typeof(Type))) { newF[fields.Length] = new Field((Type) s); } else if (s.GetType().Equals(typeof(Field))) { newF[fields.Length] = (Field)s; } else { newF[fields.Length] = new Field(s); } fields = newF; }