/// <summary> /// Creates an annotation with a detail message string. /// </summary> /// <param name="type">The annotation type.</param> /// <param name="codeElement">The associated code element, or null if none.</param> /// <param name="message">The annotation message.</param> /// <param name="details">Additional details such as exception text or null if none.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="message"/> is null.</exception> public Annotation(AnnotationType type, ICodeElementInfo codeElement, string message, string details) { this.type = type; this.codeElement = codeElement; this.message = message; this.details = details; }
public List <Annotation> GetAnnotations(AnnotationType annotationType, List <Guid> selectedTagIds, bool includeNoTags) { List <Annotation> annotationsFilteredByAnnotationType = new List <Annotation>(); if (annotationType == AnnotationType.All) { annotationsFilteredByAnnotationType = GetAnnotations(); } else { var annotations = annotationAccess.GetAnnotationsByType(GlobalAccess.Instance.Email, GlobalAccess.Instance.ServiceCode, annotationType); var dlBooks = publicationAccess.GetAllDlBooks(GlobalAccess.Instance.UserCredential); annotationsFilteredByAnnotationType = AnnotationFactory.CreateAnnotations(annotations, this.tagDomainService.Tags, dlBooks); } if (annotationsFilteredByAnnotationType != null) { List <Annotation> noTags = null; if (includeNoTags) { noTags = annotationsFilteredByAnnotationType.FindAll(o => o.CategoryTagIDs.Count == 0); } if (selectedTagIds != null && selectedTagIds.Count > 0) { annotationsFilteredByAnnotationType = annotationsFilteredByAnnotationType.FindAll(o => selectedTagIds.Intersect(o.CategoryTagIDs).Count() > 0); } if (noTags != null) { annotationsFilteredByAnnotationType.AddRange(noTags); } } return(annotationsFilteredByAnnotationType); }
private static byte[] EncodeValue(object annotationValue, AnnotationType annotationType) { switch (annotationType) { case AnnotationType.STRING: return(BinaryAnnotationValueEncoder.Encode((string)annotationValue)); case AnnotationType.BOOL: return(BinaryAnnotationValueEncoder.Encode((bool)annotationValue)); case AnnotationType.I16: return(BinaryAnnotationValueEncoder.Encode((short)annotationValue)); case AnnotationType.I32: return(BinaryAnnotationValueEncoder.Encode((int)annotationValue)); case AnnotationType.I64: return(BinaryAnnotationValueEncoder.Encode((long)annotationValue)); case AnnotationType.BYTES: return((byte[])(annotationValue)); case AnnotationType.DOUBLE: return(BinaryAnnotationValueEncoder.Encode((double)annotationValue)); } throw new ArgumentException("Unsupported object type for binary annotation."); }
private void toolStripBtnFont_Click(object sender, EventArgs e) { Color color = SelectColor(); if (color != Color.Transparent) { toolStripBtnFont.BackColor = color; List <AnnotationData> tempAllAnnotation = (List <AnnotationData>)m_ImageCore.ImageBuffer.GetMetaData(m_ImageCore.ImageBuffer.CurrentImageIndexInBuffer, EnumMetaDataType.enumAnnotation); if (m_SeletedAnnotation == null) { return; } foreach (AnnotationData annotation in m_SeletedAnnotation) { AnnotationType type = annotation.AnnotationType; if (type == AnnotationType.enumText) { foreach (AnnotationData temp in tempAllAnnotation) { if (annotation.GUID == temp.GUID) { annotation.FontType.TextColor = color.ToArgb(); } } } } m_ImageCore.ImageBuffer.SetMetaData(m_ImageCore.ImageBuffer.CurrentImageIndexInBuffer, EnumMetaDataType.enumAnnotation, tempAllAnnotation, true); } }
public CreateAnnotationResult CreateAnnotation(string documentGuid, AnnotationType type, Rectangle box, Point? annotationPosition, Range? textRange = null, string svgPath = null, string message = null) { Throw.IfNull<string>(documentGuid, "documentGuid"); var template = AnnotationApiUriTemplates.BuildUriTemplate(AnnotationApiUriTemplates.CreateAnnotation); var parameters = new NameValueCollection() { { "userId", UserId }, { "fileId", documentGuid } }; var annotation = new AnnotationInfo { Type = type, Box = box, AnnotationPosition = annotationPosition, TextRange = textRange, SvgPath = svgPath }; if (!String.IsNullOrWhiteSpace(message)) { annotation.Replies = new AnnotationReplyInfo[] { new AnnotationReplyInfo { Message = message ?? "" } }; } using (var content = HttpContentNetExtensions.CreateJsonNetDataContract<AnnotationInfo>(annotation)) { var response = SubmitRequest<CreateAnnotationResponse>(template, parameters, "POST", content); if (response.Code != ResponseCode.Ok) { throw new GroupdocsServiceException(response.ErrorMessage); } return response.Result; } }
/// <summary> /// Retrieves default annotation for specified annotation type. /// </summary> /// <param name="type">Annotation type.</param> /// <returns><see cref="AnnotationUI"/> instance for specified annotation type.</returns> public AnnotationUI GetAnnotation(AnnotationType type) { var ann = ((AnnotationUI)_table[type]).Clone(); ann.Data.Name = type.ToString(); return(ann); }
//Used to Create Annotation Mesh // Local Position private GameObject createAnnotationGroup(AnnotationType annoType, Quaternion rotation, Vector3 position) { GameObject annotationType = getAnnotationTypeObject(annoType); GameObject newAnnotation = (GameObject)Instantiate(annotationType, position, rotation); newAnnotation.transform.localScale = new Vector3(5, 5, 5); newAnnotation.transform.SetParent(meshPositionNode.transform, false); newAnnotation.SetActive(true); //set Type newAnnotation.GetComponent <Annotation>().myType = annoType; //Create Label for annotation newAnnotation.GetComponent <Annotation> ().CreateLabel(annotationLabel); //set Color if (previewAnnotation != null) { newAnnotation.GetComponent <Annotation> ().changeColor(previewAnnotation.GetComponent <Annotation>().getColor()); } else { newAnnotation.GetComponent <Annotation> ().setDefaultColor(); } newAnnotation.GetComponent <Annotation> ().setDefaultTransparency(); return(newAnnotation); }
public bool HasAttributeFor(AnnotationType annotationType, string memberName = null) { if (!annotationType.HasFlag(AnnotationType.Attribute)) { return(false); } var name = "VB_" + annotationType; if (annotationType.HasFlag(AnnotationType.MemberAnnotation)) { //Debug.Assert(memberName != null); return(this.Any(a => a.Name.Equals($"{memberName}{name}", StringComparison.OrdinalIgnoreCase))); } if (annotationType.HasFlag(AnnotationType.ModuleAnnotation)) { //Debug.Assert(memberName == null); return(this .Any(a => a.Name.Equals(name, StringComparison.OrdinalIgnoreCase) && a.Values.Any(v => v.Equals("True", StringComparison.OrdinalIgnoreCase)))); } return(false); }
/// ------------------------------------------------------------------------------------ /// <summary> /// When there are no mark segments added to the audio document in SA to indicate word /// boundaries, the assumption is that all segments belong to a single word. Therefore /// all segments found for the specified annotation type will be combined into a single /// word in the specified AudioDocWords object. /// </summary> /// ------------------------------------------------------------------------------------ private void BuildSingleAnnotationWord(AnnotationType atype, AudioDocWords adw) { if (adw == null) { return; } uint offset; uint length; string segment; StringBuilder bldr = new StringBuilder(); // Read all the segments for the annotation type. while (ReadSegment((int)atype, out offset, out length, out segment)) { bldr.Append(segment); } // Make sure to save the last word constructed. if (bldr.Length > 0) { SortedDictionary <AnnotationType, string> wrds = ReflectionHelper.GetField(adw, "m_words") as SortedDictionary <AnnotationType, string>; if (wrds != null) { wrds[atype] = bldr.ToString(); } } }
public static AnnotationTypeDto ToAnnotationTypeDto(this AnnotationType annotationType) => new AnnotationTypeDto { Id = annotationType.Id, Name = annotationType.Name, Root = annotationType.Root };
public static object ToAnnotationTypeNative(AnnotationType annotationType) { switch (annotationType) { case AnnotationType.Comment: return(Interop.UIAutomationClient.UIA_AnnotationTypes.AnnotationType_Comment); case AnnotationType.Footer: return(Interop.UIAutomationClient.UIA_AnnotationTypes.AnnotationType_Footer); case AnnotationType.FormulaError: return(Interop.UIAutomationClient.UIA_AnnotationTypes.AnnotationType_FormulaError); case AnnotationType.GrammarError: return(Interop.UIAutomationClient.UIA_AnnotationTypes.AnnotationType_GrammarError); case AnnotationType.Header: return(Interop.UIAutomationClient.UIA_AnnotationTypes.AnnotationType_Header); case AnnotationType.Highlighted: return(Interop.UIAutomationClient.UIA_AnnotationTypes.AnnotationType_Highlighted); case AnnotationType.SpellingError: return(Interop.UIAutomationClient.UIA_AnnotationTypes.AnnotationType_SpellingError); case AnnotationType.TrackChanges: return(Interop.UIAutomationClient.UIA_AnnotationTypes.AnnotationType_TrackChanges); case AnnotationType.Unknown: return(Interop.UIAutomationClient.UIA_AnnotationTypes.AnnotationType_Unknown); default: throw new NotSupportedException(); } }
public BinaryAnnotation(string key, byte[] value, AnnotationType annotationType, IPEndPoint endpoint) : this() { Key = key; Value = value; AnnotationType = annotationType; Endpoint = endpoint; }
public BinaryAnnotation(string key, byte[] value, AnnotationType annotationType, Endpoint host) { Key = key; Value = value; AnnotationType = annotationType; Host = host; }
/// <summary> /// Parses query expression from annotation for annotation type. /// </summary> /// <param name="annotation">Grafana annotation.</param> /// <param name="useFilterExpression">Determines if query is using a filter expression.</param> /// <returns>Parsed annotation type for query expression from <paramref name="annotation"/>.</returns> public static AnnotationType ParseQueryType(this Annotation annotation, out bool useFilterExpression) { if (annotation == null) { throw new ArgumentNullException(nameof(annotation)); } string query = annotation.query ?? ""; Tuple <AnnotationType, bool> result = TargetCache <Tuple <AnnotationType, bool> > .GetOrAdd(query, () => { AnnotationType type = AnnotationType.Undefined; bool parsedFilterExpression = false; if (AdapterBase.ParseFilterExpression(query, out string tableName, out string _, out string _, out int _)) { parsedFilterExpression = true; switch (tableName.ToUpperInvariant()) { case "RAISEDALARMS": type = AnnotationType.RaisedAlarms; break; case "CLEAREDALARMS": type = AnnotationType.ClearedAlarms; break; default: throw new InvalidOperationException("Invalid FILTER table for annotation query expression."); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Loads the audio document writer with the data for the specified annotation type. /// </summary> /// ------------------------------------------------------------------------------------ private void LoadWriterWithSegments(AnnotationType type, List <SegmentInfo> segInfo) { foreach (SegmentInfo segment in segInfo) { m_writer.AddSegment((int)type, segment.offset, segment.length, segment.segment); } }
public BinaryAnnotation(string key, byte[] value, AnnotationType type, Endpoint endpoint) { this.key = Ensure.ArgumentNotNull(key, "key"); this.value = Ensure.ArgumentNotNull(value, "value"); this.type = Ensure.ArgumentNotNull(type, "type"); this.endpoint = endpoint; }
protected AnnotationBase(AnnotationType annotationType, QualifiedSelection qualifiedSelection, VBAParser.AnnotationContext context) { AnnotationType = annotationType; QualifiedSelection = qualifiedSelection; Context = context; _annotatedLine = new Lazy <int?>(GetAnnotatedLine); }
/// <summary> /// Creates an annotation. /// </summary> /// <param name="type">The annotation type.</param> /// <param name="codeLocation">The code location.</param> /// <param name="codeReference">The code reference.</param> /// <param name="message">The annotation message.</param> /// <param name="details">Additional details such as exception text or null if none.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="message"/> is null.</exception> public AnnotationData(AnnotationType type, CodeLocation codeLocation, CodeReference codeReference, string message, string details) { this.type = type; this.codeLocation = codeLocation; this.codeReference = codeReference; this.message = message; this.details = details; }
private AnnotationState(AnnotationType type, string message, string details, IDeclaredElementResolver declaredElementResolver) { this.type = type; this.message = message; this.details = details; this.declaredElementResolver = declaredElementResolver; }
/// <summary> /// Associates an annotation message of the specified type with the code element. /// </summary> /// <param name="type">The annotation type.</param> /// <param name="message">The annotation message.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="message"/> is null.</exception> public AnnotationPatternAttribute(AnnotationType type, string message) { if (message == null) throw new ArgumentNullException("message"); this.type = type; this.message = message; }
internal BinaryAnnotation(string key, byte[] value, AnnotationType annotationType, DateTime timestamp, string serviceName, IPEndPoint endPoint) { Key = key; Value = value; AnnotationType = annotationType; Timestamp = timestamp; Host = CreateEndPoint(serviceName, endPoint); }
protected FixedAttributeValueAnnotationBase(AnnotationType annotationType, QualifiedSelection qualifiedSelection, VBAParser.AnnotationContext context) : base(annotationType, qualifiedSelection, context) { var fixedAttributeValueInfo = FixedAttributeValueInfo(annotationType); Attribute = fixedAttributeValueInfo?.attribute ?? string.Empty; AttributeValues = fixedAttributeValueInfo?.attributeValues ?? new List <string>(); }
public AnnotationBase(Guid id, Guid server_id, Guid author_id, DateTime time, string author, AnnotationType type) { this.ID = id; this.server_id = server_id; this.author_id = author_id; this.Date = time; this.Author = author; this.type = type; }
public override int GetHashCode() { var hashCode = Start.GetHashCode() ^ Chromosome.GetHashCode(); hashCode = (hashCode * 397) ^ (AltAllele?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (AnnotationType?.GetHashCode() ?? 0); return(hashCode); }
protected BinaryAnnotation(string key, AnnotationType type) { if (key == null) { throw new ArgumentNullException(nameof(key)); } this.Key = key; this.AnnotationType = type; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds a segment string at the specified offset, with the specified length. /// </summary> /// ------------------------------------------------------------------------------------ public void AddSegment(int annotationType, uint offset, uint length, string annotation) { AnnotationType at = (AnnotationType)annotationType; if (at < AnnotationType.MusicPhraseLevel1) { uint segIndex = GetSegmentIndexFromOffset(offset); if (segIndex == System.UInt32.MaxValue) { segIndex = (uint)m_doc.m_segments.Count; m_doc.m_segments[segIndex] = new SegmentData(m_doc); } m_doc.m_segments[segIndex].OffsetInSeconds = m_doc.BytesToSeconds(offset); m_doc.m_segments[segIndex].DurationInSeconds = m_doc.BytesToSeconds(length); switch (at) { case AnnotationType.Phonetic: m_doc.m_segments[segIndex].Phonetic = annotation; break; case AnnotationType.Phonemic: m_doc.m_segments[segIndex].Phonemic = annotation; break; case AnnotationType.Tone: m_doc.m_segments[segIndex].Tone = annotation; break; case AnnotationType.Orthographic: m_doc.m_segments[segIndex].Orthographic = annotation; break; default: return; } } else if ((at >= AnnotationType.MusicPhraseLevel1) && (at <= AnnotationType.MusicPhraseLevel4)) { // we are looking at a phrase segment MusicSegmentKey key = new MusicSegmentKey(); key.PhraseLevel = (uint)(annotationType - AnnotationType.MusicPhraseLevel1 + 1); key.Offset = offset; if (!m_doc.m_musicSegments.ContainsKey(key)) { m_doc.m_musicSegments[key] = new MusicSegmentData(m_doc); } m_doc.m_musicSegments[key].OffsetInSeconds = m_doc.BytesToSeconds(offset); m_doc.m_musicSegments[key].DurationInSeconds = m_doc.BytesToSeconds(length); m_doc.m_musicSegments[key].PhraseLevel = key.PhraseLevel; m_doc.m_musicSegments[key].Annotation = annotation; } }
/// <summary> /// Associates an annotation message of the specified type with the code element. /// </summary> /// <param name="type">The annotation type.</param> /// <param name="message">The annotation message.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="message"/> is null.</exception> public AnnotationPatternAttribute(AnnotationType type, string message) { if (message == null) { throw new ArgumentNullException("message"); } this.type = type; this.message = message; }
public DescriptionAttributeAnnotationBase(AnnotationType annotationType, QualifiedSelection qualifiedSelection, VBAParser.AnnotationContext context, IEnumerable <string> attributeValues) : base(annotationType, qualifiedSelection, context, attributeValues?.Take(1).ToList()) { Description = AttributeValues?.FirstOrDefault(); if ((Description?.StartsWith("\"") ?? false) && Description.EndsWith("\"")) { // strip surrounding double quotes Description = Description.Substring(1, Description.Length - 2); } }
public AnnotationType Create(AnnotationType annotationType) { try { context.AnnotationTypes.Add(annotationType); context.SaveChanges(); return(annotationType); } catch (Exception e) { throw WrapOracleException(e); } }
/// <summary> /// SearchAnnotation /// </summary> /// <param name="keywords"></param> /// <param name="annotationType"></param> /// <returns></returns> public static List <Annotation> SearchAnnotation(string keywords, AnnotationType annotationType = AnnotationType.All) { List <Annotation> result = new List <Annotation>(); List <Annotation> beforeRemoveDuplicateResult = new List <Annotation>(); Dictionary <Guid, int> ExistedAnnotationIdDictionary = new Dictionary <Guid, int>(); try { List <string> critieriaStringList = SegmentUtil.Instance.PhraseSegment(keywords); if (critieriaStringList.Count > 0) { int SearchRound = 0; foreach (String critieriaString in critieriaStringList) { SearchRound++; foreach (Annotation element in AnnotationUtil.Instance.SearchAnnotations(critieriaString, annotationType)) { beforeRemoveDuplicateResult.Add(element); if (ExistedAnnotationIdDictionary.ContainsKey(element.AnnotationCode)) { if (ExistedAnnotationIdDictionary[element.AnnotationCode] < SearchRound) { ExistedAnnotationIdDictionary[element.AnnotationCode]++; } } else { ExistedAnnotationIdDictionary.Add(element.AnnotationCode, 1); } } } HashSet <Guid> duplicateList = new HashSet <Guid>(); foreach (Annotation e in beforeRemoveDuplicateResult) { if (ExistedAnnotationIdDictionary[e.AnnotationCode] == critieriaStringList.Count && !duplicateList.Contains(e.AnnotationCode)) { result.Add(e); } duplicateList.Add(e.AnnotationCode); } } return(result); } catch (Exception ex) { Logger.Log("Search Annotation Failed : " + ex.Message); return(result); } }
/// <summary> /// Parses query expression from annotation for annotation type. /// </summary> /// <param name="annotation">Grafana annotation.</param> /// <param name="useFilterExpression">Determines if query is using a filter expression.</param> /// <returns>Parsed annotation type for query expression from <paramref name="annotation"/>.</returns> public static AnnotationType ParseQueryType(this Annotation annotation, out bool useFilterExpression) { if ((object)annotation == null) { throw new ArgumentNullException(nameof(annotation)); } string query = annotation.query ?? ""; Tuple <AnnotationType, bool> result = TargetCache <Tuple <AnnotationType, bool> > .GetOrAdd(query, () => { AnnotationType type = AnnotationType.Undefined; string tableName, expression, sortField; int takeCount; bool parsedFilterExpression = false; if (AdapterBase.ParseFilterExpression(query, out tableName, out expression, out sortField, out takeCount)) { parsedFilterExpression = true; switch (tableName.ToUpperInvariant()) { case "RAISEDALARMS": type = AnnotationType.RaisedAlarms; break; case "CLEAREDALARMS": type = AnnotationType.ClearedAlarms; break; default: throw new InvalidOperationException("Invalid FILTER table for annotation query expression."); } } else if (query.StartsWith("#RaisedAlarms", StringComparison.OrdinalIgnoreCase)) { type = AnnotationType.RaisedAlarms; } else if (query.StartsWith("#ClearedAlarms", StringComparison.OrdinalIgnoreCase)) { type = AnnotationType.ClearedAlarms; } if (type == AnnotationType.Undefined) { throw new InvalidOperationException("Unrecognized type or syntax for annotation query expression."); } return(new Tuple <AnnotationType, bool>(type, parsedFilterExpression)); }); useFilterExpression = result.Item2; return(result.Item1); }
private void changeAnnoTypeTo(GameObject annotationGroup, AnnotationType newType) { if (annotationGroup != null) { currentAnnotationType = newType; GameObject curAnnoGroup = annotationGroup.GetComponent <AnnotationListEntry> ().getAnnotation(); GameObject newAnnoGroup = createAnnotationGroup(newType, curAnnoGroup.GetComponent <Transform> ().localRotation, curAnnoGroup.GetComponent <Transform> ().localPosition); annotationGroup.GetComponent <AnnotationListEntry> ().replaceMyAnnotationMesh(newAnnoGroup); updatePatientAnnotationList(); } }
public override int GetHashCode() { // ReSharper disable NonReadonlyMemberInGetHashCode var hashCode = Start.GetHashCode() ^ Chromosome.GetHashCode(); hashCode = (hashCode * 397) ^ (AlternateAllele?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (AnnotationType?.GetHashCode() ?? 0); // ReSharper restore NonReadonlyMemberInGetHashCode return(hashCode); }
/// <summary> /// Gets all the annotations from the response payload. /// </summary> /// <param name="jObj">The response payload.</param> /// <param name="version">The version of the odata service.</param> /// <param name="type">The annotation type.</param> /// <param name="annotations">Stores all the annotation which were got from the response payload.</param> public static void GetAnnotationsFromResponsePayload(JObject jObj, ODataVersion version, AnnotationType type, ref List<JProperty> annotations) { if (jObj != null && annotations != null) { var jProps = jObj.Children(); foreach (JProperty jProp in jProps) { if (jProp.Value.Type == JTokenType.Object) { GetAnnotationsFromResponsePayload((JObject)jProp.Value, version, type, ref annotations); } else if (jProp.Value.Type == JTokenType.Array) { var objs = jProp.Value.Children(); foreach (var obj in objs) { if (typeof(JObject) == obj.GetType()) { GetAnnotationsFromResponsePayload((JObject)obj, version, type, ref annotations); } } } else { // If the property's name contains dot(.), it will indicate that this property is an annotation. if (jProp.Name.Contains(".")) { switch (type) { default: case AnnotationType.All: annotations.Add(jProp); break; case AnnotationType.ArrayOrPrimitive: if (version == ODataVersion.V4 ? !jProp.Name.StartsWith("@") : jProp.Name.Contains("@")) { annotations.Add(jProp); } break; case AnnotationType.Object: if (version == ODataVersion.V4 ? jProp.Name.StartsWith("@") : !jProp.Name.Contains("@")) { annotations.Add(jProp); } break; } } } } } }
private static IEnumerable<AnnotationData> GetAnnotationsWithType(Report report, AnnotationType type) { if (report.TestModel == null) yield break; foreach (AnnotationData annotation in report.TestModel.Annotations) { if (annotation.Type == type) yield return annotation; } }
private AnnotationBuilder(AnnotationType type, AnnotationSurfaceSize size, Guid toolId, int currentPage) { this.surfaceSize = size; this.type = type; this.annotation = new Annotation() { Type = type, Points = new List<AnnotationPoint>(), PageNumber = currentPage, ToolId = toolId }; }
private void SetupAnnotationData(AnnotationType annotationType) { var testModelData = new TestModelData(); testModelData.Annotations.Add(new AnnotationData(annotationType, CodeLocation.Unknown, new CodeReference(), "message", "details")); var report = new Report { TestModel = testModelData }; testController .Stub(x => x.ReadReport(null)) .IgnoreArguments() .Repeat.Any() .Do((Action<ReadAction<Report>>)(action => action(report))); }
/// <summary> /// Gets annotations type. /// </summary> /// <param name="annotable"> /// The annotable. /// </param> /// <returns> /// The <see cref="AnnotationsType"/>. /// </returns> internal AnnotationsType GetAnnotationsType(IAnnotableObject annotable) { if (!ObjectUtil.ValidCollection(annotable.Annotations)) { return null; } var returnType = new AnnotationsType(); /* foreach */ foreach (IAnnotation currentAnnotationBean in annotable.Annotations) { var annotation = new AnnotationType(); returnType.Annotation.Add(annotation); string value2 = currentAnnotationBean.Id; if (!string.IsNullOrWhiteSpace(value2)) { annotation.id = currentAnnotationBean.Id; } if (ObjectUtil.ValidCollection(currentAnnotationBean.Text)) { annotation.AnnotationText = this.GetTextType(currentAnnotationBean.Text); } string value1 = currentAnnotationBean.Title; if (!string.IsNullOrWhiteSpace(value1)) { annotation.AnnotationTitle = currentAnnotationBean.Title; } string value = currentAnnotationBean.Type; if (!string.IsNullOrWhiteSpace(value)) { annotation.AnnotationType1 = currentAnnotationBean.Type; } if (currentAnnotationBean.Uri != null) { annotation.AnnotationURL = currentAnnotationBean.Uri; } } return returnType; }
/// <summary> /// Gets the annotations of the specified type with the same label. /// </summary> /// <param name="data">Database.</param> /// <param name="type">Annotation type.</param> /// <returns>Annotations per label for the specified annotation type.</returns> public static Dictionary<string, List<KeyValuePair<string, Annotation>>> GetAnnotationsByLabels(this Database data, AnnotationType type) { var annotations = new Dictionary<string, List<KeyValuePair<string, Annotation>>>(); foreach (var pair in data.GetAnnotations()) { if (pair.Value.Type != type) continue; var annLabel = pair.Value.Label; if (!annotations.ContainsKey(annLabel)) annotations.Add(annLabel, new List<KeyValuePair<string, Annotation>>()); annotations[annLabel].Add(pair); } return annotations; }
public ProteinHoarder(IEnumerable<CsvFile> csvFiles, string fastaFile, string outputDirectory, int minPeptidesPerGroup = 1, int maxMissedCleavages = 3, double maxFDR = 1, AnnotationType annotationType = AnnotationType.None, bool useConservativePScore = true, bool useQuant = false, bool useMedian = false, bool duplexQuantitation = false, bool useNoiseBandCap = false, HashSet<Modification> modstoignore = null, bool filterquantInterference = true, double quantInterferenceCutoff = 0.25, bool includeUnfilteredResults = false, bool ignorePeptideWithMissingData = false, bool semiDigestion = false, bool proteinPerMinute = false, bool sequenceCoverageMap = false) { CsvFiles = new List<CsvFile>(csvFiles); FastaFile = fastaFile; OutputDirectory = outputDirectory; MaxMissedCleavages = maxMissedCleavages; MaxFdr = maxFDR; MinPeptidesPerGroup = minPeptidesPerGroup; AnnotationType = annotationType; UseConservativePScore = useConservativePScore; UseQuant = useQuant; UseMedianForQuantitation = useMedian; DuplexQuantitation = duplexQuantitation; UseOnlyCompleteSets = useNoiseBandCap; Quantitation.UseMedian = useMedian; ModificationsToIgnore = modstoignore; FilterQuantInterference = filterquantInterference; QuantInterferenceCutoff = quantInterferenceCutoff; IncludeNonFilteredResults = includeUnfilteredResults; IgnorePeptideWithMissingData = ignorePeptideWithMissingData; SemiDigestion = semiDigestion; ProteinsPerMinute = proteinPerMinute; SequenceCoverageMap = sequenceCoverageMap; }
public static void saveAnnotation(Guid id, DateTime time, Guid author_id, string author, AnnotationType type, string text, string picture_location, Guid question_id, Guid server_id, bool saved, SQLiteConnection database) { Debug.WriteLine(String.Format("Saving annotation ID {0}", id)); if (author == null) { throw new ArgumentNullException("author"); } Hashtable data = new Hashtable(); data["id"] = SQLHelper.FormatAndAddQuotes(id.ToString()); data["text"] = SQLHelper.NullOrFormatAndAddQuotes(text); data["photo_path"] = SQLHelper.NullOrFormatAndAddQuotes(picture_location); data["saved"] = Convert.ToInt16(saved); data["time"] = SQLHelper.FormatAndAddQuotes(time.ToUniversalTime().ToString(SQLHelper.DateFormatString)); data["type"] = (int)type; data["author"] = SQLHelper.FormatAndAddQuotes(author); data["server_id"] = SQLHelper.FormatAndAddQuotes(server_id.ToString()); data["question_id"] = SQLHelper.NullOrFormatAndAddQuotes(question_id.ToString()); data["author_id"] = SQLHelper.FormatAndAddQuotes(author_id.ToString()); string insert = String.Format("INSERT INTO {0} {1}", SensorShareConfig.AnnotationTableName, SQLHelper.GenerateColumnsAndValues(data)); Debug.WriteLine(insert); using (SQLiteCommand command = new SQLiteCommand(insert, database)) { if (command.Connection.State != ConnectionState.Open) { command.Connection.Open(); } command.ExecuteNonQuery(); } database.Close(); }
public static void saveAnnotation(Guid id, DateTime time, Guid author_id, string author, AnnotationType type, string text, string picture_location, Guid question_id, Guid server_id, SQLiteConnection database) { DatabaseHelper.saveAnnotation(id, time, author_id, author, type, text, picture_location, question_id, server_id, true, database); }
/// <summary> /// Associates an annotation message of the specified type with the code element. /// </summary> /// <param name="type">The annotation type.</param> /// <param name="message">The annotation message.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="message"/> is null.</exception> public AnnotationAttribute(AnnotationType type, string message) : base(type, message) { }
public AnnotationBuilder CreateBuilder(AnnotationType type) { return AnnotationBuilder.Create(type, SurfaceSize, Meeting.ActiveTool.CurrentPageNumber, Meeting.ActiveTool.ToolId); }
public static AnnotationBuilder Create(AnnotationType type, AnnotationSurfaceSize size, int currentPage, Guid toolId) { return new AnnotationBuilder(type, size, toolId, currentPage); }
/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM READER ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// // public AnnotationObjectCore(SdmxReader reader, ISdmxObject parent) { // super(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ANNOTATION), parent); // this.id = reader.getAttributeValue("id", false); // while(processNextElement(reader)) { // } // return; // } // private boolean processNextElement(SdmxReader reader) { // string nextEl = reader.peek(); // if(nextEl.equals("AnnotationTitle")) { // reader.moveNextElement(); // this.title = reader.getCurrentElementValue(); // return true; // } // if(nextEl.equals("AnnotationType")) { // reader.moveNextElement(); // this.type = reader.getCurrentElementValue(); // return true; // } // if(nextEl.equals("AnnotationURL")) { // reader.moveNextElement(); // setURL(reader.getCurrentElementValue()); // return true; // } // if(nextEl.equals("AnnotationText")) { // reader.moveNextElement(); // this.text.add(new TextTypeWrapperImpl(reader.getAttributeValue("lang", false), reader.getCurrentElementValue(), this)); // return true; // } // return false; // } /////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM V2.1 SCHEMA ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Initializes a new instance of the <see cref="AnnotationObjectCore"/> class. /// </summary> /// <param name="annotation"> /// The annotation. /// </param> /// <param name="parent"> /// The parent. /// </param> /// <exception cref="SdmxException"> /// Throws Validate exception. /// </exception> public AnnotationObjectCore(AnnotationType annotation, ISdmxObject parent) : base(_annotationType, parent) { this._text = new List<ITextTypeWrapper>(); this._title = annotation.AnnotationTitle; this._type = annotation.AnnotationType1; this._id = annotation.id; this._text = TextTypeUtil.WrapTextTypeV21(annotation.AnnotationText, this); this.Uri = annotation.AnnotationURL; try { this.Validate(); } catch (SdmxException ex) { throw new SdmxException("Annotation is not valid", ex); } catch (Exception th) { throw new SdmxException("Annotation is not valid", th); } }
/// <summary> /// Parses source definitions for an annotation query. /// </summary> /// <param name="annotation">Grafana annotation.</param> /// <param name="type">Annotation type.</param> /// <param name="source">Metadata of source definitions.</param> /// <param name="useFilterExpression">Determines if query is using a filter expression.</param> /// <returns>Parsed source definitions from <paramref name="annotation"/>.</returns> public static Dictionary<string, DataRow> ParseSourceDefinitions(this Annotation annotation, AnnotationType type, DataSet source, bool useFilterExpression) { if ((object)annotation == null) throw new ArgumentNullException(nameof(annotation)); if ((object)source == null) throw new ArgumentNullException(nameof(source)); if (type == AnnotationType.Undefined) throw new InvalidOperationException("Unrecognized type or syntax for annotation query expression."); string query = annotation.query ?? ""; DataRow[] rows; if (useFilterExpression) { string tableName, expression, sortField; int takeCount; if (AdapterBase.ParseFilterExpression(query, out tableName, out expression, out sortField, out takeCount)) rows = source.Tables[tableName.Translate()].Select(expression, sortField).Take(takeCount).ToArray(); else throw new InvalidOperationException("Invalid FILTER syntax for annotation query expression."); } else { // Assume all records if no filter expression was provided rows = source.Tables[type.TableName().Translate()].Rows.Cast<DataRow>().ToArray(); } Dictionary<string, DataRow> definitions = new Dictionary<string, DataRow>(StringComparer.OrdinalIgnoreCase); foreach (DataRow row in rows) { MeasurementKey key = GetTargetFromGuid(row[type.TargetFieldName()].ToString()); if (key != MeasurementKey.Undefined) definitions[key.ID.ToString()] = row; } return definitions; }
public AnnotationEntry(string uniqueID, string name, AnnotationType type) { UniqueID = uniqueID; Name = name; Type = type; }
public void AddAnnotation(AnnotationType annotationType, AnnotationEntry annotationEntry) { List<AnnotationEntry> outEntries = null; if (AnnotationEntries.TryGetValue(annotationType, out outEntries)) { if(!outEntries.Contains(annotationEntry)) { outEntries.Add(annotationEntry); } } else { List<AnnotationEntry> addList = new List<AnnotationEntry>(); addList.Add(annotationEntry); AnnotationEntries.Add(annotationType, addList); } }
/// <summary> /// Count the number of annotations of the specified type with the same label. /// </summary> /// <param name="data">Database.</param> /// <param name="type">Annotation type.</param> /// <returns>The number of annotations per label for the specified annotation type.</returns> public static Dictionary<string, int> AnnotationCountByLabels(this Database data, AnnotationType type) { Dictionary<string, int> labelCounts = new Dictionary<string, int>(); foreach (var pair in data.GetAnnotationsByLabels(type)) { labelCounts[pair.Key] = pair.Value.Count; } return labelCounts; }
/// <summary> /// Creates an annotation with no details. /// </summary> /// <param name="type">The annotation type.</param> /// <param name="codeElement">The associated code element, or null if none.</param> /// <param name="message">The annotation message.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="message"/> is null.</exception> public Annotation(AnnotationType type, ICodeElementInfo codeElement, string message) : this(type, codeElement, message, (string) null) { }
public AnnotationBase(AnnotationType annotationType, QualifiedSelection qualifiedSelection) { _annotationType = annotationType; _qualifiedSelection = qualifiedSelection; }
protected AIMQueryParameters(AIMQueryParameters queryParameters) { foreach (AimAnatomicEntityQueryData aeQueryData in queryParameters.AeQueryParameters) AeQueryParameters.Add(new AimAnatomicEntityQueryData(aeQueryData)); foreach (AimImagingObservationQueryData imQueryData in queryParameters.ImQueryParameters) ImQueryParameters.Add(new AimImagingObservationQueryData(imQueryData)); foreach (QueryData queryData in queryParameters.StudyInstanceUidParameters) StudyInstanceUidParameters.Add(new QueryData(queryData)); foreach (QueryData queryData in queryParameters.UserParameters) UserParameters.Add(new QueryData(queryData)); _annotationType = queryParameters._annotationType; }
private static FacadeCategory GetCategoryForAnnotation(AnnotationType type) { switch (type) { case AnnotationType.Error: return FacadeCategory.Error; case AnnotationType.Warning: return FacadeCategory.Warning; case AnnotationType.Info: return FacadeCategory.Info; default: throw new ArgumentException("type"); } }
/// <summary> /// Read the data from a given MemoryStream and return that steam with the pointer at the end of the data /// </summary> /// <remarks>Will Seek the start of the MemoryStream given and leave it at the end of the bytes loaded. Exceptions must be caught upstream.</remarks> /// <returns>A MemoryStream with the pointer set at the end of the data read.</returns> protected MemoryStream ReadBaseData(MemoryStream ms) { ms.Seek(0, SeekOrigin.Begin); // ID byte[] readData = new byte[16]; ms.Read(readData, 0, 16); this.ID = new Guid(readData); // ServerID readData = new byte[16]; ms.Read(readData, 0, 16); this.server_id = new Guid(readData); // AuthorID readData = new byte[16]; ms.Read(readData, 0, 16); this.AuthorID = new Guid(readData); // Date readData = new byte[sizeof(Int64)]; ms.Read(readData, 0, sizeof(Int64)); this.BinaryDate = BitConverter.ToInt64(readData, 0); // Type readData = new byte[sizeof(Int32)]; ms.Read(readData, 0, sizeof(Int32)); this.type = (AnnotationType)BitConverter.ToInt32(readData, 0); //Author this.Author = TextHelper.DeStreamString(ms); return ms; }
/// <summary> /// Creates an annotation with a detail exception. /// </summary> /// <param name="type">The annotation type.</param> /// <param name="codeElement">The associated code element, or null if none.</param> /// <param name="message">The annotation message.</param> /// <param name="ex">The exception to use as additional details or null if none.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="message"/> is null.</exception> public Annotation(AnnotationType type, ICodeElementInfo codeElement, string message, Exception ex) : this(type, codeElement, message, ex != null ? ExceptionUtils.SafeToString(ex) : null) { }
/// <summary> /// Parses source definitions for an annotation query. /// </summary> /// <param name="request">Grafana annotation request.</param> /// <param name="type">Annotation type.</param> /// <param name="source">Metadata of source definitions.</param> /// <param name="useFilterExpression">Determines if query is using a filter expression.</param> /// <returns>Parsed source definitions from annotation <paramref name="request"/>.</returns> public static Dictionary<string, DataRow> ParseSourceDefinitions(this AnnotationRequest request, AnnotationType type, DataSet source, bool useFilterExpression) { if ((object)request == null) throw new ArgumentNullException(nameof(request)); return request.annotation.ParseSourceDefinitions(type, source, useFilterExpression); }