answer
stringlengths
15
1.25M
jsonp({"cep":"74490190","logradouro":"Estrada S\u00e3o de Paulo","bairro":"Parque Bom Jesus","cidade":"Goi\u00e2nia","uf":"GO","estado":"Goi\u00e1s"});
jsonp({"cep":"73751271","logradouro":"Quadra 14 MR 1","bairro":"Setor Norte","cidade":"Planaltina de Goi\u00e1s","uf":"GO","estado":"Goi\u00e1s"});
jsonp({"cep":"64009295","logradouro":"Rua Miguel Furtado Bacellar","bairro":"Memorare","cidade":"Teresina","uf":"PI","estado":"Piau\u00ed"});
jsonp({"cep":"74863070","logradouro":"Rua Cruzeiro do Sul","bairro":"Jardim Bela Vista","cidade":"Goi\u00e2nia","uf":"GO","estado":"Goi\u00e1s"});
jsonp({"cep":"29706320","logradouro":"Rua Jos\u00e9 de Anchieta","bairro":"Vila Am\u00e9lia","cidade":"Colatina","uf":"ES","estado":"Esp\u00edrito Santo"});
jsonp({"cep":"06320170","logradouro":"Rua Pedro Lobas","bairro":"Jardim das Belezas","cidade":"Carapicu\u00edba","uf":"SP","estado":"S\u00e3o Paulo"});
jsonp({"cep":"57601322","logradouro":"Rua Tabeli\u00e3o Luiz Vieira de Barros","bairro":"S\u00e3o Crist\u00f3v\u00e3o","cidade":"Palmeira dos \u00cdndios","uf":"AL","estado":"Alagoas"});
jsonp({"cep":"73805345","logradouro":"Rua Virg\u00edlio Alves Ferreira","bairro":"Setor Pampulha","cidade":"Formosa","uf":"GO","estado":"Goi\u00e1s"});
jsonp({"cep":"14178057","logradouro":"Rua Hugo Gaiofatto","bairro":"Jardim Campo Belo","cidade":"Sert\u00e3ozinho","uf":"SP","estado":"S\u00e3o Paulo"});
jsonp({"cep":"13256566","logradouro":"Rua Angelo Capeletto","bairro":"Loteamento Residencial Terra Nova","cidade":"Itatiba","uf":"SP","estado":"S\u00e3o Paulo"});
* {margin:0;padding:0;} html {height:100%;overflow-y:scroll;font-family:Verdana,Georgia,Serif;} body {height:100%;font-size:12px;line-height:22px; display:flex;flex-direction: column; color:#1b1e1d;background-color:#fbfbfb;} .container {margin: 0 auto;flex: 1 0 auto;} .wrap {max-width:800px;margin: 0 auto;padding:0 40px} .rftd {display: flex;align-items: center;justify-content: center} .footer {margin: 0 auto;flex-shrink: 0;} #mainmenu{padding:48px 0} h1, h2, h3 {font-family:'Vollkorn',Verdana,Georgia,serif;font-weight:normal;} h1 {font-size:48px;line-height:46px;padding: 0 32px 0 0;color:#e10009;} h2 {font-size:28px;line-height:26px;color:#e10009;} h3 {font-size:16px;line-height:22px;} h1, h1 a, h2, h2 a {font-weight:normal;letter-spacing:-0.04em} span {padding:0 3em} hr {clear:both;border:none} a{outline:none;text-decoration:underline;color:#33342f} a img{outline:none} a:hover{color:#1b1e1d;text-decoration:none} a:visited{text-decoration:none} img {-webkit-user-select:none;-moz-user-select: none;user-select: none;} img.fleft{float:left;margin:9px 32px 0 0} img.fright{float:right;margin:9px 0 0 64px} .chapter {padding: 3em 0} .logo {float:left;padding-right: 6em} .bigspacer{height:66px} p {padding: 1em 0 0} table {border: 1px solid #777;border-collapse: collapse;clear:both;float:left;margin:1rem 0;width:98%;} table td {-moz-hyphens: auto;word-break: break-all;word-wrap: break-word;border: 1px solid #d7d7d7;padding:1rem;vertical-align: baseline;} ::selection{background:#33342f;color:#fbfbfb} ::-moz-selection{background:#33342f;color:#fbfbfb} ::-webkit-selection{background:#33342f;color:#fbfbfb}
/*!CK:906623253!*//*1432615303,*/ ._9jo a.navSubmenu,._9jo li.navSubmenu{color:#141823;display:block;max-width:200px;padding:0 22px;text-decoration:none}._9jo .uiLinkButton input{color:#141823;display:block;line-height:22px;padding:0 22px;text-decoration:none}._9jo ._54ne .uiLinkButton input,._9jo ._54ne a.navSubmenu,._9jo li.navSubmenu._54ne a,._9jo li._54ne{background-color:#42599e;color:#fff;text-decoration:none}._9jo .uiSideNavCount{margin-top:3px}._9jo li.navSubmenu a{color:#141823;display:block;text-decoration:none}#logoutMenu ._khf{right:-6px} #profile_minifeed .reportHide{display:none} #bootloader_1KeRQ { height: 42px; } .bootloader_1KeRQ { display:block !important; }
jsonp({"cep":"02254030","logradouro":"Pra\u00e7a Ataliba da Costa Vida","bairro":"Vila Nivi","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
jsonp({"cep":"74391150","logradouro":"Rua Desembargador Em\u00edlio Fleury de Brito","bairro":"Jardim Marques de Abreu","cidade":"Goi\u00e2nia","uf":"GO","estado":"Goi\u00e1s"});
buildcompileGradleGradle->`--<API key>` bash gradle build --<API key> Gradle`<API key>(int, java.util.concurrent.TimeUnit)` ,`<API key>(int, java.util.concurrent.TimeUnit) ` groovy configurations.all { resolutionStrategy.<API key> 24, 'hours' //resolutionStrategy.<API key> 10, 'minutes' resolutionStrategy.<API key> 10*60, 'seconds' } dependencies { // changing: true compile group: "group", name: "module", version: "1.1-SNAPSHOT", changing: true //compile('group:module:1.1-SNAPSHOT') { changing = true } } GradleUSER_HOME/.gradle/caches - GRADLE_USER_HOME - org.gradle.user.home - -g --gradle-user-home Gradle`--offline` bash gradle build --offline
<!DOCTYPE html> <html lang="en"> <meta charset="utf-8"> <title>-wei</title> <link type="text/css" rel="stylesheet" href="../../style.css"> <h1 lang="art-Latn-x-osv-0010"> -wei </h1> <dl> <dt>Etymology: <dd>From VIV <i lang="art-Latn-x-osv-0009">*-auei</i> <small>«do»</small>. </dl> <h2>affix</h2> <aside>positive: <i lang="art-Latn-x-osv-0010">-wai</i></aside> <p> perfective aspect
jsonp({"cep":"12214425","logradouro":"Rua Quatro","bairro":"Condom\u00ednio Villagio Fazend\u00e3o","cidade":"S\u00e3o Jos\u00e9 dos Campos","uf":"SP","estado":"S\u00e3o Paulo"});
jsonp({"cep":"02721200","logradouro":"Avenida Deputado Em\u00edlio Carlos","bairro":"Lim\u00e3o","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
jsonp({"cep":"08140438","logradouro":"Travessa Jonatas Batista","bairro":"Jardim Benfica","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
jsonp({"cep":"25250439","logradouro":"Travessa Jos\u00e9 Zito Santana","bairro":"Mantiquira","cidade":"Duque de Caxias","uf":"RJ","estado":"Rio de Janeiro"});
// Global Vars to set var musicas = new Array(11); musicas[0] = 0; // Wheel A musicas[1] = 0; // Whell B musicas[2] = "0;"; musicas[3] = "0;"; musicas[4] = "0;"; musicas[5] = "0;"; musicas[6] = "0;"; musicas[7] = "0;"; musicas[8] = "0;"; musicas[9] = "0;"; musicas[10] = 0; // Sings function ativa_facebook(){ alert('Aguarde...'); FB.api('/me', function(response) { // console.log(response); // NORMAL ACTION $.post('getUser.php', { facebookId: response.id}, function(data){ if(data.success){ //INSERE APENAS BATIDA $.post('salva_som.php?opc=1', { m1: musicas[0], m2: musicas[1], m3: musicas[2]+musicas[3]+musicas[4]+musicas[5]+musicas[6]+musicas[7]+musicas[8]+musicas[9], m4: musicas[10], usuario: data.usuario }, function(data){ if(data.success){ var image = Math.floor((Math.random()*3)+1); FB.api('/me/feed', 'post', { message: 'Sinta o sabor da minha batida no FLAVOR DJ: o gerador de som exclusivo do BH DANCE FESTIVAL. BH Dance Festival. A CIDADE NA PISTA.', link: 'https: if (!response || response.error) { alert('Error occured'); } else { alert('Sua batida foi compartilhada com sucesso!'); } }); } }, 'json'); }else{ //INSERE BATIDA E USUARIO $.post('salva_som.php?opc=2', { m1: musicas[0], m2: musicas[1], m3: musicas[2]+musicas[3]+musicas[4]+musicas[5]+musicas[6]+musicas[7]+musicas[8]+musicas[9], m4: musicas[10], facebookId: response.id, nome: response.name, email: response.email, sexo: response.gender, cidade: '' }, function(data){ if(data.success){ var image = Math.floor((Math.random()*3)+1); FB.api('/me/feed', 'post', { message: 'Sinta o sabor da minha batida no FLAVOR DJ: o gerador de som exclusivo do BH DANCE FESTIVAL. BH Dance Festival. A CIDADE NA PISTA.', link: 'https: if (!response || response.error) { alert('Error occured'); } else { alert('Sua batida foi compartilhada com sucesso!'); } }); } }, 'json'); } }, 'json'); }); } function computa_voto(batida){ FB.api('/me', function(response) { //console.log(response); // NORMAL ACTION $.post('getVoto.php', { facebookId: response.id}, function(data){ if(data.success){ alert('Você já votou em uma batida, obrigado por participar!'); }else{ //INSERE NO BD $.post('computa_voto.php', { facebookId: response.id, batida: batida }, function(data){ if(data.success){ } }, 'json'); } }, 'json'); }); } function login() { alert('Você ainda não tem o aplicativo do Flavor DJ. Instale-o primeiro para compartilhar sua batida.'); FB.login(function(response) { if (response.authResponse) { ativa_facebook(); } else { } }, {scope: 'email, publish_stream'}); } function desativaetp1(){ $('.audio1').jPlayer("stop"); $('.audio2').jPlayer("stop"); $('.audio3').jPlayer("stop"); $('.audio4').jPlayer("stop"); musicas[0] = "0;"; $('.etapa1, .guide .etapa1 div, .etapa1 li').removeClass('ativo'); $('.etapa1').css('z-index', 2); } function desativaetp2(){ $('.audio5').jPlayer("stop"); $('.audio6').jPlayer("stop"); $('.audio7').jPlayer("stop"); $('.audio8').jPlayer("stop"); musicas[1] = "0;"; $('.etapa2, .guide .etapa2 div, .etapa2 li').removeClass('ativo'); $('.etapa2').css('z-index', 2); } function desativaetpr(idPlayer, cod){ musicas[cod] = "0;"; $('.audio'+idPlayer).jPlayer("stop"); $('.etapa3').css('z-index', 2); } function desativaetp5(){ $('.audio17').jPlayer("stop"); $('.audio18').jPlayer("stop"); $('.audio19').jPlayer("stop"); $('.audio20').jPlayer("stop"); musicas[10] = "0;"; $('.etapa5, .guide .etapa5 div, .etapa5 li').removeClass('ativo'); $('.etapa5').css('z-index', 2); } function ativa_anima(){ $('.whel1 div.a').delay(300).animate({ height: '0px' }, 1000); $('.whel1 div.b').delay(300).animate({ height: '0px' }, 1000, function(){ $('.whel2 div.a').delay(300).animate({ width: '0px' }, 1000); $('.whel2 div.b').delay(300).animate({ width: '0px' }, 1000); }); } $(document).ready(function(){ //login_start(); $('.etapa1').click(function(){ if($(this).hasClass('ativo')){ desativaetp1(); }else{ desativaetp1(); $(this).addClass('ativo'); $(this).css('z-index', 1); var audioPlayer = $(this).attr('href'); musicas[0] = audioPlayer; $('.guide .etapa1 div.p'+audioPlayer).addClass('ativo'); $('.visor .etapa1 li.p'+audioPlayer).addClass('ativo'); $(".audio"+audioPlayer).jPlayer("play", 0); } return false; }) $('.etapa2').click(function(){ if($(this).hasClass('ativo')){ desativaetp2(); }else{ desativaetp2(); $(this).addClass('ativo'); $(this).css('z-index', 1); var audioPlayer = $(this).attr('href'); musicas[1] = audioPlayer; $('.guide .etapa2 div.p'+audioPlayer).addClass('ativo'); $('.visor .etapa2 li.p'+audioPlayer).addClass('ativo'); $(".audio"+audioPlayer).jPlayer("play", 0); } return false; }) $('.etapa3').click(function(){ var audioPlayer = $(this).attr('href'); var codigo = $(this).data('codigo'); if($(this).hasClass('ativo')){ desativaetpr(audioPlayer,codigo); $('.guide .etapa3 div.p'+audioPlayer).removeClass('ativo'); $('.visor .etapa3 li.p'+audioPlayer).removeClass('ativo'); $(this).removeClass('ativo'); }else{ $(this).addClass('ativo'); $('.guide .etapa3 div.p'+audioPlayer).addClass('ativo'); $('.visor .etapa3 li.p'+audioPlayer).addClass('ativo'); $(this).css('z-index', 1); musicas[codigo] = audioPlayer+";"; $(".audio"+audioPlayer).jPlayer("play", 0); } return false; }) $('.etapa4').click(function(){ var audioPlayer = $(this).attr('href'); var cod = $(this).data('codigo'); if($(this).hasClass('ativo')){ desativaetpr(audioPlayer, cod); $('.guide .etapa4 div.p'+audioPlayer).removeClass('ativo'); $('.visor .etapa4 li.p'+audioPlayer).removeClass('ativo'); $(this).removeClass('ativo'); }else{ $(this).addClass('ativo'); $('.guide .etapa4 div.p'+audioPlayer).addClass('ativo'); $('.visor .etapa4 li.p'+audioPlayer).addClass('ativo'); musicas[cod] = audioPlayer+";"; $(".audio"+audioPlayer).jPlayer("play", 0); } return false; }) $('.etapa5').click(function(){ if($(this).hasClass('ativo')){ desativaetp5(); }else{ desativaetp5(); $(this).addClass('ativo'); var audioPlayer = $(this).attr('href'); musicas[10] = audioPlayer; $('.guide .etapa5 div.p'+audioPlayer).addClass('ativo'); $('.visor .etapa5 li.p'+audioPlayer).addClass('ativo'); $(".audio"+audioPlayer).jPlayer("play", 0); } return false; }) $(".audio1").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio2").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio3").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio4").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio5").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio6").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio7").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio8").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio9").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio10").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio11").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio12").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio13").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio14").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio15").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio16").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio17").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio18").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio19").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $(".audio20").jPlayer({ ready: function (event) { $(this).jPlayer("setMedia", { oga: "https: )}, swfPath: "js", supplied: "oga, mp3", wmode: "window", loop: true, preload: 'auto' }); $('body').queryLoader2( { onLoadComplete: ativa_anima() } ); function login_start() { FB.login(function(response) { if (response.authResponse) { // ativa_facebook(); } else { } }, {scope: 'email, publish_stream'}); } // Share var cont = 0 var i = 0; $('a.share').click(function(){ cont = 0; for(i = 0; i<11; i++){ if((musicas[i] == "0;") || (musicas[i] == 0)){ cont++; } } if(cont == 11){ alert('Você precisa selecionar pelo menos um ingrediente para sua batida.'); }else{ FB.getLoginStatus(function(response) { // console.log(response); if (response.status === 'connected') { // NORMAL ACTION ativa_facebook(); } else if (response.status === 'not_authorized') { login(); window.location.reload(); } else { login(); window.location.reload(); } }); } return false; }); $('.votarBatida').click(function(){ var batida = $(this).attr('href'); FB.getLoginStatus(function(response) { if (response.status === 'connected') { // NORMAL ACTION computa_voto(batida); } else if (response.status === 'not_authorized') { FB.login(function(response) { if (response.authResponse) { // NORMAL ACTION computa_voto(batida); } else { } }, {scope: 'email, publish_stream'}); } else { FB.login(function(response) { if (response.authResponse) { // NORMAL ACTION computa_voto(batida); } else { } }, {scope: 'email, publish_stream'}); } }); }); });
jsonp({"cep":"61610135","logradouro":"Rua Santo Ant\u00f4nio","bairro":"Padre Julio Maria","cidade":"Caucaia","uf":"CE","estado":"Cear\u00e1"});
jsonp({"cep":"24745360","logradouro":"Rua Expedicion\u00e1rio Aprigio Jos\u00e9 Vieira","bairro":"Coelho","cidade":"S\u00e3o Gon\u00e7alo","uf":"RJ","estado":"Rio de Janeiro"});
jsonp({"cep":"87114166","logradouro":"Rua 11","bairro":"Jardim Ouro Verde II","cidade":"Sarandi","uf":"PR","estado":"Paran\u00e1"});
jsonp({"cep":"02846010","logradouro":"Estrada L\u00e1zaro Am\u00e2ncio de Barros","bairro":"Vila Itaberaba","cidade":"S\u00e3o Paulo","uf":"SP","estado":"S\u00e3o Paulo"});
jsonp({"cep":"96506661","logradouro":"Rua Batista Carlos","bairro":"Barcelos","cidade":"Cachoeira do Sul","uf":"RS","estado":"Rio Grande do Sul"});
jsonp({"cep":"35171331","logradouro":"Rua Rio Branco","bairro":"Amaro Lanari","cidade":"Coronel Fabriciano","uf":"MG","estado":"Minas Gerais"});
jsonp({"cep":"25730410","logradouro":"Avenida Country Club","bairro":"Nogueira","cidade":"Petr\u00f3polis","uf":"RJ","estado":"Rio de Janeiro"});
jsonp({"cep":"70377070","logradouro":"Quadra SQS 114 Bloco G","bairro":"Asa Sul","cidade":"Bras\u00edlia","uf":"DF","estado":"Distrito Federal"});
jsonp({"cep":"36070570","logradouro":"Rua Jo\u00e3o Surerus J\u00fanior","bairro":"Lourdes","cidade":"Juiz de Fora","uf":"MG","estado":"Minas Gerais"});
$(document).ready( function () { // Add return on top button $('body').append('<div id="returnOnTop" title="Retour en haut">&nbsp;</div>'); // On button click, let's scroll up to top $('#returnOnTop').click( function() { $('html,body').animate({scrollTop: 0}, 'slow'); }); }); $(window).scroll(function() { // If on top fade the bouton out, else fade it in if ( $(window).scrollTop() == 0 ) $('#returnOnTop').fadeOut(); else $('#returnOnTop').fadeIn(); });
jsonp({"cep":"40060240","logradouro":"Rua do Sodr\u00e9","bairro":"Dois de Julho","cidade":"Salvador","uf":"BA","estado":"Bahia"});
jsonp({"cep":"08671155","logradouro":"Rua Luciano de Godoi","bairro":"Jardim M\u00e1rcia","cidade":"Suzano","uf":"SP","estado":"S\u00e3o Paulo"});
jsonp({"cep":"80820132","logradouro":"Jardinete Aline de Souza Thomaszeck","bairro":"Vista Alegre","cidade":"Curitiba","uf":"PR","estado":"Paran\u00e1"});
jsonp({"cep":"07176635","logradouro":"Rua Jo\u00e3o Garcia e Garcia","bairro":"Jardim \u00c1lamo","cidade":"Guarulhos","uf":"SP","estado":"S\u00e3o Paulo"});
const electron = require('electron') const app = electron.app const BrowserWindow = electron.BrowserWindow const {ipcMain} = require('electron') const {dialog} = require('electron') const {Menu} = require('electron') import {enableLiveReload} from 'electron-compile' const path = require('path') const url = require('url') const fs = require('fs') enableLiveReload() //Window Creation var windowArray = [] exports.windowCount = 0 function createWindow () { // Create the new browser window. windowArray.push( new BrowserWindow({width: 800, height: 600}) ) exports.windowCount = windowArray.length var newWindow = windowArray[exports.windowCount-1] // windowArray[windowCount-1].maximize() // and load the index.html of the app. newWindow.loadURL(url.format({ pathname: path.join(__dirname, 'html/index.html'), protocol: 'file:', slashes: true })) // Emitted when the window is closed. newWindow.on('closed', function () { newWindow = null }) } app.on('ready', createWindow) app.on('window-all-closed', function () { if (process.platform !== 'darwin') { app.quit() } }) // app.on('activate', function () { // // On OS X it's common to re-create a window in the app when the // // dock icon is clicked and there are no other windows open. // createWindow() //Menus var template = [ { label: 'File', submenu: [ {label: 'New Project'}, {label: 'Open Project'}, {label: 'Import File'}, {type: 'separator'}, {label: 'Save'}, {label: 'Save As'}, {label: 'Settings'} ] }, { label: 'Edit', submenu: [ {role: 'undo'}, {role: 'redo'}, {type: 'separator'}, {role: 'cut'}, {role: 'copy'}, {role: 'paste'}, {role: 'delete'}, {role: 'selectall'} ] }, { label: 'Window', submenu: [ {label: 'New Window', click: createWindow}, {role: 'minimize'}, {type: 'separator'}, {role: 'toggledevtools'}, {role: 'close'} ] }, ] var mainMenu = Menu.buildFromTemplate(template) Menu.setApplicationMenu(mainMenu) //File Functions function importFile (event) { dialog.showOpenDialog({properties: ['openFile', 'multiSelections']}, (filePaths) => { console.log(filePaths) event.sender.send('importer', filePaths) }) } //IPC Functions ipcMain.on('window-manager', (event, arg) => { console.log(arg) if (arg == "New Window") { //Create new window createWindow() } }) ipcMain.on('file-manager', (event, arg) => { console.log(arg) if (arg == "Import Files") { importFile(event) } })
from cStringIO import StringIO from struct import pack, unpack, error as StructError from .log import log from .structures import fields class DBFile(object): """ Base class for WDB and DBC files """ @classmethod def open(cls, file, build, structure, environment): if isinstance(file, basestring): file = open(file, "rb") instance = cls(file, build, environment) instance._readHeader() instance.setStructure(structure) instance._rowDynamicFields = 0 # Dynamic fields index, used when parsing a row instance._readAddresses() return instance def __init__(self, file=None, build=None, environment=None): self._addresses = {} self._values = {} self.file = file self.build = build self.environment = environment def __repr__(self): return "%s(file=%r, build=%r)" % (self.__class__.__name__, self.file, self.build) def __contains__(self, id): return id in self._addresses def __getitem__(self, item): if isinstance(item, slice): keys = sorted(self._addresses.keys())[item] return [self[k] for k in keys] if item not in self._values: self._parse_row(item) return self._values[item] def __setitem__(self, item, value): if not isinstance(item, int): raise TypeError("DBFile indices must be integers, not %s" % (type(item))) if isinstance(value, DBRow): self._values[item] = value self._addresses[item] = -1 else: # FIXME technically we should allow DBRow, but this is untested and will need resetting parent raise TypeError("Unsupported type for DBFile.__setitem__: %s" % (type(value))) def __delitem__(self, item): if item in self._values: del self._values[item] del self._addresses[item] def __iter__(self): return self._addresses.__iter__() def __len__(self): return len(self._addresses) def _add_row(self, id, address, reclen): if id in self._addresses: # Something's wrong here log.warning("Multiple instances of row %r found in %s" % (id, self.file.name)) self._addresses[id] = (address, reclen) def _parse_field(self, data, field, row=None): """ Parse a single field in stream. """ if field.dyn > self._rowDynamicFields: return None # The column doesn't exist in this row, we set it to None ret = None try: if isinstance(field, fields.StringField): ret = self._parse_string(data) elif isinstance(field, fields.DataField): # wowcache.wdb length = getattr(row, field.master) ret = data.read(length) elif isinstance(field, fields.DynamicMaster): ret, = unpack("<I", data.read(4)) self._rowDynamicFields = ret else: ret, = unpack("<%s" % (field.char), data.read(field.size)) except StructError: log.warning("Field %s could not be parsed properly" % (field)) ret = None return ret def supportsSeeking(self): return hasattr(self.file, "seek") def append(self, row): """ Append a row at the end of the file. If the row does not have an id, one is automatically assigned. """ i = len(self) + 1 # FIXME this wont work properly in incomplete files if "_id" not in row: row["_id"] = i self[i] = row def clear(self): """ Delete every row in the file """ for k in self.keys(): # Use key, otherwise we get RuntimeError: dictionary changed size during iteration del self[k] def keys(self): return self._addresses.keys() def items(self): return [(k, self[k]) for k in self] def parse_row(self, data, reclen=0): """ Assign data to a DBRow instance """ return DBRow(self, data=data, reclen=reclen) def values(self): """ Return a list of the file's values """ return [self[id] for id in self] def setRow(self, key, **values): self.__setitem__(key, DBRow(self, columns=values)) def size(self): if hasattr(self.file, "size"): return self.file.size() elif isinstance(self.file, file): from os.path import getsize return getsize(self.file.name) raise NotImplementedError def update(self, other): """ Update file from iterable other """ for k in other: self[k] = other[k] def write(self, filename=""): """ Write the file data on disk. If filename is not given, use currently opened file. """ _filename = filename or self.file.name data = self.header.data() + self.data() + self.eof() f = open(_filename, "wb") # Don't open before calling data() as uncached rows would be empty f.write(data) f.close() log.info("Written %i bytes at %s" % (len(data), f.name)) if not filename: # Reopen self.file, we modified it # XXX do we need to wipe self._values here? self.file.close() self.file = open(f.name, "rb") class DBRow(list): """ A database row. Names of the variables of that class should not be used in field names of structures """ initialized = False def __init__(self, parent, data=None, columns=None, reclen=0): self._parent = parent self._values = {} # Columns values storage self.structure = parent.structure self.initialized = True # needed for __setattr__ if columns: if type(columns) == list: self.extend(columns) elif type(columns) == dict: self._default() _cols = [k.name for k in self.structure] for k in columns: try: self[_cols.index(k)] = columns[k] except ValueError: log.warning("Column %r not found" % (k)) elif data: dynfields = 0 data = StringIO(data) for field in self.structure: _data = parent._parse_field(data, field, self) self.append(_data) if reclen: real_reclen = reclen + self._parent.row_header_size if data.tell() != real_reclen: log.warning("Reclen not respected for row %r. Expected %i, read %i. (%+i)" % (self.id, real_reclen, data.tell(), real_reclen-data.tell())) def __dir__(self): result = self.__dict__.keys() result.extend(self.structure.column_names) return result def __getattr__(self, attr): if attr in self.structure: return self._get_value(attr) if attr in self.structure._abstractions: # Union abstractions etc field, func = self.structure._abstractions[attr] return func(field, self) if "__" in attr: return self._query(attr) return super(DBRow, self).__getattribute__(attr) def __int__(self): return self.id def __setattr__(self, attr, value): # Do not preserve the value in DBRow! Use the save method to save. if self.initialized and attr in self.structure: self._set_value(attr, value) return super(DBRow, self).__setattr__(attr, value) def __setitem__(self, index, value): if not isinstance(index, int): raise TypeError("Expected int instance, got %s instead (%r)" % (type(index), index)) list.__setitem__(self, index, value) col = self.structure[index] self._values[col.name] = col.to_python(value, row=self) def <API key>(self, table, field): """ Return a list of rows matching the reverse relation """ if not hasattr(self._parent, "<API key>"): self._parent.<API key> = {} cache = self._parent.<API key> tfield = table + "__" + field if tfield not in cache: cache[tfield] = {} # First time lookup, let's build the cache table = self._parent.environment.dbFile(table) for row in table: row = table[row] id = row._raw(field) if id not in cache[tfield]: cache[tfield][id] = [] cache[tfield][id].append(row) return cache[tfield].get(self.id, None) def _matches(self, **kwargs): for k, v in kwargs.items(): if not self._query(k, v): return False return True def _query(self, rel, value=None): """ Parse a django-like multilevel relationship """ rels = rel.split("__") if "" in rels: # empty string raise ValueError("Invalid relation string") first = rels[0] if not hasattr(self, first): if self._parent.environment.hasDbFile(first): # Handle reverse relations, eg spell__item for item table remainder = rel[len(first + "__"):] return self.<API key>(first, remainder) raise ValueError("Invalid relation string") ret = self rels = rels[::-1] special = { "contains": lambda x, y: x in y, "exact": lambda x, y: x == y, "icontains": lambda x, y: x.lower() in y.lower(), "iexact": lambda x, y: x.lower() == y.lower(), "gt": lambda x, y: x > y, "gte": lambda x, y: x >= y, "lt": lambda x, y: x < y, "lte": lambda x, y: x <= y, } while rels: if rels[-1] in special: if len(rels) != 1: # icontains always needs to be the last piece of the relation string raise ValueError("Invalid relation string") return special[rels[-1]](value, ret) else: ret = getattr(ret, rels.pop()) return ret def _set_value(self, name, value): index = self.structure.index(name) col = self.structure[index] self._values[name] = col.to_python(value, self) self[index] = value def _get_value(self, name): if name not in self._values: raw_value = self[self.structure.index(name)] self._set_value(name, raw_value) return self._values[name] def _raw(self, name): """ Returns the raw value from field 'name' """ index = self.structure.index(name) return self[index] def _save(self): for name in self._values: index = self.structure.index(name) col = self.structure[index] self[index] = col.from_python(self._values[name]) def _field(self, name): """ Returns the field 'name' """ index = self.structure.index(name) return self.structure[index] def _default(self): """ Change all fields to their default values """ del self[:] self._values = {} for col in self.structure: char = col.char if col.dyn: self.append(None) elif char == "s": self.append("") elif char == "f": self.append(0.0) else: self.append(0) def dict(self): """ Return a dict of the row as colname: value """ return dict(zip(self.structure.column_names, self)) def update(self, other): for k in other: self[k] = other[k] @property def id(self): "Temporary hack to transition between _id and id" return self._id
<!DOCTYPE html> <html lang="" xml:lang=""> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>Chapter 8 Statistical significance and p-values | APS 240: Data Analysis and Statistics with R</title> <meta name="description" content="Course book for Data Analysis and Statistics with R (APS 240) in the Department of Animal and Plant Sciences, University of Sheffield" /> <meta name="generator" content="bookdown 0.21 and GitBook 2.6.7" /> <meta property="og:title" content="Chapter 8 Statistical significance and p-values | APS 240: Data Analysis and Statistics with R" /> <meta property="og:type" content="book" /> <meta property="og:description" content="Course book for Data Analysis and Statistics with R (APS 240) in the Department of Animal and Plant Sciences, University of Sheffield" /> <meta name="github-repo" content="dzchilds/stats-for-bio" /> <meta name="twitter:card" content="summary" /> <meta name="twitter:title" content="Chapter 8 Statistical significance and p-values | APS 240: Data Analysis and Statistics with R" /> <meta name="<TwitterConsumerkey>" content="Course book for Data Analysis and Statistics with R (APS 240) in the Department of Animal and Plant Sciences, University of Sheffield" /> <meta name="author" content="Dylan Z. Childs, Bethan J. Hindle and Philip H. Warren" /> <meta name="date" content="2021-01-14" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="<API key>" content="yes" /> <meta name="<API key>" content="black" /> <link rel="prev" href="sampling-error.html"/> <link rel="next" href="<API key>.html"/> <script src="libs/header-attrs-2.5/header-attrs.js"></script> <script src="libs/jquery-2.2.3/jquery.min.js"></script> <link href="libs/gitbook-2.6.7/css/style.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-table.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-bookdown.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-highlight.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-search.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-fontsettings.css" rel="stylesheet" /> <link href="libs/gitbook-2.6.7/css/plugin-clipboard.css" rel="stylesheet" /> <link href="libs/anchor-sections-1.0/anchor-sections.css" rel="stylesheet" /> <script src="libs/anchor-sections-1.0/anchor-sections.js"></script> <style type="text/css"> .warning-box { border: 3px solid #e60000; margin: 25px; padding: 10px 10px 5px 10px; border-radius: 6px 6px 6px 6px; } .advanced-box { border: 3px solid #268bd2; margin: 25px; padding: 10px 10px 5px 10px; border-radius: 6px 6px 6px 6px; } .do-something { border: 3px solid #803e00; margin: 25px; padding: 10px 10px 5px 10px; border-radius: 6px 6px 6px 6px; } </style> <style type="text/css"> pre > code.sourceCode { white-space: pre; position: relative; } pre > code.sourceCode > span { display: inline-block; line-height: 1.25; } pre > code.sourceCode > span:empty { height: 1.2em; } code.sourceCode > span { color: inherit; text-decoration: inherit; } pre.sourceCode { margin: 0; } @media screen { div.sourceCode { overflow: auto; } } @media print { pre > code.sourceCode { white-space: pre-wrap; } pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; } } pre.numberSource code { counter-reset: source-line 0; } pre.numberSource code > span { position: relative; left: -4em; counter-increment: source-line; } pre.numberSource code > span > a:first-child::before { content: counter(source-line); position: relative; left: -1em; text-align: right; vertical-align: baseline; border: none; display: inline-block; -<API key>: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; padding: 0 4px; width: 4em; color: #aaaaaa; } pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } div.sourceCode { } @media screen { pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; } } code span.al { color: #ff0000; font-weight: bold; } /* Alert */ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ code span.at { color: #7d9029; } /* Attribute */ code span.bn { color: #40a070; } /* BaseN */ code span.bu { } /* BuiltIn */ code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ code span.ch { color: #4070a0; } /* Char */ code span.cn { color: #880000; } /* Constant */ code span.co { color: #60a0b0; font-style: italic; } /* Comment */ code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ code span.do { color: #ba2121; font-style: italic; } /* Documentation */ code span.dt { color: #902000; } /* DataType */ code span.dv { color: #40a070; } /* DecVal */ code span.er { color: #ff0000; font-weight: bold; } /* Error */ code span.ex { } /* Extension */ code span.fl { color: #40a070; } /* Float */ code span.fu { color: #06287e; } /* Function */ code span.im { } /* Import */ code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ code span.kw { color: #007020; font-weight: bold; } /* Keyword */ code span.op { color: #666666; } /* Operator */ code span.ot { color: #007020; } /* Other */ code span.pp { color: #bc7a00; } /* Preprocessor */ code span.sc { color: #4070a0; } /* SpecialChar */ code span.ss { color: #bb6688; } /* SpecialString */ code span.st { color: #4070a0; } /* String */ code span.va { color: #19177c; } /* Variable */ code span.vs { color: #4070a0; } /* VerbatimString */ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ </style> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body> <div class="book without-animation with-summary font-size-2 font-family-1" data-basepath="."> <div class="book-summary"> <nav role="navigation"> <ul class="summary"> <li><a href="./">APS 240</a></li> <li class="divider"></li> <li class="chapter" data-level="1" data-path="index.html"><a href="index.html"><i class="fa fa-check"></i><b>1</b> Course information and overview</a> <ul> <li class="chapter" data-level="1.1" data-path="index.html"><a href="index.html#why-data-analysis"><i class="fa fa-check"></i><b>1.1</b> Why do a data analysis course?</a></li> <li class="chapter" data-level="1.2" data-path="index.html"><a href="index.html#overview"><i class="fa fa-check"></i><b>1.2</b> Course overview</a> <ul> <li class="chapter" data-level="1.2.1" data-path="index.html"><a href="index.html#aims"><i class="fa fa-check"></i><b>1.2.1</b> Aims</a></li> <li class="chapter" data-level="1.2.2" data-path="index.html"><a href="index.html#objectives"><i class="fa fa-check"></i><b>1.2.2</b> Objectives</a></li> <li class="chapter" data-level="1.2.3" data-path="index.html"><a href="index.html#assumed-background"><i class="fa fa-check"></i><b>1.2.3</b> Assumed background</a></li> <li class="chapter" data-level="1.2.4" data-path="index.html"><a href="index.html#methods"><i class="fa fa-check"></i><b>1.2.4</b> Methods</a></li> <li class="chapter" data-level="1.2.5" data-path="index.html"><a href="index.html#<API key>"><i class="fa fa-check"></i><b>1.2.5</b> What do you need to learn?</a></li> <li class="chapter" data-level="1.2.6" data-path="index.html"><a href="index.html#<API key>"><i class="fa fa-check"></i><b>1.2.6</b> What is required of you?</a></li> </ul></li> <li class="chapter" data-level="1.3" data-path="index.html"><a href="index.html#<API key>"><i class="fa fa-check"></i><b>1.3</b> How to use the teaching material</a> <ul> <li class="chapter" data-level="1.3.1" data-path="index.html"><a href="index.html#printed-material"><i class="fa fa-check"></i><b>1.3.1</b> The online course book</a></li> <li class="chapter" data-level="1.3.2" data-path="index.html"><a href="index.html#<API key>"><i class="fa fa-check"></i><b>1.3.2</b> How to make best use of the teaching material</a></li> <li class="chapter" data-level="1.3.3" data-path="index.html"><a href="index.html#conventions"><i class="fa fa-check"></i><b>1.3.3</b> Conventions used in the course material</a></li> <li class="chapter" data-level="1.3.4" data-path="index.html"><a href="index.html#feedback"><i class="fa fa-check"></i><b>1.3.4</b> Feedback</a></li> <li class="chapter" data-level="1.3.5" data-path="index.html"><a href="index.html </ul></li> <li class="chapter" data-level="1.4" data-path="index.html"><a href="index.html#health-and-safety"><i class="fa fa-check"></i><b>1.4</b> Health and safety using display screen equipment</a></li> </ul></li> <li class="chapter" data-level="2" data-path="expected-learning.html"><a href="expected-learning.html"><i class="fa fa-check"></i><b>2</b> Expected learning outcomes</a> <ul> <li class="chapter" data-level="2.1" data-path="expected-learning.html"><a href="expected-learning.html#<API key>"><i class="fa fa-check"></i><b>2.1</b> Collecting and using data</a></li> <li class="chapter" data-level="2.2" data-path="expected-learning.html"><a href="expected-learning.html#<API key>"><i class="fa fa-check"></i><b>2.2</b> Statistical Concepts</a></li> <li class="chapter" data-level="2.3" data-path="expected-learning.html"><a href="expected-learning.html#<API key>"><i class="fa fa-check"></i><b>2.3</b> Simple parametric statistics</a></li> <li class="chapter" data-level="2.4" data-path="expected-learning.html"><a href="expected-learning.html#<API key>"><i class="fa fa-check"></i><b>2.4</b> Regression and ANOVA</a></li> <li class="chapter" data-level="2.5" data-path="expected-learning.html"><a href="expected-learning.html#<API key>"><i class="fa fa-check"></i><b>2.5</b> Doing more with models</a></li> <li class="chapter" data-level="2.6" data-path="expected-learning.html"><a href="expected-learning.html#experimental-design"><i class="fa fa-check"></i><b>2.6</b> Experimental design</a></li> <li class="chapter" data-level="2.7" data-path="expected-learning.html"><a href="expected-learning.html#<API key>"><i class="fa fa-check"></i><b>2.7</b> Beyond simple models</a></li> <li class="chapter" data-level="2.8" data-path="expected-learning.html"><a href="expected-learning.html#<API key>"><i class="fa fa-check"></i><b>2.8</b> Frequency data and non-parameteric tests</a></li> </ul></li> <li class="chapter" data-level="3" data-path="prerequisites.html"><a href="prerequisites.html"><i class="fa fa-check"></i><b>3</b> Programming prerequisites</a> <ul> <li class="chapter" data-level="3.1" data-path="prerequisites.html"><a href="prerequisites.html#<API key>"><i class="fa fa-check"></i><b>3.1</b> Starting a <strong>learnr</strong> tutorial</a></li> <li class="chapter" data-level="3.2" data-path="prerequisites.html"><a href="prerequisites.html#using-packages"><i class="fa fa-check"></i><b>3.2</b> Using packages</a></li> <li class="chapter" data-level="3.3" data-path="prerequisites.html"><a href="prerequisites.html#reading-data-into-r"><i class="fa fa-check"></i><b>3.3</b> Reading data into R</a></li> </ul></li> <li class="part"><span><b>I Collecting and Using Data</b></span></li> <li class="chapter" data-level="4" data-path="scientific-process.html"><a href="scientific-process.html"><i class="fa fa-check"></i><b>4</b> The scientific process</a> <ul> <li class="chapter" data-level="4.1" data-path="scientific-process.html"><a href="scientific-process.html#<API key>"><i class="fa fa-check"></i><b>4.1</b> Stages in the scientific process</a> <ul> <li class="chapter" data-level="4.1.1" data-path="scientific-process.html"><a href="scientific-process.html#stages-observations"><i class="fa fa-check"></i><b>4.1.1</b> Observations</a></li> <li class="chapter" data-level="4.1.2" data-path="scientific-process.html"><a href="scientific-process.html#stages-questions"><i class="fa fa-check"></i><b>4.1.2</b> Questions</a></li> <li class="chapter" data-level="4.1.3" data-path="scientific-process.html"><a href="scientific-process.html#stages-hypotheses"><i class="fa fa-check"></i><b>4.1.3</b> Hypotheses</a></li> <li class="chapter" data-level="4.1.4" data-path="scientific-process.html"><a href="scientific-process.html#stages-predictions"><i class="fa fa-check"></i><b>4.1.4</b> Predictions</a></li> </ul></li> <li class="chapter" data-level="4.2" data-path="scientific-process.html"><a href="scientific-process.html#an-example"><i class="fa fa-check"></i><b>4.2</b> An example</a></li> <li class="chapter" data-level="4.3" data-path="scientific-process.html"><a href="scientific-process.html#hypothesis-testing"><i class="fa fa-check"></i><b>4.3</b> Hypothesis testing</a></li> <li class="chapter" data-level="4.4" data-path="scientific-process.html"><a href="scientific-process.html </ul></li> <li class="chapter" data-level="5" data-path="data-variables.html"><a href="data-variables.html"><i class="fa fa-check"></i><b>5</b> Data and variables</a> <ul> <li class="chapter" data-level="5.1" data-path="data-variables.html"><a href="data-variables.html <li class="chapter" data-level="5.2" data-path="data-variables.html"><a href="data-variables.html#var-types"><i class="fa fa-check"></i><b>5.2</b> Revision: Types of variable</a> <ul> <li class="chapter" data-level="5.2.1" data-path="data-variables.html"><a href="data-variables.html#<API key>"><i class="fa fa-check"></i><b>5.2.1</b> Nominal (categorical) variables</a></li> <li class="chapter" data-level="5.2.2" data-path="data-variables.html"><a href="data-variables.html#<API key>"><i class="fa fa-check"></i><b>5.2.2</b> Ordinal (categorical) data</a></li> <li class="chapter" data-level="5.2.3" data-path="data-variables.html"><a href="data-variables.html#<API key>"><i class="fa fa-check"></i><b>5.2.3</b> Ratio scale (numeric) variables</a></li> <li class="chapter" data-level="5.2.4" data-path="data-variables.html"><a href="data-variables.html#<API key>"><i class="fa fa-check"></i><b>5.2.4</b> Interval scale (numeric) variables</a></li> <li class="chapter" data-level="5.2.5" data-path="data-variables.html"><a href="data-variables.html#<API key>"><i class="fa fa-check"></i><b>5.2.5</b> Why does the distinction matter?</a></li> <li class="chapter" data-level="5.2.6" data-path="data-variables.html"><a href="data-variables.html#which-is-best"><i class="fa fa-check"></i><b>5.2.6</b> Which is best?</a></li> </ul></li> <li class="chapter" data-level="5.3" data-path="data-variables.html"><a href="data-variables.html#accuracy-precision"><i class="fa fa-check"></i><b>5.3</b> Accuracy and precision</a> <ul> <li class="chapter" data-level="5.3.1" data-path="data-variables.html"><a href="data-variables.html#what-do-they-mean"><i class="fa fa-check"></i><b>5.3.1</b> What do they mean?</a></li> <li class="chapter" data-level="5.3.2" data-path="data-variables.html"><a href="data-variables.html <li class="chapter" data-level="5.3.3" data-path="data-variables.html"><a href="data-variables.html#<API key>"><i class="fa fa-check"></i><b>5.3.3</b> How precise should measurements be?</a></li> <li class="chapter" data-level="5.3.4" data-path="data-variables.html"><a href="data-variables.html#<API key>"><i class="fa fa-check"></i><b>5.3.4</b> Error, bias and prejudice</a></li> </ul></li> </ul></li> <li class="chapter" data-level="6" data-path="learning-from-data.html"><a href="learning-from-data.html"><i class="fa fa-check"></i><b>6</b> Learning from data</a> <ul> <li class="chapter" data-level="6.1" data-path="learning-from-data.html"><a href="learning-from-data.html#populations"><i class="fa fa-check"></i><b>6.1</b> Populations</a></li> <li class="chapter" data-level="6.2" data-path="learning-from-data.html"><a href="learning-from-data.html#<API key>"><i class="fa fa-check"></i><b>6.2</b> Learning about populations</a></li> <li class="chapter" data-level="6.3" data-path="learning-from-data.html"><a href="learning-from-data.html#morph-example"><i class="fa fa-check"></i><b>6.3</b> A simple example</a></li> <li class="chapter" data-level="6.4" data-path="learning-from-data.html"><a href="learning-from-data.html#now-what"><i class="fa fa-check"></i><b>6.4</b> Now what?</a></li> </ul></li> <li class="part"><span><b>II Statistical Concepts</b></span></li> <li class="chapter" data-level="7" data-path="sampling-error.html"><a href="sampling-error.html"><i class="fa fa-check"></i><b>7</b> Sampling error</a> <ul> <li class="chapter" data-level="7.1" data-path="sampling-error.html"><a href="sampling-error.html#sampling-error-1"><i class="fa fa-check"></i><b>7.1</b> Sampling error</a></li> <li class="chapter" data-level="7.2" data-path="sampling-error.html"><a href="sampling-error.html#<API key>"><i class="fa fa-check"></i><b>7.2</b> Sampling distributions</a></li> <li class="chapter" data-level="7.3" data-path="sampling-error.html"><a href="sampling-error.html#<API key>"><i class="fa fa-check"></i><b>7.3</b> The effect of sample size</a></li> <li class="chapter" data-level="7.4" data-path="sampling-error.html"><a href="sampling-error.html#the-standard-error"><i class="fa fa-check"></i><b>7.4</b> The standard error</a></li> <li class="chapter" data-level="7.5" data-path="sampling-error.html"><a href="sampling-error.html#<API key>"><i class="fa fa-check"></i><b>7.5</b> What is the point of all this?</a></li> </ul></li> <li class="chapter" data-level="8" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>8</b> Statistical significance and <em>p</em>-values</a> <ul> <li class="chapter" data-level="8.1" data-path="<API key>.html"><a href="<API key>.html#bootstrap"><i class="fa fa-check"></i><b>8.1</b> Estimating a sampling distribution</a> <ul> <li class="chapter" data-level="8.1.1" data-path="<API key>.html"><a href="<API key>.html#bootstrap-overview"><i class="fa fa-check"></i><b>8.1.1</b> Overview of bootstrapping</a></li> <li class="chapter" data-level="8.1.2" data-path="<API key>.html"><a href="<API key>.html#doing-it-for-real"><i class="fa fa-check"></i><b>8.1.2</b> Doing it for real</a></li> </ul></li> <li class="chapter" data-level="8.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>8.2</b> Statistical significance</a> <ul> <li class="chapter" data-level="" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i>Carrying out the assessment</a></li> <li class="chapter" data-level="" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i>Interpreting the p-value</a></li> </ul></li> <li class="chapter" data-level="8.3" data-path="<API key>.html"><a href="<API key>.html#concluding-remarks"><i class="fa fa-check"></i><b>8.3</b> Concluding remarks</a></li> </ul></li> <li class="chapter" data-level="9" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>9</b> Statistical comparisons</a> <ul> <li class="chapter" data-level="9.1" data-path="<API key>.html"><a href="<API key>.html#making-comparisons"><i class="fa fa-check"></i><b>9.1</b> Making comparisons</a> <ul> <li class="chapter" data-level="9.1.1" data-path="<API key>.html"><a href="<API key>.html#morph-weights-eg"><i class="fa fa-check"></i><b>9.1.1</b> A new example</a></li> <li class="chapter" data-level="9.1.2" data-path="<API key>.html"><a href="<API key>.html#examine-the-data"><i class="fa fa-check"></i><b>9.1.2</b> Examine the data</a></li> </ul></li> <li class="chapter" data-level="9.2" data-path="<API key>.html"><a href="<API key>.html#constructing-a-test"><i class="fa fa-check"></i><b>9.2</b> Constructing a test</a> <ul> <li class="chapter" data-level="9.2.1" data-path="<API key>.html"><a href="<API key>.html#permutation-tests"><i class="fa fa-check"></i><b>9.2.1</b> Permutation tests</a></li> <li class="chapter" data-level="9.2.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>9.2.2</b> Carrying out a permutation test</a></li> <li><a href="<API key>.html#<API key>">Calculating the <em>p</em>-value</a></li> </ul></li> <li class="chapter" data-level="9.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>9.3</b> What have we learned?</a></li> </ul></li> <li class="chapter" data-level="10" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>10</b> Hypotheses and <em>p</em>-values</a> <ul> <li class="chapter" data-level="10.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>10.1</b> A few words about the null hypothesis</a> <ul> <li class="chapter" data-level="10.1.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>10.1.1</b> Hypotheses and null hypotheses</a></li> <li class="chapter" data-level="10.1.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>10.1.2</b> Report the null hypothesis?</a></li> </ul></li> <li class="chapter" data-level="10.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>10.2</b> Interpreting and reporting <em>p</em>-values</a> <ul> <li class="chapter" data-level="10.2.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>10.2.1</b> Careful with those <em>p</em>-values</a></li> <li class="chapter" data-level="10.2.2" data-path="<API key>.html"><a href="<API key>.html#presenting-p-values"><i class="fa fa-check"></i><b>10.2.2</b> Presenting <em>p</em>-values</a></li> </ul></li> <li class="chapter" data-level="10.3" data-path="<API key>.html"><a href="<API key>.html#biological-vs.-<API key>"><i class="fa fa-check"></i><b>10.3</b> Biological vs. statistical significance</a></li> </ul></li> <li class="part"><span><b>III Simple Statistics</b></span></li> <li class="chapter" data-level="11" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>11</b> Parametric statistics</a> <ul> <li class="chapter" data-level="11.1" data-path="<API key>.html"><a href="<API key>.html#introduction"><i class="fa fa-check"></i><b>11.1</b> Introduction</a></li> <li class="chapter" data-level="11.2" data-path="<API key>.html"><a href="<API key>.html#math-models"><i class="fa fa-check"></i><b>11.2</b> Mathematical models</a></li> <li class="chapter" data-level="11.3" data-path="<API key>.html"><a href="<API key>.html#parametric-stats"><i class="fa fa-check"></i><b>11.3</b> The normal distribution</a> <ul> <li class="chapter" data-level="11.3.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>11.3.1</b> Standard error of the mean</a></li> <li class="chapter" data-level="11.3.2" data-path="<API key>.html"><a href="<API key>.html#the-t-distribution"><i class="fa fa-check"></i><b>11.3.2</b> The <em>t</em> distribution</a></li> </ul></li> </ul></li> <li class="chapter" data-level="12" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html"><i class="fa fa-check"></i><b>12</b> One sample <em>t</em>-tests</a> <ul> <li class="chapter" data-level="12.1" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#<API key>"><i class="fa fa-check"></i><b>12.1</b> When do we use one-sample <em>t</em>-test?</a></li> <li class="chapter" data-level="12.2" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#<API key>"><i class="fa fa-check"></i><b>12.2</b> How does the one-sample <em>t</em>-test work?</a> <ul> <li class="chapter" data-level="12.2.1" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#<API key>"><i class="fa fa-check"></i><b>12.2.1</b> Assumptions of the one-sample <em>t</em>-test</a></li> <li class="chapter" data-level="12.2.2" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#<API key>"><i class="fa fa-check"></i><b>12.2.2</b> Evaluating the assumptions</a></li> </ul></li> <li class="chapter" data-level="12.3" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#<API key>"><i class="fa fa-check"></i><b>12.3</b> Carrying out a one-sample <em>t</em>-test in R</a> <ul> <li class="chapter" data-level="12.3.1" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#<API key>"><i class="fa fa-check"></i><b>12.3.1</b> Visualising the data and checking the assumptions</a></li> <li class="chapter" data-level="12.3.2" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#<API key>"><i class="fa fa-check"></i><b>12.3.2</b> Carrying out the test</a></li> <li class="chapter" data-level="12.3.3" data-path="one-sample-t-tests.html"><a href="one-sample-t-tests.html#<API key>"><i class="fa fa-check"></i><b>12.3.3</b> Summarising the result</a></li> </ul></li> </ul></li> <li class="chapter" data-level="13" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html"><i class="fa fa-check"></i><b>13</b> Two-sample <em>t</em>-test</a> <ul> <li class="chapter" data-level="13.1" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#<API key>"><i class="fa fa-check"></i><b>13.1</b> When do we use a two-sample <em>t</em>-test?</a></li> <li class="chapter" data-level="13.2" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#<API key>"><i class="fa fa-check"></i><b>13.2</b> How does the two-sample <em>t</em>-test work?</a> <ul> <li class="chapter" data-level="13.2.1" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#<API key>"><i class="fa fa-check"></i><b>13.2.1</b> Assumptions of the two-sample <em>t</em>-test</a></li> <li class="chapter" data-level="13.2.2" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#<API key>"><i class="fa fa-check"></i><b>13.2.2</b> Evaluating the assumptions</a></li> <li class="chapter" data-level="13.2.3" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#<API key>"><i class="fa fa-check"></i><b>13.2.3</b> What about the <em>equal variance</em> assumption?</a></li> </ul></li> <li class="chapter" data-level="13.3" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#<API key>"><i class="fa fa-check"></i><b>13.3</b> Carrying out a two-sample <em>t</em>-test in R</a> <ul> <li class="chapter" data-level="13.3.1" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#<API key>"><i class="fa fa-check"></i><b>13.3.1</b> Visualising the data and checking the assumptions</a></li> <li class="chapter" data-level="13.3.2" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#<API key>"><i class="fa fa-check"></i><b>13.3.2</b> Carrying out the test</a></li> <li class="chapter" data-level="13.3.3" data-path="two-sample-t-test.html"><a href="two-sample-t-test.html#<API key>"><i class="fa fa-check"></i><b>13.3.3</b> Summarising the result</a></li> </ul></li> </ul></li> <li class="chapter" data-level="14" data-path="a-correlation-test.html"><a href="a-correlation-test.html"><i class="fa fa-check"></i><b>14</b> A correlation test</a> <ul> <li class="chapter" data-level="14.1" data-path="a-correlation-test.html"><a href="a-correlation-test.html <ul> <li class="chapter" data-level="14.1.1" data-path="a-correlation-test.html"><a href="a-correlation-test.html </ul></li> <li class="chapter" data-level="14.2" data-path="a-correlation-test.html"><a href="a-correlation-test.html <ul> <li class="chapter" data-level="14.2.1" data-path="a-correlation-test.html"><a href="a-correlation-test.html#<API key>"><i class="fa fa-check"></i><b>14.2.1</b> Visualising the data and checking the assumptions</a></li> <li class="chapter" data-level="14.2.2" data-path="a-correlation-test.html"><a href="a-correlation-test.html#doing-the-test"><i class="fa fa-check"></i><b>14.2.2</b> Doing the test</a></li> <li class="chapter" data-level="14.2.3" data-path="a-correlation-test.html"><a href="a-correlation-test.html#<API key>"><i class="fa fa-check"></i><b>14.2.3</b> Reporting the result</a></li> </ul></li> <li class="chapter" data-level="14.3" data-path="a-correlation-test.html"><a href="a-correlation-test.html#next-steps"><i class="fa fa-check"></i><b>14.3</b> Next steps</a></li> </ul></li> <li class="part"><span><b>IV Regression and ANOVA</b></span></li> <li class="chapter" data-level="15" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>15</b> Relationships and regression</a> <ul> <li class="chapter" data-level="15.1" data-path="<API key>.html"><a href="<API key>.html#introduction-1"><i class="fa fa-check"></i><b>15.1</b> Introduction</a></li> <li class="chapter" data-level="15.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>15.2</b> What does linear regression do?</a></li> <li class="chapter" data-level="15.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>15.3</b> How does simple linear regression work?</a> <ul> <li class="chapter" data-level="15.3.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>15.3.1</b> Finding the best fit line</a></li> </ul></li> <li class="chapter" data-level="15.4" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>15.4</b> What do you get out of a regression?</a> <ul> <li class="chapter" data-level="15.4.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>15.4.1</b> Interpreting a regression</a></li> <li class="chapter" data-level="15.4.2" data-path="<API key>.html"><a href="<API key>.html </ul></li> <li class="chapter" data-level="15.5" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>15.5</b> Correlation or regression?</a></li> </ul></li> <li class="chapter" data-level="16" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>16</b> Simple regression in R</a> <ul> <li class="chapter" data-level="16.1" data-path="<API key>.html"><a href="<API key>.html#regression-in-R"><i class="fa fa-check"></i><b>16.1</b> Carrying out a simple linear regression in R</a></li> <li class="chapter" data-level="16.2" data-path="<API key>.html"><a href="<API key>.html#first-steps"><i class="fa fa-check"></i><b>16.2</b> First steps</a> <ul> <li class="chapter" data-level="16.2.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>16.2.1</b> Visualising the data</a></li> </ul></li> <li class="chapter" data-level="16.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>16.3</b> Model fitting and significance tests</a> <ul> <li class="chapter" data-level="16.3.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>16.3.1</b> Extracting a little more information</a></li> </ul></li> <li class="chapter" data-level="16.4" data-path="<API key>.html"><a href="<API key>.html#present-results"><i class="fa fa-check"></i><b>16.4</b> Presenting results</a> <ul> <li class="chapter" data-level="16.4.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>16.4.1</b> Plotting the fitted line and the data</a></li> </ul></li> <li class="chapter" data-level="16.5" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>16.5</b> What about causation?</a></li> </ul></li> <li class="chapter" data-level="17" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>17</b> Introduction to one-way ANOVA</a> <ul> <li class="chapter" data-level="17.1" data-path="<API key>.html"><a href="<API key>.html#intro"><i class="fa fa-check"></i><b>17.1</b> Introduction</a></li> <li class="chapter" data-level="17.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>17.2</b> Why do we need ANOVA models?</a></li> <li class="chapter" data-level="17.3" data-path="<API key>.html"><a href="<API key>.html#how-does-anova-work"><i class="fa fa-check"></i><b>17.3</b> How does ANOVA work?</a> <ul> <li class="chapter" data-level="17.3.1" data-path="<API key>.html"><a href="<API key>.html#degrees-of-freedom"><i class="fa fa-check"></i><b>17.3.1</b> Degrees of freedom</a></li> <li class="chapter" data-level="17.3.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>17.3.2</b> Mean squares, variance ratios, and F-tests</a></li> </ul></li> <li class="chapter" data-level="17.4" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>17.4</b> Different kinds of ANOVA model</a></li> <li class="chapter" data-level="17.5" data-path="<API key>.html"><a href="<API key>.html#questions"><i class="fa fa-check"></i><b>17.5</b> Some common questions about ANOVA</a> <ul> <li class="chapter" data-level="17.5.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>17.5.1</b> Can ANOVA only be applied to experimental data?</a></li> <li class="chapter" data-level="17.5.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>17.5.2</b> Do we need equal replication?</a></li> <li class="chapter" data-level="17.5.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>17.5.3</b> Can ANOVA be done with only two treatments?</a></li> </ul></li> </ul></li> <li class="chapter" data-level="18" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html"><i class="fa fa-check"></i><b>18</b> One-way ANOVA in R</a> <ul> <li class="chapter" data-level="18.1" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html#introduction-2"><i class="fa fa-check"></i><b>18.1</b> Introduction</a></li> <li class="chapter" data-level="18.2" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html#factors-in-r"><i class="fa fa-check"></i><b>18.2</b> Factors in R</a></li> <li class="chapter" data-level="18.3" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html#<API key>"><i class="fa fa-check"></i><b>18.3</b> Visualising the data</a></li> <li class="chapter" data-level="18.4" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html#<API key>"><i class="fa fa-check"></i><b>18.4</b> Fitting the ANOVA model</a></li> <li class="chapter" data-level="18.5" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html#<API key>"><i class="fa fa-check"></i><b>18.5</b> Interpreting the results</a></li> <li class="chapter" data-level="18.6" data-path="one-way-anova-in-r.html"><a href="one-way-anova-in-r.html#summarise-results"><i class="fa fa-check"></i><b>18.6</b> Summarising and presenting the results of ANOVA</a></li> </ul></li> <li class="part"><span><b>V Experimental Design</b></span></li> <li class="chapter" data-level="19" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>19</b> Principles of experimental design</a> <ul> <li class="chapter" data-level="19.1" data-path="<API key>.html"><a href="<API key>.html#introduction-3"><i class="fa fa-check"></i><b>19.1</b> Introduction</a></li> <li class="chapter" data-level="19.2" data-path="<API key>.html"><a href="<API key>.html#jargon-busting"><i class="fa fa-check"></i><b>19.2</b> Jargon busting</a></li> <li class="chapter" data-level="19.3" data-path="<API key>.html"><a href="<API key>.html#replication"><i class="fa fa-check"></i><b>19.3</b> Replication</a> <ul> <li class="chapter" data-level="19.3.1" data-path="<API key>.html"><a href="<API key>.html#independence"><i class="fa fa-check"></i><b>19.3.1</b> Independence and pseudoreplication</a></li> </ul></li> <li class="chapter" data-level="19.4" data-path="<API key>.html"><a href="<API key>.html#controls"><i class="fa fa-check"></i><b>19.4</b> Controls</a></li> <li class="chapter" data-level="19.5" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>19.5</b> Confounded and noisy experiments</a> <ul> <li class="chapter" data-level="19.5.1" data-path="<API key>.html"><a href="<API key>.html#confounding"><i class="fa fa-check"></i><b>19.5.1</b> Confounding</a></li> <li class="chapter" data-level="19.5.2" data-path="<API key>.html"><a href="<API key>.html#noise"><i class="fa fa-check"></i><b>19.5.2</b> Noise</a></li> </ul></li> <li class="chapter" data-level="19.6" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>19.6</b> Dealing with confounding effects and noise</a> <ul> <li class="chapter" data-level="19.6.1" data-path="<API key>.html"><a href="<API key>.html#randomisation"><i class="fa fa-check"></i><b>19.6.1</b> Randomisation</a></li> <li class="chapter" data-level="19.6.2" data-path="<API key>.html"><a href="<API key>.html#blocking"><i class="fa fa-check"></i><b>19.6.2</b> Blocking</a></li> <li class="chapter" data-level="19.6.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>19.6.3</b> Experimental control</a></li> <li class="chapter" data-level="19.6.4" data-path="<API key>.html"><a href="<API key>.html </ul></li> <li class="chapter" data-level="19.7" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>19.7</b> Ethics and practicality</a></li> <li class="chapter" data-level="19.8" data-path="<API key>.html"><a href="<API key>.html#further-reading"><i class="fa fa-check"></i><b>19.8</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="20" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>20</b> Paired-sample t-test</a> <ul> <li class="chapter" data-level="20.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>20.1</b> When do we use a paired-sample <em>t</em>-test?</a></li> <li class="chapter" data-level="20.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>20.2</b> Why do we use a paired-sample design?</a></li> <li class="chapter" data-level="20.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>20.3</b> How do you carry out a <em>t</em>-test on paired-samples?</a> <ul> <li class="chapter" data-level="20.3.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>20.3.1</b> Assumptions of the paired-sample <em>t</em>-test</a></li> </ul></li> <li class="chapter" data-level="20.4" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>20.4</b> Carrying out a paired-sample <em>t</em>-test in R</a> <ul> <li class="chapter" data-level="20.4.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>20.4.1</b> Using the <code>paired = TRUE</code> argument</a></li> </ul></li> </ul></li> <li class="chapter" data-level="21" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>21</b> ANOVA for randomised block designs</a> <ul> <li class="chapter" data-level="21.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>21.1</b> Randomized Complete Block Designs</a></li> <li class="chapter" data-level="21.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>21.2</b> Designs without replication</a></li> <li class="chapter" data-level="21.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>21.3</b> Analysing an RCBD experiment</a></li> <li class="chapter" data-level="21.4" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>21.4</b> Carrying out the analysis with R</a> <ul> <li class="chapter" data-level="21.4.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>21.4.1</b> Multiple comparisons anyone?</a></li> </ul></li> <li class="chapter" data-level="21.5" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>21.5</b> Are there disadvantages to randomised block designs?</a></li> <li class="chapter" data-level="21.6" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>21.6</b> Multiple blocking factors</a></li> </ul></li> <li class="part"><span><b>VI Doing More with Models</b></span></li> <li class="chapter" data-level="22" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>22</b> Assumptions and diagnostics</a> <ul> <li class="chapter" data-level="22.1" data-path="<API key>.html"><a href="<API key>.html#understanding-data"><i class="fa fa-check"></i><b>22.1</b> Understanding data</a></li> <li class="chapter" data-level="22.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>22.2</b> Assumptions of regression</a></li> <li class="chapter" data-level="22.3" data-path="<API key>.html"><a href="<API key>.html#regres-diagnose"><i class="fa fa-check"></i><b>22.3</b> Regression diagnostics</a> <ul> <li class="chapter" data-level="22.3.1" data-path="<API key>.html"><a href="<API key>.html#fitted-values"><i class="fa fa-check"></i><b>22.3.1</b> Fitted values</a></li> <li class="chapter" data-level="22.3.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>22.3.2</b> Checking the linearity assumption</a></li> <li class="chapter" data-level="22.3.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>22.3.3</b> Checking the normality assumption</a></li> <li class="chapter" data-level="22.3.4" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>22.3.4</b> Checking the constant variance assumption</a></li> </ul></li> <li class="chapter" data-level="22.4" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>22.4</b> Assumptions of one-way ANOVA</a></li> </ul></li> <li class="chapter" data-level="23" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>23</b> Regression diagnostics in R</a> <ul> <li class="chapter" data-level="23.1" data-path="<API key>.html"><a href="<API key>.html#introduction-4"><i class="fa fa-check"></i><b>23.1</b> Introduction</a></li> <li class="chapter" data-level="23.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>23.2</b> Diagnostics for regression</a></li> <li class="chapter" data-level="23.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>23.3</b> Diagnostics for one-way ANOVA</a> <ul> <li class="chapter" data-level="23.3.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>23.3.1</b> Aside: formal test of equality of variance</a></li> </ul></li> </ul></li> <li class="chapter" data-level="24" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>24</b> Data transformations</a> <ul> <li class="chapter" data-level="24.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>24.1</b> Data that violate ANOVA assumptions</a></li> <li class="chapter" data-level="24.2" data-path="<API key>.html"><a href="<API key>.html#ant-eg"><i class="fa fa-check"></i><b>24.2</b> Data transformation: ANOVAs and <em>t</em>-tests</a> <ul> <li class="chapter" data-level="24.2.1" data-path="<API key>.html"><a href="<API key>.html <li class="chapter" data-level="24.2.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>24.2.2</b> Fit the model and checking the assumptions</a></li> </ul></li> <li class="chapter" data-level="24.3" data-path="<API key>.html"><a href="<API key>.html#carry-on"><i class="fa fa-check"></i><b>24.3</b> Carrying on anyway</a></li> <li class="chapter" data-level="24.4" data-path="<API key>.html"><a href="<API key>.html#transform"><i class="fa fa-check"></i><b>24.4</b> Transforming the data</a> <ul> <li class="chapter" data-level="24.4.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>24.4.1</b> The logarithmic transformation</a></li> <li class="chapter" data-level="24.4.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>24.4.2</b> Presenting results from analyses of transformed data</a></li> </ul></li> <li class="chapter" data-level="24.5" data-path="<API key>.html"><a href="<API key>.html#trans-types"><i class="fa fa-check"></i><b>24.5</b> Types of transformations</a> <ul> <li class="chapter" data-level="24.5.1" data-path="<API key>.html"><a href="<API key>.html#logarithms"><i class="fa fa-check"></i><b>24.5.1</b> Logarithms</a></li> <li class="chapter" data-level="24.5.2" data-path="<API key>.html"><a href="<API key>.html#square-roots"><i class="fa fa-check"></i><b>24.5.2</b> Square roots</a></li> <li class="chapter" data-level="24.5.3" data-path="<API key>.html"><a href="<API key>.html#arcsine-square-root"><i class="fa fa-check"></i><b>24.5.3</b> Arcsine square root</a></li> <li class="chapter" data-level="24.5.4" data-path="<API key>.html"><a href="<API key>.html#squaring"><i class="fa fa-check"></i><b>24.5.4</b> Squaring</a></li> <li class="chapter" data-level="24.5.5" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>24.5.5</b> Situations which cannot be dealt with by transformations</a></li> </ul></li> <li class="chapter" data-level="24.6" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>24.6</b> What about other kinds of models?</a></li> <li class="chapter" data-level="24.7" data-path="<API key>.html"><a href="<API key>.html#final-thoughts"><i class="fa fa-check"></i><b>24.7</b> Final thoughts</a></li> </ul></li> <li class="chapter" data-level="25" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>25</b> Multiple comparison tests</a> <ul> <li class="chapter" data-level="25.1" data-path="<API key>.html"><a href="<API key>.html#introduction-5"><i class="fa fa-check"></i><b>25.1</b> Introduction</a></li> <li class="chapter" data-level="25.2" data-path="<API key>.html"><a href="<API key>.html <li class="chapter" data-level="25.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>25.3</b> How to summarise multiple-comparison results</a></li> <li class="chapter" data-level="25.4" data-path="<API key>.html"><a href="<API key>.html <li class="chapter" data-level="25.5" data-path="<API key>.html"><a href="<API key>.html#summarise"><i class="fa fa-check"></i><b>25.5</b> Summarising and presenting the results of a Tukey test</a></li> <li class="chapter" data-level="25.6" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>25.6</b> Significant ANOVA but no differences in a Tukey test?</a></li> </ul></li> <li class="part"><span><b>VII Beyond Simple Models</b></span></li> <li class="chapter" data-level="26" data-path="two-way-anova-intro.html"><a href="two-way-anova-intro.html"><i class="fa fa-check"></i><b>26</b> Introduction to two-way ANOVA</a> <ul> <li class="chapter" data-level="26.1" data-path="<API key>.html"><a href="<API key>.html#introduction"><i class="fa fa-check"></i><b>26.1</b> Introduction</a></li> <li class="chapter" data-level="26.2" data-path="two-way-anova-intro.html"><a href="two-way-anova-intro.html#<API key>"><i class="fa fa-check"></i><b>26.2</b> Degrees of freedom, mean squares, and <em>F</em>-statistics</a></li> <li class="chapter" data-level="26.3" data-path="two-way-anova-intro.html"><a href="two-way-anova-intro.html#<API key>"><i class="fa fa-check"></i><b>26.3</b> Multiple comparison tests</a></li> <li class="chapter" data-level="26.4" data-path="two-way-anova-intro.html"><a href="two-way-anova-intro.html#<API key>"><i class="fa fa-check"></i><b>26.4</b> Beyond two-way ANOVA</a></li> </ul></li> <li class="chapter" data-level="27" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html"><i class="fa fa-check"></i><b>27</b> Two-way ANOVA in R</a> <ul> <li class="chapter" data-level="27.1" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#introduction-6"><i class="fa fa-check"></i><b>27.1</b> Introduction</a></li> <li class="chapter" data-level="27.2" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#<API key>"><i class="fa fa-check"></i><b>27.2</b> Competition between <em>Calluna</em> and <em>Festuca</em></a></li> <li class="chapter" data-level="27.3" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#<API key>"><i class="fa fa-check"></i><b>27.3</b> Visualising the data</a></li> <li class="chapter" data-level="27.4" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#<API key>"><i class="fa fa-check"></i><b>27.4</b> Fitting the ANOVA model</a></li> <li class="chapter" data-level="27.5" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#diagnostics"><i class="fa fa-check"></i><b>27.5</b> Diagnostics</a></li> <li class="chapter" data-level="27.6" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#<API key>"><i class="fa fa-check"></i><b>27.6</b> Interpreting the results</a> <ul> <li class="chapter" data-level="27.6.1" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#<API key>"><i class="fa fa-check"></i><b>27.6.1</b> Understanding the model graphically</a></li> </ul></li> <li class="chapter" data-level="27.7" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#<API key>"><i class="fa fa-check"></i><b>27.7</b> Multiple comparison tests</a></li> <li class="chapter" data-level="27.8" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#<API key>"><i class="fa fa-check"></i><b>27.8</b> Drawing conclusions and presenting results</a> <ul> <li class="chapter" data-level="27.8.1" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#<API key>"><i class="fa fa-check"></i><b>27.8.1</b> A little more customisation</a></li> </ul></li> <li class="chapter" data-level="27.9" data-path="two-way-anova-in-r.html"><a href="two-way-anova-in-r.html#<API key>"><i class="fa fa-check"></i><b>27.9</b> Balanced or orthogonal designs</a></li> </ul></li> <li class="chapter" data-level="28" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>28</b> Introduction to ANCOVA</a> <ul> <li class="chapter" data-level="28.1" data-path="<API key>.html"><a href="<API key>.html#introduction"><i class="fa fa-check"></i><b>28.1</b> Introduction</a></li> <li class="chapter" data-level="28.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>28.2</b> Why do we need ANCOVA models?</a></li> <li class="chapter" data-level="28.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>28.3</b> How does ANCOVA work?</a></li> <li class="chapter" data-level="28.4" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>28.4</b> Degrees of freedom, mean squares and F-statistics</a></li> <li class="chapter" data-level="28.5" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>28.5</b> Assumptions of ANCOVA</a></li> </ul></li> <li class="chapter" data-level="29" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html"><i class="fa fa-check"></i><b>29</b> Two-way ANCOVA in R</a> <ul> <li class="chapter" data-level="29.1" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html#introduction-7"><i class="fa fa-check"></i><b>29.1</b> Introduction</a></li> <li class="chapter" data-level="29.2" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html#<API key>"><i class="fa fa-check"></i><b>29.2</b> Visualising the data</a></li> <li class="chapter" data-level="29.3" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html#fitting-an-ancova"><i class="fa fa-check"></i><b>29.3</b> Fitting an ANCOVA</a></li> <li class="chapter" data-level="29.4" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html#diagnostics-1"><i class="fa fa-check"></i><b>29.4</b> Diagnostics</a></li> <li class="chapter" data-level="29.5" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html#<API key>"><i class="fa fa-check"></i><b>29.5</b> Interpreting the results</a></li> <li class="chapter" data-level="29.6" data-path="two-way-ancova-in-r.html"><a href="two-way-ancova-in-r.html#<API key>"><i class="fa fa-check"></i><b>29.6</b> Presenting the results</a></li> </ul></li> <li class="part"><span><b>VIII Frequency Data and Non-parametric Tests</b></span></li> <li class="chapter" data-level="30" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>30</b> Working with frequencies</a> <ul> <li class="chapter" data-level="30.1" data-path="<API key>.html"><a href="<API key>.html#introduction-8"><i class="fa fa-check"></i><b>30.1</b> Introduction</a></li> <li class="chapter" data-level="30.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>30.2</b> A new kind of distribution</a></li> <li class="chapter" data-level="30.3" data-path="<API key>.html"><a href="<API key>.html#types-of-test"><i class="fa fa-check"></i><b>30.3</b> Types of test</a> <ul> <li class="chapter" data-level="30.3.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>30.3.1</b> <span class="math inline">\(\chi^{2}\)</span> goodness of fit test</a></li> <li class="chapter" data-level="30.3.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>30.3.2</b> <span class="math inline">\(\chi^{2}\)</span> contingency table test</a></li> <li class="chapter" data-level="30.3.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>30.3.3</b> The assumptions and requirements of <span class="math inline">\(\chi^{2}\)</span> tests</a></li> </ul></li> </ul></li> <li class="chapter" data-level="31" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>31</b> Goodness of fit tests</a> <ul> <li class="chapter" data-level="31.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>31.1</b> When do we use a chi-square goodness of fit test?</a></li> <li class="chapter" data-level="31.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>31.2</b> How does the chi-square goodness of fit test work?</a> <ul> <li class="chapter" data-level="31.2.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>31.2.1</b> Assumptions of the chi-square goodness of fit test</a></li> </ul></li> <li class="chapter" data-level="31.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>31.3</b> Carrying out a chi-square goodness of fit test in R</a> <ul> <li class="chapter" data-level="31.3.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>31.3.1</b> Summarising the result</a></li> <li class="chapter" data-level="31.3.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>31.3.2</b> A bit more about goodness of fit tests in R</a></li> <li class="chapter" data-level="31.3.3" data-path="<API key>.html"><a href="<API key>.html </ul></li> <li class="chapter" data-level="31.4" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>31.4</b> Determining appropriate expected values</a></li> </ul></li> <li class="chapter" data-level="32" data-path="contingency-tables.html"><a href="contingency-tables.html"><i class="fa fa-check"></i><b>32</b> Contingency tables</a> <ul> <li class="chapter" data-level="32.1" data-path="contingency-tables.html"><a href="contingency-tables.html#<API key>"><i class="fa fa-check"></i><b>32.1</b> When do we use a chi-square contingency table test?</a></li> <li class="chapter" data-level="32.2" data-path="contingency-tables.html"><a href="contingency-tables.html#<API key>"><i class="fa fa-check"></i><b>32.2</b> How does the chi-square contingency table test work?</a> <ul> <li class="chapter" data-level="32.2.1" data-path="contingency-tables.html"><a href="contingency-tables.html#<API key>"><i class="fa fa-check"></i><b>32.2.1</b> Assumptions of the chi-square contingency table test</a></li> </ul></li> <li class="chapter" data-level="32.3" data-path="contingency-tables.html"><a href="contingency-tables.html#<API key>"><i class="fa fa-check"></i><b>32.3</b> Carrying out a chi-square contingency table test in R</a> <ul> <li class="chapter" data-level="32.3.1" data-path="contingency-tables.html"><a href="contingency-tables.html#step-1.-<API key>"><i class="fa fa-check"></i><b>32.3.1</b> Step 1. Getting the data into the correct format</a></li> <li class="chapter" data-level="32.3.2" data-path="contingency-tables.html"><a href="contingency-tables.html#step-2.-doing-the-test"><i class="fa fa-check"></i><b>32.3.2</b> Step 2. Doing the test</a></li> <li class="chapter" data-level="32.3.3" data-path="contingency-tables.html"><a href="contingency-tables.html#<API key>"><i class="fa fa-check"></i><b>32.3.3</b> Summarising the result</a></li> </ul></li> <li class="chapter" data-level="32.4" data-path="contingency-tables.html"><a href="contingency-tables.html#<API key>"><i class="fa fa-check"></i><b>32.4</b> Working with larger tables</a></li> </ul></li> <li class="chapter" data-level="33" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>33</b> Non-parametric tests</a> <ul> <li class="chapter" data-level="33.1" data-path="<API key>.html"><a href="<API key>.html#what-is-non-par"><i class="fa fa-check"></i><b>33.1</b> What is a non-parametric test?</a></li> <li class="chapter" data-level="33.2" data-path="<API key>.html"><a href="<API key>.html#non-par-intro"><i class="fa fa-check"></i><b>33.2</b> How does a non-parametric test work?</a></li> <li class="chapter" data-level="33.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>33.3</b> Non-parametric equivalents</a></li> <li class="chapter" data-level="33.4" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>33.4</b> Wilcoxon signed-rank test</a> <ul> <li class="chapter" data-level="33.4.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>33.4.1</b> Leaf damage, plant defences and feeding by winter moth larvae</a></li> </ul></li> <li class="chapter" data-level="33.5" data-path="<API key>.html"><a href="<API key>.html#mann-whitney"><i class="fa fa-check"></i><b>33.5</b> The Mann-Whitney <em>U</em>-test</a> <ul> <li class="chapter" data-level="33.5.1" data-path="<API key>.html"><a href="<API key>.html#ant-foraging"><i class="fa fa-check"></i><b>33.5.1</b> Ant foraging</a></li> </ul></li> <li class="chapter" data-level="33.6" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>33.6</b> The Kruskal-Wallis test</a> <ul> <li class="chapter" data-level="33.6.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>33.6.1</b> Learning in cuttlefish</a></li> </ul></li> <li class="chapter" data-level="33.7" data-path="<API key>.html"><a href="<API key>.html <ul> <li class="chapter" data-level="33.7.1" data-path="<API key>.html"><a href="<API key>.html#grouse-lekking"><i class="fa fa-check"></i><b>33.7.1</b> Grouse lekking</a></li> </ul></li> <li class="chapter" data-level="33.8" data-path="<API key>.html"><a href="<API key>.html <ul> <li class="chapter" data-level="33.8.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>33.8.1</b> What are the advantages?</a></li> <li class="chapter" data-level="33.8.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>33.8.2</b> What are the disadvantages?</a></li> <li class="chapter" data-level="33.8.3" data-path="<API key>.html"><a href="<API key>.html#parting-words"><i class="fa fa-check"></i><b>33.8.3</b> Parting words</a></li> </ul></li> </ul></li> <li class="appendix"><span><b>Supplementary Material</b></span></li> <li class="chapter" data-level="A" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>A</b> Choosing models and tests</a> <ul> <li class="chapter" data-level="A.1" data-path="<API key>.html"><a href="<API key>.html#intro"><i class="fa fa-check"></i><b>A.1</b> Introduction</a> <ul> <li class="chapter" data-level="A.1.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>A.1.1</b> Do we need to carry out a statistical analysis?</a></li> </ul></li> <li class="chapter" data-level="A.2" data-path="<API key>.html"><a href="<API key>.html <li class="chapter" data-level="A.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>A.3</b> A key to choosing statistical models and tests</a></li> <li class="chapter" data-level="A.4" data-path="<API key>.html"><a href="<API key>.html#four-questions"><i class="fa fa-check"></i><b>A.4</b> Four main types of question</a></li> <li class="chapter" data-level="A.5" data-path="<API key>.html"><a href="<API key>.html <ul> <li class="chapter" data-level="A.5.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>A.5.1</b> Question 1 How many groups?</a></li> <li class="chapter" data-level="A.5.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>A.5.2</b> [Question 1] Single group</a></li> <li class="chapter" data-level="A.5.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>A.5.3</b> [Question 1] Two groups</a></li> <li class="chapter" data-level="A.5.4" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>A.5.4</b> [Question 1] More than two groups</a></li> </ul></li> <li class="chapter" data-level="A.6" data-path="<API key>.html"><a href="<API key>.html <ul> <li class="chapter" data-level="A.6.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>A.6.1</b> [Question 2] Testing <span class="math inline">\(y\)</span> as a function of <span class="math inline">\(x\)</span>, or an association between <span class="math inline">\(x\)</span> and <span class="math inline">\(y\)</span>?</a></li> </ul></li> <li class="chapter" data-level="A.7" data-path="<API key>.html"><a href="<API key>.html <li class="chapter" data-level="A.8" data-path="<API key>.html"><a href="<API key>.html#var-cat"><i class="fa fa-check"></i><b>A.8</b> Variables or categories?</a> <ul> <li class="chapter" data-level="A.8.1" data-path="<API key>.html"><a href="<API key>.html#anova-vs.-regression"><i class="fa fa-check"></i><b>A.8.1</b> ANOVA vs. regression</a></li> <li class="chapter" data-level="A.8.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>A.8.2</b> Making categories out of continuous measures</a></li> </ul></li> </ul></li> <li class="chapter" data-level="B" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>B</b> Writing a scientific report</a> <ul> <li class="chapter" data-level="B.1" data-path="<API key>.html"><a href="<API key>.html#introduction-9"><i class="fa fa-check"></i><b>B.1</b> Introduction</a></li> <li class="chapter" data-level="B.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>B.2</b> The structure of a scientific report</a> <ul> <li class="chapter" data-level="B.2.1" data-path="<API key>.html"><a href="<API key>.html#title"><i class="fa fa-check"></i><b>B.2.1</b> Title</a></li> <li class="chapter" data-level="B.2.2" data-path="<API key>.html"><a href="<API key>.html#abstract-or-summary"><i class="fa fa-check"></i><b>B.2.2</b> Abstract or Summary</a></li> <li class="chapter" data-level="B.2.3" data-path="<API key>.html"><a href="<API key>.html#introduction-10"><i class="fa fa-check"></i><b>B.2.3</b> Introduction</a></li> <li class="chapter" data-level="B.2.4" data-path="<API key>.html"><a href="<API key>.html#methods-1"><i class="fa fa-check"></i><b>B.2.4</b> Methods</a></li> <li class="chapter" data-level="B.2.5" data-path="<API key>.html"><a href="<API key>.html#results"><i class="fa fa-check"></i><b>B.2.5</b> Results</a></li> <li class="chapter" data-level="B.2.6" data-path="<API key>.html"><a href="<API key>.html#discussion"><i class="fa fa-check"></i><b>B.2.6</b> Discussion</a></li> <li class="chapter" data-level="B.2.7" data-path="<API key>.html"><a href="<API key>.html#acknowledgements"><i class="fa fa-check"></i><b>B.2.7</b> Acknowledgements</a></li> <li class="chapter" data-level="B.2.8" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>B.2.8</b> Literature cited / References</a></li> <li class="chapter" data-level="B.2.9" data-path="<API key>.html"><a href="<API key>.html#appendices"><i class="fa fa-check"></i><b>B.2.9</b> Appendices</a></li> </ul></li> <li class="chapter" data-level="B.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>B.3</b> Presenting species names</a> <ul> <li class="chapter" data-level="B.3.1" data-path="<API key>.html"><a href="<API key>.html </ul></li> <li class="chapter" data-level="B.4" data-path="<API key>.html"><a href="<API key>.html#further-reading-1"><i class="fa fa-check"></i><b>B.4</b> Further reading</a></li> </ul></li> <li class="chapter" data-level="C" data-path="<API key>.html"><a href="<API key>.html"><i class="fa fa-check"></i><b>C</b> One-tailed vs. two-tailed tests</a> <ul> <li class="chapter" data-level="C.1" data-path="<API key>.html"><a href="<API key>.html#introduction-11"><i class="fa fa-check"></i><b>C.1</b> Introduction</a></li> <li class="chapter" data-level="C.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>C.2</b> An example of a one-tailed hypothesis</a></li> <li class="chapter" data-level="C.3" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>C.3</b> So how do we perform a one-tailed <em>t</em>-test?</a> <ul> <li class="chapter" data-level="C.3.1" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>C.3.1</b> Carrying out one-tailed <em>t</em>-tests in R</a></li> <li class="chapter" data-level="C.3.2" data-path="<API key>.html"><a href="<API key>.html#<API key>"><i class="fa fa-check"></i><b>C.3.2</b> When to use, and not to use, one-tailed <em>t</em>-tests</a></li> </ul></li> </ul></li> <li class="divider"></li> <li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li> </ul> </nav> </div> <div class="book-body"> <div class="body-inner"> <div class="book-header" role="navigation"> <h1> <i class="fa fa-circle-o-notch fa-spin"></i><a href="./">APS 240: Data Analysis and Statistics with R</a> </h1> </div> <div class="page-wrapper" tabindex="-1" role="main"> <div class="page-inner"> <section class="normal" id="section-"> <div id="<API key>" class="section level1" number="8"> <h1><span class="<API key>">Chapter 8</span> Statistical significance and <em>p</em>-values</h1> <p>Frequentist statistics works by asking <em>what would have happened</em> if we were to repeat a data collection exercise many times, <em>assuming that the population remains the same</em> each time. This is the basic idea we used to generate sampling distributions in the last chapter. The details of this procedure depend on what kind of question we are asking, which varies from one situation to another.</p> <p>What is common to every frequentist technique is that we ultimately have to work out what some kind of sampling distribution looks like. Once we’ve done that we can evaluate how likely a particular result is. This naturally leads onto the most important ideas in frequentist statistics: <em>p</em>-values and statistical significance.</p> <div id="bootstrap" class="section level2" number="8.1"> <h2><span class="<API key>">8.1</span> Estimating a sampling distribution</h2> <p>Let’s carry on with the plant polymorphism example. Our ultimate goal is to find out if the purple morph frequency is likely to be greater than 25% in the new study population. The suggestion above is that we will need to work out what the sampling distribution of the purple morph frequency estimate looks like to get to this point.</p> <p>At first glance this seems an impossible task in the real world because we would only have access to a single sample? The solution to this problem is surprisingly simple: use the one sample to approximate the population in some way, then work out what the sampling distribution of our estimate should look like by ‘taking samples’ from this approximation.</p> <p>We’ll unpack this idea a bit more before we try it out for real.</p> <div id="bootstrap-overview" class="section level3" number="8.1.1"> <h3><span class="<API key>">8.1.1</span> Overview of bootstrapping</h3> <p>There are many ways to use a sample to approximate the population it came from. One of the simplest is to <em>pretend the sample is the true population</em>. All we then have to do to get at a sampling distribution is draw new samples from this pretend population. This may sound like ‘cheating’ but it turns out this is a perfectly valid way to construct approximate sampling distributions.</p> <p>We’ll try to get a sense of how this works using a physical analogy based on our plant morph example. Imagine that we have written down the colour of every sampled plant on a different piece of paper and then placed these bits of paper into in a hat. We then do the following:</p> <ol style="list-style-type: decimal"> <li>Pick a piece of paper at random, record its value (purple or green), put the paper back into the hat, and shake the hat about to mix up the bits of paper.</li> </ol> <p>(The shaking here is meant to ensure that each piece of paper has an equal chance of being picked.)</p> <ol start="2" style="list-style-type: decimal"> <li><p>Now pick another piece of paper (we might get the same one), record its value, put that one back into the hat, and shake everything up again.</p></li> <li><p>Repeat this process until we have a recorded new sample of colours that is the same size as the real sample. We have now have generated a ‘new sample’ from the original one.</p></li> </ol> <p>(This process is called ‘sampling with replacement.’ Each artificial sample is called a ‘bootstrapped sample.’)</p> <ol start="4" style="list-style-type: decimal"> <li><p>For each bootstrapped sample, calculate whatever quantity is of interest. In our example, this is the proportion of purple plants sampled.</p></li> <li><p>Repeat steps 1-4 until we have generated a large number of bootstrapped samples. About 10000 is sufficient for most problems.</p></li> </ol> <p>Although it seems like cheating this procedure really does approximate the sampling distribution of the purple plant frequency. It is called <strong>bootstrapping</strong> (or ‘the bootstrap’).</p> <p>The bootstrap is quite a sophisticated technique developed by statistician <a href="https: </div> <div id="doing-it-for-real" class="section level3" number="8.1.2"> <h3><span class="<API key>">8.1.2</span> Doing it for real</h3> <p>No one carries out bootstrapping using bits of paper and hat. Generating 10000 bootstrapped samples via such a method would obviously take a very long time! Luckily, computers are very good at carrying out repetitive tasks quickly. We’re going to work through how to implement the bootstrap for our hypothetical example.</p> <div class="do-something"> <p> The best way to understand what follows is to actually work through the example. You are strongly encouraged to do this! </p> </div> <div id="<API key>" class="section level4 unnumbered"> <h4>Set up and read the data</h4> <p>Assume we had sampled 250 individuals from the new plant population. A data set representing this situation is stored in the Comma Separated Value (CSV) file called ‘MORPH_DATA.CSV.’ Using the template project for the book examples, run through the following steps in your script:</p> <ul> <li><p>Read the data into an R data frame, assigning it the name <code>morph_data</code>.</p></li> <li><p>Use functions like <code>glimpse</code> / <code>str</code> to inspect <code>morph_data</code>.</p></li> <li><p>Use the <code>View</code> function to inspect the data with RStudio.</p></li> </ul> <p>Make sure you can answer the following questions:</p> <ul> <li><p>How many observations are in the data set?</p></li> <li><p>How many variables are in the data set? What are their names?</p></li> <li><p>What kind of variables are they?</p></li> <li><p>What values do the different variables take?</p></li> </ul> <p>The point of all this is to check that we understand our data. <strong>Always examine a dataset after reading it into R</strong>. If we don’t understand how our data is organised and what variables we are working with we are bound to make otherwise avoidable mistakes.</p> <p>What you should have found is that <code>morph_data</code> contains 250 rows and two columns/variables: <code>Colour</code> and <code>Weight</code>. <code>Colour</code> is a categorical variable and <code>Weight</code> is a numeric variable. The <code>Colour</code> variable contains the colour of each plant in the sample.</p> <p>What is that <code>Weight</code> variable all about? Actually… we don’t need this now—we’ll use it in the next chapter.</p> </div> <div id="<API key>" class="section level4 unnumbered"> <h4>Running the bootstrap</h4> <p>Now that we understand the data we’re ready to implement bootstrapping. We are going to use a few R programming tricks that you may not have come across before. We’ll explain these as we go but there’s really no need to learn them. Focus on the ‘why’—the logic of what we’re doing—rather than the ‘how.’</p> <p>We want to construct an approximate sampling distribution for the frequency of purple morphs. That means the variable that matters is <code>Colour</code>. Rather than work with this inside the <code>morph_data</code> data frame, we’re going to pull it out using the <code>$</code> operator and assign it a name (<code>plant_morphs</code>):</p> <div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb9-1"><a href="<API key>.html#cb9-1" aria-hidden="true" tabindex="-1"></a><span class="co"># pull out the &#39;Colour&#39; variable</span></span> <span id="cb9-2"><a href="<API key>.html#cb9-2" aria-hidden="true" tabindex="-1"></a>plant_morphs <span class="ot">&lt;-</span> morph_data<span class="sc">$</span>Colour </span></code></pre></div> <p>Next, we’ll take a quick look at the values of <code>plant_morphs</code>:</p> <div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb10-1"><a href="<API key>.html#cb10-1" aria-hidden="true" tabindex="-1"></a><span class="co"># what is the set of values &#39;plant_morphs&#39; can take?</span></span> <span id="cb10-2"><a href="<API key>.html#cb10-2" aria-hidden="true" tabindex="-1"></a><span class="fu">unique</span>(plant_morphs)</span></code></pre></div> <pre><code>## [1] &quot;Green&quot; &quot;Purple&quot;</code></pre> <div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb12-1"><a href="<API key>.html#cb12-1" aria-hidden="true" tabindex="-1"></a><span class="co"># show the first 100 values</span></span> <span id="cb12-2"><a href="<API key>.html#cb12-2" aria-hidden="true" tabindex="-1"></a><span class="fu">head</span>(plant_morphs, <span class="dv">50</span>) </span></code></pre></div> <pre><code>## [1] &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; ## [9] &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; ## [17] &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; ## [25] &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; ## [33] &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; ## [41] &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; ## [49] &quot;Green&quot; &quot;Green&quot;</code></pre> <p>The last line printed out the first 50 values of <code>plant_morphs</code>. This shows that <code>plant_morphs</code> is a simple character vector with two categories describing the plant colour morph information.</p> <p>Next, we calculate and store the sample size (<code>samp_size</code>) and the point estimate of purple morph frequency (<code>mean_point_est</code>) from the sample:</p> <div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb14-1"><a href="<API key>.html#cb14-1" aria-hidden="true" tabindex="-1"></a><span class="co"># get the sample size form the length of &#39;plant_morphs&#39;</span></span> <span id="cb14-2"><a href="<API key>.html#cb14-2" aria-hidden="true" tabindex="-1"></a>samp_size <span class="ot">&lt;-</span> <span class="fu">length</span>(plant_morphs)</span> <span id="cb14-3"><a href="<API key>.html#cb14-3" aria-hidden="true" tabindex="-1"></a>samp_size</span></code></pre></div> <pre><code>## [1] 250</code></pre> <div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb16-1"><a href="<API key>.html#cb16-1" aria-hidden="true" tabindex="-1"></a><span class="co"># estimate the frequency of purple plants as a %</span></span> <span id="cb16-2"><a href="<API key>.html#cb16-2" aria-hidden="true" tabindex="-1"></a>mean_point_est <span class="ot">&lt;-</span> <span class="dv">100</span> <span class="sc">*</span> <span class="fu">sum</span>(plant_morphs <span class="sc">==</span> <span class="st">&quot;Purple&quot;</span>) <span class="sc">/</span> samp_size</span> <span id="cb16-3"><a href="<API key>.html#cb16-3" aria-hidden="true" tabindex="-1"></a>mean_point_est</span></code></pre></div> <pre><code>## [1] 30.8</code></pre> <p>The code in the point estimate calculation says “add up all the cases where <code>plant_morphs</code> is equal to ‘purple,’ divide that total by the sample size to get the proportion of purple plants in the sample, then multiply th eproprtion by 100 to turn it into a percentage.” So… we find that 30.8% of plants were purple among our sample of 250 plants.</p> <p>Now we’re ready to start bootstrapping. For convenience, we’ll store the number of bootstrapped samples we want in <code>n_samp</code> (i.e. 10000 in this case):</p> <div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb18-1"><a href="<API key>.html#cb18-1" aria-hidden="true" tabindex="-1"></a><span class="co"># number of bootstrapped samples we want</span></span> <span id="cb18-2"><a href="<API key>.html#cb18-2" aria-hidden="true" tabindex="-1"></a>n_samp <span class="ot">&lt;-</span> <span class="dv">10000</span></span></code></pre></div> <p>Next we need to work out how to resample the values in the <code>plant_morphs</code> vector. The <code>sample</code> function can do this for us:</p> <div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb19-1"><a href="<API key>.html#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="co"># resample the plant colours</span></span> <span id="cb19-2"><a href="<API key>.html#cb19-2" aria-hidden="true" tabindex="-1"></a>samp <span class="ot">&lt;-</span> <span class="fu">sample</span>(plant_morphs, <span class="at">replace =</span> <span class="cn">TRUE</span>)</span> <span id="cb19-3"><a href="<API key>.html#cb19-3" aria-hidden="true" tabindex="-1"></a><span class="co"># show the first 50 values of the bootstrapped sample</span></span> <span id="cb19-4"><a href="<API key>.html#cb19-4" aria-hidden="true" tabindex="-1"></a><span class="fu">head</span>(samp, <span class="dv">50</span>) </span></code></pre></div> <pre><code>## [1] &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; ## [9] &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; ## [17] &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; ## [25] &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Purple&quot; ## [33] &quot;Green&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; ## [41] &quot;Purple&quot; &quot;Purple&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; &quot;Purple&quot; &quot;Green&quot; &quot;Green&quot; ## [49] &quot;Purple&quot; &quot;Green&quot;</code></pre> <p>The <code>replace = TRUE</code> ensures that we sample with replacement—this is the ‘putting the bits of paper back in the hat’ part of the process.</p> <p>The new <code>samp</code> variable now contains exactly one bootstrapped sample of th 250 plants in the real sample. We only need to extract one number from this—the frequency of purple morphs:</p> <div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb21-1"><a href="<API key>.html#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="co"># calculate the purple morph frequencyin the bootstrapped sample</span></span> <span id="cb21-2"><a href="<API key>.html#cb21-2" aria-hidden="true" tabindex="-1"></a>first_bs_freq <span class="ot">&lt;-</span> <span class="dv">100</span> <span class="sc">*</span> <span class="fu">sum</span>(samp <span class="sc">==</span> <span class="st">&quot;Purple&quot;</span>) <span class="sc">/</span> samp_size</span></code></pre></div> <p>That’s one bootstrapped value of the purple morph frequency. Fine, but we need <span class="math inline">\(10^{4}\)</span> values. We don’t want to have to keep doing this over an over ‘by hand’—making <code>second_bs_freq</code>, <code>third_bs_freq</code>, and so on—because this would be very slow and boring to do.</p> <p>As we said earlier, computers are very good at carrying out repetitive tasks. The <code>replicate</code> function can replicate any R code many times and return the set of results. Here is some R code that repeats what we just did <code>n_samp</code> times, storing the resulting bootstrapped values of purple morph frequency in a numeric vector called <code>boot_out</code>:</p> <div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb22-1"><a href="<API key>.html#cb22-1" aria-hidden="true" tabindex="-1"></a>boot_out <span class="ot">&lt;-</span> <span class="fu">replicate</span>(n_samp, {</span> <span id="cb22-2"><a href="<API key>.html#cb22-2" aria-hidden="true" tabindex="-1"></a> samp <span class="ot">&lt;-</span> <span class="fu">sample</span>(plant_morphs, <span class="at">replace =</span> <span class="cn">TRUE</span>)</span> <span id="cb22-3"><a href="<API key>.html#cb22-3" aria-hidden="true" tabindex="-1"></a> <span class="dv">100</span> <span class="sc">*</span> <span class="fu">sum</span>(samp <span class="sc">==</span> <span class="st">&quot;Purple&quot;</span>) <span class="sc">/</span> samp_size</span> <span id="cb22-4"><a href="<API key>.html#cb22-4" aria-hidden="true" tabindex="-1"></a>})</span></code></pre></div> <p>The <code>boot_out</code> vector now contains a bootstrapped sample of frequency estimates. Here are the first 30 values rounded to 1 decimal place:</p> <div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb23-1"><a href="<API key>.html#cb23-1" aria-hidden="true" tabindex="-1"></a><span class="fu">head</span>(boot_out, <span class="dv">30</span>) <span class="sc">%&gt;%</span> <span class="fu">round</span>(<span class="dv">1</span>)</span></code></pre></div> <pre><code>## [1] 31.6 24.0 26.8 29.2 32.8 26.4 34.4 27.6 33.2 32.8 33.6 26.0 34.0 29.6 29.6 ## [16] 31.2 29.6 30.4 29.6 27.2 30.8 28.8 29.6 30.4 32.8 30.0 31.6 35.6 34.4 32.0</code></pre> <p>(We used the pipe <code>%&gt;%</code> to make a code a bit more readable—remember, this won’t work unless the <strong>dplyr</strong> package is loaded.)</p> </div> <div id="<API key>" class="section level4 unnumbered"> <h4>Making sense of the bootstrapped sample</h4> <p>What has all this achieved? The numbers in <code>boot_out</code> represent the values of purple morph frequency we can expect to find if we repeated the data collection exercise many times, under the assumption that the purple morph frequency is equal to that of the actual sample. This is a bootstrapped sampling distribution!</p> <p>We can use this bootstrapped sampling distribution in a number of ways. Let’s plot it first get a sense of what it looks like. A histogram is OK here because we have a reasonably large number of possible cases:</p> <div class="figure" style="text-align: center"><span id="fig:boot-samp-dist"></span> <img src="stats-for-bio_files/figure-html/boot-samp-dist-1.png" alt="Bootstrapped sampling distribution of purple morph frequency" width="75%" /> <p class="caption"> Figure 8.1: Bootstrapped sampling distribution of purple morph frequency </p> </div> <p>What the most common values in our bootstrapped sample? The centre of the distribution looks to be round about 30%. We can be a bit more precise by calculating its mean:</p> <div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb25-1"><a href="<API key>.html#cb25-1" aria-hidden="true" tabindex="-1"></a><span class="fu">mean</span>(boot_out) <span class="sc">%&gt;%</span> <span class="fu">round</span>(<span class="dv">1</span>)</span></code></pre></div> <pre><code>## [1] 30.8</code></pre> <p>This is essentially the same as the point estimate of purple morph frequency from the true sample. In fact, it is guaranteed to be the same if we construct a large enough sample because we’re just resampling the data used to estimate that frequency.</p> <p>A more useful quantity is the standard error (SE) of our estimate. This is <em>defined</em> as being the standard deviation of the sampling distribution. We can calculate that by applying the <code>sd</code> function to the bootstrapped sample:</p> <div class="sourceCode" id="cb27"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb27-1"><a href="<API key>.html#cb27-1" aria-hidden="true" tabindex="-1"></a><span class="fu">sd</span>(boot_out) <span class="sc">%&gt;%</span> <span class="fu">round</span>(<span class="dv">1</span>)</span></code></pre></div> <pre><code>## [1] 2.9</code></pre> <p>The standard error is a very useful quantity. Remember, it is a measure of the precision of an estimate. For example, a large SE implies that our sample size was too small to reliably estimate the population mean; a small SE means we have a reliable estimate. Once we have the point estimate of a population parameter its standard error we’re able to start asking questions like, “is the true value likely to be different from 25%.”</p> <p>It is standard practice include the standard error when we report a point estimate of some quantity. Whenever we report a point estimate, we really should also report its standard error, like this:</p> <blockquote> <p>The frequency of purple morph plants (n = 250) was 30.8% (s.e. ± 2.9).</p> </blockquote> <p>Notice we also report the sample size. More on that later in the book.</p> </div> </div> </div> <div id="<API key>" class="section level2" number="8.2"> <h2><span class="<API key>">8.2</span> Statistical significance</h2> <p>Now back to the question that motivated all the work in the last few chapters. Is the purple morph frequency greater than 25% in the new study population? The first thing to realise is that we can never answer a question like this definitively from a sample. We have to carry out some kind of probabilistic assessment instead. To make this assessment, we’re going to do something that looks odd at first glance.</p> <div class="do-something"> <p> <strong>Don’t panic! This stuff is hard.</strong> </p> <p> The ideas in this next section are very abstract and you may not understand them straight away. That’s fine. Don’t worry—these ideas take time to absorb and understand. </p> </div> <div id="<API key>" class="section level3 unnumbered"> <h3>Carrying out the assessment</h3> <p>We need to make two assumptions to arrive at our probabilistic assessment of whether or not the purple morph frequency greater than 25%:</p> <ol style="list-style-type: decimal"> <li><p>Assume the true value of the purple morph frequency in our new study population is 25%, i.e. we’ll assume the population parameter of interest is the same as that of the original population that motivated this work. In effect, we’re pretending there is really no difference between the populations.</p></li> <li><p>Assume that the form of sampling distribution that we just generated would have been the same if the ‘equal population’ hypothesis were true. That is, the expected ‘shape’ of the sampling distribution would not change if the purple morph frequency really was 25%.</p></li> </ol> <p>That first assumption is an example of a <strong>null hypothesis</strong>. The null hypothesis is an hypothesis of ‘no effect’ or ‘no difference.’ We’re going to revisit this idea many times in future chapters.</p> <p>The second assumption is necessary for the reasoning below to work. In fact, this can be shown to be a pretty reasonable assumption in many situations. We don’t want to get lost in the details though so you will have to trust us on this one.</p> <p>Now we ask a question: if the purple morph frequency in the population really is 25%, what would its corresponding sampling distribution look like? This is called the <strong>null distribution</strong>—the distribution expected under the null hypothesis.</p> <p>If the second assumption is valid, we can actually construct the null distribution from our bootstrapped distribution as follows:</p> <div class="sourceCode" id="cb29"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb29-1"><a href="<API key>.html#cb29-1" aria-hidden="true" tabindex="-1"></a>null_dist <span class="ot">&lt;-</span> boot_out <span class="sc">-</span> <span class="fu">mean</span>(boot_out) <span class="sc">+</span> <span class="dv">25</span></span></code></pre></div> <p>All we did here was shift the bootstrapped sampling distribution along until the mean is at 25%. Here’s what that null distribution looks like, along with the original observed estimate of the purple morph frequency:</p> <div class="figure" style="text-align: center"><span id="fig:boot-samp-dist-25"></span> <img src="stats-for-bio_files/figure-html/boot-samp-dist-25-1.png" alt="Sampling distribution of purple morph frequency under the null hypothesis" width="75%" /> <p class="caption"> Figure 8.2: Sampling distribution of purple morph frequency under the null hypothesis </p> </div> <p>The red line shows where the point estimate from the true sample lies. What does this tells us? It looks like the observed purple morph frequency would be quite unlikely to have arisen through sampling variation if the population frequency really was 25%. We can say this because the observed frequency (red line) lies at the end of one ‘tail’ of the sampling distribution over on the right.</p> <p>We need to be able to make a more precise statement than this though. Instead of ‘eyeballing’ the distribution, we can quantify how often the values of the bootstrapped null distribution ended up greater than the observed estimate:</p> <div class="sourceCode" id="cb30"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb30-1"><a href="<API key>.html#cb30-1" aria-hidden="true" tabindex="-1"></a>p_value <span class="ot">&lt;-</span> <span class="fu">sum</span>(null_dist <span class="sc">&gt;</span> mean_point_est) <span class="sc">/</span> n_samp</span> <span id="cb30-2"><a href="<API key>.html#cb30-2" aria-hidden="true" tabindex="-1"></a>p_value</span></code></pre></div> <pre><code>## [1] 0.0246</code></pre> <p>This number (generally denoted ‘<em>p</em>’) is called a <strong><em>p</em>-value</strong>.</p> </div> <div id="<API key>" class="section level3 unnumbered"> <h3>Interpreting the p-value</h3> <p>What are we supposed to do with the finding <em>p</em> = 0.0246? This is the probability of obtaining a result equal to, or ‘more extreme,’ than that which was actually observed, <em>assuming that the hypothesis under consideration (the null hypothesis) is true</em>. The null hypothesis is one of no effect (or no difference), and so a low <em>p</em>-value can be interpreted as evidence for an effect being present. It’s worth reading that a few times…</p> <p>In our example, it appears that the purple morph frequency we observed is fairly unlikely to occur if its frequency in the new population really was 25%. In biological terms, we take the low <em>p</em>-value as evidence for a difference in purple morph frequency among the populations, i.e. the data supports the prediction that the purple morph is present at a frequency greater than 25% in the new study population.</p> <p>One important question remains: How small does a <em>p</em>-value have to be before we are happy to conclude that the effect we’re interested in is probably present? In practice, we do this by applying a threshold, called a <strong>significance level</strong>. If the <em>p</em>-value is less than the chosen significance level we say the result is said to be <strong>statistically significant</strong>. Most often (in biology at least), we use a significance level of <em>p</em> &lt; 0.05 (5%).</p> <p>Why do we use a significance level of <em>p</em> &lt; 0.05? The short answer is that this is just a convention. Nothing more. There is nothing special about the 5% threshold, other than the fact that it’s the one most often used. Statistical significance has nothing to do with biological significance. Unfortunately, many people are very uncritical about the use of this arbitrary threshold, to the extent that it can be very hard to publish a scientific study if it doesn’t contain ‘statistically significant’ results.</p> </div> </div> <div id="concluding-remarks" class="section level2" number="8.3"> <h2><span class="<API key>">8.3</span> Concluding remarks</h2> <p>We just carried out a type of statistical test called a <strong>significance test</strong>. It was a bit convoluted reasoning, but the chain of reasoning we just employed underlies all the significance tests we use in this book. The precise details of how to construct such tests will vary from one problem to the next, but ultimately, when using frequentist ideas we always…</p> <ol style="list-style-type: decimal"> <li><p>assume that there is actually no ‘effect’ (the <strong>null hypothesis</strong>), where an effect is expressed in terms of one or more population parameters,</p></li> <li><p>construct the corresponding <strong>null distribution</strong> of the estimated parameter by working out what would happen if we were to take frequent samples in the ‘no effect’ situation,</p></li> </ol> <p>(This is why the word ‘frequentist’ is used to describe this flavour of statistics.)</p> <ol start="3" style="list-style-type: decimal"> <li>then compare the estimated population parameter to the null distribution to arrive at a <strong><em>p</em>-value</strong>, which evaluates how frequently the result, or a more extreme result, would be observed under the hypothesis of no effect.</li> </ol> <p>We used the bootstrap to operationalise that process for our example. Bootstrapping is certainly a useful tool but it is also quite an advanced technique that can be difficult to apply in many settings. We won’t use it any more—the bootstrap was introduced here to demonstrate how frequentist reasoning works.</p> <p>We will focus on simple, ‘off-the-shelf’ statistical tools in this book. The good news is we don’t need to understand the low-level details to use these tools effectively. As long as we’re able to identify the null hypothesis and understand how to interpret the associated <em>p</em>-values we should be in a good position to apply them. These two ideas—null hypotheses and <em>p</em>-values—are so important, we’re going consider them in much greater detail over the next two chapters.</p> </div> </div> </section> </div> </div> </div> <a href="sampling-error.html" class="navigation navigation-prev " aria-label="Previous page"><i class="fa fa-angle-left"></i></a> <a href="<API key>.html" class="navigation navigation-next " aria-label="Next page"><i class="fa fa-angle-right"></i></a> </div> </div> <script src="libs/gitbook-2.6.7/js/app.min.js"></script> <script src="libs/gitbook-2.6.7/js/lunr.js"></script> <script src="libs/gitbook-2.6.7/js/clipboard.min.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-search.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-sharing.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-fontsettings.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-bookdown.js"></script> <script src="libs/gitbook-2.6.7/js/jquery.highlight.js"></script> <script src="libs/gitbook-2.6.7/js/plugin-clipboard.js"></script> <script> gitbook.require(["gitbook"], function(gitbook) { gitbook.start({ "sharing": { "github": false, "facebook": true, "twitter": true, "linkedin": false, "weibo": false, "instapaper": false, "vk": false, "all": ["facebook", "twitter", "linkedin", "weibo", "instapaper"] }, "fontsettings": { "theme": "white", "family": "sans", "size": 2 }, "edit": { "link": "https://github.com/dzchilds/stats-for-bio/edit/master/<API key>.Rmd", "text": "Edit" }, "history": { "link": null, "text": null }, "view": { "link": null, "text": null }, "download": null, "toc": { "collapse": "section" }, "split_by": "section" }); }); </script> <!-- dynamically load mathjax for compatibility with self-contained --> <script> (function () { var script = document.createElement("script"); script.type = "text/javascript"; var src = "true"; if (src === "" || src === "true") src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML"; if (location.protocol !== "file:") if (/^https?:/.test(src)) src = src.replace(/^https?:/, ''); script.src = src; document.<API key>("head")[0].appendChild(script); })(); </script> </body> </html>
// npm var chalk = require('chalk') // local var Copper = require('../copper') var copper = new Copper var util = require('../util') module.exports = function (config, wallet, keys, args) { var abort = false var name if (args._.length > 0) { name = args._.join(' ') } var key = copper.newKey() console.log(' pub:', chalk.green(key.pub)) console.log('priv:', chalk.blue(key.priv)) var wkey = {pub: key.pub, priv: key.priv, date: new Date()} if (name) { var keynames = wallet.keys.map(function (k) {return k.name}) if (keynames.indexOf(name) > -1) { console.log('abort!', chalk.red('key named', name, 'already exists')) abort = true } else { wkey.name = name console.log('name:', JSON.stringify(wkey.name)) } } if (!abort) { wallet.keys.push(wkey) util.saveJSON(config.wallet.file, wallet) } }
html, body{ height: 100%; overflow: hidden; } .present{ background-color: #00838F; } md-divider{ margin-top: 5px; } md-list{ padding: 0px; } #listInfo{ color: white; background-color: #263238; } #logo_placeholder{ border-radius: 100%; background-color: #455A64; width:200px; height:200px; margin-bottom: 16px; line-height: 200px; text-align: center; vertical-align: middle; } .md-button:not(.md-fab) { min-width: 10em; } .centerH{ margin: auto; text-align: center; } .active{ background-color: #00838F; }
package com.ibm.ws.jpa.tests.spec10.entity; import org.junit.ClassRule; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; import com.ibm.ws.jpa.tests.spec10.entity.tests.AbstractFATSuite; import com.ibm.ws.jpa.tests.spec10.entity.tests.Entity_EJB; import com.ibm.ws.jpa.tests.spec10.entity.tests.Entity_Web; import componenttest.rules.repeater.<API key>; import componenttest.rules.repeater.RepeatTests; @RunWith(Suite.class) @SuiteClasses({ Entity_EJB.class, Entity_Web.class, componenttest.custom.junit.runner.AlwaysPassesTest.class }) public class FATSuite extends AbstractFATSuite { @ClassRule public static RepeatTests r = RepeatTests.with(<API key>.EE9_FEATURES()); }
<!DOCTYPE HTML PUBLIC "- <!--NewPage <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_18) on Fri Dec 23 08:32:56 PST 2011 --> <TITLE> SerialBTDevice.<API key> </TITLE> <META NAME="date" CONTENT="2011-12-23"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="SerialBTDevice.<API key>"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <A NAME="navbar_top"></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SerialBTDevice.<API key>.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../com/t2/biofeedback/device/SerialBTDevice.<API key>.html" title="class in com.t2.biofeedback.device"><B>PREV CLASS</B></A>&nbsp; &nbsp;NEXT CLASS</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/t2/biofeedback/device/SerialBTDevice.<API key>.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="SerialBTDevice.<API key>.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#<API key>.lang.Throwable">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;METHOD</FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <HR> <H2> <FONT SIZE="-1"> com.t2.biofeedback.device</FONT> <BR> Class SerialBTDevice.<API key></H2> <PRE> java.lang.Object <IMG SRC="../../../../resources/inherit.gif" ALT="extended by ">java.lang.Throwable <IMG SRC="../../../../resources/inherit.gif" ALT="extended by ">java.lang.Exception <IMG SRC="../../../../resources/inherit.gif" ALT="extended by ">java.lang.RuntimeException <IMG SRC="../../../../resources/inherit.gif" ALT="extended by "><B>com.t2.biofeedback.device.SerialBTDevice.<API key></B> </PRE> <DL> <DT><B>All Implemented Interfaces:</B> <DD>java.io.Serializable</DD> </DL> <DL> <DT><B>Enclosing class:</B><DD><A HREF="../../../../com/t2/biofeedback/device/SerialBTDevice.html" title="class in com.t2.biofeedback.device">SerialBTDevice</A></DD> </DL> <HR> <DL> <DT><PRE>public class <B>SerialBTDevice.<API key></B><DT>extends java.lang.RuntimeException</DL> </PRE> <P> <DL> <DT><B>See Also:</B><DD><A HREF="../../../../serialized-form.html#com.t2.biofeedback.device.SerialBTDevice.<API key>">Serialized Form</A></DL> <HR> <P> <A NAME="constructor_summary"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Constructor Summary</B></FONT></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><B><A HREF="../../../../com/t2/biofeedback/device/SerialBTDevice.<API key>.html#SerialBTDevice.<API key>(java.lang.String)">SerialBTDevice.<API key></A></B>(java.lang.String&nbsp;msg)</CODE> <BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD> </TR> </TABLE> &nbsp; <A NAME="method_summary"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2"> <B>Method Summary</B></FONT></TH> </TR> </TABLE> &nbsp;<A NAME="<API key>.lang.Throwable"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="<API key>"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Throwable</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString</CODE></TD> </TR> </TABLE> &nbsp;<A NAME="<API key>.lang.Object"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#EEEEFF" CLASS="<API key>"> <TH ALIGN="left"><B>Methods inherited from class java.lang.Object</B></TH> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</CODE></TD> </TR> </TABLE> &nbsp; <P> <A NAME="constructor_detail"></A> <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"> <B>Constructor Detail</B></FONT></TH> </TR> </TABLE> <A NAME="SerialBTDevice.<API key>(java.lang.String)"></A><H3> SerialBTDevice.<API key></H3> <PRE> public <B>SerialBTDevice.<API key></B>(java.lang.String&nbsp;msg)</PRE> <DL> </DL> <HR> <A NAME="navbar_bottom"></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="<API key>"></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/SerialBTDevice.<API key>.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="../../../../com/t2/biofeedback/device/SerialBTDevice.<API key>.html" title="class in com.t2.biofeedback.device"><B>PREV CLASS</B></A>&nbsp; &nbsp;NEXT CLASS</FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../index.html?com/t2/biofeedback/device/SerialBTDevice.<API key>.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="SerialBTDevice.<API key>.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <! if(window==top) { document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>'); } </SCRIPT> <NOSCRIPT> <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#<API key>.lang.Throwable">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;METHOD</FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <HR> </BODY> </HTML>
package org.opendaylight.controller.config.manager.testingservices.parallelapsp; import javax.management.ObjectName; import org.opendaylight.controller.config.api.annotations.<API key>; @<API key>(value = <API key>.NAME, <API key> = TestingAPSP.class) public interface <API key> { static final String NAME = "apsp"; ObjectName getThreadPool(); void setThreadPool(ObjectName threadPoolName); String getSomeParam(); void setSomeParam(String s); // for reporting. this should be moved to runtime jmx bean Integer <API key>(); }
package biz.netcentric.cq.tools.actool.configreader; import java.util.Map; import biz.netcentric.cq.tools.actool.configmodel.AceBean; import biz.netcentric.cq.tools.actool.configmodel.<API key>; import biz.netcentric.cq.tools.actool.validators.exceptions.<API key>; /** Subclass of YamlConfigReader only used for unit tests. Overrides bean setup-methods from YamlConfigReader to set up TestAceBean and * Test<API key> in order to set the <API key> set in test yaml files for later evaluation in unit tests. Also * overrides getNewAceBean() and getNew<API key>() to return the correct testing type in order to make the downcast in * overridden setup-methods possible. * * @author jochenkoschorke */ public class <API key> extends YamlConfigReader { protected final String ASSERTED_EXCEPTION = "assertedException"; @Override protected void setupAceBean(final String principal, final Map<String, ?> <API key>, final AceBean tmpAclBean, String sourceFile) { super.setupAceBean(principal, <API key>, tmpAclBean, sourceFile); ((TestAceBean) tmpAclBean).<API key>(getMapValueAsString( <API key>, ASSERTED_EXCEPTION)); } @Override protected void <API key>( final <API key> <API key>, final Map<String, Object> <API key>, final String authorizableId, boolean isGroupSection) throws <API key> { super.<API key>(<API key>, <API key>, authorizableId, isGroupSection); ((Test<API key>) <API key>).<API key>(getMapValueAsString( <API key>, ASSERTED_EXCEPTION)); } @Override protected AceBean getNewAceBean() { return new TestAceBean(); } @Override protected <API key> getNew<API key>() { return new Test<API key>(); } }
using System; using System.Web; namespace FineUI.Examples { public class getContent : IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; string content = context.Server.HtmlEncode(context.Request.Form["myEditor"]); string content1 = context.Server.HtmlEncode(context.Request.Form["myEditor1"]); context.Response.Write("<script src='../uparse.js' type='text/javascript'></script>"); context.Response.Write( "<script>uParse('.content',{" + "'highlightJsUrl':'../third-party/SyntaxHighlighter/shCore.js'," + "'highlightCssUrl':'../third-party/SyntaxHighlighter/shCoreDefault.css'" + "})" + "</script>"); context.Response.Write("1"); context.Response.Write("<div class='content'>" + context.Server.HtmlDecode(content) + "</div>"); context.Response.Write("<br/>2<br/>"); context.Response.Write("<textarea class='content' style='width:500px;height:300px;'>" + context.Server.HtmlDecode(content1) + "</textarea><br/>"); } public bool IsReusable { get { return false; } } } }
package com.mmkarton.mx7.reportgenerator.sqledit; import java.sql.Types; import java.text.Bidi; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.datatools.connectivity.oda.IParameterMetaData; import org.eclipse.datatools.connectivity.oda.IResultSetMetaData; import org.eclipse.datatools.connectivity.oda.OdaException; import org.eclipse.datatools.connectivity.oda.design.DataSetParameters; import org.eclipse.datatools.connectivity.oda.design.DesignFactory; import org.eclipse.datatools.connectivity.oda.design.ParameterDefinition; import org.eclipse.datatools.connectivity.oda.design.ParameterMode; import org.eclipse.datatools.connectivity.oda.design.ResultSetColumns; import org.eclipse.datatools.connectivity.oda.design.ResultSetDefinition; import org.eclipse.datatools.connectivity.oda.design.ui.designsession.DesignSessionUtil; import com.mmkarton.mx7.reportgenerator.engine.SQLQuery; import com.mmkarton.mx7.reportgenerator.jdbc.ResultSetMetaData; import com.mmkarton.mx7.reportgenerator.wizards.BIRTReportWizard; /** * The utility class for <API key> * */ public class SQLUtility { /** * save the dataset design's metadata info * * @param design */ public static SQLQuery getBIRTSQLFields(String sqlQueryText) { MetaDataRetriever retriever = new MetaDataRetriever( addDummyWhere(sqlQueryText)); IResultSetMetaData resultsetMeta = retriever.<API key>( ); IParameterMetaData paramMeta = retriever.<API key>( ); return saveDataSetDesign( resultsetMeta, paramMeta ,sqlQueryText); } public static SQLQuery saveDataSetDesign( IResultSetMetaData meta, IParameterMetaData paramMeta, String sqlQueryText ) { try { <API key>( paramMeta ); // set resultset metadata return <API key>(meta, sqlQueryText ); } catch ( OdaException e ) { return null; } } /** * Set parameter metadata in dataset design * * @param design * @param query */ private static void <API key>(IParameterMetaData paramMeta ) { try { // set parameter metadata <API key>( paramMeta ); } catch ( OdaException e ) { // do nothing, to keep the parameter definition in dataset design // dataSetDesign.setParameters( null ); } } /** * solve the BIDI line problem * @param lineText * @return */ public static int[] getBidiLineSegments( String lineText ) { int[] seg = null; if ( lineText != null && lineText.length( ) > 0 && !new Bidi( lineText, Bidi.<API key> ).isLeftToRight( ) ) { List list = new ArrayList( ); // Punctuations will be regarded as delimiter so that different // splits could be rendered separately. Object[] splits = lineText.split( "\\p{Punct}" ); // !=, <> etc. leading to "" will be filtered to meet the rule that // segments must not have duplicates. for ( int i = 0; i < splits.length; i++ ) { if ( !splits[i].equals( "" ) ) list.add( splits[i] ); } splits = list.toArray( ); // first segment must be 0 // last segment does not necessarily equal to line length seg = new int[splits.length + 1]; for ( int i = 0; i < splits.length; i++ ) { seg[i + 1] = lineText.indexOf( (String) splits[i], seg[i] ) + ( (String) splits[i] ).length( ); } } return seg; } /** * Return pre-defined query text pattern with every element in a cell. * * @return pre-defined query text */ public static String <API key>( String extensionId ) { String[] lines = <API key>( extensionId ); String result = ""; if ( lines != null && lines.length > 0 ) { for ( int i = 0; i < lines.length; i++ ) { result = result + lines[i] + ( i == lines.length - 1 ? " " : " \n" ); } } return result; } /** * Return pre-defined query text pattern with every element in a cell in an * Array * * @return pre-defined query text in an Array */ public static String[] <API key>( String extensionId ) { final String[] lines; if ( extensionId.equals( "org.eclipse.birt.report.data.oda.jdbc.SPSelectDataSet" ) ) lines = new String[]{ "{call procedure-name(arg1,arg2, ...)}" }; else lines = new String[]{ "select", "from" }; return lines; } /** * merge paramter meta data between dataParameter and datasetDesign's * parameter. * * @param dataSetDesign * @param md * @throws OdaException */ private static void <API key>( IParameterMetaData md ) throws OdaException { if ( md == null) return; DataSetParameters dataSetParameter = DesignSessionUtil.<API key>( md, ParameterMode.IN_LITERAL ); if ( dataSetParameter != null ) { Iterator iter = dataSetParameter.<API key>( ) .iterator( ); while ( iter.hasNext( ) ) { ParameterDefinition defn = (ParameterDefinition) iter.next( ); proccessParamDefn( defn, dataSetParameter ); } } //dataSetDesign.setParameters( dataSetParameter ); } /** * Process the parameter definition for some special case * * @param defn * @param parameters */ private static void proccessParamDefn( ParameterDefinition defn, DataSetParameters parameters ) { if ( defn.getAttributes( ).<API key>( ) == Types.NULL ) { defn.getAttributes( ).<API key>( Types.CHAR ); } } /** * Set the resultset metadata in dataset design * * @param dataSetDesign * @param md * @throws OdaException */ private static SQLQuery <API key>(IResultSetMetaData md, String sqlQueryText ) throws OdaException { SQLQuery query=null; ResultSetColumns columns = DesignSessionUtil.<API key>( md ); if ( columns != null ) { query=new SQLQuery(); ResultSetDefinition resultSetDefn = DesignFactory.eINSTANCE.<API key>( ); resultSetDefn.setResultSetColumns( columns ); int count=resultSetDefn.getResultSetColumns().<API key>().size(); query.setSqlQueryString(sqlQueryText); for (int i = 0; i < count; i++) { int columntype=-1; String columname=""; try { ResultSetMetaData dataset=(ResultSetMetaData)md; columname=dataset.getColumnName(i+1); columntype=dataset.getColumnType(i+1); } catch (Exception e) { return null; } query.setFields(columname, columntype); } } return query; } private static String addDummyWhere(String sqlQueryText) { if (sqlQueryText==null) { return null; } String tempsql = sqlQueryText.toUpperCase(); String sql_query=""; int where_pos = tempsql.toUpperCase().indexOf("WHERE"); if (where_pos > 0) { sql_query = tempsql.substring(0,where_pos ); } else { sql_query = tempsql; } return sql_query+" Where 1=2"; } }
package hu.eltesoft.modelexecution.m2t.smap.emf; import java.io.Serializable; import java.util.HashMap; import java.util.Map; import java.util.Vector; /** * Maps qualified EMF object references to virtual line numbers. Line numbering * starts from one, and incremented by one when a new reference inserted. */ class <API key> implements Serializable { private static final long serialVersionUID = 303577619348585564L; private final Vector<QualifiedReference> <API key> = new Vector<>(); private final Map<QualifiedReference, Integer> <API key> = new HashMap<>(); public int addLineNumber(QualifiedReference reference) { Integer result = toLineNumber(reference); if (null != result) { return result; } <API key>.add(reference); int lineNumber = <API key>.size(); <API key>.put(reference, lineNumber); return lineNumber; } public Integer toLineNumber(QualifiedReference reference) { return <API key>.get(reference); } public QualifiedReference fromLineNumber(int lineNumber) { // Vectors are indexed from zero, while lines from one int index = lineNumber - 1; if (index < 0 || <API key>.size() <= index) { return null; } return <API key>.get(index); } @Override public String toString() { return <API key>.toString() + ";" + <API key>.toString(); } }
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _extends2 = require('babel-runtime/helpers/extends'); var _extends3 = <API key>(_extends2); var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); var _classCallCheck3 = <API key>(_classCallCheck2); var _createClass2 = require('babel-runtime/helpers/createClass'); var _createClass3 = <API key>(_createClass2); var <API key> = require('babel-runtime/helpers/<API key>'); var <API key> = <API key>(<API key>); var _inherits2 = require('babel-runtime/helpers/inherits'); var _inherits3 = <API key>(_inherits2); var _classnames = require('classnames'); var _classnames2 = <API key>(_classnames); var _react = require('react'); var _react2 = <API key>(_react); var _lib = require('../../lib'); function <API key>(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * A title sub-component for Accordion component */ var AccordionTitle = function (_Component) { (0, _inherits3.default)(AccordionTitle, _Component); function AccordionTitle() { var _ref; var _temp, _this, _ret; (0, _classCallCheck3.default)(this, AccordionTitle); for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _ret = (_temp = (_this = (0, <API key>.default)(this, (_ref = AccordionTitle.__proto__ || Object.getPrototypeOf(AccordionTitle)).call.apply(_ref, [this].concat(args))), _this), _this.handleClick = function (e) { var onClick = _this.props.onClick; if (onClick) onClick(e, _this.props); }, _temp), (0, <API key>.default)(_this, _ret); } (0, _createClass3.default)(AccordionTitle, [{ key: 'render', value: function render() { var _props = this.props, active = _props.active, children = _props.children, className = _props.className; var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(active, 'active'), 'title', className); var rest = (0, _lib.getUnhandledProps)(AccordionTitle, this.props); var ElementType = (0, _lib.getElementType)(AccordionTitle, this.props); return _react2.default.createElement( ElementType, (0, _extends3.default)({}, rest, { className: classes, onClick: this.handleClick }), children ); } }]); return AccordionTitle; }(_react.Component); AccordionTitle.displayName = 'AccordionTitle'; AccordionTitle._meta = { name: 'AccordionTitle', type: _lib.META.TYPES.MODULE, parent: 'Accordion' }; exports.default = AccordionTitle; process.env.NODE_ENV !== "production" ? AccordionTitle.propTypes = { /** An element type to render as (string or function). */ as: _lib.customPropTypes.as, /** Whether or not the title is in the open state. */ active: _react.PropTypes.bool, /** Primary content. */ children: _react.PropTypes.node, /** Additional classes. */ className: _react.PropTypes.string, /** * Called on blur. * * @param {SyntheticEvent} event - React's original SyntheticEvent. * @param {object} data - All props. */ onClick: _react.PropTypes.func } : void 0; AccordionTitle.handledProps = ['active', 'as', 'children', 'className', 'onClick'];
package org.jboss.windup.reporting.rules; import java.util.HashMap; import java.util.Map; import javax.inject.Inject; import org.jboss.forge.furnace.Furnace; import org.jboss.windup.config.<API key>; import org.jboss.windup.config.GraphRewrite; import org.jboss.windup.config.metadata.RuleMetadata; import org.jboss.windup.config.operation.GraphOperation; import org.jboss.windup.config.phase.<API key>; import org.jboss.windup.graph.GraphContext; import org.jboss.windup.graph.model.WindupVertexFrame; import org.jboss.windup.graph.service.GraphService; import org.jboss.windup.reporting.model.<API key>; import org.jboss.windup.reporting.model.TemplateType; import org.jboss.windup.reporting.model.<API key>; import org.jboss.windup.reporting.rules.<API key>; import org.jboss.windup.reporting.service.<API key>; import org.ocpsoft.rewrite.config.Configuration; import org.ocpsoft.rewrite.config.<API key>; import org.ocpsoft.rewrite.context.EvaluationContext; /** * This renders an application index page listing all applications analyzed by the current execution of windup. * * @author <a href="mailto:jesse.sightler@gmail.com">Jesse Sightler</a> */ @RuleMetadata(phase = <API key>.class, before = <API key>.class) public class <API key> extends <API key> { public static final String <API key> = "Application List"; private static final String OUTPUT_FILENAME = "../index.html"; public static final String TEMPLATE_PATH = "/reports/templates/application_list.ftl"; @Inject private Furnace furnace; // @formatter:off @Override public Configuration getConfiguration(GraphContext context) { return <API key>.begin() .addRule() .perform(new GraphOperation() { @Override public void perform(GraphRewrite event, EvaluationContext context) { createIndexReport(event.getGraphContext()); } }); } // @formatter:on private void createIndexReport(GraphContext context) { <API key> <API key> = new <API key>(context); <API key> report = <API key>.create(); report.setReportPriority(1); report.setReportIconClass("glyphicon glyphicon-home"); report.setReportName(<API key>); report.setTemplatePath(TEMPLATE_PATH); report.setTemplateType(TemplateType.FREEMARKER); report.<API key>(false); report.setReportFilename(OUTPUT_FILENAME); GraphService<<API key>> listService = new GraphService<>(context, <API key>.class); <API key><<API key>> applications = listService.create(); for (<API key> <API key> : <API key>.findAll()) { if (<API key>.<API key>() != null && <API key>.<API key>()) applications.addItem(<API key>); } Map<String, WindupVertexFrame> relatedData = new HashMap<>(); relatedData.put("applications", applications); report.setRelatedResource(relatedData); } }
package fr.obeo.dsl.game.provider; import fr.obeo.dsl.game.GameFactory; import fr.obeo.dsl.game.GamePackage; import fr.obeo.dsl.game.UI; import java.util.Collection; import java.util.List; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.util.ResourceLocator; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.provider.<API key>; import org.eclipse.emf.edit.provider.<API key>; import org.eclipse.emf.edit.provider.IItemLabelProvider; import org.eclipse.emf.edit.provider.<API key>; import org.eclipse.emf.edit.provider.IItemPropertySource; import org.eclipse.emf.edit.provider.<API key>; import org.eclipse.emf.edit.provider.<API key>; import org.eclipse.emf.edit.provider.<API key>; import org.eclipse.emf.edit.provider.ItemProviderAdapter; import org.eclipse.emf.edit.provider.ViewerNotification; /** * This is the item provider adapter for a {@link fr.obeo.dsl.game.UI} object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public class UIItemProvider extends ItemProviderAdapter implements <API key>, <API key>, <API key>, IItemLabelProvider, IItemPropertySource { /** * This constructs an instance from a factory and a notifier. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public UIItemProvider(AdapterFactory adapterFactory) { super(adapterFactory); } /** * This returns the property descriptors for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public List<<API key>> <API key>(Object object) { if (<API key> == null) { super.<API key>(object); <API key>(object); <API key>(object); } return <API key>; } /** * This adds a property descriptor for the Name feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void <API key>(Object object) { <API key>.add (<API key> (((<API key>)adapterFactory).<API key>(), getResourceLocator(), getString("<API key>"), getString("<API key>", "<API key>", "_UI_Scene_type"), GamePackage.Literals.SCENE__NAME, true, false, false, <API key>.GENERIC_VALUE_IMAGE, null, null)); } /** * This adds a property descriptor for the Follow feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected void <API key>(Object object) { <API key>.add (<API key> (((<API key>)adapterFactory).<API key>(), getResourceLocator(), getString("<API key>"), getString("<API key>", "<API key>", "_UI_Scene_type"), GamePackage.Literals.SCENE__FOLLOW, true, false, true, null, null, null)); } /** * This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an * {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or * {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Collection<? extends EStructuralFeature> getChildrenFeatures(Object object) { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures.add(GamePackage.Literals.UI__WIDGETS); } return childrenFeatures; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EStructuralFeature getChildFeature(Object object, Object child) { // Check the type of the specified child object and return the proper feature to use for // adding (see {@link AddCommand}) it as a child. return super.getChildFeature(object, child); } /** * This returns UI.gif. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object getImage(Object object) { return overlayImage(object, getResourceLocator().getImage("full/obj16/UI")); } /** * This returns the label text for the adapted class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String getText(Object object) { String label = ((UI)object).getName(); return label == null || label.length() == 0 ? getString("_UI_UI_type") : getString("_UI_UI_type") + " " + label; } /** * This handles model notifications by calling {@link #updateChildren} to update any cached * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void notifyChanged(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(UI.class)) { case GamePackage.UI__NAME: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; case GamePackage.UI__WIDGETS: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); } /** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected void <API key>(Collection<Object> newChildDescriptors, Object object) { super.<API key>(newChildDescriptors, object); newChildDescriptors.add (<API key> (GamePackage.Literals.UI__WIDGETS, GameFactory.eINSTANCE.createContainer())); newChildDescriptors.add (<API key> (GamePackage.Literals.UI__WIDGETS, GameFactory.eINSTANCE.createText())); newChildDescriptors.add (<API key> (GamePackage.Literals.UI__WIDGETS, GameFactory.eINSTANCE.createButton())); newChildDescriptors.add (<API key> (GamePackage.Literals.UI__WIDGETS, GameFactory.eINSTANCE.createIFrame())); newChildDescriptors.add (<API key> (GamePackage.Literals.UI__WIDGETS, GameFactory.eINSTANCE.createHTMLElement())); } /** * Return the resource locator for this item provider's resources. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public ResourceLocator getResourceLocator() { return GameEditPlugin.INSTANCE; } }
package org.eclipse.che.datasource.ide.newDatasource.connector; import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.KeyPressEvent; import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.logical.shared.ValueChangeEvent; import com.google.gwt.resources.client.ImageResource; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.uibinder.client.UiHandler; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.CheckBox; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.ListBox; import com.google.gwt.user.client.ui.RadioButton; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.Widget; import com.google.inject.Inject; import org.eclipse.che.datasource.ide.<API key>; import javax.annotation.Nullable; public class <API key> extends Composite implements <API key> { interface <API key> extends UiBinder<Widget, <API key>> { } @UiField Label <API key>; @UiField TextBox hostField; @UiField TextBox portField; @UiField TextBox dbName; @UiField TextBox usernameField; @UiField TextBox passwordField; @UiField Button <API key>; @UiField Label <API key>; @UiField RadioButton radioUserPref; @UiField RadioButton radioProject; @UiField ListBox projectsList; @UiField CheckBox useSSL; @UiField CheckBox <API key>; @UiField <API key> <API key>; @UiField Label testConnectionText; private ActionDelegate delegate; protected String encryptedPassword; protected boolean <API key> = false; private Long runnerProcessId; @Inject public <API key>(<API key> uiBinder) { initWidget(uiBinder.createAndBindUi(this)); hostField.setText("localhost"); radioUserPref.setValue(true); radioProject.setEnabled(false); projectsList.setEnabled(false); projectsList.setWidth("100px"); <API key>.setText("Settings"); } @Override public void setDelegate(<API key>.ActionDelegate delegate) { this.delegate = delegate; } @Override public void setImage(@Nullable ImageResource image) { } @Override public void setDatasourceName(@Nullable String dsName) { } @Override public String getDatabaseName() { return dbName.getText(); } @UiHandler("dbName") public void <API key>(KeyUpEvent event) { delegate.databaseNameChanged(dbName.getText()); } @Override public String getHostname() { return hostField.getText(); } @UiHandler("hostField") public void <API key>(KeyUpEvent event) { delegate.hostNameChanged(hostField.getText()); } @Override public int getPort() { return Integer.parseInt(portField.getText()); } @Override public String getUsername() { return usernameField.getText(); } @UiHandler("usernameField") public void <API key>(KeyUpEvent event) { delegate.userNameChanged(usernameField.getText()); } @Override public String getPassword() { return passwordField.getText(); } @UiHandler("passwordField") public void on<API key>(KeyUpEvent event) { delegate.passwordChanged(passwordField.getText()); delegate.<API key>(); } @Override public String <API key>() { return encryptedPassword; } @Override public void setPort(int port) { portField.setText(Integer.toString(port)); } @UiHandler("portField") public void onPortFieldChanged(KeyPressEvent event) { if (!Character.isDigit(event.getCharCode())) { portField.cancelKey(); } delegate.portChanged(Integer.parseInt(portField.getText())); } @Override public boolean getUseSSL() { if (useSSL.getValue() != null) { return useSSL.getValue(); } else { return false; } } @Override public boolean <API key>() { if (<API key>.getValue() != null) { return <API key>.getValue(); } else { return false; } } @Override public void setDatabaseName(final String databaseName) { dbName.setValue(databaseName); } @Override public void setHostName(final String hostName) { hostField.setValue(hostName); } @Override public void setUseSSL(final boolean useSSL) { this.useSSL.setValue(useSSL); } @UiHandler({"useSSL"}) void onUseSSLChanged(ValueChangeEvent<Boolean> event) { delegate.useSSLChanged(event.getValue()); } @Override public void <API key>(final boolean <API key>) { this.<API key>.setValue(<API key>); } @UiHandler({"<API key>"}) void <API key>(ValueChangeEvent<Boolean> event) { delegate.<API key>(event.getValue()); } @Override public void setUsername(final String username) { usernameField.setValue(username); } @Override public void setPassword(final String password) { passwordField.setValue(password); } @UiHandler("<API key>") void handleClick(ClickEvent e) { delegate.<API key>(); } @UiHandler("testConnectionText") void handleTextClick(ClickEvent e) { delegate.<API key>(); } @Override public void <API key>() { // turn button green <API key>.setStyleName(<API key>.datasourceUiCSS().<API key>()); // clear error messages <API key>.setText("Connection Established Successfully!"); } @Override public void <API key>(String errorMessage) { // turn test button red <API key>.setStyleName(<API key>.datasourceUiCSS().<API key>()); // set message <API key>.setText(errorMessage); } @Override public void <API key>(String encryptedPassword, boolean resetPasswordField) { this.encrypted<API key>; <API key> = false; if (resetPasswordField) { passwordField.setText(""); } } @UiHandler("passwordField") public void <API key>(ChangeEvent event) { <API key> = true; } @Override public boolean <API key>() { return <API key>; } @Override public Long getRunnerProcessId() { return runnerProcessId; } @Override public void setRunnerProcessId(Long runnerProcessId) { this.runnerProcessId = runnerProcessId; } }
#include "F_TIME_TO_USINT.h" #ifdef <API key> #include "F_TIME_TO_USINT_gen.cpp" #endif DEFINE_FIRMWARE_FB(<API key>, <API key>) const CStringDictionary::TStringId <API key>::<API key>[] = {g_nStringIdIN}; const CStringDictionary::TStringId <API key>::<API key>[] = {g_nStringIdTIME}; const CStringDictionary::TStringId <API key>::<API key>[] = {g_nStringIdOUT}; const CStringDictionary::TStringId <API key>::<API key>[] = {g_nStringIdUSINT}; const TForteInt16 <API key>::scm_anEIWithIndexes[] = {0}; const TDataIOID <API key>::scm_anEIWith[] = {0, 255}; const CStringDictionary::TStringId <API key>::<API key>[] = {g_nStringIdREQ}; const TDataIOID <API key>::scm_anEOWith[] = {0, 255}; const TForteInt16 <API key>::scm_anEOWithIndexes[] = {0, -1}; const CStringDictionary::TStringId <API key>::<API key>[] = {g_nStringIdCNF}; const SFBInterfaceSpec <API key>::<API key> = { 1, <API key>, scm_anEIWith, scm_anEIWithIndexes, 1, <API key>, scm_anEOWith, scm_anEOWithIndexes, 1, <API key>, <API key>, 1, <API key>, <API key>, 0, 0 }; void <API key>::executeEvent(int pa_nEIID){ if(scm_nEventREQID == pa_nEIID){ OUT() = TIME_TO_USINT(IN()); sendOutputEvent(scm_nEventCNFID); } }
package org.eclipse.xtext.impl; import org.eclipse.emf.ecore.EClass; import org.eclipse.xtext.UntilToken; import org.eclipse.xtext.XtextPackage; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Until Token</b></em>'. * <!-- end-user-doc --> * * @generated */ public class UntilTokenImpl extends <API key> implements UntilToken { /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected UntilTokenImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return XtextPackage.Literals.UNTIL_TOKEN; } } //UntilTokenImpl
/* * generated by Xtext */ package org.eclipse.xtext.testlanguages.fileAware.scoping; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EReference; import org.eclipse.xtext.scoping.<API key>; import org.eclipse.xtext.scoping.IScope; import org.eclipse.xtext.testlanguages.fileAware.fileAware.FileAwarePackage; import com.google.inject.Inject; public class <API key> extends <API key> { @Inject <API key> global; public IScope getScope(EObject context, EReference reference) { if (reference == FileAwarePackage.Literals.IMPORT__ELEMENT) { return global.getScope(context.eResource(), reference, null); } return super.getScope(context, reference); } }
package org.eclipse.persistence.testing.oxm.readonly; import org.eclipse.persistence.sessions.Project; import org.eclipse.persistence.oxm.*; import org.eclipse.persistence.oxm.mappings.XMLDirectMapping; public class <API key> extends Project { public <API key>() { super(); <API key>(); } public void <API key>() { XMLDescriptor descriptor = new XMLDescriptor(); descriptor.<API key>("employee"); descriptor.setJavaClass(Employee.class); XMLDirectMapping firstNameMapping = new XMLDirectMapping(); firstNameMapping.setAttributeName("firstName"); firstNameMapping.setXPath("first-name/text()"); firstNameMapping.readOnly(); descriptor.addMapping(firstNameMapping); this.addDescriptor(descriptor); } }
# Map Transformation Service Transforms the input by mapping it to another string. It expects the mappings to be read from a file which is stored under the `transform` folder. The file name must have the `.map` extension. This file should be in property syntax, i.e. simple lines with "key=value" pairs. The file format is documented [here](https://docs.oracle.com/javase/8/docs/api/java/util/Properties.html#load-java.io.Reader-). To organize the various transformations one might use subfolders. A default value can be provided if no matching entry is found by using "=value" syntax ## Example transform/binary.map: properties key=value 1=ON 0=OFF ON=1 OFF=0 white\ space=showing escape =default | input | output | | | `1` | `ON` | | `OFF` | `0` | | `key` | `value` | | `white space` | `using escape` | | `anything` | `default` | ## Usage as a Profile The functionality of this `<API key>` can be used in a `Profile` on an `ItemChannelLink` too. To do so, it can be configured in the `.items` file as follows: java String <itemName> { channel="<channelUID>"[profile="transform:MAP", function="<filename>", sourceFormat="<valueFormat>"]} The mapping filename (within the `transform` folder) has to be set in the `function` parameter. The parameter `sourceFormat` is optional and can be used to format the input value **before** the transformation, i.e. `%.3f`. If omitted the default is `%s`, so the input value will be put into the transformation without any format changes. Please note: This profile is a one-way transformation, i.e. only values from a device towards the item are changed, the other direction is left untouched.
package com.odcgroup.page.transformmodel.ui.builder; import org.eclipse.core.runtime.Assert; import com.odcgroup.mdf.ecore.util.DomainRepository; import com.odcgroup.page.metamodel.MetaModel; import com.odcgroup.page.metamodel.util.MetaModelRegistry; import com.odcgroup.page.model.corporate.CorporateDesign; import com.odcgroup.page.model.corporate.<API key>; import com.odcgroup.page.model.util.WidgetFactory; import com.odcgroup.workbench.core.IOfsProject; /** * The <API key> is used to provide information to all the different * WidgetBuilder's used when building a Widget. * * @author Gary Hayes */ public class <API key> { /** The OFS project for which we are building Widgets. */ private IOfsProject ofsProject; /** This is the corporate design to use when building template. */ private CorporateDesign corporateDesign; /** The <API key> used to build Widgets. */ private <API key> <API key>; /** * Creates a new <API key>. * * @param ofsProject The OFS project for which we are building Widgets * @param <API key> The <API key> used to build Widgets */ public <API key>(IOfsProject ofsProject, <API key> <API key>) { Assert.isNotNull(ofsProject); Assert.isNotNull(<API key>); this.ofsProject = ofsProject; this.<API key> = <API key>; corporateDesign = <API key>.getCorporateDesign(ofsProject); } /** * Gets the path containing the model definitions. * * @return path */ public final DomainRepository getDomainRepository() { return DomainRepository.getInstance(ofsProject); } /** * Gets the Corporate Design. * * @return CorporateDesign The corporate design attached to this builder */ public final CorporateDesign getCorporateDesign() { return corporateDesign; } /** * Gets the metamodel. * * @return MetaModel The metamodel. */ public final MetaModel getMetaModel() { return MetaModelRegistry.getMetaModel(); } /** * Gets the project for which we are building Widgets. * * @return IProject */ public final IOfsProject getOfsProject() { return ofsProject; } /** * Gets the Factory used to build Widgets. * * @return <API key> */ public final <API key> getBuilderFactory() { return <API key>; } /** * Gets the WidgetFactory. * * @return WidgetFactory The WidgetFactory */ public WidgetFactory getWidgetFactory() { return new WidgetFactory(); } }
package edu.umn.msi.tropix.storage.client.impl; import java.util.HashMap; import java.util.Map; import org.easymock.EasyMock; import org.testng.annotations.Test; import edu.umn.msi.tropix.common.test.EasyMockUtils; import edu.umn.msi.tropix.grid.credentials.Credential; import edu.umn.msi.tropix.models.TropixFile; import edu.umn.msi.tropix.storage.client.ModelStorageData; public class <API key> { @Test(groups = "unit") public void get() { final <API key> factory = new <API key>(); final TropixFileFactory tfFactory = EasyMock.createMock(TropixFileFactory.class); factory.<API key>(tfFactory); final Credential proxy = EasyMock.createMock(Credential.class); TropixFile tropixFile = new TropixFile(); ModelStorageData mds = EasyMock.createMock(ModelStorageData.class); final String serviceUrl = "http://storage"; final Map<String, Object> map = new HashMap<String, Object>(); map.put("storageServiceUrl", serviceUrl); tfFactory.getStorageData(EasyMockUtils.<TropixFile><API key>(map), EasyMock.same(proxy)); EasyMock.expectLastCall().andReturn(mds); EasyMock.replay(tfFactory); assert mds == factory.getStorageData(serviceUrl, proxy); EasyMockUtils.verifyAndReset(tfFactory); tropixFile = new TropixFile(); mds = EasyMock.createMock(ModelStorageData.class); map.put("fileId", "12345"); tfFactory.getStorageData(EasyMockUtils.<TropixFile><API key>(map), EasyMock.same(proxy)); EasyMock.expectLastCall().andReturn(mds); EasyMock.replay(tfFactory); assert mds == factory.getStorageData("12345", serviceUrl, proxy); EasyMockUtils.verifyAndReset(tfFactory); tropixFile = new TropixFile(); mds = EasyMock.createMock(ModelStorageData.class); tfFactory.getStorageData(EasyMock.same(tropixFile), EasyMock.same(proxy)); EasyMock.expectLastCall().andReturn(mds); EasyMock.replay(tfFactory); assert mds == factory.getStorageData(tropixFile, proxy); EasyMockUtils.verifyAndReset(tfFactory); } }
package org.eclipse.wst.dtd.ui.internal.wizard; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.preference.PreferenceDialog; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.SourceViewer; import org.eclipse.jface.text.source.<API key>; import org.eclipse.jface.text.templates.<API key>; import org.eclipse.jface.text.templates.Template; import org.eclipse.jface.text.templates.TemplateBuffer; import org.eclipse.jface.text.templates.TemplateContext; import org.eclipse.jface.text.templates.TemplateContextType; import org.eclipse.jface.text.templates.persistence.TemplateStore; import org.eclipse.jface.viewers.<API key>; import org.eclipse.jface.viewers.<API key>; import org.eclipse.jface.viewers.<API key>; import org.eclipse.jface.viewers.ITableLabelProvider; import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.<API key>; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.TableLayout; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerSorter; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ControlAdapter; import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; 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.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.PreferencesUtil; import org.eclipse.wst.dtd.core.internal.provisional.contenttype.ContentTypeIdForDTD; import org.eclipse.wst.dtd.ui.<API key>; import org.eclipse.wst.dtd.ui.internal.DTDUIMessages; import org.eclipse.wst.dtd.ui.internal.DTDUIPlugin; import org.eclipse.wst.dtd.ui.internal.Logger; import org.eclipse.wst.dtd.ui.internal.editor.IHelpContextIds; import org.eclipse.wst.dtd.ui.internal.preferences.<API key>; import org.eclipse.wst.dtd.ui.internal.templates.<API key>; import org.eclipse.wst.sse.core.<API key>; import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel; import org.eclipse.wst.sse.ui.<API key>; import org.eclipse.wst.sse.ui.internal.<API key>; import org.eclipse.wst.sse.ui.internal.provisional.style.LineStyleProvider; /** * Templates page in new file wizard. Allows users to select a new file * template to be applied in new file. * */ public class <API key> extends WizardPage { /** * Content provider for templates */ private class <API key> implements <API key> { /** The template store. */ private TemplateStore fStore; /* * @see IContentProvider#dispose() */ public void dispose() { fStore = null; } /* * @see <API key>#getElements(Object) */ public Object[] getElements(Object input) { return fStore.getTemplates(<API key>.NEW); } /* * @see IContentProvider#inputChanged(Viewer, Object, Object) */ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { fStore = (TemplateStore) newInput; } } /** * Label provider for templates. */ private class <API key> extends LabelProvider implements ITableLabelProvider { /* * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, * int) */ public Image getColumnImage(Object element, int columnIndex) { return null; } /* * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, * int) */ public String getColumnText(Object element, int columnIndex) { Template template = (Template) element; switch (columnIndex) { case 0 : return template.getName(); case 1 : return template.getDescription(); default : return ""; //$NON-NLS-1$ } } } /** Last selected template name */ private String <API key>; /** The viewer displays the pattern of selected template. */ private SourceViewer fPatternViewer; /** The table presenting the templates. */ private TableViewer fTableViewer; /** Template store used by this wizard page */ private TemplateStore fTemplateStore; /** Checkbox for using templates. */ private Button fUseTemplateButton; public <API key>() { super("<API key>", DTDUIMessages.<API key>, null); //$NON-NLS-1$ setDescription(DTDUIMessages.<API key>); } /** * Correctly resizes the table so no phantom columns appear * * @param parent * the parent control * @param buttons * the buttons * @param table * the table * @param column1 * the first column * @param column2 * the second column * @param column3 * the third column */ private void <API key>(final Composite parent, final Table table, final TableColumn column1, final TableColumn column2) { parent.addControlListener(new ControlAdapter() { public void controlResized(ControlEvent e) { Rectangle area = parent.getClientArea(); Point preferredSize = table.computeSize(SWT.DEFAULT, SWT.DEFAULT); int width = area.width - 2 * table.getBorderWidth(); if (preferredSize.y > area.height) { // Subtract the scrollbar width from the total column // width // if a vertical scrollbar will be required Point vBarSize = table.getVerticalBar().getSize(); width -= vBarSize.x; } Point oldSize = table.getSize(); if (oldSize.x > width) { // table is getting smaller so make the columns // smaller first and then resize the table to // match the client area width column1.setWidth(width / 2); column2.setWidth(width / 2); table.setSize(width, area.height); } else { // table is getting bigger so make the table // bigger first and then make the columns wider // to match the client area width table.setSize(width, area.height); column1.setWidth(width / 2); column2.setWidth(width / 2); } } }); } public void createControl(Composite ancestor) { Composite parent = new Composite(ancestor, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 2; parent.setLayout(layout); // create checkbox for user to use DTD Template fUseTemplateButton = new Button(parent, SWT.CHECK); fUseTemplateButton.setText(DTDUIMessages.<API key>); GridData data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1); fUseTemplateButton.setLayoutData(data); fUseTemplateButton.<API key>(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { enableTemplates(); } }); // create composite for Templates table Composite innerParent = new Composite(parent, SWT.NONE); GridLayout innerLayout = new GridLayout(); innerLayout.numColumns = 2; innerLayout.marginHeight = 0; innerLayout.marginWidth = 0; innerParent.setLayout(innerLayout); GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1); innerParent.setLayoutData(gd); Label label = new Label(innerParent, SWT.NONE); label.setText(DTDUIMessages.<API key>); data = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1); label.setLayoutData(data); // create table that displays templates Table table = new Table(innerParent, SWT.BORDER | SWT.FULL_SELECTION); data = new GridData(GridData.FILL_BOTH); data.widthHint = <API key>(2); data.heightHint = <API key>(10); data.horizontalSpan = 2; table.setLayoutData(data); table.setHeaderVisible(true); table.setLinesVisible(true); TableLayout tableLayout = new TableLayout(); table.setLayout(tableLayout); TableColumn column1 = new TableColumn(table, SWT.NONE); column1.setText(DTDUIMessages.<API key>); TableColumn column2 = new TableColumn(table, SWT.NONE); column2.setText(DTDUIMessages.<API key>); fTableViewer = new TableViewer(table); fTableViewer.setLabelProvider(new <API key>()); fTableViewer.setContentProvider(new <API key>()); fTableViewer.setSorter(new ViewerSorter() { public int compare(Viewer viewer, Object object1, Object object2) { if ((object1 instanceof Template) && (object2 instanceof Template)) { Template left = (Template) object1; Template right = (Template) object2; int result = left.getName().compareToIgnoreCase(right.getName()); if (result != 0) return result; return left.getDescription().compareToIgnoreCase(right.getDescription()); } return super.compare(viewer, object1, object2); } public boolean isSorterProperty(Object element, String property) { return true; } }); fTableViewer.<API key>(new <API key>() { public void selectionChanged(<API key> e) { updateViewerInput(); } }); // create viewer that displays currently selected template's contents fPatternViewer = doCreateViewer(parent); fTemplateStore = DTDUIPlugin.getDefault().getTemplateStore(); fTableViewer.setInput(fTemplateStore); // Create linked text to just to templates preference page Link link = new Link(parent, SWT.NONE); link.setText(DTDUIMessages.<API key>); data = new GridData(SWT.END, SWT.FILL, true, false, 2, 1); link.setLayoutData(data); link.<API key>(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { linkClicked(); } }); <API key>(innerParent, table, column1, column2); <API key>(); PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.<API key>); Dialog.applyDialogFont(parent); setControl(parent); } /** * Creates, configures and returns a source viewer to present the template * pattern on the preference page. Clients may override to provide a * custom source viewer featuring e.g. syntax coloring. * * @param parent * the parent control * @return a configured source viewer */ private SourceViewer createViewer(Composite parent) { <API key> <API key> = new <API key>() { <API key> baseConfiguration = new <API key>(); public String[] <API key>(ISourceViewer sourceViewer) { return baseConfiguration.<API key>(sourceViewer); } public LineStyleProvider[] <API key>(ISourceViewer sourceViewer, String partitionType) { return baseConfiguration.<API key>(sourceViewer, partitionType); } }; SourceViewer viewer = new <API key>(parent, null, null, false, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL); viewer.getTextWidget().setFont(JFaceResources.getFont("org.eclipse.wst.sse.ui.textfont")); //$NON-NLS-1$ IStructuredModel scratchModel = <API key>.getModelManager().<API key>(ContentTypeIdForDTD.ContentTypeID_DTD); IDocument document = scratchModel.<API key>(); viewer.configure(<API key>); viewer.setDocument(document); return viewer; } private SourceViewer doCreateViewer(Composite parent) { Label label = new Label(parent, SWT.NONE); label.setText(DTDUIMessages.<API key>); GridData data = new GridData(); data.horizontalSpan = 2; label.setLayoutData(data); SourceViewer viewer = createViewer(parent); viewer.setEditable(false); Control control = viewer.getControl(); data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2; data.heightHint = <API key>(5); // [261274] - source viewer was growing to fit the max line width of the template data.widthHint = <API key>(2); control.setLayoutData(data); return viewer; } /** * Enable/disable controls in page based on fUseTemplateButton's current * state. */ void enableTemplates() { boolean enabled = fUseTemplateButton.getSelection(); if (!enabled) { // save last selected template Template template = getSelectedTemplate(); if (template != null) <API key> = template.getName(); else <API key> = ""; //$NON-NLS-1$ fTableViewer.setSelection(null); } else { setSelectedTemplate(<API key>); } fTableViewer.getControl().setEnabled(enabled); fPatternViewer.getControl().setEnabled(enabled); } /** * Return the template preference page id * * @return */ private String getPreferencePageId() { return "org.eclipse.wst.sse.ui.preferences.dtd.templates"; //$NON-NLS-1$ } /** * Get the currently selected template. * * @return */ private Template getSelectedTemplate() { Template template = null; <API key> selection = (<API key>) fTableViewer.getSelection(); if (selection.size() == 1) { template = (Template) selection.getFirstElement(); } return template; } /** * Returns template string to insert. * * @return String to insert or null if none is to be inserted */ String getTemplateString() { String templateString = null; Template template = getSelectedTemplate(); if (template != null) { TemplateContextType contextType = DTDUIPlugin.getDefault().<API key>().getContextType(<API key>.NEW); IDocument document = new Document(); TemplateContext context = new <API key>(contextType, document, 0, 0); try { TemplateBuffer buffer = context.evaluate(template); templateString = buffer.getString(); } catch (Exception e) { Logger.log(Logger.WARNING_DEBUG, "Could not create template for new dtd", e); //$NON-NLS-1$ } } return templateString; } void linkClicked() { String pageId = getPreferencePageId(); PreferenceDialog dialog = PreferencesUtil.<API key>(getShell(), pageId, new String[]{pageId}, null); dialog.open(); fTableViewer.refresh(); } /** * Load the last template name used in New DTD File wizard. */ private void <API key>() { String templateName = DTDUIPlugin.getDefault().getPreferenceStore().getString(<API key>.<API key>); if (templateName == null || templateName.length() == 0) { <API key> = ""; //$NON-NLS-1$ fUseTemplateButton.setSelection(false); } else { <API key> = templateName; fUseTemplateButton.setSelection(true); } enableTemplates(); } /** * Save template name used for next call to New DTD File wizard. */ void <API key>() { String templateName = ""; //$NON-NLS-1$ Template template = getSelectedTemplate(); if (template != null) { templateName = template.getName(); } DTDUIPlugin.getDefault().getPreferenceStore().setValue(<API key>.<API key>, templateName); DTDUIPlugin.getDefault().<API key>(); } /** * Select a template in the table viewer given the template name. If * template name cannot be found or templateName is null, just select * first item in table. If no items in table select nothing. * * @param templateName */ private void setSelectedTemplate(String templateName) { Object template = null; if (templateName != null && templateName.length() > 0) { // pick the last used template template = fTemplateStore.findTemplate(templateName, <API key>.NEW); } // no record of last used template so just pick first element if (template == null) { // just pick first element template = fTableViewer.getElementAt(0); } if (template != null) { <API key> selection = new StructuredSelection(template); fTableViewer.setSelection(selection, true); } } /** * Updates the pattern viewer. */ void updateViewerInput() { Template template = getSelectedTemplate(); if (template != null) { fPatternViewer.getDocument().set(template.getPattern()); } else { fPatternViewer.getDocument().set(""); //$NON-NLS-1$ } } }
#include "pMidiToFrequency.h" #include "../pObjectList.hpp" #include "../../dsp/math.hpp" using namespace YSE::PATCHER; #define className pMidiToFrequency CONSTRUCT() { midiValue = 0.f; ADD_IN_0; REG_FLOAT_IN(SetMidi); REG_INT_IN(SetMidiInt); ADD_OUT_FLOAT; } FLOAT_IN(SetMidi) { midiValue = value; } INT_IN(SetMidiInt) { midiValue = (float)value; } CALC() { outputs[0].SendFloat(YSE::DSP::MidiToFreq(midiValue), thread); }
package com.ibm.ws.jpa.fvt.entity.tests.web; import java.util.HashMap; import javax.annotation.PostConstruct; import javax.persistence.EntityManager; import javax.persistence.<API key>; import javax.persistence.PersistenceContext; import javax.persistence.PersistenceUnit; import javax.servlet.annotation.WebServlet; import org.junit.Test; import com.ibm.ws.jpa.fvt.entity.testlogic.<API key>; import com.ibm.ws.testtooling.testinfo.<API key>; import com.ibm.ws.testtooling.testinfo.<API key>.<API key>; import com.ibm.ws.testtooling.testinfo.<API key>.<API key>; import com.ibm.ws.testtooling.vehicle.web.JPATestServlet; @SuppressWarnings("serial") @WebServlet(urlPatterns = "/<API key>") public class <API key> extends JPATestServlet { // Container Managed Transaction Scope @PersistenceContext(unitName = "ENTITY_JTA") private EntityManager cmtsEm; // Application Managed JTA @PersistenceUnit(unitName = "ENTITY_JTA") private <API key> amjtaEmf; // Application Managed Resource-Local @PersistenceUnit(unitName = "ENTITY_RL") private <API key> amrlEmf; @PostConstruct private void initFAT() { testClassName = <API key>.class.getName(); jpaPctxMap.put("<API key>", new <API key>("<API key>", <API key>.<API key>, <API key>.FIELD, "amjtaEmf")); jpaPctxMap.put("<API key>", new <API key>("<API key>", <API key>.<API key>, <API key>.FIELD, "amrlEmf")); jpaPctxMap.put("<API key>", new <API key>("<API key>", <API key>.<API key>, <API key>.FIELD, "cmtsEm")); } @Test public void <API key>() throws Exception { final String testName = "<API key>"; final String testMethod = "<API key>"; final String testResource = "<API key>"; HashMap<String, java.io.Serializable> properties = new HashMap<String, java.io.Serializable>(); properties.put("EntityName", "EmbeddableIdEntity"); executeTest(testName, testMethod, testResource, properties); } @Test public void <API key>() throws Exception { final String testName = "<API key>"; final String testMethod = "<API key>"; final String testResource = "<API key>"; HashMap<String, java.io.Serializable> properties = new HashMap<String, java.io.Serializable>(); properties.put("EntityName", "<API key>"); executeTest(testName, testMethod, testResource, properties); } @Test public void <API key>() throws Exception { final String testName = "<API key>"; final String testMethod = "<API key>"; final String testResource = "<API key>"; HashMap<String, java.io.Serializable> properties = new HashMap<String, java.io.Serializable>(); properties.put("EntityName", "EmbeddableIdEntity"); executeTest(testName, testMethod, testResource, properties); } @Test public void <API key>() throws Exception { final String testName = "<API key>"; final String testMethod = "<API key>"; final String testResource = "<API key>"; HashMap<String, java.io.Serializable> properties = new HashMap<String, java.io.Serializable>(); properties.put("EntityName", "<API key>"); executeTest(testName, testMethod, testResource, properties); } @Test public void <API key>() throws Exception { final String testName = "<API key>"; final String testMethod = "<API key>"; final String testResource = "<API key>"; HashMap<String, java.io.Serializable> properties = new HashMap<String, java.io.Serializable>(); properties.put("EntityName", "EmbeddableIdEntity"); executeTest(testName, testMethod, testResource, properties); } @Test public void <API key>() throws Exception { final String testName = "<API key>"; final String testMethod = "<API key>"; final String testResource = "<API key>"; HashMap<String, java.io.Serializable> properties = new HashMap<String, java.io.Serializable>(); properties.put("EntityName", "<API key>"); executeTest(testName, testMethod, testResource, properties); } }
package net.eldiosantos.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import java.io.Serializable; @Entity public class Departamento implements Serializable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String nome; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } }
var config = { width: 800, height: 600, type: Phaser.AUTO, parent: 'phaser-example', scene: { create: create, update: update } }; var game = new Phaser.Game(config); var graphics; var pointerRect; var rectangles; function create () { graphics = this.add.graphics({ lineStyle: { color: 0x0000aa }, fillStyle: { color: 0x0000aa, alpha: 0.5 } }); pointerRect = new Phaser.Geom.Rectangle(0, 0, 80, 60); rectangles = []; for(var x = 0; x < 10; x++) { rectangles[x] = []; for(var y = 0; y < 10; y++) { rectangles[x][y] = new Phaser.Geom.Rectangle(x * 80, y * 60, 80, 60); } } this.input.on('pointermove', function (pointer) { var x = Math.floor(pointer.x / 80); var y = Math.floor(pointer.y / 60); pointerRect.setPosition(x * 80, y * 60); Phaser.Geom.Rectangle.CopyFrom(pointerRect, rectangles[x][y]); }); } function update () { graphics.clear(); graphics.fillRectShape(pointerRect); for(var x = 0; x < 10; x++) { for(var y = 0; y < 10; y++) { var rect = rectangles[x][y]; if(rect.width > 10) { rect.width *= 0.95; rect.height *= 0.95; } graphics.strokeRectShape(rect); } } }
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7 // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2013.07.08 at 01:02:29 PM CEST @XmlSchema(namespace = "http://uri.etsi.org/m2m", xmlns = { @XmlNs(namespaceURI = "http://uri.etsi.org/m2m", prefix = "om2m")}, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.eclipse.om2m.commons.resource; import javax.xml.bind.annotation.XmlNs; import javax.xml.bind.annotation.XmlSchema;
package org.opendaylight.controller.netconf.impl; import static com.google.common.base.Preconditions.checkNotNull; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anySetOf; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.google.common.io.ByteStreams; import io.netty.channel.ChannelFuture; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.util.HashedWheelTimer; import io.netty.util.concurrent.GlobalEventExecutor; import java.io.DataOutputStream; import java.io.InputStream; import java.io.InputStreamReader; import java.net.InetSocketAddress; import java.net.Socket; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicLong; import org.junit.After; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.opendaylight.controller.config.util.capability.Capability; import org.opendaylight.controller.config.util.xml.DocumentedException; import org.opendaylight.controller.config.util.xml.XmlUtil; import org.opendaylight.controller.netconf.api.NetconfMessage; import org.opendaylight.controller.netconf.api.monitoring.CapabilityListener; import org.opendaylight.controller.netconf.api.monitoring.<API key>; import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants; import org.opendaylight.controller.netconf.client.<API key>; import org.opendaylight.controller.netconf.client.<API key>; import org.opendaylight.controller.netconf.client.<API key>; import org.opendaylight.controller.netconf.client.<API key>; import org.opendaylight.controller.netconf.client.conf.<API key>; import org.opendaylight.controller.netconf.client.conf.<API key>; import org.opendaylight.controller.netconf.impl.osgi.<API key>; import org.opendaylight.controller.netconf.mapping.api.HandlingPriority; import org.opendaylight.controller.netconf.mapping.api.NetconfOperation; import org.opendaylight.controller.netconf.mapping.api.<API key>; import org.opendaylight.controller.netconf.mapping.api.<API key>; import org.opendaylight.controller.netconf.mapping.api.<API key>; import org.opendaylight.controller.netconf.nettyutil.handler.exi.<API key>; import org.opendaylight.controller.netconf.util.messages.<API key>; import org.opendaylight.controller.netconf.util.messages.NetconfMessageUtil; import org.opendaylight.controller.netconf.util.test.XmlFileLoader; import org.opendaylight.protocol.framework.<API key>; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.CapabilitiesBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; @RunWith(Parameterized.class) public class <API key> { private static final Logger LOG = LoggerFactory.getLogger(<API key>.class); private static ExecutorService clientExecutor; private static final int CONCURRENCY = 32; private static final InetSocketAddress netconfAddress = new InetSocketAddress("127.0.0.1", 8303); private int nettyThreads; private Class<? extends Runnable> clientRunnable; private Set<String> serverCaps; public <API key>(int nettyThreads, Class<? extends Runnable> clientRunnable, Set<String> serverCaps) { this.nettyThreads = nettyThreads; this.clientRunnable = clientRunnable; this.serverCaps = serverCaps; } @Parameterized.Parameters() public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{{4, <API key>.class, <API key>.<API key>}, {1, <API key>.class, <API key>.<API key>}, // empty set of capabilities = only base 1.0 netconf capability {4, <API key>.class, Collections.emptySet()}, {4, <API key>.class, <API key>()}, {4, <API key>.class, <API key>()}, {4, <API key>.class, <API key>()}, {1, <API key>.class, <API key>()}, }); } private EventLoopGroup nettyGroup; private <API key> <API key>; HashedWheelTimer hashedWheelTimer; private <API key> <API key>; public static <API key> <API key>() { <API key> monitoring = mock(<API key>.class); doNothing().when(monitoring).onSessionUp(any(<API key>.class)); doNothing().when(monitoring).onSessionDown(any(<API key>.class)); doReturn(new AutoCloseable() { @Override public void close() throws Exception { } }).when(monitoring).registerListener(any(<API key>.MonitoringListener.class)); doNothing().when(monitoring).<API key>(anySetOf(Capability.class), anySetOf(Capability.class)); doReturn(new CapabilitiesBuilder().setCapability(Collections.<Uri>emptyList()).build()).when(monitoring).getCapabilities(); return monitoring; } @BeforeClass public static void setUpClientExecutor() { clientExecutor = Executors.newFixedThreadPool(CONCURRENCY, new ThreadFactory() { int i = 1; @Override public Thread newThread(final Runnable r) { Thread thread = new Thread(r); thread.setName("client-" + i++); thread.setDaemon(true); return thread; } }); } @Before public void setUp() throws Exception { hashedWheelTimer = new HashedWheelTimer(); nettyGroup = new NioEventLoopGroup(nettyThreads); <API key> = new <API key>(nettyGroup, nettyGroup, hashedWheelTimer); <API key> factoriesListener = new <API key>(); <API key> = new <API key>(); factoriesListener.<API key>(new <API key>(<API key>)); SessionIdProvider idProvider = new SessionIdProvider(); <API key> <API key> = new <API key>( hashedWheelTimer, factoriesListener, idProvider, 5000, <API key>(), serverCaps); <API key>.<API key> <API key> = new <API key>.<API key>(<API key>); final <API key> dispatch = new <API key>(<API key>, nettyGroup, nettyGroup); ChannelFuture s = dispatch.createServer(netconfAddress); s.await(); } @After public void tearDown(){ hashedWheelTimer.stop(); try { nettyGroup.shutdownGracefully().get(); } catch (<API key> | ExecutionException e) { LOG.warn("Ignoring exception while cleaning up after test", e); } } @AfterClass public static void <API key>() { clientExecutor.shutdownNow(); } @Test(timeout = CONCURRENCY * 1000) public void <API key>() throws Exception { List<Future<?>> futures = Lists.<API key>(CONCURRENCY); for (int i = 0; i < CONCURRENCY; i++) { futures.add(clientExecutor.submit(<API key>())); } for (Future<?> future : futures) { try { future.get(); } catch (<API key> e) { throw new <API key>(e); } catch (ExecutionException e) { LOG.error("Thread for testing client failed", e); fail("Client failed: " + e.getMessage()); } } assertEquals(CONCURRENCY, <API key>.getMessageCount()); } public static Set<String> <API key>() { return Sets.newHashSet( XmlNetconfConstants.<API key>, XmlNetconfConstants.<API key> ); } public static Set<String> <API key>() { return Sets.newHashSet( XmlNetconfConstants.<API key>, XmlNetconfConstants.<API key> ); } public Runnable <API key>() throws Exception { return clientRunnable.getConstructor(<API key>.class).newInstance(this); } /** * Responds to all operations except start-exi and counts all requests */ private static class <API key> implements NetconfOperation { private final AtomicLong counter = new AtomicLong(); @Override public HandlingPriority canHandle(Document message) { return XmlUtil.toString(message).contains(<API key>.START_EXI) ? HandlingPriority.CANNOT_HANDLE : HandlingPriority.<API key>; } @Override public Document handle(Document requestMessage, <API key> subsequentOperation) throws DocumentedException { try { LOG.info("Handling netconf message from test {}", XmlUtil.toString(requestMessage)); counter.getAndIncrement(); return XmlUtil.readXmlToDocument("<test/>"); } catch (Exception e) { throw new RuntimeException(e); } } public long getMessageCount() { return counter.get(); } } /** * Hardcoded operation service factory */ private static class <API key> implements <API key> { private final NetconfOperation[] operations; public <API key>(final NetconfOperation... operations) { this.operations = operations; } @Override public Set<Capability> getCapabilities() { return Collections.emptySet(); } @Override public AutoCloseable <API key>(final CapabilityListener listener) { return new AutoCloseable(){ @Override public void close() throws Exception {} }; } @Override public <API key> createService(String <API key>) { return new <API key>() { @Override public Set<NetconfOperation> <API key>() { return Sets.newHashSet(operations); } @Override public void close() {} }; } } /** * Pure socket based blocking client */ public final class <API key> implements Runnable { @Override public void run() { try { run2(); } catch (Exception e) { throw new <API key>(Thread.currentThread().getName(), e); } } private void run2() throws Exception { InputStream clientHello = checkNotNull(XmlFileLoader .getResourceAsStream("netconfMessages/client_hello.xml")); InputStream getConfig = checkNotNull(XmlFileLoader.getResourceAsStream("netconfMessages/getConfig.xml")); Socket clientSocket = new Socket(netconfAddress.getHostString(), netconfAddress.getPort()); DataOutputStream outToServer = new DataOutputStream(clientSocket.getOutputStream()); InputStreamReader inFromServer = new InputStreamReader(clientSocket.getInputStream()); StringBuffer sb = new StringBuffer(); while (sb.toString().endsWith("]]>]]>") == false) { sb.append((char) inFromServer.read()); } LOG.info(sb.toString()); outToServer.write(ByteStreams.toByteArray(clientHello)); outToServer.write("]]>]]>".getBytes()); outToServer.flush(); // Thread.sleep(100); outToServer.write(ByteStreams.toByteArray(getConfig)); outToServer.write("]]>]]>".getBytes()); outToServer.flush(); Thread.sleep(100); sb = new StringBuffer(); while (sb.toString().endsWith("]]>]]>") == false) { sb.append((char) inFromServer.read()); } LOG.info(sb.toString()); clientSocket.close(); } } /** * <API key> based runnable */ public final class <API key> implements Runnable { @Override public void run() { try { final <API key> netconfClient = new <API key>(Thread.currentThread().getName(), <API key>, getClientConfig()); long sessionId = netconfClient.getSessionId(); LOG.info("Client with session id {}: hello exchanged", sessionId); final NetconfMessage getMessage = XmlFileLoader .<API key>("netconfMessages/getConfig.xml"); NetconfMessage result = netconfClient.sendRequest(getMessage).get(); LOG.info("Client with session id {}: got result {}", sessionId, result); Preconditions.checkState(NetconfMessageUtil.isErrorMessage(result) == false, "Received error response: " + XmlUtil.toString(result.getDocument()) + " to request: " + XmlUtil.toString(getMessage.getDocument())); netconfClient.close(); LOG.info("Client with session id {}: ended", sessionId); } catch (final Exception e) { throw new <API key>(Thread.currentThread().getName(), e); } } private <API key> getClientConfig() { final <API key> b = <API key>.create(); b.withAddress(netconfAddress); b.<API key>(new <API key>("uname", "10.10.10.1", "830", "tcp", "client")); b.withSessionListener(new <API key>()); b.<API key>(new <API key>(GlobalEventExecutor.INSTANCE, <API key>.<API key>)); return b.build(); } } }
var config = { type: Phaser.WEBGL, parent: 'phaser-example', scene: { preload: preload, create: create } }; var game = new Phaser.Game(config); function preload() { this.load.image('bunny', 'assets/sprites/bunny.png'); } function create() { var parent = this.add.image(0, 0, 'bunny'); var child = this.add.image(100, 100, 'bunny'); parent.alpha = 0.5; }
package org.eclipse.jdt.core.refactoring.participants; import org.eclipse.ltk.core.refactoring.RefactoringStatus; import org.eclipse.ltk.core.refactoring.participants.<API key>; import org.eclipse.ltk.core.refactoring.participants.<API key>; import org.eclipse.ltk.core.refactoring.participants.<API key>; import org.eclipse.ltk.core.refactoring.participants.<API key>; import org.eclipse.ltk.core.refactoring.participants.<API key>; import org.eclipse.jdt.core.IMethod; /** * Facade to access participants to the participant extension points * provided by the org.eclipse.jdt.core.manipulation plug-in. * <p> * Note: this class is not intended to be extended or instantiated by clients. * </p> * * @since 1.2 * * @noinstantiate This class is not intended to be instantiated by clients. * @noextend This class is not intended to be subclassed by clients. */ public class <API key> { private final static String PLUGIN_ID= "org.eclipse.jdt.core.manipulation"; //$NON-NLS-1$ private <API key>() { // no instance } private static final String <API key>= "<API key>"; //$NON-NLS-1$ private static <API key> <API key>= new <API key>(PLUGIN_ID, <API key>, <API key>.class); /** * Loads the change method signature participants for the given element. * * @param status a refactoring status to report status if problems occurred while * loading the participants * @param processor the processor that will own the participants * @param method the method to be changed * @param arguments the change method signature arguments describing the change * @param filter a participant filter to exclude certain participants, or <code>null</code> * if no filtering is desired * @param affectedNatures an array of project natures affected by the refactoring * @param shared a list of shared participants * * @return an array of change method signature participants */ public static <API key>[] <API key>(RefactoringStatus status, <API key> processor, IMethod method, <API key> arguments, <API key> filter, String[] affectedNatures, <API key> shared) { <API key>[] participants= <API key>.getParticipants(status, processor, method, arguments, filter, affectedNatures, shared); <API key>[] result= new <API key>[participants.length]; System.arraycopy(participants, 0, result, 0, participants.length); return result; } }
package com.teamNikaml.bipinography.activity; import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Window; import android.widget.Toast; import com.android.volley.Request.Method; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.JsonObjectRequest; import com.teamNikaml.bipinography.app.AppConst; import com.teamNikaml.bipinography.app.AppController; import com.teamNikaml.bipinography.helper.AppRater; import com.teamNikaml.bipinography.picasa.model.Category; public class SplashActivity extends Activity { private static final String TAG = SplashActivity.class.getSimpleName(); private static final String TAG_FEED = "feed", TAG_ENTRY = "entry", TAG_GPHOTO_ID = "gphoto$id", TAG_T = "$t", TAG_ALBUM_TITLE = "title"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().requestFeature(Window.FEATURE_ACTION_BAR); getActionBar().hide(); setContentView(R.layout.activity_splash); AppRater.app_launched(this); // Picasa request to get list of albums String url = AppConst.URL_PICASA_ALBUMS .replace("_PICASA_USER_", AppController.getInstance() .getPrefManger().getGoogleUserName()); // Preparing volley's json object request JsonObjectRequest jsonObjReq = new JsonObjectRequest(Method.GET, url, null, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { List<Category> albums = new ArrayList<Category>(); try { // Parsing the json response JSONArray entry = response.getJSONObject(TAG_FEED) .getJSONArray(TAG_ENTRY); // loop through albums nodes and add them to album // list for (int i = 0; i < entry.length(); i++) { JSONObject albumObj = (JSONObject) entry.get(i); // album id String albumId = albumObj.getJSONObject( TAG_GPHOTO_ID).getString(TAG_T); // album title String albumTitle = albumObj.getJSONObject( TAG_ALBUM_TITLE).getString(TAG_T); Category album = new Category(); album.setId(albumId); album.setTitle(albumTitle); // add album to list albums.add(album); } // Store albums in shared pref AppController.getInstance().getPrefManger() .storeCategories(albums); // String the main activity Intent intent = new Intent(<API key>(), WallpaperActivity.class); startActivity(intent); // closing spalsh activity finish(); } catch (JSONException e) { e.printStackTrace(); Toast.makeText(<API key>(), getString(R.string.msg_unknown_error), Toast.LENGTH_LONG).show(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { // show error toast Toast.makeText(<API key>(), getString(R.string.splash_error), Toast.LENGTH_LONG).show(); // Unable to fetch albums // check for existing Albums data in Shared Preferences if (AppController.getInstance().getPrefManger() .getCategories() != null && AppController.getInstance().getPrefManger() .getCategories().size() > 0) { // String the main activity Intent intent = new Intent(<API key>(), WallpaperActivity.class); startActivity(intent); // closing spalsh activity finish(); } else { // Albums data not present in the shared preferences // Launch settings activity, so that user can modify // the settings Intent i = new Intent(SplashActivity.this, SettingsActivity.class); // clear all the activities i.setFlags(Intent.<API key> | Intent.<API key>); startActivity(i); } } }); // disable the cache for this request, so that it always fetches updated // json jsonObjReq.setShouldCache(false); // Making the request AppController.getInstance().addToRequestQueue(jsonObjReq); } }
package fr.obeo.dsl.minidrone.application; import org.eclipse.jface.action.IMenuManager; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.application.ActionBarAdvisor; import org.eclipse.ui.application.<API key>; public class <API key> extends ActionBarAdvisor { public <API key>(<API key> configurer) { super(configurer); } protected void makeActions(IWorkbenchWindow window) { } protected void fillMenuBar(IMenuManager menuBar) { } }
package com.python.pydev.codecompletion.participant; import java.io.File; import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.jface.text.Document; import org.python.pydev.ast.codecompletion.PyCodeCompletion; import org.python.pydev.ast.codecompletion.<API key>; import org.python.pydev.ast.codecompletion.revisited.modules.SourceToken; import org.python.pydev.core.IToken; import org.python.pydev.core.TestDependent; import org.python.pydev.core.TokensList; import org.python.pydev.core.proposals.<API key>; import org.python.pydev.editor.actions.PySelectionTest; import org.python.pydev.editor.codecompletion.proposals.<API key>; import org.python.pydev.editor.codecompletion.proposals.<API key>; import org.python.pydev.parser.jython.ast.Import; import org.python.pydev.parser.jython.ast.NameTok; import org.python.pydev.parser.jython.ast.aliasType; import org.python.pydev.shared_core.code_completion.<API key>; import org.python.pydev.shared_core.preferences.<API key>; import com.python.pydev.analysis.AnalysisPreferences; import com.python.pydev.analysis.additionalinfo.<API key>; import com.python.pydev.codecompletion.ctxinsensitive.CtxParticipant; public class <API key> extends <API key> { public static void main(String[] args) { <API key> test = new <API key>(); try { test.setUp(); test.<API key>(); test.tearDown(); junit.textui.TestRunner.run(<API key>.class); } catch (Throwable e) { e.printStackTrace(); } } @Override public void setUp() throws Exception { // <API key> = true; -- just for testing purposes super.setUp(); codeCompletion = new PyCodeCompletion(); <API key>.set(new <API key>()); } @Override public void tearDown() throws Exception { super.tearDown(); <API key>.<API key> = null; <API key>.set(null); } @Override protected String <API key>() { return TestDependent.<API key>(true, isPython3Test()) + "|" + TestDependent.<API key> + "myzipmodule.zip" + "|" + TestDependent.<API key> + "myeggmodule.egg"; } public void <API key>() throws Exception { participant = new <API key>(); //check simple <API key>[] proposals = requestCompl( "unittest", -1, -1, new String[] { "unittest", "unittest - testlib" }); //the unittest module and testlib.unittest Document document = new Document("unittest"); <API key> p0 = null; <API key> p1 = null; for (<API key> p : proposals) { String displayString = p.getDisplayString(); if (displayString.equals("unittest")) { p0 = p; } else if (displayString.equals("unittest - testlib")) { p1 = p; } } if (p0 == null) { fail("Could not find unittest import"); } if (p1 == null) { fail("Could not find unittest - testlib import"); } ((<API key>) p0).indentString = " "; ((<API key>) p0).apply(document, ' ', 0, 8); PySelectionTest.checkStrEquals("import unittest\r\nunittest", document.get()); document = new Document("unittest"); ((<API key>) p1).indentString = " "; ((<API key>) p1).apply(document, ' ', 0, 8); PySelectionTest.checkStrEquals("from testlib import unittest\r\nunittest", document.get()); document = new Document("unittest"); final IEclipsePreferences prefs = new <API key>(); <API key>.<API key> = () -> prefs; document = new Document("unittest"); prefs.putBoolean(<API key>.<API key>, false); ((<API key>) p1).indentString = " "; ((<API key>) p1).apply(document, '.', 0, 8); PySelectionTest.checkStrEquals("unittest.", document.get()); document = new Document("unittest"); prefs.putBoolean(<API key>.<API key>, true); ((<API key>) p1).indentString = " "; ((<API key>) p1).apply(document, '.', 0, 8); PySelectionTest.checkStrEquals("from testlib import unittest\r\nunittest.", document.get()); //for imports, the behavior never changes AnalysisPreferences.<API key> = true; try { proposals = requestCompl("_priv3", new String[] { "_priv3 - relative.rel1._priv1._priv2" }); document = new Document("_priv3"); ((<API key>) proposals[0]).indentString = " "; ((<API key>) proposals[0]).apply(document, ' ', 0, 6); PySelectionTest.checkStrEquals("from relative.rel1._priv1._priv2 import _priv3\r\n_priv3", document.get()); } finally { AnalysisPreferences.<API key> = false; } //check on actual file requestCompl(new File(TestDependent.<API key> + "/testlib/unittest/guitestcase.py"), "guite", -1, 0, new String[] {}); Import importTok = new Import(new aliasType[] { new aliasType(new NameTok("unittest", NameTok.ImportModule), null) }); this.imports = new TokensList(new IToken[] { new SourceToken(importTok, "unittest", "", "", "", null) }); requestCompl("import unittest\nunittest", new String[] {}); //none because the import for unittest is already there requestCompl("import unittest\nunittes", new String[] {}); //the local import for unittest (won't actually show anything because we're only exercising the participant test) this.imports = null; } public void <API key>() throws Exception { participant = new <API key>(); <API key>[] proposals = requestCompl("myzip", -1, -1, new String[] {}); assertContains("myzipfile - myzipmodule", proposals); assertContains("myzipmodule", proposals); proposals = requestCompl("myegg", -1, -1, new String[] {}); assertContains("myeggfile - myeggmodule", proposals); assertContains("myeggmodule", proposals); } public void <API key>() throws Exception { participant = new CtxParticipant(); <API key>[] proposals = requestCompl("myzipc", -1, -1, new String[] {}); assertContains("MyZipClass - myzipmodule.myzipfile", proposals); proposals = requestCompl("myegg", -1, -1, new String[] {}); assertContains("MyEggClass - myeggmodule.myeggfile", proposals); } public void <API key>() throws Exception { participant = new CtxParticipant(); <API key>[] proposals = requestCompl("xml", -1, -1, new String[] {}); assertNotContains("xml - xmlrpclib", proposals); requestCompl(new File(TestDependent.<API key> + "/testlib/unittest/guitestcase.py"), "guite", -1, 0, new String[] {}); //the behavior changes for tokens on modules AnalysisPreferences.<API key> = true; try { proposals = requestCompl("Priv3", new String[] { "Priv3 - relative.rel1._priv1._priv2._priv3" }); Document document = new Document("Priv3"); ((<API key>) proposals[0]).indentString = " "; ((<API key>) proposals[0]).apply(document, ' ', 0, 5); PySelectionTest.checkStrEquals("from relative.rel1 import Priv3\r\nPriv3", document.get()); } finally { AnalysisPreferences.<API key> = false; } } }
package treehou.se.habit.ui.util; import android.content.Context; import android.graphics.Color; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.DefaultItemAnimator; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.mikepenz.<API key>.CommunityMaterial; import com.mikepenz.iconics.IconicsDrawable; import com.mikepenz.iconics.typeface.IIcon; import java.util.ArrayList; import java.util.List; import treehou.se.habit.R; import treehou.se.habit.util.Util; /** * Fragment for picking categories of icons. */ public class <API key> extends Fragment { private RecyclerView lstIcons; private CategoryAdapter adapter; private ViewGroup container; public static <API key> newInstance() { <API key> fragment = new <API key>(); Bundle args = new Bundle(); fragment.setArguments(args); return fragment; } public <API key>() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.<API key>, null); lstIcons = (RecyclerView) rootView.findViewById(R.id.lst_categories); lstIcons.setItemAnimator(new DefaultItemAnimator()); lstIcons.setLayoutManager(new LinearLayoutManager(getActivity())); // Hookup list of categories adapter = new CategoryAdapter(getActivity()); adapter.add(new CategoryPicker(CommunityMaterial.Icon.cmd_play, getString(R.string.media), Util.IconCategory.MEDIA)); adapter.add(new CategoryPicker(CommunityMaterial.Icon.cmd_alarm, getString(R.string.sensor), Util.IconCategory.SENSORS)); adapter.add(new CategoryPicker(CommunityMaterial.Icon.cmd_power, getString(R.string.command), Util.IconCategory.COMMANDS)); adapter.add(new CategoryPicker(CommunityMaterial.Icon.cmd_arrow_up, getString(R.string.arrows), Util.IconCategory.ARROWS)); adapter.add(new CategoryPicker(CommunityMaterial.Icon.cmd_view_module, getString(R.string.all), Util.IconCategory.ALL)); lstIcons.setAdapter(adapter); this.container = container; return rootView; } private class CategoryPicker { private IIcon icon; private String category; private Util.IconCategory id; public CategoryPicker(IIcon icon, String category, Util.IconCategory id) { this.icon = icon; this.category = category; this.id = id; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } public IIcon getIcon() { return icon; } public void setIcon(IIcon icon) { this.icon = icon; } public Util.IconCategory getId() { return id; } public void setId(Util.IconCategory id) { this.id = id; } } private class CategoryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private Context context; private List<CategoryPicker> categories = new ArrayList<>(); class CategoryHolder extends RecyclerView.ViewHolder { public ImageView imgIcon; public TextView lblCategory; public CategoryHolder(View itemView) { super(itemView); imgIcon = (ImageView) itemView.findViewById(R.id.img_menu); lblCategory = (TextView) itemView.findViewById(R.id.lbl_label); } } public CategoryAdapter(Context context) { this.context = context; } public void add(CategoryPicker category){ categories.add(category); <API key>(); } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(context); View itemView = inflater.inflate(R.layout.item_category, parent, false); return new CategoryHolder(itemView); } @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { final CategoryPicker item = categories.get(position); CategoryHolder catHolder = (CategoryHolder) holder; IconicsDrawable drawable = new IconicsDrawable(getActivity(), item.getIcon()).color(Color.BLACK).sizeDp(50); catHolder.imgIcon.setImageDrawable(drawable); catHolder.lblCategory.setText(item.getCategory()); holder.itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getActivity().<API key>().beginTransaction() .replace(container.getId(), IconPickerFragment.newInstance(item.getId())) .addToBackStack(null) .commit(); } }); } @Override public int getItemCount() { return categories.size(); } } }
package edu.umn.msi.tropix.persistence.service; import javax.annotation.Nullable; import edu.umn.msi.tropix.models.<API key>; import edu.umn.msi.tropix.persistence.aop.Modifies; import edu.umn.msi.tropix.persistence.aop.PersistenceMethod; import edu.umn.msi.tropix.persistence.aop.Reads; import edu.umn.msi.tropix.persistence.aop.UserId; public interface <API key> { @PersistenceMethod <API key> <API key>(@UserId String userId, @Nullable @Modifies String destinationId, <API key> <API key>, @Modifies String dataReportId, @Reads String[] inputRunIds, @Nullable @Reads String trainingId, @Modifies String outputFileId); }
package org.python.pydev.editor.codecompletion.revisited; import java.io.File; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; import java.util.SortedMap; import java.util.TreeMap; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.python.pydev.core.DeltaSaver; import org.python.pydev.core.<API key>; import org.python.pydev.core.IInterpreterInfo; import org.python.pydev.core.IInterpreterManager; import org.python.pydev.core.IModule; import org.python.pydev.core.IModulesManager; import org.python.pydev.core.<API key>; import org.python.pydev.core.IPythonNature; import org.python.pydev.core.IPythonPathNature; import org.python.pydev.core.<API key>; import org.python.pydev.core.ModulesKey; import org.python.pydev.core.log.Log; import org.python.pydev.editor.codecompletion.revisited.javaintegration.<API key>; import org.python.pydev.plugin.nature.PythonNature; import org.python.pydev.shared_core.io.FileUtils; import org.python.pydev.shared_core.string.StringUtils; import org.python.pydev.shared_core.structure.Tuple; /** * @author Fabio Zadrozny */ public final class <API key> extends <API key> implements <API key> { private static final boolean DEBUG_MODULES = false; //these attributes must be set whenever this class is restored. private volatile IProject project; private volatile IPythonNature nature; public <API key>() { } /** * @see org.python.pydev.core.<API key>#setProject(org.eclipse.core.resources.IProject, boolean) */ @Override public void setProject(IProject project, IPythonNature nature, boolean restoreDeltas) { this.project = project; this.nature = nature; File completionsCacheDir = this.nature.<API key>(); if (completionsCacheDir == null) { return; //project was deleted. } DeltaSaver<ModulesKey> d = this.deltaSaver = new DeltaSaver<ModulesKey>(completionsCacheDir, "v1_astdelta", readFromFileMethod, toFileMethod); if (!restoreDeltas) { d.clearAll(); //remove any existing deltas } else { d.processDeltas(this); //process the current deltas (clears current deltas automatically and saves it when the processing is concluded) } } /** * @see org.python.pydev.core.<API key>#endProcessing() */ @Override public void endProcessing() { //save it with the updated info nature.saveAstManager(); } /** * @see org.python.pydev.core.<API key>#setPythonNature(org.python.pydev.core.IPythonNature) */ @Override public void setPythonNature(IPythonNature nature) { this.nature = nature; } /** * @see org.python.pydev.core.<API key>#getNature() */ @Override public IPythonNature getNature() { return nature; } /** * @param <API key> * @see org.python.pydev.core.<API key>#<API key>() */ @Override public <API key> <API key>() { if (nature == null) { Log.log("Nature still not set"); return null; //still not set (initialization) } try { return nature.<API key>().getModulesManager(); } catch (Exception e1) { return null; } } /** * @see org.python.pydev.core.<API key>#getAllModuleNames(boolean addDependencies, String <API key>) */ @Override public Set<String> getAllModuleNames(boolean addDependencies, String <API key>) { if (addDependencies) { Set<String> s = new HashSet<String>(); IModulesManager[] managersInvolved = this.getManagersInvolved(true); for (int i = 0; i < managersInvolved.length; i++) { s.addAll(managersInvolved[i].getAllModuleNames(false, <API key>)); } return s; } else { return super.getAllModuleNames(addDependencies, <API key>); } } /** * @return all the modules that start with some token (from this manager and others involved) */ @Override public SortedMap<ModulesKey, ModulesKey> <API key>(String strStartingWith) { SortedMap<ModulesKey, ModulesKey> ret = new TreeMap<ModulesKey, ModulesKey>(); IModulesManager[] managersInvolved = this.getManagersInvolved(true); for (int i = 0; i < managersInvolved.length; i++) { ret.putAll(managersInvolved[i].<API key>(strStartingWith)); } return ret; } /** * @see org.python.pydev.core.<API key>#getModule(java.lang.String, org.python.pydev.plugin.nature.PythonNature, boolean) */ @Override public IModule getModule(String name, IPythonNature nature, boolean dontSearchInit) { return getModule(name, nature, true, dontSearchInit); } /** * When looking for relative, we do not check dependencies */ @Override public IModule getRelativeModule(String name, IPythonNature nature) { return super.getModule(false, name, nature, true); //cannot be a compiled module } /** * @see org.python.pydev.core.<API key>#getModule(java.lang.String, org.python.pydev.plugin.nature.PythonNature, boolean, boolean) */ @Override public IModule getModule(String name, IPythonNature nature, boolean checkSystemManager, boolean dontSearchInit) { Tuple<IModule, IModulesManager> ret = <API key>(name, nature, checkSystemManager, dontSearchInit); if (ret != null) { return ret.o1; } return null; } /** * @return a tuple with the IModule requested and the IModulesManager that contained that module. */ @Override public Tuple<IModule, IModulesManager> <API key>(String name, IPythonNature nature, boolean checkSystemManager, boolean dontSearchInit) { IModule module = null; IModulesManager[] managersInvolved = this.getManagersInvolved(true); //only get the system manager here (to avoid recursion) for (IModulesManager m : managersInvolved) { if (m instanceof <API key>) { module = ((<API key>) m).getBuiltinModule(name, dontSearchInit); if (module != null) { if (DEBUG_MODULES) { System.out.println("Trying to get:" + name + " - " + " returned builtin:" + module + " - " + m.getClass()); } return new Tuple<IModule, IModulesManager>(module, m); } } } for (IModulesManager m : managersInvolved) { if (m instanceof <API key>) { <API key> pM = (<API key>) m; module = pM.<API key>(name, nature, dontSearchInit); } else if (m instanceof <API key>) { <API key> <API key> = (<API key>) m; module = <API key>.<API key>(name, nature, dontSearchInit); } else { throw new RuntimeException("Unexpected: " + m); } if (module != null) { if (DEBUG_MODULES) { System.out.println("Trying to get:" + name + " - " + " returned:" + module + " - " + m.getClass()); } return new Tuple<IModule, IModulesManager>(module, m); } } if (DEBUG_MODULES) { System.out.println("Trying to get:" + name + " - " + " returned:null - " + this.getClass()); } return null; } /** * Only searches the modules contained in the direct modules manager. */ @Override public IModule <API key>(String name, IPythonNature nature, boolean dontSearchInit) { return super.getModule(name, nature, dontSearchInit); } @Override protected String getResolveModuleErr(IResource member) { return "Unable to find the path " + member + " in the project were it\n" + "is added as a source folder for pydev (project: " + project.getName() + ")"; } public String <API key>(String fileAbsolutePath, boolean addExternal) throws CoreException { String <API key> = this.nature.getPythonPathNature().<API key>(addExternal); List<String> pathItems = StringUtils.<API key>(<API key>, '|'); List<String> filteredPathItems = <API key>(pathItems); return this.pythonPathHelper.resolveModule(fileAbsolutePath, false, filteredPathItems, project); } private List<String> <API key>(List<String> pathItems) { return new ArrayList<>(new LinkedHashSet<>(pathItems)); } /** * @see org.python.pydev.core.<API key>#resolveModule(java.lang.String) */ @Override public String resolveModule(String full) { return resolveModule(full, true); } /** * @see org.python.pydev.core.<API key>#resolveModule(java.lang.String, boolean) */ @Override public String resolveModule(String full, boolean checkSystemManager) { IModulesManager[] managersInvolved = this.getManagersInvolved(checkSystemManager); for (IModulesManager m : managersInvolved) { String mod; if (m instanceof <API key>) { <API key> pM = (<API key>) m; mod = pM.<API key>(full); } else { mod = m.resolveModule(full); } if (mod != null) { return mod; } } return null; } @Override public String <API key>(String full) { if (nature != null) { return pythonPathHelper.resolveModule(full, false, nature.getProject()); } return super.resolveModule(full); } @Override public String <API key>(IFile member) { File inOs = member.getRawLocation().toFile(); return <API key>(FileUtils.getFileAbsolutePath(inOs)); } /** * @see org.python.pydev.core.<API key>#getSize(boolean) */ @Override public int getSize(boolean addDependenciesSize) { if (addDependenciesSize) { int size = 0; IModulesManager[] managersInvolved = this.getManagersInvolved(true); for (int i = 0; i < managersInvolved.length; i++) { size += managersInvolved[i].getSize(false); } return size; } else { return super.getSize(addDependenciesSize); } } /** * @see org.python.pydev.core.<API key>#getBuiltins() */ @Override public String[] getBuiltins() { String[] builtins = null; <API key> <API key> = <API key>(); if (<API key> != null) { builtins = <API key>.getBuiltins(); } return builtins; } /** * @param checkSystemManager whether the system manager should be added * @param referenced true if we should get the referenced projects * false if we should get the referencing projects * @return the Managers that this project references or the ones that reference this project (depends on 'referenced') * * Change in 1.3.3: adds itself to the list of returned managers */ private synchronized IModulesManager[] getManagers(boolean checkSystemManager, boolean referenced) { CompletionCache <API key> = this.completionCache; if (<API key> != null) { IModulesManager[] ret = <API key>.getManagers(referenced); if (ret != null) { return ret; } } ArrayList<IModulesManager> list = new ArrayList<IModulesManager>(); <API key> <API key> = <API key>(); //add itself 1st list.add(this); //get the projects 1st if (project != null) { IModulesManager <API key> = <API key> .<API key>(project); if (<API key> != null) { list.add(<API key>); } Set<IProject> projs; if (referenced) { projs = <API key>(project); } else { projs = <API key>(project); } addModuleManagers(list, projs); } //the system is the last one we add if (checkSystemManager && <API key> != null) { //may be null in initialization or if the project does not have a related interpreter manager at the present time //(i.e.: misconfigured project) list.add(<API key>); } IModulesManager[] ret = list.toArray(new IModulesManager[list.size()]); if (<API key> != null) { <API key>.setManagers(ret, referenced); } return ret; } public static Set<IProject> <API key>(IProject project) { HashSet<IProject> memo = new HashSet<IProject>(); <API key>(project, false, memo); memo.remove(project); //shouldn't happen unless we've a cycle... return memo; } public static Set<IProject> <API key>(IProject project) { HashSet<IProject> memo = new HashSet<IProject>(); <API key>(project, true, memo); memo.remove(project); //shouldn't happen unless we've a cycle... return memo; } /** * @param project the project for which we want references. * @param referenced whether we want to get the referenced projects or the ones referencing this one. * @param memo (out) this is the place where all the projects will e available. * * Note: the project itself will not be added. */ private static void <API key>(IProject project, boolean referenced, HashSet<IProject> memo) { IProject[] projects = null; try { if (project == null || !project.isOpen() || !project.exists() || memo.contains(projects)) { return; } if (referenced) { projects = project.<API key>(); } else { projects = project.<API key>(); } } catch (CoreException e) { //ignore (it's closed) } if (projects != null) { for (IProject p : projects) { if (!memo.contains(p)) { memo.add(p); <API key>(p, referenced, memo); } } } } /** * @param list the list that will be filled with the managers * @param projects the projects that should have the managers added */ private void addModuleManagers(ArrayList<IModulesManager> list, Collection<IProject> projects) { for (IProject project : projects) { PythonNature nature = PythonNature.getPythonNature(project); if (nature != null) { <API key> <API key> = nature.getAstManager(); if (<API key> != null) { IModulesManager <API key> = <API key>.getModulesManager(); if (<API key> != null) { list.add(<API key>); } } else { //Removed the warning below: this may be common when starting up... //String msg = "No ast manager configured for :" + project.getName(); //Log.log(IStatus.WARNING, msg, new RuntimeException(msg)); } } IModulesManager <API key> = <API key> .<API key>(project); if (<API key> != null) { list.add(<API key>); } } } /** * @return Returns the managers that this project references, including itself. */ public IModulesManager[] getManagersInvolved(boolean checkSystemManager) { return getManagers(checkSystemManager, true); } /** * @return Returns the managers that reference this project, including itself. */ public IModulesManager[] <API key>(boolean checkSystemManager) { return getManagers(checkSystemManager, false); } /** * Helper to work as a timer to know when to check for pythonpath consistencies. */ private volatile long <API key> = 0; /** * @see org.python.pydev.core.<API key>#<API key>() */ @Override public List<String> <API key>(IInterpreterInfo interpreter, IInterpreterManager manager) { List<String> l = new ArrayList<String>(); IModulesManager[] managersInvolved = getManagersInvolved(true); for (IModulesManager m : managersInvolved) { if (m instanceof <API key>) { <API key> <API key> = (<API key>) m; l.addAll(<API key>.<API key>(interpreter, manager)); } else { PythonPathHelper h = (PythonPathHelper) m.getPythonPathHelper(); if (h != null) { List<String> pythonpath = h.getPythonpath(); //Note: this was previously only l.addAll(pythonpath), and was changed to the code below as a place //to check for consistencies in the pythonpath stored in the pythonpath helper and the pythonpath //available in the PythonPathNature (in general, when requesting it the PythonPathHelper should be //used, as it's a cache for the resolved values of the PythonPathNature). boolean forceCheck = false; <API key> m2 = null; String <API key> = null; if (m instanceof <API key>) { long currentTimeMillis = System.currentTimeMillis(); m2 = (<API key>) m; //check at most once every 20 seconds (or every time if the pythonpath is empty... in which case //it should be fast to get it too if it's consistent). if (pythonpath.size() == 0 || currentTimeMillis - m2.<API key> > 20 * 1000) { try { IPythonNature n = m.getNature(); if (n != null) { IPythonPathNature pythonPathNature = n.getPythonPathNature(); if (pythonPathNature != null) { <API key> = pythonPathNature.<API key>(true); m2.<API key> = currentTimeMillis; forceCheck = true; } } } catch (Exception e) { Log.log(e); } } } if (forceCheck) { //Check if it's actually correct and auto-fix if it's not. List<String> parsed = PythonPathHelper.<API key>(<API key>, null); if (m2.nature != null && !new HashSet<String>(parsed).equals(new HashSet<String>(pythonpath))) { // Make it right at this moment (so any other place that calls it before the restore //takes place has the proper version). h.setPythonPath(parsed); // Force a rebuild as the PythonPathHelper paths are not up to date. m2.nature.rebuildPath(); } l.addAll(parsed); //add the proper paths } else { l.addAll(pythonpath); } } } } return l; } }
package com.coin.arbitrage.huobi.util; /** * @author Frank * */ public enum DepthType { STEP0("step0"), STEP1("step1"), STEP2("step2"), STEP3("step3"), STEP4("step4"), STEP5("step5"); private String depth; private DepthType(String depth) { this.depth = depth; } public String getDepth() { return depth; } }
package Debrief.Tools.Tote; import MWC.GUI.PlainChart; import MWC.GUI.ToolParent; import MWC.GUI.Tools.Action; import MWC.GUI.Tools.PlainTool; public final class StartTote extends PlainTool { private static final long serialVersionUID = 1L; // member variables private final PlainChart _theChart; // constructor public StartTote(final ToolParent theParent, final PlainChart theChart) { super(theParent, "Step Forward", null); _theChart = theChart; } @Override public final void execute() { _theChart.update(); } // member functions @Override public final Action getData() { // return the product return null; } }
package org.liquibase.xml.ns.dbchangelog.impl; import java.util.Collection; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.common.util.EList; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.MinimalEObjectImpl; import org.eclipse.emf.ecore.util.BasicFeatureMap; import org.eclipse.emf.ecore.util.FeatureMap; import org.eclipse.emf.ecore.util.InternalEList; import org.liquibase.xml.ns.dbchangelog.AndType; import org.liquibase.xml.ns.dbchangelog.<API key>; import org.liquibase.xml.ns.dbchangelog.<API key>; import org.liquibase.xml.ns.dbchangelog.ColumnExistsType; import org.liquibase.xml.ns.dbchangelog.<API key>; import org.liquibase.xml.ns.dbchangelog.DbchangelogPackage; import org.liquibase.xml.ns.dbchangelog.DbmsType; import org.liquibase.xml.ns.dbchangelog.<API key>; import org.liquibase.xml.ns.dbchangelog.<API key>; import org.liquibase.xml.ns.dbchangelog.IndexExistsType; import org.liquibase.xml.ns.dbchangelog.NotType; import org.liquibase.xml.ns.dbchangelog.OrType; import org.liquibase.xml.ns.dbchangelog.<API key>; import org.liquibase.xml.ns.dbchangelog.RowCountType; import org.liquibase.xml.ns.dbchangelog.RunningAsType; import org.liquibase.xml.ns.dbchangelog.SequenceExistsType; import org.liquibase.xml.ns.dbchangelog.SqlCheckType; import org.liquibase.xml.ns.dbchangelog.TableExistsType; import org.liquibase.xml.ns.dbchangelog.TableIsEmptyType; import org.liquibase.xml.ns.dbchangelog.ViewExistsType; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>And Type</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getGroup <em>Group</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getAnd <em>And</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getOr <em>Or</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getNot <em>Not</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getDbms <em>Dbms</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getRunningAs <em>Running As</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#<API key> <em>Change Set Executed</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getTableExists <em>Table Exists</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getColumnExists <em>Column Exists</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getSequenceExists <em>Sequence Exists</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#<API key> <em>Foreign Key Constraint Exists</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getIndexExists <em>Index Exists</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getPrimaryKeyExists <em>Primary Key Exists</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getViewExists <em>View Exists</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getTableIsEmpty <em>Table Is Empty</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getRowCount <em>Row Count</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getSqlCheck <em>Sql Check</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#<API key> <em>Change Log Property Defined</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#<API key> <em>Expected Quoting Strategy</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#<API key> <em>Custom Precondition</em>}</li> * <li>{@link org.liquibase.xml.ns.dbchangelog.impl.AndTypeImpl#getAny <em>Any</em>}</li> * </ul> * * @generated */ public class AndTypeImpl extends MinimalEObjectImpl.Container implements AndType { /** * The cached value of the '{@link #getGroup() <em>Group</em>}' attribute list. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getGroup() * @generated * @ordered */ protected FeatureMap group; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected AndTypeImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return DbchangelogPackage.eINSTANCE.getAndType(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public FeatureMap getGroup() { if (group == null) { group = new BasicFeatureMap(this, DbchangelogPackage.AND_TYPE__GROUP); } return group; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<AndType> getAnd() { return getGroup().list(DbchangelogPackage.eINSTANCE.getAndType_And()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<OrType> getOr() { return getGroup().list(DbchangelogPackage.eINSTANCE.getAndType_Or()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<NotType> getNot() { return getGroup().list(DbchangelogPackage.eINSTANCE.getAndType_Not()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<DbmsType> getDbms() { return getGroup().list(DbchangelogPackage.eINSTANCE.getAndType_Dbms()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<RunningAsType> getRunningAs() { return getGroup().list(DbchangelogPackage.eINSTANCE.<API key>()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<<API key>> <API key>() { return getGroup().list(DbchangelogPackage.eINSTANCE.<API key>()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<TableExistsType> getTableExists() { return getGroup().list(DbchangelogPackage.eINSTANCE.<API key>()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<ColumnExistsType> getColumnExists() { return getGroup().list(DbchangelogPackage.eINSTANCE.<API key>()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<SequenceExistsType> getSequenceExists() { return getGroup().list(DbchangelogPackage.eINSTANCE.<API key>()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<<API key>> <API key>() { return getGroup().list(DbchangelogPackage.eINSTANCE.<API key>()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<IndexExistsType> getIndexExists() { return getGroup().list(DbchangelogPackage.eINSTANCE.<API key>()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<<API key>> getPrimaryKeyExists() { return getGroup().list(DbchangelogPackage.eINSTANCE.<API key>()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<ViewExistsType> getViewExists() { return getGroup().list(DbchangelogPackage.eINSTANCE.<API key>()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<TableIsEmptyType> getTableIsEmpty() { return getGroup().list(DbchangelogPackage.eINSTANCE.<API key>()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<RowCountType> getRowCount() { return getGroup().list(DbchangelogPackage.eINSTANCE.getAndType_RowCount()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<SqlCheckType> getSqlCheck() { return getGroup().list(DbchangelogPackage.eINSTANCE.getAndType_SqlCheck()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<<API key>> <API key>() { return getGroup().list(DbchangelogPackage.eINSTANCE.<API key>()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<<API key>> <API key>() { return getGroup().list(DbchangelogPackage.eINSTANCE.<API key>()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public EList<<API key>> <API key>() { return getGroup().list(DbchangelogPackage.eINSTANCE.<API key>()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public FeatureMap getAny() { return (FeatureMap)getGroup().<FeatureMap.Entry>list(DbchangelogPackage.eINSTANCE.getAndType_Any()); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case DbchangelogPackage.AND_TYPE__GROUP: return ((InternalEList<?>)getGroup()).basicRemove(otherEnd, msgs); case DbchangelogPackage.AND_TYPE__AND: return ((InternalEList<?>)getAnd()).basicRemove(otherEnd, msgs); case DbchangelogPackage.AND_TYPE__OR: return ((InternalEList<?>)getOr()).basicRemove(otherEnd, msgs); case DbchangelogPackage.AND_TYPE__NOT: return ((InternalEList<?>)getNot()).basicRemove(otherEnd, msgs); case DbchangelogPackage.AND_TYPE__DBMS: return ((InternalEList<?>)getDbms()).basicRemove(otherEnd, msgs); case DbchangelogPackage.<API key>: return ((InternalEList<?>)getRunningAs()).basicRemove(otherEnd, msgs); case DbchangelogPackage.<API key>: return ((InternalEList<?>)<API key>()).basicRemove(otherEnd, msgs); case DbchangelogPackage.<API key>: return ((InternalEList<?>)getTableExists()).basicRemove(otherEnd, msgs); case DbchangelogPackage.<API key>: return ((InternalEList<?>)getColumnExists()).basicRemove(otherEnd, msgs); case DbchangelogPackage.<API key>: return ((InternalEList<?>)getSequenceExists()).basicRemove(otherEnd, msgs); case DbchangelogPackage.<API key>: return ((InternalEList<?>)<API key>()).basicRemove(otherEnd, msgs); case DbchangelogPackage.<API key>: return ((InternalEList<?>)getIndexExists()).basicRemove(otherEnd, msgs); case DbchangelogPackage.<API key>: return ((InternalEList<?>)getPrimaryKeyExists()).basicRemove(otherEnd, msgs); case DbchangelogPackage.<API key>: return ((InternalEList<?>)getViewExists()).basicRemove(otherEnd, msgs); case DbchangelogPackage.<API key>: return ((InternalEList<?>)getTableIsEmpty()).basicRemove(otherEnd, msgs); case DbchangelogPackage.AND_TYPE__ROW_COUNT: return ((InternalEList<?>)getRowCount()).basicRemove(otherEnd, msgs); case DbchangelogPackage.AND_TYPE__SQL_CHECK: return ((InternalEList<?>)getSqlCheck()).basicRemove(otherEnd, msgs); case DbchangelogPackage.<API key>: return ((InternalEList<?>)<API key>()).basicRemove(otherEnd, msgs); case DbchangelogPackage.<API key>: return ((InternalEList<?>)<API key>()).basicRemove(otherEnd, msgs); case DbchangelogPackage.<API key>: return ((InternalEList<?>)<API key>()).basicRemove(otherEnd, msgs); case DbchangelogPackage.AND_TYPE__ANY: return ((InternalEList<?>)getAny()).basicRemove(otherEnd, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case DbchangelogPackage.AND_TYPE__GROUP: if (coreType) return getGroup(); return ((FeatureMap.Internal)getGroup()).getWrapper(); case DbchangelogPackage.AND_TYPE__AND: return getAnd(); case DbchangelogPackage.AND_TYPE__OR: return getOr(); case DbchangelogPackage.AND_TYPE__NOT: return getNot(); case DbchangelogPackage.AND_TYPE__DBMS: return getDbms(); case DbchangelogPackage.<API key>: return getRunningAs(); case DbchangelogPackage.<API key>: return <API key>(); case DbchangelogPackage.<API key>: return getTableExists(); case DbchangelogPackage.<API key>: return getColumnExists(); case DbchangelogPackage.<API key>: return getSequenceExists(); case DbchangelogPackage.<API key>: return <API key>(); case DbchangelogPackage.<API key>: return getIndexExists(); case DbchangelogPackage.<API key>: return getPrimaryKeyExists(); case DbchangelogPackage.<API key>: return getViewExists(); case DbchangelogPackage.<API key>: return getTableIsEmpty(); case DbchangelogPackage.AND_TYPE__ROW_COUNT: return getRowCount(); case DbchangelogPackage.AND_TYPE__SQL_CHECK: return getSqlCheck(); case DbchangelogPackage.<API key>: return <API key>(); case DbchangelogPackage.<API key>: return <API key>(); case DbchangelogPackage.<API key>: return <API key>(); case DbchangelogPackage.AND_TYPE__ANY: if (coreType) return getAny(); return ((FeatureMap.Internal)getAny()).getWrapper(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @SuppressWarnings("unchecked") @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case DbchangelogPackage.AND_TYPE__GROUP: ((FeatureMap.Internal)getGroup()).set(newValue); return; case DbchangelogPackage.AND_TYPE__AND: getAnd().clear(); getAnd().addAll((Collection<? extends AndType>)newValue); return; case DbchangelogPackage.AND_TYPE__OR: getOr().clear(); getOr().addAll((Collection<? extends OrType>)newValue); return; case DbchangelogPackage.AND_TYPE__NOT: getNot().clear(); getNot().addAll((Collection<? extends NotType>)newValue); return; case DbchangelogPackage.AND_TYPE__DBMS: getDbms().clear(); getDbms().addAll((Collection<? extends DbmsType>)newValue); return; case DbchangelogPackage.<API key>: getRunningAs().clear(); getRunningAs().addAll((Collection<? extends RunningAsType>)newValue); return; case DbchangelogPackage.<API key>: <API key>().clear(); <API key>().addAll((Collection<? extends <API key>>)newValue); return; case DbchangelogPackage.<API key>: getTableExists().clear(); getTableExists().addAll((Collection<? extends TableExistsType>)newValue); return; case DbchangelogPackage.<API key>: getColumnExists().clear(); getColumnExists().addAll((Collection<? extends ColumnExistsType>)newValue); return; case DbchangelogPackage.<API key>: getSequenceExists().clear(); getSequenceExists().addAll((Collection<? extends SequenceExistsType>)newValue); return; case DbchangelogPackage.<API key>: <API key>().clear(); <API key>().addAll((Collection<? extends <API key>>)newValue); return; case DbchangelogPackage.<API key>: getIndexExists().clear(); getIndexExists().addAll((Collection<? extends IndexExistsType>)newValue); return; case DbchangelogPackage.<API key>: getPrimaryKeyExists().clear(); getPrimaryKeyExists().addAll((Collection<? extends <API key>>)newValue); return; case DbchangelogPackage.<API key>: getViewExists().clear(); getViewExists().addAll((Collection<? extends ViewExistsType>)newValue); return; case DbchangelogPackage.<API key>: getTableIsEmpty().clear(); getTableIsEmpty().addAll((Collection<? extends TableIsEmptyType>)newValue); return; case DbchangelogPackage.AND_TYPE__ROW_COUNT: getRowCount().clear(); getRowCount().addAll((Collection<? extends RowCountType>)newValue); return; case DbchangelogPackage.AND_TYPE__SQL_CHECK: getSqlCheck().clear(); getSqlCheck().addAll((Collection<? extends SqlCheckType>)newValue); return; case DbchangelogPackage.<API key>: <API key>().clear(); <API key>().addAll((Collection<? extends <API key>>)newValue); return; case DbchangelogPackage.<API key>: <API key>().clear(); <API key>().addAll((Collection<? extends <API key>>)newValue); return; case DbchangelogPackage.<API key>: <API key>().clear(); <API key>().addAll((Collection<? extends <API key>>)newValue); return; case DbchangelogPackage.AND_TYPE__ANY: ((FeatureMap.Internal)getAny()).set(newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case DbchangelogPackage.AND_TYPE__GROUP: getGroup().clear(); return; case DbchangelogPackage.AND_TYPE__AND: getAnd().clear(); return; case DbchangelogPackage.AND_TYPE__OR: getOr().clear(); return; case DbchangelogPackage.AND_TYPE__NOT: getNot().clear(); return; case DbchangelogPackage.AND_TYPE__DBMS: getDbms().clear(); return; case DbchangelogPackage.<API key>: getRunningAs().clear(); return; case DbchangelogPackage.<API key>: <API key>().clear(); return; case DbchangelogPackage.<API key>: getTableExists().clear(); return; case DbchangelogPackage.<API key>: getColumnExists().clear(); return; case DbchangelogPackage.<API key>: getSequenceExists().clear(); return; case DbchangelogPackage.<API key>: <API key>().clear(); return; case DbchangelogPackage.<API key>: getIndexExists().clear(); return; case DbchangelogPackage.<API key>: getPrimaryKeyExists().clear(); return; case DbchangelogPackage.<API key>: getViewExists().clear(); return; case DbchangelogPackage.<API key>: getTableIsEmpty().clear(); return; case DbchangelogPackage.AND_TYPE__ROW_COUNT: getRowCount().clear(); return; case DbchangelogPackage.AND_TYPE__SQL_CHECK: getSqlCheck().clear(); return; case DbchangelogPackage.<API key>: <API key>().clear(); return; case DbchangelogPackage.<API key>: <API key>().clear(); return; case DbchangelogPackage.<API key>: <API key>().clear(); return; case DbchangelogPackage.AND_TYPE__ANY: getAny().clear(); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case DbchangelogPackage.AND_TYPE__GROUP: return group != null && !group.isEmpty(); case DbchangelogPackage.AND_TYPE__AND: return !getAnd().isEmpty(); case DbchangelogPackage.AND_TYPE__OR: return !getOr().isEmpty(); case DbchangelogPackage.AND_TYPE__NOT: return !getNot().isEmpty(); case DbchangelogPackage.AND_TYPE__DBMS: return !getDbms().isEmpty(); case DbchangelogPackage.<API key>: return !getRunningAs().isEmpty(); case DbchangelogPackage.<API key>: return !<API key>().isEmpty(); case DbchangelogPackage.<API key>: return !getTableExists().isEmpty(); case DbchangelogPackage.<API key>: return !getColumnExists().isEmpty(); case DbchangelogPackage.<API key>: return !getSequenceExists().isEmpty(); case DbchangelogPackage.<API key>: return !<API key>().isEmpty(); case DbchangelogPackage.<API key>: return !getIndexExists().isEmpty(); case DbchangelogPackage.<API key>: return !getPrimaryKeyExists().isEmpty(); case DbchangelogPackage.<API key>: return !getViewExists().isEmpty(); case DbchangelogPackage.<API key>: return !getTableIsEmpty().isEmpty(); case DbchangelogPackage.AND_TYPE__ROW_COUNT: return !getRowCount().isEmpty(); case DbchangelogPackage.AND_TYPE__SQL_CHECK: return !getSqlCheck().isEmpty(); case DbchangelogPackage.<API key>: return !<API key>().isEmpty(); case DbchangelogPackage.<API key>: return !<API key>().isEmpty(); case DbchangelogPackage.<API key>: return !<API key>().isEmpty(); case DbchangelogPackage.AND_TYPE__ANY: return !getAny().isEmpty(); } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuilder result = new StringBuilder(super.toString()); result.append(" (group: "); result.append(group); result.append(')'); return result.toString(); } } //AndTypeImpl
package org.eclipse.persistence.testing.jaxb.xmlattribute.imports; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import org.eclipse.persistence.testing.jaxb.<API key>; import org.eclipse.persistence.testing.jaxb.xmlattribute.imports2.IdentifierType; public class <API key> extends <API key> { private final static String XML_RESOURCE = "org/eclipse/persistence/testing/jaxb/xmlattribute/imports.xml"; private final static String JSON_RESOURCE = "org/eclipse/persistence/testing/jaxb/xmlattribute/imports.json"; private final static String XSD_RESOURCE = "org/eclipse/persistence/testing/jaxb/xmlattribute/imports.xsd"; private final static String XSD_RESOURCE2 = "org/eclipse/persistence/testing/jaxb/xmlattribute/imports2.xsd"; public <API key>(String name) throws Exception { super(name); setControlDocument(XML_RESOURCE); setControlJSON(JSON_RESOURCE); setClasses(new Class[]{Person.class}); } protected Object getControlObject() { Person obj = new Person(); obj.name = "theName"; obj.setId(IdentifierType.thirdThing); return obj; } public void testSchemaGen() throws Exception{ List<InputStream> controlSchemas = new ArrayList<InputStream>(); InputStream is = Thread.currentThread().<API key>().getResourceAsStream(XSD_RESOURCE); InputStream is2 = Thread.currentThread().<API key>().getResourceAsStream(XSD_RESOURCE2); controlSchemas.add(is); controlSchemas.add(is2); super.testSchemaGen(controlSchemas); } }
package fr.lip6.move.pnml.ptnet.hlapi; import java.nio.channels.FileChannel; import java.util.ArrayList; import java.util.List; import org.apache.axiom.om.OMElement; import org.eclipse.emf.common.util.DiagnosticChain; import fr.lip6.move.pnml.framework.hlapi.HLAPIClass; import fr.lip6.move.pnml.framework.utils.IdRefLinker; import fr.lip6.move.pnml.framework.utils.ModelRepository; import fr.lip6.move.pnml.framework.utils.exception.InnerBuildException; import fr.lip6.move.pnml.framework.utils.exception.InvalidIDException; import fr.lip6.move.pnml.framework.utils.exception.OtherException; import fr.lip6.move.pnml.framework.utils.exception.<API key>; import fr.lip6.move.pnml.ptnet.Arc; import fr.lip6.move.pnml.ptnet.Name; import fr.lip6.move.pnml.ptnet.NodeGraphics; import fr.lip6.move.pnml.ptnet.Page; import fr.lip6.move.pnml.ptnet.PtnetFactory; import fr.lip6.move.pnml.ptnet.RefTransition; import fr.lip6.move.pnml.ptnet.ToolInfo; import fr.lip6.move.pnml.ptnet.Transition; import fr.lip6.move.pnml.ptnet.impl.PtnetFactoryImpl; public class TransitionHLAPI implements HLAPIClass,PnObjectHLAPI,NodeHLAPI,TransitionNodeHLAPI{ /** * The contained LLAPI element. */ private Transition item; /** * this constructor allows you to set all 'settable' values * excepted container. */ public TransitionHLAPI( java.lang.String id , NameHLAPI name , NodeGraphicsHLAPI nodegraphics ) throws InvalidIDException ,<API key> {//BEGIN CONSTRUCTOR BODY PtnetFactory fact = PtnetFactoryImpl.eINSTANCE; synchronized(fact){item = fact.createTransition();} if(id!=null){ item.setId(ModelRepository.getInstance().<API key>().checkId(id, this)); } if(name!=null) item.setName((Name)name.getContainedItem()); if(nodegraphics!=null) item.setNodegraphics((NodeGraphics)nodegraphics.getContainedItem()); } /** * this constructor allows you to set all 'settable' values, including container if any. */ public TransitionHLAPI( java.lang.String id , NameHLAPI name , NodeGraphicsHLAPI nodegraphics , PageHLAPI containerPage ) throws InvalidIDException ,<API key> {//BEGIN CONSTRUCTOR BODY PtnetFactory fact = PtnetFactoryImpl.eINSTANCE; synchronized(fact){item = fact.createTransition();} if(id!=null){ item.setId(ModelRepository.getInstance().<API key>().checkId(id, this)); } if(name!=null) item.setName((Name)name.getContainedItem()); if(nodegraphics!=null) item.setNodegraphics((NodeGraphics)nodegraphics.getContainedItem()); if(containerPage!=null) item.setContainerPage((Page)containerPage.getContainedItem()); } /** * This constructor give access to required stuff only (not container if any) */ public TransitionHLAPI( java.lang.String id ) throws InvalidIDException ,<API key> {//BEGIN CONSTRUCTOR BODY PtnetFactory fact = PtnetFactoryImpl.eINSTANCE; synchronized(fact){item = fact.createTransition();} if(id!=null){ item.setId(ModelRepository.getInstance().<API key>().checkId(id, this)); } } /** * This constructor give access to required stuff only (and container) */ public TransitionHLAPI( java.lang.String id , PageHLAPI containerPage ) throws InvalidIDException ,<API key> {//BEGIN CONSTRUCTOR BODY PtnetFactory fact = PtnetFactoryImpl.eINSTANCE; synchronized(fact){item = fact.createTransition();} if(id!=null){ item.setId(ModelRepository.getInstance().<API key>().checkId(id, this)); } if(containerPage!=null) item.setContainerPage((Page)containerPage.getContainedItem()); } /** * This constructor encapsulate a low level API object in HLAPI. */ public TransitionHLAPI(Transition lowLevelAPI){ item = lowLevelAPI; } // access to low level API /** * Return encapsulated object */ public Transition getContainedItem(){ return item; } //getters giving LLAPI object /** * Return the encapsulate Low Level API object. */ public String getId(){ return item.getId(); } /** * Return the encapsulate Low Level API object. */ public Name getName(){ return item.getName(); } /** * Return the encapsulate Low Level API object. */ public List<ToolInfo> getToolspecifics(){ return item.getToolspecifics(); } /** * Return the encapsulate Low Level API object. */ public Page getContainerPage(){ return item.getContainerPage(); } /** * Return the encapsulate Low Level API object. */ public List<Arc> getInArcs(){ return item.getInArcs(); } /** * Return the encapsulate Low Level API object. */ public List<Arc> getOutArcs(){ return item.getOutArcs(); } /** * Return the encapsulate Low Level API object. */ public NodeGraphics getNodegraphics(){ return item.getNodegraphics(); } /** * Return the encapsulate Low Level API object. */ public List<RefTransition> <API key>(){ return item.<API key>(); } //getters giving HLAPI object /** * This accessor automatically encapsulate an element of the current object. * WARNING : this creates a new object in memory. * @return : null if the element is null */ public NameHLAPI getNameHLAPI(){ if(item.getName() == null) return null; return new NameHLAPI(item.getName()); } /** * This accessor automatically encapsulate all elements of the selected sublist. * WARNING : this can creates a lot of new object in memory. */ public java.util.List<ToolInfoHLAPI> <API key>(){ java.util.List<ToolInfoHLAPI> retour = new ArrayList<ToolInfoHLAPI>(); for (ToolInfo elemnt : getToolspecifics()) { retour.add(new ToolInfoHLAPI(elemnt)); } return retour; } /** * This accessor automatically encapsulate an element of the current object. * WARNING : this creates a new object in memory. * @return : null if the element is null */ public PageHLAPI <API key>(){ if(item.getContainerPage() == null) return null; return new PageHLAPI(item.getContainerPage()); } /** * This accessor automatically encapsulate all elements of the selected sublist. * WARNING : this can creates a lot of new object in memory. */ public java.util.List<ArcHLAPI> getInArcsHLAPI(){ java.util.List<ArcHLAPI> retour = new ArrayList<ArcHLAPI>(); for (Arc elemnt : getInArcs()) { retour.add(new ArcHLAPI(elemnt)); } return retour; } /** * This accessor automatically encapsulate all elements of the selected sublist. * WARNING : this can creates a lot of new object in memory. */ public java.util.List<ArcHLAPI> getOutArcsHLAPI(){ java.util.List<ArcHLAPI> retour = new ArrayList<ArcHLAPI>(); for (Arc elemnt : getOutArcs()) { retour.add(new ArcHLAPI(elemnt)); } return retour; } /** * This accessor automatically encapsulate an element of the current object. * WARNING : this creates a new object in memory. * @return : null if the element is null */ public NodeGraphicsHLAPI <API key>(){ if(item.getNodegraphics() == null) return null; return new NodeGraphicsHLAPI(item.getNodegraphics()); } /** * This accessor automatically encapsulate all elements of the selected sublist. * WARNING : this can creates a lot of new object in memory. */ public java.util.List<RefTransitionHLAPI> <API key>(){ java.util.List<RefTransitionHLAPI> retour = new ArrayList<RefTransitionHLAPI>(); for (RefTransition elemnt : <API key>()) { retour.add(new RefTransitionHLAPI(elemnt)); } return retour; } //Special getter for list of generics object, return only one object type. //setters (including container setter if aviable) /** * set Id */ public void setIdHLAPI( java.lang.String elem) throws InvalidIDException ,<API key> { if(elem!=null){ try{ item.setId(ModelRepository.getInstance().<API key>().changeId(this, elem)); }catch (OtherException e){ ModelRepository.getInstance().<API key>().checkId(elem, this); } } } /** * set Name */ public void setNameHLAPI( NameHLAPI elem){ if(elem!=null) item.setName((Name)elem.getContainedItem()); } /** * set Nodegraphics */ public void <API key>( NodeGraphicsHLAPI elem){ if(elem!=null) item.setNodegraphics((NodeGraphics)elem.getContainedItem()); } /** * set ContainerPage */ public void <API key>( PageHLAPI elem){ if(elem!=null) item.setContainerPage((Page)elem.getContainedItem()); } //setters/remover for lists. public void <API key>(ToolInfoHLAPI unit){ item.getToolspecifics().add((ToolInfo)unit.getContainedItem()); } public void <API key>(ToolInfoHLAPI unit){ item.getToolspecifics().remove((ToolInfo)unit.getContainedItem()); } //equals method public boolean equals(TransitionHLAPI item){ return item.getContainedItem().equals(getContainedItem()); } //PNML /** * Returns the PNML xml tree for this object. */ public String toPNML(){ return item.toPNML(); } /** * Writes the PNML XML tree of this object into file channel. */ public void toPNML(FileChannel fc){ item.toPNML(fc); } /** * creates an object from the xml nodes.(symetric work of toPNML) */ public void fromPNML(OMElement subRoot,IdRefLinker idr) throws InnerBuildException, InvalidIDException, <API key>{ item.fromPNML(subRoot,idr); } public boolean validateOCL(DiagnosticChain diagnostics){ return item.validateOCL(diagnostics); } }
package org.eclipse.persistence.testing.tests.jpa.ddlgeneration; import junit.framework.Test; import junit.framework.TestSuite; import org.eclipse.persistence.testing.framework.junit.JUnitTestCase; import javax.persistence.EntityManager; /** * JUnit test case(s) for DDL generation. */ public class <API key> extends <API key> { // This is the persistence unit name on server as for persistence unit name "ddlTablePerClass" in J2SE private static final String DDL_TPC_PU = "MulitPU-2"; public <API key>() { super(); } public <API key>(String name) { super(name); setPuName(DDL_TPC_PU); } public static Test suite() { TestSuite suite = new TestSuite(); suite.setName("<API key>"); suite.addTest(new <API key>("testSetup")); suite.addTest(new <API key>("<API key>")); suite.addTest(new <API key>("<API key>")); if (! JUnitTestCase.isJPA10()) { suite.addTest(new <API key>("<API key>")); } return suite; } /** * The setup is done as a test, both to record its failure, and to allow execution in the server. */ public void testSetup() { // Trigger DDL generation EntityManager emDDLTPC = createEntityManager("MulitPU-2"); closeEntityManager(emDDLTPC); clearCache(DDL_TPC_PU); } public static void main(String[] args) { junit.textui.TestRunner.run(suite()); } }
.dark-theme.froala-box.fr-disabled .froala-element { color: #999999; } .dark-theme.froala-box.fr-disabled button.fr-bttn, .dark-theme.froala-box.fr-disabled button.fr-trigger { color: #999999 !important; } .dark-theme.froala-box.fr-disabled button.fr-bttn:after, .dark-theme.froala-box.fr-disabled button.fr-trigger:after { border-top-color: #999999 !important; } .dark-theme.froala-box .html-switch { border-color: #999999; } .dark-theme.froala-box .froala-wrapper.f-basic { border: solid 1px #252525; } .dark-theme.froala-box .froala-wrapper.f-basic.f-placeholder + span.fr-placeholder { margin: 10px; } .dark-theme.froala-box .froala-element hr { border-top-color: #aaaaaa; } .dark-theme.froala-box .froala-element.f-placeholder:before { color: #aaaaaa; } .dark-theme.froala-box .froala-element pre { border: solid 1px #aaaaaa; background: #fcfcfc; border-radius: 4px; -moz-border-radius: 4px; -<API key>: 4px; -moz-background-clip: padding; -<API key>: padding-box; background-clip: padding-box; } .dark-theme.froala-box .froala-element blockquote { border-left: solid 5px #aaaaaa; } .dark-theme.froala-box .froala-element img { min-width: 32px !important; min-height: 32px !important; } .dark-theme.froala-box .froala-element img.fr-fil { padding: 10px 10px 10px 3px; } .dark-theme.froala-box .froala-element img.fr-fir { padding: 10px 3px 10px 10px; } .dark-theme.froala-box .froala-element img.fr-fin { padding: 10px 0; } .dark-theme.froala-box .froala-element img::selection { color: #ffffff; } .dark-theme.froala-box .froala-element img::-moz-selection { color: #ffffff; } .dark-theme.froala-box .froala-element span.f-img-editor:before { border: none !important; outline: solid 1px #2c82c9 !important; } .dark-theme.froala-box .froala-element span.f-img-editor.fr-fil { margin: 10px 10px 10px 3px; } .dark-theme.froala-box .froala-element span.f-img-editor.fr-fir { margin: 10px 3px 10px 10px; } .dark-theme.froala-box .froala-element span.f-img-editor.fr-fin { margin: 10px 0; } .dark-theme.froala-box .froala-element span.f-img-handle { height: 8px; width: 8px; border: solid 1px #ffffff !important; background: #2c82c9; } .dark-theme.froala-box .froala-element span.f-video-editor.active:after { border: solid 1px #252525; } .dark-theme.froala-box .froala-element.f-basic { background: #ffffff; color: #444444; padding: 10px; } .dark-theme.froala-box .froala-element.f-basic a { color: inherit; } .dark-theme.froala-box .froala-element table td { border: solid 1px #aaaaaa; } .dark-theme.froala-box.f-html .froala-element { background: #202020; color: #ffffff; font-family: 'Courier New', Monospace; font-size: 13px; } .dark-theme.froala-editor { background: #353535; border: solid 1px #252525; border-top: solid 5px #252525; } .dark-theme.froala-editor hr { border-top-color: #aaaaaa; } .dark-theme.froala-editor span.f-sep { border-right: solid 1px #aaaaaa; height: 35px; } .dark-theme.froala-editor button.fr-bttn, .dark-theme.froala-editor button.fr-trigger { background: transparent; color: #ffffff; font-size: 16px; line-height: 35px; width: 40px; } .dark-theme.froala-editor button.fr-bttn img, .dark-theme.froala-editor button.fr-trigger img { max-width: 40px; max-height: 35px; } .dark-theme.froala-editor button.fr-bttn:disabled, .dark-theme.froala-editor button.fr-trigger:disabled { color: #999999 !important; } .dark-theme.froala-editor button.fr-bttn:disabled:after, .dark-theme.froala-editor button.fr-trigger:disabled:after { border-top-color: #999999 !important; } .dark-theme.froala-editor.ie8 button.fr-bttn:hover, .dark-theme.froala-editor.ie8 button.fr-trigger:hover { background: #2c82c9; color: #ffffff; } .dark-theme.froala-editor.ie8 button.fr-bttn:hover:after, .dark-theme.froala-editor.ie8 button.fr-trigger:hover:after { border-top-color: #ffffff; } .dark-theme.froala-editor .bttn-wrapper:not(.touch) button.fr-bttn:hover, .dark-theme.froala-editor .froala-popup button.fr-bttn:hover, .dark-theme.froala-editor .bttn-wrapper:not(.touch) button.fr-trigger:hover, .dark-theme.froala-editor .froala-popup button.fr-trigger:hover { background: #2c82c9; color: #ffffff; } .dark-theme.froala-editor .bttn-wrapper:not(.touch) button.fr-bttn:hover:after, .dark-theme.froala-editor .froala-popup button.fr-bttn:hover:after, .dark-theme.froala-editor .bttn-wrapper:not(.touch) button.fr-trigger:hover:after, .dark-theme.froala-editor .froala-popup button.fr-trigger:hover:after { border-top-color: #ffffff; } .dark-theme.froala-editor .fr-bttn.active { color: #2c82c9; background: transparent; } .dark-theme.froala-editor .fr-trigger:after { border-top-color: #ffffff; } .dark-theme.froala-editor .fr-trigger.active { color: #ffffff; background: #2c82c9; } .dark-theme.froala-editor .fr-trigger.active:after { border-top-color: #ffffff !important; } .dark-theme.froala-editor .fr-dropdown .fr-trigger { width: calc(40px - 2px); } .dark-theme.froala-editor .fr-dropdown .fr-dropdown-menu { background: #353535; border: solid 1px #252525; } .dark-theme.froala-editor .fr-dropdown .fr-dropdown-menu li.active a { background: #ffffff !important; color: #353535 !important; } .dark-theme.froala-editor .fr-dropdown .fr-dropdown-menu li a { color: #ffffff; } .dark-theme.froala-editor .fr-dropdown .fr-dropdown-menu li a:hover { background: #ffffff !important; color: #353535 !important; } .dark-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li:hover > a, .dark-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li.hover > a { background: #ffffff; color: #353535; } .dark-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li > ul { background: #353535; color: #ffffff; border: solid 1px #252525; } .dark-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li > div { background: #353535; color: #ffffff; border: solid 1px #252525; } .dark-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li > div > span > span { border: solid 1px #aaaaaa; } .dark-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li > div > span:hover > span, .dark-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > li > div > span.hover > span { background: rgba(61, 142, 185, 0.3); border: solid 1px #3d8eb9; } .dark-theme.froala-editor .fr-dropdown .fr-dropdown-menu.fr-table > hr { border-top: solid 1px #252525; } .dark-theme.froala-editor .fr-dropdown.fr-color-picker .fr-dropdown-menu p { color: #ffffff; } .dark-theme.froala-editor .fr-dropdown.fr-color-picker .fr-dropdown-menu p a.fr-bttn { color: #ffffff; } .dark-theme.froala-editor .fr-dropdown.fr-color-picker .fr-dropdown-menu p a.fr-bttn:hover { color: #2c82c9; } .dark-theme.froala-editor .fr-dropdown.fr-color-picker .fr-dropdown-menu .fr-color-bttn.active { outline: solid 1px #ffffff; } .dark-theme.froala-editor .fr-dropdown.fr-color-picker .fr-dropdown-menu .fr-color-bttn.active:after { color: #ffffff; } .dark-theme.froala-editor .fr-dropdown.fr-color-picker .fr-dropdown-menu .fr-color-bttn:hover:not(:focus):not(:active) { outline: solid 1px #ffffff; } .dark-theme.froala-editor .froala-popup { background: #353535; } .dark-theme.froala-editor .froala-popup h4 { color: #ffffff; } .dark-theme.froala-editor .froala-popup h4 i { color: #aaaaaa; } .dark-theme.froala-editor .froala-popup h4 i.fa-external-link { color: #ffffff; } .dark-theme.froala-editor .froala-popup h4 i.fa-external-link:hover { color: #2c82c9; } .dark-theme.froala-editor .froala-popup h4 i:hover { color: #ffffff; } .dark-theme.froala-editor .froala-popup button.fr-p-bttn { color: #ffffff; } .dark-theme.froala-editor .froala-popup button.fr-p-bttn.f-ok { background: #2c82c9; color: #ffffff; } .dark-theme.froala-editor .froala-popup button.fr-p-bttn.f-unlink { background: #b8312f; color: #ffffff; } .dark-theme.froala-editor .froala-popup button.fr-p-bttn.f-unlink:hover { background: #ffffff; color: #353535; } .dark-theme.froala-editor .froala-popup button.fr-p-bttn:hover, .dark-theme.froala-editor .froala-popup button.fr-p-bttn:focus { background: #ffffff; color: #353535; } .dark-theme.froala-editor .froala-popup div.f-popup-line.f-popup-toolbar { background: #353535; } .dark-theme.froala-editor .froala-popup div.f-popup-line label { color: #ffffff; } .dark-theme.froala-editor .froala-popup div.f-popup-line input[type="text"] { border: solid 1px #aaaaaa; } .dark-theme.froala-editor .froala-popup div.f-popup-line input[type="text"]:focus { border: solid 1px #54acd2; } .dark-theme.froala-editor .froala-popup div.f-popup-line input[type="text"]:disabled { background: #ffffff; color: #999999; } .dark-theme.froala-editor .froala-popup div.f-popup-line textarea { border: solid 1px #aaaaaa; } .dark-theme.froala-editor .froala-popup div.f-popup-line textarea:focus { border: solid 1px #54acd2; } .dark-theme.froala-editor .froala-popup.<API key> div.f-popup-line + div.f-popup-line { border-top: solid 1px #aaaaaa; } .dark-theme.froala-editor .froala-popup.froala-video-popup p.or { color: #ffffff; } .dark-theme.froala-editor .froala-popup.froala-image-popup div.f-popup-line.drop-upload div.f-upload { color: #ffffff; border: dashed 2px #aaaaaa; } .dark-theme.froala-editor .froala-popup.froala-image-popup div.f-popup-line.drop-upload div.f-upload:hover { border: dashed 2px #eeeeee; } .dark-theme.froala-editor .froala-popup.froala-image-popup div.f-popup-line.drop-upload div.f-upload.f-hover { border: dashed 2px #61bd6d; } .dark-theme.froala-editor .froala-popup.froala-image-popup div.f-popup-line button.f-browse { background: #475577; color: #ffffff; } .dark-theme.froala-editor .froala-popup.froala-image-popup div.f-popup-line button.f-browse:hover { background: #ffffff; color: #353535; } .dark-theme.froala-editor .froala-popup.froala-image-popup div.f-popup-line + div.f-popup-line { border-top: solid 1px #aaaaaa; } .dark-theme.froala-editor .froala-popup.froala-image-popup p.f-progress { background-color: #61bd6d; } .dark-theme.froala-editor .froala-popup.froala-image-popup p.f-progress span { background-color: #61bd6d; color: #ffffff; } .dark-theme.froala-editor .froala-popup.froala-link-popup div.f-popup-line .f-browse-links { background: #475577; color: #ffffff; } .dark-theme.froala-editor .froala-popup.froala-link-popup div.f-popup-line .f-browse-links:hover { background: #ffffff; color: #353535; } .dark-theme.froala-editor .froala-popup.froala-link-popup div.f-popup-line ul { background: #353535; border: solid 1px #252525; } .dark-theme.froala-editor .froala-popup.froala-link-popup div.f-popup-line ul li { color: #ffffff; } .dark-theme.froala-editor .froala-popup.froala-link-popup div.f-popup-line ul li + li { border-top: solid 1px #252525; } .dark-theme.froala-editor .froala-popup.froala-link-popup div.f-popup-line ul li:hover { background: #ffffff; color: #353535; } .dark-theme.froala-modal .f-modal-wrapper { background: #353535; border: solid 1px #252525; border-top: solid 5px #252525; } .dark-theme.froala-modal .f-modal-wrapper h4 { color: #ffffff; } .dark-theme.froala-modal .f-modal-wrapper h4 i { color: #aaaaaa; } .dark-theme.froala-modal .f-modal-wrapper h4 i:hover { color: #ffffff; } .dark-theme.froala-modal .f-modal-wrapper div.f-image-list div.f-empty { background: #aaaaaa; } .dark-theme.froala-modal .f-modal-wrapper div.f-image-list div .f-delete-img { background: #b8312f; color: #ffffff; } .dark-theme.froala-modal .f-modal-wrapper div.f-image-list div .f-delete-img:hover { background: #ffffff; color: #353535; } .dark-theme.froala-modal .f-modal-wrapper div.f-image-list:not(.f-touch) div:hover .f-delete-img:hover { background: #ffffff; color: #353535; } .froala-overlay { background: #000000; }
package org.eclipse.jface.text.rules; import java.util.ArrayList; import java.util.List; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.Platform; import org.eclipse.jface.text.<API key>; import org.eclipse.jface.text.<API key>; import org.eclipse.jface.text.<API key>; import org.eclipse.jface.text.DocumentEvent; import org.eclipse.jface.text.<API key>; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.<API key>; import org.eclipse.jface.text.<API key>; import org.eclipse.jface.text.<API key>; import org.eclipse.jface.text.<API key>; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITypedRegion; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.Region; import org.eclipse.jface.text.TextUtilities; import org.eclipse.jface.text.TypedPosition; import org.eclipse.jface.text.TypedRegion; /** * A standard implementation of a document partitioner. It uses an * {@link <API key>} to scan the document and to determine the * document's partitioning. The tokens returned by the scanner must return the * partition type as their data. The partitioner remembers the document's * partitions in the document itself rather than maintaining its own data * structure. * <p> * To reduce array creations in {@link IDocument#getPositions(String)}, the * positions get cached. The cache is cleared after updating the positions in * {@link #documentChanged2(DocumentEvent)}. Subclasses need to call * {@link #clearPositionCache()} after modifying the partitioner's positions. * The cached positions may be accessed through {@link #getPositions()}. * </p> * * @see <API key> * @since 3.1 */ public class FastPartitioner implements <API key>, <API key>, <API key>, <API key> { /** * The position category this partitioner uses to store the document's partitioning information. */ private static final String <API key>= "<API key>"; //$NON-NLS-1$ /** The partitioner's scanner */ protected final <API key> fScanner; protected final String[] fLegalContentTypes; /** The partitioner's document */ protected IDocument fDocument; /** The document length before a document change occurred */ protected int <API key>; /** The position updater used to for the default updating of partitions */ protected final <API key> fPositionUpdater; /** The offset at which the first changed partition starts */ protected int fStartOffset; /** The offset at which the last changed partition ends */ protected int fEndOffset; /**The offset at which a partition has been deleted */ protected int fDeleteOffset; /** * The position category this partitioner uses to store the document's partitioning information. */ private final String fPositionCategory; /** * The active document rewrite session. */ private <API key> <API key>; /** * Flag indicating whether this partitioner has been initialized. */ private boolean fIsInitialized= false; /** * The cached positions from our document, so we don't create a new array every time * someone requests partition information. */ private Position[] fCachedPositions= null; /** Debug option for cache consistency checking. */ private static final boolean <API key>= "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.jface.text/debug/FastPartitioner/PositionCache")); //$NON-NLS-1$//$NON-NLS-2$; public FastPartitioner(<API key> scanner, String[] legalContentTypes) { fScanner= scanner; fLegalContentTypes= TextUtilities.copy(legalContentTypes); fPositionCategory= <API key> + hashCode(); fPositionUpdater= new <API key>(fPositionCategory); } @Override public String[] <API key>() { return new String[] { fPositionCategory }; } @Override public final void connect(IDocument document) { connect(document, false); } /** * {@inheritDoc} * <p> * May be extended by subclasses. * </p> */ @Override public void connect(IDocument document, boolean delayInitialization) { Assert.isNotNull(document); Assert.isTrue(!document.<API key>(fPositionCategory)); fDocument= document; fDocument.addPositionCategory(fPositionCategory); fIsInitialized= false; if (!delayInitialization) checkInitialization(); } /** * Calls {@link #initialize()} if the receiver is not yet initialized. */ protected final void checkInitialization() { if (!fIsInitialized) initialize(); } /** * Performs the initial partitioning of the partitioner's document. * <p> * May be extended by subclasses. * </p> */ protected void initialize() { fIsInitialized= true; clearPositionCache(); fScanner.setRange(fDocument, 0, fDocument.getLength()); try { IToken token= fScanner.nextToken(); while (!token.isEOF()) { String contentType= getTokenContentType(token); if (<API key>(contentType)) { TypedPosition p= new TypedPosition(fScanner.getTokenOffset(), fScanner.getTokenLength(), contentType); fDocument.addPosition(fPositionCategory, p); } token= fScanner.nextToken(); } } catch (<API key> x) { // cannot happen as offsets come from scanner } catch (<API key> x) { // cannot happen if document has been connected before } } /** * {@inheritDoc} * <p> * May be extended by subclasses. * </p> */ @Override public void disconnect() { Assert.isTrue(fDocument.<API key>(fPositionCategory)); try { fDocument.<API key>(fPositionCategory); } catch (<API key> x) { // can not happen because of Assert } } /** * {@inheritDoc} * <p> * May be extended by subclasses. * </p> */ @Override public void <API key>(DocumentEvent e) { if (fIsInitialized) { Assert.isTrue(e.getDocument() == fDocument); <API key>= e.getDocument().getLength(); fStartOffset= -1; fEndOffset= -1; fDeleteOffset= -1; } } @Override public final boolean documentChanged(DocumentEvent e) { if (fIsInitialized) { IRegion region= documentChanged2(e); return (region != null); } return false; } /** * Helper method for tracking the minimal region containing all partition changes. * If <code>offset</code> is smaller than the remembered offset, <code>offset</code> * will from now on be remembered. If <code>offset + length</code> is greater than * the remembered end offset, it will be remembered from now on. * * @param offset the offset * @param length the length */ private void rememberRegion(int offset, int length) { // remember start offset if (fStartOffset == -1) fStartOffset= offset; else if (offset < fStartOffset) fStartOffset= offset; // remember end offset int endOffset= offset + length; if (fEndOffset == -1) fEndOffset= endOffset; else if (endOffset > fEndOffset) fEndOffset= endOffset; } /** * Remembers the given offset as the deletion offset. * * @param offset the offset */ private void <API key>(int offset) { fDeleteOffset= offset; } /** * Creates the minimal region containing all partition changes using the * remembered offset, end offset, and deletion offset. * * @return the minimal region containing all the partition changes */ private IRegion createRegion() { if (fDeleteOffset == -1) { if (fStartOffset == -1 || fEndOffset == -1) return null; return new Region(fStartOffset, fEndOffset - fStartOffset); } else if (fStartOffset == -1 || fEndOffset == -1) { return new Region(fDeleteOffset, 0); } else { int offset= Math.min(fDeleteOffset, fStartOffset); int endOffset= Math.max(fDeleteOffset, fEndOffset); return new Region(offset, endOffset - offset); } } /** * {@inheritDoc} * <p> * May be extended by subclasses. * </p> */ @Override public IRegion documentChanged2(DocumentEvent e) { if (!fIsInitialized) return null; try { Assert.isTrue(e.getDocument() == fDocument); Position[] category= getPositions(); IRegion line= fDocument.<API key>(e.getOffset()); int reparseStart= line.getOffset(); int partitionStart= -1; String contentType= null; int newLength= e.getText() == null ? 0 : e.getText().length(); int first= fDocument.<API key>(fPositionCategory, reparseStart); if (first > 0) { TypedPosition partition= (TypedPosition) category[first - 1]; if (partition.includes(reparseStart)) { partitionStart= partition.getOffset(); contentType= partition.getType(); reparseStart= partitionStart; -- first; } else if (reparseStart == e.getOffset() && reparseStart == partition.getOffset() + partition.getLength()) { partitionStart= partition.getOffset(); contentType= partition.getType(); reparseStart= partitionStart; -- first; } else { partitionStart= partition.getOffset() + partition.getLength(); contentType= IDocument.<API key>; } } else { partitionStart= 0; reparseStart= 0; } fPositionUpdater.update(e); for (int i= first; i < category.length; i++) { Position p= category[i]; if (p.isDeleted) { <API key>(e.getOffset()); break; } } clearPositionCache(); category= getPositions(); fScanner.setPartialRange(fDocument, reparseStart, fDocument.getLength() - reparseStart, contentType, partitionStart); int <API key>= reparseStart; IToken token= fScanner.nextToken(); while (!token.isEOF()) { contentType= getTokenContentType(token); if (!<API key>(contentType)) { token= fScanner.nextToken(); continue; } int start= fScanner.getTokenOffset(); int length= fScanner.getTokenLength(); <API key>= start + length; int lastScannedPosition= <API key> - 1; // remove all affected positions while (first < category.length) { TypedPosition p= (TypedPosition) category[first]; if (lastScannedPosition >= p.offset + p.length || (p.overlapsWith(start, length) && (!fDocument.containsPosition(fPositionCategory, start, length) || !contentType.equals(p.getType())))) { rememberRegion(p.offset, p.length); fDocument.removePosition(fPositionCategory, p); ++ first; } else break; } // if position already exists and we have scanned at least the // area covered by the event, we are done if (fDocument.containsPosition(fPositionCategory, start, length)) { if (lastScannedPosition >= e.getOffset() + newLength) return createRegion(); ++ first; } else { // insert the new type position try { fDocument.addPosition(fPositionCategory, new TypedPosition(start, length, contentType)); rememberRegion(start, length); } catch (<API key> x) { } catch (<API key> x) { } } token= fScanner.nextToken(); } first= fDocument.<API key>(fPositionCategory, <API key>); clearPositionCache(); category= getPositions(); TypedPosition p; while (first < category.length) { p= (TypedPosition) category[first++]; fDocument.removePosition(fPositionCategory, p); rememberRegion(p.offset, p.length); } } catch (<API key> x) { // should never happen on connected documents } catch (<API key> x) { } finally { clearPositionCache(); } return createRegion(); } /** * Returns the position in the partitoner's position category which is * close to the given offset. This is, the position has either an offset which * is the same as the given offset or an offset which is smaller than the given * offset. This method profits from the knowledge that a partitioning is * a ordered set of disjoint position. * <p> * May be extended or replaced by subclasses. * </p> * @param offset the offset for which to search the closest position * @return the closest position in the partitioner's category */ protected TypedPosition findClosestPosition(int offset) { try { int index= fDocument.<API key>(fPositionCategory, offset); Position[] category= getPositions(); if (category.length == 0) return null; if (index < category.length) { if (offset == category[index].offset) return (TypedPosition) category[index]; } if (index > 0) index return (TypedPosition) category[index]; } catch (<API key> x) { } catch (<API key> x) { } return null; } /** * {@inheritDoc} * <p> * May be replaced or extended by subclasses. * </p> */ @Override public String getContentType(int offset) { checkInitialization(); TypedPosition p= findClosestPosition(offset); if (p != null && p.includes(offset)) return p.getType(); return IDocument.<API key>; } /** * {@inheritDoc} * <p> * May be replaced or extended by subclasses. * </p> */ @Override public ITypedRegion getPartition(int offset) { checkInitialization(); try { Position[] category = getPositions(); if (category == null || category.length == 0) return new TypedRegion(0, fDocument.getLength(), IDocument.<API key>); int index= fDocument.<API key>(fPositionCategory, offset); if (index < category.length) { TypedPosition next= (TypedPosition) category[index]; if (offset == next.offset) return new TypedRegion(next.getOffset(), next.getLength(), next.getType()); if (index == 0) return new TypedRegion(0, next.offset, IDocument.<API key>); TypedPosition previous= (TypedPosition) category[index - 1]; if (previous.includes(offset)) return new TypedRegion(previous.getOffset(), previous.getLength(), previous.getType()); int endOffset= previous.getOffset() + previous.getLength(); return new TypedRegion(endOffset, next.getOffset() - endOffset, IDocument.<API key>); } TypedPosition previous= (TypedPosition) category[category.length - 1]; if (previous.includes(offset)) return new TypedRegion(previous.getOffset(), previous.getLength(), previous.getType()); int endOffset= previous.getOffset() + previous.getLength(); return new TypedRegion(endOffset, fDocument.getLength() - endOffset, IDocument.<API key>); } catch (<API key> x) { } catch (<API key> x) { } return new TypedRegion(0, fDocument.getLength(), IDocument.<API key>); } @Override public final ITypedRegion[] computePartitioning(int offset, int length) { return computePartitioning(offset, length, false); } /** * {@inheritDoc} * <p> * May be replaced or extended by subclasses. * </p> */ @Override public String[] <API key>() { return TextUtilities.copy(fLegalContentTypes); } protected boolean <API key>(String contentType) { if (contentType != null) { for (String fLegalContentType : fLegalContentTypes) { if (fLegalContentType.equals(contentType)) return true; } } return false; } /** * Returns a content type encoded in the given token. If the token's * data is not <code>null</code> and a string it is assumed that * it is the encoded content type. * <p> * May be replaced or extended by subclasses. * </p> * * @param token the token whose content type is to be determined * @return the token's content type */ protected String getTokenContentType(IToken token) { Object data= token.getData(); if (data instanceof String) return (String) data; return null; } /* zero-length partition support */ /** * {@inheritDoc} * <p> * May be replaced or extended by subclasses. * </p> */ @Override public String getContentType(int offset, boolean <API key>) { return getPartition(offset, <API key>).getType(); } /** * {@inheritDoc} * <p> * May be replaced or extended by subclasses. * </p> */ @Override public ITypedRegion getPartition(int offset, boolean <API key>) { ITypedRegion region= getPartition(offset); if (<API key>) { if (region.getOffset() == offset && !region.getType().equals(IDocument.<API key>)) { if (offset > 0) { region= getPartition(offset - 1); if (region.getType().equals(IDocument.<API key>)) return region; } return new TypedRegion(offset, 0, IDocument.<API key>); } } return region; } /** * {@inheritDoc} * <p> * May be replaced or extended by subclasses. * </p> */ @Override public ITypedRegion[] computePartitioning(int offset, int length, boolean <API key>) { checkInitialization(); List<TypedRegion> list= new ArrayList<>(); try { int endOffset= offset + length; Position[] category= getPositions(); TypedPosition previous= null, current= null; int start, end, gapOffset; Position gap= new Position(0); int startIndex= <API key>(category, offset); int endIndex= <API key>(category, endOffset); for (int i= startIndex; i < endIndex; i++) { current= (TypedPosition) category[i]; gapOffset= (previous != null) ? previous.getOffset() + previous.getLength() : 0; gap.setOffset(gapOffset); gap.setLength(current.getOffset() - gapOffset); if ((<API key> && overlapsOrTouches(gap, offset, length)) || (gap.getLength() > 0 && gap.overlapsWith(offset, length))) { start= Math.max(offset, gapOffset); end= Math.min(endOffset, gap.getOffset() + gap.getLength()); list.add(new TypedRegion(start, end - start, IDocument.<API key>)); } if (current.overlapsWith(offset, length)) { start= Math.max(offset, current.getOffset()); end= Math.min(endOffset, current.getOffset() + current.getLength()); list.add(new TypedRegion(start, end - start, current.getType())); } previous= current; } if (previous != null) { gapOffset= previous.getOffset() + previous.getLength(); gap.setOffset(gapOffset); gap.setLength(fDocument.getLength() - gapOffset); if ((<API key> && overlapsOrTouches(gap, offset, length)) || (gap.getLength() > 0 && gap.overlapsWith(offset, length))) { start= Math.max(offset, gapOffset); end= Math.min(endOffset, fDocument.getLength()); list.add(new TypedRegion(start, end - start, IDocument.<API key>)); } } if (list.isEmpty()) list.add(new TypedRegion(offset, length, IDocument.<API key>)); } catch (<API key> ex) { // Make sure we clear the cache clearPositionCache(); } catch (RuntimeException ex) { // Make sure we clear the cache clearPositionCache(); throw ex; } TypedRegion[] result= new TypedRegion[list.size()]; list.toArray(result); return result; } /** * Returns <code>true</code> if the given ranges overlap with or touch each other. * * @param gap the first range * @param offset the offset of the second range * @param length the length of the second range * @return <code>true</code> if the given ranges overlap with or touch each other */ private boolean overlapsOrTouches(Position gap, int offset, int length) { return gap.getOffset() <= offset + length && offset <= gap.getOffset() + gap.getLength(); } /** * Returns the index of the first position which ends after the given offset. * * @param positions the positions in linear order * @param offset the offset * @return the index of the first position which ends after the offset */ private int <API key>(Position[] positions, int offset) { int i= -1, j= positions.length; while (j - i > 1) { int k= (i + j) >> 1; Position p= positions[k]; if (p.getOffset() + p.getLength() > offset) j= k; else i= k; } return j; } /** * Returns the index of the first position which starts at or after the given offset. * * @param positions the positions in linear order * @param offset the offset * @return the index of the first position which starts after the offset */ private int <API key>(Position[] positions, int offset) { int i= -1, j= positions.length; while (j - i > 1) { int k= (i + j) >> 1; Position p= positions[k]; if (p.getOffset() >= offset) j= k; else i= k; } return j; } @Override public void startRewriteSession(<API key> session) throws <API key> { if (<API key> != null) throw new <API key>(); <API key>= session; } /** * {@inheritDoc} * <p> * May be extended by subclasses. * </p> */ @Override public void stopRewriteSession(<API key> session) { if (<API key> == session) flushRewriteSession(); } /** * {@inheritDoc} * <p> * May be extended by subclasses. * </p> */ @Override public <API key> <API key>() { return <API key>; } /** * Flushes the active rewrite session. */ protected final void flushRewriteSession() { <API key>= null; // remove all position belonging to the partitioner position category try { fDocument.<API key>(fPositionCategory); } catch (<API key> x) { } fDocument.addPositionCategory(fPositionCategory); fIsInitialized= false; } /** * Clears the position cache. Needs to be called whenever the positions have * been updated. */ protected final void clearPositionCache() { if (fCachedPositions != null) { fCachedPositions= null; } } /** * Returns the partitioners positions. * * @return the partitioners positions * @throws <API key> if getting the positions from the * document fails */ protected final Position[] getPositions() throws <API key> { if (fCachedPositions == null) { fCachedPositions= fDocument.getPositions(fPositionCategory); } else if (<API key>) { Position[] positions= fDocument.getPositions(fPositionCategory); int len= Math.min(positions.length, fCachedPositions.length); for (int i= 0; i < len; i++) { if (!positions[i].equals(fCachedPositions[i])) System.err.println("FastPartitioner.getPositions(): cached position is not up to date: from document: " + toString(positions[i]) + " in cache: " + toString(fCachedPositions[i])); //$NON-NLS-1$ //$NON-NLS-2$ } for (int i= len; i < positions.length; i++) System.err.println("FastPartitioner.getPositions(): new position in document: " + toString(positions[i])); //$NON-NLS-1$ for (int i= len; i < fCachedPositions.length; i++) System.err.println("FastPartitioner.getPositions(): stale position in cache: " + toString(fCachedPositions[i])); //$NON-NLS-1$ } return fCachedPositions; } /** * Pretty print a <code>Position</code>. * * @param position the position to format * @return a formatted string */ private String toString(Position position) { return "P[" + position.getOffset() + "+" + position.getLength() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } }
package mesfavoris.bookmarktype; import java.io.BufferedReader; import java.io.IOException; import java.io.StringReader; import java.util.Optional; import mesfavoris.model.Bookmark; public abstract class <API key> implements <API key> { protected Optional<String> getMessage(Bookmark bookmark) { String comment = bookmark.getPropertyValue(Bookmark.PROPERTY_COMMENT); if (comment == null) { return Optional.empty(); } try (BufferedReader br = new BufferedReader(new StringReader(comment))) { return Optional.ofNullable(br.readLine()); } catch (IOException e) { return Optional.empty(); } } }
package org.eclipse.jface.text.source; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseMoveListener; import org.eclipse.swt.events.MouseTrackAdapter; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.jface.text.<API key>; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextListener; import org.eclipse.jface.text.ITextViewer; import org.eclipse.jface.text.<API key>; import org.eclipse.jface.text.JFaceTextUtil; import org.eclipse.jface.text.Position; import org.eclipse.jface.text.Region; import org.eclipse.jface.text.TextEvent; import org.eclipse.jface.text.source.projection.AnnotationBag; /** * Ruler presented next to a source viewer showing all annotations of the * viewer's annotation model in a compact format. The ruler has the same height * as the source viewer. * <p> * Clients usually instantiate and configure objects of this class.</p> * * @since 2.1 */ public class OverviewRuler implements IOverviewRuler { /** * Internal listener class. */ class InternalListener implements ITextListener, <API key>, <API key> { /* * @see ITextListener#textChanged */ public void textChanged(TextEvent e) { if (fTextViewer != null && e.getDocumentEvent() == null && e.<API key>()) { // handle only changes of visible document redraw(); } } /* * @see <API key>#modelChanged(IAnnotationModel) */ public void modelChanged(IAnnotationModel model) { update(); } /* * @see org.eclipse.jface.text.source.<API key>#modelChanged(org.eclipse.jface.text.source.<API key>) * @since 3.3 */ public void modelChanged(<API key> event) { if (!event.isValid()) return; if (event.isWorldChange()) { update(); return; } Annotation[] annotations= event.getAddedAnnotations(); int length= annotations.length; for (int i= 0; i < length; i++) { if (!skip(annotations[i].getType())) { update(); return; } } annotations= event.<API key>(); length= annotations.length; for (int i= 0; i < length; i++) { if (!skip(annotations[i].getType())) { update(); return; } } annotations= event.<API key>(); length= annotations.length; for (int i= 0; i < length; i++) { if (!skip(annotations[i].getType())) { update(); return; } } } } /** * Enumerates the annotations of a specified type and characteristics * of the associated annotation model. */ class FilterIterator implements Iterator { final static int TEMPORARY= 1 << 1; final static int PERSISTENT= 1 << 2; final static int IGNORE_BAGS= 1 << 3; private Iterator fIterator; private Object fType; private Annotation fNext; private int fStyle; /** * Creates a new filter iterator with the given specification. * * @param annotationType the annotation type * @param style the style */ public FilterIterator(Object annotationType, int style) { fType= annotationType; fStyle= style; if (fModel != null) { fIterator= fModel.<API key>(); skip(); } } /** * Creates a new filter iterator with the given specification. * * @param annotationType the annotation type * @param style the style * @param iterator the iterator */ public FilterIterator(Object annotationType, int style, Iterator iterator) { fType= annotationType; fStyle= style; fIterator= iterator; skip(); } private void skip() { boolean temp= (fStyle & TEMPORARY) != 0; boolean pers= (fStyle & PERSISTENT) != 0; boolean ignr= (fStyle & IGNORE_BAGS) != 0; while (fIterator.hasNext()) { Annotation next= (Annotation) fIterator.next(); if (next.isMarkedDeleted()) continue; if (ignr && (next instanceof AnnotationBag)) continue; fNext= next; Object annotationType= next.getType(); if (fType == null || fType.equals(annotationType) || !<API key>.contains(annotationType) && isSubtype(annotationType)) { if (temp && pers) return; if (pers && next.isPersistent()) return; if (temp && !next.isPersistent()) return; } } fNext= null; } private boolean isSubtype(Object annotationType) { if (fAnnotationAccess instanceof <API key>) { <API key> extension= (<API key>) fAnnotationAccess; return extension.isSubtype(annotationType, fType); } return fType.equals(annotationType); } /* * @see Iterator#hasNext() */ public boolean hasNext() { return fNext != null; } /* * @see Iterator#next() */ public Object next() { try { return fNext; } finally { if (fIterator != null) skip(); } } /* * @see Iterator#remove() */ public void remove() { throw new <API key>(); } } /** * The painter of the overview ruler's header. */ class HeaderPainter implements PaintListener { private Color fIndicatorColor; private Color fSeparatorColor; /** * Creates a new header painter. */ public HeaderPainter() { fSeparatorColor= fHeader.getDisplay().getSystemColor(SWT.<API key>); } /** * Sets the header color. * * @param color the header color */ public void setColor(Color color) { fIndicatorColor= color; } private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topLeft, Color bottomRight) { gc.setForeground(topLeft == null ? fSeparatorColor : topLeft); gc.drawLine(x, y, x + w -1, y); gc.drawLine(x, y, x, y + h -1); gc.setForeground(bottomRight == null ? fSeparatorColor : bottomRight); gc.drawLine(x + w, y, x + w, y + h); gc.drawLine(x, y + h, x + w, y + h); } public void paintControl(PaintEvent e) { if (fIndicatorColor == null) return; Point s= fHeader.getSize(); e.gc.setBackground(fIndicatorColor); Rectangle r= new Rectangle(INSET, (s.y - (2*ANNOTATION_HEIGHT)) / 2, s.x - (2*INSET), 2*ANNOTATION_HEIGHT); e.gc.fillRectangle(r); Display d= fHeader.getDisplay(); if (d != null) // drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, d.getSystemColor(SWT.<API key>), d.getSystemColor(SWT.<API key>)); drawBevelRect(e.gc, r.x, r.y, r.width -1, r.height -1, null, null); e.gc.setForeground(fSeparatorColor); e.gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance e.gc.drawLine(0, s.y -1, s.x -1, s.y -1); } } private static final int INSET= 2; private static final int ANNOTATION_HEIGHT= 4; private static boolean <API key>= true; /** The model of the overview ruler */ private IAnnotationModel fModel; /** The view to which this ruler is connected */ private ITextViewer fTextViewer; /** The ruler's canvas */ private Canvas fCanvas; /** The ruler's header */ private Canvas fHeader; /** The buffer for double buffering */ private Image fBuffer; /** The internal listener */ private InternalListener fInternalListener= new InternalListener(); /** The width of this vertical ruler */ private int fWidth; /** The hit detection cursor. Do not dispose. */ private Cursor fHitDetectionCursor; /** The last cursor. Do not dispose. */ private Cursor fLastCursor; /** The line of the last mouse button activity */ private int <API key>= -1; /** The actual annotation height */ private int fAnnotationHeight= -1; /** The annotation access */ private IAnnotationAccess fAnnotationAccess; /** The header painter */ private HeaderPainter fHeaderPainter; /** * The list of annotation types to be shown in this ruler. * @since 3.0 */ private Set <API key>= new HashSet(); /** * The list of annotation types to be shown in the header of this ruler. * @since 3.0 */ private Set <API key>= new HashSet(); /** The mapping between annotation types and colors */ private Map <API key>= new HashMap(); /** The color manager */ private ISharedTextColors fSharedTextColors; /** * All available annotation types sorted by layer. * * @since 3.0 */ private List <API key>= new ArrayList(); /** * All available layers sorted by layer. * This list may contain duplicates. * @since 3.0 */ private List <API key>= new ArrayList(); /** * Map of allowed annotation types. * An allowed annotation type maps to <code>true</code>, a disallowed * to <code>false</code>. * @since 3.0 */ private Map <API key>= new HashMap(); /** * Map of allowed header annotation types. * An allowed annotation type maps to <code>true</code>, a disallowed * to <code>false</code>. * @since 3.0 */ private Map <API key>= new HashMap(); /** * The cached annotations. * @since 3.0 */ private List fCachedAnnotations= new ArrayList(); /** * Redraw runnable lock * @since 3.3 */ private Object fRunnableLock= new Object(); /** * Redraw runnable state * @since 3.3 */ private boolean fIsRunnablePosted= false; /** * Redraw runnable * @since 3.3 */ private Runnable fRunnable= new Runnable() { public void run() { synchronized (fRunnableLock) { fIsRunnablePosted= false; } redraw(); updateHeader(); } }; /** * Tells whether temporary annotations are drawn with * a separate color. This color will be computed by * discoloring the original annotation color. * * @since 3.4 */ private boolean <API key>; /** * Constructs a overview ruler of the given width using the given annotation access and the given * color manager. * <p><strong>Note:</strong> As of 3.4, temporary annotations are no longer discolored. * Use {@link #OverviewRuler(IAnnotationAccess, int, ISharedTextColors, boolean)} if you * want to keep the old behavior.</p> * * @param annotationAccess the annotation access * @param width the width of the vertical ruler * @param sharedColors the color manager */ public OverviewRuler(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors) { this(annotationAccess, width, sharedColors, false); } /** * Constructs a overview ruler of the given width using the given annotation * access and the given color manager. * * @param annotationAccess the annotation access * @param width the width of the vertical ruler * @param sharedColors the color manager * @param <API key> <code>true</code> if temporary annotations should be discolored * @since 3.4 */ public OverviewRuler(IAnnotationAccess annotationAccess, int width, ISharedTextColors sharedColors, boolean <API key>) { fAnnotationAccess= annotationAccess; fWidth= width; fSharedTextColors= sharedColors; <API key>= <API key>; } /* * @see org.eclipse.jface.text.source.IVerticalRulerInfo#getControl() */ public Control getControl() { return fCanvas; } /* * @see org.eclipse.jface.text.source.IVerticalRulerInfo#getWidth() */ public int getWidth() { return fWidth; } /* * @see org.eclipse.jface.text.source.IVerticalRuler#setModel(org.eclipse.jface.text.source.IAnnotationModel) */ public void setModel(IAnnotationModel model) { if (model != fModel || model != null) { if (fModel != null) fModel.<API key>(fInternalListener); fModel= model; if (fModel != null) fModel.<API key>(fInternalListener); update(); } } /* * @see org.eclipse.jface.text.source.IVerticalRuler#createControl(org.eclipse.swt.widgets.Composite, org.eclipse.jface.text.ITextViewer) */ public Control createControl(Composite parent, ITextViewer textViewer) { fTextViewer= textViewer; fHitDetectionCursor= parent.getDisplay().getSystemCursor(SWT.CURSOR_HAND); fHeader= new Canvas(parent, SWT.NONE); if (fAnnotationAccess instanceof <API key>) { fHeader.<API key>(new MouseTrackAdapter() { /* * @see org.eclipse.swt.events.MouseTrackAdapter#mouseHover(org.eclipse.swt.events.MouseEvent) * @since 3.3 */ public void mouseEnter(MouseEvent e) { <API key>(); } }); } fCanvas= new Canvas(parent, SWT.NO_BACKGROUND); fCanvas.addPaintListener(new PaintListener() { public void paintControl(PaintEvent event) { if (fTextViewer != null) doubleBufferPaint(event.gc); } }); fCanvas.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent event) { handleDispose(); fTextViewer= null; } }); fCanvas.addMouseListener(new MouseAdapter() { public void mouseDown(MouseEvent event) { handleMouseDown(event); } }); fCanvas.<API key>(new MouseMoveListener() { public void mouseMove(MouseEvent event) { handleMouseMove(event); } }); if (fTextViewer != null) fTextViewer.addTextListener(fInternalListener); return fCanvas; } /** * Disposes the ruler's resources. */ private void handleDispose() { if (fTextViewer != null) { fTextViewer.removeTextListener(fInternalListener); fTextViewer= null; } if (fModel != null) fModel.<API key>(fInternalListener); if (fBuffer != null) { fBuffer.dispose(); fBuffer= null; } <API key>.clear(); <API key>.clear(); <API key>.clear(); <API key>.clear(); <API key>.clear(); <API key>.clear(); <API key>.clear(); } /** * Double buffer drawing. * * @param dest the GC to draw into */ private void doubleBufferPaint(GC dest) { Point size= fCanvas.getSize(); if (size.x <= 0 || size.y <= 0) return; if (fBuffer != null) { Rectangle r= fBuffer.getBounds(); if (r.width != size.x || r.height != size.y) { fBuffer.dispose(); fBuffer= null; } } if (fBuffer == null) fBuffer= new Image(fCanvas.getDisplay(), size.x, size.y); GC gc= new GC(fBuffer); try { gc.setBackground(fCanvas.getBackground()); gc.fillRectangle(0, 0, size.x, size.y); cacheAnnotations(); if (fTextViewer instanceof <API key>) doPaint1(gc); else doPaint(gc); } finally { gc.dispose(); } dest.drawImage(fBuffer, 0, 0); } /** * Draws this overview ruler. * * @param gc the GC to draw into */ private void doPaint(GC gc) { Rectangle r= new Rectangle(0, 0, 0, 0); int yy, hh= ANNOTATION_HEIGHT; IDocument document= fTextViewer.getDocument(); IRegion visible= fTextViewer.getVisibleRegion(); StyledText textWidget= fTextViewer.getTextWidget(); int maxLines= textWidget.getLineCount(); Point size= fCanvas.getSize(); int writable= JFaceTextUtil.computeLineHeight(textWidget, 0, maxLines, maxLines); if (size.y > writable) size.y= Math.max(writable - fHeader.getSize().y, 0); for (Iterator iterator= <API key>.iterator(); iterator.hasNext();) { Object annotationType= iterator.next(); if (skip(annotationType)) continue; int[] style= new int[] { FilterIterator.PERSISTENT, FilterIterator.TEMPORARY }; for (int t=0; t < style.length; t++) { Iterator e= new FilterIterator(annotationType, style[t], fCachedAnnotations.iterator()); boolean areColorsComputed= false; Color fill= null; Color stroke= null; for (int i= 0; e.hasNext(); i++) { Annotation a= (Annotation) e.next(); Position p= fModel.getPosition(a); if (p == null || !p.overlapsWith(visible.getOffset(), visible.getLength())) continue; int annotationOffset= Math.max(p.getOffset(), visible.getOffset()); int annotationEnd= Math.min(p.getOffset() + p.getLength(), visible.getOffset() + visible.getLength()); int annotationLength= annotationEnd - annotationOffset; try { if (<API key>) { int numbersOfLines= document.getNumberOfLines(annotationOffset, annotationLength); // don't count empty trailing lines IRegion lastLine= document.<API key>(annotationOffset + annotationLength); if (lastLine.getOffset() == annotationOffset + annotationLength) { numbersOfLines -= 2; hh= (numbersOfLines * size.y) / maxLines + ANNOTATION_HEIGHT; if (hh < ANNOTATION_HEIGHT) hh= ANNOTATION_HEIGHT; } else hh= ANNOTATION_HEIGHT; } fAnnotationHeight= hh; int startLine= textWidget.getLineAtOffset(annotationOffset - visible.getOffset()); yy= Math.min((startLine * size.y) / maxLines, size.y - hh); if (!areColorsComputed) { fill= getFillColor(annotationType, style[t] == FilterIterator.TEMPORARY); stroke= getStrokeColor(annotationType, style[t] == FilterIterator.TEMPORARY); areColorsComputed= true; } if (fill != null) { gc.setBackground(fill); gc.fillRectangle(INSET, yy, size.x-(2*INSET), hh); } if (stroke != null) { gc.setForeground(stroke); r.x= INSET; r.y= yy; r.width= size.x - (2 * INSET); r.height= hh; gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance gc.drawRectangle(r); } } catch (<API key> x) { } } } } } private void cacheAnnotations() { fCachedAnnotations.clear(); if (fModel != null) { Iterator iter= fModel.<API key>(); while (iter.hasNext()) { Annotation annotation= (Annotation) iter.next(); if (annotation.isMarkedDeleted()) continue; if (skip(annotation.getType())) continue; fCachedAnnotations.add(annotation); } } } /** * Draws this overview ruler. Uses <code><API key></code> for * its implementation. Will replace <code>doPaint(GC)</code>. * * @param gc the GC to draw into */ private void doPaint1(GC gc) { Rectangle r= new Rectangle(0, 0, 0, 0); int yy, hh= ANNOTATION_HEIGHT; <API key> extension= (<API key>) fTextViewer; IDocument document= fTextViewer.getDocument(); StyledText textWidget= fTextViewer.getTextWidget(); int maxLines= textWidget.getLineCount(); Point size= fCanvas.getSize(); int writable= JFaceTextUtil.computeLineHeight(textWidget, 0, maxLines, maxLines); if (size.y > writable) size.y= Math.max(writable - fHeader.getSize().y, 0); for (Iterator iterator= <API key>.iterator(); iterator.hasNext();) { Object annotationType= iterator.next(); if (skip(annotationType)) continue; int[] style= new int[] { FilterIterator.PERSISTENT, FilterIterator.TEMPORARY }; for (int t=0; t < style.length; t++) { Iterator e= new FilterIterator(annotationType, style[t], fCachedAnnotations.iterator()); boolean areColorsComputed= false; Color fill= null; Color stroke= null; for (int i= 0; e.hasNext(); i++) { Annotation a= (Annotation) e.next(); Position p= fModel.getPosition(a); if (p == null) continue; IRegion widgetRegion= extension.<API key>(new Region(p.getOffset(), p.getLength())); if (widgetRegion == null) continue; try { if (<API key>) { int numbersOfLines= document.getNumberOfLines(p.getOffset(), p.getLength()); // don't count empty trailing lines IRegion lastLine= document.<API key>(p.getOffset() + p.getLength()); if (lastLine.getOffset() == p.getOffset() + p.getLength()) { numbersOfLines -= 2; hh= (numbersOfLines * size.y) / maxLines + ANNOTATION_HEIGHT; if (hh < ANNOTATION_HEIGHT) hh= ANNOTATION_HEIGHT; } else hh= ANNOTATION_HEIGHT; } fAnnotationHeight= hh; int startLine= textWidget.getLineAtOffset(widgetRegion.getOffset()); yy= Math.min((startLine * size.y) / maxLines, size.y - hh); if (!areColorsComputed) { fill= getFillColor(annotationType, style[t] == FilterIterator.TEMPORARY); stroke= getStrokeColor(annotationType, style[t] == FilterIterator.TEMPORARY); areColorsComputed= true; } if (fill != null) { gc.setBackground(fill); gc.fillRectangle(INSET, yy, size.x-(2*INSET), hh); } if (stroke != null) { gc.setForeground(stroke); r.x= INSET; r.y= yy; r.width= size.x - (2 * INSET); r.height= hh; gc.setLineWidth(0); // NOTE: 0 means width is 1 but with optimized performance gc.drawRectangle(r); } } catch (<API key> x) { } } } } } /* * @see org.eclipse.jface.text.source.IVerticalRuler#update() */ public void update() { if (fCanvas != null && !fCanvas.isDisposed()) { Display d= fCanvas.getDisplay(); if (d != null) { synchronized (fRunnableLock) { if (fIsRunnablePosted) return; fIsRunnablePosted= true; } d.asyncExec(fRunnable); } } } /** * Redraws the overview ruler. */ private void redraw() { if (fTextViewer == null || fModel == null) return; if (fCanvas != null && !fCanvas.isDisposed()) { GC gc= new GC(fCanvas); doubleBufferPaint(gc); gc.dispose(); } } /** * Translates a given y-coordinate of this ruler into the corresponding * document lines. The number of lines depends on the concrete scaling * given as the ration between the height of this ruler and the length * of the document. * * @param y_coordinate the y-coordinate * @return the corresponding document lines */ private int[] toLineNumbers(int y_coordinate) { StyledText textWidget= fTextViewer.getTextWidget(); int maxLines= textWidget.getContent().getLineCount(); int rulerLength= fCanvas.getSize().y; int writable= JFaceTextUtil.computeLineHeight(textWidget, 0, maxLines, maxLines); if (rulerLength > writable) rulerLength= Math.max(writable - fHeader.getSize().y, 0); if (y_coordinate >= writable || y_coordinate >= rulerLength) return new int[] {-1, -1}; int[] lines= new int[2]; int pixel0= Math.max(y_coordinate - 1, 0); int pixel1= Math.min(rulerLength, y_coordinate + 1); rulerLength= Math.max(rulerLength, 1); lines[0]= (pixel0 * maxLines) / rulerLength; lines[1]= (pixel1 * maxLines) / rulerLength; if (fTextViewer instanceof <API key>) { <API key> extension= (<API key>) fTextViewer; lines[0]= extension.<API key>(lines[0]); lines[1]= extension.<API key>(lines[1]); } else { try { IRegion visible= fTextViewer.getVisibleRegion(); int lineNumber= fTextViewer.getDocument().getLineOfOffset(visible.getOffset()); lines[0] += lineNumber; lines[1] += lineNumber; } catch (<API key> x) { } } return lines; } /** * Returns the position of the first annotation found in the given line range. * * @param lineNumbers the line range * @return the position of the first found annotation */ private Position <API key>(int[] lineNumbers) { if (lineNumbers[0] == -1) return null; Position found= null; try { IDocument d= fTextViewer.getDocument(); IRegion line= d.getLineInformation(lineNumbers[0]); int start= line.getOffset(); line= d.getLineInformation(lineNumbers[lineNumbers.length - 1]); int end= line.getOffset() + line.getLength(); for (int i= <API key>.size() -1; i >= 0; i Object annotationType= <API key>.get(i); Iterator e= new FilterIterator(annotationType, FilterIterator.PERSISTENT | FilterIterator.TEMPORARY); while (e.hasNext() && found == null) { Annotation a= (Annotation) e.next(); if (a.isMarkedDeleted()) continue; if (skip(a.getType())) continue; Position p= fModel.getPosition(a); if (p == null) continue; int posOffset= p.getOffset(); int posEnd= posOffset + p.getLength(); IRegion region= d.<API key>(posEnd); // trailing empty lines don't count if (posEnd > posOffset && region.getOffset() == posEnd) { posEnd region= d.<API key>(posEnd); } if (posOffset <= end && posEnd >= start) found= p; } } } catch (<API key> x) { } return found; } /** * Returns the line which corresponds best to one of * the underlying annotations at the given y-coordinate. * * @param lineNumbers the line numbers * @return the best matching line or <code>-1</code> if no such line can be found */ private int <API key>(int[] lineNumbers) { if (lineNumbers == null || lineNumbers.length < 1) return -1; try { Position pos= <API key>(lineNumbers); if (pos == null) return -1; return fTextViewer.getDocument().getLineOfOffset(pos.getOffset()); } catch (<API key> ex) { return -1; } } /** * Handles mouse clicks. * * @param event the mouse button down event */ private void handleMouseDown(MouseEvent event) { if (fTextViewer != null) { int[] lines= toLineNumbers(event.y); Position p= <API key>(lines); if (p == null && event.button == 1) { try { p= new Position(fTextViewer.getDocument().getLineInformation(lines[0]).getOffset(), 0); } catch (<API key> e) { // do nothing } } if (p != null) { fTextViewer.revealRange(p.getOffset(), p.getLength()); fTextViewer.setSelectedRange(p.getOffset(), p.getLength()); } fTextViewer.getTextWidget().setFocus(); } <API key>= <API key>(event.y); } /** * Handles mouse moves. * * @param event the mouse move event */ private void handleMouseMove(MouseEvent event) { if (fTextViewer != null) { int[] lines= toLineNumbers(event.y); Position p= <API key>(lines); Cursor cursor= (p != null ? fHitDetectionCursor : null); if (cursor != fLastCursor) { fCanvas.setCursor(cursor); fLastCursor= cursor; } } } /* * @see org.eclipse.jface.text.source.IOverviewRuler#addAnnotationType(java.lang.Object) */ public void addAnnotationType(Object annotationType) { <API key>.add(annotationType); <API key>.clear(); } /* * @see org.eclipse.jface.text.source.IOverviewRuler#<API key>(java.lang.Object) */ public void <API key>(Object annotationType) { <API key>.remove(annotationType); <API key>.clear(); } /* * @see org.eclipse.jface.text.source.IOverviewRuler#<API key>(java.lang.Object, int) */ public void <API key>(Object annotationType, int layer) { int j= <API key>.indexOf(annotationType); if (j != -1) { <API key>.remove(j); <API key>.remove(j); } if (layer >= 0) { int i= 0; int size= <API key>.size(); while (i < size && layer >= ((Integer)<API key>.get(i)).intValue()) i++; Integer layerObj= new Integer(layer); <API key>.add(i, layerObj); <API key>.add(i, annotationType); } } /* * @see org.eclipse.jface.text.source.IOverviewRuler#<API key>(java.lang.Object, org.eclipse.swt.graphics.Color) */ public void <API key>(Object annotationType, Color color) { if (color != null) <API key>.put(annotationType, color); else <API key>.remove(annotationType); } /** * Returns whether the given annotation type should be skipped by the drawing routine. * * @param annotationType the annotation type * @return <code>true</code> if annotation of the given type should be skipped */ private boolean skip(Object annotationType) { return !contains(annotationType, <API key>, <API key>); } /** * Returns whether the given annotation type should be skipped by the drawing routine of the header. * * @param annotationType the annotation type * @return <code>true</code> if annotation of the given type should be skipped * @since 3.0 */ private boolean skipInHeader(Object annotationType) { return !contains(annotationType, <API key>, <API key>); } /** * Returns whether the given annotation type is mapped to <code>true</code> * in the given <code>allowed</code> map or covered by the <code>configured</code> * set. * * @param annotationType the annotation type * @param allowed the map with allowed annotation types mapped to booleans * @param configured the set with configured annotation types * @return <code>true</code> if annotation is contained, <code>false</code> * otherwise * @since 3.0 */ private boolean contains(Object annotationType, Map allowed, Set configured) { Boolean cached= (Boolean) allowed.get(annotationType); if (cached != null) return cached.booleanValue(); boolean covered= isCovered(annotationType, configured); allowed.put(annotationType, covered ? Boolean.TRUE : Boolean.FALSE); return covered; } /** * Computes whether the annotations of the given type are covered by the given <code>configured</code> * set. This is the case if either the type of the annotation or any of its * super types is contained in the <code>configured</code> set. * * @param annotationType the annotation type * @param configured the set with configured annotation types * @return <code>true</code> if annotation is covered, <code>false</code> * otherwise * @since 3.0 */ private boolean isCovered(Object annotationType, Set configured) { if (fAnnotationAccess instanceof <API key>) { <API key> extension= (<API key>) fAnnotationAccess; Iterator e= configured.iterator(); while (e.hasNext()) { if (extension.isSubtype(annotationType,e.next())) return true; } return false; } return configured.contains(annotationType); } /** * Returns a specification of a color that lies between the given * foreground and background color using the given scale factor. * * @param fg the foreground color * @param bg the background color * @param scale the scale factor * @return the interpolated color */ private static RGB interpolate(RGB fg, RGB bg, double scale) { return new RGB( (int) ((1.0-scale) * fg.red + scale * bg.red), (int) ((1.0-scale) * fg.green + scale * bg.green), (int) ((1.0-scale) * fg.blue + scale * bg.blue) ); } /** * Returns the grey value in which the given color would be drawn in grey-scale. * * @param rgb the color * @return the grey-scale value */ private static double greyLevel(RGB rgb) { if (rgb.red == rgb.green && rgb.green == rgb.blue) return rgb.red; return (0.299 * rgb.red + 0.587 * rgb.green + 0.114 * rgb.blue + 0.5); } /** * Returns whether the given color is dark or light depending on the colors grey-scale level. * * @param rgb the color * @return <code>true</code> if the color is dark, <code>false</code> if it is light */ private static boolean isDark(RGB rgb) { return greyLevel(rgb) > 128; } /** * Returns a color based on the color configured for the given annotation type and the given scale factor. * * @param annotationType the annotation type * @param scale the scale factor * @return the computed color */ private Color getColor(Object annotationType, double scale) { Color base= findColor(annotationType); if (base == null) return null; RGB baseRGB= base.getRGB(); RGB background= fCanvas.getBackground().getRGB(); boolean darkBase= isDark(baseRGB); boolean darkBackground= isDark(background); if (darkBase && darkBackground) background= new RGB(255, 255, 255); else if (!darkBase && !darkBackground) background= new RGB(0, 0, 0); return fSharedTextColors.getColor(interpolate(baseRGB, background, scale)); } /** * Returns the color for the given annotation type * * @param annotationType the annotation type * @return the color * @since 3.0 */ private Color findColor(Object annotationType) { Color color= (Color) <API key>.get(annotationType); if (color != null) return color; if (fAnnotationAccess instanceof <API key>) { <API key> extension= (<API key>) fAnnotationAccess; Object[] superTypes= extension.getSupertypes(annotationType); if (superTypes != null) { for (int i= 0; i < superTypes.length; i++) { color= (Color) <API key>.get(superTypes[i]); if (color != null) return color; } } } return null; } /** * Returns the stroke color for the given annotation type and characteristics. * * @param annotationType the annotation type * @param temporary <code>true</code> if for temporary annotations * @return the stroke color */ private Color getStrokeColor(Object annotationType, boolean temporary) { return getColor(annotationType, temporary && <API key> ? 0.5 : 0.2); } /** * Returns the fill color for the given annotation type and characteristics. * * @param annotationType the annotation type * @param temporary <code>true</code> if for temporary annotations * @return the fill color */ private Color getFillColor(Object annotationType, boolean temporary) { return getColor(annotationType, temporary && <API key> ? 0.9 : 0.75); } /* * @see IVerticalRulerInfo#<API key>() */ public int <API key>() { if (<API key> >= fTextViewer.getDocument().getNumberOfLines()) <API key>= -1; return <API key>; } /* * @see IVerticalRulerInfo#<API key>(int) */ public int <API key>(int y_coordinate) { if (fTextViewer == null || y_coordinate == -1) return -1; int[] lineNumbers= toLineNumbers(y_coordinate); int bestLine= <API key>(lineNumbers); if (bestLine == -1 && lineNumbers.length > 0) return lineNumbers[0]; return bestLine; } /* * @see org.eclipse.jface.text.source.IVerticalRuler#getModel() */ public IAnnotationModel getModel() { return fModel; } /* * @see org.eclipse.jface.text.source.IOverviewRuler#getAnnotationHeight() */ public int getAnnotationHeight() { return fAnnotationHeight; } /* * @see org.eclipse.jface.text.source.IOverviewRuler#hasAnnotation(int) */ public boolean hasAnnotation(int y) { return <API key>(toLineNumbers(y)) != -1; } /* * @see org.eclipse.jface.text.source.IOverviewRuler#getHeaderControl() */ public Control getHeaderControl() { return fHeader; } /* * @see org.eclipse.jface.text.source.IOverviewRuler#<API key>(java.lang.Object) */ public void <API key>(Object annotationType) { <API key>.add(annotationType); <API key>.clear(); } /* * @see org.eclipse.jface.text.source.IOverviewRuler#<API key>(java.lang.Object) */ public void <API key>(Object annotationType) { <API key>.remove(annotationType); <API key>.clear(); } /** * Updates the header of this ruler. */ private void updateHeader() { if (fHeader == null || fHeader.isDisposed()) return; fHeader.setToolTipText(null); Object colorType= null; outer: for (int i= <API key>.size() -1; i >= 0; i Object annotationType= <API key>.get(i); if (skipInHeader(annotationType) || skip(annotationType)) continue; Iterator e= new FilterIterator(annotationType, FilterIterator.PERSISTENT | FilterIterator.TEMPORARY | FilterIterator.IGNORE_BAGS, fCachedAnnotations.iterator()); while (e.hasNext()) { if (e.next() != null) { colorType= annotationType; break outer; } } } Color color= null; if (colorType != null) color= findColor(colorType); if (color == null) { if (fHeaderPainter != null) fHeaderPainter.setColor(null); } else { if (fHeaderPainter == null) { fHeaderPainter= new HeaderPainter(); fHeader.addPaintListener(fHeaderPainter); } fHeaderPainter.setColor(color); } fHeader.redraw(); } /** * Updates the header tool tip text of this ruler. */ private void <API key>() { if (fHeader == null || fHeader.isDisposed()) return; if (fHeader.getToolTipText() != null) return; String overview= ""; //$NON-NLS-1$ for (int i= <API key>.size() -1; i >= 0; i Object annotationType= <API key>.get(i); if (skipInHeader(annotationType) || skip(annotationType)) continue; int count= 0; String annotationTypeLabel= null; Iterator e= new FilterIterator(annotationType, FilterIterator.PERSISTENT | FilterIterator.TEMPORARY | FilterIterator.IGNORE_BAGS, fCachedAnnotations.iterator()); while (e.hasNext()) { Annotation annotation= (Annotation)e.next(); if (annotation != null) { if (annotationTypeLabel == null) annotationTypeLabel= ((<API key>)fAnnotationAccess).getTypeLabel(annotation); count++; } } if (annotationTypeLabel != null) { if (overview.length() > 0) overview += "\n"; //$NON-NLS-1$ overview += JFaceTextMessages.getFormattedString("OverviewRulerHeader.toolTipTextEntry", new Object[] {annotationTypeLabel, new Integer(count)}); //$NON-NLS-1$ } } if (overview.length() > 0) fHeader.setToolTipText(overview); } }
package org.cohorte.studio.eclipse.ui.node.project; import java.io.<API key>; import java.io.InputStream; import java.io.StringWriter; import java.util.HashMap; import java.util.Map; import javax.inject.Inject; import javax.json.Json; import javax.json.JsonArrayBuilder; import javax.json.JsonBuilderFactory; import javax.json.JsonObject; import javax.json.JsonObjectBuilder; import javax.json.JsonWriter; import javax.json.stream.JsonGenerator; import org.cohorte.studio.eclipse.api.annotations.NonNull; import org.cohorte.studio.eclipse.api.objects.IHttpTransport; import org.cohorte.studio.eclipse.api.objects.INode; import org.cohorte.studio.eclipse.api.objects.IRuntime; import org.cohorte.studio.eclipse.api.objects.ITransport; import org.cohorte.studio.eclipse.api.objects.IXmppTransport; import org.cohorte.studio.eclipse.core.api.<API key>; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.eclipse.e4.core.di.annotations.Creatable; /** * Node project content manager. * * @author Ahmad Shahwan * */ @Creatable public class CNodeContentManager implements <API key><INode> { private static final String CONF = "conf"; //$NON-NLS-1$ private static final String RUN_JS = new StringBuilder().append(CONF).append("/run.js").toString(); //$NON-NLS-1$ @SuppressWarnings("nls") private interface IJsonKeys { String NODE = "node"; String SHELL_PORT = "shell-port"; String HTTP_PORT = "http-port"; String NAME = "name"; String TOP_COMPOSER = "top-composer"; String CONSOLE = "console"; String COHORTE_VERSION = "cohorte-version"; String TRANSPORT = "transport"; String TRANSPORT_HTTP = "transport-http"; String HTTP_IPV = "http-ipv"; String TRANSPORT_XMPP = "transport-xmpp"; String XMPP_SERVER = "xmpp-server"; String XMPP_USER_ID = "xmpp-user-jid"; String XMPP_USER_<API key>; String XMPP_PORT = "xmpp-port"; } /** * Constructor. */ @Inject public CNodeContentManager() { } @Override public void populate(@NonNull IProject aProject, INode aModel) throws CoreException { if (!aProject.isOpen()) { aProject.open(null); } aProject.getFolder(CONF).create(true, true, null); IFile wRun = aProject.getFile(RUN_JS); StringWriter wBuffer = new StringWriter(); Map<String, Object> wProperties = new HashMap<>(1); wProperties.put(JsonGenerator.PRETTY_PRINTING, true); JsonWriter wJWriter = Json.createWriterFactory(wProperties).createWriter(wBuffer); JsonBuilderFactory wJ = Json.<API key>(null); JsonObjectBuilder wJson = wJ.createObjectBuilder() .add(IJsonKeys.NODE, wJ.createObjectBuilder() .add(IJsonKeys.SHELL_PORT, 0) .add(IJsonKeys.HTTP_PORT, 0) .add(IJsonKeys.NAME, aModel.getName()) .add(IJsonKeys.TOP_COMPOSER, aModel.isComposer()) .add(IJsonKeys.CONSOLE, true)); JsonArrayBuilder wTransports = wJ.createArrayBuilder(); for (ITransport wTransport : aModel.getTransports()) { wTransports.add(wTransport.getName()); if (wTransport instanceof IHttpTransport) { IHttpTransport wHttp = (IHttpTransport) wTransport; String wVer = wHttp.getVersion() == IHttpTransport.EVersion.IPV4 ? "4" : "6"; //$NON-NLS-1$//$NON-NLS-2$ wJson.add(IJsonKeys.TRANSPORT_HTTP, wJ.createObjectBuilder().add(IJsonKeys.HTTP_IPV, wVer)); } if (wTransport instanceof IXmppTransport) { IXmppTransport wXmpp = (IXmppTransport) wTransport; JsonObjectBuilder wJsonXmpp = wJ.createObjectBuilder() .add(IJsonKeys.XMPP_SERVER, wXmpp.getHostname()) .add(IJsonKeys.XMPP_PORT, wXmpp.getPort()); if (wXmpp.getUsername() != null) { wJsonXmpp .add(IJsonKeys.XMPP_USER_ID, wXmpp.getUsername()) .add(IJsonKeys.XMPP_USER_PASSWORD, wXmpp.getPassword()); } wJson .add(IJsonKeys.TRANSPORT_XMPP, wJsonXmpp); } } wJson.add(IJsonKeys.TRANSPORT, wTransports); IRuntime wRuntime = aModel.getRuntime(); if (wRuntime != null) { wJson.add(IJsonKeys.COHORTE_VERSION, wRuntime.getVersion()); } JsonObject wRunJs = wJson.build(); wJWriter.write(wRunJs); InputStream wInStream = new <API key>(wBuffer.toString().getBytes()); wRun.create(wInStream, true, null); } }
package com.codeaffine.eclipse.swt.util; import org.eclipse.swt.widgets.Display; public class ActionScheduler { private final Display display; private final Runnable action; public ActionScheduler( Display display, Runnable action ) { this.display = display; this.action = action; } public void schedule( int delay ) { display.timerExec( delay, action ); } }
// <API key>.h // <API key> #import <UIKit/UIKit.h> #import "Sample.h" #import "<API key>.h" @interface <API key> : UIViewController<UIAlertViewDelegate> { __strong IBOutlet UIImageView *imgView; } @property(nonatomic) Sample* selectedSample; @property (nonatomic, strong) <API key> *libraryObjectStore; - (id)initWithSample:(Sample*)initSample withLibrary:(<API key>*)initLibrary withImage:(UIImage*)initImage withDescription:(NSString*)initDescription; @end
package org.openhab.io.habmin.services.events; import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.HeaderParam; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.<API key>; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import org.atmosphere.annotation.Broadcast; import org.atmosphere.annotation.Suspend; import org.atmosphere.annotation.Suspend.SCOPE; import org.atmosphere.cpr.AtmosphereConfig; import org.atmosphere.cpr.AtmosphereResource; import org.atmosphere.cpr.BroadcasterFactory; import org.atmosphere.cpr.<API key>; import org.atmosphere.cpr.HeaderConfig; import org.atmosphere.jersey.JerseyBroadcaster; import org.atmosphere.jersey.SuspendResponse; import org.openhab.core.items.GenericItem; import org.openhab.core.items.Item; import org.openhab.core.items.<API key>; import org.openhab.core.items.StateChangeListener; import org.openhab.core.types.State; import org.openhab.io.habmin.HABminApplication; import org.openhab.io.habmin.internal.resources.MediaTypeHelper; import org.openhab.io.habmin.internal.resources.ResponseTypeHelper; import org.openhab.ui.items.ItemUIRegistry; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.FrameworkUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.sun.jersey.api.json.JSONWithPadding; /** * <p> * This class acts as a REST resource for history data and provides different * methods to interact with the, persistence store * * <p> * The typical content types are plain text for status values and XML or JSON(P) * for more complex data structures * </p> * * <p> * This resource is registered with the Jersey servlet. * </p> * * @author Chris Jackson * @since 1.3.0 */ @Path(EventResource.PATH_EVENTS) public class EventResource { private static final Logger logger = LoggerFactory.getLogger(EventResource.class); /** The URI path to this resource */ public static final String PATH_EVENTS = "events"; /* @Context UriInfo uriInfo; @Suspend(contentType = "application/json") @GET public String suspend() { return ""; } @Broadcast(writeEntity = false) @GET @Produces({ MediaType.WILDCARD }) public SuspendResponse<Response> getItems(@Context HttpHeaders headers, @HeaderParam(HeaderConfig.<API key>) String atmosphereTransport, @HeaderParam(HeaderConfig.X_CACHE_DATE) long cacheDate, @QueryParam("type") String type, @QueryParam("jsoncallback") @DefaultValue("callback") String callback, @Context AtmosphereResource resource) { logger.debug("Received HTTP GET request at '{}' for media type '{}'.", uriInfo.getPath(), type); String responseType = MediaTypeHelper.<API key>(headers.<API key>(), type); if (atmosphereTransport == null || atmosphereTransport.isEmpty()) { // first request => return all values // if (responseType != null) { // throw new <API key>(Response.ok( // <API key>(itemNames, System.currentTimeMillis()), // responseType).build()); // } else { throw new <API key>(Response.notAcceptable(null).build()); // } } String p = resource.getRequest().getPathInfo(); EventBroadcaster broadcaster = (EventBroadcaster) BroadcasterFactory.getDefault().lookup( EventBroadcaster.class, p, true); broadcaster.register(); // itemBroadcaster.<API key>(new // <API key>(itemNames)); return new SuspendResponse.<API key><Response>().scope(SCOPE.REQUEST) .resumeOnBroadcast(!ResponseTypeHelper.<API key>(resource.getRequest())) .broadcaster(broadcaster).outputComments(true).build(); } */ /* * @GET * * @Path("/{bundlename: [a-zA-Z_0-9]*}") * * @Produces({ MediaType.WILDCARD }) public SuspendResponse<Response> * getItemData(@Context HttpHeaders headers, @PathParam("bundlename") String * bundlename, * * @QueryParam("type") String type, @QueryParam("jsoncallback") * * @DefaultValue("callback") String callback, * * @HeaderParam(HeaderConfig.<API key>) String * atmosphereTransport, * * @Context AtmosphereResource resource) { * logger.debug("Received HTTP GET request at '{}' for media type '{}'.", * uriInfo.getPath(), type ); * * if (atmosphereTransport == null || atmosphereTransport.isEmpty()) { final * String responseType = * MediaTypeHelper.<API key>(headers.<API key>(), * type); if (responseType != null) { final Object responseObject = * responseType.equals(MediaTypeHelper.<API key>) ? new * JSONWithPadding( getBundleBean(bundlename, true), callback) : * getBundleBean(bundlename, true); throw new * <API key>(Response.ok(responseObject, * responseType).build()); } else { throw new * <API key>(Response.notAcceptable(null).build()); } } * GeneralBroadcaster itemBroadcaster = (GeneralBroadcaster) * BroadcasterFactory.getDefault().lookup( GeneralBroadcaster.class, * resource.getRequest().getPathInfo(), true); return new * SuspendResponse.<API key><Response>().scope(SCOPE.REQUEST) * .resumeOnBroadcast * (!ResponseTypeHelper.<API key>(resource.getRequest())) * .broadcaster(itemBroadcaster).outputComments(true).build(); } * * public static BundleBean createBundleBean(Bundle bundle, String uriPath, * boolean detail) { BundleBean bean = new BundleBean(); * * bean.name = bundle.getSymbolicName(); bean.version = * bundle.getVersion().toString(); bean.modified = bundle.getLastModified(); * bean.id = bundle.getBundleId(); bean.state = bundle.getState(); bean.link * = uriPath; * * return bean; } * * static public Item getBundle(String itemname, String uriPath) { * ItemUIRegistry registry = HABminApplication.getItemUIRegistry(); if * (registry != null) { try { Item item = registry.getItem(itemname); return * item; } catch (<API key> e) { logger.debug(e.getMessage()); } * } return null; } * * private ItemBean getBundleBean(String bundlename, String uriPath) { * * Item item = getItem(itemname); if (item != null) { return * createBundleBean(item, uriInfo.getBaseUri().toASCIIString(), true); } * else { * logger.info("Received HTTP GET request at '{}' for the unknown item '{}'." * , uriInfo.getPath(), itemname); throw new <API key>(404); } * } * * private List<BundleBean> getBundles(String uriPath) { List<BundleBean> * beans = new LinkedList<BundleBean>(); * * BundleContext bundleContext = FrameworkUtil.getBundle(this.getClass()) * .getBundleContext(); * * for (Bundle bundle : bundleContext.getBundles()) { * logger.info(bundle.toString()); BundleBean bean = * (BundleBean)createBundleBean(bundle, uriPath, false); * * if(bean != null) beans.add(bean); } return beans; } */ }
package org.springsource.ide.eclipse.gradle.core.modelmanager; import org.eclipse.core.runtime.IProgressMonitor; import org.springsource.ide.eclipse.gradle.core.GradleProject; /** * Interface that hides the mechanics of how models are being built via Gradle's tooling API (or whatever way * models are being built). To implement a ModelBuilder create a subclass of <API key> */ public interface ModelBuilder { public <T> BuildResult<T> buildModel(GradleProject project, Class<T> type, final IProgressMonitor mon); }
package org.mpisws.p2p.transport.peerreview.commitment; import java.io.IOException; import java.nio.ByteBuffer; import java.security.SignatureException; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import org.mpisws.p2p.transport.MessageCallback; import org.mpisws.p2p.transport.<API key>; import org.mpisws.p2p.transport.peerreview.PeerReview; import org.mpisws.p2p.transport.peerreview.PeerReviewConstants; import org.mpisws.p2p.transport.peerreview.history.HashSeq; import org.mpisws.p2p.transport.peerreview.history.IndexEntry; import org.mpisws.p2p.transport.peerreview.history.SecureHistory; import org.mpisws.p2p.transport.peerreview.history.logentry.EvtAck; import org.mpisws.p2p.transport.peerreview.history.logentry.EvtRecv; import org.mpisws.p2p.transport.peerreview.history.logentry.EvtSend; import org.mpisws.p2p.transport.peerreview.history.logentry.EvtSign; import org.mpisws.p2p.transport.peerreview.identity.IdentityTransport; import org.mpisws.p2p.transport.peerreview.infostore.PeerInfoStore; import org.mpisws.p2p.transport.peerreview.message.AckMessage; import org.mpisws.p2p.transport.peerreview.message.<API key>; import org.mpisws.p2p.transport.peerreview.message.UserDataMessage; import org.mpisws.p2p.transport.util.<API key>; import rice.environment.logging.Logger; import rice.p2p.commonapi.rawserialization.RawSerializable; import rice.p2p.util.MathUtils; import rice.p2p.util.rawserialization.SimpleInputBuffer; import rice.p2p.util.tuples.Tuple; import rice.selector.TimerTask; public class <API key><Handle extends RawSerializable, Identifier extends RawSerializable> implements CommitmentProtocol<Handle, Identifier>, PeerReviewConstants { public int MAX_PEERS = 250; public int <API key> = 1000; public int <API key> = 1000; public int RECEIVE_CACHE_SIZE = 100; public int MAX_RETRANSMISSIONS = 2; public int TI_PROGRESS = 1; public int <API key> = 1000; public int MAX_ENTRIES_PER_MS = 1000000; /* Max number of entries per millisecond */ /** * We need to keep some state for each peer, including separate transmit and * receive queues */ Map<Identifier, PeerInfo<Handle>> peer = new HashMap<Identifier, PeerInfo<Handle>>(); /** * We cache a few recently received messages, so we can recognize duplicates. * We also remember the location of the corresponding RECV entry in the log, * so we can reproduce the matching acknowledgment */ Map<Tuple<Identifier, Long>, ReceiveInfo<Identifier>> receiveCache; AuthenticatorStore<Identifier> authStore; SecureHistory history; PeerReview<Handle, Identifier> peerreview; PeerInfoStore<Handle, Identifier> infoStore; IdentityTransport<Handle, Identifier> transport; /** * If the time is more different than this from a peer, we discard the message */ long timeToleranceMillis; int <API key>; int signatureSizeBytes; int hashSizeBytes; TimerTask makeProgressTask; Logger logger; public <API key>(PeerReview<Handle,Identifier> peerreview, IdentityTransport<Handle, Identifier> transport, PeerInfoStore<Handle, Identifier> infoStore, AuthenticatorStore<Identifier> authStore, SecureHistory history, long timeToleranceMillis) throws IOException { this.peerreview = peerreview; this.transport = transport; this.infoStore = infoStore; this.authStore = authStore; this.history = history; this.<API key> = 0; // this.numPeers = 0; this.timeToleranceMillis = timeToleranceMillis; this.logger = peerreview.getEnvironment().getLogManager().getLogger(<API key>.class, null); initReceiveCache(); makeProgressTask = new TimerTask(){ @Override public void run() { <API key>(); } }; peerreview.getEnvironment().getSelectorManager().schedule(makeProgressTask, <API key>, <API key>); } /** * Load the last events from the history into the cache */ protected void initReceiveCache() throws IOException { receiveCache = new LinkedHashMap<Tuple<Identifier, Long>, ReceiveInfo<Identifier>>(RECEIVE_CACHE_SIZE, 0.75f, true) { @Override protected boolean removeEldestEntry(Map.Entry eldest) { return size() > RECEIVE_CACHE_SIZE; } }; for (long i=history.getNumEntries()-1; (i>=1) && (receiveCache.size() < RECEIVE_CACHE_SIZE); i IndexEntry hIndex = history.statEntry(i); if (hIndex.getType() == PeerReviewConstants.EVT_RECV) { // NOTE: this could be more efficient, because we don't need the whole thing SimpleInputBuffer sib = new SimpleInputBuffer(history.getEntry(hIndex, hIndex.getSizeInFile())); Identifier thisSender = peerreview.getIdSerializer().deserialize(sib); // NOTE: the message better start with the sender seq, but this is done within this protocol addToReceiveCache(thisSender, sib.readLong(), i); } } } protected void addToReceiveCache(Identifier id, long senderSeq, long indexInLocalHistory) { receiveCache.put(new Tuple<Identifier, Long>(id,senderSeq), new ReceiveInfo<Identifier>(id, senderSeq, indexInLocalHistory)); } protected PeerInfo<Handle> lookupPeer(Handle handle) { PeerInfo<Handle> ret = peer.get(peerreview.<API key>().extractIdentifier(handle)); if (ret != null) return ret; ret = new PeerInfo<Handle>(handle); peer.put(peerreview.<API key>().extractIdentifier(handle), ret); return ret; } @Override public void <API key>(Identifier id) { makeProgress(id); } /** * Checks whether an incoming message is already in the log (which can happen with duplicates). * If not, it adds the message to the log. * @return The ack message and whether it was already logged. * @throws SignatureException */ @Override public Tuple<AckMessage<Identifier>,Boolean> logMessageIfNew(UserDataMessage<Handle> udm) { try { boolean loggedPreviously; // part of the return statement long seqOfRecvEntry; byte[] myHashTop; byte[] myHashTopMinusOne; // SimpleInputBuffer sib = new SimpleInputBuffer(message); // UserDataMessage<Handle> udm = UserDataMessage.build(sib, peerreview.getHandleSerializer(), peerreview.getHashSizeInBytes(), peerreview.<API key>()); /* Check whether the log contains a matching RECV entry, i.e. one with a message from the same node and with the same send sequence number */ long indexOfRecvEntry = findRecvEntry(peerreview.<API key>().extractIdentifier(udm.getSenderHandle()), udm.getTopSeq()); /* If there is no such RECV entry, we append one */ if (indexOfRecvEntry < 0L) { /* Construct the RECV entry and append it to the log */ myHashTopMinusOne = history.getTopLevelEntry().getHash(); EvtRecv<Handle> recv = udm.getReceiveEvent(transport); history.appendEntry(EVT_RECV, true, recv.serialize()); HashSeq foo = history.getTopLevelEntry(); myHashTop = foo.getHash(); seqOfRecvEntry = foo.getSeq(); addToReceiveCache(peerreview.<API key>().extractIdentifier(udm.getSenderHandle()), udm.getTopSeq(), history.getNumEntries() - 1); if (logger.level < Logger.FINE) logger.log("New message logged as seq#"+seqOfRecvEntry); /* Construct the SIGN entry and append it to the log */ history.appendEntry(EVT_SIGN, true, new EvtSign(udm.getHTopMinusOne(),udm.getSignature()).serialize()); loggedPreviously = false; } else { loggedPreviously = true; /* If the RECV entry already exists, retrieve it */ // unsigned char type; // bool ok = true; IndexEntry i2 = history.statEntry(indexOfRecvEntry); //, &seqOfRecvEntry, &type, NULL, NULL, myHashTop); IndexEntry i1 = history.statEntry(indexOfRecvEntry-1); //, NULL, NULL, NULL, NULL, myHashTopMinusOne); assert(i1 != null && i2 != null && i2.getType() == EVT_RECV) : "i1:"+i1+" i2:"+i2; seqOfRecvEntry = i2.getSeq(); myHashTop = i2.getNodeHash(); myHashTopMinusOne = i1.getNodeHash(); if (logger.level < Logger.FINE) logger.log("This message has already been logged as seq#"+seqOfRecvEntry); } /* Generate ACK = (MSG_ACK, myID, remoteSeq, localSeq, myTopMinusOne, signature) */ byte[] hToSign = transport.hash(ByteBuffer.wrap(MathUtils.longToByteArray(seqOfRecvEntry)), ByteBuffer.wrap(myHashTop)); AckMessage<Identifier> ack = new AckMessage<Identifier>( peerreview.getLocalId(), udm.getTopSeq(), seqOfRecvEntry, myHashTopMinusOne, transport.sign(hToSign)); return new Tuple<AckMessage<Identifier>,Boolean>(ack, loggedPreviously); } catch (IOException ioe) { RuntimeException throwMe = new RuntimeException("Unexpect error logging message :"+udm); throwMe.initCause(ioe); throw throwMe; } } @Override public void notifyStatusChange(Identifier id, int newStatus) { <API key>(); } protected void <API key>() { for (Identifier i : peer.keySet()) { makeProgress(i); } } /** * Tries to make progress on the message queue of the specified peer, e.g. after that peer * has become TRUSTED, or after it has sent us an acknowledgment */ protected void makeProgress(Identifier idx) { // logger.log("makeProgress("+idx+")"); PeerInfo<Handle> info = peer.get(idx); if (info == null || (info.xmitQueue.isEmpty() && info.recvQueue.isEmpty())) { return; } /* Get the public key. If we don't have it (yet), ask the peer to send it */ if (!transport.hasCertificate(idx)) { peerreview.requestCertificate(info.handle, idx); return; } /* Transmit queue: If the peer is suspected, challenge it; otherwise, send the next message or retransmit the one currently in flight */ if (!info.xmitQueue.isEmpty()) { int status = infoStore.getStatus(idx); switch (status) { case STATUS_EXPOSED: /* Node is already exposed; no point in sending it any further messages */ if (logger.level <= Logger.WARNING) logger.log("Releasing messages sent to exposed node "+idx); info.clearXmitQueue(); return; case STATUS_SUSPECTED: /* Node is suspected; send the first unanswered challenge */ if (info.lastChallenge < (peerreview.getTime() - info.<API key>)) { if (logger.level <= Logger.WARNING) logger.log( "Pending message for SUSPECTED node "+info.getHandle()+"; challenging node (interval="+info.<API key>+")"); info.lastChallenge = peerreview.getTime(); info.<API key> *= 2; peerreview.<API key>(info.handle); } return; case STATUS_TRUSTED: /* Node is trusted; continue below */ info.lastChallenge = -1; info.<API key> = PeerInfo.<API key>; break; } /* If there are no unacknowledged packets to that node, transmit the next packet */ if (info.<API key> == 0) { info.<API key>++; info.lastTransmit = peerreview.getTime(); info.currentTimeout = <API key>; info.retransmitsSoFar = 0; <API key><Handle> oudm = info.xmitQueue.getFirst(); // try { peerreview.transmit(info.getHandle(), oudm, null, oudm.getOptions()); // } catch (IOException ioe) { // info.xmitQueue.removeFirst(); // oudm.sendFailed(ioe); // return; } else if (peerreview.getTime() > (info.lastTransmit + info.currentTimeout)) { /* Otherwise, retransmit the current packet a few times, up to the specified limit */ if (info.retransmitsSoFar < MAX_RETRANSMISSIONS) { if (logger.level <= Logger.WARNING) logger.log( "Retransmitting a "+info.xmitQueue.getFirst().getPayload().remaining()+"-byte message to "+info.getHandle()+ " (lastxmit="+info.lastTransmit+", timeout="+info.currentTimeout+", type="+ info.xmitQueue.getFirst().getType()+")"); info.retransmitsSoFar++; info.currentTimeout = <API key>; info.lastTransmit = peerreview.getTime(); <API key><Handle> oudm = info.xmitQueue.getFirst(); // try { peerreview.transmit(info.handle, oudm, null, oudm.getOptions()); // } catch (IOException ioe) { // info.xmitQueue.removeFirst(); // oudm.sendFailed(ioe); // return; } else { /* If the peer still won't acknowledge the message, file a SEND challenge with its witnesses */ if (logger.level <= Logger.WARNING) logger.log(info.handle+ " has not acknowledged our message after "+info.retransmitsSoFar+ " retransmissions; filing as evidence"); <API key><Handle> challenge = info.xmitQueue.removeFirst(); challenge.sendFailed(new IOException("Peer Review Giving Up sending message to "+idx)); long evidenceSeq = peerreview.getEvidenceSeq(); try { infoStore.addEvidence(peerreview.getLocalId(), peerreview.<API key>().extractIdentifier(info.handle), evidenceSeq, challenge, null); } catch (IOException ioe) { throw new RuntimeException(ioe); } peerreview.<API key>(peerreview.<API key>().extractIdentifier(info.handle), evidenceSeq, challenge); info.<API key> } } } /* Receive queue */ if (!info.recvQueue.isEmpty() && !info.isReceiving) { info.isReceiving = true; /* Dequeue the packet. After this point, we must either deliver it or discard it */ Tuple<UserDataMessage<Handle>, Map<String, Object>> t = info.recvQueue.removeFirst(); UserDataMessage<Handle> udm = t.a(); /* Extract the authenticator */ Authenticator authenticator; byte[] innerHash = udm.getInnerHash(peerreview.getLocalId(), transport); authenticator = peerreview.<API key>( peerreview.<API key>().extractIdentifier(udm.getSenderHandle()), udm.getTopSeq(), EVT_SEND, innerHash, udm.getHTopMinusOne(), udm.getSignature()); // logger.log("received message, extract auth from "+udm.getSenderHandle()+" seq:"+udm.getTopSeq()+" "+ // MathUtils.toBase64(innerHash)+" htop-1:"+MathUtils.toBase64(udm.getHTopMinusOne())+" sig:"+MathUtils.toBase64(udm.getSignature())); if (authenticator != null) { /* At this point, we are convinced that: - The remote node is TRUSTED [TODO!!] - The message has an acceptable sequence number - The message is properly signed Now we must check our log for an existing RECV entry: - If we already have such an entry, we generate the ACK from there - If we do not yet have the entry, we log the message and deliver it */ Tuple<AckMessage<Identifier>, Boolean> ret = logMessageIfNew(udm); /* Since the message is not yet in the log, deliver it to the application */ if (!ret.b()) { if (logger.level <= Logger.FINE) logger.log( "Delivering message from "+udm.getSenderHandle()+" via "+info.handle+" ("+ udm.getPayloadLen()+" bytes; "+udm.getRelevantLen()+"/"+udm.getPayloadLen()+" relevant)"); try { peerreview.getApp().messageReceived(udm.getSenderHandle(), udm.getPayload(), t.b()); } catch (IOException ioe) { logger.logException("Error handling "+udm, ioe); } } else { if (logger.level <= Logger.FINE) logger.log( "Message from "+udm.getSenderHandle()+" via "+info.getHandle()+" was previously logged; not delivered"); } /* Send the ACK */ if (logger.level <= Logger.FINE) logger.log("Returning ACK to"+info.getHandle()); // try { peerreview.transmit(info.handle, ret.a(), null, t.b()); // } catch (IOException ioe) { // throw new RuntimeException("Major problem, ack couldn't be serialized." +ret.a(),ioe); } else { if (logger.level <= Logger.WARNING) logger.log("Cannot verify signature on message "+udm.getTopSeq()+" from "+info.getHandle()+"; discarding"); } /* Release the message */ info.isReceiving = false; makeProgress(idx); } } protected long findRecvEntry(Identifier id, long seq) { ReceiveInfo<Identifier> ret = receiveCache.get(new Tuple<Identifier, Long>(id,seq)); if (ret == null) return -1; return ret.indexInLocalHistory; } protected long findAckEntry(Identifier id, long seq) { return -1; } /** * Handle an incoming USERDATA message */ @Override public void <API key>(Handle source, UserDataMessage<Handle> msg, Map<String, Object> options) throws IOException { // char buf1[256]; /* Check whether the timestamp (in the sequence number) is close enough to our local time. If not, the node may be trying to roll forward its clock, so we discard the message. */ long txmit = (msg.getTopSeq() / MAX_ENTRIES_PER_MS); if ((txmit < (peerreview.getTime()-timeToleranceMillis)) || (txmit > (peerreview.getTime()+timeToleranceMillis))) { if (logger.level <= Logger.WARNING) logger.log("Invalid sequence no #"+msg.getTopSeq()+" on incoming message (dt="+(txmit-peerreview.getTime())+"); discarding"); return; } /** * Append a copy of the message to our receive queue. If the node is * trusted, the message is going to be delivered directly by makeProgress(); * otherwise a challenge is sent. */ lookupPeer(source).recvQueue.addLast(new Tuple<UserDataMessage<Handle>, Map<String,Object>>(msg,options)); makeProgress(peerreview.<API key>().extractIdentifier(source)); } @Override public <API key><Handle, ByteBuffer> <API key>( final Handle target, final ByteBuffer message, MessageCallback<Handle, ByteBuffer> deliverAckToMe, final Map<String, Object> options) { int relevantlen = message.remaining(); if (options != null && options.containsKey(PeerReview.RELEVANT_LENGTH)) { Number n = (Number)options.get(PeerReview.RELEVANT_LENGTH); relevantlen = n.intValue(); } assert(relevantlen >= 0); /* Append a SEND entry to our local log */ byte[] hTopMinusOne, hTop, hToSign; // long topSeq; hTopMinusOne = history.getTopLevelEntry().getHash(); EvtSend<Identifier> evtSend; if (relevantlen < message.remaining()) { evtSend = new EvtSend<Identifier>(peerreview.<API key>().extractIdentifier(target),message,relevantlen,transport); } else { evtSend = new EvtSend<Identifier>(peerreview.<API key>().extractIdentifier(target),message); } try { // logger.log("XXXa "+Arrays.toString(evtSend.serialize().array())); history.appendEntry(evtSend.getType(), true, evtSend.serialize()); } catch (IOException ioe) { <API key><Handle, ByteBuffer> ret = new <API key><Handle, ByteBuffer>(target,message,options); if (deliverAckToMe != null) deliverAckToMe.sendFailed(ret, ioe); return ret; } // hTop, &topSeq HashSeq top = history.getTopLevelEntry(); /* Sign the authenticator */ // logger.log("about to sign: "+top.getSeq()+" "+MathUtils.toBase64(top.getHash())); hToSign = transport.hash(ByteBuffer.wrap(MathUtils.longToByteArray(top.getSeq())), ByteBuffer.wrap(top.getHash())); byte[] signature = transport.sign(hToSign); /* Append a SENDSIGN entry */ ByteBuffer relevantMsg = message; if (relevantlen < message.remaining()) { relevantMsg = ByteBuffer.wrap(message.array(), message.position(), relevantlen); } else { relevantMsg = ByteBuffer.wrap(message.array(), message.position(), message.remaining()); } try { history.appendEntry(EVT_SENDSIGN, true, relevantMsg, ByteBuffer.wrap(signature)); } catch (IOException ioe) { <API key><Handle, ByteBuffer> ret = new <API key><Handle, ByteBuffer>(target,message,options); if (deliverAckToMe != null) deliverAckToMe.sendFailed(ret, ioe); return ret; } /* Construct a USERDATA message... */ assert((relevantlen == message.remaining()) || (relevantlen < 255)); PeerInfo<Handle> pi = lookupPeer(target); <API key><Handle> udm = new <API key><Handle>(top.getSeq(), peerreview.getLocalHandle(), hTopMinusOne, signature, message, relevantlen, options, pi, deliverAckToMe); /* ... and put it into the send queue. If the node is trusted and does not have any unacknowledged messages, makeProgress() will simply send it out. */ pi.xmitQueue.addLast(udm); makeProgress(peerreview.<API key>().extractIdentifier(target)); return udm; } /* This is called if we receive an acknowledgment from another node */ @Override public void handleIncomingAck(Handle source, AckMessage<Identifier> ackMessage, Map<String, Object> options) throws IOException { // AckMessage<Identifier> ackMessage = AckMessage.build(sib, peerreview.getIdSerializer(), hasher.getHashSizeBytes(), transport.<API key>()); /* Acknowledgment: Log it (if we don't have it already) and send the next message, if any */ if (logger.level <= Logger.FINE) logger.log("Received an ACK from "+source); // TODO: check that ackMessage came from the source if (transport.hasCertificate(ackMessage.getNodeId())) { PeerInfo<Handle> p = lookupPeer(source); boolean checkAck = true; <API key><Handle> udm = null; if (p.xmitQueue.isEmpty()) { checkAck = false; // don't know why this happens, but maybe the ACK gets duplicated somehow } else { udm = p.xmitQueue.getFirst(); } /* The ACK must acknowledge the sequence number of the packet that is currently at the head of the send queue */ if (checkAck && ackMessage.getSendEntrySeq() == udm.getTopSeq()) { /* Now we're ready to check the signature */ /* The peer will have logged a RECV entry, and the signature is calculated over that entry. To verify the signature, we must reconstruct that RECV entry locally */ byte[] innerHash = udm.getInnerHash(transport); Authenticator authenticator = peerreview.<API key>( ackMessage.getNodeId(), ackMessage.getRecvEntrySeq(), EVT_RECV, innerHash, ackMessage.getHashTopMinusOne(), ackMessage.getSignature()); if (authenticator != null) { /* Signature is okay... append an ACK entry to the log */ if (logger.level <= Logger.FINE) logger.log("ACK is okay; logging "+ackMessage); EvtAck<Identifier> evtAck = new EvtAck<Identifier>(ackMessage.getNodeId(), ackMessage.getSendEntrySeq(), ackMessage.getRecvEntrySeq(), ackMessage.getHashTopMinusOne(), ackMessage.getSignature()); history.appendEntry(EVT_ACK, true, evtAck.serialize()); udm.sendComplete(); //ackMessage.getSendEntrySeq()); /* Remove the message from the xmit queue */ p.xmitQueue.removeFirst(); p.<API key> /* Make progress (e.g. by sending the next message) */ makeProgress(peerreview.<API key>().extractIdentifier(p.getHandle())); } else { if (logger.level <= Logger.WARNING) logger.log("Invalid ACK from <"+ackMessage.getNodeId()+">; discarding"); } } else { if (findAckEntry(ackMessage.getNodeId(), ackMessage.getSendEntrySeq()) < 0) { if (logger.level <= Logger.WARNING) logger.log("<"+ackMessage.getNodeId()+"> has ACKed something we haven't sent ("+ackMessage.getSendEntrySeq()+"); discarding"); } else { if (logger.level <= Logger.WARNING) logger.log("Duplicate ACK from <"+ackMessage.getNodeId()+">; discarding"); } } } else { if (logger.level <= Logger.WARNING) logger.log("We got an ACK from <"+ackMessage.getNodeId()+">, but we don't have the certificate; discarding"); } } @Override public void <API key>(long timeToleranceMillis) { this.timeToleranceMillis = timeToleranceMillis; } }
if (NABUCCO === undefined || !NABUCCO) { var NABUCCO = {}; } (function() { NABUCCO.component = NABUCCO.component || {}; NABUCCO.component.CMISDocumentList = function(htmlId) { // replace Bubbling.on with NO-OP, so the superclass can't register its event listeners (never-ever) var on = YAHOO.Bubbling.on; YAHOO.Bubbling.on = function() { // NO-OP return; }; try { NABUCCO.component.CMISDocumentList.superclass.constructor.call(this, htmlId); // restore YAHOO.Bubbling.on = on; } catch (e) { // restore YAHOO.Bubbling.on = on; throw e; } this.name = "NABUCCO.component.CMISDocumentList"; Alfresco.util.ComponentManager.reregister(this); this.dataSourceUrl = Alfresco.constants.URL_SERVICECONTEXT + 'nabucco/components/cmis-documentlist/data?'; if (htmlId !== "null") { // we actually want to react to metadataRefresh YAHOO.Bubbling.on("metadataRefresh", this.onDocListRefresh, this); YAHOO.Bubbling.on("filterChanged", this.onFilterChanged, this); YAHOO.Bubbling.on("changeFilter", this.onChangeFilter, this); } this.dragAndDropAllowed = false; this.setOptions( { preferencePrefix : "org.nabucco.<API key>" }); }; YAHOO.extend(NABUCCO.component.CMISDocumentList, Alfresco.DocumentList, { onSortAscending : function() { NABUCCO.component.CMISDocumentList.<API key>.call(this, NABUCCO.component.CMISDocumentList.superclass.onSortAscending, arguments); }, onSortField : function() { NABUCCO.component.CMISDocumentList.<API key>.call(this, NABUCCO.component.CMISDocumentList.superclass.onSortField, arguments); }, onShowFolders : function() { NABUCCO.component.CMISDocumentList.<API key>.call(this, NABUCCO.component.CMISDocumentList.superclass.onShowFolders, arguments); }, <API key> : function() { NABUCCO.component.CMISDocumentList.<API key>.call(this, NABUCCO.component.CMISDocumentList.superclass.<API key>, arguments); }, onSimpleDetailed : function() { NABUCCO.component.CMISDocumentList.<API key>.call(this, NABUCCO.component.CMISDocumentList.superclass.onSimpleDetailed, arguments); }, _buildDocListParams : function(p_obj) { var params = "", obj = { path : this.currentPath }; // Pagination in use? if (this.options.usePagination) { obj.page = this.widgets.paginator.getCurrentPage() || this.currentPage; obj.pageSize = this.widgets.paginator.getRowsPerPage(); } // Passed-in overrides if (typeof p_obj === "object") { obj = YAHOO.lang.merge(obj, p_obj); } params = "path=" + obj.path; // Paging parameters if (this.options.usePagination) { params += "&pageSize=" + obj.pageSize + "&pos=" + obj.page; } // Sort parameters params += "&sortAsc=" + this.options.sortAscending + "&sortField=" + encodeURIComponent(this.options.sortField); // View mode and No-cache params += "&view=" + this.actionsView + "&noCache=" + new Date().getTime(); return params; } }); NABUCCO.component.CMISDocumentList.<API key> = function(callback, args) { var prefSet, result, scope = this; if (YAHOO.lang.isString(this.options.preferencePrefix) && this.options.preferencePrefix !== "org.alfresco.share.documentList") { prefSet = this.services.preferences.set; this.services.preferences.set = function(prefKey, value, responseConfig) { prefKey = prefKey.replace("org.alfresco.share.documentList.", scope.options.preferencePrefix + '.'); return prefSet.call(this, prefKey, value, responseConfig); }; try { result = callback.apply(this, args); this.services.preferences.set = prefSet; } catch (e) { this.services.preferences.set = prefSet; throw e; } return result; } return callback.apply(this, args); }; // necessary to fix default thumbnail icons for non-standard node types, especially non-file-folder types NABUCCO.component.CMISDocumentList.<API key> = function(callback, args) { var getFileIcon = Alfresco.util.getFileIcon, node = args[1].getData().jsNode, result; Alfresco.util.getFileIcon = function(p_fileName, p_fileType, p_iconSize, p_fileParentType) { if (p_fileType === undefined) { if (node.isLink && YAHOO.lang.isObject(node.linkedNode) && YAHOO.lang.isString(node.linkedNode.type)) { p_fileType = node.linkedNode.type; } else { p_fileType = node.type; } } return getFileIcon.call(Alfresco.util, p_fileName, p_fileType, p_iconSize, p_fileParentType); }; Alfresco.util.getFileIcon.types = getFileIcon.types; try { result = callback.apply(this, args); Alfresco.util.getFileIcon = getFileIcon; } catch (e) { Alfresco.util.getFileIcon = getFileIcon; throw e; } return result; }; // necessary to fix thumbnail URL generation to avoid HTTP 400 responses for attempts on items without content NABUCCO.component.CMISDocumentList.<API key> = function(callback, args) { var <API key> = Alfresco.DocumentList.<API key>, result; Alfresco.DocumentList.<API key> = function(record) { var node = record.jsNode; if ((node.isContent || (node.isLink && node.linkedNode.isContent)) && (YAHOO.lang.isString(node.contentURL) || (node.isLink && YAHOO.lang.isString(node.linkedNode.contentURL)))) { return <API key>(record); } return Alfresco.constants.URL_RESCONTEXT + 'components/images/filetypes/' + Alfresco.util.getFileIcon(record.displayName); }; try { result = callback.apply(this, args); Alfresco.DocumentList.<API key> = <API key>; } catch (e) { Alfresco.DocumentList.<API key> = <API key>; throw e; } return result; }; // adapt the document list <API key> to remove preview when no preview can be generated (node without content) and use // information available for file icon determination Alfresco.DocumentList.prototype.<API key> = Alfresco.DocumentList.prototype.<API key>; Alfresco.DocumentList.prototype.<API key> = function(renderChain) { var scope = this, realRenderer = this.<API key>(), renderCallback = renderChain; return function(elCell, oRecord, oColumn, oData) { var id, node = oRecord.getData().jsNode; NABUCCO.component.CMISDocumentList.<API key>.call(this, function() { NABUCCO.component.CMISDocumentList.<API key>.call(this, function() { if (YAHOO.lang.isFunction(renderCallback)) { renderCallback.call(this, realRenderer, arguments); } else { realRenderer.apply(this, arguments); } }, arguments); }, [ elCell, oRecord, oColumn, oData ]); // OOTB view renderer always prepare preview even if node has no content if (!(node.isContainer || (node.isLink && node.linkedNode.isContainer)) && !(YAHOO.lang.isString(node.contentURL) || (node.isLink && YAHOO.lang.isString(node.linkedNode.contentURL)))) { // check for any thumbnails that are not supported due to node without content id = scope.id + '-preview-' + oRecord.getId(); if (Alfresco.util.arrayContains(scope.previewTooltips, id)) { scope.previewTooltips = Alfresco.util.arrayRemove(scope.previewTooltips, id); } } }; }; // adapt size renderer for items without content as well as links Alfresco.DocumentList.prototype.<API key> = Alfresco.DocumentList.prototype.<API key>; Alfresco.DocumentList.prototype.<API key> = function() { this.<API key>(); /** * File size */ this.registerRenderer("size", function(record, label) { var jsNode = record.jsNode, html = ""; if ((YAHOO.lang.isString(jsNode.contentURL) || YAHOO.lang.isNumber(jsNode.size)) || (jsNode.isLink && (YAHOO.lang.isString(jsNode.linkedNode.contentURL) || YAHOO.lang.isNumber(jsNode.linkedNode.size)))) { html += '<span class="item">' + label + Alfresco.util.formatFileSize(YAHOO.lang.isString(jsNode.contentURL) || YAHOO.lang.isNumber(jsNode.size) ? jsNode.size : jsNode.linkedNode.size) + '</span>'; } return html; }); }; (function() { // additional properties for jsNode var <API key> = [ "isContent" ]; // adapt Node to support our additional properties Alfresco.util._nbc_Node = Alfresco.util.Node; Alfresco.util.Node = function(p_node) { var jsNode = Alfresco.util._nbc_Node(p_node), idx, propName; if (YAHOO.lang.isObject(jsNode)) { for (idx = 0; idx < <API key>.length; idx++) { propName = <API key>[idx]; // override only if no such property has been defined yet if (p_node.hasOwnProperty(propName) && !jsNode.hasOwnProperty(propName)) { if (propName.indexOf("Node") !== -1 && propName.substr(propName.indexOf("Node")) === "Node" && YAHOO.lang.isString(p_node[propName])) { jsNode[propName] = new Alfresco.util.NodeRef(p_node[propName]); } else { jsNode[propName] = p_node[propName]; } } } } return jsNode; }; }()); Alfresco.util.getFileIcon.types["D:cmiscustom:document"] = "file"; Alfresco.util.getFileIcon.types["cmis:document"] = "file"; Alfresco.util.getFileIcon.types["cmis:folder"] = "folder"; }());
package org.eclipse.xtext.formatting2.regionaccess.internal; import static org.eclipse.xtext.formatting2.regionaccess.<API key>.*; import java.util.Collections; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.formatting2.debug.<API key>; import org.eclipse.xtext.formatting2.regionaccess.IEObjectRegion; import org.eclipse.xtext.formatting2.regionaccess.IHiddenRegion; import org.eclipse.xtext.formatting2.regionaccess.ISemanticRegion; import org.eclipse.xtext.formatting2.regionaccess.ITextRegionAccess; import org.eclipse.xtext.formatting2.regionaccess.<API key>; import org.eclipse.xtext.formatting2.regionaccess.ITextSegment; import org.eclipse.xtext.serializer.<API key>; import org.eclipse.xtext.serializer.acceptor.ISequenceAcceptor; import org.eclipse.xtext.util.ITextRegion; import com.google.common.base.Preconditions; import com.google.common.base.Throwables; import com.google.common.collect.Lists; import com.google.common.collect.Maps; /** * @author Moritz Eysholdt - Initial contribution and API */ public class <API key> implements <API key> { private final static Logger LOG = Logger.getLogger(<API key>.class); protected interface Insert { public IHiddenRegion getInsertFirst(); public IHiddenRegion getInsertLast(); } protected static class MoveSource extends Rewrite { private MoveTarget target = null; public MoveSource(IHiddenRegion first, IHiddenRegion last) { super(first, last); } public MoveTarget getTarget() { return target; } } protected static class MoveTarget extends Rewrite implements Insert { private final MoveSource source; public MoveTarget(IHiddenRegion insertAt, MoveSource source) { super(insertAt, insertAt); this.source = source; this.source.target = this; } @Override public IHiddenRegion getInsertFirst() { return this.source.originalFirst; } @Override public IHiddenRegion getInsertLast() { return this.source.originalLast; } } protected static class Remove extends Rewrite { public Remove(IHiddenRegion originalFirst, IHiddenRegion originalLast) { super(originalFirst, originalLast); } } protected static class Replace1 extends Rewrite implements Insert { private final IHiddenRegion modifiedFirst; private final IHiddenRegion modifiedLast; public Replace1(IHiddenRegion originalFirst, IHiddenRegion originalLast, IHiddenRegion modifiedFirst, IHiddenRegion modifiedLast) { super(originalFirst, originalLast); this.modifiedFirst = modifiedFirst; this.modifiedLast = modifiedLast; } @Override public IHiddenRegion getInsertFirst() { return this.modifiedFirst; } @Override public IHiddenRegion getInsertLast() { return this.modifiedLast; } } protected static class Preserve extends Rewrite implements Insert { public Preserve(IHiddenRegion first, IHiddenRegion last) { super(first, last); } @Override public IHiddenRegion getInsertFirst() { return this.originalFirst; } @Override public IHiddenRegion getInsertLast() { return this.originalLast; } @Override public boolean isDiff() { return false; } } public abstract static class Rewrite implements Comparable<Rewrite> { protected IHiddenRegion originalFirst; protected IHiddenRegion originalLast; public Rewrite(IHiddenRegion originalFirst, IHiddenRegion originalLast) { super(); this.originalFirst = originalFirst; this.originalLast = originalLast; } public boolean isDiff() { return true; } @Override public int compareTo(Rewrite o) { return Integer.compare(originalFirst.getOffset(), o.originalFirst.getOffset()); } } protected static class Replace2 extends Rewrite implements Insert { private final <API key> sequencer; public Replace2(IHiddenRegion originalFirst, IHiddenRegion originalLast, <API key> sequencer) { super(originalFirst, originalLast); this.sequencer = sequencer; } @Override public IHiddenRegion getInsertFirst() { return sequencer.getRegionAccess().<API key>().<API key>(); } @Override public IHiddenRegion getInsertLast() { return sequencer.getRegionAccess().<API key>().getNextHiddenRegion(); } } private final ITextRegionAccess original; private List<Rewrite> rewrites = Lists.newArrayList(); private Map<ITextSegment, String> changes = Maps.newHashMap(); public <API key>(ITextRegionAccess base) { super(); this.original = base; } protected void checkOriginal(ITextSegment segment) { Preconditions.checkNotNull(segment); Preconditions.checkArgument(original == segment.getTextRegionAccess()); } protected List<Rewrite> createList() { List<Rewrite> sorted = Lists.newArrayList(rewrites); Collections.sort(sorted); List<Rewrite> result = Lists.<API key>(sorted.size() * 2); IHiddenRegion last = original.<API key>().<API key>(); for (Rewrite rw : sorted) { int lastOffset = last.getOffset(); int rwOffset = rw.originalFirst.getOffset(); if (rwOffset == lastOffset) { result.add(rw); last = rw.originalLast; } else if (rwOffset > lastOffset) { result.add(new Preserve(last, rw.originalFirst)); result.add(rw); last = rw.originalLast; } else { LOG.error("Error, conflicting document modifications."); } } IHiddenRegion end = original.<API key>().getNextHiddenRegion(); if (last.getOffset() < end.getOffset()) { result.add(new Preserve(last, end)); } return result; } @Override public <API key> create() { <API key> appender = createAppender(); IEObjectRegion root = original.<API key>(); appender.copyAndAppend(root.<API key>(), PREVIOUS); appender.copyAndAppend(root.<API key>(), CONTAINER); List<Rewrite> rws = createList(); IHiddenRegion last = null; for (Rewrite rw : rws) { boolean diff = rw.isDiff(); if (diff) { appender.beginDiff(); } if (rw instanceof Insert) { Insert ins = (Insert) rw; IHiddenRegion f = ins.getInsertFirst(); IHiddenRegion l = ins.getInsertLast(); appender.copyAndAppend(f, NEXT); if (f != l) { appender.copyAndAppend(f.<API key>(), l.<API key>()); } appender.copyAndAppend(l, PREVIOUS); } if (diff) { appender.endDiff(); } if (rw.originalLast != last) { appender.copyAndAppend(rw.originalLast, CONTAINER); } last = rw.originalLast; } appender.copyAndAppend(root.getNextHiddenRegion(), NEXT); <API key> result = appender.finish(); <API key> newRoot = result.regionForEObject(root.getSemanticElement()); result.setRootEObject(newRoot); return result; } protected <API key> createAppender() { return new <API key>(original, changes); } @Override public ITextRegionAccess <API key>() { return original; } @Override public boolean isModified(ITextRegion region) { int offset = region.getOffset(); int endOffset = offset + region.getLength(); for (Rewrite action : rewrites) { int rwOffset = action.originalFirst.getOffset(); int rwEndOffset = action.originalLast.getEndOffset(); if (rwOffset <= offset && offset < rwEndOffset) { return true; } if (rwOffset < endOffset && endOffset <= rwEndOffset) { return true; } } return false; } @Override public void move(IHiddenRegion insertAt, IHiddenRegion substituteFirst, IHiddenRegion substituteLast) { checkOriginal(insertAt); checkOriginal(substituteFirst); checkOriginal(substituteLast); MoveSource source = new MoveSource(substituteFirst, substituteLast); MoveTarget target = new MoveTarget(insertAt, source); rewrites.add(source); rewrites.add(target); } @Override public void remove(IHiddenRegion first, IHiddenRegion last) { checkOriginal(first); checkOriginal(last); rewrites.add(new Remove(first, last)); } @Override public void remove(ISemanticRegion region) { remove(region.<API key>(), region.getNextHiddenRegion()); } @Override public void replace(IHiddenRegion originalFirst, IHiddenRegion originalLast, IHiddenRegion modifiedFirst, IHiddenRegion modifiedLast) { checkOriginal(originalFirst); checkOriginal(originalLast); rewrites.add(new Replace1(originalFirst, originalLast, modifiedFirst, modifiedLast)); } @Override public void replace(IHiddenRegion originalFirst, IHiddenRegion originalLast, ITextRegionAccess acc) { checkOriginal(originalFirst); checkOriginal(originalLast); IEObjectRegion substituteRoot = acc.<API key>(); IHiddenRegion substituteFirst = substituteRoot.<API key>(); IHiddenRegion substituteLast = substituteRoot.getNextHiddenRegion(); replace(originalFirst, originalLast, substituteFirst, substituteLast); } @Override public void replace(ISemanticRegion region, String newText) { Preconditions.checkNotNull(newText); checkOriginal(region); changes.put(region, newText); } @Override public ISequenceAcceptor replaceSequence(IHiddenRegion originalFirst, IHiddenRegion originalLast, <API key> ctx, EObject root) { checkOriginal(originalFirst); checkOriginal(originalLast); <API key> sequenceAcceptor = new <API key>(); rewrites.add(new Replace2(originalFirst, originalLast, sequenceAcceptor)); return sequenceAcceptor.withRoot(ctx, root); } @Override public String toString() { try { <API key> regions = create(); return new <API key>().withRegionAccess(regions).toString(); } catch (Throwable t) { return t.getMessage() + "\n" + Throwables.<API key>(t); } } }
<!DOCTYPE HTML PUBLIC "- <!--NewPage <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_21) on Wed Nov 12 14:55:37 EST 2014 --> <TITLE> org.eclipse.mylyn.wikitext.markdown.core </TITLE> <META NAME="date" CONTENT="2014-11-12"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style"> </HEAD> <BODY BGCOLOR="white"> <FONT size="+1" CLASS="FrameTitleFont"> <A HREF="../../../../../../org/eclipse/mylyn/wikitext/markdown/core/package-summary.html" target="classFrame">org.eclipse.mylyn.wikitext.markdown.core</A></FONT> <TABLE BORDER="0" WIDTH="100%" SUMMARY=""> <TR> <TD NOWRAP><FONT size="+1" CLASS="FrameHeadingFont"> Classes</FONT>&nbsp; <FONT CLASS="FrameItemFont"> <BR> <A HREF="MarkdownLanguage.html" title="class in org.eclipse.mylyn.wikitext.markdown.core" target="classFrame">MarkdownLanguage</A></FONT></TD> </TR> </TABLE> </BODY> </HTML>
package org.eclipse.papyrus.RobotML.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.eclipse.papyrus.RobotML.RobotMLPackage; import org.eclipse.papyrus.RobotML.RoboticMiddleware; import org.eclipse.papyrus.RobotML.<API key>; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Robotic Middleware</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.eclipse.papyrus.RobotML.impl.<API key>#getKind <em>Kind</em>}</li> * </ul> * </p> * * @generated */ public class <API key> extends PlatformImpl implements RoboticMiddleware { /** * The default value of the '{@link #getKind() <em>Kind</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getKind() * @generated * @ordered */ protected static final <API key> KIND_EDEFAULT = <API key>.RT_MAPS; /** * The cached value of the '{@link #getKind() <em>Kind</em>}' attribute. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getKind() * @generated * @ordered */ protected <API key> kind = KIND_EDEFAULT; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected <API key>() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return RobotMLPackage.Literals.ROBOTIC_MIDDLEWARE; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public <API key> getKind() { return kind; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setKind(<API key> newKind) { <API key> oldKind = kind; kind = newKind == null ? KIND_EDEFAULT : newKind; if (<API key>()) eNotify(new ENotificationImpl(this, Notification.SET, RobotMLPackage.<API key>, oldKind, kind)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case RobotMLPackage.<API key>: return getKind(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case RobotMLPackage.<API key>: setKind((<API key>)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case RobotMLPackage.<API key>: setKind(KIND_EDEFAULT); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case RobotMLPackage.<API key>: return kind != KIND_EDEFAULT; } return super.eIsSet(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public String toString() { if (eIsProxy()) return super.toString(); StringBuffer result = new StringBuffer(super.toString()); result.append(" (kind: "); result.append(kind); result.append(')'); return result.toString(); } } //<API key>
package org.eclipse.jdt.ls.core.internal.contentassist; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.IMethod; import org.eclipse.jdt.core.ISourceRange; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.manipulation.CodeGeneration; import org.eclipse.jdt.internal.core.manipulation.StubUtility; import org.eclipse.jdt.internal.corext.util.<API key>; import org.eclipse.jdt.internal.corext.util.<API key>; import org.eclipse.jdt.ls.core.internal.JDTUtils; import org.eclipse.jdt.ls.core.internal.<API key>; import org.eclipse.jdt.ls.core.internal.handlers.<API key>; import org.eclipse.jdt.ls.core.internal.handlers.JsonRpcHelpers; import org.eclipse.jface.text.<API key>; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.Region; import org.eclipse.jface.text.TextUtilities; import org.eclipse.lsp4j.CompletionItem; import org.eclipse.lsp4j.CompletionItemKind; import org.eclipse.lsp4j.InsertTextFormat; import org.eclipse.lsp4j.Range; import org.eclipse.lsp4j.TextEdit; public class <API key> { private static final String ASTERISK = "*"; private static final String WHITESPACES = " \t"; public static final String JAVA_DOC_COMMENT = "Javadoc comment"; public List<CompletionItem> getProposals(ICompilationUnit cu, int offset, <API key> collector, IProgressMonitor monitor) throws JavaModelException { if (cu == null) { throw new <API key>("Compilation unit must not be null"); //$NON-NLS-1$ } List<CompletionItem> result = new ArrayList<>(); IDocument d = JsonRpcHelpers.toDocument(cu.getBuffer()); if (offset < 0 || d.getLength() == 0) { return result; } try { int p = (offset == d.getLength() ? offset - 1 : offset); IRegion line = d.<API key>(p); String lineStr = d.get(line.getOffset(), line.getLength()).trim(); return true; } return false; } private String createJavaDocTags(IDocument document, int offset, String indentation, String lineDelimiter, ICompilationUnit unit) throws CoreException, <API key> { IJavaElement element = unit.getElementAt(offset); if (element == null) { return null; } switch (element.getElementType()) { case IJavaElement.TYPE: return createTypeTags(document, offset, indentation, lineDelimiter, (IType) element); case IJavaElement.METHOD: return createMethodTags(document, offset, indentation, lineDelimiter, (IMethod) element); default: return null; } } private String createTypeTags(IDocument document, int offset, String indentation, String lineDelimiter, IType type) throws CoreException, <API key> { if (!accept(offset, type)) { return null; } String[] typeParamNames = StubUtility.<API key>(type.getTypeParameters()); String comment = CodeGeneration.getTypeComment(type.getCompilationUnit(), type.<API key>('.'), typeParamNames, lineDelimiter); if (comment != null) { return <API key>(comment.trim(), indentation, type.getJavaProject(), lineDelimiter); } return null; } private boolean accept(int offset, IMember member) throws JavaModelException { ISourceRange nameRange = member.getNameRange(); if (nameRange == null) { return false; } int srcOffset = nameRange.getOffset(); return srcOffset > offset; } private String createMethodTags(IDocument document, int offset, String indentation, String lineDelimiter, IMethod method) throws CoreException, <API key> { if (!accept(offset, method)) { return null; } IMethod inheritedMethod = getInheritedMethod(method); String comment = CodeGeneration.getMethodComment(method, inheritedMethod, lineDelimiter); if (comment != null) { comment = comment.trim(); boolean javadocComment = comment.startsWith("/**"); //$NON-NLS-1$ if (javadocComment) { return <API key>(comment, indentation, method.getJavaProject(), lineDelimiter); } } return null; } private String <API key>(String comment, String indentation, IJavaProject project, String lineDelimiter) { // trim comment start and end if any if (comment.endsWith("*/")) { comment = comment.substring(0, comment.length() - 2); } comment = comment.trim();
package mx.com.cinepolis.digital.booking.commons.exception; public enum <API key> { /** Error desconocido */ <API key>(0), /*** * CATALOG NULO */ CATALOG_ISNULL(1), /** * Paging Request Nulo */ <API key>(2), /** * Errores de persistencia */ <API key>(3), <API key>(4), <API key>(5), <API key>(6), <API key>(7), <API key>(8), <API key>(9), <API key>(10), INEXISTENT_REGION(11), INVALID_TERRITORY(12), THEATER_IS_NULL(13), <API key>(14), <API key>(15), INEXISTENT_THEATER(16), <API key>(17), <API key>(18), INVALID_SCREEN(19), <API key>(20), <API key>(21), FILE_NULL(22), EVENT_MOVIE_NULL(23), <API key>(24), <API key>(25), <API key>(26), <API key>(27), <API key>(28), <API key>(29), <API key>(30), <API key>(31), <API key>(39), <API key>(32), MOVIE_NAME_BLANK(33), <API key>(35), <API key>(36), MOVIE_DETAIL_EMPTY(37), MOVIE_IMAGE_NULL(38), /** * Booking errors */ <API key>(40), <API key>(41), <API key>(42), <API key>(43), <API key>(44), <API key>(45), <API key>(46), <API key>(221), /** * Week errors */ <API key>(50), /** * Observation errors */ <API key>(51), <API key>(52), <API key>(53), <API key>(103), /** * Email Errors */ <API key>(54), EMAIL_IS_REPEATED(55), /** * Configuration Errors */ <API key>(60), <API key>(61), <API key>(62), /** * Email Errors */ <API key>(70), <API key>(71), <API key>(72), <API key>(73), /** * Booking errors */ BOOKING_IS_NULL(74), <API key>(75), BOOKING_WEEK_NULL(76), BOOKING_EVENT_NULL(77), <API key>(78), <API key>(79), <API key>(80), <API key>(81), <API key>(82), <API key>(83), <API key>(84), <API key>(85), <API key>(86), <API key>(87), <API key>(88), <API key>(89), <API key>(90), BOOKING_IS_WEEK_ONE(91), <API key>(92), <API key>(93), <API key>(94), <API key>(194), <API key>(196), <API key>(195), <API key>(95), <API key>(96), <API key>(97), <API key>(98), <API key>(99), /** * Report errors */ CREATE_XLSX_ERROR(100), <API key>(101), <API key>(102), /** * Security errors */ <API key>(200), <API key>(201), <API key>(202), MENU_EXCEPTION(203), /** * UserErrors */ USER_IS_NULL(204), <API key>(205), USER_NAME_IS_BLANK(206), <API key>(207), USER_ROLE_IS_NULL(208), USER_EMAIL_IS_NULL(209), <API key>(210), <API key>(211), /** * Week errors */ WEEK_IS_NULL(212), WEEK_INVALID_NUMBER(213), WEEK_INVALID_YEAR(214), <API key>(215), /** * EventMovie errors */ EVENT_CODE_DBS_NULL(216), <API key>(217), <API key>(218), CANNOT_DELETE_WEEK(219), <API key>(220), /** * Income errors */ <API key>(300), <API key>(301), <API key>(302), /** * SynchronizeErrors */ <API key>(500), /** * Transaction timeout */ TRANSACTION_TIMEOUT(501), /** * INVALID PARAMETERS FOR BOOKING PRE RELEASE */ <API key>(600), <API key>(601), <API key>(602), <API key>(603), <API key>(604), <API key>(605), /** * VALIDATIONS FOR PRESALE IN BOOKING MOVIE */ <API key>(606), <API key>(607), <API key>(608), /** * INVALID SELECTION OF PARAMETERS * TO APPLY IN SPECIAL EVENT */ <API key>(617), INVALID_FINAL_DATES(618), <API key>(619), <API key>(620), <API key>(621), <API key>(622), <API key>(623), <API key>(624), /** * Invalid datetime range for system log. */ <API key>(625), <API key>(626), <API key>(627), /** * Invavlid cityTO */ CITY_IS_NULL(628), CITY_HAS_NO_NAME(629), CITY_HAS_NO_COUNTRY(630), <API key>(631), <API key>(632) ; /** * Constructor interno * * @param id */ private <API key>( int id ) { this.id = id; } private int id; /** * @return the id */ public int getId() { return id; } }
package com.temenos.soa.plugin.uml2dsconverter.utils; // General String utilities public class StringUtils { /** * Turns the first character of a string in to an uppercase character * @param source The source string * @return String Resultant string */ public static String <API key>(String source) { final StringBuilder result = new StringBuilder(source.length()); result.append(Character.toUpperCase(source.charAt(0))).append(source.substring(1)); return result.toString(); } /** * Turns the first character of a string in to a lowercase character * @param source The source string * @return String Resultant string */ public static String <API key>(String source) { final StringBuilder result = new StringBuilder(source.length()); result.append(Character.toLowerCase(source.charAt(0))).append(source.substring(1)); return result.toString(); } }
package org.eclipse.titan.designer.AST.TTCN3.values.expressions; import java.util.List; import org.eclipse.titan.designer.AST.ASTVisitor; import org.eclipse.titan.designer.AST.INamedNode; import org.eclipse.titan.designer.AST.IReferenceChain; import org.eclipse.titan.designer.AST.IValue; import org.eclipse.titan.designer.AST.ReferenceFinder; import org.eclipse.titan.designer.AST.Scope; import org.eclipse.titan.designer.AST.Value; import org.eclipse.titan.designer.AST.IType.Type_type; import org.eclipse.titan.designer.AST.ReferenceFinder.Hit; import org.eclipse.titan.designer.AST.TTCN3.Expected_Value_type; import org.eclipse.titan.designer.AST.TTCN3.values.Expression_Value; import org.eclipse.titan.designer.AST.TTCN3.values.Hexstring_Value; import org.eclipse.titan.designer.AST.TTCN3.values.Octetstring_Value; import org.eclipse.titan.designer.parsers.<API key>; import org.eclipse.titan.designer.parsers.ttcn3parser.ReParseException; import org.eclipse.titan.designer.parsers.ttcn3parser.TTCN3ReparseUpdater; /** * @author Kristof Szabados * */ public final class Hex2OctExpression extends Expression_Value { private static final String OPERANDERROR = "The operand of the `hex2oct' operation should be a hexstring value"; private final Value value; public Hex2OctExpression(final Value value) { this.value = value; if (value != null) { value.setFullNameParent(this); } } @Override public Operation_type getOperationType() { return Operation_type.HEX2OCT_OPERATION; } @Override public String <API key>() { final StringBuilder builder = new StringBuilder(); builder.append("hex2oct(").append(value.<API key>()).append(')'); return builder.toString(); } @Override public void setMyScope(final Scope scope) { super.setMyScope(scope); if (value != null) { value.setMyScope(scope); } } @Override public StringBuilder getFullName(final INamedNode child) { final StringBuilder builder = super.getFullName(child); if (value == child) { return builder.append(OPERAND); } return builder; } @Override public Type_type <API key>(final <API key> timestamp, final Expected_Value_type expectedValue) { return Type_type.TYPE_OCTETSTRING; } @Override public boolean isUnfoldable(final <API key> timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) { if (value == null) { return true; } return value.isUnfoldable(timestamp, expectedValue, referenceChain); } /** * Checks the parameters of the expression and if they are valid in * their position in the expression or not. * * @param timestamp * the timestamp of the actual semantic check cycle. * @param expectedValue * the kind of value expected. * @param referenceChain * a reference chain to detect cyclic references. * */ private void <API key>(final <API key> timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) { if (value == null) { return; } value.<API key>(timestamp); Type_type tempType = value.<API key>(timestamp, expectedValue); switch (tempType) { case TYPE_HEXSTRING: value.getValueRefdLast(timestamp, expectedValue, referenceChain); return; case TYPE_UNDEFINED: setIsErroneous(true); return; default: if (!isErroneous) { location.reportSemanticError(OPERANDERROR); setIsErroneous(true); } return; } } @Override public IValue evaluateValue(final <API key> timestamp, final Expected_Value_type expectedValue, final IReferenceChain referenceChain) { if (lastTimeChecked != null && !lastTimeChecked.isLess(timestamp)) { return lastValue; } isErroneous = false; lastTimeChecked = timestamp; lastValue = this; if (value == null) { return lastValue; } <API key>(timestamp, expectedValue, referenceChain); if (getIsErroneous(timestamp)) { return lastValue; } if (isUnfoldable(timestamp, referenceChain)) { return lastValue; } IValue last = value.getValueRefdLast(timestamp, referenceChain); if (last.getIsErroneous(timestamp)) { setIsErroneous(true); return lastValue; } switch (last.getValuetype()) { case HEXSTRING_VALUE: String temp = ((Hexstring_Value) last).getValue(); lastValue = new Octetstring_Value(hex2oct(temp)); lastValue.<API key>(this); break; default: setIsErroneous(true); break; } return lastValue; } public static String hex2oct(final String hexString) { if (hexString.length() % 2 == 0) { return hexString; } return new StringBuilder(hexString.length() + 1).append('0').append(hexString).toString(); } @Override public void checkRecursions(final <API key> timestamp, final IReferenceChain referenceChain) { if (referenceChain.add(this) && value != null) { referenceChain.markState(); value.checkRecursions(timestamp, referenceChain); referenceChain.previousState(); } } @Override public void updateSyntax(final TTCN3ReparseUpdater reparser, final boolean isDamaged) throws ReParseException { if (isDamaged) { throw new ReParseException(); } if (value != null) { value.updateSyntax(reparser, false); reparser.updateLocation(value.getLocation()); } } @Override public void findReferences(final ReferenceFinder referenceFinder, final List<Hit> foundIdentifiers) { if (value == null) { return; } value.findReferences(referenceFinder, foundIdentifiers); } @Override protected boolean memberAccept(final ASTVisitor v) { if (value != null && !value.accept(v)) { return false; } return true; } }
requirejs(['bmotion.config'], function() { requirejs(['bms.integrated.root'], function() {}); });
package org.jboss.windup.interrogator.impl; import java.io.File; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.jboss.windup.metadata.decoration.Summary; import org.jboss.windup.metadata.decoration.AbstractDecoration.NotificationLevel; import org.jboss.windup.metadata.type.FileMetadata; import org.jboss.windup.metadata.type.XmlMetadata; import org.jboss.windup.metadata.type.ZipEntryMetadata; import org.w3c.dom.Document; /** * Interrogates XML files. Extracts the XML, and creates an XmlMetadata object, which is passed down * the decorator pipeline. * * @author bdavis * */ public class XmlInterrogator extends <API key><XmlMetadata> { private static final Log LOG = LogFactory.getLog(XmlInterrogator.class); @Override public void processMeta(XmlMetadata fileMeta) { Document document = fileMeta.getParsedDocument(); if (document == null) { if (LOG.isDebugEnabled()) { LOG.debug("Document was null. Problem parsing: " + fileMeta.getFilePointer().getAbsolutePath()); } // attach the bad file so we see it in the reports... fileMeta.getArchiveMeta().getEntries().add(fileMeta); return; } super.processMeta(fileMeta); } @Override public boolean isOfInterest(XmlMetadata fileMeta) { return true; } @Override public XmlMetadata archiveEntryToMeta(ZipEntryMetadata archiveEntry) { File file = archiveEntry.getFilePointer(); LOG.debug("Processing XML: " + file.getAbsolutePath()); FileMetadata meta = null; if (file.length() > 1048576L * 1) { LOG.warn("XML larger than 1 MB: " + file.getAbsolutePath() + "; Skipping processing."); meta = new FileMetadata(); meta.setArchiveMeta(archiveEntry.getArchiveMeta()); meta.setFilePointer(file); Summary sr = new Summary(); sr.setDescription("File is too large; skipped."); sr.setLevel(NotificationLevel.WARNING); meta.getDecorations().add(sr); } else { XmlMetadata xmlMeta = new XmlMetadata(); xmlMeta.setArchiveMeta(archiveEntry.getArchiveMeta()); xmlMeta.setFilePointer(file); meta = xmlMeta; return xmlMeta; } return null; } @Override public XmlMetadata fileEntryToMeta(FileMetadata entry) { File file = entry.getFilePointer(); LOG.debug("Processing XML: " + file.getAbsolutePath()); FileMetadata meta = null; if (file.length() > 1048576L * 1) { LOG.warn("XML larger than 1 MB: " + file.getAbsolutePath() + "; Skipping processing."); meta = new FileMetadata(); //meta.setArchiveMeta(archiveEntry.getArchiveMeta()); meta.setFilePointer(file); meta.setArchiveMeta(entry.getArchiveMeta()); Summary sr = new Summary(); sr.setDescription("File is too large; skipped."); sr.setLevel(NotificationLevel.WARNING); meta.getDecorations().add(sr); } else { XmlMetadata xmlMeta = new XmlMetadata(); xmlMeta.setArchiveMeta(entry.getArchiveMeta()); xmlMeta.setFilePointer(file); meta = xmlMeta; return xmlMeta; } return null; } }
package de.uks.beast.editor.util; public enum Fonts { //@formatter:off HADOOP_MASTER_TITEL ("Arial", 10, true, true), HADOOP_SLAVE_TITEL ("Arial", 10, true, true), NETWORK_TITEL ("Arial", 10, true, true), <API key> ("Arial", 10, true, true), <API key> ("Arial", 8, false, true), <API key> ("Arial", 8, false, true), NETWORK_PROPERTY ("Arial", 8, false, true), <API key> ("Arial", 8, false, true), ;//@formatter:on private final String name; private final int size; private final boolean italic; private final boolean bold; private Fonts(final String name, final int size, final boolean italic, final boolean bold) { this.name = name; this.size = size; this.italic = italic; this.bold = bold; } /** * @return the name */ public String getName() { return name; } /** * @return the size */ public int getSize() { return size; } /** * @return the italic */ public boolean isItalic() { return italic; } /** * @return the bold */ public boolean isBold() { return bold; } }