hexsha
stringlengths 40
40
| size
int64 8
1.04M
| content
stringlengths 8
1.04M
| avg_line_length
float64 2.24
100
| max_line_length
int64 4
1k
| alphanum_fraction
float64 0.25
0.97
|
---|---|---|---|---|---|
dab08306333648bfa3549a5f9133c2dd915fe300
| 720 |
package com.qtin.sexyvc.ui.bean;
/**
* Created by ls on 17/7/31.
*/
public class UnReadBean {
private int total_no_read;
private int msg_no_read;
private int notice_no_read;
public int getTotal_no_read() {
return total_no_read;
}
public void setTotal_no_read(int total_no_read) {
this.total_no_read = total_no_read;
}
public int getMsg_no_read() {
return msg_no_read;
}
public void setMsg_no_read(int msg_no_read) {
this.msg_no_read = msg_no_read;
}
public int getNotice_no_read() {
return notice_no_read;
}
public void setNotice_no_read(int notice_no_read) {
this.notice_no_read = notice_no_read;
}
}
| 20 | 55 | 0.659722 |
1ae01c5014c8770cef2e559190781ed4645c63b0
| 209,341 |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author manduchi
*/
public class MARTE2_STREAMSetup extends DeviceSetup
{
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* Creates new form MARTE2_STREAMSetup
*/
public MARTE2_STREAMSetup()
{
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel2 = new javax.swing.JPanel();
jPanel11 = new javax.swing.JPanel();
deviceField1 = new DeviceField();
deviceField14 = new DeviceField();
deviceChoice9 = new DeviceChoice();
jPanel12 = new javax.swing.JPanel();
deviceField11 = new DeviceField();
deviceField12 = new DeviceField();
deviceField13 = new DeviceField();
deviceField10 = new DeviceField();
deviceButtons1 = new DeviceButtons();
jScrollPane1 = new javax.swing.JScrollPane();
jPanel1 = new javax.swing.JPanel();
jPanel3 = new javax.swing.JPanel();
deviceField2 = new DeviceField();
deviceChoice1 = new DeviceChoice();
deviceField15 = new DeviceField();
deviceField199 = new DeviceField();
jPanel4 = new javax.swing.JPanel();
deviceField3 = new DeviceField();
deviceChoice2 = new DeviceChoice();
deviceField16 = new DeviceField();
deviceField200 = new DeviceField();
jPanel5 = new javax.swing.JPanel();
deviceField4 = new DeviceField();
deviceChoice3 = new DeviceChoice();
deviceField17 = new DeviceField();
deviceField201 = new DeviceField();
jPanel6 = new javax.swing.JPanel();
deviceField5 = new DeviceField();
deviceChoice4 = new DeviceChoice();
deviceField18 = new DeviceField();
deviceField202 = new DeviceField();
jPanel7 = new javax.swing.JPanel();
deviceField6 = new DeviceField();
deviceChoice5 = new DeviceChoice();
deviceField19 = new DeviceField();
deviceField203 = new DeviceField();
jPanel8 = new javax.swing.JPanel();
deviceField7 = new DeviceField();
deviceChoice6 = new DeviceChoice();
deviceField20 = new DeviceField();
deviceField204 = new DeviceField();
jPanel9 = new javax.swing.JPanel();
deviceField8 = new DeviceField();
deviceChoice7 = new DeviceChoice();
deviceField21 = new DeviceField();
deviceField205 = new DeviceField();
jPanel10 = new javax.swing.JPanel();
deviceField9 = new DeviceField();
deviceChoice8 = new DeviceChoice();
deviceField22 = new DeviceField();
deviceField206 = new DeviceField();
jPanel13 = new javax.swing.JPanel();
deviceField23 = new DeviceField();
deviceChoice10 = new DeviceChoice();
deviceField24 = new DeviceField();
deviceField207 = new DeviceField();
jPanel14 = new javax.swing.JPanel();
deviceField25 = new DeviceField();
deviceChoice11 = new DeviceChoice();
deviceField26 = new DeviceField();
deviceField208 = new DeviceField();
jPanel15 = new javax.swing.JPanel();
deviceField27 = new DeviceField();
deviceChoice12 = new DeviceChoice();
deviceField28 = new DeviceField();
deviceField209 = new DeviceField();
jPanel16 = new javax.swing.JPanel();
deviceField29 = new DeviceField();
deviceChoice13 = new DeviceChoice();
deviceField30 = new DeviceField();
deviceField210 = new DeviceField();
jPanel17 = new javax.swing.JPanel();
deviceField31 = new DeviceField();
deviceChoice14 = new DeviceChoice();
deviceField32 = new DeviceField();
deviceField211 = new DeviceField();
jPanel18 = new javax.swing.JPanel();
deviceField33 = new DeviceField();
deviceChoice15 = new DeviceChoice();
deviceField34 = new DeviceField();
deviceField212 = new DeviceField();
jPanel19 = new javax.swing.JPanel();
deviceField35 = new DeviceField();
deviceChoice16 = new DeviceChoice();
deviceField36 = new DeviceField();
deviceField213 = new DeviceField();
jPanel20 = new javax.swing.JPanel();
deviceField37 = new DeviceField();
deviceChoice17 = new DeviceChoice();
deviceField38 = new DeviceField();
deviceField214 = new DeviceField();
jPanel21 = new javax.swing.JPanel();
deviceField39 = new DeviceField();
deviceChoice18 = new DeviceChoice();
deviceField40 = new DeviceField();
deviceField215 = new DeviceField();
jPanel22 = new javax.swing.JPanel();
deviceField41 = new DeviceField();
deviceChoice19 = new DeviceChoice();
deviceField42 = new DeviceField();
deviceField216 = new DeviceField();
jPanel23 = new javax.swing.JPanel();
deviceField43 = new DeviceField();
deviceChoice20 = new DeviceChoice();
deviceField44 = new DeviceField();
deviceField217 = new DeviceField();
jPanel24 = new javax.swing.JPanel();
deviceField45 = new DeviceField();
deviceChoice21 = new DeviceChoice();
deviceField46 = new DeviceField();
deviceField218 = new DeviceField();
jPanel25 = new javax.swing.JPanel();
deviceField47 = new DeviceField();
deviceChoice22 = new DeviceChoice();
deviceField48 = new DeviceField();
deviceField219 = new DeviceField();
jPanel26 = new javax.swing.JPanel();
deviceField49 = new DeviceField();
deviceChoice23 = new DeviceChoice();
deviceField50 = new DeviceField();
deviceField220 = new DeviceField();
jPanel27 = new javax.swing.JPanel();
deviceField51 = new DeviceField();
deviceChoice24 = new DeviceChoice();
deviceField52 = new DeviceField();
deviceField221 = new DeviceField();
jPanel28 = new javax.swing.JPanel();
deviceField53 = new DeviceField();
deviceChoice25 = new DeviceChoice();
deviceField54 = new DeviceField();
deviceField222 = new DeviceField();
jPanel29 = new javax.swing.JPanel();
deviceField55 = new DeviceField();
deviceChoice26 = new DeviceChoice();
deviceField56 = new DeviceField();
deviceField223 = new DeviceField();
jPanel30 = new javax.swing.JPanel();
deviceField57 = new DeviceField();
deviceChoice27 = new DeviceChoice();
deviceField58 = new DeviceField();
deviceField224 = new DeviceField();
jPanel31 = new javax.swing.JPanel();
deviceField59 = new DeviceField();
deviceChoice28 = new DeviceChoice();
deviceField60 = new DeviceField();
deviceField225 = new DeviceField();
jPanel32 = new javax.swing.JPanel();
deviceField61 = new DeviceField();
deviceChoice29 = new DeviceChoice();
deviceField62 = new DeviceField();
deviceField226 = new DeviceField();
jPanel33 = new javax.swing.JPanel();
deviceField63 = new DeviceField();
deviceChoice30 = new DeviceChoice();
deviceField64 = new DeviceField();
deviceField227 = new DeviceField();
jPanel34 = new javax.swing.JPanel();
deviceField65 = new DeviceField();
deviceChoice31 = new DeviceChoice();
deviceField66 = new DeviceField();
deviceField228 = new DeviceField();
jPanel35 = new javax.swing.JPanel();
deviceField67 = new DeviceField();
deviceChoice32 = new DeviceChoice();
deviceField68 = new DeviceField();
deviceField229 = new DeviceField();
jPanel36 = new javax.swing.JPanel();
deviceField69 = new DeviceField();
deviceChoice33 = new DeviceChoice();
deviceField70 = new DeviceField();
deviceField230 = new DeviceField();
jPanel37 = new javax.swing.JPanel();
deviceField71 = new DeviceField();
deviceChoice34 = new DeviceChoice();
deviceField72 = new DeviceField();
deviceField231 = new DeviceField();
jPanel38 = new javax.swing.JPanel();
deviceField73 = new DeviceField();
deviceChoice35 = new DeviceChoice();
deviceField74 = new DeviceField();
deviceField232 = new DeviceField();
jPanel39 = new javax.swing.JPanel();
deviceField75 = new DeviceField();
deviceChoice36 = new DeviceChoice();
deviceField76 = new DeviceField();
deviceField233 = new DeviceField();
jPanel40 = new javax.swing.JPanel();
deviceField77 = new DeviceField();
deviceChoice37 = new DeviceChoice();
deviceField78 = new DeviceField();
deviceField234 = new DeviceField();
jPanel41 = new javax.swing.JPanel();
deviceField79 = new DeviceField();
deviceChoice38 = new DeviceChoice();
deviceField80 = new DeviceField();
deviceField235 = new DeviceField();
jPanel42 = new javax.swing.JPanel();
deviceField81 = new DeviceField();
deviceChoice39 = new DeviceChoice();
deviceField82 = new DeviceField();
deviceField236 = new DeviceField();
jPanel43 = new javax.swing.JPanel();
deviceField83 = new DeviceField();
deviceChoice40 = new DeviceChoice();
deviceField84 = new DeviceField();
deviceField237 = new DeviceField();
jPanel44 = new javax.swing.JPanel();
deviceField85 = new DeviceField();
deviceChoice41 = new DeviceChoice();
deviceField86 = new DeviceField();
deviceField238 = new DeviceField();
jPanel45 = new javax.swing.JPanel();
deviceField87 = new DeviceField();
deviceChoice42 = new DeviceChoice();
deviceField88 = new DeviceField();
deviceField239 = new DeviceField();
jPanel46 = new javax.swing.JPanel();
deviceField89 = new DeviceField();
deviceChoice43 = new DeviceChoice();
deviceField90 = new DeviceField();
deviceField240 = new DeviceField();
jPanel47 = new javax.swing.JPanel();
deviceField91 = new DeviceField();
deviceChoice44 = new DeviceChoice();
deviceField92 = new DeviceField();
deviceField241 = new DeviceField();
jPanel48 = new javax.swing.JPanel();
deviceField93 = new DeviceField();
deviceChoice45 = new DeviceChoice();
deviceField94 = new DeviceField();
deviceField242 = new DeviceField();
jPanel49 = new javax.swing.JPanel();
deviceField95 = new DeviceField();
deviceChoice46 = new DeviceChoice();
deviceField96 = new DeviceField();
deviceField243 = new DeviceField();
jPanel50 = new javax.swing.JPanel();
deviceField97 = new DeviceField();
deviceChoice47 = new DeviceChoice();
deviceField98 = new DeviceField();
deviceField244 = new DeviceField();
jPanel51 = new javax.swing.JPanel();
deviceField99 = new DeviceField();
deviceChoice48 = new DeviceChoice();
deviceField100 = new DeviceField();
deviceField245 = new DeviceField();
jPanel52 = new javax.swing.JPanel();
deviceField101 = new DeviceField();
deviceChoice49 = new DeviceChoice();
deviceField102 = new DeviceField();
deviceField246 = new DeviceField();
jPanel53 = new javax.swing.JPanel();
deviceField103 = new DeviceField();
deviceChoice50 = new DeviceChoice();
deviceField104 = new DeviceField();
deviceField247 = new DeviceField();
jPanel54 = new javax.swing.JPanel();
deviceField105 = new DeviceField();
deviceChoice51 = new DeviceChoice();
deviceField106 = new DeviceField();
deviceField248 = new DeviceField();
jPanel55 = new javax.swing.JPanel();
deviceField107 = new DeviceField();
deviceChoice52 = new DeviceChoice();
deviceField108 = new DeviceField();
deviceField249 = new DeviceField();
jPanel56 = new javax.swing.JPanel();
deviceField109 = new DeviceField();
deviceChoice53 = new DeviceChoice();
deviceField110 = new DeviceField();
deviceField250 = new DeviceField();
jPanel57 = new javax.swing.JPanel();
deviceField111 = new DeviceField();
deviceChoice54 = new DeviceChoice();
deviceField112 = new DeviceField();
deviceField251 = new DeviceField();
jPanel58 = new javax.swing.JPanel();
deviceField113 = new DeviceField();
deviceChoice55 = new DeviceChoice();
deviceField114 = new DeviceField();
deviceField252 = new DeviceField();
jPanel59 = new javax.swing.JPanel();
deviceField115 = new DeviceField();
deviceChoice56 = new DeviceChoice();
deviceField116 = new DeviceField();
deviceField253 = new DeviceField();
jPanel60 = new javax.swing.JPanel();
deviceField117 = new DeviceField();
deviceChoice57 = new DeviceChoice();
deviceField118 = new DeviceField();
deviceField254 = new DeviceField();
jPanel61 = new javax.swing.JPanel();
deviceField119 = new DeviceField();
deviceChoice58 = new DeviceChoice();
deviceField120 = new DeviceField();
deviceField255 = new DeviceField();
jPanel62 = new javax.swing.JPanel();
deviceField121 = new DeviceField();
deviceChoice59 = new DeviceChoice();
deviceField122 = new DeviceField();
deviceField256 = new DeviceField();
jPanel63 = new javax.swing.JPanel();
deviceField123 = new DeviceField();
deviceChoice60 = new DeviceChoice();
deviceField124 = new DeviceField();
deviceField257 = new DeviceField();
jPanel64 = new javax.swing.JPanel();
deviceField125 = new DeviceField();
deviceChoice61 = new DeviceChoice();
deviceField126 = new DeviceField();
deviceField258 = new DeviceField();
jPanel65 = new javax.swing.JPanel();
deviceField127 = new DeviceField();
deviceChoice62 = new DeviceChoice();
deviceField128 = new DeviceField();
deviceField259 = new DeviceField();
jPanel66 = new javax.swing.JPanel();
deviceField129 = new DeviceField();
deviceChoice63 = new DeviceChoice();
deviceField130 = new DeviceField();
deviceField260 = new DeviceField();
jPanel67 = new javax.swing.JPanel();
deviceField131 = new DeviceField();
deviceChoice64 = new DeviceChoice();
deviceField132 = new DeviceField();
deviceField261 = new DeviceField();
jPanel68 = new javax.swing.JPanel();
deviceField133 = new DeviceField();
deviceChoice65 = new DeviceChoice();
deviceField134 = new DeviceField();
deviceField262 = new DeviceField();
jPanel69 = new javax.swing.JPanel();
deviceField135 = new DeviceField();
deviceChoice66 = new DeviceChoice();
deviceField136 = new DeviceField();
deviceField263 = new DeviceField();
jPanel70 = new javax.swing.JPanel();
deviceField137 = new DeviceField();
deviceChoice67 = new DeviceChoice();
deviceField138 = new DeviceField();
deviceField264 = new DeviceField();
jPanel71 = new javax.swing.JPanel();
deviceField139 = new DeviceField();
deviceChoice68 = new DeviceChoice();
deviceField140 = new DeviceField();
deviceField265 = new DeviceField();
jPanel72 = new javax.swing.JPanel();
deviceField141 = new DeviceField();
deviceChoice69 = new DeviceChoice();
deviceField142 = new DeviceField();
deviceField266 = new DeviceField();
jPanel73 = new javax.swing.JPanel();
deviceField143 = new DeviceField();
deviceChoice70 = new DeviceChoice();
deviceField144 = new DeviceField();
deviceField267 = new DeviceField();
jPanel74 = new javax.swing.JPanel();
deviceField145 = new DeviceField();
deviceChoice71 = new DeviceChoice();
deviceField146 = new DeviceField();
deviceField268 = new DeviceField();
jPanel75 = new javax.swing.JPanel();
deviceField147 = new DeviceField();
deviceChoice72 = new DeviceChoice();
deviceField148 = new DeviceField();
deviceField269 = new DeviceField();
jPanel76 = new javax.swing.JPanel();
deviceField149 = new DeviceField();
deviceChoice73 = new DeviceChoice();
deviceField150 = new DeviceField();
deviceField270 = new DeviceField();
jPanel77 = new javax.swing.JPanel();
deviceField151 = new DeviceField();
deviceChoice74 = new DeviceChoice();
deviceField152 = new DeviceField();
deviceField271 = new DeviceField();
jPanel78 = new javax.swing.JPanel();
deviceField153 = new DeviceField();
deviceChoice75 = new DeviceChoice();
deviceField154 = new DeviceField();
deviceField272 = new DeviceField();
jPanel79 = new javax.swing.JPanel();
deviceField155 = new DeviceField();
deviceChoice76 = new DeviceChoice();
deviceField156 = new DeviceField();
deviceField273 = new DeviceField();
jPanel80 = new javax.swing.JPanel();
deviceField157 = new DeviceField();
deviceChoice77 = new DeviceChoice();
deviceField158 = new DeviceField();
deviceField274 = new DeviceField();
jPanel81 = new javax.swing.JPanel();
deviceField159 = new DeviceField();
deviceChoice78 = new DeviceChoice();
deviceField160 = new DeviceField();
deviceField275 = new DeviceField();
jPanel82 = new javax.swing.JPanel();
deviceField161 = new DeviceField();
deviceChoice79 = new DeviceChoice();
deviceField162 = new DeviceField();
deviceField276 = new DeviceField();
jPanel83 = new javax.swing.JPanel();
deviceField163 = new DeviceField();
deviceChoice80 = new DeviceChoice();
deviceField164 = new DeviceField();
deviceField277 = new DeviceField();
jPanel84 = new javax.swing.JPanel();
deviceField165 = new DeviceField();
deviceChoice81 = new DeviceChoice();
deviceField166 = new DeviceField();
deviceField278 = new DeviceField();
jPanel85 = new javax.swing.JPanel();
deviceField167 = new DeviceField();
deviceChoice82 = new DeviceChoice();
deviceField168 = new DeviceField();
deviceField279 = new DeviceField();
jPanel86 = new javax.swing.JPanel();
deviceField169 = new DeviceField();
deviceChoice83 = new DeviceChoice();
deviceField170 = new DeviceField();
deviceField280 = new DeviceField();
jPanel87 = new javax.swing.JPanel();
deviceField171 = new DeviceField();
deviceChoice84 = new DeviceChoice();
deviceField172 = new DeviceField();
deviceField281 = new DeviceField();
jPanel88 = new javax.swing.JPanel();
deviceField173 = new DeviceField();
deviceChoice85 = new DeviceChoice();
deviceField174 = new DeviceField();
deviceField282 = new DeviceField();
jPanel89 = new javax.swing.JPanel();
deviceField175 = new DeviceField();
deviceChoice86 = new DeviceChoice();
deviceField176 = new DeviceField();
deviceField283 = new DeviceField();
jPanel90 = new javax.swing.JPanel();
deviceField177 = new DeviceField();
deviceChoice87 = new DeviceChoice();
deviceField178 = new DeviceField();
deviceField284 = new DeviceField();
jPanel91 = new javax.swing.JPanel();
deviceField179 = new DeviceField();
deviceChoice88 = new DeviceChoice();
deviceField180 = new DeviceField();
deviceField285 = new DeviceField();
jPanel92 = new javax.swing.JPanel();
deviceField181 = new DeviceField();
deviceChoice89 = new DeviceChoice();
deviceField182 = new DeviceField();
deviceField286 = new DeviceField();
jPanel93 = new javax.swing.JPanel();
deviceField183 = new DeviceField();
deviceChoice90 = new DeviceChoice();
deviceField184 = new DeviceField();
deviceField287 = new DeviceField();
jPanel94 = new javax.swing.JPanel();
deviceField185 = new DeviceField();
deviceChoice91 = new DeviceChoice();
deviceField186 = new DeviceField();
deviceField288 = new DeviceField();
jPanel95 = new javax.swing.JPanel();
deviceField187 = new DeviceField();
deviceChoice92 = new DeviceChoice();
deviceField188 = new DeviceField();
deviceField289 = new DeviceField();
jPanel96 = new javax.swing.JPanel();
deviceField189 = new DeviceField();
deviceChoice93 = new DeviceChoice();
deviceField190 = new DeviceField();
deviceField290 = new DeviceField();
jPanel97 = new javax.swing.JPanel();
deviceField191 = new DeviceField();
deviceChoice94 = new DeviceChoice();
deviceField192 = new DeviceField();
deviceField291 = new DeviceField();
jPanel98 = new javax.swing.JPanel();
deviceField193 = new DeviceField();
deviceChoice95 = new DeviceChoice();
deviceField194 = new DeviceField();
deviceField292 = new DeviceField();
jPanel99 = new javax.swing.JPanel();
deviceField195 = new DeviceField();
deviceChoice96 = new DeviceChoice();
deviceField196 = new DeviceField();
deviceField293 = new DeviceField();
jPanel100 = new javax.swing.JPanel();
deviceField197 = new DeviceField();
deviceChoice97 = new DeviceChoice();
deviceField198 = new DeviceField();
deviceField294 = new DeviceField();
jPanel101 = new javax.swing.JPanel();
deviceField295 = new DeviceField();
deviceChoice98 = new DeviceChoice();
deviceField296 = new DeviceField();
deviceField297 = new DeviceField();
jPanel102 = new javax.swing.JPanel();
deviceField298 = new DeviceField();
deviceChoice99 = new DeviceChoice();
deviceField299 = new DeviceField();
deviceField300 = new DeviceField();
jPanel103 = new javax.swing.JPanel();
deviceField301 = new DeviceField();
deviceChoice100 = new DeviceChoice();
deviceField302 = new DeviceField();
deviceField303 = new DeviceField();
jPanel104 = new javax.swing.JPanel();
deviceField304 = new DeviceField();
deviceChoice101 = new DeviceChoice();
deviceField305 = new DeviceField();
deviceField306 = new DeviceField();
jPanel105 = new javax.swing.JPanel();
deviceField307 = new DeviceField();
deviceChoice102 = new DeviceChoice();
deviceField308 = new DeviceField();
deviceField309 = new DeviceField();
jPanel106 = new javax.swing.JPanel();
deviceField310 = new DeviceField();
deviceChoice103 = new DeviceChoice();
deviceField311 = new DeviceField();
deviceField312 = new DeviceField();
jPanel107 = new javax.swing.JPanel();
deviceField313 = new DeviceField();
deviceChoice104 = new DeviceChoice();
deviceField314 = new DeviceField();
deviceField315 = new DeviceField();
jPanel108 = new javax.swing.JPanel();
deviceField316 = new DeviceField();
deviceChoice105 = new DeviceChoice();
deviceField317 = new DeviceField();
deviceField318 = new DeviceField();
jPanel109 = new javax.swing.JPanel();
deviceField319 = new DeviceField();
deviceChoice106 = new DeviceChoice();
deviceField320 = new DeviceField();
deviceField321 = new DeviceField();
jPanel110 = new javax.swing.JPanel();
deviceField322 = new DeviceField();
deviceChoice107 = new DeviceChoice();
deviceField323 = new DeviceField();
deviceField324 = new DeviceField();
jPanel111 = new javax.swing.JPanel();
deviceField325 = new DeviceField();
deviceChoice108 = new DeviceChoice();
deviceField326 = new DeviceField();
deviceField327 = new DeviceField();
jPanel112 = new javax.swing.JPanel();
deviceField328 = new DeviceField();
deviceChoice109 = new DeviceChoice();
deviceField329 = new DeviceField();
deviceField330 = new DeviceField();
jPanel113 = new javax.swing.JPanel();
deviceField331 = new DeviceField();
deviceChoice110 = new DeviceChoice();
deviceField332 = new DeviceField();
deviceField333 = new DeviceField();
jPanel114 = new javax.swing.JPanel();
deviceField334 = new DeviceField();
deviceChoice111 = new DeviceChoice();
deviceField335 = new DeviceField();
deviceField336 = new DeviceField();
jPanel115 = new javax.swing.JPanel();
deviceField337 = new DeviceField();
deviceChoice112 = new DeviceChoice();
deviceField338 = new DeviceField();
deviceField339 = new DeviceField();
jPanel116 = new javax.swing.JPanel();
deviceField340 = new DeviceField();
deviceChoice113 = new DeviceChoice();
deviceField341 = new DeviceField();
deviceField342 = new DeviceField();
jPanel117 = new javax.swing.JPanel();
deviceField343 = new DeviceField();
deviceChoice114 = new DeviceChoice();
deviceField344 = new DeviceField();
deviceField345 = new DeviceField();
jPanel118 = new javax.swing.JPanel();
deviceField346 = new DeviceField();
deviceChoice115 = new DeviceChoice();
deviceField347 = new DeviceField();
deviceField348 = new DeviceField();
jPanel119 = new javax.swing.JPanel();
deviceField349 = new DeviceField();
deviceChoice116 = new DeviceChoice();
deviceField350 = new DeviceField();
deviceField351 = new DeviceField();
jPanel120 = new javax.swing.JPanel();
deviceField352 = new DeviceField();
deviceChoice117 = new DeviceChoice();
deviceField353 = new DeviceField();
deviceField354 = new DeviceField();
jPanel121 = new javax.swing.JPanel();
deviceField355 = new DeviceField();
deviceChoice118 = new DeviceChoice();
deviceField356 = new DeviceField();
deviceField357 = new DeviceField();
jPanel122 = new javax.swing.JPanel();
deviceField358 = new DeviceField();
deviceChoice119 = new DeviceChoice();
deviceField359 = new DeviceField();
deviceField360 = new DeviceField();
jPanel123 = new javax.swing.JPanel();
deviceField361 = new DeviceField();
deviceChoice120 = new DeviceChoice();
deviceField362 = new DeviceField();
deviceField363 = new DeviceField();
jPanel124 = new javax.swing.JPanel();
deviceField364 = new DeviceField();
deviceChoice121 = new DeviceChoice();
deviceField365 = new DeviceField();
deviceField366 = new DeviceField();
jPanel125 = new javax.swing.JPanel();
deviceField367 = new DeviceField();
deviceChoice122 = new DeviceChoice();
deviceField368 = new DeviceField();
deviceField369 = new DeviceField();
jPanel126 = new javax.swing.JPanel();
deviceField370 = new DeviceField();
deviceChoice123 = new DeviceChoice();
deviceField371 = new DeviceField();
deviceField372 = new DeviceField();
jPanel127 = new javax.swing.JPanel();
deviceField373 = new DeviceField();
deviceChoice124 = new DeviceChoice();
deviceField374 = new DeviceField();
deviceField375 = new DeviceField();
jPanel128 = new javax.swing.JPanel();
deviceField376 = new DeviceField();
deviceChoice125 = new DeviceChoice();
deviceField377 = new DeviceField();
deviceField378 = new DeviceField();
jPanel129 = new javax.swing.JPanel();
deviceField379 = new DeviceField();
deviceChoice126 = new DeviceChoice();
deviceField380 = new DeviceField();
deviceField381 = new DeviceField();
jPanel130 = new javax.swing.JPanel();
deviceField382 = new DeviceField();
deviceChoice127 = new DeviceChoice();
deviceField383 = new DeviceField();
deviceField384 = new DeviceField();
jPanel131 = new javax.swing.JPanel();
deviceField385 = new DeviceField();
deviceChoice128 = new DeviceChoice();
deviceField386 = new DeviceField();
deviceField387 = new DeviceField();
jPanel132 = new javax.swing.JPanel();
deviceField388 = new DeviceField();
deviceChoice129 = new DeviceChoice();
deviceField389 = new DeviceField();
deviceField390 = new DeviceField();
setDeviceProvider("spilds.rfx.local:8100");
setDeviceTitle("MARTe2 Stream");
setDeviceType("MARTE2_STREAM");
setHeight(500);
setWidth(900);
jPanel2.setLayout(new java.awt.GridLayout(2, 1));
deviceField1.setIdentifier("");
deviceField1.setLabelString("Timebase");
deviceField1.setNumCols(25);
deviceField1.setOffsetNid(3);
jPanel11.add(deviceField1);
deviceField14.setIdentifier("");
deviceField14.setLabelString("Timebase div.:");
deviceField14.setNumCols(4);
deviceField14.setOffsetNid(107);
jPanel11.add(deviceField14);
deviceChoice9.setChoiceIntValues(new int[] {1, 0});
deviceChoice9.setChoiceItems(new String[] {"Time Streaming", "Oscilloscope"});
deviceChoice9.setConvert(true);
deviceChoice9.setIdentifier("");
deviceChoice9.setLabelString("Mode: ");
deviceChoice9.setOffsetNid(16);
deviceChoice9.setUpdateIdentifier("");
jPanel11.add(deviceChoice9);
jPanel2.add(jPanel11);
deviceField11.setIdentifier("");
deviceField11.setLabelString("CPU Mask: ");
deviceField11.setNumCols(4);
deviceField11.setOffsetNid(19);
jPanel12.add(deviceField11);
deviceField12.setIdentifier("");
deviceField12.setLabelString("Stack size: ");
deviceField12.setOffsetNid(22);
jPanel12.add(deviceField12);
deviceField13.setIdentifier("");
deviceField13.setLabelString("Num. buffers: ");
deviceField13.setNumCols(4);
deviceField13.setOffsetNid(25);
jPanel12.add(deviceField13);
deviceField10.setIdentifier("");
deviceField10.setLabelString("Event Division: ");
deviceField10.setNumCols(4);
deviceField10.setOffsetNid(7);
jPanel12.add(deviceField10);
jPanel2.add(jPanel12);
getContentPane().add(jPanel2, java.awt.BorderLayout.NORTH);
jPanel2.getAccessibleContext().setAccessibleName("");
getContentPane().add(deviceButtons1, java.awt.BorderLayout.PAGE_END);
jPanel1.setLayout(new java.awt.GridLayout(128, 1));
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 1(Time if TimeStreaming mode)"));
deviceField2.setIdentifier("");
deviceField2.setLabelString("Value: ");
deviceField2.setNumCols(35);
deviceField2.setOffsetNid(31);
jPanel3.add(deviceField2);
deviceChoice1.setChoiceItems(new String[] {"float32", "float64", "int16", "int32", "uint16", "uint32"});
deviceChoice1.setIdentifier("");
deviceChoice1.setLabelString("Type: ");
deviceChoice1.setOffsetNid(28);
deviceChoice1.setUpdateIdentifier("");
jPanel3.add(deviceChoice1);
deviceField15.setIdentifier("");
deviceField15.setLabelString("Channel: ");
deviceField15.setNumCols(15);
deviceField15.setOffsetNid(36);
deviceField15.setTextOnly(true);
jPanel3.add(deviceField15);
deviceField199.setIdentifier("");
deviceField199.setLabelString("Dimensions: ");
deviceField199.setNumCols(4);
deviceField199.setOffsetNid(29);
jPanel3.add(deviceField199);
jPanel1.add(jPanel3);
jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 2"));
deviceField3.setIdentifier("");
deviceField3.setLabelString("Value: ");
deviceField3.setNumCols(35);
deviceField3.setOffsetNid(41);
jPanel4.add(deviceField3);
deviceChoice2.setChoiceItems(new String[] {"float32", "float64", "int16", "int32", "uint16", "uint32"});
deviceChoice2.setIdentifier("");
deviceChoice2.setLabelString("Type: ");
deviceChoice2.setOffsetNid(38);
deviceChoice2.setUpdateIdentifier("");
jPanel4.add(deviceChoice2);
deviceField16.setIdentifier("");
deviceField16.setLabelString("Channel: ");
deviceField16.setNumCols(15);
deviceField16.setOffsetNid(46);
deviceField16.setTextOnly(true);
jPanel4.add(deviceField16);
deviceField200.setIdentifier("");
deviceField200.setLabelString("Dimensions: ");
deviceField200.setNumCols(4);
deviceField200.setOffsetNid(39);
jPanel4.add(deviceField200);
jPanel1.add(jPanel4);
jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 3"));
deviceField4.setIdentifier("");
deviceField4.setLabelString("Value: ");
deviceField4.setNumCols(35);
deviceField4.setOffsetNid(51);
jPanel5.add(deviceField4);
deviceChoice3.setChoiceItems(new String[] {"float32", "float64", "int16", "int32", "uint16", "uint32"});
deviceChoice3.setIdentifier("");
deviceChoice3.setLabelString("Type: ");
deviceChoice3.setOffsetNid(48);
deviceChoice3.setUpdateIdentifier("");
jPanel5.add(deviceChoice3);
deviceField17.setIdentifier("");
deviceField17.setLabelString("Channel: ");
deviceField17.setNumCols(15);
deviceField17.setOffsetNid(56);
deviceField17.setTextOnly(true);
jPanel5.add(deviceField17);
deviceField201.setIdentifier("");
deviceField201.setLabelString("Dimensions: ");
deviceField201.setNumCols(4);
deviceField201.setOffsetNid(49);
jPanel5.add(deviceField201);
jPanel1.add(jPanel5);
jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 4"));
deviceField5.setIdentifier("");
deviceField5.setLabelString("Value: ");
deviceField5.setNumCols(35);
deviceField5.setOffsetNid(61);
jPanel6.add(deviceField5);
deviceChoice4.setChoiceItems(new String[] {"float32", "float64", "int16", "int32", "uint16", "uint32"});
deviceChoice4.setIdentifier("");
deviceChoice4.setLabelString("Type: ");
deviceChoice4.setOffsetNid(58);
deviceChoice4.setUpdateIdentifier("");
jPanel6.add(deviceChoice4);
deviceField18.setIdentifier("");
deviceField18.setLabelString("Channel: ");
deviceField18.setNumCols(15);
deviceField18.setOffsetNid(66);
deviceField18.setTextOnly(true);
jPanel6.add(deviceField18);
deviceField202.setIdentifier("");
deviceField202.setLabelString("Dimensions: ");
deviceField202.setNumCols(4);
deviceField202.setOffsetNid(59);
jPanel6.add(deviceField202);
jPanel1.add(jPanel6);
jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 5"));
deviceField6.setIdentifier("");
deviceField6.setLabelString("Value: ");
deviceField6.setNumCols(35);
deviceField6.setOffsetNid(71);
jPanel7.add(deviceField6);
deviceChoice5.setChoiceItems(new String[] {"float32", "float64", "int16", "int32", "uint16", "uint32"});
deviceChoice5.setIdentifier("");
deviceChoice5.setLabelString("Type: ");
deviceChoice5.setOffsetNid(68);
deviceChoice5.setUpdateIdentifier("");
jPanel7.add(deviceChoice5);
deviceField19.setIdentifier("");
deviceField19.setLabelString("Channel: ");
deviceField19.setNumCols(15);
deviceField19.setOffsetNid(76);
deviceField19.setTextOnly(true);
jPanel7.add(deviceField19);
deviceField203.setIdentifier("");
deviceField203.setLabelString("Dimensions: ");
deviceField203.setNumCols(4);
deviceField203.setOffsetNid(69);
jPanel7.add(deviceField203);
jPanel1.add(jPanel7);
jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 6"));
deviceField7.setIdentifier("");
deviceField7.setLabelString("Value: ");
deviceField7.setNumCols(35);
deviceField7.setOffsetNid(81);
jPanel8.add(deviceField7);
deviceChoice6.setChoiceItems(new String[] {"float32", "float64", "int16", "int32", "uint16", "uint32"});
deviceChoice6.setIdentifier("");
deviceChoice6.setLabelString("Type: ");
deviceChoice6.setOffsetNid(68);
deviceChoice6.setUpdateIdentifier("");
jPanel8.add(deviceChoice6);
deviceField20.setIdentifier("");
deviceField20.setLabelString("Channel: ");
deviceField20.setNumCols(15);
deviceField20.setOffsetNid(86);
deviceField20.setTextOnly(true);
jPanel8.add(deviceField20);
deviceField204.setIdentifier("");
deviceField204.setLabelString("Dimensions: ");
deviceField204.setNumCols(4);
deviceField204.setOffsetNid(79);
jPanel8.add(deviceField204);
jPanel1.add(jPanel8);
jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 7"));
deviceField8.setIdentifier("");
deviceField8.setLabelString("Value: ");
deviceField8.setNumCols(35);
deviceField8.setOffsetNid(91);
jPanel9.add(deviceField8);
deviceChoice7.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice7.setIdentifier("");
deviceChoice7.setLabelString("Type: ");
deviceChoice7.setOffsetNid(88);
deviceChoice7.setUpdateIdentifier("");
jPanel9.add(deviceChoice7);
deviceField21.setIdentifier("");
deviceField21.setLabelString("Channel: ");
deviceField21.setNumCols(15);
deviceField21.setOffsetNid(96);
deviceField21.setTextOnly(true);
jPanel9.add(deviceField21);
deviceField205.setIdentifier("");
deviceField205.setLabelString("Dimensions: ");
deviceField205.setNumCols(4);
deviceField205.setOffsetNid(89);
jPanel9.add(deviceField205);
jPanel1.add(jPanel9);
jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 128"));
deviceField9.setIdentifier("");
deviceField9.setLabelString("Value: ");
deviceField9.setNumCols(35);
deviceField9.setOffsetNid(101);
jPanel10.add(deviceField9);
deviceChoice8.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice8.setIdentifier("");
deviceChoice8.setLabelString("Type: ");
deviceChoice8.setOffsetNid(98);
deviceChoice8.setUpdateIdentifier("");
jPanel10.add(deviceChoice8);
deviceField22.setIdentifier("");
deviceField22.setLabelString("Channel: ");
deviceField22.setNumCols(15);
deviceField22.setOffsetNid(106);
deviceField22.setTextOnly(true);
jPanel10.add(deviceField22);
deviceField206.setIdentifier("");
deviceField206.setLabelString("Dimensions: ");
deviceField206.setNumCols(4);
deviceField206.setOffsetNid(99);
jPanel10.add(deviceField206);
jPanel1.add(jPanel10);
jPanel13.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 9"));
deviceField23.setIdentifier("");
deviceField23.setLabelString("Value: ");
deviceField23.setNumCols(45);
deviceField23.setOffsetNid(111);
jPanel13.add(deviceField23);
deviceChoice10.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice10.setIdentifier("");
deviceChoice10.setLabelString("Type: ");
deviceChoice10.setOffsetNid(108);
deviceChoice10.setUpdateIdentifier("");
jPanel13.add(deviceChoice10);
deviceField24.setIdentifier("");
deviceField24.setLabelString("Channel: ");
deviceField24.setNumCols(15);
deviceField24.setOffsetNid(116);
deviceField24.setShowState(true);
deviceField24.setTextOnly(true);
jPanel13.add(deviceField24);
deviceField207.setIdentifier("");
deviceField207.setLabelString("Dimensions: ");
deviceField207.setNumCols(4);
deviceField207.setOffsetNid(109);
jPanel13.add(deviceField207);
jPanel1.add(jPanel13);
jPanel14.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 10"));
deviceField25.setIdentifier("");
deviceField25.setLabelString("Value: ");
deviceField25.setNumCols(45);
deviceField25.setOffsetNid(121);
jPanel14.add(deviceField25);
deviceChoice11.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice11.setIdentifier("");
deviceChoice11.setLabelString("Type: ");
deviceChoice11.setOffsetNid(118);
deviceChoice11.setUpdateIdentifier("");
jPanel14.add(deviceChoice11);
deviceField26.setIdentifier("");
deviceField26.setLabelString("Channel: ");
deviceField26.setNumCols(15);
deviceField26.setOffsetNid(126);
deviceField26.setShowState(true);
deviceField26.setTextOnly(true);
jPanel14.add(deviceField26);
deviceField208.setIdentifier("");
deviceField208.setLabelString("Dimensions: ");
deviceField208.setNumCols(4);
deviceField208.setOffsetNid(119);
jPanel14.add(deviceField208);
jPanel1.add(jPanel14);
jPanel15.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 11"));
deviceField27.setIdentifier("");
deviceField27.setLabelString("Value: ");
deviceField27.setNumCols(45);
deviceField27.setOffsetNid(131);
jPanel15.add(deviceField27);
deviceChoice12.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice12.setIdentifier("");
deviceChoice12.setLabelString("Type: ");
deviceChoice12.setOffsetNid(128);
deviceChoice12.setUpdateIdentifier("");
jPanel15.add(deviceChoice12);
deviceField28.setIdentifier("");
deviceField28.setLabelString("Channel: ");
deviceField28.setNumCols(15);
deviceField28.setOffsetNid(136);
deviceField28.setShowState(true);
deviceField28.setTextOnly(true);
jPanel15.add(deviceField28);
deviceField209.setIdentifier("");
deviceField209.setLabelString("Dimensions: ");
deviceField209.setNumCols(4);
deviceField209.setOffsetNid(129);
jPanel15.add(deviceField209);
jPanel1.add(jPanel15);
jPanel16.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 12"));
deviceField29.setIdentifier("");
deviceField29.setLabelString("Value: ");
deviceField29.setNumCols(45);
deviceField29.setOffsetNid(141);
jPanel16.add(deviceField29);
deviceChoice13.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice13.setIdentifier("");
deviceChoice13.setLabelString("Type: ");
deviceChoice13.setOffsetNid(138);
deviceChoice13.setUpdateIdentifier("");
jPanel16.add(deviceChoice13);
deviceField30.setIdentifier("");
deviceField30.setLabelString("Channel: ");
deviceField30.setNumCols(15);
deviceField30.setOffsetNid(146);
deviceField30.setShowState(true);
deviceField30.setTextOnly(true);
jPanel16.add(deviceField30);
deviceField210.setIdentifier("");
deviceField210.setLabelString("Dimensions: ");
deviceField210.setNumCols(4);
deviceField210.setOffsetNid(139);
jPanel16.add(deviceField210);
jPanel1.add(jPanel16);
jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 13"));
deviceField31.setIdentifier("");
deviceField31.setLabelString("Value: ");
deviceField31.setNumCols(45);
deviceField31.setOffsetNid(151);
jPanel17.add(deviceField31);
deviceChoice14.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice14.setIdentifier("");
deviceChoice14.setLabelString("Type: ");
deviceChoice14.setOffsetNid(148);
deviceChoice14.setUpdateIdentifier("");
jPanel17.add(deviceChoice14);
deviceField32.setIdentifier("");
deviceField32.setLabelString("Channel: ");
deviceField32.setNumCols(15);
deviceField32.setOffsetNid(156);
deviceField32.setShowState(true);
deviceField32.setTextOnly(true);
jPanel17.add(deviceField32);
deviceField211.setIdentifier("");
deviceField211.setLabelString("Dimensions: ");
deviceField211.setNumCols(4);
deviceField211.setOffsetNid(149);
jPanel17.add(deviceField211);
jPanel1.add(jPanel17);
jPanel18.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 14"));
deviceField33.setIdentifier("");
deviceField33.setLabelString("Value: ");
deviceField33.setNumCols(45);
deviceField33.setOffsetNid(161);
jPanel18.add(deviceField33);
deviceChoice15.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice15.setIdentifier("");
deviceChoice15.setLabelString("Type: ");
deviceChoice15.setOffsetNid(158);
deviceChoice15.setUpdateIdentifier("");
jPanel18.add(deviceChoice15);
deviceField34.setIdentifier("");
deviceField34.setLabelString("Channel: ");
deviceField34.setNumCols(15);
deviceField34.setOffsetNid(166);
deviceField34.setShowState(true);
deviceField34.setTextOnly(true);
jPanel18.add(deviceField34);
deviceField212.setIdentifier("");
deviceField212.setLabelString("Dimensions: ");
deviceField212.setNumCols(4);
deviceField212.setOffsetNid(159);
jPanel18.add(deviceField212);
jPanel1.add(jPanel18);
jPanel19.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 15"));
deviceField35.setIdentifier("");
deviceField35.setLabelString("Value: ");
deviceField35.setNumCols(45);
deviceField35.setOffsetNid(171);
jPanel19.add(deviceField35);
deviceChoice16.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice16.setIdentifier("");
deviceChoice16.setLabelString("Type: ");
deviceChoice16.setOffsetNid(168);
deviceChoice16.setUpdateIdentifier("");
jPanel19.add(deviceChoice16);
deviceField36.setIdentifier("");
deviceField36.setLabelString("Channel: ");
deviceField36.setNumCols(15);
deviceField36.setOffsetNid(176);
deviceField36.setShowState(true);
deviceField36.setTextOnly(true);
jPanel19.add(deviceField36);
deviceField213.setIdentifier("");
deviceField213.setLabelString("Dimensions: ");
deviceField213.setNumCols(4);
deviceField213.setOffsetNid(169);
jPanel19.add(deviceField213);
jPanel1.add(jPanel19);
jPanel20.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 16"));
deviceField37.setIdentifier("");
deviceField37.setLabelString("Value: ");
deviceField37.setNumCols(45);
deviceField37.setOffsetNid(181);
jPanel20.add(deviceField37);
deviceChoice17.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice17.setIdentifier("");
deviceChoice17.setLabelString("Type: ");
deviceChoice17.setOffsetNid(178);
deviceChoice17.setUpdateIdentifier("");
jPanel20.add(deviceChoice17);
deviceField38.setIdentifier("");
deviceField38.setLabelString("Channel: ");
deviceField38.setNumCols(15);
deviceField38.setOffsetNid(186);
deviceField38.setShowState(true);
deviceField38.setTextOnly(true);
jPanel20.add(deviceField38);
deviceField214.setIdentifier("");
deviceField214.setLabelString("Dimensions: ");
deviceField214.setNumCols(4);
deviceField214.setOffsetNid(179);
jPanel20.add(deviceField214);
jPanel1.add(jPanel20);
jPanel21.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 17"));
deviceField39.setIdentifier("");
deviceField39.setLabelString("Value: ");
deviceField39.setNumCols(45);
deviceField39.setOffsetNid(191);
jPanel21.add(deviceField39);
deviceChoice18.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice18.setIdentifier("");
deviceChoice18.setLabelString("Type: ");
deviceChoice18.setOffsetNid(188);
deviceChoice18.setUpdateIdentifier("");
jPanel21.add(deviceChoice18);
deviceField40.setIdentifier("");
deviceField40.setLabelString("Channel: ");
deviceField40.setNumCols(15);
deviceField40.setOffsetNid(196);
deviceField40.setShowState(true);
deviceField40.setTextOnly(true);
jPanel21.add(deviceField40);
deviceField215.setIdentifier("");
deviceField215.setLabelString("Dimensions: ");
deviceField215.setNumCols(4);
deviceField215.setOffsetNid(189);
jPanel21.add(deviceField215);
jPanel1.add(jPanel21);
jPanel22.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 18"));
deviceField41.setIdentifier("");
deviceField41.setLabelString("Value: ");
deviceField41.setNumCols(45);
deviceField41.setOffsetNid(201);
jPanel22.add(deviceField41);
deviceChoice19.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice19.setIdentifier("");
deviceChoice19.setLabelString("Type: ");
deviceChoice19.setOffsetNid(198);
deviceChoice19.setUpdateIdentifier("");
jPanel22.add(deviceChoice19);
deviceField42.setIdentifier("");
deviceField42.setLabelString("Channel: ");
deviceField42.setNumCols(15);
deviceField42.setOffsetNid(206);
deviceField42.setShowState(true);
deviceField42.setTextOnly(true);
jPanel22.add(deviceField42);
deviceField216.setIdentifier("");
deviceField216.setLabelString("Dimensions: ");
deviceField216.setNumCols(4);
deviceField216.setOffsetNid(199);
jPanel22.add(deviceField216);
jPanel1.add(jPanel22);
jPanel23.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 19"));
deviceField43.setIdentifier("");
deviceField43.setLabelString("Value: ");
deviceField43.setNumCols(45);
deviceField43.setOffsetNid(211);
jPanel23.add(deviceField43);
deviceChoice20.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice20.setIdentifier("");
deviceChoice20.setLabelString("Type: ");
deviceChoice20.setOffsetNid(208);
deviceChoice20.setUpdateIdentifier("");
jPanel23.add(deviceChoice20);
deviceField44.setIdentifier("");
deviceField44.setLabelString("Channel: ");
deviceField44.setNumCols(15);
deviceField44.setOffsetNid(216);
deviceField44.setShowState(true);
deviceField44.setTextOnly(true);
jPanel23.add(deviceField44);
deviceField217.setIdentifier("");
deviceField217.setLabelString("Dimensions: ");
deviceField217.setNumCols(4);
deviceField217.setOffsetNid(209);
jPanel23.add(deviceField217);
jPanel1.add(jPanel23);
jPanel24.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 20"));
deviceField45.setIdentifier("");
deviceField45.setLabelString("Value: ");
deviceField45.setNumCols(45);
deviceField45.setOffsetNid(221);
jPanel24.add(deviceField45);
deviceChoice21.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice21.setIdentifier("");
deviceChoice21.setLabelString("Type: ");
deviceChoice21.setOffsetNid(218);
deviceChoice21.setUpdateIdentifier("");
jPanel24.add(deviceChoice21);
deviceField46.setIdentifier("");
deviceField46.setLabelString("Channel: ");
deviceField46.setNumCols(15);
deviceField46.setOffsetNid(226);
deviceField46.setShowState(true);
deviceField46.setTextOnly(true);
jPanel24.add(deviceField46);
deviceField218.setIdentifier("");
deviceField218.setLabelString("Dimensions: ");
deviceField218.setNumCols(4);
deviceField218.setOffsetNid(219);
jPanel24.add(deviceField218);
jPanel1.add(jPanel24);
jPanel25.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 21"));
deviceField47.setIdentifier("");
deviceField47.setLabelString("Value: ");
deviceField47.setNumCols(45);
deviceField47.setOffsetNid(231);
jPanel25.add(deviceField47);
deviceChoice22.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice22.setIdentifier("");
deviceChoice22.setLabelString("Type: ");
deviceChoice22.setOffsetNid(228);
deviceChoice22.setUpdateIdentifier("");
jPanel25.add(deviceChoice22);
deviceField48.setIdentifier("");
deviceField48.setLabelString("Channel: ");
deviceField48.setNumCols(15);
deviceField48.setOffsetNid(236);
deviceField48.setShowState(true);
deviceField48.setTextOnly(true);
jPanel25.add(deviceField48);
deviceField219.setIdentifier("");
deviceField219.setLabelString("Dimensions: ");
deviceField219.setNumCols(4);
deviceField219.setOffsetNid(229);
jPanel25.add(deviceField219);
jPanel1.add(jPanel25);
jPanel26.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 22"));
deviceField49.setIdentifier("");
deviceField49.setLabelString("Value: ");
deviceField49.setNumCols(45);
deviceField49.setOffsetNid(241);
jPanel26.add(deviceField49);
deviceChoice23.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice23.setIdentifier("");
deviceChoice23.setLabelString("Type: ");
deviceChoice23.setOffsetNid(238);
deviceChoice23.setUpdateIdentifier("");
jPanel26.add(deviceChoice23);
deviceField50.setIdentifier("");
deviceField50.setLabelString("Channel: ");
deviceField50.setNumCols(15);
deviceField50.setOffsetNid(246);
deviceField50.setShowState(true);
deviceField50.setTextOnly(true);
jPanel26.add(deviceField50);
deviceField220.setIdentifier("");
deviceField220.setLabelString("Dimensions: ");
deviceField220.setNumCols(4);
deviceField220.setOffsetNid(239);
jPanel26.add(deviceField220);
jPanel1.add(jPanel26);
jPanel27.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 23"));
deviceField51.setIdentifier("");
deviceField51.setLabelString("Value: ");
deviceField51.setNumCols(45);
deviceField51.setOffsetNid(251);
jPanel27.add(deviceField51);
deviceChoice24.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice24.setIdentifier("");
deviceChoice24.setLabelString("Type: ");
deviceChoice24.setOffsetNid(248);
deviceChoice24.setUpdateIdentifier("");
jPanel27.add(deviceChoice24);
deviceField52.setIdentifier("");
deviceField52.setLabelString("Channel: ");
deviceField52.setNumCols(15);
deviceField52.setOffsetNid(256);
deviceField52.setShowState(true);
deviceField52.setTextOnly(true);
jPanel27.add(deviceField52);
deviceField221.setIdentifier("");
deviceField221.setLabelString("Dimensions: ");
deviceField221.setNumCols(4);
deviceField221.setOffsetNid(249);
jPanel27.add(deviceField221);
jPanel1.add(jPanel27);
jPanel28.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 24"));
deviceField53.setIdentifier("");
deviceField53.setLabelString("Value: ");
deviceField53.setNumCols(45);
deviceField53.setOffsetNid(261);
jPanel28.add(deviceField53);
deviceChoice25.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice25.setIdentifier("");
deviceChoice25.setLabelString("Type: ");
deviceChoice25.setOffsetNid(258);
deviceChoice25.setUpdateIdentifier("");
jPanel28.add(deviceChoice25);
deviceField54.setIdentifier("");
deviceField54.setLabelString("Channel: ");
deviceField54.setNumCols(15);
deviceField54.setOffsetNid(266);
deviceField54.setShowState(true);
deviceField54.setTextOnly(true);
jPanel28.add(deviceField54);
deviceField222.setIdentifier("");
deviceField222.setLabelString("Dimensions: ");
deviceField222.setNumCols(4);
deviceField222.setOffsetNid(259);
jPanel28.add(deviceField222);
jPanel1.add(jPanel28);
jPanel29.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 25"));
deviceField55.setIdentifier("");
deviceField55.setLabelString("Value: ");
deviceField55.setNumCols(45);
deviceField55.setOffsetNid(271);
jPanel29.add(deviceField55);
deviceChoice26.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice26.setIdentifier("");
deviceChoice26.setLabelString("Type: ");
deviceChoice26.setOffsetNid(268);
deviceChoice26.setUpdateIdentifier("");
jPanel29.add(deviceChoice26);
deviceField56.setIdentifier("");
deviceField56.setLabelString("Channel: ");
deviceField56.setNumCols(15);
deviceField56.setOffsetNid(276);
deviceField56.setShowState(true);
deviceField56.setTextOnly(true);
jPanel29.add(deviceField56);
deviceField223.setIdentifier("");
deviceField223.setLabelString("Dimensions: ");
deviceField223.setNumCols(4);
deviceField223.setOffsetNid(269);
jPanel29.add(deviceField223);
jPanel1.add(jPanel29);
jPanel30.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 26"));
deviceField57.setIdentifier("");
deviceField57.setLabelString("Value: ");
deviceField57.setNumCols(45);
deviceField57.setOffsetNid(281);
jPanel30.add(deviceField57);
deviceChoice27.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice27.setIdentifier("");
deviceChoice27.setLabelString("Type: ");
deviceChoice27.setOffsetNid(278);
deviceChoice27.setUpdateIdentifier("");
jPanel30.add(deviceChoice27);
deviceField58.setIdentifier("");
deviceField58.setLabelString("Channel: ");
deviceField58.setNumCols(15);
deviceField58.setOffsetNid(286);
deviceField58.setShowState(true);
deviceField58.setTextOnly(true);
jPanel30.add(deviceField58);
deviceField224.setIdentifier("");
deviceField224.setLabelString("Dimensions: ");
deviceField224.setNumCols(4);
deviceField224.setOffsetNid(279);
jPanel30.add(deviceField224);
jPanel1.add(jPanel30);
jPanel31.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 27"));
deviceField59.setIdentifier("");
deviceField59.setLabelString("Value: ");
deviceField59.setNumCols(45);
deviceField59.setOffsetNid(291);
jPanel31.add(deviceField59);
deviceChoice28.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice28.setIdentifier("");
deviceChoice28.setLabelString("Type: ");
deviceChoice28.setOffsetNid(288);
deviceChoice28.setUpdateIdentifier("");
jPanel31.add(deviceChoice28);
deviceField60.setIdentifier("");
deviceField60.setLabelString("Channel: ");
deviceField60.setNumCols(15);
deviceField60.setOffsetNid(296);
deviceField60.setShowState(true);
deviceField60.setTextOnly(true);
jPanel31.add(deviceField60);
deviceField225.setIdentifier("");
deviceField225.setLabelString("Dimensions: ");
deviceField225.setNumCols(4);
deviceField225.setOffsetNid(289);
jPanel31.add(deviceField225);
jPanel1.add(jPanel31);
jPanel32.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 28"));
deviceField61.setIdentifier("");
deviceField61.setLabelString("Value: ");
deviceField61.setNumCols(45);
deviceField61.setOffsetNid(301);
jPanel32.add(deviceField61);
deviceChoice29.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice29.setIdentifier("");
deviceChoice29.setLabelString("Type: ");
deviceChoice29.setOffsetNid(298);
deviceChoice29.setUpdateIdentifier("");
jPanel32.add(deviceChoice29);
deviceField62.setIdentifier("");
deviceField62.setLabelString("Channel: ");
deviceField62.setNumCols(15);
deviceField62.setOffsetNid(306);
deviceField62.setShowState(true);
deviceField62.setTextOnly(true);
jPanel32.add(deviceField62);
deviceField226.setIdentifier("");
deviceField226.setLabelString("Dimensions: ");
deviceField226.setNumCols(4);
deviceField226.setOffsetNid(299);
jPanel32.add(deviceField226);
jPanel1.add(jPanel32);
jPanel33.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 29"));
deviceField63.setIdentifier("");
deviceField63.setLabelString("Value: ");
deviceField63.setNumCols(45);
deviceField63.setOffsetNid(311);
jPanel33.add(deviceField63);
deviceChoice30.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice30.setIdentifier("");
deviceChoice30.setLabelString("Type: ");
deviceChoice30.setOffsetNid(308);
deviceChoice30.setUpdateIdentifier("");
jPanel33.add(deviceChoice30);
deviceField64.setIdentifier("");
deviceField64.setLabelString("Channel: ");
deviceField64.setNumCols(15);
deviceField64.setOffsetNid(316);
deviceField64.setShowState(true);
deviceField64.setTextOnly(true);
jPanel33.add(deviceField64);
deviceField227.setIdentifier("");
deviceField227.setLabelString("Dimensions: ");
deviceField227.setNumCols(4);
deviceField227.setOffsetNid(309);
jPanel33.add(deviceField227);
jPanel1.add(jPanel33);
jPanel34.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 30"));
deviceField65.setIdentifier("");
deviceField65.setLabelString("Value: ");
deviceField65.setNumCols(45);
deviceField65.setOffsetNid(321);
jPanel34.add(deviceField65);
deviceChoice31.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice31.setIdentifier("");
deviceChoice31.setLabelString("Type: ");
deviceChoice31.setOffsetNid(318);
deviceChoice31.setUpdateIdentifier("");
jPanel34.add(deviceChoice31);
deviceField66.setIdentifier("");
deviceField66.setLabelString("Channel: ");
deviceField66.setNumCols(15);
deviceField66.setOffsetNid(326);
deviceField66.setShowState(true);
deviceField66.setTextOnly(true);
jPanel34.add(deviceField66);
deviceField228.setIdentifier("");
deviceField228.setLabelString("Dimensions: ");
deviceField228.setNumCols(4);
deviceField228.setOffsetNid(319);
jPanel34.add(deviceField228);
jPanel1.add(jPanel34);
jPanel35.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 31"));
deviceField67.setIdentifier("");
deviceField67.setLabelString("Value: ");
deviceField67.setNumCols(45);
deviceField67.setOffsetNid(331);
jPanel35.add(deviceField67);
deviceChoice32.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice32.setIdentifier("");
deviceChoice32.setLabelString("Type: ");
deviceChoice32.setOffsetNid(328);
deviceChoice32.setUpdateIdentifier("");
jPanel35.add(deviceChoice32);
deviceField68.setIdentifier("");
deviceField68.setLabelString("Channel: ");
deviceField68.setNumCols(15);
deviceField68.setOffsetNid(336);
deviceField68.setShowState(true);
deviceField68.setTextOnly(true);
jPanel35.add(deviceField68);
deviceField229.setIdentifier("");
deviceField229.setLabelString("Dimensions: ");
deviceField229.setNumCols(4);
deviceField229.setOffsetNid(329);
jPanel35.add(deviceField229);
jPanel1.add(jPanel35);
jPanel36.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 32"));
deviceField69.setIdentifier("");
deviceField69.setLabelString("Value: ");
deviceField69.setNumCols(45);
deviceField69.setOffsetNid(341);
jPanel36.add(deviceField69);
deviceChoice33.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice33.setIdentifier("");
deviceChoice33.setLabelString("Type: ");
deviceChoice33.setOffsetNid(338);
deviceChoice33.setUpdateIdentifier("");
jPanel36.add(deviceChoice33);
deviceField70.setIdentifier("");
deviceField70.setLabelString("Channel: ");
deviceField70.setNumCols(15);
deviceField70.setOffsetNid(346);
deviceField70.setShowState(true);
deviceField70.setTextOnly(true);
jPanel36.add(deviceField70);
deviceField230.setIdentifier("");
deviceField230.setLabelString("Dimensions: ");
deviceField230.setNumCols(4);
deviceField230.setOffsetNid(339);
jPanel36.add(deviceField230);
jPanel1.add(jPanel36);
jPanel37.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 33"));
deviceField71.setIdentifier("");
deviceField71.setLabelString("Value: ");
deviceField71.setNumCols(45);
deviceField71.setOffsetNid(351);
jPanel37.add(deviceField71);
deviceChoice34.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice34.setIdentifier("");
deviceChoice34.setLabelString("Type: ");
deviceChoice34.setOffsetNid(348);
deviceChoice34.setUpdateIdentifier("");
jPanel37.add(deviceChoice34);
deviceField72.setIdentifier("");
deviceField72.setLabelString("Channel: ");
deviceField72.setNumCols(15);
deviceField72.setOffsetNid(356);
deviceField72.setShowState(true);
deviceField72.setTextOnly(true);
jPanel37.add(deviceField72);
deviceField231.setIdentifier("");
deviceField231.setLabelString("Dimensions: ");
deviceField231.setNumCols(4);
deviceField231.setOffsetNid(349);
jPanel37.add(deviceField231);
jPanel1.add(jPanel37);
jPanel38.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 34"));
deviceField73.setIdentifier("");
deviceField73.setLabelString("Value: ");
deviceField73.setNumCols(45);
deviceField73.setOffsetNid(361);
jPanel38.add(deviceField73);
deviceChoice35.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice35.setIdentifier("");
deviceChoice35.setLabelString("Type: ");
deviceChoice35.setOffsetNid(358);
deviceChoice35.setUpdateIdentifier("");
jPanel38.add(deviceChoice35);
deviceField74.setIdentifier("");
deviceField74.setLabelString("Channel: ");
deviceField74.setNumCols(15);
deviceField74.setOffsetNid(366);
deviceField74.setShowState(true);
deviceField74.setTextOnly(true);
jPanel38.add(deviceField74);
deviceField232.setIdentifier("");
deviceField232.setLabelString("Dimensions: ");
deviceField232.setNumCols(4);
deviceField232.setOffsetNid(359);
jPanel38.add(deviceField232);
jPanel1.add(jPanel38);
jPanel39.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal35"));
deviceField75.setIdentifier("");
deviceField75.setLabelString("Value: ");
deviceField75.setNumCols(45);
deviceField75.setOffsetNid(371);
jPanel39.add(deviceField75);
deviceChoice36.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice36.setIdentifier("");
deviceChoice36.setLabelString("Type: ");
deviceChoice36.setOffsetNid(368);
deviceChoice36.setUpdateIdentifier("");
jPanel39.add(deviceChoice36);
deviceField76.setIdentifier("");
deviceField76.setLabelString("Channel: ");
deviceField76.setNumCols(15);
deviceField76.setOffsetNid(376);
deviceField76.setShowState(true);
deviceField76.setTextOnly(true);
jPanel39.add(deviceField76);
deviceField233.setIdentifier("");
deviceField233.setLabelString("Dimensions: ");
deviceField233.setNumCols(4);
deviceField233.setOffsetNid(369);
jPanel39.add(deviceField233);
jPanel1.add(jPanel39);
jPanel40.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 36"));
deviceField77.setIdentifier("");
deviceField77.setLabelString("Value: ");
deviceField77.setNumCols(45);
deviceField77.setOffsetNid(381);
jPanel40.add(deviceField77);
deviceChoice37.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice37.setIdentifier("");
deviceChoice37.setLabelString("Type: ");
deviceChoice37.setOffsetNid(378);
deviceChoice37.setUpdateIdentifier("");
jPanel40.add(deviceChoice37);
deviceField78.setIdentifier("");
deviceField78.setLabelString("Channel: ");
deviceField78.setNumCols(15);
deviceField78.setOffsetNid(386);
deviceField78.setShowState(true);
deviceField78.setTextOnly(true);
jPanel40.add(deviceField78);
deviceField234.setIdentifier("");
deviceField234.setLabelString("Dimensions: ");
deviceField234.setNumCols(4);
deviceField234.setOffsetNid(379);
jPanel40.add(deviceField234);
jPanel1.add(jPanel40);
jPanel41.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 37"));
deviceField79.setIdentifier("");
deviceField79.setLabelString("Value: ");
deviceField79.setNumCols(45);
deviceField79.setOffsetNid(391);
jPanel41.add(deviceField79);
deviceChoice38.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice38.setIdentifier("");
deviceChoice38.setLabelString("Type: ");
deviceChoice38.setOffsetNid(388);
deviceChoice38.setUpdateIdentifier("");
jPanel41.add(deviceChoice38);
deviceField80.setIdentifier("");
deviceField80.setLabelString("Channel: ");
deviceField80.setNumCols(15);
deviceField80.setOffsetNid(396);
deviceField80.setShowState(true);
deviceField80.setTextOnly(true);
jPanel41.add(deviceField80);
deviceField235.setIdentifier("");
deviceField235.setLabelString("Dimensions: ");
deviceField235.setNumCols(4);
deviceField235.setOffsetNid(389);
jPanel41.add(deviceField235);
jPanel1.add(jPanel41);
jPanel42.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 38"));
deviceField81.setIdentifier("");
deviceField81.setLabelString("Value: ");
deviceField81.setNumCols(45);
deviceField81.setOffsetNid(401);
jPanel42.add(deviceField81);
deviceChoice39.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice39.setIdentifier("");
deviceChoice39.setLabelString("Type: ");
deviceChoice39.setOffsetNid(398);
deviceChoice39.setUpdateIdentifier("");
jPanel42.add(deviceChoice39);
deviceField82.setIdentifier("");
deviceField82.setLabelString("Channel: ");
deviceField82.setNumCols(15);
deviceField82.setOffsetNid(406);
deviceField82.setShowState(true);
deviceField82.setTextOnly(true);
jPanel42.add(deviceField82);
deviceField236.setIdentifier("");
deviceField236.setLabelString("Dimensions: ");
deviceField236.setNumCols(4);
deviceField236.setOffsetNid(399);
jPanel42.add(deviceField236);
jPanel1.add(jPanel42);
jPanel43.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 40"));
deviceField83.setIdentifier("");
deviceField83.setLabelString("Value: ");
deviceField83.setNumCols(45);
deviceField83.setOffsetNid(411);
jPanel43.add(deviceField83);
deviceChoice40.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice40.setIdentifier("");
deviceChoice40.setLabelString("Type: ");
deviceChoice40.setOffsetNid(408);
deviceChoice40.setUpdateIdentifier("");
jPanel43.add(deviceChoice40);
deviceField84.setIdentifier("");
deviceField84.setLabelString("Channel: ");
deviceField84.setNumCols(15);
deviceField84.setOffsetNid(416);
deviceField84.setShowState(true);
deviceField84.setTextOnly(true);
jPanel43.add(deviceField84);
deviceField237.setIdentifier("");
deviceField237.setLabelString("Dimensions: ");
deviceField237.setNumCols(4);
deviceField237.setOffsetNid(409);
jPanel43.add(deviceField237);
jPanel1.add(jPanel43);
jPanel44.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 41"));
deviceField85.setIdentifier("");
deviceField85.setLabelString("Value: ");
deviceField85.setNumCols(45);
deviceField85.setOffsetNid(421);
jPanel44.add(deviceField85);
deviceChoice41.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice41.setIdentifier("");
deviceChoice41.setLabelString("Type: ");
deviceChoice41.setOffsetNid(418);
deviceChoice41.setUpdateIdentifier("");
jPanel44.add(deviceChoice41);
deviceField86.setIdentifier("");
deviceField86.setLabelString("Channel: ");
deviceField86.setNumCols(15);
deviceField86.setOffsetNid(426);
deviceField86.setShowState(true);
deviceField86.setTextOnly(true);
jPanel44.add(deviceField86);
deviceField238.setIdentifier("");
deviceField238.setLabelString("Dimensions: ");
deviceField238.setNumCols(4);
deviceField238.setOffsetNid(419);
jPanel44.add(deviceField238);
jPanel1.add(jPanel44);
jPanel45.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 42"));
deviceField87.setIdentifier("");
deviceField87.setLabelString("Value: ");
deviceField87.setNumCols(45);
deviceField87.setOffsetNid(431);
jPanel45.add(deviceField87);
deviceChoice42.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice42.setIdentifier("");
deviceChoice42.setLabelString("Type: ");
deviceChoice42.setOffsetNid(428);
deviceChoice42.setUpdateIdentifier("");
jPanel45.add(deviceChoice42);
deviceField88.setIdentifier("");
deviceField88.setLabelString("Channel: ");
deviceField88.setNumCols(15);
deviceField88.setOffsetNid(436);
deviceField88.setShowState(true);
deviceField88.setTextOnly(true);
jPanel45.add(deviceField88);
deviceField239.setIdentifier("");
deviceField239.setLabelString("Dimensions: ");
deviceField239.setNumCols(4);
deviceField239.setOffsetNid(429);
jPanel45.add(deviceField239);
jPanel1.add(jPanel45);
jPanel46.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 43"));
deviceField89.setIdentifier("");
deviceField89.setLabelString("Value: ");
deviceField89.setNumCols(45);
deviceField89.setOffsetNid(441);
jPanel46.add(deviceField89);
deviceChoice43.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice43.setIdentifier("");
deviceChoice43.setLabelString("Type: ");
deviceChoice43.setOffsetNid(438);
deviceChoice43.setUpdateIdentifier("");
jPanel46.add(deviceChoice43);
deviceField90.setIdentifier("");
deviceField90.setLabelString("Channel: ");
deviceField90.setNumCols(15);
deviceField90.setOffsetNid(446);
deviceField90.setShowState(true);
deviceField90.setTextOnly(true);
jPanel46.add(deviceField90);
deviceField240.setIdentifier("");
deviceField240.setLabelString("Dimensions: ");
deviceField240.setNumCols(4);
deviceField240.setOffsetNid(439);
jPanel46.add(deviceField240);
jPanel1.add(jPanel46);
jPanel47.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 44"));
deviceField91.setIdentifier("");
deviceField91.setLabelString("Value: ");
deviceField91.setNumCols(45);
deviceField91.setOffsetNid(451);
jPanel47.add(deviceField91);
deviceChoice44.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice44.setIdentifier("");
deviceChoice44.setLabelString("Type: ");
deviceChoice44.setOffsetNid(448);
deviceChoice44.setUpdateIdentifier("");
jPanel47.add(deviceChoice44);
deviceField92.setIdentifier("");
deviceField92.setLabelString("Channel: ");
deviceField92.setNumCols(15);
deviceField92.setOffsetNid(456);
deviceField92.setShowState(true);
deviceField92.setTextOnly(true);
jPanel47.add(deviceField92);
deviceField241.setIdentifier("");
deviceField241.setLabelString("Dimensions: ");
deviceField241.setNumCols(4);
deviceField241.setOffsetNid(449);
jPanel47.add(deviceField241);
jPanel1.add(jPanel47);
jPanel48.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 45"));
deviceField93.setIdentifier("");
deviceField93.setLabelString("Value: ");
deviceField93.setNumCols(45);
deviceField93.setOffsetNid(461);
jPanel48.add(deviceField93);
deviceChoice45.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice45.setIdentifier("");
deviceChoice45.setLabelString("Type: ");
deviceChoice45.setOffsetNid(458);
deviceChoice45.setUpdateIdentifier("");
jPanel48.add(deviceChoice45);
deviceField94.setIdentifier("");
deviceField94.setLabelString("Channel: ");
deviceField94.setNumCols(15);
deviceField94.setOffsetNid(466);
deviceField94.setShowState(true);
deviceField94.setTextOnly(true);
jPanel48.add(deviceField94);
deviceField242.setIdentifier("");
deviceField242.setLabelString("Dimensions: ");
deviceField242.setNumCols(4);
deviceField242.setOffsetNid(459);
jPanel48.add(deviceField242);
jPanel1.add(jPanel48);
jPanel49.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 46"));
deviceField95.setIdentifier("");
deviceField95.setLabelString("Value: ");
deviceField95.setNumCols(45);
deviceField95.setOffsetNid(471);
jPanel49.add(deviceField95);
deviceChoice46.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice46.setIdentifier("");
deviceChoice46.setLabelString("Type: ");
deviceChoice46.setOffsetNid(468);
deviceChoice46.setUpdateIdentifier("");
jPanel49.add(deviceChoice46);
deviceField96.setIdentifier("");
deviceField96.setLabelString("Channel: ");
deviceField96.setNumCols(15);
deviceField96.setOffsetNid(476);
deviceField96.setShowState(true);
deviceField96.setTextOnly(true);
jPanel49.add(deviceField96);
deviceField243.setIdentifier("");
deviceField243.setLabelString("Dimensions: ");
deviceField243.setNumCols(4);
deviceField243.setOffsetNid(469);
jPanel49.add(deviceField243);
jPanel1.add(jPanel49);
jPanel50.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 47"));
deviceField97.setIdentifier("");
deviceField97.setLabelString("Value: ");
deviceField97.setNumCols(45);
deviceField97.setOffsetNid(481);
jPanel50.add(deviceField97);
deviceChoice47.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice47.setIdentifier("");
deviceChoice47.setLabelString("Type: ");
deviceChoice47.setOffsetNid(478);
deviceChoice47.setUpdateIdentifier("");
jPanel50.add(deviceChoice47);
deviceField98.setIdentifier("");
deviceField98.setLabelString("Channel: ");
deviceField98.setNumCols(15);
deviceField98.setOffsetNid(486);
deviceField98.setShowState(true);
deviceField98.setTextOnly(true);
jPanel50.add(deviceField98);
deviceField244.setIdentifier("");
deviceField244.setLabelString("Dimensions: ");
deviceField244.setNumCols(4);
deviceField244.setOffsetNid(479);
jPanel50.add(deviceField244);
jPanel1.add(jPanel50);
jPanel51.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 48"));
deviceField99.setIdentifier("");
deviceField99.setLabelString("Value: ");
deviceField99.setNumCols(45);
deviceField99.setOffsetNid(491);
jPanel51.add(deviceField99);
deviceChoice48.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice48.setIdentifier("");
deviceChoice48.setLabelString("Type: ");
deviceChoice48.setOffsetNid(488);
deviceChoice48.setUpdateIdentifier("");
jPanel51.add(deviceChoice48);
deviceField100.setIdentifier("");
deviceField100.setLabelString("Channel: ");
deviceField100.setNumCols(15);
deviceField100.setOffsetNid(496);
deviceField100.setShowState(true);
deviceField100.setTextOnly(true);
jPanel51.add(deviceField100);
deviceField245.setIdentifier("");
deviceField245.setLabelString("Dimensions: ");
deviceField245.setNumCols(4);
deviceField245.setOffsetNid(489);
jPanel51.add(deviceField245);
jPanel1.add(jPanel51);
jPanel52.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 49"));
deviceField101.setIdentifier("");
deviceField101.setLabelString("Value: ");
deviceField101.setNumCols(45);
deviceField101.setOffsetNid(501);
jPanel52.add(deviceField101);
deviceChoice49.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice49.setIdentifier("");
deviceChoice49.setLabelString("Type: ");
deviceChoice49.setOffsetNid(498);
deviceChoice49.setUpdateIdentifier("");
jPanel52.add(deviceChoice49);
deviceField102.setIdentifier("");
deviceField102.setLabelString("Channel: ");
deviceField102.setNumCols(15);
deviceField102.setOffsetNid(506);
deviceField102.setShowState(true);
deviceField102.setTextOnly(true);
jPanel52.add(deviceField102);
deviceField246.setIdentifier("");
deviceField246.setLabelString("Dimensions: ");
deviceField246.setNumCols(4);
deviceField246.setOffsetNid(499);
jPanel52.add(deviceField246);
jPanel1.add(jPanel52);
jPanel53.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 50"));
deviceField103.setIdentifier("");
deviceField103.setLabelString("Value: ");
deviceField103.setNumCols(45);
deviceField103.setOffsetNid(511);
jPanel53.add(deviceField103);
deviceChoice50.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice50.setIdentifier("");
deviceChoice50.setLabelString("Type: ");
deviceChoice50.setOffsetNid(508);
deviceChoice50.setUpdateIdentifier("");
jPanel53.add(deviceChoice50);
deviceField104.setIdentifier("");
deviceField104.setLabelString("Channel: ");
deviceField104.setNumCols(15);
deviceField104.setOffsetNid(516);
deviceField104.setShowState(true);
deviceField104.setTextOnly(true);
jPanel53.add(deviceField104);
deviceField247.setIdentifier("");
deviceField247.setLabelString("Dimensions: ");
deviceField247.setNumCols(4);
deviceField247.setOffsetNid(509);
jPanel53.add(deviceField247);
jPanel1.add(jPanel53);
jPanel54.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 51"));
deviceField105.setIdentifier("");
deviceField105.setLabelString("Value: ");
deviceField105.setNumCols(45);
deviceField105.setOffsetNid(521);
jPanel54.add(deviceField105);
deviceChoice51.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice51.setIdentifier("");
deviceChoice51.setLabelString("Type: ");
deviceChoice51.setOffsetNid(518);
deviceChoice51.setUpdateIdentifier("");
jPanel54.add(deviceChoice51);
deviceField106.setIdentifier("");
deviceField106.setLabelString("Channel: ");
deviceField106.setNumCols(15);
deviceField106.setOffsetNid(526);
deviceField106.setShowState(true);
deviceField106.setTextOnly(true);
jPanel54.add(deviceField106);
deviceField248.setIdentifier("");
deviceField248.setLabelString("Dimensions: ");
deviceField248.setNumCols(4);
deviceField248.setOffsetNid(519);
jPanel54.add(deviceField248);
jPanel1.add(jPanel54);
jPanel55.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 52"));
deviceField107.setIdentifier("");
deviceField107.setLabelString("Value: ");
deviceField107.setNumCols(45);
deviceField107.setOffsetNid(531);
jPanel55.add(deviceField107);
deviceChoice52.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice52.setIdentifier("");
deviceChoice52.setLabelString("Type: ");
deviceChoice52.setOffsetNid(528);
deviceChoice52.setUpdateIdentifier("");
jPanel55.add(deviceChoice52);
deviceField108.setIdentifier("");
deviceField108.setLabelString("Channel: ");
deviceField108.setNumCols(15);
deviceField108.setOffsetNid(536);
deviceField108.setShowState(true);
deviceField108.setTextOnly(true);
jPanel55.add(deviceField108);
deviceField249.setIdentifier("");
deviceField249.setLabelString("Dimensions: ");
deviceField249.setNumCols(4);
deviceField249.setOffsetNid(529);
jPanel55.add(deviceField249);
jPanel1.add(jPanel55);
jPanel56.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 53"));
deviceField109.setIdentifier("");
deviceField109.setLabelString("Value: ");
deviceField109.setNumCols(45);
deviceField109.setOffsetNid(541);
jPanel56.add(deviceField109);
deviceChoice53.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice53.setIdentifier("");
deviceChoice53.setLabelString("Type: ");
deviceChoice53.setOffsetNid(538);
deviceChoice53.setUpdateIdentifier("");
jPanel56.add(deviceChoice53);
deviceField110.setIdentifier("");
deviceField110.setLabelString("Channel: ");
deviceField110.setNumCols(15);
deviceField110.setOffsetNid(546);
deviceField110.setShowState(true);
deviceField110.setTextOnly(true);
jPanel56.add(deviceField110);
deviceField250.setIdentifier("");
deviceField250.setLabelString("Dimensions: ");
deviceField250.setNumCols(4);
deviceField250.setOffsetNid(539);
jPanel56.add(deviceField250);
jPanel1.add(jPanel56);
jPanel57.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 54"));
deviceField111.setIdentifier("");
deviceField111.setLabelString("Value: ");
deviceField111.setNumCols(45);
deviceField111.setOffsetNid(551);
jPanel57.add(deviceField111);
deviceChoice54.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice54.setIdentifier("");
deviceChoice54.setLabelString("Type: ");
deviceChoice54.setOffsetNid(548);
deviceChoice54.setUpdateIdentifier("");
jPanel57.add(deviceChoice54);
deviceField112.setIdentifier("");
deviceField112.setLabelString("Channel: ");
deviceField112.setNumCols(15);
deviceField112.setOffsetNid(556);
deviceField112.setShowState(true);
deviceField112.setTextOnly(true);
jPanel57.add(deviceField112);
deviceField251.setIdentifier("");
deviceField251.setLabelString("Dimensions: ");
deviceField251.setNumCols(4);
deviceField251.setOffsetNid(549);
jPanel57.add(deviceField251);
jPanel1.add(jPanel57);
jPanel58.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 55"));
deviceField113.setIdentifier("");
deviceField113.setLabelString("Value: ");
deviceField113.setNumCols(45);
deviceField113.setOffsetNid(561);
jPanel58.add(deviceField113);
deviceChoice55.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice55.setIdentifier("");
deviceChoice55.setLabelString("Type: ");
deviceChoice55.setOffsetNid(558);
deviceChoice55.setUpdateIdentifier("");
jPanel58.add(deviceChoice55);
deviceField114.setIdentifier("");
deviceField114.setLabelString("Channel: ");
deviceField114.setNumCols(15);
deviceField114.setOffsetNid(566);
deviceField114.setShowState(true);
deviceField114.setTextOnly(true);
jPanel58.add(deviceField114);
deviceField252.setIdentifier("");
deviceField252.setLabelString("Dimensions: ");
deviceField252.setNumCols(4);
deviceField252.setOffsetNid(559);
jPanel58.add(deviceField252);
jPanel1.add(jPanel58);
jPanel59.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 56"));
deviceField115.setIdentifier("");
deviceField115.setLabelString("Value: ");
deviceField115.setNumCols(45);
deviceField115.setOffsetNid(571);
jPanel59.add(deviceField115);
deviceChoice56.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice56.setIdentifier("");
deviceChoice56.setLabelString("Type: ");
deviceChoice56.setOffsetNid(568);
deviceChoice56.setUpdateIdentifier("");
jPanel59.add(deviceChoice56);
deviceField116.setIdentifier("");
deviceField116.setLabelString("Channel: ");
deviceField116.setNumCols(15);
deviceField116.setOffsetNid(576);
deviceField116.setShowState(true);
deviceField116.setTextOnly(true);
jPanel59.add(deviceField116);
deviceField253.setIdentifier("");
deviceField253.setLabelString("Dimensions: ");
deviceField253.setNumCols(4);
deviceField253.setOffsetNid(569);
jPanel59.add(deviceField253);
jPanel1.add(jPanel59);
jPanel60.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 57"));
deviceField117.setIdentifier("");
deviceField117.setLabelString("Value: ");
deviceField117.setNumCols(45);
deviceField117.setOffsetNid(581);
jPanel60.add(deviceField117);
deviceChoice57.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice57.setIdentifier("");
deviceChoice57.setLabelString("Type: ");
deviceChoice57.setOffsetNid(578);
deviceChoice57.setUpdateIdentifier("");
jPanel60.add(deviceChoice57);
deviceField118.setIdentifier("");
deviceField118.setLabelString("Channel: ");
deviceField118.setNumCols(15);
deviceField118.setOffsetNid(586);
deviceField118.setShowState(true);
deviceField118.setTextOnly(true);
jPanel60.add(deviceField118);
deviceField254.setIdentifier("");
deviceField254.setLabelString("Dimensions: ");
deviceField254.setNumCols(4);
deviceField254.setOffsetNid(579);
jPanel60.add(deviceField254);
jPanel1.add(jPanel60);
jPanel61.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 58"));
deviceField119.setIdentifier("");
deviceField119.setLabelString("Value: ");
deviceField119.setNumCols(45);
deviceField119.setOffsetNid(591);
jPanel61.add(deviceField119);
deviceChoice58.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice58.setIdentifier("");
deviceChoice58.setLabelString("Type: ");
deviceChoice58.setOffsetNid(588);
deviceChoice58.setUpdateIdentifier("");
jPanel61.add(deviceChoice58);
deviceField120.setIdentifier("");
deviceField120.setLabelString("Channel: ");
deviceField120.setNumCols(15);
deviceField120.setOffsetNid(596);
deviceField120.setShowState(true);
deviceField120.setTextOnly(true);
jPanel61.add(deviceField120);
deviceField255.setIdentifier("");
deviceField255.setLabelString("Dimensions: ");
deviceField255.setNumCols(4);
deviceField255.setOffsetNid(589);
jPanel61.add(deviceField255);
jPanel1.add(jPanel61);
jPanel62.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 59"));
deviceField121.setIdentifier("");
deviceField121.setLabelString("Value: ");
deviceField121.setNumCols(45);
deviceField121.setOffsetNid(601);
jPanel62.add(deviceField121);
deviceChoice59.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice59.setIdentifier("");
deviceChoice59.setLabelString("Type: ");
deviceChoice59.setOffsetNid(598);
deviceChoice59.setUpdateIdentifier("");
jPanel62.add(deviceChoice59);
deviceField122.setIdentifier("");
deviceField122.setLabelString("Channel: ");
deviceField122.setNumCols(15);
deviceField122.setOffsetNid(606);
deviceField122.setShowState(true);
deviceField122.setTextOnly(true);
jPanel62.add(deviceField122);
deviceField256.setIdentifier("");
deviceField256.setLabelString("Dimensions: ");
deviceField256.setNumCols(4);
deviceField256.setOffsetNid(599);
jPanel62.add(deviceField256);
jPanel1.add(jPanel62);
jPanel63.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 60"));
deviceField123.setIdentifier("");
deviceField123.setLabelString("Value: ");
deviceField123.setNumCols(45);
deviceField123.setOffsetNid(611);
jPanel63.add(deviceField123);
deviceChoice60.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice60.setIdentifier("");
deviceChoice60.setLabelString("Type: ");
deviceChoice60.setOffsetNid(608);
deviceChoice60.setUpdateIdentifier("");
jPanel63.add(deviceChoice60);
deviceField124.setIdentifier("");
deviceField124.setLabelString("Channel: ");
deviceField124.setNumCols(15);
deviceField124.setOffsetNid(616);
deviceField124.setShowState(true);
deviceField124.setTextOnly(true);
jPanel63.add(deviceField124);
deviceField257.setIdentifier("");
deviceField257.setLabelString("Dimensions: ");
deviceField257.setNumCols(4);
deviceField257.setOffsetNid(609);
jPanel63.add(deviceField257);
jPanel1.add(jPanel63);
jPanel64.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 61"));
deviceField125.setIdentifier("");
deviceField125.setLabelString("Value: ");
deviceField125.setNumCols(45);
deviceField125.setOffsetNid(621);
jPanel64.add(deviceField125);
deviceChoice61.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice61.setIdentifier("");
deviceChoice61.setLabelString("Type: ");
deviceChoice61.setOffsetNid(618);
deviceChoice61.setUpdateIdentifier("");
jPanel64.add(deviceChoice61);
deviceField126.setIdentifier("");
deviceField126.setLabelString("Channel: ");
deviceField126.setNumCols(15);
deviceField126.setOffsetNid(626);
deviceField126.setShowState(true);
deviceField126.setTextOnly(true);
jPanel64.add(deviceField126);
deviceField258.setIdentifier("");
deviceField258.setLabelString("Dimensions: ");
deviceField258.setNumCols(4);
deviceField258.setOffsetNid(619);
jPanel64.add(deviceField258);
jPanel1.add(jPanel64);
jPanel65.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 62"));
deviceField127.setIdentifier("");
deviceField127.setLabelString("Value: ");
deviceField127.setNumCols(45);
deviceField127.setOffsetNid(631);
jPanel65.add(deviceField127);
deviceChoice62.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice62.setIdentifier("");
deviceChoice62.setLabelString("Type: ");
deviceChoice62.setOffsetNid(628);
deviceChoice62.setUpdateIdentifier("");
jPanel65.add(deviceChoice62);
deviceField128.setIdentifier("");
deviceField128.setLabelString("Channel: ");
deviceField128.setNumCols(15);
deviceField128.setOffsetNid(636);
deviceField128.setShowState(true);
deviceField128.setTextOnly(true);
jPanel65.add(deviceField128);
deviceField259.setIdentifier("");
deviceField259.setLabelString("Dimensions: ");
deviceField259.setNumCols(4);
deviceField259.setOffsetNid(629);
jPanel65.add(deviceField259);
jPanel1.add(jPanel65);
jPanel66.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 63"));
deviceField129.setIdentifier("");
deviceField129.setLabelString("Value: ");
deviceField129.setNumCols(45);
deviceField129.setOffsetNid(641);
jPanel66.add(deviceField129);
deviceChoice63.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice63.setIdentifier("");
deviceChoice63.setLabelString("Type: ");
deviceChoice63.setOffsetNid(638);
deviceChoice63.setUpdateIdentifier("");
jPanel66.add(deviceChoice63);
deviceField130.setIdentifier("");
deviceField130.setLabelString("Channel: ");
deviceField130.setNumCols(15);
deviceField130.setOffsetNid(646);
deviceField130.setShowState(true);
deviceField130.setTextOnly(true);
jPanel66.add(deviceField130);
deviceField260.setIdentifier("");
deviceField260.setLabelString("Dimensions: ");
deviceField260.setNumCols(4);
deviceField260.setOffsetNid(639);
jPanel66.add(deviceField260);
jPanel1.add(jPanel66);
jPanel67.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 64"));
deviceField131.setIdentifier("");
deviceField131.setLabelString("Value: ");
deviceField131.setNumCols(45);
deviceField131.setOffsetNid(651);
jPanel67.add(deviceField131);
deviceChoice64.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice64.setIdentifier("");
deviceChoice64.setLabelString("Type: ");
deviceChoice64.setOffsetNid(648);
deviceChoice64.setUpdateIdentifier("");
jPanel67.add(deviceChoice64);
deviceField132.setIdentifier("");
deviceField132.setLabelString("Channel: ");
deviceField132.setNumCols(15);
deviceField132.setOffsetNid(656);
deviceField132.setShowState(true);
deviceField132.setTextOnly(true);
jPanel67.add(deviceField132);
deviceField261.setIdentifier("");
deviceField261.setLabelString("Dimensions: ");
deviceField261.setNumCols(4);
deviceField261.setOffsetNid(649);
jPanel67.add(deviceField261);
jPanel1.add(jPanel67);
jPanel68.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 65"));
deviceField133.setIdentifier("");
deviceField133.setLabelString("Value: ");
deviceField133.setNumCols(45);
deviceField133.setOffsetNid(661);
jPanel68.add(deviceField133);
deviceChoice65.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice65.setIdentifier("");
deviceChoice65.setLabelString("Type: ");
deviceChoice65.setOffsetNid(658);
deviceChoice65.setUpdateIdentifier("");
jPanel68.add(deviceChoice65);
deviceField134.setIdentifier("");
deviceField134.setLabelString("Channel: ");
deviceField134.setNumCols(15);
deviceField134.setOffsetNid(666);
deviceField134.setShowState(true);
deviceField134.setTextOnly(true);
jPanel68.add(deviceField134);
deviceField262.setIdentifier("");
deviceField262.setLabelString("Dimensions: ");
deviceField262.setNumCols(4);
deviceField262.setOffsetNid(659);
jPanel68.add(deviceField262);
jPanel1.add(jPanel68);
jPanel69.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 66"));
deviceField135.setIdentifier("");
deviceField135.setLabelString("Value: ");
deviceField135.setNumCols(45);
deviceField135.setOffsetNid(671);
jPanel69.add(deviceField135);
deviceChoice66.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice66.setIdentifier("");
deviceChoice66.setLabelString("Type: ");
deviceChoice66.setOffsetNid(668);
deviceChoice66.setUpdateIdentifier("");
jPanel69.add(deviceChoice66);
deviceField136.setIdentifier("");
deviceField136.setLabelString("Channel: ");
deviceField136.setNumCols(15);
deviceField136.setOffsetNid(676);
deviceField136.setShowState(true);
deviceField136.setTextOnly(true);
jPanel69.add(deviceField136);
deviceField263.setIdentifier("");
deviceField263.setLabelString("Dimensions: ");
deviceField263.setNumCols(4);
deviceField263.setOffsetNid(669);
jPanel69.add(deviceField263);
jPanel1.add(jPanel69);
jPanel70.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 67"));
deviceField137.setIdentifier("");
deviceField137.setLabelString("Value: ");
deviceField137.setNumCols(45);
deviceField137.setOffsetNid(681);
jPanel70.add(deviceField137);
deviceChoice67.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice67.setIdentifier("");
deviceChoice67.setLabelString("Type: ");
deviceChoice67.setOffsetNid(678);
deviceChoice67.setUpdateIdentifier("");
jPanel70.add(deviceChoice67);
deviceField138.setIdentifier("");
deviceField138.setLabelString("Channel: ");
deviceField138.setNumCols(15);
deviceField138.setOffsetNid(686);
deviceField138.setShowState(true);
deviceField138.setTextOnly(true);
jPanel70.add(deviceField138);
deviceField264.setIdentifier("");
deviceField264.setLabelString("Dimensions: ");
deviceField264.setNumCols(4);
deviceField264.setOffsetNid(679);
jPanel70.add(deviceField264);
jPanel1.add(jPanel70);
jPanel71.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 68"));
deviceField139.setIdentifier("");
deviceField139.setLabelString("Value: ");
deviceField139.setNumCols(45);
deviceField139.setOffsetNid(691);
jPanel71.add(deviceField139);
deviceChoice68.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice68.setIdentifier("");
deviceChoice68.setLabelString("Type: ");
deviceChoice68.setOffsetNid(688);
deviceChoice68.setUpdateIdentifier("");
jPanel71.add(deviceChoice68);
deviceField140.setIdentifier("");
deviceField140.setLabelString("Channel: ");
deviceField140.setNumCols(15);
deviceField140.setOffsetNid(696);
deviceField140.setShowState(true);
deviceField140.setTextOnly(true);
jPanel71.add(deviceField140);
deviceField265.setIdentifier("");
deviceField265.setLabelString("Dimensions: ");
deviceField265.setNumCols(4);
deviceField265.setOffsetNid(689);
jPanel71.add(deviceField265);
jPanel1.add(jPanel71);
jPanel72.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 69"));
deviceField141.setIdentifier("");
deviceField141.setLabelString("Value: ");
deviceField141.setNumCols(45);
deviceField141.setOffsetNid(701);
jPanel72.add(deviceField141);
deviceChoice69.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice69.setIdentifier("");
deviceChoice69.setLabelString("Type: ");
deviceChoice69.setOffsetNid(698);
deviceChoice69.setUpdateIdentifier("");
jPanel72.add(deviceChoice69);
deviceField142.setIdentifier("");
deviceField142.setLabelString("Channel: ");
deviceField142.setNumCols(15);
deviceField142.setOffsetNid(706);
deviceField142.setShowState(true);
deviceField142.setTextOnly(true);
jPanel72.add(deviceField142);
deviceField266.setIdentifier("");
deviceField266.setLabelString("Dimensions: ");
deviceField266.setNumCols(4);
deviceField266.setOffsetNid(699);
jPanel72.add(deviceField266);
jPanel1.add(jPanel72);
jPanel73.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 70"));
deviceField143.setIdentifier("");
deviceField143.setLabelString("Value: ");
deviceField143.setNumCols(45);
deviceField143.setOffsetNid(711);
jPanel73.add(deviceField143);
deviceChoice70.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice70.setIdentifier("");
deviceChoice70.setLabelString("Type: ");
deviceChoice70.setOffsetNid(708);
deviceChoice70.setUpdateIdentifier("");
jPanel73.add(deviceChoice70);
deviceField144.setIdentifier("");
deviceField144.setLabelString("Channel: ");
deviceField144.setNumCols(15);
deviceField144.setOffsetNid(716);
deviceField144.setShowState(true);
deviceField144.setTextOnly(true);
jPanel73.add(deviceField144);
deviceField267.setIdentifier("");
deviceField267.setLabelString("Dimensions: ");
deviceField267.setNumCols(4);
deviceField267.setOffsetNid(709);
jPanel73.add(deviceField267);
jPanel1.add(jPanel73);
jPanel74.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 8"));
deviceField145.setIdentifier("");
deviceField145.setLabelString("Value: ");
deviceField145.setNumCols(45);
deviceField145.setOffsetNid(721);
jPanel74.add(deviceField145);
deviceChoice71.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice71.setIdentifier("");
deviceChoice71.setLabelString("Type: ");
deviceChoice71.setOffsetNid(718);
deviceChoice71.setUpdateIdentifier("");
jPanel74.add(deviceChoice71);
deviceField146.setIdentifier("");
deviceField146.setLabelString("Channel: ");
deviceField146.setNumCols(15);
deviceField146.setOffsetNid(726);
deviceField146.setShowState(true);
deviceField146.setTextOnly(true);
jPanel74.add(deviceField146);
deviceField268.setIdentifier("");
deviceField268.setLabelString("Dimensions: ");
deviceField268.setNumCols(4);
deviceField268.setOffsetNid(719);
jPanel74.add(deviceField268);
jPanel1.add(jPanel74);
jPanel75.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 71"));
deviceField147.setIdentifier("");
deviceField147.setLabelString("Value: ");
deviceField147.setNumCols(45);
deviceField147.setOffsetNid(731);
jPanel75.add(deviceField147);
deviceChoice72.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice72.setIdentifier("");
deviceChoice72.setLabelString("Type: ");
deviceChoice72.setOffsetNid(728);
deviceChoice72.setUpdateIdentifier("");
jPanel75.add(deviceChoice72);
deviceField148.setIdentifier("");
deviceField148.setLabelString("Channel: ");
deviceField148.setNumCols(15);
deviceField148.setOffsetNid(736);
deviceField148.setShowState(true);
deviceField148.setTextOnly(true);
jPanel75.add(deviceField148);
deviceField269.setIdentifier("");
deviceField269.setLabelString("Dimensions: ");
deviceField269.setNumCols(4);
deviceField269.setOffsetNid(729);
jPanel75.add(deviceField269);
jPanel1.add(jPanel75);
jPanel76.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 72"));
deviceField149.setIdentifier("");
deviceField149.setLabelString("Value: ");
deviceField149.setNumCols(45);
deviceField149.setOffsetNid(741);
jPanel76.add(deviceField149);
deviceChoice73.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice73.setIdentifier("");
deviceChoice73.setLabelString("Type: ");
deviceChoice73.setOffsetNid(738);
deviceChoice73.setUpdateIdentifier("");
jPanel76.add(deviceChoice73);
deviceField150.setIdentifier("");
deviceField150.setLabelString("Channel: ");
deviceField150.setNumCols(15);
deviceField150.setOffsetNid(746);
deviceField150.setShowState(true);
deviceField150.setTextOnly(true);
jPanel76.add(deviceField150);
deviceField270.setIdentifier("");
deviceField270.setLabelString("Dimensions: ");
deviceField270.setNumCols(4);
deviceField270.setOffsetNid(739);
jPanel76.add(deviceField270);
jPanel1.add(jPanel76);
jPanel77.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 73"));
deviceField151.setIdentifier("");
deviceField151.setLabelString("Value: ");
deviceField151.setNumCols(45);
deviceField151.setOffsetNid(751);
jPanel77.add(deviceField151);
deviceChoice74.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice74.setIdentifier("");
deviceChoice74.setLabelString("Type: ");
deviceChoice74.setOffsetNid(748);
deviceChoice74.setUpdateIdentifier("");
jPanel77.add(deviceChoice74);
deviceField152.setIdentifier("");
deviceField152.setLabelString("Channel: ");
deviceField152.setNumCols(15);
deviceField152.setOffsetNid(756);
deviceField152.setShowState(true);
deviceField152.setTextOnly(true);
jPanel77.add(deviceField152);
deviceField271.setIdentifier("");
deviceField271.setLabelString("Dimensions: ");
deviceField271.setNumCols(4);
deviceField271.setOffsetNid(749);
jPanel77.add(deviceField271);
jPanel1.add(jPanel77);
jPanel78.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 74"));
deviceField153.setIdentifier("");
deviceField153.setLabelString("Value: ");
deviceField153.setNumCols(45);
deviceField153.setOffsetNid(761);
jPanel78.add(deviceField153);
deviceChoice75.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice75.setIdentifier("");
deviceChoice75.setLabelString("Type: ");
deviceChoice75.setOffsetNid(758);
deviceChoice75.setUpdateIdentifier("");
jPanel78.add(deviceChoice75);
deviceField154.setIdentifier("");
deviceField154.setLabelString("Channel: ");
deviceField154.setNumCols(15);
deviceField154.setOffsetNid(766);
deviceField154.setShowState(true);
deviceField154.setTextOnly(true);
jPanel78.add(deviceField154);
deviceField272.setIdentifier("");
deviceField272.setLabelString("Dimensions: ");
deviceField272.setNumCols(4);
deviceField272.setOffsetNid(759);
jPanel78.add(deviceField272);
jPanel1.add(jPanel78);
jPanel79.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 75"));
deviceField155.setIdentifier("");
deviceField155.setLabelString("Value: ");
deviceField155.setNumCols(45);
deviceField155.setOffsetNid(771);
jPanel79.add(deviceField155);
deviceChoice76.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice76.setIdentifier("");
deviceChoice76.setLabelString("Type: ");
deviceChoice76.setOffsetNid(768);
deviceChoice76.setUpdateIdentifier("");
jPanel79.add(deviceChoice76);
deviceField156.setIdentifier("");
deviceField156.setLabelString("Channel: ");
deviceField156.setNumCols(15);
deviceField156.setOffsetNid(776);
deviceField156.setShowState(true);
deviceField156.setTextOnly(true);
jPanel79.add(deviceField156);
deviceField273.setIdentifier("");
deviceField273.setLabelString("Dimensions: ");
deviceField273.setNumCols(4);
deviceField273.setOffsetNid(769);
jPanel79.add(deviceField273);
jPanel1.add(jPanel79);
jPanel80.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 76"));
deviceField157.setIdentifier("");
deviceField157.setLabelString("Value: ");
deviceField157.setNumCols(45);
deviceField157.setOffsetNid(781);
jPanel80.add(deviceField157);
deviceChoice77.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice77.setIdentifier("");
deviceChoice77.setLabelString("Type: ");
deviceChoice77.setOffsetNid(778);
deviceChoice77.setUpdateIdentifier("");
jPanel80.add(deviceChoice77);
deviceField158.setIdentifier("");
deviceField158.setLabelString("Channel: ");
deviceField158.setNumCols(15);
deviceField158.setOffsetNid(786);
deviceField158.setShowState(true);
deviceField158.setTextOnly(true);
jPanel80.add(deviceField158);
deviceField274.setIdentifier("");
deviceField274.setLabelString("Dimensions: ");
deviceField274.setNumCols(4);
deviceField274.setOffsetNid(779);
jPanel80.add(deviceField274);
jPanel1.add(jPanel80);
jPanel81.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 77"));
deviceField159.setIdentifier("");
deviceField159.setLabelString("Value: ");
deviceField159.setNumCols(45);
deviceField159.setOffsetNid(791);
jPanel81.add(deviceField159);
deviceChoice78.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice78.setIdentifier("");
deviceChoice78.setLabelString("Type: ");
deviceChoice78.setOffsetNid(788);
deviceChoice78.setUpdateIdentifier("");
jPanel81.add(deviceChoice78);
deviceField160.setIdentifier("");
deviceField160.setLabelString("Channel: ");
deviceField160.setNumCols(15);
deviceField160.setOffsetNid(796);
deviceField160.setShowState(true);
deviceField160.setTextOnly(true);
jPanel81.add(deviceField160);
deviceField275.setIdentifier("");
deviceField275.setLabelString("Dimensions: ");
deviceField275.setNumCols(4);
deviceField275.setOffsetNid(789);
jPanel81.add(deviceField275);
jPanel1.add(jPanel81);
jPanel82.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 78"));
deviceField161.setIdentifier("");
deviceField161.setLabelString("Value: ");
deviceField161.setNumCols(45);
deviceField161.setOffsetNid(801);
jPanel82.add(deviceField161);
deviceChoice79.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice79.setIdentifier("");
deviceChoice79.setLabelString("Type: ");
deviceChoice79.setOffsetNid(798);
deviceChoice79.setUpdateIdentifier("");
jPanel82.add(deviceChoice79);
deviceField162.setIdentifier("");
deviceField162.setLabelString("Channel: ");
deviceField162.setNumCols(15);
deviceField162.setOffsetNid(806);
deviceField162.setShowState(true);
deviceField162.setTextOnly(true);
jPanel82.add(deviceField162);
deviceField276.setIdentifier("");
deviceField276.setLabelString("Dimensions: ");
deviceField276.setNumCols(4);
deviceField276.setOffsetNid(799);
jPanel82.add(deviceField276);
jPanel1.add(jPanel82);
jPanel83.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 79"));
deviceField163.setIdentifier("");
deviceField163.setLabelString("Value: ");
deviceField163.setNumCols(45);
deviceField163.setOffsetNid(811);
jPanel83.add(deviceField163);
deviceChoice80.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice80.setIdentifier("");
deviceChoice80.setLabelString("Type: ");
deviceChoice80.setOffsetNid(808);
deviceChoice80.setUpdateIdentifier("");
jPanel83.add(deviceChoice80);
deviceField164.setIdentifier("");
deviceField164.setLabelString("Channel: ");
deviceField164.setNumCols(15);
deviceField164.setOffsetNid(816);
deviceField164.setShowState(true);
deviceField164.setTextOnly(true);
jPanel83.add(deviceField164);
deviceField277.setIdentifier("");
deviceField277.setLabelString("Dimensions: ");
deviceField277.setNumCols(4);
deviceField277.setOffsetNid(809);
jPanel83.add(deviceField277);
jPanel1.add(jPanel83);
jPanel84.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 80"));
deviceField165.setIdentifier("");
deviceField165.setLabelString("Value: ");
deviceField165.setNumCols(45);
deviceField165.setOffsetNid(821);
jPanel84.add(deviceField165);
deviceChoice81.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice81.setIdentifier("");
deviceChoice81.setLabelString("Type: ");
deviceChoice81.setOffsetNid(818);
deviceChoice81.setUpdateIdentifier("");
jPanel84.add(deviceChoice81);
deviceField166.setIdentifier("");
deviceField166.setLabelString("Channel: ");
deviceField166.setNumCols(15);
deviceField166.setOffsetNid(826);
deviceField166.setShowState(true);
deviceField166.setTextOnly(true);
jPanel84.add(deviceField166);
deviceField278.setIdentifier("");
deviceField278.setLabelString("Dimensions: ");
deviceField278.setNumCols(4);
deviceField278.setOffsetNid(819);
jPanel84.add(deviceField278);
jPanel1.add(jPanel84);
jPanel85.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 8"));
deviceField167.setIdentifier("");
deviceField167.setLabelString("Value: ");
deviceField167.setNumCols(45);
deviceField167.setOffsetNid(831);
jPanel85.add(deviceField167);
deviceChoice82.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice82.setIdentifier("");
deviceChoice82.setLabelString("Type: ");
deviceChoice82.setOffsetNid(828);
deviceChoice82.setUpdateIdentifier("");
jPanel85.add(deviceChoice82);
deviceField168.setIdentifier("");
deviceField168.setLabelString("Channel: ");
deviceField168.setNumCols(15);
deviceField168.setOffsetNid(836);
deviceField168.setShowState(true);
deviceField168.setTextOnly(true);
jPanel85.add(deviceField168);
deviceField279.setIdentifier("");
deviceField279.setLabelString("Dimensions: ");
deviceField279.setNumCols(4);
deviceField279.setOffsetNid(829);
jPanel85.add(deviceField279);
jPanel1.add(jPanel85);
jPanel86.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 81"));
deviceField169.setIdentifier("");
deviceField169.setLabelString("Value: ");
deviceField169.setNumCols(45);
deviceField169.setOffsetNid(841);
jPanel86.add(deviceField169);
deviceChoice83.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice83.setIdentifier("");
deviceChoice83.setLabelString("Type: ");
deviceChoice83.setOffsetNid(838);
deviceChoice83.setUpdateIdentifier("");
jPanel86.add(deviceChoice83);
deviceField170.setIdentifier("");
deviceField170.setLabelString("Channel: ");
deviceField170.setNumCols(15);
deviceField170.setOffsetNid(846);
deviceField170.setShowState(true);
deviceField170.setTextOnly(true);
jPanel86.add(deviceField170);
deviceField280.setIdentifier("");
deviceField280.setLabelString("Dimensions: ");
deviceField280.setNumCols(4);
deviceField280.setOffsetNid(839);
jPanel86.add(deviceField280);
jPanel1.add(jPanel86);
jPanel87.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 82"));
deviceField171.setIdentifier("");
deviceField171.setLabelString("Value: ");
deviceField171.setNumCols(45);
deviceField171.setOffsetNid(851);
jPanel87.add(deviceField171);
deviceChoice84.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice84.setIdentifier("");
deviceChoice84.setLabelString("Type: ");
deviceChoice84.setOffsetNid(848);
deviceChoice84.setUpdateIdentifier("");
jPanel87.add(deviceChoice84);
deviceField172.setIdentifier("");
deviceField172.setLabelString("Channel: ");
deviceField172.setNumCols(15);
deviceField172.setOffsetNid(856);
deviceField172.setShowState(true);
deviceField172.setTextOnly(true);
jPanel87.add(deviceField172);
deviceField281.setIdentifier("");
deviceField281.setLabelString("Dimensions: ");
deviceField281.setNumCols(4);
deviceField281.setOffsetNid(849);
jPanel87.add(deviceField281);
jPanel1.add(jPanel87);
jPanel88.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 83"));
deviceField173.setIdentifier("");
deviceField173.setLabelString("Value: ");
deviceField173.setNumCols(45);
deviceField173.setOffsetNid(861);
jPanel88.add(deviceField173);
deviceChoice85.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice85.setIdentifier("");
deviceChoice85.setLabelString("Type: ");
deviceChoice85.setOffsetNid(858);
deviceChoice85.setUpdateIdentifier("");
jPanel88.add(deviceChoice85);
deviceField174.setIdentifier("");
deviceField174.setLabelString("Channel: ");
deviceField174.setNumCols(15);
deviceField174.setOffsetNid(866);
deviceField174.setShowState(true);
deviceField174.setTextOnly(true);
jPanel88.add(deviceField174);
deviceField282.setIdentifier("");
deviceField282.setLabelString("Dimensions: ");
deviceField282.setNumCols(4);
deviceField282.setOffsetNid(859);
jPanel88.add(deviceField282);
jPanel1.add(jPanel88);
jPanel89.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 84"));
deviceField175.setIdentifier("");
deviceField175.setLabelString("Value: ");
deviceField175.setNumCols(45);
deviceField175.setOffsetNid(871);
jPanel89.add(deviceField175);
deviceChoice86.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice86.setIdentifier("");
deviceChoice86.setLabelString("Type: ");
deviceChoice86.setOffsetNid(868);
deviceChoice86.setUpdateIdentifier("");
jPanel89.add(deviceChoice86);
deviceField176.setIdentifier("");
deviceField176.setLabelString("Channel: ");
deviceField176.setNumCols(15);
deviceField176.setOffsetNid(876);
deviceField176.setShowState(true);
deviceField176.setTextOnly(true);
jPanel89.add(deviceField176);
deviceField283.setIdentifier("");
deviceField283.setLabelString("Dimensions: ");
deviceField283.setNumCols(4);
deviceField283.setOffsetNid(869);
jPanel89.add(deviceField283);
jPanel1.add(jPanel89);
jPanel90.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 85"));
deviceField177.setIdentifier("");
deviceField177.setLabelString("Value: ");
deviceField177.setNumCols(45);
deviceField177.setOffsetNid(881);
jPanel90.add(deviceField177);
deviceChoice87.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice87.setIdentifier("");
deviceChoice87.setLabelString("Type: ");
deviceChoice87.setOffsetNid(878);
deviceChoice87.setUpdateIdentifier("");
jPanel90.add(deviceChoice87);
deviceField178.setIdentifier("");
deviceField178.setLabelString("Channel: ");
deviceField178.setNumCols(15);
deviceField178.setOffsetNid(886);
deviceField178.setShowState(true);
deviceField178.setTextOnly(true);
jPanel90.add(deviceField178);
deviceField284.setIdentifier("");
deviceField284.setLabelString("Dimensions: ");
deviceField284.setNumCols(4);
deviceField284.setOffsetNid(879);
jPanel90.add(deviceField284);
jPanel1.add(jPanel90);
jPanel91.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 86"));
deviceField179.setIdentifier("");
deviceField179.setLabelString("Value: ");
deviceField179.setNumCols(45);
deviceField179.setOffsetNid(891);
jPanel91.add(deviceField179);
deviceChoice88.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice88.setIdentifier("");
deviceChoice88.setLabelString("Type: ");
deviceChoice88.setOffsetNid(888);
deviceChoice88.setUpdateIdentifier("");
jPanel91.add(deviceChoice88);
deviceField180.setIdentifier("");
deviceField180.setLabelString("Channel: ");
deviceField180.setNumCols(15);
deviceField180.setOffsetNid(896);
deviceField180.setShowState(true);
deviceField180.setTextOnly(true);
jPanel91.add(deviceField180);
deviceField285.setIdentifier("");
deviceField285.setLabelString("Dimensions: ");
deviceField285.setNumCols(4);
deviceField285.setOffsetNid(889);
jPanel91.add(deviceField285);
jPanel1.add(jPanel91);
jPanel92.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 87"));
deviceField181.setIdentifier("");
deviceField181.setLabelString("Value: ");
deviceField181.setNumCols(45);
deviceField181.setOffsetNid(901);
jPanel92.add(deviceField181);
deviceChoice89.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice89.setIdentifier("");
deviceChoice89.setLabelString("Type: ");
deviceChoice89.setOffsetNid(898);
deviceChoice89.setUpdateIdentifier("");
jPanel92.add(deviceChoice89);
deviceField182.setIdentifier("");
deviceField182.setLabelString("Channel: ");
deviceField182.setNumCols(15);
deviceField182.setOffsetNid(906);
deviceField182.setShowState(true);
deviceField182.setTextOnly(true);
jPanel92.add(deviceField182);
deviceField286.setIdentifier("");
deviceField286.setLabelString("Dimensions: ");
deviceField286.setNumCols(4);
deviceField286.setOffsetNid(899);
jPanel92.add(deviceField286);
jPanel1.add(jPanel92);
jPanel93.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 88"));
deviceField183.setIdentifier("");
deviceField183.setLabelString("Value: ");
deviceField183.setNumCols(45);
deviceField183.setOffsetNid(911);
jPanel93.add(deviceField183);
deviceChoice90.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice90.setIdentifier("");
deviceChoice90.setLabelString("Type: ");
deviceChoice90.setOffsetNid(908);
deviceChoice90.setUpdateIdentifier("");
jPanel93.add(deviceChoice90);
deviceField184.setIdentifier("");
deviceField184.setLabelString("Channel: ");
deviceField184.setNumCols(15);
deviceField184.setOffsetNid(916);
deviceField184.setShowState(true);
deviceField184.setTextOnly(true);
jPanel93.add(deviceField184);
deviceField287.setIdentifier("");
deviceField287.setLabelString("Dimensions: ");
deviceField287.setNumCols(4);
deviceField287.setOffsetNid(909);
jPanel93.add(deviceField287);
jPanel1.add(jPanel93);
jPanel94.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 89"));
deviceField185.setIdentifier("");
deviceField185.setLabelString("Value: ");
deviceField185.setNumCols(45);
deviceField185.setOffsetNid(921);
jPanel94.add(deviceField185);
deviceChoice91.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice91.setIdentifier("");
deviceChoice91.setLabelString("Type: ");
deviceChoice91.setOffsetNid(918);
deviceChoice91.setUpdateIdentifier("");
jPanel94.add(deviceChoice91);
deviceField186.setIdentifier("");
deviceField186.setLabelString("Channel: ");
deviceField186.setNumCols(15);
deviceField186.setOffsetNid(926);
deviceField186.setShowState(true);
deviceField186.setTextOnly(true);
jPanel94.add(deviceField186);
deviceField288.setIdentifier("");
deviceField288.setLabelString("Dimensions: ");
deviceField288.setNumCols(4);
deviceField288.setOffsetNid(919);
jPanel94.add(deviceField288);
jPanel1.add(jPanel94);
jPanel95.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 90"));
deviceField187.setIdentifier("");
deviceField187.setLabelString("Value: ");
deviceField187.setNumCols(45);
deviceField187.setOffsetNid(931);
jPanel95.add(deviceField187);
deviceChoice92.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice92.setIdentifier("");
deviceChoice92.setLabelString("Type: ");
deviceChoice92.setOffsetNid(928);
deviceChoice92.setUpdateIdentifier("");
jPanel95.add(deviceChoice92);
deviceField188.setIdentifier("");
deviceField188.setLabelString("Channel: ");
deviceField188.setNumCols(15);
deviceField188.setOffsetNid(936);
deviceField188.setShowState(true);
deviceField188.setTextOnly(true);
jPanel95.add(deviceField188);
deviceField289.setIdentifier("");
deviceField289.setLabelString("Dimensions: ");
deviceField289.setNumCols(4);
deviceField289.setOffsetNid(929);
jPanel95.add(deviceField289);
jPanel1.add(jPanel95);
jPanel96.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 91"));
deviceField189.setIdentifier("");
deviceField189.setLabelString("Value: ");
deviceField189.setNumCols(45);
deviceField189.setOffsetNid(941);
jPanel96.add(deviceField189);
deviceChoice93.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice93.setIdentifier("");
deviceChoice93.setLabelString("Type: ");
deviceChoice93.setOffsetNid(938);
deviceChoice93.setUpdateIdentifier("");
jPanel96.add(deviceChoice93);
deviceField190.setIdentifier("");
deviceField190.setLabelString("Channel: ");
deviceField190.setNumCols(15);
deviceField190.setOffsetNid(946);
deviceField190.setShowState(true);
deviceField190.setTextOnly(true);
jPanel96.add(deviceField190);
deviceField290.setIdentifier("");
deviceField290.setLabelString("Dimensions: ");
deviceField290.setNumCols(4);
deviceField290.setOffsetNid(939);
jPanel96.add(deviceField290);
jPanel1.add(jPanel96);
jPanel97.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 92"));
deviceField191.setIdentifier("");
deviceField191.setLabelString("Value: ");
deviceField191.setNumCols(45);
deviceField191.setOffsetNid(951);
jPanel97.add(deviceField191);
deviceChoice94.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice94.setIdentifier("");
deviceChoice94.setLabelString("Type: ");
deviceChoice94.setOffsetNid(948);
deviceChoice94.setUpdateIdentifier("");
jPanel97.add(deviceChoice94);
deviceField192.setIdentifier("");
deviceField192.setLabelString("Channel: ");
deviceField192.setNumCols(15);
deviceField192.setOffsetNid(956);
deviceField192.setShowState(true);
deviceField192.setTextOnly(true);
jPanel97.add(deviceField192);
deviceField291.setIdentifier("");
deviceField291.setLabelString("Dimensions: ");
deviceField291.setNumCols(4);
deviceField291.setOffsetNid(949);
jPanel97.add(deviceField291);
jPanel1.add(jPanel97);
jPanel98.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 93"));
deviceField193.setIdentifier("");
deviceField193.setLabelString("Value: ");
deviceField193.setNumCols(45);
deviceField193.setOffsetNid(961);
jPanel98.add(deviceField193);
deviceChoice95.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice95.setIdentifier("");
deviceChoice95.setLabelString("Type: ");
deviceChoice95.setOffsetNid(958);
deviceChoice95.setUpdateIdentifier("");
jPanel98.add(deviceChoice95);
deviceField194.setIdentifier("");
deviceField194.setLabelString("Channel: ");
deviceField194.setNumCols(15);
deviceField194.setOffsetNid(966);
deviceField194.setShowState(true);
deviceField194.setTextOnly(true);
jPanel98.add(deviceField194);
deviceField292.setIdentifier("");
deviceField292.setLabelString("Dimensions: ");
deviceField292.setNumCols(4);
deviceField292.setOffsetNid(959);
jPanel98.add(deviceField292);
jPanel1.add(jPanel98);
jPanel99.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 94"));
deviceField195.setIdentifier("");
deviceField195.setLabelString("Value: ");
deviceField195.setNumCols(45);
deviceField195.setOffsetNid(971);
jPanel99.add(deviceField195);
deviceChoice96.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice96.setIdentifier("");
deviceChoice96.setLabelString("Type: ");
deviceChoice96.setOffsetNid(968);
deviceChoice96.setUpdateIdentifier("");
jPanel99.add(deviceChoice96);
deviceField196.setIdentifier("");
deviceField196.setLabelString("Channel: ");
deviceField196.setNumCols(15);
deviceField196.setOffsetNid(976);
deviceField196.setShowState(true);
deviceField196.setTextOnly(true);
jPanel99.add(deviceField196);
deviceField293.setIdentifier("");
deviceField293.setLabelString("Dimensions: ");
deviceField293.setNumCols(4);
deviceField293.setOffsetNid(969);
jPanel99.add(deviceField293);
jPanel1.add(jPanel99);
jPanel100.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 95"));
deviceField197.setIdentifier("");
deviceField197.setLabelString("Value: ");
deviceField197.setNumCols(45);
deviceField197.setOffsetNid(981);
jPanel100.add(deviceField197);
deviceChoice97.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice97.setIdentifier("");
deviceChoice97.setLabelString("Type: ");
deviceChoice97.setOffsetNid(978);
deviceChoice97.setUpdateIdentifier("");
jPanel100.add(deviceChoice97);
deviceField198.setIdentifier("");
deviceField198.setLabelString("Channel: ");
deviceField198.setNumCols(15);
deviceField198.setOffsetNid(986);
deviceField198.setShowState(true);
deviceField198.setTextOnly(true);
jPanel100.add(deviceField198);
deviceField294.setIdentifier("");
deviceField294.setLabelString("Dimensions: ");
deviceField294.setNumCols(4);
deviceField294.setOffsetNid(979);
jPanel100.add(deviceField294);
jPanel1.add(jPanel100);
jPanel101.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 96"));
deviceField295.setIdentifier("");
deviceField295.setLabelString("Value: ");
deviceField295.setNumCols(45);
deviceField295.setOffsetNid(991);
jPanel101.add(deviceField295);
deviceChoice98.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice98.setIdentifier("");
deviceChoice98.setLabelString("Type: ");
deviceChoice98.setOffsetNid(988);
deviceChoice98.setUpdateIdentifier("");
jPanel101.add(deviceChoice98);
deviceField296.setIdentifier("");
deviceField296.setLabelString("Channel: ");
deviceField296.setNumCols(15);
deviceField296.setOffsetNid(996);
deviceField296.setShowState(true);
deviceField296.setTextOnly(true);
jPanel101.add(deviceField296);
deviceField297.setIdentifier("");
deviceField297.setLabelString("Dimensions: ");
deviceField297.setNumCols(4);
deviceField297.setOffsetNid(989);
jPanel101.add(deviceField297);
jPanel1.add(jPanel101);
jPanel102.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 97"));
deviceField298.setIdentifier("");
deviceField298.setLabelString("Value: ");
deviceField298.setNumCols(45);
deviceField298.setOffsetNid(1001);
jPanel102.add(deviceField298);
deviceChoice99.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice99.setIdentifier("");
deviceChoice99.setLabelString("Type: ");
deviceChoice99.setOffsetNid(998);
deviceChoice99.setUpdateIdentifier("");
jPanel102.add(deviceChoice99);
deviceField299.setIdentifier("");
deviceField299.setLabelString("Channel: ");
deviceField299.setNumCols(15);
deviceField299.setOffsetNid(1006);
deviceField299.setShowState(true);
deviceField299.setTextOnly(true);
jPanel102.add(deviceField299);
deviceField300.setIdentifier("");
deviceField300.setLabelString("Dimensions: ");
deviceField300.setNumCols(4);
deviceField300.setOffsetNid(999);
jPanel102.add(deviceField300);
jPanel1.add(jPanel102);
jPanel103.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 98"));
deviceField301.setIdentifier("");
deviceField301.setLabelString("Value: ");
deviceField301.setNumCols(45);
deviceField301.setOffsetNid(1011);
jPanel103.add(deviceField301);
deviceChoice100.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice100.setIdentifier("");
deviceChoice100.setLabelString("Type: ");
deviceChoice100.setOffsetNid(1008);
deviceChoice100.setUpdateIdentifier("");
jPanel103.add(deviceChoice100);
deviceField302.setIdentifier("");
deviceField302.setLabelString("Channel: ");
deviceField302.setNumCols(15);
deviceField302.setOffsetNid(1016);
deviceField302.setShowState(true);
deviceField302.setTextOnly(true);
jPanel103.add(deviceField302);
deviceField303.setIdentifier("");
deviceField303.setLabelString("Dimensions: ");
deviceField303.setNumCols(4);
deviceField303.setOffsetNid(1009);
jPanel103.add(deviceField303);
jPanel1.add(jPanel103);
jPanel104.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 99"));
deviceField304.setIdentifier("");
deviceField304.setLabelString("Value: ");
deviceField304.setNumCols(45);
deviceField304.setOffsetNid(1021);
jPanel104.add(deviceField304);
deviceChoice101.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice101.setIdentifier("");
deviceChoice101.setLabelString("Type: ");
deviceChoice101.setOffsetNid(1018);
deviceChoice101.setUpdateIdentifier("");
jPanel104.add(deviceChoice101);
deviceField305.setIdentifier("");
deviceField305.setLabelString("Channel: ");
deviceField305.setNumCols(15);
deviceField305.setOffsetNid(1026);
deviceField305.setShowState(true);
deviceField305.setTextOnly(true);
jPanel104.add(deviceField305);
deviceField306.setIdentifier("");
deviceField306.setLabelString("Dimensions: ");
deviceField306.setNumCols(4);
deviceField306.setOffsetNid(1019);
jPanel104.add(deviceField306);
jPanel1.add(jPanel104);
jPanel105.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 8100"));
deviceField307.setIdentifier("");
deviceField307.setLabelString("Value: ");
deviceField307.setNumCols(45);
deviceField307.setOffsetNid(1031);
jPanel105.add(deviceField307);
deviceChoice102.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice102.setIdentifier("");
deviceChoice102.setLabelString("Type: ");
deviceChoice102.setOffsetNid(1028);
deviceChoice102.setUpdateIdentifier("");
jPanel105.add(deviceChoice102);
deviceField308.setIdentifier("");
deviceField308.setLabelString("Channel: ");
deviceField308.setNumCols(15);
deviceField308.setOffsetNid(1036);
deviceField308.setShowState(true);
deviceField308.setTextOnly(true);
jPanel105.add(deviceField308);
deviceField309.setIdentifier("");
deviceField309.setLabelString("Dimensions: ");
deviceField309.setNumCols(4);
deviceField309.setOffsetNid(1029);
jPanel105.add(deviceField309);
jPanel1.add(jPanel105);
jPanel106.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 101"));
deviceField310.setIdentifier("");
deviceField310.setLabelString("Value: ");
deviceField310.setNumCols(45);
deviceField310.setOffsetNid(1041);
jPanel106.add(deviceField310);
deviceChoice103.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice103.setIdentifier("");
deviceChoice103.setLabelString("Type: ");
deviceChoice103.setOffsetNid(1038);
deviceChoice103.setUpdateIdentifier("");
jPanel106.add(deviceChoice103);
deviceField311.setIdentifier("");
deviceField311.setLabelString("Channel: ");
deviceField311.setNumCols(15);
deviceField311.setOffsetNid(1046);
deviceField311.setShowState(true);
deviceField311.setTextOnly(true);
jPanel106.add(deviceField311);
deviceField312.setIdentifier("");
deviceField312.setLabelString("Dimensions: ");
deviceField312.setNumCols(4);
deviceField312.setOffsetNid(1039);
jPanel106.add(deviceField312);
jPanel1.add(jPanel106);
jPanel107.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 102"));
deviceField313.setIdentifier("");
deviceField313.setLabelString("Value: ");
deviceField313.setNumCols(45);
deviceField313.setOffsetNid(1051);
jPanel107.add(deviceField313);
deviceChoice104.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice104.setIdentifier("");
deviceChoice104.setLabelString("Type: ");
deviceChoice104.setOffsetNid(1048);
deviceChoice104.setUpdateIdentifier("");
jPanel107.add(deviceChoice104);
deviceField314.setIdentifier("");
deviceField314.setLabelString("Channel: ");
deviceField314.setNumCols(15);
deviceField314.setOffsetNid(1056);
deviceField314.setShowState(true);
deviceField314.setTextOnly(true);
jPanel107.add(deviceField314);
deviceField315.setIdentifier("");
deviceField315.setLabelString("Dimensions: ");
deviceField315.setNumCols(4);
deviceField315.setOffsetNid(1049);
jPanel107.add(deviceField315);
jPanel1.add(jPanel107);
jPanel108.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 103"));
deviceField316.setIdentifier("");
deviceField316.setLabelString("Value: ");
deviceField316.setNumCols(45);
deviceField316.setOffsetNid(1061);
jPanel108.add(deviceField316);
deviceChoice105.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice105.setIdentifier("");
deviceChoice105.setLabelString("Type: ");
deviceChoice105.setOffsetNid(1058);
deviceChoice105.setUpdateIdentifier("");
jPanel108.add(deviceChoice105);
deviceField317.setIdentifier("");
deviceField317.setLabelString("Channel: ");
deviceField317.setNumCols(15);
deviceField317.setOffsetNid(1066);
deviceField317.setShowState(true);
deviceField317.setTextOnly(true);
jPanel108.add(deviceField317);
deviceField318.setIdentifier("");
deviceField318.setLabelString("Dimensions: ");
deviceField318.setNumCols(4);
deviceField318.setOffsetNid(1059);
jPanel108.add(deviceField318);
jPanel1.add(jPanel108);
jPanel109.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 104"));
deviceField319.setIdentifier("");
deviceField319.setLabelString("Value: ");
deviceField319.setNumCols(45);
deviceField319.setOffsetNid(1071);
jPanel109.add(deviceField319);
deviceChoice106.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice106.setIdentifier("");
deviceChoice106.setLabelString("Type: ");
deviceChoice106.setOffsetNid(1068);
deviceChoice106.setUpdateIdentifier("");
jPanel109.add(deviceChoice106);
deviceField320.setIdentifier("");
deviceField320.setLabelString("Channel: ");
deviceField320.setNumCols(15);
deviceField320.setOffsetNid(1076);
deviceField320.setShowState(true);
deviceField320.setTextOnly(true);
jPanel109.add(deviceField320);
deviceField321.setIdentifier("");
deviceField321.setLabelString("Dimensions: ");
deviceField321.setNumCols(4);
deviceField321.setOffsetNid(1069);
jPanel109.add(deviceField321);
jPanel1.add(jPanel109);
jPanel110.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 105"));
deviceField322.setIdentifier("");
deviceField322.setLabelString("Value: ");
deviceField322.setNumCols(45);
deviceField322.setOffsetNid(1081);
jPanel110.add(deviceField322);
deviceChoice107.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice107.setIdentifier("");
deviceChoice107.setLabelString("Type: ");
deviceChoice107.setOffsetNid(1078);
deviceChoice107.setUpdateIdentifier("");
jPanel110.add(deviceChoice107);
deviceField323.setIdentifier("");
deviceField323.setLabelString("Channel: ");
deviceField323.setNumCols(15);
deviceField323.setOffsetNid(1086);
deviceField323.setShowState(true);
deviceField323.setTextOnly(true);
jPanel110.add(deviceField323);
deviceField324.setIdentifier("");
deviceField324.setLabelString("Dimensions: ");
deviceField324.setNumCols(4);
deviceField324.setOffsetNid(1079);
jPanel110.add(deviceField324);
jPanel1.add(jPanel110);
jPanel111.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 106"));
deviceField325.setIdentifier("");
deviceField325.setLabelString("Value: ");
deviceField325.setNumCols(45);
deviceField325.setOffsetNid(1091);
jPanel111.add(deviceField325);
deviceChoice108.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice108.setIdentifier("");
deviceChoice108.setLabelString("Type: ");
deviceChoice108.setOffsetNid(1088);
deviceChoice108.setUpdateIdentifier("");
jPanel111.add(deviceChoice108);
deviceField326.setIdentifier("");
deviceField326.setLabelString("Channel: ");
deviceField326.setNumCols(15);
deviceField326.setOffsetNid(1096);
deviceField326.setShowState(true);
deviceField326.setTextOnly(true);
jPanel111.add(deviceField326);
deviceField327.setIdentifier("");
deviceField327.setLabelString("Dimensions: ");
deviceField327.setNumCols(4);
deviceField327.setOffsetNid(1089);
jPanel111.add(deviceField327);
jPanel1.add(jPanel111);
jPanel112.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 107"));
deviceField328.setIdentifier("");
deviceField328.setLabelString("Value: ");
deviceField328.setNumCols(45);
deviceField328.setOffsetNid(1101);
jPanel112.add(deviceField328);
deviceChoice109.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice109.setIdentifier("");
deviceChoice109.setLabelString("Type: ");
deviceChoice109.setOffsetNid(1098);
deviceChoice109.setUpdateIdentifier("");
jPanel112.add(deviceChoice109);
deviceField329.setIdentifier("");
deviceField329.setLabelString("Channel: ");
deviceField329.setNumCols(15);
deviceField329.setOffsetNid(1106);
deviceField329.setShowState(true);
deviceField329.setTextOnly(true);
jPanel112.add(deviceField329);
deviceField330.setIdentifier("");
deviceField330.setLabelString("Dimensions: ");
deviceField330.setNumCols(4);
deviceField330.setOffsetNid(1099);
jPanel112.add(deviceField330);
jPanel1.add(jPanel112);
jPanel113.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 108"));
deviceField331.setIdentifier("");
deviceField331.setLabelString("Value: ");
deviceField331.setNumCols(45);
deviceField331.setOffsetNid(1111);
jPanel113.add(deviceField331);
deviceChoice110.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice110.setIdentifier("");
deviceChoice110.setLabelString("Type: ");
deviceChoice110.setOffsetNid(1108);
deviceChoice110.setUpdateIdentifier("");
jPanel113.add(deviceChoice110);
deviceField332.setIdentifier("");
deviceField332.setLabelString("Channel: ");
deviceField332.setNumCols(15);
deviceField332.setOffsetNid(1116);
deviceField332.setShowState(true);
deviceField332.setTextOnly(true);
jPanel113.add(deviceField332);
deviceField333.setIdentifier("");
deviceField333.setLabelString("Dimensions: ");
deviceField333.setNumCols(4);
deviceField333.setOffsetNid(1109);
jPanel113.add(deviceField333);
jPanel1.add(jPanel113);
jPanel114.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 109"));
deviceField334.setIdentifier("");
deviceField334.setLabelString("Value: ");
deviceField334.setNumCols(45);
deviceField334.setOffsetNid(1121);
jPanel114.add(deviceField334);
deviceChoice111.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice111.setIdentifier("");
deviceChoice111.setLabelString("Type: ");
deviceChoice111.setOffsetNid(1118);
deviceChoice111.setUpdateIdentifier("");
jPanel114.add(deviceChoice111);
deviceField335.setIdentifier("");
deviceField335.setLabelString("Channel: ");
deviceField335.setNumCols(15);
deviceField335.setOffsetNid(1126);
deviceField335.setShowState(true);
deviceField335.setTextOnly(true);
jPanel114.add(deviceField335);
deviceField336.setIdentifier("");
deviceField336.setLabelString("Dimensions: ");
deviceField336.setNumCols(4);
deviceField336.setOffsetNid(1119);
jPanel114.add(deviceField336);
jPanel1.add(jPanel114);
jPanel115.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 110"));
deviceField337.setIdentifier("");
deviceField337.setLabelString("Value: ");
deviceField337.setNumCols(45);
deviceField337.setOffsetNid(1131);
jPanel115.add(deviceField337);
deviceChoice112.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice112.setIdentifier("");
deviceChoice112.setLabelString("Type: ");
deviceChoice112.setOffsetNid(1128);
deviceChoice112.setUpdateIdentifier("");
jPanel115.add(deviceChoice112);
deviceField338.setIdentifier("");
deviceField338.setLabelString("Channel: ");
deviceField338.setNumCols(15);
deviceField338.setOffsetNid(1136);
deviceField338.setShowState(true);
deviceField338.setTextOnly(true);
jPanel115.add(deviceField338);
deviceField339.setIdentifier("");
deviceField339.setLabelString("Dimensions: ");
deviceField339.setNumCols(4);
deviceField339.setOffsetNid(1129);
jPanel115.add(deviceField339);
jPanel1.add(jPanel115);
jPanel116.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 111"));
deviceField340.setIdentifier("");
deviceField340.setLabelString("Value: ");
deviceField340.setNumCols(45);
deviceField340.setOffsetNid(1141);
jPanel116.add(deviceField340);
deviceChoice113.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice113.setIdentifier("");
deviceChoice113.setLabelString("Type: ");
deviceChoice113.setOffsetNid(1138);
deviceChoice113.setUpdateIdentifier("");
jPanel116.add(deviceChoice113);
deviceField341.setIdentifier("");
deviceField341.setLabelString("Channel: ");
deviceField341.setNumCols(15);
deviceField341.setOffsetNid(1146);
deviceField341.setShowState(true);
deviceField341.setTextOnly(true);
jPanel116.add(deviceField341);
deviceField342.setIdentifier("");
deviceField342.setLabelString("Dimensions: ");
deviceField342.setNumCols(4);
deviceField342.setOffsetNid(1139);
jPanel116.add(deviceField342);
jPanel1.add(jPanel116);
jPanel117.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 112"));
deviceField343.setIdentifier("");
deviceField343.setLabelString("Value: ");
deviceField343.setNumCols(45);
deviceField343.setOffsetNid(1151);
jPanel117.add(deviceField343);
deviceChoice114.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice114.setIdentifier("");
deviceChoice114.setLabelString("Type: ");
deviceChoice114.setOffsetNid(1148);
deviceChoice114.setUpdateIdentifier("");
jPanel117.add(deviceChoice114);
deviceField344.setIdentifier("");
deviceField344.setLabelString("Channel: ");
deviceField344.setNumCols(15);
deviceField344.setOffsetNid(1156);
deviceField344.setShowState(true);
deviceField344.setTextOnly(true);
jPanel117.add(deviceField344);
deviceField345.setIdentifier("");
deviceField345.setLabelString("Dimensions: ");
deviceField345.setNumCols(4);
deviceField345.setOffsetNid(1149);
jPanel117.add(deviceField345);
jPanel1.add(jPanel117);
jPanel118.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 113"));
deviceField346.setIdentifier("");
deviceField346.setLabelString("Value: ");
deviceField346.setNumCols(45);
deviceField346.setOffsetNid(1161);
jPanel118.add(deviceField346);
deviceChoice115.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice115.setIdentifier("");
deviceChoice115.setLabelString("Type: ");
deviceChoice115.setOffsetNid(1158);
deviceChoice115.setUpdateIdentifier("");
jPanel118.add(deviceChoice115);
deviceField347.setIdentifier("");
deviceField347.setLabelString("Channel: ");
deviceField347.setNumCols(15);
deviceField347.setOffsetNid(1166);
deviceField347.setShowState(true);
deviceField347.setTextOnly(true);
jPanel118.add(deviceField347);
deviceField348.setIdentifier("");
deviceField348.setLabelString("Dimensions: ");
deviceField348.setNumCols(4);
deviceField348.setOffsetNid(1159);
jPanel118.add(deviceField348);
jPanel1.add(jPanel118);
jPanel119.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 114"));
deviceField349.setIdentifier("");
deviceField349.setLabelString("Value: ");
deviceField349.setNumCols(45);
deviceField349.setOffsetNid(1171);
jPanel119.add(deviceField349);
deviceChoice116.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice116.setIdentifier("");
deviceChoice116.setLabelString("Type: ");
deviceChoice116.setOffsetNid(1168);
deviceChoice116.setUpdateIdentifier("");
jPanel119.add(deviceChoice116);
deviceField350.setIdentifier("");
deviceField350.setLabelString("Channel: ");
deviceField350.setNumCols(15);
deviceField350.setOffsetNid(1176);
deviceField350.setShowState(true);
deviceField350.setTextOnly(true);
jPanel119.add(deviceField350);
deviceField351.setIdentifier("");
deviceField351.setLabelString("Dimensions: ");
deviceField351.setNumCols(4);
deviceField351.setOffsetNid(1169);
jPanel119.add(deviceField351);
jPanel1.add(jPanel119);
jPanel120.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 8115"));
deviceField352.setIdentifier("");
deviceField352.setLabelString("Value: ");
deviceField352.setNumCols(45);
deviceField352.setOffsetNid(1181);
jPanel120.add(deviceField352);
deviceChoice117.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice117.setIdentifier("");
deviceChoice117.setLabelString("Type: ");
deviceChoice117.setOffsetNid(1178);
deviceChoice117.setUpdateIdentifier("");
jPanel120.add(deviceChoice117);
deviceField353.setIdentifier("");
deviceField353.setLabelString("Channel: ");
deviceField353.setNumCols(15);
deviceField353.setOffsetNid(1186);
deviceField353.setShowState(true);
deviceField353.setTextOnly(true);
jPanel120.add(deviceField353);
deviceField354.setIdentifier("");
deviceField354.setLabelString("Dimensions: ");
deviceField354.setNumCols(4);
deviceField354.setOffsetNid(1179);
jPanel120.add(deviceField354);
jPanel1.add(jPanel120);
jPanel121.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 116"));
deviceField355.setIdentifier("");
deviceField355.setLabelString("Value: ");
deviceField355.setNumCols(45);
deviceField355.setOffsetNid(1191);
jPanel121.add(deviceField355);
deviceChoice118.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice118.setIdentifier("");
deviceChoice118.setLabelString("Type: ");
deviceChoice118.setOffsetNid(1188);
deviceChoice118.setUpdateIdentifier("");
jPanel121.add(deviceChoice118);
deviceField356.setIdentifier("");
deviceField356.setLabelString("Channel: ");
deviceField356.setNumCols(15);
deviceField356.setOffsetNid(1196);
deviceField356.setShowState(true);
deviceField356.setTextOnly(true);
jPanel121.add(deviceField356);
deviceField357.setIdentifier("");
deviceField357.setLabelString("Dimensions: ");
deviceField357.setNumCols(4);
deviceField357.setOffsetNid(1189);
jPanel121.add(deviceField357);
jPanel1.add(jPanel121);
jPanel122.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 117"));
deviceField358.setIdentifier("");
deviceField358.setLabelString("Value: ");
deviceField358.setNumCols(45);
deviceField358.setOffsetNid(1201);
jPanel122.add(deviceField358);
deviceChoice119.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice119.setIdentifier("");
deviceChoice119.setLabelString("Type: ");
deviceChoice119.setOffsetNid(1198);
deviceChoice119.setUpdateIdentifier("");
jPanel122.add(deviceChoice119);
deviceField359.setIdentifier("");
deviceField359.setLabelString("Channel: ");
deviceField359.setNumCols(15);
deviceField359.setOffsetNid(1206);
deviceField359.setShowState(true);
deviceField359.setTextOnly(true);
jPanel122.add(deviceField359);
deviceField360.setIdentifier("");
deviceField360.setLabelString("Dimensions: ");
deviceField360.setNumCols(4);
deviceField360.setOffsetNid(1199);
jPanel122.add(deviceField360);
jPanel1.add(jPanel122);
jPanel123.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 118"));
deviceField361.setIdentifier("");
deviceField361.setLabelString("Value: ");
deviceField361.setNumCols(45);
deviceField361.setOffsetNid(1211);
jPanel123.add(deviceField361);
deviceChoice120.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice120.setIdentifier("");
deviceChoice120.setLabelString("Type: ");
deviceChoice120.setOffsetNid(1208);
deviceChoice120.setUpdateIdentifier("");
jPanel123.add(deviceChoice120);
deviceField362.setIdentifier("");
deviceField362.setLabelString("Channel: ");
deviceField362.setNumCols(15);
deviceField362.setOffsetNid(1216);
deviceField362.setShowState(true);
deviceField362.setTextOnly(true);
jPanel123.add(deviceField362);
deviceField363.setIdentifier("");
deviceField363.setLabelString("Dimensions: ");
deviceField363.setNumCols(4);
deviceField363.setOffsetNid(1209);
jPanel123.add(deviceField363);
jPanel1.add(jPanel123);
jPanel124.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 119"));
deviceField364.setIdentifier("");
deviceField364.setLabelString("Value: ");
deviceField364.setNumCols(45);
deviceField364.setOffsetNid(1221);
jPanel124.add(deviceField364);
deviceChoice121.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice121.setIdentifier("");
deviceChoice121.setLabelString("Type: ");
deviceChoice121.setOffsetNid(1218);
deviceChoice121.setUpdateIdentifier("");
jPanel124.add(deviceChoice121);
deviceField365.setIdentifier("");
deviceField365.setLabelString("Channel: ");
deviceField365.setNumCols(15);
deviceField365.setOffsetNid(1226);
deviceField365.setShowState(true);
deviceField365.setTextOnly(true);
jPanel124.add(deviceField365);
deviceField366.setIdentifier("");
deviceField366.setLabelString("Dimensions: ");
deviceField366.setNumCols(4);
deviceField366.setOffsetNid(1219);
jPanel124.add(deviceField366);
jPanel1.add(jPanel124);
jPanel125.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 120"));
deviceField367.setIdentifier("");
deviceField367.setLabelString("Value: ");
deviceField367.setNumCols(45);
deviceField367.setOffsetNid(1231);
jPanel125.add(deviceField367);
deviceChoice122.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice122.setIdentifier("");
deviceChoice122.setLabelString("Type: ");
deviceChoice122.setOffsetNid(1228);
deviceChoice122.setUpdateIdentifier("");
jPanel125.add(deviceChoice122);
deviceField368.setIdentifier("");
deviceField368.setLabelString("Channel: ");
deviceField368.setNumCols(15);
deviceField368.setOffsetNid(1236);
deviceField368.setShowState(true);
deviceField368.setTextOnly(true);
jPanel125.add(deviceField368);
deviceField369.setIdentifier("");
deviceField369.setLabelString("Dimensions: ");
deviceField369.setNumCols(4);
deviceField369.setOffsetNid(1229);
jPanel125.add(deviceField369);
jPanel1.add(jPanel125);
jPanel126.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 121"));
deviceField370.setIdentifier("");
deviceField370.setLabelString("Value: ");
deviceField370.setNumCols(45);
deviceField370.setOffsetNid(1241);
jPanel126.add(deviceField370);
deviceChoice123.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice123.setIdentifier("");
deviceChoice123.setLabelString("Type: ");
deviceChoice123.setOffsetNid(1238);
deviceChoice123.setUpdateIdentifier("");
jPanel126.add(deviceChoice123);
deviceField371.setIdentifier("");
deviceField371.setLabelString("Channel: ");
deviceField371.setNumCols(15);
deviceField371.setOffsetNid(1246);
deviceField371.setShowState(true);
deviceField371.setTextOnly(true);
jPanel126.add(deviceField371);
deviceField372.setIdentifier("");
deviceField372.setLabelString("Dimensions: ");
deviceField372.setNumCols(4);
deviceField372.setOffsetNid(1239);
jPanel126.add(deviceField372);
jPanel1.add(jPanel126);
jPanel127.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 122"));
deviceField373.setIdentifier("");
deviceField373.setLabelString("Value: ");
deviceField373.setNumCols(45);
deviceField373.setOffsetNid(1251);
jPanel127.add(deviceField373);
deviceChoice124.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice124.setIdentifier("");
deviceChoice124.setLabelString("Type: ");
deviceChoice124.setOffsetNid(1248);
deviceChoice124.setUpdateIdentifier("");
jPanel127.add(deviceChoice124);
deviceField374.setIdentifier("");
deviceField374.setLabelString("Channel: ");
deviceField374.setNumCols(15);
deviceField374.setOffsetNid(1256);
deviceField374.setShowState(true);
deviceField374.setTextOnly(true);
jPanel127.add(deviceField374);
deviceField375.setIdentifier("");
deviceField375.setLabelString("Dimensions: ");
deviceField375.setNumCols(4);
deviceField375.setOffsetNid(1249);
jPanel127.add(deviceField375);
jPanel1.add(jPanel127);
jPanel128.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 123"));
deviceField376.setIdentifier("");
deviceField376.setLabelString("Value: ");
deviceField376.setNumCols(45);
deviceField376.setOffsetNid(1261);
jPanel128.add(deviceField376);
deviceChoice125.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice125.setIdentifier("");
deviceChoice125.setLabelString("Type: ");
deviceChoice125.setOffsetNid(1258);
deviceChoice125.setUpdateIdentifier("");
jPanel128.add(deviceChoice125);
deviceField377.setIdentifier("");
deviceField377.setLabelString("Channel: ");
deviceField377.setNumCols(15);
deviceField377.setOffsetNid(1266);
deviceField377.setShowState(true);
deviceField377.setTextOnly(true);
jPanel128.add(deviceField377);
deviceField378.setIdentifier("");
deviceField378.setLabelString("Dimensions: ");
deviceField378.setNumCols(4);
deviceField378.setOffsetNid(1259);
jPanel128.add(deviceField378);
jPanel1.add(jPanel128);
jPanel129.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 124"));
deviceField379.setIdentifier("");
deviceField379.setLabelString("Value: ");
deviceField379.setNumCols(45);
deviceField379.setOffsetNid(1271);
jPanel129.add(deviceField379);
deviceChoice126.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice126.setIdentifier("");
deviceChoice126.setLabelString("Type: ");
deviceChoice126.setOffsetNid(1268);
deviceChoice126.setUpdateIdentifier("");
jPanel129.add(deviceChoice126);
deviceField380.setIdentifier("");
deviceField380.setLabelString("Channel: ");
deviceField380.setNumCols(15);
deviceField380.setOffsetNid(1276);
deviceField380.setShowState(true);
deviceField380.setTextOnly(true);
jPanel129.add(deviceField380);
deviceField381.setIdentifier("");
deviceField381.setLabelString("Dimensions: ");
deviceField381.setNumCols(4);
deviceField381.setOffsetNid(1269);
jPanel129.add(deviceField381);
jPanel1.add(jPanel129);
jPanel130.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 125"));
deviceField382.setIdentifier("");
deviceField382.setLabelString("Value: ");
deviceField382.setNumCols(45);
deviceField382.setOffsetNid(1281);
jPanel130.add(deviceField382);
deviceChoice127.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice127.setIdentifier("");
deviceChoice127.setLabelString("Type: ");
deviceChoice127.setOffsetNid(1278);
deviceChoice127.setUpdateIdentifier("");
jPanel130.add(deviceChoice127);
deviceField383.setIdentifier("");
deviceField383.setLabelString("Channel: ");
deviceField383.setNumCols(15);
deviceField383.setOffsetNid(1286);
deviceField383.setShowState(true);
deviceField383.setTextOnly(true);
jPanel130.add(deviceField383);
deviceField384.setIdentifier("");
deviceField384.setLabelString("Dimensions: ");
deviceField384.setNumCols(4);
deviceField384.setOffsetNid(1279);
jPanel130.add(deviceField384);
jPanel1.add(jPanel130);
jPanel131.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 126"));
deviceField385.setIdentifier("");
deviceField385.setLabelString("Value: ");
deviceField385.setNumCols(45);
deviceField385.setOffsetNid(1291);
jPanel131.add(deviceField385);
deviceChoice128.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice128.setIdentifier("");
deviceChoice128.setLabelString("Type: ");
deviceChoice128.setOffsetNid(1288);
deviceChoice128.setUpdateIdentifier("");
jPanel131.add(deviceChoice128);
deviceField386.setIdentifier("");
deviceField386.setLabelString("Channel: ");
deviceField386.setNumCols(15);
deviceField386.setOffsetNid(1296);
deviceField386.setShowState(true);
deviceField386.setTextOnly(true);
jPanel131.add(deviceField386);
deviceField387.setIdentifier("");
deviceField387.setLabelString("Dimensions: ");
deviceField387.setNumCols(4);
deviceField387.setOffsetNid(1289);
jPanel131.add(deviceField387);
jPanel1.add(jPanel131);
jPanel132.setBorder(javax.swing.BorderFactory.createTitledBorder("Signal 127"));
deviceField388.setIdentifier("");
deviceField388.setLabelString("Value: ");
deviceField388.setNumCols(45);
deviceField388.setOffsetNid(1301);
jPanel132.add(deviceField388);
deviceChoice129.setChoiceItems(new String[] {"float32", "float63", "int16", "int32", "uint16", "uint32"});
deviceChoice129.setIdentifier("");
deviceChoice129.setLabelString("Type: ");
deviceChoice129.setOffsetNid(1298);
deviceChoice129.setUpdateIdentifier("");
jPanel132.add(deviceChoice129);
deviceField389.setIdentifier("");
deviceField389.setLabelString("Channel: ");
deviceField389.setNumCols(15);
deviceField389.setOffsetNid(1306);
deviceField389.setShowState(true);
deviceField389.setTextOnly(true);
jPanel132.add(deviceField389);
deviceField390.setIdentifier("");
deviceField390.setLabelString("Dimensions: ");
deviceField390.setNumCols(4);
deviceField390.setOffsetNid(1299);
jPanel132.add(deviceField390);
jPanel1.add(jPanel132);
jScrollPane1.setViewportView(jPanel1);
getContentPane().add(jScrollPane1, java.awt.BorderLayout.CENTER);
getAccessibleContext().setAccessibleName("");
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private DeviceButtons deviceButtons1;
private DeviceChoice deviceChoice1;
private DeviceChoice deviceChoice10;
private DeviceChoice deviceChoice100;
private DeviceChoice deviceChoice101;
private DeviceChoice deviceChoice102;
private DeviceChoice deviceChoice103;
private DeviceChoice deviceChoice104;
private DeviceChoice deviceChoice105;
private DeviceChoice deviceChoice106;
private DeviceChoice deviceChoice107;
private DeviceChoice deviceChoice108;
private DeviceChoice deviceChoice109;
private DeviceChoice deviceChoice11;
private DeviceChoice deviceChoice110;
private DeviceChoice deviceChoice111;
private DeviceChoice deviceChoice112;
private DeviceChoice deviceChoice113;
private DeviceChoice deviceChoice114;
private DeviceChoice deviceChoice115;
private DeviceChoice deviceChoice116;
private DeviceChoice deviceChoice117;
private DeviceChoice deviceChoice118;
private DeviceChoice deviceChoice119;
private DeviceChoice deviceChoice12;
private DeviceChoice deviceChoice120;
private DeviceChoice deviceChoice121;
private DeviceChoice deviceChoice122;
private DeviceChoice deviceChoice123;
private DeviceChoice deviceChoice124;
private DeviceChoice deviceChoice125;
private DeviceChoice deviceChoice126;
private DeviceChoice deviceChoice127;
private DeviceChoice deviceChoice128;
private DeviceChoice deviceChoice129;
private DeviceChoice deviceChoice13;
private DeviceChoice deviceChoice14;
private DeviceChoice deviceChoice15;
private DeviceChoice deviceChoice16;
private DeviceChoice deviceChoice17;
private DeviceChoice deviceChoice18;
private DeviceChoice deviceChoice19;
private DeviceChoice deviceChoice2;
private DeviceChoice deviceChoice20;
private DeviceChoice deviceChoice21;
private DeviceChoice deviceChoice22;
private DeviceChoice deviceChoice23;
private DeviceChoice deviceChoice24;
private DeviceChoice deviceChoice25;
private DeviceChoice deviceChoice26;
private DeviceChoice deviceChoice27;
private DeviceChoice deviceChoice28;
private DeviceChoice deviceChoice29;
private DeviceChoice deviceChoice3;
private DeviceChoice deviceChoice30;
private DeviceChoice deviceChoice31;
private DeviceChoice deviceChoice32;
private DeviceChoice deviceChoice33;
private DeviceChoice deviceChoice34;
private DeviceChoice deviceChoice35;
private DeviceChoice deviceChoice36;
private DeviceChoice deviceChoice37;
private DeviceChoice deviceChoice38;
private DeviceChoice deviceChoice39;
private DeviceChoice deviceChoice4;
private DeviceChoice deviceChoice40;
private DeviceChoice deviceChoice41;
private DeviceChoice deviceChoice42;
private DeviceChoice deviceChoice43;
private DeviceChoice deviceChoice44;
private DeviceChoice deviceChoice45;
private DeviceChoice deviceChoice46;
private DeviceChoice deviceChoice47;
private DeviceChoice deviceChoice48;
private DeviceChoice deviceChoice49;
private DeviceChoice deviceChoice5;
private DeviceChoice deviceChoice50;
private DeviceChoice deviceChoice51;
private DeviceChoice deviceChoice52;
private DeviceChoice deviceChoice53;
private DeviceChoice deviceChoice54;
private DeviceChoice deviceChoice55;
private DeviceChoice deviceChoice56;
private DeviceChoice deviceChoice57;
private DeviceChoice deviceChoice58;
private DeviceChoice deviceChoice59;
private DeviceChoice deviceChoice6;
private DeviceChoice deviceChoice60;
private DeviceChoice deviceChoice61;
private DeviceChoice deviceChoice62;
private DeviceChoice deviceChoice63;
private DeviceChoice deviceChoice64;
private DeviceChoice deviceChoice65;
private DeviceChoice deviceChoice66;
private DeviceChoice deviceChoice67;
private DeviceChoice deviceChoice68;
private DeviceChoice deviceChoice69;
private DeviceChoice deviceChoice7;
private DeviceChoice deviceChoice70;
private DeviceChoice deviceChoice71;
private DeviceChoice deviceChoice72;
private DeviceChoice deviceChoice73;
private DeviceChoice deviceChoice74;
private DeviceChoice deviceChoice75;
private DeviceChoice deviceChoice76;
private DeviceChoice deviceChoice77;
private DeviceChoice deviceChoice78;
private DeviceChoice deviceChoice79;
private DeviceChoice deviceChoice8;
private DeviceChoice deviceChoice80;
private DeviceChoice deviceChoice81;
private DeviceChoice deviceChoice82;
private DeviceChoice deviceChoice83;
private DeviceChoice deviceChoice84;
private DeviceChoice deviceChoice85;
private DeviceChoice deviceChoice86;
private DeviceChoice deviceChoice87;
private DeviceChoice deviceChoice88;
private DeviceChoice deviceChoice89;
private DeviceChoice deviceChoice9;
private DeviceChoice deviceChoice90;
private DeviceChoice deviceChoice91;
private DeviceChoice deviceChoice92;
private DeviceChoice deviceChoice93;
private DeviceChoice deviceChoice94;
private DeviceChoice deviceChoice95;
private DeviceChoice deviceChoice96;
private DeviceChoice deviceChoice97;
private DeviceChoice deviceChoice98;
private DeviceChoice deviceChoice99;
private DeviceField deviceField1;
private DeviceField deviceField10;
private DeviceField deviceField100;
private DeviceField deviceField101;
private DeviceField deviceField102;
private DeviceField deviceField103;
private DeviceField deviceField104;
private DeviceField deviceField105;
private DeviceField deviceField106;
private DeviceField deviceField107;
private DeviceField deviceField108;
private DeviceField deviceField109;
private DeviceField deviceField11;
private DeviceField deviceField110;
private DeviceField deviceField111;
private DeviceField deviceField112;
private DeviceField deviceField113;
private DeviceField deviceField114;
private DeviceField deviceField115;
private DeviceField deviceField116;
private DeviceField deviceField117;
private DeviceField deviceField118;
private DeviceField deviceField119;
private DeviceField deviceField12;
private DeviceField deviceField120;
private DeviceField deviceField121;
private DeviceField deviceField122;
private DeviceField deviceField123;
private DeviceField deviceField124;
private DeviceField deviceField125;
private DeviceField deviceField126;
private DeviceField deviceField127;
private DeviceField deviceField128;
private DeviceField deviceField129;
private DeviceField deviceField13;
private DeviceField deviceField130;
private DeviceField deviceField131;
private DeviceField deviceField132;
private DeviceField deviceField133;
private DeviceField deviceField134;
private DeviceField deviceField135;
private DeviceField deviceField136;
private DeviceField deviceField137;
private DeviceField deviceField138;
private DeviceField deviceField139;
private DeviceField deviceField14;
private DeviceField deviceField140;
private DeviceField deviceField141;
private DeviceField deviceField142;
private DeviceField deviceField143;
private DeviceField deviceField144;
private DeviceField deviceField145;
private DeviceField deviceField146;
private DeviceField deviceField147;
private DeviceField deviceField148;
private DeviceField deviceField149;
private DeviceField deviceField15;
private DeviceField deviceField150;
private DeviceField deviceField151;
private DeviceField deviceField152;
private DeviceField deviceField153;
private DeviceField deviceField154;
private DeviceField deviceField155;
private DeviceField deviceField156;
private DeviceField deviceField157;
private DeviceField deviceField158;
private DeviceField deviceField159;
private DeviceField deviceField16;
private DeviceField deviceField160;
private DeviceField deviceField161;
private DeviceField deviceField162;
private DeviceField deviceField163;
private DeviceField deviceField164;
private DeviceField deviceField165;
private DeviceField deviceField166;
private DeviceField deviceField167;
private DeviceField deviceField168;
private DeviceField deviceField169;
private DeviceField deviceField17;
private DeviceField deviceField170;
private DeviceField deviceField171;
private DeviceField deviceField172;
private DeviceField deviceField173;
private DeviceField deviceField174;
private DeviceField deviceField175;
private DeviceField deviceField176;
private DeviceField deviceField177;
private DeviceField deviceField178;
private DeviceField deviceField179;
private DeviceField deviceField18;
private DeviceField deviceField180;
private DeviceField deviceField181;
private DeviceField deviceField182;
private DeviceField deviceField183;
private DeviceField deviceField184;
private DeviceField deviceField185;
private DeviceField deviceField186;
private DeviceField deviceField187;
private DeviceField deviceField188;
private DeviceField deviceField189;
private DeviceField deviceField19;
private DeviceField deviceField190;
private DeviceField deviceField191;
private DeviceField deviceField192;
private DeviceField deviceField193;
private DeviceField deviceField194;
private DeviceField deviceField195;
private DeviceField deviceField196;
private DeviceField deviceField197;
private DeviceField deviceField198;
private DeviceField deviceField199;
private DeviceField deviceField2;
private DeviceField deviceField20;
private DeviceField deviceField200;
private DeviceField deviceField201;
private DeviceField deviceField202;
private DeviceField deviceField203;
private DeviceField deviceField204;
private DeviceField deviceField205;
private DeviceField deviceField206;
private DeviceField deviceField207;
private DeviceField deviceField208;
private DeviceField deviceField209;
private DeviceField deviceField21;
private DeviceField deviceField210;
private DeviceField deviceField211;
private DeviceField deviceField212;
private DeviceField deviceField213;
private DeviceField deviceField214;
private DeviceField deviceField215;
private DeviceField deviceField216;
private DeviceField deviceField217;
private DeviceField deviceField218;
private DeviceField deviceField219;
private DeviceField deviceField22;
private DeviceField deviceField220;
private DeviceField deviceField221;
private DeviceField deviceField222;
private DeviceField deviceField223;
private DeviceField deviceField224;
private DeviceField deviceField225;
private DeviceField deviceField226;
private DeviceField deviceField227;
private DeviceField deviceField228;
private DeviceField deviceField229;
private DeviceField deviceField23;
private DeviceField deviceField230;
private DeviceField deviceField231;
private DeviceField deviceField232;
private DeviceField deviceField233;
private DeviceField deviceField234;
private DeviceField deviceField235;
private DeviceField deviceField236;
private DeviceField deviceField237;
private DeviceField deviceField238;
private DeviceField deviceField239;
private DeviceField deviceField24;
private DeviceField deviceField240;
private DeviceField deviceField241;
private DeviceField deviceField242;
private DeviceField deviceField243;
private DeviceField deviceField244;
private DeviceField deviceField245;
private DeviceField deviceField246;
private DeviceField deviceField247;
private DeviceField deviceField248;
private DeviceField deviceField249;
private DeviceField deviceField25;
private DeviceField deviceField250;
private DeviceField deviceField251;
private DeviceField deviceField252;
private DeviceField deviceField253;
private DeviceField deviceField254;
private DeviceField deviceField255;
private DeviceField deviceField256;
private DeviceField deviceField257;
private DeviceField deviceField258;
private DeviceField deviceField259;
private DeviceField deviceField26;
private DeviceField deviceField260;
private DeviceField deviceField261;
private DeviceField deviceField262;
private DeviceField deviceField263;
private DeviceField deviceField264;
private DeviceField deviceField265;
private DeviceField deviceField266;
private DeviceField deviceField267;
private DeviceField deviceField268;
private DeviceField deviceField269;
private DeviceField deviceField27;
private DeviceField deviceField270;
private DeviceField deviceField271;
private DeviceField deviceField272;
private DeviceField deviceField273;
private DeviceField deviceField274;
private DeviceField deviceField275;
private DeviceField deviceField276;
private DeviceField deviceField277;
private DeviceField deviceField278;
private DeviceField deviceField279;
private DeviceField deviceField28;
private DeviceField deviceField280;
private DeviceField deviceField281;
private DeviceField deviceField282;
private DeviceField deviceField283;
private DeviceField deviceField284;
private DeviceField deviceField285;
private DeviceField deviceField286;
private DeviceField deviceField287;
private DeviceField deviceField288;
private DeviceField deviceField289;
private DeviceField deviceField29;
private DeviceField deviceField290;
private DeviceField deviceField291;
private DeviceField deviceField292;
private DeviceField deviceField293;
private DeviceField deviceField294;
private DeviceField deviceField295;
private DeviceField deviceField296;
private DeviceField deviceField297;
private DeviceField deviceField298;
private DeviceField deviceField299;
private DeviceField deviceField3;
private DeviceField deviceField30;
private DeviceField deviceField300;
private DeviceField deviceField301;
private DeviceField deviceField302;
private DeviceField deviceField303;
private DeviceField deviceField304;
private DeviceField deviceField305;
private DeviceField deviceField306;
private DeviceField deviceField307;
private DeviceField deviceField308;
private DeviceField deviceField309;
private DeviceField deviceField31;
private DeviceField deviceField310;
private DeviceField deviceField311;
private DeviceField deviceField312;
private DeviceField deviceField313;
private DeviceField deviceField314;
private DeviceField deviceField315;
private DeviceField deviceField316;
private DeviceField deviceField317;
private DeviceField deviceField318;
private DeviceField deviceField319;
private DeviceField deviceField32;
private DeviceField deviceField320;
private DeviceField deviceField321;
private DeviceField deviceField322;
private DeviceField deviceField323;
private DeviceField deviceField324;
private DeviceField deviceField325;
private DeviceField deviceField326;
private DeviceField deviceField327;
private DeviceField deviceField328;
private DeviceField deviceField329;
private DeviceField deviceField33;
private DeviceField deviceField330;
private DeviceField deviceField331;
private DeviceField deviceField332;
private DeviceField deviceField333;
private DeviceField deviceField334;
private DeviceField deviceField335;
private DeviceField deviceField336;
private DeviceField deviceField337;
private DeviceField deviceField338;
private DeviceField deviceField339;
private DeviceField deviceField34;
private DeviceField deviceField340;
private DeviceField deviceField341;
private DeviceField deviceField342;
private DeviceField deviceField343;
private DeviceField deviceField344;
private DeviceField deviceField345;
private DeviceField deviceField346;
private DeviceField deviceField347;
private DeviceField deviceField348;
private DeviceField deviceField349;
private DeviceField deviceField35;
private DeviceField deviceField350;
private DeviceField deviceField351;
private DeviceField deviceField352;
private DeviceField deviceField353;
private DeviceField deviceField354;
private DeviceField deviceField355;
private DeviceField deviceField356;
private DeviceField deviceField357;
private DeviceField deviceField358;
private DeviceField deviceField359;
private DeviceField deviceField36;
private DeviceField deviceField360;
private DeviceField deviceField361;
private DeviceField deviceField362;
private DeviceField deviceField363;
private DeviceField deviceField364;
private DeviceField deviceField365;
private DeviceField deviceField366;
private DeviceField deviceField367;
private DeviceField deviceField368;
private DeviceField deviceField369;
private DeviceField deviceField37;
private DeviceField deviceField370;
private DeviceField deviceField371;
private DeviceField deviceField372;
private DeviceField deviceField373;
private DeviceField deviceField374;
private DeviceField deviceField375;
private DeviceField deviceField376;
private DeviceField deviceField377;
private DeviceField deviceField378;
private DeviceField deviceField379;
private DeviceField deviceField38;
private DeviceField deviceField380;
private DeviceField deviceField381;
private DeviceField deviceField382;
private DeviceField deviceField383;
private DeviceField deviceField384;
private DeviceField deviceField385;
private DeviceField deviceField386;
private DeviceField deviceField387;
private DeviceField deviceField388;
private DeviceField deviceField389;
private DeviceField deviceField39;
private DeviceField deviceField390;
private DeviceField deviceField4;
private DeviceField deviceField40;
private DeviceField deviceField41;
private DeviceField deviceField42;
private DeviceField deviceField43;
private DeviceField deviceField44;
private DeviceField deviceField45;
private DeviceField deviceField46;
private DeviceField deviceField47;
private DeviceField deviceField48;
private DeviceField deviceField49;
private DeviceField deviceField5;
private DeviceField deviceField50;
private DeviceField deviceField51;
private DeviceField deviceField52;
private DeviceField deviceField53;
private DeviceField deviceField54;
private DeviceField deviceField55;
private DeviceField deviceField56;
private DeviceField deviceField57;
private DeviceField deviceField58;
private DeviceField deviceField59;
private DeviceField deviceField6;
private DeviceField deviceField60;
private DeviceField deviceField61;
private DeviceField deviceField62;
private DeviceField deviceField63;
private DeviceField deviceField64;
private DeviceField deviceField65;
private DeviceField deviceField66;
private DeviceField deviceField67;
private DeviceField deviceField68;
private DeviceField deviceField69;
private DeviceField deviceField7;
private DeviceField deviceField70;
private DeviceField deviceField71;
private DeviceField deviceField72;
private DeviceField deviceField73;
private DeviceField deviceField74;
private DeviceField deviceField75;
private DeviceField deviceField76;
private DeviceField deviceField77;
private DeviceField deviceField78;
private DeviceField deviceField79;
private DeviceField deviceField8;
private DeviceField deviceField80;
private DeviceField deviceField81;
private DeviceField deviceField82;
private DeviceField deviceField83;
private DeviceField deviceField84;
private DeviceField deviceField85;
private DeviceField deviceField86;
private DeviceField deviceField87;
private DeviceField deviceField88;
private DeviceField deviceField89;
private DeviceField deviceField9;
private DeviceField deviceField90;
private DeviceField deviceField91;
private DeviceField deviceField92;
private DeviceField deviceField93;
private DeviceField deviceField94;
private DeviceField deviceField95;
private DeviceField deviceField96;
private DeviceField deviceField97;
private DeviceField deviceField98;
private DeviceField deviceField99;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel10;
private javax.swing.JPanel jPanel100;
private javax.swing.JPanel jPanel101;
private javax.swing.JPanel jPanel102;
private javax.swing.JPanel jPanel103;
private javax.swing.JPanel jPanel104;
private javax.swing.JPanel jPanel105;
private javax.swing.JPanel jPanel106;
private javax.swing.JPanel jPanel107;
private javax.swing.JPanel jPanel108;
private javax.swing.JPanel jPanel109;
private javax.swing.JPanel jPanel11;
private javax.swing.JPanel jPanel110;
private javax.swing.JPanel jPanel111;
private javax.swing.JPanel jPanel112;
private javax.swing.JPanel jPanel113;
private javax.swing.JPanel jPanel114;
private javax.swing.JPanel jPanel115;
private javax.swing.JPanel jPanel116;
private javax.swing.JPanel jPanel117;
private javax.swing.JPanel jPanel118;
private javax.swing.JPanel jPanel119;
private javax.swing.JPanel jPanel12;
private javax.swing.JPanel jPanel120;
private javax.swing.JPanel jPanel121;
private javax.swing.JPanel jPanel122;
private javax.swing.JPanel jPanel123;
private javax.swing.JPanel jPanel124;
private javax.swing.JPanel jPanel125;
private javax.swing.JPanel jPanel126;
private javax.swing.JPanel jPanel127;
private javax.swing.JPanel jPanel128;
private javax.swing.JPanel jPanel129;
private javax.swing.JPanel jPanel13;
private javax.swing.JPanel jPanel130;
private javax.swing.JPanel jPanel131;
private javax.swing.JPanel jPanel132;
private javax.swing.JPanel jPanel14;
private javax.swing.JPanel jPanel15;
private javax.swing.JPanel jPanel16;
private javax.swing.JPanel jPanel17;
private javax.swing.JPanel jPanel18;
private javax.swing.JPanel jPanel19;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel20;
private javax.swing.JPanel jPanel21;
private javax.swing.JPanel jPanel22;
private javax.swing.JPanel jPanel23;
private javax.swing.JPanel jPanel24;
private javax.swing.JPanel jPanel25;
private javax.swing.JPanel jPanel26;
private javax.swing.JPanel jPanel27;
private javax.swing.JPanel jPanel28;
private javax.swing.JPanel jPanel29;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel30;
private javax.swing.JPanel jPanel31;
private javax.swing.JPanel jPanel32;
private javax.swing.JPanel jPanel33;
private javax.swing.JPanel jPanel34;
private javax.swing.JPanel jPanel35;
private javax.swing.JPanel jPanel36;
private javax.swing.JPanel jPanel37;
private javax.swing.JPanel jPanel38;
private javax.swing.JPanel jPanel39;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel40;
private javax.swing.JPanel jPanel41;
private javax.swing.JPanel jPanel42;
private javax.swing.JPanel jPanel43;
private javax.swing.JPanel jPanel44;
private javax.swing.JPanel jPanel45;
private javax.swing.JPanel jPanel46;
private javax.swing.JPanel jPanel47;
private javax.swing.JPanel jPanel48;
private javax.swing.JPanel jPanel49;
private javax.swing.JPanel jPanel5;
private javax.swing.JPanel jPanel50;
private javax.swing.JPanel jPanel51;
private javax.swing.JPanel jPanel52;
private javax.swing.JPanel jPanel53;
private javax.swing.JPanel jPanel54;
private javax.swing.JPanel jPanel55;
private javax.swing.JPanel jPanel56;
private javax.swing.JPanel jPanel57;
private javax.swing.JPanel jPanel58;
private javax.swing.JPanel jPanel59;
private javax.swing.JPanel jPanel6;
private javax.swing.JPanel jPanel60;
private javax.swing.JPanel jPanel61;
private javax.swing.JPanel jPanel62;
private javax.swing.JPanel jPanel63;
private javax.swing.JPanel jPanel64;
private javax.swing.JPanel jPanel65;
private javax.swing.JPanel jPanel66;
private javax.swing.JPanel jPanel67;
private javax.swing.JPanel jPanel68;
private javax.swing.JPanel jPanel69;
private javax.swing.JPanel jPanel7;
private javax.swing.JPanel jPanel70;
private javax.swing.JPanel jPanel71;
private javax.swing.JPanel jPanel72;
private javax.swing.JPanel jPanel73;
private javax.swing.JPanel jPanel74;
private javax.swing.JPanel jPanel75;
private javax.swing.JPanel jPanel76;
private javax.swing.JPanel jPanel77;
private javax.swing.JPanel jPanel78;
private javax.swing.JPanel jPanel79;
private javax.swing.JPanel jPanel8;
private javax.swing.JPanel jPanel80;
private javax.swing.JPanel jPanel81;
private javax.swing.JPanel jPanel82;
private javax.swing.JPanel jPanel83;
private javax.swing.JPanel jPanel84;
private javax.swing.JPanel jPanel85;
private javax.swing.JPanel jPanel86;
private javax.swing.JPanel jPanel87;
private javax.swing.JPanel jPanel88;
private javax.swing.JPanel jPanel89;
private javax.swing.JPanel jPanel9;
private javax.swing.JPanel jPanel90;
private javax.swing.JPanel jPanel91;
private javax.swing.JPanel jPanel92;
private javax.swing.JPanel jPanel93;
private javax.swing.JPanel jPanel94;
private javax.swing.JPanel jPanel95;
private javax.swing.JPanel jPanel96;
private javax.swing.JPanel jPanel97;
private javax.swing.JPanel jPanel98;
private javax.swing.JPanel jPanel99;
private javax.swing.JScrollPane jScrollPane1;
// End of variables declaration//GEN-END:variables
}
| 38.947163 | 114 | 0.677474 |
20f965424c67a09d010c7d9cafe533d2a7eab4d2
| 462 |
package com.sao.dentalappointment.appointment.orm.repository;
import com.sao.dentalappointment.appointment.orm.entity.Person;
import org.springframework.data.jpa.repository.JpaRepository;
public interface PersonRepository extends JpaRepository<Person, Long> {
Person findByEmail(String email);
Person findByGivenAndInitialAndSurname(String given, Character initial, String surname);
Person findByGivenAndSurname(String given, String surname);
}
| 33 | 92 | 0.822511 |
d9298b6a5e08be79492184c05d0115b5a4b5458e
| 1,284 |
package quickcache.logic.parser;
import static java.util.Objects.requireNonNull;
import java.nio.file.Path;
import java.nio.file.Paths;
import quickcache.commons.core.Messages;
import quickcache.logic.commands.ImportCommand;
import quickcache.logic.parser.exceptions.ParseException;
/**
* Parses input arguments and creates a new ImportCommand object.
*/
public class ImportCommandParser implements Parser<ImportCommand> {
/**
* Parses the given {@code String} of arguments in the context of the ImportCommand
* and returns an ImportCommand object for execution.
*
* @throws ParseException If the given user input does not conform to the expected format.
*/
@Override
public ImportCommand parse(String args) throws ParseException {
requireNonNull(args);
String fileName;
ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args);
try {
fileName = ParserUtil.parseFileName(argMultimap.getPreamble());
} catch (ParseException pe) {
throw new ParseException(String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT,
ImportCommand.MESSAGE_USAGE), pe);
}
Path path = Paths.get("import", fileName);
return new ImportCommand(path);
}
}
| 33.789474 | 94 | 0.712617 |
f58d39bffb0860d63e865f3187af39b1eba65abd
| 2,394 |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package br.univali.model.interpolacao;
import java.util.ArrayList;
import java.util.List;
import br.univali.model.minimos_quadrados.Point;
/**
*
* @author Alisson
*/
public class EquationCalculator {
public static List<Point> calcularFuncao(Double[] equacao,Double numeroInicial, Double numeroFinal,Double intervalo, String tipo)
{
if(tipo.equals("Polinomial")){
return calcularFuncaoPolinomial(equacao, numeroInicial, numeroFinal, intervalo);
}else if(tipo.equals("Geométrica")){
return calcularFuncaoGeometrica(equacao, numeroInicial, numeroFinal, intervalo);
}else{
return calcularFuncaoAeBX(equacao, numeroInicial, numeroFinal, intervalo);
}
}
private static List<Point> calcularFuncaoPolinomial(Double[] equacao,Double numeroInicial, Double numeroFinal,Double intervalo)
{
List<Point> resposta = new ArrayList<>();
for(Double x=numeroInicial; x<=numeroFinal ;x+=intervalo)
{
Double xPonto=x;
Double yPonto=0.0;
for(int i=equacao.length-1; i>=0;i--){
yPonto+=equacao[i]*Math.pow(x,i);
}
resposta.add(new Point(xPonto, yPonto));
}
return resposta;
}
private static List<Point> calcularFuncaoGeometrica(Double[] equacao,Double numeroInicial, Double numeroFinal,Double intervalo)
{
List<Point> resposta = new ArrayList<>();
for(Double x=numeroInicial; x<=numeroFinal ;x+=intervalo)
{
Double xPonto=x;
Double yPonto=0.0;
yPonto+=equacao[0]*Math.pow(x, equacao[1]);
resposta.add(new Point(xPonto, yPonto));
}
return resposta;
}
private static List<Point> calcularFuncaoAeBX(Double[] equacao,Double numeroInicial, Double numeroFinal,Double intervalo)
{
List<Point> resposta = new ArrayList<>();
for(Double x=numeroInicial; x<=numeroFinal ;x+=intervalo)
{
Double xPonto=x;
Double yPonto=0.0;
yPonto+=equacao[1]*Math.exp(x*equacao[0]);
resposta.add(new Point(xPonto, yPonto));
}
return resposta;
}
}
| 36.272727 | 133 | 0.63868 |
e77fc6a71d80d669f00b1dc98f74e462bf0420ae
| 792 |
package com.alamousse.modules.order.service.dto;
import lombok.Data;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @author mike
* @date 2019-07-27
*/
@Data
public class OrderGoodsDTO implements Serializable {
// Id
private Integer id;
// Goods Id
private Integer goodsId;
// Goods Name
private String goodsName;
// Shop Id
private Integer shopId;
// Quantity
private Integer quantity;
// Unit Price
private BigDecimal unitPrice;
// Sum Price
private BigDecimal price;
// Unit Point
private BigDecimal unitPoint;
// Sum Point
private BigDecimal point;
// Order Id
private String orderId;
// volume
private BigDecimal volume;
// weight
private BigDecimal weight;
}
| 15.84 | 52 | 0.662879 |
415bf0b6af96c62995d48a6b29448da6a3afdd7a
| 1,261 |
package org.xdty.moments;
import android.support.test.espresso.assertion.ViewAssertions;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.xdty.moments.activity.MainActivity_;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
/**
* Created by ty on 15-11-4.
*/
@RunWith(AndroidJUnit4.class)
public class MainActivityTest {
@Rule public final ActivityTestRule<MainActivity_> main = new ActivityTestRule<>(MainActivity_.class);
@Test
public void shouldBeAbleLaunchMainScreen() {
onView(withId(R.id.swipe_refresh_layout)).check(ViewAssertions.matches(isDisplayed()));
}
@Test
public void testUserNameExists() {
try {
Thread.sleep(10*1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
onView(withId(R.id.username)).check(ViewAssertions.matches(withText("tianyu")));
}
}
| 30.02381 | 106 | 0.746233 |
23b95a7f1698b2f865c4fdb5364425c3025ff4f3
| 1,566 |
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package fr.ritaly.dungeonmaster;
/**
* Enumerates the possible move speeds. Each speed is associated to a value
* representing the relative move speed.
*
* @author <a href="mailto:francois.ritaly@gmail.com">Francois RITALY</a>
*/
public enum Speed {
SLOW(8),
NORMAL(4),
FAST(2),
/**
* Special speed used for dead champions. A dead champion doesn't affect the
* party's speed and is considered to be moving at (Faster Than) Light speed
* :)
*/
UNDEFINED(0);
private final int value;
private Speed(int value) {
this.value = value;
}
/**
* Returns the integer value associated to this move speed. The higher the
* value, the slower the speed.
*
* @return an integer value.
*/
public int getValue() {
return value;
}
}
| 28.472727 | 77 | 0.717752 |
1ab8c7d4c9c7e71a9d43f78908ef0114e922467a
| 1,516 |
/*
* Copyright 2019 GridGain Systems, Inc. and Contributors.
*
* Licensed under the GridGain Community Edition License (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.gridify.hierarchy;
import org.apache.ignite.compute.gridify.Gridify;
/**
* Target base class.
*/
public abstract class SuperTarget {
/**
* @return Always returns "SuperTarget.methodA()".
*/
@Gridify(igniteInstanceName = "GridifyHierarchyTest")
protected String methodA() {
System.out.println(">>> Called SuperTarget.methodA()");
return "SuperTarget.methodA()";
}
/**
* @return "SuperTarget.methodC()" string.
*/
protected String methodB() {
return methodC();
}
/**
* @return "SuperTarget.methodC()" string.
*/
@Gridify(igniteInstanceName = "GridifyHierarchyTest")
private String methodC() {
System.out.println(">>> Called SuperTarget.methodC()");
return "SuperTarget.methodC()";
}
}
| 29.153846 | 102 | 0.684037 |
33eda3fc9b921a19444fefc8f3c675db7e102a53
| 1,882 |
package com.ktc.control.home;
import java.lang.Thread.UncaughtExceptionHandler;
import android.content.Context;
import android.util.Log;
/**
*
* TODO 捕获应用crash异常
*
* @author Arvin
* 2018-3-15
*/
public class CatchCrashHandler implements UncaughtExceptionHandler{
private static String TAG = "SerialCatchCrashHandler";
private static CatchCrashHandler mCrashHandler;
//系统默认的UncaughtException处理类
private UncaughtExceptionHandler mDefaultHandler;
//程序的Context对象
private Context mContext;
/**
* TODO 获取CatchCrashHandler单例对象
* @param
* @return CatchCrashHandler
*/
public static CatchCrashHandler getInstance() {
if (mCrashHandler == null) {
mCrashHandler = new CatchCrashHandler();
}
return mCrashHandler;
}
public void init(Context context) {
mContext = context;
//获取系统默认的UncaughtException处理器
mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler();
//设置该CrashHandler为程序的默认处理器
Thread.setDefaultUncaughtExceptionHandler(this);
}
@Override
public void uncaughtException(Thread thread, Throwable ex) {
Log.i(TAG, "uncaughtException");
if (!handleException(ex) && mDefaultHandler != null) {
//如果用户没有处理则让系统默认的异常处理器来处理
mDefaultHandler.uncaughtException(thread, ex);
} else {
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(1);
}
}
/**
* TODO 异常处理,比如收集日志等
* @param
* @return boolean
*/
private boolean handleException(Throwable ex) {
if (ex == null) {
return false;
}
Throwable cause = ex.getCause();
if(cause != null){
Log.e(TAG , cause.toString());
cause.printStackTrace();
}
return true;
}
}
| 26.138889 | 71 | 0.629649 |
41d4f32dfd4a60078418586f049ede974cfed046
| 305 |
package com.cloud.mall.search.constant;
/**
* @Author ws
* @Date 2021/3/2 19:45
* @Version 1.0
*/
public class EsConstant {
/**
* sku数据在es中的索引
*/
public static final String PRODUCT_INDEX="product";
/**
* 每页大小
*/
public static final Integer PRODUCT_PAGE_SIZE=4;
}
| 16.052632 | 55 | 0.609836 |
f873024794ecd2254f778ae5f2d530a271effa2d
| 2,635 |
package com.bbz.latte;
import java.util.ArrayList;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.TypedArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
@SuppressLint({ "NewApi", "ViewHolder", "Recycle" }) public class CardAdapter extends ArrayAdapter<Card> {
private final Context context;
private final ArrayList<Card> itemsArrayList;
public CardAdapter(Context context, ArrayList<Card> itemsArrayList) {
super(context, R.layout.single_card, itemsArrayList);
this.context = context;
this.itemsArrayList = itemsArrayList;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// Get layout elements
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View rowView = inflater.inflate(R.layout.single_card, parent, false);
TextView labelView = (TextView) rowView.findViewById(R.id.card_short_number);
ImageView cardColor = (ImageView) rowView.findViewById(R.id.credit_card_color_single);
Button defaultButton = (Button) rowView.findViewById(R.id.default_button_single_card);
Button deleteButton = (Button) rowView.findViewById(R.id.delete_button_single_card);
TextView balView = (TextView) rowView.findViewById(R.id.card_bal);
TypedArray colors = context.getResources().obtainTypedArray(R.array.card_colors_single);
// Show last four digits
labelView.setText(itemsArrayList.get(position).getShortNumber());
balView.setText(itemsArrayList.get(position).getBal());
// Show if default
if (itemsArrayList.get(position).isDefault()) {
defaultButton.setBackground(context.getResources().getDrawable(R.drawable.star));
} else {
defaultButton.setBackground(context.getResources().getDrawable(R.drawable.star_grey));
}
// Set delete listener
deleteButton.setOnClickListener(new DeleteOnClickListener(itemsArrayList.get(position)
.getShortNumber()));
// Set credit card color
cardColor.setImageResource(colors.getResourceId(itemsArrayList.get(position)
.getColorPreference(), 0));
return rowView;
}
/**
* Deletes card from the list
*/
public class DeleteOnClickListener implements OnClickListener {
String shortNum;
public DeleteOnClickListener(String shortNum) {
this.shortNum = shortNum;
}
@Override
public void onClick(View v) {
CardManager.deleteCard(shortNum);
}
};
}
| 31.369048 | 106 | 0.777989 |
2f707c174de6b8cff175178d052f0d31563d8152
| 21,405 |
package today.flux.gui.loginui;
import com.soterdev.SoterObfuscator;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Util;
import org.apache.commons.codec.digest.DigestUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Display;
import oshi.SystemInfo;
import oshi.hardware.Processor;
import today.flux.Flux;
import today.flux.gui.clickgui.classic.GuiRenderUtils;
import today.flux.gui.clickgui.classic.RenderUtil;
import today.flux.gui.fontRenderer.FontManager;
import today.flux.gui.fontRenderer.FontUtils;
import today.flux.irc.IRCClient;
import today.flux.module.ModuleManager;
import today.flux.utility.*;
import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.Transferable;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Field;
import java.net.URI;
import java.net.URL;
import java.security.MessageDigest;
import java.util.Base64;
import java.util.Map;
import java.util.Objects;
public class GuiLogin extends GuiScreen {
public static String[] account = null;
public CustomTextField usernameField;
public PasswordField passwordField;
public ScaledResolution res;
public boolean buttonEnabled = false, isLogging;
public float hoverAlpha = 0;
public float hoverHwidButtonAlpha = 0;
public float enabledAlpha = 0;
public URI registerAccount = URI.create("https://flux.today/forums/register.php");
public URI resetPassword = URI.create("https://flux.today/forums/login.php?action=forget");
public PopupDialog dialog = null;
// 动画测试
public boolean stage1 = true;
public boolean stage2 = false;
public float font_animation = 0;
public float back_animation = 1;
public TimeHelper timer = new TimeHelper();
static boolean fontLoaded = false;
public String content = "";
static float timeDelta = -1000;
@Override
public void initGui() {
timer.reset();
res = new ScaledResolution(mc);
this.usernameField = new CustomTextField(0, Flux.font, 0, 0, 100, 20);
this.passwordField = new PasswordField(0, Flux.font, 0, 0, 100, 20);
Keyboard.enableRepeatEvents(true);
new Thread() {
@Override
public void run() {
checkTime();
}
}.start();
super.initGui();
}
public void checkTime() {
try {
if (timeDelta < -999) {
long time = Long.parseLong(HttpUtil.performGetRequest(new URL("https://time.is/t/?zh.0.347.2464.0p.480.43d.1574683214663.1594044507830.")).substring(0, 13));
float delta = (System.currentTimeMillis() - time) / 1000f;
System.out.println("Sync time! " + delta);
timeDelta = delta;
}
} catch (Throwable e) {
this.dialog = new PopupDialog("Warning", "Failed to check system time!", 150, 55, true);
e.printStackTrace();
}
if (Math.abs(timeDelta) > 10) {
this.dialog = new PopupDialog("You may not be able to log in!", "The system time is not synchronized, please synchronize the time! (" + timeDelta + "s)", 320, 55, true);
}
}
// @SoterObfuscator.Obfuscation(flags = "+native")
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
float wwidth = res.getScaledWidth();
float wheight = res.getScaledHeight();
RenderUtil.drawRect(0, 0, wwidth, wheight, 0xffffffff);
RenderUtil.drawImage(new ResourceLocation("flux/loginbackground.png"), -150, 0, wwidth, wheight);
drawGradientSideways(wwidth - 170, 0, wwidth - 150, wheight, RenderUtil.reAlpha(ColorUtils.BLACK.c, 0f), RenderUtil.reAlpha(ColorUtils.BLACK.c, 0.2f));
FontManager.icon30.drawString("q", wwidth - 124, 27, 0xff4286f5);
FontManager.font1.drawString(Flux.NAME.toUpperCase(), wwidth - 106, 25, 0xff4286f5);
//USERNAME AND PASSWORD FIELD
this.usernameField.xPosition = (int) (wwidth - 125);
this.usernameField.yPosition = (int) (wheight / 2 - 50);
this.passwordField.xPosition = (int) (wwidth - 125);
this.passwordField.yPosition = (int) (wheight / 2 - 20);
if (account != null) {
this.usernameField.setText(account[0]);
this.passwordField.setText(account[1]);
}
this.usernameField.drawTextBox();
if (!usernameField.isFocused() && usernameField.getText().isEmpty()) {
FontManager.font2.drawString("USERNAME", wwidth - 120, wheight / 2 - 45, 0xffdbdbdb);
} else {
RenderUtil.drawRect(wwidth - 120, wheight / 2 - 54, wwidth - 86, wheight / 2 - 48, 0xffffffff);
FontManager.font3.drawString("USERNAME", wwidth - 118, wheight / 2 - 53.5f, this.usernameField.isFocused() ? 0xff7d7d7d : this.usernameField.getText().isEmpty() ? 0xffdbdbdb : 0xff7d7d7d);
}
this.passwordField.drawTextBox();
if (!passwordField.isFocused() && passwordField.getText().isEmpty()) {
FontManager.font2.drawString("PASSWORD", wwidth - 120, wheight / 2 - 15, 0xffdbdbdb);
} else {
RenderUtil.drawRect(wwidth - 120, wheight / 2 - 24, wwidth - 86.5f, wheight / 2 - 18, 0xffffffff);
FontManager.font3.drawString("PASSWORD", wwidth - 118f, wheight / 2 - 23.5f, this.passwordField.isFocused() ? 0xff7d7d7d : this.passwordField.getText().isEmpty() ? 0xffdbdbdb : 0xff7d7d7d);
}
//FETCH HWID BUTTON
GuiRenderUtils.drawRoundedRect(wwidth - 125, wheight - 115, 100, 15, 3, 0xff4286f5, 1, 0xff4286f5);
// HWID BUTTON on hover alpha
if (RenderUtil.isHovering(mouseX, mouseY, wwidth - 125, wheight - 115, wwidth - 25, wheight - 100) && this.dialog == null) {
this.hoverHwidButtonAlpha = AnimationUtils.getAnimationState(this.hoverHwidButtonAlpha, 0.2f, 1);
} else {
this.hoverHwidButtonAlpha = AnimationUtils.getAnimationState(this.hoverHwidButtonAlpha, 0, 1);
}
FontManager.font2.drawString("GET HWID", wwidth - ((150 / 2f) + (FontManager.font2.getStringWidth("GET HWID") / 2)), wheight - 112f, ColorUtils.WHITE.c);
if (this.hoverHwidButtonAlpha > 0) {
if (Util.getOSType() == Util.EnumOS.WINDOWS)
GuiRenderUtils.drawRoundedRect(wwidth - 125, wheight - 115, 100, 15, 3, RenderUtil.reAlpha(0xff000000, MathUtils.clampValue(this.hoverHwidButtonAlpha, 0, 1)), 1, RenderUtil.reAlpha(0xff000000, MathUtils.clampValue(this.hoverHwidButtonAlpha, 0, 1)));
}
//LOGIN BUTTON
if (this.enabledAlpha < 1) {
GuiRenderUtils.drawRoundedRect(wwidth - 125, wheight - 95, 100, 25, 3, 0xff7d7d7d, 1, 0xff7d7d7d);
}
buttonEnabled = !this.usernameField.getText().isEmpty() && !this.passwordField.getText().isEmpty() && !isLogging;
if (buttonEnabled) {
this.enabledAlpha = AnimationUtils.getAnimationState(this.enabledAlpha, 1, 5);
} else {
this.enabledAlpha = AnimationUtils.getAnimationState(this.enabledAlpha, 0, 5);
}
if (Util.getOSType() == Util.EnumOS.WINDOWS)
GuiRenderUtils.drawRoundedRect(wwidth - 125, wheight - 95, 100, 25, 3, RenderUtil.reAlpha(0xff4286f5, MathUtils.clampValue(this.enabledAlpha, 0, 1)), 1, RenderUtil.reAlpha(0xff4286f5, MathUtils.clampValue(this.enabledAlpha, 0, 1)));
// Change alpha if on Hover
if (RenderUtil.isHovering(mouseX, mouseY, wwidth - 125, wheight - 95, wwidth - 25, wheight - 75) && this.dialog == null && !this.isLogging) {
this.hoverAlpha = AnimationUtils.getAnimationState(this.hoverAlpha, 0.2f, 1);
} else {
this.hoverAlpha = AnimationUtils.getAnimationState(this.hoverAlpha, 0, 1);
}
FontManager.font2.drawString("LOGIN", wwidth - ((150 / 2f) + (FontManager.font2.getStringWidth("LOGIN") / 2)), wheight - 87f, ColorUtils.WHITE.c);
// MAC OS support
if (Util.getOSType() == Util.EnumOS.WINDOWS)
GuiRenderUtils.drawRoundedRect(wwidth - 125, wheight - 95, 100, 25, 3, RenderUtil.reAlpha(0xff000000, MathUtils.clampValue(this.hoverAlpha, 0, 1)), 1, RenderUtil.reAlpha(0xff000000, MathUtils.clampValue(this.hoverAlpha, 0, 1)));
FontManager.font4.drawString("q", wwidth - 60, wheight - 58, RenderUtil.reAlpha(0xff000000, 0.12f));
FontManager.font5.drawString("No Account?", wwidth - 125, wheight - 42,
RenderUtil.isHovering(mouseX, mouseY, wwidth - 125, wheight - 42, wwidth - 85, wheight - 35) && this.dialog == null ? new Color(0xff4286f5).darker().getRGB() : 0xff4286f5);
FontManager.font5.drawString("Password Reset", wwidth - 125, wheight - 28,
RenderUtil.isHovering(mouseX, mouseY, wwidth - 125, wheight - 28, wwidth - 78, wheight - 21) && this.dialog == null ? RenderUtil.reAlpha(0xff000000, 0.6f) : RenderUtil.reAlpha(0xff000000, 0.4f));
if (this.dialog != null) {
RenderUtil.drawRect(0, 0, wwidth, wheight, RenderUtil.reAlpha(ColorUtils.BLACK.c, 0.4f));
}
if (this.dialog != null) {
if (this.dialog.destroy) {
this.dialog = null;
return;
}
this.dialog.render(mouseX, mouseY);
}
// 根据图层顺序,启动画面在这绘制
if (!AnimationUtils.animationDone) {
if (this.stage1) {
content = "Please wait...";
if (this.font_animation < 1) {
this.font_animation += 0.02f;
}
if (!fontLoaded && FontManager.wqy18 == FontManager.roboto15 && this.font_animation >= 1) {
FontManager.wqy18 = new FontUtils("wqy_microhei.ttf", Font.PLAIN, 18, 7, true);
FontManager.wqy15 = new FontUtils("wqy_microhei.ttf", Font.PLAIN, 15, 7, true);
fontLoaded = true;
timer.reset();
}
if (fontLoaded) {
content = "Welcome to Flux Client!";
if (timer.delay(3500)) {
this.stage1 = false;
this.stage2 = true;
}
} else {
timer.reset();
}
}
if (this.stage2) {
this.font_animation = AnimationUtils.getAnimationState(this.font_animation, 0, 2f);
this.back_animation = AnimationUtils.getAnimationState(this.back_animation, 0, 2f);
if (this.font_animation == 0 && this.back_animation == 0) {
AnimationUtils.animationDone = true;
}
}
RenderUtil.drawRect(0, 0, width, height, RenderUtil.reAlpha(ColorUtils.BLACK.c, this.back_animation));
FontManager.robotoL40.drawCenteredStringWithAlpha(content, width / 2, height / 2 - 24,
ColorUtils.WHITE.c, this.font_animation > 1 ? 1 : this.font_animation);
if (fontLoaded) {
FontManager.robotoL18.drawCenteredStringWithAlpha("Ready for authentication", width / 2, height / 2,
ColorUtils.WHITE.c, this.font_animation > 1 ? 1 : this.font_animation);
}
}
super.drawScreen(mouseX, mouseY, partialTicks);
}
@Override
protected void keyTyped(char typedChar, int keyCode) throws IOException {
if (dialog == null && keyCode == 88) {
IRCClient.isChina = !IRCClient.isChina;
Display.setTitle(Flux.NAME + " b" + Flux.VERSION + " - " + (IRCClient.isChina ? "China" : "Global"));
this.dialog = new PopupDialog("Server Switched", String.format("Successfully switched server to %s server!", (IRCClient.isChina ? "China" : "Global")), 200, 55, true);
}
//Tab切换输入框
if (typedChar == '\t') {
if (!this.usernameField.isFocused() && !this.passwordField.isFocused()) {
this.usernameField.setFocused(true);
} else {
this.usernameField.setFocused(this.passwordField.isFocused());
this.passwordField.setFocused(!this.usernameField.isFocused());
}
}
if (typedChar == '\r' && buttonEnabled) {
this.doLogin();
}
this.usernameField.textboxKeyTyped(typedChar, keyCode);
this.passwordField.textboxKeyTyped(typedChar, keyCode);
super.keyTyped(typedChar, keyCode);
}
@SoterObfuscator.Obfuscation(flags = "+native")
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
float wwidth = res.getScaledWidth();
float wheight = res.getScaledHeight();
if (this.dialog != null) {
this.dialog.doClick(mouseX, mouseY, mouseButton);
return;
}
this.usernameField.mouseClicked(mouseX, mouseY, mouseButton);
this.passwordField.mouseClicked(mouseX, mouseY, mouseButton);
if (RenderUtil.isHovering(mouseX, mouseY, wwidth - 125, wheight - 95, wwidth - 25, wheight - 70) && mouseButton == 0 && buttonEnabled) {
this.doLogin();
}
if (RenderUtil.isHovering(mouseX, mouseY, wwidth - 125, wheight - 42, wwidth - 85, wheight - 35) && mouseButton == 0) {
try {
Desktop desktop = Desktop.getDesktop();
desktop.browse(registerAccount);
} catch (Exception ex) {
System.out.println("An error occurred while trying to open a url!");
}
}
if (RenderUtil.isHovering(mouseX, mouseY, wwidth - 125, wheight - 28, wwidth - 78, wheight - 21) && mouseButton == 0) {
try {
Desktop desktop = Desktop.getDesktop();
desktop.browse(resetPassword);
} catch (Exception ex) {
System.out.println("An error occurred while trying to open a url!");
}
}
// GET HWID
if (RenderUtil.isHovering(mouseX, mouseY, wwidth - 125, wheight - 115, wwidth - 25, wheight - 100) && mouseButton == 0) {
try {
Class clazz = Class.forName("java.lang.ProcessEnvironment");
Field field = clazz.getDeclaredField("theUnmodifiableEnvironment");
field.setAccessible(true);
Map<String, String> map = (Map<String, String>) field.get(clazz);
Processor[] processor = (new SystemInfo()).getHardware().getProcessors();
String a = new Base58(14513).encode((map.get("PROCESSOR_IDENTIFIER") + map.get("LOGNAME") + map.get("USER")).getBytes());
String b = new Base58(13132).encode((processor[0].getName() + processor.length + map.get("PROCESSOR_LEVEL") + a).getBytes());
String c = new Base58(23241).encode((map.get("COMPUTERNAME") + System.getProperty("user.name") + b).getBytes());
MessageDigest mdsha1 = MessageDigest.getInstance("SHA-1");
byte[] sha1hash;
mdsha1.update(Base64.getEncoder().encodeToString((a + b + c).getBytes()).getBytes("iso-8859-1"), 0, Base64.getEncoder().encodeToString((a + b + c).getBytes()).length());
sha1hash = mdsha1.digest();
final StringBuffer buf = new StringBuffer();
for (int i = 0; i < sha1hash.length; ++i) {
int halfbyte = sha1hash[i] >>> 3 & 0xF;
int two_halfs = 0;
do {
if (halfbyte >= 0 && halfbyte <= 9) {
buf.append((char) (48 + halfbyte));
} else {
buf.append((char) (97 + (halfbyte - 10)));
}
halfbyte = (sha1hash[i] & 0xF);
} while (two_halfs++ < 1);
}
String hwid = buf.toString();
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(hwid.getBytes());
StringBuffer hexString = new StringBuffer();
byte[] byteData = md.digest();
for (byte aByteData : byteData) {
String hex = Integer.toHexString(0xff & aByteData);
if (hex.length() == 1) hexString.append('0');
hexString.append(hex);
}
String origin = new Base58(14514).encode((hwid + hexString).getBytes());
StringBuffer buffer = new StringBuffer();
for (int i = 16; i < 16 + 5 * 4; i += 5) {
buffer.append(origin, i, i + 5);
buffer.append('-');
}
buffer.deleteCharAt(buffer.length() - 1);
if (!origin.equalsIgnoreCase(origin.toUpperCase()))
ModuleManager.killAuraMod = null;
if (!origin.toUpperCase().toLowerCase().equals(origin.toLowerCase()))
ModuleManager.killAuraMod = null;
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
String text = "imagine cracking flux";
try {
String.class.getMethods()[76].getName();
} catch (Throwable throwable) {
text = buffer.toString().toUpperCase();
}
Transferable trans = new StringSelection(text);
clipboard.setContents(trans, null);
if (this.dialog == null) {
this.dialog = new PopupDialog("Copying HWID to the clipboard", "Successfully copied your HWID to the clipboard", 200, 55, true);
}
} catch (Exception e) {
e.printStackTrace();
}
}
super.mouseClicked(mouseX, mouseY, mouseButton);
}
@SoterObfuscator.Obfuscation(flags = "+native")
public void doLogin() {
if (checkUsername()) {
isLogging = true;
Flux.irc = new IRCClient(usernameField.getText(), passwordField.getText());
} else {
dialog = new PopupDialog("Error", "This client was not build by yourself.", 200, 55, true);
}
}
@SoterObfuscator.Obfuscation(flags = "+native")
public boolean checkUsername() {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(Objects.requireNonNull(this.getClass().getClassLoader().getResourceAsStream("FluxAntiLeak"))));
String line = null;
while ((line = in.readLine()) != null) {
if (DigestUtils.md5Hex(usernameField.getText() + "FAL").equals(line)) {
return true;
}
}
} catch (Throwable e) {
}
return false;
}
public void drawGradientSideways(float left, float top, float right, float bottom, int startColor, int endColor) {
float f = (float) (startColor >> 24 & 255) / 255.0F;
float f1 = (float) (startColor >> 16 & 255) / 255.0F;
float f2 = (float) (startColor >> 8 & 255) / 255.0F;
float f3 = (float) (startColor & 255) / 255.0F;
float f4 = (float) (endColor >> 24 & 255) / 255.0F;
float f5 = (float) (endColor >> 16 & 255) / 255.0F;
float f6 = (float) (endColor >> 8 & 255) / 255.0F;
float f7 = (float) (endColor & 255) / 255.0F;
GlStateManager.disableTexture2D();
GlStateManager.enableBlend();
GlStateManager.disableAlpha();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.shadeModel(7425);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
worldrenderer.pos((double) right, (double) top, (double) this.zLevel).color(f5, f6, f7, f4).endVertex();
worldrenderer.pos((double) left, (double) top, (double) this.zLevel).color(f1, f2, f3, f).endVertex();
worldrenderer.pos((double) left, (double) bottom, (double) this.zLevel).color(f1, f2, f3, f).endVertex();
worldrenderer.pos((double) right, (double) bottom, (double) this.zLevel).color(f5, f6, f7, f4).endVertex();
tessellator.draw();
GlStateManager.shadeModel(7424);
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
GlStateManager.enableTexture2D();
}
@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
super.mouseReleased(mouseX, mouseY, state);
}
@Override
public void onGuiClosed() {
Keyboard.enableRepeatEvents(false);
}
@Override
public void updateScreen() {
res = new ScaledResolution(mc);
this.usernameField.updateCursorCounter();
this.passwordField.updateCursorCounter();
}
}
| 45.349576 | 265 | 0.601775 |
f8a804177986209c61b9d122fcc89968ac7233e3
| 211 |
package org.schema.api.model.thing.medicalEntity.anatomicalStructure;
import org.schema.api.model.thing.medicalEntity.anatomicalStructure.AnatomicalStructure;
public class Nerve extends AnatomicalStructure
{
}
| 30.142857 | 88 | 0.862559 |
88411644164817b1bc1981800ef4d94ab56876b8
| 7,584 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* $Id$ */
package org.apache.fop.fo.flow.table;
import java.util.Iterator;
import java.util.List;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
/**
* Tests that RowGroupBuilder returns, for each part of a table, the expected number of
* row-groups with the expected number or rows in each.
*/
public class RowGroupBuilderTestCase extends AbstractTableTest {
/**
* Checks that the given table-body(header,footer) will return row groups as expected.
* More precisely, checks that the number of row groups corresponds to the size of the
* given array, and that the number of rows inside each row group is equal to the
* corresponding integer in the array.
*
* @param part a table part whose row groups are to be checked
* @param expectedRowLengths expected lengths of all the row groups of this part of
* the table
*/
private void checkTablePartRowGroups(TablePart part, int[] expectedRowLengths) {
Iterator rowGroupIter = part.getRowGroups().iterator();
for (int i = 0; i < expectedRowLengths.length; i++) {
assertTrue(rowGroupIter.hasNext());
List rowGroup = (List) rowGroupIter.next();
assertEquals(expectedRowLengths[i], rowGroup.size());
}
assertFalse(rowGroupIter.hasNext());
}
/**
* Gets the next table and checks its row-groups.
* @param tableIter an iterator over the tables to check
* @param expectedHeaderRowLengths expected row-group sizes for the header. If null
* the table is not expected to have a header
* @param expectedFooterRowLengths expected row-group sizes for the footer. If null
* the table is not expected to have a footer
* @param expectedBodyRowLengths expected row-group sizes for the body(-ies)
*/
private void checkNextTableRowGroups(Iterator tableIter,
int[] expectedHeaderRowLengths, int[] expectedFooterRowLengths, int[][] expectedBodyRowLengths) {
Table table = (Table) tableIter.next();
if (expectedHeaderRowLengths == null) {
assertNull(table.getTableHeader());
} else {
checkTablePartRowGroups(table.getTableHeader(), expectedHeaderRowLengths);
}
if (expectedFooterRowLengths == null) {
assertNull(table.getTableFooter());
} else {
checkTablePartRowGroups(table.getTableFooter(), expectedFooterRowLengths);
}
Iterator bodyIter = table.getChildNodes();
for (int i = 0; i < expectedBodyRowLengths.length; i++) {
assertTrue(bodyIter.hasNext());
checkTablePartRowGroups((TableBody) bodyIter.next(), expectedBodyRowLengths[i]);
}
}
public void checkSimple(String filename) throws Exception {
setUp(filename);
Iterator tableIter = getTableIterator();
// Table 1: no header, no footer, one body (1 row)
checkNextTableRowGroups(tableIter, null, null, new int[][] {{1}});
// Table 2: no header, no footer, one body (2 rows)
checkNextTableRowGroups(tableIter, null, null, new int[][] {{1, 1}});
// Table 3: no header, no footer, two bodies (1 row, 1 row)
checkNextTableRowGroups(tableIter, null, null, new int[][] {{1}, {1}});
// Table 4: no header, no footer, two bodies (2 rows, 3 rows)
checkNextTableRowGroups(tableIter, null, null, new int[][] {{1, 1}, {1, 1, 1}});
// Table 5: one header (1 row), no footer, one body (1 row)
checkNextTableRowGroups(tableIter, new int[] {1}, null, new int[][] {{1}});
// Table 6: no header, one footer (1 row), one body (1 row)
checkNextTableRowGroups(tableIter, null, new int[] {1}, new int[][] {{1}});
// Table 7: one header (1 row), one footer (1 row), one body (1 row)
checkNextTableRowGroups(tableIter, new int[] {1}, new int[] {1}, new int[][] {{1}});
// Table 8: one header (2 rows), one footer (3 rows), one body (2 rows)
checkNextTableRowGroups(tableIter, new int[] {1, 1}, new int[] {1, 1, 1}, new int[][] {{1, 1}});
// Table 9: one header (3 rows), one footer (2 rows), three bodies (2 rows, 1 row, 3 rows)
checkNextTableRowGroups(tableIter, new int[] {1, 1, 1}, new int[] {1, 1}, new int[][] {{1, 1}, {1}, {1, 1, 1}});
}
public void checkSpans(String filename) throws Exception {
setUp(filename);
Iterator tableIter = getTableIterator();
// Table 1: no header, no footer, one body (1 row with column-span)
checkNextTableRowGroups(tableIter, null, null, new int[][] {{1}});
// Table 2: no header, no footer, one body (1 row-group of 2 rows)
checkNextTableRowGroups(tableIter, null, null, new int[][] {{2}});
// Table 3: no header, no footer, one body (1 row-group of 2 rows, 1 row)
checkNextTableRowGroups(tableIter, null, null, new int[][] {{2, 1}});
// Table 4: no header, no footer, one body (1 row, 1 row-group of 2 rows)
checkNextTableRowGroups(tableIter, null, null, new int[][] {{1, 2}});
// Table 5: no header, no footer, one body (1 row, 1 row-group of 3 rows, 1 row)
checkNextTableRowGroups(tableIter, null, null, new int[][] {{1, 3, 1}});
// Table 6: one header (1 row-group of 2 rows), one footer (1 row, 1 row-group of 3 rows),
// one body (1 row-group of 2 rows, 1 row, 1 row-group of 3 rows)
checkNextTableRowGroups(tableIter, new int[] {2}, new int[] {1, 3}, new int[][] {{2, 1, 3}});
}
@Test
public void testWithRowsSimple() throws Exception {
checkSimple("table/RowGroupBuilder_simple.fo");
}
@Test
public void testWithRowsSpans() throws Exception {
checkSpans("table/RowGroupBuilder_spans.fo");
}
@Test
public void testNoRowSimple() throws Exception {
checkSimple("table/RowGroupBuilder_no-row_simple.fo");
}
@Test
public void testNoRowSpans() throws Exception {
checkSpans("table/RowGroupBuilder_no-row_spans.fo");
}
@Test
public void testNoColWithRowsSimple() throws Exception {
checkSimple("table/RowGroupBuilder_no-col_simple.fo");
}
@Test
public void testNoColWithRowsSpans() throws Exception {
checkSpans("table/RowGroupBuilder_no-col_spans.fo");
}
@Test
public void testNoColNoRowSimple() throws Exception {
checkSimple("table/RowGroupBuilder_no-col_no-row_simple.fo");
}
@Test
public void testNoColNoRowSpans() throws Exception {
checkSpans("table/RowGroupBuilder_no-col_no-row_spans.fo");
}
}
| 41.442623 | 120 | 0.65625 |
4087b83b9b7238132ca4b9193a777f7fd13b9096
| 4,497 |
package gui.telas;
import dao.ProdutoDAO;
import gui.tabelas.ProdutoTableModel;
import javax.swing.JInternalFrame;
import javax.swing.JOptionPane;
import javax.swing.RowFilter;
import javax.swing.table.TableRowSorter;
import modelo.Produto;
/**
* Janela de consulta a dados do produto
*
* @author Juliano
*/
public class TelaBuscarProduto extends javax.swing.JDialog {
JInternalFrame parent;
public TelaBuscarProduto(JInternalFrame parent) {
super();
this.parent = parent;
initComponents();
carregarTabela();
}
private void carregarTabela() {
try {
ProdutoDAO produtoDAO = new ProdutoDAO();
ProdutoTableModel ptm = (ProdutoTableModel) tbProdutos.getModel();
ptm.setDados(produtoDAO.BuscarTodos());
} catch (Exception ex) {
JOptionPane.showMessageDialog(this, "Erro ao carregar tabela de produtos.\n" + ex.getMessage(), "Erro", JOptionPane.ERROR_MESSAGE);
}
}
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
pnFiltro = new javax.swing.JPanel();
lbFiltro = new javax.swing.JLabel();
txtCodigoBarra = new javax.swing.JTextField();
spGrade = new javax.swing.JScrollPane();
tbProdutos = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Tela de busca de produto");
pnFiltro.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
lbFiltro.setText("Código de barra:");
pnFiltro.add(lbFiltro);
txtCodigoBarra.setColumns(30);
txtCodigoBarra.setToolTipText("Código de barra do produto");
txtCodigoBarra.setMinimumSize(new java.awt.Dimension(246, 25));
txtCodigoBarra.setPreferredSize(new java.awt.Dimension(246, 25));
txtCodigoBarra.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
txtCodigoBarraKeyReleased(evt);
}
});
pnFiltro.add(txtCodigoBarra);
getContentPane().add(pnFiltro, java.awt.BorderLayout.PAGE_START);
tbProdutos.setAutoCreateRowSorter(true);
tbProdutos.setModel(new ProdutoTableModel());
tbProdutos.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
tbProdutosMouseClicked(evt);
}
});
spGrade.setViewportView(tbProdutos);
getContentPane().add(spGrade, java.awt.BorderLayout.CENTER);
setSize(new java.awt.Dimension(631, 338));
setLocationRelativeTo(null);
}// </editor-fold>//GEN-END:initComponents
private void tbProdutosMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbProdutosMouseClicked
if (evt.getClickCount() == 2) {
ProdutoTableModel ptm = (ProdutoTableModel) tbProdutos.getModel();
int linhaSelecionada = tbProdutos.getRowSorter().convertRowIndexToModel(tbProdutos.getSelectedRow());
Produto produto = ptm.getRowValue(linhaSelecionada);
if (parent instanceof TelaLancamentoVenda) {
TelaLancamentoVenda lv = (TelaLancamentoVenda) parent;
lv.setProduto(produto);
dispose();
} else if (parent instanceof TelaLancamentoCompra) {
TelaLancamentoCompra lc = (TelaLancamentoCompra) parent;
lc.setProduto(produto);
dispose();
} else {
JOptionPane.showMessageDialog(this, "Campo de destino inválido.", "Alerta", JOptionPane.WARNING_MESSAGE);
}
}
}//GEN-LAST:event_tbProdutosMouseClicked
private void txtCodigoBarraKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtCodigoBarraKeyReleased
TableRowSorter rs = (TableRowSorter) tbProdutos.getRowSorter();
rs.setRowFilter(RowFilter.regexFilter("(?i)" + txtCodigoBarra.getText(), 0, 1));
}//GEN-LAST:event_txtCodigoBarraKeyReleased
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel lbFiltro;
private javax.swing.JPanel pnFiltro;
private javax.swing.JScrollPane spGrade;
private javax.swing.JTable tbProdutos;
private javax.swing.JTextField txtCodigoBarra;
// End of variables declaration//GEN-END:variables
}
| 39.104348 | 143 | 0.67356 |
04435586472f4bf647149f0354b1b118d33da146
| 2,215 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.flink.connector.jdbc.internal.connection;
import org.apache.flink.annotation.Internal;
import javax.annotation.Nullable;
import java.sql.Connection;
import java.sql.SQLException;
/**
* JDBC connection provider.
*/
@Internal
public interface JdbcConnectionProvider {
/**
* Get existing connection.
*
* @return existing connection
*/
@Nullable
Connection getConnection();
/**
* Check whether possible existing connection is valid or not through {@link Connection#isValid(int)}.
*
* @return true if existing connection is valid
* @throws SQLException sql exception throw from {@link Connection#isValid(int)}
*/
boolean isConnectionValid() throws SQLException;
/**
* Get existing connection or establish an new one if there is none.
*
* @return existing connection or newly established connection
* @throws SQLException sql exception
* @throws ClassNotFoundException driver class not found
*/
Connection getOrEstablishConnection() throws SQLException, ClassNotFoundException;
/**
* Close possible existing connection.
*/
void closeConnection();
/**
* Close possible existing connection and establish an new one.
*
* @return newly established connection
* @throws SQLException sql exception
* @throws ClassNotFoundException driver class not found
*/
Connection reestablishConnection() throws SQLException, ClassNotFoundException;
}
| 31.197183 | 103 | 0.757111 |
dda4bdbd0be511dc69f44ddab42f428fee3f0cc2
| 3,073 |
/*
* MIT License
*
* Copyright (c) 2021 Pierre Adam
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package com.jackson42.play.datatables.implementations;
import com.jackson42.play.datatables.exceptions.InitializationException;
import com.jackson42.play.datatables.interfaces.Context;
import com.jackson42.play.datatables.interfaces.Payload;
import play.i18n.Messages;
import play.i18n.MessagesApi;
import play.mvc.Http;
/**
* Context.
*
* @param <P> the type of the payload
* @author Pierre Adam
* @since 21.03.01
*/
public class BasicContext<P extends Payload> implements Context<P> {
/**
* The current request.
*/
private final Http.Request request;
/**
* The instance of the preferred messages from the request.
*/
private final MessagesApi messagesApi;
/**
* The instance of the preferred messages from the request.
*/
private final Messages messages;
/**
* The current payload.
*/
private final P payload;
/**
* Instantiates a new Basic context.
*
* @param request the request
* @param messagesApi the messages api
* @param payload the payload
*/
public BasicContext(final Http.Request request, final MessagesApi messagesApi, final P payload) {
this.request = request;
this.messagesApi = messagesApi;
this.messages = messagesApi == null ? null : messagesApi.preferred(request);
this.payload = payload;
}
@Override
public Http.Request getRequest() {
return this.request;
}
@Override
public Messages getMessages() {
if (this.messages == null) {
throw new InitializationException("Unable to resolve the Messages. MessagesApi is missing !");
}
return this.messages;
}
@Override
public P getPayload() {
return this.payload;
}
@Override
public Context<Payload> asGeneric() {
return new BasicContext<Payload>(this.request, this.messagesApi, this.payload);
}
}
| 30.73 | 106 | 0.694761 |
889f2a1b51eb86224b93916caa7a6697e3250070
| 6,575 |
/*
* Copyright 2020 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.thoughtworks.gocd.elasticagent.ecs.utils;
import org.joda.time.DateTime;
import org.joda.time.Period;
import org.junit.jupiter.api.Test;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import static com.thoughtworks.gocd.elasticagent.ecs.utils.Util.PERIOD_FORMATTER;
import static com.thoughtworks.gocd.elasticagent.ecs.utils.Util.getOrDefault;
import static org.assertj.core.api.Assertions.assertThat;
class UtilTest {
@Test
void listFromCommaSeparatedString_shouldParseCommaSeparatedStringWithoutSpace() {
String csvStringWithoutSpace = "sg-45b00b38,sg-30d2694d,sg-30d2694a,sg-30d2694s,sg-q0d2694d";
List<String> resultOfWithoutSpace = Util.listFromCommaSeparatedString(csvStringWithoutSpace);
assertThat(resultOfWithoutSpace).hasSize(5);
assertThat(resultOfWithoutSpace).contains("sg-45b00b38", "sg-30d2694d", "sg-30d2694a", "sg-30d2694s", "sg-q0d2694d");
}
@Test
void listFromCommaSeparatedString_shouldParseCommaSeparatedStringWithSpace() {
String csvStringWithoutSpace = "sg-45b00b38 , sg-30d2694d , sg-30d2694a , sg-30d2694s , sg-q0d2694d";
List<String> resultOfWithoutSpace = Util.listFromCommaSeparatedString(csvStringWithoutSpace);
assertThat(resultOfWithoutSpace).hasSize(5);
assertThat(resultOfWithoutSpace).contains("sg-45b00b38", "sg-30d2694d", "sg-30d2694a", "sg-30d2694s", "sg-q0d2694d");
}
@Test
void listFromCommaSeparatedString_shouldParseCommaSeparatedStringWithNewLine() {
String csvStringWithoutSpace = "sg-45b00b38,\n" +
"sg-30d2694d,\n" +
"sg-30d2694a,\n" +
"sg-30d2694s,\n" +
"sg-q0d2694d";
List<String> resultOfWithoutSpace = Util.listFromCommaSeparatedString(csvStringWithoutSpace);
assertThat(resultOfWithoutSpace).hasSize(5);
assertThat(resultOfWithoutSpace).contains("sg-45b00b38", "sg-30d2694d", "sg-30d2694a", "sg-30d2694s", "sg-q0d2694d");
}
@Test
void test_getOrDefault_ForStringValue() {
final String value = null, defaultValue = null;
assertThat(getOrDefault(value, defaultValue)).isNull();
assertThat(getOrDefault(null, "XYZ")).isEqualTo("XYZ");
assertThat(getOrDefault("", "XYZ")).isEqualTo("XYZ");
assertThat(getOrDefault("ABC", null)).isEqualTo("ABC");
assertThat(getOrDefault("ABC", "")).isEqualTo("ABC");
assertThat(getOrDefault("ABC", "XYZ")).isEqualTo("ABC");
}
@Test
void test_getOrDefault_ForCollectionsValue() {
final Collection<String> bothValuesProvided = getOrDefault(Collections.singletonList("ABC"), Collections.singletonList("XYZ"));
assertThat(bothValuesProvided).contains("ABC");
assertThat(bothValuesProvided.contains("XYZ")).isFalse();
final Collection<String> defaultValueNotProvided = getOrDefault(Collections.singletonList("ABC"), null);
assertThat(defaultValueNotProvided).contains("ABC");
final Collection<String> valueNotProvidedAndDefaultValueProvided = getOrDefault(null, Collections.singletonList("XYZ"));
assertThat(valueNotProvidedAndDefaultValueProvided).contains("XYZ");
assertThat(valueNotProvidedAndDefaultValueProvided.contains("ABC")).isFalse();
}
@Test
void periodFormatter_shouldProduceStringWithZeroMinutes() {
final DateTime now = DateTime.parse("2017-12-21T07:50:40.514+05:30");
final DateTime start = now.minusSeconds(30);
assertThat(PERIOD_FORMATTER.print(new Period(start, now))).isEqualTo("0 mins");
}
@Test
void periodFormatter_shouldProduceStringWithMinutes() {
final DateTime now = DateTime.parse("2017-12-21T07:50:40.514+05:30");
final DateTime start = now.minusMinutes(30);
assertThat(PERIOD_FORMATTER.print(new Period(start, now))).isEqualTo("30 mins");
}
@Test
void periodFormatter_shouldProduceStringWithHours() {
final DateTime now = DateTime.parse("2017-12-21T07:50:40.514+05:30");
final DateTime start = now.minusMinutes(30).minusHours(5);
assertThat(PERIOD_FORMATTER.print(new Period(start, now))).isEqualTo("5 hours 30 mins");
}
@Test
void periodFormatter_shouldProduceStringWithDays() {
final DateTime now = DateTime.parse("2017-12-21T07:50:40.514+05:30");
final DateTime start = now.minusMinutes(30).minusHours(5).minusDays(3);
assertThat(PERIOD_FORMATTER.print(new Period(start, now))).isEqualTo("3 days 5 hours 30 mins");
}
@Test
void periodFormatter_shouldProduceStringWithWeeks() {
final DateTime now = DateTime.parse("2017-12-21T07:50:40.514+05:30");
final DateTime start = now.minusMinutes(30).minusHours(5).minusDays(9);
assertThat(PERIOD_FORMATTER.print(new Period(start, now))).isEqualTo("1 week 2 days 5 hours 30 mins");
}
@Test
void periodFormatter_shouldProduceStringWithMonths() {
final DateTime now = DateTime.parse("2017-12-21T07:50:40.514+05:30");
final DateTime start = now.minusMinutes(30).minusHours(5).minusDays(45);
assertThat(PERIOD_FORMATTER.print(new Period(start, now))).isEqualTo("1 month 2 weeks 1 day 5 hours 30 mins");
}
@Test
void periodFormatter_shouldProduceStringWithYears() {
final DateTime now = DateTime.parse("2017-12-21T07:50:40.514+05:30");
final DateTime start = now.minusMinutes(30).minusHours(5).minusDays(390);
assertThat(PERIOD_FORMATTER.print(new Period(start, now))).isEqualTo("1 year 3 weeks 4 days 5 hours 30 mins");
}
@Test
void getIntOrDefault_shouldParseStringIfNotBlank() {
assertThat(Util.getIntOrDefault("20", 0)).isEqualTo(20);
}
@Test
void getIntOrDefault_shouldReturnDefaultValueIfGivenValueIsNull() {
assertThat(Util.getIntOrDefault(null, 0)).isEqualTo(0);
}
}
| 41.09375 | 151 | 0.705247 |
d84f3ab2ee54e9e19ba9b96d0f2a283d2e0cd7c6
| 149 |
package org.billing.accountingpoints.model;
/** Значение состояния прибора учета. */
public enum MeterState {
ACTIVE,
DISABLE,
VERIFICATION
}
| 16.555556 | 43 | 0.751678 |
ce3673835389db795bbe4e2e8d0c587e6b2a47eb
| 17,425 |
/**
* Copyright (C) 2015 Orange
* <p/>
* This software is distributed under the terms and conditions of the 'Apache-2.0'
* license which can be found in the file 'LICENSE' in this package distribution
* or at 'http://www.apache.org/licenses/LICENSE-2.0'.
*/
package com.orange.datavenue;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.view.ActionMode;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.orange.datavenue.client.Config;
import com.orange.datavenue.client.model.Callback;
import com.orange.datavenue.client.model.Page;
import com.orange.datavenue.client.model.Unit;
import com.orange.datavenue.operation.CreateStreamOperation;
import com.orange.datavenue.utils.Errors;
import com.orange.datavenue.adapter.StreamAdapter;
import com.orange.datavenue.client.model.Stream;
import com.orange.datavenue.model.Model;
import com.orange.datavenue.operation.DeleteStreamOperation;
import com.orange.datavenue.operation.GetStreamsOperation;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
/**
* @author Stéphane SANDON
*/
public class StreamListFragment extends ListFragment {
private static final String TAG_NAME = StreamListFragment.class.getSimpleName();
private SharedPreferences mPreferences;
private StreamAdapter mStreamAdapter;
private List<Stream> mStreams = new ArrayList<Stream>();
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.stream_fragment_layout, container, false);
ListView listView = (ListView)view.findViewById(android.R.id.list);
final ScrollChildSwipeRefreshLayout swipeRefreshLayout = (ScrollChildSwipeRefreshLayout) view.findViewById(R.id.refresh_layout);
swipeRefreshLayout.setColorSchemeColors(
getActivity().getResources().getColor(R.color.orange),
getActivity().getResources().getColor(R.color.hint_color),
getActivity().getResources().getColor(R.color.hint_color)
);
swipeRefreshLayout.setScrollUpChild(listView);
swipeRefreshLayout.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
getStreams();
}
});
return view;
}
private void setLoadingIndicator(final boolean active) {
if (getView() == null) {
return;
}
final SwipeRefreshLayout srl = (SwipeRefreshLayout) getView().findViewById(R.id.refresh_layout);
srl.post(new Runnable() {
@Override
public void run() {
srl.setRefreshing(active);
}
});
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (mStreamAdapter == null) {
mStreamAdapter = new StreamAdapter(getActivity(), R.layout.stream_item, R.id.name, mStreams);
setListAdapter(mStreamAdapter);
getStreams();
}
getListView().setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Log.d(TAG_NAME, "onItemClick()");
if (mActionMode != null) {
mActionMode.finish();
}
Model.instance.currentStream = (Stream) parent.getItemAtPosition(position);
((StreamActivity) getActivity()).changeLayout(StreamActivity.MODE_DETAIL);
}
});
getListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
Log.d(TAG_NAME, "onItemLongClick()");
Model.instance.currentStream = (Stream) parent.getItemAtPosition(position);
mSelected = position;
getListView().setItemChecked(mSelected, true);
mActionMode = ((AppCompatActivity) getActivity()).startSupportActionMode(mActionModeCallback);
return true;
}
});
}
private int mSelected;
private ActionMode mActionMode;
private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
MenuInflater inflater = mode.getMenuInflater();
inflater.inflate(R.menu.menu_mode_stream, menu);
return true;
}
@Override
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
return false;
}
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
switch (item.getItemId()) {
case R.id.action_delete_stream:
deleteStream();
mode.finish();
return true;
case R.id.action_share_stream:
Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
String message = String.format("%1$s/datasources/%2$s/streams/%3$s",
Config.DEFAULT_BASE_URL,
Model.instance.currentDatasource.getId(),
Model.instance.currentStream.getId());
sendIntent.putExtra(Intent.EXTRA_TEXT, message);
sendIntent.setType("text/plain");
startActivity(sendIntent);
mode.finish();
return true;
}
return false;
}
@Override
public void onDestroyActionMode(ActionMode mode) {
Log.d(TAG_NAME, "onDestroyActionMode()");
mActionMode = null;
}
};
@Override
public void onDestroyView() {
unregisterForContextMenu(getListView());
super.onDestroyView();
}
private void setTitle(int num, int total) {
if (getActivity() != null) {
getActivity().setTitle(String.format(getString(R.string.stream_activity_count), num, total));
}
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.menu_stream, menu);
super.onCreateOptionsMenu(menu, inflater);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_add_stream:
createStream();
return true;
default:
break;
}
return false;
}
@Override
public void onResume() {
super.onResume();
Log.d(TAG_NAME, "onResume()");
setTitle(Model.instance.streams.size(), Model.instance.streams.size());
}
@Override
public void onStart() {
super.onStart();
Log.d(TAG_NAME, "onStart()");
}
@Override
public void onStop() {
super.onStop();
Log.d(TAG_NAME, "onStop()");
}
private void getStreams() {
setLoadingIndicator(true);
GetStreamsOperation getStreamOperation =
new GetStreamsOperation(
Model.instance.oapiKey,
Model.instance.key,
Model.instance.currentDatasource,
new OperationCallback() {
@Override
public void process(Object object, Exception exception) {
setLoadingIndicator(false);
if (exception == null) {
Page<List<Stream>> page = (Page<List<Stream>>) object;
Model.instance.streams = page.object;
Log.d(TAG_NAME, "streams received = " + Model.instance.streams.size());
setTitle(page.object.size(), page.totalCount);
updateAdapter();
} else {
Errors.displayError(getActivity(), exception);
}
}
});
getStreamOperation.execute();
}
public void updateAdapter() {
Log.d(TAG_NAME, "updateAdapter()");
if (mStreamAdapter != null) {
mStreamAdapter.changeDataSet(Model.instance.streams);
mStreamAdapter.notifyDataSetChanged();
}
}
/**
*
*/
private void deleteStream() {
final android.app.Dialog dialog = new android.app.Dialog(getActivity());
dialog.setContentView(R.layout.delete_dialog);
dialog.setTitle(R.string.delete);
TextView info = (TextView) dialog.findViewById(R.id.info_label);
info.setText(String.format(getString(R.string.delete_stream), Model.instance.currentStream.getId()));
Button deleteButton = (Button) dialog.findViewById(R.id.delete_button);
deleteButton.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View view) {
Log.d(TAG_NAME, "datasource : " + Model.instance.currentDatasource.getId());
Log.d(TAG_NAME, "stream : " + Model.instance.currentStream.getId());
DeleteStreamOperation deleteStreamOperation = new DeleteStreamOperation(
Model.instance.oapiKey,
Model.instance.key,
Model.instance.currentDatasource,
Model.instance.currentStream,
new OperationCallback() {
@Override
public void process(Object object, Exception exception) {
if (exception == null) {
getStreams(); // reload
} else {
Errors.displayError(getActivity(), exception);
}
}
});
deleteStreamOperation.execute("");
dialog.dismiss();
}
});
Button cancelDeleteButton = (Button) dialog.findViewById(R.id.cancel_button);
cancelDeleteButton.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View arg0) {
dialog.dismiss();
}
});
dialog.setCancelable(false);
dialog.show();
}
/**
*
*/
private void createStream() {
final android.app.Dialog dialog = new android.app.Dialog(getActivity());
dialog.setContentView(R.layout.create_stream_dialog);
dialog.setTitle(R.string.add_stream);
final LinearLayout callbackLayout = (LinearLayout) dialog.findViewById(R.id.callback_layout);
final EditText name = (EditText) dialog.findViewById(R.id.name);
final EditText description = (EditText) dialog.findViewById(R.id.description);
final EditText unit = (EditText) dialog.findViewById(R.id.unit);
final EditText symbol = (EditText) dialog.findViewById(R.id.symbol);
final EditText callback = (EditText) dialog.findViewById(R.id.callback);
final EditText latitude = (EditText) dialog.findViewById(R.id.latitude);
final EditText longitude = (EditText) dialog.findViewById(R.id.longitude);
Button actionButton = (Button) dialog.findViewById(R.id.add_button);
callbackLayout.setVisibility(View.VISIBLE);
actionButton.setText(getString(R.string.add_stream));
actionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d(TAG_NAME, "name : " + name.getText().toString());
Log.d(TAG_NAME, "description : " + description.getText().toString());
Log.d(TAG_NAME, "unit : " + unit.getText().toString());
Log.d(TAG_NAME, "symbol : " + symbol.getText().toString());
Stream newStream = new Stream();
newStream.setName(name.getText().toString());
newStream.setDescription(description.getText().toString());
/**
* Allocate new Location
*/
Double[] location = null;
String strLatitude = latitude.getText().toString();
String strLongitude = longitude.getText().toString();
try {
if ((!"".equals(strLatitude)) && (!"".equals(strLongitude))) {
location = new Double[2];
location[0] = Double.parseDouble(strLatitude);
location[1] = Double.parseDouble(strLongitude);
}
} catch (NumberFormatException e) {
Log.e(TAG_NAME, e.toString());
location = null;
}
if (location != null) {
newStream.setLocation(location);
}
/**************************************************************************/
/**
* Allocate new Unit & Symbol
*/
Unit newUnit = null;
String strUnit = unit.getText().toString();
String strSymbol = symbol.getText().toString();
if (!"".equals(strUnit)) {
if (newUnit == null) {
newUnit = new Unit();
}
newUnit.setName(strUnit);
}
if (!"".equals(strSymbol)) {
if (newUnit == null) {
newUnit = new Unit();
}
newUnit.setSymbol(strSymbol);
}
if (newUnit != null) {
newStream.setUnit(newUnit);
}
/**
* Allocate new Callback
*/
Callback newCallback = null;
String callbackUrl = callback.getText().toString();
if (!"".equals(callbackUrl)) {
try {
URL url = new URL(callbackUrl);
newCallback = new Callback();
newCallback.setUrl(url.toString());
newCallback.setName("Callback");
newCallback.setDescription("application callback");
newCallback.setStatus("activated");
} catch (MalformedURLException e) {
Log.e(TAG_NAME, e.toString());
callback.setText("");
}
}
if (newCallback != null) {
newStream.setCallback(newCallback);
}
/**************************************************************************/
CreateStreamOperation createStreamOperation = new CreateStreamOperation(
Model.instance.oapiKey,
Model.instance.key,
Model.instance.currentDatasource,
newStream,
new OperationCallback() {
@Override
public void process(Object object, Exception exception) {
if (exception == null) {
getStreams();
} else {
Errors.displayError(getActivity(), exception);
}
}
});
createStreamOperation.execute("");
dialog.dismiss();
}
});
Button cancelButton = (Button) dialog.findViewById(R.id.cancel_button);
cancelButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
}
});
dialog.setCancelable(false);
dialog.show();
}
}
| 36.453975 | 136 | 0.54835 |
08e96a0db7a8149bc54b0a9c897156f831b93518
| 6,117 |
/*
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
* (the "License"). You may not use this work except in compliance with the License, which is
* available at www.apache.org/licenses/LICENSE-2.0
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied, as more fully set forth in the License.
*
* See the NOTICE file distributed with this work for information regarding copyright ownership.
*/
package alluxio.master.journal.ufs;
import alluxio.Configuration;
import alluxio.PropertyKey;
import alluxio.master.journal.Journal;
import alluxio.master.journal.JournalReader;
import alluxio.master.journal.JournalWriter;
import alluxio.master.journal.options.JournalReaderOptions;
import alluxio.master.journal.options.JournalWriterOptions;
import alluxio.underfs.UfsStatus;
import alluxio.underfs.UnderFileSystem;
import alluxio.underfs.options.DeleteOptions;
import alluxio.util.URIUtils;
import alluxio.util.UnderFileSystemUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.net.URI;
import javax.annotation.concurrent.ThreadSafe;
/**
* Implementation of UFS-based journal.
*
* The journal is made up of 2 components:
* - The checkpoint: a snapshot of the master state
* - The log entries: incremental entries to apply to the checkpoint.
*
* The journal log entries must be self-contained. Checkpoint is considered as a compaction of
* a set of journal log entries. If the master does not do any checkpoint, the journal should
* still be sufficient.
*
* Journal file structure:
* journal_folder/version/logs/StartSequenceNumber-EndSequenceNumber
* journal_folder/version/checkpoints/0-EndSequenceNumber
* journal_folder/version/.tmp/random_id
*/
@ThreadSafe
public class UfsJournal implements Journal {
private static final Logger LOG = LoggerFactory.getLogger(UfsJournal.class);
/**
* This is set to Long.MAX_VALUE such that the current log can be sorted after any other
* completed logs.
*/
public static final long UNKNOWN_SEQUENCE_NUMBER = Long.MAX_VALUE;
/** The journal version. */
public static final String VERSION = "v1";
/** Directory for journal edit logs including the incomplete log file. */
private static final String LOG_DIRNAME = "logs";
/** Directory for committed checkpoints. */
private static final String CHECKPOINT_DIRNAME = "checkpoints";
/** Directory for temporary files. */
private static final String TMP_DIRNAME = ".tmp";
private final URI mLogDir;
private final URI mCheckpointDir;
private final URI mTmpDir;
/** The location where this journal is stored. */
private final URI mLocation;
/** The UFS where the journal is being written to. */
private final UnderFileSystem mUfs;
/**
* Creates a new instance of {@link UfsJournal}.
*
* @param location the location for this journal
*/
public UfsJournal(URI location) {
this(location, UnderFileSystem.Factory.create(location));
}
/**
* Creates a new instance of {@link UfsJournal}.
*
* @param location the location for this journal
* @param ufs the under file system
*/
UfsJournal(URI location, UnderFileSystem ufs) {
mLocation = URIUtils.appendPathOrDie(location, VERSION);
mUfs = ufs;
mLogDir = URIUtils.appendPathOrDie(mLocation, LOG_DIRNAME);
mCheckpointDir = URIUtils.appendPathOrDie(mLocation, CHECKPOINT_DIRNAME);
mTmpDir = URIUtils.appendPathOrDie(mLocation, TMP_DIRNAME);
}
@Override
public URI getLocation() {
return mLocation;
}
@Override
public JournalReader getReader(JournalReaderOptions options) {
return new UfsJournalReader(this, options);
}
@Override
public JournalWriter getWriter(JournalWriterOptions options) throws IOException {
if (options.isPrimary()) {
return new UfsJournalLogWriter(this, options);
} else {
return new UfsJournalCheckpointWriter(this, options);
}
}
@Override
public long getNextSequenceNumberToCheckpoint() throws IOException {
return UfsJournalSnapshot.getNextLogSequenceNumberToCheckpoint(this);
}
@Override
public boolean isFormatted() throws IOException {
UfsStatus[] files = mUfs.listStatus(mLocation.toString());
if (files == null) {
return false;
}
// Search for the format file.
String formatFilePrefix = Configuration.get(PropertyKey.MASTER_FORMAT_FILE_PREFIX);
for (UfsStatus file : files) {
if (file.getName().startsWith(formatFilePrefix)) {
return true;
}
}
return false;
}
@Override
public void format() throws IOException {
URI location = getLocation();
LOG.info("Formatting {}", location);
if (mUfs.isDirectory(location.toString())) {
for (UfsStatus status : mUfs.listStatus(location.toString())) {
String childPath = URIUtils.appendPathOrDie(location, status.getName()).toString();
if (status.isDirectory()
&& !mUfs.deleteDirectory(childPath, DeleteOptions.defaults().setRecursive(true))
|| status.isFile() && !mUfs.deleteFile(childPath)) {
throw new IOException(String.format("Failed to delete %s", childPath));
}
}
} else if (!mUfs.mkdirs(location.toString())) {
throw new IOException(String.format("Failed to create %s", location));
}
// Create a breadcrumb that indicates that the journal folder has been formatted.
UnderFileSystemUtils.touch(mUfs, URIUtils.appendPathOrDie(location,
Configuration.get(PropertyKey.MASTER_FORMAT_FILE_PREFIX) + System.currentTimeMillis())
.toString());
}
/**
* @return the log directory location
*/
URI getLogDir() {
return mLogDir;
}
/**
* @return the checkpoint directory location
*/
URI getCheckpointDir() {
return mCheckpointDir;
}
/**
* @return the temporary directory location
*/
URI getTmpDir() {
return mTmpDir;
}
/**
* @return the under file system instance
*/
UnderFileSystem getUfs() {
return mUfs;
}
}
| 31.694301 | 98 | 0.722413 |
52282474e6be8ea75b93cd84de0741c0ee8ca06b
| 13,569 |
/**
* Copyright (C) 2014 - present by Marc Henrard
*/
package marc.henrard.book.algorithmicdifferentiation.finance.formula;
import org.apache.commons.math3.distribution.NormalDistribution;
import marc.henrard.book.algorithmicdifferentiation.mathad.MathAad;
import marc.henrard.book.algorithmicdifferentiation.mathad.MathSad;
import marc.henrard.book.algorithmicdifferentiation.tape.TapeAad;
import marc.henrard.book.algorithmicdifferentiation.type.DoubleAad;
import marc.henrard.book.algorithmicdifferentiation.type.DoubleDerivatives;
import marc.henrard.book.algorithmicdifferentiation.type.DoubleSad;
/**
* Implementation of the Black-Scholes formula for option pricing.
* <p>
* Implementation of the price and different algorithmic differentiation versions.
* <p>
* The mathematical library underlying is
* <a href="http://commons.apache.org/proper/commons-math/">Apache Commons Mathematics Library</a>
*/
public class BlackFormula2 {
/** The normal distribution implementation. */
private static final NormalDistribution NORMAL = new NormalDistribution(0.0d, 1.0d);
/**
* Returns the option price computed by the Black-Scholes formula.
* @param forward The forward price/rate.
* @param volatility The log-normal volatility of the model.
* @param numeraire The numeraire.
* @param strike The strike price/rate.
* @param expiry The time to expiry.
* @param isCall The call (true) / put (false) flag.
* @return The price.
* @throws MathException
*/
public static double price(
double forward,
double volatility,
double numeraire,
double strike,
double expiry,
boolean isCall) {
double periodVolatility = volatility * Math.sqrt(expiry);
double dPlus = Math.log(forward / strike) / periodVolatility + 0.5d * periodVolatility;
double dMinus = dPlus - periodVolatility;
double omega = isCall ? 1.0d : -1.0d;
double nPlus = NORMAL.cumulativeProbability(omega * dPlus);
double nMinus = NORMAL.cumulativeProbability(omega * dMinus);
double price = numeraire * omega * (forward * nPlus - strike * nMinus);
return price;
}
/**
* Returns the option price for the Black-Scholes formula and its derivatives with respect to
* [0] forward, [1] volatility, [2] numeraire, [3] strike, and [4] expiry.
* The derivatives are computed by Standard Algorithmic Differentiation.
* @param forward The forward price/rate.
* @param volatility The log-normal volatility of the model.
* @param numeraire The numeraire.
* @param strike The strike price/rate.
* @param expiry The time to expiry.
* @param isCall The call (true) / put (false) flag.
* @return The price and derivatives.
* @throws MathException
*/
public static DoubleDerivatives price_Sad(
double forward,
double volatility,
double numeraire,
double strike,
double expiry,
boolean isCall) {
// Forward sweep - function
double omega = isCall ? 1.0d : -1.0d;
double periodVolatility = volatility * Math.sqrt(expiry);
double dPlus = Math.log(forward / strike) / periodVolatility + 0.5d * periodVolatility;
double dMinus = dPlus - periodVolatility;
double nPlus = NORMAL.cumulativeProbability(omega * dPlus);
double nMinus = NORMAL.cumulativeProbability(omega * dMinus);
double price = numeraire * omega * (forward * nPlus - strike * nMinus);
// Forward sweep - derivatives
int nbInputs = 5;
double[] inputDot = new double[nbInputs];
for (int loopinput = 0; loopinput < nbInputs; loopinput++) {
inputDot[loopinput] = 1.0d;
}
double[] periodVolatilityDot = new double[nbInputs];
periodVolatilityDot[1] = Math.sqrt(expiry) * inputDot[1];
periodVolatilityDot[4] = volatility * 0.5d / Math.sqrt(expiry) * inputDot[4];
double[] dPlusDot = new double[nbInputs];
for (int loopinput = 0; loopinput < nbInputs; loopinput++) {
dPlusDot[loopinput] = (Math.log(forward / strike) * -1.0d / (periodVolatility * periodVolatility) + 0.5d)
* periodVolatilityDot[loopinput];
}
dPlusDot[0] += 1.0d / (periodVolatility * forward) * inputDot[0];
dPlusDot[3] += -1.0d / (periodVolatility * forward) * inputDot[3];
double[] dMinusDot = new double[nbInputs];
for (int loopinput = 0; loopinput < nbInputs; loopinput++) {
dMinusDot[loopinput] = dPlusDot[loopinput] - periodVolatilityDot[loopinput];
}
double[] nPlusDot = new double[nbInputs];
double nPdfpPlus = NORMAL.density(omega * dPlus);
for (int loopinput = 0; loopinput < nbInputs; loopinput++) {
nPlusDot[loopinput] = nPdfpPlus * omega * dPlusDot[loopinput];
}
double[] nMinusDot = new double[nbInputs];
double nPdfdMinus = NORMAL.density(omega * dMinus);
for (int loopinput = 0; loopinput < nbInputs; loopinput++) {
nMinusDot[loopinput] = nPdfdMinus * omega * dMinusDot[loopinput];
}
double[] priceDot = new double[nbInputs];
for (int loopinput = 0; loopinput < nbInputs; loopinput++) {
priceDot[loopinput] = numeraire * omega * forward * nPlusDot[loopinput]
- numeraire * omega * strike * nMinusDot[loopinput];
}
priceDot[0] += numeraire * omega * nPlus * inputDot[0];
priceDot[2] += omega * (forward * nPlus - strike * nMinus) * inputDot[2];
priceDot[3] += -numeraire * omega * nMinus * inputDot[3];
return new DoubleDerivatives(price, priceDot);
}
/**
* Returns the option price for the Black-Scholes formula and its derivatives with respect to
* [0] forward, [1] volatility, [2] numeraire, [3] strike, and [4] expiry.
* The derivatives are computed by automatic Standard Algorithmic Differentiation.
* <p>
* The mathematical library underlying the automatic AD is
* <a href="https://dst.lbl.gov/ACSSoftware/colt/index.html">Colt</a>
* @param forward The forward price/rate.
* @param volatility The log-normal volatility of the model.
* @param numeraire The numeraire.
* @param strike The strike price/rate.
* @param expiry The time to expiry.
* @param isCall The call (true) / put (false) flag.
* @return The price and derivatives.
* @throws MathException
*/
public static DoubleSad price_Sad_Automatic(
double forward,
double volatility,
double numeraire,
double strike,
double expiry,
boolean isCall) {
int nbInputs = 5;
double[] input = new double[nbInputs];
input[0] = forward;
input[1] = volatility;
input[2] = numeraire;
input[3] = strike;
input[4] = expiry;
DoubleSad[] inputSad = DoubleSad.init(input);
double omega = isCall ? 1.0d : -1.0d;
DoubleSad periodVolatility = MathSad.multipliedBy(inputSad[1], MathSad.sqrt(inputSad[4]));
DoubleSad dPlus = MathSad.plus(
MathSad.dividedBy(MathSad.log(MathSad.dividedBy(inputSad[0], inputSad[3])), periodVolatility),
MathSad.multipliedBy(periodVolatility, 0.5d));
DoubleSad dMinus = MathSad.minus(dPlus, periodVolatility);
DoubleSad nPlus = MathSad.normalCdf(MathSad.multipliedBy(dPlus, omega));
DoubleSad nMinus = MathSad.normalCdf(MathSad.multipliedBy(dMinus, omega));
DoubleSad price = MathSad.multipliedBy(MathSad.multipliedBy(inputSad[2], omega),
MathSad.minus(MathSad.multipliedBy(inputSad[0], nPlus), MathSad.multipliedBy(inputSad[3], nMinus)));
return price;
}
/**
* Returns the option price for the Black-Scholes formula and its derivatives with respect to
* [0] forward, [1] volatility, [2] numeraire, [3] strike, and [4] expiry.
* The derivatives are computed by Adjoint Algorithmic Differentiation.
* @param forward The forward price/rate.
* @param volatility The log-normal volatility of the model.
* @param numeraire The numeraire.
* @param strike The strike price/rate.
* @param expiry The time to expiry.
* @param isCall The call (true) / put (false) flag.
* @return The price and derivatives.
* @throws MathException
*/
public static DoubleDerivatives price_Aad(
double forward,
double volatility,
double numeraire,
double strike,
double expiry,
boolean isCall) {
// Forward sweep - function
double omega = isCall ? 1.0d : -1.0d;
double periodVolatility = volatility * Math.sqrt(expiry);
double dPlus = Math.log(forward / strike) / periodVolatility + 0.5d * periodVolatility;
double dMinus = dPlus - periodVolatility;
double nPlus = NORMAL.cumulativeProbability(omega * dPlus);
double nMinus = NORMAL.cumulativeProbability(omega * dMinus);
double price = numeraire * omega * (forward * nPlus - strike * nMinus);
// Backward sweep - derivatives
double priceBar = 1.0;
double nMinusBar = numeraire * omega * -strike * priceBar;
double nPlusBar = numeraire * omega * forward * priceBar;
double dMinusBar = NORMAL.density(omega * dMinus) * omega * nMinusBar;
double dPlusBar = 1.0d * dMinusBar + NORMAL.density(omega * dPlus) * omega * nPlusBar;
// Note: dPlusBar is always 0; it is the optimal exercise boundary.
double periodVolatilityBar = -1.0d * dMinusBar +
(-Math.log(forward / strike) / (periodVolatility * periodVolatility) + 0.5d) * dPlusBar;
double[] inputBar = new double[5]; // forward, volatility, numeraire, strike, expiry
inputBar[4] = volatility * 0.5 / Math.sqrt(expiry) * periodVolatilityBar;
inputBar[3] = -1.0d / strike / periodVolatility * dPlusBar + numeraire * omega * -nMinus * priceBar;
inputBar[2] = omega * (forward * nPlus - strike * nMinus) * priceBar;
inputBar[1] = Math.sqrt(expiry) * periodVolatilityBar;
inputBar[0] = 1.0d / forward / periodVolatility * dPlusBar + numeraire * omega * nPlus * priceBar;
return new DoubleDerivatives(price, inputBar);
}
/**
* Returns the option price for the Black-Scholes formula and its derivatives with respect to
* [0] forward, [1] volatility, [2] numeraire, [3] strike, and [4] expiry.
* The derivatives are computed by Adjoint Algorithmic Differentiation.
* The formula is optimized to reduce computation time by using domain specific knowledge.
* @param forward The forward price/rate.
* @param volatility The log-normal volatility of the model.
* @param numeraire The numeraire.
* @param strike The strike price/rate.
* @param expiry The time to expiry.
* @param isCall The call (true) / put (false) flag.
* @return The price and derivatives.
* @throws MathException
*/
public static DoubleDerivatives price_Aad_Optimized(
double forward,
double volatility,
double numeraire,
double strike,
double expiry,
boolean isCall) {
// Forward sweep - function
double omega = isCall ? 1.0d : -1.0d;
double sqrtExpiry = Math.sqrt(expiry);
double periodVolatility = volatility * sqrtExpiry;
double dPlus = Math.log(forward / strike) / periodVolatility + 0.5d * periodVolatility;
double dMinus = dPlus - periodVolatility;
double nPlus = NORMAL.cumulativeProbability(omega * dPlus);
double nMinus = NORMAL.cumulativeProbability(omega * dMinus);
double price = numeraire * omega * (forward * nPlus - strike * nMinus);
// Backward sweep - derivatives
double priceBar = 1.0;
double nMinusBar = numeraire * omega * -strike * priceBar;
double dMinusBar = NORMAL.density(omega * dMinus) * omega * nMinusBar;
double periodVolatilityBar = -1.0d * dMinusBar;
double[] inputBar = new double[5]; // forward, volatility, numeraire, strike, expiry
inputBar[4] = volatility * 0.5 / sqrtExpiry * periodVolatilityBar;
inputBar[3] = numeraire * omega * -nMinus * priceBar;
inputBar[2] = omega * (forward * nPlus - strike * nMinus) * priceBar;
inputBar[1] = sqrtExpiry * periodVolatilityBar;
inputBar[0] = numeraire * omega * nPlus * priceBar;
return new DoubleDerivatives(price, inputBar);
}
/**
* Returns the option price for the Black-Scholes formula as a {@link DoubleAad}.
* The method also update the tape of type {@link TapeAad} which can be use to compute derivatives
* by automatic AD.
* @param forward The forward price/rate.
* @param volatility The log-normal volatility of the model.
* @param numeraire The numeraire.
* @param strike The strike price/rate.
* @param expiry The time to expiry.
* @param isCall The call (true) / put (false) flag.
* @return The price and derivatives.
* @throws MathException
*/
public static DoubleAad price_Aad_Automatic(
DoubleAad forward,
DoubleAad volatility,
DoubleAad numeraire,
DoubleAad strike,
DoubleAad expiry,
boolean isCall,
TapeAad tape) {
double omega = isCall ? 1.0d : -1.0d;
DoubleAad periodVolatility = MathAad.multipliedBy(volatility, MathAad.sqrt(expiry, tape), tape);
DoubleAad dPlus = MathAad.plus(MathAad.dividedBy(MathAad.log(MathAad.dividedBy(forward, strike, tape), tape),
periodVolatility, tape), MathAad.multipliedBy(periodVolatility, 0.5d, tape), tape);
DoubleAad dMinus = MathAad.minus(dPlus, periodVolatility, tape);
DoubleAad nPlus = MathAad.normalCdf(MathAad.multipliedBy(dPlus, omega, tape), tape);
DoubleAad nMinus = MathAad.normalCdf(MathAad.multipliedBy(dMinus, omega, tape), tape);
DoubleAad price = MathAad.multipliedBy(MathAad.multipliedBy(numeraire, omega, tape),
MathAad.minus(MathAad.multipliedBy(forward, nPlus, tape), MathAad.multipliedBy(strike, nMinus, tape), tape), tape);
return price;
}
}
| 46.31058 | 123 | 0.693566 |
16579783075a1d4a3d0660ff4ef398966c0b2fc4
| 2,970 |
package com.lunatech.postroom;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
@Mojo(name = "generate")
public class GeneratorMojo extends AbstractMojo {
@Parameter(defaultValue = "${project}")
private MavenProject project;
@Parameter(defaultValue="${project.build.directory}/generated-sources/postroom", required=true)
private File targetFolder;
@Parameter(defaultValue="8")
private Integer maxArity;
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
for(int i = 1; i <= maxArity; i++) {
Path file = targetFolder.toPath()
.resolve("com/lunatech/postroom/typed/TypedMappingStage" + i + ".java");
file.toFile().getParentFile().mkdirs();
if (!file.toFile().exists()) {
try (BufferedWriter out = Files.newBufferedWriter(file)) {
out.write(Generator.generateTypedMappingStage(i));
} catch (IOException e) {
throw new MojoExecutionException("Generating TypedMappingStage failed", e);
}
}
}
for(int i = 1; i <= maxArity; i++) {
Path file = targetFolder.toPath()
.resolve("com/lunatech/postroom/typed/TypedListWrapper" + i + ".java");
file.toFile().getParentFile().mkdirs();
if (!file.toFile().exists()) {
try (BufferedWriter out = Files.newBufferedWriter(file)) {
out.write(Generator.generateTypedListWrapper(i));
} catch (IOException e) {
throw new MojoExecutionException("Generating TypedListWrapper failed", e);
}
}
}
// Up to arity 8 is provided by vavr.
for(int i = 9; i <= maxArity; i++) {
Path file = targetFolder.toPath()
.resolve("com/lunatech/postroom/typed/Function" + i + ".java");
file.toFile().getParentFile().mkdirs();
if (!file.toFile().exists()) {
try (BufferedWriter out = Files.newBufferedWriter(file)) {
out.write(Generator.generateFunctionN(i));
} catch (IOException e) {
throw new MojoExecutionException("Generating Function failed", e);
}
}
}
Path mappingsFile = targetFolder.toPath().resolve("com/lunatech/postroom/typed/TypedMappings.java");
if(!mappingsFile.toFile().exists()) {
try (BufferedWriter out = Files.newBufferedWriter(mappingsFile)) {
out.write(Generator.generateFactoryMethods(maxArity));
} catch (IOException e) {
throw new MojoExecutionException("Generating Mappings file failed", e);
}
}
project.addCompileSourceRoot(targetFolder.toPath().toString());
}
}
| 33.370787 | 104 | 0.674074 |
a6313c0dc51f64f27b218a07e058410695b811ce
| 1,884 |
/*
* Copyright 2019 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.uberfire.java.nio.fs.jgit.util.commands;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevWalk;
import org.uberfire.java.nio.fs.jgit.util.Git;
import org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;
import static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;
import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;
public class GetCommit {
private final Git git;
private final String commitId;
public GetCommit(final Git git,
final String commitId) {
this.git = checkNotNull("git",
git);
this.commitId = checkNotEmpty("commitId",
commitId);
}
public RevCommit execute() {
final Repository repository = git.getRepository();
try (final RevWalk revWalk = new RevWalk(repository)) {
final ObjectId id = repository.resolve(this.commitId);
return id != null ? revWalk.parseCommit(id) : null;
} catch (Exception e) {
throw new GitException("Error when trying to get commit", e);
}
}
}
| 35.54717 | 82 | 0.686306 |
fc9df0a3f83380daf8c41fb9193f5f0609682757
| 2,442 |
/*
The MIT License
Copyright 2016, 2017, 2018 Rudy Alex Kohn.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package ui;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.rmi.RemoteException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Old / Temporary / Static listener classes for UI
*
* @author Rudy Alex Kohn s133235@student.dtu.dk
*/
public class Listeners {
/**
* Listener for the Ping menu option
*/
public static class PingListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
System.out.println("Pinging server..");
try {
UI.getInstance().game.ping(UI.getInstance(), System.currentTimeMillis());
} catch (RemoteException ex) {
Logger.getLogger(UI.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
/* Listener for Options menu */
public static class OptionsListener implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
UIHelpers.messageDialog("This feature has been disabled until further notice.", "Options");
// if (Options.opts == null) {
// options.setup(ui);
// } else {
// options.setVisible(true);
// }
}
}
}
| 33 | 103 | 0.678133 |
cff4a787a40672556e6da2676d9fb9c5b53c8386
| 410 |
package main.util.task;
import main.enums.Priority;
import main.enums.TaskType;
import main.util.Task;
/**
* A task sub class notifying the system to exit the program
*
* @author andreashammer
*/
public class TaskQuit extends Task {
/**
* Initializes a new quit task with the specified priority
*
* @param p The task priority
*/
public TaskQuit(Priority p){
super(p, TaskType.Quit);
}
}
| 17.826087 | 60 | 0.702439 |
d494076eb70b9fc9d7b3bdafc12e4d40896849d7
| 591 |
package org.digitalcrafting.theOne.service.outposts.domain;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequiredArgsConstructor
@RequestMapping("/outposts/v1")
public class OutpostsController {
private final OutpostsControllerService service;
@GetMapping("/")
public List<OutpostModel> getAllOutposts() {
return service.getAllOutposts();
}
}
| 26.863636 | 62 | 0.800338 |
e17c1b2e37e341a871cebfd479e5a190e00155c7
| 298 |
package org.carbon.sample.v2.app.oauth;
import lombok.Getter;
/**
* @author Shota Oda 2017/08/11.
*/
@Getter
public class OAuth2AccessTokenErrorResponse {
private String error;
public OAuth2AccessTokenErrorResponse(OAuth2Exception ex) {
this.error = ex.getErrorCode();
}
}
| 18.625 | 63 | 0.714765 |
4f3bdbd65c660a0d995ca1a9789c4ab9030148a8
| 15,374 |
package de.esri.geotrigger.core;
import java.net.URLEncoder;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class TriggerHandler {
private static Logger log = LogManager.getLogger(TriggerHandler.class.getName());
/**
* Create a trigger in the ArcGIS geotrigger service. The trigger will be a circle.
* @param triggerId The trigger id.
* @param tags The tags for the trigger.
* @param direction The trigger direction (enter / leave).
* @param latitude The latitude value. (WGS84)
* @param longitude The longitude value. (WGS84)
* @param radius The trigger radius.
* @param notificationText The notification text of the trigger.
* @param notificationUrl The notification URL.
* @param notificationIcon The notification icon.
* @param notificationSound The notification sound.
* @param notificationData The notification Data.
* @param callBackUrl The callback URL.
* @param properties The trigger properties.
* @param trackingProfile The tracking profile.
* @param times The times value.
* @param rateLimit The rate limit.
* @param boundingBoxReturnFormat The format of the bounding boc return value.
* @param geoReturnFormat The format of the geo return value.
* @param fromTimestamp The from timestamp value.
* @param toTimestamp The to timestamp value.
*/
public void createTrigger(String triggerId, String[] tags, String direction, double latitude, double longitude, double radius, String notificationText,
String notificationUrl, String notificationIcon, String notificationSound, String notificationData, String callBackUrl, String properties,
String trackingProfile, int times, int rateLimit, String boundingBoxReturnFormat, String geoReturnFormat, long fromTimestamp, long toTimestamp){
TriggerBuilder builder = new TriggerBuilder();
builder.setTriggerId(triggerId);
builder.setTags(tags);
builder.setDirection(direction);
builder.setGeo(latitude, longitude, radius);
if(!Util.isEmpty(notificationText)){
builder.setNotificationText(notificationText);
}
if(!Util.isEmpty(notificationUrl)){
builder.setNotificationUrl(notificationUrl);
}
if(!Util.isEmpty(notificationIcon)){
builder.setNotificationIcon(notificationIcon);
}
if(!Util.isEmpty(notificationSound)){
builder.setNotificationSound(notificationSound);
}
if(!Util.isEmpty(notificationData)){
JSONObject notificationDataJson = null;
try{
notificationDataJson = new JSONObject(notificationData);
builder.setNotificationData(notificationDataJson);
}catch(Exception e){
log.error("Error parsing JSON for notification data: " + e.getMessage());
}
}
if(!Util.isEmpty(callBackUrl)){
builder.setCallbackUrl(callBackUrl);
}
if(!Util.isEmpty(properties)){
JSONObject propertiesJson = null;
try{
propertiesJson = new JSONObject(properties);
builder.setProperties(propertiesJson);
}catch(Exception e){
log.error("Error parsing JSON for properties: " + e.getMessage());
}
}
if(!Util.isEmpty(trackingProfile)){
builder.setTrackingProfile(trackingProfile);
}
if(times >= 0){
builder.setTimes(times);
}
if(rateLimit >= 0){
builder.setRateLimit(rateLimit);
}
if(!Util.isEmpty(boundingBoxReturnFormat)){
builder.setBoundingBoxReturnFormat(boundingBoxReturnFormat);
}
if(!Util.isEmpty(geoReturnFormat)){
builder.setGeoReturnFormat(geoReturnFormat);
}
if(fromTimestamp > 0){
builder.setFromTimestamp(fromTimestamp);
}
if(toTimestamp > 0){
builder.setToTimestamp(toTimestamp);
}
JSONObject params = builder.build();
// Send the request to the Geotrigger API.
GeotriggerApiClient.runRequest("trigger/create", params, new GeotriggerApiListener() {
@Override
public void onSuccess(JSONObject data) {
log.info("Trigger created.");
}
@Override
public void onFailure(Throwable e) {
log.error("Error creating trigger: "+e.getMessage());
}
});
}
/**
* Create a trigger in the ArcGIS geotrigger service. The trigger will be a polygon.
* @param triggerId The trigger id.
* @param tags The tags for the trigger.
* @param direction The trigger direction (enter / leave).
* @param geoJson The JSON of the polygon.
* @param notificationText The notification text of the trigger.
* @param notificationUrl The notification URL.
* @param notificationIcon The notification icon.
* @param notificationSound The notification sound.
* @param notificationData The notification Data.
* @param callBackUrl The callback URL.
* @param properties The trigger properties.
* @param trackingProfile The tracking profile.
* @param times The times value.
* @param rateLimit The rate limit.
* @param boundingBoxReturnFormat The format of the bounding boc return value.
* @param geoReturnFormat The format of the geo return value.
* @param fromTimestamp The from timestamp value.
* @param toTimestamp The to timestamp value.
*/
public void createTrigger(String triggerId, String[] tags, String direction, String geoJson, String notificationText,
String notificationUrl, String notificationIcon, String notificationSound, String notificationData, String callBackUrl, String properties,
String trackingProfile, int times, int rateLimit, String boundingBoxReturnFormat, String geoReturnFormat, long fromTimestamp, long toTimestamp){
TriggerBuilder builder = new TriggerBuilder();
builder.setTriggerId(triggerId);
builder.setTags(tags);
builder.setDirection(direction);
JSONObject geoJsonObject;
try {
geoJsonObject = new JSONObject(geoJson);
builder.setGeoFromEsriJSON(geoJsonObject);
} catch (JSONException e) {
log.error("Error parsing geoJSON: " + e.getMessage());
}
if(!Util.isEmpty(notificationText)){
builder.setNotificationText(notificationText);
}
if(!Util.isEmpty(notificationUrl)){
builder.setNotificationUrl(notificationUrl);
}
if(!Util.isEmpty(notificationIcon)){
builder.setNotificationIcon(notificationIcon);
}
if(!Util.isEmpty(notificationSound)){
builder.setNotificationSound(notificationSound);
}
if(!Util.isEmpty(notificationData)){
JSONObject notificationDataJson = null;
try{
notificationDataJson = new JSONObject(notificationData);
builder.setNotificationData(notificationDataJson);
}catch(Exception e){
log.error("Error parsing JSON for notification data: " + e.getMessage());
}
}
if(!Util.isEmpty(callBackUrl)){
builder.setCallbackUrl(callBackUrl);
}
if(!Util.isEmpty(properties)){
JSONObject propertiesJson = null;
try{
propertiesJson = new JSONObject(properties);
builder.setProperties(propertiesJson);
}catch(Exception e){
log.error("Error parsing JSON for properties: " + e.getMessage());
}
}
if(!Util.isEmpty(trackingProfile)){
builder.setTrackingProfile(trackingProfile);
}
if(times >= 0){
builder.setTimes(times);
}
if(rateLimit >= 0){
builder.setRateLimit(rateLimit);
}
if(!Util.isEmpty(boundingBoxReturnFormat)){
builder.setBoundingBoxReturnFormat(boundingBoxReturnFormat);
}
if(!Util.isEmpty(geoReturnFormat)){
builder.setGeoReturnFormat(geoReturnFormat);
}
if(fromTimestamp > 0){
builder.setFromTimestamp(fromTimestamp);
}
if(toTimestamp > 0){
builder.setToTimestamp(toTimestamp);
}
JSONObject params = builder.build();
// Send the request to the Geotrigger API.
GeotriggerApiClient.runRequest("trigger/create", params, new GeotriggerApiListener() {
@Override
public void onSuccess(JSONObject data) {
log.info("Trigger created.");
}
@Override
public void onFailure(Throwable e) {
log.error("Error creating trigger: "+e.getMessage());
}
});
}
/**
* Create triggers for the features of an ArcGIS feature service.
* @param serviceUrl The URL of the feature service.
* @param user The ArcGIS user name (if required by the service).
* @param password The ArcGIS password (if required by the service).
* @param triggerId The trigger id.
* @param tags The tags for the triggers.
* @param direction The trigger direction (enter / leave).
* @param radius The radius of the trigger.
* @param notificationText The notification text of the trigger.
* @param notificationUrl The notification URL.
* @param notificationData The notification Data.
* @param where A SQL where clause to limit the features/triggers.
*/
public void createTriggersFromService(String serviceUrl, String user, String password, String triggerId, String[] tags,
String direction, double radius, String notificationText, String notificationUrl, String notificationData, String where){
log.info("Create triggers from service...");
try{
String tokenParam = "";
if(!Util.isEmpty(user) && !Util.isEmpty(password)){
// request user token
OAuthUtil oauthUtil = new OAuthUtil();
String userToken = oauthUtil.requestUserToken(user, password);
tokenParam = "token=" + userToken + "&";
}
String whereParam = "where=1%3D1&";
if(!Util.isEmpty(where)){
whereParam = "where=" + URLEncoder.encode(where, "UTF-8") + "&";
}
String url = serviceUrl + "/query?" + whereParam + "outFields=*&outSR=4326&" + tokenParam + "f=json";
log.debug("Request URL: " + url);
String response = HttpUtil.getRequest(url);
log.debug("Response: " + response);
JSONObject responseJson = new JSONObject(response);
String geometryType = responseJson.getString("geometryType");
// features
JSONArray features = responseJson.getJSONArray("features");
for(int i = 0; i < features.length(); i++){
JSONObject feature = features.getJSONObject(i);
// parse trigger id, notification text, notification data
String parsedTriggerId = Util.parseAttributes(triggerId, feature);
String parsedNotificationText = Util.parseAttributes(notificationText, feature);
String parsedNotificationUrl = Util.parseAttributes(notificationUrl, feature);
String parsedNotificationData = Util.parseAttributes(notificationData, feature);
JSONObject geometry = feature.getJSONObject("geometry");
if(geometryType.equals("esriGeometryPoint")){
double latitude = geometry.getDouble("y");
double longitude = geometry.getDouble("x");
createTrigger(parsedTriggerId, tags, direction, latitude, longitude, radius, parsedNotificationText, parsedNotificationUrl, null, null, parsedNotificationData, null, null, null, -1, -1, null, null, -1, -1);
}else if(geometryType.equals("esriGeometryPolyline")){
String lineJson = geometry.toString();
String polygonJson = Util.bufferLine(lineJson, radius);
createTrigger(parsedTriggerId, tags, direction, polygonJson, parsedNotificationText, parsedNotificationUrl, null, null, parsedNotificationData, null, null, null, -1, -1, null, null, -1, -1);
}else if(geometryType.equals("esriGeometryPolygon")){
String polygonJson = geometry.toString();
String bufferJson = Util.bufferPolygon(polygonJson, radius);
createTrigger(parsedTriggerId, tags, direction, bufferJson, parsedNotificationText, parsedNotificationUrl, null, null, parsedNotificationData, null, null, null, -1, -1, null, null, -1, -1);
}else{
log.info("Geometry type not supported.");
}
}
log.info("Triggers from service created.");
}catch(Exception ex){
log.error(ex.getMessage());
}
}
/**
* Run a trigger.
* @param triggerIds The trigger ids.
* @param deviceIds The device ids.
*/
public void runTrigger(String[] triggerIds, String[] deviceIds){
log.info("Run trigger");
JSONObject params = new JSONObject();
JSONArray triggerIdArray = new JSONArray();
for(String triggerId : triggerIds){
triggerIdArray.put(triggerId);
}
JSONArray deviceIdArray = new JSONArray();
for(String deviceId : deviceIds){
deviceIdArray.put(deviceId);
}
try {
params.put("triggerIds", triggerIdArray);
params.put("deviceIds", deviceIdArray);
} catch (JSONException e) {
log.error("Error setting trigger and device ids: "+e.getMessage());
}
GeotriggerApiClient.runRequest("trigger/run", params, new GeotriggerApiListener() {
public void onSuccess(JSONObject data) {
log.debug(data.toString());
log.info("Trigger run.");
}
public void onFailure(Throwable error) {
log.error("Error running trigger: "+error.getMessage());
}
});
}
/**
* Delete triggers by ids.
* @param triggerIds The trigger ids.
*/
public void deleteTriggersByIds(String[] triggerIds){
log.info("Deleting triggers");
JSONObject params = new JSONObject();
JSONArray ids = new JSONArray();
for(String triggerId : triggerIds){
ids.put(triggerId);
}
try {
params.put("triggerIds", ids);
} catch (JSONException e) {
log.error("Error setting trigger ids: "+e.getMessage());
}
GeotriggerApiClient.runRequest("trigger/delete", params, new GeotriggerApiListener() {
public void onSuccess(JSONObject data) {
log.debug(data.toString());
log.info("Triggers deleted.");
}
public void onFailure(Throwable error) {
log.error("Error deleating triggers: "+error.getMessage());
}
});
}
/**
* Delete triggers by tags.
* @param tags The tags of the triggers..
*/
public void deleteTriggersByTags(String[] tags){
log.info("Deleting triggers");
JSONObject params = new JSONObject();
JSONArray tagsArray = new JSONArray();
for(String tag : tags){
tagsArray.put(tag);
}
try {
params.put("tags", tagsArray);
} catch (JSONException e) {
log.error("Error setting tags: "+e.getMessage());
}
GeotriggerApiClient.runRequest("trigger/delete", params, new GeotriggerApiListener() {
public void onSuccess(JSONObject data) {
log.debug(data.toString());
log.info("Triggers deleted.");
}
public void onFailure(Throwable error) {
log.error("Error deleating triggers: "+error.getMessage());
}
});
}
/**
* Delete tags.
* @param tags The tags to delete.
*/
public void deleteTags(String[] tags){
log.info("Deleting tags");
JSONObject params = new JSONObject();
JSONArray tagsArray = new JSONArray();
for(String tag : tags){
tagsArray.put(tag);
}
try {
params.put("tags", tagsArray);
} catch (JSONException e) {
log.error("Error setting tags: "+e.getMessage());
}
GeotriggerApiClient.runRequest("tag/delete", params, new GeotriggerApiListener() {
public void onSuccess(JSONObject data) {
log.debug(data.toString());
log.info("Tags deleted.");
}
public void onFailure(Throwable error) {
log.error("Error deleating tags: "+error.getMessage());
}
});
}
}
| 37.045783 | 211 | 0.690126 |
40799bd56033c86a889d5a8cd2db1443fa7483c6
| 750 |
package com.kevinwilde.sitecrawler.masternodesonline.domain.githubInforesponse;
import java.util.HashMap;
import java.util.Map;
public class Repository {
private DefaultBranchRef defaultBranchRef;
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
public DefaultBranchRef getDefaultBranchRef() {
return defaultBranchRef;
}
public void setDefaultBranchRef(DefaultBranchRef defaultBranchRef) {
this.defaultBranchRef = defaultBranchRef;
}
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
}
| 25.862069 | 85 | 0.741333 |
895aa12aac3b6cac4ad0b88cc71a8939d4e50e8d
| 725 |
package net.kwmt27.codesearch.entity.payloads;
import com.google.gson.annotations.SerializedName;
import net.kwmt27.codesearch.entity.CommentEntity;
import net.kwmt27.codesearch.entity.GithubRepoEntity;
public class CommitCommentEntity {
@SerializedName("action")
private String mAction;
@SerializedName("comment")
private CommentEntity mComment;
@SerializedName("repository")
private GithubRepoEntity mRepository;
// TODO sender
public String getAction() {
if(mAction == null) { return ""; }
return mAction;
}
public CommentEntity getComment() {
return mComment;
}
public GithubRepoEntity getRepository() {
return mRepository;
}
}
| 21.969697 | 53 | 0.703448 |
e79262b44255e396d31f814672f603639aaaceb4
| 558 |
package io.github.talelin.latticy.service.imy;
import io.github.talelin.latticy.bo.my.MinUserBO;
import io.github.talelin.latticy.dto.my.MinUserDTO;
import io.github.talelin.latticy.model.my.Page;
import java.util.Map;
/**
* @Author Guiquan Chen
* @Date 2021/5/31 11:31
* @Version 1.0
*/
public interface IMinUserService {
/**
* 保存用户信息
* @param minUserDTO
*/
void save(MinUserDTO minUserDTO);
boolean searchMinUserByName(String nickName);
Page<MinUserBO> searchAllByPage(Map<String,Integer> pageMap, Integer size);
}
| 21.461538 | 79 | 0.718638 |
68cd23d5f0386e01d65f385fcff7abfa19ba6e54
| 719 |
package com.ttrzcinski.rest.java;
import io.javalin.http.BadRequestResponse;
import io.javalin.http.Context;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class DemonController {
static List<String> demons = new ArrayList<>(Arrays.asList("Minister_Pinoccio", "Angry_Duck", "Hungry_Kristy"));
public static void create(Context ctx) {
String demonName = ctx.queryParam("demonname");
if (demonName == null || demonName.length() < 5) {
throw new BadRequestResponse();
} else {
demons.add(demonName);
ctx.status(201);
}
}
public static void getAll(Context ctx) {
ctx.json(demons);
}
}
| 25.678571 | 116 | 0.652295 |
1929e65b0009e862cc24416dedb7988d6e57d079
| 1,038 |
package org.beer30.silvia.sample.springintegration;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.integration.launch.JobLaunchRequest;
import org.springframework.integration.annotation.Transformer;
import org.springframework.messaging.Message;
import java.io.File;
/**
* Created by tsweets on 3/25/16.
*/
public class FileMessageToJobRequest {
private Job job;
private String fileParameterName;
public void setFileParameterName(String fileParameterName) {
this.fileParameterName = fileParameterName;
}
public void setJob(Job job) {
this.job = job;
}
@Transformer
public JobLaunchRequest toRequest(Message<File> message) {
JobParametersBuilder jobParametersBuilder = new JobParametersBuilder();
jobParametersBuilder.addString(fileParameterName, message.getPayload().getAbsolutePath());
return new JobLaunchRequest(job, jobParametersBuilder.toJobParameters());
}
}
| 30.529412 | 98 | 0.765896 |
7dcec20081fb17dbf13ee83e07988de6a6d6e709
| 3,277 |
/******************************************************************************
**
** Advanced Distributed Learning Co-Laboratory (ADL Co-Lab) Hub grants you
** ("Licensee") a non-exclusive, royalty free, license to use, modify and
** redistribute this software in source and binary code form, provided that
** i) this copyright notice and license appear on all copies of the software;
** and ii) Licensee does not utilize the software in a manner which is
** disparaging to ADL Co-Lab Hub.
**
** This software is provided "AS IS," without a warranty of any kind. ALL
** EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING
** ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
** OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. ADL Co-Lab Hub AND ITS LICENSORS
** SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF
** USING, MODIFYING OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO
** EVENT WILL ADL Co-Lab Hub OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE,
** PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL,
** INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE
** THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE
** SOFTWARE, EVEN IF ADL Co-Lab Hub HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
** DAMAGES.
**
*******************************************************************************/
package org.ims.ssp.samplerte.server.bucket;
/**
* Enumeration of possible success status types that describe the status of an
* SSP bucket.<br><br>
*
* <strong>Filename:</strong> SuccessStatus.java<br><br>
*
* <strong>Description:</strong><br>
* Enumeration of possible success status types that describe the status of
* an SSP bucket. The values consist of FAILURE, MINIMUM, REQUESTED, and
* NONE_REQUESTED.
*
* <br><br>
*
* <strong>Design Issues:</strong><br>
* This implementation is intended to be used by the SCORM 2004 3rd Edition
* Sample RTE. <br>
* <br>
*
* <strong>Implementation Issues:</strong><br><br>
*
* <strong>Known Problems:</strong><br><br>
*
* <strong>Side Effects:</strong><br><br>
*
* <strong>References:</strong><br>
* <ul>
* <li>IMS SSP Specification
* <li>SCORM 2004 3rd Edition
* </ul>
*
* @author ADL Technical Team
*/
public class SuccessStatus {
/**
* Indicates that the SCO's allocation request has failed.
*
* <br>Failure
*
* <br><b>0</b>
*
* <br>[SCORM SSP SUBSYSTEM CONSTANT]
*/
public static final int FAILURE = 0;
/**
* Indicates that the LMS allocated the minimum size for the bucket.
*
* <br>Minimum
*
* <br><b>1</b>
*
* <br>[SCORM SSP SUBSYSTEM CONSTANT]
*/
public static final int MINIMUM = 1;
/**
* Indicates that the LMS allocated the requested size for the bucket.
*
* <br>Requested
*
* <br><b>2</b>
*
* <br>[SCORM SSP SUBSYSTEM CONSTANT]
*/
public static final int REQUESTED = 2;
/**
* Indicates that no allocation request has been made for the size of the
* bucket.
*
* <br>None Requested
*
* <br><b>3</b>
*
* <br>[SCORM SSP SUBSYSTEM CONSTANT]
*/
public static final int NONE_REQUESTED = 3;
}
| 31.815534 | 81 | 0.638389 |
90820d25426c055f10fe3896ade84c5ed800df73
| 831 |
package com.opensoc.dataservices.websocket;
import javax.servlet.annotation.WebServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServlet;
import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.inject.Inject;
import com.opensoc.dataservices.kafkaclient.KafkaConsumer;
@WebServlet(name = "Message Sender Servlet", urlPatterns = { "/messages" })
public class KafkaMessageSenderServlet extends WebSocketServlet
{
private static final Logger logger = LoggerFactory.getLogger( KafkaMessageSenderServlet.class );
@Inject
private KafkaWebSocketCreator socketCreator;
@Override
public void configure(WebSocketServletFactory factory)
{
factory.getPolicy().setIdleTimeout(600000);
factory.setCreator( socketCreator );
}
}
| 30.777778 | 98 | 0.817088 |
1907f0b710c6f481a6278023872d0e77b4ea6428
| 9,837 |
/*
* CPAchecker is a tool for configurable software verification.
* This file is part of CPAchecker.
*
* Copyright (C) 2007-2014 Dirk Beyer
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
* CPAchecker web page:
* http://cpachecker.sosy-lab.org
*/
package org.sosy_lab.cpachecker.util.predicates.mathsat5;
import static org.sosy_lab.cpachecker.util.predicates.mathsat5.Mathsat5NativeApi.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.MathContext;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.sosy_lab.cpachecker.util.predicates.AssignableTerm.Variable;
import org.sosy_lab.cpachecker.util.predicates.AssignableTerm;
import org.sosy_lab.cpachecker.util.predicates.AssignableTerm.Function;
import org.sosy_lab.cpachecker.util.predicates.Model;
import org.sosy_lab.cpachecker.util.predicates.TermType;
import org.sosy_lab.cpachecker.exceptions.SolverException;
import org.sosy_lab.cpachecker.util.predicates.mathsat5.Mathsat5NativeApi.ModelIterator;
import com.google.common.collect.ImmutableMap;
import com.google.common.primitives.UnsignedInteger;
import com.google.common.primitives.UnsignedLong;
class Mathsat5Model {
// A model can contain arbitrary real numbers, such as 1/3.
// Java does not provide a representation of such numbers with arbitrary precision,
// thus we use BigDecimal (which can handle at least all rational numbers)
// and round real numbers.
private static final MathContext ROUNDING_PRECISION = MathContext.DECIMAL128;
private static TermType toMathsatType(long e, long mType) {
if (msat_is_bool_type(e, mType)) {
return TermType.Boolean;
} else if (msat_is_integer_type(e, mType)) {
return TermType.Integer;
} else if (msat_is_rational_type(e, mType)) {
return TermType.Real;
} else if (msat_is_bv_type(e, mType)) {
return TermType.Bitvector; // all other values are bitvectors of different sizes
} else if (msat_is_fp_type(e, mType)) {
return TermType.FloatingPoint;
} else {
throw new IllegalArgumentException("Given parameter is not a mathsat type!");
}
}
private static AssignableTerm toConstant(final long env, final long variableId) {
if (!msat_term_is_constant(env, variableId)) {
throw new IllegalArgumentException("Given mathsat id doesn't correspond to a constant! (" +
msat_term_repr(variableId) + ")");
}
final long declarationId = msat_term_get_decl(variableId);
final String name = msat_decl_get_name(declarationId);
final TermType type = toMathsatType(env, msat_decl_get_return_type(declarationId));
return new Variable(name, type);
}
private static Function toFunction(long env, long pFunctionId) {
if (msat_term_is_constant(env, pFunctionId)) {
throw new IllegalArgumentException("Given mathsat id is a variable! (" + msat_term_repr(pFunctionId) + ")");
}
long lDeclarationId = msat_term_get_decl(pFunctionId);
String lName = msat_decl_get_name(lDeclarationId);
TermType lType = toMathsatType(env, msat_decl_get_return_type(lDeclarationId));
int lArity = msat_decl_get_arity(lDeclarationId);
// TODO we assume only constants (reals) as parameters for now
Object[] lArguments = new Object[lArity];
for (int lArgumentIndex = 0; lArgumentIndex < lArity; lArgumentIndex++) {
long lArgument = msat_term_get_arg(pFunctionId, lArgumentIndex);
String lTermRepresentation = msat_term_repr(lArgument);
Object lValue;
long msatType = msat_term_get_type(lArgument);
if (msat_is_integer_type(env, msatType)) {
lValue = new BigInteger(lTermRepresentation);
} else if (msat_is_rational_type(env, msatType)) {
lValue = parseReal(lTermRepresentation);
} else if (msat_is_bv_type(env, msatType)) {
lValue = interpreteBitvector(lTermRepresentation);
} else if (msat_is_fp_type(env, msatType)) {
lValue = interpreteFloatingPoint(lTermRepresentation);
} else {
throw new NumberFormatException("Unknown number format: " + lTermRepresentation);
}
lArguments[lArgumentIndex] = lValue;
}
return new Function(lName, lType, lArguments);
}
private static AssignableTerm toAssignable(long env, long pTermId) {
if (!msat_term_is_constant(env, pTermId)) {
return toFunction(env, pTermId);
} else {
return toConstant(env, pTermId);
}
}
static Model createMathsatModel(final long sourceEnvironment) throws SolverException {
ImmutableMap.Builder<AssignableTerm, Object> model = ImmutableMap.builder();
ModelIterator lModelIterator;
try {
lModelIterator = msat_create_ModelIterator(sourceEnvironment);
} catch (IllegalArgumentException e) {
// creating the iterator may fail,
// for example if some theories were disabled in the solver but are needed
throw new SolverException("Model iterator could not be created", e);
}
while (lModelIterator.hasNext()) {
long[] lModelElement = lModelIterator.next();
long lKeyTerm = lModelElement[0];
long lValueTerm = lModelElement[1];
AssignableTerm lAssignable = toAssignable(sourceEnvironment, lKeyTerm);
// TODO maybe we have to convert to SMTLIB format and then read in values in a controlled way, e.g., size of bitvector
// TODO we are assuming numbers as values
if (!(msat_term_is_number(sourceEnvironment, lValueTerm)
|| msat_term_is_boolean_constant(sourceEnvironment, lValueTerm) || msat_term_is_false(sourceEnvironment, lValueTerm) || msat_term_is_true(sourceEnvironment, lValueTerm))) {
throw new IllegalArgumentException("Mathsat term is not a number!");
}
String lTermRepresentation = msat_term_repr(lValueTerm);
Object lValue;
switch (lAssignable.getType()) {
case Boolean:
if (lTermRepresentation.equals("`true`")) {
lValue = true;
} else if (lTermRepresentation.equals("`false`")) {
lValue = false;
} else {
throw new IllegalArgumentException("Mathsat unhandled boolean value " + lTermRepresentation);
}
break;
case Real:
lValue = parseReal(lTermRepresentation);
break;
case Integer:
lValue = new BigInteger(lTermRepresentation);
break;
case Bitvector:
lValue = interpreteBitvector(lTermRepresentation);
break;
case FloatingPoint:
lValue = interpreteFloatingPoint(lTermRepresentation);
break;
default:
throw new IllegalArgumentException("Mathsat term with unhandled type " + lAssignable.getType());
}
model.put(lAssignable, lValue);
}
lModelIterator.free();
return new Model(model.build());
}
private static Pattern BITVECTOR_PATTERN = Pattern.compile("^(\\d+)_(\\d+)$");
//TODO: change this to the latest version (if possible try to use a BitvectorFormula instance here)
private static Object interpreteBitvector(String lTermRepresentation) {
// the term is of the format "<VALUE>_<WIDTH>"
Matcher matcher = BITVECTOR_PATTERN.matcher(lTermRepresentation);
if (!matcher.matches()) {
throw new NumberFormatException("Unknown bitvector format: " + lTermRepresentation);
}
// TODO: calculate negative value?
String term = matcher.group(1);
String lengthValue = matcher.group(2);
long length = Long.parseLong(lengthValue);
Object value;
if (length < 64) {
value = Long.valueOf(term);
} else {
value = new BigInteger(term);
}
return value;
}
private static Pattern FLOATING_POINT_PATTERN = Pattern.compile("^(\\d+)_(\\d+)_(\\d+)$");
private static Object interpreteFloatingPoint(String lTermRepresentation) {
// the term is of the format "<VALUE>_<EXPWIDTH>_<MANTWIDTH>"
Matcher matcher = FLOATING_POINT_PATTERN.matcher(lTermRepresentation);
if (!matcher.matches()) {
throw new NumberFormatException("Unknown floating-point format: " + lTermRepresentation);
}
int expWidth = Integer.parseInt(matcher.group(2));
int mantWidth = Integer.parseInt(matcher.group(3));
if (expWidth == 11 && mantWidth == 52) {
return Double.longBitsToDouble(UnsignedLong.valueOf(matcher.group(1)).longValue());
} else if (expWidth == 8 && mantWidth == 23) {
return Float.intBitsToFloat(UnsignedInteger.valueOf(matcher.group(1)).intValue());
}
// TODO to be fully correct, we would need to interpret this string
return new BigInteger(matcher.group(1));
}
private static Object parseReal(String lTermRepresentation) {
BigDecimal lValue;
try {
lValue = new BigDecimal(lTermRepresentation);
}
catch (NumberFormatException e) {
// lets try special case for mathsat
String[] lNumbers = lTermRepresentation.split("/");
if (lNumbers.length != 2) {
throw new NumberFormatException("Unknown number format: " + lTermRepresentation);
}
BigDecimal lNumerator = new BigDecimal(lNumbers[0]);
BigDecimal lDenominator = new BigDecimal(lNumbers[1]);
lValue = lNumerator.divide(lDenominator, ROUNDING_PRECISION);
}
return lValue;
}
}
| 36.705224 | 184 | 0.706923 |
7bff93739e0a4f52ae01f6c8cc842bbf32db2943
| 23,184 |
package com.homework.infrastructure.web.controller;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.NoSuchElementException;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.SessionAttributes;
import com.homework.domain.aluno.Aluno;
import com.homework.domain.aluno.AlunoFilter;
import com.homework.domain.aluno.AlunoRepository;
import com.homework.domain.aluno.application.service.AlunoService;
import com.homework.domain.aluno.application.service.CoordenadorService;
import com.homework.domain.aluno.application.service.EmailException;
import com.homework.domain.aluno.application.service.EntregaService;
import com.homework.domain.aluno.application.service.ProfessorService;
import com.homework.domain.aluno.application.service.RecadoService;
import com.homework.domain.aluno.application.service.ValidationException;
import com.homework.domain.atividade.AtividadeEntregaDTO;
import com.homework.domain.atividade.EntregaFilterDTO;
import com.homework.domain.comunicado.Comunicado;
import com.homework.domain.coordenador.Coordenador;
import com.homework.domain.curso.Curso;
import com.homework.domain.curso.Curso.CategoriaCurso;
import com.homework.domain.curso.CursoAluno;
import com.homework.domain.curso.CursoAluno.SituacaoAluno;
import com.homework.domain.curso.CursoAlunoPK;
import com.homework.domain.curso.CursoAlunoRepository;
import com.homework.domain.curso.CursoFilter;
import com.homework.domain.curso.CursoRepository;
import com.homework.domain.curso.StatusCurso;
import com.homework.domain.professor.Professor;
import com.homework.domain.professor.ProfessorFilter;
import com.homework.domain.professor.ProfessorRepository;
import com.homework.domain.recado.Recado;
import com.homework.utils.SecurityUtils;
@Controller
@RequestMapping("/coordenador")
@SessionAttributes("matriculas")
public class CoordenadorController {
@Autowired
private CoordenadorService coordenadorService;
@Autowired
private AlunoRepository alunoRepository;
@Autowired
private EntregaService entregaService;
@Autowired
private AlunoService alunoService;
@Autowired
private CursoRepository cursoRepository;
@Autowired
private CursoAlunoRepository matriculaRepository;
@Autowired
private RecadoService recadoService;
@Autowired
private ProfessorRepository professorRepository;
@Autowired
private ProfessorService professorService;
@GetMapping("/home")
public String home(Model model) {
colocarDependenciasCoordenadorHomeNoModel(model);
return "coordenador-home";
}
@GetMapping("/permissoes")
public String permissoes(Model model) {
colocarMatriculasNoModel(model);
return "coordenador-permissoes";
}
@GetMapping("/permissoes/permitir")
public String permitirMatricula(@RequestParam("curso") Long idCurso, @RequestParam("aluno") Long idAluno, Model model) {
try {
coordenadorService.enviarEmailDePermissaoDeMatricula(idCurso, idAluno);
} catch(EmailException e) {
model.addAttribute("msgErro", e.getMessage());
colocarMatriculasNoModel(model);
return "coordenador-permissoes";
}
coordenadorService.permitirMatricula(idCurso, idAluno);
model.addAttribute("msgSucesso", "Matrícula liberada com sucesso!");
colocarMatriculasNoModel(model);
return "coordenador-permissoes";
}
@GetMapping("/permissoes/proibir")
public String proibirMatricula(@RequestParam("curso") Long idCurso, @RequestParam("aluno") Long idAluno, Model model) {
try {
coordenadorService.enviarEmailDeProibicaoDeMatricula(idCurso, idAluno);
} catch(EmailException e) {
model.addAttribute("msgErro", e.getMessage());
colocarMatriculasNoModel(model);
return "coordenador-permissoes";
}
coordenadorService.proibirMatricula(idCurso, idAluno);
model.addAttribute("msgSucesso", "Solicitação de matrícula negada com sucesso!");
colocarMatriculasNoModel(model);
return "coordenador-permissoes";
}
@GetMapping("/aluno")
public String verAluno(@RequestParam("id") Long idAluno, Model model) {
putDependenciesCoordenadorAlunoOnModel(idAluno, model, true);
return "coordenador-aluno";
}
@GetMapping("/aluno/excluir")
public String excluirAluno(@RequestParam("id") Long idAluno, Model model) {
try {
Aluno aluno = alunoRepository.findById(idAluno).orElseThrow(NoSuchElementException::new);
coordenadorService.excluirAluno(aluno);
model.addAttribute("msgSucesso", "Aluno excluído com sucesso");
} catch(Exception e) {
model.addAttribute("msgErroExcluir", "Houve um erro ao excluir aluno: " + e.getMessage());
putDependenciesCoordenadorAlunoOnModel(idAluno, model, true);
return "coordenador-aluno";
}
colocarDependenciasCoordenadorHomeNoModel(model);
return "coordenador-home";
}
@GetMapping("/aluno/desmatricular")
public String desmatricularAluno(@RequestParam("aluno") Long idAluno, @RequestParam("curso") Long idCurso, Model model) {
try {
coordenadorService.desmatricularAluno(idAluno, idCurso);
model.addAttribute("msgSucessoDesmatricular", "Aluno desmatriculado com sucesso");
} catch(Exception e) {
model.addAttribute("msgErroDesmatricular", "Houve um erro ao desmatricular aluno: " + e.getMessage());
}
putDependenciesCoordenadorAlunoOnModel(idAluno, model, true);
return "coordenador-aluno";
}
@PostMapping("/aluno/buscarCursoConcluido")
public String buscarCursoConcluidoAluno(@ModelAttribute("cursoFilter") CursoFilter filter, @RequestParam("idAluno") Long idAluno,
Model model) {
List<CursoAluno> cursosFiltrados = coordenadorService.filtrarCursosConcluidosAluno(idAluno, filter);
model.addAttribute("cursos", cursosFiltrados);
putDependenciesCoordenadorAlunoOnModel(idAluno, model, false);
return "coordenador-aluno";
}
@GetMapping("/aluno/download-certificado")
public String baixarCertificadoAluno(@RequestParam("aluno") Long idAluno, @RequestParam("curso") Long idCurso,
HttpServletResponse response, Model model) {
Aluno aluno = alunoRepository.findById(idAluno).orElseThrow(NoSuchElementException::new);
Curso curso = cursoRepository.findById(idCurso).orElseThrow(NoSuchElementException::new);
CursoAluno matricula = matriculaRepository.findById(new CursoAlunoPK(curso, aluno)).orElse(null);
putDependenciesCoordenadorAlunoOnModel(idAluno, model, true);
try {
if(matricula != null && matricula.getSituacaoAluno().equals(SituacaoAluno.APROVADO)) {
alunoService.baixarCertificado(response, matricula);
} else {
throw new IllegalStateException("Matricula não encontrada ou você não foi aprovado nesse curso");
}
} catch(Exception e) {
List<CursoAluno> cursosConcluidos = alunoService.getCursosConcluidos(aluno);
model.addAttribute("cursos", cursosConcluidos);
model.addAttribute("msgErroCertificado", "Houve um erro ao fazer download do certificado: " + e.getMessage());
return "coordenador-aluno";
}
return null;
}
@GetMapping("/alunos")
public String viewAlunos(Model model) {
model.addAttribute("alunoFilter", new AlunoFilter());
return "coordenador-alunos";
}
@PostMapping("/alunos/buscarAluno")
public String buscarAlunos(@ModelAttribute("alunoFilter") AlunoFilter filter, Model model) {
List<Aluno> alunos = coordenadorService.filtrarAlunos(filter);
model.addAttribute("alunos", alunos);
return "coordenador-alunos";
}
@GetMapping("/curso")
public String viewCurso(@RequestParam("id") Long id,@ModelAttribute("matriculas") List<AtividadeEntregaDTO> matriculas,
Model model ) {
putDependenciesCoordenadorCursoOnModel(id, model, true, true);
model.addAttribute("matriculas", null);
return "coordenador-curso";
}
@GetMapping("/curso/mural")
public String viewMuralCurso(@RequestParam("curso") Long idCurso, Model model) {
putDependenciesCoordenadorRecadosOnModel(idCurso, model);
return "coordenador-curso-mural";
}
@PostMapping("/curso/recados/adicionar")
public String novoRecado(@RequestParam("idCurso") Long idCurso, @RequestParam("corpo") String corpo, Model model) {
Coordenador coordenador = SecurityUtils.getCoordenadorLogado();
Curso curso = cursoRepository.findById(idCurso).orElseThrow(NoSuchElementException::new);
recadoService.saveRecado(corpo, coordenador, curso);
putDependenciesCoordenadorRecadosOnModel(idCurso, model);
return "coordenador-curso-mural";
}
@GetMapping("/curso/recados/excluir")
public String excluirRecado(@RequestParam("recado") Long idRecado,
@RequestParam("autorCoordenador") boolean isAutorCoordenador, Model model) {
Recado recado = coordenadorService.deletarRecado(idRecado, isAutorCoordenador);
putDependenciesCoordenadorRecadosOnModel(recado.getCurso().getId(), model);
return "coordenador-curso-mural";
}
@GetMapping("/curso/encerrar")
public String encerrarCurso(@RequestParam("curso") Long idCurso,
@ModelAttribute("matriculas") List<AtividadeEntregaDTO> matriculas, Model model) {
boolean encerrou = coordenadorService.encerrarCurso(idCurso);
if(encerrou) {
model.addAttribute("msgSucesso", "Curso encerrado com sucesso!");
} else {
model.addAttribute("msgErroEncerramento", "Existe ainda alunos com situação indefinida, e por isso não é possível encerrar o curso!");
}
putDependenciesCoordenadorCursoOnModel(idCurso,model, true, true);
model.addAttribute("matriculas", null);
return "coordenador-curso";
}
@PostMapping("/curso/atualizar")
public String atualizarCurso(@ModelAttribute("cursoForm") @Valid Curso curso, Errors errors,
@RequestParam("idProfessor") Long idProfessor,
@ModelAttribute("matriculas") List<AtividadeEntregaDTO> matriculas, Model model) {
boolean isIdProfessorValido = coordenadorService.isIdProfessorValido(curso, idProfessor);
if(!errors.hasErrors() && isIdProfessorValido) {
Curso cursoBD = cursoRepository.findById(curso.getId()).orElseThrow();
curso.setQtdAlunosMatriculados(cursoBD.getQtdAlunosMatriculados());
cursoRepository.save(curso);
model.addAttribute("msgSucesso", "Curso atualizado com sucesso");
putDependenciesCoordenadorCursoOnModel(curso.getId(), model, true, true);
} else {
model.addAttribute("hasError", true);
putDependenciesCoordenadorCursoOnModel(curso.getId(), model, false, true);
}
if(!isIdProfessorValido) {
errors.rejectValue("professor", null, "Não encontramos nenhum professor com o id passado anteriormente");
}
model.addAttribute("matriculas", null);
return "coordenador-curso";
}
@PostMapping("/curso/buscarAluno")
public String buscarAlunoMatriculado(@ModelAttribute("entregaFilter") EntregaFilterDTO filter,
@RequestParam("idCurso") Long idCurso,
@ModelAttribute("matriculas") List<AtividadeEntregaDTO> matriculas, Model model) {
filter.setIdCurso(idCurso);
matriculas = entregaService.buscarAlunoPor(filter);
model.addAttribute("matriculas", matriculas);
putDependenciesCoordenadorCursoOnModel(idCurso, model, true, false);
return "coordenador-curso";
}
@GetMapping("/curso/buscarAluno/desmatricular")
public String desmatricularAlunoNaPaginaCurso(@RequestParam("aluno") Long idAluno,
@RequestParam("curso") Long idCurso,
@ModelAttribute("matriculas") List<AtividadeEntregaDTO> matriculas,
@ModelAttribute("entregaFilter") EntregaFilterDTO filter, Model model) {
try {
coordenadorService.desmatricularAluno(idAluno, idCurso);
model.addAttribute("msgSucessoDesmatricular", "Aluno desmatriculado com sucesso");
model.addAttribute("matriculas", atualizarListaMatriculas(matriculas, idAluno, idCurso));
} catch(Exception e) {
model.addAttribute("msgErroDesmatricular", "Houve um erro ao desmatricular aluno: " + e.getMessage());
}
putDependenciesCoordenadorCursoOnModel(idCurso, model, true, false);
return "coordenador-curso";
}
@GetMapping("/professor")
public String viewProfessor(@RequestParam("id") Long idProfessor, Model model) {
putDependenciesCoordenadorProfessorOnModel(idProfessor, model, true);
return "coordenador-professor";
}
@GetMapping("/professor/excluirProfessor")
public String excluirProfessor(@RequestParam("id") Long idProfessor, Model model) {
Professor professor = professorRepository.findById(idProfessor).orElseThrow(NoSuchElementException::new);
boolean excluiu = coordenadorService.excluirProfessor(professor);
if(excluiu) {
model.addAttribute("msgSucesso", "Professor excluído com sucesso");
colocarDependenciasCoordenadorHomeNoModel(model);
return "coordenador-home";
} else {
model.addAttribute("msgErro", "O professor está atualmente lecionando um curso que não foi concluído e por isso não pode ser excluído");
putDependenciesCoordenadorProfessorOnModel(professor.getId(), model, true);
return "coordenador-professor";
}
}
@PostMapping("/professor/buscarCurso")
public String buscarCursoLecionadoProfessor(@ModelAttribute("cursoFilter") CursoFilter filter,
@RequestParam("idProfessor") Long idProfessor, Model model) {
filter.setIdProfessor(idProfessor);
List<Curso> cursosFiltrados = coordenadorService.filtrarCursosLecionadoProfessor(filter);
model.addAttribute("cursos", cursosFiltrados);
putDependenciesCoordenadorProfessorOnModel(filter.getIdProfessor(), model, false);
return "coordenador-professor";
}
@GetMapping("/professores")
public String viewProfessores(Model model) {
colocarDependenciasCoordenadorProfessoresNoModel(true, true, true, model);
return "coordenador-professores";
}
@PostMapping("/professores/cadastrarProfessor")
public String cadastrarProfessor(@ModelAttribute("professor") @Valid Professor professor, Errors errors, Model model) {
if(!errors.hasErrors()) {
try {
professorService.save(professor);
model.addAttribute("msgSucesso", "Professor cadastrado com sucesso e chave de autenticação liberada");
colocarDependenciasCoordenadorProfessoresNoModel(true, true, true, model);
} catch (ValidationException e) {
errors.rejectValue("email", null, "Este e-mail já está cadastrado");
colocarDependenciasCoordenadorProfessoresNoModel(false, true, true, model);
model.addAttribute("hasError1", true);
} catch(Exception e) {
model.addAttribute("msgErro", "Houve um erro ao cadastrar professor: " + e.getMessage());
colocarDependenciasCoordenadorProfessoresNoModel(false, true, true, model);
model.addAttribute("hasError1", true);
}
} else {
colocarDependenciasCoordenadorProfessoresNoModel(false, true, true, model);
model.addAttribute("hasError1", true);
}
return "coordenador-professores";
}
@PostMapping("/professores/gerarChave")
public String gerarChaveProfessor(@ModelAttribute("professorChave") ProfessorFilter professorChave, Model model) {
try {
professorChave = coordenadorService.getChaveCadastroProfessor(professorChave);
} catch(ValidationException e) {
model.addAttribute("msgErroChave", e.getMessage());
professorChave.setChave("");
model.addAttribute("professorChave", professorChave);
}
model.addAttribute("open", true);
colocarDependenciasCoordenadorProfessoresNoModel(true, false, true, model);
return "coordenador-professores";
}
@PostMapping("/professores/buscarProfessor")
public String buscarProfessor(@ModelAttribute("professorFilter") ProfessorFilter filter, Model model) {
List<Professor> professores = coordenadorService.filtrarProfessores(filter);
model.addAttribute("professores", professores);
colocarDependenciasCoordenadorProfessoresNoModel(true, true, false, model);
return "coordenador-professores";
}
@GetMapping("/cursos")
public String viewCursos(Model model) {
colocarDependendenciasCoordenadorCursosNoModel(true, true, model);
return "coordenador-cursos";
}
@PostMapping("/cursos/novoCurso")
public String cadastrarNovoCurso(@ModelAttribute("curso") @Valid Curso curso, Errors errors,
@RequestParam("idProfessor") Long idProfessor, Model model) {
boolean isIdProfessorValido = coordenadorService.isIdProfessorValido(curso, idProfessor);
if(!errors.hasErrors() && isIdProfessorValido) {
try {
coordenadorService.cadastrarNovoCurso(curso);
} catch(ValidationException e) {
errors.rejectValue("dataInicial", null, e.getMessage());
model.addAttribute("hasError", true);
colocarDependendenciasCoordenadorCursosNoModel(false, true, model);
return "coordenador-cursos";
}
model.addAttribute("msgSucesso", "Curso cadastrado com sucesso");
colocarDependendenciasCoordenadorCursosNoModel(true, true, model);
} else {
model.addAttribute("hasError", true);
colocarDependendenciasCoordenadorCursosNoModel(false, true, model);
}
if(!isIdProfessorValido) {
errors.rejectValue("professor", null, "Não encontramos nenhum professor com o id passado anteriormente");
}
return "coordenador-cursos";
}
@PostMapping("/cursos/buscarCurso")
public String buscarCurso(@ModelAttribute("cursoFilter") CursoFilter filter, Model model) {
List<Curso> cursos = coordenadorService.filtrarCursos(filter);
model.addAttribute("cursos", cursos);
colocarDependendenciasCoordenadorCursosNoModel(true, false, model);
return "coordenador-cursos";
}
@GetMapping("/comunicados")
public String viewComunicados(Model model) {
model.addAttribute("comunicado", new Comunicado());
return "coordenador-comunicados";
}
@PostMapping("/comunicados/enviar")
public String enviarComunicado(@ModelAttribute("comunicado") Comunicado comunicado, Model model) {
try {
coordenadorService.enviarComunicado(comunicado);
model.addAttribute("msgSucesso", "Comunicado enviado com sucesso!");
comunicado.setIdTipoEnvio(null);
model.addAttribute("comunicado", comunicado);
} catch(Exception e) {
model.addAttribute("msgErro", "Houve um erro ao enviar comunicado: " + e.getMessage());
}
return "coordenador-comunicados";
}
@GetMapping("/atualizar")
public String atualizarCoordenador(Model model) {
Coordenador coordenador = SecurityUtils.getCoordenadorLogado();
model.addAttribute("funcionario", coordenador);
model.addAttribute("isCoordenador", true);
return "funcionario-atualizacao";
}
@PostMapping("/save")
public String atualizarDadosCoordenador(@ModelAttribute("funcionario") @Valid Coordenador coordenador, Errors errors, Model model) {
if(!errors.hasErrors()) {
try {
coordenadorService.save(coordenador);
SecurityUtils.getLoggedUser().atualizarLoggedUser(coordenador);
model.addAttribute("msgSucesso", "Coordenador atualizado com sucesso");
} catch(ValidationException e) {
errors.rejectValue("email", null, e.getMessage());
}
}
model.addAttribute("isCoordenador", true);
return "funcionario-atualizacao";
}
public void colocarDependendenciasCoordenadorCursosNoModel(boolean isComNovoCurso, boolean isComNewCursoFilter, Model model) {
if(isComNovoCurso) {
model.addAttribute("curso", new Curso());
}
List<CategoriaCurso> categorias = new ArrayList<>(Arrays.asList(CategoriaCurso.values()));
categorias.remove(CategoriaCurso.NENHUMA);
model.addAttribute("categoriasCurso", categorias);
if(isComNewCursoFilter) {
model.addAttribute("cursoFilter", new CursoFilter());
}
}
public void colocarDependenciasCoordenadorProfessoresNoModel(boolean isComNovoProfessor,
boolean isComNovoProfessorChave, boolean isComNovoProfessorFilter, Model model) {
if(isComNovoProfessor) {
model.addAttribute("professor", new Professor());
}
if(isComNovoProfessorChave) {
model.addAttribute("professorChave", new ProfessorFilter());
}
if(isComNovoProfessorFilter) {
model.addAttribute("professorFilter", new ProfessorFilter());
}
}
public void putDependenciesCoordenadorProfessorOnModel(Long idProfessor, Model model, boolean isWithNewCursoFilter) {
Professor professor = professorRepository.findById(idProfessor).orElseThrow(NoSuchElementException::new);
model.addAttribute("professor", professor);
if(isWithNewCursoFilter) {
model.addAttribute("cursoFilter", new CursoFilter());
}
}
private List<AtividadeEntregaDTO> atualizarListaMatriculas(List<AtividadeEntregaDTO> matriculas, Long idAluno, Long idCurso) {
matriculas.removeIf(a -> a.getIdAluno().equals(idAluno) && a.getIdCurso().equals(idCurso));
return matriculas;
}
@ModelAttribute("matriculas")
public List<AtividadeEntregaDTO> matriculas(){
return new ArrayList<>();
}
private void putDependenciesCoordenadorRecadosOnModel(Long idCurso, Model model) {
colocarCursoNoModel(idCurso, model);
Curso curso = cursoRepository.findById(idCurso).orElseThrow(NoSuchElementException::new);
ControllerHelper.getRecadosAndPutOnModel(curso, model, false);
}
private void putDependenciesCoordenadorAlunoOnModel(Long idAluno, Model model, boolean isWithNewFilterCursoFilter) {
Aluno aluno = alunoRepository.findById(idAluno).orElseThrow(NoSuchElementException::new);
List<AtividadeEntregaDTO> atividades = entregaService.getTodasNotasAluno(aluno);
model.addAttribute("atividadesEntregues", atividades);
model.addAttribute("aluno", aluno);
if(isWithNewFilterCursoFilter) {
model.addAttribute("cursoFilter", new CursoFilter());
}
}
private void colocarMatriculasNoModel(Model model) {
List<CursoAluno> matriculas = coordenadorService.solicitacoesDeMatriculasPendentes();
model.addAttribute("matriculas", matriculas);
if(matriculas.isEmpty()) {
model.addAttribute("msgPermissoesMatricula", "Não há novas solicitações de matrículas");
}
}
private void colocarCursoNoModel(Long idCurso, Model model) {
Curso curso = cursoRepository.findById(idCurso).orElseThrow(NoSuchElementException::new);
model.addAttribute("curso", curso);
}
private void putDependenciesCoordenadorCursoOnModel(Long idCurso, Model model, boolean withCursoForm, boolean withNewAlunoFilter) {
if(withCursoForm) {
Curso curso = cursoRepository.findById(idCurso).orElseThrow(NoSuchElementException::new);
model.addAttribute("cursoForm", curso);
}
if(withNewAlunoFilter) {
model.addAttribute("entregaFilter", new EntregaFilterDTO());
}
colocarCursoNoModel(idCurso, model);
List<CategoriaCurso> categorias = new ArrayList<>(Arrays.asList(CategoriaCurso.values()));
categorias.remove(CategoriaCurso.NENHUMA);
model.addAttribute("categoriasCurso", categorias);
List<StatusCurso> status = new ArrayList<>(Arrays.asList(StatusCurso.values()));
status.remove(StatusCurso.CONCLUIDO);
model.addAttribute("statusCurso", status);
}
public void colocarDependenciasCoordenadorHomeNoModel(Model model) {
List<Curso> cursosEmAndamento = cursoRepository.findByStatusOrdered(StatusCurso.EM_ANDAMENTO);
model.addAttribute("cursosEmAndamento", cursosEmAndamento);
}
}
| 41.106383 | 139 | 0.780452 |
044ada0777c6fb31d02348e868e35b51bdf7b139
| 1,027 |
/**
* C:\Users\kriti\Desktop\DS\Codefores\Good bye 2020\music.java
* @author Kritika Srivastava
* @since December 31, 2020
*
* Link - https://codeforces.com/contest/1466/problem/B
*/
import java.util.Scanner;
import java.util.*;
public class music {
public static void main(String[] args) {
Scanner kb = new Scanner(System.in);
int t = kb.nextInt();
while (t-- > 0) {
int n = kb.nextInt();
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = kb.nextInt();
}
int k = 0;
HashMap<Integer, Integer> l = new HashMap<Integer, Integer>();
for (int i = n - 1; i >= 0; i--) {
if (!l.containsKey(a[i] + 1)) {
l.put(a[i] + 1, 0);
k++;
} else if (!l.containsKey(a[i])) {
l.put(a[i], 0);
} else {
}
}
System.out.println(l.size());
}
}
}
| 27.756757 | 74 | 0.435248 |
3950c18d20509ca35187e6440e71883dfa5d3cdc
| 350 |
package tech.jhipster.lite.technical.infrastructure.primary.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface GeneratorStep {
String id();
}
| 26.923077 | 71 | 0.828571 |
6c138eb08507174584f5418a8ec5404f6ed42c05
| 571 |
package com.github.jolice.stream.iterator;
import java.util.Iterator;
public class LimitedIterator<T> implements Iterator<T> {
private Iterator<T> delegate;
private long limit;
private long current;
public LimitedIterator(Iterator<T> delegate, long limit) {
this.delegate = delegate;
this.limit = limit;
}
@Override
public boolean hasNext() {
return current < limit && delegate.hasNext();
}
@Override
public T next() {
T item = delegate.next();
current++;
return item;
}
}
| 20.392857 | 62 | 0.625219 |
316625cc9f9fad412c2b9a7a071224c6466261fa
| 21,269 |
package com.proxima.fragments;
import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.hardware.Camera;
import android.hardware.Camera.CameraInfo;
import android.location.Location;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.Toast;
import com.parse.ParseUser;
import com.proxima.R;
import com.proxima.activities.ConfirmationActivity;
import com.proxima.activities.TabActivity;
import com.proxima.utils.PhotoUtils;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* Created by Andrew Clissold, Rachel Glomski, Jon Wong on 10/6/14.
* Take a picture directly from inside the app using this fragment.
*
* Reference: http://developer.android.com/training/camera/cameradirect.html
* Reference: http://stackoverflow.com/questions/7942378/android-camera-will-not-work-startpreview-fails
* Reference: http://stackoverflow.com/questions/10913181/camera-preview-is-not-restarting
*
* modified from code by Rex St. John (on behalf of AirPair.com) on 3/4/14.
*/
public class CameraFragment extends Fragment {
public static final String ARG_SECTION_NUMBER = "Cam";
private static final String TAG = CameraFragment.class.getName();
// Native camera.
private Camera mCamera;
// View to display the camera output.
private CameraPreview mPreview;
int mNumberOfCameras;
// Camera ID currently chosen
int mCurrentCamera;
// Camera ID that's actually acquired
int mCameraCurrentlyLocked;
// The first rear facing camera
int mDefaultCameraId;
// Reference to the containing view.
private View mCameraView;
boolean pauseFlag = true;
boolean selfFlag = false;
/**
* Default empty constructor.
*/
public CameraFragment(){
super();
}
/**
* Static factory method
* @param sectionNumber
* @return
*/
public static CameraFragment newInstance(int sectionNumber) {
CameraFragment fragment = new CameraFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
fragment.setArguments(args);
return fragment;
}
/**
* OnCreateView fragment override
* @param inflater
* @param container
* @param savedInstanceState
* @return
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Create our Preview view and set it as the content of our activity.
View view = inflater.inflate(R.layout.camera_fragment, container, false);
// Show the action bar options menu.
setHasOptionsMenu(true);
// Find the total number of cameras available
mNumberOfCameras = Camera.getNumberOfCameras();
// Find the ID of the rear-facing ("default") camera
CameraInfo cameraInfo = new CameraInfo();
for (int i = 0; i < mNumberOfCameras; i++) {
Camera.getCameraInfo(i, cameraInfo);
if (cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK) {
mCurrentCamera = mDefaultCameraId = i;
}
}
//open the camera for use
boolean opened = safeCameraOpenInView(view);
if(opened == false){
Log.d("CameraGuide","Error, Camera failed to open");
return view;
}
// Trap the capture button.
Button captureButton = (Button) view.findViewById(R.id.button_capture);
captureButton.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
// get an image from the camera
mCamera.takePicture(null, null, mPicture);
}
}
);
// Trap the camera flip button.
Button flipButton = (Button) view.findViewById(R.id.button_flip);
// Check if there is a front camera, if not make the flip button unaccessable
if(Camera.getNumberOfCameras() == 1){
flipButton.setVisibility(View.INVISIBLE);
}
else {
flipButton.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
if (mCamera != null) {
mCamera.stopPreview();
mCamera.release();
mCamera = null;
}
// Acquire the next camera and request Preview to reconfigure
// parameters.
mCurrentCamera = (mCameraCurrentlyLocked + 1) % mNumberOfCameras;
mCamera = Camera.open(mCurrentCamera);
mCameraCurrentlyLocked = mCurrentCamera;
mPreview.switchCamera(mCamera);
// Start the preview
mCamera.startPreview();
selfFlag = true;
}
}
);
}
return view;
}
/**
* Recommended "safe" way to open the camera.
* @param view
* @return
*/
private boolean safeCameraOpenInView(View view) {
boolean qOpened = false;
// make sure camera is availiable
releaseCameraAndPreview();
Log.d("HELLO", "onCreate");
// get a camera object
mCamera = getCameraInstance();
// set the camera orientation to portrait
mCamera.setDisplayOrientation(90);
mCameraView = view;
qOpened = (mCamera != null);
// add the camera preview to the layout
if(qOpened == true){
mPreview = new CameraPreview(getActivity().getBaseContext(), mCamera,view);
FrameLayout preview = (FrameLayout) view.findViewById(R.id.camera_preview);
preview.addView(mPreview);
mPreview.startCameraPreview();
}
return qOpened;
}
/**
* Safe method for getting a camera instance.
* @return
*/
public static Camera getCameraInstance(){
Camera c = null;
try {
// attempt to get a Camera instance
c = Camera.open();
}
catch (Exception e){
e.printStackTrace();
}
// returns null if camera is unavailable
return c;
}
// release the camera on pause so it is availiable for other applications
@Override
public void onPause() {
super.onPause();
releaseCameraAndPreview();
pauseFlag = true;
}
// restart the camera preview when fragment is resumed
@Override
public void onResume() {
super.onResume();
TabActivity activity = (TabActivity) getActivity();
if (activity == null || ParseUser.getCurrentUser() == null) {
// The user got here by hitting back without being logged in; continue the expected
// behavior of finishing back to the launcher.
Log.d(TAG, "finishing activity due to unexpected onResume call");
getActivity().finish();
return;
}
activity.refreshMark();
View newView = getActivity().findViewById(R.id.camera_preview);
if (pauseFlag){
safeCameraOpenInView(newView);
}
}
// release the camera when the fragment is destroyed to make it availiable for other
// applications
@Override
public void onDestroy() {
super.onDestroy();
releaseCameraAndPreview();
}
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.camera, menu);
}
/**
* Clear any existing preview / camera.
*/
private void releaseCameraAndPreview() {
if (mCamera != null) {
FrameLayout preview = (FrameLayout) this.getActivity().findViewById(R.id.camera_preview);
preview.removeView(mPreview);
mCamera.setPreviewCallback(null);
mCamera.stopPreview();
mCamera.release();
mCamera = null;
}
if(mPreview != null){
mPreview.mCamera = null;
}
}
/**
* Surface on which the camera projects it's capture results. This is derived both from Google's docs and the
* excellent StackOverflow answer provided below.
*
* Reference / Credit: http://stackoverflow.com/questions/7942378/android-camera-will-not-work-startpreview-fails
*/
class CameraPreview extends SurfaceView implements SurfaceHolder.Callback {
// SurfaceHolder
private SurfaceHolder mHolder;
// Our Camera.
private Camera mCamera;
// Parent Context.
private Context mContext;
// Camera Sizing (For rotation, orientation changes)
private Camera.Size mPreviewSize;
// List of supported preview sizes
private List<Camera.Size> mSupportedPreviewSizes;
// Flash modes supported by this camera
private List<String> mSupportedFlashModes;
// View holding this camera.
private View mCameraView;
// Create the surface holder for the camera preview
public CameraPreview(Context context, Camera camera, View cameraView) {
super(context);
// Capture the context
mCameraView = cameraView;
mContext = context;
setCamera(camera);
// Install a SurfaceHolder.Callback so we get notified when the
// underlying surface is created and destroyed.
mHolder = getHolder();
mHolder.addCallback(this);
mHolder.setKeepScreenOn(true);
// deprecated setting, but required on Android versions prior to 3.0
mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
// switch from front to back camera or vice versa
public void switchCamera(Camera camera) {
setCamera(camera);
try {
// orient the camera display to portrait
camera.setDisplayOrientation(90);
camera.setPreviewDisplay(mHolder);
} catch (IOException exception) {
exception.printStackTrace();
}
}
/**
* Begin the preview of the camera input.
*/
public void startCameraPreview()
{
try{
mCamera.setPreviewDisplay(mHolder);
mCamera.startPreview();
}
catch(Exception e){
e.printStackTrace();
}
}
/**
* Extract supported preview and flash modes from the camera.
* @param camera
*/
private void setCamera(Camera camera)
{
// Source: http://stackoverflow.com/questions/7942378/android-camera-will-not-work-startpreview-fails
mCamera = camera;
mSupportedPreviewSizes = mCamera.getParameters().getSupportedPreviewSizes();
mSupportedFlashModes = mCamera.getParameters().getSupportedFlashModes();
// Set the camera to Auto Flash mode.
if (mSupportedFlashModes != null && mSupportedFlashModes.contains(Camera.Parameters.FLASH_MODE_AUTO)){
Camera.Parameters parameters = mCamera.getParameters();
parameters.setFlashMode(Camera.Parameters.FLASH_MODE_AUTO);
mCamera.setParameters(parameters);
}
requestLayout();
}
/**
* The Surface has been created, now tell the camera where to draw the preview.
* @param holder
*/
public void surfaceCreated(SurfaceHolder holder) {
try {
mCamera.setPreviewDisplay(holder);
} catch (IOException e) {
e.printStackTrace();
}
}
/**
* Dispose of the camera preview.
* @param holder
*/
public void surfaceDestroyed(SurfaceHolder holder) {
if (mCamera != null){
mCamera.stopPreview();
}
}
/**
* React to surface changed events
* @param holder
* @param format
* @param w
* @param h
*/
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
// If your preview can change or rotate, take care of those events here.
// Make sure to stop the preview before resizing or reformatting it.
if (mHolder.getSurface() == null){
// preview surface does not exist
return;
}
// stop preview before making changes
try {
Camera.Parameters parameters = mCamera.getParameters();
// Set the auto-focus mode to "continuous"
parameters.setFocusMode(Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE);
// Preview size must exist.
if(mPreviewSize != null) {
Camera.Size previewSize = mPreviewSize;
parameters.setPreviewSize(previewSize.width, previewSize.height);
}
mCamera.setParameters(parameters);
mCamera.startPreview();
} catch (Exception e){
e.printStackTrace();
}
}
/**
* Calculate the measurements of the layout
* @param widthMeasureSpec
* @param heightMeasureSpec
*/
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
{
// Source: http://stackoverflow.com/questions/7942378/android-camera-will-not-work-startpreview-fails
final int width = resolveSize(getSuggestedMinimumWidth(), widthMeasureSpec);
final int height = resolveSize(getSuggestedMinimumHeight(), heightMeasureSpec);
setMeasuredDimension(width, height);
if (mSupportedPreviewSizes != null){
mPreviewSize = getOptimalPreviewSize(mSupportedPreviewSizes, width, height);
}
}
/**
* Update the layout based on rotation and orientation changes.
* @param changed
* @param left
* @param top
* @param right
* @param bottom
*/
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom)
{
// Source: http://stackoverflow.com/questions/7942378/android-camera-will-not-work-startpreview-fails
if (changed) {
final int width = right - left;
final int height = bottom - top;
int previewWidth = width;
int previewHeight = height;
if (mPreviewSize != null){
Display display = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
switch (display.getRotation())
{
case Surface.ROTATION_0:
previewWidth = mPreviewSize.height;
previewHeight = mPreviewSize.width;
mCamera.setDisplayOrientation(90);
break;
case Surface.ROTATION_90:
previewWidth = mPreviewSize.width;
previewHeight = mPreviewSize.height;
break;
case Surface.ROTATION_180:
previewWidth = mPreviewSize.height;
previewHeight = mPreviewSize.width;
break;
case Surface.ROTATION_270:
previewWidth = mPreviewSize.width;
previewHeight = mPreviewSize.height;
mCamera.setDisplayOrientation(180);
break;
}
}
final int scaledChildHeight = previewHeight * width / previewWidth;
mCameraView.layout(0, height - scaledChildHeight, width, height);
}
}
/**
*
* @param sizes
* @param width
* @param height
* @return
*/
private Camera.Size getOptimalPreviewSize(List<Camera.Size> sizes, int width, int height)
{
// Source: http://stackoverflow.com/questions/7942378/android-camera-will-not-work-startpreview-fails
Camera.Size optimalSize = null;
final double ASPECT_TOLERANCE = 0.1;
double targetRatio = (double) height / width;
// Try to find a size match which suits the whole screen minus the menu on the left.
for (Camera.Size size : sizes){
if (size.height != width) continue;
double ratio = (double) size.width / size.height;
if (ratio <= targetRatio + ASPECT_TOLERANCE && ratio >= targetRatio - ASPECT_TOLERANCE){
optimalSize = size;
}
}
// If we cannot find the one that matches the aspect ratio, ignore the requirement.
if (optimalSize == null) {
// TODO : Backup in case we don't get a size.
}
return optimalSize;
}
}
/**
* Picture Callback for handling a picture capture and saving it out to a file.
*/
private Camera.PictureCallback mPicture = new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
// rotate the picture for embedded camera
boolean rotateFlag = true;
File pictureFile = getOutputMediaFile();
// create a parse photo file to facilitate uploading
try {
PhotoUtils.getInstance().createPhotoFile();
} catch (IOException e){
e.printStackTrace();
}
// get the location data and upload the photo to parse
TabActivity activity = (TabActivity) getActivity();
Location location = activity.getCurrentLocation();
// ParseGeoPoint geoPoint = new ParseGeoPoint(location.getLatitude(), location.getLongitude());
//PhotoUtils.getInstance().uploadPhoto(data, geoPoint, rotateFlag);
Intent confirmationIntent = new Intent(getActivity(), ConfirmationActivity.class);
confirmationIntent.putExtra("data", data);
confirmationIntent.putExtra("location", location);
confirmationIntent.putExtra("rotateFlag", rotateFlag);
confirmationIntent.putExtra("selfFlag", selfFlag);
selfFlag = false;
getActivity().startActivity(confirmationIntent);
// temporary file save to local device for testing
if (pictureFile == null){
Toast.makeText(getActivity(), "Image retrieval failed.", Toast.LENGTH_SHORT)
.show();
return;
}
try {
FileOutputStream fos = new FileOutputStream(pictureFile);
fos.write(data);
fos.close();
// Restart the camera preview.
safeCameraOpenInView(mCameraView);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
};
/*
* temporary local storage for testing/debugging
* Used to return the camera File output.
* @return
*/
private File getOutputMediaFile(){
File mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES), "UltimateCameraGuideApp");
if (! mediaStorageDir.exists()){
if (! mediaStorageDir.mkdirs()){
Log.d("Camera Guide", "Required media storage does not exist");
return null;
}
}
// Create a media file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
File mediaFile;
mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_"+ timeStamp + ".jpg");
Toast.makeText(getActivity(), "Image saved.", Toast.LENGTH_SHORT)
.show();
return mediaFile;
}
}
| 37.118674 | 125 | 0.581363 |
61488da5b654f123d43ba8c843313f48f0cf5ec3
| 3,619 |
package demo.java.v2c10.WebService2;
//import com.horstmann.amazon.*;
import java.awt.*;
import java.awt.event.*;
import java.util.List;
import javax.swing.*;
import javax.xml.ws.*;
/**
* The client for the Amazon e-commerce test program.
* @version 1.10 2007-10-20
* @author Cay Horstmann
*/
public class AmazonTest
{
public static void main(String[] args)
{
JFrame frame = new AmazonTestFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
/**
* A frame to select the book author and to display the server response.
*/
class AmazonTestFrame extends JFrame
{
public AmazonTestFrame()
{
setTitle("AmazonTest");
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
JPanel panel = new JPanel();
panel.add(new JLabel("Author:"));
author = new JTextField(20);
panel.add(author);
JButton searchButton = new JButton("Search");
panel.add(searchButton);
searchButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent event)
{
result.setText("Please wait...");
new SwingWorker<Void, Void>()
{
@Override
protected Void doInBackground() throws Exception
{
String name = author.getText();
String books = searchByAuthor(name);
result.setText(books);
return null;
}
}.execute();
}
});
result = new JTextArea();
result.setLineWrap(true);
result.setEditable(false);
if (accessKey.equals("your key here"))
{
result.setText("You need to edit the Amazon access key.");
searchButton.setEnabled(false);
}
add(panel, BorderLayout.NORTH);
add(new JScrollPane(result), BorderLayout.CENTER);
}
/**
* Calls the Amazon web service to find titles that match the author.
* @param name the author name
* @return a description of the matching titles
*/
private String searchByAuthor(String name)
{
return name;
/* can't find some jar
AWSECommerceService service = new AWSECommerceService();
AWSECommerceServicePortType port = service.getPort(AWSECommerceServicePortType.class);
ItemSearchRequest request = new ItemSearchRequest();
request.getResponseGroup().add("ItemAttributes");
request.setSearchIndex("Books");
Holder<List<Items>> responseHolder = new Holder<List<Items>>();
request.setAuthor(name);
port.itemSearch("", accessKey, "", "", "", "", request, null, null, responseHolder);
List<Item> response = responseHolder.value.get(0).getItem();
StringBuilder r = new StringBuilder();
for (Item item : response)
{
r.append("authors=");
List<String> authors = item.getItemAttributes().getAuthor();
r.append(authors);
r.append(",title=");
r.append(item.getItemAttributes().getTitle());
r.append(",publisher=");
r.append(item.getItemAttributes().getPublisher());
r.append(",pubdate=");
r.append(item.getItemAttributes().getPublicationDate());
r.append("\n");
}
return r.toString();
*/}
private static final int DEFAULT_WIDTH = 450;
private static final int DEFAULT_HEIGHT = 300;
private static final String accessKey = "12Y1EEATQ8DDYJCVQYR2";
private JTextField author;
private JTextArea result;
}
| 29.909091 | 92 | 0.61039 |
6de69c6af6b4023a6b160f36cd08f3e71afd1a6b
| 4,996 |
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.util.database.annotproc;
import java.util.*;
import javax.lang.model.element.*;
import javax.tools.Diagnostic.Kind;
import ghidra.util.database.annot.*;
public class DBAnnotatedObjectValidator {
private final ValidationContext ctx;
private final TypeElement type;
private final Map<String, DBAnnotatedFieldValidator> fieldsByName = new LinkedHashMap<>();
private final Map<String, DBAnnotatedColumnValidator> columnsByName = new LinkedHashMap<>();
public DBAnnotatedObjectValidator(ValidationContext ctx, TypeElement type) {
this.ctx = ctx;
this.type = type;
}
public void addAnnotatedField(VariableElement field) {
DBAnnotatedField annotation = field.getAnnotation(DBAnnotatedField.class);
assert annotation != null;
fieldsByName.put(annotation.column(), new DBAnnotatedFieldValidator(ctx, field));
}
public void addAnnotatedColumn(VariableElement column) {
DBAnnotatedColumn annotation = column.getAnnotation(DBAnnotatedColumn.class);
assert annotation != null;
columnsByName.put(annotation.value(), new DBAnnotatedColumnValidator(ctx, column));
}
public void validate() {
DBAnnotatedObjectInfo annotation = type.getAnnotation(DBAnnotatedObjectInfo.class);
if (annotation != null && type.getKind() != ElementKind.CLASS) {
ctx.messager.printMessage(Kind.ERROR,
String.format("@%s cannot be applied to an interface",
DBAnnotatedObjectInfo.class.getSimpleName()),
type);
}
else if (annotation != null && type.getModifiers().contains(Modifier.ABSTRACT)) {
ctx.messager.printMessage(Kind.ERROR,
String.format("@%s cannot be applied to an abstract class",
DBAnnotatedObjectInfo.class.getSimpleName()),
type);
}
if (annotation != null && !ctx.isSubclass(type, ctx.DB_ANNOTATED_OBJECT_ELEM)) {
ctx.messager.printMessage(Kind.ERROR,
String.format("@%s can only be applied to subclasses of %s", "DBAnnotatedObject",
DBAnnotatedObjectInfo.class.getSimpleName()));
}
if (annotation == null && !type.getModifiers().contains(Modifier.ABSTRACT)) {
ctx.messager.printMessage(Kind.ERROR,
String.format("Non-abstract subclasses of %s must have @%s annotation",
"DBAnnotatedObject", DBAnnotatedObjectInfo.class.getSimpleName()),
type);
}
if (annotation != null && annotation.version() < 0) {
ctx.messager.printMessage(Kind.ERROR, String.format("@%s.version cannot be negative",
DBAnnotatedObjectInfo.class.getSimpleName()), type);
}
validateFields();
validateColumns();
checkMissing();
}
protected void validateFields() {
for (DBAnnotatedFieldValidator fv : fieldsByName.values()) {
fv.validate();
}
}
protected void validateColumns() {
for (DBAnnotatedColumnValidator cv : columnsByName.values()) {
cv.validate();
}
}
protected void checkMissing() {
Set<String> names = new LinkedHashSet<>();
names.addAll(fieldsByName.keySet());
names.addAll(columnsByName.keySet());
for (String n : names) {
DBAnnotatedFieldValidator fv = fieldsByName.get(n);
DBAnnotatedColumnValidator cv = columnsByName.get(n);
if (fv == null && cv != null && !type.getModifiers().contains(Modifier.ABSTRACT)) {
ctx.messager.printMessage(Kind.ERROR,
String.format("@%s is missing corresponding @%s of the same column name: %s",
DBAnnotatedColumn.class.getSimpleName(),
DBAnnotatedField.class.getSimpleName(), n),
cv.column);
}
if (fv != null && cv == null && !type.getModifiers().contains(Modifier.ABSTRACT)) {
ctx.messager.printMessage(Kind.WARNING,
String.format("@%s is missing corresponding @%s of the same column name: %s",
DBAnnotatedField.class.getSimpleName(),
DBAnnotatedColumn.class.getSimpleName(), n),
fv.field);
}
if (fv != null && cv != null) {
checkAccess(fv.field, cv.column, n);
}
}
}
protected void checkAccess(VariableElement field, VariableElement column, String name) {
AccessSpec fieldSpec = AccessSpec.get(field.getModifiers());
AccessSpec columnSpec = AccessSpec.get(column.getModifiers());
if (!AccessSpec.isSameOrMorePermissive(fieldSpec, columnSpec)) {
ctx.messager.printMessage(Kind.WARNING,
String.format(
"field with @%s should have same or greater access than field with" +
" corresponding @%s for column name: %s",
DBAnnotatedColumn.class.getSimpleName(), DBAnnotatedField.class.getSimpleName(),
name),
column);
}
}
}
| 36.202899 | 93 | 0.723579 |
fc558c9545877696c40655c4df62cf564b89af3b
| 504 |
package hackatum.hackabot.bot.skills.examples;
import hackatum.hackabot.bot.Localization;
import hackatum.hackabot.bot.skills.BasicSkill;
import org.telegram.telegrambots.api.methods.send.SendMessage;
import org.telegram.telegrambots.api.objects.Message;
public class GoodBotSkill extends BasicSkill {
@Override
public SendMessage handle(Message incoming) {
return new SendMessage().setChatId(incoming.getChatId()).setText(Localization.getInstance().get("GoodBot", "Message"));
}
}
| 36 | 127 | 0.787698 |
88f8afa9b8666ecd32e88a59755046076955448d
| 2,973 |
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.apdplat.module.monitor.service;
import com.apdplat.module.monitor.model.MemoryState;
import com.apdplat.module.system.service.LogQueue;
import com.apdplat.module.system.service.SystemListener;
import com.apdplat.platform.log.APDPlatLogger;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;
/**
*
* @author ysc
*/
public class MemoryMonitorThread extends Thread{
protected static final APDPlatLogger log = new APDPlatLogger(MemoryMonitorThread.class);
public boolean running=true;
private int circle=10;
public MemoryMonitorThread(int circle){
this.setDaemon(true);
this.setName("内存监视线程(Memory monitor thread)");
log.info("内存监视间隔为(Memory monitor interval) "+circle+" 分钟(min)");
this.circle=circle;
}
@Override
public void run(){
log.info("内存监视线程启动(Launch memory monitor thread)");
while(running){
log();
try {
Thread.sleep(circle*60*1000);
} catch (InterruptedException ex) {
if(!running){
log.info("内存监视线程退出(Exit memory monitor thread)");
}else{
log.error("内存监视线程出错(Error in memory monitor thread)",ex);
}
}
}
}
private void log(){
float max=(float)Runtime.getRuntime().maxMemory()/1000000;
float total=(float)Runtime.getRuntime().totalMemory()/1000000;
float free=(float)Runtime.getRuntime().freeMemory()/1000000;
MemoryState logger=new MemoryState();
try {
logger.setServerIP(InetAddress.getLocalHost().getHostAddress());
} catch (UnknownHostException ex) {
log.error("用户记录日志出错(Error in user record log)",ex);
}
logger.setAppName(SystemListener.getContextPath());
logger.setRecordTime(new Date());
logger.setMaxMemory(max);
logger.setTotalMemory(total);
logger.setFreeMemory(free);
logger.setUsableMemory(logger.getMaxMemory()-logger.getTotalMemory()+logger.getFreeMemory());
LogQueue.addLog(logger);
}
}
| 38.115385 | 101 | 0.668348 |
c30bca3e85e0f830c4a8c89e5885209ee022cc19
| 889 |
package com.cloud.api.query.dao;
import com.cloud.api.ApiConstants.HostDetails;
import com.cloud.api.query.vo.HostJoinVO;
import com.cloud.api.response.HostForMigrationResponse;
import com.cloud.api.response.HostResponse;
import com.cloud.legacymodel.dc.Host;
import com.cloud.utils.db.GenericDao;
import java.util.EnumSet;
import java.util.List;
public interface HostJoinDao extends GenericDao<HostJoinVO, Long> {
HostResponse newHostResponse(HostJoinVO host, EnumSet<HostDetails> details);
HostResponse setHostResponse(HostResponse response, HostJoinVO host);
HostForMigrationResponse newHostForMigrationResponse(HostJoinVO host, EnumSet<HostDetails> details);
HostForMigrationResponse setHostForMigrationResponse(HostForMigrationResponse response, HostJoinVO host);
List<HostJoinVO> newHostView(Host group);
List<HostJoinVO> searchByIds(Long... ids);
}
| 32.925926 | 109 | 0.814398 |
1c23b4c8a9b57ba87b0c0b883f2af29d8b142552
| 319 |
import lombok.Value;
@Value(staticConstructor = "of")
public class ValueWithGeneric176<T> {
private T name;
private int count;
public static void main(String[] args) {
ValueWithGeneric176<String> valueObject = ValueWithGeneric176.of("thing1", 10);
System.out.println(valueObject);
}
}
| 24.538462 | 87 | 0.69279 |
e4615225b9c54dcd25f4548d35ba2458ad91f442
| 10,040 |
package de.ids_mannheim.korap.index;
import static org.junit.Assert.assertEquals;
import java.io.IOException;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.spans.SpanQuery;
import org.apache.lucene.search.spans.SpanTermQuery;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import de.ids_mannheim.korap.KrillIndex;
import de.ids_mannheim.korap.query.DistanceConstraint;
import de.ids_mannheim.korap.query.SpanDistanceQuery;
import de.ids_mannheim.korap.query.SpanElementQuery;
import de.ids_mannheim.korap.query.SpanNextQuery;
import de.ids_mannheim.korap.response.Result;
@RunWith(JUnit4.class)
public class TestUnorderedDistanceIndex {
private KrillIndex ki;
private Result kr;
private FieldDocument createFieldDoc0 () {
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-0");
fd.addTV("base", "text",
"[(0-1)s:c|_1$<i>0<i>1]" + "[(1-2)s:e|_2$<i>1<i>2]"
+ "[(2-3)s:c|_3$<i>2<i>3|<>:y$<b>64<i>2<i>4<i>4<b>0]"
+ "[(3-4)s:c|_4$<i>3<i>4|<>:x$<b>64<i>3<i>7<i>7<b>0]"
+ "[(4-5)s:d|_5$<i>4<i>5|<>:y$<b>64<i>4<i>6<i>6<b>0]"
+ "[(5-6)s:c|_6$<i>5<i>6|<>:y$<b>64<i>5<i>8<i>8<b>0]"
+ "[(6-7)s:d|_7$<i>6<i>7]"
+ "[(7-8)s:f|_8$<i>7<i>8|<>:x$<b>64<i>7<i>9<i>9<b>0]"
+ "[(8-9)s:e|_9$<i>8<i>9|<>:x$<b>64<i>8<i>10<i>10<b>0]"
+ "[(9-10)s:d|_10$<i>9<i>10]");
return fd;
}
private FieldDocument createFieldDoc1 () {
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-1");
fd.addTV("base", "text",
"[(0-1)s:d|_1$<i>0<i>1]" + "[(1-2)s:c|_2$<i>1<i>2]"
+ "[(2-3)s:e|_3$<i>2<i>3]" + "[(3-4)s:e|_4$<i>3<i>4]"
+ "[(4-5)s:d|_5$<i>4<i>5]" + "[(5-6)s:e|_6$<i>5<i>6]"
+ "[(6-7)s:e|_7$<i>6<i>7]" + "[(7-8)s:c|_8$<i>7<i>8]"
+ "[(8-9)s:e|_9$<i>8<i>9]"
+ "[(9-10)s:d|_10$<i>9<i>10]");
return fd;
}
private FieldDocument createFieldDoc2 () {
FieldDocument fd = new FieldDocument();
fd.addString("ID", "doc-2");
fd.addTV("base", "text",
"[(0-1)s:f|_1$<i>0<i>1]" + "[(1-2)s:c|_2$<i>1<i>2]"
+ "[(2-3)s:e|_3$<i>2<i>3]" + "[(3-4)s:e|_4$<i>3<i>4]"
+ "[(4-5)s:d|_5$<i>4<i>5]" + "[(5-6)s:f|_6$<i>5<i>6]"
+ "[(6-7)s:f|_7$<i>6<i>7]");
return fd;
}
private SpanQuery createQuery (String x, String y, int min, int max,
boolean isOrdered) {
SpanQuery sq = new SpanDistanceQuery(
new SpanTermQuery(new Term("base", x)),
new SpanTermQuery(new Term("base", y)),
new DistanceConstraint(min, max, isOrdered, false), true);
return sq;
}
private SpanQuery createElementQuery (String x, String y, int min, int max,
boolean isOrdered) {
SpanQuery sq = new SpanDistanceQuery(new SpanElementQuery("base", x),
new SpanElementQuery("base", y),
new DistanceConstraint(min, max, isOrdered, false), true);
return sq;
}
/**
* One document, multiple occurrences
* The first first and second spans are too far from each other
* One of the spans ends first
* One of the candidate list is empty
*/
@Test
public void testCase1 () throws IOException {
//System.out.println("testcase 1");
ki = new KrillIndex();
ki.addDoc(createFieldDoc0());
ki.commit();
SpanQuery sq = createQuery("s:c", "s:d", 0, 3, false);
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 5);
}
/**
* Multiple documents
* Ensure same doc
* Both candidate lists are empty, but there is a span left in the
* doc
* Both candidate lists are empty, but there are more matches in
* the doc
*
* @throws IOException
*/
@Test
public void testCase2 () throws IOException {
//System.out.println("testcase 2");
ki = new KrillIndex();
ki.addDoc(createFieldDoc0());
ki.addDoc(createFieldDoc1());
ki.commit();
SpanQuery sq = createQuery("s:c", "s:d", 1, 2, false);
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 6);
}
/**
* Multiple documents
* Ensure same Doc
*
* @throws IOException
*/
@Test
public void testCase3 () throws IOException {
//System.out.println("testcase 3");
ki = new KrillIndex();
ki.addDoc(createFieldDoc0());
ki.addDoc(createFieldDoc1());
ki.addDoc(createFieldDoc2());
ki.commit();
SpanQuery sq = createQuery("s:e", "s:f", 1, 2, false);
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 3);
assertEquals(0, kr.getMatch(0).getLocalDocID());
assertEquals(7, kr.getMatch(0).getStartPos());
assertEquals(9, kr.getMatch(0).getEndPos());
assertEquals(2, kr.getMatch(1).getLocalDocID());
assertEquals(0, kr.getMatch(1).getStartPos());
assertEquals(3, kr.getMatch(1).getEndPos());
}
/** Skip to */
@Test
public void testCase4 () throws IOException {
//System.out.println("testcase 4");
ki = new KrillIndex();
ki.addDoc(createFieldDoc0());
ki.addDoc(createFieldDoc1());
ki.addDoc(createFieldDoc2());
ki.commit();
SpanQuery sq = new SpanNextQuery(createQuery("s:d", "s:e", 1, 2, false),
new SpanTermQuery(new Term("base", "s:f")));
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 2);
assertEquals(2, kr.getMatch(0).getLocalDocID());
assertEquals(2, kr.getMatch(0).getStartPos());
assertEquals(6, kr.getMatch(0).getEndPos());
assertEquals(3, kr.getMatch(1).getStartPos());
assertEquals(6, kr.getMatch(1).getEndPos());
}
/** ElementQueries */
@Test
public void testCase5 () throws IOException {
ki = new KrillIndex();
ki.addDoc(createFieldDoc0());
ki.commit();
// Intersection ---- Distance 0:0
//System.out.println("Intersection ---- Distance 0:0");
SpanQuery sq = createElementQuery("x", "y", 0, 0, false);
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 4);
assertEquals(2, kr.getMatch(0).startPos);
assertEquals(7, kr.getMatch(0).endPos);
assertEquals(3, kr.getMatch(1).startPos);
assertEquals(7, kr.getMatch(1).endPos);
assertEquals(3, kr.getMatch(2).startPos);
assertEquals(8, kr.getMatch(2).endPos);
// Next to ---- Distance 1:1
//System.out.println("Next to ---- Distance 1:1");
sq = createElementQuery("x", "y", 1, 1, false);
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 1);
assertEquals(5, kr.getMatch(0).startPos);
assertEquals(10, kr.getMatch(0).endPos);
// ---- Distance 1:2
//System.out.println("---- Distance 1:2");
sq = createElementQuery("x", "y", 1, 2, false);
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 2);
assertEquals(4, kr.getMatch(0).startPos);
assertEquals(9, kr.getMatch(0).endPos);
assertEquals(5, kr.getMatch(1).startPos);
assertEquals(10, kr.getMatch(1).endPos);
}
/**
* The same element type
*
* WARNING:
* This kind of query is not appropriate for an unordered distance
* span query.
* Instead, it must be an ordered distance span query. Such an
* unordered distance
* span query yields "redundant results" because matches are
* searched for each
* child span.
*/
@Test
public void testCase6 () throws IOException {
ki = new KrillIndex();
ki.addDoc(createFieldDoc0());
ki.commit();
//---- Distance 1:2
SpanQuery sq = createElementQuery("x", "x", 1, 2, false);
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 4);
}
/**
* Nested distance queries
*/
@Test
public void testCase7 () throws IOException {
//System.out.println("testcase 7");
ki = new KrillIndex();
ki.addDoc(createFieldDoc0());
ki.addDoc(createFieldDoc1());
ki.commit();
SpanQuery sq = createQuery("s:c", "s:d", 1, 2, false);
SpanQuery sq2 = new SpanDistanceQuery(sq,
new SpanTermQuery(new Term("base", "s:e")),
new DistanceConstraint(1, 2, true, false), true);
kr = ki.search(sq2, (short) 10);
assertEquals(kr.getTotalResults(), 3);
assertEquals(5, kr.getMatch(0).getStartPos());
assertEquals(9, kr.getMatch(0).getEndPos());
assertEquals(1, kr.getMatch(1).getLocalDocID());
assertEquals(0, kr.getMatch(1).getStartPos());
assertEquals(3, kr.getMatch(1).getEndPos());
assertEquals(0, kr.getMatch(2).getStartPos());
assertEquals(4, kr.getMatch(2).getEndPos());
}
/**
* Multiple NextSpans in the same first span position
*/
@Test
public void testCase8 () throws IOException {
ki = new KrillIndex();
ki.addDoc(createFieldDoc1());
ki.commit();
SpanQuery sq = new SpanNextQuery(
new SpanTermQuery(new Term("base", "s:d")),
createQuery("s:c", "s:e", 1, 2, false));
kr = ki.search(sq, (short) 10);
assertEquals(kr.getTotalResults(), 3);
assertEquals(0, kr.getMatch(1).getStartPos());
assertEquals(4, kr.getMatch(1).getEndPos());
}
}
| 33.245033 | 80 | 0.551195 |
ce4b732b20349c75939a63371404bd554f8f1790
| 11,142 |
package com.arenafight;
import com.arenafight.gear.Belt;
import com.arenafight.gear.BeltSize;
import com.arenafight.gear.Footwear;
import com.arenafight.gear.Headgear;
import com.arenafight.weapons.BareHanded;
import com.arenafight.weapons.Weapon;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* A class that represents a Character object that fights in the arena. They have a reference
* to an abilities object that holds their ability values. They also have a Headgear, a footwear
* and a list of belts reference that is used to track what objects are held by the character.
* When the current health of the character drops to 0 in a battle they lose.
*/
public class Character implements Playable {
private final Abilities baseStats;
private Abilities modifiedStats;
private final int totalHealth;
private int currentHealth;
private final String name;
private final String title;
private Headgear headgear;
private Footwear footwear;
private List<Belt> belts;
private List<Potion> potions;
private Weapon weapon;
private int currentBeltWeight;
private final int maxBeltWeight;
/**
* Constructs a character object with random ability values as decided by the seed passed as
* the argument.The total health is calculated based on the sum
* of these values and the current health
* is temporarily set to the same value. We assign a null value to both the headgear and footwear.
*
* @param seed the seed value for randomness
*/
public Character(int seed) {
Roll roll = new Roll();
Random random = new Random(seed);
int baseStrength = roll.rollForStats(random.nextInt());
int baseConstitution = roll.rollForStats(random.nextInt());
int baseDexterity = roll.rollForStats(random.nextInt());
int baseCharisma = roll.rollForStats(random.nextInt());
baseStats = new Abilities(baseStrength, baseConstitution, baseDexterity, baseCharisma);
this.name = roll.rollForCharacterName(random.nextInt());
this.title = roll.rollForTitle(random.nextInt());
this.totalHealth = baseStats.getCharisma()
+ baseStats.getDexterity() + baseStats.getConstitution() + baseStats.getStrength();
headgear = new ItemFactory().makeBareHeadGear();
footwear = new ItemFactory().makeBareFootGear();
belts = new ArrayList<>();
potions = new ArrayList<>();
weapon = new BareHanded();
currentBeltWeight = 0;
maxBeltWeight = 10;
modifiedStats = new Abilities(baseStrength, baseConstitution, baseDexterity, baseCharisma);
currentHealth = totalHealth;
}
@Override
public String printBaseStats() {
return String.format("\n %11s the %s\n", name, title)
+ String.format("%15s : %d\n", "Strength", baseStats.getStrength())
+ String.format("%15s : %d\n", "Constitution", baseStats.getConstitution())
+ String.format("%15s : %d\n", "Dexterity", baseStats.getDexterity())
+ String.format("%15s : %d\n", "Charisma", baseStats.getCharisma())
+ String.format("%15s : %d\n", "Health", totalHealth);
}
@Override
public String printModifiedStats() {
return String.format("\n %11s the %s\n", name, title)
+ String.format("%15s : %d\n", "Strength", modifiedStats.getStrength())
+ String.format("%15s : %d\n", "Constitution", modifiedStats.getConstitution())
+ String.format("%15s : %d\n", "Dexterity", modifiedStats.getDexterity())
+ String.format("%15s : %d\n", "Charisma", modifiedStats.getCharisma())
+ String.format("%15s : %d\n", "Health", currentHealth);
}
public int getCurrentHealth() {
return currentHealth;
}
/**
* Returns the name and the title of the character as the full name.
*
* @return string full name with title
*/
public String getFullName() {
return String.format("%s the %s", this.name, this.title);
}
public void setCurrentHealth(int currentHealth) {
this.currentHealth = currentHealth;
}
/**
* Gets a copy of the weapon of the character as a Weapon object.
*
* @return Weapon the object returned
*/
public Weapon getWeapon() {
return weapon;
}
/**
* Sets the weapon for a character.
*
* @param weapon Weapon object to be set
*/
public void setWeapon(Weapon weapon) {
this.weapon = weapon;
}
/**
* Returns a copy of the belts held by the character.
*
* @return an ArrayList copy of belts
*/
public ArrayList<Belt> getBelts() {
return new ArrayList<>(belts);
}
/**
* Returns a copy of the footwear object held by the character object.
*
* @return a Footwear copy of footwear.
*/
public Footwear getFootwear() {
if (footwear != null) {
return new Footwear(footwear);
}
return null;
}
/**
* Used to set the footwear object for the character.
*
* @param footwear sets the footwear.
*/
public void setFootwear(Footwear footwear) {
this.footwear = footwear;
}
/**
* Used to get a copy of the Headgear object held by the character.
*
* @return a Headgear copy of the headgear.
*/
public Headgear getHeadgear() {
if (headgear != null) {
return new Headgear(headgear);
}
return null;
}
/**
* Used to set the headgear object for character.
*
* @param headgear the headgear object to be set
*/
public void setHeadgear(Headgear headgear) {
this.headgear = headgear;
}
/**
* Used to return the current weight occupied by belts.
* @return an int with the current belt weight
*/
public int getCurrentBeltWeight() {
return currentBeltWeight;
}
/**
* Used to set the current belt weight.
*
* @param currentBeltWeight the current belt weight to be set
*/
public void setCurrentBeltWeight(int currentBeltWeight) {
this.currentBeltWeight = currentBeltWeight;
}
/**
* The max belt weight units that can be carried by a character as defined in the constructor.
*
* @return an int with the max belt weight of the character.
*/
public int getMaxBeltWeight() {
return maxBeltWeight;
}
/**
* A method that adds a belt to a characters list of belts and adds to the current belt weight.
*
* @param belt a belt object to be added to the list of belts
*/
public void wearBelt(Belt belt) {
belts.add(belt);
if (belt.getBeltSize().equals(BeltSize.SMALL)) {
setCurrentBeltWeight(getCurrentBeltWeight() + 1);
} else if (belt.getBeltSize().equals(BeltSize.MEDIUM)) {
setCurrentBeltWeight(getCurrentBeltWeight() + 2);
} else if (belt.getBeltSize().equals((BeltSize.LARGE))) {
setCurrentBeltWeight(getCurrentBeltWeight() + 4);
}
}
/**
* A method that adds a potion to a characters list of potions.
*
* @param potion a potion object to be added to the list of potions
*/
public void drinkPotion(Potion potion) {
potions.add(potion);
}
/**
* A method that returns a copy of the array list of potions
* held by the character.
*
* @return a copy of the Arraylist of potions
*/
public ArrayList<Potion> getPotions() {
return new ArrayList<>(potions);
}
@Override
public Abilities getModifiedStats() {
if (modifiedStats != null) {
return new Abilities(modifiedStats.getStrength(), modifiedStats.getConstitution(),
modifiedStats.getDexterity(), modifiedStats.getCharisma());
}
return null;
}
@Override
public Abilities getBaseStats() {
if (baseStats != null) {
return new Abilities(baseStats.getStrength(), baseStats.getConstitution(),
baseStats.getDexterity(), baseStats.getCharisma());
}
return null;
}
/**
* Sets the modified stats object reference after calculating the modifications.
*
* @param modifiedStats the modified stats object to set
*/
public void setModifiedStats(Abilities modifiedStats) {
this.modifiedStats = modifiedStats;
}
/**
* A method that does the damage calculation for a character attacking an
* opponent and reduces an opponent's health.
*
* @param opponent Character object, the opponent to attack
* @param seed a seed that determines the random values
* @return a string with the text of the battle
*/
public String attack(Character opponent, int seed) {
int strikingPower = calculateStrikingPower(this,seed);
int avoidanceAbility = calculateAvoidanceAbility(opponent,seed);
if (strikingPower > avoidanceAbility) {
int potentialStrikingDamage = calculatePotentialStrikingDamage(this,seed);
int trueDamage = potentialStrikingDamage - opponent.getModifiedStats().getConstitution();
if (trueDamage < 0) {
trueDamage = 0;
}
opponent.setCurrentHealth(opponent.getCurrentHealth() - trueDamage);
return String.format("\n%s inflicted %d damage on %s!\n\n", this.getWeapon().getItemType(),
trueDamage,opponent.getFullName());
} else {
return String.format( "The attack was avoided as "
+ "Striking Power (%d) was less than avoidance (%d)!\n", strikingPower, avoidanceAbility);
}
}
/**
* Resets the character to the default state by unequipping all the gear and removing
* potion effects. The weapon is also unequipped and replaced with BareHanded.
*/
public void resetCharacter() {
headgear = new ItemFactory().makeBareHeadGear();
footwear = new ItemFactory().makeBareFootGear();
belts = new ArrayList<>();
potions = new ArrayList<>();
weapon = new BareHanded();
currentBeltWeight = 0;
modifiedStats = new Abilities(baseStats.getStrength(), baseStats.getConstitution(),
baseStats.getDexterity(), baseStats.getCharisma());
currentHealth = totalHealth;
}
/**
* Used in damage calculation for calculating the Striking Power of attacker.
* @param character the attacking character
* @param seed the random seed int
* @return an integer with striking power
*/
public int calculateStrikingPower(Character character, int seed) {
Random random = new Random(seed);
Roll roll = new Roll();
return character.getModifiedStats().getStrength()
+ roll.rollInRange(1, 10, random.nextInt());
}
/**
* Used in damage calculation for calculating the Striking Power of defender.
* @param opponent the defending character
* @param seed the random seed int
* @return an integer with avoidance ability
*/
public int calculateAvoidanceAbility(Character opponent, int seed) {
Random random = new Random(seed);
Roll roll = new Roll();
return opponent.getModifiedStats().getDexterity()
+ roll.rollInRange(1, 6, random.nextInt());
}
/**
* Used in damage calculation for calculating the Potential Striking damage of attacker.
* @param player the attacking character
* @param seed the random seed int
* @return an integer with potential striking damage
*/
public int calculatePotentialStrikingDamage(Character player, int seed) {
Random random = new Random(seed);
return player.getModifiedStats().getStrength()
+ this.getWeapon().getWeaponDamage(random.nextInt(),this);
}
}
| 31.834286 | 100 | 0.687848 |
cc1fa10ba77fd76e63c2360169e0a71227ebf43e
| 500 |
package application;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
//combining two example in project also
class Alert implements Runnable {
public void run() {
System.out.println("hii");
}
}
public class App {
public static void main(String[] args) {
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
executor.scheduleAtFixedRate(new Alert(), 0L, 1L, TimeUnit.SECONDS);
}
}
| 20.833333 | 74 | 0.77 |
81aeddebd5789a85348cd93df3d390a4e98a01bc
| 5,442 |
package server;
import org.apache.log4j.Logger;
import javax.swing.*;
import java.io.IOException;
import java.util.ArrayList;
public class SharedCarParkState extends JFrame
{
private boolean isAccessing = false;
private int waitingThreads = 0;
private final ArrayList<CarDataModel> groundFloorCollection;
private final ArrayList<CarDataModel> firstFloorCollection;
public Logger Logger;
private javax.swing.JPanel JPanel;
private JLabel carsOnGroundFloor;
private JLabel carsOnFirstFloor;
public SharedCarParkState()
{
super("Car Park State");
setContentPane(JPanel);
pack();
setVisible(true);
Logger = Logger.getLogger(this.getClass().getCanonicalName());
groundFloorCollection = new ArrayList<CarDataModel>();
firstFloorCollection = new ArrayList<CarDataModel>();
}
public synchronized void AcquireLock() throws InterruptedException
{
Thread me = Thread.currentThread(); // get a ref to the current thread
Logger.debug(me.getName() + ": Attempting to acquire a lock.");
waitingThreads++;
while (isAccessing)
{ // while someone else is accessing or threadsWaiting > 0
Logger.debug(me.getName() + ": Waiting to get a lock on as it is currently held by another thread.");
//wait for the lock to be released - see releaseLock() below
wait();
}
Logger.debug("No active thread currently has a lock on. Free for all active!");
// nobody has got a lock so get one
waitingThreads--;
isAccessing = true;
Logger.debug(me.getName() + ": Has acquired a lock on.");
}
public synchronized void ReleaseLock()
{
//release the lock and tell everyone
Logger.debug("Releasing Lock...");
isAccessing = false;
notifyAll();
Thread me = Thread.currentThread(); // get a ref to the current thread
Logger.debug(me.getName() + ": Has released a lock.");
}
public synchronized void ProcessEntry(ClientType clientType, ClientDataModel clientData) throws IOException
{
Logger.info("Car Data received from " + clientType.toString());
if (groundFloorCollection.size() < 20)
{
Logger.info("Ground Floor free to park cars.");
Logger.info("Number of Cars on Ground Floor: " + groundFloorCollection.size());
groundFloorCollection.add(clientData.CarDataModel);
Logger.info("Car Parked - Details: Make: " + clientData.CarDataModel.CarMake + " Licence Plate: " + clientData.CarDataModel.CarLicence);
Logger.info("NEW CAR PARKED - Number of Cars on Ground Floor: " + groundFloorCollection.size());
}
else if (firstFloorCollection.size() < 20)
{
Logger.info("First Floor free to park cars.");
Logger.info("Number of Cars on First Floor: " + firstFloorCollection.size());
firstFloorCollection.add(clientData.CarDataModel);
Logger.info("Car Parked - Details: Make: " + clientData.CarDataModel.CarMake + " Licence Plate: " + clientData.CarDataModel.CarLicence);
Logger.info("NEW CAR PARKED - Number of Cars on First Floor: " + firstFloorCollection.size());
}
}
public synchronized String UpdateFloorSpaces()
{
StringBuilder outgoingXml = new StringBuilder();
outgoingXml.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
outgoingXml.append("<FloorInfo>");
outgoingXml.append("<Info Level=\"GROUNDFLOOR\" Count=\"" +
groundFloorCollection.size() + "\"></Info>");
outgoingXml.append("<Info Level=\"FIRSTFLOOR\" Count=\"" +
firstFloorCollection.size() + "\"></Info>");
outgoingXml.append("</FloorInfo>\r\n");
carsOnGroundFloor.setText(Integer.toString(groundFloorCollection.size()));
carsOnFirstFloor.setText(Integer.toString(firstFloorCollection.size()));
return outgoingXml.toString();
}
public synchronized void ProcessExit(ClientType clientType)
{
Logger.info("Exit Request received from " + clientType.toString());
switch (clientType)
{
case GROUNDFLOOREXIT:
Logger.info("Number of Cars on Ground Floor: " + groundFloorCollection.size());
if (groundFloorCollection.size() > 0)
{
groundFloorCollection.remove(groundFloorCollection.size() - 1);
Logger.info("Car Removed. Current number of Cars on GF: " + groundFloorCollection.size());
}
else
{
Logger.info("No Cars on Ground Floor: " + groundFloorCollection.size());
}
break;
case FIRSTFLOOREXIT:
Logger.info("Number of Cars on First Floor: " + firstFloorCollection.size());
if (firstFloorCollection.size() > 0)
{
firstFloorCollection.remove(firstFloorCollection.size() - 1);
Logger.info("Car Removed. Current number of Cars on FF: " + firstFloorCollection.size());
}
else
{
Logger.info("No Cars on First Floor: " + firstFloorCollection.size());
}
break;
}
}
}
| 38.595745 | 148 | 0.61007 |
2d2973531538947c78081379aae347f673a2c886
| 1,980 |
package com.crescentflare.smartmock.utility;
import android.content.Context;
import com.crescentflare.smartmock.model.SmartMockProperties;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.InputStream;
/**
* Smart mock library utility: easily read and manage response properties
*/
public class SmartMockPropertiesUtility
{
/**
* Private constructor, only static methods allowed
*/
private SmartMockPropertiesUtility()
{
}
/**
* Utility functions
*/
public static SmartMockProperties readFile(Context context, String requestPath, String filePath)
{
SmartMockProperties properties = null;
InputStream responseStream = SmartMockFileUtility.open(context, filePath + "/properties.json");
if (responseStream != null)
{
String result = SmartMockFileUtility.readFromInputStream(responseStream);
if (result != null)
{
try
{
JSONObject propertiesJson = new JSONObject(result);
properties = new SmartMockProperties();
properties.parseJson(propertiesJson);
if (properties.getRedirect() != null)
{
SmartMockProperties redirectProperties = readFile(context, requestPath, filePath + "/" + properties.getRedirect());
if (redirectProperties != null)
{
redirectProperties.fallbackToProperties(properties);
properties = redirectProperties;
}
}
}
catch (JSONException ignored)
{
}
}
}
if (properties == null)
{
properties = new SmartMockProperties();
}
properties.forceDefaults();
return properties;
}
}
| 29.552239 | 139 | 0.563131 |
0fd272bf727138948c249e4d496cf98e43e8b91d
| 4,746 |
package net.oschina.app.improve.detail.apply;
import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.SearchView;
import android.text.TextUtils;
import android.util.TypedValue;
import android.view.View;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import net.oschina.app.R;
import net.oschina.app.improve.base.activities.BackActivity;
import net.oschina.app.improve.widget.SimplexToast;
import net.oschina.app.ui.empty.EmptyLayout;
import net.oschina.app.util.TDevice;
import butterknife.Bind;
import butterknife.OnClick;
/**
* Created by haibin
* on 2016/12/27.
*/
public class ApplyActivity extends BackActivity implements
View.OnClickListener, ApplyContract.EmptyView {
@Bind(R.id.searchView)
SearchView mSearchView;
@Bind(R.id.emptyLayout)
EmptyLayout mEmptyLayout;
@Bind(R.id.ll_search)
LinearLayout mLinearSearch;
@Bind(R.id.fl_tool)
FrameLayout mFrameTool;
@Bind(R.id.search_src_text)
EditText mViewSearchEditor;
private ApplyPresenter mPresenter;
private String mSearchText;
public static void show(Context context, long sourceId) {
Intent intent = new Intent(context, ApplyActivity.class);
intent.putExtra("sourceId", sourceId);
context.startActivity(intent);
}
@Override
protected int getContentView() {
return R.layout.activity_apply;
}
@Override
protected void initWidget() {
super.initWidget();
setStatusBarDarkMode();
setDarkToolBar();
long sourceId = getIntent().getLongExtra("sourceId", 0);
if (sourceId == 0) {
SimplexToast.show(this, "活动不存在");
finish();
return;
}
mViewSearchEditor.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
mSearchView.setOnCloseListener(new SearchView.OnCloseListener() {
@Override
public boolean onClose() {
// 阻止点击关闭按钮 collapse icon
return true;
}
});
mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
mSearchView.clearFocus();
return doSearch(query, false);
}
@Override
public boolean onQueryTextChange(String newText) {
return doSearch(newText, true);
}
});
ApplyFragment fragment = ApplyFragment.newInstance();
mPresenter = new ApplyPresenter(fragment, this, sourceId);
addFragment(R.id.fl_content, fragment);
}
@OnClick({R.id.ll_search, R.id.tv_cancel})
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.ll_search:
mLinearSearch.setVisibility(View.GONE);
mSearchView.setVisibility(View.VISIBLE);
mSearchView.setFocusable(true);
mSearchView.setFocusableInTouchMode(true);
mSearchView.requestFocus();
TDevice.openKeyboard(mSearchView);
break;
case R.id.tv_cancel:
mLinearSearch.setVisibility(View.VISIBLE);
mSearchView.setVisibility(View.GONE);
mViewSearchEditor.setText("");
mPresenter.setFilter("");
mSearchView.clearFocus();
TDevice.hideSoftKeyboard(mSearchView);
break;
}
}
@Override
public void showGetApplyUserSuccess() {
if (isDestroy())
return;
mFrameTool.setVisibility(View.VISIBLE);
mEmptyLayout.setVisibility(View.GONE);
}
@Override
public void showGetApplyUserError(String message) {
}
@Override
public void showSearchError(String message) {
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
mSearchView.clearFocus();
}
private Runnable mSearchRunnable = new Runnable() {
@Override
public void run() {
if (TextUtils.isEmpty(mSearchText))
return;
mPresenter.setFilter(mSearchText);
mPresenter.onRefreshing();
}
};
private boolean doSearch(String query, boolean fromTextChange) {
mSearchText = query.trim();
mPresenter.setFilter(mSearchText);
mLinearSearch.removeCallbacks(mSearchRunnable);
if (fromTextChange && !TDevice.isWifiOpen()) return false;
mLinearSearch.postDelayed(mSearchRunnable, fromTextChange ? 2000 : 0);
return true;
}
}
| 30.037975 | 81 | 0.634218 |
660cde36fbaeb2ee34416ab4ced43497b443c33f
| 1,929 |
package com.numberone.project.system.reduces.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.numberone.project.system.reduces.mapper.ReducesMapper;
import com.numberone.project.system.reduces.domain.Reduces;
import com.numberone.project.system.reduces.service.IReducesService;
import com.numberone.common.utils.text.Convert;
/**
* 减少排碳Service业务层处理
*
* @author sqalong
* @date 2021-01-13
*/
@Service
public class ReducesServiceImpl implements IReducesService
{
@Autowired
private ReducesMapper reducesMapper;
/**
* 查询减少排碳
*
* @param id 减少排碳ID
* @return 减少排碳
*/
@Override
public Reduces selectReducesById(Long id)
{
return reducesMapper.selectReducesById(id);
}
/**
* 查询减少排碳列表
*
* @param reduces 减少排碳
* @return 减少排碳
*/
@Override
public List<Reduces> selectReducesList(Reduces reduces)
{
return reducesMapper.selectReducesList(reduces);
}
/**
* 新增减少排碳
*
* @param reduces 减少排碳
* @return 结果
*/
@Override
public int insertReduces(Reduces reduces)
{
return reducesMapper.insertReduces(reduces);
}
/**
* 修改减少排碳
*
* @param reduces 减少排碳
* @return 结果
*/
@Override
public int updateReduces(Reduces reduces)
{
return reducesMapper.updateReduces(reduces);
}
/**
* 删除减少排碳对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteReducesByIds(String ids)
{
return reducesMapper.deleteReducesByIds(Convert.toStrArray(ids));
}
/**
* 删除减少排碳信息
*
* @param id 减少排碳ID
* @return 结果
*/
@Override
public int deleteReducesById(Long id)
{
return reducesMapper.deleteReducesById(id);
}
}
| 20.305263 | 73 | 0.636081 |
27951f94eff82c103c4e79b457f4f5daf74f5b5f
| 14,594 |
/*
* Copyright 1999-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id$
*/
package org.apache.xml.serializer;
import java.io.IOException;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
/**
* This class writes unicode characters to a byte stream (java.io.OutputStream)
* as quickly as possible. It buffers the output in an internal
* buffer which must be flushed to the OutputStream when done. This flushing
* is done via the close() flush() or flushBuffer() method.
*/
public final class WriterToUTF8Buffered extends Writer
{
/** number of bytes that the byte buffer can hold.
* This is a fixed constant is used rather than m_outputBytes.lenght for performance.
*/
private static final int BYTES_MAX=16*1024;
/** number of characters that the character buffer can hold.
* This is 1/3 of the number of bytes because UTF-8 encoding
* can expand one unicode character by up to 3 bytes.
*/
private static final int CHARS_MAX=(BYTES_MAX/3);
// private static final int
/** The byte stream to write to. (sc & sb remove final to compile in JDK 1.1.8) */
private final OutputStream m_os;
/**
* The internal buffer where data is stored.
* (sc & sb remove final to compile in JDK 1.1.8)
*/
private final byte m_outputBytes[];
private final char m_inputChars[];
/**
* The number of valid bytes in the buffer. This value is always
* in the range <tt>0</tt> through <tt>m_outputBytes.length</tt>; elements
* <tt>m_outputBytes[0]</tt> through <tt>m_outputBytes[count-1]</tt> contain valid
* byte data.
*/
private int count;
/**
* Create an buffered UTF-8 writer.
*
*
* @param out the underlying output stream.
*
* @throws UnsupportedEncodingException
*/
public WriterToUTF8Buffered(OutputStream out)
throws UnsupportedEncodingException
{
m_os = out;
// get 3 extra bytes to make buffer overflow checking simpler and faster
// we won't have to keep checking for a few extra characters
m_outputBytes = new byte[BYTES_MAX + 3];
// Big enough to hold the input chars that will be transformed
// into output bytes in m_ouputBytes.
m_inputChars = new char[CHARS_MAX + 1];
count = 0;
// the old body of this constructor, before the buffersize was changed to a constant
// this(out, 8*1024);
}
/**
* Create an buffered UTF-8 writer to write data to the
* specified underlying output stream with the specified buffer
* size.
*
* @param out the underlying output stream.
* @param size the buffer size.
* @exception IllegalArgumentException if size <= 0.
*/
// public WriterToUTF8Buffered(final OutputStream out, final int size)
// {
//
// m_os = out;
//
// if (size <= 0)
// {
// throw new IllegalArgumentException(
// SerializerMessages.createMessage(SerializerErrorResources.ER_BUFFER_SIZE_LESSTHAN_ZERO, null)); //"Buffer size <= 0");
// }
//
// m_outputBytes = new byte[size];
// count = 0;
// }
/**
* Write a single character. The character to be written is contained in
* the 16 low-order bits of the given integer value; the 16 high-order bits
* are ignored.
*
* <p> Subclasses that intend to support efficient single-character output
* should override this method.
*
* @param c int specifying a character to be written.
* @exception IOException If an I/O error occurs
*/
public void write(final int c) throws IOException
{
/* If we are close to the end of the buffer then flush it.
* Remember the buffer can hold a few more bytes than BYTES_MAX
*/
if (count >= BYTES_MAX)
flushBuffer();
if (c < 0x80)
{
m_outputBytes[count++] = (byte) (c);
}
else if (c < 0x800)
{
m_outputBytes[count++] = (byte) (0xc0 + (c >> 6));
m_outputBytes[count++] = (byte) (0x80 + (c & 0x3f));
}
else
{
m_outputBytes[count++] = (byte) (0xe0 + (c >> 12));
m_outputBytes[count++] = (byte) (0x80 + ((c >> 6) & 0x3f));
m_outputBytes[count++] = (byte) (0x80 + (c & 0x3f));
}
}
/**
* Write a portion of an array of characters.
*
* @param chars Array of characters
* @param start Offset from which to start writing characters
* @param length Number of characters to write
*
* @exception IOException If an I/O error occurs
*
* @throws java.io.IOException
*/
public void write(final char chars[], final int start, final int length)
throws java.io.IOException
{
// We multiply the length by three since this is the maximum length
// of the characters that we can put into the buffer. It is possible
// for each Unicode character to expand to three bytes.
int lengthx3 = 3*length;
if (lengthx3 >= BYTES_MAX - count)
{
// The requested length is greater than the unused part of the buffer
flushBuffer();
if (lengthx3 >= BYTES_MAX)
{
/*
* The requested length exceeds the size of the buffer.
* Cut the buffer up into chunks, each of which will
* not cause an overflow to the output buffer m_outputBytes,
* and make multiple recursive calls.
*/
final int chunks = 1 + length/CHARS_MAX;
for (int chunk =0 ; chunk < chunks; chunk++)
{
int start_chunk = start + ((length*chunk)/chunks);
int end_chunk = start + ((length*(chunk+1))/chunks);
int len_chunk = (end_chunk - start_chunk);
this.write(chars,start_chunk, len_chunk);
}
return;
}
}
final int n = length+start;
final byte[] buf_loc = m_outputBytes; // local reference for faster access
int count_loc = count; // local integer for faster access
int i = start;
{
/* This block could be omitted and the code would produce
* the same result. But this block exists to give the JIT
* a better chance of optimizing a tight and common loop which
* occurs when writing out ASCII characters.
*/
char c;
for(; i < n && (c = chars[i])< 0x80 ; i++ )
buf_loc[count_loc++] = (byte)c;
}
for (; i < n; i++)
{
final char c = chars[i];
if (c < 0x80)
buf_loc[count_loc++] = (byte) (c);
else if (c < 0x800)
{
buf_loc[count_loc++] = (byte) (0xc0 + (c >> 6));
buf_loc[count_loc++] = (byte) (0x80 + (c & 0x3f));
}
else
{
buf_loc[count_loc++] = (byte) (0xe0 + (c >> 12));
buf_loc[count_loc++] = (byte) (0x80 + ((c >> 6) & 0x3f));
buf_loc[count_loc++] = (byte) (0x80 + (c & 0x3f));
}
}
// Store the local integer back into the instance variable
count = count_loc;
}
/**
* Writes out the character array
* @param chars a character array with only ASCII characters, so
* the UTF-8 encoding is optimized.
* @param start the first character in the input array
* @param length the number of characters in the input array
*/
private void directWrite(final char chars[], final int start, final int length)
throws java.io.IOException
{
if (length >= BYTES_MAX - count)
{
// The requested length is greater than the unused part of the buffer
flushBuffer();
if (length >= BYTES_MAX)
{
/*
* The requested length exceeds the size of the buffer.
* Cut the buffer up into chunks, each of which will
* not cause an overflow to the output buffer m_outputBytes,
* and make multiple recursive calls.
*/
int chunks = 1 + length/CHARS_MAX;
for (int chunk =0 ; chunk < chunks; chunk++)
{
int start_chunk = start + ((length*chunk)/chunks);
int end_chunk = start + ((length*(chunk+1))/chunks);
int len_chunk = (end_chunk - start_chunk);
this.directWrite(chars,start_chunk, len_chunk);
}
return;
}
}
final int n = length+start;
final byte[] buf_loc = m_outputBytes; // local reference for faster access
int count_loc = count; // local integer for faster access
for(int i=start; i < n ; i++ )
buf_loc[count_loc++] = (byte) buf_loc[i];
// Store the local integer back into the instance variable
count = count_loc;
}
/**
* Write a string.
*
* @param s String to be written
*
* @exception IOException If an I/O error occurs
*/
public void write(final String s) throws IOException
{
// We multiply the length by three since this is the maximum length
// of the characters that we can put into the buffer. It is possible
// for each Unicode character to expand to three bytes.
final int length = s.length();
int lengthx3 = 3*length;
if (lengthx3 >= BYTES_MAX - count)
{
// The requested length is greater than the unused part of the buffer
flushBuffer();
if (lengthx3 >= BYTES_MAX)
{
/*
* The requested length exceeds the size of the buffer,
* so break it up in chunks that don't exceed the buffer size.
*/
final int start = 0;
int chunks = 1 + length/CHARS_MAX;
for (int chunk =0 ; chunk < chunks; chunk++)
{
int start_chunk = start + ((length*chunk)/chunks);
int end_chunk = start + ((length*(chunk+1))/chunks);
int len_chunk = (end_chunk - start_chunk);
s.getChars(start_chunk,end_chunk, m_inputChars,0);
this.write(m_inputChars,0, len_chunk);
}
return;
}
}
s.getChars(0, length , m_inputChars, 0);
final char[] chars = m_inputChars;
final int n = length;
final byte[] buf_loc = m_outputBytes; // local reference for faster access
int count_loc = count; // local integer for faster access
int i = 0;
{
/* This block could be omitted and the code would produce
* the same result. But this block exists to give the JIT
* a better chance of optimizing a tight and common loop which
* occurs when writing out ASCII characters.
*/
char c;
for(; i < n && (c = chars[i])< 0x80 ; i++ )
buf_loc[count_loc++] = (byte)c;
}
for (; i < n; i++)
{
final char c = chars[i];
if (c < 0x80)
buf_loc[count_loc++] = (byte) (c);
else if (c < 0x800)
{
buf_loc[count_loc++] = (byte) (0xc0 + (c >> 6));
buf_loc[count_loc++] = (byte) (0x80 + (c & 0x3f));
}
else
{
buf_loc[count_loc++] = (byte) (0xe0 + (c >> 12));
buf_loc[count_loc++] = (byte) (0x80 + ((c >> 6) & 0x3f));
buf_loc[count_loc++] = (byte) (0x80 + (c & 0x3f));
}
}
// Store the local integer back into the instance variable
count = count_loc;
}
/**
* Flush the internal buffer
*
* @throws IOException
*/
public void flushBuffer() throws IOException
{
if (count > 0)
{
m_os.write(m_outputBytes, 0, count);
count = 0;
}
}
/**
* Flush the stream. If the stream has saved any characters from the
* various write() methods in a buffer, write them immediately to their
* intended destination. Then, if that destination is another character or
* byte stream, flush it. Thus one flush() invocation will flush all the
* buffers in a chain of Writers and OutputStreams.
*
* @exception IOException If an I/O error occurs
*
* @throws java.io.IOException
*/
public void flush() throws java.io.IOException
{
flushBuffer();
m_os.flush();
}
/**
* Close the stream, flushing it first. Once a stream has been closed,
* further write() or flush() invocations will cause an IOException to be
* thrown. Closing a previously-closed stream, however, has no effect.
*
* @exception IOException If an I/O error occurs
*
* @throws java.io.IOException
*/
public void close() throws java.io.IOException
{
flushBuffer();
m_os.close();
}
/**
* Get the output stream where the events will be serialized to.
*
* @return reference to the result stream, or null of only a writer was
* set.
*/
public OutputStream getOutputStream()
{
return m_os;
}
/**
*
* @param s A string with only ASCII characters
* @throws IOException
*/
public void directWrite(final String s) throws IOException
{
final int length = s.length();
if (length >= BYTES_MAX - count)
{
// The requested length is greater than the unused part of the buffer
flushBuffer();
if (length >= BYTES_MAX)
{
/*
* The requested length exceeds the size of the buffer,
* so don't bother to buffer this one, just write it out
* directly. The buffer is already flushed so this is a
* safe thing to do.
*/
final int start = 0;
int chunks = 1 + length/CHARS_MAX;
for (int chunk =0 ; chunk < chunks; chunk++)
{
int start_chunk = start + ((length*chunk)/chunks);
int end_chunk = start + ((length*(chunk+1))/chunks);
int len_chunk = (end_chunk - start_chunk);
s.getChars(start_chunk,end_chunk, m_inputChars,0);
this.directWrite(m_inputChars,0, len_chunk);
}
return;
}
}
s.getChars(0, length , m_inputChars, 0);
final char[] chars = m_inputChars;
final byte[] buf_loc = m_outputBytes; // local reference for faster access
int count_loc = count; // local integer for faster access
int i = 0;
while( i < length)
buf_loc[count_loc++] = (byte)chars[i++];
// Store the local integer back into the instance variable
count = count_loc;
}
}
| 30.340956 | 128 | 0.608469 |
74b58969b00812fd660ab058c42fb3019c81f7c1
| 1,693 |
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: types.proto
package com.github.jtendermint.jabci.types;
public interface ConsensusParamsOrBuilder extends
// @@protoc_insertion_point(interface_extends:com.github.jtendermint.jabci.types.ConsensusParams)
com.google.protobuf.MessageOrBuilder {
/**
* <code>.com.github.jtendermint.jabci.types.BlockParams block = 1;</code>
*/
boolean hasBlock();
/**
* <code>.com.github.jtendermint.jabci.types.BlockParams block = 1;</code>
*/
com.github.jtendermint.jabci.types.BlockParams getBlock();
/**
* <code>.com.github.jtendermint.jabci.types.BlockParams block = 1;</code>
*/
com.github.jtendermint.jabci.types.BlockParamsOrBuilder getBlockOrBuilder();
/**
* <code>.com.github.jtendermint.jabci.types.EvidenceParams evidence = 2;</code>
*/
boolean hasEvidence();
/**
* <code>.com.github.jtendermint.jabci.types.EvidenceParams evidence = 2;</code>
*/
com.github.jtendermint.jabci.types.EvidenceParams getEvidence();
/**
* <code>.com.github.jtendermint.jabci.types.EvidenceParams evidence = 2;</code>
*/
com.github.jtendermint.jabci.types.EvidenceParamsOrBuilder getEvidenceOrBuilder();
/**
* <code>.com.github.jtendermint.jabci.types.ValidatorParams validator = 3;</code>
*/
boolean hasValidator();
/**
* <code>.com.github.jtendermint.jabci.types.ValidatorParams validator = 3;</code>
*/
com.github.jtendermint.jabci.types.ValidatorParams getValidator();
/**
* <code>.com.github.jtendermint.jabci.types.ValidatorParams validator = 3;</code>
*/
com.github.jtendermint.jabci.types.ValidatorParamsOrBuilder getValidatorOrBuilder();
}
| 34.55102 | 101 | 0.724158 |
497c7241b0eaa1b290ef26d4b9b0e2504ec3321b
| 1,876 |
package com.inpowered.nlp.stanford;
import java.util.List;
import javax.annotation.PostConstruct;
import org.springframework.stereotype.Service;
import com.inpowered.nlp.NamingService;
import com.inpowered.user.profile.Profile;
import edu.stanford.nlp.ie.AbstractSequenceClassifier;
import edu.stanford.nlp.ie.crf.CRFClassifier;
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.ling.CoreLabel;
@Service("namingService")
public class StanfordNLPNamingService implements NamingService {
protected final static String PERSON = "PERSON";
protected String serializedClassifier = "classifiers/english.all.3class.distsim.crf.ser.gz";
protected AbstractSequenceClassifier<CoreLabel> classifier = null;
public String getSerializedClassifier() {
return serializedClassifier;
}
public void setSerializedClassifier(String serializedClassifier) {
this.serializedClassifier = serializedClassifier;
}
protected AbstractSequenceClassifier<CoreLabel> classifier()
{
return this.classifier;
}
protected void classifier(AbstractSequenceClassifier<CoreLabel> classifier)
{
this.classifier = classifier;
}
/* (non-Javadoc)
* @see com.inpowered.nlp.stanford.NamingService#classifyNames(com.inpowered.user.profile.Profile)
*/
public void classifyNames(Profile profile)
{
for (List<CoreLabel> lcl : classifier.classify(profile.getFullName())) {
// There should only be two names
boolean isPerson = lcl.size() == 2
// And both of them should be names of people
&& PERSON.equals(lcl.get(0).get(CoreAnnotations.AnswerAnnotation.class))
&& PERSON.equals(lcl.get(1).get(CoreAnnotations.AnswerAnnotation.class));
profile.setIsPerson(isPerson);
}
}
@PostConstruct
public void startUp() throws Exception
{
this.classifier(CRFClassifier.getClassifier(this.getSerializedClassifier()));
}
}
| 28.861538 | 99 | 0.773987 |
1c2b431d55f8a4cbef7210a2095bc6c8d8aab533
| 7,047 |
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.shardingsphere.core.parse.parser.clause.expression;
import lombok.RequiredArgsConstructor;
import org.apache.shardingsphere.core.parse.antlr.constant.QuoteCharacter;
import org.apache.shardingsphere.core.parse.lexer.LexerEngine;
import org.apache.shardingsphere.core.parse.lexer.token.Literals;
import org.apache.shardingsphere.core.parse.lexer.token.Symbol;
import org.apache.shardingsphere.core.parse.parser.expression.SQLExpression;
import org.apache.shardingsphere.core.parse.parser.expression.SQLIdentifierExpression;
import org.apache.shardingsphere.core.parse.parser.expression.SQLIgnoreExpression;
import org.apache.shardingsphere.core.parse.parser.expression.SQLNumberExpression;
import org.apache.shardingsphere.core.parse.parser.expression.SQLPlaceholderExpression;
import org.apache.shardingsphere.core.parse.parser.expression.SQLPropertyExpression;
import org.apache.shardingsphere.core.parse.parser.expression.SQLTextExpression;
import org.apache.shardingsphere.core.parse.parser.sql.SQLStatement;
import org.apache.shardingsphere.core.parse.parser.token.TableToken;
import org.apache.shardingsphere.core.parse.util.SQLUtil;
import org.apache.shardingsphere.core.util.NumberUtil;
/**
* Basic expression parser.
*
* @author zhangliang
* @author panjuan
*/
@RequiredArgsConstructor
public final class BasicExpressionParser {
private final LexerEngine lexerEngine;
/**
* Parse expression.
*
* @param sqlStatement SQL statement
* @return expression
*/
public SQLExpression parse(final SQLStatement sqlStatement) {
int beginPosition = lexerEngine.getCurrentToken().getEndPosition();
SQLExpression result = parseExpression(sqlStatement);
if (result instanceof SQLPropertyExpression) {
setTableToken(sqlStatement, beginPosition, (SQLPropertyExpression) result);
}
return result;
}
// TODO complete more expression parse
private SQLExpression parseExpression(final SQLStatement sqlStatement) {
String literals = lexerEngine.getCurrentToken().getLiterals();
final int beginPosition = lexerEngine.getCurrentToken().getEndPosition() - literals.length();
final SQLExpression expression = getExpression(literals, sqlStatement);
lexerEngine.nextToken();
if (lexerEngine.skipIfEqual(Symbol.DOT)) {
String property = lexerEngine.getCurrentToken().getLiterals();
lexerEngine.nextToken();
return skipIfCompositeExpression(sqlStatement)
? new SQLIgnoreExpression(lexerEngine.getInput().substring(beginPosition, lexerEngine.getCurrentToken().getEndPosition()))
: new SQLPropertyExpression(new SQLIdentifierExpression(literals), property);
}
if (lexerEngine.equalAny(Symbol.LEFT_PAREN)) {
lexerEngine.skipParentheses(sqlStatement);
skipRestCompositeExpression(sqlStatement);
return new SQLIgnoreExpression(lexerEngine.getInput().substring(beginPosition,
lexerEngine.getCurrentToken().getEndPosition() - lexerEngine.getCurrentToken().getLiterals().length()).trim());
}
return skipIfCompositeExpression(sqlStatement)
? new SQLIgnoreExpression(lexerEngine.getInput().substring(beginPosition, lexerEngine.getCurrentToken().getEndPosition())) : expression;
}
private SQLExpression getExpression(final String literals, final SQLStatement sqlStatement) {
if (lexerEngine.equalAny(Symbol.QUESTION)) {
sqlStatement.increaseParametersIndex();
return new SQLPlaceholderExpression(sqlStatement.getParametersIndex() - 1);
}
if (lexerEngine.equalAny(Literals.CHARS)) {
return new SQLTextExpression(literals);
}
if (lexerEngine.equalAny(Literals.INT)) {
return new SQLNumberExpression(NumberUtil.getExactlyNumber(literals, 10));
}
if (lexerEngine.equalAny(Literals.FLOAT)) {
return new SQLNumberExpression(Double.parseDouble(literals));
}
if (lexerEngine.equalAny(Literals.HEX)) {
return new SQLNumberExpression(NumberUtil.getExactlyNumber(literals, 16));
}
if (lexerEngine.equalAny(Literals.IDENTIFIER)) {
return new SQLIdentifierExpression(SQLUtil.getExactlyValue(literals));
}
return new SQLIgnoreExpression(literals);
}
private boolean skipIfCompositeExpression(final SQLStatement sqlStatement) {
if (lexerEngine.equalAny(
Symbol.PLUS, Symbol.SUB, Symbol.STAR, Symbol.SLASH, Symbol.PERCENT, Symbol.AMP, Symbol.BAR, Symbol.DOUBLE_AMP, Symbol.DOUBLE_BAR, Symbol.CARET, Symbol.DOT, Symbol.LEFT_PAREN)) {
lexerEngine.skipParentheses(sqlStatement);
skipRestCompositeExpression(sqlStatement);
return true;
}
if ((Literals.INT == lexerEngine.getCurrentToken().getType() || Literals.FLOAT == lexerEngine.getCurrentToken().getType()) && lexerEngine.getCurrentToken().getLiterals().startsWith("-")) {
lexerEngine.nextToken();
return true;
}
return false;
}
private void skipRestCompositeExpression(final SQLStatement sqlStatement) {
while (lexerEngine.skipIfEqual(Symbol.PLUS, Symbol.SUB, Symbol.STAR, Symbol.SLASH, Symbol.PERCENT, Symbol.AMP, Symbol.BAR, Symbol.DOUBLE_AMP, Symbol.DOUBLE_BAR, Symbol.CARET, Symbol.DOT)) {
if (lexerEngine.equalAny(Symbol.QUESTION)) {
sqlStatement.increaseParametersIndex();
}
lexerEngine.nextToken();
lexerEngine.skipParentheses(sqlStatement);
}
}
private void setTableToken(final SQLStatement sqlStatement, final int beginPosition, final SQLPropertyExpression propertyExpr) {
String owner = propertyExpr.getOwner().getName();
if (sqlStatement.getTables().getTableNames().contains(SQLUtil.getExactlyValue(propertyExpr.getOwner().getName()))) {
sqlStatement.addSQLToken(new TableToken(beginPosition - owner.length(), SQLUtil.getExactlyValue(owner), QuoteCharacter.getQuoteCharacter(owner), 0));
}
}
}
| 50.335714 | 197 | 0.721584 |
83782a14467dc5faeabbe90d5375017be9aba9fd
| 465 |
package com.voxelwind.server.network.mcpe.packets;
import com.voxelwind.nbt.util.Varints;
import com.voxelwind.server.network.NetworkPackage;
import io.netty.buffer.ByteBuf;
import lombok.Data;
@Data
public class McpeSetTime implements NetworkPackage
{
private int time;
@Override
public void decode (ByteBuf buffer)
{
time = Varints.decodeSigned (buffer);
}
@Override
public void encode (ByteBuf buffer)
{
Varints.encodeSigned (buffer, time);
}
}
| 18.6 | 51 | 0.769892 |
8a87cc8e1a43f53ba7e74dd0ede2fd4285ea676a
| 9,603 |
package DiscordPlayer;
import com.google.api.services.youtube.model.PlaylistItem;
import com.google.api.services.youtube.model.SearchResult;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayer;
import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager;
import com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager;
import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers;
import com.sedmelluq.discord.lavaplayer.track.playback.NonAllocatingAudioFrameBuffer;
import discord4j.core.DiscordClientBuilder;
import discord4j.core.GatewayDiscordClient;
import discord4j.core.event.domain.message.MessageCreateEvent;
import discord4j.core.object.VoiceState;
import discord4j.core.object.entity.Member;
import discord4j.core.object.entity.channel.Channel;
import discord4j.core.object.entity.channel.VoiceChannel;
import discord4j.voice.AudioProvider;
import org.apache.hc.core5.http.ParseException;
import se.michaelthelin.spotify.exceptions.SpotifyWebApiException;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
public class Main {
private static boolean joined = false;
private static final Map<String, Command> commands = new HashMap<String, Command>();
static final AudioPlayerManager playerManager = new DefaultAudioPlayerManager();
static final AudioPlayer player = playerManager.createPlayer();
static final TrackScheduler scheduler = new TrackScheduler(player);
static final AudioProvider provider = new LavaPlayerAudioProvider(player);
public static void main(final String[] args) throws IOException {
InputStream input = new FileInputStream("application.properties");
Properties properties = new Properties();
properties.load(input);
String discordToken = properties.getProperty("discordBotToken");
String prefix = properties.getProperty("prefix");
// Creates AudioPlayer instances and translates URLs to AudioTrack instances
// This is an optimization strategy that Discord4J can utilize.
// It is not important to understand
playerManager.getConfiguration().setFrameBufferFactory(NonAllocatingAudioFrameBuffer::new);
// Allow playerManager to parse remote sources like YouTube links
AudioSourceManagers.registerRemoteSources(playerManager);
// Create an AudioPlayer so Discord4J can receive audio data
// We will be creating LavaPlayerAudioProvider in the next step
commands.put("join", event -> {
final Member member = event.getMember().orElse(null);
if (member != null) {
final VoiceState voiceState = member.getVoiceState().block();
if (voiceState != null) {
final VoiceChannel channel = voiceState.getChannel().block();
if (channel != null) {
// join returns a VoiceConnection which would be required if we were
// adding disconnection features, but for now we are just ignoring it.
channel.join(spec -> spec.setProvider(provider)).block();
joined = true;
if (scheduler.getPlayer().getPlayingTrack() != null) {
scheduler.pause(true);
}
}
}
}
});
final GatewayDiscordClient client = DiscordClientBuilder.create(discordToken).build().login().block();
client.getEventDispatcher().on(MessageCreateEvent.class)
// subscribe is like block, in that it will *request* for action
// to be done, but instead of blocking the thread, waiting for it
// to finish, it will just execute the results asynchronously.
.subscribe(event -> {
// 3.1 Message.getContent() is a String
final String content = event.getMessage().getContent();
String[] contentSplitted = content.split(" ");
for (final Map.Entry<String, Command> entry : commands.entrySet()) {
// We will be using ! as our "prefix" to any command in the system.
if (contentSplitted[0].startsWith(prefix + entry.getKey())) {
System.out.println(event.getMessage().getContent());
try {
entry.getValue().execute(event);
} catch (IOException e) {
e.printStackTrace();
}
break;
}
}
});
client.onDisconnect().block();
}
static {
commands.put("play", event -> {
if (!joined) {
commands.get("join").execute(event);
}
final String content = event.getMessage().getContent().toString();
final List<String> command = Arrays.asList(content.split(" " ));
scheduler.setEvent(event);
if (command.get(1).startsWith("https://www.youtube.com/watch?v=")) {
System.out.println(command.get(1).toString());
playerManager.loadItem(command.get(1), scheduler);
} else if(command.get(1).startsWith("https://www.youtube.com/playlist?list=")) {
String playlistId = command.get(1).split("list=")[1];
List<PlaylistItem> playlist = YoutubeSearch.getVideosFromPlaylist(playlistId);
scheduler.setFromPlaylist(true);
event.getMessage().getChannel().block().createMessage("**Now Scheduling **" + command.get(1)).block();
for(int i = 0; i < playlist.size(); i++) {
scheduler.setEvent(event);
playerManager.loadItem("https://www.youtube.com/watch?v=" +
playlist.get(i).getSnippet().getResourceId().getVideoId(), scheduler);
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
scheduler.setFromPlaylist(false);
} else if(command.get(1).startsWith("https://open.spotify.com/playlist/")) {
String playlistURL = command.get(1).split("playlist/")[1];
playlistURL = playlistURL.replace("?", "&&").split("&&")[0];
try {
List<String> tracks = SpotifySearch.getPlaylistTrackNames(playlistURL);
event.getMessage().getChannel().block().createMessage("**Now Scheduling **" + command.get(1)).block();
scheduler.setFromPlaylist(true);
for (String track : tracks) {
String url = "https://www.youtube.com/watch?v=";
SearchResult result = YoutubeSearch.getVideoInfo(track);
playerManager.loadItem(url + result.getId().getVideoId(), scheduler);
Thread.sleep(10);
}
Thread.sleep(500);
scheduler.setFromPlaylist(false);
} catch (ParseException e) {
e.printStackTrace();
} catch (SpotifyWebApiException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
} else {
String url = "https://www.youtube.com/watch?v=";
StringBuilder sb = new StringBuilder();
for(int i = 0; i < command.size(); i++) {
if(i != 0) {
sb.append(command.get(i) + " ");
}
}
SearchResult video = YoutubeSearch.getVideoInfo(sb.toString());
scheduler.setEvent(event);
playerManager.loadItem(url + video.getId().getVideoId(), scheduler);
}
});
commands.put("skip", event -> {
scheduler.setEvent(event);
scheduler.skip();
});
commands.put("queue", event -> {
scheduler.setEvent(event);
scheduler.showQueue();
});
commands.put("clear", event -> {
scheduler.setEvent(event);
scheduler.clearQueue();
});
commands.put("ping", event -> event.getMessage().getChannel().block().createMessage("Pong!").block());
commands.put("pause", event -> {
scheduler.setEvent(event);
scheduler.pause(false);
});
commands.put("loop", event -> {
scheduler.setEvent(event);
if (scheduler.isLoop()) {
scheduler.setLoop(false);
event.getMessage().getChannel().block().createMessage("**Continuing with queue...**").block();
} else {
event.getMessage().getChannel().block().createMessage("**Now playing in loop -> **" +
scheduler.getPlayer().getPlayingTrack().getInfo().title).block();
scheduler.setLoop(true);
}
});
commands.put("disconnect", event -> {
VoiceChannel channel = event.getMember().orElse(null).getVoiceState().block().getChannel().block();
scheduler.pause(true);
joined = false;
channel.sendDisconnectVoiceState().block();
});
}
}
| 49.756477 | 122 | 0.573467 |
ce7079b859691c05fa7bdf419bd0e4cd9bbc4d07
| 4,631 |
/*
Copyright 1995-2019 Esri
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For additional information, contact:
Environmental Systems Research Institute, Inc.
Attn: Contracts Dept
380 New York Street
Redlands, California, USA 92373
email: contracts@esri.com
*/
package com.esri.core.geometry;
public class OperatorCentroid2DLocal extends OperatorCentroid2D {
@Override
public Point2D execute(Geometry geometry, ProgressTracker progressTracker) {
if (geometry.isEmpty()) {
return null;
}
Geometry.Type geometryType = geometry.getType();
switch (geometryType) {
case Point:
return ((Point) geometry).getXY();
case Line:
return computeLineCentroid((Line) geometry);
case Envelope:
return ((Envelope) geometry).getCenterXY();
case MultiPoint:
return computePointsCentroid((MultiPoint) geometry);
case Polyline:
return computePolylineCentroid(((Polyline) geometry));
case Polygon:
return computePolygonCentroid((Polygon) geometry);
default:
throw new UnsupportedOperationException("Unexpected geometry type: " + geometryType);
}
}
private static Point2D computeLineCentroid(Line line) {
return new Point2D((line.getEndX() - line.getStartX()) / 2, (line.getEndY() - line.getStartY()) / 2);
}
// Points centroid is arithmetic mean of the input points
private static Point2D computePointsCentroid(MultiVertexGeometry multiPoint) {
double xSum = 0;
double ySum = 0;
int pointCount = multiPoint.getPointCount();
Point2D point2D = new Point2D();
for (int i = 0; i < pointCount; i++) {
multiPoint.getXY(i, point2D);
xSum += point2D.x;
ySum += point2D.y;
}
return new Point2D(xSum / pointCount, ySum / pointCount);
}
// Lines centroid is weighted mean of each line segment, weight in terms of line
// length
private static Point2D computePolylineCentroid(MultiPath polyline) {
double totalLength = polyline.calculateLength2D();
if (totalLength == 0) {
return computePointsCentroid(polyline);
}
MathUtils.KahanSummator xSum = new MathUtils.KahanSummator(0);
MathUtils.KahanSummator ySum = new MathUtils.KahanSummator(0);
Point2D point = new Point2D();
SegmentIterator iter = polyline.querySegmentIterator();
while (iter.nextPath()) {
while (iter.hasNextSegment()) {
Segment seg = iter.nextSegment();
seg.getCoord2D(0.5, point);
double length = seg.calculateLength2D();
point.scale(length);
xSum.add(point.x);
ySum.add(point.y);
}
}
return new Point2D(xSum.getResult() / totalLength, ySum.getResult() / totalLength);
}
// Polygon centroid: area weighted average of centroids
private static Point2D computePolygonCentroid(Polygon polygon) {
double totalArea = polygon.calculateArea2D();
if (totalArea == 0)
{
return computePolylineCentroid(polygon);
}
MathUtils.KahanSummator xSum = new MathUtils.KahanSummator(0);
MathUtils.KahanSummator ySum = new MathUtils.KahanSummator(0);
Point2D startPoint = new Point2D();
Point2D current = new Point2D();
Point2D next = new Point2D();
Point2D origin = polygon.getXY(0);
for (int ipath = 0, npaths = polygon.getPathCount(); ipath < npaths; ipath++) {
int startIndex = polygon.getPathStart(ipath);
int endIndex = polygon.getPathEnd(ipath);
int pointCount = endIndex - startIndex;
if (pointCount < 3) {
continue;
}
polygon.getXY(startIndex, startPoint);
polygon.getXY(startIndex + 1, current);
current.sub(startPoint);
for (int i = startIndex + 2, n = endIndex; i < n; i++) {
polygon.getXY(i, next);
next.sub(startPoint);
double twiceTriangleArea = next.x * current.y - current.x * next.y;
xSum.add((current.x + next.x) * twiceTriangleArea);
ySum.add((current.y + next.y) * twiceTriangleArea);
current.setCoords(next);
}
startPoint.sub(origin);
startPoint.scale(6.0 * polygon.calculateRingArea2D(ipath));
//add weighted startPoint
xSum.add(startPoint.x);
ySum.add(startPoint.y);
}
totalArea *= 6.0;
Point2D res = new Point2D(xSum.getResult() / totalArea, ySum.getResult() / totalArea);
res.add(origin);
return res;
}
}
| 32.159722 | 103 | 0.71518 |
b479a81deaac8d681d3c0ffbb6aaf04b531989b0
| 4,362 |
package org.firstinspires.ftc.teamcode;
public class Matricies {
private double[][] forward;
private double[][] distSensor;
private double[][] distSensorOrientation;
public double angle;
private static Matricies instance;
public double[][] getForward(double angle) {
double[][] transform = rotateTransform(angle);
return multiply(transform, forward);
}
public double[][] getDistSensorPos(double angle) {
double[][] transform = rotateTransform(angle);
return multiply(transform, distSensor);
}
public double[][] getDistSensorForward(double angle) { //returns a unit vector in the direction that the distance sensor is facing
double[][] transform = rotateTransform(angle);
return multiply(transform, distSensorOrientation);
}
public Matricies(){
forward = multiply(rotateTransform(-Math.PI/4), vector(0.0d, 1.0d));
distSensor = multiply(rotateTransform(-Math.PI/4), vector(0.0d, 1.0d));//need distSensor measurement. the robots forward is the +y direction and right is the +x directon. angle = 0;
distSensorOrientation = multiply(rotateTransform(-Math.PI/4), vector(1.0d, 0.0d));
}
public static Matricies getInstance(){
if (instance == null) {
instance = new Matricies();
}
return instance;
}
public void updateRobotPosition(){
}
public static int[][] vector(int x, int y) { //creates a vector using the given x and y components
int[][] v = new int[2][1];
v[0][0] = x;
v[1][0] = y;
return v;
}
public static double[][] vector(double x, double y) { //double overload
double[][] v = new double[2][1];
v[0][0] = x;
v[1][0] = y;
return v;
}
public static int[][] multiply(int[][] a, int[][] b) { //Multiplies two matricies using basic matrix multiplycation rules
int[][] p = new int[a.length][b[0].length];
for (int row = 0; row < a.length; row++) { //apparently, you use semicol0ns;;;
for (int col = 0; col < b[0].length; col++) {
int s = 0;
for (int i = 0; i < b.length; i++) {
s += a[row][i] * b[i][col];
}
p[row][col] = s;
}
}
return p; //i think this will work
//it w0rks!
}
public static double[][] multiply(double[][] a, double[][] b) { //overload for double
double[][] p = new double[a.length][b[0].length];
for (int row = 0; row < a.length; row++) {
for (int col = 0; col < b[0].length; col++) {
double s = 0;
for (int i = 0; i < b.length; i++) {
s += a[row][i] * b[i][col];
}
p[row][col] = s;
}
}
return p;
}
public double[][] add(double[][] a, double[][] b) { //overload this for int as well maybe
double[][] sum = new double[a.length][a[1].length];
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a[0].length; j++) {
sum[i][j] = a[i][j] + b[i][j];
}
}
return sum;
}
public static double[][] rotateTransform(double angle) { //returns a transform matrix that when multiplied by a vector will rotate the vector by the given angle.
double[][] transform = new double[2][2];
transform[0][0] = Math.cos(angle);
transform[0][1] = Math.sin(angle);
transform[1][0] = -Math.sin(angle);
transform[1][1] = Math.cos(angle);
return transform;
}
public static double[][] scale(double a, double[][] b) {//scales a matrix by a scalar
double[][] out = new double[b.length][b[0].length];
for (int i = 0; i < b.length; i++) {
for (int j = 0; j < b[0].length; j++) {
out[i][j] = a * b[i][j];
}
}
return out;
}
/*
we can use matricies as vectors and transform them using matrix multiplycation using a traansform matrix such as
[cos(a) -sin(a)]
[sin(a) cos(a)]
to rotate the vector.
*/
}
| 35.754098 | 197 | 0.514901 |
c519a17ac1fb091a6ccae62ec4138fdfd7c3f770
| 3,289 |
/*
* Copyright DataStax, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.datastax.dse.protocol.internal.request;
import static org.assertj.core.api.Assertions.assertThat;
import com.datastax.dse.protocol.internal.DseProtocolConstants;
import com.datastax.dse.protocol.internal.DseTestDataProviders;
import com.datastax.oss.protocol.internal.Message;
import com.datastax.oss.protocol.internal.MessageTestBase;
import com.datastax.oss.protocol.internal.PrimitiveSizes;
import com.datastax.oss.protocol.internal.binary.MockBinaryString;
import com.tngtech.java.junit.dataprovider.DataProviderRunner;
import com.tngtech.java.junit.dataprovider.UseDataProvider;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(DataProviderRunner.class)
public class ReviseTest extends MessageTestBase<Revise> {
public ReviseTest() {
super(Revise.class);
}
@Override
protected Message.Codec newCodec(int protocolVersion) {
return new Revise.Codec(protocolVersion);
}
@Test
@UseDataProvider(location = DseTestDataProviders.class, value = "protocolDseV1OrAbove")
public void should_encode_and_decode_cancel_continuous_paging(int protocolVersion) {
Revise initial = Revise.cancelContinuousPaging(42);
MockBinaryString encoded = encode(initial, protocolVersion);
assertThat(encoded)
.isEqualTo(
new MockBinaryString()
.int_(DseProtocolConstants.RevisionType.CANCEL_CONTINUOUS_PAGING)
.int_(42));
assertThat(encodedSize(initial, protocolVersion)).isEqualTo(PrimitiveSizes.INT * 2);
Revise decoded = decode(encoded, protocolVersion);
assertThat(decoded.revisionType)
.isEqualTo(DseProtocolConstants.RevisionType.CANCEL_CONTINUOUS_PAGING);
assertThat(decoded.streamId).isEqualTo(42);
assertThat(decoded.nextPages).isEqualTo(-1);
}
@Test
@UseDataProvider(location = DseTestDataProviders.class, value = "protocolDseV2OrAbove")
public void should_encode_and_decode_request_for_more_pages_in_dse_v2_and_above(
int protocolVersion) {
Revise initial = Revise.requestMoreContinuousPages(42, 10);
MockBinaryString encoded = encode(initial, protocolVersion);
assertThat(encoded)
.isEqualTo(
new MockBinaryString()
.int_(DseProtocolConstants.RevisionType.MORE_CONTINUOUS_PAGES)
.int_(42)
.int_(10));
assertThat(encodedSize(initial, protocolVersion)).isEqualTo(PrimitiveSizes.INT * 3);
Revise decoded = decode(encoded, protocolVersion);
assertThat(decoded.revisionType)
.isEqualTo(DseProtocolConstants.RevisionType.MORE_CONTINUOUS_PAGES);
assertThat(decoded.streamId).isEqualTo(42);
assertThat(decoded.nextPages).isEqualTo(10);
}
}
| 37.804598 | 89 | 0.757981 |
513d3ab98a2a82ace1fed83c055ca773486f2ccc
| 501 |
package com.wecamp.model;
import java.sql.Date;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MemberAndAuthority {
private int rnum;
private String email;
private int a_no;
private String name;
private String nickname;
private String pwd;
private Date birth;
private long point;
private String approval_status;
private String approval_key;
private String grade;
private String a_name;
}
| 19.269231 | 33 | 0.804391 |
b131b9ea2ccd2dfff458580100942c953c1d20cd
| 257 |
package com.example.application.data.repository;
import com.example.application.data.entity.FoodProduct;
import org.springframework.data.jpa.repository.JpaRepository;
public interface FoodProductRepository extends JpaRepository<FoodProduct, Integer> {
}
| 28.555556 | 84 | 0.848249 |
907ae9aef80aa7b99d74f334cd359386981c9151
| 1,318 |
package org.moodminds.route;
/**
* Route definition block by the argument values functional interface.
*
* @param <I1> the type of the input argument 1
* @param <I2> the type of the input argument 2
* @param <I3> the type of the input argument 3
* @param <I4> the type of the input argument 4
* @param <I5> the type of the input argument 5
* @param <I6> the type of the input argument 6
* @param <I7> the type of the input argument 7
* @param <$R> the type of the route definition result
*/
@FunctionalInterface
public interface Block7<I1, I2, I3, I4, I5, I6, I7, $R extends Routing<?>> {
/**
* Define the route block by the specified argument value.
*
* @param value1 the specified argument value 1
* @param value2 the specified argument value 2
* @param value3 the specified argument value 3
* @param value4 the specified argument value 4
* @param value5 the specified argument value 5
* @param value6 the specified argument value 6
* @param value7 the specified argument value 7
* @return a route block definition result
* @throws RouteException an exception in case of route definition error
*/
$R block(Value<I1> value1, Value<I2> value2, Value<I3> value3, Value<I4> value4, Value<I5> value5, Value<I6> value6, Value<I7> value7);
}
| 39.939394 | 139 | 0.694234 |
ebf34956014e449a066094e7220a524abb5e5afa
| 2,103 |
package com.koch.ambeth.cache.interceptor;
/*-
* #%L
* jambeth-cache
* %%
* Copyright (C) 2017 Koch Softwaredevelopment
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
* #L%
*/
import java.lang.reflect.Method;
import com.koch.ambeth.cache.IRootCache;
import com.koch.ambeth.cache.RootCache;
import com.koch.ambeth.ioc.config.Property;
import com.koch.ambeth.ioc.threadlocal.Forkable;
import com.koch.ambeth.util.threading.SensitiveThreadLocal;
import net.sf.cglib.proxy.MethodProxy;
public class ThreadLocalRootCacheInterceptor extends AbstractRootCacheAwareInterceptor {
protected static final Method clearMethod = AbstractRootCacheAwareInterceptor.clearMethod;
@Property(defaultValue = "false")
protected boolean privileged;
@Forkable
protected final ThreadLocal<RootCache> rootCacheTL = new SensitiveThreadLocal<>();
protected IRootCache getCurrentRootCache() {
IRootCache rootCache = getCurrentRootCacheIfValid();
if (rootCache == null) {
rootCache = acquireRootCache(privileged, rootCacheTL);
}
return rootCache;
}
protected IRootCache getCurrentRootCacheIfValid() {
return rootCacheTL.get();
}
@Override
protected Object interceptIntern(Object obj, Method method, Object[] args, MethodProxy proxy)
throws Throwable {
if (clearMethod.equals(method)) {
IRootCache rootCache = getCurrentRootCacheIfValid();
if (rootCache == null) {
// Nothing to do
return null;
}
}
IRootCache rootCache = getCurrentRootCache();
return proxy.invoke(rootCache, args);
}
@Override
public void cleanupThreadLocal() {
disposeCurrentRootCache(rootCacheTL);
}
}
| 28.808219 | 94 | 0.768426 |
2e98b5cbb877fa10020cf2e874e3644b8840ad74
| 4,271 |
package de.simbuildings.tilemapper.variations;
import de.simbuildings.tilemapper.image.TextureImage;
import de.simbuildings.tilemapper.variations.model.Face;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import java.util.Set;
import static de.simbuildings.tilemapper.junit.TestUtils.getSampleTexture;
import static org.assertj.core.api.Assertions.assertThat;
class VariantDtoTextureTest {
@Test
@DisplayName("Should return single additional texture when single override")
void shouldReturnSingleAdditionalTexture_WhenSingleOverride() {
// given
TextureImage textureDefault = getSampleTexture("alternate_sample_1.png");
TextureImage textureTop = getSampleTexture("alternate_sample_2.png");
// when
VariantDto variantDto = VariantDto.builder(textureDefault)
.weight(2)
.overrideSlabTexture(Face.TOP, textureTop)
.build();
Set<TextureImage> additionalTextures = variantDto.additionalTextures();
// then
assertThat(additionalTextures)
.contains(textureTop)
.doesNotContain(textureDefault);
}
@Test
@DisplayName("Should return single additional texture when multiple overrides with same file")
void shouldReturnSingleAdditionalTexture_WhenMultipleOverridesWithSameFile() {
// given
TextureImage textureDefault = getSampleTexture("alternate_sample_1.png");
TextureImage textureTop = getSampleTexture("alternate_sample_2.png");
// when
VariantDto variantDto = VariantDto.builder(textureDefault)
.weight(2)
.overrideSlabTexture(Face.TOP, textureTop)
.overrideSlabTexture(Face.BOTTOM, textureTop)
.build();
Set<TextureImage> additionalTextures = variantDto.additionalTextures();
// then
assertThat(additionalTextures)
.hasSize(1);
}
@Test
@DisplayName("Should get slab textures without override")
void shouldGetSlabTextures_WhenNoOverride() {
// given
TextureImage textureDefault = getSampleTexture("alternate_sample_1.png");
// when
VariantDto variantDto = new VariantDto(textureDefault);
TextureImage slabOverride = variantDto.slabTexture(Face.TOP);
// then
assertThat(slabOverride).isEqualTo(textureDefault);
}
@Test
@DisplayName("Should get stair textures without override")
void shouldGetStairTextures_WhenNoOverride() {
// given
TextureImage textureDefault = getSampleTexture("alternate_sample_1.png");
// when
VariantDto variantDto = new VariantDto(textureDefault);
// then
assertThat(variantDto.stairTexture(Face.BOTTOM)).isEqualTo(textureDefault);
assertThat(variantDto.stairTexture(Face.SIDE)).isEqualTo(textureDefault);
assertThat(variantDto.stairTexture(Face.TOP)).isEqualTo(textureDefault);
}
@Test
@DisplayName("Should get slab textures with override")
void shouldGetSlabTexture_WhenOverride() {
// given
TextureImage textureDefault = getSampleTexture("alternate_sample_1.png");
TextureImage textureTop = getSampleTexture("alternate_sample_2.png");
// when
VariantDto variantDto = VariantDto.builder(textureDefault)
.weight(2)
.overrideSlabTexture(Face.TOP, textureTop)
.build();
TextureImage slabTexture = variantDto.slabTexture(Face.TOP);
// then
assertThat(slabTexture).isEqualTo(textureTop);
}
@Test
@DisplayName("Should get stair textures with override")
void shouldGetStairTextures_WhenOverride() {
// given
TextureImage textureDefault = getSampleTexture("alternate_sample_1.png");
TextureImage textureTop = getSampleTexture("alternate_sample_2.png");
// when
VariantDto variantDto = VariantDto.builder(textureDefault)
.overrideStairTexture(Face.TOP, textureTop)
.build();
TextureImage stairTexture = variantDto.stairTexture(Face.TOP);
// then
assertThat(stairTexture).isEqualTo(textureTop);
}
}
| 36.194915 | 98 | 0.682744 |
a82d069abaf72d69a19aefefce015109400240b9
| 7,802 |
/*
* Copyright 2014-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghost.framework.data.commons.repository.query;
import ghost.framework.beans.annotation.constraints.Nullable;
import ghost.framework.context.factory.ListableBeanFactory;
import ghost.framework.data.commons.spel.ExtensionAwareEvaluationContextProvider;
import ghost.framework.data.commons.spel.spi.EvaluationContextExtension;
import ghost.framework.data.commons.repository.QueryMethodEvaluationContextProvider;
import ghost.framework.expression.EvaluationContext;
import ghost.framework.expression.spel.support.StandardEvaluationContext;
import ghost.framework.util.Assert;
import ghost.framework.util.ConcurrentReferenceHashMap;
import ghost.framework.util.ReflectionUtils;
import ghost.framework.util.StringUtils;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.Stream;
//import ghost.framework.beans.factory.ListableBeanFactory;
//import ghost.framework.data.spel.ExtensionAwareEvaluationContextProvider;
//import ghost.framework.data.spel.spi.EvaluationContextExtension;
//import ghost.framework.expression.EvaluationContext;
//import ghost.framework.expression.spel.support.StandardEvaluationContext;
//import ghost.framework.lang.Nullable;
//import ghost.framework.util.Assert;
//import ghost.framework.util.ConcurrentReferenceHashMap;
//import ghost.framework.util.ReflectionUtils;
//import ghost.framework.util.StringUtils;
/**
* An {@link QueryMethodEvaluationContextProvider} that assembles an {@link EvaluationContext} from a list of
* {@link EvaluationContextExtension} instances.
*
* @author Thomas Darimont
* @author Oliver Gierke
* @author Christoph Strobl
* @author Jens Schauder
* @since 1.9
*/
public class ExtensionAwareQueryMethodEvaluationContextProvider implements QueryMethodEvaluationContextProvider {
private final ExtensionAwareEvaluationContextProvider delegate;
/**
* Creates a new {@link ExtensionAwareQueryMethodEvaluationContextProvider}.
*
* @param beanFactory the {@link ListableBeanFactory} to lookup the {@link EvaluationContextExtension}s from, must not
* be {@literal null}.
*/
public ExtensionAwareQueryMethodEvaluationContextProvider(ListableBeanFactory beanFactory) {
Assert.notNull(beanFactory, "ListableBeanFactory must not be null!");
this.delegate = null;//new ExtensionAwareEvaluationContextProvider(beanFactory);
}
/**
* Creates a new {@link ExtensionAwareQueryMethodEvaluationContextProvider} using the given
* {@link EvaluationContextExtension}s.
*
* @param extensions must not be {@literal null}.
*/
public ExtensionAwareQueryMethodEvaluationContextProvider(List<? extends EvaluationContextExtension> extensions) {
Assert.notNull(extensions, "EvaluationContextExtensions must not be null!");
this.delegate = new ExtensionAwareEvaluationContextProvider(extensions);
}
/*
* (non-Javadoc)
* @see ghost.framework.data.repository.query.QueryMethodEvaluationContextProvider#getEvaluationContext(ghost.framework.data.repository.query.Parameters, java.lang.Object[])
*/
@Override
public <T extends Parameters<?, ?>> EvaluationContext getEvaluationContext(T parameters, Object[] parameterValues) {
StandardEvaluationContext evaluationContext = delegate.getEvaluationContext(parameterValues);
evaluationContext.setVariables(collectVariables(parameters, parameterValues));
return evaluationContext;
}
/**
* Exposes variables for all named parameters for the given arguments. Also exposes non-bindable parameters under the
* names of their types.
*
* @param parameters must not be {@literal null}.
* @param arguments must not be {@literal null}.
* @return
*/
private static Map<String, Object> collectVariables(Parameters<?, ?> parameters, Object[] arguments) {
Map<String, Object> variables = new HashMap<>();
parameters.stream()//
.filter(Parameter::isSpecialParameter)//
.forEach(it -> variables.put(//
StringUtils.uncapitalize(it.getType().getSimpleName()), //
arguments[it.getIndex()]));
parameters.stream()//
.filter(Parameter::isNamedParameter)//
.forEach(it -> variables.put(//
it.getName().orElseThrow(() -> new IllegalStateException("Should never occur!")), //
arguments[it.getIndex()]));
return variables;
}
/**
* Looks up all {@link EvaluationContextExtension} and
* {@link ghost.framework.data.repository.query.spi.EvaluationContextExtension} instances from the given
* {@link ListableBeanFactory} and wraps the latter into proxies so that they implement the former.
*
* @param beanFactory must not be {@literal null}.
* @return
*/
private static List<EvaluationContextExtension> getExtensionsFrom(ListableBeanFactory beanFactory) {
Stream<EvaluationContextExtension> extensions = beanFactory
.getBeansOfType(EvaluationContextExtension.class, true, false).values().stream();
return extensions.collect(Collectors.toList());
}
/**
* A {@link MethodInterceptor} that forwards all invocations of methods (by name and parameter types) that are
* available on a given target object
*
* @author Oliver Gierke
*/
static class DelegatingMethodInterceptor implements MethodInterceptor {
private static final Map<Method, Method> METHOD_CACHE = new ConcurrentReferenceHashMap<Method, Method>();
private final Object target;
private final Map<String, java.util.function.Function<Object, Object>> directMappings = new HashMap<>();
DelegatingMethodInterceptor(Object target) {
this.target = target;
}
/**
* Registers a result mapping for the method with the given name. Invocation results for matching methods will be
* piped through the mapping.
*
* @param methodName
* @param mapping
*/
public void registerResultMapping(String methodName, java.util.function.Function<Object, Object> mapping) {
this.directMappings.put(methodName, mapping);
}
/*
* (non-Javadoc)
* @see org.aopalliance.intercept.MethodInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
*/
@Nullable
@Override
public Object invoke(@Nullable MethodInvocation invocation) throws Throwable {
if (invocation == null) {
throw new IllegalArgumentException("Invocation must not be null!");
}
Method method = invocation.getMethod();
Method targetMethod = METHOD_CACHE.computeIfAbsent(method,
it -> Optional.ofNullable(findTargetMethod(it)).orElse(it));
Object result = method.equals(targetMethod) ? invocation.proceed()
: ReflectionUtils.invokeMethod(targetMethod, target, invocation.getArguments());
if (result == null) {
return result;
}
java.util.function.Function<Object, Object> mapper = directMappings.get(targetMethod.getName());
return mapper != null ? mapper.apply(result) : result;
}
@Nullable
private Method findTargetMethod(Method method) {
try {
return target.getClass().getMethod(method.getName(), method.getParameterTypes());
} catch (Exception e) {
return null;
}
}
}
}
| 36.288372 | 174 | 0.767752 |
2d915beb77e45bbda993f679b34a98888e735f5c
| 3,937 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.netbeans.modules.hudson.subversion;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Writer;
import org.netbeans.junit.NbTestCase;
import org.netbeans.modules.hudson.spi.HudsonSCM;
import org.netbeans.modules.hudson.spi.HudsonSCM.ConfigurationStatus;
import org.openide.xml.XMLUtil;
import org.w3c.dom.Document;
public class HudsonSubversionSCMTest extends NbTestCase {
public HudsonSubversionSCMTest(String n) {
super(n);
}
@Override protected void setUp() throws Exception {
clearWorkDir();
}
public void testNonSVNDir() throws Exception {
HudsonSCM scm = new HudsonSubversionSCM();
assertNull(scm.forFolder(getWorkDir()));
}
public void testSVNDir() throws Exception {
HudsonSCM scm = new HudsonSubversionSCM();
File dir = getWorkDir();
File dotSvn = new File(dir, ".svn");
dotSvn.mkdir();
OutputStream os = new FileOutputStream(new File(dotSvn, "entries"));
InputStream is = HudsonSubversionSCMTest.class.getResourceAsStream("sample-entries-file");
int c;
while ((c = is.read()) != -1) {
os.write(c);
}
is.close();
os.close();
HudsonSCM.Configuration cfg = scm.forFolder(dir);
assertNotNull(cfg);
Document doc = XMLUtil.createDocument("root", null, null, null);
cfg.configure(doc);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
XMLUtil.write(doc, baos, "UTF-8");
assertEquals("<?xml version='1.0' encoding='UTF-8'?>" +
"<root>" +
"<scm class='hudson.scm.SubversionSCM'>" +
"<locations>" +
"<hudson.scm.SubversionSCM_-ModuleLocation>" +
"<remote>https://sezpoz.dev.java.net/svn/sezpoz/trunk</remote>" +
"<local>.</local>" +
"</hudson.scm.SubversionSCM_-ModuleLocation>" +
"</locations>" +
"<useUpdate>false</useUpdate>" +
"</scm>" +
"<triggers>" +
"<hudson.triggers.SCMTrigger>" +
"<spec>@hourly</spec>" +
"</hudson.triggers.SCMTrigger>" +
"</triggers>" +
"</root>",
baos.toString("UTF-8").replace('"', '\'').replaceAll("\n *", "").replaceAll("\r|\n", ""));
}
public void testSVN17Dir() throws Exception { // #210884
HudsonSCM scm = new HudsonSubversionSCM();
File dir = getWorkDir();
File dotSvn = new File(dir, ".svn");
dotSvn.mkdir();
Writer w = new FileWriter(new File(dotSvn, "entries"));
w.write("12\n");
w.flush();
w.close();
HudsonSCM.Configuration cfg = scm.forFolder(dir);
assertNotNull(cfg);
ConfigurationStatus problems = cfg.problems();
assertNotNull(problems);
assertEquals(Bundle.ERR_unsupported(), problems.getErrorMessage());
}
}
| 37.141509 | 106 | 0.624587 |
1e61be6b9ce6e700350d7a057d9404acda797dd2
| 43,631 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.storm.daemon.supervisor;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NavigableMap;
import org.apache.commons.lang.StringUtils;
import org.apache.storm.Config;
import org.apache.storm.DaemonConfig;
import org.apache.storm.container.ResourceIsolationInterface;
import org.apache.storm.generated.LocalAssignment;
import org.apache.storm.generated.ProfileAction;
import org.apache.storm.generated.ProfileRequest;
import org.apache.storm.generated.StormTopology;
import org.apache.storm.generated.WorkerResources;
import org.apache.storm.shade.com.google.common.base.Joiner;
import org.apache.storm.shade.com.google.common.collect.Lists;
import org.apache.storm.utils.ConfigUtils;
import org.apache.storm.utils.LocalState;
import org.apache.storm.utils.ObjectReader;
import org.apache.storm.utils.ServerConfigUtils;
import org.apache.storm.utils.ServerUtils;
import org.apache.storm.utils.SimpleVersion;
import org.apache.storm.utils.Time;
import org.apache.storm.utils.Utils;
import org.apache.storm.utils.VersionInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static org.apache.storm.daemon.nimbus.Nimbus.MIN_VERSION_SUPPORT_RPC_HEARTBEAT;
import static org.apache.storm.utils.Utils.OR;
import org.apache.storm.metric.StormMetricsRegistry;
/**
* A container that runs processes on the local box.
*/
public class BasicContainer extends Container {
static final TopoMetaLRUCache TOPO_META_CACHE = new TopoMetaLRUCache();
private static final Logger LOG = LoggerFactory.getLogger(BasicContainer.class);
private static final FilenameFilter jarFilter = (dir, name) -> name.endsWith(".jar");
private static final Joiner CPJ =
Joiner.on(File.pathSeparator).skipNulls();
protected final LocalState _localState;
protected final String _profileCmd;
protected final String _stormHome = System.getProperty(ConfigUtils.STORM_HOME);
protected final double hardMemoryLimitMultiplier;
protected final long hardMemoryLimitOver;
protected final long lowMemoryThresholdMB;
protected final long mediumMemoryThresholdMb;
protected final long mediumMemoryGracePeriodMs;
protected volatile boolean _exitedEarly = false;
protected volatile long memoryLimitMB;
protected volatile long memoryLimitExceededStart;
/**
* Create a new BasicContainer.
*
* @param type the type of container being made.
* @param conf the supervisor config
* @param supervisorId the ID of the supervisor this is a part of.
* @param supervisorPort the thrift server port of the supervisor this is a part of.
* @param port the port the container is on. Should be <= 0 if only a partial recovery
* @param assignment the assignment for this container. Should be null if only a partial recovery.
* @param resourceIsolationManager used to isolate resources for a container can be null if no isolation is used.
* @param localState the local state of the supervisor. May be null if partial recovery
* @param workerId the id of the worker to use. Must not be null if doing a partial recovery.
* @param metricsRegistry The metrics registry.
* @param containerMemoryTracker The shared memory tracker for the supervisor's containers
*/
public BasicContainer(ContainerType type, Map<String, Object> conf, String supervisorId, int supervisorPort,
int port, LocalAssignment assignment, ResourceIsolationInterface resourceIsolationManager,
LocalState localState, String workerId, StormMetricsRegistry metricsRegistry,
ContainerMemoryTracker containerMemoryTracker) throws IOException {
this(type, conf, supervisorId, supervisorPort, port, assignment, resourceIsolationManager, localState,
workerId, metricsRegistry, containerMemoryTracker, null, null, null);
}
/**
* Create a new BasicContainer.
*
* @param type the type of container being made.
* @param conf the supervisor config
* @param supervisorId the ID of the supervisor this is a part of.
* @param supervisorPort the thrift server port of the supervisor this is a part of.
* @param port the port the container is on. Should be <= 0 if only a partial recovery
* @param assignment the assignment for this container. Should be null if only a partial recovery.
* @param resourceIsolationManager used to isolate resources for a container can be null if no isolation is used.
* @param localState the local state of the supervisor. May be null if partial recovery
* @param workerId the id of the worker to use. Must not be null if doing a partial recovery.
* @param metricsRegistry The metrics registry.
* @param containerMemoryTracker The shared memory tracker for the supervisor's containers
* @param ops file system operations (mostly for testing) if null a new one is made
* @param topoConf the config of the topology (mostly for testing) if null and not a partial recovery the real conf is
* read.
* @param profileCmd the command to use when profiling (used for testing)
* @throws IOException on any error
* @throws ContainerRecoveryException if the Container could not be recovered.
*/
BasicContainer(ContainerType type, Map<String, Object> conf, String supervisorId, int supervisorPort, int port,
LocalAssignment assignment, ResourceIsolationInterface resourceIsolationManager, LocalState localState, String workerId,
StormMetricsRegistry metricsRegistry, ContainerMemoryTracker containerMemoryTracker, Map<String, Object> topoConf,
AdvancedFSOps ops, String profileCmd) throws IOException {
super(type, conf, supervisorId, supervisorPort, port, assignment,
resourceIsolationManager, workerId, topoConf, ops, metricsRegistry, containerMemoryTracker);
assert (localState != null);
_localState = localState;
if (type.isRecovery() && !type.isOnlyKillable()) {
synchronized (localState) {
String wid = null;
Map<String, Integer> workerToPort = localState.getApprovedWorkers();
for (Map.Entry<String, Integer> entry : workerToPort.entrySet()) {
if (port == entry.getValue().intValue()) {
wid = entry.getKey();
}
}
if (wid == null) {
throw new ContainerRecoveryException("Could not find worker id for " + port + " " + assignment);
}
LOG.info("Recovered Worker {}", wid);
_workerId = wid;
}
} else if (_workerId == null) {
createNewWorkerId();
}
if (profileCmd == null) {
profileCmd = _stormHome + File.separator + "bin" + File.separator
+ conf.get(DaemonConfig.WORKER_PROFILER_COMMAND);
}
_profileCmd = profileCmd;
hardMemoryLimitMultiplier =
ObjectReader.getDouble(conf.get(DaemonConfig.STORM_SUPERVISOR_HARD_MEMORY_LIMIT_MULTIPLIER), 2.0);
hardMemoryLimitOver =
ObjectReader.getInt(conf.get(DaemonConfig.STORM_SUPERVISOR_HARD_LIMIT_MEMORY_OVERAGE_MB), 0);
lowMemoryThresholdMB = ObjectReader.getInt(conf.get(DaemonConfig.STORM_SUPERVISOR_LOW_MEMORY_THRESHOLD_MB), 1024);
mediumMemoryThresholdMb =
ObjectReader.getInt(conf.get(DaemonConfig.STORM_SUPERVISOR_MEDIUM_MEMORY_THRESHOLD_MB), 1536);
mediumMemoryGracePeriodMs =
ObjectReader.getInt(conf.get(DaemonConfig.STORM_SUPERVISOR_MEDIUM_MEMORY_GRACE_PERIOD_MS), 20_000);
if (assignment != null) {
WorkerResources resources = assignment.get_resources();
memoryLimitMB = calculateMemoryLimit(resources, getMemOnHeap(resources));
}
}
private static void removeWorkersOn(Map<String, Integer> workerToPort, int _port) {
for (Iterator<Entry<String, Integer>> i = workerToPort.entrySet().iterator(); i.hasNext(); ) {
Entry<String, Integer> found = i.next();
if (_port == found.getValue().intValue()) {
LOG.warn("Deleting worker {} from state", found.getKey());
i.remove();
}
}
}
public static List<String> getDependencyLocationsFor(final Map<String, Object> conf, final String topologyId, final AdvancedFSOps ops,
String stormRoot) throws IOException {
return TOPO_META_CACHE.get(conf, topologyId, ops, stormRoot).getDepLocs();
}
public static String getStormVersionFor(final Map<String, Object> conf, final String topologyId, final AdvancedFSOps ops,
String stormRoot) throws IOException {
return TOPO_META_CACHE.get(conf, topologyId, ops, stormRoot).getStormVersion();
}
/**
* Create a new worker ID for this process and store in in this object and in the local state. Never call this if a worker is currently
* up and running. We will lose track of the process.
*/
protected void createNewWorkerId() {
_type.assertFull();
assert (_workerId == null);
synchronized (_localState) {
_workerId = Utils.uuid();
Map<String, Integer> workerToPort = _localState.getApprovedWorkers();
if (workerToPort == null) {
workerToPort = new HashMap<>(1);
}
removeWorkersOn(workerToPort, _port);
workerToPort.put(_workerId, _port);
_localState.setApprovedWorkers(workerToPort);
LOG.info("Created Worker ID {}", _workerId);
}
}
@Override
public void cleanUpForRestart() throws IOException {
String origWorkerId = _workerId;
super.cleanUpForRestart();
synchronized (_localState) {
Map<String, Integer> workersToPort = _localState.getApprovedWorkers();
if (workersToPort != null) {
workersToPort.remove(origWorkerId);
removeWorkersOn(workersToPort, _port);
_localState.setApprovedWorkers(workersToPort);
LOG.info("Removed Worker ID {}", origWorkerId);
} else {
LOG.warn("No approved workers exists");
}
}
}
@Override
public void relaunch() throws IOException {
_type.assertFull();
//We are launching it now...
_type = ContainerType.LAUNCH;
createNewWorkerId();
setup();
launch();
}
@Override
public boolean didMainProcessExit() {
return _exitedEarly;
}
/**
* Run the given command for profiling.
*
* @param command the command to run
* @param env the environment to run the command
* @param logPrefix the prefix to include in the logs
* @param targetDir the working directory to run the command in
* @return true if it ran successfully, else false
*
* @throws IOException on any error
* @throws InterruptedException if interrupted wile waiting for the process to exit.
*/
protected boolean runProfilingCommand(List<String> command, Map<String, String> env, String logPrefix,
File targetDir) throws IOException, InterruptedException {
_type.assertFull();
Process p = ClientSupervisorUtils.launchProcess(command, env, logPrefix, null, targetDir);
int ret = p.waitFor();
return ret == 0;
}
@Override
public boolean runProfiling(ProfileRequest request, boolean stop) throws IOException, InterruptedException {
_type.assertFull();
String targetDir = ConfigUtils.workerArtifactsRoot(_conf, _topologyId, _port);
@SuppressWarnings("unchecked")
Map<String, String> env = (Map<String, String>) _topoConf.get(Config.TOPOLOGY_ENVIRONMENT);
if (env == null) {
env = new HashMap<>();
}
String str = ConfigUtils.workerArtifactsPidPath(_conf, _topologyId, _port);
String workerPid = _ops.slurpString(new File(str)).trim();
ProfileAction profileAction = request.get_action();
String logPrefix = "ProfilerAction process " + _topologyId + ":" + _port + " PROFILER_ACTION: " + profileAction
+ " ";
List<String> command = mkProfileCommand(profileAction, stop, workerPid, targetDir);
File targetFile = new File(targetDir);
if (command.size() > 0) {
return runProfilingCommand(command, env, logPrefix, targetFile);
}
LOG.warn("PROFILING REQUEST NOT SUPPORTED {} IGNORED...", request);
return true;
}
/**
* Get the command to run when doing profiling.
*
* @param action the profiling action to perform
* @param stop if this is meant to stop the profiling or start it
* @param workerPid the PID of the process to profile
* @param targetDir the current working directory of the worker process
* @return the command to run for profiling.
*/
private List<String> mkProfileCommand(ProfileAction action, boolean stop, String workerPid, String targetDir) {
switch (action) {
case JMAP_DUMP:
return jmapDumpCmd(workerPid, targetDir);
case JSTACK_DUMP:
return jstackDumpCmd(workerPid, targetDir);
case JPROFILE_DUMP:
return jprofileDump(workerPid, targetDir);
case JVM_RESTART:
return jprofileJvmRestart(workerPid);
case JPROFILE_STOP:
if (stop) {
return jprofileStop(workerPid, targetDir);
}
return jprofileStart(workerPid);
default:
return Lists.newArrayList();
}
}
private List<String> jmapDumpCmd(String pid, String targetDir) {
return Lists.newArrayList(_profileCmd, pid, "jmap", targetDir);
}
private List<String> jstackDumpCmd(String pid, String targetDir) {
return Lists.newArrayList(_profileCmd, pid, "jstack", targetDir);
}
private List<String> jprofileStart(String pid) {
return Lists.newArrayList(_profileCmd, pid, "start");
}
private List<String> jprofileStop(String pid, String targetDir) {
return Lists.newArrayList(_profileCmd, pid, "stop", targetDir);
}
private List<String> jprofileDump(String pid, String targetDir) {
return Lists.newArrayList(_profileCmd, pid, "dump", targetDir);
}
private List<String> jprofileJvmRestart(String pid) {
return Lists.newArrayList(_profileCmd, pid, "kill");
}
/**
* Compute the java.library.path that should be used for the worker. This helps it to load JNI libraries that are packaged in the uber
* jar.
*
* @param stormRoot the root directory of the worker process
* @param conf the config for the supervisor.
* @return the java.library.path/LD_LIBRARY_PATH to use so native libraries load correctly.
*/
protected String javaLibraryPath(String stormRoot, Map<String, Object> conf) {
String resourceRoot = stormRoot + File.separator + ServerConfigUtils.RESOURCES_SUBDIR;
String os = System.getProperty("os.name").replaceAll("\\s+", "_");
String arch = System.getProperty("os.arch");
String archResourceRoot = resourceRoot + File.separator + os + "-" + arch;
String ret = CPJ.join(archResourceRoot, resourceRoot,
conf.get(DaemonConfig.JAVA_LIBRARY_PATH));
return ret;
}
/**
* Returns a path with a wildcard as the final element, so that the JVM will expand that to all JARs in the directory.
*
* @param dir the directory to which a wildcard will be appended
* @return the path with wildcard ("*") suffix
*/
protected String getWildcardDir(File dir) {
return dir.toString() + File.separator + "*";
}
protected List<String> frameworkClasspath(SimpleVersion topoVersion) {
File stormWorkerLibDir = new File(_stormHome, "lib-worker");
String topoConfDir =
System.getenv("STORM_CONF_DIR") != null ?
System.getenv("STORM_CONF_DIR") :
new File(_stormHome, "conf").getAbsolutePath();
File stormExtlibDir = new File(_stormHome, "extlib");
String extcp = System.getenv("STORM_EXT_CLASSPATH");
List<String> pathElements = new LinkedList<>();
pathElements.add(getWildcardDir(stormWorkerLibDir));
pathElements.add(getWildcardDir(stormExtlibDir));
pathElements.add(extcp);
pathElements.add(topoConfDir);
NavigableMap<SimpleVersion, List<String>> classpaths = Utils.getConfiguredClasspathVersions(_conf, pathElements);
return Utils.getCompatibleVersion(classpaths, topoVersion, "classpath", pathElements);
}
protected String getWorkerMain(SimpleVersion topoVersion) {
String defaultWorkerGuess = "org.apache.storm.daemon.worker.Worker";
if (topoVersion.getMajor() == 0) {
//Prior to the org.apache change
defaultWorkerGuess = "backtype.storm.daemon.worker";
} else if (topoVersion.getMajor() == 1) {
//Have not moved to a java worker yet
defaultWorkerGuess = "org.apache.storm.daemon.worker";
}
NavigableMap<SimpleVersion, String> mains = Utils.getConfiguredWorkerMainVersions(_conf);
return Utils.getCompatibleVersion(mains, topoVersion, "worker main class", defaultWorkerGuess);
}
protected String getWorkerLogWriter(SimpleVersion topoVersion) {
String defaultGuess = "org.apache.storm.LogWriter";
if (topoVersion.getMajor() == 0) {
//Prior to the org.apache change
defaultGuess = "backtype.storm.LogWriter";
}
NavigableMap<SimpleVersion, String> mains = Utils.getConfiguredWorkerLogWriterVersions(_conf);
return Utils.getCompatibleVersion(mains, topoVersion, "worker log writer class", defaultGuess);
}
@SuppressWarnings("unchecked")
private List<String> asStringList(Object o) {
if (o instanceof String) {
return Arrays.asList((String) o);
} else if (o instanceof List) {
return (List<String>) o;
}
return Collections.EMPTY_LIST;
}
/**
* Compute the classpath for the worker process.
*
* @param stormJar the topology jar
* @param dependencyLocations any dependencies from the topology
* @param topoVersion the version of the storm framework to use
* @return the full classpath
*/
protected String getWorkerClassPath(String stormJar, List<String> dependencyLocations, SimpleVersion topoVersion) {
List<String> workercp = new ArrayList<>();
workercp.addAll(asStringList(_topoConf.get(Config.TOPOLOGY_CLASSPATH_BEGINNING)));
workercp.addAll(frameworkClasspath(topoVersion));
workercp.add(stormJar);
workercp.addAll(dependencyLocations);
workercp.addAll(asStringList(_topoConf.get(Config.TOPOLOGY_CLASSPATH)));
return CPJ.join(workercp);
}
private String substituteChildOptsInternal(String string, int memOnheap) {
if (StringUtils.isNotBlank(string)) {
String p = String.valueOf(_port);
string = string.replace("%ID%", p);
string = string.replace("%WORKER-ID%", _workerId);
string = string.replace("%TOPOLOGY-ID%", _topologyId);
string = string.replace("%WORKER-PORT%", p);
if (memOnheap > 0) {
string = string.replace("%HEAP-MEM%", String.valueOf(memOnheap));
}
if (memoryLimitMB > 0) {
string = string.replace("%LIMIT-MEM%", String.valueOf(memoryLimitMB));
}
}
return string;
}
protected List<String> substituteChildopts(Object value) {
return substituteChildopts(value, -1);
}
protected List<String> substituteChildopts(Object value, int memOnheap) {
List<String> rets = new ArrayList<>();
if (value instanceof String) {
String string = substituteChildOptsInternal((String) value, memOnheap);
if (StringUtils.isNotBlank(string)) {
String[] strings = string.split("\\s+");
for (String s : strings) {
if (StringUtils.isNotBlank(s)) {
rets.add(s);
}
}
}
} else if (value instanceof List) {
@SuppressWarnings("unchecked")
List<String> objects = (List<String>) value;
for (String object : objects) {
String str = substituteChildOptsInternal(object, memOnheap);
if (StringUtils.isNotBlank(str)) {
rets.add(str);
}
}
}
return rets;
}
/**
* Launch the worker process (non-blocking).
*
* @param command the command to run
* @param env the environment to run the command
* @param processExitCallback a callback for when the process exits
* @param logPrefix the prefix to include in the logs
* @param targetDir the working directory to run the command in
* @return true if it ran successfully, else false
*
* @throws IOException on any error
*/
protected void launchWorkerProcess(List<String> command, Map<String, String> env, String logPrefix,
ExitCodeCallback processExitCallback, File targetDir) throws IOException {
if (_resourceIsolationManager != null) {
command = _resourceIsolationManager.getLaunchCommand(_workerId, command);
}
ClientSupervisorUtils.launchProcess(command, env, logPrefix, processExitCallback, targetDir);
}
private String getWorkerLoggingConfigFile() {
String log4jConfigurationDir = (String) (_conf.get(DaemonConfig.STORM_LOG4J2_CONF_DIR));
if (StringUtils.isNotBlank(log4jConfigurationDir)) {
if (!ServerUtils.isAbsolutePath(log4jConfigurationDir)) {
log4jConfigurationDir = _stormHome + File.separator + log4jConfigurationDir;
}
} else {
log4jConfigurationDir = _stormHome + File.separator + "log4j2";
}
if (ServerUtils.IS_ON_WINDOWS && !log4jConfigurationDir.startsWith("file:")) {
log4jConfigurationDir = "file:///" + log4jConfigurationDir;
}
return log4jConfigurationDir + File.separator + "worker.xml";
}
/**
* Get parameters for the class path of the worker process. Also used by the log Writer.
*
* @param stormRoot the root dist dir for the topology
* @return the classpath for the topology as command line arguments.
*
* @throws IOException on any error.
*/
private List<String> getClassPathParams(final String stormRoot, final SimpleVersion topoVersion) throws IOException {
final String stormJar = ConfigUtils.supervisorStormJarPath(stormRoot);
final List<String> dependencyLocations = getDependencyLocationsFor(_conf, _topologyId, _ops, stormRoot);
final String workerClassPath = getWorkerClassPath(stormJar, dependencyLocations, topoVersion);
List<String> classPathParams = new ArrayList<>();
classPathParams.add("-cp");
classPathParams.add(workerClassPath);
return classPathParams;
}
/**
* Get a set of java properties that are common to both the log writer and the worker processes. These are mostly system properties that
* are used by logging.
*
* @return a list of command line options
*/
private List<String> getCommonParams() {
final String workersArtifacts = ConfigUtils.workerArtifactsRoot(_conf);
String stormLogDir = ConfigUtils.getLogDir();
List<String> commonParams = new ArrayList<>();
commonParams.add("-Dlogging.sensitivity=" + OR((String) _topoConf.get(Config.TOPOLOGY_LOGGING_SENSITIVITY), "S3"));
commonParams.add("-Dlogfile.name=worker.log");
commonParams.add("-Dstorm.home=" + OR(_stormHome, ""));
commonParams.add("-Dworkers.artifacts=" + workersArtifacts);
commonParams.add("-Dstorm.id=" + _topologyId);
commonParams.add("-Dworker.id=" + _workerId);
commonParams.add("-Dworker.port=" + _port);
commonParams.add("-Dstorm.log.dir=" + stormLogDir);
commonParams.add("-DLog4jContextSelector=org.apache.logging.log4j.core.selector.BasicContextSelector");
commonParams.add("-Dstorm.local.dir=" + _conf.get(Config.STORM_LOCAL_DIR));
if (memoryLimitMB > 0) {
commonParams.add("-Dworker.memory_limit_mb=" + memoryLimitMB);
}
return commonParams;
}
private int getMemOnHeap(WorkerResources resources) {
int memOnheap = 0;
if (resources != null && resources.is_set_mem_on_heap() &&
resources.get_mem_on_heap() > 0) {
memOnheap = (int) Math.ceil(resources.get_mem_on_heap());
} else {
// set the default heap memory size for supervisor-test
memOnheap = ObjectReader.getInt(_topoConf.get(Config.WORKER_HEAP_MEMORY_MB), 768);
}
return memOnheap;
}
private List<String> getWorkerProfilerChildOpts(int memOnheap) {
List<String> workerProfilerChildopts = new ArrayList<>();
if (ObjectReader.getBoolean(_conf.get(DaemonConfig.WORKER_PROFILER_ENABLED), false)) {
workerProfilerChildopts = substituteChildopts(_conf.get(DaemonConfig.WORKER_PROFILER_CHILDOPTS), memOnheap);
}
return workerProfilerChildopts;
}
protected String javaCmd(String cmd) {
String ret = null;
String javaHome = System.getenv().get("JAVA_HOME");
if (StringUtils.isNotBlank(javaHome)) {
ret = javaHome + File.separator + "bin" + File.separator + cmd;
} else {
ret = cmd;
}
return ret;
}
/**
* Create the command to launch the worker process.
*
* @param memOnheap the on heap memory for the worker
* @param stormRoot the root dist dir for the topology
* @param jlp java library path for the topology
* @return the command to run
*
* @throws IOException on any error.
*/
private List<String> mkLaunchCommand(final int memOnheap, final String stormRoot,
final String jlp) throws IOException {
final String javaCmd = javaCmd("java");
final String stormOptions = ConfigUtils.concatIfNotNull(System.getProperty("storm.options"));
final String topoConfFile = ConfigUtils.concatIfNotNull(System.getProperty("storm.conf.file"));
final String workerTmpDir = ConfigUtils.workerTmpRoot(_conf, _workerId);
String topoVersionString = getStormVersionFor(_conf, _topologyId, _ops, stormRoot);
if (topoVersionString == null) {
topoVersionString = (String) _conf.getOrDefault(Config.SUPERVISOR_WORKER_DEFAULT_VERSION, VersionInfo.getVersion());
}
final SimpleVersion topoVersion = new SimpleVersion(topoVersionString);
List<String> classPathParams = getClassPathParams(stormRoot, topoVersion);
List<String> commonParams = getCommonParams();
String log4jConfigurationFile = getWorkerLoggingConfigFile();
String workerLog4jConfig = log4jConfigurationFile;
if (_topoConf.get(Config.TOPOLOGY_LOGGING_CONFIG_FILE) != null) {
workerLog4jConfig = workerLog4jConfig + "," + _topoConf.get(Config.TOPOLOGY_LOGGING_CONFIG_FILE);
}
List<String> commandList = new ArrayList<>();
String logWriter = getWorkerLogWriter(topoVersion);
if (logWriter != null) {
//Log Writer Command...
commandList.add(javaCmd);
commandList.addAll(classPathParams);
commandList.addAll(substituteChildopts(_topoConf.get(Config.TOPOLOGY_WORKER_LOGWRITER_CHILDOPTS)));
commandList.addAll(commonParams);
commandList.add("-Dlog4j.configurationFile=" + log4jConfigurationFile);
commandList.add(logWriter); //The LogWriter in turn launches the actual worker.
}
//Worker Command...
commandList.add(javaCmd);
commandList.add("-server");
commandList.addAll(commonParams);
commandList.add("-Dlog4j.configurationFile=" + workerLog4jConfig);
commandList.addAll(substituteChildopts(_conf.get(Config.WORKER_CHILDOPTS), memOnheap));
commandList.addAll(substituteChildopts(_topoConf.get(Config.TOPOLOGY_WORKER_CHILDOPTS), memOnheap));
commandList.addAll(substituteChildopts(Utils.OR(
_topoConf.get(Config.TOPOLOGY_WORKER_GC_CHILDOPTS),
_conf.get(Config.WORKER_GC_CHILDOPTS)), memOnheap));
commandList.addAll(getWorkerProfilerChildOpts(memOnheap));
commandList.add("-Djava.library.path=" + jlp);
commandList.add("-Dstorm.conf.file=" + topoConfFile);
commandList.add("-Dstorm.options=" + stormOptions);
commandList.add("-Djava.io.tmpdir=" + workerTmpDir);
commandList.addAll(classPathParams);
commandList.add(getWorkerMain(topoVersion));
commandList.add(_topologyId);
commandList.add(_supervisorId);
// supervisor port should be only presented to worker which supports RPC heartbeat
// unknown version should be treated as "current version", which supports RPC heartbeat
if ((topoVersion.getMajor() == -1 && topoVersion.getMinor() == -1) ||
topoVersion.compareTo(MIN_VERSION_SUPPORT_RPC_HEARTBEAT) >= 0) {
commandList.add(String.valueOf(_supervisorPort));
}
commandList.add(String.valueOf(_port));
commandList.add(_workerId);
return commandList;
}
@Override
public boolean isMemoryLimitViolated(LocalAssignment withUpdatedLimits) throws IOException {
if (super.isMemoryLimitViolated(withUpdatedLimits)) {
return true;
}
if (_resourceIsolationManager != null) {
// In the short term the goal is to not shoot anyone unless we really need to.
// The on heap should limit the memory usage in most cases to a reasonable amount
// If someone is using way more than they requested this is a bug and we should
// not allow it
long usageMb;
long memoryLimitMb;
long hardMemoryLimitOver;
String typeOfCheck;
if (withUpdatedLimits.is_set_total_node_shared()) {
//We need to do enforcement on a topology level, not a single worker level...
// Because in for cgroups each page in shared memory goes to the worker that touched it
// first. We may need to make this more plugable in the future and let the resource
// isolation manager tell us what to do
usageMb = getTotalTopologyMemoryUsed();
memoryLimitMb = getTotalTopologyMemoryReserved(withUpdatedLimits);
hardMemoryLimitOver = this.hardMemoryLimitOver * getTotalWorkersForThisTopology();
typeOfCheck = "TOPOLOGY " + _topologyId;
} else {
usageMb = getMemoryUsageMb();
memoryLimitMb = this.memoryLimitMB;
hardMemoryLimitOver = this.hardMemoryLimitOver;
typeOfCheck = "WORKER " + _workerId;
}
LOG.debug(
"Enforcing memory usage for {} with usage of {} out of {} total and a hard limit of {}",
typeOfCheck,
usageMb,
memoryLimitMb,
hardMemoryLimitOver);
if (usageMb <= 0) {
//Looks like usage might not be supported
return false;
}
long hardLimitMb = Math.max((long) (memoryLimitMb * hardMemoryLimitMultiplier), memoryLimitMb + hardMemoryLimitOver);
if (usageMb > hardLimitMb) {
LOG.warn(
"{} is using {} MB > adjusted hard limit {} MB", typeOfCheck, usageMb, hardLimitMb);
return true;
}
if (usageMb > memoryLimitMb) {
//For others using too much it is really a question of how much memory is free in the system
// to be use. If we cannot calculate it assume that it is bad
long systemFreeMemoryMb = 0;
try {
systemFreeMemoryMb = _resourceIsolationManager.getSystemFreeMemoryMb();
} catch (IOException e) {
LOG.warn("Error trying to calculate free memory on the system {}", e);
}
LOG.debug("SYSTEM MEMORY FREE {} MB", systemFreeMemoryMb);
//If the system is low on memory we cannot be kind and need to shoot something
if (systemFreeMemoryMb <= lowMemoryThresholdMB) {
LOG.warn(
"{} is using {} MB > memory limit {} MB and system is low on memory {} free",
typeOfCheck,
usageMb,
memoryLimitMb,
systemFreeMemoryMb);
return true;
}
//If the system still has some free memory give them a grace period to
// drop back down.
if (systemFreeMemoryMb < mediumMemoryThresholdMb) {
if (memoryLimitExceededStart < 0) {
memoryLimitExceededStart = Time.currentTimeMillis();
} else {
long timeInViolation = Time.currentTimeMillis() - memoryLimitExceededStart;
if (timeInViolation > mediumMemoryGracePeriodMs) {
LOG.warn(
"{} is using {} MB > memory limit {} MB for {} seconds",
typeOfCheck,
usageMb,
memoryLimitMb,
timeInViolation / 1000);
return true;
}
}
} else {
//Otherwise don't bother them
LOG.debug("{} is using {} MB > memory limit {} MB", typeOfCheck, usageMb, memoryLimitMb);
memoryLimitExceededStart = -1;
}
} else {
memoryLimitExceededStart = -1;
}
}
return false;
}
@Override
public long getMemoryUsageMb() {
try {
long ret = 0;
if (_resourceIsolationManager != null) {
long usageBytes = _resourceIsolationManager.getMemoryUsage(_workerId);
if (usageBytes >= 0) {
ret = usageBytes / 1024 / 1024;
}
}
return ret;
} catch (IOException e) {
LOG.warn("Error trying to calculate worker memory usage {}", e);
return 0;
}
}
@Override
public long getMemoryReservationMb() {
return memoryLimitMB;
}
private long calculateMemoryLimit(final WorkerResources resources, final int memOnHeap) {
long ret = memOnHeap;
if (_resourceIsolationManager != null) {
final int memoffheap = (int) Math.ceil(resources.get_mem_off_heap());
final int extraMem =
(int)
(Math.ceil(
ObjectReader.getDouble(
_conf.get(DaemonConfig.STORM_SUPERVISOR_MEMORY_LIMIT_TOLERANCE_MARGIN_MB),
0.0)));
ret += memoffheap + extraMem;
}
return ret;
}
@Override
public void launch() throws IOException {
_type.assertFull();
LOG.info("Launching worker with assignment {} for this supervisor {} on port {} with id {}", _assignment,
_supervisorId, _port, _workerId);
String logPrefix = "Worker Process " + _workerId;
ProcessExitCallback processExitCallback = new ProcessExitCallback(logPrefix);
_exitedEarly = false;
final WorkerResources resources = _assignment.get_resources();
final int memOnHeap = getMemOnHeap(resources);
memoryLimitMB = calculateMemoryLimit(resources, memOnHeap);
final String stormRoot = ConfigUtils.supervisorStormDistRoot(_conf, _topologyId);
String jlp = javaLibraryPath(stormRoot, _conf);
Map<String, String> topEnvironment = new HashMap<String, String>();
@SuppressWarnings("unchecked")
Map<String, String> environment = (Map<String, String>) _topoConf.get(Config.TOPOLOGY_ENVIRONMENT);
if (environment != null) {
topEnvironment.putAll(environment);
}
String ld_library_path = topEnvironment.get("LD_LIBRARY_PATH");
if (ld_library_path != null) {
jlp = jlp + System.getProperty("path.separator") + ld_library_path;
}
topEnvironment.put("LD_LIBRARY_PATH", jlp);
if (_resourceIsolationManager != null) {
final int cpu = (int) Math.ceil(resources.get_cpu());
//Save the memory limit so we can enforce it less strictly
_resourceIsolationManager.reserveResourcesForWorker(_workerId, (int) memoryLimitMB, cpu);
}
List<String> commandList = mkLaunchCommand(memOnHeap, stormRoot, jlp);
LOG.info("Launching worker with command: {}. ", ServerUtils.shellCmd(commandList));
String workerDir = ConfigUtils.workerRoot(_conf, _workerId);
launchWorkerProcess(commandList, topEnvironment, logPrefix, processExitCallback, new File(workerDir));
}
private static class TopologyMetaData {
private final Map<String, Object> _conf;
private final String _topologyId;
private final AdvancedFSOps _ops;
private final String _stormRoot;
private boolean _dataCached = false;
private List<String> _depLocs = null;
private String _stormVersion = null;
public TopologyMetaData(final Map<String, Object> conf, final String topologyId, final AdvancedFSOps ops, final String stormRoot) {
_conf = conf;
_topologyId = topologyId;
_ops = ops;
_stormRoot = stormRoot;
}
public String toString() {
List<String> data;
String stormVersion;
synchronized (this) {
data = _depLocs;
stormVersion = _stormVersion;
}
return "META for " + _topologyId + " DEP_LOCS => " + data + " STORM_VERSION => " + stormVersion;
}
private synchronized void readData() throws IOException {
final StormTopology stormTopology = ConfigUtils.readSupervisorTopology(_conf, _topologyId, _ops);
final List<String> dependencyLocations = new ArrayList<>();
if (stormTopology.get_dependency_jars() != null) {
for (String dependency : stormTopology.get_dependency_jars()) {
dependencyLocations.add(new File(_stormRoot, dependency).getAbsolutePath());
}
}
if (stormTopology.get_dependency_artifacts() != null) {
for (String dependency : stormTopology.get_dependency_artifacts()) {
dependencyLocations.add(new File(_stormRoot, dependency).getAbsolutePath());
}
}
_depLocs = dependencyLocations;
_stormVersion = stormTopology.get_storm_version();
_dataCached = true;
}
public synchronized List<String> getDepLocs() throws IOException {
if (!_dataCached) {
readData();
}
return _depLocs;
}
public synchronized String getStormVersion() throws IOException {
if (!_dataCached) {
readData();
}
return _stormVersion;
}
}
static class TopoMetaLRUCache {
public final int _maxSize = 100; //We could make this configurable in the future...
@SuppressWarnings("serial")
private LinkedHashMap<String, TopologyMetaData> _cache = new LinkedHashMap<String, TopologyMetaData>() {
@Override
protected boolean removeEldestEntry(Map.Entry<String, TopologyMetaData> eldest) {
return (size() > _maxSize);
}
};
public synchronized TopologyMetaData get(final Map<String, Object> conf, final String topologyId, final AdvancedFSOps ops,
String stormRoot) {
//Only go off of the topology id for now.
TopologyMetaData dl = _cache.get(topologyId);
if (dl == null) {
_cache.putIfAbsent(topologyId, new TopologyMetaData(conf, topologyId, ops, stormRoot));
dl = _cache.get(topologyId);
}
return dl;
}
public synchronized void clear() {
_cache.clear();
}
}
private class ProcessExitCallback implements ExitCodeCallback {
private final String _logPrefix;
public ProcessExitCallback(String logPrefix) {
_logPrefix = logPrefix;
}
@Override
public void call(int exitCode) {
LOG.info("{} exited with code: {}", _logPrefix, exitCode);
_exitedEarly = true;
}
}
}
| 45.213472 | 140 | 0.630744 |
b83aaa323cdd1cabcb3fa39bbb7fd6fca5116486
| 1,551 |
/*
* Copyright 2011 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*/
package com.google.android.apps.picview.view;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import com.google.android.apps.picview.request.ImageLoadingTask;
/**
* A view for showing a thumbnail in e.g. a list view.
*
* @author haeberling@google.com (Sascha Haeberling)
*/
public class ThumbnailSlotView extends LinearLayout {
private ImageLoadingTask imageLoadingTask;
public ThumbnailSlotView(Context context, AttributeSet attributes) {
super(context, attributes);
}
/**
* Sets the {@link ImageLoadingTask} that is currently loading content for
* this view.
*/
public void setImageLoadingTask(ImageLoadingTask task) {
imageLoadingTask = task;
}
/**
* Gets the {@link ImageLoadingTask} that is currently loading content for
* this view, or <code>null</code>.
*/
public ImageLoadingTask getImageLoadingTask() {
return imageLoadingTask;
}
}
| 28.2 | 80 | 0.738233 |
573dcc6384764b4740e03de2ad1b362098cea754
| 2,122 |
package com.spaghetti.assets;
import java.nio.*;
import javax.sound.sampled.*;
import org.lwjgl.BufferUtils;
import org.lwjgl.openal.AL10;
import com.spaghetti.audio.*;
import com.spaghetti.interfaces.AssetLoader;
import com.spaghetti.utils.*;
public class SoundLoader implements AssetLoader {
@Override
public void initializeAsset(SheetEntry asset) {
asset.asset = new StaticSound();
}
@Override
public String[] provideDependencies(SheetEntry asset) {
return null;
}
@Override
public Object[] loadAsset(SheetEntry asset) throws Throwable {
AudioInputStream audio_stream = AudioSystem.getAudioInputStream(ResourceLoader.getStream(asset.args[0]));
AudioFormat audio_format = audio_stream.getFormat();
// Read metadata
int channels = audio_format.getChannels();
int bps = audio_format.getSampleSizeInBits();
int samplerate = (int) audio_format.getSampleRate();
int format = AL10.AL_FORMAT_MONO8;
if (channels == 1) {
if (bps == 8) {
format = AL10.AL_FORMAT_MONO8;
} else if (bps == 16) {
format = AL10.AL_FORMAT_MONO16;
}
} else if (channels == 2) {
if (bps == 8) {
format = AL10.AL_FORMAT_STEREO8;
} else if (bps == 16) {
format = AL10.AL_FORMAT_STEREO16;
}
}
// Read audio data
byte[] audio_data = new byte[audio_stream.available()];
Utils.effectiveRead(audio_stream, audio_data, 0, audio_data.length);
ByteBuffer raw_data = ByteBuffer.wrap(audio_data);
raw_data.order(ByteOrder.LITTLE_ENDIAN);
ByteBuffer dest_data = BufferUtils.createByteBuffer(audio_data.length);
dest_data.order(ByteOrder.nativeOrder());
// Reorder bytes
int bytes = bps / 8;
while (raw_data.hasRemaining()) {
int pos = raw_data.position();
for (int i = 0; i < bytes; i++) {
dest_data.put(dest_data.order() == raw_data.order() ? raw_data.get(pos + i)
: raw_data.get(pos + bytes - i - 1));
}
raw_data.position(pos + bytes);
}
dest_data.clear();
return new Object[] { format, dest_data, samplerate };
}
@Override
public Object[] provideDefault(SheetEntry asset) {
// TODO Auto-generated method stub
return null;
}
}
| 26.197531 | 107 | 0.704995 |
6cdc8bce85dac9ec611c3024124d2266e266bf1f
| 7,378 |
/*
* Copyright (c) 2002-2020 "Neo4j,"
* Neo4j Sweden AB [http://neo4j.com]
*
* This file is part of Neo4j.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.neo4j.driver.internal.util;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.neo4j.driver.internal.InternalPair;
import org.neo4j.driver.internal.value.NodeValue;
import org.neo4j.driver.internal.value.PathValue;
import org.neo4j.driver.internal.value.RelationshipValue;
import org.neo4j.driver.Record;
import org.neo4j.driver.Value;
import org.neo4j.driver.exceptions.ClientException;
import org.neo4j.driver.types.MapAccessor;
import org.neo4j.driver.types.Node;
import org.neo4j.driver.types.Path;
import org.neo4j.driver.types.Relationship;
import java.util.function.Function;
import org.neo4j.driver.util.Pair;
import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static java.util.Collections.singletonList;
import static java.util.Collections.singletonMap;
import static java.util.Collections.unmodifiableList;
import static java.util.Collections.unmodifiableMap;
import static org.neo4j.driver.internal.util.Iterables.newHashMapWithSize;
import static org.neo4j.driver.Values.value;
/**
* Utility class for extracting data.
*/
public final class Extract
{
private Extract()
{
throw new UnsupportedOperationException();
}
public static List<Value> list( Value[] values )
{
switch ( values.length )
{
case 0:
return emptyList();
case 1:
return singletonList( values[0] );
default:
return unmodifiableList( Arrays.asList( values ) );
}
}
public static <T> List<T> list( Value[] data, Function<Value, T> mapFunction )
{
int size = data.length;
switch ( size )
{
case 0:
return emptyList();
case 1:
return singletonList( mapFunction.apply( data[0] ) );
default:
List<T> result = new ArrayList<>( size );
for ( Value value : data )
{
result.add( mapFunction.apply( value ) );
}
return unmodifiableList( result );
}
}
public static <T> Map<String, T> map( Map<String, Value> data, Function<Value, T> mapFunction )
{
if ( data.isEmpty() ) {
return emptyMap();
} else {
int size = data.size();
if ( size == 1 ) {
Map.Entry<String, Value> head = data.entrySet().iterator().next();
return singletonMap( head.getKey(), mapFunction.apply( head.getValue() ) );
} else {
Map<String,T> map = Iterables.newLinkedHashMapWithSize( size );
for ( Map.Entry<String, Value> entry : data.entrySet() )
{
map.put( entry.getKey(), mapFunction.apply( entry.getValue() ) );
}
return unmodifiableMap( map );
}
}
}
public static <T> Map<String, T> map( Record record, Function<Value, T> mapFunction )
{
int size = record.size();
switch ( size )
{
case 0:
return emptyMap();
case 1:
return singletonMap( record.keys().get( 0 ), mapFunction.apply( record.get( 0 ) ) );
default:
Map<String,T> map = Iterables.newLinkedHashMapWithSize( size );
List<String> keys = record.keys();
for ( int i = 0; i < size; i++ )
{
map.put( keys.get( i ), mapFunction.apply( record.get( i ) ) );
}
return unmodifiableMap( map );
}
}
public static <V> Iterable<Pair<String, V>> properties( final MapAccessor map, final Function<Value, V> mapFunction )
{
int size = map.size();
switch ( size )
{
case 0:
return emptyList();
case 1:
{
String key = map.keys().iterator().next();
Value value = map.get( key );
return singletonList( InternalPair.of( key, mapFunction.apply( value ) ) );
}
default:
{
List<Pair<String, V>> list = new ArrayList<>( size );
for ( String key : map.keys() )
{
Value value = map.get( key );
list.add( InternalPair.of( key, mapFunction.apply( value ) ) );
}
return unmodifiableList( list );
}
}
}
public static <V> List<Pair<String, V>> fields( final Record map, final Function<Value, V> mapFunction )
{
int size = map.keys().size();
switch ( size )
{
case 0:
return emptyList();
case 1:
{
String key = map.keys().iterator().next();
Value value = map.get( key );
return singletonList( InternalPair.of( key, mapFunction.apply( value ) ) );
}
default:
{
List<Pair<String, V>> list = new ArrayList<>( size );
List<String> keys = map.keys();
for ( int i = 0; i < size; i++ )
{
String key = keys.get( i );
Value value = map.get( i );
list.add( InternalPair.of( key, mapFunction.apply( value ) ) );
}
return unmodifiableList( list );
}
}
}
public static Map<String,Value> mapOfValues( Map<String,Object> map )
{
if ( map == null || map.isEmpty() )
{
return emptyMap();
}
Map<String,Value> result = newHashMapWithSize( map.size() );
for ( Map.Entry<String,Object> entry : map.entrySet() )
{
Object value = entry.getValue();
assertParameter( value );
result.put( entry.getKey(), value( value ) );
}
return result;
}
public static void assertParameter( Object value )
{
if ( value instanceof Node || value instanceof NodeValue )
{
throw new ClientException( "Nodes can't be used as parameters." );
}
if ( value instanceof Relationship || value instanceof RelationshipValue )
{
throw new ClientException( "Relationships can't be used as parameters." );
}
if ( value instanceof Path || value instanceof PathValue )
{
throw new ClientException( "Paths can't be used as parameters." );
}
}
}
| 32.9375 | 121 | 0.551369 |
20d7a51ca62879aba624f45e8bda17308a2fd4c0
| 5,311 |
// -*- mode:java; encoding:utf-8 -*-
// vim:set fileencoding=utf-8:
// @homepage@
package example;
import java.awt.*;
import java.awt.font.FontRenderContext;
import java.awt.geom.AffineTransform;
import java.awt.geom.Area;
import java.awt.geom.Path2D;
import java.awt.geom.PathIterator;
import java.io.Serializable;
import javax.swing.*;
public final class MainPanel extends JPanel {
private static final Dimension SIZE = new Dimension(50, 50);
private static final Font FONT = new Font(Font.SANS_SERIF, Font.PLAIN, SIZE.width);
private MainPanel() {
super(new GridLayout(4, 6, 0, 0));
String[] pieces = {
"♔", "♕", "♖", "♗", "♘", "♙", // "\u2654", "\u2655", "\u2656", "\u2657", "\u2658", "\u2659",
"♚", "♛", "♜", "♝", "♞", "♟", // "\u265A", "\u265B", "\u265C", "\u265D", "\u265E", "\u265F",
};
for (int i = 0; i < pieces.length; i++) {
add(initLabel(makeCharLabel(pieces[i]), i));
}
for (int i = 0; i < pieces.length; i++) {
add(initLabel(makeIconLabel(pieces[i]), i));
}
setPreferredSize(new Dimension(320, 240));
}
private static JLabel makeCharLabel(String txt) {
return new JLabel(txt);
}
private static JLabel makeIconLabel(String txt) {
return new JLabel(new SilhouetteIcon(FONT, txt, SIZE));
}
private static JLabel initLabel(JLabel l, int i) {
l.setHorizontalAlignment(SwingConstants.CENTER);
l.setFont(FONT);
l.setOpaque(true);
boolean isFirstHalf = i < 6;
boolean isEven = i % 2 == 0;
if (isFirstHalf == isEven) {
l.setForeground(Color.BLACK);
l.setBackground(Color.WHITE);
} else {
l.setForeground(Color.WHITE);
l.setBackground(Color.BLACK);
}
return l;
}
public static void main(String[] args) {
EventQueue.invokeLater(MainPanel::createAndShowGui);
}
private static void createAndShowGui() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
ex.printStackTrace();
Toolkit.getDefaultToolkit().beep();
}
JFrame frame = new JFrame("@title@");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
frame.getContentPane().add(new MainPanel());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
class SilhouetteIcon implements Icon, Serializable {
private static final long serialVersionUID = 1L;
private static final Color PIECE_PAINT = new Color(0x96_64_14);
private final Font font;
private final String str;
private final Dimension size;
protected SilhouetteIcon(Font font, String str, Dimension size) {
this.font = font;
this.str = str;
this.size = size;
}
// Inspired from java - 'Fill' Unicode characters in labels - Stack Overflow
// https://stackoverflow.com/questions/18686199/fill-unicode-characters-in-labels
private static Area getOuterShape(Shape shape) {
Area area = new Area();
Path2D path = new Path2D.Double();
PathIterator pi = shape.getPathIterator(null);
double[] coords = new double[6];
while (!pi.isDone()) {
int pathSegmentType = pi.currentSegment(coords);
switch (pathSegmentType) {
case PathIterator.SEG_MOVETO:
path.moveTo(coords[0], coords[1]);
break;
case PathIterator.SEG_LINETO:
path.lineTo(coords[0], coords[1]);
break;
case PathIterator.SEG_QUADTO:
path.quadTo(coords[0], coords[1], coords[2], coords[3]);
break;
case PathIterator.SEG_CUBICTO:
path.curveTo(coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]);
break;
case PathIterator.SEG_CLOSE:
path.closePath();
area.add(createArea(path));
path.reset();
break;
default:
System.err.println("Unexpected value! " + pathSegmentType);
break;
}
pi.next();
}
return area;
}
private static Area createArea(Path2D path) {
return new Area(path);
}
@Override public void paintIcon(Component c, Graphics g, int x, int y) {
Graphics2D g2 = (Graphics2D) g.create();
g2.translate(x, y);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
FontRenderContext frc = g2.getFontRenderContext();
Shape shape = font.createGlyphVector(frc, str).getOutline();
Rectangle r = shape.getBounds();
int sx = getIconWidth() - r.width;
int sy = getIconHeight() - r.height;
AffineTransform at = AffineTransform.getTranslateInstance(-r.x + sx / 2d, -r.y + sy / 2d);
Shape shapeCentered = at.createTransformedShape(shape);
Shape silhouette = getOuterShape(shapeCentered);
g2.setStroke(new BasicStroke(3));
g2.setPaint(c.getForeground());
g2.draw(silhouette);
g2.setPaint(PIECE_PAINT);
g2.fill(silhouette);
g2.setStroke(new BasicStroke(1));
g2.setPaint(c.getBackground());
g2.fill(shapeCentered);
// g2.setPaint(PIECE_PAINT.brighter());
// g2.draw(shapeCentered);
g2.dispose();
}
@Override public int getIconWidth() {
return size.width;
}
@Override public int getIconHeight() {
return size.height;
}
}
| 31.613095 | 125 | 0.653549 |
dbed9ee3406df78d33e56cbced5d412c8bffc4ab
| 796 |
package leetcode.problem_0804;
import java.util.HashSet;
import java.util.Set;
class Solution {
private static String[] MORSE_CODES = {".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."};
int uniqueMorseRepresentations(String[] words) {
final Set<String> set = new HashSet<>();
for (String word : words) {
set.add(transform(word));
}
return set.size();
}
private String transform(final String word) {
final StringBuilder sb = new StringBuilder();
for (Character c : word.toCharArray()) {
sb.append(MORSE_CODES[c - 'a']);
}
return sb.toString();
}
}
| 30.615385 | 229 | 0.45603 |
95b6d38ef63656e5ef5ed4141b1e1a46ed954260
| 1,502 |
package com.ds.algo.matters.array;
public class TrapRainWater {
public static void main(String[] args){
int[] height = {2, 0, 2};
System.out.println(trapUsingTwoPointers(height));
}
private static int trapUsingTwoPointers(int[] height){
int N = height.length;
if (N < 3) return 0;
int totalWater = 0;
int i = 1, j = N - 2;
int lMax = height[0], rMax = height[N-1];
while (i <= j){
lMax = Math.max(lMax, height[i]);
rMax = Math.max(rMax, height[j]);
if (lMax <= rMax){
totalWater += (lMax - height[i]);
i++;
} else {
totalWater += (rMax - height[j]);
j--;
}
}
return totalWater;
}
/** This method will find total unit of water in an array of heights **/
private static int trap(int[] height){
int N = height.length;
int[] leftMax = new int[N];
int[] rightMax = new int[N];
leftMax[0] = height[0];
rightMax[N-1] = height[N-1];
for(int i = 1; i < N; i++){
leftMax[i] = Math.max(leftMax[i-1], height[i]);
}
for(int i = N - 2; i >= 0; i--){
rightMax[i] = Math.max(rightMax[i+1], height[i]);
}
int totalWater = 0;
for(int i = 0; i < N; i++){
totalWater += Math.min(leftMax[i], rightMax[i]) - height[i];
}
return totalWater;
}
}
| 27.814815 | 76 | 0.476032 |
bb506b726c86b570d9e258d1cabadf377da27475
| 1,598 |
/*
* Copyright (C) 2013 Jerzy Chalupski
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.chalup.microorm;
import android.content.ContentValues;
import android.database.Cursor;
import java.lang.reflect.Field;
class EmbeddedFieldAdapter extends FieldAdapter {
private final DaoAdapter<Object> mDaoAdapter;
@SuppressWarnings("unchecked")
EmbeddedFieldAdapter(Field field, DaoAdapter<?> daoAdapter) {
super(field);
mDaoAdapter = ((DaoAdapter<Object>) daoAdapter);
}
@Override
public void setValueFromCursor(Cursor inCursor, Object outTarget) throws IllegalArgumentException, IllegalAccessException {
mField.set(outTarget, mDaoAdapter.fromCursor(inCursor, mDaoAdapter.createInstance()));
}
@Override
protected void putValueToContentValues(Object value, ContentValues outValues) {
mDaoAdapter.toContentValues(outValues, value);
}
@Override
public String[] getColumnNames() {
return mDaoAdapter.getProjection();
}
@Override
public String[] getWritableColumnNames() {
return mDaoAdapter.getWritableColumns();
}
}
| 29.592593 | 125 | 0.754693 |
c88a39c054001f8a834de69ca6e2ed0e67bbfd39
| 2,778 |
/*
*
* Copyright (c) 2013,2019 AT&T Knowledge Ventures
* SPDX-License-Identifier: MIT
*/
package com.att.research.xacml.std;
import java.util.Collection;
import com.att.research.xacml.api.MissingAttributeDetail;
import com.att.research.xacml.api.StatusDetail;
import com.att.research.xacml.util.Wrapper;
/**
* Immutable implementation of the {@link com.att.research.xacml.api.StatusDetail} interface.
*
* @author Christopher A. Rath
* @version $Revision$
*/
public class StdStatusDetail extends Wrapper<StatusDetail> implements StatusDetail {
/**
* Creates a new immutable <code>StdStatusDetail</code> that wraps the given {@link com.att.research.xacml.api.StatusDetail}.
* The caller agrees not to modify the given <code>StatusDetail</code> as long as the new <code>StdStatusDetail</code> refers to it.
*
* @param statusDetail the <code>StatusDetail</code> to wrap
*/
public StdStatusDetail(StatusDetail statusDetail) {
super(statusDetail);
}
/**
* Creates a new immutable empty <code>StdStatusDetail</code>.
*/
public StdStatusDetail() {
this(new StdMutableStatusDetail());
}
/**
* Creates a new immutable <code>StdStatusDetail</code> with the given <code>Collection</code> of {@link com.att.research.xacml.api.MissingAttributeDetail} objects.
*
* @param missingAttributeDetailsIn the <code>Collection</code> of <code>MissingAttributeDetail</code>s for the new <code>StdStatusDetail</code>.
*/
public StdStatusDetail(Collection<MissingAttributeDetail> missingAttributeDetailsIn) {
this(new StdMutableStatusDetail(missingAttributeDetailsIn));
}
/**
* Creates a new immutable <code>StdStatusDetail</code> with the given {@link com.att.research.xacml.api.MissingAttributeDetail}.
*
* @param missingAttributeDetail the <code>MissingAttributeDetail</code> for the new <code>StdStatusDetail</code>
*/
public StdStatusDetail(MissingAttributeDetail missingAttributeDetail) {
this(new StdMutableStatusDetail(missingAttributeDetail));
}
/**
* Creates a new <code>StdStatusDetail</code> that is a copy of the given {@link com.att.research.xacml.api.StatusDetail}.
*
* @param statusDetail the <code>StatusDetail</code> to copy
* @return a new <code>StdStatusDetail</code> that is a copy of the given <code>StatusDetail</code>.
*/
public static StdStatusDetail copy(StatusDetail statusDetail) {
return new StdStatusDetail(statusDetail.getMissingAttributeDetails());
}
@Override
public Collection<MissingAttributeDetail> getMissingAttributeDetails() {
return this.getWrappedObject().getMissingAttributeDetails();
}
@Override
public StatusDetail merge(StatusDetail statusDetail) {
return new StdStatusDetail(this.getWrappedObject().merge(statusDetail));
}
}
| 36.077922 | 165 | 0.7527 |
84f5c046060cc0540b135f7883ac940b3d0bb038
| 12,435 |
package com.digero.maestro.view;
import info.clearthought.layout.TableLayout;
import info.clearthought.layout.TableLayoutConstants;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.BorderFactory;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JSpinner;
import javax.swing.JTextField;
import javax.swing.SpinnerNumberModel;
import javax.swing.border.Border;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import com.digero.common.abc.LotroInstrument;
import com.digero.common.midi.Note;
import com.digero.common.midi.SequencerEvent;
import com.digero.common.midi.SequencerListener;
import com.digero.common.midi.SequencerWrapper;
import com.digero.common.util.IDiscardable;
import com.digero.common.view.ColorTable;
import com.digero.maestro.abc.AbcPart;
import com.digero.maestro.abc.AbcPartEvent;
import com.digero.maestro.abc.AbcPartListener;
import com.digero.maestro.abc.PartAutoNumberer;
import com.digero.maestro.midi.TrackInfo;
import com.digero.maestro.util.ISelectable;
import com.digero.maestro.util.SingleSelectionModel;
public class AbcPartPanel extends JPanel implements IDiscardable, ISelectable, TableLayoutConstants {
// 0 1 2 3
// +---+----------+---------------------+--------------------+
// | | X: +--^+ | I: +---------+ | +--------------+ |
// 0 |[M]| +--v+ | +_Lute___v+ | | | |
// | +----------+---------------------+ | (note graph) | |
// |[S]| T: +-------------------------+ | | | |
// 1 | | +-------------------------+ | +--------------+ |
// +---+--------------------------------+--------------------+
private static final double[] LAYOUT_COLUMNS = {
PREFERRED, PREFERRED, FILL
};
private static final int MUTE_SOLO_COLUMN = 0;
private static final int PART_NUMBER_COLUMN = 0;
private static final int INSTRUMENT_COLUMN = 1;
private static final int TITLE_COLUMN_START = 0;
private static final int TITLE_COLUMN_END = 1;
private static final int NOTE_GRAPH_COLUMN = 2;
private static final double[] LAYOUT_ROWS = {
PREFERRED, PREFERRED
};
private static final int MUTE_SOLO_ROW_START = 0;
private static final int MUTE_SOLO_ROW_END = 1;
private static final int META_INFO_ROW = 0;
private static final int TITLE_ROW = 1;
private static final int NOTE_GRAPH_ROW_START = 0;
private static final int NOTE_GRAPH_ROW_END = 1;
private AbcPart abcPart;
private PartAutoNumberer partAutoNumberer;
private SequencerWrapper abcSequencer;
private SingleSelectionModel<AbcPartPanel> selectionModel;
private TrackInfo abcTrackInfo;
private NoteGraph noteGraph;
private AbcPartListener abcPartListener;
private SequencerListener abcSequencerListener;
private MouseListener selectOnClickListener;
private FocusListener selectOnFocusListener;
private JSpinner partNumberSpinner;
private JComboBox<LotroInstrument> instrumentComboBox;
private JTextField nameTextField;
// private JPanel selectionIndicator;
private boolean selected = false;
private Color borderColor = null;
public AbcPartPanel(SequencerWrapper _abcSequencer, PartAutoNumberer _partAutoNumberer,
SingleSelectionModel<AbcPartPanel> _selectionModel) {
this(_abcSequencer, _partAutoNumberer, _selectionModel, null, null);
}
public AbcPartPanel(SequencerWrapper _abcSequencer, PartAutoNumberer _partAutoNumberer,
SingleSelectionModel<AbcPartPanel> _selectionModel, AbcPart _abcPart, TrackInfo _trackInfo) {
super(new TableLayout(LAYOUT_COLUMNS, LAYOUT_ROWS));
this.abcSequencer = _abcSequencer;
this.partAutoNumberer = _partAutoNumberer;
this.selectionModel = _selectionModel;
selectOnFocusListener = new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
if (selectionModel != null)
selectionModel.setSelectedItem(AbcPartPanel.this);
}
};
selectOnClickListener = new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
if (selectionModel != null)
selectionModel.setSelectedItem(AbcPartPanel.this);
}
};
addMouseListener(selectOnClickListener);
// selectionIndicator = new JPanel();
SpinnerNumberModel partNumberSpinnerModel = new SpinnerNumberModel(0, 0, 999, partAutoNumberer.getIncrement());
partNumberSpinner = new JSpinner(partNumberSpinnerModel);
partNumberSpinner.addFocusListener(selectOnFocusListener);
partNumberSpinnerModel.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
if (abcPart != null) {
int newPartNumber = (Integer) partNumberSpinner.getValue();
if (newPartNumber != abcPart.getPartNumber())
partAutoNumberer.setPartNumber(abcPart, newPartNumber);
}
}
});
instrumentComboBox = new JComboBox<LotroInstrument>(partAutoNumberer.getSortedInstrumentList());
instrumentComboBox.setMaximumRowCount(12);
instrumentComboBox.addFocusListener(selectOnFocusListener);
instrumentComboBox.addActionListener(new ActionListener() {
private LotroInstrument lastSelectedInstrument = (LotroInstrument) instrumentComboBox.getSelectedItem();
public void actionPerformed(ActionEvent e) {
if (abcPart != null) {
LotroInstrument newInstrument = (LotroInstrument) instrumentComboBox.getSelectedItem();
if (newInstrument != abcPart.getInstrument()) {
partAutoNumberer.setInstrument(abcPart, newInstrument);
String title = abcPart.getTitle();
title = title.replace(lastSelectedInstrument.toString(), newInstrument.toString());
nameTextField.setText(title);
lastSelectedInstrument = newInstrument;
}
}
}
});
nameTextField = new JTextField();
nameTextField.addFocusListener(selectOnFocusListener);
nameTextField.getDocument().addDocumentListener(new DocumentListener() {
public void removeUpdate(DocumentEvent e) {
if (abcPart != null)
abcPart.setTitle(nameTextField.getText());
}
public void insertUpdate(DocumentEvent e) {
if (abcPart != null)
abcPart.setTitle(nameTextField.getText());
}
public void changedUpdate(DocumentEvent e) {
if (abcPart != null)
abcPart.setTitle(nameTextField.getText());
}
});
noteGraph = new PartNoteGraph(abcSequencer);
noteGraph.addMouseListener(selectOnClickListener);
abcPartListener = new AbcPartListener() {
@Override
public void abcPartChanged(AbcPartEvent e) {
switch (e.getProperty()) {
case TITLE:
if (!nameTextField.getText().equals(abcPart.getTitle()))
nameTextField.setText(abcPart.getTitle());
break;
case PART_NUMBER:
if (!partNumberSpinner.getValue().equals(abcPart.getPartNumber()))
partNumberSpinner.setValue(abcPart.getPartNumber());
break;
case INSTRUMENT:
if (!instrumentComboBox.getSelectedItem().equals(abcPart.getInstrument()))
instrumentComboBox.setSelectedItem(abcPart.getInstrument());
break;
}
}
};
abcSequencer.addChangeListener(abcSequencerListener = new SequencerListener() {
@Override
public void propertyChanged(SequencerEvent evt) {
switch (evt.getProperty()) {
case TRACK_ACTIVE:
updateColors();
break;
}
}
});
JPanel partNumberPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
partNumberPanel.add(new JLabel("X: "));
partNumberPanel.add(partNumberSpinner);
JPanel instrumentPanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
instrumentPanel.add(new JLabel("I: "));
instrumentPanel.add(instrumentComboBox);
JPanel titlePanel = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0));
titlePanel.add(new JLabel("T: "));
titlePanel.add(nameTextField);
// add(selectionIndicator, MUTE_SOLO_COLUMN + ", " + MUTE_SOLO_ROW_START + ", " + MUTE_SOLO_COLUMN + ", "
// + MUTE_SOLO_ROW_END);
add(partNumberPanel, PART_NUMBER_COLUMN + ", " + META_INFO_ROW);
add(instrumentPanel, INSTRUMENT_COLUMN + ", " + META_INFO_ROW);
add(titlePanel, TITLE_COLUMN_START + ", " + TITLE_ROW + ", " + TITLE_COLUMN_END + ", " + TITLE_ROW);
add(noteGraph, NOTE_GRAPH_COLUMN + ", " + NOTE_GRAPH_ROW_START + ", " + NOTE_GRAPH_COLUMN + ", "
+ NOTE_GRAPH_ROW_END);
setAbcPart(_abcPart, _trackInfo, true);
updateColors();
}
@Override
public void discard() {
if (abcPart != null)
abcPart.removeAbcListener(abcPartListener);
if (abcSequencer != null)
abcSequencer.removeChangeListener(abcSequencerListener);
if (noteGraph != null)
noteGraph.removeMouseListener(selectOnClickListener);
if (selectionModel != null && selectionModel.getSelectedItem() == this)
selectionModel.setSelectedItem(null);
selectionModel = null;
}
@Override
public void setSelected(boolean selected) {
if (this.selected != selected) {
this.selected = selected;
if (selectionModel != null) {
if (selected && selectionModel.getSelectedItem() != this)
selectionModel.setSelectedItem(this);
else if (!selected && selectionModel.getSelectedItem() == this)
selectionModel.setSelectedItem(null);
}
updateColors();
}
}
public AbcPart getAbcPart() {
return abcPart;
}
public void setAbcPart(AbcPart abcPart, TrackInfo abcTrackInfo) {
setAbcPart(abcPart, abcTrackInfo, false);
}
private void setAbcPart(AbcPart abcPart, TrackInfo abcTrackInfo, boolean forceRefresh) {
if (this.abcPart == abcPart && this.abcTrackInfo == abcTrackInfo && !forceRefresh)
return;
if (this.abcPart != null) {
this.abcPart.removeAbcListener(abcPartListener);
this.abcPart = null;
}
partNumberSpinner.setEnabled(abcPart != null);
instrumentComboBox.setEnabled(abcPart != null);
nameTextField.setEnabled(abcPart != null);
if (abcPart == null) {
partNumberSpinner.setValue(0);
instrumentComboBox.setSelectedIndex(0);
nameTextField.setText("");
}
else {
partNumberSpinner.setValue(abcPart.getPartNumber());
instrumentComboBox.setSelectedItem(abcPart.getInstrument());
nameTextField.setText(abcPart.getTitle());
abcPart.addAbcListener(abcPartListener);
}
this.abcPart = abcPart;
this.abcTrackInfo = abcTrackInfo;
noteGraph.setTrackInfo(abcTrackInfo);
updateColors();
}
public TrackInfo getAbcTrackInfo() {
return abcTrackInfo;
}
private void updateColors() {
ColorTable newBorderColor;
if (abcTrackInfo == null || !abcSequencer.isTrackActive(abcTrackInfo.getTrackNumber())) {
noteGraph.setNoteColor(ColorTable.NOTE_ABC_OFF);
noteGraph.setBadNoteColor(ColorTable.NOTE_BAD_OFF);
setBackground(ColorTable.GRAPH_BACKGROUND_OFF.get());
newBorderColor = selected ? ColorTable.ABC_BORDER_SELECTED_OFF : ColorTable.ABC_BORDER_UNSELECTED_OFF;
}
else {
noteGraph.setNoteColor(ColorTable.NOTE_ABC_ENABLED);
noteGraph.setBadNoteColor(ColorTable.NOTE_BAD_ENABLED);
setBackground(ColorTable.GRAPH_BACKGROUND_ENABLED.get());
newBorderColor = selected ? ColorTable.ABC_BORDER_SELECTED_ENABLED
: ColorTable.ABC_BORDER_UNSELECTED_ENABLED;
}
if (!newBorderColor.get().equals(borderColor)) {
borderColor = newBorderColor.get();
Border outerBorder = BorderFactory.createMatteBorder(0, 0, 1, 0, ColorTable.PANEL_BORDER.get());
// Border innerBorder = BorderFactory.createMatteBorder(0, 32, 0, 0, borderColor);
// setBorder(BorderFactory.createCompoundBorder(outerBorder, innerBorder));
setBorder(outerBorder);
}
}
private class PartNoteGraph extends NoteGraph {
public PartNoteGraph(SequencerWrapper sequencer) {
super(sequencer, null, Note.MIN_PLAYABLE.id - 12, Note.MAX_PLAYABLE.id + 12);
}
@Override
protected boolean isNotePlayable(int noteId) {
return abcPart.getInstrument().isPlayable(noteId);
}
}
}
| 35.630372 | 114 | 0.712183 |
b64c6cea72c586cb0f93343252b449e2a37b31fd
| 678 |
package org.esfinge.guardian.rbac.entity;
public class Role {
private String roleName;
public Role(String roleName) {
this.roleName = roleName;
}
@Override
final public String toString() {
return roleName;
}
@Override
final public boolean equals(Object o) {
if (o != null && roleName != null && o instanceof Role) {
return roleName.equals(((Role) o).getRoleName());
}
return false;
}
@Override
final public int hashCode() {
return roleName.toLowerCase().hashCode();
}
final public String getRoleName() {
return roleName;
}
public boolean isSubjectInRole(Role role) {
return this.equals(role);
}
}
| 19.371429 | 60 | 0.653392 |
3022118cc5c8a940338297d720ae107282755ca4
| 1,141 |
package org.jabingp.state;
public class Account {
private AccountState state;
private String owner;
public Account(String owner, double init) {
System.out.printf("%s开户,初始金额为%f\n", owner, init);
this.owner = owner;
if (init >= 0) {
this.state = new GreenState(init, this);
} else {
System.out.printf("开户金额%f不符合要求(>=0)\n", init);
}
System.out.printf("------------------------------\n");
}
public String getOwner() {
return this.owner;
}
public void setState(AccountState state) {
this.state = state;
}
public void deposit(double amount) {
this.state.deposit(amount);
this.state.stateCheck();
this.showInfo();
System.out.printf("------------------------------\n");
}
public void withdraw(double amount) {
this.state.withdraw(amount);
this.state.stateCheck();
this.showInfo();
System.out.printf("------------------------------\n");
}
public void showInfo() {
this.state.showBalance();
this.state.showState();
}
}
| 24.804348 | 62 | 0.51709 |
9edc8a30bf6ab0f47c959d243bcc36e2dcd340b0
| 2,075 |
/*
* Copyright 2013-2017 consulo.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package consulo.csharp.ide.refactoring.move;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiDirectory;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.move.MoveCallback;
import com.intellij.refactoring.move.MoveHandlerDelegate;
import consulo.csharp.lang.psi.CSharpFile;
import consulo.csharp.lang.psi.CSharpTypeDeclaration;
import javax.annotation.Nullable;
/**
* @author VISTALL
* @since 26.07.2015
*/
public class CSharpMoveHandlerDelegate extends MoveHandlerDelegate
{
@Override
public boolean isValidTarget(PsiElement psiElement, PsiElement[] sources)
{
if(!(psiElement instanceof PsiDirectory))
{
return false;
}
for(PsiElement source : sources)
{
if(source instanceof CSharpTypeDeclaration)
{
return true;
}
if(source instanceof CSharpFile)
{
return true;
}
}
return false;
}
@Override
public boolean canMove(DataContext dataContext)
{
PsiElement psiElement = dataContext.getData(CommonDataKeys.PSI_ELEMENT);
return canMove(new PsiElement[] {psiElement}, null);
}
@Override
public void doMove(Project project, PsiElement[] elements, @Nullable PsiElement targetContainer, @Nullable MoveCallback callback)
{
CSharpMoveClassesUtil.doMove(project, adjustForMove(project, elements, targetContainer), new PsiElement[] {targetContainer}, callback);
}
}
| 28.819444 | 137 | 0.768675 |
1466165a65fcc29f12d42214e173d43b34562954
| 1,823 |
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bval.constraints;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import javax.validation.constraints.Size;
import java.lang.reflect.Array;
public class SizeValidatorForArrayOfChar extends SizeValidator
implements ConstraintValidator<Size, char[]> {
/**
* Checks the number of entries in an array.
*
* @param array The array to validate.
* @param context context in which the constraint is evaluated.
* @return Returns <code>true</code> if the array is <code>null</code> or the number of entries in
* <code>array</code> is between the specified <code>min</code> and <code>max</code> values (inclusive),
* <code>false</code> otherwise.
*/
public boolean isValid(char[] array, ConstraintValidatorContext context) {
if (array == null) {
return true;
}
int length = Array.getLength(array);
return length >= min && length <= max;
}
}
| 39.630435 | 116 | 0.710368 |
df22bd4c885b9feacf4113ae0bdb172dd73ed8af
| 1,040 |
package org.swingeasy;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JSplitPane;
import javax.swing.WindowConstants;
/**
* @author Jurgen
*/
public class ListDnDDemo {
public static void main(String[] args) {
JFrame f = new JFrame();
JSplitPane jsp = new JSplitPane();
f.getContentPane().add(jsp, BorderLayout.CENTER);
{
EListConfig cfg = new EListConfig();
EList<String> list = new EList<>(cfg);
list.addRecord(new EListRecord<>("bean1"));
list.addRecord(new EListRecord<>("bean2"));
list.addRecord(new EListRecord<>("bean3"));
jsp.setLeftComponent(list);
}
{
EListConfig cfg = new EListConfig();
EList<String> list = new EList<>(cfg);
jsp.setRightComponent(list);
}
jsp.setDividerLocation(200);
f.setSize(400, 400);
f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
f.setVisible(true);
}
}
| 28.888889 | 66 | 0.600962 |
f3125fc4602719f091de24aca403db076034be0e
| 1,291 |
package io.izzel.ambershop.data;
import com.google.inject.ImplementedBy;
import io.izzel.ambershop.util.OperationResult;
import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.Future;
@ImplementedBy(ShopDataSourceImpl.class)
public interface ShopDataSource {
void init();
Future<OperationResult> removeRecord(ShopRecord record);
Future<OperationResult> updateRecord(ShopRecord newRec);
Future<OperationResult> moveLocation(ShopRecord old, Location<World> dest);
Future<List<ShopRecord>> fetchRecordBy(List<String> map);
Optional<ShopRecord> getByLocation(Location<World> location);
default Future<List<ShopRecord>> getByPlayer(Player player) {
return getByUUID(player.getUniqueId());
}
Future<List<ShopRecord>> getByUUID(UUID uuid);
Future<Optional<ShopRecord>> getById(int id);
Future<OperationResult> addRecord(ShopRecord record);
Future<Collection<ShopRecord>> getByChunk(UUID world, int x, int z);
Future<Void> unloadChunk(UUID world, int x, int z);
Future<OperationResult> fixAll();
}
| 27.468085 | 79 | 0.764524 |
1a0f6b166ae4cb16a33e1ec3176c2467403d3cd0
| 443 |
package com.chen.service;
import com.chen.entity.Area;
import java.util.List;
/**
* Created by handsome programmer.
* User: chen
* Date: 2019/3/12
* Time: 3:48
* Description: 区域信息服务类
*
* @author chen
*/
public interface AreaService {
/**
* 获取区域信息
*
* @return 区域信息列表
*/
List<Area> getAreaList();
/**
* 获取区域列表信息
*
* @return 用于注册店铺使用的区域信息
*/
List<Area> getRegisterAreaList();
}
| 14.290323 | 37 | 0.586907 |
f195423cba16bc6ceb944aded2120bf70463fe34
| 2,416 |
package org.struckture.handlers;
import org.struckture.base.Struck;
import org.struckture.base.Strucktor;
import org.struckture.base.StrucktureTest;
import org.struckture.base.annotations.Reverse;
import org.struckture.base.annotations.StruckField;
import org.struckture.base.annotations.Struckture;
import org.junit.Test;
import java.io.InputStream;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.junit.MatcherAssert.assertThat;
/**
* Test.
*/
public class FloatTest extends StrucktureTest {
@Struckture(length = 0x10)
private static class FloatTestStructure {
@StruckField(offset = 0)
private Float wrapper;
@StruckField(offset = 0x8)
private float primitive;
@StruckField(offset = 0xc) @Reverse
private float reverse;
}
@Test
public void shouldReadFloatWrapper() {
//given
InputStream stream = stream(
o(0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55), o(0, 0, 0, 0, 0, 0, 0, 0),
o(0, 0, 0, 0, 0, 0, 0, 0), o(0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55));
Struck<FloatTestStructure> struck = Strucktor.forClass(FloatTestStructure.class);
//when
FloatTestStructure structure = struck.read(stream);
//then
assertThat(structure.wrapper, is(5/3f));
}
@Test
public void shouldReadFloatPrimitive() {
//given
InputStream stream = stream(
o(0, 0, 0, 0, 0, 0, 0, 0), o(0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55),
o(0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55), o(0, 0, 0, 0, 0, 0, 0, 0));
Struck<FloatTestStructure> struck = Strucktor.forClass(FloatTestStructure.class);
//when
FloatTestStructure structure = struck.read(stream);
//then
assertThat(structure.primitive, is(5/3f));
}
@Test
public void shouldReadFloatReverse() {
//given
InputStream stream = stream(
o(0, 0, 0, 0, 0, 0, 0, 0), o(0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0xd5, 0x3f),
o(0x3f, 0xd5, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55), o(0, 0, 0, 0, 0, 0, 0, 0));
Struck<FloatTestStructure> struck = Strucktor.forClass(FloatTestStructure.class);
//when
FloatTestStructure structure = struck.read(stream);
//then
assertThat(structure.reverse, is(5/3f));
}
}
| 31.789474 | 94 | 0.625 |
4c70786bb5b46247cf2770ca5aa1a93843c80630
| 5,046 |
/**
* Copyright 2017-2019 The GreyCat Authors. All rights reserved.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package greycat.websocket.withWorkers;
import greycat.*;
import greycat.plugin.Job;
import greycat.websocket.WSClientForWorkers;
import greycat.websocket.WSServerWithWorkers;
import greycat.workers.*;
import org.junit.*;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import static org.junit.Assert.*;
/**
* Created by Gregory NAIN on 2019-03-15.
*/
public class WSWithWorkersMultiCLientTest {
private WSServerWithWorkers wsServer;
@Before
public void setUp() {
GraphBuilder graphBuilder = GraphBuilder.newBuilder().withPlugin(new PluginForWorkersTest());
WorkerBuilderFactory defaultFactory = () -> DefaultWorkerBuilder.newBuilder().withGraphBuilder(graphBuilder);
WorkerBuilderFactory defaultRootFactory = () -> DefaultRootWorkerBuilder.newBuilder().withGraphBuilder(graphBuilder);
GraphWorkerPool workersPool = GraphWorkerPool.getInstance()
.withRootWorkerBuilderFactory(defaultRootFactory)
.withDefaultWorkerBuilderFactory(defaultFactory);
workersPool.initialize();
for (int i = 0; i < 5; i++) {
GraphWorkerPool.getInstance().createWorker(WorkerAffinity.GENERAL_PURPOSE_WORKER, "GeneralPurposeWorker_" + i, null);
}
wsServer = new WSServerWithWorkers(1234);
wsServer.start();
}
@Test
public void multiTaskOneClientTest() {
try {
int nbTasks = 10;
AtomicInteger reportsCounter = new AtomicInteger();
CountDownLatch latch = new CountDownLatch(1);
runClient(nbTasks, latch, reportsCounter);
latch.await();
assertEquals(10 * nbTasks, reportsCounter.get());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private void runClient(int nbTasks, CountDownLatch clientsLatch, AtomicInteger reportsCounter) {
try {
CountDownLatch latch = new CountDownLatch(nbTasks * 11);
GraphBuilder builder = GraphBuilder.newBuilder().withPlugin(new PluginForWorkersTest()).withStorage(new WSClientForWorkers("ws://localhost:1234/ws"));
Graph graph = builder.build();
graph.connect(graphConnected -> {
long ts0 = System.currentTimeMillis();
Task withProgress = Tasks.newTask().action(greycatTest.workers.PluginForWorkersTest.PROGRESS_REPORTS);
TaskContext taskContext = withProgress.prepare(graph, null, result -> {
if (result.exception() != null) {
result.exception().printStackTrace();
}
long ts1 = System.currentTimeMillis();
//assertEquals(10, reportsCount.get());
//System.out.println("Duration: " + (ts1 - ts0) + "ms");
latch.countDown();
});
taskContext.setProgressHook(result -> {
//System.out.println("Progress: " + result.progress() + " Comment:" + result.comment());
reportsCounter.incrementAndGet();
latch.countDown();
});
for (int i = 0; i < nbTasks; i++) {
taskContext.setVariable("taskId", "" + i);
withProgress.executeRemotelyUsing(taskContext);
}
});
latch.await();
graph.disconnect((e) -> {
if (clientsLatch != null) {
clientsLatch.countDown();
}
});
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@Test
public void multiTaskMultiClientTest() {
try {
int nbTasks = 4;
int nbClients = 3;
CountDownLatch clientsLatch = new CountDownLatch(nbClients);
AtomicInteger reportsCounter = new AtomicInteger();
for (int i = 0; i < nbClients; i++) {
new Thread(() -> runClient(nbTasks, clientsLatch, reportsCounter)).start();
}
clientsLatch.await();
assertEquals(10 * nbTasks * nbClients, reportsCounter.get());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@After
public void tearDown() {
wsServer.stop();
}
}
| 35.286713 | 162 | 0.608601 |
05ffd6ee36727e68b29ae2fb61bf8fffd57c9c67
| 749 |
package easy.array;
/**
* @Classname LC485_MaxConsecutiveOnes
* @Description TODO
* 题目:给定一个二进制数组, 计算其中最大连续1的个数。
* 解法1:1.
* @Date 2020/12/12 16:29
* @Created by youfayang
*/
public class LC485_MaxConsecutiveOnes {
public static void main(String[] args) {
int[] nums = new int[]{1,1,0,1,1,1};
System.out.println(findMaxConsecutiveOnes(nums));
}
public static int findMaxConsecutiveOnes(int[] nums) {
int result = 0;
int curLength = 0;
for (int num : nums){
if(num == 1){
curLength++;
}else {
result = Math.max(curLength,result);
curLength = 0;
}
}
return Math.max(curLength,result);
}
}
| 24.966667 | 58 | 0.555407 |
c2069e871a4125efb90d8b39b903bd79b5c179a1
| 1,644 |
package org.springframework.security.oauth2.client.endpoint;
import org.springframework.security.oauth2.client.registration.ClientRegistration;
import org.springframework.security.oauth2.core.AuthorizationGrantType;
import org.springframework.util.Assert;
/**
* An OAuth 2.0 Client Credentials Grant request that holds the client's credentials in
* {@link #getClientRegistration()}.
*
* @author Joe Grandja
* @since 5.1
* @see AbstractOAuth2AuthorizationGrantRequest
* @see ClientRegistration
* @see <a target="_blank" href=
* "https://tools.ietf.org/html/rfc6749#section-1.3.4">Section 1.3.4 Client Credentials
* Grant</a>
*/
public class OAuth2ClientCredentialsGrantRequest extends AbstractOAuth2AuthorizationGrantRequest {
private final ClientRegistration clientRegistration;
/**
* Constructs an {@code OAuth2ClientCredentialsGrantRequest} using the provided
* parameters.
* @param clientRegistration the client registration
*/
public OAuth2ClientCredentialsGrantRequest(ClientRegistration clientRegistration) {
super(AuthorizationGrantType.CLIENT_CREDENTIALS);
Assert.notNull(clientRegistration, "clientRegistration cannot be null");
Assert.isTrue(AuthorizationGrantType.CLIENT_CREDENTIALS.equals(clientRegistration.getAuthorizationGrantType()),
"clientRegistration.authorizationGrantType must be AuthorizationGrantType.CLIENT_CREDENTIALS");
this.clientRegistration = clientRegistration;
}
/**
* Returns the {@link ClientRegistration client registration}.
* @return the {@link ClientRegistration}
*/
public ClientRegistration getClientRegistration() {
return this.clientRegistration;
}
}
| 36.533333 | 113 | 0.804136 |
c2d1779362bcae691f155acd54072ee2fdd2e683
| 67,068 |
/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.hbase.regionserver;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.NavigableSet;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.regex.Matcher;
import org.apache.commons.collections.map.AbstractReferenceMap;
import org.apache.commons.collections.map.ReferenceMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.Coprocessor;
import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.client.Append;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.Increment;
import org.apache.hadoop.hbase.client.Mutation;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
import org.apache.hadoop.hbase.coprocessor.CoprocessorService;
import org.apache.hadoop.hbase.coprocessor.EndpointObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.coprocessor.RegionObserver;
import org.apache.hadoop.hbase.coprocessor.RegionObserver.MutationType;
import org.apache.hadoop.hbase.filter.ByteArrayComparable;
import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
import org.apache.hadoop.hbase.io.FSDataInputStreamWrapper;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.io.Reference;
import org.apache.hadoop.hbase.io.hfile.CacheConfig;
import org.apache.hadoop.hbase.regionserver.HRegion.Operation;
import org.apache.hadoop.hbase.regionserver.compactions.CompactionRequest;
import org.apache.hadoop.hbase.regionserver.wal.HLogKey;
import org.apache.hadoop.hbase.wal.WALKey;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
import org.apache.hadoop.hbase.util.BoundedConcurrentLinkedQueue;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.CoprocessorClassLoader;
import org.apache.hadoop.hbase.util.Pair;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import com.google.protobuf.Message;
import com.google.protobuf.Service;
/**
* Implements the coprocessor environment and runtime support for coprocessors
* loaded within a {@link HRegion}.
*/
@InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.COPROC)
@InterfaceStability.Evolving
public class RegionCoprocessorHost
extends CoprocessorHost<RegionCoprocessorHost.RegionEnvironment> {
private static final Log LOG = LogFactory.getLog(RegionCoprocessorHost.class);
// The shared data map
private static ReferenceMap sharedDataMap =
new ReferenceMap(AbstractReferenceMap.HARD, AbstractReferenceMap.WEAK);
// optimization: no need to call postScannerFilterRow, if no coprocessor implements it
private final boolean hasCustomPostScannerFilterRow;
/**
*
* Encapsulation of the environment of each coprocessor
*/
static class RegionEnvironment extends CoprocessorHost.Environment
implements RegionCoprocessorEnvironment {
private HRegion region;
private RegionServerServices rsServices;
ConcurrentMap<String, Object> sharedData;
private static final int LATENCY_BUFFER_SIZE = 100;
private final BoundedConcurrentLinkedQueue<Long> coprocessorTimeNanos =
new BoundedConcurrentLinkedQueue<Long>(LATENCY_BUFFER_SIZE);
private final boolean useLegacyPre;
private final boolean useLegacyPost;
/**
* Constructor
* @param impl the coprocessor instance
* @param priority chaining priority
*/
public RegionEnvironment(final Coprocessor impl, final int priority,
final int seq, final Configuration conf, final HRegion region,
final RegionServerServices services, final ConcurrentMap<String, Object> sharedData) {
super(impl, priority, seq, conf);
this.region = region;
this.rsServices = services;
this.sharedData = sharedData;
// Pick which version of the WAL related events we'll call.
// This way we avoid calling the new version on older RegionObservers so
// we can maintain binary compatibility.
// See notes in javadoc for RegionObserver
useLegacyPre = useLegacyMethod(impl.getClass(), "preWALRestore", ObserverContext.class,
HRegionInfo.class, WALKey.class, WALEdit.class);
useLegacyPost = useLegacyMethod(impl.getClass(), "postWALRestore", ObserverContext.class,
HRegionInfo.class, WALKey.class, WALEdit.class);
}
/** @return the region */
@Override
public HRegion getRegion() {
return region;
}
/** @return reference to the region server services */
@Override
public RegionServerServices getRegionServerServices() {
return rsServices;
}
public void shutdown() {
super.shutdown();
}
@Override
public ConcurrentMap<String, Object> getSharedData() {
return sharedData;
}
public void offerExecutionLatency(long latencyNanos) {
coprocessorTimeNanos.offer(latencyNanos);
}
public Collection<Long> getExecutionLatenciesNanos() {
final List<Long> latencies = Lists.newArrayListWithCapacity(coprocessorTimeNanos.size());
coprocessorTimeNanos.drainTo(latencies);
return latencies;
}
@Override
public HRegionInfo getRegionInfo() {
return region.getRegionInfo();
}
}
static class TableCoprocessorAttribute {
private Path path;
private String className;
private int priority;
private Configuration conf;
public TableCoprocessorAttribute(Path path, String className, int priority,
Configuration conf) {
this.path = path;
this.className = className;
this.priority = priority;
this.conf = conf;
}
public Path getPath() {
return path;
}
public String getClassName() {
return className;
}
public int getPriority() {
return priority;
}
public Configuration getConf() {
return conf;
}
}
/** The region server services */
RegionServerServices rsServices;
/** The region */
HRegion region;
/**
* Constructor
* @param region the region
* @param rsServices interface to available region server functionality
* @param conf the configuration
*/
public RegionCoprocessorHost(final HRegion region,
final RegionServerServices rsServices, final Configuration conf) {
super(rsServices);
this.conf = conf;
this.rsServices = rsServices;
this.region = region;
this.pathPrefix = Integer.toString(this.region.getRegionInfo().hashCode());
// load system default cp's from configuration.
loadSystemCoprocessors(conf, REGION_COPROCESSOR_CONF_KEY);
// load system default cp's for user tables from configuration.
if (!region.getRegionInfo().getTable().isSystemTable()) {
loadSystemCoprocessors(conf, USER_REGION_COPROCESSOR_CONF_KEY);
}
// load Coprocessor From HDFS
loadTableCoprocessors(conf);
// now check whether any coprocessor implements postScannerFilterRow
boolean hasCustomPostScannerFilterRow = false;
out: for (RegionEnvironment env: coprocessors) {
if (env.getInstance() instanceof RegionObserver) {
Class<?> clazz = env.getInstance().getClass();
for(;;) {
if (clazz == null) {
// we must have directly implemented RegionObserver
hasCustomPostScannerFilterRow = true;
break out;
}
if (clazz == BaseRegionObserver.class) {
// we reached BaseRegionObserver, try next coprocessor
break;
}
try {
clazz.getDeclaredMethod("postScannerFilterRow", ObserverContext.class,
InternalScanner.class, byte[].class, int.class, short.class, boolean.class);
// this coprocessor has a custom version of postScannerFilterRow
hasCustomPostScannerFilterRow = true;
break out;
} catch (NoSuchMethodException ignore) {
}
clazz = clazz.getSuperclass();
}
}
}
this.hasCustomPostScannerFilterRow = hasCustomPostScannerFilterRow;
}
static List<TableCoprocessorAttribute> getTableCoprocessorAttrsFromSchema(Configuration conf,
HTableDescriptor htd) {
List<TableCoprocessorAttribute> result = Lists.newArrayList();
for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> e: htd.getValues().entrySet()) {
String key = Bytes.toString(e.getKey().get()).trim();
if (HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(key).matches()) {
String spec = Bytes.toString(e.getValue().get()).trim();
// found one
try {
Matcher matcher = HConstants.CP_HTD_ATTR_VALUE_PATTERN.matcher(spec);
if (matcher.matches()) {
// jar file path can be empty if the cp class can be loaded
// from class loader.
Path path = matcher.group(1).trim().isEmpty() ?
null : new Path(matcher.group(1).trim());
String className = matcher.group(2).trim();
if (className.isEmpty()) {
LOG.error("Malformed table coprocessor specification: key=" +
key + ", spec: " + spec);
continue;
}
int priority = matcher.group(3).trim().isEmpty() ?
Coprocessor.PRIORITY_USER : Integer.valueOf(matcher.group(3));
String cfgSpec = null;
try {
cfgSpec = matcher.group(4);
} catch (IndexOutOfBoundsException ex) {
// ignore
}
Configuration ourConf;
if (cfgSpec != null && !cfgSpec.trim().equals("|")) {
cfgSpec = cfgSpec.substring(cfgSpec.indexOf('|') + 1);
// do an explicit deep copy of the passed configuration
ourConf = new Configuration(false);
HBaseConfiguration.merge(ourConf, conf);
Matcher m = HConstants.CP_HTD_ATTR_VALUE_PARAM_PATTERN.matcher(cfgSpec);
while (m.find()) {
ourConf.set(m.group(1), m.group(2));
}
} else {
ourConf = conf;
}
result.add(new TableCoprocessorAttribute(path, className, priority, ourConf));
} else {
LOG.error("Malformed table coprocessor specification: key=" + key +
", spec: " + spec);
}
} catch (Exception ioe) {
LOG.error("Malformed table coprocessor specification: key=" + key +
", spec: " + spec);
}
}
}
return result;
}
/**
* Sanity check the table coprocessor attributes of the supplied schema. Will
* throw an exception if there is a problem.
* @param conf
* @param htd
* @throws IOException
*/
public static void testTableCoprocessorAttrs(final Configuration conf,
final HTableDescriptor htd) throws IOException {
String pathPrefix = UUID.randomUUID().toString();
for (TableCoprocessorAttribute attr: getTableCoprocessorAttrsFromSchema(conf, htd)) {
if (attr.getPriority() < 0) {
throw new IOException("Priority for coprocessor " + attr.getClassName() +
" cannot be less than 0");
}
ClassLoader old = Thread.currentThread().getContextClassLoader();
try {
ClassLoader cl;
if (attr.getPath() != null) {
cl = CoprocessorClassLoader.getClassLoader(attr.getPath(),
CoprocessorHost.class.getClassLoader(), pathPrefix, conf);
} else {
cl = CoprocessorHost.class.getClassLoader();
}
Thread.currentThread().setContextClassLoader(cl);
cl.loadClass(attr.getClassName());
} catch (ClassNotFoundException e) {
throw new IOException("Class " + attr.getClassName() + " cannot be loaded", e);
} finally {
Thread.currentThread().setContextClassLoader(old);
}
}
}
void loadTableCoprocessors(final Configuration conf) {
boolean coprocessorsEnabled = conf.getBoolean(COPROCESSORS_ENABLED_CONF_KEY,
DEFAULT_COPROCESSORS_ENABLED);
boolean tableCoprocessorsEnabled = conf.getBoolean(USER_COPROCESSORS_ENABLED_CONF_KEY,
DEFAULT_USER_COPROCESSORS_ENABLED);
if (!(coprocessorsEnabled && tableCoprocessorsEnabled)) {
return;
}
// scan the table attributes for coprocessor load specifications
// initialize the coprocessors
List<RegionEnvironment> configured = new ArrayList<RegionEnvironment>();
for (TableCoprocessorAttribute attr: getTableCoprocessorAttrsFromSchema(conf,
region.getTableDesc())) {
// Load encompasses classloading and coprocessor initialization
try {
RegionEnvironment env = load(attr.getPath(), attr.getClassName(), attr.getPriority(),
attr.getConf());
configured.add(env);
LOG.info("Loaded coprocessor " + attr.getClassName() + " from HTD of " +
region.getTableDesc().getTableName().getNameAsString() + " successfully.");
} catch (Throwable t) {
// Coprocessor failed to load, do we abort on error?
if (conf.getBoolean(ABORT_ON_ERROR_KEY, DEFAULT_ABORT_ON_ERROR)) {
abortServer(attr.getClassName(), t);
} else {
LOG.error("Failed to load coprocessor " + attr.getClassName(), t);
}
}
}
// add together to coprocessor set for COW efficiency
coprocessors.addAll(configured);
}
@Override
public RegionEnvironment createEnvironment(Class<?> implClass,
Coprocessor instance, int priority, int seq, Configuration conf) {
// Check if it's an Endpoint.
// Due to current dynamic protocol design, Endpoint
// uses a different way to be registered and executed.
// It uses a visitor pattern to invoke registered Endpoint
// method.
for (Class<?> c : implClass.getInterfaces()) {
if (CoprocessorService.class.isAssignableFrom(c)) {
region.registerService( ((CoprocessorService)instance).getService() );
}
}
ConcurrentMap<String, Object> classData;
// make sure only one thread can add maps
synchronized (sharedDataMap) {
// as long as at least one RegionEnvironment holds on to its classData it will
// remain in this map
classData = (ConcurrentMap<String, Object>)sharedDataMap.get(implClass.getName());
if (classData == null) {
classData = new ConcurrentHashMap<String, Object>();
sharedDataMap.put(implClass.getName(), classData);
}
}
return new RegionEnvironment(instance, priority, seq, conf, region,
rsServices, classData);
}
/**
* HBASE-4014 : This is used by coprocessor hooks which are not declared to throw exceptions.
*
* For example, {@link
* org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost#preOpen()} and
* {@link org.apache.hadoop.hbase.regionserver.RegionCoprocessorHost#postOpen()} are such hooks.
*
* See also
* {@link org.apache.hadoop.hbase.master.MasterCoprocessorHost#handleCoprocessorThrowable(
* CoprocessorEnvironment, Throwable)}
* @param env The coprocessor that threw the exception.
* @param e The exception that was thrown.
*/
private void handleCoprocessorThrowableNoRethrow(
final CoprocessorEnvironment env, final Throwable e) {
try {
handleCoprocessorThrowable(env,e);
} catch (IOException ioe) {
// We cannot throw exceptions from the caller hook, so ignore.
LOG.warn(
"handleCoprocessorThrowable() threw an IOException while attempting to handle Throwable " +
e + ". Ignoring.",e);
}
}
/**
* Invoked before a region open.
*
* @throws IOException Signals that an I/O exception has occurred.
*/
public void preOpen() throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preOpen(ctx);
}
});
}
/**
* Invoked after a region open
*/
public void postOpen() {
try {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postOpen(ctx);
}
});
} catch (IOException e) {
LOG.warn(e);
}
}
/**
* Invoked after log replay on region
*/
public void postLogReplay() {
try {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postLogReplay(ctx);
}
});
} catch (IOException e) {
LOG.warn(e);
}
}
/**
* Invoked before a region is closed
* @param abortRequested true if the server is aborting
*/
public void preClose(final boolean abortRequested) throws IOException {
execOperation(false, new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preClose(ctx, abortRequested);
}
});
}
/**
* Invoked after a region is closed
* @param abortRequested true if the server is aborting
*/
public void postClose(final boolean abortRequested) {
try {
execOperation(false, new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postClose(ctx, abortRequested);
}
public void postEnvCall(RegionEnvironment env) {
shutdown(env);
}
});
} catch (IOException e) {
LOG.warn(e);
}
}
/**
* See
* {@link RegionObserver#preCompactScannerOpen(ObserverContext, Store, List, ScanType, long, InternalScanner, CompactionRequest)}
*/
public InternalScanner preCompactScannerOpen(final Store store,
final List<StoreFileScanner> scanners, final ScanType scanType, final long earliestPutTs,
final CompactionRequest request) throws IOException {
return execOperationWithResult(null,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<InternalScanner>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preCompactScannerOpen(ctx, store, scanners, scanType,
earliestPutTs, getResult(), request));
}
});
}
/**
* Called prior to selecting the {@link StoreFile}s for compaction from the list of currently
* available candidates.
* @param store The store where compaction is being requested
* @param candidates The currently available store files
* @param request custom compaction request
* @return If {@code true}, skip the normal selection process and use the current list
* @throws IOException
*/
public boolean preCompactSelection(final Store store, final List<StoreFile> candidates,
final CompactionRequest request) throws IOException {
return execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preCompactSelection(ctx, store, candidates, request);
}
});
}
/**
* Called after the {@link StoreFile}s to be compacted have been selected from the available
* candidates.
* @param store The store where compaction is being requested
* @param selected The store files selected to compact
* @param request custom compaction
*/
public void postCompactSelection(final Store store, final ImmutableList<StoreFile> selected,
final CompactionRequest request) {
try {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postCompactSelection(ctx, store, selected, request);
}
});
} catch (IOException e) {
LOG.warn(e);
}
}
/**
* Called prior to rewriting the store files selected for compaction
* @param store the store being compacted
* @param scanner the scanner used to read store data during compaction
* @param scanType type of Scan
* @param request the compaction that will be executed
* @throws IOException
*/
public InternalScanner preCompact(final Store store, final InternalScanner scanner,
final ScanType scanType, final CompactionRequest request) throws IOException {
return execOperationWithResult(false, scanner,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<InternalScanner>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preCompact(ctx, store, getResult(), scanType, request));
}
});
}
/**
* Called after the store compaction has completed.
* @param store the store being compacted
* @param resultFile the new store file written during compaction
* @param request the compaction that is being executed
* @throws IOException
*/
public void postCompact(final Store store, final StoreFile resultFile,
final CompactionRequest request) throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postCompact(ctx, store, resultFile, request);
}
});
}
/**
* Invoked before a memstore flush
* @throws IOException
*/
public InternalScanner preFlush(final Store store, final InternalScanner scanner)
throws IOException {
return execOperationWithResult(false, scanner,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<InternalScanner>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preFlush(ctx, store, getResult()));
}
});
}
/**
* Invoked before a memstore flush
* @throws IOException
*/
public void preFlush() throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preFlush(ctx);
}
});
}
/**
* See
* {@link RegionObserver#preFlushScannerOpen(ObserverContext,
* Store, KeyValueScanner, InternalScanner)}
*/
public InternalScanner preFlushScannerOpen(final Store store,
final KeyValueScanner memstoreScanner) throws IOException {
return execOperationWithResult(null,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<InternalScanner>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preFlushScannerOpen(ctx, store, memstoreScanner, getResult()));
}
});
}
/**
* Invoked after a memstore flush
* @throws IOException
*/
public void postFlush() throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postFlush(ctx);
}
});
}
/**
* Invoked after a memstore flush
* @throws IOException
*/
public void postFlush(final Store store, final StoreFile storeFile) throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postFlush(ctx, store, storeFile);
}
});
}
/**
* Invoked just before a split
* @throws IOException
*/
// TODO: Deprecate this
public void preSplit() throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preSplit(ctx);
}
});
}
/**
* Invoked just before a split
* @throws IOException
*/
public void preSplit(final byte[] splitRow) throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preSplit(ctx, splitRow);
}
});
}
/**
* Invoked just after a split
* @param l the new left-hand daughter region
* @param r the new right-hand daughter region
* @throws IOException
*/
public void postSplit(final HRegion l, final HRegion r) throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postSplit(ctx, l, r);
}
});
}
public boolean preSplitBeforePONR(final byte[] splitKey,
final List<Mutation> metaEntries) throws IOException {
return execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preSplitBeforePONR(ctx, splitKey, metaEntries);
}
});
}
public void preSplitAfterPONR() throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preSplitAfterPONR(ctx);
}
});
}
/**
* Invoked just before the rollback of a failed split is started
* @throws IOException
*/
public void preRollBackSplit() throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preRollBackSplit(ctx);
}
});
}
/**
* Invoked just after the rollback of a failed split is done
* @throws IOException
*/
public void postRollBackSplit() throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postRollBackSplit(ctx);
}
});
}
/**
* Invoked after a split is completed irrespective of a failure or success.
* @throws IOException
*/
public void postCompleteSplit() throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postCompleteSplit(ctx);
}
});
}
// RegionObserver support
/**
* @param row the row key
* @param family the family
* @param result the result set from the region
* @return true if default processing should be bypassed
* @exception IOException Exception
*/
public boolean preGetClosestRowBefore(final byte[] row, final byte[] family,
final Result result) throws IOException {
return execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preGetClosestRowBefore(ctx, row, family, result);
}
});
}
/**
* @param row the row key
* @param family the family
* @param result the result set from the region
* @exception IOException Exception
*/
public void postGetClosestRowBefore(final byte[] row, final byte[] family,
final Result result) throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postGetClosestRowBefore(ctx, row, family, result);
}
});
}
/**
* @param get the Get request
* @return true if default processing should be bypassed
* @exception IOException Exception
*/
public boolean preGet(final Get get, final List<Cell> results)
throws IOException {
return execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preGetOp(ctx, get, results);
}
});
}
/**
* @param get the Get request
* @param results the result sett
* @exception IOException Exception
*/
public void postGet(final Get get, final List<Cell> results)
throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postGetOp(ctx, get, results);
}
});
}
/**
* @param get the Get request
* @return true or false to return to client if bypassing normal operation,
* or null otherwise
* @exception IOException Exception
*/
public Boolean preExists(final Get get) throws IOException {
return execOperationWithResult(true, false,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Boolean>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preExists(ctx, get, getResult()));
}
});
}
/**
* @param get the Get request
* @param exists the result returned by the region server
* @return the result to return to the client
* @exception IOException Exception
*/
public boolean postExists(final Get get, boolean exists)
throws IOException {
return execOperationWithResult(exists,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Boolean>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.postExists(ctx, get, getResult()));
}
});
}
/**
* @param put The Put object
* @param edit The WALEdit object.
* @param durability The durability used
* @return true if default processing should be bypassed
* @exception IOException Exception
*/
public boolean prePut(final Put put, final WALEdit edit, final Durability durability)
throws IOException {
return execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.prePut(ctx, put, edit, durability);
}
});
}
/**
* @param mutation - the current mutation
* @param kv - the current cell
* @param byteNow - current timestamp in bytes
* @param get - the get that could be used
* Note that the get only does not specify the family and qualifier that should be used
* @return true if default processing should be bypassed
* @exception IOException
* Exception
*/
public boolean prePrepareTimeStampForDeleteVersion(final Mutation mutation,
final Cell kv, final byte[] byteNow, final Get get) throws IOException {
return execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.prePrepareTimeStampForDeleteVersion(ctx, mutation, kv, byteNow, get);
}
});
}
/**
* @param put The Put object
* @param edit The WALEdit object.
* @param durability The durability used
* @exception IOException Exception
*/
public void postPut(final Put put, final WALEdit edit, final Durability durability)
throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postPut(ctx, put, edit, durability);
}
});
}
/**
* @param delete The Delete object
* @param edit The WALEdit object.
* @param durability The durability used
* @return true if default processing should be bypassed
* @exception IOException Exception
*/
public boolean preDelete(final Delete delete, final WALEdit edit, final Durability durability)
throws IOException {
return execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preDelete(ctx, delete, edit, durability);
}
});
}
/**
* @param delete The Delete object
* @param edit The WALEdit object.
* @param durability The durability used
* @exception IOException Exception
*/
public void postDelete(final Delete delete, final WALEdit edit, final Durability durability)
throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postDelete(ctx, delete, edit, durability);
}
});
}
/**
* @param miniBatchOp
* @return true if default processing should be bypassed
* @throws IOException
*/
public boolean preBatchMutate(
final MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
return execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preBatchMutate(ctx, miniBatchOp);
}
});
}
/**
* @param miniBatchOp
* @throws IOException
*/
public void postBatchMutate(
final MiniBatchOperationInProgress<Mutation> miniBatchOp) throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postBatchMutate(ctx, miniBatchOp);
}
});
}
public void postBatchMutateIndispensably(
final MiniBatchOperationInProgress<Mutation> miniBatchOp, final boolean success)
throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postBatchMutateIndispensably(ctx, miniBatchOp, success);
}
});
}
/**
* @param row row to check
* @param family column family
* @param qualifier column qualifier
* @param compareOp the comparison operation
* @param comparator the comparator
* @param put data to put if check succeeds
* @return true or false to return to client if default processing should
* be bypassed, or null otherwise
* @throws IOException e
*/
public Boolean preCheckAndPut(final byte [] row, final byte [] family,
final byte [] qualifier, final CompareOp compareOp,
final ByteArrayComparable comparator, final Put put)
throws IOException {
return execOperationWithResult(true, false,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Boolean>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preCheckAndPut(ctx, row, family, qualifier,
compareOp, comparator, put, getResult()));
}
});
}
/**
* @param row row to check
* @param family column family
* @param qualifier column qualifier
* @param compareOp the comparison operation
* @param comparator the comparator
* @param put data to put if check succeeds
* @return true or false to return to client if default processing should
* be bypassed, or null otherwise
* @throws IOException e
*/
public Boolean preCheckAndPutAfterRowLock(final byte[] row, final byte[] family,
final byte[] qualifier, final CompareOp compareOp, final ByteArrayComparable comparator,
final Put put) throws IOException {
return execOperationWithResult(true, false,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Boolean>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preCheckAndPutAfterRowLock(ctx, row, family, qualifier,
compareOp, comparator, put, getResult()));
}
});
}
/**
* @param row row to check
* @param family column family
* @param qualifier column qualifier
* @param compareOp the comparison operation
* @param comparator the comparator
* @param put data to put if check succeeds
* @throws IOException e
*/
public boolean postCheckAndPut(final byte [] row, final byte [] family,
final byte [] qualifier, final CompareOp compareOp,
final ByteArrayComparable comparator, final Put put,
boolean result) throws IOException {
return execOperationWithResult(result,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Boolean>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.postCheckAndPut(ctx, row, family, qualifier,
compareOp, comparator, put, getResult()));
}
});
}
/**
* @param row row to check
* @param family column family
* @param qualifier column qualifier
* @param compareOp the comparison operation
* @param comparator the comparator
* @param delete delete to commit if check succeeds
* @return true or false to return to client if default processing should
* be bypassed, or null otherwise
* @throws IOException e
*/
public Boolean preCheckAndDelete(final byte [] row, final byte [] family,
final byte [] qualifier, final CompareOp compareOp,
final ByteArrayComparable comparator, final Delete delete)
throws IOException {
return execOperationWithResult(true, false,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Boolean>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preCheckAndDelete(ctx, row, family,
qualifier, compareOp, comparator, delete, getResult()));
}
});
}
/**
* @param row row to check
* @param family column family
* @param qualifier column qualifier
* @param compareOp the comparison operation
* @param comparator the comparator
* @param delete delete to commit if check succeeds
* @return true or false to return to client if default processing should
* be bypassed, or null otherwise
* @throws IOException e
*/
public Boolean preCheckAndDeleteAfterRowLock(final byte[] row, final byte[] family,
final byte[] qualifier, final CompareOp compareOp, final ByteArrayComparable comparator,
final Delete delete) throws IOException {
return execOperationWithResult(true, false,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Boolean>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preCheckAndDeleteAfterRowLock(ctx, row,
family, qualifier, compareOp, comparator, delete, getResult()));
}
});
}
/**
* @param row row to check
* @param family column family
* @param qualifier column qualifier
* @param compareOp the comparison operation
* @param comparator the comparator
* @param delete delete to commit if check succeeds
* @throws IOException e
*/
public boolean postCheckAndDelete(final byte [] row, final byte [] family,
final byte [] qualifier, final CompareOp compareOp,
final ByteArrayComparable comparator, final Delete delete,
boolean result) throws IOException {
return execOperationWithResult(result,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Boolean>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.postCheckAndDelete(ctx, row, family,
qualifier, compareOp, comparator, delete, getResult()));
}
});
}
/**
* @param append append object
* @return result to return to client if default operation should be
* bypassed, null otherwise
* @throws IOException if an error occurred on the coprocessor
*/
public Result preAppend(final Append append) throws IOException {
return execOperationWithResult(true, null,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Result>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preAppend(ctx, append));
}
});
}
/**
* @param append append object
* @return result to return to client if default operation should be
* bypassed, null otherwise
* @throws IOException if an error occurred on the coprocessor
*/
public Result preAppendAfterRowLock(final Append append) throws IOException {
return execOperationWithResult(true, null,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Result>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preAppendAfterRowLock(ctx, append));
}
});
}
/**
* @param increment increment object
* @return result to return to client if default operation should be
* bypassed, null otherwise
* @throws IOException if an error occurred on the coprocessor
*/
public Result preIncrement(final Increment increment) throws IOException {
return execOperationWithResult(true, null,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Result>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preIncrement(ctx, increment));
}
});
}
/**
* @param increment increment object
* @return result to return to client if default operation should be
* bypassed, null otherwise
* @throws IOException if an error occurred on the coprocessor
*/
public Result preIncrementAfterRowLock(final Increment increment) throws IOException {
return execOperationWithResult(true, null,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Result>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preIncrementAfterRowLock(ctx, increment));
}
});
}
/**
* @param append Append object
* @param result the result returned by the append
* @throws IOException if an error occurred on the coprocessor
*/
public void postAppend(final Append append, final Result result) throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postAppend(ctx, append, result);
}
});
}
/**
* @param increment increment object
* @param result the result returned by postIncrement
* @throws IOException if an error occurred on the coprocessor
*/
public Result postIncrement(final Increment increment, Result result) throws IOException {
return execOperationWithResult(result,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Result>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.postIncrement(ctx, increment, getResult()));
}
});
}
/**
* @param scan the Scan specification
* @return scanner id to return to client if default operation should be
* bypassed, false otherwise
* @exception IOException Exception
*/
public RegionScanner preScannerOpen(final Scan scan) throws IOException {
return execOperationWithResult(true, null,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<RegionScanner>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preScannerOpen(ctx, scan, getResult()));
}
});
}
/**
* See
* {@link RegionObserver#preStoreScannerOpen(ObserverContext,
* Store, Scan, NavigableSet, KeyValueScanner)}
*/
public KeyValueScanner preStoreScannerOpen(final Store store, final Scan scan,
final NavigableSet<byte[]> targetCols) throws IOException {
return execOperationWithResult(null,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<KeyValueScanner>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preStoreScannerOpen(ctx, store, scan, targetCols, getResult()));
}
});
}
/**
* @param scan the Scan specification
* @param s the scanner
* @return the scanner instance to use
* @exception IOException Exception
*/
public RegionScanner postScannerOpen(final Scan scan, RegionScanner s) throws IOException {
return execOperationWithResult(s,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<RegionScanner>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.postScannerOpen(ctx, scan, getResult()));
}
});
}
/**
* @param s the scanner
* @param results the result set returned by the region server
* @param limit the maximum number of results to return
* @return 'has next' indication to client if bypassing default behavior, or
* null otherwise
* @exception IOException Exception
*/
public Boolean preScannerNext(final InternalScanner s,
final List<Result> results, final int limit) throws IOException {
return execOperationWithResult(true, false,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Boolean>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preScannerNext(ctx, s, results, limit, getResult()));
}
});
}
/**
* @param s the scanner
* @param results the result set returned by the region server
* @param limit the maximum number of results to return
* @param hasMore
* @return 'has more' indication to give to client
* @exception IOException Exception
*/
public boolean postScannerNext(final InternalScanner s,
final List<Result> results, final int limit, boolean hasMore)
throws IOException {
return execOperationWithResult(hasMore,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Boolean>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.postScannerNext(ctx, s, results, limit, getResult()));
}
});
}
/**
* This will be called by the scan flow when the current scanned row is being filtered out by the
* filter.
* @param s the scanner
* @param currentRow The current rowkey which got filtered out
* @param offset offset to rowkey
* @param length length of rowkey
* @return whether more rows are available for the scanner or not
* @throws IOException
*/
public boolean postScannerFilterRow(final InternalScanner s, final byte[] currentRow,
final int offset, final short length) throws IOException {
// short circuit for performance
if (!hasCustomPostScannerFilterRow) return true;
return execOperationWithResult(true,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Boolean>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.postScannerFilterRow(ctx, s, currentRow, offset,length, getResult()));
}
});
}
/**
* @param s the scanner
* @return true if default behavior should be bypassed, false otherwise
* @exception IOException Exception
*/
public boolean preScannerClose(final InternalScanner s) throws IOException {
return execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preScannerClose(ctx, s);
}
});
}
/**
* @exception IOException Exception
*/
public void postScannerClose(final InternalScanner s) throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postScannerClose(ctx, s);
}
});
}
/**
* @param info
* @param logKey
* @param logEdit
* @return true if default behavior should be bypassed, false otherwise
* @throws IOException
*/
public boolean preWALRestore(final HRegionInfo info, final WALKey logKey,
final WALEdit logEdit) throws IOException {
return execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
// Once we don't need to support the legacy call, replace RegionOperation with a version
// that's ObserverContext<RegionEnvironment> and avoid this cast.
final RegionEnvironment env = (RegionEnvironment)ctx.getEnvironment();
if (env.useLegacyPre) {
if (logKey instanceof HLogKey) {
oserver.preWALRestore(ctx, info, (HLogKey)logKey, logEdit);
} else {
legacyWarning(oserver.getClass(), "There are wal keys present that are not HLogKey.");
}
} else {
oserver.preWALRestore(ctx, info, logKey, logEdit);
}
}
});
}
/**
* @return true if default behavior should be bypassed, false otherwise
* @deprecated use {@link #preWALRestore(HRegionInfo, WALKey, WALEdit)}
*/
@Deprecated
public boolean preWALRestore(final HRegionInfo info, final HLogKey logKey,
final WALEdit logEdit) throws IOException {
return preWALRestore(info, (WALKey)logKey, logEdit);
}
/**
* @param info
* @param logKey
* @param logEdit
* @throws IOException
*/
public void postWALRestore(final HRegionInfo info, final WALKey logKey, final WALEdit logEdit)
throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
// Once we don't need to support the legacy call, replace RegionOperation with a version
// that's ObserverContext<RegionEnvironment> and avoid this cast.
final RegionEnvironment env = (RegionEnvironment)ctx.getEnvironment();
if (env.useLegacyPost) {
if (logKey instanceof HLogKey) {
oserver.postWALRestore(ctx, info, (HLogKey)logKey, logEdit);
} else {
legacyWarning(oserver.getClass(), "There are wal keys present that are not HLogKey.");
}
} else {
oserver.postWALRestore(ctx, info, logKey, logEdit);
}
}
});
}
/**
* @deprecated use {@link #postWALRestore(HRegionInfo, WALKey, WALEdit)}
*/
@Deprecated
public void postWALRestore(final HRegionInfo info, final HLogKey logKey, final WALEdit logEdit)
throws IOException {
postWALRestore(info, (WALKey)logKey, logEdit);
}
/**
* @param familyPaths pairs of { CF, file path } submitted for bulk load
* @return true if the default operation should be bypassed
* @throws IOException
*/
public boolean preBulkLoadHFile(final List<Pair<byte[], String>> familyPaths) throws IOException {
return execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.preBulkLoadHFile(ctx, familyPaths);
}
});
}
/**
* @param familyPaths pairs of { CF, file path } submitted for bulk load
* @param hasLoaded whether load was successful or not
* @return the possibly modified value of hasLoaded
* @throws IOException
*/
public boolean postBulkLoadHFile(final List<Pair<byte[], String>> familyPaths,
boolean hasLoaded) throws IOException {
return execOperationWithResult(hasLoaded,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Boolean>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.postBulkLoadHFile(ctx, familyPaths, getResult()));
}
});
}
public void postStartRegionOperation(final Operation op) throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postStartRegionOperation(ctx, op);
}
});
}
public void postCloseRegionOperation(final Operation op) throws IOException {
execOperation(coprocessors.isEmpty() ? null : new RegionOperation() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postCloseRegionOperation(ctx, op);
}
});
}
/**
* @param fs fileystem to read from
* @param p path to the file
* @param in {@link FSDataInputStreamWrapper}
* @param size Full size of the file
* @param cacheConf
* @param r original reference file. This will be not null only when reading a split file.
* @return a Reader instance to use instead of the base reader if overriding
* default behavior, null otherwise
* @throws IOException
*/
public StoreFile.Reader preStoreFileReaderOpen(final FileSystem fs, final Path p,
final FSDataInputStreamWrapper in, final long size, final CacheConfig cacheConf,
final Reference r) throws IOException {
return execOperationWithResult(null,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<StoreFile.Reader>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preStoreFileReaderOpen(ctx, fs, p, in, size, cacheConf, r, getResult()));
}
});
}
/**
* @param fs fileystem to read from
* @param p path to the file
* @param in {@link FSDataInputStreamWrapper}
* @param size Full size of the file
* @param cacheConf
* @param r original reference file. This will be not null only when reading a split file.
* @param reader the base reader instance
* @return The reader to use
* @throws IOException
*/
public StoreFile.Reader postStoreFileReaderOpen(final FileSystem fs, final Path p,
final FSDataInputStreamWrapper in, final long size, final CacheConfig cacheConf,
final Reference r, final StoreFile.Reader reader) throws IOException {
return execOperationWithResult(reader,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<StoreFile.Reader>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.postStoreFileReaderOpen(ctx, fs, p, in, size, cacheConf, r, getResult()));
}
});
}
public Cell postMutationBeforeWAL(final MutationType opType, final Mutation mutation,
final Cell oldCell, Cell newCell) throws IOException {
return execOperationWithResult(newCell,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<Cell>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.postMutationBeforeWAL(ctx, opType, mutation, oldCell, getResult()));
}
});
}
public Message preEndpointInvocation(final Service service, final String methodName,
Message request) throws IOException {
return execOperationWithResult(request,
coprocessors.isEmpty() ? null : new EndpointOperationWithResult<Message>() {
@Override
public void call(EndpointObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.preEndpointInvocation(ctx, service, methodName, getResult()));
}
});
}
public void postEndpointInvocation(final Service service, final String methodName,
final Message request, final Message.Builder responseBuilder) throws IOException {
execOperation(coprocessors.isEmpty() ? null : new EndpointOperation() {
@Override
public void call(EndpointObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
oserver.postEndpointInvocation(ctx, service, methodName, request, responseBuilder);
}
});
}
public DeleteTracker postInstantiateDeleteTracker(DeleteTracker tracker) throws IOException {
return execOperationWithResult(tracker,
coprocessors.isEmpty() ? null : new RegionOperationWithResult<DeleteTracker>() {
@Override
public void call(RegionObserver oserver, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
setResult(oserver.postInstantiateDeleteTracker(ctx, getResult()));
}
});
}
public Map<String, DescriptiveStatistics> getCoprocessorExecutionStatistics() {
Map<String, DescriptiveStatistics> results = new HashMap<String, DescriptiveStatistics>();
for (RegionEnvironment env : coprocessors) {
DescriptiveStatistics ds = new DescriptiveStatistics();
if (env.getInstance() instanceof RegionObserver) {
for (Long time : env.getExecutionLatenciesNanos()) {
ds.addValue(time);
}
// Ensures that web ui circumvents the display of NaN values when there are zero samples.
if (ds.getN() == 0) {
ds.addValue(0);
}
results.put(env.getInstance().getClass().getSimpleName(), ds);
}
}
return results;
}
private static abstract class CoprocessorOperation
extends ObserverContext<RegionCoprocessorEnvironment> {
public abstract void call(Coprocessor observer,
ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException;
public abstract boolean hasCall(Coprocessor observer);
public void postEnvCall(RegionEnvironment env) { }
}
private static abstract class RegionOperation extends CoprocessorOperation {
public abstract void call(RegionObserver observer,
ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException;
public boolean hasCall(Coprocessor observer) {
return observer instanceof RegionObserver;
}
public void call(Coprocessor observer, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
call((RegionObserver)observer, ctx);
}
}
private static abstract class RegionOperationWithResult<T> extends RegionOperation {
private T result = null;
public void setResult(final T result) { this.result = result; }
public T getResult() { return this.result; }
}
private static abstract class EndpointOperation extends CoprocessorOperation {
public abstract void call(EndpointObserver observer,
ObserverContext<RegionCoprocessorEnvironment> ctx) throws IOException;
public boolean hasCall(Coprocessor observer) {
return observer instanceof EndpointObserver;
}
public void call(Coprocessor observer, ObserverContext<RegionCoprocessorEnvironment> ctx)
throws IOException {
call((EndpointObserver)observer, ctx);
}
}
private static abstract class EndpointOperationWithResult<T> extends EndpointOperation {
private T result = null;
public void setResult(final T result) { this.result = result; }
public T getResult() { return this.result; }
}
private boolean execOperation(final CoprocessorOperation ctx)
throws IOException {
return execOperation(true, ctx);
}
private <T> T execOperationWithResult(final T defaultValue,
final RegionOperationWithResult<T> ctx) throws IOException {
if (ctx == null) return defaultValue;
ctx.setResult(defaultValue);
execOperation(true, ctx);
return ctx.getResult();
}
private <T> T execOperationWithResult(final boolean ifBypass, final T defaultValue,
final RegionOperationWithResult<T> ctx) throws IOException {
boolean bypass = false;
T result = defaultValue;
if (ctx != null) {
ctx.setResult(defaultValue);
bypass = execOperation(true, ctx);
result = ctx.getResult();
}
return bypass == ifBypass ? result : null;
}
private <T> T execOperationWithResult(final T defaultValue,
final EndpointOperationWithResult<T> ctx) throws IOException {
if (ctx == null) return defaultValue;
ctx.setResult(defaultValue);
execOperation(true, ctx);
return ctx.getResult();
}
private boolean execOperation(final boolean earlyExit, final CoprocessorOperation ctx)
throws IOException {
boolean bypass = false;
for (RegionEnvironment env: coprocessors) {
Coprocessor observer = env.getInstance();
if (ctx.hasCall(observer)) {
long startTime = System.nanoTime();
ctx.prepare(env);
Thread currentThread = Thread.currentThread();
ClassLoader cl = currentThread.getContextClassLoader();
try {
currentThread.setContextClassLoader(env.getClassLoader());
ctx.call(observer, ctx);
} catch (Throwable e) {
handleCoprocessorThrowable(env, e);
} finally {
currentThread.setContextClassLoader(cl);
}
env.offerExecutionLatency(System.nanoTime() - startTime);
bypass |= ctx.shouldBypass();
if (earlyExit && ctx.shouldComplete()) {
break;
}
}
ctx.postEnvCall(env);
}
return bypass;
}
}
| 37.280712 | 131 | 0.696711 |
6e58dc952996df2af8b396b852346e681d1d8ccc
| 1,183 |
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
package org.opensearch.ml.common.dataframe;
import org.junit.Test;
import org.opensearch.common.Strings;
import org.opensearch.common.xcontent.XContentBuilder;
import org.opensearch.common.xcontent.XContentFactory;
import org.opensearch.common.xcontent.XContentType;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class LongValueTest {
@Test
public void longValue() {
LongValue longValue = new LongValue((long)2);
assertEquals(ColumnType.LONG, longValue.columnType());
assertEquals(2L, longValue.getValue());
assertEquals(2.0d, longValue.doubleValue(), 1e-5);
}
@Test
public void testToXContent() throws IOException {
LongValue longValue = new LongValue((long)2);
XContentBuilder builder = XContentFactory.contentBuilder(XContentType.JSON);
longValue.toXContent(builder);
assertNotNull(builder);
String jsonStr = Strings.toString(builder);
assertEquals("{\"column_type\":\"LONG\",\"value\":2}", jsonStr);
}
}
| 29.575 | 84 | 0.720203 |
a0217c8dab9dc6e5b2bc6b811749370d59b0afa5
| 148 |
package land.bruinkool.garzweiler.security;
import land.bruinkool.garzweiler.entity.User;
public interface Authenticatable {
User getUser();
}
| 21.142857 | 45 | 0.797297 |
8bf40405bac7adc5274c9e8fc1e6ae5cf4ac1d6a
| 600 |
// JOOS1: PARSER_WEEDER,JOOS1_EXPLICIT_SUPER_CALL,PARSER_EXCEPTION
// JOOS2: TYPE_CHECKING,THIS_BEFORE_SUPER_CALL
// JAVAC:UNKNOWN
/**
* Parser/weeder:
* - (Joos 1) Explicit this statements not allowed
* Typecheck:
* - A this reference (AThisExp) must not occur, explicitly or
* implicitly, in a static method, an initializer for a static field,
* or an argument to a super or this constructor invocation.
*/
public class Je_16_StaticThis_ArgumentToSuper extends Thread{
public Je_16_StaticThis_ArgumentToSuper(){
super(this);
}
public static int test(){
return 123;
}
}
| 27.272727 | 69 | 0.743333 |
6a2b6a08181f2f1c83487e925e7efea3931fc658
| 74 |
/**
* JDBC transaction.
*/
package org.apache.ibatis.transaction.jdbc;
| 12.333333 | 43 | 0.702703 |
a01be1e9c84ee18237466e957bf9fdd4d3ee9761
| 520 |
package db.services;
import com.j256.ormlite.jdbc.JdbcPooledConnectionSource;
import com.j256.ormlite.support.ConnectionSource;
import java.sql.SQLException;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class TestingDataSourceConfig {
@Bean(destroyMethod = "close")
public ConnectionSource getConnectionSource() throws SQLException {
return new JdbcPooledConnectionSource("jdbc:sqlite:bachelor_diploma_test.db");
}
}
| 30.588235 | 82 | 0.826923 |
21e3853f535953912119164066e63da94ecc96bf
| 4,945 |
package com.xiaoke1256.orders.pay.service;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.LockModeType;
import javax.persistence.PersistenceContext;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.transaction.annotation.Transactional;
import com.xiaoke1256.orders.common.RespCode;
import com.xiaoke1256.orders.common.exception.AppException;
import com.xiaoke1256.orders.common.exception.BusinessException;
import com.xiaoke1256.orders.core.bo.PaymentTxn;
import com.xiaoke1256.orders.core.dto.PaymentCancelRequest;
public abstract class AbstractPayBusinessService implements PayBusinessService {
private static final Logger logger = LoggerFactory.getLogger(AbstractPayBusinessService.class);
@PersistenceContext(unitName="default")
private EntityManager entityManager ;
@Transactional
protected void savePayment(String thirdOrderNo, String payerNo, String payeeNo, String payType, BigDecimal amt, String payOrderNo,
String subOrderNo,String businessNo, String incident) {
//查一下该订单号 ,是否已用过。
PaymentTxn payment = this.getPaymentByThirdOrderNo(thirdOrderNo);
if(payment!=null) {
//TODO 有可能是黑客攻击事件,需要记录安全日志。
throw new BusinessException(RespCode.BUSSNESS_ERROR.getCode(),"The third order no has usered","重复使用已支付过的订单。");
}
//记录支付流水
PaymentTxn paymentTxn = new PaymentTxn();
paymentTxn.setPayType(payType);
paymentTxn.setPayeeNo(payeeNo);
paymentTxn.setPayerNo(payerNo);
paymentTxn.setAmt(amt);
paymentTxn.setPayOrderNo(payOrderNo);
paymentTxn.setSubOrderNo(subOrderNo);
paymentTxn.setBusinessNo(businessNo);
paymentTxn.setThirdOrderNo(thirdOrderNo);
paymentTxn.setReverseFlg("0");//未冲正
paymentTxn.setIncident(incident);
paymentTxn.setInsertTime(new Timestamp(System.currentTimeMillis()));
paymentTxn.setUpdateTime(new Timestamp(System.currentTimeMillis()));
entityManager.persist(paymentTxn);
}
@Transactional(readOnly=true)
public PaymentTxn getPaymentByThirdOrderNo(String thirdOrderNo) {
String ql = "from PaymentTxn where thirdOrderNo = :thirdOrderNo";
@SuppressWarnings("unchecked")
List<PaymentTxn> list = entityManager.createQuery(ql).setParameter("thirdOrderNo", thirdOrderNo).getResultList();
if(list!=null && list.size()>0)
return list.get(0);
return null;
}
/**
* 冲正
* @param orgTxn
* @param reason
*/
protected void reverse(PaymentTxn orgTxn,String reason) {
try {
entityManager.refresh(orgTxn, LockModeType.WRITE);
if(!"0".equals(orgTxn.getReverseFlg())) {
//已经被冲正了。
logger.warn("Already been reversed!payment_id is:"+orgTxn.getPaymentId());
return;
}
orgTxn.setReverseFlg("1");
entityManager.merge(orgTxn);
//冲正记录
PaymentTxn paymentTxn = new PaymentTxn();
BeanUtils.copyProperties(paymentTxn, orgTxn);
paymentTxn.setPaymentId(null);
paymentTxn.setAmt(orgTxn.getAmt().negate());
paymentTxn.setIncident("冲正记录:"+orgTxn.getIncident());
paymentTxn.setRemark(reason);
paymentTxn.setReverseFlg("0");
paymentTxn.setInsertTime(new Timestamp(System.currentTimeMillis()));
paymentTxn.setUpdateTime(new Timestamp(System.currentTimeMillis()));
paymentTxn.setDealStatus(PaymentTxn.DEAL_STATUS_INIT);
entityManager.persist(paymentTxn);
}catch(Exception ex) {
throw new RuntimeException(ex);
}
}
protected String getReson(String cancelType) {
String reason="";
if(PaymentCancelRequest.CANCEL_TYPE_EXPIRED.equals(cancelType)) {
reason="超时未反馈。";
}else if(PaymentCancelRequest.CANCEL_TYPE_REMOTE_INVOK.equals(cancelType)) {
reason="远程调用异常。";
}else if(PaymentCancelRequest.CANCEL_TYPE_OTHER_FAIL.equals(cancelType)) {
reason="其他异常。";
}
if(StringUtils.isEmpty(reason)) {
throw new AppException(RespCode.EMPTY_PARAMTER_ERROR.getCode(),"未提供足够的参数");
}
return reason;
}
@Transactional
@Override
public void cancel(String orderNo, String cancelType, String remark) {
String reason = getReson(cancelType);
PaymentTxn orgTxn = null;
if(StringUtils.isNotEmpty(orderNo)) {
orgTxn = getPaymentByThirdOrderNo(orderNo);
}else if(StringUtils.isNotEmpty(remark)) {
orgTxn = getPaymentByBusiness(remark);
}
if(orgTxn==null) {
logger.warn("Have not found the order by the orderNo.Maybe the order never input in our system.");
return;//订单不存在就视为已经取消了。
}
cancel(orgTxn, reason);
reverse(orgTxn,reason);
}
/**
* 处理具体业务的取消。
* @param orgTxn
* @param reason
*/
protected abstract void cancel(PaymentTxn orgTxn, String reason);
/**
* 根据业务来获取支付流水
* @param remark
* @return
*/
protected abstract PaymentTxn getPaymentByBusiness(String remark);
}
| 33.412162 | 132 | 0.740546 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.