internal override List <RawRecord> CrossApply(RawRecord record) { List <RawRecord> results = new List <RawRecord>(); FieldObject unfoldTarget = _unfoldTarget.Evaluate(record); if (unfoldTarget.GetType() == typeof(CollectionField)) { CollectionField cf = unfoldTarget as CollectionField; foreach (FieldObject fo in cf.Collection) { if (fo == null) { continue; } RawRecord newRecord = new RawRecord(); // Extract only needed columns from Compose1Field if (fo.GetType() == typeof(Compose1Field)) { Compose1Field compose1Field = fo as Compose1Field; foreach (string unfoldColumn in _unfoldColumns) { newRecord.Append(compose1Field.Map[new StringField(unfoldColumn)]); } } else { newRecord.Append(fo); } results.Add(newRecord); } } else if (unfoldTarget.GetType() == typeof(MapField)) { MapField mf = unfoldTarget as MapField; foreach (var pair in mf.Map) { RawRecord newRecord = new RawRecord(); string key = pair.Key.ToString(); string value = pair.Value.ToString(); newRecord.Append(new StringField(key + "=" + value)); results.Add(newRecord); } } else { RawRecord newRecord = new RawRecord(); newRecord.Append(unfoldTarget); results.Add(newRecord); } return(results); }
public GameRuleEvent(GameRuleEventType et, SportsObject s, FieldObject t) { source = s; target = t; eventType = et; if (et == GameRuleEventType.Bump && t.GetType() == typeof(FieldObject)) param = t.sportName; else param = null; }
public override FieldObject Evaluate(RawRecord record) { FieldObject checkObject = record[_checkFieldIndex]; VertexField vertexField = checkObject as VertexField; EdgeField edgeField = checkObject as EdgeField; if (vertexField != null) { if (vertexField.AllProperties.Count(pf => pf.PropertyName == _propertyName) > 0) { return(new StringField("true", JsonDataType.Boolean)); } else { return(new StringField("false", JsonDataType.Boolean)); } } else if (edgeField != null) { if (edgeField.EdgeProperties.ContainsKey(_propertyName)) { return(new StringField("true", JsonDataType.Boolean)); } else { return(new StringField("false", JsonDataType.Boolean)); } } else { throw new GraphViewException( "HasProperty() function can only be applied to a VertexField or EdgeField but now the object is " + checkObject.GetType()); } }