text:
/*{% load i18n %}*/
/*global dojo, dijit, djConfig, questionnaire, startAsTestUser, logout, createsubwindow, showHideFeaturelayers,
  closesubwindow, submitsubwindow, create_session, create_session_callback, map, window, submitContact, gnt,
  checkemail
*/
/* init questionnaire object */

/*All the functions controlling the flow of the questionnaire*/
var applicationName = "pehmogis";

/*Mapservice used */
var MAPSERVICE_URL = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";

/* Mapservice for satellite map */
var SATELLITE_MAPSERVICE_URL = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer";

/*Mapservice for the overview map*/
var OVERVIEWMAP_URL = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer";

var AREAS_FEATURE_LAYER_URL = "";

questionnaire.infotemplates_url = "{% url random_cont file_name='pos_neg_info_temp_html' file_type='html' %}";
questionnaire.WMScapabilities_url ="{% url common file_name='vaaka_poi_wms_getcapabilities2' file_type='xml' %}";

questionnaire.initial_extent = {
        "xmax": 2780607.609391832,
        "xmin": 2768578.3320654687,
        "ymax": 8438150.101392904,
        "ymin": 8433544.770438729,
        "spatialReference": {
            "wkid": 3857
        }
};

questionnaire.start_extent = {
        "x": -13051288.879079,
        "y": 3868252.6086434,
        "zoomLevel": 12
}
questionnaire.initial_wms_layers = "0,1,3,5";

//questionnaire.minMarkZoomLevel = 2;

questionnaire.sections = [{
"section": "background"
},
{
"section": "envmovement"
},
{
"section": "envevaluation"
},
{
"section": "improvements"
},
{
"section": "feedback"
}
];

questionnaire.infoTemplates = {
"default": {
    "confirm": "
${question}
" +
                "
" +
                "${positive}" +
                "
" +
                "
" +
                "${negative}" +
                "
",
    "confirmHeight": 150,
    "confirmWidth": 250,
    "info": "
" +
            "${close}" +
            "
" +
            "
" +
            "" +
            "${remove}
",
    "infoWidth": 250,
    "infoHeight": 150
},
"routes": {
    "confirm": "{% spaceless %}{% include 'example/html/routes_info.html' %}{% with 'route' as type %}{% include 'example/html/infoConfirm.html' %}{% endwith %}{% endspaceless %}",
    "confirmWidth": 250,
    "confirmHeight": 460,
    "info": "{% spaceless %}{% include 'example/html/routes_info.html' %}{% with 'route' as type %}{% include 'example/html/info_info.html' %}{% endwith %}{% endspaceless %}",
    "infoWidth": 250,
    "infoHeight": 460
    },
"newRoutes": {
    "confirm":	"<form id='info'>" +
                "
${tellmore}
" +
                "<textarea id='itext' name='tellmore' cols='25' rows='4'></textarea>" +
                "</form>" +
                "{% spaceless %}{% with 'route' as type %}{% include 'example/html/infoConfirm.html' %}{% endwith %}{% endspaceless %}",
    "confirmHeight": 270,
    "confirmWidth": 250,
    "info":	"<form id='info'>" +
            "
${tellmore}
" +
            "<textarea id='itext' name='tellmore' cols='25' rows='4'></textarea>" +
            "</form>" +
            "{% spaceless %}{% with 'route' as type %}{% include 'example/html/info_info.html' %}{% endwith %}{% endspaceless %}",
    "infoWidth": 270,
    "infoHeight": 250
},
"other": {
    "confirm":  "<form id='info'>" +
                "
${tellmore}
" +
                "<textarea id='itext' name='tellmore' cols='25' rows='4'></textarea>" +
                "</form>" +
                "{% spaceless %}{% include 'example/html/infoConfirm.html' %}{% endspaceless %}",
    "confirmHeight": 270,
    "confirmWidth": 250,
    "info": "<form id='info'>" +
            "
${tellmore}
" +
            "<textarea id='itext' name='tellmore' cols='25' rows='4'></textarea>" +
            "</form>" +
            "{% spaceless %}{% include 'example/html/info_info.html' %}{% endspaceless %}",
    "infoWidth": 270,
    "infoHeight": 250
},
"home": {
    "confirm":  "{% spaceless %}{% include 'example/html/home_info.html' %}{% include 'example/html/infoConfirm.html' %}{% endspaceless %}",
    "confirmWidth": 350,
    "confirmHeight": 450,
    "info": "{% spaceless %}{% include 'example/html/home_info.html' %}{% include 'example/html/info_info.html' %}{% endspaceless %}",
    "infoWidth": 350,
    "infoHeight": 450
},
"moveEnvWork": {
    "confirm":  "{% spaceless %}{% include 'example/html/move_env_info_work.html' %}{% include 'example/html/infoConfirm.html' %}{% endspaceless %}",
    "confirmWidth": 350,
    "confirmHeight": 450,
    "info": "{% spaceless %}{% include 'example/html/move_env_info_work.html' %}{% include 'example/html/info_info.html' %}{% endspaceless %}",
    "infoWidth": 350,
    "infoHeight": 450
},
"moveEnvShop": {
    "confirm":  "{% spaceless %}{% include 'example/html/move_env_info_shop.html' %}{% include 'example/html/infoConfirm.html' %}{% endspaceless %}",
    "confirmWidth": 350,
    "confirmHeight": 450,
    "info": "{% spaceless %}{% include 'example/html/move_env_info_shop.html' %}{% include 'example/html/info_info.html' %}{% endspaceless %}",
    "infoWidth": 350,
    "infoHeight": 450
},
"moveEnvBusiness": {
    "confirm":  "{% spaceless %}{% include 'example/html/move_env_info_business.html' %}{% include 'example/html/infoConfirm.html' %}{% endspaceless %}",
    "confirmWidth": 350,
    "confirmHeight": 450,
    "info": "{% spaceless %}{% include 'example/html/move_env_info_business.html' %}{% include 'example/html/info_info.html' %}{% endspaceless %}",
    "infoWidth": 350,
    "infoHeight": 450
},
"moveEnvExercise": {
    "confirm":  "{% spaceless %}{% include 'example/html/move_env_info_exercise.html' %}{% include 'example/html/infoConfirm.html' %}{% endspaceless %}",
    "confirmWidth": 350,
    "confirmHeight": 450,
    "info": "{% spaceless %}{% include 'example/html/move_env_info_exercise.html' %}{% include 'example/html/info_info.html' %}{% endspaceless %}",
    "infoWidth": 350,
    "infoHeight": 450
},
"moveEnvFreetime": {
    "confirm":  "{% spaceless %}{% include 'example/html/move_env_info_freetime.html' %}{% include 'example/html/infoConfirm.html' %}{% endspaceless %}",
    "confirmWidth": 350,
    "confirmHeight": 450,
    "info": "{% spaceless %}{% include 'example/html/move_env_info_freetime.html' %}{% include 'example/html/info_info.html' %}{% endspaceless %}",
    "infoWidth": 350,
    "infoHeight": 450
},
"moveEnvOther": {
    "confirm":  "{% spaceless %}{% include 'example/html/move_env_info_otherplace.html' %}{% include 'example/html/infoConfirm.html' %}{% endspaceless %}",
    "confirmWidth": 350,
    "confirmHeight": 450,
    "info": "{% spaceless %}{% include 'example/html/move_env_info_otherplace.html' %}{% include 'example/html/info_info.html' %}{% endspaceless %}",
    "infoWidth": 350,
    "infoHeight": 450
},
"kkolmio": {
    "confirm":  "{% spaceless %}{% include 'example/html/kkolmio_info_info.html' %}{% endspaceless %}",
    "confirmWidth": 350,
    "confirmHeight": 450,
    "info": "{% spaceless %}{% include 'example/html/kkolmio_info_confirm.html' %}{% endspaceless %}",
    "infoWidth": 350,
    "infoHeight": 450
}
};

