text:
var InstagramApi = (function(options){
    var shared = {},
        options = options || {};

    var access_token = "228523518.e6e158d.43e428c17026491294d002bcadba0e7f";
    //https://api.instagram.com/oauth/authorize/?client_id=e6e158d6b61547739924dffdf92113b9&redirect_uri=https://localhost:8888/wd4-googlemapsinstagram/&response_type=token&scope=basic+public_content+follower_list+comments+relationships+likes

    CLIENT_ID= "e6e158d6b61547739924dffdf92113b9";
    // CLIENT_SECRET = "4c0b32153ec24c9cb834382a0ec5dd38";
    // var redirect_url = 'https://localhost:8888/wd4-googlemapsinstagram/';

    function setupListeners(){
        setUpInstaLocation();
    }

    function setUpInstaLocation( name, callback ){

        $('form[name=instagram] button').click(function(event) {
            var $e = $(event.currentTarget),
                $form = $e.closest('form'),
                params = {},
                $results = $form.find('#instagram ul'),
                keyword = $form.find('input[name=q]').val();

            // params['op'] = 'search_instagram'; // which PHP function to run
            // params['q'] = keyword; // argument for the Twitter search API
            // var $count_f = $form.find('input[name=count]');
            // if ($count_f) {
            //     params['count'] = $count_f.val();// argument for the Twitter search API
            // }
            // var $result_type_f = $form.find('select[name=result_type]');
            // if ($result_type_f) {
            //     params['result_type'] = $result_type_f.val();// argument for the Twitter search API
            // }
            //786 New Bushy Branch Road
            //Manchester, TN 37355
            // var keyword = [
            //     lat: 35.475123,
            //     log:-86.051883
            // ]
            //var bonarooLoc = 'lat=35.475123&lng=-86.051883';
            //var endpoint = 'https://api.instagram.com/v1/media/search?' + bonarooLoc + '&access_token=' + access_token;

            //lollapalooza id = 44095688, 228523518, 44095688
            //bonnaroo id = 13203488

            //window._sharedData.entry_data.ProfilePage[0].user.id
            //tag-name
            //works var endpoint = 'https://api.instagram.com/v1/tags/search?q=' + keyword + '&access_token=' + access_token;

            //try to make work
            var endpoint = 'https://api.instagram.com/v1/tags/' + keyword + '/media/recent?access_token=' + access_token ;

            //user 228523518 work
            //var endpoint ='https://api.instagram.com/v1/users/'+ keyword + '/media/recent/?access_token=' + access_token;

            //var endpoint ='https://api.instagram.com/v1/locations/' + keyword + '/media/recent?access_token=' + access_token;
            //https://api.instagram.com/v1/media/search?
            //var endpoint = 'https://api.instagram.com/v1/locations/search?' + keyword + '&access_token=' + access_token;
            //var endpoint = 'https://api.instagram.com/v1/tags/'+keyword+'/media/recent?access_token=' + access_token;
            $.ajax({
                type: 'GET',
                dataType: "jsonp",
                url: endpoint,
                resultElements: $results,
                data: params//,
                // keyword: keyword
            }).done(function(response) {
                //if(typeof callback === 'function') callback (response);
                console.log(response.data);
                $results.empty();

                for (var i = response.data.length - 1; i >= 0; i--) {
                    var status = response.data[i];
                    var imageUrl = '';
                    var imageDisplay = ''+ imageUrl + '';
                    $results.append(imageUrl);
                    $results.append(highlightedUrl);
                    var highlightedUrl = RegExModule.highlightKeyword(status.link);

                    console.log(status);
                    if ( status.location ) {
                    GoogleMapApi.createMarker({
                        lat: status.location.latitude, // use real data instead
                        lng: status.location.longitude, // use real data instead
                        name: status.location.name, // use real data instead
                        //image: imageDisplay,
                        content: imageDisplay
                });
                    //$results.append('')

                }

            }
                //displayTweets($results, response.statuses, keyword);
                //displayTweetsOnMap($results, response.statuses, keyword);
            });
                return false;
        });
    }

    function urlString( string ){
        var newHighlightedString = string.replace(newString, '' + newString + '');
        // (fill in code here)
        //and then return the new string:
        return newHighlightedString;
    }

    var init = function() {
        console.log('init()');
        setupListeners();
    };
    shared.init = init;

    return {
        init: init,
        setUpInstaLocation: setUpInstaLocation,
        urlString: urlString
    }
}());

InstagramApi.init({
    // client_id: 'e6e158d6b61547739924dffdf92113b9';
});
// InstagramApi.setUpInstaLocation('cat', function(r) {
//     console.log(r);
// });

var TwitterApi = (function(options) {
    var shared = {},
        options = options || {};

    function setupListeners() {
        //console.log('setupListeners()');

        setupTimeline();
        setupSearch();
        // displayTweets();
    }

    function setupTimeline() {
        $('form[name=timeline] button').click(function(event) {
            var $e = $(event.currentTarget),
                $form = $e.closest('form'),
                screen_name = $form.find('input[type=text]').val(),
                $results = $form.find('.results ul'),
                keyword = $form.find('input[name=screen_name]').val();

                params = {};

                params['op'] = 'user_timeline';
                params['screen_name'] = screen_name;
        $.ajax({
            dataType: "json",
            url: 'twitter-proxy.php',
            resultElements: $results,
            data: params//,
            //keyword: screen_name
        }).done(function(response) {
            displayTweets($results, response);  //correct
        });
            return false;
        });
    }

    function setupSearch() {

        $('form[name=search] button').click(function(event) {
            var $e = $(event.currentTarget),
                $form = $e.closest('form'),
                params = {},
                $results = $form.find('.results ul'),
                keyword = $form.find('input[name=q]').val();

            params['op'] = 'search_tweets'; // which PHP function to run
            params['q'] = keyword; // argument for the Twitter search API
            var $count_f = $form.find('input[name=count]');
            if ($count_f) {
                params['count'] = $count_f.val();// argument for the Twitter search API
            }
            var $result_type_f = $form.find('select[name=result_type]');
            if ($result_type_f) {
                params['result_type'] = $result_type_f.val();// argument for the Twitter search API
            }

        $.ajax({
            dataType: "json",
            url: 'twitter-proxy.php',
            resultElements: $results,
            data: params,
            keyword: keyword
        }).done(function(response) {
            displayTweets($results, response.statuses, keyword);
            //displayTweetsOnMap($results, response.statuses, keyword);

        });
            return false;
        });
    }
    function displayTweets($results, data, keyword) {
        //console.log("displayTweets", $results);
        $results.empty();
        for (var s in data) {
            var status = data[s];
            console.log(status)
            var li = document.createElement('li');
            var screen_name = status.user.screen_name;
            var txt = status.text;
            var txtNode_SN = document.createElement('p');
            var txtNode = document.createElement('span');
            var highlightedKeyword = RegExModule.highlightTweet(status.text, keyword);
            txtNode.innerHTML = highlightedKeyword;
            txtNode_SN.innerHTML = screen_name;
            //txtNode.innerHTML = txt;
            li.appendChild(txtNode_SN);
            li.appendChild(txtNode);
            $results.append(li);
            console.log("Geo", status.coordinates);

            // if ( status.coordinates ) {
            //     console.log(status.coordinates);
            //     GoogleMapApi.createMarker({
            //         lat: status.coordinates.coordinates[1], // use real data instead
            //         lng: status.coordinates.coordinates[0], // use real data instead
            //         name: screen_name, // use real data instead
            //         content: highlightedKeyword
            //     });
            // }
            // mapNode.innerHTML = displayTweetsOnMap;

            // if( status.coordinates){
            //     GoogleMapApi.createInfoWindow({

            //     });
            // }
        }

        // // var keyword = $form.find('input[name=q]').val();

        // for(tweet = ;tweet++;) {
        //   var highlightedTweet = RegExModule.highlightTweet(tweet, keyword)
        // }
        // return highlightTweet;
    }

    var init = function() {
        //console.log('init()');
        setupListeners();
    };
    shared.init = init;

    return shared;
}());

TwitterApi.init();

