public FoldMarker(int startLine, int startColumn, int endLine, int endColumn, FoldType foldType) { this.startLine = startLine; this.startColumn = startColumn; this.endLine = endLine; this.endColumn = endColumn; this.foldType = foldType; }
void AddFolding(SyntaxToken openBrace, SyntaxToken closeBrace, FoldType type) { openBrace = openBrace.GetPreviousToken(false, false, true, true); try { var first = openBrace.GetLocation().GetLineSpan(); var last = closeBrace.GetLocation().GetLineSpan(); if (first.EndLinePosition.Line != last.EndLinePosition.Line) { Foldings.Add(new FoldingRegion(new DocumentRegion(first.EndLinePosition, last.EndLinePosition), type)); } } catch (ArgumentOutOfRangeException) {} }
public FoldMarker(IDocument document, int startLine, int startColumn, int endLine, int endColumn, FoldType foldType, string foldText, bool isFolded) { this.document = document; startLine = Math.Min(document.TotalNumberOfLines - 1, Math.Max(startLine, 0)); ISegment startLineSegment = document.GetLineSegment(startLine); endLine = Math.Min(document.TotalNumberOfLines - 1, Math.Max(endLine, 0)); ISegment endLineSegment = document.GetLineSegment(endLine); // Prevent the region from completely disappearing if (string.IsNullOrEmpty(foldText)) { foldText = "..."; } this.FoldType = foldType; this.foldText = foldText; this.offset = startLineSegment.Offset + Math.Min(startColumn, startLineSegment.Length); this.length = (endLineSegment.Offset + Math.Min(endColumn, endLineSegment.Length)) - this.offset; this.isFolded = isFolded; }
public FoldMarker(IDocument document, int startLine, int startColumn, int endLine, int endColumn, FoldType foldType, string foldText, bool isFolded) { this.document = document; startLine = Math.Min(document.TotalNumberOfLines - 1, Math.Max(startLine, val2: 0)); ISegment startLineSegment = document.GetLineSegment(startLine); endLine = Math.Min(document.TotalNumberOfLines - 1, Math.Max(endLine, val2: 0)); ISegment endLineSegment = document.GetLineSegment(endLine); // Prevent the region from completely disappearing if (string.IsNullOrEmpty(foldText)) { foldText = "..."; } FoldType = foldType; FoldText = foldText; offset = startLineSegment.Offset + Math.Min(startColumn, startLineSegment.Length); length = endLineSegment.Offset + Math.Min(endColumn, endLineSegment.Length) - offset; IsFolded = isFolded; }
public FoldMarker(IDocument document, int startLine, int startColumn, int endLine, int endColumn, FoldType foldType, string foldText, bool isFolded) { this.document = document; startLine = Math.Min(document.TotalNumberOfLines - 1, Math.Max(startLine, 0)); ISegment startLineSegment = document.GetLineSegment(startLine); endLine = Math.Min(document.TotalNumberOfLines - 1, Math.Max(endLine, 0)); ISegment endLineSegment = document.GetLineSegment(endLine); this.FoldType = foldType; this.foldText = foldText; this.offset = startLineSegment.Offset + startColumn; this.length = (endLineSegment.Offset + endColumn) - this.offset; this.isFolded = isFolded; }
public FoldingRegion(DocumentRegion region, FoldType type) : this(null, region, type) { }
public FoldingRegion(string name, DocumentRegion region, FoldType type, bool isFoldedByDefault) : this(name, region) { this.Type = type; this.IsFoldedByDefault = isFoldedByDefault; }
public FoldingRegion(string name, DocumentRegion region, FoldType type) : this(name, region) { this.Type = type; }
public override double CalculateFitness(char[] reference) { int Orientation = 0; var positions = new Point[reference.Length]; var types = new FoldType[reference.Length]; var currentPoint = new Point { X = 0, Y = 0 }; double cNeighbour = 0; double cOverlapp = 0; int seqLength = this.BaseType.Length; if (seqLength != reference.Length - 1) { throw new Exception("Sequenzelengths do not match"); } // Create Field for (int i = 0; i < reference.Length; i++) { Direction currentDirection; if (i == reference.Length - 1) { currentDirection = Direction.U; } else { currentDirection = cD[this.BaseType[i]]; } var currentType = types[i] = cT[reference[i]]; var iDirection = (int)currentDirection; positions[i] = currentPoint; currentPoint.X += OrientMapping[0][Orientation][iDirection]; currentPoint.Y += OrientMapping[1][Orientation][iDirection]; Orientation = ((iDirection - 2) + Orientation).mod(4); } int refL = reference.Length - 1; for (int leftI = 0; leftI < refL; leftI++) { for (int rightI = reference.Length - 1; rightI > leftI; rightI--) { var posRight = positions[rightI]; var posLeft = positions[leftI]; var distance = posRight.distance(positions[leftI]); //Console.WriteLine("{0},{1} -> {2},{3} {4},{5} D: {6}", leftI, rightI, positions[leftI].X, positions[leftI].Y, positions[rightI].X, positions[rightI].Y, distance); if (distance == 0) { //overlapp //Console.WriteLine("Overlapp"); cOverlapp++; } else if (distance == 1) { if (types[leftI] == FoldType.Hydrophobic && types[rightI] == FoldType.Hydrophobic) { if (positions[leftI + 1].distance(posRight) != 0) //nextPoint is not the next Point in chain //Console.WriteLine("{0},{1},{2}", nextX, nextY, nextPos.distance(posRight)); //Console.WriteLine("{0},{1} near {2},{3}", positions[leftI].X, positions[leftI].Y, positions[rightI].X, positions[rightI].Y); { cNeighbour++; } } } else { rightI -= (distance - 2); } } } return(Folding.ScaleFitness(cOverlapp, cNeighbour)); }
public FoldMarker(Document document, int startLine, int startColumn, int endLine, int endColumn, FoldType foldType, string foldText) : this(document, startLine, startColumn, endLine, endColumn, foldType, foldText, false) { }
void AddFolding (SyntaxToken openBrace, SyntaxToken closeBrace, FoldType type) { openBrace = openBrace.GetPreviousToken (false, false, true, true); try { var first = openBrace.GetLocation ().GetLineSpan (); var last = closeBrace.GetLocation ().GetLineSpan (); if (first.EndLinePosition.Line != last.EndLinePosition.Line) Foldings.Add (new FoldingRegion (new DocumentRegion (first.EndLinePosition, last.EndLinePosition), type)); } catch (ArgumentOutOfRangeException) {} }
public static string Print(this FoldType elem) { return(elem == FoldType.Hydrophilic ? "1" : "0"); }
private List <FoldMarker> GetFoldMarkers(IDocument doc, IBaseScope root, string fileName) { List <FoldMarker> foldMarkers = new List <FoldMarker>(); if (!(root is ITypeScope)) { Position pos = root.GetPosition(); if (pos.file_name != null) { Position head_pos = root.GetHeaderPosition(); FoldMarker newFoldMarker = null; if (head_pos.file_name == null) { if (root is ImplementationUnitScope) { Position unit_pos = root.TopScope.GetPosition(); newFoldMarker = new FoldMarker(doc, pos.line - 1, pos.column - 1, unit_pos.end_line - 1, unit_pos.end_column, FoldType.MemberBody); } else { newFoldMarker = new FoldMarker(doc, pos.line - 1, pos.column - 1, pos.end_line - 1, pos.end_column, FoldType.MemberBody); } } else { newFoldMarker = new FoldMarker(doc, head_pos.end_line - 1, head_pos.end_column - 1, pos.end_line - 1, pos.end_column, FoldType.MemberBody); } if (newFoldMarker.Length > 0) { foldMarkers.Add(newFoldMarker); } } if (root.Regions != null) { foreach (Position p in root.Regions) { foldMarkers.Add(new RegionFoldMarker(doc, p.line - 1, p.column, p.end_line - 1, p.end_column, FoldType.MemberBody, p.fold_text)); } } Position body_pos = root.GetBodyPosition(); if (body_pos.file_name != null) { FoldMarker newFoldMarker = null; newFoldMarker = new FoldMarker(doc, body_pos.line - 1, body_pos.column - 1, body_pos.end_line - 1, body_pos.end_column, FoldType.MemberBody); if (newFoldMarker.Length > 0) { foldMarkers.Add(newFoldMarker); } } } foreach (IBaseScope ss in root.Members) { if (ss is ITypeScope) { Position body_pos = ss.GetBodyPosition(); Position head_pos = ss.GetHeaderPosition(); if (head_pos.file_name == null || body_pos.file_name == null) { continue; } FoldMarker newFoldMarker = new FoldMarker(doc, head_pos.end_line - 1, head_pos.end_column - 1, body_pos.end_line - 1, body_pos.end_column, FoldType.TypeBody); if (newFoldMarker.Length > 0) { foldMarkers.Add(newFoldMarker); } foldMarkers.AddRange(GetFoldMarkers(doc, ss, fileName)); } else if (ss is IProcScope) { FoldType ft = FoldType.MemberBody; Position head_pos = ss.GetHeaderPosition(); Position body_pos = ss.GetBodyPosition(); if (head_pos.file_name == null || body_pos.file_name == null) { continue; } FoldMarker newFoldMarker = new FoldMarker(doc, head_pos.end_line - 1, head_pos.end_column, body_pos.end_line - 1, body_pos.end_column, ft); if (newFoldMarker.Length > 0) { foldMarkers.Add(newFoldMarker); } } else if (ss is IImplementationUnitScope) { foldMarkers.AddRange(GetFoldMarkers(doc, ss, fileName)); } } return(foldMarkers); }
public RegionFoldMarker(IDocument document, int startLine, int startColumn, int endLine, int endColumn, FoldType foldType, string foldText) : base(document, startLine, startColumn, endLine, endColumn, foldType, foldText) { }
public FoldMarker(IDocument document, int startLine, int startColumn, int endLine, int endColumn, FoldType foldType) : this(document, startLine, startColumn, endLine, endColumn, foldType, "...") { }
public FoldMarker(IDocument document, int startLine, int startColumn, int endLine, int endColumn, FoldType foldType, string foldText) : this(document, startLine, startColumn, endLine, endColumn, foldType, foldText, false) { }
public FoldingRegion (string name, DocumentRegion region, FoldType type) : this (name, region) { this.Type = type; }
public FoldMarker(Document document, int startLine, int startColumn, int endLine, int endColumn, FoldType foldType) : this(document, startLine, startColumn, endLine, endColumn, foldType, "...") { }
public FoldingRegion (string name, DocumentRegion region, FoldType type, bool isFoldedByDefault) : this (name, region) { this.Type = type; this.IsFoldedByDefault = isFoldedByDefault; }
public FoldingRegion (DocumentRegion region, FoldType type) : this (null, region, type) { }
public FoldMarker(IDocument document, int startLine, int startColumn, int endLine, int endColumn, FoldType foldType, string foldText, bool isFolded) { this.document = document; startLine = Math.Min(document.TotalNumberOfLines - 1, Math.Max(startLine, 0)); ISegment startLineSegment = document.GetLineSegment(startLine); endLine = Math.Min(document.TotalNumberOfLines - 1, Math.Max(endLine, 0)); ISegment endLineSegment = document.GetLineSegment(endLine); if (string.IsNullOrEmpty(foldText)) { foldText = "..."; } this.FoldType = foldType; this.foldText = foldText; this.offset = startLineSegment.Offset + Math.Min(startColumn, startLineSegment.Length); this.length = (endLineSegment.Offset + Math.Min(endColumn, endLineSegment.Length)) - this.offset; this.isFolded = isFolded; }