questionnaire.imageButton = {
"defaultbutton": { //sets all the default values here,
    "draw": "POINT",
    "buttontext": {
        "en":"",
        "fi":"",
        "sv":""
        },
    "xoffset": 0, //according to the placemarker
    "yoffset": 15, //according to the placemarker
    "xsize": 23, //according to image size for placemarker
    "ysize": 36,
    "classtype": "point", //added as a class, good for css rules and outlook
    "placeMark": "{{ MEDIA_URL }}img/placemarks/pointorange.png",
    "cursorImg":"{{ MEDIA_URL }}img/cursors/point.cur",
    "graphicAttr": {
        "id": "default",
        "infotype": "default",
        "valuename": "default",
        "max": 3,
        "rgb": [200,92,92]
        },
    "graphicStrings": {
        "fi": {
            "header": "
Paikka
",
            "question": "Menikö piste oikeaan kohtaan?",
            "polylinequestion": "Menikö reitti oikeaan kohtaan?",
            "positive": "Kyllä, tallenna kohde",
            "polylinepositive": "Tallenna reitti",
            "negative": "Ei, poista kohde",
            "polylinenegative": "Poista reitti",
            "remove": "Poista kohde",
            "polylineremove": "Poista reitti",
            "change": "Muuta kohteen paikkaa",
            "close": "Sulje ikkuna",
            "save": "Tallenna kohde",
            "many": "Useammalla välineellä",
            "tellmore": "Kerro lisää paikasta:",
            "walk": "jalkaisin",
            "bike": "pyöräillen",
            "public": "Julkisilla",
            "car": "Autolla",
            "runorjog": "juosten tai hölkäten",
            "skate": "rullaluistimilla",
            "other": "muuten",
            "comments": "Muuta kerrottavaa tästä reitistä?"
            },
        "en": {
            "header": "
Place
",
            "question": "is the mark in the right place",
            "positive": "Yes, save place",
            "negative": "No, remove place",
            "change": "Change place",
            "close": "Close window"
            },
        "sv": {
            "header": "
Ställe
",
            "question": "Kom punkten på rätt ställe?",
            "polylinequestion": "Kom rutten på rätt ställe?",
            "positive": "Ja, spara objektet",
            "polylinepositive": "Spara rutten",
            "negative": "Nej, ta bort stället",
            "polylinenegative": "Ta bort stället",
            "remove": "Ta bort objektet",
            "polylineremove": "Ta bort rutten",
            "change": "Flytta på objektet",
            "close": "Stäng fönstret",
            "save": "Spara objektet",
            "many": "Med flera medel",
            "tellmore": "Berätta mer om stället:",
            "walk": "Till fots",
            "bike": "Med cykel",
            "public": "Med kollektivtrafiken",
            "car": "Med bil",
            "comments": "Annat som du vill berätta om den här rutten?"
            }
        }
},
"home": {
        "buttontext": "{% trans 'Home' %}",
        "classtype": "big",
        "placeMark": "{{ STATIC_URL }}img/placemarks/pointgreen.png",
        "cursorImg":"{{ STATIC_URL }}img/cursors/home.cur",
        "graphicAttr": {
                    "id": "home",
                    "valuename": "home",
                    "infotype": "home",
                    "max": 1
        },
        "graphicStrings": {
                    "header": "
{% trans 'Home' %}
"
        }
},
"new_place": {
        "buttontext": "{% trans 'Uusi asuinpaikka' %}",
        "classtype": "big",
        "placeMark": "{{ STATIC_URL }}img/placemarks/pointorange.png",
        "cursorImg":"{{ STATIC_URL }}img/cursors/point.cur",
        "graphicAttr": {
                    "id": "new_place",
                    "valuename": "new_place",
                    "infotype": "other",
                    "max": 10
        },
        "graphicStrings": {
                    "header": "
{% trans 'Uusi asuinpaikka' %}
",
                    "tellmore": "{% trans 'Miksi muuttaisit juuri tänne?' %}"
        }
},
"new_place_area_at_kk": {
        "buttontext": "{% trans 'Uusi asuinalue' %}",
        "classtype": "big",
        "placeMark": "{{ STATIC_URL }}img/placemarks/pointorange.png",
        "cursorImg":"{{ STATIC_URL }}img/cursors/point.cur",
        "graphicAttr": {
                    "id": "new_place_at_kk",
                    "valuename": "new_place_at_kk",
                    "infotype": "default",
                    "max": 100
        },
        "graphicStrings": {
                    "header": "
{% trans 'Uusi asuinalue' %}
",
                    "tellmore": "{% trans 'Miksi muuttaiset juuri tänne?' %}"
        }
},
"work": {
        "placeMark": "{{ STATIC_URL }}img/placemarks/atmosphere.png",
        "classtype": "moveEnvironment",
        "graphicAttr": {
                    "id": "work",
                    "valuename": "work",
                    "infotype": "moveEnvWork"
        },
        "graphicStrings": {
                    "header": "
{% trans 'Työ, opiskelu, päivähoito' %}
",
                    "typetext": "{% trans 'työ-, opiskelu-, päivähoitopaikka' %}",
                    "type1": "{% trans 'oma työpaikka' %}",
                    "type2": "{% trans 'perheenjäsenen työpaikka' %}",
                    "type3": "{% trans 'lapsen päivähoitopaikka tai koulu' %}",
                    "type4": "{% trans 'koulu tai opiskelupaikka' %}",
                    "type5": "{% trans 'työhön liittyvä asiointipaikka' %}",
                    "type6": "{% trans 'muu' %}",
                    "extraText": "{% trans 'Lisätietoja tästä paikasta' %}"
        }
},
"shop": {
        "placeMark": "{{ STATIC_URL }}img/placemarks/atmosphere.png",
        "classtype": "moveEnvironment",
        "graphicAttr": {
                    "id": "shop",
                    "valuename": "shop",
                    "infotype": "moveEnvShop"
        },
        "graphicStrings": {
                    "header": "
{% trans 'Ostospaikka' %}
",
                    "typetext": "{% trans 'ostospaikka' %}",
                    "type1": "{% trans 'lähikauppa' %}",
                    "type2": "{% trans 'super- tai hypermarket' %}",
                    "type3": "{% trans 'kauppakeskus tai tavaratalo' %}",
                    "type4": "{% trans 'erikoiskauppa' %}",
                    "type5": "{% trans 'muu' %}",
                    "extraText": "{% trans 'Miksi käyt ostoksilla juuri täällä?' %}"
        }
},
"business": {
        "placeMark": "{{ STATIC_URL }}img/placemarks/atmosphere.png",
        "classtype": "moveEnvironment",
        "graphicAttr": {
                    "id": "business",
                    "valuename": "business",
                    "max": 100,
                    "infotype": "moveEnvBusiness"
        },
        "graphicStrings": {
                    "header": "
{% trans 'Asiointipaikka' %}
",
                    "typetext": "{% trans 'asiointipaikka' %}",
                    "type1": "{% trans 'pankki, posti tai virasto' %}",
                    "type2": "{% trans 'terveyspalvelut' %}",
                    "type3": "{% trans 'muu palvelu, esim. kampaaja tai parturi' %}",
                    "type4": "{% trans 'muu' %}",
                    "extraText": "{% trans 'Miksi asioit juuri täällä?' %}"
        }
},
"exercise": {
        "placeMark": "{{ STATIC_URL }}img/placemarks/atmosphere.png",
        "classtype": "moveEnvironment",
        "graphicAttr": {
                    "id": "exercise",
                    "valuename": "exercise",
                    "max": 100,
                    "infotype": "moveEnvExercise"
        },
        "graphicStrings": {
                    "header": "
{% trans 'Liikunta ja ulkoilu' %}
",
                    "typetext": "{% trans 'liikunta- tai ulkoilupaikka' %}",
                    "type1": "{% trans 'ulkoilupaikka' %}",
                    "type2": "{% trans 'liikuntapaikka' %}",
                    "type3": "{% trans 'leikkipuisto' %}",
                    "type4": "{% trans 'muu' %}",
                    "extraText": "{% trans 'Miksi liikut ja ulkoilet juuri täällä?' %}"
        }
},
"freetime": {
        "placeMark": "{{ STATIC_URL }}img/placemarks/atmosphere.png",
        "classtype": "moveEnvironment",
        "graphicAttr": {
                    "id": "freetime",
                    "valuename": "freetime",
                    "max": 100,
                    "infotype": "moveEnvFreetime"
        },
        "graphicStrings": {
                    "header": "
{% trans 'Vapaa-aika' %}
",
                    "typetext": "{% trans 'vapaa-ajanpaikka' %}",
                    "type1": "{% trans 'vierailupaikka' %}",
                    "type2": "{% trans 'ravintola, kahvila' %}",
                    "type3": "{% trans 'kirjasto' %}",
                    "type4": "{% trans 'kirkko, seurakuntatoiminta' %}",
                    "type5": "{% trans 'kesämökki, vapaa-ajan asunto' %}",
                    "type6": "{% trans 'työväenopisto tms.' %}",
                    "type7": "{% trans 'muu' %}",
                    "extraText": "{% trans 'Miksi vietät vapaa-aikaa juuri täällä?' %}"
        }
},
"otherplace": {
        "placeMark": "{{ STATIC_URL }}img/placemarks/atmosphere.png",
        "classtype": "moveEnvironment",
        "graphicAttr": {
                    "id": "otherplace",
                    "valuename": "otherplace",
                    "max": 100,
                    "infotype": "moveEnvOther"
        },
        "graphicStrings": {
                    "header": "
{% trans 'Muu paikka' %}
",
                    "typetext": "{% trans 'muu paikka' %}",
                    "type1": "{% trans 'Minkätyyppinen paikka on kyseessä?' %}",
                    "extraText": "{% trans 'Lisätietoja tästä paikasta' %}"
        }
},
"importantroute": {
        "draw": "POLYLINE",
        "classtype": "big twoLine",
        "buttontext": "{% trans 'tärkeä jalankulku- tai
pyöräilyreitti' %}",
        "cursorImg":"{{ STATIC_URL }}img/cursors/route.cur",
        "graphicAttr": {
                    "id": "importantroute",
                    "infotype": "routes",
                    "max": 100,
                    "valuename": "importantroute",
                    "rgb": [152,10,211],
                    "question": "{% trans 'Miten yleensä liikut tällä reitillä?' %}"
        },
        "graphicStrings": {
                    "header": "
{% trans 'Tärkeä kävely- tai
 pyöräreitti' %}
",
                    "extraText": "{% trans 'Lisätietoja reitistä:' %}"
        }
},
"new_improve_route": {
        "draw": "POLYLINE",
        "buttontext": "{% trans 'uusi kevyen liikenteen reitti' %}",
        "classtype": "big long",
        "cursorImg":"{{ STATIC_URL }}img/cursors/route.cur",
        "graphicAttr": {
                    "id": "new_improve_route",
                    "valuename": "newRoute",
                    "infotype": "newRoutes",
                    "max": 3,
                    "rgb": [0,0,255]
        },
        "graphicStrings": {
                    "header": "
{% trans 'Reittiehdotuksesi' %}
",
                    "tellmore": "{% trans 'Millaista reittiä toivot tähän paikkaan?' %}"
        }
},
"new_transport_route": {
        "draw": "POLYLINE",
        "buttontext": "{% trans 'uusi joukkoliikenneyhteys' %}",
        "classtype": "big long",
        "cursorImg":"{{ STATIC_URL }}img/cursors/route.cur",
        "graphicAttr": {
                    "id": "new_transport_route",
                    "valuename": "newtrRoute",
                    "infotype": "newRoutes",
                    "max": 3,
                    "rgb": [0,255,0]
                    //"rgb": [205,225,170]
        },
        "graphicStrings": {
                    "header": "
{% trans 'Ehdotuksesi uudeksi joukkoliikenneyhteydeksi' %}
",
                    "tellmore": "{% trans 'Millaista joukkoliikennelinjaa toivoisit tänne?' %}"
        }
}
};

//pages order saved in questionnaire object, Array in the order which the pages are shown.
questionnaire.pages =
[
/*first page*/
{
"name": "welcome", //name for page is required and should contain no spaces
"type": "firstpage", //type of page, can be "big" or "small" default is big
"next": function () {gnt.auth.create_session(create_session_callback);}, // additional onclick handler for next button
"preventDefault": {"next": true, "prev": false}, // prevent default onclick handlers for buttons (submitform and createpage)
"content": "{% url main_html file_name='welcome' %}" //the file where the content can be found
},
{
"name": "background",
"section": "background", //tells the application which section this page belongs to
"type":"big",
"content": "{% url main_html file_name='background' %}"
},
{
"name": "thingsappreciate",
"section": "background",
"type": "big",
"content": "{% url random_cont file_name='thingsappreciate' file_type='html' %}"
},
{
"name": "home",
"section": "background",
"type": "small",
"content": "{% url main_html file_name='home' %}"
},
{
"name": "move_environment",
"section": "envmovement",
"type": "small",
"content": "{% url main_html file_name='move_environment' %}"
},
{
"name": "importantRoutes",
"section": "envmovement",
"type": "small",
"content": "{% url main_html file_name='important_routes' %}"
},
{
"name":  "environment",
"section": "envevaluation",
"type": "small",
"content": "{% url random_cont file_name='environment' file_type='html' %}"
},
{
"name": "environmentSummary",
"section": "envevaluation",
"type": "big",
"content": "{% url random_cont file_name='environmentsummary' file_type='html' %}"
},
{
"name":  "improvements",
"section": "improvements",
"type": "small",
"content": "{% url main_html file_name='improvements' %}"
},
{
"name": "owncomments",
"section": "feedback",
"type": "big",
"content": "{% url main_html file_name='owncomments' %}",
"next": function() {submitContact('contactForm');},
"previous": function() {submitContact('contactForm');}
},
{
"name": "thankyou",
"type": "big",
//"next": function () {window.location=('{% url common file_name='mymap' file_type='html' %}');},
"extraButtons": function() {gnt.auth.logout(); createsubwindow('endQuestionnaire');},
"preventDefault": {"next": true, "prev": false},
"content": "{% url main_html file_name='thankyou' %}"
}
];

//subwindows is not in any particular order and can be search by name
questionnaire.subwindows = {
"quit": {
    "content": "{% url main_html file_name='quit' %}",
    "next": function(e) {if(checkemail(dojo.byId("quitemail").value)) {dojo.byId("languageinput").value = djConfig.locale; submitsubwindow();}createsubwindow('quitconfirmation');}, //function to be called for onclick on the next button
    "previous": function(e) {closesubwindow();}//function to be called for onclick on the previous button
},
"quitconfirmation": {
    "content": "{% url main_html file_name='quitconfirmation' %}"
},
"mapanimation": {
"content": "{% url common file_type='html' file_name='mapanimation' %}"
},
"routeanimation": {
"content": "{% url common file_type='html' file_name='routeanimation' %}"
},
"feedback": {
    "content": "{% url feedback %}",
    "next": function(e) {submitFeedback("feedback", submitFeedback_callback);}, //function to be called for onclick on the next button
    "previous": function(e) {closesubwindow();}//function to be called for onclick on the previous button
},
"endQuestionnaire": {
    "content": "{% url main_html file_name='end_questionnaire' %}"
}

};
/*
var tooltiphelp = {
    "fi": {
        "firstedge":"Aloita piirtäminen napsauttamalla karttaa.",
        "nextedge":"Napsauta karttaa jatkaaksesi reitin piirtoa
tai
lopeta reitin piirto kaksoisklikkauksella."
        },
    "en": {
        "firstedge":"Click on the map to draw the route.",
        "nextedge":"Click on the map to continue the route
or
end the route with a doubleclick."
        },
    "sv": {
        "firstedge":"Klicka på kartan för att rita rutten.",
        "nextedge":"Klicka på kartan för att fortsätta rutten
 eller
sluta rita rutten med en dubbelklick."
        }
};
*/
questionnaire.extra_input_connect = [
    {   "id":"education",
        "event": "onchange",
        "func": function(evt) {
            if(evt.currentTarget.value === 'otherEdu') {
                dojo.removeClass('otherEducationRow', 'tyhja');
                dojo.byId('otherEducation').disabled = false;
            }
            else {
                dojo.addClass('otherEducationRow', 'tyhja');
                dojo.byId('otherEducation').disabled = true;
            }
        }

    },
    {   "id": "family",
        "event": "onchange",
        "func": function(evt) {
            if(evt.currentTarget.value === 'otherFam') {
                dojo.removeClass('otherFamilyRow', 'tyhja');
                dojo.byId('otherFamily').disabled = false;
            }
            else {
                dojo.addClass('otherFamilyRow', 'tyhja');
                dojo.byId('otherFamily').disabled = true;
            }
            if(evt.currentTarget.value === 'couplewithchildren' ||
               evt.currentTarget.value === 'parentwithchildren') {
                dojo.removeClass('birthyearsRow', 'tyhja');
                dojo.byId('birthyears').disabled = false;
            }
            else {
                dojo.addClass('birthyearsRow', 'tyhja');
                dojo.byId('birthyears').disabled = true;
            }
        }

    },
    {   "id":"occupation",
        "event": "onchange",
        "func": function(evt) {
            if(evt.currentTarget.value === 'otherOcc') {
                dojo.removeClass('otherOccupationRow', 'tyhja');
                dojo.byId('otherOccupation').disabled = false;
            }
            else {
                dojo.addClass('otherOccupationRow', 'tyhja');
                dojo.byId('otherOccupation').disabled = true;
            }
        }

    },
    {   "id":"me_other",
        "event": "onchange",
        "func": function(evt) {
            if(evt.currentTarget.value === 'other' && evt.currentTarget.checked === true) {
                dojo.removeClass('otherSpan', 'tyhja');
                dojo.byId('other_text').disabled = false;
            }
            else {
                dojo.addClass('otherSpan', 'tyhja');
                dojo.byId('other_text').disabled = true;
            }
        }

    },
    {   "id":"me_other",
        "event": "onclick",
        "func": function(evt) {
            if (jQuery.browser.msie) {
                $("#me_other").click(function(){$(this).blur().focus();});
            }
        }

    },
    {   "id":"me3_5",
        "event": "onchange",
        "func": function(evt) {
            if(evt.currentTarget.value === 'other' && evt.currentTarget.checked === true) {
                dojo.removeClass('otherHowSpan', 'tyhja');
                dojo.byId('visitOther').disabled = false;
            }
            else {
                dojo.addClass('otherHowSpan', 'tyhja');
                dojo.byId('visitOther').disabled = true;
            }
        }

    },
    {   "id":"me3_5",
        "event": "onclick",
        "func": function(evt) {
            if (jQuery.browser.msie) {
                $("#me3_5").click(function(){$(this).blur().focus();});
            }
        }

    },
    {   "id":"other",
        "name": "mtransport",
        "event": "onchange",
        "func": function(evt) {
            if(evt.currentTarget.value === 'other' && evt.currentTarget.checked === true) {
                dojo.removeClass('otherSpan', 'tyhja');
                dojo.byId('other_text').disabled = false;
            }
            else {
                dojo.addClass('otherSpan', 'tyhja');
                dojo.byId('other_text').disabled = true;
            }
        }

    },
    {   "id":"otherRelation",
        "event": "onchange",
        "func": function(evt) {
            if(evt.currentTarget.value === 'otherRelation' && evt.currentTarget.checked === true) {
                dojo.removeClass('otherRelations_areaRow', 'tyhja');
                dojo.byId('otherRelation_text').disabled = false;
            }
            else {
                dojo.addClass('otherRelations_areaRow', 'tyhja');
                dojo.byId('otherRelation_text').disabled = true;
            }
        }

    },
    {   "id":"work_area",
        "event": "onchange",
        "func": function(evt) {
            if(evt.currentTarget.value === 'otherWork') {
                dojo.removeClass('otherWork_areaRow', 'tyhja');
                dojo.byId('otherWork_area').disabled = false;
            }
            else {
                dojo.addClass('otherWork_areaRow', 'tyhja');
                dojo.byId('otherWork_area').disabled = true;
            }
        }

    },
    {   "id":"ir_17",
        //"name": "threats",
        "event": "onchange",
        "func": function(evt) {
            if(evt.currentTarget.value === 'other_threat' && evt.currentTarget.checked === true) {
                dojo.removeClass('other_threat_row', 'tyhja');
                dojo.byId('other_threat_text').disabled = false;
            }
            else {
                dojo.addClass('other_threat_row', 'tyhja');
                dojo.byId('other_threat_text').disabled = true;
            }
        }

    },
    {   "id":"ir_8",
//        "name": "activity",
        "event": "onchange",
        "func": function(evt) {
            if(evt.currentTarget.value === 'other_acti' && evt.currentTarget.checked === true) {
                dojo.removeClass('other_actiRow', 'tyhja');
                dojo.byId('other_activity').disabled = false;
            }
            else {
                dojo.addClass('other_actiRow', 'tyhja');
                dojo.byId('other_activity').disabled = true;
            }
        }

    },
    {   "id":"like_info_id",
        "event": "onchange",
        "func": function(evt) {
            if(evt.currentTarget.value === 'other' && evt.currentTarget.checked === true) {
                dojo.byId('like_info_other_text').disabled = false;
            }
            else {
                dojo.byId('like_info_other_text').disabled = true;
            }
        }

    },
    {   "id":"spoiled_natural_state_r",
        "event": "onchange",
        "func": function(evt) {
            if(evt.currentTarget.value === 'spoiled_natural_state' && evt.currentTarget.checked === true) {
                dojo.byId('dislike_info_text').disabled = false;
            }
            else {
                dojo.byId('dislike_info_text').disabled = true;
            }
        }

    },
    {   "id":"dislike_info_id",
        "event": "onchange",
        "func": function(evt) {
            if(evt.currentTarget.value === 'other' && evt.currentTarget.checked === true) {
                dojo.byId('dislike_info_other_text').disabled = false;
            }
            else {
                dojo.byId('dislike_info_other_text').disabled = true;
            }
        }

   }
];

questionnaire.special_widgets = {
    "family": {
        "onChange": function(val) {
            if(val === 'otherFam') {
                dojo.removeClass('otherFamilyRow', 'tyhja');
                dijit.byId('otherFamily').set('disabled', false);
            }
            else {
                dojo.addClass('otherFamilyRow', 'tyhja');
                dijit.byId('otherFamily').set('disabled', true);
            }
            if(val === 'couplewithchildren' || val === 'parentwithchildren') {
                dojo.removeClass('birthyearsRow', 'tyhja');
                dijit.byId('birthyears').set('disabled', false);
            }
            else {
                dojo.addClass('birthyearsRow', 'tyhja');
                dijit.byId('birthyears').set('disabled', true);
            }
        }

    },
    "occupation": {
        "onChange": function(val) {
            if(val === 'otherOcc') {
                dojo.removeClass('otherOccupationRow', 'tyhja');
                dijit.byId('otherOccupation').set('disabled', false);
            }
            else {
                dojo.addClass('otherOccupationRow', 'tyhja');
                dijit.byId('otherOccupation').set('disabled', true);
            }
        }
    },
    "show_kk": {
        "onClick": function(val) {
            for(var j = 0; j < map.graphicsLayerIds.length; j++) {
                if(map.getLayer(map.graphicsLayerIds[j]).name === "example_kaikki_new") {
                    var ext = dojo.clone(map.getLayer(map.graphicsLayerIds[j]).fullExtent);
                    //expand extent to cover smallContent
                    var offSet = ext.getWidth() / map.width * 330;
                    map.setExtent(ext.update(
                            ext.xmin - offSet,
                            ext.ymin,
                            ext.xmax,
                            ext.ymax,
                            ext.spatialReference
                    ), true);
                }
           }

        }
    },
    "me_other": {
        "onChange": function(val) {
            if(val) {
                dojo.removeClass('otherSpan', 'tyhja');
                dijit.byId('other_text').set('disabled', false);
            }
            else {
                dojo.addClass('otherSpan', 'tyhja');
                dijit.byId('other_text').set('disabled', true);
            }
        }

    },
    "me3_5": {
        "onChange": function(val) {
            if(val) {
                dojo.removeClass('otherHowSpan', 'tyhja');
                dijit.byId('visitOther').set('disabled', false);
            }
            else {
                dojo.addClass('otherHowSpan', 'tyhja');
                dijit.byId('visitOther').set('disabled', true);
            }
        }

    },
    "what_things_eval_8": {
        "onChange": function(val) {
            if(val) {
                dojo.removeClass('otherThingsSpan', 'tyhja');
                dijit.byId('other_things').set('disabled', false);
            }
            else {
                dojo.addClass('otherThingsSpan', 'tyhja');
                dijit.byId('other_things').set('disabled', true);
            }
        }

    },
    "exit": {
        "onClick": function(e) {
            var diag = dijit.byId("infoDialog");
            diag.set({
                "title": "{% trans 'confirm exit' %}",
                "href": "{% url main_html file_name='confirm_exit' %}"
            });
            diag.show();
        }
    },
    "confirm_exit_yes": {
        "onClick": function(e) {
            children_logout("{% url children_logout %}");
            dijit.byId("infoDialog").hide();
        }

    },
    "confirm_exit_no": {
        "onClick": function(e) {
            dijit.byId("infoDialog").hide();
        }
    }
};

questionnaire.feature_defaults = {
    "appearancePlus": {
        "style": "point_positive",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary",
        "header": "{% trans 'Kerro paikan ulkoisesta ilmeestä tarkemmin! Tässä paikassa...' %}"
    },
    "appearanceMinus": {
        "style": "point_negative",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-secondary",
        "header": "{% trans 'Kerro paikan ulkoisesta ilmeestä tarkemmin! Tässä paikassa...' %}"
    },
    "socialPlus": {
        "style": "point_positive",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary",
        "header": "{% trans 'Kerro sosiaalisesta ilmapiiristä tarkemmin! Tässä paikassa...' %}"
    },
    "socialMinus": {
        "style": "point_negative",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-secondary",
        "header": "{% trans 'Kerro sosiaalisesta ilmapiiristä tarkemmin! Tässä paikassa...' %}"
    },
    "atmospherePlus": {
        "style": "point_positive",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary",
        "header": "{% trans 'Kerro paikan tunnelmasta tarkemmin! Tämä paikka on...' %}"
    },
    "atmosphereMinus": {
        "style": "point_negative",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-secondary",
        "header": "{% trans 'Kerro paikan tunnelmasta tarkemmin! Tämä paikka on...' %}"
    },
    "functionalPlus": {
        "style": "point_positive",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-primary",
        "header": "{% trans 'Kerro paikan toimintamahdollisuuksista tarkemmin! Tässä paikassa...' %}"
    },
    "functionalMinus": {
        "style": "point_negative",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-secondary",
        "header": "{% trans 'Kerro paikan toimintamahdollisuuksista tarkemmin! Tässä paikassa...' %}"
    },
    "pearl_p": {
        "max": 1,
        "style": "point_lightorange"
    },
    "home": {
        "max": 1,
        "style": "point_green",
/*        "classes": "ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-secondary",
        "icons": {"secondary": "green-icon"},*/
        "header": "{% trans 'Koti' %}"
    },
    "work": {
        "style": "point_cyan",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "cyan-icon"},
        "header": "{% trans 'Työ, opiskelu, päivähoito' %}"
    },
    "shop": {
        "style": "point_cyan",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "cyan-icon"},
        "header": "{% trans 'Ostospaikka' %}"
    },
    "business": {
        "style": "point_cyan",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "cyan-icon"},
        "header": "{% trans 'Asiointipaikka' %}"
    },
    "exercise": {
        "style": "point_cyan",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "cyan-icon"},
        "header": "{% trans 'Liikunta ja ulkoilu' %}"
    },
    "freetime": {
        "style": "point_cyan",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "cyan-icon"},
        "header": "{% trans 'Vapaa-aika' %}"
    },
    "otherplace": {
        "style": "point_cyan",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "cyan-icon"},
        "header": "{% trans 'Muu paikka' %}"
    },
    "importantroute": {
        "style": "route_purple",
        "header": "{% trans 'Tärkeä kävely- tai pyöräreitti' %}"
    },
    "improve_point_area": {
        "max": 3,
        "style": "point_lightgreen",
        "tellmore": "{% trans 'Miten tätä paikkaa pitäisi kohentaa?' %}",
        "header": "{% trans 'Kohentamisehdotuksesi' %}"
    },
    "remove_object": {
        "max": 3,
        "style": "point_red",
        "tellmore": "{% trans 'Mitä poistaisit tästä paikasta?' %}",
        "header": "{% trans 'Poistamisehdotuksesi' %}"
    },
    "new_building": {
        "max": 3,
        "style": "point_purple",
        "tellmore": "{% trans 'Mitä uutta tähän mielestäsi pitäisi rakentaa?' %}",
        "header": "{% trans 'Rakentamisehdotuksesi' %}"
    },
    "new_improve_route": {
        "max": 3,
        "style": "route_blue",
        "tellmore": "{% trans 'Millaista reittiä toivot tähän paikkaan?' %}",
        "header": "{% trans 'Reittiehdotuksesi' %}"
    },
    "new_transport_route_mob": {
        "max": 3,
        "style": "route_green",
        "tellmore": "{% trans 'Millaista joukkoliikennelinjaa toivoisit tänne?' %}",
        "header": "{% trans 'Ehdotuksesi uudeksi joukkoliikenneyhteydeksi' %}"
    },
    "ser_build": {
        "style": "point_blue",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "blue-icon"},
        "header": "{% trans 'Palvelurakennus' %}"
    },
    "new_walking_route": {
        "style": "route_green",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "green_route-icon"},
        "header": "{% trans 'Kävely- tai pyöräilyreitti' %}"
    },
    "new_transport_route": {
        "style": "route_blue",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "blue_route-icon"},
        "header": "{% trans 'Bussireitti' %}"
    },
    "new_recreation_area": {
        "style": "area_yellow",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "yellow_area-icon"},
        "header": "{% trans 'Virkistysalue' %}"
    },
    "preserve_place": {
        "style": "point_cyan",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "cyan-icon"},
        "header": "{% trans 'Säilytettävä paikka' %}"
    },
    "improve_place": {
        "style": "point_yellow",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "yellow-icon"},
        "header": "{% trans 'Kohennettava paikka' %}"
    },
    "otherplace_2": {
        "style": "point_brown",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "brown-icon"},
        "header": "{% trans 'Muu paikka' %}"
    },
    "acti_point": {
        "style": "point_yellow",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "yellow-icon"},
        "header": "{% trans 'Mitä teet kohteessa?' %}"
    },
    "acti_poly": {
        "style": "area_yellow",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "yellow_area-icon"},
        "header": "{% trans 'Mitä teet kohteessa?' %}"
    },
    "no_tourism": {
        "style": "area_blue",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "blue_area-icon"},
        "header": "{% trans 'Ei matkailua' %}"
    },
    "new_hiking_route": {
        "style": "route_orange",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "orange_route-icon"},
        "header": "{% trans 'Uusi retkeily- tai hiihtoreitti' %}"
    },
    "new_snowmobile_route": {
        "style": "route_yellow",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "yellow_route-icon"},
        "header": "{% trans 'Uusi moottorikelkka- tai mönkijäreitti' %}"
    },
    "new_tourist_attraction": {
        "style": "point_cottage",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "cottage-icon"},
        "header": "{% trans 'Uusi matkailurakentaminen' %}"
    },
    "no_forestry": {
        "style": "area_green",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "green_area-icon"},
        "header": "{% trans 'Ei metsätaloutta' %}"
    },
    "no_nature_reserve": {
        "style": "area_red",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "red_area-icon"},
        "header": "{% trans 'Ei suojelua' %}"
    },
    "new_nature_reserve": {
        "style": "area_cyan",
        "classes": "ui-button ui-widget ui-state-default ui-corner-all small ui-button-text-icon-secondary",
        "icons": {"secondary": "cyan_area-icon"},
        "header": "{% trans 'Uusi suojelualue' %}"
    }

};