var RegExModule = (function() {
    function matchURL(string) {
        //console.log("matchURL:", string.text);
        var urlRE = /(?:(?:https?|ftp|file):\/\/|www\.|ftp\.)(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[-A-Z0-9+&@#\/%=~_|$?!:,.])*(?:\([-A-Z0-9+&@#\/%=~_|$?!:,.]*\)|[A-Z0-9+&@#\/%=~_|$])/igm;
        ///[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi
        var matched = string.match(urlRE);
        return matched;
    }
    function highlightTweet(tweet, keyword){
        //console.log("tweet:", tweet, "keyword", keyword);
        var processed = highlightURL(tweet);
        //console.log("processed1:", processed);
        var processed = highlightTwitterHandle(processed);
        //console.log("processed2:", processed);
        var processed = highlightKeyword(processed, keyword);
        //console.log("processed3:", processed);
        return processed;
    }
    function highlightKeyword(string, keyword){
        //console.log("string:", tweet, "keyword:", keyword);
        //var newString = tweet.replace(keyword, ''+ keyword + '');
        //return newString;
        var keywordRE = new RegExp("("+keyword+")", "gi");
        var newString = string.replace(keywordRE,'$1');

        return newString;
    }
    function highlightTwitterHandle(tweet){
        // var twitterHandleRE = /(^|[^@\w])@(\w{1,15})\b/; /([@][A-z0-9]+)|([#][A-z0-9]+)/g
        var twitterHandleRE = /([@][A-z0-9]+)/g;

        var matched = tweet.match(twitterHandleRE);

        if (matched) {
            for (var i = 0; i < matched.length; i++) {
                tweet = tweet.replace(matched[i], '' + matched[i] + '');
            }
        }

        return tweet;
    }
    function highlightURL(string) {
        //match a URL in the string, and then modify the strong to turn the URL into a hyperlink
        var newString = matchURL(string);
        //process the matched URL...
        var newHighlightedString = string.replace(newString, '' + newString + '');
        // (fill in code here)
        //and then return the new string:
        return newHighlightedString;
    }
    function matchEmail(string){
        var emailRE = /(.+@.+\..+)/;
        var matched = string.match(emailRE);
        //"bob@bob.com".match(emailRE);
        return matched;
    }
    function init(){

    }
    return {
        init: init,
        matchEmail: matchEmail,
        matchURL: matchURL,
        highlightTweet: highlightTweet,
        highlightKeyword: highlightKeyword
    }

})();
//$document.ready(function() {
    RegExModule.init();
//});

var GoogleMapApi = (function(options){
    var map;
    var service;

    var centerPoint = {
      lat: 33.734088,
      lng: -84.372260,
      name: 'Zoo Atlanta',
      content: '800 Cherokee Ave SE, Atlanta, GA 30315'
    };
    //var centerPoint = {lat: 33.833935, lng: -84.357232};

    var $searchField = document.getElementById('search-input');
    var $searchButton = document.getElementById('search-submit-button');
    var $placesList = document.getElementById('search-list');

    function initMap() {

        map = new google.maps.Map(document.getElementById('map'), {
            center: centerPoint,
            zoom: 15,
            styles: [
              {elementType: 'geometry', stylers: [{color: '#242f3e'}]},
              {elementType: 'labels.text.stroke', stylers: [{color: '#242f3e'}]},
              {elementType: 'labels.text.fill', stylers: [{color: '#746855'}]},
              {
                featureType: 'administrative.locality',
                elementType: 'labels.text.fill',
                stylers: [{color: '#d59563'}]
              },
              {
                featureType: 'poi',
                elementType: 'labels.text.fill',
                stylers: [{color: '#d59563'}]
              },
              {
                featureType: 'poi.park',
                elementType: 'geometry',
                stylers: [{color: '#365e44'}]
              },
              {
                featureType: 'poi.park',
                elementType: 'labels.text.fill',
                stylers: [{color: '#6b9a76'}]
              },
              {
                featureType: 'road',
                elementType: 'geometry',
                stylers: [{color: '#a65bc2'}]
              },
              {
                featureType: 'road',
                elementType: 'geometry.stroke',
                stylers: [{color: '#212a37'}]
              },
              {
                featureType: 'road',
                elementType: 'labels.text.fill',
                stylers: [{color: '#9ca5b3'}]
              },
              {
                featureType: 'road.highway',
                elementType: 'geometry',
                stylers: [{color: '#746855'}]
              },
              {
                featureType: 'road.highway',
                elementType: 'geometry.stroke',
                stylers: [{color: '#1f2835'}]
              },
              {
                featureType: 'road.highway',
                elementType: 'labels.text.fill',
                stylers: [{color: '#f3d19c'}]
              },
              {
                featureType: 'transit',
                elementType: 'geometry',
                stylers: [{color: '#2f3948'}]
              },
              {
                featureType: 'transit.station',
                elementType: 'labels.text.fill',
                stylers: [{color: '#d59563'}]
              },
              {
                featureType: 'water',
                elementType: 'geometry',
                stylers: [{color: '#5b78c2'}]
              },
              {
                featureType: 'water',
                elementType: 'labels.text.fill',
                stylers: [{color: '#515c6d'}]
              },
              {
                featureType: 'water',
                elementType: 'labels.text.stroke',
                stylers: [{color: '#17263c'}]
              }
            ]
        });
        // createMarker(centerPoint);
        //$searchButton.addEventListener("click", doSearch);
    }

    function createMarker(aLatLng){
        //console.log("createMarker:", aLatLng);
        // var geo = aLatLng.coordinates;

        // if(geo && geo.type === 'Point'){
        //     var marker = new google.maps.Marker({
        //         position: new google.maps.LatLng(geo[1], geo[0]),
        //         map: map,
        //         title: '@' + aLatLng.user.screen_name + ': ' + aLatLng.text
        //     })
        // }
        //marker.empty();
        var marker = new google.maps.Marker({
            position: aLatLng,
            map: map,
            title: aLatLng.name,
            content: aLatLng.content
        });
        createInfoWindow(marker);
    }

    function createInfoWindow(marker){
        //console.log("createInfoWindow", marker);
        //var contentString = '
'+ "hey"+'
';
        var place = marker.title;
        var image = marker.url;
        var address = marker.content;

        //var imageString = '';

        var contentString = '
'+ place +'
' + address;
        //var contentString = '
'+ marker.user.screen_name +'
' + marker.text;
        var infowindow = new google.maps.InfoWindow({
            content: contentString
        });
        marker.addListener('click', function(){
            infowindow.open(map, marker);
        });
    }

    function processPlacesResults(results, status){
        //console.log('results',results);
        //console.log('status', status);
        //console.log('name', result.name);
        $placesList.innerHTML = ' ';

        if (status == google.maps.places.PlacesServiceStatus.OK) {
            for (var i = 0; i < results.length; i++) {
                var result = results[i];
                // window.result = result; //to make it a global variabl, console
                //console.log('result', result);
                //console.log(result.geometry.location);

                var newMarker = {
                    lat: result.geometry.location.lat(),
                    lng: result.geometry.location.lng(),
                    name: result.name,
                    content: result.formatted_address
                };
                createMarker(newMarker);
                $placesList.innerHTML += '
' + result.name + '
';
                //place.geometry.location.lat()
                //place.geometry.location.lng()
            }
        }
    }
    function doSearch(event){

        event.preventDefault();

        var request = {
            location: centerPoint,
            radius: '100',
            // name: aLatLng,
            query: $searchField.value
        };
        var service = new google.maps.places.PlacesService(map);
        // service.nearbySearch(request, callback);
        service.textSearch(request, processPlacesResults);
    }

    return{
        initMap: initMap,
        createMarker: createMarker
    };

}());
    //GoogleMapApi.initMap();


text:
' Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

Imports System.Collections.Immutable
Imports System.Globalization
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Threading
Imports System.Xml
Imports System.Xml.Linq
Imports Microsoft.CodeAnalysis.Collections
Imports Microsoft.CodeAnalysis.VisualBasic
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.Text

Namespace Microsoft.CodeAnalysis.VisualBasic
    Partial Public Class VisualBasicCompilation

        Partial Friend Class DocumentationCommentCompiler
            Inherits VisualBasicSymbolVisitor

            Private Class IncludeElementExpander

                Private ReadOnly _symbol As Symbol
                Private ReadOnly _tagsSupport As WellKnownTagsSupport
                Private ReadOnly _sourceIncludeElementNodes As ArrayBuilder(Of XmlNodeSyntax)
                Private ReadOnly _compilation As VisualBasicCompilation
                Private ReadOnly _tree As SyntaxTree
                Private ReadOnly _onlyDiagnosticsFromTree As SyntaxTree
                Private ReadOnly _filterSpanWithinTree As TextSpan?
                Private ReadOnly _diagnostics As DiagnosticBag
                Private ReadOnly _cancellationToken As CancellationToken

                Private _binders As Dictionary(Of DocumentationCommentBinder.BinderType, Binder) = Nothing

                Private _nextSourceIncludeElementIndex As Integer
                Private _inProgressIncludeElementNodes As HashSet(Of Location)
                Private _includedFileCache As DocumentationCommentIncludeCache

                Private Sub New(symbol As Symbol,
                                sourceIncludeElementNodes As ArrayBuilder(Of XmlNodeSyntax),
                                compilation As VisualBasicCompilation,
                                includedFileCache As DocumentationCommentIncludeCache,
                                onlyDiagnosticsFromTree As SyntaxTree,
                                filterSpanWithinTree As TextSpan?,
                                diagnostics As DiagnosticBag,
                                cancellationToken As CancellationToken)

                    Me._symbol = symbol
                    Me._tagsSupport = New WellKnownTagsSupport(symbol)
                    Me._sourceIncludeElementNodes = sourceIncludeElementNodes
                    Me._compilation = compilation
                    Me._onlyDiagnosticsFromTree = onlyDiagnosticsFromTree
                    Me._filterSpanWithinTree = filterSpanWithinTree
                    Me._diagnostics = diagnostics
                    Me._cancellationToken = cancellationToken

                    Me._tree = If(sourceIncludeElementNodes Is Nothing OrElse
                                    sourceIncludeElementNodes.Count = 0,
                                  Nothing,
                                  sourceIncludeElementNodes(0).SyntaxTree)

                    Me._includedFileCache = includedFileCache

                    Me._nextSourceIncludeElementIndex = 0
                End Sub

                Private Structure WellKnownTagsSupport
                    Public ReadOnly ExceptionSupported As Boolean
                    Public ReadOnly ReturnsSupported As Boolean
                    Public ReadOnly ParamAndParamRefSupported As Boolean
                    Public ReadOnly ValueSupported As Boolean
                    Public ReadOnly TypeParamSupported As Boolean
                    Public ReadOnly TypeParamRefSupported As Boolean

                    Public ReadOnly IsDeclareMethod As Boolean
                    Public ReadOnly IsWriteOnlyProperty As Boolean

                    Public ReadOnly SymbolName As String

                    Public Sub New(symbol As Symbol)
                        Me.ExceptionSupported = False
                        Me.ReturnsSupported = False
                        Me.ParamAndParamRefSupported = False
                        Me.ValueSupported = False
                        Me.TypeParamSupported = False
                        Me.TypeParamRefSupported = False

                        Me.IsDeclareMethod = False
                        Me.IsWriteOnlyProperty = False

                        Me.SymbolName = GetSymbolName(symbol)

                        Select Case symbol.Kind
                            Case SymbolKind.Field
                                Me.TypeParamRefSupported = True

                            Case SymbolKind.Event
                                Me.ExceptionSupported = True
                                Me.ParamAndParamRefSupported = True
                                Me.TypeParamRefSupported = True

                            Case SymbolKind.Method
                                Dim method = DirectCast(symbol, MethodSymbol)
                                Me.IsDeclareMethod = method.MethodKind = MethodKind.DeclareMethod

                                Me.ExceptionSupported = True
                                Me.ParamAndParamRefSupported = True
                                Me.TypeParamSupported = Not Me.IsDeclareMethod AndAlso method.MethodKind <> MethodKind.UserDefinedOperator
                                Me.TypeParamRefSupported = True

                                If Not method.IsSub Then
                                    Me.ReturnsSupported = True
                                End If

                            Case SymbolKind.NamedType
                                Dim namedType = DirectCast(symbol, NamedTypeSymbol)
                                Dim invokeMethod As MethodSymbol = namedType.DelegateInvokeMethod

                                If namedType.TypeKind = TYPEKIND.Delegate Then
                                    If invokeMethod IsNot Nothing AndAlso Not invokeMethod.IsSub Then
                                        Me.ReturnsSupported = True
                                    Else
                                        Me.SymbolName = "delegate sub"
                                    End If
                                End If

                                Me.ParamAndParamRefSupported = namedType.TypeKind = TYPEKIND.Delegate
                                Me.TypeParamSupported = namedType.TypeKind <> TYPEKIND.Enum AndAlso namedType.TypeKind <> TYPEKIND.Module
                                Me.TypeParamRefSupported = namedType.TypeKind <> TYPEKIND.Module

                            Case SymbolKind.Property
                                Dim prop = DirectCast(symbol, PropertySymbol)

                                Me.ExceptionSupported = True
                                Me.ParamAndParamRefSupported = True
                                Me.TypeParamRefSupported = True
                                Me.ValueSupported = True

                                Me.IsWriteOnlyProperty = prop.IsWriteOnly
                                Me.ReturnsSupported = Not Me.IsWriteOnlyProperty

                            Case Else
                                Throw ExceptionUtilities.UnexpectedValue(symbol.Kind)
                        End Select
                    End Sub
                End Structure

                Friend Shared Function ProcessIncludes(unprocessed As String,
                                                       memberSymbol As Symbol,
                                                       sourceIncludeElementNodes As ArrayBuilder(Of XmlNodeSyntax),
                                                       compilation As VisualBasicCompilation,
                                                       onlyDiagnosticsFromTree As SyntaxTree,
                                                       filterSpanWithinTree As TextSpan?,
                                                       ByRef includedFileCache As DocumentationCommentIncludeCache,
                                                       diagnostics As DiagnosticBag,
                                                       cancellationToken As CancellationToken) As String

                    ' If there are no include elements, then there's nothing to expand.
                    '
                    ' NOTE: Following C# implementation we avoid parsing/printing of the xml
                    '       in this case, which might differ in terms of printed whitespaces
                    '       if we compare to the result of parse/print scenaro
                    If sourceIncludeElementNodes Is Nothing Then
                        Return unprocessed
                    End If

                    Debug.Assert(sourceIncludeElementNodes.Count > 0)

                    Dim doc As XDocument

                    Try
                        ' NOTE: XDocument.Parse seems to do a better job of preserving whitespace than XElement.Parse.
                        doc = XDocument.Parse(unprocessed, LoadOptions.PreserveWhitespace)

                    Catch ex As XmlException
                        Return unprocessed
                    End Try

                    Dim pooled As PooledStringBuilder = PooledStringBuilder.GetInstance()

                    Using writer As New StringWriter(pooled.Builder, CultureInfo.InvariantCulture)
                        cancellationToken.ThrowIfCancellationRequested()

                        Dim expander = New IncludeElementExpander(memberSymbol,
                                                                  sourceIncludeElementNodes,
                                                                  compilation,
                                                                  includedFileCache,
                                                                  onlyDiagnosticsFromTree,
                                                                  filterSpanWithinTree,
                                                                  diagnostics,
                                                                  cancellationToken)

                        For Each node In expander.Rewrite(doc, currentXmlFilePath:=Nothing, originatingSyntax:=Nothing)
                            cancellationToken.ThrowIfCancellationRequested()
                            writer.Write(node)
                        Next

                        Debug.Assert(expander._nextSourceIncludeElementIndex = expander._sourceIncludeElementNodes.Count)
                        includedFileCache = expander._includedFileCache
                    End Using

                    Return pooled.ToStringAndFree()
                End Function

                Private ReadOnly Property ProduceDiagnostics As Boolean
                    Get
                        Return Me._tree.ReportDocumentationCommentDiagnostics
                    End Get
                End Property

                Private ReadOnly Property ProduceXmlDiagnostics As Boolean
                    Get
                        Return Me._tree.ReportDocumentationCommentDiagnostics AndAlso Me._onlyDiagnosticsFromTree Is Nothing
                    End Get
                End Property

                Private ReadOnly Property [Module] As SourceModuleSymbol
                    Get
                        Return DirectCast(Me._compilation.SourceModule, SourceModuleSymbol)
                    End Get
                End Property

                Private Function GetOrCreateBinder(type As DocumentationCommentBinder.BinderType) As Binder
                    If Me._binders Is Nothing Then
                        Me._binders = New Dictionary(Of DocumentationCommentBinder.BinderType, Binder)()
                    End If

                    Dim result As Binder = Nothing
                    If Not Me._binders.TryGetValue(type, result) Then

                        Debug.Assert(Me._tree IsNot Nothing)
                        result = CreateDocumentationCommentBinderForSymbol(Me.Module, Me._symbol, Me._tree, type)
                        Me._binders.Add(type, result)
                    End If

                    Return result
                End Function

                ''' <remarks>
                ''' Rewrites nodes in <paramref name="nodes"/>, which Is a snapshot of nodes from the original document.
                ''' We're mutating the tree as we rewrite, so it's important to grab a snapshot of the
                ''' nodes that we're going to reparent before we enumerate them.
                ''' </remarks>
                Private Function RewriteMany(nodes As XNode(), currentXmlFilePath As String, originatingSyntax As XmlNodeSyntax) As XNode()
                    Debug.Assert(nodes IsNot Nothing)

                    Dim builder As ArrayBuilder(Of XNode) = Nothing
                    For Each child In nodes
                        If builder Is Nothing Then
                            builder = ArrayBuilder(Of XNode).GetInstance()
                        End If
                        builder.AddRange(Rewrite(child, currentXmlFilePath, originatingSyntax))
                    Next

                    ' Nodes returned by this method are going to be attached to a new parent, so it's
                    ' important that they don't already have parents.  If a node with a parent is
                    ' attached to a new parent, it is copied and its annotations are dropped.
                    Debug.Assert(builder Is Nothing OrElse builder.All(Function(node) node.Parent Is Nothing))

                    Return If(builder Is Nothing, SpecializedCollections.EmptyArray(Of XNode)(), builder.ToArrayAndFree())
                End Function

                Private Function Rewrite(node As XNode, currentXmlFilePath As String, originatingSyntax As XmlNodeSyntax) As XNode()
                    Me._cancellationToken.ThrowIfCancellationRequested()

                    Dim commentMessage As String = Nothing

                    If node.NodeType = XmlNodeType.Element Then
                        Dim element = DirectCast(node, XElement)
                        If ElementNameIs(element, DocumentationCommentXmlNames.IncludeElementName) Then
                            Dim rewritten As XNode() = RewriteIncludeElement(element, currentXmlFilePath, originatingSyntax, commentMessage)
                            If rewritten IsNot Nothing Then
                                Return rewritten
                            End If
                        End If
                    End If

                    Dim container = TryCast(node, XContainer)
                    If container Is Nothing Then
                        Debug.Assert(commentMessage Is Nothing, "How did we get an error comment for a non-container?")
                        Return New XNode() {node.Copy(copyAttributeAnnotations:=True)}
                    End If

                    Dim oldNodes As IEnumerable(Of XNode) = container.Nodes

                    ' Do this after grabbing the nodes, so we don't see copies of them.
                    container = container.Copy(copyAttributeAnnotations:=True)

                    ' WARN: don't use node after this point - use container since it's already been copied.

                    If oldNodes IsNot Nothing Then
                        Dim rewritten As XNode() = RewriteMany(oldNodes.ToArray(), currentXmlFilePath, originatingSyntax)
                        container.ReplaceNodes(rewritten)
                    End If

                    ' NOTE: we only care if we're included text - otherwise we've already processed the cref/name.
                    If container.NodeType = XmlNodeType.Element AndAlso originatingSyntax IsNot Nothing Then
                        Debug.Assert(currentXmlFilePath IsNot Nothing)

                        Dim element = DirectCast(container, XElement)
                        Dim elementName As XName = element.Name

                        Dim binderType As DocumentationCommentBinder.BinderType = DocumentationCommentBinder.BinderType.None

                        Dim elementIsException As Boolean = False ' To support WRN_XMLDocExceptionTagWithoutCRef

                        ' Check element first for well-known names
                        If ElementNameIs(element, DocumentationCommentXmlNames.ExceptionElementName) Then
                            If Not Me._tagsSupport.ExceptionSupported Then
                                commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
                                                                    ERRID.WRN_XMLDocIllegalTagOnElement2,
                                                                    elementName.LocalName,
                                                                    Me._tagsSupport.SymbolName)

                            Else
                                elementIsException = True
                            End If

                        ElseIf ElementNameIs(element, DocumentationCommentXmlNames.ReturnsElementName) Then
                            If Not Me._tagsSupport.ReturnsSupported Then

                                ' NOTE: different messages in two cases:
                                If Me._tagsSupport.IsDeclareMethod Then
                                    commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath), ERRID.WRN_XMLDocReturnsOnADeclareSub)

                                ElseIf Me._tagsSupport.IsWriteOnlyProperty Then
                                    commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath), ERRID.WRN_XMLDocReturnsOnWriteOnlyProperty)

                                Else
                                    commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
                                                                        ERRID.WRN_XMLDocIllegalTagOnElement2,
                                                                        elementName.LocalName,
                                                                        Me._tagsSupport.SymbolName)
                                End If
                            End If

                        ElseIf ElementNameIs(element, DocumentationCommentXmlNames.ParameterElementName) OrElse
                                    ElementNameIs(element, DocumentationCommentXmlNames.ParameterReferenceElementName) Then

                            binderType = DocumentationCommentBinder.BinderType.NameInParamOrParamRef
                            If Not Me._tagsSupport.ParamAndParamRefSupported Then
                                commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
                                                                    ERRID.WRN_XMLDocIllegalTagOnElement2,
                                                                    elementName.LocalName,
                                                                    Me._tagsSupport.SymbolName)
                            End If

                        ElseIf ElementNameIs(element, DocumentationCommentXmlNames.ValueElementName) Then
                            If Not Me._tagsSupport.ValueSupported Then
                                commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
                                                                    ERRID.WRN_XMLDocIllegalTagOnElement2,
                                                                    elementName.LocalName,
                                                                    Me._tagsSupport.SymbolName)
                            End If

                        ElseIf ElementNameIs(element, DocumentationCommentXmlNames.TypeParameterElementName) Then
                            binderType = DocumentationCommentBinder.BinderType.NameInTypeParam
                            If Not Me._tagsSupport.TypeParamSupported Then
                                commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
                                                                    ERRID.WRN_XMLDocIllegalTagOnElement2,
                                                                    elementName.LocalName,
                                                                    Me._tagsSupport.SymbolName)
                            End If

                        ElseIf ElementNameIs(element, DocumentationCommentXmlNames.TypeParameterReferenceElementName) Then
                            binderType = DocumentationCommentBinder.BinderType.NameInTypeParamRef
                            If Not Me._tagsSupport.TypeParamRefSupported Then
                                commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
                                                                    ERRID.WRN_XMLDocIllegalTagOnElement2,
                                                                    elementName.LocalName,
                                                                    Me._tagsSupport.SymbolName)
                            End If
                        End If

                        If commentMessage Is Nothing Then

                            Dim nameAttribute As XAttribute = Nothing
                            Dim seenCref As Boolean = False

                            For Each attribute In element.Attributes
                                If AttributeNameIs(attribute, DocumentationCommentXmlNames.CrefAttributeName) Then
                                    ' NOTE: 'cref=' errors are ignored, because the reference is marked with "?:..."
                                    BindAndReplaceCref(attribute, currentXmlFilePath)
                                    seenCref = True

                                ElseIf AttributeNameIs(attribute, DocumentationCommentXmlNames.NameAttributeName) Then
                                    nameAttribute = attribute
                                End If
                            Next

                            ' After processing 'special' attributes, we need to either bind 'name'
                            ' attribute value or, if the element was 'exception', and 'cref' was not found,
                            ' report WRN_XMLDocExceptionTagWithoutCRef
                            If elementIsException Then
                                If Not seenCref Then
                                    commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath), ERRID.WRN_XMLDocExceptionTagWithoutCRef)
                                End If

                            ElseIf binderType <> DocumentationCommentBinder.BinderType.None Then
                                Debug.Assert(binderType <> DocumentationCommentBinder.BinderType.Cref)

                                If nameAttribute Is Nothing Then
                                    ' Report missing 'name' attribute
                                    commentMessage = GenerateDiagnostic(XmlLocation.Create(element, currentXmlFilePath),
                                                                        If(binderType = DocumentationCommentBinder.BinderType.NameInParamOrParamRef,
                                                                           ERRID.WRN_XMLDocParamTagWithoutName,
                                                                           ERRID.WRN_XMLDocGenericParamTagWithoutName))
                                Else
                                    ' Bind the value of 'name' attribute
                                    commentMessage = BindName(nameAttribute,
                                                              elementName.LocalName,
                                                              binderType,
                                                              If(binderType = DocumentationCommentBinder.BinderType.NameInParamOrParamRef, ERRID.WRN_XMLDocBadParamTag2, ERRID.WRN_XMLDocBadGenericParamTag2),
                                                              currentXmlFilePath)
                                End If
                            End If
                        End If
                    End If

                    If commentMessage Is Nothing Then
                        Return New XNode() {container}
                    Else
                        Return New XNode() {New XComment(commentMessage), container}
                    End If
                End Function

                Private Shared Function ElementNameIs(element As XElement, name As String) As Boolean
                    Return String.IsNullOrEmpty(element.Name.NamespaceName) AndAlso
                           DocumentationCommentXmlNames.ElementEquals(element.Name.LocalName, name, True)
                End Function

                Private Shared Function AttributeNameIs(attribute As XAttribute, name As String) As Boolean
                    Return String.IsNullOrEmpty(attribute.Name.NamespaceName) AndAlso
                           DocumentationCommentXmlNames.AttributeEquals(attribute.Name.LocalName, name)
                End Function

                Private Function RewriteIncludeElement(includeElement As XElement, currentXmlFilePath As String, originatingSyntax As XmlNodeSyntax, <Out> ByRef commentMessage As String) As XNode()
                    Dim location As location = GetIncludeElementLocation(includeElement, currentXmlFilePath, originatingSyntax)
                    Debug.Assert(originatingSyntax IsNot Nothing)

                    If Not AddIncludeElementLocation(location) Then

                        ' NOTE: these must exist since we're already processed this node elsewhere in the call stack.
                        Dim fileAttr As XAttribute = includeElement.Attribute(XName.Get(DocumentationCommentXmlNames.FileAttributeName))
                        Dim pathAttr As XAttribute = includeElement.Attribute(XName.Get(DocumentationCommentXmlNames.PathAttributeName))

                        commentMessage = GenerateDiagnostic(location, ERRID.WRN_XMLDocInvalidXMLFragment, fileAttr.Value, pathAttr.Value)

                        ' Don't inspect the children - we're already in a cycle.
                        Return New XNode() {New XComment(commentMessage)}
                    End If

                    Try
                        Dim fileAttr As XAttribute = includeElement.Attribute(XName.Get(DocumentationCommentXmlNames.FileAttributeName))
                        Dim pathAttr As XAttribute = includeElement.Attribute(XName.Get(DocumentationCommentXmlNames.PathAttributeName))

                        Dim hasFileAttribute As Boolean = fileAttr IsNot Nothing
                        Dim hasPathAttribute As Boolean = pathAttr IsNot Nothing

                        If Not hasFileAttribute OrElse Not hasPathAttribute Then
                            ' 'file' or 'path' attribute missing
                            If Not hasFileAttribute Then
                                commentMessage = GenerateDiagnostic(location, ERRID.WRN_XMLMissingFileOrPathAttribute1, DocumentationCommentXmlNames.FileAttributeName)
                            End If

                            If Not hasPathAttribute Then
                                commentMessage = If(commentMessage Is Nothing, "", commentMessage & " ") &
                                                     GenerateDiagnostic(location, ERRID.WRN_XMLMissingFileOrPathAttribute1, DocumentationCommentXmlNames.PathAttributeName)
                            End If

                            Return New XNode() {New XComment(commentMessage)}
                        End If

                        Dim xpathValue As String = pathAttr.Value
                        Dim filePathValue As String = fileAttr.Value

                        Dim resolver = _compilation.Options.XmlReferenceResolver
                        If resolver Is Nothing Then
                            commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocBadFormedXML, filePathValue, xpathValue, New CodeAnalysisResourcesLocalizableErrorArgument(NameOf(CodeAnalysisResources.XmlReferencesNotSupported)))
                            Return New XNode() {New XComment(commentMessage)}
                        End If

                        Dim resolvedFilePath As String = resolver.ResolveReference(filePathValue, currentXmlFilePath)
                        If resolvedFilePath Is Nothing Then
                            commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocBadFormedXML, filePathValue, xpathValue, New CodeAnalysisResourcesLocalizableErrorArgument(NameOf(CodeAnalysisResources.FileNotFound)))
                            Return New XNode() {New XComment(commentMessage)}
                        End If

                        If _includedFileCache Is Nothing Then
                            _includedFileCache = New DocumentationCommentIncludeCache(_compilation.Options.XmlReferenceResolver)
                        End If

                        Try
                            Dim doc As XDocument

                            Try
                                doc = _includedFileCache.GetOrMakeDocument(resolvedFilePath)
                            Catch e As IOException
                                commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocBadFormedXML, filePathValue, xpathValue, e.Message)
                                Return New XNode() {New XComment(commentMessage)}
                            End Try

                            Debug.Assert(doc IsNot Nothing)

                            Dim errorMessage As String = Nothing
                            Dim invalidXPath As Boolean = False
                            Dim loadedElements As XElement() = XmlUtilities.TrySelectElements(doc, xpathValue, errorMessage, invalidXPath)

                            If loadedElements Is Nothing Then
                                commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocInvalidXMLFragment, xpathValue, filePathValue)
                                Return New XNode() {New XComment(commentMessage)}
                                End If

                                If loadedElements IsNot Nothing AndAlso loadedElements.Length > 0 Then
                                    ' change the current XML file path for nodes contained in the document
                                    Dim result As XNode() = RewriteMany(loadedElements, resolvedFilePath, originatingSyntax)

                                    ' The elements could be rewritten away if they are includes that refer to invalid
                                    ' (but existing and accessible) XML files. If this occurs, behave as if we
                                    ' had failed to find any XPath results.
                                    If result.Length > 0 Then
                                        ' NOTE: in this case, we do NOT visit the children of the include element -
                                        ' they are dropped.
                                        commentMessage = Nothing
                                        Return result
                                    End If
                                End If

                                ' Nothing was found
                                commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocInvalidXMLFragment, xpathValue, filePathValue)
                                Return New XNode() {New XComment(commentMessage)}

                            Catch ex As XmlException
                                commentMessage = GenerateDiagnostic(True, location, ERRID.WRN_XMLDocInvalidXMLFragment, xpathValue, filePathValue)
                                Return New XNode() {New XComment(commentMessage)}
                            End Try
                        Finally
                            RemoveIncludeElementLocation(location)
                        End Try
                End Function

                Private Function ShouldProcessLocation(loc As Location) As Boolean
                    Return Me._onlyDiagnosticsFromTree Is Nothing OrElse
                        loc.Kind = LocationKind.SourceFile AndAlso DirectCast(loc, SourceLocation).SourceTree Is Me._onlyDiagnosticsFromTree AndAlso
                        (Not Me._filterSpanWithinTree.HasValue OrElse Me._filterSpanWithinTree.Value.Contains(loc.SourceSpan))
                End Function

                Private Function GenerateDiagnostic(suppressDiagnostic As Boolean, loc As Location, id As ERRID, ParamArray arguments As Object()) As String
                    Dim info As DiagnosticInfo = ErrorFactory.ErrorInfo(id, arguments)
                    If Not suppressDiagnostic AndAlso Me.ProduceDiagnostics AndAlso ShouldProcessLocation(loc) Then
                        Me._diagnostics.Add(New VBDiagnostic(info, loc))
                    End If
                    Return info.ToString()
                End Function

                Private Function GenerateDiagnostic(loc As Location, id As ERRID, ParamArray arguments As Object()) As String
                    Return GenerateDiagnostic(False, loc, id, arguments)
                End Function

                Private Function AddIncludeElementLocation(location As Location) As Boolean
                    If Me._inProgressIncludeElementNodes Is Nothing Then
                        Me._inProgressIncludeElementNodes = New HashSet(Of location)()
                    End If

                    Return Me._inProgressIncludeElementNodes.Add(location)
                End Function

                Private Function RemoveIncludeElementLocation(location As Location) As Boolean
                    Debug.Assert(Me._inProgressIncludeElementNodes IsNot Nothing)
                    Dim result As Boolean = Me._inProgressIncludeElementNodes.Remove(location)
                    Debug.Assert(result)
                    Return result
                End Function

                Private Function GetIncludeElementLocation(includeElement As XElement, ByRef currentXmlFilePath As String, ByRef originatingSyntax As XmlNodeSyntax) As Location
                    Dim location As location = includeElement.Annotation(Of location)()

                    If location IsNot Nothing Then
                        Return location
                    End If

                    ' If we are not in an XML file, then we must be in a source file.  Since we're traversing the XML tree in the same
                    ' order as the DocumentationCommentWalker, we can access the elements of includeElementNodes in order.
                    If currentXmlFilePath Is Nothing Then
                        Debug.Assert(_nextSourceIncludeElementIndex < _sourceIncludeElementNodes.Count)
                        Debug.Assert(originatingSyntax Is Nothing)

                        originatingSyntax = _sourceIncludeElementNodes(_nextSourceIncludeElementIndex)
                        location = originatingSyntax.GetLocation()
                        Me._nextSourceIncludeElementIndex += 1
                        includeElement.AddAnnotation(location)

                        currentXmlFilePath = location.GetLineSpan().Path
                    Else
                        location = XmlLocation.Create(includeElement, currentXmlFilePath)
                    End If

                    Debug.Assert(location IsNot Nothing)
                    Return location
                End Function

                Private Sub BindAndReplaceCref(attribute As XAttribute, currentXmlFilePath As String)
                    Debug.Assert(currentXmlFilePath IsNot Nothing)

                    Dim attributeText As String = attribute.ToString()

                    ' note, the parent element name does not matter
                    Dim attr As BaseXmlAttributeSyntax = SyntaxFactory.ParseDocCommentAttributeAsStandAloneEntity(attributeText, parentElementName:="")

                    ' NOTE: we don't expect any *syntax* errors on the parsed xml
                    '       attribute, or otherwise why xml parsed didn't throw?
                    Debug.Assert(attr IsNot Nothing)

                    Select Case attr.Kind

                        Case SyntaxKind.XmlCrefAttribute
                            Dim binder As binder = Me.GetOrCreateBinder(DocumentationCommentBinder.BinderType.Cref)
                            Dim reference As CrefReferenceSyntax = DirectCast(attr, XmlCrefAttributeSyntax).Reference
                            Dim useSiteDiagnostics As HashSet(Of DiagnosticInfo) = Nothing
                            Dim diagnostics = DiagnosticBag.GetInstance
                            Dim bindResult As ImmutableArray(Of Symbol) = binder.BindInsideCrefAttributeValue(reference, preserveAliases:=False, diagnosticBag:=diagnostics, useSiteDiagnostics:=useSiteDiagnostics)

                            Dim errorLocations = diagnostics.ToReadOnlyAndFree().SelectAsArray(Function(x) x.Location).WhereAsArray(Function(x) x IsNot Nothing)
                            If Me.ProduceXmlDiagnostics AndAlso Not useSiteDiagnostics.IsNullOrEmpty Then
                                ProcessErrorLocations(XmlLocation.Create(attribute, currentXmlFilePath), Nothing, useSiteDiagnostics, errorLocations, Nothing)
                            End If

                            If bindResult.IsDefaultOrEmpty Then
                                If Me.ProduceXmlDiagnostics Then
                                    ProcessErrorLocations(XmlLocation.Create(attribute, currentXmlFilePath), reference.ToFullString().TrimEnd(Nothing), useSiteDiagnostics, errorLocations, ERRID.WRN_XMLDocCrefAttributeNotFound1)
                                End If
                                attribute.Value = "?:" + attribute.Value

                            Else
                                ' The following mimics handling 'cref' attributes in source documentation
                                ' comment, see DocumentationCommentWalker for details

                                ' Some symbols found may not support doc-comment-ids, we just filter
                                ' those out, from the rest we take the symbol with 'smallest' location
                                Dim symbolCommentId As String = Nothing
                                Dim smallestSymbol As Symbol = Nothing
                                Dim errid As ERRID = ERRID.WRN_XMLDocCrefAttributeNotFound1

                                For Each symbol In bindResult
                                    If symbol.Kind = SymbolKind.TypeParameter Then
                                        errid = ERRID.WRN_XMLDocCrefToTypeParameter
                                        Continue For
                                    End If

                                    Dim id As String = symbol.OriginalDefinition.GetDocumentationCommentId()
                                    If id IsNot Nothing Then

                                        ' Override only if this is the first id or the new symbol's location wins;
                                        ' note that we want to ignore the cases when there are more than one symbol
                                        ' can be found by the name, just deterministically choose which one to use
                                        If symbolCommentId Is Nothing OrElse
                                                Me._compilation.CompareSourceLocations(
                                                    smallestSymbol.Locations(0), symbol.Locations(0)) > 0 Then

                                            symbolCommentId = id
                                            smallestSymbol = symbol
                                        End If
                                    End If
                                Next

                                If symbolCommentId Is Nothing Then
                                    If Me.ProduceXmlDiagnostics Then
                                        ProcessErrorLocations(XmlLocation.Create(attribute, currentXmlFilePath), reference.ToString(), Nothing, errorLocations, errid)
                                    End If
                                    attribute.Value = "?:" + attribute.Value

                                Else
                                    ' Replace value with id
                                    attribute.Value = symbolCommentId
                                End If

                            End If

                        Case SyntaxKind.XmlAttribute
                            ' 'cref=' attribute can land here for two reasons:
                            '   (a) the value is represented in a form "X:SOME-ID-STRING", or
                            '   (b) the value between '"' is not a valid NameSyntax
                            '
                            ' in both cases we want just to put the result into documentation XML.
                            '
                            ' In the second case we also generate a diagnostic and add '!:' in from
                            ' of the value indicating wrong id, and generate a diagnostic
                            Dim value As String = attribute.Value.Trim()
                            If value.Length < 2 OrElse value(0) = ":"c OrElse value(1) <> ":"c Then
                                ' Case (b) from above
                                If Me.ProduceXmlDiagnostics Then
                                    Me._diagnostics.Add(ERRID.WRN_XMLDocCrefAttributeNotFound1, XmlLocation.Create(attribute, currentXmlFilePath), value)
                                End If
                                attribute.Value = "?:" + value
                            End If

                        Case Else
                            Throw ExceptionUtilities.UnexpectedValue(attr.Kind)

                    End Select
                End Sub

                Private Sub ProcessErrorLocations(currentXmlLocation As XmlLocation, referenceName As String, useSiteDiagnostics As HashSet(Of DiagnosticInfo), errorLocations As ImmutableArray(Of Location), errid As Nullable(Of ERRID))
                    If errorLocations.Length = 0 Then
                        If useSiteDiagnostics IsNot Nothing Then
                            Me._diagnostics.Add(currentXmlLocation, useSiteDiagnostics)
                        ElseIf errid.HasValue Then
                            Me._diagnostics.Add(errid.Value, currentXmlLocation, referenceName)
                        End If
                    ElseIf errid.HasValue Then
                        For Each location In errorLocations
                            Me._diagnostics.Add(errid.Value, location, referenceName)
                        Next
                    Else
                        For Each location In errorLocations
                            Me._diagnostics.Add(location, useSiteDiagnostics)
                        Next
                    End If
                End Sub

                Private Function BindName(attribute As XAttribute,
                                          elementName As String,
                                          type As DocumentationCommentBinder.BinderType,
                                          badNameValueError As ERRID,
                                          currentXmlFilePath As String) As String

                    Debug.Assert(type = DocumentationCommentBinder.BinderType.NameInParamOrParamRef OrElse
                                 type = DocumentationCommentBinder.BinderType.NameInTypeParamRef OrElse
                                 type = DocumentationCommentBinder.BinderType.NameInTypeParam)

                    Debug.Assert(currentXmlFilePath IsNot Nothing)

                    Dim commentMessage As String = Nothing

                    Dim attributeText As String = attribute.ToString()
                    Dim attributeValue As String = attribute.Value.Trim()
                    Dim attr As BaseXmlAttributeSyntax =
                        SyntaxFactory.ParseDocCommentAttributeAsStandAloneEntity(
                            attributeText, elementName) ' note, the element name does not matter

                    ' NOTE: we don't expect any *syntax* errors on the parsed xml
                    '       attribute, or otherwise why xml parsed didn't throw?
                    Debug.Assert(attr IsNot Nothing)
                    Debug.Assert(Not attr.ContainsDiagnostics)

                    Select Case attr.Kind

                        Case SyntaxKind.XmlNameAttribute
                            Dim binder As binder = Me.GetOrCreateBinder(type)
                            Dim identifier As IdentifierNameSyntax = DirectCast(attr, XmlNameAttributeSyntax).Reference
                            Dim useSiteDiagnostics As HashSet(Of DiagnosticInfo) = Nothing
                            Dim bindResult As ImmutableArray(Of Symbol) = binder.BindXmlNameAttributeValue(identifier, useSiteDiagnostics)

                            If Me.ProduceDiagnostics AndAlso Not useSiteDiagnostics.IsNullOrEmpty Then
                                Dim loc As Location = XmlLocation.Create(attribute, currentXmlFilePath)
                                If ShouldProcessLocation(loc) Then
                                    Me._diagnostics.Add(loc, useSiteDiagnostics)
                                End If
                            End If

                            If bindResult.IsDefaultOrEmpty Then
                                commentMessage = GenerateDiagnostic(XmlLocation.Create(attribute, currentXmlFilePath), badNameValueError, attributeValue, Me._tagsSupport.SymbolName)
                            End If

                        Case SyntaxKind.XmlAttribute
                            ' 'name=' attribute can get here if parsing of identifier went wrong, we need to generate a diagnostic
                            commentMessage = GenerateDiagnostic(XmlLocation.Create(attribute, currentXmlFilePath), badNameValueError, attributeValue, Me._tagsSupport.SymbolName)

                        Case Else
                            Throw ExceptionUtilities.UnexpectedValue(attr.Kind)
                    End Select

                    Return commentMessage
                End Function
            End Class

        End Class

    End Class
End Namespace

redpajama_set_name: RedPajamaGithub


text:
package com.github.lstephen.ootp.ai.selection.lineup

import com.github.lstephen.ootp.ai.player.Player
import com.github.lstephen.ootp.ai.player.ratings.Position
import com.github.lstephen.ootp.ai.regression.Predictor
import com.github.lstephen.ootp.ai.score._
import com.github.lstephen.ootp.ai.selection.lineup.Lineup.VsHand

import scalaz._
import Scalaz._

import collection.JavaConversions._

class InLineupScore(player: Player,
                    position: Position,
                    vs: Option[VsHand] = None)(implicit predictor: Predictor)
    extends Scoreable {

  val name = player.getShortName

  val hitting: Score = vs match {
    case None => predictor.predictBatting(player).overall
    case Some(vs) => Score(vs.getStats(predictor, player).getWobaPlus)
  }

  val defense = new PlayerDefenseScore(player, position)

  val score = hitting + defense.score
}

object InLineupScore {
  def apply(ply: Player)(implicit ps: Predictor): InLineupScore =
    Position.hitting.map(InLineupScore(ply, _)).max

  def apply(ply: Player, pos: Position)(
      implicit ps: Predictor): InLineupScore = {
    new InLineupScore(ply, pos, None)
  }

  def apply(ply: Player, pos: Position, vs: VsHand)(
      implicit ps: Predictor): InLineupScore = {
    new InLineupScore(ply, pos, Some(vs))
  }

  def sort(players: Traversable[Player], pos: Position, vs: VsHand)(
      implicit ps: Predictor): Seq[Player] = {
    players.toSeq.sortBy(InLineupScore(_, pos, vs)).reverse
  }
}


text:
package edu.ucla.nesl.rulemanager.db;

import java.util.ArrayList;
import java.util.List;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import edu.ucla.nesl.rulemanager.Const;
import edu.ucla.nesl.rulemanager.db.model.TimeLabel;

public class TimeLabelDataSource extends DataSource {

	public TimeLabelDataSource(Context context) {
		super(context);
	}

	public void insertTimeRange(String labelName, String fromDate, String fromTime, String toDate, String toTime) throws SQLException {
		ContentValues values = new ContentValues();
		values.put(SQLiteHelper.COL_LABEL_NAME, labelName);
		values.put(SQLiteHelper.COL_FROM_DATE, fromDate);
		values.put(SQLiteHelper.COL_FROM_TIME, fromTime);
		values.put(SQLiteHelper.COL_TO_DATE, toDate);
		values.put(SQLiteHelper.COL_TO_TIME, toTime);
		values.put(SQLiteHelper.COL_IS_ALL_DAY, false);
		values.put(SQLiteHelper.COL_IS_REPEAT, false);
		values.put(SQLiteHelper.COL_REPEAT_DAY, 0);
		values.put(SQLiteHelper.COL_IS_REPEAT_MON, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_TUE, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_WED, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_THU, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_FRI, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_SAT, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_SUN, false);
		database.insertOrThrow(SQLiteHelper.TABLE_TIME_LABELS, null, values);
	}

	public void insertRepeatWeekly(String labelName, String fromTime, String toTime
			, boolean isMon
			, boolean isTue
			, boolean isWed
			, boolean isThu
			, boolean isFri
			, boolean isSat
			, boolean isSun
			) throws SQLException {
		ContentValues values = new ContentValues();
		values.put(SQLiteHelper.COL_LABEL_NAME, labelName);
		values.put(SQLiteHelper.COL_FROM_TIME, fromTime);
		values.put(SQLiteHelper.COL_TO_TIME, toTime);
		values.put(SQLiteHelper.COL_IS_ALL_DAY, false);
		values.put(SQLiteHelper.COL_IS_REPEAT, true);
		values.put(SQLiteHelper.COL_REPEAT_TYPE, TimeLabel.REPEAT_TYPE_WEEKLY);
		values.put(SQLiteHelper.COL_REPEAT_DAY, 0);
		values.put(SQLiteHelper.COL_IS_REPEAT_MON, isMon);
		values.put(SQLiteHelper.COL_IS_REPEAT_TUE, isTue);
		values.put(SQLiteHelper.COL_IS_REPEAT_WED, isWed);
		values.put(SQLiteHelper.COL_IS_REPEAT_THU, isThu);
		values.put(SQLiteHelper.COL_IS_REPEAT_FRI, isFri);
		values.put(SQLiteHelper.COL_IS_REPEAT_SAT, isSat);
		values.put(SQLiteHelper.COL_IS_REPEAT_SUN, isSun);
		database.insertOrThrow(SQLiteHelper.TABLE_TIME_LABELS, null, values);
	}

	public void insertRepeatMonthly(String labelName, String fromTime, String toTime, int repeatDay) throws SQLException {
		ContentValues values = new ContentValues();
		values.put(SQLiteHelper.COL_LABEL_NAME, labelName);
		values.put(SQLiteHelper.COL_FROM_TIME, fromTime);
		values.put(SQLiteHelper.COL_TO_TIME, toTime);
		values.put(SQLiteHelper.COL_IS_ALL_DAY, false);
		values.put(SQLiteHelper.COL_IS_REPEAT, true);
		values.put(SQLiteHelper.COL_REPEAT_TYPE, TimeLabel.REPEAT_TYPE_MONTHLY);
		values.put(SQLiteHelper.COL_REPEAT_DAY, repeatDay);
		values.put(SQLiteHelper.COL_IS_REPEAT_MON, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_TUE, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_WED, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_THU, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_FRI, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_SAT, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_SUN, false);
		database.insertOrThrow(SQLiteHelper.TABLE_TIME_LABELS, null, values);
	}

	public void insertAllDay(String labelName, String fromDate, String toDate) throws SQLException {
		ContentValues values = new ContentValues();
		values.put(SQLiteHelper.COL_LABEL_NAME, labelName);
		values.put(SQLiteHelper.COL_FROM_DATE, fromDate);
		values.put(SQLiteHelper.COL_TO_DATE, toDate);
		values.put(SQLiteHelper.COL_IS_ALL_DAY, true);
		values.put(SQLiteHelper.COL_IS_REPEAT, false);
		values.put(SQLiteHelper.COL_REPEAT_DAY, 0);
		values.put(SQLiteHelper.COL_IS_REPEAT_MON, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_TUE, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_WED, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_THU, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_FRI, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_SAT, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_SUN, false);
		database.insertOrThrow(SQLiteHelper.TABLE_TIME_LABELS, null, values);
	}

	public void insertAllDayRepeatWeekly(String labelName
			, boolean isMon
			, boolean isTue
			, boolean isWed
			, boolean isThu
			, boolean isFri
			, boolean isSat
			, boolean isSun
			) throws SQLException {
		ContentValues values = new ContentValues();
		values.put(SQLiteHelper.COL_LABEL_NAME, labelName);
		values.put(SQLiteHelper.COL_IS_ALL_DAY, true);
		values.put(SQLiteHelper.COL_IS_REPEAT, true);
		values.put(SQLiteHelper.COL_REPEAT_TYPE, TimeLabel.REPEAT_TYPE_WEEKLY);
		values.put(SQLiteHelper.COL_REPEAT_DAY, 0);
		values.put(SQLiteHelper.COL_IS_REPEAT_MON, isMon);
		values.put(SQLiteHelper.COL_IS_REPEAT_TUE, isTue);
		values.put(SQLiteHelper.COL_IS_REPEAT_WED, isWed);
		values.put(SQLiteHelper.COL_IS_REPEAT_THU, isThu);
		values.put(SQLiteHelper.COL_IS_REPEAT_FRI, isFri);
		values.put(SQLiteHelper.COL_IS_REPEAT_SAT, isSat);
		values.put(SQLiteHelper.COL_IS_REPEAT_SUN, isSun);
		database.insertOrThrow(SQLiteHelper.TABLE_TIME_LABELS, null, values);
	}

	public void insertAllDayRepeatMonthly(String labelName, int repeatDay) throws SQLException {
		ContentValues values = new ContentValues();
		values.put(SQLiteHelper.COL_LABEL_NAME, labelName);
		values.put(SQLiteHelper.COL_IS_ALL_DAY, true);
		values.put(SQLiteHelper.COL_IS_REPEAT, true);
		values.put(SQLiteHelper.COL_REPEAT_TYPE, TimeLabel.REPEAT_TYPE_MONTHLY);
		values.put(SQLiteHelper.COL_REPEAT_DAY, repeatDay);
		values.put(SQLiteHelper.COL_IS_REPEAT_MON, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_TUE, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_WED, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_THU, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_FRI, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_SAT, false);
		values.put(SQLiteHelper.COL_IS_REPEAT_SUN, false);
		database.insertOrThrow(SQLiteHelper.TABLE_TIME_LABELS, null, values);
	}

	public List<TimeLabel> getTimeLabels() {
		List<TimeLabel> labels = new ArrayList<TimeLabel>();
		Cursor c = database.query(SQLiteHelper.TABLE_TIME_LABELS, null, null, null, null, null, null);
		c.moveToFirst();
		while (!c.isAfterLast()) {
			TimeLabel label = new TimeLabel();
			label.setLabelName(c.getString(0));
			label.setFromDate(c.getString(1));
			label.setFromTime(c.getString(2));
			label.setToDate(c.getString(3));
			label.setToTime(c.getString(4));
			label.setAllDay(c.getInt(5) == 0 ? false : true);
			label.setRepeat(c.getInt(6) == 0 ? false : true);
			label.setRepeatType(c.getString(7));
			label.setRepeatDay(c.getInt(8));
			label.setRepeatMon(c.getInt(9) == 0 ? false : true);
			label.setRepeatTue(c.getInt(10) == 0 ? false : true);
			label.setRepeatWed(c.getInt(11) == 0 ? false : true);
			label.setRepeatThu(c.getInt(12) == 0 ? false : true);
			label.setRepeatFri(c.getInt(13) == 0 ? false : true);
			label.setRepeatSat(c.getInt(14) == 0 ? false : true);
			label.setRepeatSun(c.getInt(15) == 0 ? false : true);
			labels.add(label);
			c.moveToNext();
		}
		return labels;
	}

	public int deleteTimeLabel(String labelName) {
		return database.delete(SQLiteHelper.TABLE_TIME_LABELS, SQLiteHelper.COL_LABEL_NAME + " = ?", new String[] { labelName });
	}

	public int updateTimeLabel(String prevLabelName, String newLabelName
			, String fromDate, String fromTime, String toDate, String toTime
			, boolean isAllDay, boolean isRepeat, String repeatType
			, int repeatDay
			, boolean isMon, boolean isTue, boolean isWed, boolean isThu, boolean isFri, boolean isSat, boolean isSun
			) {
		ContentValues values = new ContentValues();
		values.put(SQLiteHelper.COL_LABEL_NAME, newLabelName);
		values.put(SQLiteHelper.COL_FROM_DATE, fromDate);
		values.put(SQLiteHelper.COL_FROM_TIME, fromTime);
		values.put(SQLiteHelper.COL_TO_DATE, toDate);
		values.put(SQLiteHelper.COL_TO_TIME, toTime);
		values.put(SQLiteHelper.COL_IS_ALL_DAY, isAllDay);
		values.put(SQLiteHelper.COL_IS_REPEAT, isRepeat);
		values.put(SQLiteHelper.COL_REPEAT_TYPE, repeatType);
		values.put(SQLiteHelper.COL_REPEAT_DAY, repeatDay);
		values.put(SQLiteHelper.COL_IS_REPEAT_MON, isMon);
		values.put(SQLiteHelper.COL_IS_REPEAT_TUE, isTue);
		values.put(SQLiteHelper.COL_IS_REPEAT_WED, isWed);
		values.put(SQLiteHelper.COL_IS_REPEAT_THU, isThu);
		values.put(SQLiteHelper.COL_IS_REPEAT_FRI, isFri);
		values.put(SQLiteHelper.COL_IS_REPEAT_SAT, isSat);
		values.put(SQLiteHelper.COL_IS_REPEAT_SUN, isSun);
		return database.update(SQLiteHelper.TABLE_TIME_LABELS, values, SQLiteHelper.COL_LABEL_NAME + " = ?", new String[] { prevLabelName });
	}

	public List<String> getLabelNames() {
		List<String> labels = new ArrayList<String>();
		Cursor c = database.query(SQLiteHelper.TABLE_TIME_LABELS, new String[] { SQLiteHelper.COL_LABEL_NAME }, null, null, null, null, null);
		c.moveToFirst();
		while (!c.isAfterLast()) {
			labels.add(c.getString(0));
			c.moveToNext();
		}
		return labels;
	}

	public List<String> getLabelNamesWithOther() {
		List<String> labels = getLabelNames();
		if (labels.size() <= 0) {
			labels.add(Const.ALL_TIME);
		} else {
			labels.add(Const.OTHER_TIME);
		}
		return labels;
	}
}


text:
\documentclass{beamer}
\usepackage[applemac]{inputenc}
\usepackage[french]{babel}
\usetheme{lanci}
\title{Titre de la prŽsentation}
\author{Nom de l'auteur}

\begin{document}
\titlepage
\section{Premire section}

\begin{frame}
\frametitle{Nom de la diapositive}
\end{frame}
\end{document}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Diagnostics;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Diagnostics.EngineV1;
using Microsoft.CodeAnalysis.LanguageServices;
using Microsoft.CodeAnalysis.Shared.Extensions;
using Microsoft.CodeAnalysis.Text;
using Microsoft.CodeAnalysis.VisualBasic.Diagnostics;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.UnitTests.Diagnostics
{
    public static class DiagnosticProviderTestUtilities
    {
        private static IEnumerable<Diagnostic> GetDiagnostics(DiagnosticAnalyzer analyzerOpt, Document document, TextSpan span, Project project, bool getDocumentDiagnostics, bool getProjectDiagnostics, bool donotCatchAnalyzerExceptions)
        {
            var documentDiagnostics = SpecializedCollections.EmptyEnumerable<Diagnostic>();
            var projectDiagnostics = SpecializedCollections.EmptyEnumerable<Diagnostic>();

            // If no user diagnostic analyzer, then test compiler diagnostics.
            var analyzer = analyzerOpt ?? DiagnosticExtensions.GetCompilerDiagnosticAnalyzer(project.Language);

            if (getDocumentDiagnostics)
            {
                var tree = document.GetSyntaxTreeAsync().Result;
                var root = document.GetSyntaxRootAsync().Result;
                var semanticModel = document.GetSemanticModelAsync().Result;

                var builder = new List<Diagnostic>();
                var nodeInBodyAnalyzerService = document.Project.Language == LanguageNames.CSharp ?
                    (ISyntaxNodeAnalyzerService)new CSharpSyntaxNodeAnalyzerService() :
                    new VisualBasicSyntaxNodeAnalyzerService();

                // Lets replicate the IDE diagnostic incremental analyzer behavior to determine span to test:
                //  (a) If the span is contained within a method level member and analyzer supports semantic in span: analyze in member span.
                //  (b) Otherwise, analyze entire syntax tree span.
                var spanToTest = root.FullSpan;

                var driver = new DiagnosticAnalyzerDriver(document, spanToTest, root, syntaxNodeAnalyzerService: nodeInBodyAnalyzerService, cancellationToken: CancellationToken.None, testOnly_DonotCatchAnalyzerExceptions: donotCatchAnalyzerExceptions);
                var diagnosticAnalyzerCategory = analyzer.GetDiagnosticAnalyzerCategory(driver);
                bool supportsSemanticInSpan = (diagnosticAnalyzerCategory & DiagnosticAnalyzerCategory.SemanticSpanAnalysis) != 0;
                if (supportsSemanticInSpan)
                {
                    var syntaxFacts = document.Project.LanguageServices.GetService<ISyntaxFactsService>();
                    if (syntaxFacts != null)
                    {
                        var member = syntaxFacts.GetContainingMemberDeclaration(root, span.Start);
                        if (member != null && syntaxFacts.IsMethodLevelMember(member) && member.FullSpan.Contains(span))
                        {
                            spanToTest = member.FullSpan;
                        }
                    }
                }

                if ((diagnosticAnalyzerCategory & DiagnosticAnalyzerCategory.SyntaxAnalysis) != 0)
                {
                    builder.AddRange(driver.GetSyntaxDiagnosticsAsync(analyzer).Result ?? SpecializedCollections.EmptyEnumerable<Diagnostic>());
                }

                if (supportsSemanticInSpan || (diagnosticAnalyzerCategory & DiagnosticAnalyzerCategory.SemanticDocumentAnalysis) != 0)
                {
                    builder.AddRange(driver.GetSemanticDiagnosticsAsync(analyzer).Result ?? SpecializedCollections.EmptyEnumerable<Diagnostic>());
                }

                documentDiagnostics = builder.Where(d => d.Location == Location.None ||
                    (d.Location.SourceTree == tree && d.Location.SourceSpan.IntersectsWith(span)));
            }

            if (getProjectDiagnostics)
            {
                var nodeInBodyAnalyzerService = project.Language == LanguageNames.CSharp ?
                    (ISyntaxNodeAnalyzerService)new CSharpSyntaxNodeAnalyzerService() :
                    new VisualBasicSyntaxNodeAnalyzerService();
                var driver = new DiagnosticAnalyzerDriver(project, nodeInBodyAnalyzerService, CancellationToken.None);

                if (analyzer.SupportsProjectDiagnosticAnalysis(driver))
                {
                    projectDiagnostics = driver.GetProjectDiagnosticsAsync(analyzer, null).Result ?? SpecializedCollections.EmptyEnumerable<Diagnostic>();
                }
            }

            return documentDiagnostics.Concat(projectDiagnostics);
        }

        public static IEnumerable<Diagnostic> GetAllDiagnostics(DiagnosticAnalyzer providerOpt, Document document, TextSpan span, bool donotCatchAnalyzerExceptions = true)
        {
            return GetDiagnostics(providerOpt, document, span, document.Project, getDocumentDiagnostics: true, getProjectDiagnostics: true, donotCatchAnalyzerExceptions: donotCatchAnalyzerExceptions);
        }

        public static IEnumerable<Diagnostic> GetAllDiagnostics(DiagnosticAnalyzer providerOpt, Project project, bool donotCatchAnalyzerExceptions = true)
        {
            var diagnostics = new List<Diagnostic>();
            foreach (var document in project.Documents)
            {
                var span = document.GetSyntaxRootAsync().Result.FullSpan;
                var documentDiagnostics = GetDocumentDiagnostics(providerOpt, document, span, donotCatchAnalyzerExceptions);
                diagnostics.AddRange(documentDiagnostics);
            }

            var projectDiagnostics = GetProjectDiagnostics(providerOpt, project, donotCatchAnalyzerExceptions);
            diagnostics.AddRange(projectDiagnostics);
            return diagnostics;
        }

        public static IEnumerable<Diagnostic> GetAllDiagnostics(DiagnosticAnalyzer providerOpt, Solution solution, bool donotCatchAnalyzerExceptions = true)
        {
            var diagnostics = new List<Diagnostic>();
            foreach (var project in solution.Projects)
            {
                var projectDiagnostics = GetAllDiagnostics(providerOpt, project, donotCatchAnalyzerExceptions);
                diagnostics.AddRange(projectDiagnostics);
            }

            return diagnostics;
        }

        public static IEnumerable<Diagnostic> GetDocumentDiagnostics(DiagnosticAnalyzer providerOpt, Document document, TextSpan span, bool donotCatchAnalyzerExceptions = true)
        {
            return GetDiagnostics(providerOpt, document, span, document.Project, getDocumentDiagnostics: true, getProjectDiagnostics: false, donotCatchAnalyzerExceptions: donotCatchAnalyzerExceptions);
        }

        public static IEnumerable<Diagnostic> GetProjectDiagnostics(DiagnosticAnalyzer providerOpt, Project project, bool donotCatchAnalyzerExceptions = true)
        {
            return GetDiagnostics(providerOpt, null, default(TextSpan), project, getDocumentDiagnostics: false, getProjectDiagnostics: true, donotCatchAnalyzerExceptions: donotCatchAnalyzerExceptions);
        }
    }
}


text:
package facebook4j;

import java.util.List;

import facebook4j.internal.util.z_F4JInternalStringUtil;

/**
 * @author Ryuji Yamashita - roundrop at gmail.com
 */
public final class PrivacyBuilder {
    private PrivacyParameter privacyParameter = new PrivacyParameter();

    public PrivacyBuilder setValue(PrivacyType value) {
        checkNotBuilt();
        privacyParameter.setValue(value.toString());
        return this;
    }

    public PrivacyBuilder setFriends(PrivacyType friends) {
        checkNotBuilt();
        privacyParameter.setFriends(friends.toString());
        return this;
    }

    public PrivacyBuilder setNetworks(String networks) {
        checkNotBuilt();
        privacyParameter.setNetworks(networks);
        return this;
    }
    public PrivacyBuilder setNetworks(List<String> networks) {
        checkNotBuilt();
        privacyParameter.setNetworks(z_F4JInternalStringUtil.join((String[]) networks.toArray(new String[networks.size()])));
        return this;
    }
    public PrivacyBuilder addNetwork(String network) {
        checkNotBuilt();
        String networks = privacyParameter.getNetworks();
        if (networks == null) {
            privacyParameter.setNetworks(network);
        } else {
            privacyParameter.setNetworks(networks + "," + network);
        }
        return this;
    }

    public PrivacyBuilder setAllow(String allow) {
        checkNotBuilt();
        privacyParameter.setAllow(allow);
        return this;
    }
    public PrivacyBuilder setAllow(List<String> allow) {
        checkNotBuilt();
        privacyParameter.setAllow(z_F4JInternalStringUtil.join((String[]) allow.toArray(new String[allow.size()])));
        return this;
    }
    public PrivacyBuilder addAllow(String allow) {
        checkNotBuilt();
        String allows = privacyParameter.getAllow();
        if (allows == null) {
            privacyParameter.setAllow(allow);
        } else {
            privacyParameter.setAllow(allows + "," + allow);
        }
        return this;
    }

    public PrivacyBuilder setDeny(String deny) {
        checkNotBuilt();
        privacyParameter.setDeny(deny);
        return this;
    }
    public PrivacyBuilder setDeny(List<String> deny) {
        checkNotBuilt();
        privacyParameter.setDeny(z_F4JInternalStringUtil.join((String[]) deny.toArray(new String[deny.size()])));
        return this;
    }
    public PrivacyBuilder addDeny(String deny) {
        checkNotBuilt();
        String denys = privacyParameter.getDeny();
        if (denys == null) {
            privacyParameter.setDeny(deny);
        } else {
            privacyParameter.setDeny(denys + "," + deny);
        }
        return this;
    }

    public PrivacyParameter build() {
        checkNotBuilt();
        try {
            return privacyParameter;
        } finally {
            privacyParameter = null;
        }
    }

    private void checkNotBuilt() {
        if (privacyParameter == null) {
            throw new IllegalStateException("Cannot use this builder any longer, build() has already been called");
        }
    }
}


text:
from ducktape.utils.util import wait_until
from ducktape.tests.test import Test
from ducktape.mark import matrix
from ducktape.mark.resource import cluster

from kafkatest.services.zookeeper import ZookeeperService
from kafkatest.services.kafka import KafkaService
from kafkatest.services.console_consumer import ConsoleConsumer
from kafkatest.services.kafka_log4j_appender import KafkaLog4jAppender
from kafkatest.services.security.security_config import SecurityConfig

TOPIC = "topic-log4j-appender"
MAX_MESSAGES = 100

class Log4jAppenderTest(Test):
    """
    Tests KafkaLog4jAppender using VerifiableKafkaLog4jAppender that appends increasing ints to a Kafka topic
    """
    def __init__(self, test_context):
        super(Log4jAppenderTest, self).__init__(test_context)
        self.num_zk = 1
        self.num_brokers = 1
        self.messages_received_count = 0
        self.topics = {
            TOPIC: {'partitions': 1, 'replication-factor': 1}
        }

        self.zk = ZookeeperService(test_context, self.num_zk)

    def setUp(self):
        self.zk.start()

    def start_kafka(self, security_protocol, interbroker_security_protocol):
        self.kafka = KafkaService(
            self.test_context, self.num_brokers,
            self.zk, security_protocol=security_protocol,
            interbroker_security_protocol=interbroker_security_protocol, topics=self.topics)
        self.kafka.start()

    def start_appender(self, security_protocol):
        self.appender = KafkaLog4jAppender(self.test_context, self.num_brokers, self.kafka, TOPIC, MAX_MESSAGES,
                                           security_protocol=security_protocol)
        self.appender.start()

    def custom_message_validator(self, msg):
        if msg and "INFO : org.apache.kafka.tools.VerifiableLog4jAppender" in msg:
            self.logger.debug("Received message: %s" % msg)
            self.messages_received_count += 1

    def start_consumer(self):
        self.consumer = ConsoleConsumer(self.test_context, num_nodes=self.num_brokers, kafka=self.kafka, topic=TOPIC,
                                        consumer_timeout_ms=10000,
                                        message_validator=self.custom_message_validator)
        self.consumer.start()

    @cluster(num_nodes=4)
    @matrix(security_protocol=['PLAINTEXT', 'SSL'])
    @cluster(num_nodes=5)
    @matrix(security_protocol=['SASL_PLAINTEXT', 'SASL_SSL'])
    def test_log4j_appender(self, security_protocol='PLAINTEXT'):
        """
        Tests if KafkaLog4jAppender is producing to Kafka topic
        :return: None
        """
        self.start_kafka(security_protocol, security_protocol)
        self.start_appender(security_protocol)
        self.appender.wait()

        self.start_consumer()
        node = self.consumer.nodes[0]

        wait_until(lambda: self.consumer.alive(node),
            timeout_sec=10, backoff_sec=.2, err_msg="Consumer was too slow to start")

        # Verify consumed messages count
        wait_until(lambda: self.messages_received_count == MAX_MESSAGES, timeout_sec=10,
                   err_msg="Timed out waiting to consume expected number of messages.")

        self.consumer.stop()


text:
from nova import exception

from paxes_nova import _

class IBMPowerVMMigrationFailed(exception.NovaException):
    msg_fmt = _("The migration task failed. %(error)s")

class IBMPowerVMMigrationInProgress(exception.NovaException):
    msg_fmt = _("Migration of %(lpar)s is already in progress.")

class IBMPowerVMProgressUpdateError(exception.NovaException):
    msg_fmt = _("Unable to update progress for virtual machine '%(uuid)s'.")

class IBMPowerVMMediaRepOutOfSpace(exception.NovaException):
    msg_fmt = _("The media library is too small for the ISO image. The "
                "media library requires %(size)s MB of space but only "
                "%(free)s MB is available.")

class IBMPowerVMLPARIsRunningDuringCapture(exception.NovaException):
    msg_fmt = _("Virtual machine '%(instance_name)s' is running during "
                "capture. Virtual machines must be stopped before they "
                "can be captured.")

class IBMPowerVMLPARInstanceNotFound(exception.NovaException):
    msg_fmt = _("Unable to find virtual machine '%(instance_name)s'.")

class IBMPowerVMInsufficientResources(exception.NovaException):
    msg_fmt = _("Insufficient resources")

class IBMPowerVMMemoryBelowMin(IBMPowerVMInsufficientResources):
    msg_fmt = _("The requested memory (%(mem_requested)d MB) is below "
                "the minimum required value (%(mem_min)d MB)")

class IBMPowerVMDiskBelowActual(IBMPowerVMInsufficientResources):
    msg_fmt = _("The requested disk (%(new_disk_size)d GB) is lesser than "
                "the existing disk (%(disk_size)d GB)")

class IBMPowerVMCPUsBelowMin(IBMPowerVMInsufficientResources):
    msg_fmt = _("The requested CPUs (%(cpus_requested)d) are below "
                "the minimum required value (%(cpus_min)d) ")

class IBMPowerVMProcUnitsBelowMin(IBMPowerVMInsufficientResources):
    msg_fmt = _("The requested processing units (%(units_requested)s) are "
                "below the minimum required value (%(units_min)s) ")

class IBMPowerVMInsufficientFreeMemory(IBMPowerVMInsufficientResources):
    msg_fmt = _("Insufficient free memory: (%(mem_requested)d MB "
                "requested, %(mem_avail)d MB free)")

class IBMPowerVMInsufficientCPU(IBMPowerVMInsufficientResources):
    msg_fmt = _("Insufficient available CPUs: (%(cpus_requested)d "
                "requested, %(cpus_avail)d available)")

class IBMPowerVMInsufficientProcUnits(IBMPowerVMInsufficientResources):
    msg_fmt = _("Insufficient available processing units: "
                "(%(units_requested)s requested, "
                "%(units_avail)s available)")

class IBMPowerVMJobRequestFailed(exception.NovaException):
    msg_fmt = _("The '%(operation_name)s' operation failed. %(error)s")

class IBMPowerVMJobRequestTimedOut(IBMPowerVMJobRequestFailed):
    msg_fmt = _("The '%(operation_name)s' operation failed. "
                "Failed to complete the task in %(seconds)s seconds.")

class IBMPowerVMLPARInstanceCleanupFailed(exception.NovaException):
    msg_fmt = _("Virtual machine '%(instance_name)s' cleanup failed. "
                "Reason: %(reason)s")

class IBMPowerVMInstanceTerminationFailure(exception.
                                           InstanceTerminationFailure):
    msg_fmt = _("Failed to delete virtual machine. %(reason)s")

class IBMPowerVMNoInstanceBootDeviceDefined(exception.NovaException):
    msg_fmt = _("The boot device name attribute is not defined for virtual "
                "machine %(instance_name)s with ID %(instance_uuid)s.")

class IBMPowerVMInvalidImageObject(exception.NovaException):
    msg_fmt = _("Unable to save the captured image meta data for virtual "
                "machine %(instance_name)s because the image object is "
                "invalid.")

class IBMPowerVMInvalidBootVolume(exception.NovaException):
    msg_fmt = _("Boot volume %(volume)s is invalid for virtual machine "
                "%(instance_name)s with ID %(instance_uuid)s.")

class IBMPowerVMBootVolumeCloneFailure(exception.NovaException):
    msg_fmt = _("Clone for boot volume %(image_volume)s failed for virtual "
                "machine %(instance_name)s with ID %(instance_uuid)s.")

class IBMPowerVCK2APIError(exception.NovaException):
    msg_fmt = _("An error occurred while working with objects returned "
                "from the K2 API.")

class IBMPowerVMNoOSForVM(exception.NovaException):
    msg_fmt = _("Virtual machine '%(instance_name)s' does not have an"
                " operating system identified.  The process for bringing"
                " the virtual machine under management by PowerVC must "
                "be completed.")

class IBMPowerVMUnsupportedOSForVM(exception.NovaException):
    msg_fmt = _("The operating system %(os_distro)s for virtual machine "
                "'%(instance_name)s' is not supported. Supported operating "
                "systems include the following: %(options)s")

class IBMPowerVMErrorExtendingVolume(exception.NovaException):
    msg_fmt = _("An error occurred when extending volume %(volume_id)s")

class IBMPowerVMNoLicenseSRC(exception.NovaException):

    def __init__(self, message=None, **kwargs):
        message = _("Unable to deploy virtual machine '%(instance_name)s' "
                    "because the host does not support the operating system"
                    " installed on this image") % kwargs
        super(IBMPowerVMNoLicenseSRC, self).__init__(message)


text:
namespace Gwen {
class WindowProvider {
public:
  virtual void *GetWindow() = 0;
};
}

#endif


text:
using Util = Saklient.Util;

namespace Saklient.Cloud.Enums
{

	/// <summary>ディスクの接続方式を表す列挙子。
	/// </summary>
	public class EDiskConnection
	{

		static System.Collections.Generic.Dictionary<string, long?> _map_ = new System.Collections.Generic.Dictionary<string, long?>()
		{
			{ "ide", 100 },
			{ "virtio", 300 }
		};

		/// <summary>IDE
		/// </summary>
		public static string IDE = "ide";

		/// <summary>VIRTIO
		/// </summary>
		public static string VIRTIO = "virtio";

		public static long? Compare(string lhs, string rhs)
		{
			long? l = lhs!=null && _map_.ContainsKey(lhs) ? _map_[lhs] : null;
			long? r = rhs!=null && _map_.ContainsKey(rhs) ? _map_[rhs] : null;
			if (l==null || r==null) return null;
			long ret = (long)l - (long)r;
			return 0 < ret ? 1 : (ret < 0 ? -1 : 0);
		}

	}

}


text:
package brownshome.scriptwars.connection;

import java.nio.ByteBuffer;
import java.util.concurrent.SynchronousQueue;
import java.util.function.Consumer;

import brownshome.scriptwars.game.Player;

public class MemoryConnectionHandler extends ConnectionHandler<SynchronousQueue<ByteBuffer>> {
	private static MemoryConnectionHandler instance;

	public static MemoryConnectionHandler instance() {
		if(instance == null) {
			instance = new MemoryConnectionHandler();
		}

		return instance;
	}

	private final int MEMORY_PROTOCOL_BYTE = 3;

	@Override
	protected void sendRawData(SynchronousQueue<ByteBuffer> queue, ByteBuffer... data) {
		int length = 0;
		for(ByteBuffer b : data) {
			length += b.remaining();
		}
		ByteBuffer total = ByteBuffer.allocate(length);
		for(ByteBuffer b : data) {
			total.put(b);
		}
		total.flip();

		//If the packet is not ready to be received drop it.
		queue.offer(total);
	}

	@Override
	public int getProtocolByte() {
		return MEMORY_PROTOCOL_BYTE;
	}

	@Override
	public void closeConnectionHandler() {}

	public Consumer<ByteBuffer> join(ByteBuffer firstPacket, SynchronousQueue<ByteBuffer> input) throws InvalidIDException {
		int ID = firstPacket.getInt();

		if(Player.getPlayerFromID(ID) != null) {
			throw new InvalidIDException();
		}

		Player<SynchronousQueue<ByteBuffer>> player = new Player<>(ID, ConnectionUtil.bufferToString(firstPacket), this, input);

		synchronized(player.getGame()) {
			player.addPlayer();
		}

		return buffer -> handleData(buffer, player);
	}

	private void handleData(ByteBuffer buffer, Player<SynchronousQueue<ByteBuffer>> player) {
		try {
			synchronized(player.getGame()) {
				player.incommingData(buffer);
			}
		} catch(Exception e) {
			player.sendError(e.getMessage());
		}
	}
}