private void CacheData(GraphDataProperties properties, int index) { var data = CreateOrGet(properties); lock (_requestLock) { if (properties.Equals((object)_requested)) { _callback(data); _requested = null; _callback = null; } } }
public bool TryGet(SrmDocument document, AreaCVGraphSettings settings, Action <AreaCVGraphData> callback, out AreaCVGraphData result) { var properties = new GraphDataProperties(settings); if (!IsValidFor(document, settings)) { Cancel(); lock (_cacheInfo) { _cacheInfo.Clear(); _cacheInfo.Document = document; _cacheInfo.Settings = settings; } // Get a list of all properties that we want to cache data for, except for the data that just got requested var propertyList = new List <GraphDataProperties>(GetPropertyVariants(settings).Except(new[] { properties })); _producerConsumer.Add(propertyList, false, false); } result = Get(properties); if (result != null) { return(true); } lock (_requestLock) { if (!properties.Equals((object)_requested)) { _producerConsumer.Add(properties); _requested = properties; _callback = callback; } return(false); } }
private AreaCVGraphData CreateOrGet(GraphDataProperties properties) { var result = Get(properties); if (result == null) { SrmDocument document; AreaCVGraphSettings settings; lock (_cacheInfo) { document = _cacheInfo.Document; settings = _cacheInfo.Settings; } result = new AreaCVGraphData(document, new AreaCVGraphSettings(settings.GraphType, properties.NormalizationMethod, properties.RatioIndex, settings.Group, properties.Annotation, settings.PointsType, settings.QValueCutoff, settings.CVCutoff, properties.MinimumDetections, settings.BinWidth, settings.MsLevel, settings.Transitions, settings.CountTransitions), _tokenSource.Token); lock (_cacheInfo) { if (IsValidFor(document, settings)) { _cacheInfo.Data.Add(result); } } } return(result); }
public bool Equals(GraphDataProperties other) { return(string.Equals(Group, other.Group) && NormalizationMethod == other.NormalizationMethod && RatioIndex == other.RatioIndex && string.Equals(Annotation, other.Annotation) && MinimumDetections == other.MinimumDetections); }
public AreaCVGraphData Get(GraphDataProperties properties) { return(Get(properties.Group, properties.Annotation, properties.MinimumDetections, properties.NormalizationMethod, properties.RatioIndex)); }
public bool Equals(GraphDataProperties other) { return(Equals(Group, other.Group) && NormalizeOption == other.NormalizeOption && Equals(Annotation, other.Annotation) && MinimumDetections == other.MinimumDetections); }
public AreaCVGraphData Get(GraphDataProperties properties) { return(Get(properties.Group, properties.Annotation, properties.MinimumDetections, properties.NormalizeOption)); }