text:
classdef tArrowCppCall < matlab.unittest.TestCase
    % Tests for arrow.cpp.call.

    % Licensed to the Apache Software Foundation (ASF) under one or more
    % contributor license agreements.  See the NOTICE file distributed with
    % this work for additional information regarding copyright ownership.
    % The ASF licenses this file to you under the Apache License, Version
    % 2.0 (the "License"); you may not use this file except in compliance
    % with the License.  You may obtain a copy of the License at
    %
    %   http://www.apache.org/licenses/LICENSE-2.0
    %
    % Unless required by applicable law or agreed to in writing, software
    % distributed under the License is distributed on an "AS IS" BASIS,
    % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
    % implied.  See the License for the specific language governing
    % permissions and limitations under the License.

    methods(TestClassSetup)
       function addFeatherFunctionsToMATLABPath(testCase)
            import matlab.unittest.fixtures.PathFixture
            % Add Feather test utilities to the MATLAB path.
            testCase.applyFixture(PathFixture('util'));
            % arrow.cpp.call must be on the MATLAB path.
            testCase.assertTrue(~isempty(which('arrow.cpp.call')), ...
                '''arrow.cpp.call'' must be on the MATLAB path. Use ''addpath'' to add folders to the MATLAB path.');
        end
    end

    methods(Test)
        function UnknownCppFunctionError(testCase)
        % Verifies arrow.cpp.call throws an error if an unkown C++ function name
        % is passed to it.
            errID = "MATLAB:arrow:UnknownCppFunction";
            fcn = @()arrow.cpp.call('NotAFunction');
            testCase.verifyError(fcn, errID);
        end

        function TooFewInputArgumentsError(testCase)
        % Verifies arrow.cpp.call throws an error if zero input arguments are
        % passed it.
            errID = "MATLAB:arrow:minrhs";
            fcn = @()arrow.cpp.call;
            testCase.verifyError(fcn, errID);
        end

        function InvalidFunctionNameDataTypeError(testCase)
        % Verifies arrow.cpp.call throws an error if the first input argument is
        % not a character vector.
            errID = "MATLAB:arrow:FunctionNameDataType";
            fcn = @()arrow.cpp.call(1);
            testCase.verifyError(fcn, errID);

            fcn = @()arrow.cpp.call(categorical);
            testCase.verifyError(fcn, errID);

            fcn = @()arrow.cpp.call(datetime(2021, 9, 10));
            testCase.verifyError(fcn, errID);
        end
    end
end

redpajama_set_name: RedPajamaGithub


text:
package reflex.node;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import reflex.IReflexHandler;
import reflex.Scope;
import reflex.debug.IReflexDebugger;
import reflex.value.ReflexValue;

public class MapNode extends BaseNode {
    private List<ReflexNode> keyValPairs;

    public MapNode(int lineNumber, IReflexHandler handler, Scope s, List<ReflexNode> keyValPairs) {
        super(lineNumber, handler, s);
        if (keyValPairs == null) {
            this.keyValPairs = new ArrayList<ReflexNode>();
        } else {
            this.keyValPairs = keyValPairs;
        }
    }

    @Override
    public ReflexValue evaluate(IReflexDebugger debugger, Scope scope) {
        // Convert the mapnode into a Map
        debugger.stepStart(this, scope);
        Map<String, Object> ret = new LinkedHashMap<String, Object>();
        for (ReflexNode n : keyValPairs) {
            if (n instanceof KeyValNode) {
                KeyValNode kvn = (KeyValNode) n;
                ret.put(kvn.getKey(debugger, scope), kvn.getValue(debugger, scope));
            }
        }
        ReflexValue retVal = new ReflexValue(lineNumber, ret);
        debugger.stepEnd(this, retVal, scope);
        return retVal;
    }

}


text:
===========================================

How am I supposed to manage the case when a user asks to perform an
action on multiple rows?

For example imagine a client which retrieves a list of elements using::

  GET http://example.com/foos

then it displays that list to the user in a grid,
the user selects some of those rows and hits a "Delete" button.

Imagine the selected rows have primary keys 123, 124 and 127.
After all I've read about the RESTful API, I imagine that the client
should now issue the following HTTP requests::

  DELETE http://example.com/foos/123
  DELETE http://example.com/foos/124
  DELETE http://example.com/foos/127

But I would like the user to receive a confirmation
"Are you sure you want to delete these 3 rows..?",
and I'd like to construct this question dynamically *on the server*.
Is that possible while remaining RESTful?

Maybe something like::

  GET http://example.com/foos/?action=delete,selected=[123,124,127]

which would **not** delete anything, it would just return the text of
the confirmation question to ask.


text:
package org.fatal.activesql.database.validator;

import org.fatal.activesql.database.core.Model;

/**
 *
 * Logic of validations:
 *
 * When a user calls addValidation() a Validator instance will be created.
 * A Validation object is created too, and receives the validator object
 * The Validator object is added in an arraylist in the model
 * Validation object is returned.
 *
 * The Validation is the place to call the validation methods needed
 * When calling a validation method a ValidationTemplate
 * (normally a ValidationObject, that extends ValidationTemplate)  is created
 * and stored in the validator variable.
 * This object, extending ValidationTemplate is what will make the validation itself
 * ValidationTemplate implements ValidationInplementation. So every classes extending it
 * will need to have the validate(Model m) and getMessage() methods.
 * ValidationsTemplates are stored by property.
 * So a validator contains only the validations for a specific property
 *
 * When the method validate() in Model is called
 * we go through the Validator arraylist, and for each Validator
 * we get all the validations (ValidationTemplate extended class)
 * and for each validation we call the validate method
 * if the validate method returns false the error message is added in the error map in the model
 *
 * When creating a custom Validation, user should extends ValidationTemplate
 *
 * All this is kinda complex, but works really well :p
 *
 */
public class ValidationObject extends ValidationTemplate
{
    public enum OPTION {PRESENT, MIN_LENGTH, MAX_LENGTH, STRING, NUMBER, DATE};

    private OPTION option;
    private Object validationValue;
    private String message;

    public ValidationObject(String fieldname, OPTION option, Object validationValue, String error)
    {
        this.option = option;
        this.validationValue = validationValue;
        this.message = error;
        this.fieldname = fieldname;
    }

    public OPTION getOption()
    {
        return option;
    }

    public void setOption(OPTION option)
    {
        this.option = option;
    }

    public Object getValue()
    {
        return validationValue;
    }

    public void setValue(Object value)
    {
        this.validationValue = value;
    }

    @Override
    public String getMessage()
    {
        return message;
    }

    public void setMessage(String message)
    {
        this.message = message;
    }

    @Override
    public boolean validate(Model model)
    {
        boolean valid;
        Object value = model.get(fieldname);

        switch (option)
        {
            case PRESENT:
                valid = value != null;
                break;
            case MIN_LENGTH:
                valid = ((String)value).length() > (int)validationValue;
                break;
            case MAX_LENGTH:
                valid = ((String)value).length() < (int)validationValue;
                break;
            case STRING:
                valid = value instanceof String;
                break;
            default:
                valid = true;
        }

        return valid;
    }

}


text:
package com.planet_ink.coffee_mud.Abilities.Druid;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

@SuppressWarnings("unchecked")
public class Chant_SummonHerb extends Chant
{
	public String ID() { return "Chant_SummonHerb"; }
	public String name(){ return "Summon Herbs";}
    public int abstractQuality(){return Ability.QUALITY_INDIFFERENT;}
	protected int canAffectCode(){return 0;}
	protected int canTargetCode(){return 0;}
	public int classificationCode(){return Ability.ACODE_CHANT|Ability.DOMAIN_PLANTGROWTH;}

	public boolean invoke(MOB mob, Vector commands, Environmental givenTarget, boolean auto, int asLevel)
	{

		if(((mob.location().domainType()&Room.INDOORS)>0)&&(!auto))
		{
			mob.tell("You must be outdoors to try this.");
			return false;
		}
		if((mob.location().domainType()==Room.DOMAIN_OUTDOORS_CITY)
		   ||(mob.location().domainType()==Room.DOMAIN_OUTDOORS_SPACEPORT)
		   ||(mob.location().domainType()==Room.DOMAIN_OUTDOORS_UNDERWATER)
		   ||(mob.location().domainType()==Room.DOMAIN_OUTDOORS_AIR)
		   ||(mob.location().domainType()==Room.DOMAIN_OUTDOORS_WATERSURFACE))
		{
			mob.tell("This magic will not work here.");
			return false;
		}

		if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
			return false;

		// now see if it worked
		boolean success=proficiencyCheck(mob,0,auto);
		if(success)
		{
			CMMsg msg=CMClass.getMsg(mob,null,this,verbalCastCode(mob,null,auto),auto?"":"^S<S-NAME> chant(s) to the ground.^?");
			if(mob.location().okMessage(mob,msg))
			{
				mob.location().send(mob,msg);
				for(int i=0;i<((adjustedLevel(mob,asLevel)/4)+1);i++)
				{
					Food newItem=(Food)CMClass.getBasicItem("GenFoodResource");
					newItem.setName("some herbs");
					newItem.setDisplayText("Some herbs are growing here.");
					newItem.setDescription("");
					newItem.setMaterial(RawMaterial.RESOURCE_HERBS);
					newItem.setNourishment(1);
					newItem.setMiscText(newItem.text());
					mob.location().addItemRefuse(newItem,CMProps.getIntVar(CMProps.SYSTEMI_EXPIRE_RESOURCE));
				}
				mob.location().showHappens(CMMsg.MSG_OK_ACTION,"Some herbs quickly begin to grow here.");
				mob.location().recoverEnvStats();
			}
		}
		else
			return beneficialWordsFizzle(mob,null,"<S-NAME> chant(s) to the ground, but nothing happens.");

		// return whether it worked
		return success;
	}
}


text:
define((require) => {
    let angular = require('angular');
    let template = require('text!html/common/layout.html');

    angular.module('layout', [])
        .directive('layout', () => {
            return {
                restrict: 'A',
                template
            }
        });
});


text:
package org.kitesdk.data.spi;

import org.apache.avro.Schema;
import org.apache.avro.SchemaBuilder;
import org.apache.avro.generic.GenericData;
import org.apache.avro.generic.GenericRecord;
import org.junit.Assert;
import org.junit.Ignore;
import org.junit.Test;
import org.kitesdk.data.DatasetDescriptor;
import org.kitesdk.data.PartitionStrategy;
import org.kitesdk.data.TestHelpers;

public class TestNestedFieldPartitioning {

  private static final Schema schema = SchemaBuilder.record("Station").fields()
      .requiredString("name")
      .name("position").type().record("Position")
          .namespace("org.kitesdk.data.spi.TestNestedFieldPartitioning$Station$")
          .fields()
              .requiredDouble("latitude")
              .requiredDouble("longitude")
              .endRecord().noDefault()
          .endRecord();

  private static final PartitionStrategy strategy =
      new PartitionStrategy.Builder()
          .identity("position.latitude", "lat")
          .identity("position.longitude", "long")
          .build();

  private static class Station {
    private static class Position {
      private double latitude;
      private double longitude;
    }

    private Position position;
    private String name;

    private Station(String name, double lat, double lon) {
      this.name = name;
      this.position = new Position();
      this.position.latitude = lat;
      this.position.longitude = lon;
    }
  }

  @Test
  public void testDescriptorValidationPasses() {
    DatasetDescriptor descriptor = new DatasetDescriptor.Builder()
        .schema(schema)
        .partitionStrategy(strategy)
        .build();
    Assert.assertEquals("Descriptor should have correct schema",
        schema, descriptor.getSchema());
    Assert.assertEquals("Descriptor should have correct strategy",
        strategy, descriptor.getPartitionStrategy());
  }

  @Test
  public void testDescriptorValidationFails() {
    final PartitionStrategy missingStartField =
        new PartitionStrategy.Builder()
            .identity("p.latitude")
            .identity("p.longitude")
            .build();

    TestHelpers.assertThrows("Should complain that p is missing",
        IllegalStateException.class, new Runnable() {
          @Override
          public void run() {
            new DatasetDescriptor.Builder()
                .schema(schema)
                .partitionStrategy(missingStartField)
                .build();
          }
        });

    final PartitionStrategy missingLongField =
        new PartitionStrategy.Builder()
            .identity("position.latitude")
            .identity("position.long")
            .build();

    TestHelpers.assertThrows("Should complain that position.long is missing",
        IllegalStateException.class, new Runnable() {
          @Override
          public void run() {
            new DatasetDescriptor.Builder()
                .schema(schema)
                .partitionStrategy(missingLongField)
                .build();
          }
        });

    final PartitionStrategy badExpectedType =
        new PartitionStrategy.Builder()
            .identity("position.latitude")
            .year("position.longitude")
            .build();

    TestHelpers.assertThrows("Should complain about mismatched expected type",
        IllegalStateException.class, new Runnable() {
          @Override
          public void run() {
            new DatasetDescriptor.Builder()
                .schema(schema)
                .partitionStrategy(badExpectedType)
                .build();
          }
        });
  }

  @Test
  public void testStorageKeyForGenericEntity() {
    GenericData.Record position = new GenericData.Record(
        schema.getField("position").schema());
    position.put("latitude", 37.776);
    position.put("longitude", -122.418);
    GenericData.Record generic = new GenericData.Record(schema);
    generic.put("name", "KCASANFR291");
    generic.put("position", position);

    StorageKey key = new StorageKey.Builder(strategy)
        .add("position.latitude", 0)
        .add("position.longitude", 0)
        .build();

    StorageKey expected = StorageKey.copy(key);
    expected.replace(0, 37.776);
    expected.replace(1, -122.418);

    key.reuseFor(generic, DataModelUtil.accessor(GenericRecord.class, schema));

    Assert.assertEquals(expected, key);
  }

  @Test
  public void testStorageKeyForReflectedEntity() {
    Station station = new Station("KCASANFR291", 37.776, -122.418);

    StorageKey key = new StorageKey.Builder(strategy)
        .add("position.latitude", 0)
        .add("position.longitude", 0)
        .build();

    StorageKey expected = StorageKey.copy(key);
    expected.replace(0, 37.776);
    expected.replace(1, -122.418);

    key.reuseFor(station, DataModelUtil.accessor(Station.class, schema));

    Assert.assertEquals(expected, key);
  }
}


text:
package com.team2052.frckrawler.fragments;

import android.os.Bundle;
import android.support.v4.app.Fragment;

import com.team2052.frckrawler.activities.HasComponent;
import com.team2052.frckrawler.binding.BaseDataBinder;
import com.team2052.frckrawler.database.RxDBManager;
import com.team2052.frckrawler.di.FragmentComponent;
import com.team2052.frckrawler.subscribers.BaseDataSubscriber;

import javax.inject.Inject;

import rx.Observable;
import rx.schedulers.Schedulers;

/**
 * Created by Acorp on 11/17/2015.
 * T - Type of the Data
 * V - View Type of Data
 * S - Subscriber Type
 * B - Binder Type
 */
public abstract class BaseDataFragment
        <T, V, S extends BaseDataSubscriber<T, V>, B extends BaseDataBinder<V>>
        extends Fragment {
    protected FragmentComponent mComponent;
    protected RxDBManager rxDbManager;
    @Inject
    protected S subscriber;
    @Inject
    protected B binder;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getActivity() instanceof HasComponent) {
            mComponent = ((HasComponent) getActivity()).getComponent();
        }
        inject();
        rxDbManager = mComponent.dbManager();
        subscriber.setConsumer(binder);
        binder.setActivity(getActivity());
    }

    @Override
    public void onResume() {
        super.onResume();
        getObservable().subscribeOn(Schedulers.io())
                .observeOn(Schedulers.computation())
                .subscribe(subscriber);
    }

    public abstract void inject();

    protected abstract Observable<? extends T> getObservable();
}


text: 基础的mvc框架,struts 2 + spring + ibatis +jquery easyui


text:
package com.dubture.composer.ui.dialogs;

import java.net.URL;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.WorkbenchMessages;

import com.dubture.composer.core.util.StringUtil;

@SuppressWarnings("restriction")
public class ComposerJobFailureDialog extends ErrorDialog {

	public ComposerJobFailureDialog(String message, IStatus status) {
		super(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Composer problem", message, status,
				IStatus.ERROR | IStatus.OK);
	}

	@Override
	protected Control createDialogArea(Composite parent) {
		Composite main = (Composite) super.createDialogArea(parent);

			Composite space = new Composite(main, SWT.NONE);
			GridData gridData = new GridData(SWT.FILL, SWT.FILL, false, false);
			gridData.heightHint = 1;
			gridData.widthHint = 1;
			space.setLayoutData(gridData);

			Link link = createShowErrorLogLink(main);
			link.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

		return main;
	}

	protected Control createMessageArea(Composite composite) {
		// create composite
		// create image
		Image image = getImage();
		if (image != null) {
			imageLabel = new Label(composite, SWT.NULL);
			image.setBackground(imageLabel.getBackground());
			imageLabel.setImage(image);
			GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING)
					.applyTo(imageLabel);
		}
		// create message
		if (message != null) {
			messageLabel = new Label(composite, getMessageLabelStyle());
			messageLabel.setText("Composer exited with an error");
			GridDataFactory
					.fillDefaults()
					.align(SWT.FILL, SWT.BEGINNING)
					.grab(true, false)
					.hint(
							convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH),
							SWT.DEFAULT).applyTo(messageLabel);
		}
		return composite;
	}

	private Link createShowErrorLogLink(Composite parent) {
		Link link = new Link(parent, SWT.NONE);
		link.addSelectionListener(new SelectionAdapter(){
			@Override
			public void widgetSelected(SelectionEvent e) {
				try {
					PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(e.text));
				} catch (Exception ce) {
					ce.printStackTrace();
				}
			}
		});
		link.setText(StringUtil.replaceLinksInComposerMessage(message));
		link.setToolTipText(WorkbenchMessages.ErrorLogUtil_ShowErrorLogTooltip);
		Dialog.applyDialogFont(link);
		return link;
	}
}


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;

namespace Beacon.Lib
{
    /// <summary>
    /// Instances of this class can be autodiscovered on the local network through UDP broadcasts
    /// </summary>
    /// <remarks>
    /// The advertisement consists of the beacon's application type and a short beacon-specific string.
    /// </remarks>
    public class Beacon : IDisposable {

        internal const int DiscoveryPort = 35891;
        private readonly UdpClient udp;
        private Core.BeaconConfig _config;

        /// <summary>
        ///
        /// </summary>
        public bool Stopped { get; private set; }

        public Beacon(Core.BeaconConfig config) { //string beaconType, ushort advertisedPort)
            this._config = config;
          /* OLD STUFF REMOVE LATER
           * ==========================
             BeaconType     = beaconType;
             AdvertisedPort = advertisedPort;
             BeaconData     = "";
           */

            udp = new UdpClient();
            udp.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
            udp.Client.Bind(new IPEndPoint(IPAddress.Any, DiscoveryPort));

            try {
                //udp.AllowNatTraversal(true);

                //Hopefully the below works ok and AllowNatTraversal does nothing more.
                //https://msdn.microsoft.com/en-us/library/system.net.sockets.udpclient.allownattraversal(v=vs.110).aspx
                udp.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.IPProtectionLevel, IPProtectionLevel.Unrestricted);
            } catch (SocketException ex) {
                Debug.WriteLine("Error switching on NAT traversal: " + ex.Message);
            }
            catch (Exception e)
            {
                Debug.WriteLine("Error switching on NAT traversal: " + e.Message);
            }
        }

        public void Start()
        {
            Stopped = false;
            //udp.BeginReceive(ProbeReceived, null);
            Listen();
        }

        private async void Listen()
        {
            var result = await udp.ReceiveAsync();
            ProbeReceived(result);
        }

        public void Stop()
        {
            Stopped = true;
        }

        private void ProbeReceived(UdpReceiveResult ar) { //IAsyncResult ar)
            var remote = ar.RemoteEndPoint; //new IPEndPoint(IPAddress.Any, 0);
            var bytes = ar.Buffer;

            // Compare beacon type to probe type
            var typeBytes = new DatagramPacket(this._config.BeaconType).Encode();
            if (HasPrefix(bytes, typeBytes))
            {
                // If true, respond again with our type, port and payload
                var responseData = new DatagramPacket(this._config.BeaconType).Encode() //Encode(BeaconType)
                    .Concat(BitConverter.GetBytes((ushort)IPAddress.HostToNetworkOrder((short)this._config.AdvertisedPort)))
                    .Concat(new DatagramPacket(this._config.BeaconData).Encode()).ToArray();
                //udp.Send(responseData, responseData.Length, remote);
                var data = new DatagramPacket(responseData).Decode();
                udp.SendAsync(responseData, responseData.Length, remote);
            }

            if (!Stopped) Listen();// udp.BeginReceive(ProbeReceived, null);
        }

        internal static bool HasPrefix<T>(IEnumerable<T> haystack, IEnumerable<T> prefix)
        {
            return haystack.Count() >= prefix.Count() &&
                haystack.Zip(prefix, (a, b) => a.Equals(b)).All(_ => _);
        }

        public void Dispose()
        {
            Stop();
        }
    }
}


text:
<?php

namespace Symfony\Component\Routing\Loader;

use Doctrine\Common\Annotations\Reader;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Config\Loader\LoaderResolverInterface;
use Symfony\Component\Config\Resource\FileResource;
use Symfony\Component\Routing\Annotation\Route as RouteAnnotation;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;

/**
 * AnnotationClassLoader loads routing information from a PHP class and its methods.
 *
 * You need to define an implementation for the getRouteDefaults() method. Most of the
 * time, this method should define some PHP callable to be called for the route
 * (a controller in MVC speak).
 *
 * The @Route annotation can be set on the class (for global parameters),
 * and on each method.
 *
 * The @Route annotation main value is the route path. The annotation also
 * recognizes several parameters: requirements, options, defaults, schemes,
 * methods, host, and name. The name parameter is mandatory.
 * Here is an example of how you should be able to use it:
 *     /**
 *      * @Route("/Blog")
 *      * /
 *     class Blog
 *     {
 *         /**
 *          * @Route("/", name="blog_index")
 *          * /
 *         public function index()
 *         {
 *         }
 *         /**
 *          * @Route("/{id}", name="blog_post", requirements = {"id" = "\d+"})
 *          * /
 *         public function show()
 *         {
 *         }
 *     }
 *
 * @author Fabien Potencier <fabien@symfony.com>
 */
abstract class AnnotationClassLoader implements LoaderInterface
{
    protected $reader;

    /**
     * @var string
     */
    protected $routeAnnotationClass = 'Symfony\\Component\\Routing\\Annotation\\Route';

    /**
     * @var int
     */
    protected $defaultRouteIndex = 0;

    public function __construct(Reader $reader)
    {
        $this->reader = $reader;
    }

    /**
     * Sets the annotation class to read route properties from.
     *
     * @param string $class A fully-qualified class name
     */
    public function setRouteAnnotationClass($class)
    {
        $this->routeAnnotationClass = $class;
    }

    /**
     * Loads from annotations from a class.
     *
     * @param string      $class A class name
     * @param string|null $type  The resource type
     *
     * @return RouteCollection A RouteCollection instance
     *
     * @throws \InvalidArgumentException When route can't be parsed
     */
    public function load($class, $type = null)
    {
        if (!class_exists($class)) {
            throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
        }

        $class = new \ReflectionClass($class);
        if ($class->isAbstract()) {
            throw new \InvalidArgumentException(sprintf('Annotations from class "%s" cannot be read as it is abstract.', $class->getName()));
        }

        $globals = $this->getGlobals($class);

        $collection = new RouteCollection();
        $collection->addResource(new FileResource($class->getFileName()));

        foreach ($class->getMethods() as $method) {
            $this->defaultRouteIndex = 0;
            foreach ($this->reader->getMethodAnnotations($method) as $annot) {
                if ($annot instanceof $this->routeAnnotationClass) {
                    $this->addRoute($collection, $annot, $globals, $class, $method);
                }
            }
        }

        if (0 === $collection->count() && $class->hasMethod('__invoke')) {
            $globals = $this->resetGlobals();
            foreach ($this->reader->getClassAnnotations($class) as $annot) {
                if ($annot instanceof $this->routeAnnotationClass) {
                    $this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke'));
                }
            }
        }

        return $collection;
    }

    /**
     * @param RouteAnnotation $annot   or an object that exposes a similar interface
     * @param array           $globals
     */
    protected function addRoute(RouteCollection $collection, $annot, $globals, \ReflectionClass $class, \ReflectionMethod $method)
    {
        $name = $annot->getName();
        if (null === $name) {
            $name = $this->getDefaultRouteName($class, $method);
        }
        $name = $globals['name'].$name;

        $requirements = $annot->getRequirements();

        foreach ($requirements as $placeholder => $requirement) {
            if (\is_int($placeholder)) {
                @trigger_error(sprintf('A placeholder name must be a string (%d given). Did you forget to specify the placeholder key for the requirement "%s" of route "%s" in "%s::%s()"?', $placeholder, $requirement, $name, $class->getName(), $method->getName()), E_USER_DEPRECATED);
            }
        }

        $defaults = array_replace($globals['defaults'], $annot->getDefaults());
        $requirements = array_replace($globals['requirements'], $requirements);
        $options = array_replace($globals['options'], $annot->getOptions());
        $schemes = array_merge($globals['schemes'], $annot->getSchemes());
        $methods = array_merge($globals['methods'], $annot->getMethods());

        $host = $annot->getHost();
        if (null === $host) {
            $host = $globals['host'];
        }

        $condition = $annot->getCondition();
        if (null === $condition) {
            $condition = $globals['condition'];
        }

        $path = $annot->getLocalizedPaths() ?: $annot->getPath();
        $prefix = $globals['localized_paths'] ?: $globals['path'];
        $paths = [];

        if (\is_array($path)) {
            if (!\is_array($prefix)) {
                foreach ($path as $locale => $localePath) {
                    $paths[$locale] = $prefix.$localePath;
                }
            } elseif ($missing = array_diff_key($prefix, $path)) {
                throw new \LogicException(sprintf('Route to "%s" is missing paths for locale(s) "%s".', $class->name.'::'.$method->name, implode('", "', array_keys($missing))));
            } else {
                foreach ($path as $locale => $localePath) {
                    if (!isset($prefix[$locale])) {
                        throw new \LogicException(sprintf('Route to "%s" with locale "%s" is missing a corresponding prefix in class "%s".', $method->name, $locale, $class->name));
                    }

                    $paths[$locale] = $prefix[$locale].$localePath;
                }
            }
        } elseif (\is_array($prefix)) {
            foreach ($prefix as $locale => $localePrefix) {
                $paths[$locale] = $localePrefix.$path;
            }
        } else {
            $paths[] = $prefix.$path;
        }

        foreach ($method->getParameters() as $param) {
            if (isset($defaults[$param->name]) || !$param->isDefaultValueAvailable()) {
                continue;
            }
            foreach ($paths as $locale => $path) {
                if (preg_match(sprintf('/\{%s(?:<.*?>)?\}/', preg_quote($param->name)), $path)) {
                    $defaults[$param->name] = $param->getDefaultValue();
                    break;
                }
            }
        }

        foreach ($paths as $locale => $path) {
            $route = $this->createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
            $this->configureRoute($route, $class, $method, $annot);
            if (0 !== $locale) {
                $route->setDefault('_locale', $locale);
                $route->setDefault('_canonical_route', $name);
                $collection->add($name.'.'.$locale, $route);
            } else {
                $collection->add($name, $route);
            }
        }
    }

    /**
     * {@inheritdoc}
     */
    public function supports($resource, $type = null)
    {
        return \is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type);
    }

    /**
     * {@inheritdoc}
     */
    public function setResolver(LoaderResolverInterface $resolver)
    {
    }

    /**
     * {@inheritdoc}
     */
    public function getResolver()
    {
    }

    /**
     * Gets the default route name for a class method.
     *
     * @return string
     */
    protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMethod $method)
    {
        $name = str_replace('\\', '_', $class->name).'_'.$method->name;
        $name = \function_exists('mb_strtolower') && preg_match('//u', $name) ? mb_strtolower($name, 'UTF-8') : strtolower($name);
        if ($this->defaultRouteIndex > 0) {
            $name .= '_'.$this->defaultRouteIndex;
        }
        ++$this->defaultRouteIndex;

        return $name;
    }

    protected function getGlobals(\ReflectionClass $class)
    {
        $globals = $this->resetGlobals();

        if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) {
            if (null !== $annot->getName()) {
                $globals['name'] = $annot->getName();
            }

            if (null !== $annot->getPath()) {
                $globals['path'] = $annot->getPath();
            }

            $globals['localized_paths'] = $annot->getLocalizedPaths();

            if (null !== $annot->getRequirements()) {
                $globals['requirements'] = $annot->getRequirements();
            }

            if (null !== $annot->getOptions()) {
                $globals['options'] = $annot->getOptions();
            }

            if (null !== $annot->getDefaults()) {
                $globals['defaults'] = $annot->getDefaults();
            }

            if (null !== $annot->getSchemes()) {
                $globals['schemes'] = $annot->getSchemes();
            }

            if (null !== $annot->getMethods()) {
                $globals['methods'] = $annot->getMethods();
            }

            if (null !== $annot->getHost()) {
                $globals['host'] = $annot->getHost();
            }

            if (null !== $annot->getCondition()) {
                $globals['condition'] = $annot->getCondition();
            }

            foreach ($globals['requirements'] as $placeholder => $requirement) {
                if (\is_int($placeholder)) {
                    @trigger_error(sprintf('A placeholder name must be a string (%d given). Did you forget to specify the placeholder key for the requirement "%s" in "%s"?', $placeholder, $requirement, $class->getName()), E_USER_DEPRECATED);
                }
            }
        }

        return $globals;
    }

    private function resetGlobals()
    {
        return [
            'path' => null,
            'localized_paths' => [],
            'requirements' => [],
            'options' => [],
            'defaults' => [],
            'schemes' => [],
            'methods' => [],
            'host' => '',
            'condition' => '',
            'name' => '',
        ];
    }

    protected function createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition)
    {
        return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition);
    }

    abstract protected function configureRoute(Route $route, \ReflectionClass $class, \ReflectionMethod $method, $annot);
}