/// <summary>Analyze multiple event types and determine common property sets that form property groups. </summary> /// <param name="allProperties">property names to look at</param> /// <param name="deltaEventTypes">all types contributing</param> /// <param name="names">names of properies</param> /// <returns>groups</returns> public static PropertyGroupDesc[] AnalyzeGroups(String[] allProperties, EventType[] deltaEventTypes, String[] names) { if (deltaEventTypes.Length != names.Length) { throw new ArgumentException("Delta event type number and name number of elements don't match"); } allProperties = CopyAndSort(allProperties); var result = new LinkedHashMap <MultiKey <String>, PropertyGroupDesc>(); var currentGroupNum = 0; for (int i = 0; i < deltaEventTypes.Length; i++) { MultiKey <String> props = GetPropertiesContributed(deltaEventTypes[i], allProperties); if (props.Array.Length == 0) { Log.Warn("Event type named '" + names[i] + "' does not contribute (or override) any properties of the revision event type"); continue; } PropertyGroupDesc propertyGroup = result.Get(props); IDictionary <EventType, String> typesForGroup; if (propertyGroup == null) { typesForGroup = new Dictionary <EventType, String>(); propertyGroup = new PropertyGroupDesc(currentGroupNum++, typesForGroup, props.Array); result.Put(props, propertyGroup); } else { typesForGroup = propertyGroup.Types; } typesForGroup.Put(deltaEventTypes[i], names[i]); } PropertyGroupDesc[] array = Collections.ToArray(result.Values); if (Log.IsDebugEnabled) { Log.Debug(".analyzeGroups " + array.Render()); } return(array); }
/// <summary>Ctor. </summary> /// <param name="keyPropertyGetters">key getters</param> /// <param name="changesetPropertyGetters">property getters</param> /// <param name="group">group this belongs to</param> public RevisionTypeDesc(EventPropertyGetter[] keyPropertyGetters, EventPropertyGetter[] changesetPropertyGetters, PropertyGroupDesc group) { this.keyPropertyGetters = keyPropertyGetters; this.changesetPropertyGetters = changesetPropertyGetters; this.group = group; }