Search is not available for this dataset
hexsha
stringlengths 40
40
| repo
stringlengths 6
126
| path
stringlengths 6
1.02k
| license
sequence | language
stringclasses 1
value | identifier
stringlengths 1
220
| return_type
stringlengths 1
110
⌀ | original_string
stringlengths 39
223k
| original_docstring
stringlengths 16
34.8k
| docstring
stringlengths 11
3.41k
| docstring_tokens
sequence | code
stringlengths 26
223k
| code_tokens
sequence | short_docstring
stringlengths 0
3.02k
| short_docstring_tokens
sequence | comment
sequence | parameters
list | docstring_params
dict | input_ids
sequence | attention_mask
sequence | labels
sequence |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
32575d8d7dafab052108a7f919d9c85d7232753b | iedadata/geomapapp | org/geomapapp/grid/GridDialog.java | [
"Apache-2.0"
] | Java | dispose | null | public void dispose(Grid2DOverlay gridToRemove) {
if ( gridToRemove != null ) {
String gridToRemoveName = gridToRemove.name;
XMap map = ((Grid2DOverlay)gridCB.getSelectedItem()).getMap();
//contributed grids only
if ( isContributedGrid(gridToRemove.name) ) {
//Set units to null
org.geomapapp.gis.shape.ESRIShapefile.nullUnits();
// Remove reference to saving grid
((MapApp)map.getApp()).setToolsGrid(null);
if (gridToRemove != null) {
gridToRemove.dispose();
disposedGrid = gridToRemove;
// gridCBElements.remove(gridToRemoveName);
gridCB.removeItem(gridToRemove);
}
} else {
((MapApp)map.getApp()).setToolsGrid(null);
if (gridToRemove != null) {
gridToRemove.dispose();
gridToRemove.getMap().removeOverlay(gridToRemove);
}
}
//If closing GMRT grid, deselect the toggle button
if ((gridToRemoveName.equals(DEM) ||gridToRemoveName.equals(GRID_SHORT_TO_LONG_NAMES.get(DEM)))) {
gridTB.setSelected(false);
}
currentGrid = gridCB.getSelectedIndex();
//Check the layer manager for the next grid.
//If no more, then close down the dialog.
List<LayerPanel> layerPanels = ((MapApp)(map.getApp())).layerManager.getLayerPanels();
for (LayerPanel lp : layerPanels) {
if (lp.layer instanceof Grid2DOverlay) {
Grid2DOverlay gotoGrid = ((Grid2DOverlay) lp.layer);
if (gotoGrid != gridToRemove && !gotoGrid.name.equals(MapApp.baseFocusName)) {
gridCB.setSelectedItem(gotoGrid);
switchGrid();
return;
}
} else if (lp.layer instanceof ESRIShapefile && ((ESRIShapefile)lp.layer).getMultiGrid() != null ) {
Grid2DOverlay gotoGrid = ((ESRIShapefile)lp.layer).getMultiGrid().grid;
if (gotoGrid != gridToRemove) {
gridCB.setSelectedItem(gotoGrid);
switchGrid();
return;
}
}
}
toggleListLockUnlock = null;
dialog.dispose();
loaded = false;
if ( map != null && map.getApp() instanceof MapApp) {
((MapApp)map.getApp()).initializeColorScale();
}
map.repaint();
}
} | /*
* This version works better if grids have the same name
*/ | This version works better if grids have the same name | [
"This",
"version",
"works",
"better",
"if",
"grids",
"have",
"the",
"same",
"name"
] | public void dispose(Grid2DOverlay gridToRemove) {
if ( gridToRemove != null ) {
String gridToRemoveName = gridToRemove.name;
XMap map = ((Grid2DOverlay)gridCB.getSelectedItem()).getMap();
if ( isContributedGrid(gridToRemove.name) ) {
org.geomapapp.gis.shape.ESRIShapefile.nullUnits();
((MapApp)map.getApp()).setToolsGrid(null);
if (gridToRemove != null) {
gridToRemove.dispose();
disposedGrid = gridToRemove;
gridCB.removeItem(gridToRemove);
}
} else {
((MapApp)map.getApp()).setToolsGrid(null);
if (gridToRemove != null) {
gridToRemove.dispose();
gridToRemove.getMap().removeOverlay(gridToRemove);
}
}
if ((gridToRemoveName.equals(DEM) ||gridToRemoveName.equals(GRID_SHORT_TO_LONG_NAMES.get(DEM)))) {
gridTB.setSelected(false);
}
currentGrid = gridCB.getSelectedIndex();
List<LayerPanel> layerPanels = ((MapApp)(map.getApp())).layerManager.getLayerPanels();
for (LayerPanel lp : layerPanels) {
if (lp.layer instanceof Grid2DOverlay) {
Grid2DOverlay gotoGrid = ((Grid2DOverlay) lp.layer);
if (gotoGrid != gridToRemove && !gotoGrid.name.equals(MapApp.baseFocusName)) {
gridCB.setSelectedItem(gotoGrid);
switchGrid();
return;
}
} else if (lp.layer instanceof ESRIShapefile && ((ESRIShapefile)lp.layer).getMultiGrid() != null ) {
Grid2DOverlay gotoGrid = ((ESRIShapefile)lp.layer).getMultiGrid().grid;
if (gotoGrid != gridToRemove) {
gridCB.setSelectedItem(gotoGrid);
switchGrid();
return;
}
}
}
toggleListLockUnlock = null;
dialog.dispose();
loaded = false;
if ( map != null && map.getApp() instanceof MapApp) {
((MapApp)map.getApp()).initializeColorScale();
}
map.repaint();
}
} | [
"public",
"void",
"dispose",
"(",
"Grid2DOverlay",
"gridToRemove",
")",
"{",
"if",
"(",
"gridToRemove",
"!=",
"null",
")",
"{",
"String",
"gridToRemoveName",
"=",
"gridToRemove",
".",
"name",
";",
"XMap",
"map",
"=",
"(",
"(",
"Grid2DOverlay",
")",
"gridCB",
".",
"getSelectedItem",
"(",
")",
")",
".",
"getMap",
"(",
")",
";",
"if",
"(",
"isContributedGrid",
"(",
"gridToRemove",
".",
"name",
")",
")",
"{",
"org",
".",
"geomapapp",
".",
"gis",
".",
"shape",
".",
"ESRIShapefile",
".",
"nullUnits",
"(",
")",
";",
"(",
"(",
"MapApp",
")",
"map",
".",
"getApp",
"(",
")",
")",
".",
"setToolsGrid",
"(",
"null",
")",
";",
"if",
"(",
"gridToRemove",
"!=",
"null",
")",
"{",
"gridToRemove",
".",
"dispose",
"(",
")",
";",
"disposedGrid",
"=",
"gridToRemove",
";",
"gridCB",
".",
"removeItem",
"(",
"gridToRemove",
")",
";",
"}",
"}",
"else",
"{",
"(",
"(",
"MapApp",
")",
"map",
".",
"getApp",
"(",
")",
")",
".",
"setToolsGrid",
"(",
"null",
")",
";",
"if",
"(",
"gridToRemove",
"!=",
"null",
")",
"{",
"gridToRemove",
".",
"dispose",
"(",
")",
";",
"gridToRemove",
".",
"getMap",
"(",
")",
".",
"removeOverlay",
"(",
"gridToRemove",
")",
";",
"}",
"}",
"if",
"(",
"(",
"gridToRemoveName",
".",
"equals",
"(",
"DEM",
")",
"||",
"gridToRemoveName",
".",
"equals",
"(",
"GRID_SHORT_TO_LONG_NAMES",
".",
"get",
"(",
"DEM",
")",
")",
")",
")",
"{",
"gridTB",
".",
"setSelected",
"(",
"false",
")",
";",
"}",
"currentGrid",
"=",
"gridCB",
".",
"getSelectedIndex",
"(",
")",
";",
"List",
"<",
"LayerPanel",
">",
"layerPanels",
"=",
"(",
"(",
"MapApp",
")",
"(",
"map",
".",
"getApp",
"(",
")",
")",
")",
".",
"layerManager",
".",
"getLayerPanels",
"(",
")",
";",
"for",
"(",
"LayerPanel",
"lp",
":",
"layerPanels",
")",
"{",
"if",
"(",
"lp",
".",
"layer",
"instanceof",
"Grid2DOverlay",
")",
"{",
"Grid2DOverlay",
"gotoGrid",
"=",
"(",
"(",
"Grid2DOverlay",
")",
"lp",
".",
"layer",
")",
";",
"if",
"(",
"gotoGrid",
"!=",
"gridToRemove",
"&&",
"!",
"gotoGrid",
".",
"name",
".",
"equals",
"(",
"MapApp",
".",
"baseFocusName",
")",
")",
"{",
"gridCB",
".",
"setSelectedItem",
"(",
"gotoGrid",
")",
";",
"switchGrid",
"(",
")",
";",
"return",
";",
"}",
"}",
"else",
"if",
"(",
"lp",
".",
"layer",
"instanceof",
"ESRIShapefile",
"&&",
"(",
"(",
"ESRIShapefile",
")",
"lp",
".",
"layer",
")",
".",
"getMultiGrid",
"(",
")",
"!=",
"null",
")",
"{",
"Grid2DOverlay",
"gotoGrid",
"=",
"(",
"(",
"ESRIShapefile",
")",
"lp",
".",
"layer",
")",
".",
"getMultiGrid",
"(",
")",
".",
"grid",
";",
"if",
"(",
"gotoGrid",
"!=",
"gridToRemove",
")",
"{",
"gridCB",
".",
"setSelectedItem",
"(",
"gotoGrid",
")",
";",
"switchGrid",
"(",
")",
";",
"return",
";",
"}",
"}",
"}",
"toggleListLockUnlock",
"=",
"null",
";",
"dialog",
".",
"dispose",
"(",
")",
";",
"loaded",
"=",
"false",
";",
"if",
"(",
"map",
"!=",
"null",
"&&",
"map",
".",
"getApp",
"(",
")",
"instanceof",
"MapApp",
")",
"{",
"(",
"(",
"MapApp",
")",
"map",
".",
"getApp",
"(",
")",
")",
".",
"initializeColorScale",
"(",
")",
";",
"}",
"map",
".",
"repaint",
"(",
")",
";",
"}",
"}"
] | This version works better if grids have the same name | [
"This",
"version",
"works",
"better",
"if",
"grids",
"have",
"the",
"same",
"name"
] | [
"//contributed grids only",
"//Set units to null",
"// Remove reference to saving grid",
"//\t\t\t\t\tgridCBElements.remove(gridToRemoveName);",
"//If closing GMRT grid, deselect the toggle button",
"//Check the layer manager for the next grid.",
"//If no more, then close down the dialog."
] | [
{
"param": "gridToRemove",
"type": "Grid2DOverlay"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gridToRemove",
"type": "Grid2DOverlay",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
15825,
12,
6313,
22,
3191,
502,
5544,
3068,
12765,
13,
288,
203,
202,
202,
430,
261,
3068,
12765,
480,
446,
262,
288,
203,
1082,
202,
780,
3068,
12765,
461,
273,
3068,
12765,
18,
529,
31,
203,
25083,
203,
1082,
202,
60,
863,
852,
273,
14015,
6313,
22,
3191,
502,
5544,
13,
5222,
8876,
18,
588,
7416,
1180,
1435,
2934,
588,
863,
5621,
203,
203,
1082,
202,
759,
591,
11050,
3068,
87,
1338,
203,
1082,
202,
430,
261,
353,
442,
11050,
6313,
12,
5222,
12765,
18,
529,
13,
262,
288,
203,
6862,
203,
9506,
202,
759,
694,
4971,
358,
446,
203,
9506,
202,
3341,
18,
10049,
438,
2910,
18,
15761,
18,
4867,
18,
3991,
2259,
8500,
768,
18,
2011,
7537,
5621,
203,
6862,
203,
9506,
202,
759,
3581,
2114,
358,
12392,
3068,
203,
9506,
202,
12443,
863,
3371,
13,
1458,
18,
588,
3371,
1435,
2934,
542,
10348,
6313,
12,
2011,
1769,
203,
9506,
202,
430,
261,
5222,
12765,
480,
446,
13,
288,
203,
6862,
202,
5222,
12765,
18,
2251,
4150,
5621,
203,
6862,
202,
2251,
7423,
6313,
273,
3068,
12765,
31,
203,
759,
6862,
202,
5222,
8876,
3471,
18,
4479,
12,
5222,
12765,
461,
1769,
203,
6862,
202,
5222,
8876,
18,
4479,
1180,
12,
5222,
12765,
1769,
203,
9506,
202,
97,
203,
1082,
202,
97,
469,
288,
203,
9506,
202,
12443,
863,
3371,
13,
1458,
18,
588,
3371,
1435,
2934,
542,
10348,
6313,
12,
2011,
1769,
203,
9506,
202,
430,
261,
5222,
12765,
480,
446,
13,
288,
203,
6862,
202,
5222,
12765,
18,
2251,
4150,
5621,
203,
6862,
202,
5222,
12765,
18,
588,
863,
7675,
4479,
11627,
12,
5222,
12765,
1769,
203,
9506,
202,
97,
203,
1082,
202,
97,
203,
9506,
203,
1082,
202,
759,
2047,
7647,
611,
49,
12185,
3068,
16,
2832,
13759,
326,
10486,
3568,
203,
1082,
202,
430,
14015,
5222,
12765,
461,
18,
14963,
12,
1639,
49,
13,
747,
5222,
12765,
461,
18,
14963,
12,
6997,
734,
67,
15993,
67,
4296,
67,
14639,
67,
16257,
18,
588,
12,
1639,
49,
3719,
3719,
288,
203,
9506,
202,
5222,
25730,
18,
542,
7416,
12,
5743,
1769,
203,
1082,
202,
97,
203,
9506,
203,
1082,
202,
2972,
6313,
273,
3068,
8876,
18,
588,
7416,
1016,
5621,
203,
1082,
202,
759,
1564,
326,
3018,
3301,
364,
326,
1024,
3068,
18,
203,
1082,
202,
759,
2047,
1158,
1898,
16,
1508,
1746,
2588,
326,
6176,
18,
203,
1082,
202,
682,
32,
4576,
5537,
34,
3018,
5537,
87,
273,
14015,
863,
3371,
21433,
1458,
18,
588,
3371,
10756,
2934,
6363,
1318,
18,
588,
4576,
5537,
87,
5621,
203,
1082,
202,
1884,
261,
4576,
5537,
12423,
294,
3018,
5537,
87,
13,
288,
203,
9506,
202,
430,
261,
9953,
18,
6363,
1276,
7145,
22,
3191,
502,
5544,
13,
288,
203,
6862,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
20308,
203,
202,
380,
1220,
1177,
6330,
7844,
309,
3068,
87,
1240,
326,
1967,
508,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
32575d8d7dafab052108a7f919d9c85d7232753b | iedadata/geomapapp | org/geomapapp/grid/GridDialog.java | [
"Apache-2.0"
] | Java | isDialogVisible | null | public boolean isDialogVisible() {
if ( dialog == null ) {
return false;
}
else {
return dialog.isVisible();
}
} | // Indicates whether the dialog is visible | Indicates whether the dialog is visible | [
"Indicates",
"whether",
"the",
"dialog",
"is",
"visible"
] | public boolean isDialogVisible() {
if ( dialog == null ) {
return false;
}
else {
return dialog.isVisible();
}
} | [
"public",
"boolean",
"isDialogVisible",
"(",
")",
"{",
"if",
"(",
"dialog",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"else",
"{",
"return",
"dialog",
".",
"isVisible",
"(",
")",
";",
"}",
"}"
] | Indicates whether the dialog is visible | [
"Indicates",
"whether",
"the",
"dialog",
"is",
"visible"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
1250,
353,
6353,
6207,
1435,
288,
203,
202,
202,
430,
261,
6176,
422,
446,
262,
288,
203,
1082,
202,
2463,
629,
31,
203,
202,
202,
97,
203,
202,
202,
12107,
288,
203,
1082,
202,
2463,
6176,
18,
291,
6207,
5621,
203,
202,
202,
97,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
759,
18336,
2856,
326,
6176,
353,
6021,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
32575d8d7dafab052108a7f919d9c85d7232753b | iedadata/geomapapp | org/geomapapp/grid/GridDialog.java | [
"Apache-2.0"
] | Java | zoomTo | null | void zoomTo() {
Grid2DOverlay grid = (Grid2DOverlay)gridCB.getSelectedItem();
if( grid==null ) {
System.out.println("null");
return;
}
MultiGrid tempMGrid = ((MultiGrid)mGrids.get( grid ));
XMap m = grid.getMap();
try {
Rectangle2D.Double rect = null;
Rectangle2D shape = (Rectangle2D)tempMGrid.shape.getShapes().get( 0 );
double w = shape.getWidth();
double h = shape.getHeight();
rect = new Rectangle2D.Double( shape.getX()-.25*w, shape.getY()-.25*h, w*1.5, h*1.5 );
// Tracks zoom before, does zoom, tracks zoom after
m.setZoomHistoryPast(m);
m.zoomToRect( rect );
m.setZoomHistoryNext(m);
m.repaint();
} catch(Exception e) {}
} | /*
* Based on GridLayerDialog.zoomTo() for contributed grids
*/ | Based on GridLayerDialog.zoomTo() for contributed grids | [
"Based",
"on",
"GridLayerDialog",
".",
"zoomTo",
"()",
"for",
"contributed",
"grids"
] | void zoomTo() {
Grid2DOverlay grid = (Grid2DOverlay)gridCB.getSelectedItem();
if( grid==null ) {
System.out.println("null");
return;
}
MultiGrid tempMGrid = ((MultiGrid)mGrids.get( grid ));
XMap m = grid.getMap();
try {
Rectangle2D.Double rect = null;
Rectangle2D shape = (Rectangle2D)tempMGrid.shape.getShapes().get( 0 );
double w = shape.getWidth();
double h = shape.getHeight();
rect = new Rectangle2D.Double( shape.getX()-.25*w, shape.getY()-.25*h, w*1.5, h*1.5 );
m.setZoomHistoryPast(m);
m.zoomToRect( rect );
m.setZoomHistoryNext(m);
m.repaint();
} catch(Exception e) {}
} | [
"void",
"zoomTo",
"(",
")",
"{",
"Grid2DOverlay",
"grid",
"=",
"(",
"Grid2DOverlay",
")",
"gridCB",
".",
"getSelectedItem",
"(",
")",
";",
"if",
"(",
"grid",
"==",
"null",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"null\"",
")",
";",
"return",
";",
"}",
"MultiGrid",
"tempMGrid",
"=",
"(",
"(",
"MultiGrid",
")",
"mGrids",
".",
"get",
"(",
"grid",
")",
")",
";",
"XMap",
"m",
"=",
"grid",
".",
"getMap",
"(",
")",
";",
"try",
"{",
"Rectangle2D",
".",
"Double",
"rect",
"=",
"null",
";",
"Rectangle2D",
"shape",
"=",
"(",
"Rectangle2D",
")",
"tempMGrid",
".",
"shape",
".",
"getShapes",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"double",
"w",
"=",
"shape",
".",
"getWidth",
"(",
")",
";",
"double",
"h",
"=",
"shape",
".",
"getHeight",
"(",
")",
";",
"rect",
"=",
"new",
"Rectangle2D",
".",
"Double",
"(",
"shape",
".",
"getX",
"(",
")",
"-",
".25",
"*",
"w",
",",
"shape",
".",
"getY",
"(",
")",
"-",
".25",
"*",
"h",
",",
"w",
"*",
"1.5",
",",
"h",
"*",
"1.5",
")",
";",
"m",
".",
"setZoomHistoryPast",
"(",
"m",
")",
";",
"m",
".",
"zoomToRect",
"(",
"rect",
")",
";",
"m",
".",
"setZoomHistoryNext",
"(",
"m",
")",
";",
"m",
".",
"repaint",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"}",
"}"
] | Based on GridLayerDialog.zoomTo() for contributed grids | [
"Based",
"on",
"GridLayerDialog",
".",
"zoomTo",
"()",
"for",
"contributed",
"grids"
] | [
"// Tracks zoom before, does zoom, tracks zoom after"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
918,
7182,
774,
1435,
288,
203,
202,
202,
6313,
22,
3191,
502,
5544,
3068,
273,
261,
6313,
22,
3191,
502,
5544,
13,
5222,
8876,
18,
588,
7416,
1180,
5621,
203,
202,
202,
430,
12,
3068,
631,
2011,
262,
288,
203,
1082,
202,
3163,
18,
659,
18,
8222,
2932,
2011,
8863,
203,
1082,
202,
2463,
31,
203,
202,
202,
97,
203,
202,
202,
5002,
6313,
1906,
49,
6313,
273,
14015,
5002,
6313,
13,
81,
6313,
87,
18,
588,
12,
3068,
262,
1769,
203,
202,
202,
60,
863,
312,
273,
3068,
18,
588,
863,
5621,
203,
202,
202,
698,
288,
203,
1082,
202,
19463,
22,
40,
18,
5265,
4917,
273,
446,
31,
203,
1082,
202,
19463,
22,
40,
2179,
273,
261,
19463,
22,
40,
13,
5814,
49,
6313,
18,
4867,
18,
588,
30080,
7675,
588,
12,
374,
11272,
203,
1082,
202,
9056,
341,
273,
2179,
18,
588,
2384,
5621,
203,
1082,
202,
9056,
366,
273,
2179,
18,
588,
2686,
5621,
203,
1082,
202,
2607,
273,
394,
13264,
22,
40,
18,
5265,
12,
2179,
18,
588,
60,
1435,
17,
18,
2947,
14,
91,
16,
2179,
18,
588,
61,
1435,
17,
18,
2947,
14,
76,
16,
341,
14,
21,
18,
25,
16,
366,
14,
21,
18,
25,
11272,
203,
1082,
202,
759,
11065,
87,
7182,
1865,
16,
1552,
7182,
16,
13933,
7182,
1839,
203,
1082,
202,
81,
18,
542,
11497,
5623,
52,
689,
12,
81,
1769,
203,
1082,
202,
81,
18,
14932,
774,
6120,
12,
4917,
11272,
203,
1082,
202,
81,
18,
542,
11497,
5623,
2134,
12,
81,
1769,
203,
1082,
202,
81,
18,
14462,
1598,
5621,
203,
202,
202,
97,
1044,
12,
503,
425,
13,
2618,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0
] | [
1,
20308,
203,
202,
380,
25935,
603,
7145,
4576,
6353,
18,
14932,
774,
1435,
364,
356,
11050,
3068,
87,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
32575d8d7dafab052108a7f919d9c85d7232753b | iedadata/geomapapp | org/geomapapp/grid/GridDialog.java | [
"Apache-2.0"
] | Java | refreshGrid | null | public void refreshGrid(ESRIShapefile shape) {
if( gridCB.getItemCount()==0 )return;
for ( int i = 0; i < gridCB.getItemCount(); i++ ) {
final Grid2DOverlay grid = (Grid2DOverlay)gridCB.getItemAt(i);
if (grid != null && isContributedGrid(grid.name) && ((MultiGrid)mGrids.get(grid)).shape != null) {
if ( shape.equals(((MultiGrid)mGrids.get(grid)).shape) ) {
final XMap map = grid.getMap();
MapApp app = ((MapApp) map.getApp());
app.addProcessingTask(grid.toString(), new Runnable() {
public void run() {
boolean merc = map.getProjection() instanceof haxby.proj.Mercator;
int res=2;
while( res < map.getZoom()*1.4 ) res *= 2;
Grid2D grd;
if (merc)
grd = ((MultiGrid)mGrids.get( grid )).getGrid( res, map.getClipRect2D());
else {
boolean southPole =
((PolarStereo) map.getProjection()).getHemisphere() == PolarStereo.SOUTH;
grd = ((MultiGrid)mGrids.get( grid )).getGridPolar(res, map.getClipRect2D(), southPole);
}
if ( grd != null ) {
Rectangle r = grd.getBounds();
Grid2D.Boolean land = new Grid2D.Boolean( r, grd.getProjection() );
boolean hasLand = false;
boolean hasOcean = false;
for( int y=r.y ; y<r.y+r.height ; y++) {
for( int x=r.x ; x<r.x+r.width ; x++) {
double val = grd.valueAt(x,y);
if( Double.isNaN(val) )continue;
if( val>=0. ) {
hasLand=true;
land.setValue( x, y, true);
} else hasOcean=true;
}
}
grid.setGrid( grd, land, hasLand, hasOcean);
if (grid.lut.contourB.isSelected()) {
grid.contour.contour(grid.interval, grid.bolding_interval, grid.cb);
grid.contour.setVisible(true);
}
switchPanel();
loaded = true;
}
map.repaint();
}
});
}
return;
}
}
} | /*
* Based on GridLayerDialog.refershGrid for contributed grids
*/ | Based on GridLayerDialog.refershGrid for contributed grids | [
"Based",
"on",
"GridLayerDialog",
".",
"refershGrid",
"for",
"contributed",
"grids"
] | public void refreshGrid(ESRIShapefile shape) {
if( gridCB.getItemCount()==0 )return;
for ( int i = 0; i < gridCB.getItemCount(); i++ ) {
final Grid2DOverlay grid = (Grid2DOverlay)gridCB.getItemAt(i);
if (grid != null && isContributedGrid(grid.name) && ((MultiGrid)mGrids.get(grid)).shape != null) {
if ( shape.equals(((MultiGrid)mGrids.get(grid)).shape) ) {
final XMap map = grid.getMap();
MapApp app = ((MapApp) map.getApp());
app.addProcessingTask(grid.toString(), new Runnable() {
public void run() {
boolean merc = map.getProjection() instanceof haxby.proj.Mercator;
int res=2;
while( res < map.getZoom()*1.4 ) res *= 2;
Grid2D grd;
if (merc)
grd = ((MultiGrid)mGrids.get( grid )).getGrid( res, map.getClipRect2D());
else {
boolean southPole =
((PolarStereo) map.getProjection()).getHemisphere() == PolarStereo.SOUTH;
grd = ((MultiGrid)mGrids.get( grid )).getGridPolar(res, map.getClipRect2D(), southPole);
}
if ( grd != null ) {
Rectangle r = grd.getBounds();
Grid2D.Boolean land = new Grid2D.Boolean( r, grd.getProjection() );
boolean hasLand = false;
boolean hasOcean = false;
for( int y=r.y ; y<r.y+r.height ; y++) {
for( int x=r.x ; x<r.x+r.width ; x++) {
double val = grd.valueAt(x,y);
if( Double.isNaN(val) )continue;
if( val>=0. ) {
hasLand=true;
land.setValue( x, y, true);
} else hasOcean=true;
}
}
grid.setGrid( grd, land, hasLand, hasOcean);
if (grid.lut.contourB.isSelected()) {
grid.contour.contour(grid.interval, grid.bolding_interval, grid.cb);
grid.contour.setVisible(true);
}
switchPanel();
loaded = true;
}
map.repaint();
}
});
}
return;
}
}
} | [
"public",
"void",
"refreshGrid",
"(",
"ESRIShapefile",
"shape",
")",
"{",
"if",
"(",
"gridCB",
".",
"getItemCount",
"(",
")",
"==",
"0",
")",
"return",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"gridCB",
".",
"getItemCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"final",
"Grid2DOverlay",
"grid",
"=",
"(",
"Grid2DOverlay",
")",
"gridCB",
".",
"getItemAt",
"(",
"i",
")",
";",
"if",
"(",
"grid",
"!=",
"null",
"&&",
"isContributedGrid",
"(",
"grid",
".",
"name",
")",
"&&",
"(",
"(",
"MultiGrid",
")",
"mGrids",
".",
"get",
"(",
"grid",
")",
")",
".",
"shape",
"!=",
"null",
")",
"{",
"if",
"(",
"shape",
".",
"equals",
"(",
"(",
"(",
"MultiGrid",
")",
"mGrids",
".",
"get",
"(",
"grid",
")",
")",
".",
"shape",
")",
")",
"{",
"final",
"XMap",
"map",
"=",
"grid",
".",
"getMap",
"(",
")",
";",
"MapApp",
"app",
"=",
"(",
"(",
"MapApp",
")",
"map",
".",
"getApp",
"(",
")",
")",
";",
"app",
".",
"addProcessingTask",
"(",
"grid",
".",
"toString",
"(",
")",
",",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"boolean",
"merc",
"=",
"map",
".",
"getProjection",
"(",
")",
"instanceof",
"haxby",
".",
"proj",
".",
"Mercator",
";",
"int",
"res",
"=",
"2",
";",
"while",
"(",
"res",
"<",
"map",
".",
"getZoom",
"(",
")",
"*",
"1.4",
")",
"res",
"*=",
"2",
";",
"Grid2D",
"grd",
";",
"if",
"(",
"merc",
")",
"grd",
"=",
"(",
"(",
"MultiGrid",
")",
"mGrids",
".",
"get",
"(",
"grid",
")",
")",
".",
"getGrid",
"(",
"res",
",",
"map",
".",
"getClipRect2D",
"(",
")",
")",
";",
"else",
"{",
"boolean",
"southPole",
"=",
"(",
"(",
"PolarStereo",
")",
"map",
".",
"getProjection",
"(",
")",
")",
".",
"getHemisphere",
"(",
")",
"==",
"PolarStereo",
".",
"SOUTH",
";",
"grd",
"=",
"(",
"(",
"MultiGrid",
")",
"mGrids",
".",
"get",
"(",
"grid",
")",
")",
".",
"getGridPolar",
"(",
"res",
",",
"map",
".",
"getClipRect2D",
"(",
")",
",",
"southPole",
")",
";",
"}",
"if",
"(",
"grd",
"!=",
"null",
")",
"{",
"Rectangle",
"r",
"=",
"grd",
".",
"getBounds",
"(",
")",
";",
"Grid2D",
".",
"Boolean",
"land",
"=",
"new",
"Grid2D",
".",
"Boolean",
"(",
"r",
",",
"grd",
".",
"getProjection",
"(",
")",
")",
";",
"boolean",
"hasLand",
"=",
"false",
";",
"boolean",
"hasOcean",
"=",
"false",
";",
"for",
"(",
"int",
"y",
"=",
"r",
".",
"y",
";",
"y",
"<",
"r",
".",
"y",
"+",
"r",
".",
"height",
";",
"y",
"++",
")",
"{",
"for",
"(",
"int",
"x",
"=",
"r",
".",
"x",
";",
"x",
"<",
"r",
".",
"x",
"+",
"r",
".",
"width",
";",
"x",
"++",
")",
"{",
"double",
"val",
"=",
"grd",
".",
"valueAt",
"(",
"x",
",",
"y",
")",
";",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"val",
")",
")",
"continue",
";",
"if",
"(",
"val",
">=",
"0.",
")",
"{",
"hasLand",
"=",
"true",
";",
"land",
".",
"setValue",
"(",
"x",
",",
"y",
",",
"true",
")",
";",
"}",
"else",
"hasOcean",
"=",
"true",
";",
"}",
"}",
"grid",
".",
"setGrid",
"(",
"grd",
",",
"land",
",",
"hasLand",
",",
"hasOcean",
")",
";",
"if",
"(",
"grid",
".",
"lut",
".",
"contourB",
".",
"isSelected",
"(",
")",
")",
"{",
"grid",
".",
"contour",
".",
"contour",
"(",
"grid",
".",
"interval",
",",
"grid",
".",
"bolding_interval",
",",
"grid",
".",
"cb",
")",
";",
"grid",
".",
"contour",
".",
"setVisible",
"(",
"true",
")",
";",
"}",
"switchPanel",
"(",
")",
";",
"loaded",
"=",
"true",
";",
"}",
"map",
".",
"repaint",
"(",
")",
";",
"}",
"}",
")",
";",
"}",
"return",
";",
"}",
"}",
"}"
] | Based on GridLayerDialog.refershGrid for contributed grids | [
"Based",
"on",
"GridLayerDialog",
".",
"refershGrid",
"for",
"contributed",
"grids"
] | [] | [
{
"param": "shape",
"type": "ESRIShapefile"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "shape",
"type": "ESRIShapefile",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
4460,
6313,
12,
3991,
2259,
8500,
768,
2179,
13,
288,
203,
202,
202,
430,
12,
3068,
8876,
18,
588,
30687,
1435,
631,
20,
262,
2463,
31,
203,
202,
202,
1884,
261,
509,
277,
273,
374,
31,
277,
411,
3068,
8876,
18,
588,
30687,
5621,
277,
9904,
262,
288,
203,
1082,
202,
6385,
7145,
22,
3191,
502,
5544,
3068,
273,
261,
6313,
22,
3191,
502,
5544,
13,
5222,
8876,
18,
588,
1180,
861,
12,
77,
1769,
203,
1082,
202,
430,
261,
5222,
480,
446,
597,
353,
442,
11050,
6313,
12,
5222,
18,
529,
13,
597,
14015,
5002,
6313,
13,
81,
6313,
87,
18,
588,
12,
5222,
13,
2934,
4867,
480,
446,
13,
288,
203,
9506,
202,
430,
261,
2179,
18,
14963,
12443,
12,
5002,
6313,
13,
81,
6313,
87,
18,
588,
12,
5222,
13,
2934,
4867,
13,
262,
288,
203,
6862,
202,
6385,
1139,
863,
852,
273,
3068,
18,
588,
863,
5621,
203,
6862,
202,
863,
3371,
595,
273,
14015,
863,
3371,
13,
852,
18,
588,
3371,
10663,
203,
203,
6862,
202,
2910,
18,
1289,
7798,
2174,
12,
5222,
18,
10492,
9334,
394,
10254,
1435,
288,
203,
25083,
202,
482,
918,
1086,
1435,
288,
203,
6862,
1082,
202,
6494,
4045,
71,
273,
225,
852,
18,
588,
14789,
1435,
1276,
366,
651,
1637,
18,
17995,
18,
8478,
71,
639,
31,
203,
6862,
1082,
202,
474,
400,
33,
22,
31,
203,
6862,
1082,
202,
17523,
12,
400,
411,
852,
18,
588,
11497,
1435,
14,
21,
18,
24,
262,
400,
6413,
576,
31,
203,
203,
6862,
1082,
202,
6313,
22,
40,
3821,
72,
31,
203,
6862,
1082,
202,
430,
261,
6592,
71,
13,
203,
6862,
9506,
202,
3197,
72,
273,
14015,
5002,
6313,
13,
81,
6313,
87,
18,
588,
12,
3068,
262,
2934,
588,
6313,
12,
400,
16,
852,
18,
588,
15339,
6120,
22,
40,
10663,
203,
6862,
1082,
202,
12107,
288,
203,
6862,
9506,
202,
6494,
24516,
52,
790,
273,
203,
6862,
6862,
202,
12443,
5850,
297,
55,
22854,
13,
852,
18,
588,
14789,
1435,
2934,
588,
44,
351,
291,
9346,
1435,
422,
6730,
297,
55,
22854,
18,
3584,
5844,
31,
203,
6862,
9506,
202,
3197,
72,
273,
14015,
5002,
6313,
13,
81,
6313,
87,
18,
588,
12,
3068,
262,
2934,
588,
6313,
5850,
297,
12,
455,
16,
852,
18,
588,
15339,
6120,
22,
40,
9334,
24516,
52,
790,
1769,
203,
6862,
1082,
202,
97,
203,
203,
6862,
1082,
202,
430,
261,
3821,
72,
480,
446,
262,
288,
203,
6862,
9506,
202,
19463,
436,
273,
3821,
72,
18,
588,
5694,
5621,
203,
6862,
9506,
202,
6313,
22,
40,
18,
5507,
19193,
273,
394,
7145,
22,
40,
18,
5507,
12,
436,
16,
3821,
72,
18,
588,
14789,
1435,
11272,
203,
6862,
9506,
202,
6494,
711,
29398,
273,
629,
31,
203,
6862,
9506,
202,
6494,
711,
51,
31393,
273,
629,
31,
203,
203,
6862,
9506,
202,
1884,
12,
509,
677,
33,
86,
18,
93,
274,
677,
32,
86,
18,
93,
15,
86,
18,
4210,
274,
677,
27245,
288,
203,
6862,
6862,
202,
1884,
12,
509,
619,
33,
86,
18,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
20308,
203,
202,
380,
25935,
603,
7145,
4576,
6353,
18,
1734,
414,
76,
6313,
364,
356,
11050,
3068,
87,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
32575d8d7dafab052108a7f919d9c85d7232753b | iedadata/geomapapp | org/geomapapp/grid/GridDialog.java | [
"Apache-2.0"
] | Java | refreshGrids | null | public void refreshGrids() {
if( gridCB.getItemCount()==0 )return;
for ( int i = 0; i < gridCB.getItemCount(); i++ ) {
final Grid2DOverlay grid = (Grid2DOverlay)gridCB.getItemAt(i);
final XMap map = grid.getMap();
MapApp app = ((MapApp) map.getApp());
if (grid == null ||!app.layerManager.getLayerVisibleDefaultFalse(grid)) continue;
app.addProcessingTask(grid.toString(), new Runnable() {
public void run() {
boolean merc = map.getProjection() instanceof haxby.proj.Mercator;
if (!isContributedGrid(grid.name)) {
//global grids
if( !merc && !grid.toString().equals(GridDialog.DEV) && !(grid instanceof CruiseGridViewer)) {
int which = ((MapApp) map.getApp()).getMapType();
if (which == MapApp.SOUTH_POLAR_MAP)
GridComposer.getGridSP(map.getClipRect2D(), grid, 512);
else if (which == MapApp.NORTH_POLAR_MAP)
GridComposer.getGridNP(map.getClipRect2D(), grid, 512);
} else {
GRID_LOADERS.get(grid.toString()).loadGrid(grid);
switchPanel();
}
if (grid.lut.contourB.isSelected()) {
grid.contour.contour(grid.interval, grid.bolding_interval, grid.cb);
grid.contour.setVisible(true);
}
map.repaint();
} else {
//contributed grids
int res=2;
while( res < map.getZoom()*1.4 ) res *= 2;
Grid2D grd;
if (merc)
grd = ((MultiGrid)mGrids.get( grid )).getGrid( res, map.getClipRect2D());
else {
boolean southPole =
((PolarStereo) map.getProjection()).getHemisphere() == PolarStereo.SOUTH;
grd = ((MultiGrid)mGrids.get( grid )).getGridPolar(res, map.getClipRect2D(), southPole);
}
if ( grd != null ) {
Rectangle r = grd.getBounds();
Grid2D.Boolean land = new Grid2D.Boolean( r, grd.getProjection() );
boolean hasLand = false;
boolean hasOcean = false;
for( int y=r.y ; y<r.y+r.height ; y++) {
for( int x=r.x ; x<r.x+r.width ; x++) {
double val = grd.valueAt(x,y);
if( Double.isNaN(val) )continue;
if( val>=0. ) {
hasLand=true;
land.setValue( x, y, true);
} else hasOcean=true;
}
}
grid.setGrid( grd, land, hasLand, hasOcean);
if (grid.lut.contourB.isSelected()) {
grid.contour.contour(grid.interval, grid.bolding_interval, grid.cb);
grid.contour.setVisible(true);
}
switchPanel();
loaded = true;
map.repaint();
System.gc();
}
}
}
});
}
} | /*
* Based on GridLayerDialog.refreshGrids() for contributed grids
*/ | Based on GridLayerDialog.refreshGrids() for contributed grids | [
"Based",
"on",
"GridLayerDialog",
".",
"refreshGrids",
"()",
"for",
"contributed",
"grids"
] | public void refreshGrids() {
if( gridCB.getItemCount()==0 )return;
for ( int i = 0; i < gridCB.getItemCount(); i++ ) {
final Grid2DOverlay grid = (Grid2DOverlay)gridCB.getItemAt(i);
final XMap map = grid.getMap();
MapApp app = ((MapApp) map.getApp());
if (grid == null ||!app.layerManager.getLayerVisibleDefaultFalse(grid)) continue;
app.addProcessingTask(grid.toString(), new Runnable() {
public void run() {
boolean merc = map.getProjection() instanceof haxby.proj.Mercator;
if (!isContributedGrid(grid.name)) {
if( !merc && !grid.toString().equals(GridDialog.DEV) && !(grid instanceof CruiseGridViewer)) {
int which = ((MapApp) map.getApp()).getMapType();
if (which == MapApp.SOUTH_POLAR_MAP)
GridComposer.getGridSP(map.getClipRect2D(), grid, 512);
else if (which == MapApp.NORTH_POLAR_MAP)
GridComposer.getGridNP(map.getClipRect2D(), grid, 512);
} else {
GRID_LOADERS.get(grid.toString()).loadGrid(grid);
switchPanel();
}
if (grid.lut.contourB.isSelected()) {
grid.contour.contour(grid.interval, grid.bolding_interval, grid.cb);
grid.contour.setVisible(true);
}
map.repaint();
} else {
int res=2;
while( res < map.getZoom()*1.4 ) res *= 2;
Grid2D grd;
if (merc)
grd = ((MultiGrid)mGrids.get( grid )).getGrid( res, map.getClipRect2D());
else {
boolean southPole =
((PolarStereo) map.getProjection()).getHemisphere() == PolarStereo.SOUTH;
grd = ((MultiGrid)mGrids.get( grid )).getGridPolar(res, map.getClipRect2D(), southPole);
}
if ( grd != null ) {
Rectangle r = grd.getBounds();
Grid2D.Boolean land = new Grid2D.Boolean( r, grd.getProjection() );
boolean hasLand = false;
boolean hasOcean = false;
for( int y=r.y ; y<r.y+r.height ; y++) {
for( int x=r.x ; x<r.x+r.width ; x++) {
double val = grd.valueAt(x,y);
if( Double.isNaN(val) )continue;
if( val>=0. ) {
hasLand=true;
land.setValue( x, y, true);
} else hasOcean=true;
}
}
grid.setGrid( grd, land, hasLand, hasOcean);
if (grid.lut.contourB.isSelected()) {
grid.contour.contour(grid.interval, grid.bolding_interval, grid.cb);
grid.contour.setVisible(true);
}
switchPanel();
loaded = true;
map.repaint();
System.gc();
}
}
}
});
}
} | [
"public",
"void",
"refreshGrids",
"(",
")",
"{",
"if",
"(",
"gridCB",
".",
"getItemCount",
"(",
")",
"==",
"0",
")",
"return",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"gridCB",
".",
"getItemCount",
"(",
")",
";",
"i",
"++",
")",
"{",
"final",
"Grid2DOverlay",
"grid",
"=",
"(",
"Grid2DOverlay",
")",
"gridCB",
".",
"getItemAt",
"(",
"i",
")",
";",
"final",
"XMap",
"map",
"=",
"grid",
".",
"getMap",
"(",
")",
";",
"MapApp",
"app",
"=",
"(",
"(",
"MapApp",
")",
"map",
".",
"getApp",
"(",
")",
")",
";",
"if",
"(",
"grid",
"==",
"null",
"||",
"!",
"app",
".",
"layerManager",
".",
"getLayerVisibleDefaultFalse",
"(",
"grid",
")",
")",
"continue",
";",
"app",
".",
"addProcessingTask",
"(",
"grid",
".",
"toString",
"(",
")",
",",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"boolean",
"merc",
"=",
"map",
".",
"getProjection",
"(",
")",
"instanceof",
"haxby",
".",
"proj",
".",
"Mercator",
";",
"if",
"(",
"!",
"isContributedGrid",
"(",
"grid",
".",
"name",
")",
")",
"{",
"if",
"(",
"!",
"merc",
"&&",
"!",
"grid",
".",
"toString",
"(",
")",
".",
"equals",
"(",
"GridDialog",
".",
"DEV",
")",
"&&",
"!",
"(",
"grid",
"instanceof",
"CruiseGridViewer",
")",
")",
"{",
"int",
"which",
"=",
"(",
"(",
"MapApp",
")",
"map",
".",
"getApp",
"(",
")",
")",
".",
"getMapType",
"(",
")",
";",
"if",
"(",
"which",
"==",
"MapApp",
".",
"SOUTH_POLAR_MAP",
")",
"GridComposer",
".",
"getGridSP",
"(",
"map",
".",
"getClipRect2D",
"(",
")",
",",
"grid",
",",
"512",
")",
";",
"else",
"if",
"(",
"which",
"==",
"MapApp",
".",
"NORTH_POLAR_MAP",
")",
"GridComposer",
".",
"getGridNP",
"(",
"map",
".",
"getClipRect2D",
"(",
")",
",",
"grid",
",",
"512",
")",
";",
"}",
"else",
"{",
"GRID_LOADERS",
".",
"get",
"(",
"grid",
".",
"toString",
"(",
")",
")",
".",
"loadGrid",
"(",
"grid",
")",
";",
"switchPanel",
"(",
")",
";",
"}",
"if",
"(",
"grid",
".",
"lut",
".",
"contourB",
".",
"isSelected",
"(",
")",
")",
"{",
"grid",
".",
"contour",
".",
"contour",
"(",
"grid",
".",
"interval",
",",
"grid",
".",
"bolding_interval",
",",
"grid",
".",
"cb",
")",
";",
"grid",
".",
"contour",
".",
"setVisible",
"(",
"true",
")",
";",
"}",
"map",
".",
"repaint",
"(",
")",
";",
"}",
"else",
"{",
"int",
"res",
"=",
"2",
";",
"while",
"(",
"res",
"<",
"map",
".",
"getZoom",
"(",
")",
"*",
"1.4",
")",
"res",
"*=",
"2",
";",
"Grid2D",
"grd",
";",
"if",
"(",
"merc",
")",
"grd",
"=",
"(",
"(",
"MultiGrid",
")",
"mGrids",
".",
"get",
"(",
"grid",
")",
")",
".",
"getGrid",
"(",
"res",
",",
"map",
".",
"getClipRect2D",
"(",
")",
")",
";",
"else",
"{",
"boolean",
"southPole",
"=",
"(",
"(",
"PolarStereo",
")",
"map",
".",
"getProjection",
"(",
")",
")",
".",
"getHemisphere",
"(",
")",
"==",
"PolarStereo",
".",
"SOUTH",
";",
"grd",
"=",
"(",
"(",
"MultiGrid",
")",
"mGrids",
".",
"get",
"(",
"grid",
")",
")",
".",
"getGridPolar",
"(",
"res",
",",
"map",
".",
"getClipRect2D",
"(",
")",
",",
"southPole",
")",
";",
"}",
"if",
"(",
"grd",
"!=",
"null",
")",
"{",
"Rectangle",
"r",
"=",
"grd",
".",
"getBounds",
"(",
")",
";",
"Grid2D",
".",
"Boolean",
"land",
"=",
"new",
"Grid2D",
".",
"Boolean",
"(",
"r",
",",
"grd",
".",
"getProjection",
"(",
")",
")",
";",
"boolean",
"hasLand",
"=",
"false",
";",
"boolean",
"hasOcean",
"=",
"false",
";",
"for",
"(",
"int",
"y",
"=",
"r",
".",
"y",
";",
"y",
"<",
"r",
".",
"y",
"+",
"r",
".",
"height",
";",
"y",
"++",
")",
"{",
"for",
"(",
"int",
"x",
"=",
"r",
".",
"x",
";",
"x",
"<",
"r",
".",
"x",
"+",
"r",
".",
"width",
";",
"x",
"++",
")",
"{",
"double",
"val",
"=",
"grd",
".",
"valueAt",
"(",
"x",
",",
"y",
")",
";",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"val",
")",
")",
"continue",
";",
"if",
"(",
"val",
">=",
"0.",
")",
"{",
"hasLand",
"=",
"true",
";",
"land",
".",
"setValue",
"(",
"x",
",",
"y",
",",
"true",
")",
";",
"}",
"else",
"hasOcean",
"=",
"true",
";",
"}",
"}",
"grid",
".",
"setGrid",
"(",
"grd",
",",
"land",
",",
"hasLand",
",",
"hasOcean",
")",
";",
"if",
"(",
"grid",
".",
"lut",
".",
"contourB",
".",
"isSelected",
"(",
")",
")",
"{",
"grid",
".",
"contour",
".",
"contour",
"(",
"grid",
".",
"interval",
",",
"grid",
".",
"bolding_interval",
",",
"grid",
".",
"cb",
")",
";",
"grid",
".",
"contour",
".",
"setVisible",
"(",
"true",
")",
";",
"}",
"switchPanel",
"(",
")",
";",
"loaded",
"=",
"true",
";",
"map",
".",
"repaint",
"(",
")",
";",
"System",
".",
"gc",
"(",
")",
";",
"}",
"}",
"}",
"}",
")",
";",
"}",
"}"
] | Based on GridLayerDialog.refreshGrids() for contributed grids | [
"Based",
"on",
"GridLayerDialog",
".",
"refreshGrids",
"()",
"for",
"contributed",
"grids"
] | [
"//global grids",
"//contributed grids"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
4460,
6313,
87,
1435,
288,
203,
202,
202,
430,
12,
3068,
8876,
18,
588,
30687,
1435,
631,
20,
262,
2463,
31,
203,
202,
202,
1884,
261,
509,
277,
273,
374,
31,
277,
411,
3068,
8876,
18,
588,
30687,
5621,
277,
9904,
262,
288,
203,
1082,
202,
6385,
7145,
22,
3191,
502,
5544,
3068,
273,
261,
6313,
22,
3191,
502,
5544,
13,
5222,
8876,
18,
588,
1180,
861,
12,
77,
1769,
203,
1082,
202,
6385,
1139,
863,
852,
273,
3068,
18,
588,
863,
5621,
203,
1082,
202,
863,
3371,
595,
273,
14015,
863,
3371,
13,
852,
18,
588,
3371,
10663,
203,
203,
1082,
202,
430,
261,
5222,
422,
446,
747,
5,
2910,
18,
6363,
1318,
18,
588,
4576,
6207,
1868,
8381,
12,
5222,
3719,
1324,
31,
203,
203,
1082,
202,
2910,
18,
1289,
7798,
2174,
12,
5222,
18,
10492,
9334,
394,
10254,
1435,
288,
203,
9506,
202,
482,
918,
1086,
1435,
288,
202,
203,
6862,
202,
6494,
4045,
71,
273,
225,
852,
18,
588,
14789,
1435,
1276,
366,
651,
1637,
18,
17995,
18,
8478,
71,
639,
31,
203,
6862,
202,
430,
16051,
291,
442,
11050,
6313,
12,
5222,
18,
529,
3719,
288,
203,
25083,
202,
759,
6347,
3068,
87,
203,
25083,
202,
430,
12,
401,
6592,
71,
597,
401,
5222,
18,
10492,
7675,
14963,
12,
6313,
6353,
18,
15301,
13,
597,
401,
12,
5222,
1276,
385,
8653,
784,
6313,
18415,
3719,
288,
203,
6862,
1082,
202,
474,
1492,
273,
14015,
863,
3371,
13,
852,
18,
588,
3371,
1435,
2934,
588,
863,
559,
5621,
203,
6862,
1082,
202,
430,
261,
12784,
422,
1635,
3371,
18,
3584,
5844,
67,
14232,
985,
67,
8352,
13,
203,
6862,
9506,
202,
6313,
14404,
18,
588,
6313,
3118,
12,
1458,
18,
588,
15339,
6120,
22,
40,
9334,
3068,
16,
13908,
1769,
203,
6862,
1082,
202,
12107,
309,
261,
12784,
422,
1635,
3371,
18,
50,
28212,
67,
14232,
985,
67,
8352,
13,
203,
6862,
9506,
202,
6313,
14404,
18,
588,
6313,
23430,
12,
1458,
18,
588,
15339,
6120,
22,
40,
9334,
3068,
16,
13908,
1769,
203,
203,
25083,
202,
97,
469,
288,
203,
6862,
1082,
202,
6997,
734,
67,
1502,
5483,
55,
18,
588,
12,
5222,
18,
10492,
1435,
2934,
945,
6313,
12,
5222,
1769,
203,
6862,
1082,
202,
9610,
5537,
5621,
203,
25083,
202,
97,
203,
25083,
202,
430,
261,
5222,
18,
80,
322,
18,
1213,
477,
38,
18,
291,
7416,
10756,
288,
203,
6862,
1082,
202,
5222,
18,
1213,
477,
18,
1213,
477,
12,
5222,
18,
6624,
16,
3068,
18,
16390,
310,
67,
6624,
16,
3068,
18,
7358,
1769,
203,
6862,
1082,
202,
5222,
18,
1213,
477,
18,
542,
6207,
12,
3767,
1769,
203,
25083,
202,
97,
203,
25083,
202,
1458,
18,
14462,
1598,
5621,
203,
6862,
202,
97,
469,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
20308,
203,
202,
380,
25935,
603,
7145,
4576,
6353,
18,
9144,
6313,
87,
1435,
364,
356,
11050,
3068,
87,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
028967a5d0a23a8b428fbec632f958a1f00d1f7c | iedadata/geomapapp | haxby/worldwind/layers/dynamic_tiler/DynamicImageTileLayer.java | [
"Apache-2.0"
] | Java | compareTo | null | public int compareTo(RequestTask that)
{
if (that == null)
{
String msg = Logging.getMessage("nullValue.RequestTaskIsNull");
Logging.logger().log(java.util.logging.Level.FINE, msg);
throw new IllegalArgumentException(msg);
}
return this.tile.getPriority() == that.tile.getPriority() ? 0 :
this.tile.getPriority() < that.tile.getPriority() ? -1 : 1;
} | /**
* @param that the task to compare
* @return -1 if <code>this</code> less than <code>that</code>, 1 if greater than, 0 if equal
* @throws IllegalArgumentException if <code>that</code> is null
*/ | @param that the task to compare
@return -1 if this less than that, 1 if greater than, 0 if equal
@throws IllegalArgumentException if that is null | [
"@param",
"that",
"the",
"task",
"to",
"compare",
"@return",
"-",
"1",
"if",
"this",
"less",
"than",
"that",
"1",
"if",
"greater",
"than",
"0",
"if",
"equal",
"@throws",
"IllegalArgumentException",
"if",
"that",
"is",
"null"
] | public int compareTo(RequestTask that)
{
if (that == null)
{
String msg = Logging.getMessage("nullValue.RequestTaskIsNull");
Logging.logger().log(java.util.logging.Level.FINE, msg);
throw new IllegalArgumentException(msg);
}
return this.tile.getPriority() == that.tile.getPriority() ? 0 :
this.tile.getPriority() < that.tile.getPriority() ? -1 : 1;
} | [
"public",
"int",
"compareTo",
"(",
"RequestTask",
"that",
")",
"{",
"if",
"(",
"that",
"==",
"null",
")",
"{",
"String",
"msg",
"=",
"Logging",
".",
"getMessage",
"(",
"\"nullValue.RequestTaskIsNull\"",
")",
";",
"Logging",
".",
"logger",
"(",
")",
".",
"log",
"(",
"java",
".",
"util",
".",
"logging",
".",
"Level",
".",
"FINE",
",",
"msg",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"msg",
")",
";",
"}",
"return",
"this",
".",
"tile",
".",
"getPriority",
"(",
")",
"==",
"that",
".",
"tile",
".",
"getPriority",
"(",
")",
"?",
"0",
":",
"this",
".",
"tile",
".",
"getPriority",
"(",
")",
"<",
"that",
".",
"tile",
".",
"getPriority",
"(",
")",
"?",
"-",
"1",
":",
"1",
";",
"}"
] | @param that the task to compare
@return -1 if <code>this</code> less than <code>that</code>, 1 if greater than, 0 if equal
@throws IllegalArgumentException if <code>that</code> is null | [
"@param",
"that",
"the",
"task",
"to",
"compare",
"@return",
"-",
"1",
"if",
"<code",
">",
"this<",
"/",
"code",
">",
"less",
"than",
"<code",
">",
"that<",
"/",
"code",
">",
"1",
"if",
"greater",
"than",
"0",
"if",
"equal",
"@throws",
"IllegalArgumentException",
"if",
"<code",
">",
"that<",
"/",
"code",
">",
"is",
"null"
] | [] | [
{
"param": "that",
"type": "RequestTask"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "that",
"type": "RequestTask",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
509,
9292,
12,
691,
2174,
716,
13,
206,
203,
3639,
288,
206,
203,
5411,
309,
261,
19056,
422,
446,
13,
206,
203,
5411,
288,
206,
203,
7734,
514,
1234,
273,
10253,
18,
24906,
2932,
2011,
620,
18,
691,
2174,
2520,
2041,
8863,
206,
203,
7734,
10253,
18,
4901,
7675,
1330,
12,
6290,
18,
1367,
18,
11167,
18,
2355,
18,
42,
3740,
16,
1234,
1769,
206,
203,
7734,
604,
394,
2754,
12,
3576,
1769,
206,
203,
5411,
289,
206,
203,
5411,
327,
333,
18,
15368,
18,
588,
8183,
1435,
422,
716,
18,
15368,
18,
588,
8183,
1435,
692,
374,
294,
206,
203,
7734,
333,
18,
15368,
18,
588,
8183,
1435,
411,
716,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
206,
203,
540,
380,
632,
891,
716,
326,
1562,
358,
3400,
206,
203,
540,
380,
632,
2463,
300,
21,
309,
411,
710,
34,
2211,
1757,
710,
34,
5242,
2353,
411,
710,
34,
19056,
1757,
710,
20401,
404,
309,
6802,
2353,
16,
374,
309,
3959,
206,
203,
540,
380,
632,
15069,
2754,
309,
411,
710,
34,
19056,
1757,
710,
34,
353,
446,
206,
203,
540,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
34e57bb397fce21c3bad4c4020e71756dd4d7add | iedadata/geomapapp | org/geomapapp/grid/Interpolate2D.java | [
"Apache-2.0"
] | Java | cubicGMRT | null | public static double cubicGMRT(double[] z, int offset, double x) {
for(int i=offset ; i<offset+4 ; i++) {
if(Double.isNaN(z[i])) return Double.NaN;
}
double x1 = 1-x;
if( x<=-1. ) {
return z[offset] + (x+1.)*( -1.5*z[offset] +2.*z[offset+1] -z[offset+2]*.5);
} else if( x<=0. ) {
return z[offset+1] + x*.5 * (z[offset+2] - z[offset]
+ x * (z[offset+2] + z[offset] - 2*z[offset+1]));
} else if( x>=2. ) {
return z[offset+3] + (x-2.)*( .5*z[offset+1] -2.*z[offset+2] +1.5*z[offset+3]);
} else if( x>=1. ) {
return z[offset+2] + x1*.5 * (z[offset+1] - z[offset+3]
+ x1 * (z[offset+1] + z[offset+3] - 2*z[offset+2]));
}
double y = x1 * ( z[offset+1] +
x*.5 * (z[offset+2] - z[offset]
+ x * (z[offset+2] + z[offset] - 2*z[offset+1])))
+ x * (z[offset+2] +
x1*.5 * (z[offset+1] - z[offset+3]
+ x1 * (z[offset+1] + z[offset+3] - 2*z[offset+2])));
return y;
} | //use this version for the GMRT grid | use this version for the GMRT grid | [
"use",
"this",
"version",
"for",
"the",
"GMRT",
"grid"
] | public static double cubicGMRT(double[] z, int offset, double x) {
for(int i=offset ; i<offset+4 ; i++) {
if(Double.isNaN(z[i])) return Double.NaN;
}
double x1 = 1-x;
if( x<=-1. ) {
return z[offset] + (x+1.)*( -1.5*z[offset] +2.*z[offset+1] -z[offset+2]*.5);
} else if( x<=0. ) {
return z[offset+1] + x*.5 * (z[offset+2] - z[offset]
+ x * (z[offset+2] + z[offset] - 2*z[offset+1]));
} else if( x>=2. ) {
return z[offset+3] + (x-2.)*( .5*z[offset+1] -2.*z[offset+2] +1.5*z[offset+3]);
} else if( x>=1. ) {
return z[offset+2] + x1*.5 * (z[offset+1] - z[offset+3]
+ x1 * (z[offset+1] + z[offset+3] - 2*z[offset+2]));
}
double y = x1 * ( z[offset+1] +
x*.5 * (z[offset+2] - z[offset]
+ x * (z[offset+2] + z[offset] - 2*z[offset+1])))
+ x * (z[offset+2] +
x1*.5 * (z[offset+1] - z[offset+3]
+ x1 * (z[offset+1] + z[offset+3] - 2*z[offset+2])));
return y;
} | [
"public",
"static",
"double",
"cubicGMRT",
"(",
"double",
"[",
"]",
"z",
",",
"int",
"offset",
",",
"double",
"x",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"offset",
";",
"i",
"<",
"offset",
"+",
"4",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"z",
"[",
"i",
"]",
")",
")",
"return",
"Double",
".",
"NaN",
";",
"}",
"double",
"x1",
"=",
"1",
"-",
"x",
";",
"if",
"(",
"x",
"<=",
"-",
"1.",
")",
"{",
"return",
"z",
"[",
"offset",
"]",
"+",
"(",
"x",
"+",
"1.",
")",
"*",
"(",
"-",
"1.5",
"*",
"z",
"[",
"offset",
"]",
"+",
"2.",
"*",
"z",
"[",
"offset",
"+",
"1",
"]",
"-",
"z",
"[",
"offset",
"+",
"2",
"]",
"*",
".5",
")",
";",
"}",
"else",
"if",
"(",
"x",
"<=",
"0.",
")",
"{",
"return",
"z",
"[",
"offset",
"+",
"1",
"]",
"+",
"x",
"*",
".5",
"*",
"(",
"z",
"[",
"offset",
"+",
"2",
"]",
"-",
"z",
"[",
"offset",
"]",
"+",
"x",
"*",
"(",
"z",
"[",
"offset",
"+",
"2",
"]",
"+",
"z",
"[",
"offset",
"]",
"-",
"2",
"*",
"z",
"[",
"offset",
"+",
"1",
"]",
")",
")",
";",
"}",
"else",
"if",
"(",
"x",
">=",
"2.",
")",
"{",
"return",
"z",
"[",
"offset",
"+",
"3",
"]",
"+",
"(",
"x",
"-",
"2.",
")",
"*",
"(",
".5",
"*",
"z",
"[",
"offset",
"+",
"1",
"]",
"-",
"2.",
"*",
"z",
"[",
"offset",
"+",
"2",
"]",
"+",
"1.5",
"*",
"z",
"[",
"offset",
"+",
"3",
"]",
")",
";",
"}",
"else",
"if",
"(",
"x",
">=",
"1.",
")",
"{",
"return",
"z",
"[",
"offset",
"+",
"2",
"]",
"+",
"x1",
"*",
".5",
"*",
"(",
"z",
"[",
"offset",
"+",
"1",
"]",
"-",
"z",
"[",
"offset",
"+",
"3",
"]",
"+",
"x1",
"*",
"(",
"z",
"[",
"offset",
"+",
"1",
"]",
"+",
"z",
"[",
"offset",
"+",
"3",
"]",
"-",
"2",
"*",
"z",
"[",
"offset",
"+",
"2",
"]",
")",
")",
";",
"}",
"double",
"y",
"=",
"x1",
"*",
"(",
"z",
"[",
"offset",
"+",
"1",
"]",
"+",
"x",
"*",
".5",
"*",
"(",
"z",
"[",
"offset",
"+",
"2",
"]",
"-",
"z",
"[",
"offset",
"]",
"+",
"x",
"*",
"(",
"z",
"[",
"offset",
"+",
"2",
"]",
"+",
"z",
"[",
"offset",
"]",
"-",
"2",
"*",
"z",
"[",
"offset",
"+",
"1",
"]",
")",
")",
")",
"+",
"x",
"*",
"(",
"z",
"[",
"offset",
"+",
"2",
"]",
"+",
"x1",
"*",
".5",
"*",
"(",
"z",
"[",
"offset",
"+",
"1",
"]",
"-",
"z",
"[",
"offset",
"+",
"3",
"]",
"+",
"x1",
"*",
"(",
"z",
"[",
"offset",
"+",
"1",
"]",
"+",
"z",
"[",
"offset",
"+",
"3",
"]",
"-",
"2",
"*",
"z",
"[",
"offset",
"+",
"2",
"]",
")",
")",
")",
";",
"return",
"y",
";",
"}"
] | use this version for the GMRT grid | [
"use",
"this",
"version",
"for",
"the",
"GMRT",
"grid"
] | [] | [
{
"param": "z",
"type": "double[]"
},
{
"param": "offset",
"type": "int"
},
{
"param": "x",
"type": "double"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "z",
"type": "double[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "offset",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "x",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1645,
31247,
43,
49,
12185,
12,
9056,
8526,
998,
16,
509,
1384,
16,
1645,
619,
13,
288,
203,
202,
202,
1884,
12,
474,
277,
33,
3348,
274,
277,
32,
3348,
15,
24,
274,
277,
27245,
288,
203,
1082,
202,
430,
12,
5265,
18,
291,
21172,
12,
94,
63,
77,
22643,
327,
3698,
18,
21172,
31,
203,
202,
202,
97,
203,
202,
202,
9056,
619,
21,
273,
404,
17,
92,
31,
203,
202,
202,
430,
12,
619,
32,
29711,
21,
18,
262,
288,
203,
1082,
202,
2463,
998,
63,
3348,
65,
397,
261,
92,
15,
21,
12998,
21556,
300,
21,
18,
25,
14,
94,
63,
3348,
65,
397,
22,
4509,
94,
63,
3348,
15,
21,
65,
300,
94,
63,
3348,
15,
22,
5772,
18,
25,
1769,
203,
202,
202,
97,
469,
309,
12,
619,
32,
33,
20,
18,
262,
288,
203,
1082,
202,
2463,
998,
63,
3348,
15,
21,
65,
397,
619,
11146,
25,
380,
261,
94,
63,
3348,
15,
22,
65,
300,
998,
63,
3348,
65,
203,
6862,
202,
15,
619,
380,
261,
94,
63,
3348,
15,
22,
65,
397,
998,
63,
3348,
65,
300,
576,
14,
94,
63,
3348,
15,
21,
5717,
1769,
203,
202,
202,
97,
469,
309,
12,
619,
34,
33,
22,
18,
262,
288,
203,
1082,
202,
2463,
998,
63,
3348,
15,
23,
65,
397,
261,
92,
17,
22,
12998,
21556,
263,
25,
14,
94,
63,
3348,
15,
21,
65,
300,
22,
4509,
94,
63,
3348,
15,
22,
65,
397,
21,
18,
25,
14,
94,
63,
3348,
15,
23,
19226,
203,
202,
202,
97,
469,
309,
12,
619,
34,
33,
21,
18,
262,
288,
203,
1082,
202,
2463,
998,
63,
3348,
15,
22,
65,
397,
619,
21,
11146,
25,
380,
261,
94,
63,
3348,
15,
21,
65,
300,
998,
63,
3348,
15,
23,
65,
203,
6862,
202,
15,
619,
21,
380,
261,
94,
63,
3348,
15,
21,
65,
397,
998,
63,
3348,
15,
23,
65,
300,
576,
14,
94,
63,
3348,
15,
22,
5717,
1769,
203,
202,
202,
97,
203,
202,
202,
9056,
677,
273,
619,
21,
380,
261,
998,
63,
3348,
15,
21,
65,
397,
203,
9506,
202,
92,
11146,
25,
380,
261,
94,
63,
3348,
15,
22,
65,
300,
998,
63,
3348,
65,
203,
9506,
202,
15,
619,
380,
261,
94,
63,
3348,
15,
22,
65,
397,
998,
63,
3348,
65,
300,
576,
14,
94,
63,
3348,
15,
21,
65,
20349,
203,
1082,
202,
15,
619,
380,
261,
94,
63,
3348,
15,
22,
65,
397,
203,
9506,
202,
92,
21,
11146,
25,
380,
261,
94,
63,
3348,
15,
21,
65,
300,
998,
63,
3348,
15,
23,
65,
203,
9506,
202,
15,
619,
21,
380,
261,
94,
63,
3348,
15,
21,
65,
397,
998,
63,
3348,
15,
23,
65,
300,
576,
14,
94,
63,
3348,
15,
22,
22643,
1769,
203,
202,
202,
2463,
677,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
759,
1202,
333,
1177,
364,
326,
611,
49,
12185,
3068,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
771ce7b270294e1768e11351824858f19cd499ed | iedadata/geomapapp | haxby/map/XMap.java | [
"Apache-2.0"
] | Java | zoomTo | null | public void zoomTo( Rectangle rect ) {
if(rect.width<10 || rect.height<10) return;
Point p = new Point( rect.x + rect.width/2, rect.y + rect.height/2 );
Rectangle r = getVisibleRect();
Insets insets = new Insets(0,0,0,0);
if(mapBorder!=null) insets = mapBorder.getBorderInsets(this);
r.width -= insets.left + insets.right;
r.height -= insets.top + insets.bottom;
double factor = Math.min( r.getWidth()/rect.getWidth(),
r.getHeight()/rect.getHeight() );
doZoom( p, factor );
} | /**
Zoom to a rectangle defined by a mouse
@param rect Rectangled defined by the mouse
*/ | Zoom to a rectangle defined by a mouse | [
"Zoom",
"to",
"a",
"rectangle",
"defined",
"by",
"a",
"mouse"
] | public void zoomTo( Rectangle rect ) {
if(rect.width<10 || rect.height<10) return;
Point p = new Point( rect.x + rect.width/2, rect.y + rect.height/2 );
Rectangle r = getVisibleRect();
Insets insets = new Insets(0,0,0,0);
if(mapBorder!=null) insets = mapBorder.getBorderInsets(this);
r.width -= insets.left + insets.right;
r.height -= insets.top + insets.bottom;
double factor = Math.min( r.getWidth()/rect.getWidth(),
r.getHeight()/rect.getHeight() );
doZoom( p, factor );
} | [
"public",
"void",
"zoomTo",
"(",
"Rectangle",
"rect",
")",
"{",
"if",
"(",
"rect",
".",
"width",
"<",
"10",
"||",
"rect",
".",
"height",
"<",
"10",
")",
"return",
";",
"Point",
"p",
"=",
"new",
"Point",
"(",
"rect",
".",
"x",
"+",
"rect",
".",
"width",
"/",
"2",
",",
"rect",
".",
"y",
"+",
"rect",
".",
"height",
"/",
"2",
")",
";",
"Rectangle",
"r",
"=",
"getVisibleRect",
"(",
")",
";",
"Insets",
"insets",
"=",
"new",
"Insets",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"if",
"(",
"mapBorder",
"!=",
"null",
")",
"insets",
"=",
"mapBorder",
".",
"getBorderInsets",
"(",
"this",
")",
";",
"r",
".",
"width",
"-=",
"insets",
".",
"left",
"+",
"insets",
".",
"right",
";",
"r",
".",
"height",
"-=",
"insets",
".",
"top",
"+",
"insets",
".",
"bottom",
";",
"double",
"factor",
"=",
"Math",
".",
"min",
"(",
"r",
".",
"getWidth",
"(",
")",
"/",
"rect",
".",
"getWidth",
"(",
")",
",",
"r",
".",
"getHeight",
"(",
")",
"/",
"rect",
".",
"getHeight",
"(",
")",
")",
";",
"doZoom",
"(",
"p",
",",
"factor",
")",
";",
"}"
] | Zoom to a rectangle defined by a mouse | [
"Zoom",
"to",
"a",
"rectangle",
"defined",
"by",
"a",
"mouse"
] | [] | [
{
"param": "rect",
"type": "Rectangle"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "rect",
"type": "Rectangle",
"docstring": "Rectangled defined by the mouse",
"docstring_tokens": [
"Rectangled",
"defined",
"by",
"the",
"mouse"
],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
7182,
774,
12,
13264,
4917,
262,
288,
203,
202,
202,
430,
12,
2607,
18,
2819,
32,
2163,
747,
4917,
18,
4210,
32,
2163,
13,
327,
31,
203,
202,
202,
2148,
293,
273,
394,
4686,
12,
4917,
18,
92,
397,
4917,
18,
2819,
19,
22,
16,
4917,
18,
93,
397,
4917,
18,
4210,
19,
22,
11272,
203,
202,
202,
19463,
436,
273,
31564,
6120,
5621,
203,
202,
202,
382,
4424,
23576,
273,
394,
22300,
12,
20,
16,
20,
16,
20,
16,
20,
1769,
203,
202,
202,
430,
12,
1458,
8107,
5,
33,
2011,
13,
23576,
273,
852,
8107,
18,
588,
8107,
382,
4424,
12,
2211,
1769,
203,
202,
202,
86,
18,
2819,
3947,
23576,
18,
4482,
397,
23576,
18,
4083,
31,
203,
202,
202,
86,
18,
4210,
3947,
23576,
18,
3669,
397,
23576,
18,
9176,
31,
203,
202,
202,
9056,
5578,
273,
2361,
18,
1154,
12,
436,
18,
588,
2384,
1435,
19,
2607,
18,
588,
2384,
9334,
203,
6862,
202,
86,
18,
588,
2686,
1435,
19,
2607,
18,
588,
2686,
1435,
11272,
203,
202,
202,
2896,
11497,
12,
293,
16,
5578,
11272,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
225,
202,
11497,
358,
279,
11845,
2553,
635,
279,
7644,
203,
202,
225,
202,
36,
891,
4917,
9315,
539,
1259,
2553,
635,
326,
7644,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
771ce7b270294e1768e11351824858f19cd499ed | iedadata/geomapapp | haxby/map/XMap.java | [
"Apache-2.0"
] | Java | doZoom | null | public void doZoom( Point2D p, double factor ) {
AffineTransform ATrans = new AffineTransform();
ATrans.scale( zoom, zoom );
Insets insets = getInsets();
Rectangle rect = getVisibleRect();
Dimension dim = getParent().getSize();
if( dim.width>rect.width) rect.width = dim.width;
if( dim.height>rect.height) rect.height = dim.height;
rect.width -= insets.left + insets.right;
rect.height -= insets.top + insets.bottom;
double nX = (p.getX() - insets.left - (rect.width/(2.*factor)));
double nY = ( p.getY() - insets.top - rect.height/(2.*factor));
Point2D newP = null;
try {
newP = ATrans.inverseTransform( new Point2D.Double(nX, nY), null );
} catch (Exception ex ) {
return;
}
ATrans.scale( factor, factor );
zoom *= factor;
newP = ATrans.transform( newP, null );
int newX = (int)newP.getX(); // + insets.left;
// add the wrap value if newX is -ve.
if (wrap > 0) {
while (newX < 0) newX += wrap * zoom;
}
int newY = (int)newP.getY(); // + insets.top;
invalidate();
scrollPane.validate();
JScrollBar sb = scrollPane.getHorizontalScrollBar();
sb.setValue(newX);
sb = scrollPane.getVerticalScrollBar();
sb.setValue(newY);
revalidate();
//If this is MapApp Auto Focus
if (app instanceof MapApp) {
((MapApp) app).autoFocus();
}
double[] wesn = getWESN();
MapApp.sendLogMessage("Zoom&WESN="+wesn[0]+","+wesn[1]+","+wesn[2]+","+wesn[3]+"&zoom_level=" + zoom);
} | /**
Zoom by factor and center on point p.
@param p point to center on.
@param factor Factor to zoom by.
*/ | Zoom by factor and center on point p. | [
"Zoom",
"by",
"factor",
"and",
"center",
"on",
"point",
"p",
"."
] | public void doZoom( Point2D p, double factor ) {
AffineTransform ATrans = new AffineTransform();
ATrans.scale( zoom, zoom );
Insets insets = getInsets();
Rectangle rect = getVisibleRect();
Dimension dim = getParent().getSize();
if( dim.width>rect.width) rect.width = dim.width;
if( dim.height>rect.height) rect.height = dim.height;
rect.width -= insets.left + insets.right;
rect.height -= insets.top + insets.bottom;
double nX = (p.getX() - insets.left - (rect.width/(2.*factor)));
double nY = ( p.getY() - insets.top - rect.height/(2.*factor));
Point2D newP = null;
try {
newP = ATrans.inverseTransform( new Point2D.Double(nX, nY), null );
} catch (Exception ex ) {
return;
}
ATrans.scale( factor, factor );
zoom *= factor;
newP = ATrans.transform( newP, null );
int newX = (int)newP.getX();
if (wrap > 0) {
while (newX < 0) newX += wrap * zoom;
}
int newY = (int)newP.getY();
invalidate();
scrollPane.validate();
JScrollBar sb = scrollPane.getHorizontalScrollBar();
sb.setValue(newX);
sb = scrollPane.getVerticalScrollBar();
sb.setValue(newY);
revalidate();
if (app instanceof MapApp) {
((MapApp) app).autoFocus();
}
double[] wesn = getWESN();
MapApp.sendLogMessage("Zoom&WESN="+wesn[0]+","+wesn[1]+","+wesn[2]+","+wesn[3]+"&zoom_level=" + zoom);
} | [
"public",
"void",
"doZoom",
"(",
"Point2D",
"p",
",",
"double",
"factor",
")",
"{",
"AffineTransform",
"ATrans",
"=",
"new",
"AffineTransform",
"(",
")",
";",
"ATrans",
".",
"scale",
"(",
"zoom",
",",
"zoom",
")",
";",
"Insets",
"insets",
"=",
"getInsets",
"(",
")",
";",
"Rectangle",
"rect",
"=",
"getVisibleRect",
"(",
")",
";",
"Dimension",
"dim",
"=",
"getParent",
"(",
")",
".",
"getSize",
"(",
")",
";",
"if",
"(",
"dim",
".",
"width",
">",
"rect",
".",
"width",
")",
"rect",
".",
"width",
"=",
"dim",
".",
"width",
";",
"if",
"(",
"dim",
".",
"height",
">",
"rect",
".",
"height",
")",
"rect",
".",
"height",
"=",
"dim",
".",
"height",
";",
"rect",
".",
"width",
"-=",
"insets",
".",
"left",
"+",
"insets",
".",
"right",
";",
"rect",
".",
"height",
"-=",
"insets",
".",
"top",
"+",
"insets",
".",
"bottom",
";",
"double",
"nX",
"=",
"(",
"p",
".",
"getX",
"(",
")",
"-",
"insets",
".",
"left",
"-",
"(",
"rect",
".",
"width",
"/",
"(",
"2.",
"*",
"factor",
")",
")",
")",
";",
"double",
"nY",
"=",
"(",
"p",
".",
"getY",
"(",
")",
"-",
"insets",
".",
"top",
"-",
"rect",
".",
"height",
"/",
"(",
"2.",
"*",
"factor",
")",
")",
";",
"Point2D",
"newP",
"=",
"null",
";",
"try",
"{",
"newP",
"=",
"ATrans",
".",
"inverseTransform",
"(",
"new",
"Point2D",
".",
"Double",
"(",
"nX",
",",
"nY",
")",
",",
"null",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"return",
";",
"}",
"ATrans",
".",
"scale",
"(",
"factor",
",",
"factor",
")",
";",
"zoom",
"*=",
"factor",
";",
"newP",
"=",
"ATrans",
".",
"transform",
"(",
"newP",
",",
"null",
")",
";",
"int",
"newX",
"=",
"(",
"int",
")",
"newP",
".",
"getX",
"(",
")",
";",
"if",
"(",
"wrap",
">",
"0",
")",
"{",
"while",
"(",
"newX",
"<",
"0",
")",
"newX",
"+=",
"wrap",
"*",
"zoom",
";",
"}",
"int",
"newY",
"=",
"(",
"int",
")",
"newP",
".",
"getY",
"(",
")",
";",
"invalidate",
"(",
")",
";",
"scrollPane",
".",
"validate",
"(",
")",
";",
"JScrollBar",
"sb",
"=",
"scrollPane",
".",
"getHorizontalScrollBar",
"(",
")",
";",
"sb",
".",
"setValue",
"(",
"newX",
")",
";",
"sb",
"=",
"scrollPane",
".",
"getVerticalScrollBar",
"(",
")",
";",
"sb",
".",
"setValue",
"(",
"newY",
")",
";",
"revalidate",
"(",
")",
";",
"if",
"(",
"app",
"instanceof",
"MapApp",
")",
"{",
"(",
"(",
"MapApp",
")",
"app",
")",
".",
"autoFocus",
"(",
")",
";",
"}",
"double",
"[",
"]",
"wesn",
"=",
"getWESN",
"(",
")",
";",
"MapApp",
".",
"sendLogMessage",
"(",
"\"Zoom&WESN=\"",
"+",
"wesn",
"[",
"0",
"]",
"+",
"\",\"",
"+",
"wesn",
"[",
"1",
"]",
"+",
"\",\"",
"+",
"wesn",
"[",
"2",
"]",
"+",
"\",\"",
"+",
"wesn",
"[",
"3",
"]",
"+",
"\"&zoom_level=\"",
"+",
"zoom",
")",
";",
"}"
] | Zoom by factor and center on point p. | [
"Zoom",
"by",
"factor",
"and",
"center",
"on",
"point",
"p",
"."
] | [
"// + insets.left;",
"// add the wrap value if newX is -ve.",
"// + insets.top;\t",
"//If this is MapApp Auto Focus"
] | [
{
"param": "p",
"type": "Point2D"
},
{
"param": "factor",
"type": "double"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p",
"type": "Point2D",
"docstring": "point to center on.",
"docstring_tokens": [
"point",
"to",
"center",
"on",
"."
],
"default": null,
"is_optional": null
},
{
"identifier": "factor",
"type": "double",
"docstring": "Factor to zoom by.",
"docstring_tokens": [
"Factor",
"to",
"zoom",
"by",
"."
],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
741,
11497,
12,
4686,
22,
40,
293,
16,
1645,
5578,
262,
288,
203,
202,
202,
13785,
558,
4059,
432,
1429,
273,
394,
23906,
558,
4059,
5621,
203,
202,
202,
789,
28001,
18,
5864,
12,
7182,
16,
7182,
11272,
203,
202,
202,
382,
4424,
23576,
273,
7854,
4424,
5621,
203,
202,
202,
19463,
4917,
273,
31564,
6120,
5621,
203,
202,
202,
8611,
2464,
273,
5089,
7675,
588,
1225,
5621,
203,
202,
202,
430,
12,
2464,
18,
2819,
34,
2607,
18,
2819,
13,
4917,
18,
2819,
273,
2464,
18,
2819,
31,
203,
202,
202,
430,
12,
2464,
18,
4210,
34,
2607,
18,
4210,
13,
4917,
18,
4210,
273,
2464,
18,
4210,
31,
203,
202,
202,
2607,
18,
2819,
3947,
23576,
18,
4482,
397,
23576,
18,
4083,
31,
203,
202,
202,
2607,
18,
4210,
3947,
23576,
18,
3669,
397,
23576,
18,
9176,
31,
203,
202,
202,
9056,
290,
60,
273,
261,
84,
18,
588,
60,
1435,
300,
23576,
18,
4482,
300,
261,
2607,
18,
2819,
19,
12,
22,
4509,
6812,
3719,
1769,
203,
202,
202,
9056,
290,
61,
273,
261,
293,
18,
588,
61,
1435,
300,
23576,
18,
3669,
300,
4917,
18,
4210,
19,
12,
22,
4509,
6812,
10019,
203,
202,
202,
2148,
22,
40,
394,
52,
273,
446,
31,
203,
202,
202,
698,
288,
203,
1082,
202,
2704,
52,
273,
432,
1429,
18,
22552,
4059,
12,
394,
4686,
22,
40,
18,
5265,
12,
82,
60,
16,
290,
61,
3631,
446,
11272,
203,
202,
202,
97,
1044,
261,
503,
431,
262,
288,
203,
1082,
202,
2463,
31,
203,
202,
202,
97,
203,
202,
202,
789,
28001,
18,
5864,
12,
5578,
16,
5578,
11272,
203,
202,
202,
14932,
6413,
5578,
31,
203,
202,
202,
2704,
52,
273,
432,
1429,
18,
6547,
12,
394,
52,
16,
446,
11272,
203,
202,
202,
474,
394,
60,
273,
261,
474,
13,
2704,
52,
18,
588,
60,
5621,
368,
397,
23576,
18,
4482,
31,
203,
202,
202,
759,
527,
326,
2193,
460,
309,
394,
60,
353,
300,
537,
18,
203,
202,
202,
430,
261,
4113,
405,
374,
13,
288,
203,
1082,
202,
17523,
261,
2704,
60,
411,
374,
13,
394,
60,
1011,
2193,
380,
7182,
31,
203,
202,
202,
97,
203,
202,
202,
474,
394,
61,
273,
261,
474,
13,
2704,
52,
18,
588,
61,
5621,
368,
397,
23576,
18,
3669,
31,
202,
203,
202,
202,
5387,
340,
5621,
203,
202,
202,
12033,
8485,
18,
5662,
5621,
203,
202,
202,
46,
6806,
5190,
2393,
273,
5532,
8485,
18,
588,
14457,
6806,
5190,
5621,
203,
202,
202,
18366,
18,
542,
620,
12,
2704,
60,
1769,
203,
202,
202,
18366,
273,
5532,
8485,
18,
588,
15704,
6806,
5190,
5621,
203,
202,
202,
18366,
18,
542,
620,
12,
2704,
61,
1769,
203,
202,
202,
266,
5662,
5621,
203,
1082,
203,
202,
202,
759,
2047,
333,
353,
1635,
3371,
8064,
478,
4560,
203,
202,
202,
430,
261,
2910,
1276,
1635,
3371,
13,
288,
203,
1082,
202,
12443,
863,
3371,
13,
595,
2934,
6079,
9233,
5621,
203,
202,
202,
97,
203,
202,
202,
9056,
8526,
341,
281,
82,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
202,
225,
202,
11497,
635,
5578,
471,
4617,
603,
1634,
293,
18,
203,
202,
225,
202,
36,
891,
293,
1634,
358,
4617,
603,
18,
203,
202,
225,
202,
36,
891,
5578,
26400,
358,
7182,
635,
18,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
771ce7b270294e1768e11351824858f19cd499ed | iedadata/geomapapp | haxby/map/XMap.java | [
"Apache-2.0"
] | Java | saveJPEGImage | null | public void saveJPEGImage(File file) throws IOException {
Rectangle r = getVisibleRect();
BufferedImage im = new BufferedImage( r.width, r.height, BufferedImage.TYPE_INT_RGB );
Graphics2D g2d = im.createGraphics();
g2d.translate(-r.getX(), -r.getY());
paint(g2d);
int s_idx = file.getName().indexOf(".");
String suffix = s_idx<0
? "jpg"
: file.getName().substring(s_idx+1);
if( !javax.imageio.ImageIO.getImageWritersBySuffix(suffix).hasNext() )suffix = "jpg";
javax.imageio.ImageIO.write( im, suffix, file);
// BufferedOutputStream out = new BufferedOutputStream(
// new FileOutputStream( file ));
// JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
// encoder.encode(im);
} | /**
* Saves current image.as a JPEG.
*/ | Saves current image.as a JPEG. | [
"Saves",
"current",
"image",
".",
"as",
"a",
"JPEG",
"."
] | public void saveJPEGImage(File file) throws IOException {
Rectangle r = getVisibleRect();
BufferedImage im = new BufferedImage( r.width, r.height, BufferedImage.TYPE_INT_RGB );
Graphics2D g2d = im.createGraphics();
g2d.translate(-r.getX(), -r.getY());
paint(g2d);
int s_idx = file.getName().indexOf(".");
String suffix = s_idx<0
? "jpg"
: file.getName().substring(s_idx+1);
if( !javax.imageio.ImageIO.getImageWritersBySuffix(suffix).hasNext() )suffix = "jpg";
javax.imageio.ImageIO.write( im, suffix, file);
} | [
"public",
"void",
"saveJPEGImage",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"Rectangle",
"r",
"=",
"getVisibleRect",
"(",
")",
";",
"BufferedImage",
"im",
"=",
"new",
"BufferedImage",
"(",
"r",
".",
"width",
",",
"r",
".",
"height",
",",
"BufferedImage",
".",
"TYPE_INT_RGB",
")",
";",
"Graphics2D",
"g2d",
"=",
"im",
".",
"createGraphics",
"(",
")",
";",
"g2d",
".",
"translate",
"(",
"-",
"r",
".",
"getX",
"(",
")",
",",
"-",
"r",
".",
"getY",
"(",
")",
")",
";",
"paint",
"(",
"g2d",
")",
";",
"int",
"s_idx",
"=",
"file",
".",
"getName",
"(",
")",
".",
"indexOf",
"(",
"\".\"",
")",
";",
"String",
"suffix",
"=",
"s_idx",
"<",
"0",
"?",
"\"jpg\"",
":",
"file",
".",
"getName",
"(",
")",
".",
"substring",
"(",
"s_idx",
"+",
"1",
")",
";",
"if",
"(",
"!",
"javax",
".",
"imageio",
".",
"ImageIO",
".",
"getImageWritersBySuffix",
"(",
"suffix",
")",
".",
"hasNext",
"(",
")",
")",
"suffix",
"=",
"\"jpg\"",
";",
"javax",
".",
"imageio",
".",
"ImageIO",
".",
"write",
"(",
"im",
",",
"suffix",
",",
"file",
")",
";",
"}"
] | Saves current image.as a JPEG. | [
"Saves",
"current",
"image",
".",
"as",
"a",
"JPEG",
"."
] | [
"//\tBufferedOutputStream out = new BufferedOutputStream(",
"//\t\t\t\tnew FileOutputStream( file ));",
"//\tJPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);",
"//\tencoder.encode(im);"
] | [
{
"param": "file",
"type": "File"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1923,
28698,
2040,
12,
812,
585,
13,
1216,
1860,
288,
203,
202,
202,
19463,
436,
273,
31564,
6120,
5621,
203,
202,
202,
17947,
2040,
709,
273,
394,
12362,
12,
436,
18,
2819,
16,
436,
18,
4210,
16,
12362,
18,
2399,
67,
3217,
67,
11343,
11272,
203,
202,
202,
17558,
22,
40,
314,
22,
72,
273,
709,
18,
2640,
17558,
5621,
203,
202,
202,
75,
22,
72,
18,
13929,
19236,
86,
18,
588,
60,
9334,
300,
86,
18,
588,
61,
10663,
203,
202,
202,
84,
1598,
12,
75,
22,
72,
1769,
1082,
203,
202,
202,
474,
272,
67,
3465,
273,
585,
18,
17994,
7675,
31806,
2932,
1199,
1769,
203,
202,
202,
780,
3758,
273,
272,
67,
3465,
32,
20,
203,
9506,
202,
35,
315,
14362,
6,
203,
9506,
202,
30,
585,
18,
17994,
7675,
28023,
12,
87,
67,
3465,
15,
21,
1769,
203,
202,
202,
430,
12,
401,
28384,
18,
2730,
1594,
18,
2040,
4294,
18,
588,
2040,
27508,
858,
5791,
12,
8477,
2934,
5332,
2134,
1435,
262,
8477,
273,
315,
14362,
14432,
203,
202,
202,
28384,
18,
2730,
1594,
18,
2040,
4294,
18,
2626,
12,
709,
16,
3758,
16,
585,
1769,
203,
202,
759,
202,
17947,
4632,
596,
273,
394,
28649,
12,
203,
202,
759,
9506,
202,
2704,
12942,
12,
585,
262,
1769,
203,
202,
759,
202,
28698,
2040,
7204,
7261,
273,
28038,
11008,
18,
2640,
28698,
7204,
12,
659,
1769,
203,
202,
759,
202,
16480,
18,
3015,
12,
381,
1769,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
348,
6606,
783,
1316,
18,
345,
279,
28038,
18,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
771ce7b270294e1768e11351824858f19cd499ed | iedadata/geomapapp | haxby/map/XMap.java | [
"Apache-2.0"
] | Java | savePMGImage | null | public void savePMGImage(File file) throws IOException {
Rectangle r = getVisibleRect();
BufferedImage im = new BufferedImage( r.width, r.height, BufferedImage.TYPE_INT_BGR );
Graphics2D g2d = im.createGraphics();
g2d.translate(-r.getX(), -r.getY());
paint(g2d);
int s_idx = file.getName().indexOf(".");
String suffix = s_idx<0
? "png"
: file.getName().substring(s_idx+1);
if( !javax.imageio.ImageIO.getImageWritersBySuffix(suffix).hasNext() ) {
suffix = "png";
}
javax.imageio.ImageIO.write( (RenderedImage)im, suffix, file );
} | // ***** GMA 1.6.6: Add option to save as .tiff image for high detail | GMA 1.6.6: Add option to save as .tiff image for high detail | [
"GMA",
"1",
".",
"6",
".",
"6",
":",
"Add",
"option",
"to",
"save",
"as",
".",
"tiff",
"image",
"for",
"high",
"detail"
] | public void savePMGImage(File file) throws IOException {
Rectangle r = getVisibleRect();
BufferedImage im = new BufferedImage( r.width, r.height, BufferedImage.TYPE_INT_BGR );
Graphics2D g2d = im.createGraphics();
g2d.translate(-r.getX(), -r.getY());
paint(g2d);
int s_idx = file.getName().indexOf(".");
String suffix = s_idx<0
? "png"
: file.getName().substring(s_idx+1);
if( !javax.imageio.ImageIO.getImageWritersBySuffix(suffix).hasNext() ) {
suffix = "png";
}
javax.imageio.ImageIO.write( (RenderedImage)im, suffix, file );
} | [
"public",
"void",
"savePMGImage",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"Rectangle",
"r",
"=",
"getVisibleRect",
"(",
")",
";",
"BufferedImage",
"im",
"=",
"new",
"BufferedImage",
"(",
"r",
".",
"width",
",",
"r",
".",
"height",
",",
"BufferedImage",
".",
"TYPE_INT_BGR",
")",
";",
"Graphics2D",
"g2d",
"=",
"im",
".",
"createGraphics",
"(",
")",
";",
"g2d",
".",
"translate",
"(",
"-",
"r",
".",
"getX",
"(",
")",
",",
"-",
"r",
".",
"getY",
"(",
")",
")",
";",
"paint",
"(",
"g2d",
")",
";",
"int",
"s_idx",
"=",
"file",
".",
"getName",
"(",
")",
".",
"indexOf",
"(",
"\".\"",
")",
";",
"String",
"suffix",
"=",
"s_idx",
"<",
"0",
"?",
"\"png\"",
":",
"file",
".",
"getName",
"(",
")",
".",
"substring",
"(",
"s_idx",
"+",
"1",
")",
";",
"if",
"(",
"!",
"javax",
".",
"imageio",
".",
"ImageIO",
".",
"getImageWritersBySuffix",
"(",
"suffix",
")",
".",
"hasNext",
"(",
")",
")",
"{",
"suffix",
"=",
"\"png\"",
";",
"}",
"javax",
".",
"imageio",
".",
"ImageIO",
".",
"write",
"(",
"(",
"RenderedImage",
")",
"im",
",",
"suffix",
",",
"file",
")",
";",
"}"
] | GMA 1.6.6: Add option to save as .tiff image for high detail | [
"GMA",
"1",
".",
"6",
".",
"6",
":",
"Add",
"option",
"to",
"save",
"as",
".",
"tiff",
"image",
"for",
"high",
"detail"
] | [] | [
{
"param": "file",
"type": "File"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1923,
12728,
43,
2040,
12,
812,
585,
13,
1216,
1860,
288,
203,
202,
202,
19463,
436,
273,
31564,
6120,
5621,
203,
202,
202,
17947,
2040,
709,
273,
394,
12362,
12,
436,
18,
2819,
16,
436,
18,
4210,
16,
12362,
18,
2399,
67,
3217,
67,
38,
6997,
11272,
203,
202,
202,
17558,
22,
40,
314,
22,
72,
273,
709,
18,
2640,
17558,
5621,
203,
202,
202,
75,
22,
72,
18,
13929,
19236,
86,
18,
588,
60,
9334,
300,
86,
18,
588,
61,
10663,
203,
202,
202,
84,
1598,
12,
75,
22,
72,
1769,
203,
202,
202,
474,
272,
67,
3465,
273,
585,
18,
17994,
7675,
31806,
2932,
1199,
1769,
203,
202,
202,
780,
3758,
273,
272,
67,
3465,
32,
20,
203,
9506,
202,
35,
315,
6446,
6,
203,
9506,
202,
30,
585,
18,
17994,
7675,
28023,
12,
87,
67,
3465,
15,
21,
1769,
203,
202,
202,
430,
12,
401,
28384,
18,
2730,
1594,
18,
2040,
4294,
18,
588,
2040,
27508,
858,
5791,
12,
8477,
2934,
5332,
2134,
1435,
262,
288,
203,
1082,
202,
8477,
273,
315,
6446,
14432,
203,
202,
202,
97,
203,
202,
202,
28384,
18,
2730,
1594,
18,
2040,
4294,
18,
2626,
12,
261,
19222,
2040,
13,
381,
16,
3758,
16,
585,
11272,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
771ce7b270294e1768e11351824858f19cd499ed | iedadata/geomapapp | haxby/map/XMap.java | [
"Apache-2.0"
] | Java | keyPressed | null | public void keyPressed(KeyEvent e) {
if ( e.getKeyCode() == KeyEvent.VK_SPACE) {
setSpaceBarPress(true);
}
if(getSpaceBarPress()) {
// Set locations
screenPressedX = MouseInfo.getPointerInfo().getLocation().x;
screenPressedY = MouseInfo.getPointerInfo().getLocation().y;
pressedX = scrollPane.getHorizontalScrollBar().getValue();
pressedY = scrollPane.getVerticalScrollBar().getValue();
// Set cursor to closed hand
Toolkit toolkit = Toolkit.getDefaultToolkit();
ClassLoader loader = org.geomapapp.util.Icons.class.getClassLoader();
String path = "org/geomapapp/resources/icons/close_hand.png";
java.net.URL url = loader.getResource(path);
try {
BufferedImage im = ImageIO.read(url);
Cursor closeHandCursor = toolkit.createCustomCursor( im, new Point(0,0), "close_hand");
setCursor(closeHandCursor);
} catch (IOException e1) {
e1.printStackTrace();
}
}
} | // Pans the map if user holds space bar down while navigating with pointer. | Pans the map if user holds space bar down while navigating with pointer. | [
"Pans",
"the",
"map",
"if",
"user",
"holds",
"space",
"bar",
"down",
"while",
"navigating",
"with",
"pointer",
"."
] | public void keyPressed(KeyEvent e) {
if ( e.getKeyCode() == KeyEvent.VK_SPACE) {
setSpaceBarPress(true);
}
if(getSpaceBarPress()) {
screenPressedX = MouseInfo.getPointerInfo().getLocation().x;
screenPressedY = MouseInfo.getPointerInfo().getLocation().y;
pressedX = scrollPane.getHorizontalScrollBar().getValue();
pressedY = scrollPane.getVerticalScrollBar().getValue();
Toolkit toolkit = Toolkit.getDefaultToolkit();
ClassLoader loader = org.geomapapp.util.Icons.class.getClassLoader();
String path = "org/geomapapp/resources/icons/close_hand.png";
java.net.URL url = loader.getResource(path);
try {
BufferedImage im = ImageIO.read(url);
Cursor closeHandCursor = toolkit.createCustomCursor( im, new Point(0,0), "close_hand");
setCursor(closeHandCursor);
} catch (IOException e1) {
e1.printStackTrace();
}
}
} | [
"public",
"void",
"keyPressed",
"(",
"KeyEvent",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getKeyCode",
"(",
")",
"==",
"KeyEvent",
".",
"VK_SPACE",
")",
"{",
"setSpaceBarPress",
"(",
"true",
")",
";",
"}",
"if",
"(",
"getSpaceBarPress",
"(",
")",
")",
"{",
"screenPressedX",
"=",
"MouseInfo",
".",
"getPointerInfo",
"(",
")",
".",
"getLocation",
"(",
")",
".",
"x",
";",
"screenPressedY",
"=",
"MouseInfo",
".",
"getPointerInfo",
"(",
")",
".",
"getLocation",
"(",
")",
".",
"y",
";",
"pressedX",
"=",
"scrollPane",
".",
"getHorizontalScrollBar",
"(",
")",
".",
"getValue",
"(",
")",
";",
"pressedY",
"=",
"scrollPane",
".",
"getVerticalScrollBar",
"(",
")",
".",
"getValue",
"(",
")",
";",
"Toolkit",
"toolkit",
"=",
"Toolkit",
".",
"getDefaultToolkit",
"(",
")",
";",
"ClassLoader",
"loader",
"=",
"org",
".",
"geomapapp",
".",
"util",
".",
"Icons",
".",
"class",
".",
"getClassLoader",
"(",
")",
";",
"String",
"path",
"=",
"\"org/geomapapp/resources/icons/close_hand.png\"",
";",
"java",
".",
"net",
".",
"URL",
"url",
"=",
"loader",
".",
"getResource",
"(",
"path",
")",
";",
"try",
"{",
"BufferedImage",
"im",
"=",
"ImageIO",
".",
"read",
"(",
"url",
")",
";",
"Cursor",
"closeHandCursor",
"=",
"toolkit",
".",
"createCustomCursor",
"(",
"im",
",",
"new",
"Point",
"(",
"0",
",",
"0",
")",
",",
"\"close_hand\"",
")",
";",
"setCursor",
"(",
"closeHandCursor",
")",
";",
"}",
"catch",
"(",
"IOException",
"e1",
")",
"{",
"e1",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}"
] | Pans the map if user holds space bar down while navigating with pointer. | [
"Pans",
"the",
"map",
"if",
"user",
"holds",
"space",
"bar",
"down",
"while",
"navigating",
"with",
"pointer",
"."
] | [
"// Set locations",
"// Set cursor to closed hand"
] | [
{
"param": "e",
"type": "KeyEvent"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "e",
"type": "KeyEvent",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
498,
24624,
12,
653,
1133,
425,
13,
288,
203,
202,
202,
430,
261,
425,
18,
588,
653,
1085,
1435,
422,
23737,
18,
58,
47,
67,
6616,
13,
288,
203,
1082,
202,
542,
3819,
5190,
11840,
12,
3767,
1769,
203,
202,
202,
97,
203,
203,
202,
202,
430,
12,
588,
3819,
5190,
11840,
10756,
288,
203,
1082,
202,
759,
1000,
7838,
203,
1082,
202,
9252,
24624,
60,
273,
17013,
966,
18,
588,
4926,
966,
7675,
588,
2735,
7675,
92,
31,
203,
1082,
202,
9252,
24624,
61,
273,
17013,
966,
18,
588,
4926,
966,
7675,
588,
2735,
7675,
93,
31,
203,
1082,
202,
10906,
60,
273,
5532,
8485,
18,
588,
14457,
6806,
5190,
7675,
24805,
5621,
203,
1082,
202,
10906,
61,
273,
5532,
8485,
18,
588,
15704,
6806,
5190,
7675,
24805,
5621,
203,
203,
1082,
202,
759,
1000,
3347,
358,
4375,
948,
203,
1082,
202,
6364,
8691,
5226,
8691,
273,
13288,
8691,
18,
588,
1868,
6364,
8691,
5621,
203,
1082,
202,
7805,
4088,
273,
2358,
18,
10049,
438,
2910,
18,
1367,
18,
27510,
18,
1106,
18,
588,
7805,
5621,
203,
1082,
202,
780,
589,
273,
315,
3341,
19,
10049,
438,
2910,
19,
4683,
19,
14516,
19,
4412,
67,
2349,
18,
6446,
14432,
203,
1082,
202,
6290,
18,
2758,
18,
1785,
880,
273,
4088,
18,
588,
1420,
12,
803,
1769,
203,
1082,
202,
698,
288,
203,
9506,
202,
17947,
2040,
709,
273,
3421,
4294,
18,
896,
12,
718,
1769,
203,
9506,
202,
6688,
1746,
1144,
6688,
273,
5226,
8691,
18,
2640,
3802,
6688,
12,
709,
16,
394,
4686,
12,
20,
16,
20,
3631,
315,
4412,
67,
2349,
8863,
203,
9506,
202,
542,
6688,
12,
4412,
1144,
6688,
1769,
203,
1082,
202,
97,
1044,
261,
14106,
425,
21,
13,
288,
203,
9506,
202,
73,
21,
18,
1188,
6332,
5621,
203,
1082,
202,
97,
203,
202,
202,
97,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
759,
453,
634,
326,
852,
309,
729,
14798,
3476,
4653,
2588,
1323,
290,
4911,
1776,
598,
4407,
18,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
ae82faae40e31079df3d6f8b47dbb7dbac963f80 | iedadata/geomapapp | org/geomapapp/image/RenderingTools.java | [
"Apache-2.0"
] | Java | deletePalette | Palette | public Palette deletePalette() {
Palette deletePalette = null;
try {
deletePalette = getPalette().deletePalette(parentGridDialog);
} catch(Exception ex) {
ex.printStackTrace();
return null;
}
if( deletePalette==null )return null;
palettes.remove( deletePalette.toString());
return deletePalette;
} | // Removes the chosen palette from system. | Removes the chosen palette from system. | [
"Removes",
"the",
"chosen",
"palette",
"from",
"system",
"."
] | public Palette deletePalette() {
Palette deletePalette = null;
try {
deletePalette = getPalette().deletePalette(parentGridDialog);
} catch(Exception ex) {
ex.printStackTrace();
return null;
}
if( deletePalette==null )return null;
palettes.remove( deletePalette.toString());
return deletePalette;
} | [
"public",
"Palette",
"deletePalette",
"(",
")",
"{",
"Palette",
"deletePalette",
"=",
"null",
";",
"try",
"{",
"deletePalette",
"=",
"getPalette",
"(",
")",
".",
"deletePalette",
"(",
"parentGridDialog",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"return",
"null",
";",
"}",
"if",
"(",
"deletePalette",
"==",
"null",
")",
"return",
"null",
";",
"palettes",
".",
"remove",
"(",
"deletePalette",
".",
"toString",
"(",
")",
")",
";",
"return",
"deletePalette",
";",
"}"
] | Removes the chosen palette from system. | [
"Removes",
"the",
"chosen",
"palette",
"from",
"system",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
453,
8786,
1430,
25863,
1435,
288,
203,
202,
202,
25863,
1430,
25863,
273,
446,
31,
203,
202,
202,
698,
288,
203,
1082,
202,
3733,
25863,
273,
1689,
8786,
7675,
3733,
25863,
12,
2938,
6313,
6353,
1769,
203,
202,
202,
97,
1044,
12,
503,
431,
13,
288,
203,
1082,
202,
338,
18,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
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
ae82faae40e31079df3d6f8b47dbb7dbac963f80 | iedadata/geomapapp | org/geomapapp/image/RenderingTools.java | [
"Apache-2.0"
] | Java | exportPaletteFile | File | public File exportPaletteFile() {
File exportPaletteFile = null;
try {
exportPaletteFile = getPalette().exportPalette(parentGridDialog);
} catch(Exception ex) {
ex.printStackTrace();
return null;
}
if( exportPaletteFile==null )return null;
return exportPaletteFile;
} | // Export the chosen custom palette file to desktop. | Export the chosen custom palette file to desktop. | [
"Export",
"the",
"chosen",
"custom",
"palette",
"file",
"to",
"desktop",
"."
] | public File exportPaletteFile() {
File exportPaletteFile = null;
try {
exportPaletteFile = getPalette().exportPalette(parentGridDialog);
} catch(Exception ex) {
ex.printStackTrace();
return null;
}
if( exportPaletteFile==null )return null;
return exportPaletteFile;
} | [
"public",
"File",
"exportPaletteFile",
"(",
")",
"{",
"File",
"exportPaletteFile",
"=",
"null",
";",
"try",
"{",
"exportPaletteFile",
"=",
"getPalette",
"(",
")",
".",
"exportPalette",
"(",
"parentGridDialog",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"return",
"null",
";",
"}",
"if",
"(",
"exportPaletteFile",
"==",
"null",
")",
"return",
"null",
";",
"return",
"exportPaletteFile",
";",
"}"
] | Export the chosen custom palette file to desktop. | [
"Export",
"the",
"chosen",
"custom",
"palette",
"file",
"to",
"desktop",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
1387,
3359,
25863,
812,
1435,
288,
203,
202,
202,
812,
3359,
25863,
812,
273,
446,
31,
203,
202,
202,
698,
288,
203,
1082,
202,
6530,
25863,
812,
273,
1689,
8786,
7675,
6530,
25863,
12,
2938,
6313,
6353,
1769,
203,
202,
202,
97,
1044,
12,
503,
431,
13,
288,
203,
1082,
202,
338,
18,
1188,
6332,
5621,
203,
1082,
202,
2463,
446,
31,
203,
202,
202,
97,
203,
202,
202,
430,
12,
3359,
25863,
812,
631,
2011,
262,
2463,
446,
31,
203,
202,
202,
2463,
3359,
25863,
812,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
759,
11054,
326,
10447,
1679,
12127,
585,
358,
21304,
18,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
ae82faae40e31079df3d6f8b47dbb7dbac963f80 | iedadata/geomapapp | org/geomapapp/image/RenderingTools.java | [
"Apache-2.0"
] | Java | importPaletteFile | null | public void importPaletteFile() {
JFileChooser chooser = MapApp.getFileChooser();
FileFilter filter = new FileFilter(){
public boolean accept(File pathname) {
if (pathname.isDirectory()) return true;
return pathname.getName().endsWith(".lut");
}
public String getDescription() {
return "Color Palette (.lut)";
}
};
chooser.setFileFilter(filter);
int ok = chooser.showOpenDialog(parentGridDialog);
int confirm = JOptionPane.NO_OPTION;
boolean lutNameExists = false;
if (ok == chooser.CANCEL_OPTION) {
return;
} else if(ok == chooser.APPROVE_OPTION) {
File importPalette = chooser.getSelectedFile();
if (importPalette.exists()) {
if(root==null)return;
File dirLUT = new File(root, "lut");
if(!dirLUT.exists()) {
dirLUT.mkdir();
}
File[] filesLUT = dirLUT.listFiles(new java.io.FileFilter() {
public boolean accept(File file) {
return file.getName().endsWith(".lut");
}
});
for( int k=0 ; k<filesLUT.length ; k++) {
if(filesLUT[k].getName().matches(importPalette.getName())) {
lutNameExists = true;
}
}
if(lutNameExists) {
confirm = JOptionPane.showConfirmDialog(parentGridDialog, "File exists in GeoMapApp, Overwrite?");
if (confirm == JOptionPane.CANCEL_OPTION) return;
} else {
File loadGMALUT = new File(dirLUT, importPalette.getName());
loadAPalette(importPalette.getPath(), loadGMALUT.getPath());
}
}
}
return;
} | // Import the chosen custom palette file from desktop in GMA and save to GMA files dir. | Import the chosen custom palette file from desktop in GMA and save to GMA files dir. | [
"Import",
"the",
"chosen",
"custom",
"palette",
"file",
"from",
"desktop",
"in",
"GMA",
"and",
"save",
"to",
"GMA",
"files",
"dir",
"."
] | public void importPaletteFile() {
JFileChooser chooser = MapApp.getFileChooser();
FileFilter filter = new FileFilter(){
public boolean accept(File pathname) {
if (pathname.isDirectory()) return true;
return pathname.getName().endsWith(".lut");
}
public String getDescription() {
return "Color Palette (.lut)";
}
};
chooser.setFileFilter(filter);
int ok = chooser.showOpenDialog(parentGridDialog);
int confirm = JOptionPane.NO_OPTION;
boolean lutNameExists = false;
if (ok == chooser.CANCEL_OPTION) {
return;
} else if(ok == chooser.APPROVE_OPTION) {
File importPalette = chooser.getSelectedFile();
if (importPalette.exists()) {
if(root==null)return;
File dirLUT = new File(root, "lut");
if(!dirLUT.exists()) {
dirLUT.mkdir();
}
File[] filesLUT = dirLUT.listFiles(new java.io.FileFilter() {
public boolean accept(File file) {
return file.getName().endsWith(".lut");
}
});
for( int k=0 ; k<filesLUT.length ; k++) {
if(filesLUT[k].getName().matches(importPalette.getName())) {
lutNameExists = true;
}
}
if(lutNameExists) {
confirm = JOptionPane.showConfirmDialog(parentGridDialog, "File exists in GeoMapApp, Overwrite?");
if (confirm == JOptionPane.CANCEL_OPTION) return;
} else {
File loadGMALUT = new File(dirLUT, importPalette.getName());
loadAPalette(importPalette.getPath(), loadGMALUT.getPath());
}
}
}
return;
} | [
"public",
"void",
"importPaletteFile",
"(",
")",
"{",
"JFileChooser",
"chooser",
"=",
"MapApp",
".",
"getFileChooser",
"(",
")",
";",
"FileFilter",
"filter",
"=",
"new",
"FileFilter",
"(",
")",
"{",
"public",
"boolean",
"accept",
"(",
"File",
"pathname",
")",
"{",
"if",
"(",
"pathname",
".",
"isDirectory",
"(",
")",
")",
"return",
"true",
";",
"return",
"pathname",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\".lut\"",
")",
";",
"}",
"public",
"String",
"getDescription",
"(",
")",
"{",
"return",
"\"Color Palette (.lut)\"",
";",
"}",
"}",
";",
"chooser",
".",
"setFileFilter",
"(",
"filter",
")",
";",
"int",
"ok",
"=",
"chooser",
".",
"showOpenDialog",
"(",
"parentGridDialog",
")",
";",
"int",
"confirm",
"=",
"JOptionPane",
".",
"NO_OPTION",
";",
"boolean",
"lutNameExists",
"=",
"false",
";",
"if",
"(",
"ok",
"==",
"chooser",
".",
"CANCEL_OPTION",
")",
"{",
"return",
";",
"}",
"else",
"if",
"(",
"ok",
"==",
"chooser",
".",
"APPROVE_OPTION",
")",
"{",
"File",
"importPalette",
"=",
"chooser",
".",
"getSelectedFile",
"(",
")",
";",
"if",
"(",
"importPalette",
".",
"exists",
"(",
")",
")",
"{",
"if",
"(",
"root",
"==",
"null",
")",
"return",
";",
"File",
"dirLUT",
"=",
"new",
"File",
"(",
"root",
",",
"\"lut\"",
")",
";",
"if",
"(",
"!",
"dirLUT",
".",
"exists",
"(",
")",
")",
"{",
"dirLUT",
".",
"mkdir",
"(",
")",
";",
"}",
"File",
"[",
"]",
"filesLUT",
"=",
"dirLUT",
".",
"listFiles",
"(",
"new",
"java",
".",
"io",
".",
"FileFilter",
"(",
")",
"{",
"public",
"boolean",
"accept",
"(",
"File",
"file",
")",
"{",
"return",
"file",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\".lut\"",
")",
";",
"}",
"}",
")",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"filesLUT",
".",
"length",
";",
"k",
"++",
")",
"{",
"if",
"(",
"filesLUT",
"[",
"k",
"]",
".",
"getName",
"(",
")",
".",
"matches",
"(",
"importPalette",
".",
"getName",
"(",
")",
")",
")",
"{",
"lutNameExists",
"=",
"true",
";",
"}",
"}",
"if",
"(",
"lutNameExists",
")",
"{",
"confirm",
"=",
"JOptionPane",
".",
"showConfirmDialog",
"(",
"parentGridDialog",
",",
"\"File exists in GeoMapApp, Overwrite?\"",
")",
";",
"if",
"(",
"confirm",
"==",
"JOptionPane",
".",
"CANCEL_OPTION",
")",
"return",
";",
"}",
"else",
"{",
"File",
"loadGMALUT",
"=",
"new",
"File",
"(",
"dirLUT",
",",
"importPalette",
".",
"getName",
"(",
")",
")",
";",
"loadAPalette",
"(",
"importPalette",
".",
"getPath",
"(",
")",
",",
"loadGMALUT",
".",
"getPath",
"(",
")",
")",
";",
"}",
"}",
"}",
"return",
";",
"}"
] | Import the chosen custom palette file from desktop in GMA and save to GMA files dir. | [
"Import",
"the",
"chosen",
"custom",
"palette",
"file",
"from",
"desktop",
"in",
"GMA",
"and",
"save",
"to",
"GMA",
"files",
"dir",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1930,
25863,
812,
1435,
288,
203,
1082,
202,
46,
812,
17324,
5011,
13164,
273,
1635,
3371,
18,
29925,
17324,
5621,
203,
1082,
202,
29837,
1034,
273,
394,
1387,
1586,
1435,
95,
203,
9506,
202,
482,
1250,
2791,
12,
812,
9806,
13,
288,
203,
6862,
202,
430,
261,
28336,
18,
291,
2853,
10756,
327,
638,
31,
203,
6862,
202,
2463,
9806,
18,
17994,
7675,
5839,
1190,
2932,
18,
80,
322,
8863,
203,
9506,
202,
97,
203,
9506,
203,
9506,
202,
482,
514,
11056,
1435,
288,
203,
6862,
202,
2463,
315,
2957,
453,
8786,
261,
18,
80,
322,
2225,
31,
203,
9506,
202,
97,
203,
1082,
202,
20451,
203,
1082,
202,
2599,
13164,
18,
542,
29837,
12,
2188,
1769,
203,
1082,
202,
474,
1529,
273,
5011,
13164,
18,
4500,
3678,
6353,
12,
2938,
6313,
6353,
1769,
203,
1082,
202,
474,
6932,
273,
804,
1895,
8485,
18,
3417,
67,
7425,
31,
203,
203,
1082,
202,
6494,
27171,
461,
4002,
273,
629,
31,
203,
1082,
202,
430,
261,
601,
422,
5011,
13164,
18,
25268,
67,
7425,
13,
288,
203,
9506,
202,
2463,
31,
203,
1082,
202,
97,
469,
309,
12,
601,
422,
5011,
13164,
18,
2203,
3373,
3412,
67,
7425,
13,
288,
203,
9506,
202,
812,
1930,
25863,
273,
5011,
13164,
18,
588,
7416,
812,
5621,
203,
9506,
202,
430,
261,
5666,
25863,
18,
1808,
10756,
288,
203,
6862,
202,
430,
12,
3085,
631,
2011,
13,
2463,
31,
203,
6862,
202,
812,
1577,
48,
1693,
273,
394,
1387,
12,
3085,
16,
315,
80,
322,
8863,
203,
6862,
202,
430,
12,
5,
1214,
48,
1693,
18,
1808,
10756,
288,
203,
25083,
202,
1214,
48,
1693,
18,
26686,
5621,
203,
6862,
202,
97,
203,
203,
6862,
202,
812,
8526,
1390,
48,
1693,
273,
1577,
48,
1693,
18,
1098,
2697,
12,
2704,
2252,
18,
1594,
18,
29837,
1435,
288,
203,
25083,
202,
482,
1250,
2791,
12,
812,
585,
13,
288,
203,
6862,
1082,
202,
2463,
585,
18,
17994,
7675,
5839,
1190,
2932,
18,
80,
322,
8863,
203,
25083,
202,
97,
203,
6862,
202,
22938,
203,
203,
6862,
202,
1884,
12,
509,
417,
33,
20,
274,
417,
32,
2354,
48,
1693,
18,
2469,
274,
417,
27245,
288,
203,
25083,
202,
430,
12,
2354,
48,
1693,
63,
79,
8009,
17994,
7675,
8436,
12,
5666,
25863,
18,
17994,
1435,
3719,
288,
203,
6862,
1082,
202,
80,
322,
461,
4002,
273,
638,
31,
203,
25083,
202,
97,
203,
6862,
202,
97,
203,
6862,
202,
430,
12,
80,
322,
461,
4002,
13,
288,
203,
25083,
202,
10927,
273,
804,
1895,
8485,
18,
4500,
11269,
6353,
12,
2938,
6313,
6353,
16,
315,
812,
1704,
316,
9385,
863,
3371,
16,
29747,
7225,
1769,
203,
25083,
202,
430,
261,
10927,
422,
804,
1895,
8485,
18,
25268,
67,
7425,
13,
327,
31,
203,
6862,
202,
97,
469,
288,
203,
25083,
202,
812,
1262,
43,
49,
1013,
1693,
273,
394,
1387,
12,
1214,
48,
1693,
16,
1930,
25863,
18,
17994,
10663,
203,
25083,
202,
945,
2203,
8786,
12,
5666,
25863,
18,
588,
743,
9334,
1262,
43,
49,
1013,
1693,
18,
588,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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5535,
471,
1923,
358,
611,
5535,
1390,
1577,
18,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7dcc1ff54adaeb2c3c342d02ba4b2822ac453630 | iedadata/geomapapp | haxby/db/custom/DBInputDialog.java | [
"Apache-2.0"
] | Java | loadExcelFile | null | public void loadExcelFile() {
type = UnknownDataSet.EXCEL_FILE;
jfc = haxby.map.MapApp.getFileChooser();
jfc.setFileFilter(eff);
int c = jfc.showOpenDialog(this);
if (c==JFileChooser.CANCEL_OPTION || c == JFileChooser.ERROR_OPTION) {
// If user cancels then close the dialog box also.
input = null;
setVisible(false);
return;
}
path = jfc.getSelectedFile().getPath();
if(jfc.getSelectedFile().getName().endsWith("xls")){
loadExcelFile(jfc.getSelectedFile());
}else if(jfc.getSelectedFile().getName().endsWith("xlsx")){
loadExcelTypeXLSX(jfc.getSelectedFile());
}else{
return;
}
} | // Determines which excel format type file is selected and opens appropriately
| Determines which excel format type file is selected and opens appropriately | [
"Determines",
"which",
"excel",
"format",
"type",
"file",
"is",
"selected",
"and",
"opens",
"appropriately"
] | public void loadExcelFile() {
type = UnknownDataSet.EXCEL_FILE;
jfc = haxby.map.MapApp.getFileChooser();
jfc.setFileFilter(eff);
int c = jfc.showOpenDialog(this);
if (c==JFileChooser.CANCEL_OPTION || c == JFileChooser.ERROR_OPTION) {
input = null;
setVisible(false);
return;
}
path = jfc.getSelectedFile().getPath();
if(jfc.getSelectedFile().getName().endsWith("xls")){
loadExcelFile(jfc.getSelectedFile());
}else if(jfc.getSelectedFile().getName().endsWith("xlsx")){
loadExcelTypeXLSX(jfc.getSelectedFile());
}else{
return;
}
} | [
"public",
"void",
"loadExcelFile",
"(",
")",
"{",
"type",
"=",
"UnknownDataSet",
".",
"EXCEL_FILE",
";",
"jfc",
"=",
"haxby",
".",
"map",
".",
"MapApp",
".",
"getFileChooser",
"(",
")",
";",
"jfc",
".",
"setFileFilter",
"(",
"eff",
")",
";",
"int",
"c",
"=",
"jfc",
".",
"showOpenDialog",
"(",
"this",
")",
";",
"if",
"(",
"c",
"==",
"JFileChooser",
".",
"CANCEL_OPTION",
"||",
"c",
"==",
"JFileChooser",
".",
"ERROR_OPTION",
")",
"{",
"input",
"=",
"null",
";",
"setVisible",
"(",
"false",
")",
";",
"return",
";",
"}",
"path",
"=",
"jfc",
".",
"getSelectedFile",
"(",
")",
".",
"getPath",
"(",
")",
";",
"if",
"(",
"jfc",
".",
"getSelectedFile",
"(",
")",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\"xls\"",
")",
")",
"{",
"loadExcelFile",
"(",
"jfc",
".",
"getSelectedFile",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"jfc",
".",
"getSelectedFile",
"(",
")",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\"xlsx\"",
")",
")",
"{",
"loadExcelTypeXLSX",
"(",
"jfc",
".",
"getSelectedFile",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
";",
"}",
"}"
] | Determines which excel format type file is selected and opens appropriately | [
"Determines",
"which",
"excel",
"format",
"type",
"file",
"is",
"selected",
"and",
"opens",
"appropriately"
] | [
"// If user cancels then close the dialog box also.\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1262,
7177,
812,
1435,
288,
206,
203,
202,
202,
723,
273,
9077,
13676,
18,
2294,
28746,
67,
3776,
31,
206,
203,
202,
202,
78,
7142,
273,
366,
651,
1637,
18,
1458,
18,
863,
3371,
18,
29925,
17324,
5621,
206,
203,
202,
202,
78,
7142,
18,
542,
29837,
12,
17098,
1769,
206,
203,
202,
202,
474,
276,
273,
525,
7142,
18,
4500,
3678,
6353,
12,
2211,
1769,
206,
203,
202,
202,
430,
261,
71,
631,
46,
812,
17324,
18,
25268,
67,
7425,
747,
276,
422,
804,
812,
17324,
18,
3589,
67,
7425,
13,
288,
206,
203,
1082,
202,
759,
971,
729,
3755,
87,
1508,
1746,
326,
6176,
3919,
2546,
18,
206,
203,
1082,
202,
2630,
273,
446,
31,
206,
203,
1082,
202,
542,
6207,
12,
5743,
1769,
206,
203,
1082,
202,
2463,
31,
206,
203,
202,
202,
97,
206,
203,
202,
202,
803,
273,
525,
7142,
18,
588,
7416,
812,
7675,
588,
743,
5621,
206,
203,
202,
202,
430,
12,
78,
7142,
18,
588,
7416,
812,
7675,
17994,
7675,
5839,
1190,
2932,
92,
3251,
6,
3719,
95,
206,
203,
1082,
202,
945,
7177,
812,
12,
78,
7142,
18,
588,
7416,
812,
10663,
206,
203,
202,
202,
97,
12107,
309,
12,
78,
7142,
18,
588,
7416,
812,
7675,
17994,
7675,
5839,
1190,
2932,
92,
14917,
6,
3719,
95,
206,
203,
1082,
202,
945,
7177,
559,
60,
3045,
60,
12,
78,
7142,
18,
588,
7416,
812,
10663,
206,
203,
202,
202,
97,
12107,
95,
206,
203,
1082,
202,
2463,
31,
206,
203,
202,
202,
97,
206,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
759,
30778,
1492,
22011,
740,
618,
585,
353,
3170,
471,
10400,
21419,
206,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7dcc1ff54adaeb2c3c342d02ba4b2822ac453630 | iedadata/geomapapp | haxby/db/custom/DBInputDialog.java | [
"Apache-2.0"
] | Java | loadExcelFile | null | public void loadExcelFile(File f){
final File f1 = f;
final DBInputDialog diag = this;
new Thread(){
File f = f1;
public void run(){
int length = (int)f.length();
JDialog d = new JDialog((Frame)null, "Loading File");
JPanel p = new JPanel(new BorderLayout());
p.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
d.setLocationRelativeTo(null);
JProgressBar pb = new JProgressBar(0,length);
p.add(new JLabel("Loading " + (length / 1000) + " kb file"), BorderLayout.NORTH);
p.add(pb);
d.getContentPane().add(p);
d.pack();
d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
d.setVisible(true);
d.setAlwaysOnTop(true);
String excelPath = f.getPath();
//HSSFWorkbook workbook = new HSSFWorkbook();
try {
HSSFWorkbook workbook = new HSSFWorkbook();
workbook = new HSSFWorkbook(new FileInputStream(excelPath));
if (workbook.getNumberOfSheets()<0) return;
//System.out.println(workbook.getNumberOfSheets());
StringBuffer sb2 = new StringBuffer();
if(workbook.getSheetAt(0) != null){
String sheetname = workbook.getSheetName(0);
// XSSFExcelExtractor extract = null;
HSSFSheet worksheet = workbook.getSheetAt(0);
// Check the columns usually first row of titles for columns. Just incase check next row.
int numCol = worksheet.getRow(0).getLastCellNum();
int numCol1 = worksheet.getRow(1).getLastCellNum();
if (numCol1 > numCol) {
numCol = numCol1;
}
HSSFFormulaEvaluator formulaEvaluator = new HSSFFormulaEvaluator(workbook);
omitCount = 0;
for (int i = 0; i < worksheet.getLastRowNum()+1; i++) {
for (int j = 0; j < numCol; j++) {
formulaEvaluator.evaluateInCell(worksheet.getRow(i).getCell(j));
sb2.append(worksheet.getRow(i).getCell(j) + "\t");
pb.setValue(pb.getValue()+ (((""+worksheet.getRow(i).getCell(j)).length()*2) + 38));
pb.repaint();
}
sb2.append("\n");
try {
if(formulaEvaluator.evaluateInCell(worksheet.getRow(i).getCell(0)).getStringCellValue().startsWith("#")) {
omitCount ++;
}
} catch (IllegalStateException ix) {}
//System.out.println(worksheet.getRow(1).getCell(1)+ " R " + worksheet.getLastRowNum() + " c " + worksheet.getRow(1).getLastCellNum());
//String excelText = extract.getText().replaceFirst(sheetname+"\n", "");
}
name.setText(f.getName().substring(0, f.getName().lastIndexOf('.')));
input.setText(sb2.toString());
MapApp.sendLogMessage("Imported_Excel_Table&name="+name.getText());
System.out.println("Detected " + omitCount + " commented row(s). Commented data rows will not be plotted.");
detectMessage.setText("<html>Detected <b>" + omitCount + " </b> commented row(s).<br>Commented data rows <b>will not</b> be plotted.<br>Click Refresh to view updated count.</html>");
pack();
}
} catch (OldExcelFormatException oe){
d.setVisible(false);
d.setEnabled(false);
cDialog.doClick();
JOptionPane.showMessageDialog(null, "The supplied spreadsheet seems to be Excel 5.0/7.0 format\n" +
"or older and is not supported. Please save the file in a newer\n" +
"Excel format (such as 97-2003 .xls or 2007 .xlsx) and try\n" +
"again to import it.", "Warning",JOptionPane.ERROR_MESSAGE ) ;// message to user
oe.printStackTrace();
return;
} catch (IOException e1) {
e1.printStackTrace();
}
d.dispose();
System.out.println("data ready");
}
}.start();
} | // Reads the selected file type .xls and sets it as the input text.
| Reads the selected file type .xls and sets it as the input text. | [
"Reads",
"the",
"selected",
"file",
"type",
".",
"xls",
"and",
"sets",
"it",
"as",
"the",
"input",
"text",
"."
] | public void loadExcelFile(File f){
final File f1 = f;
final DBInputDialog diag = this;
new Thread(){
File f = f1;
public void run(){
int length = (int)f.length();
JDialog d = new JDialog((Frame)null, "Loading File");
JPanel p = new JPanel(new BorderLayout());
p.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
d.setLocationRelativeTo(null);
JProgressBar pb = new JProgressBar(0,length);
p.add(new JLabel("Loading " + (length / 1000) + " kb file"), BorderLayout.NORTH);
p.add(pb);
d.getContentPane().add(p);
d.pack();
d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
d.setVisible(true);
d.setAlwaysOnTop(true);
String excelPath = f.getPath();
try {
HSSFWorkbook workbook = new HSSFWorkbook();
workbook = new HSSFWorkbook(new FileInputStream(excelPath));
if (workbook.getNumberOfSheets()<0) return;
StringBuffer sb2 = new StringBuffer();
if(workbook.getSheetAt(0) != null){
String sheetname = workbook.getSheetName(0);
HSSFSheet worksheet = workbook.getSheetAt(0);
int numCol = worksheet.getRow(0).getLastCellNum();
int numCol1 = worksheet.getRow(1).getLastCellNum();
if (numCol1 > numCol) {
numCol = numCol1;
}
HSSFFormulaEvaluator formulaEvaluator = new HSSFFormulaEvaluator(workbook);
omitCount = 0;
for (int i = 0; i < worksheet.getLastRowNum()+1; i++) {
for (int j = 0; j < numCol; j++) {
formulaEvaluator.evaluateInCell(worksheet.getRow(i).getCell(j));
sb2.append(worksheet.getRow(i).getCell(j) + "\t");
pb.setValue(pb.getValue()+ (((""+worksheet.getRow(i).getCell(j)).length()*2) + 38));
pb.repaint();
}
sb2.append("\n");
try {
if(formulaEvaluator.evaluateInCell(worksheet.getRow(i).getCell(0)).getStringCellValue().startsWith("#")) {
omitCount ++;
}
} catch (IllegalStateException ix) {}
}
name.setText(f.getName().substring(0, f.getName().lastIndexOf('.')));
input.setText(sb2.toString());
MapApp.sendLogMessage("Imported_Excel_Table&name="+name.getText());
System.out.println("Detected " + omitCount + " commented row(s). Commented data rows will not be plotted.");
detectMessage.setText("<html>Detected <b>" + omitCount + " </b> commented row(s).<br>Commented data rows <b>will not</b> be plotted.<br>Click Refresh to view updated count.</html>");
pack();
}
} catch (OldExcelFormatException oe){
d.setVisible(false);
d.setEnabled(false);
cDialog.doClick();
JOptionPane.showMessageDialog(null, "The supplied spreadsheet seems to be Excel 5.0/7.0 format\n" +
"or older and is not supported. Please save the file in a newer\n" +
"Excel format (such as 97-2003 .xls or 2007 .xlsx) and try\n" +
"again to import it.", "Warning",JOptionPane.ERROR_MESSAGE ) ;
oe.printStackTrace();
return;
} catch (IOException e1) {
e1.printStackTrace();
}
d.dispose();
System.out.println("data ready");
}
}.start();
} | [
"public",
"void",
"loadExcelFile",
"(",
"File",
"f",
")",
"{",
"final",
"File",
"f1",
"=",
"f",
";",
"final",
"DBInputDialog",
"diag",
"=",
"this",
";",
"new",
"Thread",
"(",
")",
"{",
"File",
"f",
"=",
"f1",
";",
"public",
"void",
"run",
"(",
")",
"{",
"int",
"length",
"=",
"(",
"int",
")",
"f",
".",
"length",
"(",
")",
";",
"JDialog",
"d",
"=",
"new",
"JDialog",
"(",
"(",
"Frame",
")",
"null",
",",
"\"Loading File\"",
")",
";",
"JPanel",
"p",
"=",
"new",
"JPanel",
"(",
"new",
"BorderLayout",
"(",
")",
")",
";",
"p",
".",
"setBorder",
"(",
"BorderFactory",
".",
"createEmptyBorder",
"(",
"1",
",",
"1",
",",
"1",
",",
"1",
")",
")",
";",
"d",
".",
"setLocationRelativeTo",
"(",
"null",
")",
";",
"JProgressBar",
"pb",
"=",
"new",
"JProgressBar",
"(",
"0",
",",
"length",
")",
";",
"p",
".",
"add",
"(",
"new",
"JLabel",
"(",
"\"Loading \"",
"+",
"(",
"length",
"/",
"1000",
")",
"+",
"\" kb file\"",
")",
",",
"BorderLayout",
".",
"NORTH",
")",
";",
"p",
".",
"add",
"(",
"pb",
")",
";",
"d",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"p",
")",
";",
"d",
".",
"pack",
"(",
")",
";",
"d",
".",
"setDefaultCloseOperation",
"(",
"JDialog",
".",
"DISPOSE_ON_CLOSE",
")",
";",
"d",
".",
"setVisible",
"(",
"true",
")",
";",
"d",
".",
"setAlwaysOnTop",
"(",
"true",
")",
";",
"String",
"excelPath",
"=",
"f",
".",
"getPath",
"(",
")",
";",
"try",
"{",
"HSSFWorkbook",
"workbook",
"=",
"new",
"HSSFWorkbook",
"(",
")",
";",
"workbook",
"=",
"new",
"HSSFWorkbook",
"(",
"new",
"FileInputStream",
"(",
"excelPath",
")",
")",
";",
"if",
"(",
"workbook",
".",
"getNumberOfSheets",
"(",
")",
"<",
"0",
")",
"return",
";",
"StringBuffer",
"sb2",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"workbook",
".",
"getSheetAt",
"(",
"0",
")",
"!=",
"null",
")",
"{",
"String",
"sheetname",
"=",
"workbook",
".",
"getSheetName",
"(",
"0",
")",
";",
"HSSFSheet",
"worksheet",
"=",
"workbook",
".",
"getSheetAt",
"(",
"0",
")",
";",
"int",
"numCol",
"=",
"worksheet",
".",
"getRow",
"(",
"0",
")",
".",
"getLastCellNum",
"(",
")",
";",
"int",
"numCol1",
"=",
"worksheet",
".",
"getRow",
"(",
"1",
")",
".",
"getLastCellNum",
"(",
")",
";",
"if",
"(",
"numCol1",
">",
"numCol",
")",
"{",
"numCol",
"=",
"numCol1",
";",
"}",
"HSSFFormulaEvaluator",
"formulaEvaluator",
"=",
"new",
"HSSFFormulaEvaluator",
"(",
"workbook",
")",
";",
"omitCount",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"worksheet",
".",
"getLastRowNum",
"(",
")",
"+",
"1",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"numCol",
";",
"j",
"++",
")",
"{",
"formulaEvaluator",
".",
"evaluateInCell",
"(",
"worksheet",
".",
"getRow",
"(",
"i",
")",
".",
"getCell",
"(",
"j",
")",
")",
";",
"sb2",
".",
"append",
"(",
"worksheet",
".",
"getRow",
"(",
"i",
")",
".",
"getCell",
"(",
"j",
")",
"+",
"\"\\t\"",
")",
";",
"pb",
".",
"setValue",
"(",
"pb",
".",
"getValue",
"(",
")",
"+",
"(",
"(",
"(",
"\"\"",
"+",
"worksheet",
".",
"getRow",
"(",
"i",
")",
".",
"getCell",
"(",
"j",
")",
")",
".",
"length",
"(",
")",
"*",
"2",
")",
"+",
"38",
")",
")",
";",
"pb",
".",
"repaint",
"(",
")",
";",
"}",
"sb2",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"try",
"{",
"if",
"(",
"formulaEvaluator",
".",
"evaluateInCell",
"(",
"worksheet",
".",
"getRow",
"(",
"i",
")",
".",
"getCell",
"(",
"0",
")",
")",
".",
"getStringCellValue",
"(",
")",
".",
"startsWith",
"(",
"\"#\"",
")",
")",
"{",
"omitCount",
"++",
";",
"}",
"}",
"catch",
"(",
"IllegalStateException",
"ix",
")",
"{",
"}",
"}",
"name",
".",
"setText",
"(",
"f",
".",
"getName",
"(",
")",
".",
"substring",
"(",
"0",
",",
"f",
".",
"getName",
"(",
")",
".",
"lastIndexOf",
"(",
"'.'",
")",
")",
")",
";",
"input",
".",
"setText",
"(",
"sb2",
".",
"toString",
"(",
")",
")",
";",
"MapApp",
".",
"sendLogMessage",
"(",
"\"Imported_Excel_Table&name=\"",
"+",
"name",
".",
"getText",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Detected \"",
"+",
"omitCount",
"+",
"\" commented row(s). Commented data rows will not be plotted.\"",
")",
";",
"detectMessage",
".",
"setText",
"(",
"\"<html>Detected <b>\"",
"+",
"omitCount",
"+",
"\" </b> commented row(s).<br>Commented data rows <b>will not</b> be plotted.<br>Click Refresh to view updated count.</html>\"",
")",
";",
"pack",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"OldExcelFormatException",
"oe",
")",
"{",
"d",
".",
"setVisible",
"(",
"false",
")",
";",
"d",
".",
"setEnabled",
"(",
"false",
")",
";",
"cDialog",
".",
"doClick",
"(",
")",
";",
"JOptionPane",
".",
"showMessageDialog",
"(",
"null",
",",
"\"The supplied spreadsheet seems to be Excel 5.0/7.0 format\\n\"",
"+",
"\"or older and is not supported. Please save the file in a newer\\n\"",
"+",
"\"Excel format (such as 97-2003 .xls or 2007 .xlsx) and try\\n\"",
"+",
"\"again to import it.\"",
",",
"\"Warning\"",
",",
"JOptionPane",
".",
"ERROR_MESSAGE",
")",
";",
"oe",
".",
"printStackTrace",
"(",
")",
";",
"return",
";",
"}",
"catch",
"(",
"IOException",
"e1",
")",
"{",
"e1",
".",
"printStackTrace",
"(",
")",
";",
"}",
"d",
".",
"dispose",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"data ready\"",
")",
";",
"}",
"}",
".",
"start",
"(",
")",
";",
"}"
] | Reads the selected file type .xls and sets it as the input text. | [
"Reads",
"the",
"selected",
"file",
"type",
".",
"xls",
"and",
"sets",
"it",
"as",
"the",
"input",
"text",
"."
] | [
"//HSSFWorkbook workbook = new HSSFWorkbook();\r",
"//System.out.println(workbook.getNumberOfSheets());\r",
"//\tXSSFExcelExtractor extract = null;\r",
"// Check the columns usually first row of titles for columns. Just incase check next row.\r",
"//System.out.println(worksheet.getRow(1).getCell(1)+ \" R \" + worksheet.getLastRowNum() + \" c \" + worksheet.getRow(1).getLastCellNum());\r",
"//String excelText = extract.getText().replaceFirst(sheetname+\"\\n\", \"\");\r",
"// message to user\r"
] | [
{
"param": "f",
"type": "File"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1262,
7177,
812,
12,
812,
284,
15329,
206,
203,
202,
202,
6385,
1387,
284,
21,
273,
284,
31,
206,
203,
202,
202,
6385,
2383,
1210,
6353,
6643,
273,
333,
31,
206,
203,
202,
202,
2704,
4884,
1435,
95,
206,
203,
1082,
202,
812,
284,
273,
284,
21,
31,
206,
203,
1082,
202,
482,
918,
1086,
1435,
95,
206,
203,
202,
202,
474,
769,
273,
261,
474,
13,
74,
18,
2469,
5621,
206,
203,
202,
202,
46,
6353,
302,
273,
394,
804,
6353,
12443,
3219,
13,
2011,
16,
315,
10515,
1387,
8863,
206,
203,
202,
202,
46,
5537,
293,
273,
394,
24048,
12,
2704,
30814,
10663,
206,
203,
202,
202,
84,
18,
542,
8107,
12,
8107,
1733,
18,
2640,
1921,
8107,
12,
21,
16,
404,
16,
404,
16,
404,
10019,
206,
203,
202,
202,
72,
18,
542,
2735,
8574,
774,
12,
2011,
1769,
206,
203,
202,
202,
46,
31547,
6386,
273,
394,
804,
31547,
12,
20,
16,
2469,
1769,
206,
203,
202,
202,
84,
18,
1289,
12,
2704,
21403,
2932,
10515,
315,
397,
261,
2469,
342,
4336,
13,
397,
315,
9182,
585,
6,
3631,
30814,
18,
50,
28212,
1769,
206,
203,
202,
202,
84,
18,
1289,
12,
5733,
1769,
206,
203,
202,
202,
72,
18,
588,
1350,
8485,
7675,
1289,
12,
84,
1769,
206,
203,
202,
202,
72,
18,
2920,
5621,
206,
203,
202,
202,
72,
18,
542,
1868,
4605,
2988,
12,
46,
6353,
18,
13498,
23757,
67,
673,
67,
13384,
1769,
206,
203,
202,
202,
72,
18,
542,
6207,
12,
3767,
1769,
9760,
203,
202,
202,
72,
18,
542,
18806,
1398,
3401,
12,
3767,
1769,
206,
203,
202,
202,
780,
22011,
743,
273,
284,
18,
588,
743,
5621,
206,
203,
202,
202,
759,
44,
1260,
42,
23345,
18985,
273,
394,
670,
1260,
42,
23345,
5621,
206,
203,
206,
203,
202,
202,
698,
288,
206,
203,
1082,
202,
44,
1260,
42,
23345,
18985,
273,
394,
670,
1260,
42,
23345,
5621,
206,
203,
1082,
202,
1252,
3618,
273,
394,
670,
1260,
42,
23345,
12,
2704,
11907,
12,
24121,
743,
10019,
206,
203,
1082,
202,
430,
261,
1252,
3618,
18,
588,
9226,
55,
10245,
1435,
32,
20,
13,
327,
31,
206,
203,
1082,
202,
759,
3163,
18,
659,
18,
8222,
12,
1252,
3618,
18,
588,
9226,
55,
10245,
10663,
206,
203,
206,
203,
1082,
202,
780,
1892,
2393,
22,
273,
394,
6674,
5621,
206,
203,
1082,
202,
430,
12,
1252,
3618,
18,
588,
8229,
861,
12,
20,
13,
480,
446,
15329,
206,
203,
9506,
202,
780,
6202,
529,
273,
18985,
18,
588,
8229,
461,
12,
20,
1769,
206,
203,
9506,
202,
759,
202,
60,
1260,
42,
7177,
10958,
2608,
273,
446,
31,
206,
203,
9506,
202,
44,
1260,
4931,
2963,
13622,
273,
18985,
18,
588,
8229,
861,
12,
20,
1769,
206,
203,
9506,
202,
759,
2073,
326,
2168,
11234,
1122,
1027,
434,
14693,
364,
2168,
18,
12526,
316,
3593,
866,
1024,
1027,
18,
206,
203,
9506,
202,
474,
818,
914,
273,
13622,
18,
588,
1999,
12,
20,
2934,
588,
3024,
4020,
2578,
5621,
206,
203,
9506,
202,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
759,
29185,
326,
3170,
585,
618,
263,
92,
3251,
471,
1678,
518,
487,
326,
810,
977,
18,
206,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7dcc1ff54adaeb2c3c342d02ba4b2822ac453630 | iedadata/geomapapp | haxby/db/custom/DBInputDialog.java | [
"Apache-2.0"
] | Java | loadExcelTypeXLSX | null | public void loadExcelTypeXLSX(File f){
final File f1 = f;
new Thread(){
File f = f1;
public void run(){
int length = (int)f.length();
JDialog d = new JDialog((Frame)null, "Loading File");
JPanel p = new JPanel(new BorderLayout());
p.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
d.setLocationRelativeTo(null);
JProgressBar pb = new JProgressBar(0,length);
p.add(new JLabel("Loading " + (length / 1000) + " kb file"), BorderLayout.NORTH);
p.add(pb);
d.getContentPane().add(p);
d.pack();
d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
d.setVisible(true);
d.setAlwaysOnTop(true);
//String excelPath = f1.getPath();
//XSSFWorkbook workbook = new XSSFWorkbook(excelPath);
omitCount = 0;
try {
FileInputStream fis = new FileInputStream(f);
XSSFWorkbook workbook = new XSSFWorkbook(fis);
if (workbook.getNumberOfSheets()<0) {return;}
//System.out.println(workbook.getNumberOfSheets());
StringBuffer sb2 = new StringBuffer();
if(workbook.getSheetAt(0) != null){
String sheetname = workbook.getSheetName(0);
// XSSFExcelExtractor extract = null;
XSSFSheet worksheet = workbook.getSheetAt(0);
// Check the columns usually first row of titles for columns. Just incase check next row.
int numCol = worksheet.getRow(0).getLastCellNum();
int numCol1 = worksheet.getRow(1).getLastCellNum();
if (numCol1 > numCol) {
numCol = numCol1;
}
XSSFFormulaEvaluator formulaEvaluator = new XSSFFormulaEvaluator(workbook);
for (int i = 0; i < worksheet.getLastRowNum()+1; i++) {
for (int j = 0; j < numCol; j++){
formulaEvaluator.evaluateInCell(worksheet.getRow(i).getCell(j));
sb2.append(worksheet.getRow(i).getCell(j) + "\t");
pb.setValue(pb.getValue()+ (((""+worksheet.getRow(i).getCell(j)).length()*2) + 38));
pb.repaint();
}
sb2.append("\n");
try {
if(worksheet.getRow(i).getCell(0).getStringCellValue().startsWith("#")) {
omitCount ++;
}
} catch (IllegalStateException ix) {}
//System.out.println(worksheet.getRow(1).getCell(1)+ " R " + worksheet.getLastRowNum() + " c " + worksheet.getRow(1).getLastCellNum());
//String excelText = extract.getText().replaceFirst(sheetname+"\n", "");
//input.setText(excelText);
}
name.setText(f.getName().substring(0, f.getName().lastIndexOf('.')));
//System.out.println(sb2.toString());
input.setText(sb2.toString());
MapApp.sendLogMessage("Imported_ExcelXLSX_Table&name="+name.getText());
System.out.println("Detected " + omitCount + " commented row(s). Commented data rows will not be plotted.");
detectMessage.setText("<html>Detected <b>" + omitCount + " </b> commented row(s).<br>Commented data rows <b>will not</b> be plotted.<br>Click Refresh to view updated count.</html>");
pack();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
d.dispose();
System.out.println("data ready");
}
}.start();
} | // Reads the selected file type .xlsx and sets it as the input text.
| Reads the selected file type .xlsx and sets it as the input text. | [
"Reads",
"the",
"selected",
"file",
"type",
".",
"xlsx",
"and",
"sets",
"it",
"as",
"the",
"input",
"text",
"."
] | public void loadExcelTypeXLSX(File f){
final File f1 = f;
new Thread(){
File f = f1;
public void run(){
int length = (int)f.length();
JDialog d = new JDialog((Frame)null, "Loading File");
JPanel p = new JPanel(new BorderLayout());
p.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
d.setLocationRelativeTo(null);
JProgressBar pb = new JProgressBar(0,length);
p.add(new JLabel("Loading " + (length / 1000) + " kb file"), BorderLayout.NORTH);
p.add(pb);
d.getContentPane().add(p);
d.pack();
d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
d.setVisible(true);
d.setAlwaysOnTop(true);
omitCount = 0;
try {
FileInputStream fis = new FileInputStream(f);
XSSFWorkbook workbook = new XSSFWorkbook(fis);
if (workbook.getNumberOfSheets()<0) {return;}
StringBuffer sb2 = new StringBuffer();
if(workbook.getSheetAt(0) != null){
String sheetname = workbook.getSheetName(0);
XSSFSheet worksheet = workbook.getSheetAt(0);
int numCol = worksheet.getRow(0).getLastCellNum();
int numCol1 = worksheet.getRow(1).getLastCellNum();
if (numCol1 > numCol) {
numCol = numCol1;
}
XSSFFormulaEvaluator formulaEvaluator = new XSSFFormulaEvaluator(workbook);
for (int i = 0; i < worksheet.getLastRowNum()+1; i++) {
for (int j = 0; j < numCol; j++){
formulaEvaluator.evaluateInCell(worksheet.getRow(i).getCell(j));
sb2.append(worksheet.getRow(i).getCell(j) + "\t");
pb.setValue(pb.getValue()+ (((""+worksheet.getRow(i).getCell(j)).length()*2) + 38));
pb.repaint();
}
sb2.append("\n");
try {
if(worksheet.getRow(i).getCell(0).getStringCellValue().startsWith("#")) {
omitCount ++;
}
} catch (IllegalStateException ix) {}
}
name.setText(f.getName().substring(0, f.getName().lastIndexOf('.')));
input.setText(sb2.toString());
MapApp.sendLogMessage("Imported_ExcelXLSX_Table&name="+name.getText());
System.out.println("Detected " + omitCount + " commented row(s). Commented data rows will not be plotted.");
detectMessage.setText("<html>Detected <b>" + omitCount + " </b> commented row(s).<br>Commented data rows <b>will not</b> be plotted.<br>Click Refresh to view updated count.</html>");
pack();
}
} catch (IOException e) {
e.printStackTrace();
}
d.dispose();
System.out.println("data ready");
}
}.start();
} | [
"public",
"void",
"loadExcelTypeXLSX",
"(",
"File",
"f",
")",
"{",
"final",
"File",
"f1",
"=",
"f",
";",
"new",
"Thread",
"(",
")",
"{",
"File",
"f",
"=",
"f1",
";",
"public",
"void",
"run",
"(",
")",
"{",
"int",
"length",
"=",
"(",
"int",
")",
"f",
".",
"length",
"(",
")",
";",
"JDialog",
"d",
"=",
"new",
"JDialog",
"(",
"(",
"Frame",
")",
"null",
",",
"\"Loading File\"",
")",
";",
"JPanel",
"p",
"=",
"new",
"JPanel",
"(",
"new",
"BorderLayout",
"(",
")",
")",
";",
"p",
".",
"setBorder",
"(",
"BorderFactory",
".",
"createEmptyBorder",
"(",
"1",
",",
"1",
",",
"1",
",",
"1",
")",
")",
";",
"d",
".",
"setLocationRelativeTo",
"(",
"null",
")",
";",
"JProgressBar",
"pb",
"=",
"new",
"JProgressBar",
"(",
"0",
",",
"length",
")",
";",
"p",
".",
"add",
"(",
"new",
"JLabel",
"(",
"\"Loading \"",
"+",
"(",
"length",
"/",
"1000",
")",
"+",
"\" kb file\"",
")",
",",
"BorderLayout",
".",
"NORTH",
")",
";",
"p",
".",
"add",
"(",
"pb",
")",
";",
"d",
".",
"getContentPane",
"(",
")",
".",
"add",
"(",
"p",
")",
";",
"d",
".",
"pack",
"(",
")",
";",
"d",
".",
"setDefaultCloseOperation",
"(",
"JDialog",
".",
"DISPOSE_ON_CLOSE",
")",
";",
"d",
".",
"setVisible",
"(",
"true",
")",
";",
"d",
".",
"setAlwaysOnTop",
"(",
"true",
")",
";",
"omitCount",
"=",
"0",
";",
"try",
"{",
"FileInputStream",
"fis",
"=",
"new",
"FileInputStream",
"(",
"f",
")",
";",
"XSSFWorkbook",
"workbook",
"=",
"new",
"XSSFWorkbook",
"(",
"fis",
")",
";",
"if",
"(",
"workbook",
".",
"getNumberOfSheets",
"(",
")",
"<",
"0",
")",
"{",
"return",
";",
"}",
"StringBuffer",
"sb2",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"if",
"(",
"workbook",
".",
"getSheetAt",
"(",
"0",
")",
"!=",
"null",
")",
"{",
"String",
"sheetname",
"=",
"workbook",
".",
"getSheetName",
"(",
"0",
")",
";",
"XSSFSheet",
"worksheet",
"=",
"workbook",
".",
"getSheetAt",
"(",
"0",
")",
";",
"int",
"numCol",
"=",
"worksheet",
".",
"getRow",
"(",
"0",
")",
".",
"getLastCellNum",
"(",
")",
";",
"int",
"numCol1",
"=",
"worksheet",
".",
"getRow",
"(",
"1",
")",
".",
"getLastCellNum",
"(",
")",
";",
"if",
"(",
"numCol1",
">",
"numCol",
")",
"{",
"numCol",
"=",
"numCol1",
";",
"}",
"XSSFFormulaEvaluator",
"formulaEvaluator",
"=",
"new",
"XSSFFormulaEvaluator",
"(",
"workbook",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"worksheet",
".",
"getLastRowNum",
"(",
")",
"+",
"1",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"numCol",
";",
"j",
"++",
")",
"{",
"formulaEvaluator",
".",
"evaluateInCell",
"(",
"worksheet",
".",
"getRow",
"(",
"i",
")",
".",
"getCell",
"(",
"j",
")",
")",
";",
"sb2",
".",
"append",
"(",
"worksheet",
".",
"getRow",
"(",
"i",
")",
".",
"getCell",
"(",
"j",
")",
"+",
"\"\\t\"",
")",
";",
"pb",
".",
"setValue",
"(",
"pb",
".",
"getValue",
"(",
")",
"+",
"(",
"(",
"(",
"\"\"",
"+",
"worksheet",
".",
"getRow",
"(",
"i",
")",
".",
"getCell",
"(",
"j",
")",
")",
".",
"length",
"(",
")",
"*",
"2",
")",
"+",
"38",
")",
")",
";",
"pb",
".",
"repaint",
"(",
")",
";",
"}",
"sb2",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"try",
"{",
"if",
"(",
"worksheet",
".",
"getRow",
"(",
"i",
")",
".",
"getCell",
"(",
"0",
")",
".",
"getStringCellValue",
"(",
")",
".",
"startsWith",
"(",
"\"#\"",
")",
")",
"{",
"omitCount",
"++",
";",
"}",
"}",
"catch",
"(",
"IllegalStateException",
"ix",
")",
"{",
"}",
"}",
"name",
".",
"setText",
"(",
"f",
".",
"getName",
"(",
")",
".",
"substring",
"(",
"0",
",",
"f",
".",
"getName",
"(",
")",
".",
"lastIndexOf",
"(",
"'.'",
")",
")",
")",
";",
"input",
".",
"setText",
"(",
"sb2",
".",
"toString",
"(",
")",
")",
";",
"MapApp",
".",
"sendLogMessage",
"(",
"\"Imported_ExcelXLSX_Table&name=\"",
"+",
"name",
".",
"getText",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Detected \"",
"+",
"omitCount",
"+",
"\" commented row(s). Commented data rows will not be plotted.\"",
")",
";",
"detectMessage",
".",
"setText",
"(",
"\"<html>Detected <b>\"",
"+",
"omitCount",
"+",
"\" </b> commented row(s).<br>Commented data rows <b>will not</b> be plotted.<br>Click Refresh to view updated count.</html>\"",
")",
";",
"pack",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"d",
".",
"dispose",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"data ready\"",
")",
";",
"}",
"}",
".",
"start",
"(",
")",
";",
"}"
] | Reads the selected file type .xlsx and sets it as the input text. | [
"Reads",
"the",
"selected",
"file",
"type",
".",
"xlsx",
"and",
"sets",
"it",
"as",
"the",
"input",
"text",
"."
] | [
"//String excelPath = f1.getPath();\r",
"//XSSFWorkbook workbook = new XSSFWorkbook(excelPath);\r",
"//System.out.println(workbook.getNumberOfSheets());\r",
"//\tXSSFExcelExtractor extract = null;\r",
"// Check the columns usually first row of titles for columns. Just incase check next row.\r",
"//System.out.println(worksheet.getRow(1).getCell(1)+ \" R \" + worksheet.getLastRowNum() + \" c \" + worksheet.getRow(1).getLastCellNum());\r",
"//String excelText = extract.getText().replaceFirst(sheetname+\"\\n\", \"\");\r",
"//input.setText(excelText);\r",
"//System.out.println(sb2.toString());\r",
"// TODO Auto-generated catch block\r"
] | [
{
"param": "f",
"type": "File"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "f",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1262,
7177,
559,
60,
3045,
60,
12,
812,
284,
15329,
206,
203,
202,
202,
6385,
1387,
284,
21,
273,
284,
31,
206,
203,
206,
203,
202,
202,
2704,
4884,
1435,
95,
206,
203,
1082,
202,
812,
284,
273,
284,
21,
31,
206,
203,
1082,
202,
482,
918,
1086,
1435,
95,
206,
203,
202,
202,
474,
769,
273,
261,
474,
13,
74,
18,
2469,
5621,
206,
203,
202,
202,
46,
6353,
302,
273,
394,
804,
6353,
12443,
3219,
13,
2011,
16,
315,
10515,
1387,
8863,
206,
203,
202,
202,
46,
5537,
293,
273,
394,
24048,
12,
2704,
30814,
10663,
206,
203,
202,
202,
84,
18,
542,
8107,
12,
8107,
1733,
18,
2640,
1921,
8107,
12,
21,
16,
404,
16,
404,
16,
404,
10019,
206,
203,
202,
202,
72,
18,
542,
2735,
8574,
774,
12,
2011,
1769,
206,
203,
202,
202,
46,
31547,
6386,
273,
394,
804,
31547,
12,
20,
16,
2469,
1769,
206,
203,
202,
202,
84,
18,
1289,
12,
2704,
21403,
2932,
10515,
315,
397,
261,
2469,
342,
4336,
13,
397,
315,
9182,
585,
6,
3631,
30814,
18,
50,
28212,
1769,
206,
203,
202,
202,
84,
18,
1289,
12,
5733,
1769,
206,
203,
202,
202,
72,
18,
588,
1350,
8485,
7675,
1289,
12,
84,
1769,
206,
203,
202,
202,
72,
18,
2920,
5621,
206,
203,
202,
202,
72,
18,
542,
1868,
4605,
2988,
12,
46,
6353,
18,
13498,
23757,
67,
673,
67,
13384,
1769,
206,
203,
202,
202,
72,
18,
542,
6207,
12,
3767,
1769,
9760,
203,
202,
202,
72,
18,
542,
18806,
1398,
3401,
12,
3767,
1769,
206,
203,
206,
203,
202,
202,
759,
780,
22011,
743,
273,
284,
21,
18,
588,
743,
5621,
206,
203,
202,
202,
759,
60,
1260,
42,
23345,
18985,
273,
394,
1139,
1260,
42,
23345,
12,
24121,
743,
1769,
206,
203,
202,
202,
362,
305,
1380,
273,
374,
31,
206,
203,
202,
202,
698,
288,
206,
203,
1082,
202,
812,
4348,
15324,
273,
394,
11907,
12,
74,
1769,
206,
203,
1082,
202,
60,
1260,
42,
23345,
18985,
273,
394,
1139,
1260,
42,
23345,
12,
74,
291,
1769,
206,
203,
206,
203,
1082,
202,
430,
261,
1252,
3618,
18,
588,
9226,
55,
10245,
1435,
32,
20,
13,
288,
2463,
31,
97,
206,
203,
206,
203,
1082,
202,
759,
3163,
18,
659,
18,
8222,
12,
1252,
3618,
18,
588,
9226,
55,
10245,
10663,
206,
203,
1082,
202,
780,
1892,
2393,
22,
273,
394,
6674,
5621,
206,
203,
202,
202,
430,
12,
1252,
3618,
18,
588,
8229,
861,
12,
20,
13,
480,
446,
15329,
206,
203,
1082,
202,
780,
6202,
529,
273,
18985,
18,
588,
8229,
461,
12,
20,
1769,
206,
203,
202,
202,
759,
202,
60,
1260,
42,
7177,
10958,
2608,
273,
446,
31,
206,
203,
1082,
202,
60,
1260,
4931,
2963,
13622,
273,
18985,
18,
588,
8229,
861,
12,
20,
1769,
206,
203,
1082,
202,
759,
2073,
326,
2168,
11234,
1122,
1027,
434,
14693,
364,
2168,
18,
12526,
316,
3593,
866,
1024,
1027,
18,
206,
203,
1082,
202,
474,
818,
914,
273,
13622,
18,
588,
1999,
12,
20,
2934,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
759,
29185,
326,
3170,
585,
618,
263,
92,
14917,
471,
1678,
518,
487,
326,
810,
977,
18,
206,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | arrayList2doubles | null | public static double[] arrayList2doubles(ArrayList<Double> doubles) {
if (doubles == null) return null;
double[] ret = new double[doubles.size()];
for(int i = 0; i < ret.length; i++) ret[i] = doubles.get(i).doubleValue();
return ret;
} | /**
* convert and ArrayList<Double> to an array of doubles
* @param doubles
* @return
*/ | convert and ArrayList to an array of doubles
@param doubles
@return | [
"convert",
"and",
"ArrayList",
"to",
"an",
"array",
"of",
"doubles",
"@param",
"doubles",
"@return"
] | public static double[] arrayList2doubles(ArrayList<Double> doubles) {
if (doubles == null) return null;
double[] ret = new double[doubles.size()];
for(int i = 0; i < ret.length; i++) ret[i] = doubles.get(i).doubleValue();
return ret;
} | [
"public",
"static",
"double",
"[",
"]",
"arrayList2doubles",
"(",
"ArrayList",
"<",
"Double",
">",
"doubles",
")",
"{",
"if",
"(",
"doubles",
"==",
"null",
")",
"return",
"null",
";",
"double",
"[",
"]",
"ret",
"=",
"new",
"double",
"[",
"doubles",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ret",
".",
"length",
";",
"i",
"++",
")",
"ret",
"[",
"i",
"]",
"=",
"doubles",
".",
"get",
"(",
"i",
")",
".",
"doubleValue",
"(",
")",
";",
"return",
"ret",
";",
"}"
] | convert and ArrayList<Double> to an array of doubles
@param doubles
@return | [
"convert",
"and",
"ArrayList<Double",
">",
"to",
"an",
"array",
"of",
"doubles",
"@param",
"doubles",
"@return"
] | [] | [
{
"param": "doubles",
"type": "ArrayList<Double>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "doubles",
"type": "ArrayList<Double>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1645,
8526,
526,
682,
22,
2896,
19314,
12,
19558,
32,
5265,
34,
31446,
13,
288,
203,
202,
202,
430,
261,
2896,
19314,
422,
446,
13,
327,
446,
31,
203,
202,
565,
1645,
8526,
325,
273,
394,
1645,
63,
2896,
19314,
18,
1467,
1435,
15533,
203,
202,
565,
364,
12,
474,
277,
273,
374,
31,
277,
411,
325,
18,
2469,
31,
277,
27245,
325,
63,
77,
65,
273,
31446,
18,
588,
12,
77,
2934,
9056,
620,
5621,
203,
202,
565,
327,
325,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
1765,
471,
2407,
32,
5265,
34,
358,
392,
526,
434,
31446,
203,
202,
380,
632,
891,
31446,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | arrayList2floats | null | public static float[] arrayList2floats(ArrayList<Float> floats) {
if (floats == null) return null;
float[] ret = new float[floats.size()];
for(int i = 0; i < ret.length; i++) ret[i] = floats.get(i).floatValue();
return ret;
} | /**
* convert an ArrayList<Float> to an array of floats
* @param floats
* @return
*/ | convert an ArrayList to an array of floats
@param floats
@return | [
"convert",
"an",
"ArrayList",
"to",
"an",
"array",
"of",
"floats",
"@param",
"floats",
"@return"
] | public static float[] arrayList2floats(ArrayList<Float> floats) {
if (floats == null) return null;
float[] ret = new float[floats.size()];
for(int i = 0; i < ret.length; i++) ret[i] = floats.get(i).floatValue();
return ret;
} | [
"public",
"static",
"float",
"[",
"]",
"arrayList2floats",
"(",
"ArrayList",
"<",
"Float",
">",
"floats",
")",
"{",
"if",
"(",
"floats",
"==",
"null",
")",
"return",
"null",
";",
"float",
"[",
"]",
"ret",
"=",
"new",
"float",
"[",
"floats",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ret",
".",
"length",
";",
"i",
"++",
")",
"ret",
"[",
"i",
"]",
"=",
"floats",
".",
"get",
"(",
"i",
")",
".",
"floatValue",
"(",
")",
";",
"return",
"ret",
";",
"}"
] | convert an ArrayList<Float> to an array of floats
@param floats
@return | [
"convert",
"an",
"ArrayList<Float",
">",
"to",
"an",
"array",
"of",
"floats",
"@param",
"floats",
"@return"
] | [] | [
{
"param": "floats",
"type": "ArrayList<Float>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "floats",
"type": "ArrayList<Float>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1431,
8526,
526,
682,
22,
5659,
87,
12,
19558,
32,
4723,
34,
19172,
13,
288,
203,
202,
202,
430,
261,
5659,
87,
422,
446,
13,
327,
446,
31,
203,
202,
565,
1431,
8526,
325,
273,
394,
1431,
63,
5659,
87,
18,
1467,
1435,
15533,
203,
202,
565,
364,
12,
474,
277,
273,
374,
31,
277,
411,
325,
18,
2469,
31,
277,
27245,
325,
63,
77,
65,
273,
19172,
18,
588,
12,
77,
2934,
5659,
620,
5621,
203,
202,
565,
327,
325,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
1765,
392,
2407,
32,
4723,
34,
358,
392,
526,
434,
19172,
203,
202,
380,
632,
891,
19172,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | arrayList2ints | null | public static int[] arrayList2ints(ArrayList<Integer> ints) {
if (ints == null) return null;
int[] ret = new int[ints.size()];
for(int i = 0; i < ret.length; i++) ret[i] = ints.get(i).intValue();
return ret;
} | /**
* convert an ArrayList<Integer> to an array of ints
* @param floats
* @return
*/ | convert an ArrayList to an array of ints
@param floats
@return | [
"convert",
"an",
"ArrayList",
"to",
"an",
"array",
"of",
"ints",
"@param",
"floats",
"@return"
] | public static int[] arrayList2ints(ArrayList<Integer> ints) {
if (ints == null) return null;
int[] ret = new int[ints.size()];
for(int i = 0; i < ret.length; i++) ret[i] = ints.get(i).intValue();
return ret;
} | [
"public",
"static",
"int",
"[",
"]",
"arrayList2ints",
"(",
"ArrayList",
"<",
"Integer",
">",
"ints",
")",
"{",
"if",
"(",
"ints",
"==",
"null",
")",
"return",
"null",
";",
"int",
"[",
"]",
"ret",
"=",
"new",
"int",
"[",
"ints",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"ret",
".",
"length",
";",
"i",
"++",
")",
"ret",
"[",
"i",
"]",
"=",
"ints",
".",
"get",
"(",
"i",
")",
".",
"intValue",
"(",
")",
";",
"return",
"ret",
";",
"}"
] | convert an ArrayList<Integer> to an array of ints
@param floats
@return | [
"convert",
"an",
"ArrayList<Integer",
">",
"to",
"an",
"array",
"of",
"ints",
"@param",
"floats",
"@return"
] | [] | [
{
"param": "ints",
"type": "ArrayList<Integer>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ints",
"type": "ArrayList<Integer>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
509,
8526,
526,
682,
22,
28142,
12,
19558,
32,
4522,
34,
15542,
13,
288,
203,
202,
202,
430,
261,
28142,
422,
446,
13,
327,
446,
31,
203,
202,
565,
509,
8526,
325,
273,
394,
509,
63,
28142,
18,
1467,
1435,
15533,
203,
202,
565,
364,
12,
474,
277,
273,
374,
31,
277,
411,
325,
18,
2469,
31,
277,
27245,
325,
63,
77,
65,
273,
15542,
18,
588,
12,
77,
2934,
474,
620,
5621,
203,
202,
565,
327,
325,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
1765,
392,
2407,
32,
4522,
34,
358,
392,
526,
434,
15542,
203,
202,
380,
632,
891,
19172,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | array2String | String | public static String array2String(float[] array) {
String str = "";
if (array == null) return str;
for (int i=0; i<array.length; i++) {
if (i==0) str += Float.toString(array[i]);
else str += "," + Float.toString(array[i]);
}
return str;
} | /**
* convert an array of floats to a CSV string
* @param array
* @return
*/ | convert an array of floats to a CSV string
@param array
@return | [
"convert",
"an",
"array",
"of",
"floats",
"to",
"a",
"CSV",
"string",
"@param",
"array",
"@return"
] | public static String array2String(float[] array) {
String str = "";
if (array == null) return str;
for (int i=0; i<array.length; i++) {
if (i==0) str += Float.toString(array[i]);
else str += "," + Float.toString(array[i]);
}
return str;
} | [
"public",
"static",
"String",
"array2String",
"(",
"float",
"[",
"]",
"array",
")",
"{",
"String",
"str",
"=",
"\"\"",
";",
"if",
"(",
"array",
"==",
"null",
")",
"return",
"str",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"==",
"0",
")",
"str",
"+=",
"Float",
".",
"toString",
"(",
"array",
"[",
"i",
"]",
")",
";",
"else",
"str",
"+=",
"\",\"",
"+",
"Float",
".",
"toString",
"(",
"array",
"[",
"i",
"]",
")",
";",
"}",
"return",
"str",
";",
"}"
] | convert an array of floats to a CSV string
@param array
@return | [
"convert",
"an",
"array",
"of",
"floats",
"to",
"a",
"CSV",
"string",
"@param",
"array",
"@return"
] | [] | [
{
"param": "array",
"type": "float[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "array",
"type": "float[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
514,
526,
22,
780,
12,
5659,
8526,
526,
13,
288,
203,
202,
202,
780,
609,
273,
1408,
31,
203,
202,
202,
430,
261,
1126,
422,
446,
13,
327,
609,
31,
203,
202,
202,
1884,
261,
474,
277,
33,
20,
31,
277,
32,
1126,
18,
2469,
31,
277,
27245,
288,
203,
1082,
202,
430,
261,
77,
631,
20,
13,
609,
1011,
5450,
18,
10492,
12,
1126,
63,
77,
19226,
203,
1082,
202,
12107,
609,
1011,
5753,
397,
5450,
18,
10492,
12,
1126,
63,
77,
19226,
203,
202,
202,
97,
203,
202,
202,
2463,
609,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
1765,
392,
526,
434,
19172,
358,
279,
10381,
533,
203,
202,
380,
632,
891,
526,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | array2String | String | public static String array2String(int[] array) {
String str = "";
if (array == null) return str;
for (int i=0; i<array.length; i++) {
if (i==0) str += Integer.toString(array[i]);
else str += "," + Integer.toString(array[i]);
}
return str;
} | /**
* convert an array on integers to a CSV string
* @param array
* @return
*/ | convert an array on integers to a CSV string
@param array
@return | [
"convert",
"an",
"array",
"on",
"integers",
"to",
"a",
"CSV",
"string",
"@param",
"array",
"@return"
] | public static String array2String(int[] array) {
String str = "";
if (array == null) return str;
for (int i=0; i<array.length; i++) {
if (i==0) str += Integer.toString(array[i]);
else str += "," + Integer.toString(array[i]);
}
return str;
} | [
"public",
"static",
"String",
"array2String",
"(",
"int",
"[",
"]",
"array",
")",
"{",
"String",
"str",
"=",
"\"\"",
";",
"if",
"(",
"array",
"==",
"null",
")",
"return",
"str",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"i",
"==",
"0",
")",
"str",
"+=",
"Integer",
".",
"toString",
"(",
"array",
"[",
"i",
"]",
")",
";",
"else",
"str",
"+=",
"\",\"",
"+",
"Integer",
".",
"toString",
"(",
"array",
"[",
"i",
"]",
")",
";",
"}",
"return",
"str",
";",
"}"
] | convert an array on integers to a CSV string
@param array
@return | [
"convert",
"an",
"array",
"on",
"integers",
"to",
"a",
"CSV",
"string",
"@param",
"array",
"@return"
] | [] | [
{
"param": "array",
"type": "int[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "array",
"type": "int[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
514,
526,
22,
780,
12,
474,
8526,
526,
13,
288,
203,
202,
202,
780,
609,
273,
1408,
31,
203,
202,
202,
430,
261,
1126,
422,
446,
13,
327,
609,
31,
203,
202,
202,
1884,
261,
474,
277,
33,
20,
31,
277,
32,
1126,
18,
2469,
31,
277,
27245,
288,
203,
1082,
202,
430,
261,
77,
631,
20,
13,
609,
1011,
2144,
18,
10492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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
1765,
392,
526,
603,
12321,
358,
279,
10381,
533,
203,
202,
380,
632,
891,
526,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | string2FloatArray | null | public static float[] string2FloatArray(String str) {
if (str == null) return null;
String[] strArray = str.split(",");
float[] array = new float[strArray.length];
for (int i=0; i<strArray.length; i++) {
array[i] = Float.parseFloat(strArray[i]);
}
return array;
} | /**
* convert a CSV string to an array of floats
* @param str
* @return
*/ | convert a CSV string to an array of floats
@param str
@return | [
"convert",
"a",
"CSV",
"string",
"to",
"an",
"array",
"of",
"floats",
"@param",
"str",
"@return"
] | public static float[] string2FloatArray(String str) {
if (str == null) return null;
String[] strArray = str.split(",");
float[] array = new float[strArray.length];
for (int i=0; i<strArray.length; i++) {
array[i] = Float.parseFloat(strArray[i]);
}
return array;
} | [
"public",
"static",
"float",
"[",
"]",
"string2FloatArray",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"return",
"null",
";",
"String",
"[",
"]",
"strArray",
"=",
"str",
".",
"split",
"(",
"\",\"",
")",
";",
"float",
"[",
"]",
"array",
"=",
"new",
"float",
"[",
"strArray",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"strArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"array",
"[",
"i",
"]",
"=",
"Float",
".",
"parseFloat",
"(",
"strArray",
"[",
"i",
"]",
")",
";",
"}",
"return",
"array",
";",
"}"
] | convert a CSV string to an array of floats
@param str
@return | [
"convert",
"a",
"CSV",
"string",
"to",
"an",
"array",
"of",
"floats",
"@param",
"str",
"@return"
] | [] | [
{
"param": "str",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1431,
8526,
533,
22,
4723,
1076,
12,
780,
609,
13,
288,
203,
202,
202,
430,
261,
701,
422,
446,
13,
327,
446,
31,
203,
202,
202,
780,
8526,
609,
1076,
273,
609,
18,
4939,
2932,
16,
8863,
203,
202,
202,
5659,
8526,
526,
273,
394,
1431,
63,
701,
1076,
18,
2469,
15533,
203,
202,
202,
1884,
261,
474,
277,
33,
20,
31,
277,
32,
701,
1076,
18,
2469,
31,
277,
27245,
288,
203,
1082,
202,
1126,
63,
77,
65,
273,
5450,
18,
2670,
4723,
12,
701,
1076,
63,
77,
19226,
203,
202,
202,
97,
203,
202,
202,
2463,
526,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
1765,
279,
10381,
533,
358,
392,
526,
434,
19172,
203,
202,
380,
632,
891,
609,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | string2IntArray | null | public static int[] string2IntArray(String str) {
if (str == null) return null;
String[] strArray = str.split(",");
int[] array = new int[strArray.length];
for (int i=0; i<strArray.length; i++) {
array[i] = Integer.parseInt(strArray[i]);
}
return array;
} | /**
* convert a CSV string to an array of integers
* @param str
* @return
*/ | convert a CSV string to an array of integers
@param str
@return | [
"convert",
"a",
"CSV",
"string",
"to",
"an",
"array",
"of",
"integers",
"@param",
"str",
"@return"
] | public static int[] string2IntArray(String str) {
if (str == null) return null;
String[] strArray = str.split(",");
int[] array = new int[strArray.length];
for (int i=0; i<strArray.length; i++) {
array[i] = Integer.parseInt(strArray[i]);
}
return array;
} | [
"public",
"static",
"int",
"[",
"]",
"string2IntArray",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"return",
"null",
";",
"String",
"[",
"]",
"strArray",
"=",
"str",
".",
"split",
"(",
"\",\"",
")",
";",
"int",
"[",
"]",
"array",
"=",
"new",
"int",
"[",
"strArray",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"strArray",
".",
"length",
";",
"i",
"++",
")",
"{",
"array",
"[",
"i",
"]",
"=",
"Integer",
".",
"parseInt",
"(",
"strArray",
"[",
"i",
"]",
")",
";",
"}",
"return",
"array",
";",
"}"
] | convert a CSV string to an array of integers
@param str
@return | [
"convert",
"a",
"CSV",
"string",
"to",
"an",
"array",
"of",
"integers",
"@param",
"str",
"@return"
] | [] | [
{
"param": "str",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
509,
8526,
533,
22,
1702,
1076,
12,
780,
609,
13,
288,
203,
202,
202,
430,
261,
701,
422,
446,
13,
327,
446,
31,
203,
202,
202,
780,
8526,
609,
1076,
273,
609,
18,
4939,
2932,
16,
8863,
203,
202,
202,
474,
8526,
526,
273,
394,
509,
63,
701,
1076,
18,
2469,
15533,
203,
202,
202,
1884,
261,
474,
277,
33,
20,
31,
277,
32,
701,
1076,
18,
2469,
31,
277,
27245,
288,
203,
1082,
202,
1126,
63,
77,
65,
273,
2144,
18,
2670,
1702,
12,
701,
1076,
63,
77,
19226,
203,
202,
202,
97,
203,
202,
202,
2463,
526,
31,
203,
202,
97,
2,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
1765,
279,
10381,
533,
358,
392,
526,
434,
12321,
203,
202,
380,
632,
891,
609,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | isInteger | null | public static boolean isInteger(String str) {
try {
Integer.parseInt(str);
return true;
} catch (NumberFormatException e) {
return false;
}
} | /**
* tests whether a string can be parsed as an integer
* @param str
* @return
*/ | tests whether a string can be parsed as an integer
@param str
@return | [
"tests",
"whether",
"a",
"string",
"can",
"be",
"parsed",
"as",
"an",
"integer",
"@param",
"str",
"@return"
] | public static boolean isInteger(String str) {
try {
Integer.parseInt(str);
return true;
} catch (NumberFormatException e) {
return false;
}
} | [
"public",
"static",
"boolean",
"isInteger",
"(",
"String",
"str",
")",
"{",
"try",
"{",
"Integer",
".",
"parseInt",
"(",
"str",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] | tests whether a string can be parsed as an integer
@param str
@return | [
"tests",
"whether",
"a",
"string",
"can",
"be",
"parsed",
"as",
"an",
"integer",
"@param",
"str",
"@return"
] | [] | [
{
"param": "str",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
353,
4522,
12,
780,
609,
13,
288,
203,
3639,
775,
288,
203,
5411,
2144,
18,
2670,
1702,
12,
701,
1769,
203,
5411,
327,
638,
31,
203,
3639,
289,
1044,
261,
1854,
9291,
425,
13,
288,
203,
5411,
327,
629,
31,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0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,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | cumulativeDistance | null | public static double cumulativeDistance(Point2D[] pts) {
if( pts==null ) return 0.;
try{
double d = 0.;
for (int i=1; i<pts.length; i++) {
Point2D[] points = {pts[i-1], pts[i]};
d += distance(points);
}
return d;
} catch (Exception e) {
return 0;
}
} | /**
* Find the cumulative distance between an array of points
* @param pts
* @return
*/ | Find the cumulative distance between an array of points
@param pts
@return | [
"Find",
"the",
"cumulative",
"distance",
"between",
"an",
"array",
"of",
"points",
"@param",
"pts",
"@return"
] | public static double cumulativeDistance(Point2D[] pts) {
if( pts==null ) return 0.;
try{
double d = 0.;
for (int i=1; i<pts.length; i++) {
Point2D[] points = {pts[i-1], pts[i]};
d += distance(points);
}
return d;
} catch (Exception e) {
return 0;
}
} | [
"public",
"static",
"double",
"cumulativeDistance",
"(",
"Point2D",
"[",
"]",
"pts",
")",
"{",
"if",
"(",
"pts",
"==",
"null",
")",
"return",
"0.",
";",
"try",
"{",
"double",
"d",
"=",
"0.",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"pts",
".",
"length",
";",
"i",
"++",
")",
"{",
"Point2D",
"[",
"]",
"points",
"=",
"{",
"pts",
"[",
"i",
"-",
"1",
"]",
",",
"pts",
"[",
"i",
"]",
"}",
";",
"d",
"+=",
"distance",
"(",
"points",
")",
";",
"}",
"return",
"d",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"return",
"0",
";",
"}",
"}"
] | Find the cumulative distance between an array of points
@param pts
@return | [
"Find",
"the",
"cumulative",
"distance",
"between",
"an",
"array",
"of",
"points",
"@param",
"pts",
"@return"
] | [] | [
{
"param": "pts",
"type": "Point2D[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pts",
"type": "Point2D[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1645,
15582,
7200,
12,
2148,
22,
40,
8526,
13397,
13,
288,
203,
202,
202,
430,
12,
13397,
631,
2011,
262,
327,
374,
18,
31,
203,
202,
202,
698,
95,
203,
1082,
202,
9056,
302,
273,
374,
18,
31,
203,
1082,
202,
1884,
261,
474,
277,
33,
21,
31,
277,
32,
1092,
18,
2469,
31,
277,
27245,
288,
203,
9506,
202,
2148,
22,
40,
8526,
3143,
273,
288,
1092,
63,
77,
17,
21,
6487,
13397,
63,
77,
18322,
31,
203,
9506,
202,
72,
1011,
3888,
12,
4139,
1769,
203,
1082,
202,
97,
203,
1082,
202,
2463,
302,
31,
203,
202,
202,
97,
1044,
261,
503,
425,
13,
288,
203,
1082,
202,
2463,
374,
31,
203,
202,
202,
97,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
4163,
326,
15582,
3888,
3086,
392,
526,
434,
3143,
203,
377,
380,
632,
891,
13397,
203,
377,
380,
632,
2463,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | bearing | null | public static double bearing(Point2D[] pts) {
double f1 = Math.toRadians(pts[0].getY());
double f2 = Math.toRadians(pts[pts.length-1].getY());
double l1 = Math.toRadians(pts[0].getX());
double l2 = Math.toRadians(pts[pts.length-1].getX());
double y = Math.sin(l2-l1) * Math.cos(f2);
double x = Math.cos(f1)*Math.sin(f2) -
Math.sin(f1)*Math.cos(f2)*Math.cos(l2-l1);
double brng = Math.atan2(y, x);
return Math.toDegrees(brng);
} | /**
* Find the initial bearing of a line defined by an array of points
* (see http://www.movable-type.co.uk/scripts/latlong.html)
* @param pts
* @return
*/ | Find the initial bearing of a line defined by an array of points
@param pts
@return | [
"Find",
"the",
"initial",
"bearing",
"of",
"a",
"line",
"defined",
"by",
"an",
"array",
"of",
"points",
"@param",
"pts",
"@return"
] | public static double bearing(Point2D[] pts) {
double f1 = Math.toRadians(pts[0].getY());
double f2 = Math.toRadians(pts[pts.length-1].getY());
double l1 = Math.toRadians(pts[0].getX());
double l2 = Math.toRadians(pts[pts.length-1].getX());
double y = Math.sin(l2-l1) * Math.cos(f2);
double x = Math.cos(f1)*Math.sin(f2) -
Math.sin(f1)*Math.cos(f2)*Math.cos(l2-l1);
double brng = Math.atan2(y, x);
return Math.toDegrees(brng);
} | [
"public",
"static",
"double",
"bearing",
"(",
"Point2D",
"[",
"]",
"pts",
")",
"{",
"double",
"f1",
"=",
"Math",
".",
"toRadians",
"(",
"pts",
"[",
"0",
"]",
".",
"getY",
"(",
")",
")",
";",
"double",
"f2",
"=",
"Math",
".",
"toRadians",
"(",
"pts",
"[",
"pts",
".",
"length",
"-",
"1",
"]",
".",
"getY",
"(",
")",
")",
";",
"double",
"l1",
"=",
"Math",
".",
"toRadians",
"(",
"pts",
"[",
"0",
"]",
".",
"getX",
"(",
")",
")",
";",
"double",
"l2",
"=",
"Math",
".",
"toRadians",
"(",
"pts",
"[",
"pts",
".",
"length",
"-",
"1",
"]",
".",
"getX",
"(",
")",
")",
";",
"double",
"y",
"=",
"Math",
".",
"sin",
"(",
"l2",
"-",
"l1",
")",
"*",
"Math",
".",
"cos",
"(",
"f2",
")",
";",
"double",
"x",
"=",
"Math",
".",
"cos",
"(",
"f1",
")",
"*",
"Math",
".",
"sin",
"(",
"f2",
")",
"-",
"Math",
".",
"sin",
"(",
"f1",
")",
"*",
"Math",
".",
"cos",
"(",
"f2",
")",
"*",
"Math",
".",
"cos",
"(",
"l2",
"-",
"l1",
")",
";",
"double",
"brng",
"=",
"Math",
".",
"atan2",
"(",
"y",
",",
"x",
")",
";",
"return",
"Math",
".",
"toDegrees",
"(",
"brng",
")",
";",
"}"
] | Find the initial bearing of a line defined by an array of points
(see http://www.movable-type.co.uk/scripts/latlong.html)
@param pts
@return | [
"Find",
"the",
"initial",
"bearing",
"of",
"a",
"line",
"defined",
"by",
"an",
"array",
"of",
"points",
"(",
"see",
"http",
":",
"//",
"www",
".",
"movable",
"-",
"type",
".",
"co",
".",
"uk",
"/",
"scripts",
"/",
"latlong",
".",
"html",
")",
"@param",
"pts",
"@return"
] | [] | [
{
"param": "pts",
"type": "Point2D[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pts",
"type": "Point2D[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1645,
30261,
12,
2148,
22,
40,
8526,
13397,
13,
288,
203,
202,
202,
9056,
284,
21,
273,
2361,
18,
869,
25140,
12,
1092,
63,
20,
8009,
588,
61,
10663,
203,
202,
202,
9056,
284,
22,
273,
2361,
18,
869,
25140,
12,
1092,
63,
1092,
18,
2469,
17,
21,
8009,
588,
61,
10663,
203,
202,
202,
9056,
328,
21,
273,
2361,
18,
869,
25140,
12,
1092,
63,
20,
8009,
588,
60,
10663,
203,
202,
202,
9056,
328,
22,
273,
2361,
18,
869,
25140,
12,
1092,
63,
1092,
18,
2469,
17,
21,
8009,
588,
60,
10663,
203,
1082,
203,
202,
202,
9056,
677,
273,
2361,
18,
21861,
12,
80,
22,
17,
80,
21,
13,
380,
2361,
18,
14445,
12,
74,
22,
1769,
203,
202,
202,
9056,
619,
273,
2361,
18,
14445,
12,
74,
21,
17653,
10477,
18,
21861,
12,
74,
22,
13,
300,
203,
1082,
3639,
2361,
18,
21861,
12,
74,
21,
17653,
10477,
18,
14445,
12,
74,
22,
17653,
10477,
18,
14445,
12,
80,
22,
17,
80,
21,
1769,
203,
202,
202,
9056,
5186,
3368,
273,
2361,
18,
270,
304,
22,
12,
93,
16,
619,
1769,
203,
202,
202,
2463,
2361,
18,
869,
24400,
12,
2848,
3368,
1769,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
4163,
326,
2172,
30261,
434,
279,
980,
2553,
635,
392,
526,
434,
3143,
203,
202,
380,
261,
5946,
1062,
2207,
5591,
18,
81,
1527,
429,
17,
723,
18,
2894,
18,
19445,
19,
12827,
19,
4801,
5748,
18,
2620,
13,
203,
202,
380,
632,
891,
13397,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | finalBearing | null | public static double finalBearing(Point2D[] pts) {
double f2 = Math.toRadians(pts[0].getY());
double f1 = Math.toRadians(pts[pts.length-1].getY());
double l2 = Math.toRadians(pts[0].getX());
double l1 = Math.toRadians(pts[pts.length-1].getX());
double y = Math.sin(l2-l1) * Math.cos(f2);
double x = Math.cos(f1)*Math.sin(f2) -
Math.sin(f1)*Math.cos(f2)*Math.cos(l2-l1);
double brng = (Math.atan2(y, x) + Math.PI) % (Math.PI * 2.);
return Math.toDegrees(brng);
} | /**
* Find the final bearing of a line defined by an array of points
* (see http://www.movable-type.co.uk/scripts/latlong.html)
* @param pts
* @return
*/ | Find the final bearing of a line defined by an array of points
@param pts
@return | [
"Find",
"the",
"final",
"bearing",
"of",
"a",
"line",
"defined",
"by",
"an",
"array",
"of",
"points",
"@param",
"pts",
"@return"
] | public static double finalBearing(Point2D[] pts) {
double f2 = Math.toRadians(pts[0].getY());
double f1 = Math.toRadians(pts[pts.length-1].getY());
double l2 = Math.toRadians(pts[0].getX());
double l1 = Math.toRadians(pts[pts.length-1].getX());
double y = Math.sin(l2-l1) * Math.cos(f2);
double x = Math.cos(f1)*Math.sin(f2) -
Math.sin(f1)*Math.cos(f2)*Math.cos(l2-l1);
double brng = (Math.atan2(y, x) + Math.PI) % (Math.PI * 2.);
return Math.toDegrees(brng);
} | [
"public",
"static",
"double",
"finalBearing",
"(",
"Point2D",
"[",
"]",
"pts",
")",
"{",
"double",
"f2",
"=",
"Math",
".",
"toRadians",
"(",
"pts",
"[",
"0",
"]",
".",
"getY",
"(",
")",
")",
";",
"double",
"f1",
"=",
"Math",
".",
"toRadians",
"(",
"pts",
"[",
"pts",
".",
"length",
"-",
"1",
"]",
".",
"getY",
"(",
")",
")",
";",
"double",
"l2",
"=",
"Math",
".",
"toRadians",
"(",
"pts",
"[",
"0",
"]",
".",
"getX",
"(",
")",
")",
";",
"double",
"l1",
"=",
"Math",
".",
"toRadians",
"(",
"pts",
"[",
"pts",
".",
"length",
"-",
"1",
"]",
".",
"getX",
"(",
")",
")",
";",
"double",
"y",
"=",
"Math",
".",
"sin",
"(",
"l2",
"-",
"l1",
")",
"*",
"Math",
".",
"cos",
"(",
"f2",
")",
";",
"double",
"x",
"=",
"Math",
".",
"cos",
"(",
"f1",
")",
"*",
"Math",
".",
"sin",
"(",
"f2",
")",
"-",
"Math",
".",
"sin",
"(",
"f1",
")",
"*",
"Math",
".",
"cos",
"(",
"f2",
")",
"*",
"Math",
".",
"cos",
"(",
"l2",
"-",
"l1",
")",
";",
"double",
"brng",
"=",
"(",
"Math",
".",
"atan2",
"(",
"y",
",",
"x",
")",
"+",
"Math",
".",
"PI",
")",
"%",
"(",
"Math",
".",
"PI",
"*",
"2.",
")",
";",
"return",
"Math",
".",
"toDegrees",
"(",
"brng",
")",
";",
"}"
] | Find the final bearing of a line defined by an array of points
(see http://www.movable-type.co.uk/scripts/latlong.html)
@param pts
@return | [
"Find",
"the",
"final",
"bearing",
"of",
"a",
"line",
"defined",
"by",
"an",
"array",
"of",
"points",
"(",
"see",
"http",
":",
"//",
"www",
".",
"movable",
"-",
"type",
".",
"co",
".",
"uk",
"/",
"scripts",
"/",
"latlong",
".",
"html",
")",
"@param",
"pts",
"@return"
] | [] | [
{
"param": "pts",
"type": "Point2D[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pts",
"type": "Point2D[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1645,
727,
1919,
5968,
12,
2148,
22,
40,
8526,
13397,
13,
288,
203,
202,
202,
9056,
284,
22,
273,
2361,
18,
869,
25140,
12,
1092,
63,
20,
8009,
588,
61,
10663,
203,
202,
202,
9056,
284,
21,
273,
2361,
18,
869,
25140,
12,
1092,
63,
1092,
18,
2469,
17,
21,
8009,
588,
61,
10663,
203,
202,
202,
9056,
328,
22,
273,
2361,
18,
869,
25140,
12,
1092,
63,
20,
8009,
588,
60,
10663,
203,
202,
202,
9056,
328,
21,
273,
2361,
18,
869,
25140,
12,
1092,
63,
1092,
18,
2469,
17,
21,
8009,
588,
60,
10663,
203,
1082,
203,
202,
202,
9056,
677,
273,
2361,
18,
21861,
12,
80,
22,
17,
80,
21,
13,
380,
2361,
18,
14445,
12,
74,
22,
1769,
203,
202,
202,
9056,
619,
273,
2361,
18,
14445,
12,
74,
21,
17653,
10477,
18,
21861,
12,
74,
22,
13,
300,
203,
1082,
3639,
2361,
18,
21861,
12,
74,
21,
17653,
10477,
18,
14445,
12,
74,
22,
17653,
10477,
18,
14445,
12,
80,
22,
17,
80,
21,
1769,
203,
202,
202,
9056,
5186,
3368,
273,
261,
10477,
18,
270,
304,
22,
12,
93,
16,
619,
13,
397,
2361,
18,
1102,
13,
738,
261,
10477,
18,
1102,
380,
576,
18,
1769,
203,
202,
202,
2463,
2361,
18,
869,
24400,
12,
2848,
3368,
1769,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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2553,
635,
392,
526,
434,
3143,
203,
202,
380,
261,
5946,
1062,
2207,
5591,
18,
81,
1527,
429,
17,
723,
18,
2894,
18,
19445,
19,
12827,
19,
4801,
5748,
18,
2620,
13,
203,
202,
380,
632,
891,
13397,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | flatEarthBearing | null | public static double flatEarthBearing(Point2D[] pts) {
double y = pts[1].getX() - pts[0].getX();
double x = pts[0].getY() - pts[1].getY();
double brng = Math.atan2(y, x);
return Math.toDegrees(brng);
} | /**
* Find the bearing of a line defined by two points
* on a flat Earth (ie not using great circles)
* @param pts
* @return
*/ | Find the bearing of a line defined by two points
on a flat Earth
@param pts
@return | [
"Find",
"the",
"bearing",
"of",
"a",
"line",
"defined",
"by",
"two",
"points",
"on",
"a",
"flat",
"Earth",
"@param",
"pts",
"@return"
] | public static double flatEarthBearing(Point2D[] pts) {
double y = pts[1].getX() - pts[0].getX();
double x = pts[0].getY() - pts[1].getY();
double brng = Math.atan2(y, x);
return Math.toDegrees(brng);
} | [
"public",
"static",
"double",
"flatEarthBearing",
"(",
"Point2D",
"[",
"]",
"pts",
")",
"{",
"double",
"y",
"=",
"pts",
"[",
"1",
"]",
".",
"getX",
"(",
")",
"-",
"pts",
"[",
"0",
"]",
".",
"getX",
"(",
")",
";",
"double",
"x",
"=",
"pts",
"[",
"0",
"]",
".",
"getY",
"(",
")",
"-",
"pts",
"[",
"1",
"]",
".",
"getY",
"(",
")",
";",
"double",
"brng",
"=",
"Math",
".",
"atan2",
"(",
"y",
",",
"x",
")",
";",
"return",
"Math",
".",
"toDegrees",
"(",
"brng",
")",
";",
"}"
] | Find the bearing of a line defined by two points
on a flat Earth (ie not using great circles)
@param pts
@return | [
"Find",
"the",
"bearing",
"of",
"a",
"line",
"defined",
"by",
"two",
"points",
"on",
"a",
"flat",
"Earth",
"(",
"ie",
"not",
"using",
"great",
"circles",
")",
"@param",
"pts",
"@return"
] | [] | [
{
"param": "pts",
"type": "Point2D[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pts",
"type": "Point2D[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1645,
3569,
41,
27076,
1919,
5968,
12,
2148,
22,
40,
8526,
13397,
13,
288,
203,
202,
202,
9056,
677,
273,
13397,
63,
21,
8009,
588,
60,
1435,
300,
13397,
63,
20,
8009,
588,
60,
5621,
203,
202,
202,
9056,
619,
273,
13397,
63,
20,
8009,
588,
61,
1435,
300,
13397,
63,
21,
8009,
588,
61,
5621,
203,
202,
202,
9056,
5186,
3368,
273,
2361,
18,
270,
304,
22,
12,
93,
16,
619,
1769,
202,
203,
202,
202,
2463,
2361,
18,
869,
24400,
12,
2848,
3368,
1769,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
4163,
326,
30261,
434,
279,
980,
2553,
635,
2795,
3143,
203,
202,
380,
603,
279,
3569,
512,
27076,
261,
1385,
486,
1450,
18825,
5886,
9558,
13,
203,
202,
380,
632,
891,
13397,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | parallelLine | null | public static Point2D[] parallelLine(Point2D[] pts, double distance, byte dir) {
if (dir != 1 && dir != -1) return null;
double brng = Math.toRadians(finalBearing(pts) + 90 * dir);
Point2D start = pointFromDistAndBearing(pts[0], distance, brng);
Point2D end = pointFromDistAndBearing(pts[pts.length-1], distance, brng);
Point2D[] newPts = {start, end};
return newPts;
} | /**
* Calculate the start and end points for a line parallel to that defined by the
* input array of points pts. The distance input (in km) gives the perpendicular distance
* of the new line from the original. dir can be +1 or -1 and determines in which
* direction the new line is from the original.
* @param pts
* @param distance
* @param dir
* @return
*/ | Calculate the start and end points for a line parallel to that defined by the
input array of points pts. The distance input (in km) gives the perpendicular distance
of the new line from the original. dir can be +1 or -1 and determines in which
direction the new line is from the original. | [
"Calculate",
"the",
"start",
"and",
"end",
"points",
"for",
"a",
"line",
"parallel",
"to",
"that",
"defined",
"by",
"the",
"input",
"array",
"of",
"points",
"pts",
".",
"The",
"distance",
"input",
"(",
"in",
"km",
")",
"gives",
"the",
"perpendicular",
"distance",
"of",
"the",
"new",
"line",
"from",
"the",
"original",
".",
"dir",
"can",
"be",
"+",
"1",
"or",
"-",
"1",
"and",
"determines",
"in",
"which",
"direction",
"the",
"new",
"line",
"is",
"from",
"the",
"original",
"."
] | public static Point2D[] parallelLine(Point2D[] pts, double distance, byte dir) {
if (dir != 1 && dir != -1) return null;
double brng = Math.toRadians(finalBearing(pts) + 90 * dir);
Point2D start = pointFromDistAndBearing(pts[0], distance, brng);
Point2D end = pointFromDistAndBearing(pts[pts.length-1], distance, brng);
Point2D[] newPts = {start, end};
return newPts;
} | [
"public",
"static",
"Point2D",
"[",
"]",
"parallelLine",
"(",
"Point2D",
"[",
"]",
"pts",
",",
"double",
"distance",
",",
"byte",
"dir",
")",
"{",
"if",
"(",
"dir",
"!=",
"1",
"&&",
"dir",
"!=",
"-",
"1",
")",
"return",
"null",
";",
"double",
"brng",
"=",
"Math",
".",
"toRadians",
"(",
"finalBearing",
"(",
"pts",
")",
"+",
"90",
"*",
"dir",
")",
";",
"Point2D",
"start",
"=",
"pointFromDistAndBearing",
"(",
"pts",
"[",
"0",
"]",
",",
"distance",
",",
"brng",
")",
";",
"Point2D",
"end",
"=",
"pointFromDistAndBearing",
"(",
"pts",
"[",
"pts",
".",
"length",
"-",
"1",
"]",
",",
"distance",
",",
"brng",
")",
";",
"Point2D",
"[",
"]",
"newPts",
"=",
"{",
"start",
",",
"end",
"}",
";",
"return",
"newPts",
";",
"}"
] | Calculate the start and end points for a line parallel to that defined by the
input array of points pts. | [
"Calculate",
"the",
"start",
"and",
"end",
"points",
"for",
"a",
"line",
"parallel",
"to",
"that",
"defined",
"by",
"the",
"input",
"array",
"of",
"points",
"pts",
"."
] | [] | [
{
"param": "pts",
"type": "Point2D[]"
},
{
"param": "distance",
"type": "double"
},
{
"param": "dir",
"type": "byte"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pts",
"type": "Point2D[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "distance",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dir",
"type": "byte",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
4686,
22,
40,
8526,
7230,
1670,
12,
2148,
22,
40,
8526,
13397,
16,
1645,
3888,
16,
1160,
1577,
13,
288,
203,
202,
203,
202,
202,
430,
261,
1214,
480,
404,
597,
1577,
480,
300,
21,
13,
327,
446,
31,
203,
202,
202,
9056,
5186,
3368,
273,
2361,
18,
869,
25140,
12,
6385,
1919,
5968,
12,
1092,
13,
397,
8566,
380,
1577,
1769,
203,
202,
202,
2148,
22,
40,
787,
273,
1634,
1265,
5133,
1876,
1919,
5968,
12,
1092,
63,
20,
6487,
3888,
16,
5186,
3368,
1769,
203,
202,
202,
2148,
22,
40,
679,
273,
1634,
1265,
5133,
1876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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
9029,
326,
787,
471,
679,
3143,
364,
279,
980,
7230,
358,
716,
2553,
635,
326,
7010,
202,
380,
810,
526,
434,
3143,
13397,
18,
225,
1021,
3888,
810,
261,
267,
18952,
13,
14758,
326,
1534,
1302,
335,
2490,
3888,
203,
202,
380,
434,
326,
394,
980,
628,
326,
2282,
18,
225,
1577,
848,
506,
397,
21,
578,
300,
21,
471,
12949,
316,
1492,
203,
202,
380,
4068,
326,
394,
980,
353,
628,
326,
2282,
18,
203,
202,
380,
632,
891,
13397,
203,
202,
380,
632,
891,
3888,
203,
202,
380,
632,
891,
1577,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | wrapPoints | null | public static void wrapPoints(XMap map, Point2D.Double p0, Point2D.Double p1) {
double wrap = map.getWrap();
//get the limits of the displayed map
Rectangle2D rect = map.getClipRect2D();
double xmin = rect.getMinX();
double xmax = rect.getMaxX();
//make sure points are within the displayed map by adding or subtracting the wrap value
if( wrap>0f ) {
while( p0.x <= xmin ){p0.x+=wrap;}
while( p0.x >= xmax ){p0.x-=wrap;}
while( p1.x <= xmin ){p1.x+=wrap;}
//while( p1.x > wrap + xmin ){p1.x-=wrap;}
while( p1.x >= xmax ){p1.x-=wrap;}
}
} | /**
* When calculating the distance between two points in map coords, need to
* take into account the displayed map size, and whether one of the points crosses
* the wrap boundary.
* @param map
* @param p0
* @param p1
* @return
*/ | When calculating the distance between two points in map coords, need to
take into account the displayed map size, and whether one of the points crosses
the wrap boundary. | [
"When",
"calculating",
"the",
"distance",
"between",
"two",
"points",
"in",
"map",
"coords",
"need",
"to",
"take",
"into",
"account",
"the",
"displayed",
"map",
"size",
"and",
"whether",
"one",
"of",
"the",
"points",
"crosses",
"the",
"wrap",
"boundary",
"."
] | public static void wrapPoints(XMap map, Point2D.Double p0, Point2D.Double p1) {
double wrap = map.getWrap();
Rectangle2D rect = map.getClipRect2D();
double xmin = rect.getMinX();
double xmax = rect.getMaxX();
if( wrap>0f ) {
while( p0.x <= xmin ){p0.x+=wrap;}
while( p0.x >= xmax ){p0.x-=wrap;}
while( p1.x <= xmin ){p1.x+=wrap;}
while( p1.x >= xmax ){p1.x-=wrap;}
}
} | [
"public",
"static",
"void",
"wrapPoints",
"(",
"XMap",
"map",
",",
"Point2D",
".",
"Double",
"p0",
",",
"Point2D",
".",
"Double",
"p1",
")",
"{",
"double",
"wrap",
"=",
"map",
".",
"getWrap",
"(",
")",
";",
"Rectangle2D",
"rect",
"=",
"map",
".",
"getClipRect2D",
"(",
")",
";",
"double",
"xmin",
"=",
"rect",
".",
"getMinX",
"(",
")",
";",
"double",
"xmax",
"=",
"rect",
".",
"getMaxX",
"(",
")",
";",
"if",
"(",
"wrap",
">",
"0f",
")",
"{",
"while",
"(",
"p0",
".",
"x",
"<=",
"xmin",
")",
"{",
"p0",
".",
"x",
"+=",
"wrap",
";",
"}",
"while",
"(",
"p0",
".",
"x",
">=",
"xmax",
")",
"{",
"p0",
".",
"x",
"-=",
"wrap",
";",
"}",
"while",
"(",
"p1",
".",
"x",
"<=",
"xmin",
")",
"{",
"p1",
".",
"x",
"+=",
"wrap",
";",
"}",
"while",
"(",
"p1",
".",
"x",
">=",
"xmax",
")",
"{",
"p1",
".",
"x",
"-=",
"wrap",
";",
"}",
"}",
"}"
] | When calculating the distance between two points in map coords, need to
take into account the displayed map size, and whether one of the points crosses
the wrap boundary. | [
"When",
"calculating",
"the",
"distance",
"between",
"two",
"points",
"in",
"map",
"coords",
"need",
"to",
"take",
"into",
"account",
"the",
"displayed",
"map",
"size",
"and",
"whether",
"one",
"of",
"the",
"points",
"crosses",
"the",
"wrap",
"boundary",
"."
] | [
"//get the limits of the displayed map",
"//make sure points are within the displayed map by adding or subtracting the wrap value",
"//while( p1.x > wrap + xmin ){p1.x-=wrap;}"
] | [
{
"param": "map",
"type": "XMap"
},
{
"param": "p0",
"type": "Point2D.Double"
},
{
"param": "p1",
"type": "Point2D.Double"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "map",
"type": "XMap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "p0",
"type": "Point2D.Double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "p1",
"type": "Point2D.Double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
918,
2193,
5636,
12,
60,
863,
852,
16,
4686,
22,
40,
18,
5265,
293,
20,
16,
4686,
22,
40,
18,
5265,
293,
21,
13,
288,
203,
202,
202,
9056,
2193,
273,
852,
18,
588,
2964,
5621,
203,
1082,
203,
202,
202,
759,
588,
326,
8181,
434,
326,
10453,
852,
203,
202,
202,
19463,
22,
40,
4917,
273,
852,
18,
588,
15339,
6120,
22,
40,
5621,
203,
202,
202,
9056,
13777,
273,
4917,
18,
588,
2930,
60,
5621,
203,
202,
202,
9056,
14016,
273,
4917,
18,
588,
2747,
60,
5621,
203,
1082,
203,
202,
202,
759,
6540,
3071,
3143,
854,
3470,
326,
10453,
852,
635,
6534,
578,
10418,
310,
326,
2193,
460,
203,
202,
202,
430,
12,
2193,
34,
20,
74,
262,
288,
203,
1082,
202,
17523,
12,
293,
20,
18,
92,
1648,
13777,
262,
95,
84,
20,
18,
92,
15,
33,
4113,
31,
97,
203,
1082,
202,
17523,
12,
293,
20,
18,
92,
1545,
14016,
262,
95,
84,
20,
18,
92,
17,
33,
4113,
31,
97,
203,
1082,
202,
17523,
12,
293,
21,
18,
92,
1648,
13777,
262,
95,
84,
21,
18,
92,
15,
33,
4113,
31,
97,
203,
1082,
202,
759,
17523,
12,
293,
21,
18,
92,
405,
2193,
397,
13777,
262,
95,
84,
21,
18,
92,
17,
33,
4113,
31,
97,
203,
1082,
202,
17523,
12,
293,
21,
18,
92,
1545,
14016,
262,
95,
84,
21,
18,
92,
17,
33,
4113,
31,
97,
203,
202,
202,
97,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
5203,
21046,
326,
3888,
3086,
2795,
3143,
316,
852,
6074,
16,
1608,
358,
7010,
202,
380,
4862,
1368,
2236,
326,
10453,
852,
963,
16,
471,
2856,
1245,
434,
326,
3143,
6828,
281,
7010,
202,
380,
326,
2193,
7679,
18,
203,
202,
380,
632,
891,
852,
203,
202,
380,
632,
891,
293,
20,
203,
202,
380,
632,
891,
293,
21,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | wrapPoint | null | public static void wrapPoint(XMap map, Point2D.Double p) {
double wrap = map.getWrap();
//get the limits of the displayed map
Rectangle2D rect = map.getClipRect2D();
double xmin = rect.getMinX();
double xmax = rect.getMaxX();
//make sure point is within the displayed map by adding or subtracting the wrap value
if( wrap>0f ) {
while( p.x <= xmin ){p.x+=wrap;}
while( p.x >= xmax ){p.x-=wrap;}
//if the point isn't in range, work out which boundary it is closest to.
if (p.x < xmin) {
if (p.x + wrap - xmax < (xmin - p.x) ) p.x+=wrap;
}
}
} | /**
* Make sure point is within the displayed map by adding
* or subtracting the wrap value
* @param map
* @param p
*/ | Make sure point is within the displayed map by adding
or subtracting the wrap value
@param map
@param p | [
"Make",
"sure",
"point",
"is",
"within",
"the",
"displayed",
"map",
"by",
"adding",
"or",
"subtracting",
"the",
"wrap",
"value",
"@param",
"map",
"@param",
"p"
] | public static void wrapPoint(XMap map, Point2D.Double p) {
double wrap = map.getWrap();
Rectangle2D rect = map.getClipRect2D();
double xmin = rect.getMinX();
double xmax = rect.getMaxX();
if( wrap>0f ) {
while( p.x <= xmin ){p.x+=wrap;}
while( p.x >= xmax ){p.x-=wrap;}
if (p.x < xmin) {
if (p.x + wrap - xmax < (xmin - p.x) ) p.x+=wrap;
}
}
} | [
"public",
"static",
"void",
"wrapPoint",
"(",
"XMap",
"map",
",",
"Point2D",
".",
"Double",
"p",
")",
"{",
"double",
"wrap",
"=",
"map",
".",
"getWrap",
"(",
")",
";",
"Rectangle2D",
"rect",
"=",
"map",
".",
"getClipRect2D",
"(",
")",
";",
"double",
"xmin",
"=",
"rect",
".",
"getMinX",
"(",
")",
";",
"double",
"xmax",
"=",
"rect",
".",
"getMaxX",
"(",
")",
";",
"if",
"(",
"wrap",
">",
"0f",
")",
"{",
"while",
"(",
"p",
".",
"x",
"<=",
"xmin",
")",
"{",
"p",
".",
"x",
"+=",
"wrap",
";",
"}",
"while",
"(",
"p",
".",
"x",
">=",
"xmax",
")",
"{",
"p",
".",
"x",
"-=",
"wrap",
";",
"}",
"if",
"(",
"p",
".",
"x",
"<",
"xmin",
")",
"{",
"if",
"(",
"p",
".",
"x",
"+",
"wrap",
"-",
"xmax",
"<",
"(",
"xmin",
"-",
"p",
".",
"x",
")",
")",
"p",
".",
"x",
"+=",
"wrap",
";",
"}",
"}",
"}"
] | Make sure point is within the displayed map by adding
or subtracting the wrap value
@param map
@param p | [
"Make",
"sure",
"point",
"is",
"within",
"the",
"displayed",
"map",
"by",
"adding",
"or",
"subtracting",
"the",
"wrap",
"value",
"@param",
"map",
"@param",
"p"
] | [
"//get the limits of the displayed map",
"//make sure point is within the displayed map by adding or subtracting the wrap value",
"//if the point isn't in range, work out which boundary it is closest to."
] | [
{
"param": "map",
"type": "XMap"
},
{
"param": "p",
"type": "Point2D.Double"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "map",
"type": "XMap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "p",
"type": "Point2D.Double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
918,
2193,
2148,
12,
60,
863,
852,
16,
4686,
22,
40,
18,
5265,
293,
13,
288,
203,
202,
202,
9056,
2193,
273,
852,
18,
588,
2964,
5621,
203,
1082,
203,
202,
202,
759,
588,
326,
8181,
434,
326,
10453,
852,
203,
202,
202,
19463,
22,
40,
4917,
273,
852,
18,
588,
15339,
6120,
22,
40,
5621,
203,
202,
202,
9056,
13777,
273,
4917,
18,
588,
2930,
60,
5621,
203,
202,
202,
9056,
14016,
273,
4917,
18,
588,
2747,
60,
5621,
203,
1082,
203,
202,
202,
759,
6540,
3071,
1634,
353,
3470,
326,
10453,
852,
635,
6534,
578,
10418,
310,
326,
2193,
460,
203,
202,
202,
430,
12,
2193,
34,
20,
74,
262,
288,
203,
1082,
202,
17523,
12,
293,
18,
92,
1648,
13777,
262,
95,
84,
18,
92,
15,
33,
4113,
31,
97,
203,
1082,
202,
17523,
12,
293,
18,
92,
1545,
14016,
262,
95,
84,
18,
92,
17,
33,
4113,
31,
97,
203,
9506,
203,
1082,
202,
759,
430,
326,
1634,
5177,
1404,
316,
1048,
16,
1440,
596,
1492,
7679,
518,
353,
9219,
358,
18,
203,
1082,
202,
430,
261,
84,
18,
92,
411,
13777,
13,
288,
203,
9506,
202,
430,
261,
84,
18,
92,
397,
2193,
300,
14016,
411,
261,
92,
1154,
300,
293,
18,
92,
13,
262,
293,
18,
92,
15,
33,
4113,
31,
203,
1082,
202,
97,
203,
202,
202,
97,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
4344,
3071,
1634,
353,
3470,
326,
10453,
852,
635,
6534,
7010,
202,
380,
578,
10418,
310,
326,
2193,
460,
203,
202,
380,
632,
891,
852,
203,
202,
380,
632,
891,
293,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | unwrapPoint | null | public static void unwrapPoint(XMap map, Point2D.Double p) {
double wrap = map.getWrap();
//get the limits of the displayed map
Rectangle2D rect = map.getClipRect2D();
double xmin = rect.getMinX();
//get the first occurrence
if (wrap > 0f) {
while (p.x - wrap >= xmin) {p.x -= wrap;}
}
} | /**
* If a point occurs multiple times on the map, subtract the wrap
* value until we have the first occurrence
* @param map
* @param p
*/ | If a point occurs multiple times on the map, subtract the wrap
value until we have the first occurrence
@param map
@param p | [
"If",
"a",
"point",
"occurs",
"multiple",
"times",
"on",
"the",
"map",
"subtract",
"the",
"wrap",
"value",
"until",
"we",
"have",
"the",
"first",
"occurrence",
"@param",
"map",
"@param",
"p"
] | public static void unwrapPoint(XMap map, Point2D.Double p) {
double wrap = map.getWrap();
Rectangle2D rect = map.getClipRect2D();
double xmin = rect.getMinX();
if (wrap > 0f) {
while (p.x - wrap >= xmin) {p.x -= wrap;}
}
} | [
"public",
"static",
"void",
"unwrapPoint",
"(",
"XMap",
"map",
",",
"Point2D",
".",
"Double",
"p",
")",
"{",
"double",
"wrap",
"=",
"map",
".",
"getWrap",
"(",
")",
";",
"Rectangle2D",
"rect",
"=",
"map",
".",
"getClipRect2D",
"(",
")",
";",
"double",
"xmin",
"=",
"rect",
".",
"getMinX",
"(",
")",
";",
"if",
"(",
"wrap",
">",
"0f",
")",
"{",
"while",
"(",
"p",
".",
"x",
"-",
"wrap",
">=",
"xmin",
")",
"{",
"p",
".",
"x",
"-=",
"wrap",
";",
"}",
"}",
"}"
] | If a point occurs multiple times on the map, subtract the wrap
value until we have the first occurrence
@param map
@param p | [
"If",
"a",
"point",
"occurs",
"multiple",
"times",
"on",
"the",
"map",
"subtract",
"the",
"wrap",
"value",
"until",
"we",
"have",
"the",
"first",
"occurrence",
"@param",
"map",
"@param",
"p"
] | [
"//get the limits of the displayed map",
"//get the first occurrence"
] | [
{
"param": "map",
"type": "XMap"
},
{
"param": "p",
"type": "Point2D.Double"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "map",
"type": "XMap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "p",
"type": "Point2D.Double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
918,
11014,
2148,
12,
60,
863,
852,
16,
4686,
22,
40,
18,
5265,
293,
13,
288,
203,
202,
202,
9056,
2193,
273,
852,
18,
588,
2964,
5621,
203,
1082,
203,
202,
202,
759,
588,
326,
8181,
434,
326,
10453,
852,
203,
202,
202,
19463,
22,
40,
4917,
273,
852,
18,
588,
15339,
6120,
22,
40,
5621,
203,
202,
202,
9056,
13777,
273,
4917,
18,
588,
2930,
60,
5621,
203,
202,
202,
759,
588,
326,
1122,
13083,
203,
202,
202,
430,
261,
4113,
405,
374,
74,
13,
288,
203,
1082,
202,
17523,
261,
84,
18,
92,
300,
2193,
1545,
13777,
13,
288,
84,
18,
92,
3947,
2193,
31,
97,
203,
202,
202,
97,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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634,
9938,
3229,
4124,
603,
326,
852,
16,
10418,
326,
2193,
7010,
202,
380,
460,
3180,
732,
1240,
326,
1122,
13083,
203,
202,
380,
632,
891,
852,
203,
202,
380,
632,
891,
293,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | makeEditorPane | JEditorPane | public static JEditorPane makeEditorPane(String text) {
// for copying style
JLabel label = new JLabel();
Font font = label.getFont();
// create some css from the label's font
StringBuffer style = new StringBuffer("font-family:" + font.getFamily() + ";");
style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";");
style.append("font-size:" + font.getSize() + "pt;");
//need to use editor pane and hyperlink listener so that we can include hyperlinks in help text
JEditorPane ep = new JEditorPane("text/html", "<html><body style=\"" + style + "\">" //
+ text //
+ "</body></html>");
ep.addHyperlinkListener(new HyperlinkListener()
{
@Override
public void hyperlinkUpdate(HyperlinkEvent e)
{
if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED))
BrowseURL.browseURL(e.getURL().toString());
}
});
ep.setEditable(false);
ep.setBackground(label.getBackground());
return ep;
} | /**
* Create a JEditorPane that will convert the text into html with working hyperlinks.
* This can be included in a messageDialog with, e.g.
* JOptionPane.showMessageDialog(null, ep)
* @param text
* @return
*/ | Create a JEditorPane that will convert the text into html with working hyperlinks.
This can be included in a messageDialog with, e.g. | [
"Create",
"a",
"JEditorPane",
"that",
"will",
"convert",
"the",
"text",
"into",
"html",
"with",
"working",
"hyperlinks",
".",
"This",
"can",
"be",
"included",
"in",
"a",
"messageDialog",
"with",
"e",
".",
"g",
"."
] | public static JEditorPane makeEditorPane(String text) {
JLabel label = new JLabel();
Font font = label.getFont();
StringBuffer style = new StringBuffer("font-family:" + font.getFamily() + ";");
style.append("font-weight:" + (font.isBold() ? "bold" : "normal") + ";");
style.append("font-size:" + font.getSize() + "pt;");
JEditorPane ep = new JEditorPane("text/html", "<html><body style=\"" + style + "\">"
+ text
+ "</body></html>");
ep.addHyperlinkListener(new HyperlinkListener()
{
@Override
public void hyperlinkUpdate(HyperlinkEvent e)
{
if (e.getEventType().equals(HyperlinkEvent.EventType.ACTIVATED))
BrowseURL.browseURL(e.getURL().toString());
}
});
ep.setEditable(false);
ep.setBackground(label.getBackground());
return ep;
} | [
"public",
"static",
"JEditorPane",
"makeEditorPane",
"(",
"String",
"text",
")",
"{",
"JLabel",
"label",
"=",
"new",
"JLabel",
"(",
")",
";",
"Font",
"font",
"=",
"label",
".",
"getFont",
"(",
")",
";",
"StringBuffer",
"style",
"=",
"new",
"StringBuffer",
"(",
"\"font-family:\"",
"+",
"font",
".",
"getFamily",
"(",
")",
"+",
"\";\"",
")",
";",
"style",
".",
"append",
"(",
"\"font-weight:\"",
"+",
"(",
"font",
".",
"isBold",
"(",
")",
"?",
"\"bold\"",
":",
"\"normal\"",
")",
"+",
"\";\"",
")",
";",
"style",
".",
"append",
"(",
"\"font-size:\"",
"+",
"font",
".",
"getSize",
"(",
")",
"+",
"\"pt;\"",
")",
";",
"JEditorPane",
"ep",
"=",
"new",
"JEditorPane",
"(",
"\"text/html\"",
",",
"\"<html><body style=\\\"\"",
"+",
"style",
"+",
"\"\\\">\"",
"+",
"text",
"+",
"\"</body></html>\"",
")",
";",
"ep",
".",
"addHyperlinkListener",
"(",
"new",
"HyperlinkListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"hyperlinkUpdate",
"(",
"HyperlinkEvent",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getEventType",
"(",
")",
".",
"equals",
"(",
"HyperlinkEvent",
".",
"EventType",
".",
"ACTIVATED",
")",
")",
"BrowseURL",
".",
"browseURL",
"(",
"e",
".",
"getURL",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"}",
")",
";",
"ep",
".",
"setEditable",
"(",
"false",
")",
";",
"ep",
".",
"setBackground",
"(",
"label",
".",
"getBackground",
"(",
")",
")",
";",
"return",
"ep",
";",
"}"
] | Create a JEditorPane that will convert the text into html with working hyperlinks. | [
"Create",
"a",
"JEditorPane",
"that",
"will",
"convert",
"the",
"text",
"into",
"html",
"with",
"working",
"hyperlinks",
"."
] | [
"// for copying style",
"// create some css from the label's font",
"//need to use editor pane and hyperlink listener so that we can include hyperlinks in help text",
"//",
"//"
] | [
{
"param": "text",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
804,
6946,
8485,
1221,
6946,
8485,
12,
780,
977,
13,
288,
203,
202,
565,
368,
364,
8933,
2154,
203,
202,
565,
21403,
1433,
273,
394,
21403,
5621,
203,
202,
565,
10063,
3512,
273,
1433,
18,
588,
5711,
5621,
203,
203,
202,
565,
368,
752,
2690,
3747,
628,
326,
1433,
1807,
3512,
203,
202,
565,
6674,
2154,
273,
394,
6674,
2932,
5776,
17,
9309,
2773,
397,
3512,
18,
588,
9203,
1435,
397,
11430,
1769,
203,
202,
565,
2154,
18,
6923,
2932,
5776,
17,
4865,
2773,
397,
261,
5776,
18,
291,
38,
1673,
1435,
692,
315,
16390,
6,
294,
315,
6130,
7923,
397,
11430,
1769,
203,
202,
565,
2154,
18,
6923,
2932,
5776,
17,
1467,
2773,
397,
3512,
18,
588,
1225,
1435,
397,
315,
337,
4868,
1769,
203,
1082,
203,
202,
565,
368,
14891,
358,
999,
4858,
13618,
471,
9512,
1232,
2991,
1427,
716,
732,
848,
2341,
9512,
7135,
316,
2809,
977,
203,
202,
565,
804,
6946,
8485,
5529,
273,
394,
804,
6946,
8485,
2932,
955,
19,
2620,
3113,
3532,
2620,
4438,
3432,
2154,
13186,
397,
2154,
397,
7023,
2984,
368,
203,
202,
5411,
397,
977,
368,
203,
202,
5411,
397,
6823,
3432,
4695,
2620,
2984,
1769,
203,
203,
202,
565,
5529,
18,
1289,
15996,
1232,
2223,
12,
2704,
18274,
1232,
2223,
1435,
203,
202,
565,
288,
203,
202,
3639,
632,
6618,
203,
202,
3639,
1071,
918,
9512,
1232,
1891,
12,
15996,
1232,
1133,
425,
13,
203,
202,
3639,
288,
203,
202,
5411,
309,
261,
73,
18,
588,
16346,
7675,
14963,
12,
15996,
1232,
1133,
18,
16346,
18,
22271,
6344,
3719,
203,
202,
2398,
202,
27304,
1785,
18,
25731,
1785,
12,
73,
18,
588,
1785,
7675,
10492,
10663,
203,
202,
3639,
289,
203,
202,
565,
15549,
203,
202,
202,
881,
18,
542,
15470,
12,
5743,
1769,
203,
202,
202,
881,
18,
542,
8199,
12,
1925,
18,
588,
8199,
10663,
203,
1082,
203,
202,
202,
2463,
5529,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
1788,
279,
804,
6946,
8485,
716,
903,
1765,
326,
977,
1368,
1729,
598,
5960,
9512,
7135,
18,
203,
202,
380,
1220,
848,
506,
5849,
316,
279,
883,
6353,
598,
16,
425,
18,
75,
18,
203,
202,
380,
804,
1895,
8485,
18,
4500,
1079,
6353,
12,
2011,
16,
5529,
13,
203,
202,
380,
632,
891,
977,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | formatToSignificant | String | public static String formatToSignificant(double value,int significant) {
MathContext mathContext = new MathContext(significant,RoundingMode.DOWN);
BigDecimal bigDecimal = new BigDecimal(value,mathContext);
return bigDecimal.toPlainString();
} | /**
* Format a double to a given number of significant figures.
* From: http://helpdesk.objects.com.au/java/how-to-format-a-number-to-a-certain-number-of-significant-figures-as-opposed-to-decimal-places
* @param value
* @param significant
* @return
*/ | Format a double to a given number of significant figures. | [
"Format",
"a",
"double",
"to",
"a",
"given",
"number",
"of",
"significant",
"figures",
"."
] | public static String formatToSignificant(double value,int significant) {
MathContext mathContext = new MathContext(significant,RoundingMode.DOWN);
BigDecimal bigDecimal = new BigDecimal(value,mathContext);
return bigDecimal.toPlainString();
} | [
"public",
"static",
"String",
"formatToSignificant",
"(",
"double",
"value",
",",
"int",
"significant",
")",
"{",
"MathContext",
"mathContext",
"=",
"new",
"MathContext",
"(",
"significant",
",",
"RoundingMode",
".",
"DOWN",
")",
";",
"BigDecimal",
"bigDecimal",
"=",
"new",
"BigDecimal",
"(",
"value",
",",
"mathContext",
")",
";",
"return",
"bigDecimal",
".",
"toPlainString",
"(",
")",
";",
"}"
] | Format a double to a given number of significant figures. | [
"Format",
"a",
"double",
"to",
"a",
"given",
"number",
"of",
"significant",
"figures",
"."
] | [] | [
{
"param": "value",
"type": "double"
},
{
"param": "significant",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "value",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "significant",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
514,
740,
774,
29822,
12,
9056,
460,
16,
474,
14177,
13,
288,
203,
202,
202,
10477,
1042,
4233,
1042,
273,
394,
2361,
1042,
12,
2977,
11120,
16,
11066,
19154,
18,
12711,
1769,
203,
202,
202,
29436,
29741,
273,
394,
8150,
12,
1132,
16,
15949,
1042,
1769,
203,
202,
202,
2463,
29741,
18,
869,
13360,
780,
5621,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
4077,
279,
1645,
358,
279,
864,
1300,
434,
14177,
4291,
1823,
18,
203,
202,
380,
6338,
30,
1062,
2207,
5201,
5489,
79,
18,
6911,
18,
832,
18,
8377,
19,
6290,
19,
13606,
17,
869,
17,
2139,
17,
69,
17,
2696,
17,
869,
17,
69,
17,
7593,
530,
17,
2696,
17,
792,
17,
2977,
11120,
17,
470,
1823,
17,
345,
17,
556,
7423,
17,
869,
17,
12586,
17,
11350,
203,
202,
380,
632,
891,
460,
203,
202,
380,
632,
891,
14177,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
38f4b5c96802842202fe599a866b7b30ffa7298f | iedadata/geomapapp | haxby/util/GeneralUtils.java | [
"Apache-2.0"
] | Java | stringToSHA256 | String | public static String stringToSHA256(String stringIn) {
if (stringIn != null) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(stringIn.getBytes(StandardCharsets.UTF_8));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.length; i++) {
sb.append(Integer.toString((hash[i] & 0xff) + 0x100, 16).substring(1));
}
return sb.toString();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
}
return null;
} | /**
* Generate a SHA256 hash code for an input string
* @param stringIn
* @return
*/ | Generate a SHA256 hash code for an input string
@param stringIn
@return | [
"Generate",
"a",
"SHA256",
"hash",
"code",
"for",
"an",
"input",
"string",
"@param",
"stringIn",
"@return"
] | public static String stringToSHA256(String stringIn) {
if (stringIn != null) {
try {
MessageDigest digest = MessageDigest.getInstance("SHA-256");
byte[] hash = digest.digest(stringIn.getBytes(StandardCharsets.UTF_8));
StringBuilder sb = new StringBuilder();
for (int i = 0; i < hash.length; i++) {
sb.append(Integer.toString((hash[i] & 0xff) + 0x100, 16).substring(1));
}
return sb.toString();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
}
return null;
} | [
"public",
"static",
"String",
"stringToSHA256",
"(",
"String",
"stringIn",
")",
"{",
"if",
"(",
"stringIn",
"!=",
"null",
")",
"{",
"try",
"{",
"MessageDigest",
"digest",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"SHA-256\"",
")",
";",
"byte",
"[",
"]",
"hash",
"=",
"digest",
".",
"digest",
"(",
"stringIn",
".",
"getBytes",
"(",
"StandardCharsets",
".",
"UTF_8",
")",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"hash",
".",
"length",
";",
"i",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"Integer",
".",
"toString",
"(",
"(",
"hash",
"[",
"i",
"]",
"&",
"0xff",
")",
"+",
"0x100",
",",
"16",
")",
".",
"substring",
"(",
"1",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"catch",
"(",
"NoSuchAlgorithmException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Generate a SHA256 hash code for an input string
@param stringIn
@return | [
"Generate",
"a",
"SHA256",
"hash",
"code",
"for",
"an",
"input",
"string",
"@param",
"stringIn",
"@return"
] | [] | [
{
"param": "stringIn",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "stringIn",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
514,
14134,
8325,
5034,
12,
780,
533,
382,
13,
288,
203,
202,
202,
430,
261,
1080,
382,
480,
446,
13,
288,
203,
1082,
202,
698,
288,
203,
9506,
202,
1079,
9568,
5403,
273,
22485,
18,
588,
1442,
2932,
8325,
17,
5034,
8863,
203,
9506,
202,
7229,
8526,
1651,
273,
5403,
18,
10171,
12,
1080,
382,
18,
588,
2160,
12,
8336,
19329,
18,
5159,
67,
28,
10019,
203,
203,
9506,
565,
3225,
2393,
273,
394,
3225,
5621,
203,
9506,
565,
364,
261,
474,
277,
273,
374,
31,
277,
411,
1651,
18,
2469,
31,
277,
27245,
288,
203,
9506,
3639,
2393,
18,
6923,
12,
4522,
18,
10492,
12443,
2816,
63,
77,
65,
473,
374,
5297,
13,
397,
374,
92,
6625,
16,
2872,
2934,
28023,
12,
21,
10019,
203,
9506,
565,
289,
203,
6862,
203,
9506,
565,
327,
2393,
18,
10492,
5621,
203,
203,
1082,
202,
97,
1044,
261,
28341,
17293,
425,
13,
288,
203,
9506,
202,
73,
18,
1188,
6332,
5621,
203,
1082,
202,
97,
203,
202,
202,
97,
203,
202,
202,
2463,
446,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
6654,
279,
9777,
5034,
1651,
981,
364,
392,
810,
533,
7010,
202,
380,
632,
891,
533,
382,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
3b019a5699a57234a11dc809ac7f9592123c7d95 | iedadata/geomapapp | haxby/wms/XML_Layer.java | [
"Apache-2.0"
] | Java | searchChildLayersForLegend | Style | private static Style searchChildLayersForLegend(Layer layer, String name) {
Style s = null;
Layer[] childLayers = layer.getChildren();
for ( int m = 0; m < childLayers.length; m++ ) {
s = searchChildLayersForLegend(childLayers[m], name);
if (s != null) return s;
if (childLayers[m].getName() != null && childLayers[m].getName().equals(name)) {
for ( int j = 0; j < childLayers[m].getStyles().length; j++ ) {
for ( int k = 0; k < childLayers[m].getStyles()[j].getLegendURLs().length; k++ ) {
if ( childLayers[m].getStyles()[j].getLegendURLs()[k] != null ) {
s = childLayers[m].getStyles()[j];
return s;
}
}
}
}
}
return s;
} | /*
* recursive method to search child layers for WMS legend
*/ | recursive method to search child layers for WMS legend | [
"recursive",
"method",
"to",
"search",
"child",
"layers",
"for",
"WMS",
"legend"
] | private static Style searchChildLayersForLegend(Layer layer, String name) {
Style s = null;
Layer[] childLayers = layer.getChildren();
for ( int m = 0; m < childLayers.length; m++ ) {
s = searchChildLayersForLegend(childLayers[m], name);
if (s != null) return s;
if (childLayers[m].getName() != null && childLayers[m].getName().equals(name)) {
for ( int j = 0; j < childLayers[m].getStyles().length; j++ ) {
for ( int k = 0; k < childLayers[m].getStyles()[j].getLegendURLs().length; k++ ) {
if ( childLayers[m].getStyles()[j].getLegendURLs()[k] != null ) {
s = childLayers[m].getStyles()[j];
return s;
}
}
}
}
}
return s;
} | [
"private",
"static",
"Style",
"searchChildLayersForLegend",
"(",
"Layer",
"layer",
",",
"String",
"name",
")",
"{",
"Style",
"s",
"=",
"null",
";",
"Layer",
"[",
"]",
"childLayers",
"=",
"layer",
".",
"getChildren",
"(",
")",
";",
"for",
"(",
"int",
"m",
"=",
"0",
";",
"m",
"<",
"childLayers",
".",
"length",
";",
"m",
"++",
")",
"{",
"s",
"=",
"searchChildLayersForLegend",
"(",
"childLayers",
"[",
"m",
"]",
",",
"name",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"return",
"s",
";",
"if",
"(",
"childLayers",
"[",
"m",
"]",
".",
"getName",
"(",
")",
"!=",
"null",
"&&",
"childLayers",
"[",
"m",
"]",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"childLayers",
"[",
"m",
"]",
".",
"getStyles",
"(",
")",
".",
"length",
";",
"j",
"++",
")",
"{",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"childLayers",
"[",
"m",
"]",
".",
"getStyles",
"(",
")",
"[",
"j",
"]",
".",
"getLegendURLs",
"(",
")",
".",
"length",
";",
"k",
"++",
")",
"{",
"if",
"(",
"childLayers",
"[",
"m",
"]",
".",
"getStyles",
"(",
")",
"[",
"j",
"]",
".",
"getLegendURLs",
"(",
")",
"[",
"k",
"]",
"!=",
"null",
")",
"{",
"s",
"=",
"childLayers",
"[",
"m",
"]",
".",
"getStyles",
"(",
")",
"[",
"j",
"]",
";",
"return",
"s",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"s",
";",
"}"
] | recursive method to search child layers for WMS legend | [
"recursive",
"method",
"to",
"search",
"child",
"layers",
"for",
"WMS",
"legend"
] | [] | [
{
"param": "layer",
"type": "Layer"
},
{
"param": "name",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "layer",
"type": "Layer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "name",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
760,
9767,
1623,
1763,
9282,
1290,
16812,
12,
4576,
3018,
16,
514,
508,
13,
288,
206,
203,
202,
202,
2885,
272,
273,
446,
31,
206,
203,
202,
202,
4576,
8526,
1151,
9282,
273,
3018,
18,
588,
4212,
5621,
206,
203,
202,
202,
1884,
261,
509,
312,
273,
374,
31,
312,
411,
1151,
9282,
18,
2469,
31,
312,
9904,
262,
288,
206,
203,
1082,
202,
87,
273,
1623,
1763,
9282,
1290,
16812,
12,
3624,
9282,
63,
81,
6487,
508,
1769,
206,
203,
1082,
202,
430,
261,
87,
480,
446,
13,
327,
272,
31,
9760,
203,
1082,
202,
430,
261,
3624,
9282,
63,
81,
8009,
17994,
1435,
480,
446,
597,
1151,
9282,
63,
81,
8009,
17994,
7675,
14963,
12,
529,
3719,
288,
206,
203,
9506,
202,
1884,
261,
509,
525,
273,
374,
31,
525,
411,
1151,
9282,
63,
81,
8009,
588,
9725,
7675,
2469,
31,
525,
9904,
262,
288,
206,
203,
6862,
202,
1884,
261,
509,
417,
273,
374,
31,
417,
411,
1151,
9282,
63,
81,
8009,
588,
9725,
1435,
63,
78,
8009,
588,
16812,
15749,
7675,
2469,
31,
417,
9904,
262,
288,
206,
203,
25083,
202,
430,
261,
1151,
9282,
63,
81,
8009,
588,
9725,
1435,
63,
78,
8009,
588,
16812,
15749,
1435,
63,
79,
65,
480,
446,
262,
288,
206,
203,
6862,
1082,
202,
87,
273,
1151,
9282,
63,
81,
8009,
588,
9725,
1435,
63,
78,
15533,
206,
203,
6862,
1082,
202,
2463,
272,
31,
206,
203,
25083,
202,
97,
206,
203,
6862,
202,
97,
206,
203,
9506,
202,
97,
206,
203,
1082,
202,
97,
9760,
203,
202,
202,
97,
206,
203,
206,
203,
202,
202,
2463,
272,
31,
206,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
206,
203,
202,
380,
5904,
707,
358,
1623,
1151,
6623,
364,
678,
3537,
7241,
206,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
042fcecbfb27a39ca5f4d446dc7816510aec7b36 | iedadata/geomapapp | haxby/db/xmcs/XMControl.java | [
"Apache-2.0"
] | Java | main | null | public static void main(String[] args) {
if (args.length != 2) {
System.err.println("ussage java haxby.db.mcs.XMControl cruiseID navDir");
System.exit(0);
}
Projection proj = ProjectionFactory.getMercator( 1024*512 );
try {
DataOutputStream out = new DataOutputStream(
new BufferedOutputStream(
new FileOutputStream("mcs_control")));
File dir = new File(args[1]);
File[] files = dir.listFiles( new FileFilter() {
public boolean accept( File file ) {
return file.getName().endsWith(".nav");
}
});
String s;
String cruise = args[0];
String lineID = "";
Nav nav = null;
int time = 0;
double lon = 0.;
double lat = 0.;
int time1 = 0;
double lon0 = Double.MAX_VALUE;
double lat0 = Double.MAX_VALUE;
double lon1 = -Double.MAX_VALUE;
double lat1 = -Double.MAX_VALUE;
for( int k=0 ; k<files.length ; k++ ) {
BufferedReader in = new BufferedReader(
new FileReader( files[k] ));
int nraw = 0;
nav = null;
while( (s=in.readLine()) != null ) {
StringTokenizer st = new StringTokenizer( s );
lineID = st.nextToken();
if (nav == null)
nav = new Nav(lineID);
int shot = Integer.parseInt( st.nextToken() );
lat = Double.parseDouble( st.nextToken() );
lon = Double.parseDouble( st.nextToken() );
nav.addPoint( shot, lon, lat );
nraw++;
}
System.out.println( cruise +"\t"+ lineID +"\t"+ nraw);
if( nraw>1 ) {
double[] wesn = writeNav( nav, cruise, lineID, proj, out );
if (wesn==null) continue;
lon0 = Math.min(wesn[0], lon0);
lon1 = Math.max(wesn[1], lon1);
lat0 = Math.min(wesn[2], lat0);
lat1 = Math.max(wesn[3], lat1);
}
}
out.close();
System.out.println("West\tEast\tSouth\tNorth");
System.out.println(lon0+"\t"+lon1+"\t"+lat0+"\t"+lat1);
} catch (IOException ex) {
ex.printStackTrace();
}
} | /**
* java haxby.db.mcs.XMControl cruiseID navDir
* Expects nav files to be in the format
LineID shotPoint Lat Lon
Any information can follow the Lon
* Creates an mcs_control for cruiseID based on *nav in navDir
* Outputs WESN bounds to StandardIO
* @param args
*/ | java haxby.db.mcs.XMControl cruiseID navDir
Expects nav files to be in the format
LineID shotPoint Lat Lon
Any information can follow the Lon
Creates an mcs_control for cruiseID based on *nav in navDir
Outputs WESN bounds to StandardIO
@param args | [
"java",
"haxby",
".",
"db",
".",
"mcs",
".",
"XMControl",
"cruiseID",
"navDir",
"Expects",
"nav",
"files",
"to",
"be",
"in",
"the",
"format",
"LineID",
"shotPoint",
"Lat",
"Lon",
"Any",
"information",
"can",
"follow",
"the",
"Lon",
"Creates",
"an",
"mcs_control",
"for",
"cruiseID",
"based",
"on",
"*",
"nav",
"in",
"navDir",
"Outputs",
"WESN",
"bounds",
"to",
"StandardIO",
"@param",
"args"
] | public static void main(String[] args) {
if (args.length != 2) {
System.err.println("ussage java haxby.db.mcs.XMControl cruiseID navDir");
System.exit(0);
}
Projection proj = ProjectionFactory.getMercator( 1024*512 );
try {
DataOutputStream out = new DataOutputStream(
new BufferedOutputStream(
new FileOutputStream("mcs_control")));
File dir = new File(args[1]);
File[] files = dir.listFiles( new FileFilter() {
public boolean accept( File file ) {
return file.getName().endsWith(".nav");
}
});
String s;
String cruise = args[0];
String lineID = "";
Nav nav = null;
int time = 0;
double lon = 0.;
double lat = 0.;
int time1 = 0;
double lon0 = Double.MAX_VALUE;
double lat0 = Double.MAX_VALUE;
double lon1 = -Double.MAX_VALUE;
double lat1 = -Double.MAX_VALUE;
for( int k=0 ; k<files.length ; k++ ) {
BufferedReader in = new BufferedReader(
new FileReader( files[k] ));
int nraw = 0;
nav = null;
while( (s=in.readLine()) != null ) {
StringTokenizer st = new StringTokenizer( s );
lineID = st.nextToken();
if (nav == null)
nav = new Nav(lineID);
int shot = Integer.parseInt( st.nextToken() );
lat = Double.parseDouble( st.nextToken() );
lon = Double.parseDouble( st.nextToken() );
nav.addPoint( shot, lon, lat );
nraw++;
}
System.out.println( cruise +"\t"+ lineID +"\t"+ nraw);
if( nraw>1 ) {
double[] wesn = writeNav( nav, cruise, lineID, proj, out );
if (wesn==null) continue;
lon0 = Math.min(wesn[0], lon0);
lon1 = Math.max(wesn[1], lon1);
lat0 = Math.min(wesn[2], lat0);
lat1 = Math.max(wesn[3], lat1);
}
}
out.close();
System.out.println("West\tEast\tSouth\tNorth");
System.out.println(lon0+"\t"+lon1+"\t"+lat0+"\t"+lat1);
} catch (IOException ex) {
ex.printStackTrace();
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"if",
"(",
"args",
".",
"length",
"!=",
"2",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"ussage java haxby.db.mcs.XMControl cruiseID navDir\"",
")",
";",
"System",
".",
"exit",
"(",
"0",
")",
";",
"}",
"Projection",
"proj",
"=",
"ProjectionFactory",
".",
"getMercator",
"(",
"1024",
"*",
"512",
")",
";",
"try",
"{",
"DataOutputStream",
"out",
"=",
"new",
"DataOutputStream",
"(",
"new",
"BufferedOutputStream",
"(",
"new",
"FileOutputStream",
"(",
"\"mcs_control\"",
")",
")",
")",
";",
"File",
"dir",
"=",
"new",
"File",
"(",
"args",
"[",
"1",
"]",
")",
";",
"File",
"[",
"]",
"files",
"=",
"dir",
".",
"listFiles",
"(",
"new",
"FileFilter",
"(",
")",
"{",
"public",
"boolean",
"accept",
"(",
"File",
"file",
")",
"{",
"return",
"file",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\".nav\"",
")",
";",
"}",
"}",
")",
";",
"String",
"s",
";",
"String",
"cruise",
"=",
"args",
"[",
"0",
"]",
";",
"String",
"lineID",
"=",
"\"\"",
";",
"Nav",
"nav",
"=",
"null",
";",
"int",
"time",
"=",
"0",
";",
"double",
"lon",
"=",
"0.",
";",
"double",
"lat",
"=",
"0.",
";",
"int",
"time1",
"=",
"0",
";",
"double",
"lon0",
"=",
"Double",
".",
"MAX_VALUE",
";",
"double",
"lat0",
"=",
"Double",
".",
"MAX_VALUE",
";",
"double",
"lon1",
"=",
"-",
"Double",
".",
"MAX_VALUE",
";",
"double",
"lat1",
"=",
"-",
"Double",
".",
"MAX_VALUE",
";",
"for",
"(",
"int",
"k",
"=",
"0",
";",
"k",
"<",
"files",
".",
"length",
";",
"k",
"++",
")",
"{",
"BufferedReader",
"in",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"files",
"[",
"k",
"]",
")",
")",
";",
"int",
"nraw",
"=",
"0",
";",
"nav",
"=",
"null",
";",
"while",
"(",
"(",
"s",
"=",
"in",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"StringTokenizer",
"st",
"=",
"new",
"StringTokenizer",
"(",
"s",
")",
";",
"lineID",
"=",
"st",
".",
"nextToken",
"(",
")",
";",
"if",
"(",
"nav",
"==",
"null",
")",
"nav",
"=",
"new",
"Nav",
"(",
"lineID",
")",
";",
"int",
"shot",
"=",
"Integer",
".",
"parseInt",
"(",
"st",
".",
"nextToken",
"(",
")",
")",
";",
"lat",
"=",
"Double",
".",
"parseDouble",
"(",
"st",
".",
"nextToken",
"(",
")",
")",
";",
"lon",
"=",
"Double",
".",
"parseDouble",
"(",
"st",
".",
"nextToken",
"(",
")",
")",
";",
"nav",
".",
"addPoint",
"(",
"shot",
",",
"lon",
",",
"lat",
")",
";",
"nraw",
"++",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"cruise",
"+",
"\"\\t\"",
"+",
"lineID",
"+",
"\"\\t\"",
"+",
"nraw",
")",
";",
"if",
"(",
"nraw",
">",
"1",
")",
"{",
"double",
"[",
"]",
"wesn",
"=",
"writeNav",
"(",
"nav",
",",
"cruise",
",",
"lineID",
",",
"proj",
",",
"out",
")",
";",
"if",
"(",
"wesn",
"==",
"null",
")",
"continue",
";",
"lon0",
"=",
"Math",
".",
"min",
"(",
"wesn",
"[",
"0",
"]",
",",
"lon0",
")",
";",
"lon1",
"=",
"Math",
".",
"max",
"(",
"wesn",
"[",
"1",
"]",
",",
"lon1",
")",
";",
"lat0",
"=",
"Math",
".",
"min",
"(",
"wesn",
"[",
"2",
"]",
",",
"lat0",
")",
";",
"lat1",
"=",
"Math",
".",
"max",
"(",
"wesn",
"[",
"3",
"]",
",",
"lat1",
")",
";",
"}",
"}",
"out",
".",
"close",
"(",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"West\\tEast\\tSouth\\tNorth\"",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"lon0",
"+",
"\"\\t\"",
"+",
"lon1",
"+",
"\"\\t\"",
"+",
"lat0",
"+",
"\"\\t\"",
"+",
"lat1",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | java haxby.db.mcs.XMControl cruiseID navDir
Expects nav files to be in the format
LineID shotPoint Lat Lon
Any information can follow the Lon
Creates an mcs_control for cruiseID based on *nav in navDir
Outputs WESN bounds to StandardIO
@param args | [
"java",
"haxby",
".",
"db",
".",
"mcs",
".",
"XMControl",
"cruiseID",
"navDir",
"Expects",
"nav",
"files",
"to",
"be",
"in",
"the",
"format",
"LineID",
"shotPoint",
"Lat",
"Lon",
"Any",
"information",
"can",
"follow",
"the",
"Lon",
"Creates",
"an",
"mcs_control",
"for",
"cruiseID",
"based",
"on",
"*",
"nav",
"in",
"navDir",
"Outputs",
"WESN",
"bounds",
"to",
"StandardIO",
"@param",
"args"
] | [] | [
{
"param": "args",
"type": "String[]"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "args",
"type": "String[]",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
918,
2774,
12,
780,
8526,
833,
13,
288,
203,
202,
202,
430,
261,
1968,
18,
2469,
480,
576,
13,
288,
203,
1082,
202,
3163,
18,
370,
18,
8222,
2932,
5567,
410,
2252,
366,
651,
1637,
18,
1966,
18,
81,
2143,
18,
60,
49,
3367,
4422,
89,
784,
734,
8775,
1621,
8863,
203,
1082,
202,
3163,
18,
8593,
12,
20,
1769,
203,
202,
202,
97,
203,
203,
202,
202,
14789,
10296,
273,
21288,
1733,
18,
588,
8478,
71,
639,
12,
6250,
14,
13757,
11272,
203,
202,
202,
698,
288,
203,
1082,
202,
751,
4632,
596,
273,
394,
28680,
12,
203,
6862,
202,
2704,
28649,
12,
203,
6862,
202,
2704,
12942,
2932,
81,
2143,
67,
7098,
6,
3719,
1769,
203,
1082,
202,
812,
1577,
273,
394,
1387,
12,
1968,
63,
21,
19226,
203,
1082,
202,
812,
8526,
1390,
273,
1577,
18,
1098,
2697,
12,
394,
1387,
1586,
1435,
288,
203,
6862,
202,
482,
1250,
2791,
12,
1387,
585,
262,
288,
203,
25083,
202,
2463,
585,
18,
17994,
7675,
5839,
1190,
2932,
18,
11589,
8863,
203,
6862,
202,
97,
203,
9506,
202,
22938,
203,
1082,
202,
780,
272,
31,
203,
1082,
202,
780,
4422,
89,
784,
273,
833,
63,
20,
15533,
203,
1082,
202,
780,
980,
734,
273,
1408,
31,
203,
1082,
202,
12599,
8775,
273,
446,
31,
203,
1082,
202,
474,
813,
273,
374,
31,
203,
1082,
202,
9056,
4281,
273,
374,
18,
31,
203,
1082,
202,
9056,
2516,
273,
374,
18,
31,
203,
1082,
202,
474,
813,
21,
273,
374,
31,
203,
1082,
202,
9056,
4281,
20,
273,
3698,
18,
6694,
67,
4051,
31,
203,
1082,
202,
9056,
2516,
20,
273,
3698,
18,
6694,
67,
4051,
31,
203,
1082,
202,
9056,
4281,
21,
273,
300,
5265,
18,
6694,
67,
4051,
31,
203,
1082,
202,
9056,
2516,
21,
273,
300,
5265,
18,
6694,
67,
4051,
31,
203,
1082,
202,
1884,
12,
509,
417,
33,
20,
274,
417,
32,
2354,
18,
2469,
274,
417,
9904,
262,
288,
203,
9506,
202,
17947,
2514,
316,
273,
394,
10633,
12,
203,
25083,
202,
2704,
23010,
12,
1390,
63,
79,
65,
262,
1769,
203,
9506,
202,
474,
290,
1899,
273,
374,
31,
203,
9506,
202,
11589,
273,
446,
31,
203,
9506,
202,
17523,
12,
261,
87,
33,
267,
18,
896,
1670,
10756,
480,
446,
262,
288,
203,
6862,
202,
780,
10524,
384,
225,
273,
394,
16370,
12,
272,
11272,
203,
6862,
202,
1369,
734,
273,
384,
18,
4285,
1345,
5621,
203,
6862,
202,
430,
261,
11589,
422,
446,
13,
203,
25083,
202,
11589,
273,
394,
423,
842,
12,
1369,
734,
1769,
203,
6862,
202,
474,
24167,
273,
2144,
18,
2670,
1702,
12,
384,
18,
4285,
1345,
1435,
11272,
203,
6862,
202,
4801,
273,
3698,
18,
2670,
5265,
12,
384,
18,
4285,
1345,
1435,
11272,
203,
6862,
202,
9379,
273,
3698,
18,
2670,
5265,
12,
384,
18,
4285,
1345,
1435,
11272,
203,
6862,
202,
11589,
18,
1289,
2148,
12,
24167,
16,
4281,
16,
2516,
11272,
203,
6862,
202,
82,
1899,
9904,
31,
203,
9506,
202,
97,
203,
202,
3163,
18,
659,
18,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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,
60,
49,
3367,
4422,
89,
784,
734,
8775,
1621,
203,
202,
380,
15510,
87,
8775,
1390,
358,
506,
316,
326,
740,
7010,
202,
202,
1670,
734,
202,
2415,
2148,
202,
6607,
511,
265,
203,
202,
202,
2961,
1779,
848,
2805,
326,
511,
265,
203,
202,
380,
10210,
392,
312,
2143,
67,
7098,
364,
4422,
89,
784,
734,
2511,
603,
380,
11589,
316,
8775,
1621,
203,
202,
380,
26168,
678,
3991,
50,
4972,
358,
8263,
4294,
203,
202,
380,
632,
891,
833,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
1381df0cb575eafe20f2178193628fbd90a1e3cf | iedadata/geomapapp | org/geomapapp/grid/Grid2DOverlay.java | [
"Apache-2.0"
] | Java | saveGrdGMT3 | null | public void saveGrdGMT3( File file ) throws IOException {
try {
NetCDFGrid2D.createStandardGrd( grid, file );
} catch(IOException ex) {
ex.printStackTrace();
throw ex;
}
} | // ***** GMA 1.6.4: Create new function to retain functionality to save as GMT-3 GRD file | GMA 1.6.4: Create new function to retain functionality to save as GMT-3 GRD file | [
"GMA",
"1",
".",
"6",
".",
"4",
":",
"Create",
"new",
"function",
"to",
"retain",
"functionality",
"to",
"save",
"as",
"GMT",
"-",
"3",
"GRD",
"file"
] | public void saveGrdGMT3( File file ) throws IOException {
try {
NetCDFGrid2D.createStandardGrd( grid, file );
} catch(IOException ex) {
ex.printStackTrace();
throw ex;
}
} | [
"public",
"void",
"saveGrdGMT3",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"try",
"{",
"NetCDFGrid2D",
".",
"createStandardGrd",
"(",
"grid",
",",
"file",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"throw",
"ex",
";",
"}",
"}"
] | GMA 1.6.4: Create new function to retain functionality to save as GMT-3 GRD file | [
"GMA",
"1",
".",
"6",
".",
"4",
":",
"Create",
"new",
"function",
"to",
"retain",
"functionality",
"to",
"save",
"as",
"GMT",
"-",
"3",
"GRD",
"file"
] | [] | [
{
"param": "file",
"type": "File"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1923,
43,
13623,
25315,
23,
12,
1387,
585,
262,
1216,
1860,
288,
203,
202,
202,
698,
288,
203,
1082,
202,
7308,
39,
4577,
6313,
22,
40,
18,
2640,
8336,
43,
13623,
12,
3068,
16,
585,
11272,
203,
202,
202,
97,
1044,
12,
14106,
431,
13,
288,
203,
1082,
202,
338,
18,
1188,
6332,
5621,
203,
1082,
202,
12849,
431,
31,
203,
202,
202,
97,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
759,
202,
23490,
611,
5535,
404,
18,
26,
18,
24,
30,
1788,
394,
445,
358,
15096,
14176,
358,
1923,
487,
21706,
17,
23,
15228,
40,
585,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
1381df0cb575eafe20f2178193628fbd90a1e3cf | iedadata/geomapapp | org/geomapapp/grid/Grid2DOverlay.java | [
"Apache-2.0"
] | Java | saveGridToESRI | null | public void saveGridToESRI() {
Rectangle rect = grid.getBounds();
MapProjection proj = grid.getProjection();
double minLon = proj.getRefXY(rect.x, rect.y).getX();
double minLat = proj.getRefXY(rect.x, rect.getMaxY()).getY();
double maxLon = proj.getRefXY(rect.getMaxX(), rect.y).getX();
double maxLat = proj.getRefXY(rect.x, rect.y).getY();
double dLon = maxLon - minLon;
double dLat = maxLat - minLat;
// if second x is wrapped
if ((int) Math.rint(proj.getMapXY(maxLon, 0).getX()) !=
(int) Math.rint(rect.getMaxX()))
// if first x is NOT wrapped
if ((int) Math.rint(proj.getMapXY(minLon, 0).getX()) ==
(int) Math.rint(rect.x))
dLon += 360;
int nCols = rect.width;
int nRows = (int) (nCols * dLat / dLon);
double cell_size = dLon / nCols;
File file = new File("untitled" + MapTools.saveCount++);
JPanel panel = new JPanel(new BorderLayout());
JLabel label = new JLabel("Save " + nCols + " by " + nRows + " grid in ESRI format as?");
panel.add( label , BorderLayout.NORTH);
JPanel p2 = new JPanel(new GridLayout(0,1));
ButtonGroup bg = new ButtonGroup();
JRadioButton b = new JRadioButton("ASCII", true);
bg.add(b);
p2.add(b);
final JRadioButton b2 = new JRadioButton("Binary");
bg.add(b2);
p2.add(b2);
panel.add(p2);
int s = JOptionPane.showConfirmDialog( map.getTopLevelAncestor(), panel, "Save grid", JOptionPane.OK_CANCEL_OPTION);
// Close on cancel
if(s == JOptionPane.CANCEL_OPTION) {
return;
}
JFileChooser chooser = MapApp.getFileChooser();
chooser.setSelectedFile(file);
chooser.setFileFilter(null);
int confirm = JOptionPane.NO_OPTION;
while (confirm == JOptionPane.NO_OPTION) {
int ok = chooser.showSaveDialog(map.getTopLevelAncestor());
if (ok == chooser.CANCEL_OPTION)
return;
// append .asc to file if save as ESRI ascii is choosen
file = chooser.getSelectedFile();
if ( !file.getName().endsWith(".asc") && !b2.isSelected()) {
file = new File(file.getPath() + ".asc");
}
if (file.exists()) {
confirm = JOptionPane.showConfirmDialog(map.getTopLevelAncestor(), "File exists, Overwrite?");
if (confirm == JOptionPane.CANCEL_OPTION) return;
}
else
break;
}
final File saveTo = file;
final int cols = nCols;
final int rows = nRows;
final double mLon = minLon;
final double mLat = minLat;
final double c_size = cell_size;
((MapApp) map.getApp()).addProcessingTask("Saving Grid...", new Runnable() {
public void run() {
try {
if (b2.isSelected())
saveGridToESRI_Bin(saveTo, cols, rows, mLon, mLat, c_size);
else
saveGridToESRI_ASCII(saveTo, cols, rows, mLon, mLat, c_size);
} catch(Exception ex) {
JOptionPane.showMessageDialog(map.getTopLevelAncestor(),
"an error occurred during this operation:\t"
+ " "+ ex.getMessage());
}
}
});
} | // Save as ESRI will give choice for binary or ascii | Save as ESRI will give choice for binary or ascii | [
"Save",
"as",
"ESRI",
"will",
"give",
"choice",
"for",
"binary",
"or",
"ascii"
] | public void saveGridToESRI() {
Rectangle rect = grid.getBounds();
MapProjection proj = grid.getProjection();
double minLon = proj.getRefXY(rect.x, rect.y).getX();
double minLat = proj.getRefXY(rect.x, rect.getMaxY()).getY();
double maxLon = proj.getRefXY(rect.getMaxX(), rect.y).getX();
double maxLat = proj.getRefXY(rect.x, rect.y).getY();
double dLon = maxLon - minLon;
double dLat = maxLat - minLat;
if ((int) Math.rint(proj.getMapXY(maxLon, 0).getX()) !=
(int) Math.rint(rect.getMaxX()))
if ((int) Math.rint(proj.getMapXY(minLon, 0).getX()) ==
(int) Math.rint(rect.x))
dLon += 360;
int nCols = rect.width;
int nRows = (int) (nCols * dLat / dLon);
double cell_size = dLon / nCols;
File file = new File("untitled" + MapTools.saveCount++);
JPanel panel = new JPanel(new BorderLayout());
JLabel label = new JLabel("Save " + nCols + " by " + nRows + " grid in ESRI format as?");
panel.add( label , BorderLayout.NORTH);
JPanel p2 = new JPanel(new GridLayout(0,1));
ButtonGroup bg = new ButtonGroup();
JRadioButton b = new JRadioButton("ASCII", true);
bg.add(b);
p2.add(b);
final JRadioButton b2 = new JRadioButton("Binary");
bg.add(b2);
p2.add(b2);
panel.add(p2);
int s = JOptionPane.showConfirmDialog( map.getTopLevelAncestor(), panel, "Save grid", JOptionPane.OK_CANCEL_OPTION);
if(s == JOptionPane.CANCEL_OPTION) {
return;
}
JFileChooser chooser = MapApp.getFileChooser();
chooser.setSelectedFile(file);
chooser.setFileFilter(null);
int confirm = JOptionPane.NO_OPTION;
while (confirm == JOptionPane.NO_OPTION) {
int ok = chooser.showSaveDialog(map.getTopLevelAncestor());
if (ok == chooser.CANCEL_OPTION)
return;
file = chooser.getSelectedFile();
if ( !file.getName().endsWith(".asc") && !b2.isSelected()) {
file = new File(file.getPath() + ".asc");
}
if (file.exists()) {
confirm = JOptionPane.showConfirmDialog(map.getTopLevelAncestor(), "File exists, Overwrite?");
if (confirm == JOptionPane.CANCEL_OPTION) return;
}
else
break;
}
final File saveTo = file;
final int cols = nCols;
final int rows = nRows;
final double mLon = minLon;
final double mLat = minLat;
final double c_size = cell_size;
((MapApp) map.getApp()).addProcessingTask("Saving Grid...", new Runnable() {
public void run() {
try {
if (b2.isSelected())
saveGridToESRI_Bin(saveTo, cols, rows, mLon, mLat, c_size);
else
saveGridToESRI_ASCII(saveTo, cols, rows, mLon, mLat, c_size);
} catch(Exception ex) {
JOptionPane.showMessageDialog(map.getTopLevelAncestor(),
"an error occurred during this operation:\t"
+ " "+ ex.getMessage());
}
}
});
} | [
"public",
"void",
"saveGridToESRI",
"(",
")",
"{",
"Rectangle",
"rect",
"=",
"grid",
".",
"getBounds",
"(",
")",
";",
"MapProjection",
"proj",
"=",
"grid",
".",
"getProjection",
"(",
")",
";",
"double",
"minLon",
"=",
"proj",
".",
"getRefXY",
"(",
"rect",
".",
"x",
",",
"rect",
".",
"y",
")",
".",
"getX",
"(",
")",
";",
"double",
"minLat",
"=",
"proj",
".",
"getRefXY",
"(",
"rect",
".",
"x",
",",
"rect",
".",
"getMaxY",
"(",
")",
")",
".",
"getY",
"(",
")",
";",
"double",
"maxLon",
"=",
"proj",
".",
"getRefXY",
"(",
"rect",
".",
"getMaxX",
"(",
")",
",",
"rect",
".",
"y",
")",
".",
"getX",
"(",
")",
";",
"double",
"maxLat",
"=",
"proj",
".",
"getRefXY",
"(",
"rect",
".",
"x",
",",
"rect",
".",
"y",
")",
".",
"getY",
"(",
")",
";",
"double",
"dLon",
"=",
"maxLon",
"-",
"minLon",
";",
"double",
"dLat",
"=",
"maxLat",
"-",
"minLat",
";",
"if",
"(",
"(",
"int",
")",
"Math",
".",
"rint",
"(",
"proj",
".",
"getMapXY",
"(",
"maxLon",
",",
"0",
")",
".",
"getX",
"(",
")",
")",
"!=",
"(",
"int",
")",
"Math",
".",
"rint",
"(",
"rect",
".",
"getMaxX",
"(",
")",
")",
")",
"if",
"(",
"(",
"int",
")",
"Math",
".",
"rint",
"(",
"proj",
".",
"getMapXY",
"(",
"minLon",
",",
"0",
")",
".",
"getX",
"(",
")",
")",
"==",
"(",
"int",
")",
"Math",
".",
"rint",
"(",
"rect",
".",
"x",
")",
")",
"dLon",
"+=",
"360",
";",
"int",
"nCols",
"=",
"rect",
".",
"width",
";",
"int",
"nRows",
"=",
"(",
"int",
")",
"(",
"nCols",
"*",
"dLat",
"/",
"dLon",
")",
";",
"double",
"cell_size",
"=",
"dLon",
"/",
"nCols",
";",
"File",
"file",
"=",
"new",
"File",
"(",
"\"untitled\"",
"+",
"MapTools",
".",
"saveCount",
"++",
")",
";",
"JPanel",
"panel",
"=",
"new",
"JPanel",
"(",
"new",
"BorderLayout",
"(",
")",
")",
";",
"JLabel",
"label",
"=",
"new",
"JLabel",
"(",
"\"Save \"",
"+",
"nCols",
"+",
"\" by \"",
"+",
"nRows",
"+",
"\" grid in ESRI format as?\"",
")",
";",
"panel",
".",
"add",
"(",
"label",
",",
"BorderLayout",
".",
"NORTH",
")",
";",
"JPanel",
"p2",
"=",
"new",
"JPanel",
"(",
"new",
"GridLayout",
"(",
"0",
",",
"1",
")",
")",
";",
"ButtonGroup",
"bg",
"=",
"new",
"ButtonGroup",
"(",
")",
";",
"JRadioButton",
"b",
"=",
"new",
"JRadioButton",
"(",
"\"ASCII\"",
",",
"true",
")",
";",
"bg",
".",
"add",
"(",
"b",
")",
";",
"p2",
".",
"add",
"(",
"b",
")",
";",
"final",
"JRadioButton",
"b2",
"=",
"new",
"JRadioButton",
"(",
"\"Binary\"",
")",
";",
"bg",
".",
"add",
"(",
"b2",
")",
";",
"p2",
".",
"add",
"(",
"b2",
")",
";",
"panel",
".",
"add",
"(",
"p2",
")",
";",
"int",
"s",
"=",
"JOptionPane",
".",
"showConfirmDialog",
"(",
"map",
".",
"getTopLevelAncestor",
"(",
")",
",",
"panel",
",",
"\"Save grid\"",
",",
"JOptionPane",
".",
"OK_CANCEL_OPTION",
")",
";",
"if",
"(",
"s",
"==",
"JOptionPane",
".",
"CANCEL_OPTION",
")",
"{",
"return",
";",
"}",
"JFileChooser",
"chooser",
"=",
"MapApp",
".",
"getFileChooser",
"(",
")",
";",
"chooser",
".",
"setSelectedFile",
"(",
"file",
")",
";",
"chooser",
".",
"setFileFilter",
"(",
"null",
")",
";",
"int",
"confirm",
"=",
"JOptionPane",
".",
"NO_OPTION",
";",
"while",
"(",
"confirm",
"==",
"JOptionPane",
".",
"NO_OPTION",
")",
"{",
"int",
"ok",
"=",
"chooser",
".",
"showSaveDialog",
"(",
"map",
".",
"getTopLevelAncestor",
"(",
")",
")",
";",
"if",
"(",
"ok",
"==",
"chooser",
".",
"CANCEL_OPTION",
")",
"return",
";",
"file",
"=",
"chooser",
".",
"getSelectedFile",
"(",
")",
";",
"if",
"(",
"!",
"file",
".",
"getName",
"(",
")",
".",
"endsWith",
"(",
"\".asc\"",
")",
"&&",
"!",
"b2",
".",
"isSelected",
"(",
")",
")",
"{",
"file",
"=",
"new",
"File",
"(",
"file",
".",
"getPath",
"(",
")",
"+",
"\".asc\"",
")",
";",
"}",
"if",
"(",
"file",
".",
"exists",
"(",
")",
")",
"{",
"confirm",
"=",
"JOptionPane",
".",
"showConfirmDialog",
"(",
"map",
".",
"getTopLevelAncestor",
"(",
")",
",",
"\"File exists, Overwrite?\"",
")",
";",
"if",
"(",
"confirm",
"==",
"JOptionPane",
".",
"CANCEL_OPTION",
")",
"return",
";",
"}",
"else",
"break",
";",
"}",
"final",
"File",
"saveTo",
"=",
"file",
";",
"final",
"int",
"cols",
"=",
"nCols",
";",
"final",
"int",
"rows",
"=",
"nRows",
";",
"final",
"double",
"mLon",
"=",
"minLon",
";",
"final",
"double",
"mLat",
"=",
"minLat",
";",
"final",
"double",
"c_size",
"=",
"cell_size",
";",
"(",
"(",
"MapApp",
")",
"map",
".",
"getApp",
"(",
")",
")",
".",
"addProcessingTask",
"(",
"\"Saving Grid...\"",
",",
"new",
"Runnable",
"(",
")",
"{",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"b2",
".",
"isSelected",
"(",
")",
")",
"saveGridToESRI_Bin",
"(",
"saveTo",
",",
"cols",
",",
"rows",
",",
"mLon",
",",
"mLat",
",",
"c_size",
")",
";",
"else",
"saveGridToESRI_ASCII",
"(",
"saveTo",
",",
"cols",
",",
"rows",
",",
"mLon",
",",
"mLat",
",",
"c_size",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"map",
".",
"getTopLevelAncestor",
"(",
")",
",",
"\"an error occurred during this operation:\\t\"",
"+",
"\" \"",
"+",
"ex",
".",
"getMessage",
"(",
")",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Save as ESRI will give choice for binary or ascii | [
"Save",
"as",
"ESRI",
"will",
"give",
"choice",
"for",
"binary",
"or",
"ascii"
] | [
"// if second x is wrapped",
"// if first x is NOT wrapped",
"// Close on cancel",
"// append .asc to file if save as ESRI ascii is choosen "
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1923,
6313,
774,
3991,
2259,
1435,
288,
203,
202,
202,
19463,
4917,
273,
3068,
18,
588,
5694,
5621,
203,
202,
202,
863,
14789,
10296,
273,
3068,
18,
588,
14789,
5621,
203,
203,
202,
202,
9056,
1131,
15927,
273,
10296,
18,
588,
1957,
8546,
12,
2607,
18,
92,
16,
4917,
18,
93,
2934,
588,
60,
5621,
203,
202,
202,
9056,
1131,
6607,
273,
10296,
18,
588,
1957,
8546,
12,
2607,
18,
92,
16,
4917,
18,
588,
2747,
61,
1435,
2934,
588,
61,
5621,
203,
203,
202,
202,
9056,
943,
15927,
273,
10296,
18,
588,
1957,
8546,
12,
2607,
18,
588,
2747,
60,
9334,
4917,
18,
93,
2934,
588,
60,
5621,
203,
202,
202,
9056,
943,
6607,
273,
10296,
18,
588,
1957,
8546,
12,
2607,
18,
92,
16,
4917,
18,
93,
2934,
588,
61,
5621,
203,
203,
202,
202,
9056,
302,
15927,
273,
943,
15927,
300,
1131,
15927,
31,
203,
202,
202,
9056,
302,
6607,
273,
943,
6607,
300,
1131,
6607,
31,
203,
203,
202,
202,
759,
309,
2205,
619,
353,
5805,
203,
202,
202,
430,
14015,
474,
13,
2361,
18,
86,
474,
12,
17995,
18,
588,
863,
8546,
12,
1896,
15927,
16,
374,
2934,
588,
60,
10756,
480,
203,
1082,
202,
12,
474,
13,
2361,
18,
86,
474,
12,
2607,
18,
588,
2747,
60,
1435,
3719,
203,
1082,
202,
759,
309,
1122,
619,
353,
4269,
5805,
203,
1082,
202,
430,
14015,
474,
13,
2361,
18,
86,
474,
12,
17995,
18,
588,
863,
8546,
12,
1154,
15927,
16,
374,
2934,
588,
60,
10756,
422,
203,
9506,
202,
12,
474,
13,
2361,
18,
86,
474,
12,
2607,
18,
92,
3719,
203,
9506,
202,
72,
15927,
1011,
12360,
31,
203,
203,
202,
202,
474,
290,
8011,
273,
4917,
18,
2819,
31,
203,
202,
202,
474,
290,
4300,
273,
261,
474,
13,
261,
82,
8011,
380,
302,
6607,
342,
302,
15927,
1769,
203,
203,
202,
202,
9056,
2484,
67,
1467,
273,
302,
15927,
342,
290,
8011,
31,
203,
203,
202,
202,
812,
585,
273,
394,
1387,
2932,
10032,
305,
1259,
6,
397,
1635,
10348,
18,
5688,
1380,
9904,
1769,
203,
203,
202,
202,
46,
5537,
6594,
273,
394,
24048,
12,
2704,
30814,
10663,
203,
202,
202,
46,
2224,
1433,
273,
394,
21403,
2932,
4755,
315,
397,
290,
8011,
397,
315,
635,
315,
397,
290,
4300,
397,
315,
3068,
316,
14054,
2259,
740,
487,
7225,
1769,
203,
202,
202,
13916,
18,
1289,
12,
1433,
269,
30814,
18,
50,
28212,
1769,
203,
203,
202,
202,
46,
5537,
293,
22,
273,
394,
24048,
12,
2704,
7145,
3744,
12,
20,
16,
21,
10019,
203,
202,
202,
3616,
1114,
7611,
273,
394,
12569,
1114,
5621,
203,
202,
202,
46,
19984,
3616,
324,
273,
394,
804,
19984,
3616,
2932,
13756,
3113,
638,
1769,
203,
202,
202,
12370,
18,
1289,
12,
70,
1769,
203,
202,
202,
84,
22,
18,
1289,
12,
70,
1769,
203,
202,
202,
6385,
804,
19984,
3616,
324,
22,
273,
394,
804,
19984,
3616,
2932,
5905,
8863,
203,
202,
202,
12370,
18,
1289,
12,
70,
22,
1769,
203,
202,
202,
84,
22,
18,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
1381df0cb575eafe20f2178193628fbd90a1e3cf | iedadata/geomapapp | org/geomapapp/grid/Grid2DOverlay.java | [
"Apache-2.0"
] | Java | loadSessionParameters | null | public void loadSessionParameters(XML_Menu inputXML_Menu) {
//if no grid values are present, just return
if (inputXML_Menu.grid == null || inputXML_Menu.grid.equals("false")) return;
//set default palette
Palette pal = makePalette(inputXML_Menu.grid_dpal_name, inputXML_Menu.grid_dpal_r, inputXML_Menu.grid_dpal_g, inputXML_Menu.grid_dpal_b,
inputXML_Menu.grid_dpal_ht, inputXML_Menu.grid_dpal_discrete, inputXML_Menu.grid_dpal_range);
if (pal != null) lut.setDefaultPalette(pal);
//set land palette
pal = makePalette(inputXML_Menu.grid_lpal_name, inputXML_Menu.grid_lpal_r, inputXML_Menu.grid_lpal_g, inputXML_Menu.grid_lpal_b,
inputXML_Menu.grid_lpal_ht, inputXML_Menu.grid_lpal_discrete, inputXML_Menu.grid_lpal_range);
if (pal != null) lut.setLandPalette(pal);
//set ocean palette
pal = makePalette(inputXML_Menu.grid_opal_name, inputXML_Menu.grid_opal_r, inputXML_Menu.grid_opal_g, inputXML_Menu.grid_opal_b,
inputXML_Menu.grid_opal_ht, inputXML_Menu.grid_opal_discrete, inputXML_Menu.grid_opal_range);
if (pal != null) lut.setOceanPalette(pal);
//set up buttons depending on which palette was displayed when the session was saved
lut.setWhichPalette(inputXML_Menu.grid_which_pal);
//set V.E.
if (inputXML_Menu.grid_ve != null) {
lut.setVE(Float.parseFloat(inputXML_Menu.grid_ve));
}
//set diamond tabs on histogram
if (inputXML_Menu.grid_tabs != null && inputXML_Menu.grid_tabs != "") {
int[] tabs = GeneralUtils.string2IntArray(inputXML_Menu.grid_tabs);
lut.getScaler().setTabs(tabs);
}
//add sun illumination settings
if (inputXML_Menu.grid_illum != null && inputXML_Menu.grid_az != null && inputXML_Menu.grid_alt != null) {
boolean illum = inputXML_Menu.grid_illum.equals("true") ? true : false;
lut.setSunOn(illum);
lut.getSunTool().setDeclination(Double.parseDouble(inputXML_Menu.grid_az));
lut.getSunTool().setInclination(Double.parseDouble(inputXML_Menu.grid_alt));
}
//add contour settings
if (inputXML_Menu.grid_contours != null) {
boolean contours = inputXML_Menu.grid_contours.equals("true") ? true : false;
lut.setContourSelected(contours);
}
if (inputXML_Menu.grid_cont_int != null && inputXML_Menu.grid_cont_min != null && inputXML_Menu.grid_cont_max != null) {
interval = Double.parseDouble(inputXML_Menu.grid_cont_int);
cb[0] = Integer.parseInt(inputXML_Menu.grid_cont_min);
cb[1] = Integer.parseInt(inputXML_Menu.grid_cont_max);
}
if (inputXML_Menu.grid_cont_bolding != null) {
bolding_interval = Double.parseDouble(inputXML_Menu.grid_cont_bolding);
}
lut.setFitToStDev(false);
lut.showDialog();
MapApp app = (MapApp)map.getApp();
// do a refresh to update the palettes, etc
app.getMapTools().getGridDialog().refreshGrids();
// Add the xml_menu to the layerpanel for this grid
LayerPanel layerPanel = app.layerManager.getLayerPanel(this);
if (layerPanel != null) layerPanel.setItem(inputXML_Menu);
map.repaint();
} | /*
* load the saved grid parameters from the session XML file
*/ | load the saved grid parameters from the session XML file | [
"load",
"the",
"saved",
"grid",
"parameters",
"from",
"the",
"session",
"XML",
"file"
] | public void loadSessionParameters(XML_Menu inputXML_Menu) {
if (inputXML_Menu.grid == null || inputXML_Menu.grid.equals("false")) return;
Palette pal = makePalette(inputXML_Menu.grid_dpal_name, inputXML_Menu.grid_dpal_r, inputXML_Menu.grid_dpal_g, inputXML_Menu.grid_dpal_b,
inputXML_Menu.grid_dpal_ht, inputXML_Menu.grid_dpal_discrete, inputXML_Menu.grid_dpal_range);
if (pal != null) lut.setDefaultPalette(pal);
pal = makePalette(inputXML_Menu.grid_lpal_name, inputXML_Menu.grid_lpal_r, inputXML_Menu.grid_lpal_g, inputXML_Menu.grid_lpal_b,
inputXML_Menu.grid_lpal_ht, inputXML_Menu.grid_lpal_discrete, inputXML_Menu.grid_lpal_range);
if (pal != null) lut.setLandPalette(pal);
pal = makePalette(inputXML_Menu.grid_opal_name, inputXML_Menu.grid_opal_r, inputXML_Menu.grid_opal_g, inputXML_Menu.grid_opal_b,
inputXML_Menu.grid_opal_ht, inputXML_Menu.grid_opal_discrete, inputXML_Menu.grid_opal_range);
if (pal != null) lut.setOceanPalette(pal);
lut.setWhichPalette(inputXML_Menu.grid_which_pal);
if (inputXML_Menu.grid_ve != null) {
lut.setVE(Float.parseFloat(inputXML_Menu.grid_ve));
}
if (inputXML_Menu.grid_tabs != null && inputXML_Menu.grid_tabs != "") {
int[] tabs = GeneralUtils.string2IntArray(inputXML_Menu.grid_tabs);
lut.getScaler().setTabs(tabs);
}
if (inputXML_Menu.grid_illum != null && inputXML_Menu.grid_az != null && inputXML_Menu.grid_alt != null) {
boolean illum = inputXML_Menu.grid_illum.equals("true") ? true : false;
lut.setSunOn(illum);
lut.getSunTool().setDeclination(Double.parseDouble(inputXML_Menu.grid_az));
lut.getSunTool().setInclination(Double.parseDouble(inputXML_Menu.grid_alt));
}
if (inputXML_Menu.grid_contours != null) {
boolean contours = inputXML_Menu.grid_contours.equals("true") ? true : false;
lut.setContourSelected(contours);
}
if (inputXML_Menu.grid_cont_int != null && inputXML_Menu.grid_cont_min != null && inputXML_Menu.grid_cont_max != null) {
interval = Double.parseDouble(inputXML_Menu.grid_cont_int);
cb[0] = Integer.parseInt(inputXML_Menu.grid_cont_min);
cb[1] = Integer.parseInt(inputXML_Menu.grid_cont_max);
}
if (inputXML_Menu.grid_cont_bolding != null) {
bolding_interval = Double.parseDouble(inputXML_Menu.grid_cont_bolding);
}
lut.setFitToStDev(false);
lut.showDialog();
MapApp app = (MapApp)map.getApp();
app.getMapTools().getGridDialog().refreshGrids();
LayerPanel layerPanel = app.layerManager.getLayerPanel(this);
if (layerPanel != null) layerPanel.setItem(inputXML_Menu);
map.repaint();
} | [
"public",
"void",
"loadSessionParameters",
"(",
"XML_Menu",
"inputXML_Menu",
")",
"{",
"if",
"(",
"inputXML_Menu",
".",
"grid",
"==",
"null",
"||",
"inputXML_Menu",
".",
"grid",
".",
"equals",
"(",
"\"false\"",
")",
")",
"return",
";",
"Palette",
"pal",
"=",
"makePalette",
"(",
"inputXML_Menu",
".",
"grid_dpal_name",
",",
"inputXML_Menu",
".",
"grid_dpal_r",
",",
"inputXML_Menu",
".",
"grid_dpal_g",
",",
"inputXML_Menu",
".",
"grid_dpal_b",
",",
"inputXML_Menu",
".",
"grid_dpal_ht",
",",
"inputXML_Menu",
".",
"grid_dpal_discrete",
",",
"inputXML_Menu",
".",
"grid_dpal_range",
")",
";",
"if",
"(",
"pal",
"!=",
"null",
")",
"lut",
".",
"setDefaultPalette",
"(",
"pal",
")",
";",
"pal",
"=",
"makePalette",
"(",
"inputXML_Menu",
".",
"grid_lpal_name",
",",
"inputXML_Menu",
".",
"grid_lpal_r",
",",
"inputXML_Menu",
".",
"grid_lpal_g",
",",
"inputXML_Menu",
".",
"grid_lpal_b",
",",
"inputXML_Menu",
".",
"grid_lpal_ht",
",",
"inputXML_Menu",
".",
"grid_lpal_discrete",
",",
"inputXML_Menu",
".",
"grid_lpal_range",
")",
";",
"if",
"(",
"pal",
"!=",
"null",
")",
"lut",
".",
"setLandPalette",
"(",
"pal",
")",
";",
"pal",
"=",
"makePalette",
"(",
"inputXML_Menu",
".",
"grid_opal_name",
",",
"inputXML_Menu",
".",
"grid_opal_r",
",",
"inputXML_Menu",
".",
"grid_opal_g",
",",
"inputXML_Menu",
".",
"grid_opal_b",
",",
"inputXML_Menu",
".",
"grid_opal_ht",
",",
"inputXML_Menu",
".",
"grid_opal_discrete",
",",
"inputXML_Menu",
".",
"grid_opal_range",
")",
";",
"if",
"(",
"pal",
"!=",
"null",
")",
"lut",
".",
"setOceanPalette",
"(",
"pal",
")",
";",
"lut",
".",
"setWhichPalette",
"(",
"inputXML_Menu",
".",
"grid_which_pal",
")",
";",
"if",
"(",
"inputXML_Menu",
".",
"grid_ve",
"!=",
"null",
")",
"{",
"lut",
".",
"setVE",
"(",
"Float",
".",
"parseFloat",
"(",
"inputXML_Menu",
".",
"grid_ve",
")",
")",
";",
"}",
"if",
"(",
"inputXML_Menu",
".",
"grid_tabs",
"!=",
"null",
"&&",
"inputXML_Menu",
".",
"grid_tabs",
"!=",
"\"\"",
")",
"{",
"int",
"[",
"]",
"tabs",
"=",
"GeneralUtils",
".",
"string2IntArray",
"(",
"inputXML_Menu",
".",
"grid_tabs",
")",
";",
"lut",
".",
"getScaler",
"(",
")",
".",
"setTabs",
"(",
"tabs",
")",
";",
"}",
"if",
"(",
"inputXML_Menu",
".",
"grid_illum",
"!=",
"null",
"&&",
"inputXML_Menu",
".",
"grid_az",
"!=",
"null",
"&&",
"inputXML_Menu",
".",
"grid_alt",
"!=",
"null",
")",
"{",
"boolean",
"illum",
"=",
"inputXML_Menu",
".",
"grid_illum",
".",
"equals",
"(",
"\"true\"",
")",
"?",
"true",
":",
"false",
";",
"lut",
".",
"setSunOn",
"(",
"illum",
")",
";",
"lut",
".",
"getSunTool",
"(",
")",
".",
"setDeclination",
"(",
"Double",
".",
"parseDouble",
"(",
"inputXML_Menu",
".",
"grid_az",
")",
")",
";",
"lut",
".",
"getSunTool",
"(",
")",
".",
"setInclination",
"(",
"Double",
".",
"parseDouble",
"(",
"inputXML_Menu",
".",
"grid_alt",
")",
")",
";",
"}",
"if",
"(",
"inputXML_Menu",
".",
"grid_contours",
"!=",
"null",
")",
"{",
"boolean",
"contours",
"=",
"inputXML_Menu",
".",
"grid_contours",
".",
"equals",
"(",
"\"true\"",
")",
"?",
"true",
":",
"false",
";",
"lut",
".",
"setContourSelected",
"(",
"contours",
")",
";",
"}",
"if",
"(",
"inputXML_Menu",
".",
"grid_cont_int",
"!=",
"null",
"&&",
"inputXML_Menu",
".",
"grid_cont_min",
"!=",
"null",
"&&",
"inputXML_Menu",
".",
"grid_cont_max",
"!=",
"null",
")",
"{",
"interval",
"=",
"Double",
".",
"parseDouble",
"(",
"inputXML_Menu",
".",
"grid_cont_int",
")",
";",
"cb",
"[",
"0",
"]",
"=",
"Integer",
".",
"parseInt",
"(",
"inputXML_Menu",
".",
"grid_cont_min",
")",
";",
"cb",
"[",
"1",
"]",
"=",
"Integer",
".",
"parseInt",
"(",
"inputXML_Menu",
".",
"grid_cont_max",
")",
";",
"}",
"if",
"(",
"inputXML_Menu",
".",
"grid_cont_bolding",
"!=",
"null",
")",
"{",
"bolding_interval",
"=",
"Double",
".",
"parseDouble",
"(",
"inputXML_Menu",
".",
"grid_cont_bolding",
")",
";",
"}",
"lut",
".",
"setFitToStDev",
"(",
"false",
")",
";",
"lut",
".",
"showDialog",
"(",
")",
";",
"MapApp",
"app",
"=",
"(",
"MapApp",
")",
"map",
".",
"getApp",
"(",
")",
";",
"app",
".",
"getMapTools",
"(",
")",
".",
"getGridDialog",
"(",
")",
".",
"refreshGrids",
"(",
")",
";",
"LayerPanel",
"layerPanel",
"=",
"app",
".",
"layerManager",
".",
"getLayerPanel",
"(",
"this",
")",
";",
"if",
"(",
"layerPanel",
"!=",
"null",
")",
"layerPanel",
".",
"setItem",
"(",
"inputXML_Menu",
")",
";",
"map",
".",
"repaint",
"(",
")",
";",
"}"
] | load the saved grid parameters from the session XML file | [
"load",
"the",
"saved",
"grid",
"parameters",
"from",
"the",
"session",
"XML",
"file"
] | [
"//if no grid values are present, just return",
"//set default palette",
"//set land palette",
"//set ocean palette",
"//set up buttons depending on which palette was displayed when the session was saved",
"//set V.E.",
"//set diamond tabs on histogram",
"//add sun illumination settings",
"//add contour settings",
"// do a refresh to update the palettes, etc",
"// Add the xml_menu to the layerpanel for this grid"
] | [
{
"param": "inputXML_Menu",
"type": "XML_Menu"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inputXML_Menu",
"type": "XML_Menu",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1262,
2157,
2402,
12,
4201,
67,
4599,
810,
4201,
67,
4599,
13,
288,
203,
202,
202,
759,
430,
1158,
3068,
924,
854,
3430,
16,
2537,
327,
203,
202,
202,
430,
261,
2630,
4201,
67,
4599,
18,
5222,
422,
446,
747,
810,
4201,
67,
4599,
18,
5222,
18,
14963,
2932,
5743,
6,
3719,
327,
31,
203,
203,
202,
202,
759,
542,
805,
12127,
203,
202,
202,
25863,
25995,
273,
1221,
25863,
12,
2630,
4201,
67,
4599,
18,
5222,
67,
9295,
287,
67,
529,
16,
810,
4201,
67,
4599,
18,
5222,
67,
9295,
287,
67,
86,
16,
810,
4201,
67,
4599,
18,
5222,
67,
9295,
287,
67,
75,
16,
810,
4201,
67,
4599,
18,
5222,
67,
9295,
287,
67,
70,
16,
7010,
9506,
202,
2630,
4201,
67,
4599,
18,
5222,
67,
9295,
287,
67,
647,
16,
810,
4201,
67,
4599,
18,
5222,
67,
9295,
287,
67,
31937,
16,
810,
4201,
67,
4599,
18,
5222,
67,
9295,
287,
67,
3676,
1769,
203,
202,
202,
430,
261,
15081,
480,
446,
13,
27171,
18,
542,
1868,
25863,
12,
15081,
1769,
203,
203,
202,
202,
759,
542,
19193,
12127,
203,
202,
202,
15081,
273,
1221,
25863,
12,
2630,
4201,
67,
4599,
18,
5222,
67,
9953,
287,
67,
529,
16,
810,
4201,
67,
4599,
18,
5222,
67,
9953,
287,
67,
86,
16,
810,
4201,
67,
4599,
18,
5222,
67,
9953,
287,
67,
75,
16,
810,
4201,
67,
4599,
18,
5222,
67,
9953,
287,
67,
70,
16,
7010,
9506,
202,
2630,
4201,
67,
4599,
18,
5222,
67,
9953,
287,
67,
647,
16,
810,
4201,
67,
4599,
18,
5222,
67,
9953,
287,
67,
31937,
16,
810,
4201,
67,
4599,
18,
5222,
67,
9953,
287,
67,
3676,
1769,
203,
202,
202,
430,
261,
15081,
480,
446,
13,
27171,
18,
542,
29398,
25863,
12,
15081,
1769,
203,
1082,
203,
202,
202,
759,
542,
320,
31393,
12127,
203,
202,
202,
15081,
273,
1221,
25863,
12,
2630,
4201,
67,
4599,
18,
5222,
67,
556,
287,
67,
529,
16,
810,
4201,
67,
4599,
18,
5222,
67,
556,
287,
67,
86,
16,
810,
4201,
67,
4599,
18,
5222,
67,
556,
287,
67,
75,
16,
810,
4201,
67,
4599,
18,
5222,
67,
556,
287,
67,
70,
16,
7010,
9506,
202,
2630,
4201,
67,
4599,
18,
5222,
67,
556,
287,
67,
647,
16,
810,
4201,
67,
4599,
18,
5222,
67,
556,
287,
67,
31937,
16,
810,
4201,
67,
4599,
18,
5222,
67,
556,
287,
67,
3676,
1769,
203,
202,
202,
430,
261,
15081,
480,
446,
13,
27171,
18,
542,
51,
31393,
25863,
12,
15081,
1769,
203,
1082,
203,
202,
202,
759,
542,
731,
9502,
8353,
603,
1492,
12127,
1703,
10453,
1347,
326,
1339,
1703,
5198,
203,
202,
202,
80,
322,
18,
542,
2888,
1354,
25863,
12,
2630,
4201,
67,
4599,
18,
5222,
67,
12784,
67,
15081,
1769,
203,
203,
202,
202,
759,
542,
776,
18,
41,
18,
203,
202,
202,
430,
261,
2630,
4201,
67,
4599,
18,
5222,
67,
537,
480,
446,
13,
288,
203,
1082,
202,
80,
322,
18,
542,
3412,
12,
4723,
18,
2670,
4723,
12,
2630,
4201,
67,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
20308,
203,
202,
380,
1262,
326,
5198,
3068,
1472,
628,
326,
1339,
3167,
585,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
1381df0cb575eafe20f2178193628fbd90a1e3cf | iedadata/geomapapp | org/geomapapp/grid/Grid2DOverlay.java | [
"Apache-2.0"
] | Java | makePalette | Palette | public Palette makePalette(String palName, String palR, String palG, String palB, String palHT, String disc_interval, String palRange) {
Palette pal = null;
if ( palR != null && palG != null && palB != null && palHT != null) {
float[] r = GeneralUtils.string2FloatArray(palR);
float[] g = GeneralUtils.string2FloatArray(palG);
float[] b = GeneralUtils.string2FloatArray(palB);
float[] ht = GeneralUtils.string2FloatArray(palHT);
pal = new Palette(r, g, b, ht);
if (palRange != null) {
float[] range = GeneralUtils.string2FloatArray(palRange);
pal.setRange(range[0], range[1]);
}
if (disc_interval != null) {
pal.setDiscrete(Float.parseFloat(disc_interval));
}
}
if (palName != null && palName != "") {
pal.setName(palName);
} else pal.setName("unknown");
return pal;
} | /*
* Create a palette from parameters stored in a saved session XML file
*/ | Create a palette from parameters stored in a saved session XML file | [
"Create",
"a",
"palette",
"from",
"parameters",
"stored",
"in",
"a",
"saved",
"session",
"XML",
"file"
] | public Palette makePalette(String palName, String palR, String palG, String palB, String palHT, String disc_interval, String palRange) {
Palette pal = null;
if ( palR != null && palG != null && palB != null && palHT != null) {
float[] r = GeneralUtils.string2FloatArray(palR);
float[] g = GeneralUtils.string2FloatArray(palG);
float[] b = GeneralUtils.string2FloatArray(palB);
float[] ht = GeneralUtils.string2FloatArray(palHT);
pal = new Palette(r, g, b, ht);
if (palRange != null) {
float[] range = GeneralUtils.string2FloatArray(palRange);
pal.setRange(range[0], range[1]);
}
if (disc_interval != null) {
pal.setDiscrete(Float.parseFloat(disc_interval));
}
}
if (palName != null && palName != "") {
pal.setName(palName);
} else pal.setName("unknown");
return pal;
} | [
"public",
"Palette",
"makePalette",
"(",
"String",
"palName",
",",
"String",
"palR",
",",
"String",
"palG",
",",
"String",
"palB",
",",
"String",
"palHT",
",",
"String",
"disc_interval",
",",
"String",
"palRange",
")",
"{",
"Palette",
"pal",
"=",
"null",
";",
"if",
"(",
"palR",
"!=",
"null",
"&&",
"palG",
"!=",
"null",
"&&",
"palB",
"!=",
"null",
"&&",
"palHT",
"!=",
"null",
")",
"{",
"float",
"[",
"]",
"r",
"=",
"GeneralUtils",
".",
"string2FloatArray",
"(",
"palR",
")",
";",
"float",
"[",
"]",
"g",
"=",
"GeneralUtils",
".",
"string2FloatArray",
"(",
"palG",
")",
";",
"float",
"[",
"]",
"b",
"=",
"GeneralUtils",
".",
"string2FloatArray",
"(",
"palB",
")",
";",
"float",
"[",
"]",
"ht",
"=",
"GeneralUtils",
".",
"string2FloatArray",
"(",
"palHT",
")",
";",
"pal",
"=",
"new",
"Palette",
"(",
"r",
",",
"g",
",",
"b",
",",
"ht",
")",
";",
"if",
"(",
"palRange",
"!=",
"null",
")",
"{",
"float",
"[",
"]",
"range",
"=",
"GeneralUtils",
".",
"string2FloatArray",
"(",
"palRange",
")",
";",
"pal",
".",
"setRange",
"(",
"range",
"[",
"0",
"]",
",",
"range",
"[",
"1",
"]",
")",
";",
"}",
"if",
"(",
"disc_interval",
"!=",
"null",
")",
"{",
"pal",
".",
"setDiscrete",
"(",
"Float",
".",
"parseFloat",
"(",
"disc_interval",
")",
")",
";",
"}",
"}",
"if",
"(",
"palName",
"!=",
"null",
"&&",
"palName",
"!=",
"\"\"",
")",
"{",
"pal",
".",
"setName",
"(",
"palName",
")",
";",
"}",
"else",
"pal",
".",
"setName",
"(",
"\"unknown\"",
")",
";",
"return",
"pal",
";",
"}"
] | Create a palette from parameters stored in a saved session XML file | [
"Create",
"a",
"palette",
"from",
"parameters",
"stored",
"in",
"a",
"saved",
"session",
"XML",
"file"
] | [] | [
{
"param": "palName",
"type": "String"
},
{
"param": "palR",
"type": "String"
},
{
"param": "palG",
"type": "String"
},
{
"param": "palB",
"type": "String"
},
{
"param": "palHT",
"type": "String"
},
{
"param": "disc_interval",
"type": "String"
},
{
"param": "palRange",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "palName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "palR",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "palG",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "palB",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "palHT",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "disc_interval",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "palRange",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
453,
8786,
1221,
25863,
12,
780,
25995,
461,
16,
514,
25995,
54,
16,
514,
25995,
43,
16,
514,
25995,
38,
16,
514,
25995,
5062,
16,
514,
19169,
67,
6624,
16,
514,
25995,
2655,
13,
288,
203,
202,
202,
25863,
25995,
273,
446,
31,
203,
202,
202,
430,
261,
25995,
54,
480,
446,
597,
25995,
43,
480,
446,
597,
25995,
38,
480,
446,
225,
597,
25995,
5062,
480,
446,
13,
288,
203,
9506,
203,
1082,
202,
5659,
8526,
436,
273,
9544,
1989,
18,
1080,
22,
4723,
1076,
12,
15081,
54,
1769,
203,
1082,
202,
5659,
8526,
314,
273,
9544,
1989,
18,
1080,
22,
4723,
1076,
12,
15081,
43,
1769,
203,
1082,
202,
5659,
8526,
324,
273,
9544,
1989,
18,
1080,
22,
4723,
1076,
12,
15081,
38,
1769,
203,
1082,
202,
5659,
8526,
14049,
273,
9544,
1989,
18,
1080,
22,
4723,
1076,
12,
15081,
5062,
1769,
203,
1082,
202,
15081,
273,
394,
453,
8786,
12,
86,
16,
314,
16,
324,
16,
14049,
1769,
203,
203,
1082,
202,
430,
261,
15081,
2655,
480,
446,
13,
288,
203,
9506,
202,
5659,
8526,
1048,
273,
9544,
1989,
18,
1080,
22,
4723,
1076,
12,
15081,
2655,
1769,
203,
9506,
202,
15081,
18,
542,
2655,
12,
3676,
63,
20,
6487,
1048,
63,
21,
19226,
203,
1082,
202,
97,
203,
6862,
1082,
203,
1082,
202,
430,
261,
2251,
71,
67,
6624,
480,
446,
13,
288,
203,
9506,
202,
15081,
18,
542,
1669,
6883,
12,
4723,
18,
2670,
4723,
12,
2251,
71,
67,
6624,
10019,
203,
1082,
202,
97,
203,
9506,
203,
202,
202,
97,
203,
202,
202,
430,
261,
15081,
461,
480,
446,
597,
25995,
461,
480,
1408,
13,
288,
203,
1082,
202,
15081,
18,
542,
461,
12,
15081,
461,
1769,
203,
202,
202,
97,
469,
25995,
18,
542,
461,
2932,
8172,
8863,
203,
1082,
203,
202,
202,
2463,
25995,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
203,
202,
380,
1788,
279,
12127,
628,
1472,
4041,
316,
279,
5198,
1339,
3167,
585,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
dfb3586c17f077a367efa3a67e27b5ad2c389bdf | iedadata/geomapapp | haxby/util/FilesUtil.java | [
"Apache-2.0"
] | Java | writeLayerToFile | null | public static void writeLayerToFile(String fileContents, File xmlFile){
//Creates layers directory if one does not exists
File layerDir = new File(gmaRoot + File.separator +"layers");
if( !layerDir.exists() ) {
layerDir.mkdirs();
}
// Layers directory exists then writes to tempLayerFile
if ( layerDir.exists() ) {
BufferedWriter bufferedWriter = null;
//File tempLayerFile = new File(layerDir + File.separator + "layers.tmp");
try{
if(!xmlFile.exists()){
bufferedWriter = new BufferedWriter(new PrintWriter(xmlFile));
bufferedWriter.write(fileContents);
bufferedWriter.newLine();
}
// If tempLayerFile exists append output to file
if(xmlFile.exists()){
BufferedReader br = new BufferedReader(new FileReader(xmlFile));
bufferedWriter = new BufferedWriter(new FileWriter(xmlFile,true));
bufferedWriter.write(fileContents);
bufferedWriter.newLine();
}
}catch(FileNotFoundException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}finally{
try{
if(bufferedWriter !=null){
bufferedWriter.flush();
//Close the output stream
bufferedWriter.close();
}
}catch (IOException ex){
ex.printStackTrace();
}
}
}
} | /* Creates the necessary directories if it doesn't already exist,
* Writes the XML layer information into a saved file.
*/ | Creates the necessary directories if it doesn't already exist,
Writes the XML layer information into a saved file. | [
"Creates",
"the",
"necessary",
"directories",
"if",
"it",
"doesn",
"'",
"t",
"already",
"exist",
"Writes",
"the",
"XML",
"layer",
"information",
"into",
"a",
"saved",
"file",
"."
] | public static void writeLayerToFile(String fileContents, File xmlFile){
File layerDir = new File(gmaRoot + File.separator +"layers");
if( !layerDir.exists() ) {
layerDir.mkdirs();
}
if ( layerDir.exists() ) {
BufferedWriter bufferedWriter = null;
try{
if(!xmlFile.exists()){
bufferedWriter = new BufferedWriter(new PrintWriter(xmlFile));
bufferedWriter.write(fileContents);
bufferedWriter.newLine();
}
if(xmlFile.exists()){
BufferedReader br = new BufferedReader(new FileReader(xmlFile));
bufferedWriter = new BufferedWriter(new FileWriter(xmlFile,true));
bufferedWriter.write(fileContents);
bufferedWriter.newLine();
}
}catch(FileNotFoundException e){
e.printStackTrace();
}catch(IOException e){
e.printStackTrace();
}finally{
try{
if(bufferedWriter !=null){
bufferedWriter.flush();
bufferedWriter.close();
}
}catch (IOException ex){
ex.printStackTrace();
}
}
}
} | [
"public",
"static",
"void",
"writeLayerToFile",
"(",
"String",
"fileContents",
",",
"File",
"xmlFile",
")",
"{",
"File",
"layerDir",
"=",
"new",
"File",
"(",
"gmaRoot",
"+",
"File",
".",
"separator",
"+",
"\"layers\"",
")",
";",
"if",
"(",
"!",
"layerDir",
".",
"exists",
"(",
")",
")",
"{",
"layerDir",
".",
"mkdirs",
"(",
")",
";",
"}",
"if",
"(",
"layerDir",
".",
"exists",
"(",
")",
")",
"{",
"BufferedWriter",
"bufferedWriter",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"!",
"xmlFile",
".",
"exists",
"(",
")",
")",
"{",
"bufferedWriter",
"=",
"new",
"BufferedWriter",
"(",
"new",
"PrintWriter",
"(",
"xmlFile",
")",
")",
";",
"bufferedWriter",
".",
"write",
"(",
"fileContents",
")",
";",
"bufferedWriter",
".",
"newLine",
"(",
")",
";",
"}",
"if",
"(",
"xmlFile",
".",
"exists",
"(",
")",
")",
"{",
"BufferedReader",
"br",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"xmlFile",
")",
")",
";",
"bufferedWriter",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter",
"(",
"xmlFile",
",",
"true",
")",
")",
";",
"bufferedWriter",
".",
"write",
"(",
"fileContents",
")",
";",
"bufferedWriter",
".",
"newLine",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"finally",
"{",
"try",
"{",
"if",
"(",
"bufferedWriter",
"!=",
"null",
")",
"{",
"bufferedWriter",
".",
"flush",
"(",
")",
";",
"bufferedWriter",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}",
"}",
"}"
] | Creates the necessary directories if it doesn't already exist,
Writes the XML layer information into a saved file. | [
"Creates",
"the",
"necessary",
"directories",
"if",
"it",
"doesn",
"'",
"t",
"already",
"exist",
"Writes",
"the",
"XML",
"layer",
"information",
"into",
"a",
"saved",
"file",
"."
] | [
"//Creates layers directory if one does not exists\r",
"// Layers directory exists then writes to tempLayerFile\r",
"//File tempLayerFile = new File(layerDir + File.separator + \"layers.tmp\");\r",
"// If tempLayerFile exists append output to file\r",
"//Close the output stream\r"
] | [
{
"param": "fileContents",
"type": "String"
},
{
"param": "xmlFile",
"type": "File"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fileContents",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xmlFile",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
918,
1045,
4576,
15450,
12,
780,
22031,
16,
1387,
2025,
812,
15329,
206,
203,
202,
202,
759,
2729,
6623,
1867,
309,
1245,
1552,
486,
1704,
206,
203,
202,
202,
812,
3018,
1621,
273,
394,
1387,
12,
75,
2540,
2375,
397,
1387,
18,
11287,
397,
6,
10396,
8863,
206,
203,
202,
202,
430,
12,
401,
6363,
1621,
18,
1808,
1435,
262,
288,
206,
203,
1082,
202,
6363,
1621,
18,
24816,
8291,
5621,
206,
203,
202,
202,
97,
206,
203,
202,
202,
759,
511,
3907,
1867,
1704,
1508,
7262,
358,
1906,
4576,
812,
206,
203,
202,
202,
430,
261,
3018,
1621,
18,
1808,
1435,
262,
288,
206,
203,
1082,
202,
17947,
2289,
11445,
2289,
273,
446,
31,
206,
203,
1082,
202,
759,
812,
1906,
4576,
812,
273,
394,
1387,
12,
6363,
1621,
397,
1387,
18,
11287,
397,
315,
10396,
18,
5645,
8863,
206,
203,
1082,
202,
698,
95,
206,
203,
9506,
202,
430,
12,
5,
2902,
812,
18,
1808,
10756,
95,
206,
203,
6862,
202,
26385,
2289,
273,
394,
22490,
12,
2704,
14071,
12,
2902,
812,
10019,
206,
203,
6862,
202,
26385,
2289,
18,
2626,
12,
768,
6323,
1769,
206,
203,
6862,
202,
26385,
2289,
18,
2704,
1670,
5621,
206,
203,
9506,
202,
97,
206,
203,
9506,
202,
759,
971,
1906,
4576,
812,
1704,
714,
876,
358,
585,
206,
203,
9506,
202,
430,
12,
2902,
812,
18,
1808,
10756,
95,
206,
203,
6862,
202,
17947,
2514,
5186,
273,
394,
10633,
12,
2704,
23010,
12,
2902,
812,
10019,
206,
203,
6862,
202,
26385,
2289,
273,
394,
22490,
12,
2704,
24639,
12,
2902,
812,
16,
3767,
10019,
206,
203,
6862,
202,
26385,
2289,
18,
2626,
12,
768,
6323,
1769,
206,
203,
6862,
202,
26385,
2289,
18,
2704,
1670,
5621,
206,
203,
9506,
202,
97,
206,
203,
206,
203,
1082,
202,
97,
14683,
12,
812,
3990,
425,
15329,
206,
203,
9506,
202,
73,
18,
1188,
6332,
5621,
206,
203,
1082,
202,
97,
14683,
12,
14106,
425,
15329,
206,
203,
9506,
202,
73,
18,
1188,
6332,
5621,
206,
203,
1082,
202,
97,
23417,
95,
206,
203,
9506,
202,
698,
95,
206,
203,
6862,
202,
430,
12,
26385,
2289,
480,
2011,
15329,
206,
203,
6862,
202,
26385,
2289,
18,
11330,
5621,
206,
203,
6862,
202,
759,
4605,
326,
876,
1407,
206,
203,
6862,
202,
26385,
2289,
18,
4412,
5621,
206,
203,
9506,
202,
97,
206,
203,
9506,
202,
97,
14683,
261,
14106,
431,
15329,
206,
203,
6862,
202,
338,
18,
1188,
6332,
5621,
206,
203,
9506,
202,
97,
206,
203,
1082,
202,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
10210,
326,
4573,
6402,
309,
518,
3302,
1404,
1818,
1005,
16,
206,
203,
202,
380,
30053,
326,
3167,
3018,
1779,
1368,
279,
5198,
585,
18,
206,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
dfb3586c17f077a367efa3a67e27b5ad2c389bdf | iedadata/geomapapp | haxby/util/FilesUtil.java | [
"Apache-2.0"
] | Java | sessionAlreadyImported | null | public static boolean sessionAlreadyImported(File xmlImportFile, File xmlSessionFile) throws IOException {
BufferedReader br1 = new BufferedReader(new FileReader(xmlSessionFile)); //sessionfile
BufferedReader br2 = new BufferedReader(new FileReader(xmlImportFile)); //desktop import
String s1, s2;
s1 = br1.readLine();
s2 = br2.readLine();
s2 = br2.readLine();
br2.mark(2000);;
while(s1 != null) {
while (s1 != null && s2 != null && s1.equals(s2)) {
s1 = br1.readLine();
s2 = br2.readLine();
if (s2 == null) {
br1.close();
br2.close();
return true;
}
}
br2.reset();
s1 = br1.readLine();
}
br1.close();
br2.close();
return false;
} | /*
* search through the SessionFile to see if it already contains the import file
*/ | search through the SessionFile to see if it already contains the import file | [
"search",
"through",
"the",
"SessionFile",
"to",
"see",
"if",
"it",
"already",
"contains",
"the",
"import",
"file"
] | public static boolean sessionAlreadyImported(File xmlImportFile, File xmlSessionFile) throws IOException {
BufferedReader br1 = new BufferedReader(new FileReader(xmlSessionFile));
BufferedReader br2 = new BufferedReader(new FileReader(xmlImportFile));
String s1, s2;
s1 = br1.readLine();
s2 = br2.readLine();
s2 = br2.readLine();
br2.mark(2000);;
while(s1 != null) {
while (s1 != null && s2 != null && s1.equals(s2)) {
s1 = br1.readLine();
s2 = br2.readLine();
if (s2 == null) {
br1.close();
br2.close();
return true;
}
}
br2.reset();
s1 = br1.readLine();
}
br1.close();
br2.close();
return false;
} | [
"public",
"static",
"boolean",
"sessionAlreadyImported",
"(",
"File",
"xmlImportFile",
",",
"File",
"xmlSessionFile",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"br1",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"xmlSessionFile",
")",
")",
";",
"BufferedReader",
"br2",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"xmlImportFile",
")",
")",
";",
"String",
"s1",
",",
"s2",
";",
"s1",
"=",
"br1",
".",
"readLine",
"(",
")",
";",
"s2",
"=",
"br2",
".",
"readLine",
"(",
")",
";",
"s2",
"=",
"br2",
".",
"readLine",
"(",
")",
";",
"br2",
".",
"mark",
"(",
"2000",
")",
";",
";",
"while",
"(",
"s1",
"!=",
"null",
")",
"{",
"while",
"(",
"s1",
"!=",
"null",
"&&",
"s2",
"!=",
"null",
"&&",
"s1",
".",
"equals",
"(",
"s2",
")",
")",
"{",
"s1",
"=",
"br1",
".",
"readLine",
"(",
")",
";",
"s2",
"=",
"br2",
".",
"readLine",
"(",
")",
";",
"if",
"(",
"s2",
"==",
"null",
")",
"{",
"br1",
".",
"close",
"(",
")",
";",
"br2",
".",
"close",
"(",
")",
";",
"return",
"true",
";",
"}",
"}",
"br2",
".",
"reset",
"(",
")",
";",
"s1",
"=",
"br1",
".",
"readLine",
"(",
")",
";",
"}",
"br1",
".",
"close",
"(",
")",
";",
"br2",
".",
"close",
"(",
")",
";",
"return",
"false",
";",
"}"
] | search through the SessionFile to see if it already contains the import file | [
"search",
"through",
"the",
"SessionFile",
"to",
"see",
"if",
"it",
"already",
"contains",
"the",
"import",
"file"
] | [
"//sessionfile\r",
"//desktop import\r"
] | [
{
"param": "xmlImportFile",
"type": "File"
},
{
"param": "xmlSessionFile",
"type": "File"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "xmlImportFile",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xmlSessionFile",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
1339,
9430,
24934,
12,
812,
2025,
5010,
812,
16,
1387,
2025,
2157,
812,
13,
1216,
1860,
288,
206,
203,
202,
202,
17947,
2514,
5186,
21,
273,
394,
10633,
12,
2704,
23010,
12,
2902,
2157,
812,
10019,
368,
3184,
768,
206,
203,
202,
202,
17947,
2514,
5186,
22,
273,
394,
10633,
12,
2704,
23010,
12,
2902,
5010,
812,
10019,
368,
31949,
1930,
206,
203,
202,
202,
780,
272,
21,
16,
272,
22,
31,
206,
203,
1082,
206,
203,
202,
202,
87,
21,
273,
5186,
21,
18,
896,
1670,
5621,
206,
203,
202,
202,
87,
22,
273,
5186,
22,
18,
896,
1670,
5621,
206,
203,
202,
202,
87,
22,
273,
5186,
22,
18,
896,
1670,
5621,
206,
203,
202,
202,
2848,
22,
18,
3355,
12,
17172,
1769,
31,
206,
203,
202,
202,
17523,
12,
87,
21,
480,
446,
13,
288,
1082,
206,
203,
1082,
202,
17523,
261,
87,
21,
480,
446,
597,
272,
22,
480,
446,
597,
272,
21,
18,
14963,
12,
87,
22,
3719,
288,
206,
203,
9506,
202,
87,
21,
273,
5186,
21,
18,
896,
1670,
5621,
206,
203,
9506,
202,
87,
22,
273,
5186,
22,
18,
896,
1670,
5621,
206,
203,
9506,
202,
430,
261,
87,
22,
422,
446,
13,
288,
206,
203,
6862,
202,
2848,
21,
18,
4412,
5621,
206,
203,
6862,
202,
2848,
22,
18,
4412,
5621,
206,
203,
6862,
202,
2463,
638,
31,
206,
203,
9506,
202,
97,
206,
203,
1082,
202,
97,
206,
203,
1082,
202,
2848,
22,
18,
6208,
5621,
206,
203,
1082,
202,
87,
21,
273,
5186,
21,
18,
896,
1670,
5621,
206,
203,
202,
202,
97,
206,
203,
202,
202,
2848,
21,
18,
4412,
5621,
206,
203,
202,
202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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
206,
203,
202,
380,
1623,
3059,
326,
3877,
812,
358,
2621,
309,
518,
1818,
1914,
326,
1930,
585,
206,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
dfb3586c17f077a367efa3a67e27b5ad2c389bdf | iedadata/geomapapp | haxby/util/FilesUtil.java | [
"Apache-2.0"
] | Java | containsItemCheck | null | public static boolean containsItemCheck(String fileContents)throws IOException{
File layerDir = new File(gmaRoot + File.separator +"layers");
File tempLayerFile = new File(layerDir + File.separator + "layers.tmp");
if( !tempLayerFile.exists()) {
return false;
}
if((tempLayerFile.exists()) && (tempLayerFile!=null)){
BufferedReader bufferedReader = null;
bufferedReader = new BufferedReader(new FileReader(tempLayerFile));
String s;
s = bufferedReader.readLine();
/* Read each line in file and if it contains the contents return
* true otherwise return false. Keep doing this till you reach
* the end of the file and throw a null exception.
*/
try{
while ( (tempLayerFile!=null) && (!s.contains(fileContents))) {
s = bufferedReader.readLine();
//System.out.println("String in file " + s);
while ( s.contains(fileContents)) {
return true;
}
}
}catch (NullPointerException e) {
return false;
}
}
return false;
} | /*
* Checks the layers temp file to see if the item already exists.
* Returns a boolean
*/ | Checks the layers temp file to see if the item already exists.
Returns a boolean | [
"Checks",
"the",
"layers",
"temp",
"file",
"to",
"see",
"if",
"the",
"item",
"already",
"exists",
".",
"Returns",
"a",
"boolean"
] | public static boolean containsItemCheck(String fileContents)throws IOException{
File layerDir = new File(gmaRoot + File.separator +"layers");
File tempLayerFile = new File(layerDir + File.separator + "layers.tmp");
if( !tempLayerFile.exists()) {
return false;
}
if((tempLayerFile.exists()) && (tempLayerFile!=null)){
BufferedReader bufferedReader = null;
bufferedReader = new BufferedReader(new FileReader(tempLayerFile));
String s;
s = bufferedReader.readLine();
/* Read each line in file and if it contains the contents return
* true otherwise return false. Keep doing this till you reach
* the end of the file and throw a null exception.
*/
try{
while ( (tempLayerFile!=null) && (!s.contains(fileContents))) {
s = bufferedReader.readLine();
while ( s.contains(fileContents)) {
return true;
}
}
}catch (NullPointerException e) {
return false;
}
}
return false;
} | [
"public",
"static",
"boolean",
"containsItemCheck",
"(",
"String",
"fileContents",
")",
"throws",
"IOException",
"{",
"File",
"layerDir",
"=",
"new",
"File",
"(",
"gmaRoot",
"+",
"File",
".",
"separator",
"+",
"\"layers\"",
")",
";",
"File",
"tempLayerFile",
"=",
"new",
"File",
"(",
"layerDir",
"+",
"File",
".",
"separator",
"+",
"\"layers.tmp\"",
")",
";",
"if",
"(",
"!",
"tempLayerFile",
".",
"exists",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"(",
"tempLayerFile",
".",
"exists",
"(",
")",
")",
"&&",
"(",
"tempLayerFile",
"!=",
"null",
")",
")",
"{",
"BufferedReader",
"bufferedReader",
"=",
"null",
";",
"bufferedReader",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"tempLayerFile",
")",
")",
";",
"String",
"s",
";",
"s",
"=",
"bufferedReader",
".",
"readLine",
"(",
")",
";",
"/* Read each line in file and if it contains the contents return\r\n\t\t\t * true otherwise return false. Keep doing this till you reach\r\n\t\t\t * the end of the file and throw a null exception.\r\n\t\t\t */",
"try",
"{",
"while",
"(",
"(",
"tempLayerFile",
"!=",
"null",
")",
"&&",
"(",
"!",
"s",
".",
"contains",
"(",
"fileContents",
")",
")",
")",
"{",
"s",
"=",
"bufferedReader",
".",
"readLine",
"(",
")",
";",
"while",
"(",
"s",
".",
"contains",
"(",
"fileContents",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"}",
"catch",
"(",
"NullPointerException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Checks the layers temp file to see if the item already exists. | [
"Checks",
"the",
"layers",
"temp",
"file",
"to",
"see",
"if",
"the",
"item",
"already",
"exists",
"."
] | [
"//System.out.println(\"String in file \" + s);\r"
] | [
{
"param": "fileContents",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fileContents",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
1914,
1180,
1564,
12,
780,
22031,
13,
15069,
1860,
95,
206,
203,
202,
202,
812,
3018,
1621,
273,
394,
1387,
12,
75,
2540,
2375,
397,
1387,
18,
11287,
397,
6,
10396,
8863,
206,
203,
202,
202,
812,
1906,
4576,
812,
273,
394,
1387,
12,
6363,
1621,
397,
1387,
18,
11287,
397,
315,
10396,
18,
5645,
8863,
206,
203,
206,
203,
202,
202,
430,
12,
401,
5814,
4576,
812,
18,
1808,
10756,
288,
206,
203,
1082,
202,
2463,
629,
31,
206,
203,
202,
202,
97,
206,
203,
202,
202,
430,
12443,
5814,
4576,
812,
18,
1808,
10756,
597,
261,
5814,
4576,
812,
5,
33,
2011,
3719,
95,
206,
203,
1082,
202,
17947,
2514,
11445,
2514,
273,
446,
31,
206,
203,
1082,
202,
26385,
2514,
273,
394,
10633,
12,
2704,
23010,
12,
5814,
4576,
812,
10019,
206,
203,
1082,
202,
780,
272,
31,
206,
203,
1082,
202,
87,
273,
11445,
2514,
18,
896,
1670,
5621,
206,
203,
206,
203,
1082,
202,
20308,
2720,
1517,
980,
316,
585,
471,
309,
518,
1914,
326,
2939,
327,
206,
203,
9506,
380,
638,
3541,
327,
629,
18,
10498,
9957,
333,
21364,
1846,
9287,
206,
203,
9506,
380,
326,
679,
434,
326,
585,
471,
604,
279,
446,
1520,
18,
206,
203,
9506,
1195,
206,
203,
1082,
202,
698,
95,
206,
203,
9506,
202,
17523,
261,
261,
5814,
4576,
812,
5,
33,
2011,
13,
597,
16051,
87,
18,
12298,
12,
768,
6323,
20349,
288,
206,
203,
6862,
202,
87,
273,
11445,
2514,
18,
896,
1670,
5621,
206,
203,
6862,
202,
759,
3163,
18,
659,
18,
8222,
2932,
780,
316,
585,
315,
397,
272,
1769,
206,
203,
6862,
202,
17523,
261,
272,
18,
12298,
12,
768,
6323,
3719,
288,
206,
203,
25083,
202,
2463,
638,
31,
206,
203,
6862,
202,
97,
206,
203,
9506,
202,
97,
206,
203,
1082,
202,
97,
14683,
261,
2041,
9992,
425,
13,
288,
206,
203,
9506,
202,
2463,
629,
31,
206,
203,
1082,
202,
97,
206,
203,
202,
202,
97,
206,
203,
202,
202,
2463,
629,
31,
206,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
206,
203,
202,
380,
13074,
326,
6623,
1906,
585,
358,
2621,
309,
326,
761,
1818,
1704,
18,
206,
203,
202,
380,
2860,
279,
1250,
206,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
4c203eaa748ebb86618557d816d171ccbfe25140 | iedadata/geomapapp | haxby/util/SilentProcessingDialog.java | [
"Apache-2.0"
] | Java | addTask | null | public void addTask(SilentProcessingTask task) {
LinkedList<SilentProcessingTask> existing = new LinkedList<SilentProcessingTask>();
synchronized(tasks) {
for (SilentProcessingTask eTask : tasks) {
if ( eTask.taskID.equals(task.taskID) ) {
existing.add(eTask);
if (task.cancelExisting()) {
tasks.remove(eTask);
eTask.cancel(); //TODO right now this cancels a task even if it's done
break; // for cancelExisting, we only add a task when there
// are 0 in the queue
}
}
}
}
if (task.existingTasksMustFullyTerminate() && !existing.isEmpty()) {
for(SilentProcessingTask eTask : existing) {
try {
eTask.join();
} catch (InterruptedException e) {
// we know that if the task is interrupted it does not continue
continue;
}
}
}
tasks.add(task);
task.start();
} | /**
* Add a task to the silent processing queue. Removes all previous tasks
* of this type, and if indicated in the SilentlyProcessable task also terminates
* all previous tasks of this type.
* @param task the task to add
*/ | Add a task to the silent processing queue. Removes all previous tasks
of this type, and if indicated in the SilentlyProcessable task also terminates
all previous tasks of this type.
@param task the task to add | [
"Add",
"a",
"task",
"to",
"the",
"silent",
"processing",
"queue",
".",
"Removes",
"all",
"previous",
"tasks",
"of",
"this",
"type",
"and",
"if",
"indicated",
"in",
"the",
"SilentlyProcessable",
"task",
"also",
"terminates",
"all",
"previous",
"tasks",
"of",
"this",
"type",
".",
"@param",
"task",
"the",
"task",
"to",
"add"
] | public void addTask(SilentProcessingTask task) {
LinkedList<SilentProcessingTask> existing = new LinkedList<SilentProcessingTask>();
synchronized(tasks) {
for (SilentProcessingTask eTask : tasks) {
if ( eTask.taskID.equals(task.taskID) ) {
existing.add(eTask);
if (task.cancelExisting()) {
tasks.remove(eTask);
eTask.cancel();
break;
}
}
}
}
if (task.existingTasksMustFullyTerminate() && !existing.isEmpty()) {
for(SilentProcessingTask eTask : existing) {
try {
eTask.join();
} catch (InterruptedException e) {
continue;
}
}
}
tasks.add(task);
task.start();
} | [
"public",
"void",
"addTask",
"(",
"SilentProcessingTask",
"task",
")",
"{",
"LinkedList",
"<",
"SilentProcessingTask",
">",
"existing",
"=",
"new",
"LinkedList",
"<",
"SilentProcessingTask",
">",
"(",
")",
";",
"synchronized",
"(",
"tasks",
")",
"{",
"for",
"(",
"SilentProcessingTask",
"eTask",
":",
"tasks",
")",
"{",
"if",
"(",
"eTask",
".",
"taskID",
".",
"equals",
"(",
"task",
".",
"taskID",
")",
")",
"{",
"existing",
".",
"add",
"(",
"eTask",
")",
";",
"if",
"(",
"task",
".",
"cancelExisting",
"(",
")",
")",
"{",
"tasks",
".",
"remove",
"(",
"eTask",
")",
";",
"eTask",
".",
"cancel",
"(",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"task",
".",
"existingTasksMustFullyTerminate",
"(",
")",
"&&",
"!",
"existing",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"SilentProcessingTask",
"eTask",
":",
"existing",
")",
"{",
"try",
"{",
"eTask",
".",
"join",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"continue",
";",
"}",
"}",
"}",
"tasks",
".",
"add",
"(",
"task",
")",
";",
"task",
".",
"start",
"(",
")",
";",
"}"
] | Add a task to the silent processing queue. | [
"Add",
"a",
"task",
"to",
"the",
"silent",
"processing",
"queue",
"."
] | [
"//TODO right now this cancels a task even if it's done",
"// for cancelExisting, we only add a task when there",
"// are 0 in the queue",
"// we know that if the task is interrupted it does not continue"
] | [
{
"param": "task",
"type": "SilentProcessingTask"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "task",
"type": "SilentProcessingTask",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
527,
2174,
12,
55,
8125,
7798,
2174,
1562,
13,
288,
203,
203,
202,
202,
13174,
682,
32,
55,
8125,
7798,
2174,
34,
2062,
273,
394,
10688,
32,
55,
8125,
7798,
2174,
34,
5621,
203,
1082,
203,
202,
202,
22043,
12,
9416,
13,
288,
203,
1082,
202,
1884,
261,
55,
8125,
7798,
2174,
425,
2174,
294,
4592,
13,
288,
203,
9506,
202,
430,
261,
425,
2174,
18,
4146,
734,
18,
14963,
12,
4146,
18,
4146,
734,
13,
262,
288,
203,
6862,
202,
11711,
18,
1289,
12,
73,
2174,
1769,
203,
6862,
202,
430,
261,
4146,
18,
10996,
9895,
10756,
288,
203,
25083,
202,
9416,
18,
4479,
12,
73,
2174,
1769,
203,
25083,
202,
73,
2174,
18,
10996,
5621,
368,
6241,
2145,
2037,
333,
3755,
87,
279,
1562,
5456,
309,
518,
1807,
2731,
203,
25083,
202,
8820,
31,
368,
364,
3755,
9895,
16,
732,
1338,
527,
279,
1562,
1347,
1915,
203,
6862,
9506,
282,
368,
854,
374,
316,
326,
2389,
203,
6862,
202,
97,
203,
9506,
202,
97,
203,
1082,
202,
97,
203,
202,
202,
97,
203,
1082,
203,
202,
202,
430,
261,
4146,
18,
11711,
6685,
10136,
16999,
26106,
1435,
597,
401,
11711,
18,
291,
1921,
10756,
225,
288,
203,
1082,
202,
1884,
12,
55,
8125,
7798,
2174,
425,
2174,
294,
2062,
13,
288,
203,
9506,
202,
698,
288,
203,
6862,
202,
73,
2174,
18,
5701,
5621,
203,
7734,
289,
1044,
261,
24485,
503,
425,
13,
288,
203,
1171,
202,
759,
732,
5055,
716,
309,
326,
1562,
353,
15711,
518,
1552,
486,
1324,
203,
1171,
202,
17143,
31,
7010,
7734,
289,
203,
1082,
202,
97,
203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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
1436,
279,
1562,
358,
326,
10404,
4929,
2389,
18,
20284,
777,
2416,
4592,
203,
202,
380,
434,
333,
618,
16,
471,
309,
17710,
316,
326,
348,
8125,
715,
2227,
429,
1562,
2546,
30559,
203,
202,
380,
777,
2416,
4592,
434,
333,
618,
18,
203,
202,
380,
632,
891,
1562,
326,
1562,
358,
527,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
5752d9ef03d8ac2ab0c3b9610c4f1b5302ac3c1b | iedadata/geomapapp | org/geomapapp/db/dsdp/DSDPDemo.java | [
"Apache-2.0"
] | Java | readHoleList | null | public void readHoleList() {
try {
BufferedReader in = new BufferedReader( new InputStreamReader( ( URLFactory.url(sedimentHoleListURLString) ).openStream() ) );
String s;
while ( ( s = in.readLine() ) != null ) {
String[] sArr = s.split("\t");
String sedimentsForHole = "";
if ( sArr.length > 1 ) {
for ( int i = 1; i < sArr.length; i++ ) {
if ( sArr[i] != null ) {
sedimentsForHole = sedimentsForHole + sArr[i] + "\t";
}
}
sedimentsForHole = sedimentsForHole.trim();
}
String holeString = sArr[0];
holeString = holeString.substring( 0, holeString.length() - 1 );
holeString = holeString.replaceAll( "/", "-" );
sedimentHoleList.put( holeString, sedimentsForHole );
}
in.close();
} catch (MalformedURLException mue) {
mue.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}
} | // ***** GMA 1.6.8: Read in the hole-list that indicates which sediments are available for a particular hole | GMA 1.6.8: Read in the hole-list that indicates which sediments are available for a particular hole | [
"GMA",
"1",
".",
"6",
".",
"8",
":",
"Read",
"in",
"the",
"hole",
"-",
"list",
"that",
"indicates",
"which",
"sediments",
"are",
"available",
"for",
"a",
"particular",
"hole"
] | public void readHoleList() {
try {
BufferedReader in = new BufferedReader( new InputStreamReader( ( URLFactory.url(sedimentHoleListURLString) ).openStream() ) );
String s;
while ( ( s = in.readLine() ) != null ) {
String[] sArr = s.split("\t");
String sedimentsForHole = "";
if ( sArr.length > 1 ) {
for ( int i = 1; i < sArr.length; i++ ) {
if ( sArr[i] != null ) {
sedimentsForHole = sedimentsForHole + sArr[i] + "\t";
}
}
sedimentsForHole = sedimentsForHole.trim();
}
String holeString = sArr[0];
holeString = holeString.substring( 0, holeString.length() - 1 );
holeString = holeString.replaceAll( "/", "-" );
sedimentHoleList.put( holeString, sedimentsForHole );
}
in.close();
} catch (MalformedURLException mue) {
mue.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}
} | [
"public",
"void",
"readHoleList",
"(",
")",
"{",
"try",
"{",
"BufferedReader",
"in",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"(",
"URLFactory",
".",
"url",
"(",
"sedimentHoleListURLString",
")",
")",
".",
"openStream",
"(",
")",
")",
")",
";",
"String",
"s",
";",
"while",
"(",
"(",
"s",
"=",
"in",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"String",
"[",
"]",
"sArr",
"=",
"s",
".",
"split",
"(",
"\"\\t\"",
")",
";",
"String",
"sedimentsForHole",
"=",
"\"\"",
";",
"if",
"(",
"sArr",
".",
"length",
">",
"1",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"sArr",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"sArr",
"[",
"i",
"]",
"!=",
"null",
")",
"{",
"sedimentsForHole",
"=",
"sedimentsForHole",
"+",
"sArr",
"[",
"i",
"]",
"+",
"\"\\t\"",
";",
"}",
"}",
"sedimentsForHole",
"=",
"sedimentsForHole",
".",
"trim",
"(",
")",
";",
"}",
"String",
"holeString",
"=",
"sArr",
"[",
"0",
"]",
";",
"holeString",
"=",
"holeString",
".",
"substring",
"(",
"0",
",",
"holeString",
".",
"length",
"(",
")",
"-",
"1",
")",
";",
"holeString",
"=",
"holeString",
".",
"replaceAll",
"(",
"\"/\"",
",",
"\"-\"",
")",
";",
"sedimentHoleList",
".",
"put",
"(",
"holeString",
",",
"sedimentsForHole",
")",
";",
"}",
"in",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"mue",
")",
"{",
"mue",
".",
"printStackTrace",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",
"ioe",
".",
"printStackTrace",
"(",
")",
";",
"}",
"}"
] | GMA 1.6.8: Read in the hole-list that indicates which sediments are available for a particular hole | [
"GMA",
"1",
".",
"6",
".",
"8",
":",
"Read",
"in",
"the",
"hole",
"-",
"list",
"that",
"indicates",
"which",
"sediments",
"are",
"available",
"for",
"a",
"particular",
"hole"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
855,
29501,
682,
1435,
288,
203,
202,
202,
698,
288,
203,
1082,
202,
17947,
2514,
316,
273,
394,
10633,
12,
394,
15322,
12,
261,
1976,
1733,
18,
718,
12,
730,
5670,
29501,
682,
1785,
780,
13,
262,
18,
3190,
1228,
1435,
262,
11272,
203,
1082,
202,
780,
272,
31,
203,
1082,
202,
17523,
261,
261,
272,
273,
316,
18,
896,
1670,
1435,
262,
480,
446,
262,
288,
203,
9506,
202,
780,
8526,
272,
5715,
273,
272,
18,
4939,
31458,
88,
8863,
203,
9506,
202,
780,
24336,
19644,
1290,
29501,
273,
1408,
31,
203,
9506,
202,
430,
261,
272,
5715,
18,
2469,
405,
404,
262,
288,
203,
6862,
202,
1884,
261,
509,
277,
273,
404,
31,
277,
411,
272,
5715,
18,
2469,
31,
277,
9904,
262,
288,
203,
25083,
202,
430,
261,
272,
5715,
63,
77,
65,
480,
446,
262,
288,
203,
6862,
1082,
202,
730,
19644,
1290,
29501,
273,
24336,
19644,
1290,
29501,
397,
272,
5715,
63,
77,
65,
397,
1548,
88,
14432,
203,
25083,
202,
97,
203,
6862,
202,
97,
203,
6862,
202,
730,
19644,
1290,
29501,
273,
24336,
19644,
1290,
29501,
18,
5290,
5621,
203,
9506,
202,
97,
21281,
9506,
202,
780,
19922,
780,
273,
272,
5715,
63,
20,
15533,
203,
9506,
202,
27167,
780,
273,
19922,
780,
18,
28023,
12,
374,
16,
19922,
780,
18,
2469,
1435,
300,
404,
11272,
203,
9506,
202,
27167,
780,
273,
19922,
780,
18,
2079,
1595,
12,
2206,
3113,
7514,
11272,
203,
9506,
202,
730,
5670,
29501,
682,
18,
458,
12,
19922,
780,
16,
24336,
19644,
1290,
29501,
11272,
203,
1082,
202,
97,
203,
1082,
202,
267,
18,
4412,
5621,
203,
202,
202,
97,
1044,
261,
18695,
20160,
312,
344,
13,
288,
203,
1082,
202,
81,
344,
18,
1188,
6332,
5621,
203,
202,
202,
97,
1044,
261,
14106,
10847,
13,
288,
203,
1082,
202,
1594,
73,
18,
1188,
6332,
5621,
203,
202,
202,
97,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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364,
279,
6826,
19922,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
33c6fe581f9463c7b322e671bdc8c258683ad558 | iedadata/geomapapp | haxby/map/GetImageRequest.java | [
"Apache-2.0"
] | Java | run | null | public void run() {
if (isCancelled) return;
if (width <= 0 || height <= 0) return;
// --------------------------------------------------------
// First add in any relevant content from the previous view
// --------------------------------------------------------
// Sometimes, we've done a small enough pan that the previous overlay
// image still captures the current view. Avoid updating in this case.
if (res != mapRes || !mapRect.contains(x, y, width, height)) {
if (isCancelled) return;
updateWorkingImageFromImage(overlay.getImage(), mapRes);
}
// --------------------------------------------------------
// Now fill in content at any lower resolutions
// --------------------------------------------------------
int baseRes;
switch (proj) {
case MapApp.MERCATOR_MAP:
baseRes = 64;
break;
case MapApp.NORTH_POLAR_MAP:
baseRes = PoleMapServer.baseRes[PoleMapServer.NORTH_POLE];
break;
case MapApp.SOUTH_POLAR_MAP:
baseRes = PoleMapServer.baseRes[PoleMapServer.SOUTH_POLE];
break;
default:
baseRes = 64;
}
// Update workingImage for all resolutions in inclusive range [baseRes, 512]
if (res > baseRes) {
LinkedList<Integer> subRes = new LinkedList<Integer>();
subRes.add(baseRes);
for (int ires = 512; ires < res; ires *= 2) {
subRes.add(ires);
}
for (Integer ires : subRes) {
if (isCancelled) return;
updateWorkingImageFromResolution(ires, true);
}
}
// --------------------------------------------------------
// Now fill in content at any lower resolutions
// --------------------------------------------------------
BufferedImage tile;
int tileX0 = x/320;
if (x<0 && tileX0*320!=x) tileX0--;
int tileY0 = y/320;
if (y<0 && tileY0*320!=y) tileY0--;
int tileX, tileY;
int x0,y0;
int x1,x2,y1,y2;
for (tileX = tileX0; tileX*320<x+width; tileX++) {
x0 = tileX * 320;
x1 = Math.max(x0, x);
x2 = Math.min(x0 + 320, x + width);
for (tileY = tileY0; tileY * 320 < y + height; tileY++) {
if (isCancelled) return;
y0 = tileY * 320;
y1 = Math.max(y0, y);
y2 = Math.min(y0+320, y + height);
int yShift = proj == MapApp.MERCATOR_MAP ? 260 : 0;
if (mapRect.contains(x1,
y1 + yShift * scale, // Convert back to map XY
x2-x1,
y2-y1)
&& mapImageSafe) {
// this conditional indicates that this tile is covered by
// the image from the previous view, which we already copied
// into our image buffer (at the beginning of the workflow)
// therefore, we just ignore this tile and move on
continue;
}
try {
switch (proj) {
case MapApp.MERCATOR_MAP:
tile = MMapServer.getTile(res, tileX, tileY);
break;
case MapApp.NORTH_POLAR_MAP:
tile = PoleMapServer.getTile(res, tileX, tileY,
PoleMapServer.NORTH_POLE);
break;
case MapApp.SOUTH_POLAR_MAP:
tile = PoleMapServer.getTile(res, tileX, tileY,
PoleMapServer.SOUTH_POLE);
break;
default:
tile = null;
}
if(tile == null )continue;
} catch (Exception ex) {
System.out.println(ex);
continue;
}
// fill pixels into working image from tile
for (int ix=x1; ix<x2; ix++) {
for (int iy=y1; iy<y2; iy++) {
int tX = ix-x0;
int tY = iy-y0;
if (tX < 0 || tY < 0) continue;
if (tX >= tile.getWidth() || tY >= tile.getWidth()) continue;
workingImage.setRGB(ix-x,
iy-y,
tile.getRGB(ix-x0 + 8, iy-y0 + 8));
}
}
// at this point we have `image' updated with the data from a new tile, so we
// repaint
int x_XMap = x + rectToTileXShift * scale;
int y_XMap = y + rectToTileYShift * scale;
if (isCancelled) return;
overlay.setImage(workingImage,
x_XMap / (double)scale,
y_XMap / (double)scale,
1. / (double)scale);
overlay.setRect(x_XMap, y_XMap, width, height);
overlay.setResolution(res);
if (isCancelled) return;
overlay.map.repaint();
// done repainting
}
}
int x_XMap = x + rectToTileXShift * scale;
int y_XMap = y + rectToTileYShift * scale;
if (isCancelled) return;
overlay.setImage(workingImage,
x_XMap / (double)scale,
y_XMap / (double)scale,
1. / (double)scale);
overlay.setRect(x, y, width, height);
overlay.setResolution(res);
if (isCancelled) return;
overlay.map.repaint();
// image and bounds as represented in overlay are now accurate
finish();
mapImageSafe = true;
} | /**
* Execute modified version of getImage with periodic checks for cancellation after
* painting individual tiles.
*/ | Execute modified version of getImage with periodic checks for cancellation after
painting individual tiles. | [
"Execute",
"modified",
"version",
"of",
"getImage",
"with",
"periodic",
"checks",
"for",
"cancellation",
"after",
"painting",
"individual",
"tiles",
"."
] | public void run() {
if (isCancelled) return;
if (width <= 0 || height <= 0) return;
if (res != mapRes || !mapRect.contains(x, y, width, height)) {
if (isCancelled) return;
updateWorkingImageFromImage(overlay.getImage(), mapRes);
}
int baseRes;
switch (proj) {
case MapApp.MERCATOR_MAP:
baseRes = 64;
break;
case MapApp.NORTH_POLAR_MAP:
baseRes = PoleMapServer.baseRes[PoleMapServer.NORTH_POLE];
break;
case MapApp.SOUTH_POLAR_MAP:
baseRes = PoleMapServer.baseRes[PoleMapServer.SOUTH_POLE];
break;
default:
baseRes = 64;
}
if (res > baseRes) {
LinkedList<Integer> subRes = new LinkedList<Integer>();
subRes.add(baseRes);
for (int ires = 512; ires < res; ires *= 2) {
subRes.add(ires);
}
for (Integer ires : subRes) {
if (isCancelled) return;
updateWorkingImageFromResolution(ires, true);
}
}
BufferedImage tile;
int tileX0 = x/320;
if (x<0 && tileX0*320!=x) tileX0--;
int tileY0 = y/320;
if (y<0 && tileY0*320!=y) tileY0--;
int tileX, tileY;
int x0,y0;
int x1,x2,y1,y2;
for (tileX = tileX0; tileX*320<x+width; tileX++) {
x0 = tileX * 320;
x1 = Math.max(x0, x);
x2 = Math.min(x0 + 320, x + width);
for (tileY = tileY0; tileY * 320 < y + height; tileY++) {
if (isCancelled) return;
y0 = tileY * 320;
y1 = Math.max(y0, y);
y2 = Math.min(y0+320, y + height);
int yShift = proj == MapApp.MERCATOR_MAP ? 260 : 0;
if (mapRect.contains(x1,
y1 + yShift * scale,
x2-x1,
y2-y1)
&& mapImageSafe) {
continue;
}
try {
switch (proj) {
case MapApp.MERCATOR_MAP:
tile = MMapServer.getTile(res, tileX, tileY);
break;
case MapApp.NORTH_POLAR_MAP:
tile = PoleMapServer.getTile(res, tileX, tileY,
PoleMapServer.NORTH_POLE);
break;
case MapApp.SOUTH_POLAR_MAP:
tile = PoleMapServer.getTile(res, tileX, tileY,
PoleMapServer.SOUTH_POLE);
break;
default:
tile = null;
}
if(tile == null )continue;
} catch (Exception ex) {
System.out.println(ex);
continue;
}
for (int ix=x1; ix<x2; ix++) {
for (int iy=y1; iy<y2; iy++) {
int tX = ix-x0;
int tY = iy-y0;
if (tX < 0 || tY < 0) continue;
if (tX >= tile.getWidth() || tY >= tile.getWidth()) continue;
workingImage.setRGB(ix-x,
iy-y,
tile.getRGB(ix-x0 + 8, iy-y0 + 8));
}
}
int x_XMap = x + rectToTileXShift * scale;
int y_XMap = y + rectToTileYShift * scale;
if (isCancelled) return;
overlay.setImage(workingImage,
x_XMap / (double)scale,
y_XMap / (double)scale,
1. / (double)scale);
overlay.setRect(x_XMap, y_XMap, width, height);
overlay.setResolution(res);
if (isCancelled) return;
overlay.map.repaint();
}
}
int x_XMap = x + rectToTileXShift * scale;
int y_XMap = y + rectToTileYShift * scale;
if (isCancelled) return;
overlay.setImage(workingImage,
x_XMap / (double)scale,
y_XMap / (double)scale,
1. / (double)scale);
overlay.setRect(x, y, width, height);
overlay.setResolution(res);
if (isCancelled) return;
overlay.map.repaint();
finish();
mapImageSafe = true;
} | [
"public",
"void",
"run",
"(",
")",
"{",
"if",
"(",
"isCancelled",
")",
"return",
";",
"if",
"(",
"width",
"<=",
"0",
"||",
"height",
"<=",
"0",
")",
"return",
";",
"if",
"(",
"res",
"!=",
"mapRes",
"||",
"!",
"mapRect",
".",
"contains",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
")",
")",
"{",
"if",
"(",
"isCancelled",
")",
"return",
";",
"updateWorkingImageFromImage",
"(",
"overlay",
".",
"getImage",
"(",
")",
",",
"mapRes",
")",
";",
"}",
"int",
"baseRes",
";",
"switch",
"(",
"proj",
")",
"{",
"case",
"MapApp",
".",
"MERCATOR_MAP",
":",
"baseRes",
"=",
"64",
";",
"break",
";",
"case",
"MapApp",
".",
"NORTH_POLAR_MAP",
":",
"baseRes",
"=",
"PoleMapServer",
".",
"baseRes",
"[",
"PoleMapServer",
".",
"NORTH_POLE",
"]",
";",
"break",
";",
"case",
"MapApp",
".",
"SOUTH_POLAR_MAP",
":",
"baseRes",
"=",
"PoleMapServer",
".",
"baseRes",
"[",
"PoleMapServer",
".",
"SOUTH_POLE",
"]",
";",
"break",
";",
"default",
":",
"baseRes",
"=",
"64",
";",
"}",
"if",
"(",
"res",
">",
"baseRes",
")",
"{",
"LinkedList",
"<",
"Integer",
">",
"subRes",
"=",
"new",
"LinkedList",
"<",
"Integer",
">",
"(",
")",
";",
"subRes",
".",
"add",
"(",
"baseRes",
")",
";",
"for",
"(",
"int",
"ires",
"=",
"512",
";",
"ires",
"<",
"res",
";",
"ires",
"*=",
"2",
")",
"{",
"subRes",
".",
"add",
"(",
"ires",
")",
";",
"}",
"for",
"(",
"Integer",
"ires",
":",
"subRes",
")",
"{",
"if",
"(",
"isCancelled",
")",
"return",
";",
"updateWorkingImageFromResolution",
"(",
"ires",
",",
"true",
")",
";",
"}",
"}",
"BufferedImage",
"tile",
";",
"int",
"tileX0",
"=",
"x",
"/",
"320",
";",
"if",
"(",
"x",
"<",
"0",
"&&",
"tileX0",
"*",
"320",
"!=",
"x",
")",
"tileX0",
"--",
";",
"int",
"tileY0",
"=",
"y",
"/",
"320",
";",
"if",
"(",
"y",
"<",
"0",
"&&",
"tileY0",
"*",
"320",
"!=",
"y",
")",
"tileY0",
"--",
";",
"int",
"tileX",
",",
"tileY",
";",
"int",
"x0",
",",
"y0",
";",
"int",
"x1",
",",
"x2",
",",
"y1",
",",
"y2",
";",
"for",
"(",
"tileX",
"=",
"tileX0",
";",
"tileX",
"*",
"320",
"<",
"x",
"+",
"width",
";",
"tileX",
"++",
")",
"{",
"x0",
"=",
"tileX",
"*",
"320",
";",
"x1",
"=",
"Math",
".",
"max",
"(",
"x0",
",",
"x",
")",
";",
"x2",
"=",
"Math",
".",
"min",
"(",
"x0",
"+",
"320",
",",
"x",
"+",
"width",
")",
";",
"for",
"(",
"tileY",
"=",
"tileY0",
";",
"tileY",
"*",
"320",
"<",
"y",
"+",
"height",
";",
"tileY",
"++",
")",
"{",
"if",
"(",
"isCancelled",
")",
"return",
";",
"y0",
"=",
"tileY",
"*",
"320",
";",
"y1",
"=",
"Math",
".",
"max",
"(",
"y0",
",",
"y",
")",
";",
"y2",
"=",
"Math",
".",
"min",
"(",
"y0",
"+",
"320",
",",
"y",
"+",
"height",
")",
";",
"int",
"yShift",
"=",
"proj",
"==",
"MapApp",
".",
"MERCATOR_MAP",
"?",
"260",
":",
"0",
";",
"if",
"(",
"mapRect",
".",
"contains",
"(",
"x1",
",",
"y1",
"+",
"yShift",
"*",
"scale",
",",
"x2",
"-",
"x1",
",",
"y2",
"-",
"y1",
")",
"&&",
"mapImageSafe",
")",
"{",
"continue",
";",
"}",
"try",
"{",
"switch",
"(",
"proj",
")",
"{",
"case",
"MapApp",
".",
"MERCATOR_MAP",
":",
"tile",
"=",
"MMapServer",
".",
"getTile",
"(",
"res",
",",
"tileX",
",",
"tileY",
")",
";",
"break",
";",
"case",
"MapApp",
".",
"NORTH_POLAR_MAP",
":",
"tile",
"=",
"PoleMapServer",
".",
"getTile",
"(",
"res",
",",
"tileX",
",",
"tileY",
",",
"PoleMapServer",
".",
"NORTH_POLE",
")",
";",
"break",
";",
"case",
"MapApp",
".",
"SOUTH_POLAR_MAP",
":",
"tile",
"=",
"PoleMapServer",
".",
"getTile",
"(",
"res",
",",
"tileX",
",",
"tileY",
",",
"PoleMapServer",
".",
"SOUTH_POLE",
")",
";",
"break",
";",
"default",
":",
"tile",
"=",
"null",
";",
"}",
"if",
"(",
"tile",
"==",
"null",
")",
"continue",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"ex",
")",
";",
"continue",
";",
"}",
"for",
"(",
"int",
"ix",
"=",
"x1",
";",
"ix",
"<",
"x2",
";",
"ix",
"++",
")",
"{",
"for",
"(",
"int",
"iy",
"=",
"y1",
";",
"iy",
"<",
"y2",
";",
"iy",
"++",
")",
"{",
"int",
"tX",
"=",
"ix",
"-",
"x0",
";",
"int",
"tY",
"=",
"iy",
"-",
"y0",
";",
"if",
"(",
"tX",
"<",
"0",
"||",
"tY",
"<",
"0",
")",
"continue",
";",
"if",
"(",
"tX",
">=",
"tile",
".",
"getWidth",
"(",
")",
"||",
"tY",
">=",
"tile",
".",
"getWidth",
"(",
")",
")",
"continue",
";",
"workingImage",
".",
"setRGB",
"(",
"ix",
"-",
"x",
",",
"iy",
"-",
"y",
",",
"tile",
".",
"getRGB",
"(",
"ix",
"-",
"x0",
"+",
"8",
",",
"iy",
"-",
"y0",
"+",
"8",
")",
")",
";",
"}",
"}",
"int",
"x_XMap",
"=",
"x",
"+",
"rectToTileXShift",
"*",
"scale",
";",
"int",
"y_XMap",
"=",
"y",
"+",
"rectToTileYShift",
"*",
"scale",
";",
"if",
"(",
"isCancelled",
")",
"return",
";",
"overlay",
".",
"setImage",
"(",
"workingImage",
",",
"x_XMap",
"/",
"(",
"double",
")",
"scale",
",",
"y_XMap",
"/",
"(",
"double",
")",
"scale",
",",
"1.",
"/",
"(",
"double",
")",
"scale",
")",
";",
"overlay",
".",
"setRect",
"(",
"x_XMap",
",",
"y_XMap",
",",
"width",
",",
"height",
")",
";",
"overlay",
".",
"setResolution",
"(",
"res",
")",
";",
"if",
"(",
"isCancelled",
")",
"return",
";",
"overlay",
".",
"map",
".",
"repaint",
"(",
")",
";",
"}",
"}",
"int",
"x_XMap",
"=",
"x",
"+",
"rectToTileXShift",
"*",
"scale",
";",
"int",
"y_XMap",
"=",
"y",
"+",
"rectToTileYShift",
"*",
"scale",
";",
"if",
"(",
"isCancelled",
")",
"return",
";",
"overlay",
".",
"setImage",
"(",
"workingImage",
",",
"x_XMap",
"/",
"(",
"double",
")",
"scale",
",",
"y_XMap",
"/",
"(",
"double",
")",
"scale",
",",
"1.",
"/",
"(",
"double",
")",
"scale",
")",
";",
"overlay",
".",
"setRect",
"(",
"x",
",",
"y",
",",
"width",
",",
"height",
")",
";",
"overlay",
".",
"setResolution",
"(",
"res",
")",
";",
"if",
"(",
"isCancelled",
")",
"return",
";",
"overlay",
".",
"map",
".",
"repaint",
"(",
")",
";",
"finish",
"(",
")",
";",
"mapImageSafe",
"=",
"true",
";",
"}"
] | Execute modified version of getImage with periodic checks for cancellation after
painting individual tiles. | [
"Execute",
"modified",
"version",
"of",
"getImage",
"with",
"periodic",
"checks",
"for",
"cancellation",
"after",
"painting",
"individual",
"tiles",
"."
] | [
"// --------------------------------------------------------",
"// First add in any relevant content from the previous view",
"// --------------------------------------------------------",
"// Sometimes, we've done a small enough pan that the previous overlay",
"// image still captures the current view. Avoid updating in this case.",
"// --------------------------------------------------------",
"// Now fill in content at any lower resolutions",
"// --------------------------------------------------------\t\t",
"// Update workingImage for all resolutions in inclusive range [baseRes, 512]",
"// --------------------------------------------------------",
"// Now fill in content at any lower resolutions",
"// --------------------------------------------------------\t",
"// Convert back to map XY",
"// this conditional indicates that this tile is covered by",
"// the image from the previous view, which we already copied",
"// into our image buffer (at the beginning of the workflow)",
"// therefore, we just ignore this tile and move on",
"// fill pixels into working image from tile",
"// at this point we have `image' updated with the data from a new tile, so we",
"// repaint",
"// done repainting",
"// image and bounds as represented in overlay are now accurate"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1086,
1435,
288,
203,
202,
202,
430,
261,
291,
21890,
13,
327,
31,
203,
202,
202,
430,
261,
2819,
1648,
374,
747,
2072,
1648,
374,
13,
327,
31,
203,
203,
202,
202,
759,
13420,
17082,
203,
202,
202,
759,
5783,
527,
316,
1281,
9368,
913,
628,
326,
2416,
1476,
203,
202,
202,
759,
13420,
17082,
203,
1082,
203,
202,
202,
759,
348,
25976,
16,
732,
8081,
2731,
279,
5264,
7304,
2800,
716,
326,
2416,
9218,
203,
202,
202,
759,
1316,
4859,
21922,
326,
783,
1476,
18,
17843,
9702,
316,
333,
648,
18,
203,
202,
202,
430,
261,
455,
480,
852,
607,
747,
401,
1458,
6120,
18,
12298,
12,
92,
16,
677,
16,
1835,
16,
2072,
3719,
288,
203,
1082,
202,
430,
261,
291,
21890,
13,
327,
31,
203,
1082,
202,
2725,
14836,
2040,
1265,
2040,
12,
17312,
18,
588,
2040,
9334,
852,
607,
1769,
203,
202,
202,
97,
203,
9506,
203,
202,
202,
759,
13420,
17082,
203,
202,
202,
759,
4494,
3636,
316,
913,
622,
1281,
2612,
1565,
6170,
203,
202,
202,
759,
13420,
17082,
1082,
203,
202,
202,
474,
1026,
607,
31,
203,
1082,
203,
202,
202,
9610,
261,
17995,
13,
288,
203,
202,
202,
3593,
1635,
3371,
18,
20969,
39,
3575,
67,
8352,
30,
203,
1082,
202,
1969,
607,
273,
5178,
31,
203,
1082,
202,
8820,
31,
203,
202,
202,
3593,
1635,
3371,
18,
50,
28212,
67,
14232,
985,
67,
8352,
30,
203,
1082,
202,
1969,
607,
273,
453,
790,
863,
2081,
18,
1969,
607,
63,
52,
790,
863,
2081,
18,
50,
28212,
67,
2419,
900,
15533,
203,
1082,
202,
8820,
31,
203,
202,
202,
3593,
1635,
3371,
18,
3584,
5844,
67,
14232,
985,
67,
8352,
30,
203,
1082,
202,
1969,
607,
273,
453,
790,
863,
2081,
18,
1969,
607,
63,
52,
790,
863,
2081,
18,
3584,
5844,
67,
2419,
900,
15533,
203,
1082,
202,
8820,
31,
203,
202,
202,
1886,
30,
203,
1082,
202,
1969,
607,
273,
5178,
31,
203,
202,
202,
97,
203,
6862,
203,
202,
202,
759,
2315,
5960,
2040,
364,
777,
1565,
6170,
316,
13562,
1048,
306,
1969,
607,
16,
13908,
65,
203,
202,
202,
430,
261,
455,
405,
1026,
607,
13,
288,
203,
1082,
202,
13174,
682,
32,
4522,
34,
720,
607,
273,
394,
10688,
32,
4522,
34,
5621,
203,
1082,
202,
1717,
607,
18,
1289,
12,
1969,
607,
1769,
203,
1082,
202,
1884,
261,
474,
277,
455,
273,
13908,
31,
277,
455,
411,
400,
31,
277,
455,
6413,
576,
13,
288,
203,
9506,
202,
1717,
607,
18,
1289,
12,
2814,
1769,
203,
1082,
202,
97,
203,
1082,
202,
1884,
261,
4522,
277,
455,
294,
720,
607,
13,
288,
203,
9506,
202,
430,
261,
291,
21890,
13,
327,
31,
203,
9506,
202,
2725,
14836,
2040,
1265,
11098,
12,
2814,
16,
638,
1769,
203,
1082,
202,
97,
203,
202,
202,
97,
203,
1082,
203,
202,
202,
759,
13420,
17082,
203,
202,
202,
759,
4494,
3636,
316,
913,
622,
1281,
2612,
1565,
6170,
203,
202,
202,
759,
13420,
17082,
202,
203,
202,
202,
17947,
2040,
4769,
31,
203,
203,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
203,
202,
380,
7903,
4358,
1177,
434,
10567,
598,
17478,
4271,
364,
7272,
1839,
203,
202,
380,
12574,
310,
7327,
12568,
18,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
33c6fe581f9463c7b322e671bdc8c258683ad558 | iedadata/geomapapp | haxby/map/GetImageRequest.java | [
"Apache-2.0"
] | Java | updateWorkingImageFromImage | null | private void updateWorkingImageFromImage(BufferedImage image, int imageRes) {
int mapServerToXMapYShift;
switch (proj) {
case MapApp.MERCATOR_MAP:
mapServerToXMapYShift = 260 * res;
break;
case MapApp.NORTH_POLAR_MAP:
case MapApp.SOUTH_POLAR_MAP:
default:
mapServerToXMapYShift = 0;
}
if (res == imageRes) {
Graphics2D g = workingImage.createGraphics();
g.drawImage(overlay.getImage(),
((int)mapRect.getX()) - x,
((int)mapRect.getY() - mapServerToXMapYShift) - y,
null);
} else {
// otherwise scale the image from the previous view and write it
int mapScale = mapRes;
int mapX = (int)Math.floor(mapScale*rect.getX());
int mapY = (int)Math.floor(mapScale*rect.getY());
double s = (double)mapRes / res;
double dx = mapX/s - x;
double dy = mapY/s - y;
AffineTransform at = new AffineTransform();
at.translate(dx, dy);
at.scale(1./s, 1./s);
Graphics2D g = workingImage.createGraphics();
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR );
g.drawRenderedImage(overlay.getImage(), at);
}
} | /**
* Update the workingImage for this request with new content (either pulled
* from a previous view or from the map server). Takes care of coordinate
* transformations between XMap and MapServer for each projection.
* @param imageRes
*/ | Update the workingImage for this request with new content (either pulled
from a previous view or from the map server). Takes care of coordinate
transformations between XMap and MapServer for each projection.
@param imageRes | [
"Update",
"the",
"workingImage",
"for",
"this",
"request",
"with",
"new",
"content",
"(",
"either",
"pulled",
"from",
"a",
"previous",
"view",
"or",
"from",
"the",
"map",
"server",
")",
".",
"Takes",
"care",
"of",
"coordinate",
"transformations",
"between",
"XMap",
"and",
"MapServer",
"for",
"each",
"projection",
".",
"@param",
"imageRes"
] | private void updateWorkingImageFromImage(BufferedImage image, int imageRes) {
int mapServerToXMapYShift;
switch (proj) {
case MapApp.MERCATOR_MAP:
mapServerToXMapYShift = 260 * res;
break;
case MapApp.NORTH_POLAR_MAP:
case MapApp.SOUTH_POLAR_MAP:
default:
mapServerToXMapYShift = 0;
}
if (res == imageRes) {
Graphics2D g = workingImage.createGraphics();
g.drawImage(overlay.getImage(),
((int)mapRect.getX()) - x,
((int)mapRect.getY() - mapServerToXMapYShift) - y,
null);
} else {
int mapScale = mapRes;
int mapX = (int)Math.floor(mapScale*rect.getX());
int mapY = (int)Math.floor(mapScale*rect.getY());
double s = (double)mapRes / res;
double dx = mapX/s - x;
double dy = mapY/s - y;
AffineTransform at = new AffineTransform();
at.translate(dx, dy);
at.scale(1./s, 1./s);
Graphics2D g = workingImage.createGraphics();
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR );
g.drawRenderedImage(overlay.getImage(), at);
}
} | [
"private",
"void",
"updateWorkingImageFromImage",
"(",
"BufferedImage",
"image",
",",
"int",
"imageRes",
")",
"{",
"int",
"mapServerToXMapYShift",
";",
"switch",
"(",
"proj",
")",
"{",
"case",
"MapApp",
".",
"MERCATOR_MAP",
":",
"mapServerToXMapYShift",
"=",
"260",
"*",
"res",
";",
"break",
";",
"case",
"MapApp",
".",
"NORTH_POLAR_MAP",
":",
"case",
"MapApp",
".",
"SOUTH_POLAR_MAP",
":",
"default",
":",
"mapServerToXMapYShift",
"=",
"0",
";",
"}",
"if",
"(",
"res",
"==",
"imageRes",
")",
"{",
"Graphics2D",
"g",
"=",
"workingImage",
".",
"createGraphics",
"(",
")",
";",
"g",
".",
"drawImage",
"(",
"overlay",
".",
"getImage",
"(",
")",
",",
"(",
"(",
"int",
")",
"mapRect",
".",
"getX",
"(",
")",
")",
"-",
"x",
",",
"(",
"(",
"int",
")",
"mapRect",
".",
"getY",
"(",
")",
"-",
"mapServerToXMapYShift",
")",
"-",
"y",
",",
"null",
")",
";",
"}",
"else",
"{",
"int",
"mapScale",
"=",
"mapRes",
";",
"int",
"mapX",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"mapScale",
"*",
"rect",
".",
"getX",
"(",
")",
")",
";",
"int",
"mapY",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"mapScale",
"*",
"rect",
".",
"getY",
"(",
")",
")",
";",
"double",
"s",
"=",
"(",
"double",
")",
"mapRes",
"/",
"res",
";",
"double",
"dx",
"=",
"mapX",
"/",
"s",
"-",
"x",
";",
"double",
"dy",
"=",
"mapY",
"/",
"s",
"-",
"y",
";",
"AffineTransform",
"at",
"=",
"new",
"AffineTransform",
"(",
")",
";",
"at",
".",
"translate",
"(",
"dx",
",",
"dy",
")",
";",
"at",
".",
"scale",
"(",
"1.",
"/",
"s",
",",
"1.",
"/",
"s",
")",
";",
"Graphics2D",
"g",
"=",
"workingImage",
".",
"createGraphics",
"(",
")",
";",
"g",
".",
"setRenderingHint",
"(",
"RenderingHints",
".",
"KEY_INTERPOLATION",
",",
"RenderingHints",
".",
"VALUE_INTERPOLATION_BILINEAR",
")",
";",
"g",
".",
"drawRenderedImage",
"(",
"overlay",
".",
"getImage",
"(",
")",
",",
"at",
")",
";",
"}",
"}"
] | Update the workingImage for this request with new content (either pulled
from a previous view or from the map server). | [
"Update",
"the",
"workingImage",
"for",
"this",
"request",
"with",
"new",
"content",
"(",
"either",
"pulled",
"from",
"a",
"previous",
"view",
"or",
"from",
"the",
"map",
"server",
")",
"."
] | [
"// otherwise scale the image from the previous view and write it"
] | [
{
"param": "image",
"type": "BufferedImage"
},
{
"param": "imageRes",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "image",
"type": "BufferedImage",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "imageRes",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
1089,
14836,
2040,
1265,
2040,
12,
17947,
2040,
1316,
16,
509,
1316,
607,
13,
288,
203,
1082,
203,
202,
565,
509,
852,
2081,
14955,
863,
61,
10544,
31,
203,
1082,
203,
202,
202,
9610,
261,
17995,
13,
288,
203,
202,
202,
3593,
1635,
3371,
18,
20969,
39,
3575,
67,
8352,
30,
203,
1082,
202,
1458,
2081,
14955,
863,
61,
10544,
273,
576,
4848,
380,
400,
31,
203,
1082,
202,
8820,
31,
203,
202,
202,
3593,
1635,
3371,
18,
50,
28212,
67,
14232,
985,
67,
8352,
30,
203,
202,
202,
3593,
1635,
3371,
18,
3584,
5844,
67,
14232,
985,
67,
8352,
30,
203,
202,
202,
1886,
30,
203,
1082,
202,
1458,
2081,
14955,
863,
61,
10544,
273,
374,
31,
203,
202,
202,
97,
203,
1082,
203,
202,
202,
430,
261,
455,
422,
1316,
607,
13,
288,
203,
1082,
202,
17558,
22,
40,
314,
273,
5960,
2040,
18,
2640,
17558,
5621,
203,
1082,
202,
75,
18,
9446,
2040,
12,
17312,
18,
588,
2040,
9334,
7010,
25083,
202,
12443,
474,
13,
1458,
6120,
18,
588,
60,
10756,
300,
619,
16,
203,
25083,
202,
12443,
474,
13,
1458,
6120,
18,
588,
61,
1435,
300,
852,
2081,
14955,
863,
61,
10544,
13,
300,
677,
16,
203,
25083,
202,
2011,
1769,
203,
202,
202,
97,
469,
288,
203,
1082,
202,
759,
3541,
3159,
326,
1316,
628,
326,
2416,
1476,
471,
1045,
518,
203,
1082,
202,
474,
852,
5587,
273,
852,
607,
31,
203,
1082,
202,
474,
852,
60,
273,
261,
474,
13,
10477,
18,
74,
5807,
12,
1458,
5587,
14,
2607,
18,
588,
60,
10663,
203,
1082,
202,
474,
852,
61,
273,
261,
474,
13,
10477,
18,
74,
5807,
12,
1458,
5587,
14,
2607,
18,
588,
61,
10663,
203,
1082,
202,
9056,
272,
273,
261,
9056,
13,
1458,
607,
342,
400,
31,
203,
1082,
202,
9056,
6633,
273,
852,
60,
19,
87,
300,
619,
31,
203,
1082,
202,
9056,
7732,
273,
852,
61,
19,
87,
300,
677,
31,
203,
203,
1082,
202,
13785,
558,
4059,
622,
273,
394,
23906,
558,
4059,
5621,
203,
1082,
202,
270,
18,
13929,
12,
13437,
16,
7732,
1769,
203,
1082,
202,
270,
18,
5864,
12,
21,
18,
19,
87,
16,
404,
18,
19,
87,
1769,
203,
203,
1082,
202,
17558,
22,
40,
314,
273,
5960,
2040,
18,
2640,
17558,
5621,
203,
1082,
202,
75,
18,
542,
14261,
7002,
12,
14261,
13368,
18,
3297,
67,
9125,
14232,
2689,
16,
203,
6862,
9506,
282,
22391,
18,
4051,
67,
9125,
14232,
2689,
67,
38,
30690,
985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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
2315,
326,
5960,
2040,
364,
333,
590,
598,
394,
913,
261,
73,
2927,
30741,
203,
202,
380,
628,
279,
2416,
1476,
578,
628,
326,
852,
1438,
2934,
23004,
7671,
434,
7799,
203,
202,
380,
19245,
3086,
1139,
863,
471,
1635,
2081,
364,
1517,
8106,
18,
203,
202,
380,
632,
891,
1316,
607,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
33c6fe581f9463c7b322e671bdc8c258683ad558 | iedadata/geomapapp | haxby/map/GetImageRequest.java | [
"Apache-2.0"
] | Java | updateWorkingImageFromResolution | null | private void updateWorkingImageFromResolution(int ires, boolean repaint) {
BufferedImage tile;
int resA = ires;
int scaleA = ires;
int xA = (int)Math.floor(scaleA*(rect.getX() - (double)rectToTileXShift));
int yA = (int)Math.floor(scaleA*(rect.getY() - (double)rectToTileYShift));
int widthA = (int)Math.ceil(scaleA *
(rect.getX() - (double)rectToTileXShift + rect.getWidth())
) - xA;
int heightA = (int)Math.ceil(scaleA *
(rect.getY() - (double)rectToTileYShift + rect.getHeight())
) - yA;
BufferedImage imageA = new BufferedImage(widthA, heightA, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = imageA.createGraphics();
g2.setComposite(AlphaComposite.Clear);
g2.fillRect(0, 0, width, height);
int tileX0 = xA/320;
if (xA<0 && tileX0*320!=xA) tileX0--;
int tileY0 = yA/320;
if (yA<0 && tileY0*320!=yA) tileY0--;
int tileX, tileY;
int x0,y0;
int x1,x2,y1,y2;
// For each tile at resA that intersects the new view (given by rect)
for (tileX = tileX0; tileX*320<xA+widthA; tileX++) {
x0 = tileX*320;
x1 = Math.max(x0, xA);
x2 = Math.min(x0+320, xA+widthA);
for(tileY = tileY0; tileY*320<yA+heightA; tileY++) {
if (isCancelled) return;
y0 = tileY*320;
y1 = Math.max( y0, yA);
y2 = Math.min( y0+320, yA+heightA);
try {
switch (proj) {
case MapApp.MERCATOR_MAP:
tile = MMapServer.getTile(resA, tileX, tileY);
break;
case MapApp.NORTH_POLAR_MAP:
tile = PoleMapServer.getTile(resA, tileX, tileY,
PoleMapServer.NORTH_POLE);
break;
case MapApp.SOUTH_POLAR_MAP:
tile = PoleMapServer.getTile(resA, tileX, tileY,
PoleMapServer.SOUTH_POLE);
break;
default:
tile = null;
}
if (tile == null) continue;
} catch(Exception ex) {
continue;
}
for( int ix=x1; ix<x2 ; ix++) {
for( int iy=y1 ; iy<y2 ; iy++) {
imageA.setRGB(ix-xA, iy-yA,
(0xff << 24) | tile.getRGB(ix-x0 + 8, iy-y0 + 8));
}
}
// by this point, imageA has been update with data from the tile, and
// the tile definitely does exist
// so, we try to write the new tile directly onto the image as it exists
Graphics2D g = workingImage.createGraphics();
double s = (double)ires / res;
double dx = xA/s - x;
double dy = yA/s - y;
AffineTransform at = new AffineTransform();
at.translate(dx, dy);
at.scale(1./s, 1./s);
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR );
g.drawRenderedImage(imageA, at);
int x_XMap = x + rectToTileXShift * scale;
int y_XMap = y + rectToTileYShift * scale;
if (isCancelled) return;
if (repaint) {
overlay.setImage(workingImage,
x_XMap/(double)scale,
y_XMap/(double)scale,
1./(double)scale);
overlay.setRect(x_XMap, y_XMap, width, height);
overlay.setResolution(res);
if (isCancelled) return;
overlay.map.repaint();
}
// done writing and repainting
}
}
} | /**
* Upsample a lower resolution to fill in a portion of this requests working image.
* @param ires the res we are sampling from
* @param repaint whether or not to repaint the display after this update
*/ | Upsample a lower resolution to fill in a portion of this requests working image.
@param ires the res we are sampling from
@param repaint whether or not to repaint the display after this update | [
"Upsample",
"a",
"lower",
"resolution",
"to",
"fill",
"in",
"a",
"portion",
"of",
"this",
"requests",
"working",
"image",
".",
"@param",
"ires",
"the",
"res",
"we",
"are",
"sampling",
"from",
"@param",
"repaint",
"whether",
"or",
"not",
"to",
"repaint",
"the",
"display",
"after",
"this",
"update"
] | private void updateWorkingImageFromResolution(int ires, boolean repaint) {
BufferedImage tile;
int resA = ires;
int scaleA = ires;
int xA = (int)Math.floor(scaleA*(rect.getX() - (double)rectToTileXShift));
int yA = (int)Math.floor(scaleA*(rect.getY() - (double)rectToTileYShift));
int widthA = (int)Math.ceil(scaleA *
(rect.getX() - (double)rectToTileXShift + rect.getWidth())
) - xA;
int heightA = (int)Math.ceil(scaleA *
(rect.getY() - (double)rectToTileYShift + rect.getHeight())
) - yA;
BufferedImage imageA = new BufferedImage(widthA, heightA, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = imageA.createGraphics();
g2.setComposite(AlphaComposite.Clear);
g2.fillRect(0, 0, width, height);
int tileX0 = xA/320;
if (xA<0 && tileX0*320!=xA) tileX0--;
int tileY0 = yA/320;
if (yA<0 && tileY0*320!=yA) tileY0--;
int tileX, tileY;
int x0,y0;
int x1,x2,y1,y2;
for (tileX = tileX0; tileX*320<xA+widthA; tileX++) {
x0 = tileX*320;
x1 = Math.max(x0, xA);
x2 = Math.min(x0+320, xA+widthA);
for(tileY = tileY0; tileY*320<yA+heightA; tileY++) {
if (isCancelled) return;
y0 = tileY*320;
y1 = Math.max( y0, yA);
y2 = Math.min( y0+320, yA+heightA);
try {
switch (proj) {
case MapApp.MERCATOR_MAP:
tile = MMapServer.getTile(resA, tileX, tileY);
break;
case MapApp.NORTH_POLAR_MAP:
tile = PoleMapServer.getTile(resA, tileX, tileY,
PoleMapServer.NORTH_POLE);
break;
case MapApp.SOUTH_POLAR_MAP:
tile = PoleMapServer.getTile(resA, tileX, tileY,
PoleMapServer.SOUTH_POLE);
break;
default:
tile = null;
}
if (tile == null) continue;
} catch(Exception ex) {
continue;
}
for( int ix=x1; ix<x2 ; ix++) {
for( int iy=y1 ; iy<y2 ; iy++) {
imageA.setRGB(ix-xA, iy-yA,
(0xff << 24) | tile.getRGB(ix-x0 + 8, iy-y0 + 8));
}
}
Graphics2D g = workingImage.createGraphics();
double s = (double)ires / res;
double dx = xA/s - x;
double dy = yA/s - y;
AffineTransform at = new AffineTransform();
at.translate(dx, dy);
at.scale(1./s, 1./s);
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR );
g.drawRenderedImage(imageA, at);
int x_XMap = x + rectToTileXShift * scale;
int y_XMap = y + rectToTileYShift * scale;
if (isCancelled) return;
if (repaint) {
overlay.setImage(workingImage,
x_XMap/(double)scale,
y_XMap/(double)scale,
1./(double)scale);
overlay.setRect(x_XMap, y_XMap, width, height);
overlay.setResolution(res);
if (isCancelled) return;
overlay.map.repaint();
}
}
}
} | [
"private",
"void",
"updateWorkingImageFromResolution",
"(",
"int",
"ires",
",",
"boolean",
"repaint",
")",
"{",
"BufferedImage",
"tile",
";",
"int",
"resA",
"=",
"ires",
";",
"int",
"scaleA",
"=",
"ires",
";",
"int",
"xA",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"scaleA",
"*",
"(",
"rect",
".",
"getX",
"(",
")",
"-",
"(",
"double",
")",
"rectToTileXShift",
")",
")",
";",
"int",
"yA",
"=",
"(",
"int",
")",
"Math",
".",
"floor",
"(",
"scaleA",
"*",
"(",
"rect",
".",
"getY",
"(",
")",
"-",
"(",
"double",
")",
"rectToTileYShift",
")",
")",
";",
"int",
"widthA",
"=",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"scaleA",
"*",
"(",
"rect",
".",
"getX",
"(",
")",
"-",
"(",
"double",
")",
"rectToTileXShift",
"+",
"rect",
".",
"getWidth",
"(",
")",
")",
")",
"-",
"xA",
";",
"int",
"heightA",
"=",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"scaleA",
"*",
"(",
"rect",
".",
"getY",
"(",
")",
"-",
"(",
"double",
")",
"rectToTileYShift",
"+",
"rect",
".",
"getHeight",
"(",
")",
")",
")",
"-",
"yA",
";",
"BufferedImage",
"imageA",
"=",
"new",
"BufferedImage",
"(",
"widthA",
",",
"heightA",
",",
"BufferedImage",
".",
"TYPE_INT_ARGB",
")",
";",
"Graphics2D",
"g2",
"=",
"imageA",
".",
"createGraphics",
"(",
")",
";",
"g2",
".",
"setComposite",
"(",
"AlphaComposite",
".",
"Clear",
")",
";",
"g2",
".",
"fillRect",
"(",
"0",
",",
"0",
",",
"width",
",",
"height",
")",
";",
"int",
"tileX0",
"=",
"xA",
"/",
"320",
";",
"if",
"(",
"xA",
"<",
"0",
"&&",
"tileX0",
"*",
"320",
"!=",
"xA",
")",
"tileX0",
"--",
";",
"int",
"tileY0",
"=",
"yA",
"/",
"320",
";",
"if",
"(",
"yA",
"<",
"0",
"&&",
"tileY0",
"*",
"320",
"!=",
"yA",
")",
"tileY0",
"--",
";",
"int",
"tileX",
",",
"tileY",
";",
"int",
"x0",
",",
"y0",
";",
"int",
"x1",
",",
"x2",
",",
"y1",
",",
"y2",
";",
"for",
"(",
"tileX",
"=",
"tileX0",
";",
"tileX",
"*",
"320",
"<",
"xA",
"+",
"widthA",
";",
"tileX",
"++",
")",
"{",
"x0",
"=",
"tileX",
"*",
"320",
";",
"x1",
"=",
"Math",
".",
"max",
"(",
"x0",
",",
"xA",
")",
";",
"x2",
"=",
"Math",
".",
"min",
"(",
"x0",
"+",
"320",
",",
"xA",
"+",
"widthA",
")",
";",
"for",
"(",
"tileY",
"=",
"tileY0",
";",
"tileY",
"*",
"320",
"<",
"yA",
"+",
"heightA",
";",
"tileY",
"++",
")",
"{",
"if",
"(",
"isCancelled",
")",
"return",
";",
"y0",
"=",
"tileY",
"*",
"320",
";",
"y1",
"=",
"Math",
".",
"max",
"(",
"y0",
",",
"yA",
")",
";",
"y2",
"=",
"Math",
".",
"min",
"(",
"y0",
"+",
"320",
",",
"yA",
"+",
"heightA",
")",
";",
"try",
"{",
"switch",
"(",
"proj",
")",
"{",
"case",
"MapApp",
".",
"MERCATOR_MAP",
":",
"tile",
"=",
"MMapServer",
".",
"getTile",
"(",
"resA",
",",
"tileX",
",",
"tileY",
")",
";",
"break",
";",
"case",
"MapApp",
".",
"NORTH_POLAR_MAP",
":",
"tile",
"=",
"PoleMapServer",
".",
"getTile",
"(",
"resA",
",",
"tileX",
",",
"tileY",
",",
"PoleMapServer",
".",
"NORTH_POLE",
")",
";",
"break",
";",
"case",
"MapApp",
".",
"SOUTH_POLAR_MAP",
":",
"tile",
"=",
"PoleMapServer",
".",
"getTile",
"(",
"resA",
",",
"tileX",
",",
"tileY",
",",
"PoleMapServer",
".",
"SOUTH_POLE",
")",
";",
"break",
";",
"default",
":",
"tile",
"=",
"null",
";",
"}",
"if",
"(",
"tile",
"==",
"null",
")",
"continue",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"continue",
";",
"}",
"for",
"(",
"int",
"ix",
"=",
"x1",
";",
"ix",
"<",
"x2",
";",
"ix",
"++",
")",
"{",
"for",
"(",
"int",
"iy",
"=",
"y1",
";",
"iy",
"<",
"y2",
";",
"iy",
"++",
")",
"{",
"imageA",
".",
"setRGB",
"(",
"ix",
"-",
"xA",
",",
"iy",
"-",
"yA",
",",
"(",
"0xff",
"<<",
"24",
")",
"|",
"tile",
".",
"getRGB",
"(",
"ix",
"-",
"x0",
"+",
"8",
",",
"iy",
"-",
"y0",
"+",
"8",
")",
")",
";",
"}",
"}",
"Graphics2D",
"g",
"=",
"workingImage",
".",
"createGraphics",
"(",
")",
";",
"double",
"s",
"=",
"(",
"double",
")",
"ires",
"/",
"res",
";",
"double",
"dx",
"=",
"xA",
"/",
"s",
"-",
"x",
";",
"double",
"dy",
"=",
"yA",
"/",
"s",
"-",
"y",
";",
"AffineTransform",
"at",
"=",
"new",
"AffineTransform",
"(",
")",
";",
"at",
".",
"translate",
"(",
"dx",
",",
"dy",
")",
";",
"at",
".",
"scale",
"(",
"1.",
"/",
"s",
",",
"1.",
"/",
"s",
")",
";",
"g",
".",
"setRenderingHint",
"(",
"RenderingHints",
".",
"KEY_INTERPOLATION",
",",
"RenderingHints",
".",
"VALUE_INTERPOLATION_BILINEAR",
")",
";",
"g",
".",
"drawRenderedImage",
"(",
"imageA",
",",
"at",
")",
";",
"int",
"x_XMap",
"=",
"x",
"+",
"rectToTileXShift",
"*",
"scale",
";",
"int",
"y_XMap",
"=",
"y",
"+",
"rectToTileYShift",
"*",
"scale",
";",
"if",
"(",
"isCancelled",
")",
"return",
";",
"if",
"(",
"repaint",
")",
"{",
"overlay",
".",
"setImage",
"(",
"workingImage",
",",
"x_XMap",
"/",
"(",
"double",
")",
"scale",
",",
"y_XMap",
"/",
"(",
"double",
")",
"scale",
",",
"1.",
"/",
"(",
"double",
")",
"scale",
")",
";",
"overlay",
".",
"setRect",
"(",
"x_XMap",
",",
"y_XMap",
",",
"width",
",",
"height",
")",
";",
"overlay",
".",
"setResolution",
"(",
"res",
")",
";",
"if",
"(",
"isCancelled",
")",
"return",
";",
"overlay",
".",
"map",
".",
"repaint",
"(",
")",
";",
"}",
"}",
"}",
"}"
] | Upsample a lower resolution to fill in a portion of this requests working image. | [
"Upsample",
"a",
"lower",
"resolution",
"to",
"fill",
"in",
"a",
"portion",
"of",
"this",
"requests",
"working",
"image",
"."
] | [
"// For each tile at resA that intersects the new view (given by rect)",
"// by this point, imageA has been update with data from the tile, and",
"// the tile definitely does exist",
"// so, we try to write the new tile directly onto the image as it exists",
"// done writing and repainting"
] | [
{
"param": "ires",
"type": "int"
},
{
"param": "repaint",
"type": "boolean"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ires",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "repaint",
"type": "boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
1089,
14836,
2040,
1265,
11098,
12,
474,
277,
455,
16,
1250,
24962,
13,
288,
203,
202,
202,
17947,
2040,
4769,
31,
203,
1082,
203,
202,
202,
474,
400,
37,
273,
277,
455,
31,
203,
202,
202,
474,
3159,
37,
273,
277,
455,
31,
203,
202,
202,
474,
619,
37,
273,
261,
474,
13,
10477,
18,
74,
5807,
12,
5864,
37,
21556,
2607,
18,
588,
60,
1435,
300,
261,
9056,
13,
2607,
774,
9337,
60,
10544,
10019,
203,
202,
202,
474,
677,
37,
273,
261,
474,
13,
10477,
18,
74,
5807,
12,
5864,
37,
21556,
2607,
18,
588,
61,
1435,
300,
261,
9056,
13,
2607,
774,
9337,
61,
10544,
10019,
203,
202,
202,
474,
1835,
37,
273,
261,
474,
13,
10477,
18,
311,
330,
12,
5864,
37,
380,
7010,
25083,
202,
12,
2607,
18,
588,
60,
1435,
300,
261,
9056,
13,
2607,
774,
9337,
60,
10544,
202,
15,
4917,
18,
588,
2384,
10756,
203,
6862,
6862,
202,
13,
300,
619,
37,
31,
203,
202,
202,
474,
2072,
37,
273,
261,
474,
13,
10477,
18,
311,
330,
12,
5864,
37,
380,
203,
25083,
202,
12,
2607,
18,
588,
61,
1435,
300,
261,
9056,
13,
2607,
774,
9337,
61,
10544,
202,
15,
4917,
18,
588,
2686,
10756,
203,
6862,
6862,
202,
13,
300,
677,
37,
31,
203,
203,
202,
202,
17947,
2040,
1316,
37,
273,
394,
12362,
12,
2819,
37,
16,
2072,
37,
16,
12362,
18,
2399,
67,
3217,
67,
985,
5887,
1769,
203,
202,
202,
17558,
22,
40,
314,
22,
273,
1316,
37,
18,
2640,
17558,
5621,
203,
202,
202,
75,
22,
18,
542,
9400,
12,
9690,
9400,
18,
9094,
1769,
203,
202,
202,
75,
22,
18,
5935,
6120,
12,
20,
16,
374,
16,
1835,
16,
2072,
1769,
203,
203,
202,
202,
474,
4769,
60,
20,
273,
619,
37,
19,
31273,
31,
203,
202,
202,
430,
261,
21703,
32,
20,
597,
4769,
60,
20,
14,
31273,
5,
33,
21703,
13,
4769,
60,
20,
413,
31,
203,
202,
202,
474,
4769,
61,
20,
273,
677,
37,
19,
31273,
31,
203,
202,
202,
430,
261,
93,
37,
32,
20,
597,
4769,
61,
20,
14,
31273,
5,
33,
93,
37,
13,
4769,
61,
20,
413,
31,
203,
202,
202,
474,
4769,
60,
16,
4769,
61,
31,
203,
202,
202,
474,
619,
20,
16,
93,
20,
31,
203,
202,
202,
474,
619,
21,
16,
92,
22,
16,
93,
21,
16,
93,
22,
31,
203,
1082,
203,
202,
202,
759,
2457,
1517,
4769,
622,
400,
37,
716,
19791,
326,
394,
1476,
261,
10822,
635,
4917,
13,
203,
202,
202,
1884,
261,
15368,
60,
273,
4769,
60,
20,
31,
4769,
60,
14,
31273,
32,
21703,
15,
2819,
37,
31,
4769,
60,
27245,
288,
203,
1082,
202,
92,
20,
273,
4769,
60,
14,
31273,
31,
203,
1082,
202,
92,
21,
273,
2361,
18,
1896,
12,
92,
20,
16,
619,
37,
1769,
203,
1082,
202,
92,
22,
273,
2361,
18,
1154,
12,
92,
20,
15,
31273,
16,
619,
37,
15,
2819,
37,
1769,
203,
1082,
202,
1884,
12,
15368,
61,
273,
4769,
61,
20,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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587,
1121,
1511,
279,
2612,
7861,
358,
3636,
316,
279,
14769,
434,
333,
3285,
5960,
1316,
18,
203,
202,
380,
632,
891,
277,
455,
326,
400,
732,
854,
11558,
628,
203,
202,
380,
632,
891,
24962,
2856,
578,
486,
358,
24962,
326,
2562,
1839,
333,
1089,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
234189a714d0aca1545fb9e5cba37c6e5d7a9742 | iedadata/geomapapp | haxby/db/custom/DataSetGraph.java | [
"Apache-2.0"
] | Java | parseRGB | null | public void parseRGB(int item){
String rgbString = ds.rowData.get(ds.tm.displayToDataIndex.get(item)).get(ds.rgbIndex).toString();
try {
if (rgbString.indexOf(",") != -1) {
String[] split = rgbString.split(",");
if (split.length == 3) {
float[] rgbF = new float[3];
for (int j = 0; j < 3; j++)
rgbF[j] = Float.parseFloat(split[j]);
// Floats from 0-1
rgbValue = new int[3];
if (rgbF[0] <= 1 && rgbF[1] <= 1 && rgbF[2] <=1) {
for (int j = 0; j < 3; j++)
rgbValue[j] = (int) (rgbF[j] * 255);
}else {
for (int j = 0; j < 3; j++)
rgbValue[j] = (int) rgbF[j];
}
// Clamp to 0-255 range
for (int j = 0; j < 3; j++){
rgbValue[j] = Math.max(rgbValue[j], 0);
rgbValue[j] = Math.min(rgbValue[j], 255);
}
}
return;
}
}catch (NumberFormatException ex) {
rgbString = null;
}
} | // parse rgb column into rgbValue array
| parse rgb column into rgbValue array | [
"parse",
"rgb",
"column",
"into",
"rgbValue",
"array"
] | public void parseRGB(int item){
String rgbString = ds.rowData.get(ds.tm.displayToDataIndex.get(item)).get(ds.rgbIndex).toString();
try {
if (rgbString.indexOf(",") != -1) {
String[] split = rgbString.split(",");
if (split.length == 3) {
float[] rgbF = new float[3];
for (int j = 0; j < 3; j++)
rgbF[j] = Float.parseFloat(split[j]);
rgbValue = new int[3];
if (rgbF[0] <= 1 && rgbF[1] <= 1 && rgbF[2] <=1) {
for (int j = 0; j < 3; j++)
rgbValue[j] = (int) (rgbF[j] * 255);
}else {
for (int j = 0; j < 3; j++)
rgbValue[j] = (int) rgbF[j];
}
for (int j = 0; j < 3; j++){
rgbValue[j] = Math.max(rgbValue[j], 0);
rgbValue[j] = Math.min(rgbValue[j], 255);
}
}
return;
}
}catch (NumberFormatException ex) {
rgbString = null;
}
} | [
"public",
"void",
"parseRGB",
"(",
"int",
"item",
")",
"{",
"String",
"rgbString",
"=",
"ds",
".",
"rowData",
".",
"get",
"(",
"ds",
".",
"tm",
".",
"displayToDataIndex",
".",
"get",
"(",
"item",
")",
")",
".",
"get",
"(",
"ds",
".",
"rgbIndex",
")",
".",
"toString",
"(",
")",
";",
"try",
"{",
"if",
"(",
"rgbString",
".",
"indexOf",
"(",
"\",\"",
")",
"!=",
"-",
"1",
")",
"{",
"String",
"[",
"]",
"split",
"=",
"rgbString",
".",
"split",
"(",
"\",\"",
")",
";",
"if",
"(",
"split",
".",
"length",
"==",
"3",
")",
"{",
"float",
"[",
"]",
"rgbF",
"=",
"new",
"float",
"[",
"3",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"3",
";",
"j",
"++",
")",
"rgbF",
"[",
"j",
"]",
"=",
"Float",
".",
"parseFloat",
"(",
"split",
"[",
"j",
"]",
")",
";",
"rgbValue",
"=",
"new",
"int",
"[",
"3",
"]",
";",
"if",
"(",
"rgbF",
"[",
"0",
"]",
"<=",
"1",
"&&",
"rgbF",
"[",
"1",
"]",
"<=",
"1",
"&&",
"rgbF",
"[",
"2",
"]",
"<=",
"1",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"3",
";",
"j",
"++",
")",
"rgbValue",
"[",
"j",
"]",
"=",
"(",
"int",
")",
"(",
"rgbF",
"[",
"j",
"]",
"*",
"255",
")",
";",
"}",
"else",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"3",
";",
"j",
"++",
")",
"rgbValue",
"[",
"j",
"]",
"=",
"(",
"int",
")",
"rgbF",
"[",
"j",
"]",
";",
"}",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"3",
";",
"j",
"++",
")",
"{",
"rgbValue",
"[",
"j",
"]",
"=",
"Math",
".",
"max",
"(",
"rgbValue",
"[",
"j",
"]",
",",
"0",
")",
";",
"rgbValue",
"[",
"j",
"]",
"=",
"Math",
".",
"min",
"(",
"rgbValue",
"[",
"j",
"]",
",",
"255",
")",
";",
"}",
"}",
"return",
";",
"}",
"}",
"catch",
"(",
"NumberFormatException",
"ex",
")",
"{",
"rgbString",
"=",
"null",
";",
"}",
"}"
] | parse rgb column into rgbValue array | [
"parse",
"rgb",
"column",
"into",
"rgbValue",
"array"
] | [
"// Floats from 0-1\r",
"// Clamp to 0-255 range\r"
] | [
{
"param": "item",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "item",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
1109,
11343,
12,
474,
761,
15329,
206,
203,
202,
202,
780,
6917,
780,
273,
3780,
18,
492,
751,
18,
588,
12,
2377,
18,
16925,
18,
5417,
774,
751,
1016,
18,
588,
12,
1726,
13,
2934,
588,
12,
2377,
18,
10948,
1016,
2934,
10492,
5621,
206,
203,
202,
202,
698,
288,
206,
203,
202,
202,
430,
261,
10948,
780,
18,
31806,
2932,
16,
7923,
480,
300,
21,
13,
288,
206,
203,
1082,
202,
780,
8526,
1416,
273,
6917,
780,
18,
4939,
2932,
16,
8863,
206,
203,
1082,
202,
430,
261,
4939,
18,
2469,
422,
890,
13,
288,
206,
203,
9506,
202,
5659,
8526,
6917,
42,
273,
394,
1431,
63,
23,
15533,
206,
203,
9506,
202,
1884,
261,
474,
525,
273,
374,
31,
525,
411,
890,
31,
525,
27245,
206,
203,
6862,
202,
10948,
42,
63,
78,
65,
273,
5450,
18,
2670,
4723,
12,
4939,
63,
78,
19226,
206,
203,
206,
203,
9506,
202,
759,
5450,
87,
628,
374,
17,
21,
206,
203,
9506,
202,
10948,
620,
273,
394,
509,
63,
23,
15533,
206,
203,
9506,
202,
430,
261,
10948,
42,
63,
20,
65,
1648,
404,
597,
6917,
42,
63,
21,
65,
1648,
404,
597,
6917,
42,
63,
22,
65,
1648,
21,
13,
288,
206,
203,
6862,
202,
1884,
261,
474,
525,
273,
374,
31,
525,
411,
890,
31,
525,
27245,
206,
203,
25083,
202,
10948,
620,
63,
78,
65,
273,
261,
474,
13,
261,
10948,
42,
63,
78,
65,
380,
4561,
1769,
206,
203,
9506,
202,
97,
12107,
288,
206,
203,
6862,
202,
1884,
261,
474,
525,
273,
374,
31,
525,
411,
890,
31,
525,
27245,
206,
203,
25083,
202,
10948,
620,
63,
78,
65,
273,
261,
474,
13,
6917,
42,
63,
78,
15533,
206,
203,
9506,
202,
97,
206,
203,
9506,
202,
759,
3905,
931,
358,
374,
17,
10395,
1048,
206,
203,
9506,
202,
1884,
261,
474,
525,
273,
374,
31,
525,
411,
890,
31,
525,
27245,
95,
206,
203,
6862,
202,
10948,
620,
63,
78,
65,
273,
2361,
18,
1896,
12,
10948,
620,
63,
78,
6487,
374,
1769,
206,
203,
6862,
202,
10948,
620,
63,
78,
65,
273,
2361,
18,
1154,
12,
10948,
620,
63,
78,
6487,
4561,
1769,
206,
203,
9506,
202,
97,
206,
203,
1082,
202,
97,
206,
203,
1082,
202,
2463,
31,
206,
203,
202,
202,
97,
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
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
234189a714d0aca1545fb9e5cba37c6e5d7a9742 | iedadata/geomapapp | haxby/db/custom/DataSetGraph.java | [
"Apache-2.0"
] | Java | selectLasso | null | void selectLasso(XYGraph xyg) {
GeneralPath path = new GeneralPath();
for (int i=0; i<poly.npoints; i++){
Point2D p2 = new Point2D.Float (poly.xpoints[i], poly.ypoints[i]);
Point2D point = new Point2D.Double (xyg.getXAt(p2), xyg.getYAt(p2));
if (i==0) path.moveTo((float)point.getX(), (float) point.getY());
else path.lineTo((float)point.getX(), (float) point.getY());
}
path.closePath();
Rectangle2D r = path.getBounds();
ds.dataT.getSelectionModel().setValueIsAdjusting(true);
if (scatter) {
int n = 0;
while (n<x.length&&(Float.isNaN(x[n])||Float.isNaN(y[n]))) {
n++;
}
if (n>=x.length) return;
for (int i = n; i < x.length; i++) {
if (Float.isNaN(x[i])||Float.isNaN(y[i])) continue;
if (r.contains(x[i], y[i]) && path.contains(x[i], y[i])) {
ds.dataT.getSelectionModel().addSelectionInterval(i, i);
}
}
}
unDrawLasso(xyg);
// selectionChangedRedraw(ds.selected);
ds.dataT.getSelectionModel().setValueIsAdjusting(false);
if (ds.dataT.getSelectedRow() != -1)
ds.dataT.ensureIndexIsVisible(ds.dataT.getSelectedRow());
} | /**
Selects the area represented by poly
*/ | Selects the area represented by poly | [
"Selects",
"the",
"area",
"represented",
"by",
"poly"
] | void selectLasso(XYGraph xyg) {
GeneralPath path = new GeneralPath();
for (int i=0; i<poly.npoints; i++){
Point2D p2 = new Point2D.Float (poly.xpoints[i], poly.ypoints[i]);
Point2D point = new Point2D.Double (xyg.getXAt(p2), xyg.getYAt(p2));
if (i==0) path.moveTo((float)point.getX(), (float) point.getY());
else path.lineTo((float)point.getX(), (float) point.getY());
}
path.closePath();
Rectangle2D r = path.getBounds();
ds.dataT.getSelectionModel().setValueIsAdjusting(true);
if (scatter) {
int n = 0;
while (n<x.length&&(Float.isNaN(x[n])||Float.isNaN(y[n]))) {
n++;
}
if (n>=x.length) return;
for (int i = n; i < x.length; i++) {
if (Float.isNaN(x[i])||Float.isNaN(y[i])) continue;
if (r.contains(x[i], y[i]) && path.contains(x[i], y[i])) {
ds.dataT.getSelectionModel().addSelectionInterval(i, i);
}
}
}
unDrawLasso(xyg);
ds.dataT.getSelectionModel().setValueIsAdjusting(false);
if (ds.dataT.getSelectedRow() != -1)
ds.dataT.ensureIndexIsVisible(ds.dataT.getSelectedRow());
} | [
"void",
"selectLasso",
"(",
"XYGraph",
"xyg",
")",
"{",
"GeneralPath",
"path",
"=",
"new",
"GeneralPath",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"poly",
".",
"npoints",
";",
"i",
"++",
")",
"{",
"Point2D",
"p2",
"=",
"new",
"Point2D",
".",
"Float",
"(",
"poly",
".",
"xpoints",
"[",
"i",
"]",
",",
"poly",
".",
"ypoints",
"[",
"i",
"]",
")",
";",
"Point2D",
"point",
"=",
"new",
"Point2D",
".",
"Double",
"(",
"xyg",
".",
"getXAt",
"(",
"p2",
")",
",",
"xyg",
".",
"getYAt",
"(",
"p2",
")",
")",
";",
"if",
"(",
"i",
"==",
"0",
")",
"path",
".",
"moveTo",
"(",
"(",
"float",
")",
"point",
".",
"getX",
"(",
")",
",",
"(",
"float",
")",
"point",
".",
"getY",
"(",
")",
")",
";",
"else",
"path",
".",
"lineTo",
"(",
"(",
"float",
")",
"point",
".",
"getX",
"(",
")",
",",
"(",
"float",
")",
"point",
".",
"getY",
"(",
")",
")",
";",
"}",
"path",
".",
"closePath",
"(",
")",
";",
"Rectangle2D",
"r",
"=",
"path",
".",
"getBounds",
"(",
")",
";",
"ds",
".",
"dataT",
".",
"getSelectionModel",
"(",
")",
".",
"setValueIsAdjusting",
"(",
"true",
")",
";",
"if",
"(",
"scatter",
")",
"{",
"int",
"n",
"=",
"0",
";",
"while",
"(",
"n",
"<",
"x",
".",
"length",
"&&",
"(",
"Float",
".",
"isNaN",
"(",
"x",
"[",
"n",
"]",
")",
"||",
"Float",
".",
"isNaN",
"(",
"y",
"[",
"n",
"]",
")",
")",
")",
"{",
"n",
"++",
";",
"}",
"if",
"(",
"n",
">=",
"x",
".",
"length",
")",
"return",
";",
"for",
"(",
"int",
"i",
"=",
"n",
";",
"i",
"<",
"x",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Float",
".",
"isNaN",
"(",
"x",
"[",
"i",
"]",
")",
"||",
"Float",
".",
"isNaN",
"(",
"y",
"[",
"i",
"]",
")",
")",
"continue",
";",
"if",
"(",
"r",
".",
"contains",
"(",
"x",
"[",
"i",
"]",
",",
"y",
"[",
"i",
"]",
")",
"&&",
"path",
".",
"contains",
"(",
"x",
"[",
"i",
"]",
",",
"y",
"[",
"i",
"]",
")",
")",
"{",
"ds",
".",
"dataT",
".",
"getSelectionModel",
"(",
")",
".",
"addSelectionInterval",
"(",
"i",
",",
"i",
")",
";",
"}",
"}",
"}",
"unDrawLasso",
"(",
"xyg",
")",
";",
"ds",
".",
"dataT",
".",
"getSelectionModel",
"(",
")",
".",
"setValueIsAdjusting",
"(",
"false",
")",
";",
"if",
"(",
"ds",
".",
"dataT",
".",
"getSelectedRow",
"(",
")",
"!=",
"-",
"1",
")",
"ds",
".",
"dataT",
".",
"ensureIndexIsVisible",
"(",
"ds",
".",
"dataT",
".",
"getSelectedRow",
"(",
")",
")",
";",
"}"
] | Selects the area represented by poly | [
"Selects",
"the",
"area",
"represented",
"by",
"poly"
] | [
"//\t\tselectionChangedRedraw(ds.selected);\r"
] | [
{
"param": "xyg",
"type": "XYGraph"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "xyg",
"type": "XYGraph",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
918,
2027,
48,
428,
83,
12,
8546,
4137,
619,
4338,
13,
288,
206,
203,
202,
202,
12580,
743,
589,
273,
394,
9544,
743,
5621,
206,
203,
206,
203,
202,
202,
1884,
261,
474,
277,
33,
20,
31,
277,
32,
16353,
18,
82,
4139,
31,
277,
27245,
95,
206,
203,
1082,
202,
2148,
22,
40,
293,
22,
273,
394,
4686,
22,
40,
18,
4723,
261,
16353,
18,
92,
4139,
63,
77,
6487,
7573,
18,
879,
763,
87,
63,
77,
19226,
206,
203,
1082,
202,
2148,
22,
40,
1634,
273,
394,
4686,
22,
40,
18,
5265,
261,
1698,
75,
18,
588,
60,
861,
12,
84,
22,
3631,
619,
4338,
18,
588,
61,
861,
12,
84,
22,
10019,
206,
203,
1082,
202,
430,
261,
77,
631,
20,
13,
589,
18,
8501,
774,
12443,
5659,
13,
1153,
18,
588,
60,
9334,
261,
5659,
13,
1634,
18,
588,
61,
10663,
206,
203,
1082,
202,
12107,
589,
18,
1369,
774,
12443,
5659,
13,
1153,
18,
588,
60,
9334,
261,
5659,
13,
1634,
18,
588,
61,
10663,
206,
203,
202,
202,
97,
206,
203,
202,
202,
803,
18,
4412,
743,
5621,
206,
203,
202,
202,
19463,
22,
40,
436,
273,
589,
18,
588,
5694,
5621,
206,
203,
206,
203,
202,
202,
2377,
18,
892,
56,
18,
588,
6233,
1488,
7675,
542,
620,
2520,
10952,
310,
12,
3767,
1769,
206,
203,
202,
202,
430,
261,
31320,
13,
288,
206,
203,
1082,
202,
474,
290,
273,
374,
31,
206,
203,
1082,
202,
17523,
261,
82,
32,
92,
18,
2469,
10,
10,
12,
4723,
18,
291,
21172,
12,
92,
63,
82,
5717,
20081,
4723,
18,
291,
21172,
12,
93,
63,
82,
65,
20349,
288,
206,
203,
9506,
202,
82,
9904,
31,
206,
203,
1082,
202,
97,
206,
203,
1082,
202,
430,
261,
82,
34,
33,
92,
18,
2469,
13,
327,
31,
206,
203,
1082,
202,
1884,
261,
474,
277,
273,
290,
31,
277,
411,
619,
18,
2469,
31,
277,
27245,
288,
206,
203,
9506,
202,
430,
261,
4723,
18,
291,
21172,
12,
92,
63,
77,
5717,
20081,
4723,
18,
291,
21172,
12,
93,
63,
77,
22643,
1324,
31,
206,
203,
9506,
202,
430,
261,
86,
18,
12298,
12,
92,
63,
77,
6487,
677,
63,
77,
5717,
597,
589,
18,
12298,
12,
92,
63,
77,
6487,
677,
63,
77,
22643,
288,
206,
203,
6862,
202,
2377,
18,
892,
56,
18,
588,
6233,
1488,
7675,
1289,
6233,
4006,
12,
77,
16,
277,
1769,
206,
203,
9506,
202,
97,
206,
203,
1082,
202,
97,
206,
203,
202,
202,
97,
206,
203,
206,
203,
202,
202,
318,
6493,
48,
428,
83,
12,
1698,
75,
1769,
206,
203,
759,
202,
202,
10705,
5033,
3715,
1899,
12,
2377,
18,
8109,
1769,
206,
203,
206,
203,
202,
202,
2377,
18,
892,
56,
18,
588,
6233,
1488,
7675,
542,
620,
2520,
10952,
310,
12,
5743,
1769,
206,
203,
206,
203,
202,
202,
430,
261,
2377,
18,
892,
56,
18,
588,
7416,
1999,
1435,
480,
300,
21,
13,
206,
203,
1082,
202,
2377,
18,
892,
56,
18,
15735,
1016,
2520,
6207,
12,
2377,
18,
892,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,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1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
26873,
206,
203,
202,
202,
24093,
326,
5091,
10584,
635,
7573,
206,
203,
202,
5549,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
234189a714d0aca1545fb9e5cba37c6e5d7a9742 | iedadata/geomapapp | haxby/db/custom/DataSetGraph.java | [
"Apache-2.0"
] | Java | initDrag | null | public boolean initDrag(Point p, XYGraph xyg) {
if (!scatter) return false;
testForSide(p, xyg);
if (side==0)return false;
drawLine(xyg);
if (side<0) lastV=(float)xyg.getXAt(p);
else lastV=(float)xyg.getYAt(p);
drawLine(xyg);
return true;
} | /**
initDrag returns true if a drag has been started, false otherwise
*/ | initDrag returns true if a drag has been started, false otherwise | [
"initDrag",
"returns",
"true",
"if",
"a",
"drag",
"has",
"been",
"started",
"false",
"otherwise"
] | public boolean initDrag(Point p, XYGraph xyg) {
if (!scatter) return false;
testForSide(p, xyg);
if (side==0)return false;
drawLine(xyg);
if (side<0) lastV=(float)xyg.getXAt(p);
else lastV=(float)xyg.getYAt(p);
drawLine(xyg);
return true;
} | [
"public",
"boolean",
"initDrag",
"(",
"Point",
"p",
",",
"XYGraph",
"xyg",
")",
"{",
"if",
"(",
"!",
"scatter",
")",
"return",
"false",
";",
"testForSide",
"(",
"p",
",",
"xyg",
")",
";",
"if",
"(",
"side",
"==",
"0",
")",
"return",
"false",
";",
"drawLine",
"(",
"xyg",
")",
";",
"if",
"(",
"side",
"<",
"0",
")",
"lastV",
"=",
"(",
"float",
")",
"xyg",
".",
"getXAt",
"(",
"p",
")",
";",
"else",
"lastV",
"=",
"(",
"float",
")",
"xyg",
".",
"getYAt",
"(",
"p",
")",
";",
"drawLine",
"(",
"xyg",
")",
";",
"return",
"true",
";",
"}"
] | initDrag returns true if a drag has been started, false otherwise | [
"initDrag",
"returns",
"true",
"if",
"a",
"drag",
"has",
"been",
"started",
"false",
"otherwise"
] | [] | [
{
"param": "p",
"type": "Point"
},
{
"param": "xyg",
"type": "XYGraph"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "p",
"type": "Point",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "xyg",
"type": "XYGraph",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
1250,
1208,
11728,
12,
2148,
293,
16,
18774,
4137,
619,
4338,
13,
288,
206,
203,
202,
202,
430,
16051,
31320,
13,
327,
629,
31,
206,
203,
202,
202,
3813,
1290,
8895,
12,
84,
16,
619,
4338,
1769,
206,
203,
202,
202,
430,
261,
5564,
631,
20,
13,
2463,
629,
31,
206,
203,
202,
202,
9446,
1670,
12,
1698,
75,
1769,
206,
203,
202,
202,
430,
261,
5564,
32,
20,
13,
1142,
58,
28657,
5659,
13,
1698,
75,
18,
588,
60,
861,
12,
84,
1769,
206,
203,
202,
202,
12107,
1142,
58,
28657,
5659,
13,
1698,
75,
18,
588,
61,
861,
12,
84,
1769,
206,
203,
202,
202,
9446,
1670,
12,
1698,
75,
1769,
206,
203,
202,
202,
2463,
638,
31,
206,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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
638,
309,
279,
8823,
711,
2118,
5746,
16,
629,
3541,
206,
203,
202,
5549,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
197be1ad0a5f4cf26c056b813369e30336c4b2bb | iedadata/geomapapp | haxby/db/mgg/MGGDataDisplay.java | [
"Apache-2.0"
] | Java | showInfo | null | void showInfo() {
if (cruiseL.getSelectedValue() == null) return;
String leg = cruiseL.getSelectedValue().replace(" (header only)", "");
try {
BufferedReader in;
java.net.URL headerFileURL = null;
JTextArea text = new JTextArea();
// First check if there is an imported header file stored in mgg_header_files
// on the user's computer
File MGG_h77_file = new File (MGG.MGG_header_dir, leg + ".h77");
File MGG_h77t_file = new File (MGG.MGG_header_dir, leg + ".h77t");
if ( MGG_h77t_file.exists() || MGG_h77_file.exists()) {
File h77File = MGG_h77t_file.exists() ? MGG_h77t_file : MGG_h77_file;
in = new BufferedReader(new InputStreamReader( new FileInputStream(h77File)));
// check if this file has M77T formatting
// by convention, we can tell this is the second field in the first line is
// "FORMAT_77" or "MGD77T"
String[] firstLine = in.readLine().split("\t");
in.close();
in = new BufferedReader(new InputStreamReader( new FileInputStream(h77File)));
if (firstLine.length > 1 &&
(firstLine[1].equals("FORMAT_77") || firstLine[1].equals("MGD77T"))) {
// if the header file is h77t, then format the output in rows of fields
readAsH77T(text, in);
} else readAsH77(text, in);
}
// if not an imported file, then look for header file on the server
else {
boolean isH77T = false;
if ( tracks.mggSel.loadedControlFiles.compareTo( "LDEO" ) == 0 ) {
headerFileURL = haxby.util.URLFactory.url(MGD77_PATH + MGGSelector.LAMONT_CONTROL_LOADED.toLowerCase() + "-mgd77/header/" + leg + ".hldeo");
}
else if ( tracks.mggSel.loadedControlFiles.compareTo( "NGDC" ) == 0 ) {
headerFileURL = haxby.util.URLFactory.url( MGD77_PATH + MGGSelector.NGDC_CONTROL_LOADED.toLowerCase() + "-mgd77/header/" + leg + ".h77");
}
else if ( tracks.mggSel.loadedControlFiles.compareTo( "ADGRAV" ) == 0 ) {
headerFileURL = haxby.util.URLFactory.url( MGD77_PATH + MGGSelector.ADGRAV_CONTROL_LOADED.toLowerCase() + "-mgd77/header/" + leg + ".h77");
}
else if ( tracks.mggSel.loadedControlFiles.compareTo( "SIOExplorer" ) == 0 ) {
headerFileURL = haxby.util.URLFactory.url( MGD77_PATH + MGGSelector.SIOEXPLORER_LOADED.toLowerCase() + "-mgd77/header/" + leg + ".info");
}
else if ( tracks.mggSel.loadedControlFiles.compareTo( "USAP" ) == 0 ) {
headerFileURL = haxby.util.URLFactory.url( MGD77_PATH + MGGSelector.USAP_LOADED.toLowerCase() + "-mgd77/header/" + leg + ".info");
}
//look for h77 file, if not found, see if there is a h77t file
if (!URLFactory.checkWorkingURL(headerFileURL)) {
String h77tFile = headerFileURL.toString().replaceAll(".h77", ".h77t");
headerFileURL = URLFactory.url(h77tFile);
isH77T = URLFactory.checkWorkingURL(headerFileURL);
}
in = new BufferedReader(new InputStreamReader( headerFileURL.openStream() ));
if (isH77T)
readAsH77T(text, in);
else
readAsH77(text, in);
}
JPanel p = new JPanel( new BorderLayout() );
text.setCaretPosition(0);
p.add( new JScrollPane(text) );
p.setPreferredSize( new Dimension(600, 400) );
JOptionPane.showMessageDialog( map.getTopLevelAncestor(),
p, "cruise: "+leg, JOptionPane.INFORMATION_MESSAGE);
} catch(Exception e) {
JOptionPane.showMessageDialog( map.getTopLevelAncestor(),
"No header information provided for " + leg, "No Header Information", JOptionPane.INFORMATION_MESSAGE);
}
} | // Info Button from the header file | Info Button from the header file | [
"Info",
"Button",
"from",
"the",
"header",
"file"
] | void showInfo() {
if (cruiseL.getSelectedValue() == null) return;
String leg = cruiseL.getSelectedValue().replace(" (header only)", "");
try {
BufferedReader in;
java.net.URL headerFileURL = null;
JTextArea text = new JTextArea();
File MGG_h77_file = new File (MGG.MGG_header_dir, leg + ".h77");
File MGG_h77t_file = new File (MGG.MGG_header_dir, leg + ".h77t");
if ( MGG_h77t_file.exists() || MGG_h77_file.exists()) {
File h77File = MGG_h77t_file.exists() ? MGG_h77t_file : MGG_h77_file;
in = new BufferedReader(new InputStreamReader( new FileInputStream(h77File)));
String[] firstLine = in.readLine().split("\t");
in.close();
in = new BufferedReader(new InputStreamReader( new FileInputStream(h77File)));
if (firstLine.length > 1 &&
(firstLine[1].equals("FORMAT_77") || firstLine[1].equals("MGD77T"))) {
readAsH77T(text, in);
} else readAsH77(text, in);
}
else {
boolean isH77T = false;
if ( tracks.mggSel.loadedControlFiles.compareTo( "LDEO" ) == 0 ) {
headerFileURL = haxby.util.URLFactory.url(MGD77_PATH + MGGSelector.LAMONT_CONTROL_LOADED.toLowerCase() + "-mgd77/header/" + leg + ".hldeo");
}
else if ( tracks.mggSel.loadedControlFiles.compareTo( "NGDC" ) == 0 ) {
headerFileURL = haxby.util.URLFactory.url( MGD77_PATH + MGGSelector.NGDC_CONTROL_LOADED.toLowerCase() + "-mgd77/header/" + leg + ".h77");
}
else if ( tracks.mggSel.loadedControlFiles.compareTo( "ADGRAV" ) == 0 ) {
headerFileURL = haxby.util.URLFactory.url( MGD77_PATH + MGGSelector.ADGRAV_CONTROL_LOADED.toLowerCase() + "-mgd77/header/" + leg + ".h77");
}
else if ( tracks.mggSel.loadedControlFiles.compareTo( "SIOExplorer" ) == 0 ) {
headerFileURL = haxby.util.URLFactory.url( MGD77_PATH + MGGSelector.SIOEXPLORER_LOADED.toLowerCase() + "-mgd77/header/" + leg + ".info");
}
else if ( tracks.mggSel.loadedControlFiles.compareTo( "USAP" ) == 0 ) {
headerFileURL = haxby.util.URLFactory.url( MGD77_PATH + MGGSelector.USAP_LOADED.toLowerCase() + "-mgd77/header/" + leg + ".info");
}
if (!URLFactory.checkWorkingURL(headerFileURL)) {
String h77tFile = headerFileURL.toString().replaceAll(".h77", ".h77t");
headerFileURL = URLFactory.url(h77tFile);
isH77T = URLFactory.checkWorkingURL(headerFileURL);
}
in = new BufferedReader(new InputStreamReader( headerFileURL.openStream() ));
if (isH77T)
readAsH77T(text, in);
else
readAsH77(text, in);
}
JPanel p = new JPanel( new BorderLayout() );
text.setCaretPosition(0);
p.add( new JScrollPane(text) );
p.setPreferredSize( new Dimension(600, 400) );
JOptionPane.showMessageDialog( map.getTopLevelAncestor(),
p, "cruise: "+leg, JOptionPane.INFORMATION_MESSAGE);
} catch(Exception e) {
JOptionPane.showMessageDialog( map.getTopLevelAncestor(),
"No header information provided for " + leg, "No Header Information", JOptionPane.INFORMATION_MESSAGE);
}
} | [
"void",
"showInfo",
"(",
")",
"{",
"if",
"(",
"cruiseL",
".",
"getSelectedValue",
"(",
")",
"==",
"null",
")",
"return",
";",
"String",
"leg",
"=",
"cruiseL",
".",
"getSelectedValue",
"(",
")",
".",
"replace",
"(",
"\" (header only)\"",
",",
"\"\"",
")",
";",
"try",
"{",
"BufferedReader",
"in",
";",
"java",
".",
"net",
".",
"URL",
"headerFileURL",
"=",
"null",
";",
"JTextArea",
"text",
"=",
"new",
"JTextArea",
"(",
")",
";",
"File",
"MGG_h77_file",
"=",
"new",
"File",
"(",
"MGG",
".",
"MGG_header_dir",
",",
"leg",
"+",
"\".h77\"",
")",
";",
"File",
"MGG_h77t_file",
"=",
"new",
"File",
"(",
"MGG",
".",
"MGG_header_dir",
",",
"leg",
"+",
"\".h77t\"",
")",
";",
"if",
"(",
"MGG_h77t_file",
".",
"exists",
"(",
")",
"||",
"MGG_h77_file",
".",
"exists",
"(",
")",
")",
"{",
"File",
"h77File",
"=",
"MGG_h77t_file",
".",
"exists",
"(",
")",
"?",
"MGG_h77t_file",
":",
"MGG_h77_file",
";",
"in",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"new",
"FileInputStream",
"(",
"h77File",
")",
")",
")",
";",
"String",
"[",
"]",
"firstLine",
"=",
"in",
".",
"readLine",
"(",
")",
".",
"split",
"(",
"\"\\t\"",
")",
";",
"in",
".",
"close",
"(",
")",
";",
"in",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"new",
"FileInputStream",
"(",
"h77File",
")",
")",
")",
";",
"if",
"(",
"firstLine",
".",
"length",
">",
"1",
"&&",
"(",
"firstLine",
"[",
"1",
"]",
".",
"equals",
"(",
"\"FORMAT_77\"",
")",
"||",
"firstLine",
"[",
"1",
"]",
".",
"equals",
"(",
"\"MGD77T\"",
")",
")",
")",
"{",
"readAsH77T",
"(",
"text",
",",
"in",
")",
";",
"}",
"else",
"readAsH77",
"(",
"text",
",",
"in",
")",
";",
"}",
"else",
"{",
"boolean",
"isH77T",
"=",
"false",
";",
"if",
"(",
"tracks",
".",
"mggSel",
".",
"loadedControlFiles",
".",
"compareTo",
"(",
"\"LDEO\"",
")",
"==",
"0",
")",
"{",
"headerFileURL",
"=",
"haxby",
".",
"util",
".",
"URLFactory",
".",
"url",
"(",
"MGD77_PATH",
"+",
"MGGSelector",
".",
"LAMONT_CONTROL_LOADED",
".",
"toLowerCase",
"(",
")",
"+",
"\"-mgd77/header/\"",
"+",
"leg",
"+",
"\".hldeo\"",
")",
";",
"}",
"else",
"if",
"(",
"tracks",
".",
"mggSel",
".",
"loadedControlFiles",
".",
"compareTo",
"(",
"\"NGDC\"",
")",
"==",
"0",
")",
"{",
"headerFileURL",
"=",
"haxby",
".",
"util",
".",
"URLFactory",
".",
"url",
"(",
"MGD77_PATH",
"+",
"MGGSelector",
".",
"NGDC_CONTROL_LOADED",
".",
"toLowerCase",
"(",
")",
"+",
"\"-mgd77/header/\"",
"+",
"leg",
"+",
"\".h77\"",
")",
";",
"}",
"else",
"if",
"(",
"tracks",
".",
"mggSel",
".",
"loadedControlFiles",
".",
"compareTo",
"(",
"\"ADGRAV\"",
")",
"==",
"0",
")",
"{",
"headerFileURL",
"=",
"haxby",
".",
"util",
".",
"URLFactory",
".",
"url",
"(",
"MGD77_PATH",
"+",
"MGGSelector",
".",
"ADGRAV_CONTROL_LOADED",
".",
"toLowerCase",
"(",
")",
"+",
"\"-mgd77/header/\"",
"+",
"leg",
"+",
"\".h77\"",
")",
";",
"}",
"else",
"if",
"(",
"tracks",
".",
"mggSel",
".",
"loadedControlFiles",
".",
"compareTo",
"(",
"\"SIOExplorer\"",
")",
"==",
"0",
")",
"{",
"headerFileURL",
"=",
"haxby",
".",
"util",
".",
"URLFactory",
".",
"url",
"(",
"MGD77_PATH",
"+",
"MGGSelector",
".",
"SIOEXPLORER_LOADED",
".",
"toLowerCase",
"(",
")",
"+",
"\"-mgd77/header/\"",
"+",
"leg",
"+",
"\".info\"",
")",
";",
"}",
"else",
"if",
"(",
"tracks",
".",
"mggSel",
".",
"loadedControlFiles",
".",
"compareTo",
"(",
"\"USAP\"",
")",
"==",
"0",
")",
"{",
"headerFileURL",
"=",
"haxby",
".",
"util",
".",
"URLFactory",
".",
"url",
"(",
"MGD77_PATH",
"+",
"MGGSelector",
".",
"USAP_LOADED",
".",
"toLowerCase",
"(",
")",
"+",
"\"-mgd77/header/\"",
"+",
"leg",
"+",
"\".info\"",
")",
";",
"}",
"if",
"(",
"!",
"URLFactory",
".",
"checkWorkingURL",
"(",
"headerFileURL",
")",
")",
"{",
"String",
"h77tFile",
"=",
"headerFileURL",
".",
"toString",
"(",
")",
".",
"replaceAll",
"(",
"\".h77\"",
",",
"\".h77t\"",
")",
";",
"headerFileURL",
"=",
"URLFactory",
".",
"url",
"(",
"h77tFile",
")",
";",
"isH77T",
"=",
"URLFactory",
".",
"checkWorkingURL",
"(",
"headerFileURL",
")",
";",
"}",
"in",
"=",
"new",
"BufferedReader",
"(",
"new",
"InputStreamReader",
"(",
"headerFileURL",
".",
"openStream",
"(",
")",
")",
")",
";",
"if",
"(",
"isH77T",
")",
"readAsH77T",
"(",
"text",
",",
"in",
")",
";",
"else",
"readAsH77",
"(",
"text",
",",
"in",
")",
";",
"}",
"JPanel",
"p",
"=",
"new",
"JPanel",
"(",
"new",
"BorderLayout",
"(",
")",
")",
";",
"text",
".",
"setCaretPosition",
"(",
"0",
")",
";",
"p",
".",
"add",
"(",
"new",
"JScrollPane",
"(",
"text",
")",
")",
";",
"p",
".",
"setPreferredSize",
"(",
"new",
"Dimension",
"(",
"600",
",",
"400",
")",
")",
";",
"JOptionPane",
".",
"showMessageDialog",
"(",
"map",
".",
"getTopLevelAncestor",
"(",
")",
",",
"p",
",",
"\"cruise: \"",
"+",
"leg",
",",
"JOptionPane",
".",
"INFORMATION_MESSAGE",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"JOptionPane",
".",
"showMessageDialog",
"(",
"map",
".",
"getTopLevelAncestor",
"(",
")",
",",
"\"No header information provided for \"",
"+",
"leg",
",",
"\"No Header Information\"",
",",
"JOptionPane",
".",
"INFORMATION_MESSAGE",
")",
";",
"}",
"}"
] | Info Button from the header file | [
"Info",
"Button",
"from",
"the",
"header",
"file"
] | [
"// First check if there is an imported header file stored in mgg_header_files",
"// on the user's computer",
"// check if this file has M77T formatting",
"// by convention, we can tell this is the second field in the first line is",
"// \"FORMAT_77\" or \"MGD77T\"",
"// if the header file is h77t, then format the output in rows of fields",
"// if not an imported file, then look for header file on the server",
"//look for h77 file, if not found, see if there is a h77t file"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
918,
2405,
966,
1435,
288,
203,
202,
202,
430,
261,
3353,
89,
784,
48,
18,
588,
7416,
620,
1435,
422,
446,
13,
327,
31,
203,
202,
202,
780,
4553,
273,
4422,
89,
784,
48,
18,
588,
7416,
620,
7675,
2079,
2932,
261,
3374,
1338,
2225,
16,
1408,
1769,
203,
202,
202,
698,
288,
203,
1082,
202,
17947,
2514,
316,
31,
203,
1082,
202,
6290,
18,
2758,
18,
1785,
1446,
812,
1785,
273,
446,
31,
203,
1082,
202,
46,
1528,
5484,
977,
273,
394,
804,
1528,
5484,
5621,
203,
9506,
203,
1082,
202,
759,
5783,
866,
309,
1915,
353,
392,
9101,
1446,
585,
4041,
316,
11174,
75,
67,
3374,
67,
2354,
203,
1082,
202,
759,
603,
326,
729,
1807,
26579,
203,
1082,
202,
812,
490,
19491,
67,
76,
4700,
67,
768,
273,
394,
1387,
261,
49,
19491,
18,
49,
19491,
67,
3374,
67,
1214,
16,
4553,
397,
3552,
76,
4700,
8863,
203,
1082,
202,
812,
490,
19491,
67,
76,
4700,
88,
67,
768,
273,
394,
1387,
261,
49,
19491,
18,
49,
19491,
67,
3374,
67,
1214,
16,
4553,
397,
3552,
76,
4700,
88,
8863,
203,
1082,
202,
430,
261,
490,
19491,
67,
76,
4700,
88,
67,
768,
18,
1808,
1435,
747,
490,
19491,
67,
76,
4700,
67,
768,
18,
1808,
10756,
288,
203,
6862,
203,
9506,
202,
812,
366,
4700,
812,
273,
490,
19491,
67,
76,
4700,
88,
67,
768,
18,
1808,
1435,
692,
490,
19491,
67,
76,
4700,
88,
67,
768,
294,
490,
19491,
67,
76,
4700,
67,
768,
31,
203,
9506,
202,
267,
273,
394,
10633,
12,
2704,
15322,
12,
394,
11907,
12,
76,
4700,
812,
3719,
1769,
203,
203,
9506,
202,
759,
866,
309,
333,
585,
711,
490,
4700,
56,
10407,
203,
9506,
202,
759,
635,
15797,
16,
732,
848,
9276,
333,
353,
326,
2205,
652,
316,
326,
1122,
980,
353,
203,
9506,
202,
759,
315,
7254,
67,
4700,
6,
578,
315,
49,
27338,
4700,
56,
6,
203,
9506,
202,
780,
8526,
24415,
273,
316,
18,
896,
1670,
7675,
4939,
31458,
88,
8863,
203,
9506,
202,
267,
18,
4412,
5621,
203,
9506,
202,
267,
273,
394,
10633,
12,
2704,
15322,
12,
394,
11907,
12,
76,
4700,
812,
3719,
1769,
203,
9506,
202,
430,
261,
3645,
1670,
18,
2469,
405,
404,
597,
7010,
25083,
202,
12,
3645,
1670,
63,
21,
8009,
14963,
2932,
7254,
67,
4700,
7923,
747,
24415,
63,
21,
8009,
14963,
2932,
49,
27338,
4700,
56,
6,
20349,
288,
203,
6862,
202,
759,
309,
326,
1446,
585,
353,
366,
4700,
88,
16,
1508,
740,
326,
876,
316,
2595,
434,
1466,
203,
6862,
202,
896,
1463,
44,
4700,
56,
12,
955,
16,
316,
1769,
203,
9506,
202,
97,
469,
855,
1463,
44,
4700,
12,
955,
16,
316,
1769,
203,
6862,
6862,
1082,
203,
1082,
202,
97,
203,
1082,
202,
759,
309,
486,
392,
9101,
585,
16,
1508,
2324,
364,
1446,
585,
603,
326,
1438,
203,
1082,
202,
12107,
288,
203,
9506,
202,
6494,
27803,
4700,
56,
273,
629,
31,
203,
9506,
202,
430,
261,
13933,
18,
81,
14253,
1877,
18,
4230,
3367,
2697,
18,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1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
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
] | [
1,
759,
3807,
12569,
628,
326,
1446,
585,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
197be1ad0a5f4cf26c056b813369e30336c4b2bb | iedadata/geomapapp | haxby/db/mgg/MGGDataDisplay.java | [
"Apache-2.0"
] | Java | readAsH77 | null | public void readAsH77 (JTextArea text, BufferedReader in) throws IOException {
text.append( in.readLine() );
String s;
while( (s=in.readLine())!=null ) {
text.append("\n"+s);
}
in.close();
} | /*
* read in an H77 non-tabbed text
*/ | read in an H77 non-tabbed text | [
"read",
"in",
"an",
"H77",
"non",
"-",
"tabbed",
"text"
] | public void readAsH77 (JTextArea text, BufferedReader in) throws IOException {
text.append( in.readLine() );
String s;
while( (s=in.readLine())!=null ) {
text.append("\n"+s);
}
in.close();
} | [
"public",
"void",
"readAsH77",
"(",
"JTextArea",
"text",
",",
"BufferedReader",
"in",
")",
"throws",
"IOException",
"{",
"text",
".",
"append",
"(",
"in",
".",
"readLine",
"(",
")",
")",
";",
"String",
"s",
";",
"while",
"(",
"(",
"s",
"=",
"in",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"text",
".",
"append",
"(",
"\"\\n\"",
"+",
"s",
")",
";",
"}",
"in",
".",
"close",
"(",
")",
";",
"}"
] | read in an H77 non-tabbed text | [
"read",
"in",
"an",
"H77",
"non",
"-",
"tabbed",
"text"
] | [] | [
{
"param": "text",
"type": "JTextArea"
},
{
"param": "in",
"type": "BufferedReader"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": "JTextArea",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "in",
"type": "BufferedReader",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
855,
1463,
44,
4700,
261,
46,
1528,
5484,
977,
16,
10633,
316,
13,
1216,
1860,
288,
203,
202,
202,
955,
18,
6923,
12,
316,
18,
896,
1670,
1435,
11272,
203,
202,
202,
780,
272,
31,
203,
202,
202,
17523,
12,
261,
87,
33,
267,
18,
896,
1670,
10756,
5,
33,
2011,
262,
288,
203,
1082,
202,
955,
18,
6923,
31458,
82,
6,
15,
87,
1769,
203,
202,
202,
97,
203,
202,
202,
267,
18,
4412,
5621,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
203,
202,
380,
855,
316,
392,
670,
4700,
1661,
17,
7032,
2992,
977,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
197be1ad0a5f4cf26c056b813369e30336c4b2bb | iedadata/geomapapp | haxby/db/mgg/MGGDataDisplay.java | [
"Apache-2.0"
] | Java | readAsH77T | null | public void readAsH77T (JTextArea text, BufferedReader in) throws IOException {
// read in each line and split into fields
ArrayList<String[]> lines = new ArrayList<String[]>();
String l;
while( ( l=in.readLine())!=null ) {
lines.add(l.split("\t"));
}
// if file has a header line, containing field names, use that, else use convention values
// by convention we can detect this if the second field name is "FORMAT_77"
if (!lines.get(0)[1].equals("FORMAT_77")) {
lines.add(0, CONVENTION_M77T_LABELS);
}
int numFields = lines.get(0).length;
for (int i=0; i < numFields; i++) {
for (int j=0; j<lines.size(); j++) {
String[] line = lines.get(j);
if (j == 0) {
text.append(line[i] + ":\t");
} else if (line.length > i) text.append(line[i] + "\t");
}
text.append("\n");
}
in.close();
} | /*
* read in an H77T tabbed text
*/ | read in an H77T tabbed text | [
"read",
"in",
"an",
"H77T",
"tabbed",
"text"
] | public void readAsH77T (JTextArea text, BufferedReader in) throws IOException {
ArrayList<String[]> lines = new ArrayList<String[]>();
String l;
while( ( l=in.readLine())!=null ) {
lines.add(l.split("\t"));
}
if (!lines.get(0)[1].equals("FORMAT_77")) {
lines.add(0, CONVENTION_M77T_LABELS);
}
int numFields = lines.get(0).length;
for (int i=0; i < numFields; i++) {
for (int j=0; j<lines.size(); j++) {
String[] line = lines.get(j);
if (j == 0) {
text.append(line[i] + ":\t");
} else if (line.length > i) text.append(line[i] + "\t");
}
text.append("\n");
}
in.close();
} | [
"public",
"void",
"readAsH77T",
"(",
"JTextArea",
"text",
",",
"BufferedReader",
"in",
")",
"throws",
"IOException",
"{",
"ArrayList",
"<",
"String",
"[",
"]",
">",
"lines",
"=",
"new",
"ArrayList",
"<",
"String",
"[",
"]",
">",
"(",
")",
";",
"String",
"l",
";",
"while",
"(",
"(",
"l",
"=",
"in",
".",
"readLine",
"(",
")",
")",
"!=",
"null",
")",
"{",
"lines",
".",
"add",
"(",
"l",
".",
"split",
"(",
"\"\\t\"",
")",
")",
";",
"}",
"if",
"(",
"!",
"lines",
".",
"get",
"(",
"0",
")",
"[",
"1",
"]",
".",
"equals",
"(",
"\"FORMAT_77\"",
")",
")",
"{",
"lines",
".",
"add",
"(",
"0",
",",
"CONVENTION_M77T_LABELS",
")",
";",
"}",
"int",
"numFields",
"=",
"lines",
".",
"get",
"(",
"0",
")",
".",
"length",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"numFields",
";",
"i",
"++",
")",
"{",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"lines",
".",
"size",
"(",
")",
";",
"j",
"++",
")",
"{",
"String",
"[",
"]",
"line",
"=",
"lines",
".",
"get",
"(",
"j",
")",
";",
"if",
"(",
"j",
"==",
"0",
")",
"{",
"text",
".",
"append",
"(",
"line",
"[",
"i",
"]",
"+",
"\":\\t\"",
")",
";",
"}",
"else",
"if",
"(",
"line",
".",
"length",
">",
"i",
")",
"text",
".",
"append",
"(",
"line",
"[",
"i",
"]",
"+",
"\"\\t\"",
")",
";",
"}",
"text",
".",
"append",
"(",
"\"\\n\"",
")",
";",
"}",
"in",
".",
"close",
"(",
")",
";",
"}"
] | read in an H77T tabbed text | [
"read",
"in",
"an",
"H77T",
"tabbed",
"text"
] | [
"// read in each line and split into fields",
"// if file has a header line, containing field names, use that, else use convention values",
"// by convention we can detect this if the second field name is \"FORMAT_77\""
] | [
{
"param": "text",
"type": "JTextArea"
},
{
"param": "in",
"type": "BufferedReader"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": "JTextArea",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "in",
"type": "BufferedReader",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
855,
1463,
44,
4700,
56,
261,
46,
1528,
5484,
977,
16,
10633,
316,
13,
1216,
1860,
288,
203,
202,
202,
759,
855,
316,
1517,
980,
471,
1416,
1368,
1466,
203,
202,
202,
19558,
32,
780,
8526,
34,
2362,
273,
394,
2407,
32,
780,
8526,
34,
5621,
203,
202,
202,
780,
328,
31,
203,
202,
202,
17523,
12,
261,
328,
33,
267,
18,
896,
1670,
10756,
5,
33,
2011,
262,
288,
203,
1082,
202,
3548,
18,
1289,
12,
80,
18,
4939,
31458,
88,
7923,
1769,
203,
202,
202,
97,
203,
202,
202,
759,
309,
585,
711,
279,
1446,
980,
16,
4191,
652,
1257,
16,
999,
716,
16,
469,
999,
15797,
924,
203,
202,
202,
759,
635,
15797,
732,
848,
5966,
333,
309,
326,
2205,
652,
508,
353,
315,
7254,
67,
4700,
6,
203,
202,
202,
430,
16051,
3548,
18,
588,
12,
20,
25146,
21,
8009,
14963,
2932,
7254,
67,
4700,
6,
3719,
288,
203,
1082,
202,
3548,
18,
1289,
12,
20,
16,
225,
3492,
6465,
1146,
67,
49,
4700,
56,
67,
13545,
55,
1769,
203,
202,
202,
97,
203,
25083,
203,
202,
202,
474,
818,
2314,
273,
2362,
18,
588,
12,
20,
2934,
2469,
31,
203,
203,
202,
202,
1884,
261,
474,
277,
33,
20,
31,
277,
411,
818,
2314,
31,
277,
27245,
288,
203,
203,
1082,
202,
1884,
261,
474,
525,
33,
20,
31,
525,
32,
3548,
18,
1467,
5621,
525,
27245,
288,
203,
9506,
202,
780,
8526,
980,
273,
2362,
18,
588,
12,
78,
1769,
203,
9506,
202,
430,
261,
78,
422,
374,
13,
288,
203,
6862,
202,
955,
18,
6923,
12,
1369,
63,
77,
65,
397,
315,
5581,
88,
8863,
203,
9506,
202,
97,
469,
309,
261,
1369,
18,
2469,
405,
277,
13,
977,
18,
6923,
12,
1369,
63,
77,
65,
397,
1548,
88,
8863,
203,
1082,
202,
97,
203,
1082,
202,
955,
18,
6923,
31458,
82,
8863,
203,
202,
202,
97,
203,
202,
202,
267,
18,
4412,
5621,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
316,
392,
670,
4700,
56,
3246,
2992,
977,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
197be1ad0a5f4cf26c056b813369e30336c4b2bb | iedadata/geomapapp | haxby/db/mgg/MGGDataDisplay.java | [
"Apache-2.0"
] | Java | mouseClicked | null | public void mouseClicked(MouseEvent e) {
if ( e.getSource() == cruiseL ) {
if ( e.getClickCount() >= 2 ) {
loadProfile.doClick();
}
}
} | // 1.4.4: Allows user to double-click to load the data for the currently selected legs | 1.4.4: Allows user to double-click to load the data for the currently selected legs | [
"1",
".",
"4",
".",
"4",
":",
"Allows",
"user",
"to",
"double",
"-",
"click",
"to",
"load",
"the",
"data",
"for",
"the",
"currently",
"selected",
"legs"
] | public void mouseClicked(MouseEvent e) {
if ( e.getSource() == cruiseL ) {
if ( e.getClickCount() >= 2 ) {
loadProfile.doClick();
}
}
} | [
"public",
"void",
"mouseClicked",
"(",
"MouseEvent",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getSource",
"(",
")",
"==",
"cruiseL",
")",
"{",
"if",
"(",
"e",
".",
"getClickCount",
"(",
")",
">=",
"2",
")",
"{",
"loadProfile",
".",
"doClick",
"(",
")",
";",
"}",
"}",
"}"
] | 1.4.4: Allows user to double-click to load the data for the currently selected legs | [
"1",
".",
"4",
".",
"4",
":",
"Allows",
"user",
"to",
"double",
"-",
"click",
"to",
"load",
"the",
"data",
"for",
"the",
"currently",
"selected",
"legs"
] | [] | [
{
"param": "e",
"type": "MouseEvent"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "e",
"type": "MouseEvent",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
7644,
27633,
12,
9186,
1133,
425,
13,
288,
203,
202,
202,
430,
261,
425,
18,
588,
1830,
1435,
422,
4422,
89,
784,
48,
262,
288,
203,
1082,
202,
430,
261,
425,
18,
588,
6563,
1380,
1435,
1545,
576,
262,
288,
203,
9506,
202,
945,
4029,
18,
2896,
6563,
5621,
203,
1082,
202,
97,
203,
202,
202,
97,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
759,
202,
21,
18,
24,
18,
24,
30,
25619,
729,
358,
1645,
17,
7475,
358,
1262,
326,
501,
364,
326,
4551,
3170,
884,
564,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
e573201543663b6a176b28bcf4270a37e15551a0 | iedadata/geomapapp | haxby/db/xmcs/XMImage.java | [
"Apache-2.0"
] | Java | undoReverseProcessPoint | Point | public Point undoReverseProcessPoint(Point2D processedPoint) {
Insets ins = getInsets();
Point p = new Point((int)processedPoint.getX(),(int)processedPoint.getY());
double[] scales = getScales();
p.x -= ins.left;
p.y -= ins.top;
p.x /= scales[0];
p.y /= scales[1];
return p;
} | /**
* Returns the point from the object generated by reverseProcessPoint - Donald Pomeroy
* @param processedPoint
* @return
*/ | Returns the point from the object generated by reverseProcessPoint - Donald Pomeroy
@param processedPoint
@return | [
"Returns",
"the",
"point",
"from",
"the",
"object",
"generated",
"by",
"reverseProcessPoint",
"-",
"Donald",
"Pomeroy",
"@param",
"processedPoint",
"@return"
] | public Point undoReverseProcessPoint(Point2D processedPoint) {
Insets ins = getInsets();
Point p = new Point((int)processedPoint.getX(),(int)processedPoint.getY());
double[] scales = getScales();
p.x -= ins.left;
p.y -= ins.top;
p.x /= scales[0];
p.y /= scales[1];
return p;
} | [
"public",
"Point",
"undoReverseProcessPoint",
"(",
"Point2D",
"processedPoint",
")",
"{",
"Insets",
"ins",
"=",
"getInsets",
"(",
")",
";",
"Point",
"p",
"=",
"new",
"Point",
"(",
"(",
"int",
")",
"processedPoint",
".",
"getX",
"(",
")",
",",
"(",
"int",
")",
"processedPoint",
".",
"getY",
"(",
")",
")",
";",
"double",
"[",
"]",
"scales",
"=",
"getScales",
"(",
")",
";",
"p",
".",
"x",
"-=",
"ins",
".",
"left",
";",
"p",
".",
"y",
"-=",
"ins",
".",
"top",
";",
"p",
".",
"x",
"/=",
"scales",
"[",
"0",
"]",
";",
"p",
".",
"y",
"/=",
"scales",
"[",
"1",
"]",
";",
"return",
"p",
";",
"}"
] | Returns the point from the object generated by reverseProcessPoint - Donald Pomeroy
@param processedPoint
@return | [
"Returns",
"the",
"point",
"from",
"the",
"object",
"generated",
"by",
"reverseProcessPoint",
"-",
"Donald",
"Pomeroy",
"@param",
"processedPoint",
"@return"
] | [] | [
{
"param": "processedPoint",
"type": "Point2D"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "processedPoint",
"type": "Point2D",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
4686,
15436,
12650,
2227,
2148,
12,
2148,
22,
40,
5204,
2148,
13,
288,
203,
202,
202,
382,
4424,
2763,
273,
7854,
4424,
5621,
203,
202,
202,
2148,
293,
273,
394,
4686,
12443,
474,
13,
11005,
2148,
18,
588,
60,
9334,
12,
474,
13,
11005,
2148,
18,
588,
61,
10663,
203,
202,
202,
9056,
8526,
18211,
273,
1322,
21177,
5621,
203,
202,
202,
84,
18,
92,
3947,
2763,
18,
4482,
31,
203,
202,
202,
84,
18,
93,
3947,
2763,
18,
3669,
31,
203,
202,
202,
84,
18,
92,
9531,
18211,
63,
20,
15533,
203,
202,
202,
84,
18,
93,
9531,
18211,
63,
21,
15533,
203,
202,
202,
2463,
293,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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733,
4374,
635,
4219,
2227,
2148,
300,
7615,
287,
72,
453,
362,
2439,
93,
203,
202,
380,
632,
891,
5204,
2148,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
e573201543663b6a176b28bcf4270a37e15551a0 | iedadata/geomapapp | haxby/db/xmcs/XMImage.java | [
"Apache-2.0"
] | Java | undoCdpAt | null | public double undoCdpAt( double c)
{
if( cdpInterval == null) return -1;
Insets ins = border.getBorderInsets(this);
double zoomX = getZoomX();
zoomX /= (cdpInterval[1]-cdpInterval[0]+1)/(double)width;
double x;
c = Math.rint(c);
if( flip ) {
c = (-1)*(c - cdpInterval[1]);
} else {
c = c - cdpInterval[0];
}
x = ((c*zoomX) + ins.left);
return x;
} | /**
* Returns the co-ordinate that the CDP was generated from - Donald Pomeroy
* @param c
* @return
*/ | Returns the co-ordinate that the CDP was generated from - Donald Pomeroy
@param c
@return | [
"Returns",
"the",
"co",
"-",
"ordinate",
"that",
"the",
"CDP",
"was",
"generated",
"from",
"-",
"Donald",
"Pomeroy",
"@param",
"c",
"@return"
] | public double undoCdpAt( double c)
{
if( cdpInterval == null) return -1;
Insets ins = border.getBorderInsets(this);
double zoomX = getZoomX();
zoomX /= (cdpInterval[1]-cdpInterval[0]+1)/(double)width;
double x;
c = Math.rint(c);
if( flip ) {
c = (-1)*(c - cdpInterval[1]);
} else {
c = c - cdpInterval[0];
}
x = ((c*zoomX) + ins.left);
return x;
} | [
"public",
"double",
"undoCdpAt",
"(",
"double",
"c",
")",
"{",
"if",
"(",
"cdpInterval",
"==",
"null",
")",
"return",
"-",
"1",
";",
"Insets",
"ins",
"=",
"border",
".",
"getBorderInsets",
"(",
"this",
")",
";",
"double",
"zoomX",
"=",
"getZoomX",
"(",
")",
";",
"zoomX",
"/=",
"(",
"cdpInterval",
"[",
"1",
"]",
"-",
"cdpInterval",
"[",
"0",
"]",
"+",
"1",
")",
"/",
"(",
"double",
")",
"width",
";",
"double",
"x",
";",
"c",
"=",
"Math",
".",
"rint",
"(",
"c",
")",
";",
"if",
"(",
"flip",
")",
"{",
"c",
"=",
"(",
"-",
"1",
")",
"*",
"(",
"c",
"-",
"cdpInterval",
"[",
"1",
"]",
")",
";",
"}",
"else",
"{",
"c",
"=",
"c",
"-",
"cdpInterval",
"[",
"0",
"]",
";",
"}",
"x",
"=",
"(",
"(",
"c",
"*",
"zoomX",
")",
"+",
"ins",
".",
"left",
")",
";",
"return",
"x",
";",
"}"
] | Returns the co-ordinate that the CDP was generated from - Donald Pomeroy
@param c
@return | [
"Returns",
"the",
"co",
"-",
"ordinate",
"that",
"the",
"CDP",
"was",
"generated",
"from",
"-",
"Donald",
"Pomeroy",
"@param",
"c",
"@return"
] | [] | [
{
"param": "c",
"type": "double"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "c",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
1645,
15436,
39,
9295,
861,
12,
1645,
276,
13,
203,
202,
95,
203,
202,
202,
430,
12,
7976,
84,
4006,
422,
446,
13,
327,
300,
21,
31,
203,
202,
202,
382,
4424,
2763,
273,
5795,
18,
588,
8107,
382,
4424,
12,
2211,
1769,
203,
202,
202,
9056,
7182,
60,
273,
336,
11497,
60,
5621,
203,
202,
202,
14932,
60,
9531,
261,
4315,
84,
4006,
63,
21,
65,
17,
4315,
84,
4006,
63,
20,
3737,
21,
13176,
12,
9056,
13,
2819,
31,
203,
202,
202,
9056,
619,
31,
203,
202,
202,
71,
273,
2361,
18,
86,
474,
12,
71,
1769,
203,
202,
202,
430,
12,
9668,
262,
288,
203,
1082,
202,
71,
273,
24927,
21,
17653,
12,
71,
300,
7976,
84,
4006,
63,
21,
19226,
203,
202,
202,
97,
469,
288,
203,
1082,
202,
71,
273,
225,
276,
300,
7976,
84,
4006,
63,
20,
15533,
203,
202,
202,
97,
203,
202,
202,
92,
273,
14015,
71,
14,
14932,
60,
13,
397,
2763,
18,
4482,
1769,
203,
202,
202,
2463,
619,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
e573201543663b6a176b28bcf4270a37e15551a0 | iedadata/geomapapp | haxby/db/xmcs/XMImage.java | [
"Apache-2.0"
] | Java | itemStateChanged | null | public void itemStateChanged(ItemEvent e) {
Object source = e.getItemSelectable();
if ( source == imageCB && imageCB.isSelected() ) {
segyCB.setSelected(false);
}
else if ( source == imageFullCB && imageFullCB.isSelected() ) {
segyCB.setSelected(false);
}
else if ( source == segyCB && segyCB.isSelected() ) {
imageCB.setSelected(false);
imageFullCB.setSelected(false);
navCB.setSelected(false);
}
else if ( source == navCB && navCB.isSelected() ) {
segyCB.setSelected(false);
}
} | // ***** GMA 1.6.2: If segyCB is selected the other save options cannot be selected and vice versa. | GMA 1.6.2: If segyCB is selected the other save options cannot be selected and vice versa. | [
"GMA",
"1",
".",
"6",
".",
"2",
":",
"If",
"segyCB",
"is",
"selected",
"the",
"other",
"save",
"options",
"cannot",
"be",
"selected",
"and",
"vice",
"versa",
"."
] | public void itemStateChanged(ItemEvent e) {
Object source = e.getItemSelectable();
if ( source == imageCB && imageCB.isSelected() ) {
segyCB.setSelected(false);
}
else if ( source == imageFullCB && imageFullCB.isSelected() ) {
segyCB.setSelected(false);
}
else if ( source == segyCB && segyCB.isSelected() ) {
imageCB.setSelected(false);
imageFullCB.setSelected(false);
navCB.setSelected(false);
}
else if ( source == navCB && navCB.isSelected() ) {
segyCB.setSelected(false);
}
} | [
"public",
"void",
"itemStateChanged",
"(",
"ItemEvent",
"e",
")",
"{",
"Object",
"source",
"=",
"e",
".",
"getItemSelectable",
"(",
")",
";",
"if",
"(",
"source",
"==",
"imageCB",
"&&",
"imageCB",
".",
"isSelected",
"(",
")",
")",
"{",
"segyCB",
".",
"setSelected",
"(",
"false",
")",
";",
"}",
"else",
"if",
"(",
"source",
"==",
"imageFullCB",
"&&",
"imageFullCB",
".",
"isSelected",
"(",
")",
")",
"{",
"segyCB",
".",
"setSelected",
"(",
"false",
")",
";",
"}",
"else",
"if",
"(",
"source",
"==",
"segyCB",
"&&",
"segyCB",
".",
"isSelected",
"(",
")",
")",
"{",
"imageCB",
".",
"setSelected",
"(",
"false",
")",
";",
"imageFullCB",
".",
"setSelected",
"(",
"false",
")",
";",
"navCB",
".",
"setSelected",
"(",
"false",
")",
";",
"}",
"else",
"if",
"(",
"source",
"==",
"navCB",
"&&",
"navCB",
".",
"isSelected",
"(",
")",
")",
"{",
"segyCB",
".",
"setSelected",
"(",
"false",
")",
";",
"}",
"}"
] | GMA 1.6.2: If segyCB is selected the other save options cannot be selected and vice versa. | [
"GMA",
"1",
".",
"6",
".",
"2",
":",
"If",
"segyCB",
"is",
"selected",
"the",
"other",
"save",
"options",
"cannot",
"be",
"selected",
"and",
"vice",
"versa",
"."
] | [] | [
{
"param": "e",
"type": "ItemEvent"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "e",
"type": "ItemEvent",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
761,
1119,
5033,
12,
1180,
1133,
425,
13,
288,
203,
202,
202,
921,
1084,
273,
425,
18,
588,
1180,
31544,
5621,
203,
202,
202,
430,
261,
1084,
422,
1316,
8876,
597,
1316,
8876,
18,
291,
7416,
1435,
262,
288,
203,
1082,
202,
5680,
93,
8876,
18,
542,
7416,
12,
5743,
1769,
203,
202,
202,
97,
203,
202,
202,
12107,
309,
261,
1084,
422,
1316,
5080,
8876,
597,
1316,
5080,
8876,
18,
291,
7416,
1435,
262,
288,
203,
1082,
202,
5680,
93,
8876,
18,
542,
7416,
12,
5743,
1769,
203,
202,
202,
97,
203,
202,
202,
12107,
309,
261,
1084,
422,
2291,
93,
8876,
597,
2291,
93,
8876,
18,
291,
7416,
1435,
262,
288,
203,
1082,
202,
2730,
8876,
18,
542,
7416,
12,
5743,
1769,
203,
1082,
202,
2730,
5080,
8876,
18,
542,
7416,
12,
5743,
1769,
203,
1082,
202,
11589,
8876,
18,
542,
7416,
12,
5743,
1769,
203,
202,
202,
97,
203,
202,
202,
12107,
309,
261,
1084,
422,
8775,
8876,
597,
8775,
8876,
18,
291,
7416,
1435,
262,
288,
203,
1082,
202,
5680,
93,
8876,
18,
542,
7416,
12,
5743,
1769,
203,
202,
202,
97,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
e573201543663b6a176b28bcf4270a37e15551a0 | iedadata/geomapapp | haxby/db/xmcs/XMImage.java | [
"Apache-2.0"
] | Java | tryPopUp | null | public void tryPopUp(MouseEvent evt){
String osName = System.getProperty("os.name");
if ( !evt.isControlDown()) {
if ( osName.startsWith("Mac OS") && evt.isShiftDown() ) {
pm.show(evt.getComponent(), evt.getX(), evt.getY() );
}
else if ( evt.isPopupTrigger() ) {
pm.show(evt.getComponent(), evt.getX(), evt.getY());
}
else if ( digitizeTB.isSelected() ) {
pm.show(evt.getComponent(), evt.getX(), evt.getY());
}
repaint();
}
} | // the current point to the clipboard. | the current point to the clipboard. | [
"the",
"current",
"point",
"to",
"the",
"clipboard",
"."
] | public void tryPopUp(MouseEvent evt){
String osName = System.getProperty("os.name");
if ( !evt.isControlDown()) {
if ( osName.startsWith("Mac OS") && evt.isShiftDown() ) {
pm.show(evt.getComponent(), evt.getX(), evt.getY() );
}
else if ( evt.isPopupTrigger() ) {
pm.show(evt.getComponent(), evt.getX(), evt.getY());
}
else if ( digitizeTB.isSelected() ) {
pm.show(evt.getComponent(), evt.getX(), evt.getY());
}
repaint();
}
} | [
"public",
"void",
"tryPopUp",
"(",
"MouseEvent",
"evt",
")",
"{",
"String",
"osName",
"=",
"System",
".",
"getProperty",
"(",
"\"os.name\"",
")",
";",
"if",
"(",
"!",
"evt",
".",
"isControlDown",
"(",
")",
")",
"{",
"if",
"(",
"osName",
".",
"startsWith",
"(",
"\"Mac OS\"",
")",
"&&",
"evt",
".",
"isShiftDown",
"(",
")",
")",
"{",
"pm",
".",
"show",
"(",
"evt",
".",
"getComponent",
"(",
")",
",",
"evt",
".",
"getX",
"(",
")",
",",
"evt",
".",
"getY",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"evt",
".",
"isPopupTrigger",
"(",
")",
")",
"{",
"pm",
".",
"show",
"(",
"evt",
".",
"getComponent",
"(",
")",
",",
"evt",
".",
"getX",
"(",
")",
",",
"evt",
".",
"getY",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"digitizeTB",
".",
"isSelected",
"(",
")",
")",
"{",
"pm",
".",
"show",
"(",
"evt",
".",
"getComponent",
"(",
")",
",",
"evt",
".",
"getX",
"(",
")",
",",
"evt",
".",
"getY",
"(",
")",
")",
";",
"}",
"repaint",
"(",
")",
";",
"}",
"}"
] | the current point to the clipboard. | [
"the",
"current",
"point",
"to",
"the",
"clipboard",
"."
] | [] | [
{
"param": "evt",
"type": "MouseEvent"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "evt",
"type": "MouseEvent",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
775,
7049,
1211,
12,
9186,
1133,
6324,
15329,
203,
202,
202,
780,
1140,
461,
273,
2332,
18,
588,
1396,
2932,
538,
18,
529,
8863,
203,
202,
202,
430,
261,
401,
73,
11734,
18,
291,
3367,
4164,
10756,
288,
203,
1082,
202,
430,
261,
1140,
461,
18,
17514,
1190,
2932,
9990,
5932,
7923,
597,
6324,
18,
291,
10544,
4164,
1435,
262,
288,
203,
9506,
202,
7755,
18,
4500,
12,
73,
11734,
18,
588,
1841,
9334,
6324,
18,
588,
60,
9334,
6324,
18,
588,
61,
1435,
11272,
203,
1082,
202,
97,
203,
1082,
202,
12107,
309,
261,
6324,
18,
291,
13770,
6518,
1435,
262,
288,
203,
9506,
202,
7755,
18,
4500,
12,
73,
11734,
18,
588,
1841,
9334,
6324,
18,
588,
60,
9334,
6324,
18,
588,
61,
10663,
203,
1082,
202,
97,
203,
1082,
202,
12107,
309,
261,
8035,
554,
25730,
18,
291,
7416,
1435,
262,
288,
203,
9506,
202,
7755,
18,
4500,
12,
73,
11734,
18,
588,
1841,
9334,
6324,
18,
588,
60,
9334,
6324,
18,
588,
61,
10663,
203,
1082,
202,
97,
203,
1082,
202,
14462,
1598,
5621,
203,
202,
202,
97,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
759,
202,
5787,
783,
1634,
358,
326,
20304,
18,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
5398af0e0cfb67e5d342ae4e226c7df288e25112 | iedadata/geomapapp | haxby/db/radar/RImage.java | [
"Apache-2.0"
] | Java | undoReverseProcessPoint | Point | public Point undoReverseProcessPoint(Point2D processedPoint)
{
Insets ins = getInsets();
Point p = new Point((int)processedPoint.getX(),(int)processedPoint.getY());
double[] scales = getScales();
p.x -= ins.left;
p.y -= ins.top;
p.x /= scales[0];
p.y /= scales[1];
return p;
} | /**
* Returns the point from the object generated by reverseProcessPoint - Donald Pomeroy
* @param processedPoint
* @return
*/ | Returns the point from the object generated by reverseProcessPoint - Donald Pomeroy
@param processedPoint
@return | [
"Returns",
"the",
"point",
"from",
"the",
"object",
"generated",
"by",
"reverseProcessPoint",
"-",
"Donald",
"Pomeroy",
"@param",
"processedPoint",
"@return"
] | public Point undoReverseProcessPoint(Point2D processedPoint)
{
Insets ins = getInsets();
Point p = new Point((int)processedPoint.getX(),(int)processedPoint.getY());
double[] scales = getScales();
p.x -= ins.left;
p.y -= ins.top;
p.x /= scales[0];
p.y /= scales[1];
return p;
} | [
"public",
"Point",
"undoReverseProcessPoint",
"(",
"Point2D",
"processedPoint",
")",
"{",
"Insets",
"ins",
"=",
"getInsets",
"(",
")",
";",
"Point",
"p",
"=",
"new",
"Point",
"(",
"(",
"int",
")",
"processedPoint",
".",
"getX",
"(",
")",
",",
"(",
"int",
")",
"processedPoint",
".",
"getY",
"(",
")",
")",
";",
"double",
"[",
"]",
"scales",
"=",
"getScales",
"(",
")",
";",
"p",
".",
"x",
"-=",
"ins",
".",
"left",
";",
"p",
".",
"y",
"-=",
"ins",
".",
"top",
";",
"p",
".",
"x",
"/=",
"scales",
"[",
"0",
"]",
";",
"p",
".",
"y",
"/=",
"scales",
"[",
"1",
"]",
";",
"return",
"p",
";",
"}"
] | Returns the point from the object generated by reverseProcessPoint - Donald Pomeroy
@param processedPoint
@return | [
"Returns",
"the",
"point",
"from",
"the",
"object",
"generated",
"by",
"reverseProcessPoint",
"-",
"Donald",
"Pomeroy",
"@param",
"processedPoint",
"@return"
] | [] | [
{
"param": "processedPoint",
"type": "Point2D"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "processedPoint",
"type": "Point2D",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
4686,
15436,
12650,
2227,
2148,
12,
2148,
22,
40,
5204,
2148,
13,
203,
202,
95,
203,
202,
202,
382,
4424,
2763,
273,
7854,
4424,
5621,
203,
202,
202,
2148,
293,
273,
394,
4686,
12443,
474,
13,
11005,
2148,
18,
588,
60,
9334,
12,
474,
13,
11005,
2148,
18,
588,
61,
10663,
203,
202,
202,
9056,
8526,
18211,
273,
1322,
21177,
5621,
203,
202,
202,
84,
18,
92,
3947,
2763,
18,
4482,
31,
203,
202,
202,
84,
18,
93,
3947,
2763,
18,
3669,
31,
203,
202,
202,
84,
18,
92,
9531,
18211,
63,
20,
15533,
203,
202,
202,
84,
18,
93,
9531,
18211,
63,
21,
15533,
203,
202,
202,
2463,
293,
31,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
202,
380,
2860,
326,
1634,
628,
326,
733,
4374,
635,
4219,
2227,
2148,
300,
7615,
287,
72,
453,
362,
2439,
93,
203,
202,
380,
632,
891,
5204,
2148,
203,
202,
380,
632,
2463,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
5398af0e0cfb67e5d342ae4e226c7df288e25112 | iedadata/geomapapp | haxby/db/radar/RImage.java | [
"Apache-2.0"
] | Java | closeLine | null | protected void closeLine() {
XMap map = line.map;
//line = null;
border = null;
image = null;
System.gc();
panel.repaint();
otherImage.repaint();
map.repaint();
dig.getSelectB().doClick(0);
dig.reset();
} | //DEP add a close line function for the close image button | DEP add a close line function for the close image button | [
"DEP",
"add",
"a",
"close",
"line",
"function",
"for",
"the",
"close",
"image",
"button"
] | protected void closeLine() {
XMap map = line.map;
border = null;
image = null;
System.gc();
panel.repaint();
otherImage.repaint();
map.repaint();
dig.getSelectB().doClick(0);
dig.reset();
} | [
"protected",
"void",
"closeLine",
"(",
")",
"{",
"XMap",
"map",
"=",
"line",
".",
"map",
";",
"border",
"=",
"null",
";",
"image",
"=",
"null",
";",
"System",
".",
"gc",
"(",
")",
";",
"panel",
".",
"repaint",
"(",
")",
";",
"otherImage",
".",
"repaint",
"(",
")",
";",
"map",
".",
"repaint",
"(",
")",
";",
"dig",
".",
"getSelectB",
"(",
")",
".",
"doClick",
"(",
"0",
")",
";",
"dig",
".",
"reset",
"(",
")",
";",
"}"
] | DEP add a close line function for the close image button | [
"DEP",
"add",
"a",
"close",
"line",
"function",
"for",
"the",
"close",
"image",
"button"
] | [
"//line = null;"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
918,
1746,
1670,
1435,
288,
203,
202,
202,
60,
863,
852,
273,
980,
18,
1458,
31,
203,
202,
202,
759,
1369,
273,
446,
31,
203,
202,
202,
8815,
273,
446,
31,
203,
202,
202,
2730,
273,
446,
31,
203,
202,
202,
3163,
18,
13241,
5621,
203,
202,
202,
13916,
18,
14462,
1598,
5621,
203,
202,
202,
3011,
2040,
18,
14462,
1598,
5621,
203,
202,
202,
1458,
18,
14462,
1598,
5621,
203,
1082,
203,
202,
202,
5606,
18,
588,
3391,
38,
7675,
2896,
6563,
12,
20,
1769,
203,
1082,
203,
202,
202,
5606,
18,
6208,
5621,
202,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
759,
1639,
52,
527,
279,
1746,
980,
445,
364,
326,
1746,
1316,
3568,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
61843dc5706035e6ee3ba4dfe036e7d61da0e0e3 | iedadata/geomapapp | org/geomapapp/util/GMAProfile.java | [
"Apache-2.0"
] | Java | isMultiPlot | Boolean | public Boolean isMultiPlot() {
int count = 0;
for (Grid2DOverlay thisGrid : gridsToPlot) {
if (thisGrid instanceof CruiseGridViewer || thisGrid instanceof GridViewer) count ++;
}
return (count >= 1);
} | /*
* Return whether the multiplot button should be displayed
* For now, this is only available when looking at the development
* and GMRT released grid using PreviewGrids of PreviewCruise
*/ | Return whether the multiplot button should be displayed
For now, this is only available when looking at the development
and GMRT released grid using PreviewGrids of PreviewCruise | [
"Return",
"whether",
"the",
"multiplot",
"button",
"should",
"be",
"displayed",
"For",
"now",
"this",
"is",
"only",
"available",
"when",
"looking",
"at",
"the",
"development",
"and",
"GMRT",
"released",
"grid",
"using",
"PreviewGrids",
"of",
"PreviewCruise"
] | public Boolean isMultiPlot() {
int count = 0;
for (Grid2DOverlay thisGrid : gridsToPlot) {
if (thisGrid instanceof CruiseGridViewer || thisGrid instanceof GridViewer) count ++;
}
return (count >= 1);
} | [
"public",
"Boolean",
"isMultiPlot",
"(",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"Grid2DOverlay",
"thisGrid",
":",
"gridsToPlot",
")",
"{",
"if",
"(",
"thisGrid",
"instanceof",
"CruiseGridViewer",
"||",
"thisGrid",
"instanceof",
"GridViewer",
")",
"count",
"++",
";",
"}",
"return",
"(",
"count",
">=",
"1",
")",
";",
"}"
] | Return whether the multiplot button should be displayed
For now, this is only available when looking at the development
and GMRT released grid using PreviewGrids of PreviewCruise | [
"Return",
"whether",
"the",
"multiplot",
"button",
"should",
"be",
"displayed",
"For",
"now",
"this",
"is",
"only",
"available",
"when",
"looking",
"at",
"the",
"development",
"and",
"GMRT",
"released",
"grid",
"using",
"PreviewGrids",
"of",
"PreviewCruise"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
3411,
25129,
11532,
1435,
288,
206,
203,
202,
202,
474,
1056,
273,
374,
31,
206,
203,
202,
202,
1884,
261,
6313,
22,
3191,
502,
5544,
333,
6313,
294,
3068,
11634,
11532,
13,
288,
206,
203,
1082,
202,
430,
261,
2211,
6313,
1276,
385,
8653,
784,
6313,
18415,
747,
333,
6313,
1276,
7145,
18415,
13,
1056,
965,
31,
206,
203,
202,
202,
97,
206,
203,
202,
202,
2463,
261,
1883,
1545,
404,
1769,
206,
203,
202,
97,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
20308,
206,
203,
202,
380,
2000,
2856,
326,
3309,
4032,
3568,
1410,
506,
10453,
206,
203,
202,
380,
2457,
2037,
16,
333,
353,
1338,
2319,
1347,
7849,
622,
326,
17772,
206,
203,
202,
380,
471,
611,
49,
12185,
15976,
3068,
1450,
22289,
6313,
87,
434,
22289,
39,
8653,
784,
206,
203,
202,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
54627edb5c1a7ebcb9fdb97114220d01b8b39c48 | iedadata/geomapapp | haxby/worldwind/layers/ScalingTiledImageLayer.java | [
"Apache-2.0"
] | Java | composeImageForSector | BufferedImage | public BufferedImage composeImageForSector(Sector sector, int canvasWidth, int canvasHeight, double aspectRatio,
int levelNumber, String mimeType, boolean abortOnError, BufferedImage image, int timeout) throws Exception
{
if (sector == null)
{
String message = Logging.getMessage("nullValue.SectorIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (!this.levels.getSector().intersects(sector))
{
Logging.logger().severe(Logging.getMessage("generic.SectorRequestedOutsideCoverageArea", sector,
this.levels.getSector()));
return image;
}
Sector intersection = this.levels.getSector().intersection(sector);
if (levelNumber < 0)
{
levelNumber = this.levels.getLastLevel().getLevelNumber();
}
else if (levelNumber > this.levels.getLastLevel().getLevelNumber())
{
Logging.logger().warning(Logging.getMessage("generic.LevelRequestedGreaterThanMaxLevel",
levelNumber, this.levels.getLastLevel().getLevelNumber()));
levelNumber = this.levels.getLastLevel().getLevelNumber();
}
int numTiles = 0;
TextureTile[][] tiles = this.getTilesInSector(sector, levelNumber);
for (TextureTile[] row : tiles)
{
numTiles += row.length;
}
if (tiles.length == 0 || tiles[0].length == 0)
{
Logging.logger().severe(Logging.getMessage("layers.TiledImageLayer.NoImagesAvailable"));
return null;
}
if (image == null)
image = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB);
double tileCount = 0;
for (TextureTile[] row : tiles)
{
for (TextureTile tile : row)
{
if (tile == null)
continue;
BufferedImage tileImage;
try
{
tileImage = this.getImage(tile, mimeType, timeout);
Thread.sleep(1); // generates InterruptedException if thread has been interupted
if (tileImage != null)
ImageUtil.mergeImage(sector, tile.getSector(), aspectRatio, tileImage, image);
this.firePropertyChange(AVKey.PROGRESS, tileCount / numTiles, ++tileCount / numTiles);
}
catch (InterruptedException e)
{
throw e;
}
catch (InterruptedIOException e)
{
throw e;
}
catch (Exception e)
{
if (abortOnError)
throw e;
String message = Logging.getMessage("generic.ExceptionWhileRequestingImage", tile.getPath());
Logging.logger().log(java.util.logging.Level.WARNING, message, e);
}
}
}
return image;
} | /**
* Create an image for the portion of this layer lying within a specified sector. The image is created at a
* specified aspect ratio within a canvas of a specified size.
*
* @param sector the sector of interest.
* @param canvasWidth the width of the canvas.
* @param canvasHeight the height of the canvas.
* @param aspectRatio the aspect ratio, width/height, of the window. If the aspect ratio is greater or equal to
* one, the full width of the canvas is used for the image; the height used is proportional to
* the inverse of the aspect ratio. If the aspect ratio is less than one, the full height of the
* canvas is used, and the width used is proportional to the aspect ratio.
* @param levelNumber the target level of the tiled image layer.
* @param mimeType the type of image to create, e.g., "png" and "jpg".
* @param abortOnError indicates whether to stop assembling the image if an error occurs. If false, processing
* continues until all portions of the layer that intersect the specified sector have been added
* to the image. Portions for which an error occurs will be blank.
* @param image if non-null, a {@link BufferedImage} in which to place the image. If null, a new buffered
* image is created. The image must be the width and height specified in the
* <code>canvasWidth</code> and <code>canvasHeight</code> arguments.
* @param timeout The amount of time to allow for reading the image from the server.
*
* @return image the assembelled image, of size indicated by the <code>canvasWidth</code> and
* <code>canvasHeight</code>. If the specified aspect ratio is one, all pixels contain values. If the aspect
* ratio is greater than one, a full-width segment along the top of the canvas is blank. If the aspect ratio
* is less than one, a full-height segment along the right side of the canvase is blank. If the
* <code>image</code> argument was non-null, that buffered image is returned.
*
* @throws IllegalArgumentException if <code>sector</code> is null.
* @see ImageUtil#mergeImage ;
*/ | Create an image for the portion of this layer lying within a specified sector. The image is created at a
specified aspect ratio within a canvas of a specified size.
@param sector the sector of interest.
@param canvasWidth the width of the canvas.
@param canvasHeight the height of the canvas.
@param aspectRatio the aspect ratio, width/height, of the window. If the aspect ratio is greater or equal to
one, the full width of the canvas is used for the image; the height used is proportional to
the inverse of the aspect ratio. If the aspect ratio is less than one, the full height of the
canvas is used, and the width used is proportional to the aspect ratio.
@param levelNumber the target level of the tiled image layer.
@param mimeType the type of image to create, e.g., "png" and "jpg".
@param abortOnError indicates whether to stop assembling the image if an error occurs. If false, processing
continues until all portions of the layer that intersect the specified sector have been added
to the image. Portions for which an error occurs will be blank.
@param image if non-null, a BufferedImage in which to place the image. If null, a new buffered
image is created. The image must be the width and height specified in the
canvasWidth and canvasHeight arguments.
@param timeout The amount of time to allow for reading the image from the server.
@return image the assembelled image, of size indicated by the canvasWidth and
canvasHeight. If the specified aspect ratio is one, all pixels contain values. If the aspect
ratio is greater than one, a full-width segment along the top of the canvas is blank. If the aspect ratio
is less than one, a full-height segment along the right side of the canvase is blank. If the
image argument was non-null, that buffered image is returned.
@throws IllegalArgumentException if sector is null. | [
"Create",
"an",
"image",
"for",
"the",
"portion",
"of",
"this",
"layer",
"lying",
"within",
"a",
"specified",
"sector",
".",
"The",
"image",
"is",
"created",
"at",
"a",
"specified",
"aspect",
"ratio",
"within",
"a",
"canvas",
"of",
"a",
"specified",
"size",
".",
"@param",
"sector",
"the",
"sector",
"of",
"interest",
".",
"@param",
"canvasWidth",
"the",
"width",
"of",
"the",
"canvas",
".",
"@param",
"canvasHeight",
"the",
"height",
"of",
"the",
"canvas",
".",
"@param",
"aspectRatio",
"the",
"aspect",
"ratio",
"width",
"/",
"height",
"of",
"the",
"window",
".",
"If",
"the",
"aspect",
"ratio",
"is",
"greater",
"or",
"equal",
"to",
"one",
"the",
"full",
"width",
"of",
"the",
"canvas",
"is",
"used",
"for",
"the",
"image",
";",
"the",
"height",
"used",
"is",
"proportional",
"to",
"the",
"inverse",
"of",
"the",
"aspect",
"ratio",
".",
"If",
"the",
"aspect",
"ratio",
"is",
"less",
"than",
"one",
"the",
"full",
"height",
"of",
"the",
"canvas",
"is",
"used",
"and",
"the",
"width",
"used",
"is",
"proportional",
"to",
"the",
"aspect",
"ratio",
".",
"@param",
"levelNumber",
"the",
"target",
"level",
"of",
"the",
"tiled",
"image",
"layer",
".",
"@param",
"mimeType",
"the",
"type",
"of",
"image",
"to",
"create",
"e",
".",
"g",
".",
"\"",
"png",
"\"",
"and",
"\"",
"jpg",
"\"",
".",
"@param",
"abortOnError",
"indicates",
"whether",
"to",
"stop",
"assembling",
"the",
"image",
"if",
"an",
"error",
"occurs",
".",
"If",
"false",
"processing",
"continues",
"until",
"all",
"portions",
"of",
"the",
"layer",
"that",
"intersect",
"the",
"specified",
"sector",
"have",
"been",
"added",
"to",
"the",
"image",
".",
"Portions",
"for",
"which",
"an",
"error",
"occurs",
"will",
"be",
"blank",
".",
"@param",
"image",
"if",
"non",
"-",
"null",
"a",
"BufferedImage",
"in",
"which",
"to",
"place",
"the",
"image",
".",
"If",
"null",
"a",
"new",
"buffered",
"image",
"is",
"created",
".",
"The",
"image",
"must",
"be",
"the",
"width",
"and",
"height",
"specified",
"in",
"the",
"canvasWidth",
"and",
"canvasHeight",
"arguments",
".",
"@param",
"timeout",
"The",
"amount",
"of",
"time",
"to",
"allow",
"for",
"reading",
"the",
"image",
"from",
"the",
"server",
".",
"@return",
"image",
"the",
"assembelled",
"image",
"of",
"size",
"indicated",
"by",
"the",
"canvasWidth",
"and",
"canvasHeight",
".",
"If",
"the",
"specified",
"aspect",
"ratio",
"is",
"one",
"all",
"pixels",
"contain",
"values",
".",
"If",
"the",
"aspect",
"ratio",
"is",
"greater",
"than",
"one",
"a",
"full",
"-",
"width",
"segment",
"along",
"the",
"top",
"of",
"the",
"canvas",
"is",
"blank",
".",
"If",
"the",
"aspect",
"ratio",
"is",
"less",
"than",
"one",
"a",
"full",
"-",
"height",
"segment",
"along",
"the",
"right",
"side",
"of",
"the",
"canvase",
"is",
"blank",
".",
"If",
"the",
"image",
"argument",
"was",
"non",
"-",
"null",
"that",
"buffered",
"image",
"is",
"returned",
".",
"@throws",
"IllegalArgumentException",
"if",
"sector",
"is",
"null",
"."
] | public BufferedImage composeImageForSector(Sector sector, int canvasWidth, int canvasHeight, double aspectRatio,
int levelNumber, String mimeType, boolean abortOnError, BufferedImage image, int timeout) throws Exception
{
if (sector == null)
{
String message = Logging.getMessage("nullValue.SectorIsNull");
Logging.logger().severe(message);
throw new IllegalArgumentException(message);
}
if (!this.levels.getSector().intersects(sector))
{
Logging.logger().severe(Logging.getMessage("generic.SectorRequestedOutsideCoverageArea", sector,
this.levels.getSector()));
return image;
}
Sector intersection = this.levels.getSector().intersection(sector);
if (levelNumber < 0)
{
levelNumber = this.levels.getLastLevel().getLevelNumber();
}
else if (levelNumber > this.levels.getLastLevel().getLevelNumber())
{
Logging.logger().warning(Logging.getMessage("generic.LevelRequestedGreaterThanMaxLevel",
levelNumber, this.levels.getLastLevel().getLevelNumber()));
levelNumber = this.levels.getLastLevel().getLevelNumber();
}
int numTiles = 0;
TextureTile[][] tiles = this.getTilesInSector(sector, levelNumber);
for (TextureTile[] row : tiles)
{
numTiles += row.length;
}
if (tiles.length == 0 || tiles[0].length == 0)
{
Logging.logger().severe(Logging.getMessage("layers.TiledImageLayer.NoImagesAvailable"));
return null;
}
if (image == null)
image = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_RGB);
double tileCount = 0;
for (TextureTile[] row : tiles)
{
for (TextureTile tile : row)
{
if (tile == null)
continue;
BufferedImage tileImage;
try
{
tileImage = this.getImage(tile, mimeType, timeout);
Thread.sleep(1);
if (tileImage != null)
ImageUtil.mergeImage(sector, tile.getSector(), aspectRatio, tileImage, image);
this.firePropertyChange(AVKey.PROGRESS, tileCount / numTiles, ++tileCount / numTiles);
}
catch (InterruptedException e)
{
throw e;
}
catch (InterruptedIOException e)
{
throw e;
}
catch (Exception e)
{
if (abortOnError)
throw e;
String message = Logging.getMessage("generic.ExceptionWhileRequestingImage", tile.getPath());
Logging.logger().log(java.util.logging.Level.WARNING, message, e);
}
}
}
return image;
} | [
"public",
"BufferedImage",
"composeImageForSector",
"(",
"Sector",
"sector",
",",
"int",
"canvasWidth",
",",
"int",
"canvasHeight",
",",
"double",
"aspectRatio",
",",
"int",
"levelNumber",
",",
"String",
"mimeType",
",",
"boolean",
"abortOnError",
",",
"BufferedImage",
"image",
",",
"int",
"timeout",
")",
"throws",
"Exception",
"{",
"if",
"(",
"sector",
"==",
"null",
")",
"{",
"String",
"message",
"=",
"Logging",
".",
"getMessage",
"(",
"\"nullValue.SectorIsNull\"",
")",
";",
"Logging",
".",
"logger",
"(",
")",
".",
"severe",
"(",
"message",
")",
";",
"throw",
"new",
"IllegalArgumentException",
"(",
"message",
")",
";",
"}",
"if",
"(",
"!",
"this",
".",
"levels",
".",
"getSector",
"(",
")",
".",
"intersects",
"(",
"sector",
")",
")",
"{",
"Logging",
".",
"logger",
"(",
")",
".",
"severe",
"(",
"Logging",
".",
"getMessage",
"(",
"\"generic.SectorRequestedOutsideCoverageArea\"",
",",
"sector",
",",
"this",
".",
"levels",
".",
"getSector",
"(",
")",
")",
")",
";",
"return",
"image",
";",
"}",
"Sector",
"intersection",
"=",
"this",
".",
"levels",
".",
"getSector",
"(",
")",
".",
"intersection",
"(",
"sector",
")",
";",
"if",
"(",
"levelNumber",
"<",
"0",
")",
"{",
"levelNumber",
"=",
"this",
".",
"levels",
".",
"getLastLevel",
"(",
")",
".",
"getLevelNumber",
"(",
")",
";",
"}",
"else",
"if",
"(",
"levelNumber",
">",
"this",
".",
"levels",
".",
"getLastLevel",
"(",
")",
".",
"getLevelNumber",
"(",
")",
")",
"{",
"Logging",
".",
"logger",
"(",
")",
".",
"warning",
"(",
"Logging",
".",
"getMessage",
"(",
"\"generic.LevelRequestedGreaterThanMaxLevel\"",
",",
"levelNumber",
",",
"this",
".",
"levels",
".",
"getLastLevel",
"(",
")",
".",
"getLevelNumber",
"(",
")",
")",
")",
";",
"levelNumber",
"=",
"this",
".",
"levels",
".",
"getLastLevel",
"(",
")",
".",
"getLevelNumber",
"(",
")",
";",
"}",
"int",
"numTiles",
"=",
"0",
";",
"TextureTile",
"[",
"]",
"[",
"]",
"tiles",
"=",
"this",
".",
"getTilesInSector",
"(",
"sector",
",",
"levelNumber",
")",
";",
"for",
"(",
"TextureTile",
"[",
"]",
"row",
":",
"tiles",
")",
"{",
"numTiles",
"+=",
"row",
".",
"length",
";",
"}",
"if",
"(",
"tiles",
".",
"length",
"==",
"0",
"||",
"tiles",
"[",
"0",
"]",
".",
"length",
"==",
"0",
")",
"{",
"Logging",
".",
"logger",
"(",
")",
".",
"severe",
"(",
"Logging",
".",
"getMessage",
"(",
"\"layers.TiledImageLayer.NoImagesAvailable\"",
")",
")",
";",
"return",
"null",
";",
"}",
"if",
"(",
"image",
"==",
"null",
")",
"image",
"=",
"new",
"BufferedImage",
"(",
"canvasWidth",
",",
"canvasHeight",
",",
"BufferedImage",
".",
"TYPE_INT_RGB",
")",
";",
"double",
"tileCount",
"=",
"0",
";",
"for",
"(",
"TextureTile",
"[",
"]",
"row",
":",
"tiles",
")",
"{",
"for",
"(",
"TextureTile",
"tile",
":",
"row",
")",
"{",
"if",
"(",
"tile",
"==",
"null",
")",
"continue",
";",
"BufferedImage",
"tileImage",
";",
"try",
"{",
"tileImage",
"=",
"this",
".",
"getImage",
"(",
"tile",
",",
"mimeType",
",",
"timeout",
")",
";",
"Thread",
".",
"sleep",
"(",
"1",
")",
";",
"if",
"(",
"tileImage",
"!=",
"null",
")",
"ImageUtil",
".",
"mergeImage",
"(",
"sector",
",",
"tile",
".",
"getSector",
"(",
")",
",",
"aspectRatio",
",",
"tileImage",
",",
"image",
")",
";",
"this",
".",
"firePropertyChange",
"(",
"AVKey",
".",
"PROGRESS",
",",
"tileCount",
"/",
"numTiles",
",",
"++",
"tileCount",
"/",
"numTiles",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"InterruptedIOException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"if",
"(",
"abortOnError",
")",
"throw",
"e",
";",
"String",
"message",
"=",
"Logging",
".",
"getMessage",
"(",
"\"generic.ExceptionWhileRequestingImage\"",
",",
"tile",
".",
"getPath",
"(",
")",
")",
";",
"Logging",
".",
"logger",
"(",
")",
".",
"log",
"(",
"java",
".",
"util",
".",
"logging",
".",
"Level",
".",
"WARNING",
",",
"message",
",",
"e",
")",
";",
"}",
"}",
"}",
"return",
"image",
";",
"}"
] | Create an image for the portion of this layer lying within a specified sector. | [
"Create",
"an",
"image",
"for",
"the",
"portion",
"of",
"this",
"layer",
"lying",
"within",
"a",
"specified",
"sector",
"."
] | [
"// generates InterruptedException if thread has been interupted\r"
] | [
{
"param": "sector",
"type": "Sector"
},
{
"param": "canvasWidth",
"type": "int"
},
{
"param": "canvasHeight",
"type": "int"
},
{
"param": "aspectRatio",
"type": "double"
},
{
"param": "levelNumber",
"type": "int"
},
{
"param": "mimeType",
"type": "String"
},
{
"param": "abortOnError",
"type": "boolean"
},
{
"param": "image",
"type": "BufferedImage"
},
{
"param": "timeout",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sector",
"type": "Sector",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "canvasWidth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "canvasHeight",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "aspectRatio",
"type": "double",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "levelNumber",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mimeType",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "abortOnError",
"type": "boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "image",
"type": "BufferedImage",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "timeout",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
12362,
11458,
2040,
1290,
55,
1229,
12,
55,
1229,
16323,
16,
509,
5953,
2384,
16,
509,
5953,
2686,
16,
1645,
9648,
8541,
16,
206,
203,
202,
202,
474,
1801,
1854,
16,
514,
10707,
16,
1250,
6263,
11427,
16,
12362,
1316,
16,
509,
2021,
13,
1216,
1185,
206,
203,
202,
95,
206,
203,
202,
202,
430,
261,
5709,
280,
422,
446,
13,
206,
203,
202,
202,
95,
206,
203,
1082,
202,
780,
883,
273,
10253,
18,
24906,
2932,
2011,
620,
18,
55,
1229,
2520,
2041,
8863,
206,
203,
1082,
202,
7735,
18,
4901,
7675,
307,
502,
73,
12,
2150,
1769,
206,
203,
1082,
202,
12849,
394,
2754,
12,
2150,
1769,
206,
203,
202,
202,
97,
206,
203,
206,
203,
3639,
309,
16051,
2211,
18,
12095,
18,
588,
55,
1229,
7675,
12288,
87,
12,
5709,
280,
3719,
206,
203,
3639,
288,
206,
203,
5411,
10253,
18,
4901,
7675,
307,
502,
73,
12,
7735,
18,
24906,
2932,
13540,
18,
55,
1229,
11244,
28018,
9739,
5484,
3113,
16323,
16,
206,
203,
7734,
333,
18,
12095,
18,
588,
55,
1229,
1435,
10019,
206,
203,
5411,
327,
1316,
31,
206,
203,
3639,
289,
206,
203,
206,
203,
3639,
348,
1229,
7619,
273,
333,
18,
12095,
18,
588,
55,
1229,
7675,
30231,
12,
5709,
280,
1769,
206,
203,
540,
206,
203,
202,
202,
430,
261,
2815,
1854,
411,
374,
13,
206,
203,
202,
202,
95,
206,
203,
1082,
202,
2815,
1854,
273,
333,
18,
12095,
18,
588,
3024,
2355,
7675,
588,
2355,
1854,
5621,
206,
203,
202,
202,
97,
206,
203,
202,
202,
12107,
309,
261,
2815,
1854,
405,
333,
18,
12095,
18,
588,
3024,
2355,
7675,
588,
2355,
1854,
10756,
206,
203,
202,
202,
95,
206,
203,
1082,
202,
7735,
18,
4901,
7675,
8551,
12,
7735,
18,
24906,
2932,
13540,
18,
2355,
11244,
28130,
2747,
2355,
3113,
206,
203,
9506,
202,
2815,
1854,
16,
333,
18,
12095,
18,
588,
3024,
2355,
7675,
588,
2355,
1854,
1435,
10019,
206,
203,
1082,
202,
2815,
1854,
273,
333,
18,
12095,
18,
588,
3024,
2355,
7675,
588,
2355,
1854,
5621,
206,
203,
202,
202,
97,
206,
203,
206,
203,
202,
202,
474,
818,
27669,
273,
374,
31,
206,
203,
202,
202,
10967,
9337,
63,
6362,
65,
12568,
273,
333,
18,
588,
27669,
382,
55,
1229,
12,
5709,
280,
16,
1801,
1854,
1769,
206,
203,
202,
202,
1884,
261,
10967,
9337,
8526,
1027,
294,
12568,
13,
206,
203,
202,
202,
95,
206,
203,
1082,
202,
2107,
27669,
1011,
1027,
18,
2469,
31,
206,
203,
202,
202,
97,
206,
203,
206,
203,
202,
202,
430,
261,
28366,
18,
2469,
422,
374,
747,
12568,
63,
20,
8009,
2469,
422,
374,
13,
206,
203,
202,
202,
95,
206,
203,
1082,
202,
7735,
18,
4901,
7675,
307,
502,
73,
12,
7735,
18,
24906,
2932,
10396,
18,
56,
1411,
2040,
4576,
18,
2279,
8946,
5268,
7923,
1769,
206,
203,
1082,
202,
2463,
446,
31,
206,
203,
202,
202,
97,
206,
203,
206,
203,
202,
202,
430,
261,
2730,
422,
446,
13,
206,
203,
1082,
202,
2730,
273,
394,
12362,
12,
15424,
2
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
206,
203,
225,
202,
14,
632,
891,
16323,
565,
202,
5787,
16323,
434,
16513,
18,
206,
203,
225,
202,
14,
632,
891,
5953,
2384,
225,
326,
1835,
434,
326,
5953,
18,
206,
203,
225,
202,
14,
632,
891,
5953,
2686,
326,
2072,
434,
326,
5953,
18,
206,
203,
225,
202,
14,
632,
891,
9648,
8541,
225,
326,
9648,
7169,
16,
1835,
19,
4210,
16,
434,
326,
2742,
18,
971,
326,
9648,
7169,
353,
6802,
578,
3959,
358,
2
] |
d1541c14e7dcf5fa66d9ee147328832303095570 | y12uc231/FR | android/FaceRecApp/app/src/main/java/org/bytefish/facerecapp/app/ImageHelper.java | [
"BSD-3-Clause"
] | Java | cropFace | Bitmap | public static Bitmap cropFace(Bitmap originalBitmap, FaceDetector.Face face) {
// Get face midpoint:
PointF faceMidPoint = new PointF();
face.getMidPoint(faceMidPoint);
float faceEyesDistance = face.eyesDistance();
// Get rectangle:
int x0 = (int) (faceMidPoint.x - faceEyesDistance * 2);
int y0 = (int) (faceMidPoint.y - faceEyesDistance * 2);
int x1 = (int) (faceMidPoint.x + faceEyesDistance * 2);
int y1 = (int) (faceMidPoint.y + faceEyesDistance * 2);
// Clip to image boundaries
x0 = Math.max(x0, 0);
y0 = Math.max(y0, 0);
x1 = Math.min(x1, originalBitmap.getWidth());
y1 = Math.min(y1, originalBitmap.getHeight());
return Bitmap.createBitmap(originalBitmap, x0, y0, x1, y1);
} | /**
* @param originalBitmap Image to crop the face image from.
* @param face Landmarks found by Androids FaceDetector.
* @return
*/ | @param originalBitmap Image to crop the face image from.
@param face Landmarks found by Androids FaceDetector.
@return | [
"@param",
"originalBitmap",
"Image",
"to",
"crop",
"the",
"face",
"image",
"from",
".",
"@param",
"face",
"Landmarks",
"found",
"by",
"Androids",
"FaceDetector",
".",
"@return"
] | public static Bitmap cropFace(Bitmap originalBitmap, FaceDetector.Face face) {
PointF faceMidPoint = new PointF();
face.getMidPoint(faceMidPoint);
float faceEyesDistance = face.eyesDistance();
int x0 = (int) (faceMidPoint.x - faceEyesDistance * 2);
int y0 = (int) (faceMidPoint.y - faceEyesDistance * 2);
int x1 = (int) (faceMidPoint.x + faceEyesDistance * 2);
int y1 = (int) (faceMidPoint.y + faceEyesDistance * 2);
x0 = Math.max(x0, 0);
y0 = Math.max(y0, 0);
x1 = Math.min(x1, originalBitmap.getWidth());
y1 = Math.min(y1, originalBitmap.getHeight());
return Bitmap.createBitmap(originalBitmap, x0, y0, x1, y1);
} | [
"public",
"static",
"Bitmap",
"cropFace",
"(",
"Bitmap",
"originalBitmap",
",",
"FaceDetector",
".",
"Face",
"face",
")",
"{",
"PointF",
"faceMidPoint",
"=",
"new",
"PointF",
"(",
")",
";",
"face",
".",
"getMidPoint",
"(",
"faceMidPoint",
")",
";",
"float",
"faceEyesDistance",
"=",
"face",
".",
"eyesDistance",
"(",
")",
";",
"int",
"x0",
"=",
"(",
"int",
")",
"(",
"faceMidPoint",
".",
"x",
"-",
"faceEyesDistance",
"*",
"2",
")",
";",
"int",
"y0",
"=",
"(",
"int",
")",
"(",
"faceMidPoint",
".",
"y",
"-",
"faceEyesDistance",
"*",
"2",
")",
";",
"int",
"x1",
"=",
"(",
"int",
")",
"(",
"faceMidPoint",
".",
"x",
"+",
"faceEyesDistance",
"*",
"2",
")",
";",
"int",
"y1",
"=",
"(",
"int",
")",
"(",
"faceMidPoint",
".",
"y",
"+",
"faceEyesDistance",
"*",
"2",
")",
";",
"x0",
"=",
"Math",
".",
"max",
"(",
"x0",
",",
"0",
")",
";",
"y0",
"=",
"Math",
".",
"max",
"(",
"y0",
",",
"0",
")",
";",
"x1",
"=",
"Math",
".",
"min",
"(",
"x1",
",",
"originalBitmap",
".",
"getWidth",
"(",
")",
")",
";",
"y1",
"=",
"Math",
".",
"min",
"(",
"y1",
",",
"originalBitmap",
".",
"getHeight",
"(",
")",
")",
";",
"return",
"Bitmap",
".",
"createBitmap",
"(",
"originalBitmap",
",",
"x0",
",",
"y0",
",",
"x1",
",",
"y1",
")",
";",
"}"
] | @param originalBitmap Image to crop the face image from. | [
"@param",
"originalBitmap",
"Image",
"to",
"crop",
"the",
"face",
"image",
"from",
"."
] | [
"// Get face midpoint:",
"// Get rectangle:",
"// Clip to image boundaries"
] | [
{
"param": "originalBitmap",
"type": "Bitmap"
},
{
"param": "face",
"type": "FaceDetector.Face"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "originalBitmap",
"type": "Bitmap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "face",
"type": "FaceDetector.Face",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
14764,
7987,
11824,
12,
12224,
2282,
12224,
16,
15325,
12594,
18,
11824,
7945,
13,
288,
203,
3639,
368,
968,
7945,
7501,
1153,
30,
203,
3639,
4686,
42,
7945,
20711,
2148,
273,
394,
4686,
42,
5621,
203,
3639,
7945,
18,
588,
20711,
2148,
12,
865,
20711,
2148,
1769,
203,
3639,
1431,
7945,
41,
9707,
7200,
273,
7945,
18,
402,
281,
7200,
5621,
203,
203,
3639,
368,
968,
11845,
30,
203,
3639,
509,
619,
20,
273,
261,
474,
13,
261,
865,
20711,
2148,
18,
92,
300,
7945,
41,
9707,
7200,
380,
576,
1769,
203,
3639,
509,
677,
20,
273,
261,
474,
13,
261,
865,
20711,
2148,
18,
93,
300,
7945,
41,
9707,
7200,
380,
576,
1769,
203,
3639,
509,
619,
21,
273,
261,
474,
13,
261,
865,
20711,
2148,
18,
92,
397,
7945,
41,
9707,
7200,
380,
576,
1769,
203,
3639,
509,
677,
21,
273,
261,
474,
13,
261,
865,
20711,
2148,
18,
93,
397,
7945,
41,
9707,
7200,
380,
576,
1769,
203,
203,
3639,
368,
385,
3169,
358,
1316,
15054,
203,
3639,
619,
20,
273,
2361,
18,
1896,
12,
92,
20,
16,
374,
1769,
203,
3639,
677,
20,
273,
2361,
18,
1896,
12,
93,
20,
16,
374,
1769,
203,
3639,
619,
21,
273,
2361,
18,
1154,
12,
92,
21,
16,
2282,
12224,
18,
588,
2384,
10663,
203,
3639,
677,
21,
273,
2361,
18,
1154,
12,
93,
21,
16,
2282,
12224,
18,
588,
2686,
10663,
203,
203,
3639,
327,
14764,
18,
2640,
12224,
12,
8830,
12224,
16,
619,
20,
16,
677,
20,
16,
619,
21,
16,
677,
21,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
632,
891,
2282,
12224,
3421,
358,
7987,
326,
7945,
1316,
628,
18,
203,
377,
380,
632,
891,
7945,
6647,
511,
464,
17439,
1392,
635,
7835,
17694,
15325,
12594,
18,
203,
377,
380,
632,
2463,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d1541c14e7dcf5fa66d9ee147328832303095570 | y12uc231/FR | android/FaceRecApp/app/src/main/java/org/bytefish/facerecapp/app/ImageHelper.java | [
"BSD-3-Clause"
] | Java | rotateBitmap | Bitmap | public static Bitmap rotateBitmap(Bitmap originalBitmap, int cx, int cy, int angle) {
Matrix rotMatrix = new Matrix();
rotMatrix.postRotate(angle, cx, cy);
return Bitmap.createBitmap(originalBitmap, 0, 0, originalBitmap.getWidth(), originalBitmap.getHeight(), rotMatrix, true);
} | /**
* Rotates a Bitmap for a given angle and rotation center.
*
* @param originalBitmap
* @param cx
* @param cy
* @param angle
* @return
*/ | Rotates a Bitmap for a given angle and rotation center. | [
"Rotates",
"a",
"Bitmap",
"for",
"a",
"given",
"angle",
"and",
"rotation",
"center",
"."
] | public static Bitmap rotateBitmap(Bitmap originalBitmap, int cx, int cy, int angle) {
Matrix rotMatrix = new Matrix();
rotMatrix.postRotate(angle, cx, cy);
return Bitmap.createBitmap(originalBitmap, 0, 0, originalBitmap.getWidth(), originalBitmap.getHeight(), rotMatrix, true);
} | [
"public",
"static",
"Bitmap",
"rotateBitmap",
"(",
"Bitmap",
"originalBitmap",
",",
"int",
"cx",
",",
"int",
"cy",
",",
"int",
"angle",
")",
"{",
"Matrix",
"rotMatrix",
"=",
"new",
"Matrix",
"(",
")",
";",
"rotMatrix",
".",
"postRotate",
"(",
"angle",
",",
"cx",
",",
"cy",
")",
";",
"return",
"Bitmap",
".",
"createBitmap",
"(",
"originalBitmap",
",",
"0",
",",
"0",
",",
"originalBitmap",
".",
"getWidth",
"(",
")",
",",
"originalBitmap",
".",
"getHeight",
"(",
")",
",",
"rotMatrix",
",",
"true",
")",
";",
"}"
] | Rotates a Bitmap for a given angle and rotation center. | [
"Rotates",
"a",
"Bitmap",
"for",
"a",
"given",
"angle",
"and",
"rotation",
"center",
"."
] | [] | [
{
"param": "originalBitmap",
"type": "Bitmap"
},
{
"param": "cx",
"type": "int"
},
{
"param": "cy",
"type": "int"
},
{
"param": "angle",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "originalBitmap",
"type": "Bitmap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cx",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cy",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "angle",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
14764,
8534,
12224,
12,
12224,
2282,
12224,
16,
509,
9494,
16,
509,
6143,
16,
509,
5291,
13,
288,
203,
3639,
7298,
4168,
4635,
273,
394,
7298,
5621,
203,
3639,
4168,
4635,
18,
2767,
16357,
12,
4341,
16,
9494,
16,
6143,
1769,
203,
3639,
327,
14764,
18,
2640,
12224,
12,
8830,
12224,
16,
374,
16,
374,
16,
2282,
12224,
18,
588,
2384,
9334,
2282,
12224,
18,
588,
2686,
9334,
4168,
4635,
16,
638,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
15697,
815,
279,
14764,
364,
279,
864,
5291,
471,
6752,
4617,
18,
203,
377,
380,
203,
377,
380,
632,
891,
2282,
12224,
203,
377,
380,
632,
891,
9494,
203,
377,
380,
632,
891,
6143,
203,
377,
380,
632,
891,
5291,
203,
377,
380,
632,
2463,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d1541c14e7dcf5fa66d9ee147328832303095570 | y12uc231/FR | android/FaceRecApp/app/src/main/java/org/bytefish/facerecapp/app/ImageHelper.java | [
"BSD-3-Clause"
] | Java | readBitmapFromFile | Bitmap | public static Bitmap readBitmapFromFile(String fileName) {
BitmapFactory.Options bitmapFatoryOptions = new BitmapFactory.Options();
bitmapFatoryOptions.inPreferredConfig = Bitmap.Config.RGB_565;
return BitmapFactory.decodeFile(fileName, bitmapFatoryOptions);
} | /**
* Reads an image into a Bitmap.
*
* @param fileName Filename of the given image
* @return image in Bitmap representation
*/ | Reads an image into a Bitmap.
@param fileName Filename of the given image
@return image in Bitmap representation | [
"Reads",
"an",
"image",
"into",
"a",
"Bitmap",
".",
"@param",
"fileName",
"Filename",
"of",
"the",
"given",
"image",
"@return",
"image",
"in",
"Bitmap",
"representation"
] | public static Bitmap readBitmapFromFile(String fileName) {
BitmapFactory.Options bitmapFatoryOptions = new BitmapFactory.Options();
bitmapFatoryOptions.inPreferredConfig = Bitmap.Config.RGB_565;
return BitmapFactory.decodeFile(fileName, bitmapFatoryOptions);
} | [
"public",
"static",
"Bitmap",
"readBitmapFromFile",
"(",
"String",
"fileName",
")",
"{",
"BitmapFactory",
".",
"Options",
"bitmapFatoryOptions",
"=",
"new",
"BitmapFactory",
".",
"Options",
"(",
")",
";",
"bitmapFatoryOptions",
".",
"inPreferredConfig",
"=",
"Bitmap",
".",
"Config",
".",
"RGB_565",
";",
"return",
"BitmapFactory",
".",
"decodeFile",
"(",
"fileName",
",",
"bitmapFatoryOptions",
")",
";",
"}"
] | Reads an image into a Bitmap. | [
"Reads",
"an",
"image",
"into",
"a",
"Bitmap",
"."
] | [] | [
{
"param": "fileName",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fileName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
14764,
855,
12224,
13087,
12,
780,
3968,
13,
288,
203,
3639,
14764,
1733,
18,
1320,
9389,
42,
8452,
1320,
273,
394,
14764,
1733,
18,
1320,
5621,
203,
3639,
9389,
42,
8452,
1320,
18,
267,
16028,
809,
273,
14764,
18,
809,
18,
11343,
67,
4313,
25,
31,
203,
3639,
327,
14764,
1733,
18,
3922,
812,
12,
17812,
16,
9389,
42,
8452,
1320,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
29185,
392,
1316,
1368,
279,
14764,
18,
203,
377,
380,
203,
377,
380,
632,
891,
3968,
16671,
434,
326,
864,
1316,
203,
377,
380,
632,
2463,
1316,
316,
14764,
4335,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d1541c14e7dcf5fa66d9ee147328832303095570 | y12uc231/FR | android/FaceRecApp/app/src/main/java/org/bytefish/facerecapp/app/ImageHelper.java | [
"BSD-3-Clause"
] | Java | saveBitmapAsJpegToExternalStorage | null | public static boolean saveBitmapAsJpegToExternalStorage(Bitmap bitmap, String fileName) {
File im_dir = getImageDirectory();
File im_file = new File(im_dir, fileName);
return saveBitmapAsJpeg(bitmap, im_file);
} | /**
* Saves a bitmap to the external storage. Please note, that you need the following
* permission in your AndroidManifest.xml:
* <p/>
* <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
*
* @param bitmap
* @param fileName
* @return
*/ | Saves a bitmap to the external storage. Please note, that you need the following
permission in your AndroidManifest.xml:
@param bitmap
@param fileName
@return | [
"Saves",
"a",
"bitmap",
"to",
"the",
"external",
"storage",
".",
"Please",
"note",
"that",
"you",
"need",
"the",
"following",
"permission",
"in",
"your",
"AndroidManifest",
".",
"xml",
":",
"@param",
"bitmap",
"@param",
"fileName",
"@return"
] | public static boolean saveBitmapAsJpegToExternalStorage(Bitmap bitmap, String fileName) {
File im_dir = getImageDirectory();
File im_file = new File(im_dir, fileName);
return saveBitmapAsJpeg(bitmap, im_file);
} | [
"public",
"static",
"boolean",
"saveBitmapAsJpegToExternalStorage",
"(",
"Bitmap",
"bitmap",
",",
"String",
"fileName",
")",
"{",
"File",
"im_dir",
"=",
"getImageDirectory",
"(",
")",
";",
"File",
"im_file",
"=",
"new",
"File",
"(",
"im_dir",
",",
"fileName",
")",
";",
"return",
"saveBitmapAsJpeg",
"(",
"bitmap",
",",
"im_file",
")",
";",
"}"
] | Saves a bitmap to the external storage. | [
"Saves",
"a",
"bitmap",
"to",
"the",
"external",
"storage",
"."
] | [] | [
{
"param": "bitmap",
"type": "Bitmap"
},
{
"param": "fileName",
"type": "String"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bitmap",
"type": "Bitmap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fileName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
1923,
12224,
1463,
46,
9001,
774,
6841,
3245,
12,
12224,
9389,
16,
514,
3968,
13,
288,
203,
3639,
1387,
709,
67,
1214,
273,
10567,
2853,
5621,
203,
3639,
1387,
709,
67,
768,
273,
394,
1387,
12,
381,
67,
1214,
16,
3968,
1769,
203,
3639,
327,
1923,
12224,
1463,
46,
9001,
12,
3682,
1458,
16,
709,
67,
768,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
348,
6606,
279,
9389,
358,
326,
3903,
2502,
18,
7801,
4721,
16,
716,
1846,
1608,
326,
3751,
203,
377,
380,
4132,
316,
3433,
15288,
9121,
18,
2902,
30,
203,
377,
380,
411,
84,
21259,
203,
377,
380,
411,
6117,
17,
9827,
13911,
30,
529,
1546,
16705,
18,
9827,
18,
11677,
67,
2294,
11702,
67,
19009,
6,
20954,
203,
377,
380,
203,
377,
380,
632,
891,
9389,
203,
377,
380,
632,
891,
3968,
203,
377,
380,
632,
2463,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d1541c14e7dcf5fa66d9ee147328832303095570 | y12uc231/FR | android/FaceRecApp/app/src/main/java/org/bytefish/facerecapp/app/ImageHelper.java | [
"BSD-3-Clause"
] | Java | saveBitmapAsJpeg | null | public static boolean saveBitmapAsJpeg(Bitmap bitmap, File file) {
FileOutputStream out = null;
try {
// Overwrite the existing bitmap?
out = new FileOutputStream(file, false);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
out.flush();
} catch (IOException e) {
Log.e(TAG, "Could not save the image!", e);
return false;
} finally {
// Be sure to close the IO handle:
if (out != null) {
try {
out.close();
} catch (IOException e) {
// We can safely ignore this case!
}
}
}
return true;
} | /**
* Stores a Bitmap as a JPEG (with 90% Quality). This function should belong to
* a class, which is configurable in terms of compression method, quality and so
* on.
*
* @param bitmap Bitmap to store
* @param file File to store the image to
* @return Returns the File
*/ | Stores a Bitmap as a JPEG (with 90% Quality). This function should belong to
a class, which is configurable in terms of compression method, quality and so
on.
@param bitmap Bitmap to store
@param file File to store the image to
@return Returns the File | [
"Stores",
"a",
"Bitmap",
"as",
"a",
"JPEG",
"(",
"with",
"90%",
"Quality",
")",
".",
"This",
"function",
"should",
"belong",
"to",
"a",
"class",
"which",
"is",
"configurable",
"in",
"terms",
"of",
"compression",
"method",
"quality",
"and",
"so",
"on",
".",
"@param",
"bitmap",
"Bitmap",
"to",
"store",
"@param",
"file",
"File",
"to",
"store",
"the",
"image",
"to",
"@return",
"Returns",
"the",
"File"
] | public static boolean saveBitmapAsJpeg(Bitmap bitmap, File file) {
FileOutputStream out = null;
try {
out = new FileOutputStream(file, false);
bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out);
out.flush();
} catch (IOException e) {
Log.e(TAG, "Could not save the image!", e);
return false;
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
}
}
}
return true;
} | [
"public",
"static",
"boolean",
"saveBitmapAsJpeg",
"(",
"Bitmap",
"bitmap",
",",
"File",
"file",
")",
"{",
"FileOutputStream",
"out",
"=",
"null",
";",
"try",
"{",
"out",
"=",
"new",
"FileOutputStream",
"(",
"file",
",",
"false",
")",
";",
"bitmap",
".",
"compress",
"(",
"Bitmap",
".",
"CompressFormat",
".",
"JPEG",
",",
"90",
",",
"out",
")",
";",
"out",
".",
"flush",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"Could not save the image!\"",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"finally",
"{",
"if",
"(",
"out",
"!=",
"null",
")",
"{",
"try",
"{",
"out",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"}",
"}",
"}",
"return",
"true",
";",
"}"
] | Stores a Bitmap as a JPEG (with 90% Quality). | [
"Stores",
"a",
"Bitmap",
"as",
"a",
"JPEG",
"(",
"with",
"90%",
"Quality",
")",
"."
] | [
"// Overwrite the existing bitmap?",
"// Be sure to close the IO handle:",
"// We can safely ignore this case!"
] | [
{
"param": "bitmap",
"type": "Bitmap"
},
{
"param": "file",
"type": "File"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "bitmap",
"type": "Bitmap",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "file",
"type": "File",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
1250,
1923,
12224,
1463,
46,
9001,
12,
12224,
9389,
16,
1387,
585,
13,
288,
203,
3639,
12942,
596,
273,
446,
31,
203,
3639,
775,
288,
203,
5411,
368,
29747,
326,
2062,
9389,
35,
203,
5411,
596,
273,
394,
12942,
12,
768,
16,
629,
1769,
203,
5411,
9389,
18,
14706,
12,
12224,
18,
16552,
1630,
18,
28698,
16,
8566,
16,
596,
1769,
203,
5411,
596,
18,
11330,
5621,
203,
3639,
289,
1044,
261,
14106,
425,
13,
288,
203,
5411,
1827,
18,
73,
12,
7927,
16,
315,
4445,
486,
1923,
326,
1316,
5,
3113,
425,
1769,
203,
5411,
327,
629,
31,
203,
3639,
289,
3095,
288,
203,
5411,
368,
4823,
3071,
358,
1746,
326,
1665,
1640,
30,
203,
5411,
309,
261,
659,
480,
446,
13,
288,
203,
7734,
775,
288,
203,
10792,
596,
18,
4412,
5621,
203,
7734,
289,
1044,
261,
14106,
425,
13,
288,
203,
10792,
368,
1660,
848,
15303,
2305,
333,
648,
5,
203,
7734,
289,
203,
5411,
289,
203,
3639,
289,
203,
3639,
327,
638,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
20296,
455,
279,
14764,
487,
279,
28038,
261,
1918,
8566,
9,
4783,
7919,
2934,
1220,
445,
1410,
10957,
358,
203,
377,
380,
279,
667,
16,
1492,
353,
14593,
316,
6548,
434,
9154,
707,
16,
9312,
471,
1427,
203,
377,
380,
603,
18,
203,
377,
380,
203,
377,
380,
632,
891,
9389,
14764,
358,
1707,
203,
377,
380,
632,
891,
585,
282,
1387,
358,
1707,
326,
1316,
358,
203,
377,
380,
632,
2463,
2860,
326,
1387,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d1541c14e7dcf5fa66d9ee147328832303095570 | y12uc231/FR | android/FaceRecApp/app/src/main/java/org/bytefish/facerecapp/app/ImageHelper.java | [
"BSD-3-Clause"
] | Java | loadResizedBitmap | Bitmap | public static Bitmap loadResizedBitmap(String fileName, int reqWidth, int reqHeight) {
// First decode with inJustDecodeBounds=true to check dimensions
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(fileName, options);
// Calculate the maximum inSampleSize larger than the request width/height:
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight) + 1;
// Decode bitmap with inSampleSize set
options.inJustDecodeBounds = false;
options.inPreferredConfig = Bitmap.Config.RGB_565;
Bitmap scaledBitmap = BitmapFactory.decodeFile(fileName, options);
if (scaledBitmap.getHeight() > reqHeight || scaledBitmap.getWidth() > reqWidth) {
return createScaledBitmap(scaledBitmap, reqWidth, reqHeight);
}
return scaledBitmap;
} | /**
* It's possible, that an image eats up so much memory, that the limits are exceeded and thus
* our app is crashing. We want to prevent this by scaling the image down to a maximum size.
* <p/>
* The approach is a simple one, taken from these two links:
* <p/>
* http://developer.android.com/training/displaying-bitmaps/load-bitmap.html#load-bitmap
* http://stackoverflow.com/questions/17839388/creating-a-scaled-bitmap-with-createscaledbitmap-in-android
* <p/>
* The trick is to not load the entire file in memory (using inJustDecodeBounds), then caclulate
* the sample size for the decoder (plus one, as we don't want a smaller image than we have requested)
* and finally scale it down to the maximum of the requestedWidth/requestedHeight (as we want to
* respect the ratio of the image).
*
* @param fileName File to read
* @param reqWidth Maximum width allowed
* @param reqHeight Maximum height allowed
* @return Scaled version without
*/ | It's possible, that an image eats up so much memory, that the limits are exceeded and thus
our app is crashing. We want to prevent this by scaling the image down to a maximum size.
@param fileName File to read
@param reqWidth Maximum width allowed
@param reqHeight Maximum height allowed
@return Scaled version without | [
"It",
"'",
"s",
"possible",
"that",
"an",
"image",
"eats",
"up",
"so",
"much",
"memory",
"that",
"the",
"limits",
"are",
"exceeded",
"and",
"thus",
"our",
"app",
"is",
"crashing",
".",
"We",
"want",
"to",
"prevent",
"this",
"by",
"scaling",
"the",
"image",
"down",
"to",
"a",
"maximum",
"size",
".",
"@param",
"fileName",
"File",
"to",
"read",
"@param",
"reqWidth",
"Maximum",
"width",
"allowed",
"@param",
"reqHeight",
"Maximum",
"height",
"allowed",
"@return",
"Scaled",
"version",
"without"
] | public static Bitmap loadResizedBitmap(String fileName, int reqWidth, int reqHeight) {
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeFile(fileName, options);
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight) + 1;
options.inJustDecodeBounds = false;
options.inPreferredConfig = Bitmap.Config.RGB_565;
Bitmap scaledBitmap = BitmapFactory.decodeFile(fileName, options);
if (scaledBitmap.getHeight() > reqHeight || scaledBitmap.getWidth() > reqWidth) {
return createScaledBitmap(scaledBitmap, reqWidth, reqHeight);
}
return scaledBitmap;
} | [
"public",
"static",
"Bitmap",
"loadResizedBitmap",
"(",
"String",
"fileName",
",",
"int",
"reqWidth",
",",
"int",
"reqHeight",
")",
"{",
"final",
"BitmapFactory",
".",
"Options",
"options",
"=",
"new",
"BitmapFactory",
".",
"Options",
"(",
")",
";",
"options",
".",
"inJustDecodeBounds",
"=",
"true",
";",
"BitmapFactory",
".",
"decodeFile",
"(",
"fileName",
",",
"options",
")",
";",
"options",
".",
"inSampleSize",
"=",
"calculateInSampleSize",
"(",
"options",
",",
"reqWidth",
",",
"reqHeight",
")",
"+",
"1",
";",
"options",
".",
"inJustDecodeBounds",
"=",
"false",
";",
"options",
".",
"inPreferredConfig",
"=",
"Bitmap",
".",
"Config",
".",
"RGB_565",
";",
"Bitmap",
"scaledBitmap",
"=",
"BitmapFactory",
".",
"decodeFile",
"(",
"fileName",
",",
"options",
")",
";",
"if",
"(",
"scaledBitmap",
".",
"getHeight",
"(",
")",
">",
"reqHeight",
"||",
"scaledBitmap",
".",
"getWidth",
"(",
")",
">",
"reqWidth",
")",
"{",
"return",
"createScaledBitmap",
"(",
"scaledBitmap",
",",
"reqWidth",
",",
"reqHeight",
")",
";",
"}",
"return",
"scaledBitmap",
";",
"}"
] | It's possible, that an image eats up so much memory, that the limits are exceeded and thus
our app is crashing. | [
"It",
"'",
"s",
"possible",
"that",
"an",
"image",
"eats",
"up",
"so",
"much",
"memory",
"that",
"the",
"limits",
"are",
"exceeded",
"and",
"thus",
"our",
"app",
"is",
"crashing",
"."
] | [
"// First decode with inJustDecodeBounds=true to check dimensions",
"// Calculate the maximum inSampleSize larger than the request width/height:",
"// Decode bitmap with inSampleSize set"
] | [
{
"param": "fileName",
"type": "String"
},
{
"param": "reqWidth",
"type": "int"
},
{
"param": "reqHeight",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fileName",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reqWidth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reqHeight",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
760,
14764,
1262,
607,
1235,
12224,
12,
780,
3968,
16,
509,
1111,
2384,
16,
509,
1111,
2686,
13,
288,
203,
3639,
368,
5783,
2495,
598,
316,
19642,
6615,
5694,
33,
3767,
358,
866,
5769,
203,
3639,
727,
14764,
1733,
18,
1320,
702,
273,
394,
14764,
1733,
18,
1320,
5621,
203,
3639,
702,
18,
267,
19642,
6615,
5694,
273,
638,
31,
203,
3639,
14764,
1733,
18,
3922,
812,
12,
17812,
16,
702,
1769,
203,
3639,
368,
9029,
326,
4207,
316,
8504,
1225,
10974,
2353,
326,
590,
1835,
19,
4210,
30,
203,
3639,
702,
18,
267,
8504,
1225,
273,
4604,
382,
8504,
1225,
12,
2116,
16,
1111,
2384,
16,
1111,
2686,
13,
397,
404,
31,
203,
3639,
368,
6209,
9389,
598,
316,
8504,
1225,
444,
203,
3639,
702,
18,
267,
19642,
6615,
5694,
273,
629,
31,
203,
3639,
702,
18,
267,
16028,
809,
273,
14764,
18,
809,
18,
11343,
67,
4313,
25,
31,
203,
3639,
14764,
12304,
12224,
273,
14764,
1733,
18,
3922,
812,
12,
17812,
16,
702,
1769,
203,
3639,
309,
261,
20665,
12224,
18,
588,
2686,
1435,
405,
1111,
2686,
747,
12304,
12224,
18,
588,
2384,
1435,
405,
1111,
2384,
13,
288,
203,
5411,
327,
752,
55,
12825,
12224,
12,
20665,
12224,
16,
1111,
2384,
16,
1111,
2686,
1769,
203,
3639,
289,
203,
3639,
327,
12304,
12224,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
2597,
1807,
3323,
16,
716,
392,
1316,
425,
2323,
731,
1427,
9816,
3778,
16,
716,
326,
8181,
854,
12428,
471,
12493,
203,
377,
380,
3134,
595,
353,
17053,
310,
18,
1660,
2545,
358,
5309,
333,
635,
10612,
326,
1316,
2588,
358,
279,
4207,
963,
18,
203,
377,
380,
411,
84,
21259,
203,
377,
380,
1021,
17504,
353,
279,
4143,
1245,
16,
9830,
628,
4259,
2795,
4716,
30,
203,
377,
380,
411,
84,
21259,
203,
377,
380,
1062,
2207,
23669,
18,
16705,
18,
832,
19,
17584,
19,
5417,
310,
17,
3682,
10711,
19,
945,
17,
3682,
1458,
18,
2620,
7,
945,
17,
3682,
1458,
203,
377,
380,
1062,
2207,
20672,
18,
832,
19,
9758,
19,
4033,
28,
5520,
23,
5482,
19,
23799,
17,
2
] |
d8042dc3658fd4e109b95dcd152f8c4076fe19dd | y12uc231/FR | android/VideoFaceRecognition/app/src/main/java/org/bytefish/videofacerecognition/api/client/BaseServiceClient.java | [
"BSD-3-Clause"
] | Java | post | JSONObject | protected JSONObject post(String relativePath, JSONObject jsonObject)
throws AccessDeniedException, ResourceNotFoundException, InternalServerErrorException, RestClientException {
String destUrl = getFullUrl(relativePath);
HttpPost httpPost = new HttpPost(destUrl);
if(jsonObject != null) {
String jsonObjectString = jsonObject.toString();
try {
httpPost.setEntity(new StringEntity(jsonObjectString, "UTF-8"));
} catch (UnsupportedEncodingException e) {
Log.e(TAG, "Unable to encode JSON data", e);
throw new RestClientException("Unable to encode the JSON Data", e, jsonObjectString);
}
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-type", "application/json");
}
return executeHttpMethod(httpPost);
} | /**
* Post a JSON object to the given API method.
*
* @param relativePath API method to request.
* @param jsonObject JSON data to send to the Webservice.
* @return JSON result
*
* @throws AccessDeniedException
* @throws ResourceNotFoundException
* @throws InternalServerErrorException
* @throws RestClientException
*/ | Post a JSON object to the given API method.
@param relativePath API method to request.
@param jsonObject JSON data to send to the Webservice.
@return JSON result
| [
"Post",
"a",
"JSON",
"object",
"to",
"the",
"given",
"API",
"method",
".",
"@param",
"relativePath",
"API",
"method",
"to",
"request",
".",
"@param",
"jsonObject",
"JSON",
"data",
"to",
"send",
"to",
"the",
"Webservice",
".",
"@return",
"JSON",
"result"
] | protected JSONObject post(String relativePath, JSONObject jsonObject)
throws AccessDeniedException, ResourceNotFoundException, InternalServerErrorException, RestClientException {
String destUrl = getFullUrl(relativePath);
HttpPost httpPost = new HttpPost(destUrl);
if(jsonObject != null) {
String jsonObjectString = jsonObject.toString();
try {
httpPost.setEntity(new StringEntity(jsonObjectString, "UTF-8"));
} catch (UnsupportedEncodingException e) {
Log.e(TAG, "Unable to encode JSON data", e);
throw new RestClientException("Unable to encode the JSON Data", e, jsonObjectString);
}
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-type", "application/json");
}
return executeHttpMethod(httpPost);
} | [
"protected",
"JSONObject",
"post",
"(",
"String",
"relativePath",
",",
"JSONObject",
"jsonObject",
")",
"throws",
"AccessDeniedException",
",",
"ResourceNotFoundException",
",",
"InternalServerErrorException",
",",
"RestClientException",
"{",
"String",
"destUrl",
"=",
"getFullUrl",
"(",
"relativePath",
")",
";",
"HttpPost",
"httpPost",
"=",
"new",
"HttpPost",
"(",
"destUrl",
")",
";",
"if",
"(",
"jsonObject",
"!=",
"null",
")",
"{",
"String",
"jsonObjectString",
"=",
"jsonObject",
".",
"toString",
"(",
")",
";",
"try",
"{",
"httpPost",
".",
"setEntity",
"(",
"new",
"StringEntity",
"(",
"jsonObjectString",
",",
"\"UTF-8\"",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"Unable to encode JSON data\"",
",",
"e",
")",
";",
"throw",
"new",
"RestClientException",
"(",
"\"Unable to encode the JSON Data\"",
",",
"e",
",",
"jsonObjectString",
")",
";",
"}",
"httpPost",
".",
"setHeader",
"(",
"\"Accept\"",
",",
"\"application/json\"",
")",
";",
"httpPost",
".",
"setHeader",
"(",
"\"Content-type\"",
",",
"\"application/json\"",
")",
";",
"}",
"return",
"executeHttpMethod",
"(",
"httpPost",
")",
";",
"}"
] | Post a JSON object to the given API method. | [
"Post",
"a",
"JSON",
"object",
"to",
"the",
"given",
"API",
"method",
"."
] | [] | [
{
"param": "relativePath",
"type": "String"
},
{
"param": "jsonObject",
"type": "JSONObject"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "relativePath",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "jsonObject",
"type": "JSONObject",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
4750,
8014,
1603,
12,
780,
12820,
16,
8014,
16233,
13,
203,
5411,
1216,
21665,
16,
16676,
16,
31389,
16,
6320,
3781,
288,
203,
3639,
514,
1570,
1489,
273,
10208,
1489,
12,
11626,
743,
1769,
203,
3639,
2541,
3349,
27678,
273,
394,
2541,
3349,
12,
10488,
1489,
1769,
203,
3639,
309,
12,
1977,
921,
480,
446,
13,
288,
203,
5411,
514,
16233,
780,
273,
16233,
18,
10492,
5621,
203,
5411,
775,
288,
203,
7734,
27678,
18,
542,
1943,
12,
2704,
514,
1943,
12,
1977,
921,
780,
16,
315,
5159,
17,
28,
7923,
1769,
203,
5411,
289,
1044,
261,
8544,
13836,
425,
13,
288,
203,
7734,
1827,
18,
73,
12,
7927,
16,
315,
3370,
358,
2017,
1796,
501,
3113,
425,
1769,
203,
7734,
604,
394,
6320,
3781,
2932,
3370,
358,
2017,
326,
1796,
1910,
3113,
425,
16,
16233,
780,
1769,
203,
5411,
289,
203,
5411,
27678,
18,
542,
1864,
2932,
5933,
3113,
315,
3685,
19,
1977,
8863,
203,
5411,
27678,
18,
542,
1864,
2932,
1350,
17,
723,
3113,
315,
3685,
19,
1977,
8863,
203,
3639,
289,
203,
3639,
327,
1836,
2940,
1305,
12,
2505,
3349,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
5616,
279,
1796,
733,
358,
326,
864,
1491,
707,
18,
203,
377,
380,
203,
377,
380,
632,
891,
12820,
1491,
707,
358,
590,
18,
203,
377,
380,
632,
891,
16233,
1796,
501,
358,
1366,
358,
326,
1660,
20015,
18,
203,
377,
380,
632,
2463,
1796,
563,
203,
377,
380,
203,
377,
380,
632,
15069,
21665,
203,
377,
380,
632,
15069,
16676,
203,
377,
380,
632,
15069,
31389,
203,
377,
380,
632,
15069,
6320,
3781,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d8042dc3658fd4e109b95dcd152f8c4076fe19dd | y12uc231/FR | android/VideoFaceRecognition/app/src/main/java/org/bytefish/videofacerecognition/api/client/BaseServiceClient.java | [
"BSD-3-Clause"
] | Java | executeHttpMethod | JSONObject | private JSONObject executeHttpMethod(final HttpRequestBase httpMethod)
throws AccessDeniedException, ResourceNotFoundException, InternalServerErrorException, RestClientException {
JSONObject resultJson = null;
try {
HttpResponse httpResponse = mHttpClient.execute(httpMethod);
int httpStatusCode = httpResponse.getStatusLine().getStatusCode();
if(httpStatusCode != HttpStatus.SC_OK) {
checkHttpStatus(httpMethod, httpStatusCode);
}
resultJson = Common.getJsonFromResponse(httpResponse);
} catch(IOException e) {
Log.e(TAG, "Unable to execute HTTP Method.", e);
throw new RestClientException("Unable executing HTTP Request.", e);
} catch (JSONException e) {
Log.e(TAG, "There was an error decoding the JSON Object.", e);
throw new RestClientException("JSON decoding failed.", e);
} finally {
httpMethod.abort();
}
return resultJson;
} | /**
* This method executes the httpMethod and checks the response. It also evaluates the Status field
* sent by the Web service.
*
* @param httpMethod
* @return
* @throws WebAppException
* @throws AccessDeniedException
* @throws ResourceNotFoundException
* @throws InternalServerErrorException
*/ | This method executes the httpMethod and checks the response. It also evaluates the Status field
sent by the Web service.
| [
"This",
"method",
"executes",
"the",
"httpMethod",
"and",
"checks",
"the",
"response",
".",
"It",
"also",
"evaluates",
"the",
"Status",
"field",
"sent",
"by",
"the",
"Web",
"service",
"."
] | private JSONObject executeHttpMethod(final HttpRequestBase httpMethod)
throws AccessDeniedException, ResourceNotFoundException, InternalServerErrorException, RestClientException {
JSONObject resultJson = null;
try {
HttpResponse httpResponse = mHttpClient.execute(httpMethod);
int httpStatusCode = httpResponse.getStatusLine().getStatusCode();
if(httpStatusCode != HttpStatus.SC_OK) {
checkHttpStatus(httpMethod, httpStatusCode);
}
resultJson = Common.getJsonFromResponse(httpResponse);
} catch(IOException e) {
Log.e(TAG, "Unable to execute HTTP Method.", e);
throw new RestClientException("Unable executing HTTP Request.", e);
} catch (JSONException e) {
Log.e(TAG, "There was an error decoding the JSON Object.", e);
throw new RestClientException("JSON decoding failed.", e);
} finally {
httpMethod.abort();
}
return resultJson;
} | [
"private",
"JSONObject",
"executeHttpMethod",
"(",
"final",
"HttpRequestBase",
"httpMethod",
")",
"throws",
"AccessDeniedException",
",",
"ResourceNotFoundException",
",",
"InternalServerErrorException",
",",
"RestClientException",
"{",
"JSONObject",
"resultJson",
"=",
"null",
";",
"try",
"{",
"HttpResponse",
"httpResponse",
"=",
"mHttpClient",
".",
"execute",
"(",
"httpMethod",
")",
";",
"int",
"httpStatusCode",
"=",
"httpResponse",
".",
"getStatusLine",
"(",
")",
".",
"getStatusCode",
"(",
")",
";",
"if",
"(",
"httpStatusCode",
"!=",
"HttpStatus",
".",
"SC_OK",
")",
"{",
"checkHttpStatus",
"(",
"httpMethod",
",",
"httpStatusCode",
")",
";",
"}",
"resultJson",
"=",
"Common",
".",
"getJsonFromResponse",
"(",
"httpResponse",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"Unable to execute HTTP Method.\"",
",",
"e",
")",
";",
"throw",
"new",
"RestClientException",
"(",
"\"Unable executing HTTP Request.\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"JSONException",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"There was an error decoding the JSON Object.\"",
",",
"e",
")",
";",
"throw",
"new",
"RestClientException",
"(",
"\"JSON decoding failed.\"",
",",
"e",
")",
";",
"}",
"finally",
"{",
"httpMethod",
".",
"abort",
"(",
")",
";",
"}",
"return",
"resultJson",
";",
"}"
] | This method executes the httpMethod and checks the response. | [
"This",
"method",
"executes",
"the",
"httpMethod",
"and",
"checks",
"the",
"response",
"."
] | [] | [
{
"param": "httpMethod",
"type": "HttpRequestBase"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "httpMethod",
"type": "HttpRequestBase",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
8014,
1836,
2940,
1305,
12,
6385,
14069,
2171,
17425,
13,
203,
5411,
1216,
21665,
16,
16676,
16,
31389,
16,
6320,
3781,
288,
203,
203,
3639,
8014,
563,
3185,
273,
446,
31,
203,
3639,
775,
288,
203,
5411,
9476,
15001,
273,
312,
11895,
18,
8837,
12,
2505,
1305,
1769,
203,
5411,
509,
1062,
14041,
273,
15001,
18,
588,
1482,
1670,
7675,
588,
14041,
5621,
203,
5411,
309,
12,
2505,
14041,
480,
21153,
18,
2312,
67,
3141,
13,
288,
203,
7734,
866,
2940,
1482,
12,
2505,
1305,
16,
1062,
14041,
1769,
203,
5411,
289,
203,
5411,
563,
3185,
273,
5658,
18,
588,
3185,
1265,
1064,
12,
2505,
1064,
1769,
203,
3639,
289,
1044,
12,
14106,
425,
13,
288,
203,
5411,
1827,
18,
73,
12,
7927,
16,
315,
3370,
358,
1836,
2239,
2985,
1199,
16,
425,
1769,
203,
5411,
604,
394,
6320,
3781,
2932,
3370,
11274,
2239,
1567,
1199,
16,
425,
1769,
203,
3639,
289,
1044,
261,
2986,
503,
425,
13,
288,
203,
5411,
1827,
18,
73,
12,
7927,
16,
315,
9828,
1703,
392,
555,
13547,
326,
1796,
1033,
1199,
16,
425,
1769,
203,
5411,
604,
394,
6320,
3781,
2932,
2986,
13547,
2535,
1199,
16,
425,
1769,
203,
3639,
289,
3095,
288,
203,
5411,
17425,
18,
18623,
5621,
203,
3639,
289,
203,
3639,
327,
563,
3185,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1220,
707,
11997,
326,
17425,
471,
4271,
326,
766,
18,
2597,
2546,
20996,
326,
2685,
652,
203,
377,
380,
3271,
635,
326,
2999,
1156,
18,
203,
377,
380,
203,
377,
380,
632,
891,
17425,
203,
377,
380,
632,
2463,
203,
377,
380,
632,
15069,
22162,
503,
203,
377,
380,
632,
15069,
21665,
203,
377,
380,
632,
15069,
16676,
203,
377,
380,
632,
15069,
31389,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
d8042dc3658fd4e109b95dcd152f8c4076fe19dd | y12uc231/FR | android/VideoFaceRecognition/app/src/main/java/org/bytefish/videofacerecognition/api/client/BaseServiceClient.java | [
"BSD-3-Clause"
] | Java | checkHttpStatus | null | private void checkHttpStatus(HttpRequestBase httpMethod, int httpStatusCode)
throws AccessDeniedException, ResourceNotFoundException, InternalServerErrorException {
String requestedPath = httpMethod.getURI().toString();
if(httpStatusCode == HttpStatus.SC_FORBIDDEN) {
Log.e(TAG, "Access denied.");
throw new AccessDeniedException(requestedPath);
}
if(httpStatusCode == HttpStatus.SC_NOT_FOUND) {
Log.e(TAG, "Resource not found.");
throw new ResourceNotFoundException(requestedPath);
}
if(httpStatusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR) {
Log.e(TAG, "Internal Server Error.");
throw new InternalServerErrorException(requestedPath);
}
} | /**
* Checks the HttpStatus code of the Response and throws an appropriate exception, the upper
* layer is able to catch the exception and notify the user.
*
* @param httpMethod
* @param httpStatusCode
*
* @throws AccessDeniedException
* @throws ResourceNotFoundException
* @throws InternalServerErrorException
*/ | Checks the HttpStatus code of the Response and throws an appropriate exception, the upper
layer is able to catch the exception and notify the user.
@param httpMethod
@param httpStatusCode
| [
"Checks",
"the",
"HttpStatus",
"code",
"of",
"the",
"Response",
"and",
"throws",
"an",
"appropriate",
"exception",
"the",
"upper",
"layer",
"is",
"able",
"to",
"catch",
"the",
"exception",
"and",
"notify",
"the",
"user",
".",
"@param",
"httpMethod",
"@param",
"httpStatusCode"
] | private void checkHttpStatus(HttpRequestBase httpMethod, int httpStatusCode)
throws AccessDeniedException, ResourceNotFoundException, InternalServerErrorException {
String requestedPath = httpMethod.getURI().toString();
if(httpStatusCode == HttpStatus.SC_FORBIDDEN) {
Log.e(TAG, "Access denied.");
throw new AccessDeniedException(requestedPath);
}
if(httpStatusCode == HttpStatus.SC_NOT_FOUND) {
Log.e(TAG, "Resource not found.");
throw new ResourceNotFoundException(requestedPath);
}
if(httpStatusCode == HttpStatus.SC_INTERNAL_SERVER_ERROR) {
Log.e(TAG, "Internal Server Error.");
throw new InternalServerErrorException(requestedPath);
}
} | [
"private",
"void",
"checkHttpStatus",
"(",
"HttpRequestBase",
"httpMethod",
",",
"int",
"httpStatusCode",
")",
"throws",
"AccessDeniedException",
",",
"ResourceNotFoundException",
",",
"InternalServerErrorException",
"{",
"String",
"requestedPath",
"=",
"httpMethod",
".",
"getURI",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"httpStatusCode",
"==",
"HttpStatus",
".",
"SC_FORBIDDEN",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"Access denied.\"",
")",
";",
"throw",
"new",
"AccessDeniedException",
"(",
"requestedPath",
")",
";",
"}",
"if",
"(",
"httpStatusCode",
"==",
"HttpStatus",
".",
"SC_NOT_FOUND",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"Resource not found.\"",
")",
";",
"throw",
"new",
"ResourceNotFoundException",
"(",
"requestedPath",
")",
";",
"}",
"if",
"(",
"httpStatusCode",
"==",
"HttpStatus",
".",
"SC_INTERNAL_SERVER_ERROR",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"Internal Server Error.\"",
")",
";",
"throw",
"new",
"InternalServerErrorException",
"(",
"requestedPath",
")",
";",
"}",
"}"
] | Checks the HttpStatus code of the Response and throws an appropriate exception, the upper
layer is able to catch the exception and notify the user. | [
"Checks",
"the",
"HttpStatus",
"code",
"of",
"the",
"Response",
"and",
"throws",
"an",
"appropriate",
"exception",
"the",
"upper",
"layer",
"is",
"able",
"to",
"catch",
"the",
"exception",
"and",
"notify",
"the",
"user",
"."
] | [] | [
{
"param": "httpMethod",
"type": "HttpRequestBase"
},
{
"param": "httpStatusCode",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "httpMethod",
"type": "HttpRequestBase",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "httpStatusCode",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
866,
2940,
1482,
12,
8988,
2171,
17425,
16,
509,
1062,
14041,
13,
203,
5411,
1216,
21665,
16,
16676,
16,
31389,
288,
203,
3639,
514,
3764,
743,
273,
17425,
18,
588,
3098,
7675,
10492,
5621,
203,
3639,
309,
12,
2505,
14041,
422,
21153,
18,
2312,
67,
7473,
30198,
13,
288,
203,
5411,
1827,
18,
73,
12,
7927,
16,
315,
1862,
15338,
1199,
1769,
203,
5411,
604,
394,
21665,
12,
19065,
743,
1769,
203,
3639,
289,
203,
3639,
309,
12,
2505,
14041,
422,
21153,
18,
2312,
67,
4400,
67,
9294,
13,
288,
203,
5411,
1827,
18,
73,
12,
7927,
16,
315,
1420,
486,
1392,
1199,
1769,
203,
5411,
604,
394,
16676,
12,
19065,
743,
1769,
203,
3639,
289,
203,
3639,
309,
12,
2505,
14041,
422,
21153,
18,
2312,
67,
14005,
67,
4370,
67,
3589,
13,
288,
203,
5411,
1827,
18,
73,
12,
7927,
16,
315,
3061,
3224,
1068,
1199,
1769,
203,
5411,
604,
394,
31389,
12,
19065,
743,
1769,
203,
3639,
289,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
13074,
326,
21153,
981,
434,
326,
2306,
471,
1216,
392,
5505,
1520,
16,
326,
3854,
203,
377,
380,
3018,
353,
7752,
358,
1044,
326,
1520,
471,
5066,
326,
729,
18,
203,
377,
380,
203,
377,
380,
632,
891,
17425,
203,
377,
380,
632,
891,
1062,
14041,
203,
377,
380,
203,
377,
380,
632,
15069,
21665,
203,
377,
380,
632,
15069,
16676,
203,
377,
380,
632,
15069,
31389,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
ca94ab643ab7e44ce1cd7302d15df0a3f04f12a3 | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/web/rest/metis/PostResource.java | [
"MIT"
] | Java | createPost | null | @PostMapping("courses/{courseId}/posts")
@PreAuthorize("hasRole('USER')")
public ResponseEntity<Post> createPost(@PathVariable Long courseId, @Valid @RequestBody Post post) throws URISyntaxException {
Post createdPost = postService.createPost(courseId, post);
return ResponseEntity.created(new URI("/api/courses/" + courseId + "/posts/" + createdPost.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, postService.getEntityName(), createdPost.getId().toString())).body(createdPost);
} | /**
* POST /courses/{courseId}/posts : Create a new post
*
* @param courseId id of the course the post belongs to
* @param post post to create
* @return ResponseEntity with status 201 (Created) containing the created post in the response body,
* or with status 400 (Bad Request) if the checks on user, course or post validity fail
*/ | POST /courses/{courseId}/posts : Create a new post
@param courseId id of the course the post belongs to
@param post post to create
@return ResponseEntity with status 201 (Created) containing the created post in the response body,
or with status 400 (Bad Request) if the checks on user, course or post validity fail | [
"POST",
"/",
"courses",
"/",
"{",
"courseId",
"}",
"/",
"posts",
":",
"Create",
"a",
"new",
"post",
"@param",
"courseId",
"id",
"of",
"the",
"course",
"the",
"post",
"belongs",
"to",
"@param",
"post",
"post",
"to",
"create",
"@return",
"ResponseEntity",
"with",
"status",
"201",
"(",
"Created",
")",
"containing",
"the",
"created",
"post",
"in",
"the",
"response",
"body",
"or",
"with",
"status",
"400",
"(",
"Bad",
"Request",
")",
"if",
"the",
"checks",
"on",
"user",
"course",
"or",
"post",
"validity",
"fail"
] | @PostMapping("courses/{courseId}/posts")
@PreAuthorize("hasRole('USER')")
public ResponseEntity<Post> createPost(@PathVariable Long courseId, @Valid @RequestBody Post post) throws URISyntaxException {
Post createdPost = postService.createPost(courseId, post);
return ResponseEntity.created(new URI("/api/courses/" + courseId + "/posts/" + createdPost.getId()))
.headers(HeaderUtil.createEntityCreationAlert(applicationName, true, postService.getEntityName(), createdPost.getId().toString())).body(createdPost);
} | [
"@",
"PostMapping",
"(",
"\"courses/{courseId}/posts\"",
")",
"@",
"PreAuthorize",
"(",
"\"hasRole('USER')\"",
")",
"public",
"ResponseEntity",
"<",
"Post",
">",
"createPost",
"(",
"@",
"PathVariable",
"Long",
"courseId",
",",
"@",
"Valid",
"@",
"RequestBody",
"Post",
"post",
")",
"throws",
"URISyntaxException",
"{",
"Post",
"createdPost",
"=",
"postService",
".",
"createPost",
"(",
"courseId",
",",
"post",
")",
";",
"return",
"ResponseEntity",
".",
"created",
"(",
"new",
"URI",
"(",
"\"/api/courses/\"",
"+",
"courseId",
"+",
"\"/posts/\"",
"+",
"createdPost",
".",
"getId",
"(",
")",
")",
")",
".",
"headers",
"(",
"HeaderUtil",
".",
"createEntityCreationAlert",
"(",
"applicationName",
",",
"true",
",",
"postService",
".",
"getEntityName",
"(",
")",
",",
"createdPost",
".",
"getId",
"(",
")",
".",
"toString",
"(",
")",
")",
")",
".",
"body",
"(",
"createdPost",
")",
";",
"}"
] | POST /courses/{courseId}/posts : Create a new post
@param courseId id of the course the post belongs to
@param post post to create
@return ResponseEntity with status 201 (Created) containing the created post in the response body,
or with status 400 (Bad Request) if the checks on user, course or post validity fail | [
"POST",
"/",
"courses",
"/",
"{",
"courseId",
"}",
"/",
"posts",
":",
"Create",
"a",
"new",
"post",
"@param",
"courseId",
"id",
"of",
"the",
"course",
"the",
"post",
"belongs",
"to",
"@param",
"post",
"post",
"to",
"create",
"@return",
"ResponseEntity",
"with",
"status",
"201",
"(",
"Created",
")",
"containing",
"the",
"created",
"post",
"in",
"the",
"response",
"body",
"or",
"with",
"status",
"400",
"(",
"Bad",
"Request",
")",
"if",
"the",
"checks",
"on",
"user",
"course",
"or",
"post",
"validity",
"fail"
] | [] | [
{
"param": "courseId",
"type": "Long"
},
{
"param": "post",
"type": "Post"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "courseId",
"type": "Long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "post",
"type": "Post",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
3349,
3233,
2932,
15804,
4938,
5566,
548,
4004,
11660,
7923,
203,
565,
632,
1386,
18987,
2932,
5332,
2996,
2668,
4714,
23291,
13,
203,
565,
1071,
2306,
1943,
32,
3349,
34,
752,
3349,
26964,
743,
3092,
3407,
4362,
548,
16,
632,
1556,
632,
28843,
5616,
1603,
13,
1216,
19883,
288,
203,
3639,
5616,
2522,
3349,
273,
1603,
1179,
18,
2640,
3349,
12,
5566,
548,
16,
1603,
1769,
203,
3639,
327,
2306,
1943,
18,
4824,
12,
2704,
3699,
2932,
19,
2425,
19,
15804,
4898,
397,
4362,
548,
397,
2206,
11660,
4898,
397,
2522,
3349,
18,
26321,
1435,
3719,
203,
7734,
263,
2485,
12,
1864,
1304,
18,
2640,
1943,
9906,
13298,
12,
3685,
461,
16,
638,
16,
1603,
1179,
18,
588,
19441,
9334,
2522,
3349,
18,
26321,
7675,
10492,
10756,
2934,
3432,
12,
4824,
3349,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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,
279,
394,
1603,
203,
377,
380,
203,
377,
380,
632,
891,
4362,
548,
612,
434,
326,
4362,
326,
1603,
11081,
358,
203,
377,
380,
632,
891,
1603,
377,
1603,
358,
752,
203,
377,
380,
632,
2463,
2306,
1943,
598,
1267,
3786,
261,
6119,
13,
4191,
326,
2522,
1603,
316,
326,
766,
1417,
16,
203,
377,
380,
578,
598,
1267,
7409,
261,
6434,
1567,
13,
309,
326,
4271,
603,
729,
16,
4362,
578,
1603,
13800,
2321,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
ca94ab643ab7e44ce1cd7302d15df0a3f04f12a3 | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/web/rest/metis/PostResource.java | [
"MIT"
] | Java | updatePost | null | @PutMapping("courses/{courseId}/posts")
@PreAuthorize("hasRole('USER')")
public ResponseEntity<Post> updatePost(@PathVariable Long courseId, @RequestBody Post post) {
Post updatedPost = postService.updatePost(courseId, post);
return new ResponseEntity<>(updatedPost, null, HttpStatus.OK);
} | /**
* PUT /courses/{courseId}/posts : Update an existing post
*
* @param courseId id of the course the post belongs to
* @param post post to update
* @return ResponseEntity with status 200 (OK) containing the updated post in the response body,
* or with status 400 (Bad Request) if the checks on user, course or post validity fail
*/ | PUT /courses/{courseId}/posts : Update an existing post
@param courseId id of the course the post belongs to
@param post post to update
@return ResponseEntity with status 200 (OK) containing the updated post in the response body,
or with status 400 (Bad Request) if the checks on user, course or post validity fail | [
"PUT",
"/",
"courses",
"/",
"{",
"courseId",
"}",
"/",
"posts",
":",
"Update",
"an",
"existing",
"post",
"@param",
"courseId",
"id",
"of",
"the",
"course",
"the",
"post",
"belongs",
"to",
"@param",
"post",
"post",
"to",
"update",
"@return",
"ResponseEntity",
"with",
"status",
"200",
"(",
"OK",
")",
"containing",
"the",
"updated",
"post",
"in",
"the",
"response",
"body",
"or",
"with",
"status",
"400",
"(",
"Bad",
"Request",
")",
"if",
"the",
"checks",
"on",
"user",
"course",
"or",
"post",
"validity",
"fail"
] | @PutMapping("courses/{courseId}/posts")
@PreAuthorize("hasRole('USER')")
public ResponseEntity<Post> updatePost(@PathVariable Long courseId, @RequestBody Post post) {
Post updatedPost = postService.updatePost(courseId, post);
return new ResponseEntity<>(updatedPost, null, HttpStatus.OK);
} | [
"@",
"PutMapping",
"(",
"\"courses/{courseId}/posts\"",
")",
"@",
"PreAuthorize",
"(",
"\"hasRole('USER')\"",
")",
"public",
"ResponseEntity",
"<",
"Post",
">",
"updatePost",
"(",
"@",
"PathVariable",
"Long",
"courseId",
",",
"@",
"RequestBody",
"Post",
"post",
")",
"{",
"Post",
"updatedPost",
"=",
"postService",
".",
"updatePost",
"(",
"courseId",
",",
"post",
")",
";",
"return",
"new",
"ResponseEntity",
"<",
">",
"(",
"updatedPost",
",",
"null",
",",
"HttpStatus",
".",
"OK",
")",
";",
"}"
] | PUT /courses/{courseId}/posts : Update an existing post
@param courseId id of the course the post belongs to
@param post post to update
@return ResponseEntity with status 200 (OK) containing the updated post in the response body,
or with status 400 (Bad Request) if the checks on user, course or post validity fail | [
"PUT",
"/",
"courses",
"/",
"{",
"courseId",
"}",
"/",
"posts",
":",
"Update",
"an",
"existing",
"post",
"@param",
"courseId",
"id",
"of",
"the",
"course",
"the",
"post",
"belongs",
"to",
"@param",
"post",
"post",
"to",
"update",
"@return",
"ResponseEntity",
"with",
"status",
"200",
"(",
"OK",
")",
"containing",
"the",
"updated",
"post",
"in",
"the",
"response",
"body",
"or",
"with",
"status",
"400",
"(",
"Bad",
"Request",
")",
"if",
"the",
"checks",
"on",
"user",
"course",
"or",
"post",
"validity",
"fail"
] | [] | [
{
"param": "courseId",
"type": "Long"
},
{
"param": "post",
"type": "Post"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "courseId",
"type": "Long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "post",
"type": "Post",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
6426,
3233,
2932,
15804,
4938,
5566,
548,
4004,
11660,
7923,
203,
565,
632,
1386,
18987,
2932,
5332,
2996,
2668,
4714,
23291,
13,
203,
565,
1071,
2306,
1943,
32,
3349,
34,
1089,
3349,
26964,
743,
3092,
3407,
4362,
548,
16,
632,
28843,
5616,
1603,
13,
288,
203,
3639,
5616,
3526,
3349,
273,
1603,
1179,
18,
2725,
3349,
12,
5566,
548,
16,
1603,
1769,
203,
3639,
327,
394,
2306,
1943,
29667,
12,
7007,
3349,
16,
446,
16,
21153,
18,
3141,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
11443,
342,
15804,
4938,
5566,
548,
4004,
11660,
294,
2315,
392,
2062,
1603,
203,
377,
380,
203,
377,
380,
632,
891,
4362,
548,
612,
434,
326,
4362,
326,
1603,
11081,
358,
203,
377,
380,
632,
891,
1603,
377,
1603,
358,
1089,
203,
377,
380,
632,
2463,
2306,
1943,
598,
1267,
4044,
261,
3141,
13,
4191,
326,
3526,
1603,
316,
326,
766,
1417,
16,
203,
377,
380,
578,
598,
1267,
7409,
261,
6434,
1567,
13,
309,
326,
4271,
603,
729,
16,
4362,
578,
1603,
13800,
2321,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
ca94ab643ab7e44ce1cd7302d15df0a3f04f12a3 | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/web/rest/metis/PostResource.java | [
"MIT"
] | Java | deletePost | null | @DeleteMapping("courses/{courseId}/posts/{postId}")
@PreAuthorize("hasRole('USER')")
public ResponseEntity<Void> deletePost(@PathVariable Long courseId, @PathVariable Long postId) {
postService.deletePostById(courseId, postId);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, postService.getEntityName(), postId.toString())).build();
} | /**
* DELETE /courses/{courseId}/posts/{id} : Delete a post by its id
*
* @param courseId id of the course the post belongs to
* @param postId id of the post to delete
* @return ResponseEntity with status 200 (OK),
* or 400 (Bad Request) if the checks on user, course or post validity fail
*/ | DELETE /courses/{courseId}/posts/{id} : Delete a post by its id
@param courseId id of the course the post belongs to
@param postId id of the post to delete
@return ResponseEntity with status 200 (OK),
or 400 (Bad Request) if the checks on user, course or post validity fail | [
"DELETE",
"/",
"courses",
"/",
"{",
"courseId",
"}",
"/",
"posts",
"/",
"{",
"id",
"}",
":",
"Delete",
"a",
"post",
"by",
"its",
"id",
"@param",
"courseId",
"id",
"of",
"the",
"course",
"the",
"post",
"belongs",
"to",
"@param",
"postId",
"id",
"of",
"the",
"post",
"to",
"delete",
"@return",
"ResponseEntity",
"with",
"status",
"200",
"(",
"OK",
")",
"or",
"400",
"(",
"Bad",
"Request",
")",
"if",
"the",
"checks",
"on",
"user",
"course",
"or",
"post",
"validity",
"fail"
] | @DeleteMapping("courses/{courseId}/posts/{postId}")
@PreAuthorize("hasRole('USER')")
public ResponseEntity<Void> deletePost(@PathVariable Long courseId, @PathVariable Long postId) {
postService.deletePostById(courseId, postId);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(applicationName, true, postService.getEntityName(), postId.toString())).build();
} | [
"@",
"DeleteMapping",
"(",
"\"courses/{courseId}/posts/{postId}\"",
")",
"@",
"PreAuthorize",
"(",
"\"hasRole('USER')\"",
")",
"public",
"ResponseEntity",
"<",
"Void",
">",
"deletePost",
"(",
"@",
"PathVariable",
"Long",
"courseId",
",",
"@",
"PathVariable",
"Long",
"postId",
")",
"{",
"postService",
".",
"deletePostById",
"(",
"courseId",
",",
"postId",
")",
";",
"return",
"ResponseEntity",
".",
"ok",
"(",
")",
".",
"headers",
"(",
"HeaderUtil",
".",
"createEntityDeletionAlert",
"(",
"applicationName",
",",
"true",
",",
"postService",
".",
"getEntityName",
"(",
")",
",",
"postId",
".",
"toString",
"(",
")",
")",
")",
".",
"build",
"(",
")",
";",
"}"
] | DELETE /courses/{courseId}/posts/{id} : Delete a post by its id
@param courseId id of the course the post belongs to
@param postId id of the post to delete
@return ResponseEntity with status 200 (OK),
or 400 (Bad Request) if the checks on user, course or post validity fail | [
"DELETE",
"/",
"courses",
"/",
"{",
"courseId",
"}",
"/",
"posts",
"/",
"{",
"id",
"}",
":",
"Delete",
"a",
"post",
"by",
"its",
"id",
"@param",
"courseId",
"id",
"of",
"the",
"course",
"the",
"post",
"belongs",
"to",
"@param",
"postId",
"id",
"of",
"the",
"post",
"to",
"delete",
"@return",
"ResponseEntity",
"with",
"status",
"200",
"(",
"OK",
")",
"or",
"400",
"(",
"Bad",
"Request",
")",
"if",
"the",
"checks",
"on",
"user",
"course",
"or",
"post",
"validity",
"fail"
] | [] | [
{
"param": "courseId",
"type": "Long"
},
{
"param": "postId",
"type": "Long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "courseId",
"type": "Long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "postId",
"type": "Long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
2613,
3233,
2932,
15804,
4938,
5566,
548,
4004,
11660,
4938,
2767,
548,
1532,
13,
203,
565,
632,
1386,
18987,
2932,
5332,
2996,
2668,
4714,
23291,
13,
203,
565,
1071,
2306,
1943,
32,
19038,
34,
1430,
3349,
26964,
743,
3092,
3407,
4362,
548,
16,
632,
743,
3092,
3407,
1603,
548,
13,
288,
203,
3639,
1603,
1179,
18,
3733,
3349,
5132,
12,
5566,
548,
16,
1603,
548,
1769,
203,
3639,
327,
2306,
1943,
18,
601,
7675,
2485,
12,
1864,
1304,
18,
2640,
1943,
13064,
13298,
12,
3685,
461,
16,
638,
16,
1603,
1179,
18,
588,
19441,
9334,
1603,
548,
18,
10492,
10756,
2934,
3510,
5621,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
8568,
342,
15804,
4938,
5566,
548,
4004,
11660,
4938,
350,
97,
294,
2504,
279,
1603,
635,
2097,
612,
203,
377,
380,
203,
377,
380,
632,
891,
4362,
548,
612,
434,
326,
4362,
326,
1603,
11081,
358,
203,
377,
380,
632,
891,
1603,
548,
282,
612,
434,
326,
1603,
358,
1430,
203,
377,
380,
632,
2463,
2306,
1943,
598,
1267,
4044,
261,
3141,
3631,
203,
377,
380,
578,
7409,
261,
6434,
1567,
13,
309,
326,
4271,
603,
729,
16,
4362,
578,
1603,
13800,
2321,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
ca94ab643ab7e44ce1cd7302d15df0a3f04f12a3 | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/web/rest/metis/PostResource.java | [
"MIT"
] | Java | computeSimilarityScoresWitCoursePosts | null | @PostMapping("courses/{courseId}/posts/similarity-check")
@PreAuthorize("hasRole('USER')")
public ResponseEntity<List<Post>> computeSimilarityScoresWitCoursePosts(@PathVariable Long courseId, @RequestBody Post post) throws URISyntaxException {
List<Post> similarPosts = postService.getSimilarPosts(courseId, post);
return ResponseEntity.ok().body(similarPosts);
} | /**
* POST /courses/{courseId}/posts/similarity-check : trigger a similarity check for post to be created
*
* @param courseId id of the course the post should be published in
* @param post post to create
* @return ResponseEntity with status 200 (OK)
*/ | POST /courses/{courseId}/posts/similarity-check : trigger a similarity check for post to be created
@param courseId id of the course the post should be published in
@param post post to create
@return ResponseEntity with status 200 (OK) | [
"POST",
"/",
"courses",
"/",
"{",
"courseId",
"}",
"/",
"posts",
"/",
"similarity",
"-",
"check",
":",
"trigger",
"a",
"similarity",
"check",
"for",
"post",
"to",
"be",
"created",
"@param",
"courseId",
"id",
"of",
"the",
"course",
"the",
"post",
"should",
"be",
"published",
"in",
"@param",
"post",
"post",
"to",
"create",
"@return",
"ResponseEntity",
"with",
"status",
"200",
"(",
"OK",
")"
] | @PostMapping("courses/{courseId}/posts/similarity-check")
@PreAuthorize("hasRole('USER')")
public ResponseEntity<List<Post>> computeSimilarityScoresWitCoursePosts(@PathVariable Long courseId, @RequestBody Post post) throws URISyntaxException {
List<Post> similarPosts = postService.getSimilarPosts(courseId, post);
return ResponseEntity.ok().body(similarPosts);
} | [
"@",
"PostMapping",
"(",
"\"courses/{courseId}/posts/similarity-check\"",
")",
"@",
"PreAuthorize",
"(",
"\"hasRole('USER')\"",
")",
"public",
"ResponseEntity",
"<",
"List",
"<",
"Post",
">",
">",
"computeSimilarityScoresWitCoursePosts",
"(",
"@",
"PathVariable",
"Long",
"courseId",
",",
"@",
"RequestBody",
"Post",
"post",
")",
"throws",
"URISyntaxException",
"{",
"List",
"<",
"Post",
">",
"similarPosts",
"=",
"postService",
".",
"getSimilarPosts",
"(",
"courseId",
",",
"post",
")",
";",
"return",
"ResponseEntity",
".",
"ok",
"(",
")",
".",
"body",
"(",
"similarPosts",
")",
";",
"}"
] | POST /courses/{courseId}/posts/similarity-check : trigger a similarity check for post to be created
@param courseId id of the course the post should be published in
@param post post to create
@return ResponseEntity with status 200 (OK) | [
"POST",
"/",
"courses",
"/",
"{",
"courseId",
"}",
"/",
"posts",
"/",
"similarity",
"-",
"check",
":",
"trigger",
"a",
"similarity",
"check",
"for",
"post",
"to",
"be",
"created",
"@param",
"courseId",
"id",
"of",
"the",
"course",
"the",
"post",
"should",
"be",
"published",
"in",
"@param",
"post",
"post",
"to",
"create",
"@return",
"ResponseEntity",
"with",
"status",
"200",
"(",
"OK",
")"
] | [] | [
{
"param": "courseId",
"type": "Long"
},
{
"param": "post",
"type": "Post"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "courseId",
"type": "Long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "post",
"type": "Post",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
3349,
3233,
2932,
15804,
4938,
5566,
548,
4004,
11660,
19,
22985,
560,
17,
1893,
7923,
203,
565,
632,
1386,
18987,
2932,
5332,
2996,
2668,
4714,
23291,
13,
203,
565,
1071,
2306,
1943,
32,
682,
32,
3349,
9778,
3671,
16891,
560,
20037,
59,
305,
39,
3117,
24983,
26964,
743,
3092,
3407,
4362,
548,
16,
632,
28843,
5616,
1603,
13,
1216,
19883,
288,
203,
3639,
987,
32,
3349,
34,
7281,
24983,
273,
1603,
1179,
18,
588,
16891,
24983,
12,
5566,
548,
16,
1603,
1769,
203,
3639,
327,
2306,
1943,
18,
601,
7675,
3432,
12,
22985,
24983,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
5485,
342,
15804,
4938,
5566,
548,
4004,
11660,
19,
22985,
560,
17,
1893,
294,
3080,
279,
16416,
866,
364,
1603,
358,
506,
2522,
203,
377,
380,
203,
377,
380,
632,
891,
4362,
548,
612,
434,
326,
4362,
326,
1603,
1410,
506,
9487,
316,
203,
377,
380,
632,
891,
1603,
377,
1603,
358,
752,
203,
377,
380,
632,
2463,
2306,
1943,
598,
1267,
4044,
261,
3141,
13,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6ed7e4ed5ff52fbdc9b621ebc4472b873a5e9e0d | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/service/SubmissionService.java | [
"MIT"
] | Java | copyFeedbackToNewResult | null | public List<Feedback> copyFeedbackToNewResult(Result newResult, Result oldResult) {
List<Feedback> oldFeedback = oldResult.getFeedbacks();
copyFeedbackToResult(newResult, oldFeedback);
return newResult.getFeedbacks();
} | /**
* Copy Feedbacks from one Result to a another Result
* @param newResult new result to copy feedback to
* @param oldResult old result to copy feedback from
* @return the list of newly created feedbacks
*/ | Copy Feedbacks from one Result to a another Result
@param newResult new result to copy feedback to
@param oldResult old result to copy feedback from
@return the list of newly created feedbacks | [
"Copy",
"Feedbacks",
"from",
"one",
"Result",
"to",
"a",
"another",
"Result",
"@param",
"newResult",
"new",
"result",
"to",
"copy",
"feedback",
"to",
"@param",
"oldResult",
"old",
"result",
"to",
"copy",
"feedback",
"from",
"@return",
"the",
"list",
"of",
"newly",
"created",
"feedbacks"
] | public List<Feedback> copyFeedbackToNewResult(Result newResult, Result oldResult) {
List<Feedback> oldFeedback = oldResult.getFeedbacks();
copyFeedbackToResult(newResult, oldFeedback);
return newResult.getFeedbacks();
} | [
"public",
"List",
"<",
"Feedback",
">",
"copyFeedbackToNewResult",
"(",
"Result",
"newResult",
",",
"Result",
"oldResult",
")",
"{",
"List",
"<",
"Feedback",
">",
"oldFeedback",
"=",
"oldResult",
".",
"getFeedbacks",
"(",
")",
";",
"copyFeedbackToResult",
"(",
"newResult",
",",
"oldFeedback",
")",
";",
"return",
"newResult",
".",
"getFeedbacks",
"(",
")",
";",
"}"
] | Copy Feedbacks from one Result to a another Result
@param newResult new result to copy feedback to
@param oldResult old result to copy feedback from
@return the list of newly created feedbacks | [
"Copy",
"Feedbacks",
"from",
"one",
"Result",
"to",
"a",
"another",
"Result",
"@param",
"newResult",
"new",
"result",
"to",
"copy",
"feedback",
"to",
"@param",
"oldResult",
"old",
"result",
"to",
"copy",
"feedback",
"from",
"@return",
"the",
"list",
"of",
"newly",
"created",
"feedbacks"
] | [] | [
{
"param": "newResult",
"type": "Result"
},
{
"param": "oldResult",
"type": "Result"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "newResult",
"type": "Result",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "oldResult",
"type": "Result",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
987,
32,
15888,
34,
1610,
15888,
774,
1908,
1253,
12,
1253,
394,
1253,
16,
3438,
1592,
1253,
13,
288,
203,
3639,
987,
32,
15888,
34,
1592,
15888,
273,
1592,
1253,
18,
588,
15888,
87,
5621,
203,
3639,
1610,
15888,
774,
1253,
12,
2704,
1253,
16,
1592,
15888,
1769,
203,
3639,
327,
394,
1253,
18,
588,
15888,
87,
5621,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
5631,
14013,
823,
87,
628,
1245,
3438,
358,
279,
4042,
3438,
203,
377,
380,
632,
891,
394,
1253,
394,
563,
358,
1610,
10762,
358,
203,
377,
380,
632,
891,
1592,
1253,
1592,
563,
358,
1610,
10762,
628,
203,
377,
380,
632,
2463,
326,
666,
434,
10894,
2522,
10762,
87,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6ed7e4ed5ff52fbdc9b621ebc4472b873a5e9e0d | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/service/SubmissionService.java | [
"MIT"
] | Java | copyFeedbackToResult | null | private void copyFeedbackToResult(Result result, List<Feedback> feedbacks) {
feedbacks.forEach(feedback -> {
Feedback newFeedback = feedback.copyFeedback();
newFeedback.setPositive(newFeedback.getCredits() > 0);
result.addFeedback(newFeedback);
});
resultRepository.save(result);
} | /**
* Copy feedback from a feedback list to a Result
* @param result the result to copy feedback to
* @param feedbacks the feedbacks which are copied
*/ | Copy feedback from a feedback list to a Result
@param result the result to copy feedback to
@param feedbacks the feedbacks which are copied | [
"Copy",
"feedback",
"from",
"a",
"feedback",
"list",
"to",
"a",
"Result",
"@param",
"result",
"the",
"result",
"to",
"copy",
"feedback",
"to",
"@param",
"feedbacks",
"the",
"feedbacks",
"which",
"are",
"copied"
] | private void copyFeedbackToResult(Result result, List<Feedback> feedbacks) {
feedbacks.forEach(feedback -> {
Feedback newFeedback = feedback.copyFeedback();
newFeedback.setPositive(newFeedback.getCredits() > 0);
result.addFeedback(newFeedback);
});
resultRepository.save(result);
} | [
"private",
"void",
"copyFeedbackToResult",
"(",
"Result",
"result",
",",
"List",
"<",
"Feedback",
">",
"feedbacks",
")",
"{",
"feedbacks",
".",
"forEach",
"(",
"feedback",
"->",
"{",
"Feedback",
"newFeedback",
"=",
"feedback",
".",
"copyFeedback",
"(",
")",
";",
"newFeedback",
".",
"setPositive",
"(",
"newFeedback",
".",
"getCredits",
"(",
")",
">",
"0",
")",
";",
"result",
".",
"addFeedback",
"(",
"newFeedback",
")",
";",
"}",
")",
";",
"resultRepository",
".",
"save",
"(",
"result",
")",
";",
"}"
] | Copy feedback from a feedback list to a Result
@param result the result to copy feedback to
@param feedbacks the feedbacks which are copied | [
"Copy",
"feedback",
"from",
"a",
"feedback",
"list",
"to",
"a",
"Result",
"@param",
"result",
"the",
"result",
"to",
"copy",
"feedback",
"to",
"@param",
"feedbacks",
"the",
"feedbacks",
"which",
"are",
"copied"
] | [] | [
{
"param": "result",
"type": "Result"
},
{
"param": "feedbacks",
"type": "List<Feedback>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "result",
"type": "Result",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "feedbacks",
"type": "List<Feedback>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
1610,
15888,
774,
1253,
12,
1253,
563,
16,
987,
32,
15888,
34,
10762,
87,
13,
288,
203,
3639,
10762,
87,
18,
1884,
3442,
12,
12571,
317,
288,
203,
5411,
14013,
823,
394,
15888,
273,
10762,
18,
3530,
15888,
5621,
203,
5411,
394,
15888,
18,
542,
14900,
12,
2704,
15888,
18,
588,
24201,
1282,
1435,
405,
374,
1769,
203,
5411,
563,
18,
1289,
15888,
12,
2704,
15888,
1769,
203,
3639,
15549,
203,
3639,
563,
3305,
18,
5688,
12,
2088,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
5631,
10762,
628,
279,
10762,
666,
358,
279,
3438,
203,
377,
380,
632,
891,
563,
326,
563,
358,
1610,
10762,
358,
203,
377,
380,
632,
891,
10762,
87,
326,
10762,
87,
1492,
854,
9268,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6ed7e4ed5ff52fbdc9b621ebc4472b873a5e9e0d | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/service/SubmissionService.java | [
"MIT"
] | Java | copyResultFromPreviousRoundAndSave | Result | public Result copyResultFromPreviousRoundAndSave(Submission submission, Result oldResult) {
if (oldResult == null) {
return saveNewEmptyResult(submission);
}
Result newResult = new Result();
newResult.setParticipation(submission.getParticipation());
copyFeedbackToNewResult(newResult, oldResult);
return copyResultContentAndAddToSubmission(submission, newResult, oldResult);
} | /**
* This method is used to create a copy of a result, used in the exam mode with correctionRound > 1,
* because an assessment with current correctionRound > 1 contains all previous work,
* which the tutor can then edit. Assigns the newly created Result to the submission
*
* @param submission submission to which the new Result is assigned
* @param oldResult result to copy from
* @return the newly created copy of the oldResult
*/ | This method is used to create a copy of a result, used in the exam mode with correctionRound > 1,
because an assessment with current correctionRound > 1 contains all previous work,
which the tutor can then edit. Assigns the newly created Result to the submission
@param submission submission to which the new Result is assigned
@param oldResult result to copy from
@return the newly created copy of the oldResult | [
"This",
"method",
"is",
"used",
"to",
"create",
"a",
"copy",
"of",
"a",
"result",
"used",
"in",
"the",
"exam",
"mode",
"with",
"correctionRound",
">",
"1",
"because",
"an",
"assessment",
"with",
"current",
"correctionRound",
">",
"1",
"contains",
"all",
"previous",
"work",
"which",
"the",
"tutor",
"can",
"then",
"edit",
".",
"Assigns",
"the",
"newly",
"created",
"Result",
"to",
"the",
"submission",
"@param",
"submission",
"submission",
"to",
"which",
"the",
"new",
"Result",
"is",
"assigned",
"@param",
"oldResult",
"result",
"to",
"copy",
"from",
"@return",
"the",
"newly",
"created",
"copy",
"of",
"the",
"oldResult"
] | public Result copyResultFromPreviousRoundAndSave(Submission submission, Result oldResult) {
if (oldResult == null) {
return saveNewEmptyResult(submission);
}
Result newResult = new Result();
newResult.setParticipation(submission.getParticipation());
copyFeedbackToNewResult(newResult, oldResult);
return copyResultContentAndAddToSubmission(submission, newResult, oldResult);
} | [
"public",
"Result",
"copyResultFromPreviousRoundAndSave",
"(",
"Submission",
"submission",
",",
"Result",
"oldResult",
")",
"{",
"if",
"(",
"oldResult",
"==",
"null",
")",
"{",
"return",
"saveNewEmptyResult",
"(",
"submission",
")",
";",
"}",
"Result",
"newResult",
"=",
"new",
"Result",
"(",
")",
";",
"newResult",
".",
"setParticipation",
"(",
"submission",
".",
"getParticipation",
"(",
")",
")",
";",
"copyFeedbackToNewResult",
"(",
"newResult",
",",
"oldResult",
")",
";",
"return",
"copyResultContentAndAddToSubmission",
"(",
"submission",
",",
"newResult",
",",
"oldResult",
")",
";",
"}"
] | This method is used to create a copy of a result, used in the exam mode with correctionRound > 1,
because an assessment with current correctionRound > 1 contains all previous work,
which the tutor can then edit. | [
"This",
"method",
"is",
"used",
"to",
"create",
"a",
"copy",
"of",
"a",
"result",
"used",
"in",
"the",
"exam",
"mode",
"with",
"correctionRound",
">",
"1",
"because",
"an",
"assessment",
"with",
"current",
"correctionRound",
">",
"1",
"contains",
"all",
"previous",
"work",
"which",
"the",
"tutor",
"can",
"then",
"edit",
"."
] | [] | [
{
"param": "submission",
"type": "Submission"
},
{
"param": "oldResult",
"type": "Result"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "submission",
"type": "Submission",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "oldResult",
"type": "Result",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
3438,
1610,
1253,
1265,
8351,
11066,
1876,
4755,
12,
17865,
8515,
16,
3438,
1592,
1253,
13,
288,
203,
3639,
309,
261,
1673,
1253,
422,
446,
13,
288,
203,
5411,
327,
1923,
1908,
1921,
1253,
12,
12684,
1769,
203,
3639,
289,
203,
3639,
3438,
394,
1253,
273,
394,
3438,
5621,
203,
3639,
394,
1253,
18,
542,
1988,
24629,
367,
12,
12684,
18,
588,
1988,
24629,
367,
10663,
203,
3639,
1610,
15888,
774,
1908,
1253,
12,
2704,
1253,
16,
1592,
1253,
1769,
203,
3639,
327,
1610,
1253,
1350,
1876,
986,
774,
17865,
12,
12684,
16,
394,
1253,
16,
1592,
1253,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1220,
707,
353,
1399,
358,
752,
279,
1610,
434,
279,
563,
16,
1399,
316,
326,
19707,
1965,
598,
15104,
11066,
405,
404,
16,
203,
377,
380,
2724,
392,
14158,
598,
783,
15104,
11066,
405,
404,
1914,
777,
2416,
1440,
16,
203,
377,
380,
1492,
326,
268,
3408,
848,
1508,
3874,
18,
12093,
87,
326,
10894,
2522,
3438,
358,
326,
8515,
203,
377,
380,
203,
377,
380,
632,
891,
8515,
8515,
358,
1492,
326,
394,
3438,
353,
6958,
203,
377,
380,
632,
891,
1592,
1253,
563,
358,
1610,
628,
203,
377,
380,
632,
2463,
326,
10894,
2522,
1610,
434,
326,
1592,
1253,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6ed7e4ed5ff52fbdc9b621ebc4472b873a5e9e0d | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/service/SubmissionService.java | [
"MIT"
] | Java | createResultAfterComplaintResponse | Result | public Result createResultAfterComplaintResponse(Submission submission, Result oldResult, List<Feedback> feedbacks) {
Result newResult = new Result();
newResult.setParticipation(submission.getParticipation());
copyFeedbackToResult(newResult, feedbacks);
newResult = copyResultContentAndAddToSubmission(submission, newResult, oldResult);
return newResult;
} | /**
* This method is used to create a new result, after a complaint has been accepted.
* The new result contains the updated feedback of the result the complaint belongs to.
*
* @param submission the submission where the original result and the result after the complaintResponse belong to
* @param oldResult the original result, before the response
* @param feedbacks the new feedbacks after the response
* @return the newly created result
*/ | This method is used to create a new result, after a complaint has been accepted.
The new result contains the updated feedback of the result the complaint belongs to.
@param submission the submission where the original result and the result after the complaintResponse belong to
@param oldResult the original result, before the response
@param feedbacks the new feedbacks after the response
@return the newly created result | [
"This",
"method",
"is",
"used",
"to",
"create",
"a",
"new",
"result",
"after",
"a",
"complaint",
"has",
"been",
"accepted",
".",
"The",
"new",
"result",
"contains",
"the",
"updated",
"feedback",
"of",
"the",
"result",
"the",
"complaint",
"belongs",
"to",
".",
"@param",
"submission",
"the",
"submission",
"where",
"the",
"original",
"result",
"and",
"the",
"result",
"after",
"the",
"complaintResponse",
"belong",
"to",
"@param",
"oldResult",
"the",
"original",
"result",
"before",
"the",
"response",
"@param",
"feedbacks",
"the",
"new",
"feedbacks",
"after",
"the",
"response",
"@return",
"the",
"newly",
"created",
"result"
] | public Result createResultAfterComplaintResponse(Submission submission, Result oldResult, List<Feedback> feedbacks) {
Result newResult = new Result();
newResult.setParticipation(submission.getParticipation());
copyFeedbackToResult(newResult, feedbacks);
newResult = copyResultContentAndAddToSubmission(submission, newResult, oldResult);
return newResult;
} | [
"public",
"Result",
"createResultAfterComplaintResponse",
"(",
"Submission",
"submission",
",",
"Result",
"oldResult",
",",
"List",
"<",
"Feedback",
">",
"feedbacks",
")",
"{",
"Result",
"newResult",
"=",
"new",
"Result",
"(",
")",
";",
"newResult",
".",
"setParticipation",
"(",
"submission",
".",
"getParticipation",
"(",
")",
")",
";",
"copyFeedbackToResult",
"(",
"newResult",
",",
"feedbacks",
")",
";",
"newResult",
"=",
"copyResultContentAndAddToSubmission",
"(",
"submission",
",",
"newResult",
",",
"oldResult",
")",
";",
"return",
"newResult",
";",
"}"
] | This method is used to create a new result, after a complaint has been accepted. | [
"This",
"method",
"is",
"used",
"to",
"create",
"a",
"new",
"result",
"after",
"a",
"complaint",
"has",
"been",
"accepted",
"."
] | [] | [
{
"param": "submission",
"type": "Submission"
},
{
"param": "oldResult",
"type": "Result"
},
{
"param": "feedbacks",
"type": "List<Feedback>"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "submission",
"type": "Submission",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "oldResult",
"type": "Result",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "feedbacks",
"type": "List<Feedback>",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
3438,
752,
1253,
4436,
799,
412,
1598,
1064,
12,
17865,
8515,
16,
3438,
1592,
1253,
16,
987,
32,
15888,
34,
10762,
87,
13,
288,
203,
3639,
3438,
394,
1253,
273,
394,
3438,
5621,
203,
3639,
394,
1253,
18,
542,
1988,
24629,
367,
12,
12684,
18,
588,
1988,
24629,
367,
10663,
203,
3639,
1610,
15888,
774,
1253,
12,
2704,
1253,
16,
10762,
87,
1769,
203,
3639,
394,
1253,
273,
1610,
1253,
1350,
1876,
986,
774,
17865,
12,
12684,
16,
394,
1253,
16,
1592,
1253,
1769,
203,
3639,
327,
394,
1253,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1220,
707,
353,
1399,
358,
752,
279,
394,
563,
16,
1839,
279,
27534,
1598,
711,
2118,
8494,
18,
203,
377,
380,
1021,
394,
563,
1914,
326,
3526,
10762,
434,
326,
563,
326,
27534,
1598,
11081,
358,
18,
203,
377,
380,
203,
377,
380,
632,
891,
8515,
326,
8515,
1625,
326,
2282,
563,
471,
326,
563,
1839,
326,
27534,
1598,
1064,
10957,
358,
203,
377,
380,
632,
891,
1592,
1253,
326,
2282,
563,
16,
1865,
326,
766,
203,
377,
380,
632,
891,
10762,
87,
326,
394,
10762,
87,
1839,
326,
766,
203,
377,
380,
632,
2463,
326,
10894,
2522,
563,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6ed7e4ed5ff52fbdc9b621ebc4472b873a5e9e0d | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/service/SubmissionService.java | [
"MIT"
] | Java | copyResultContentAndAddToSubmission | Result | private Result copyResultContentAndAddToSubmission(Submission submission, Result newResult, Result oldResult) {
newResult.setResultString(oldResult.getResultString());
newResult.setScore(oldResult.getScore());
newResult.setHasFeedback(oldResult.getHasFeedback());
newResult.setRated(oldResult.isRated());
var savedResult = resultRepository.save(newResult);
savedResult.setSubmission(submission);
submission.addResult(savedResult);
submissionRepository.save(submission);
return savedResult;
} | /**
* Copies the content of one result to another, and adds the second result to the submission.
*
* @param submission the submission which both results belong to, the newResult comes after the oldResult in the resultlist
* @param newResult the result where the content is set
* @param oldResult the result from which the content is copied from
* @return the newResult
*/ | Copies the content of one result to another, and adds the second result to the submission.
@param submission the submission which both results belong to, the newResult comes after the oldResult in the resultlist
@param newResult the result where the content is set
@param oldResult the result from which the content is copied from
@return the newResult | [
"Copies",
"the",
"content",
"of",
"one",
"result",
"to",
"another",
"and",
"adds",
"the",
"second",
"result",
"to",
"the",
"submission",
".",
"@param",
"submission",
"the",
"submission",
"which",
"both",
"results",
"belong",
"to",
"the",
"newResult",
"comes",
"after",
"the",
"oldResult",
"in",
"the",
"resultlist",
"@param",
"newResult",
"the",
"result",
"where",
"the",
"content",
"is",
"set",
"@param",
"oldResult",
"the",
"result",
"from",
"which",
"the",
"content",
"is",
"copied",
"from",
"@return",
"the",
"newResult"
] | private Result copyResultContentAndAddToSubmission(Submission submission, Result newResult, Result oldResult) {
newResult.setResultString(oldResult.getResultString());
newResult.setScore(oldResult.getScore());
newResult.setHasFeedback(oldResult.getHasFeedback());
newResult.setRated(oldResult.isRated());
var savedResult = resultRepository.save(newResult);
savedResult.setSubmission(submission);
submission.addResult(savedResult);
submissionRepository.save(submission);
return savedResult;
} | [
"private",
"Result",
"copyResultContentAndAddToSubmission",
"(",
"Submission",
"submission",
",",
"Result",
"newResult",
",",
"Result",
"oldResult",
")",
"{",
"newResult",
".",
"setResultString",
"(",
"oldResult",
".",
"getResultString",
"(",
")",
")",
";",
"newResult",
".",
"setScore",
"(",
"oldResult",
".",
"getScore",
"(",
")",
")",
";",
"newResult",
".",
"setHasFeedback",
"(",
"oldResult",
".",
"getHasFeedback",
"(",
")",
")",
";",
"newResult",
".",
"setRated",
"(",
"oldResult",
".",
"isRated",
"(",
")",
")",
";",
"var",
"savedResult",
"=",
"resultRepository",
".",
"save",
"(",
"newResult",
")",
";",
"savedResult",
".",
"setSubmission",
"(",
"submission",
")",
";",
"submission",
".",
"addResult",
"(",
"savedResult",
")",
";",
"submissionRepository",
".",
"save",
"(",
"submission",
")",
";",
"return",
"savedResult",
";",
"}"
] | Copies the content of one result to another, and adds the second result to the submission. | [
"Copies",
"the",
"content",
"of",
"one",
"result",
"to",
"another",
"and",
"adds",
"the",
"second",
"result",
"to",
"the",
"submission",
"."
] | [] | [
{
"param": "submission",
"type": "Submission"
},
{
"param": "newResult",
"type": "Result"
},
{
"param": "oldResult",
"type": "Result"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "submission",
"type": "Submission",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "newResult",
"type": "Result",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "oldResult",
"type": "Result",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
3438,
1610,
1253,
1350,
1876,
986,
774,
17865,
12,
17865,
8515,
16,
3438,
394,
1253,
16,
3438,
1592,
1253,
13,
288,
203,
3639,
394,
1253,
18,
542,
1253,
780,
12,
1673,
1253,
18,
588,
1253,
780,
10663,
203,
3639,
394,
1253,
18,
542,
7295,
12,
1673,
1253,
18,
588,
7295,
10663,
203,
3639,
394,
1253,
18,
542,
5582,
15888,
12,
1673,
1253,
18,
588,
5582,
15888,
10663,
203,
3639,
394,
1253,
18,
542,
54,
690,
12,
1673,
1253,
18,
291,
54,
690,
10663,
203,
3639,
569,
5198,
1253,
273,
563,
3305,
18,
5688,
12,
2704,
1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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
28506,
606,
326,
913,
434,
1245,
563,
358,
4042,
16,
471,
4831,
326,
2205,
563,
358,
326,
8515,
18,
203,
377,
380,
203,
377,
380,
632,
891,
8515,
326,
8515,
1492,
3937,
1686,
10957,
358,
16,
326,
394,
1253,
14535,
1839,
326,
1592,
1253,
316,
326,
563,
1098,
203,
377,
380,
632,
891,
394,
1253,
326,
563,
1625,
326,
913,
353,
444,
203,
377,
380,
632,
891,
1592,
1253,
326,
563,
628,
1492,
326,
913,
353,
9268,
628,
203,
377,
380,
632,
2463,
326,
394,
1253,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6ed7e4ed5ff52fbdc9b621ebc4472b873a5e9e0d | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/service/SubmissionService.java | [
"MIT"
] | Java | addEmptyProgrammingSubmissionToParticipation | null | public void addEmptyProgrammingSubmissionToParticipation(StudentParticipation studentParticipation) {
if (studentParticipation.getExercise().isExamExercise()) {
Submission submission = new ProgrammingSubmission();
submission.setSubmissionDate(ZonedDateTime.now());
submission.setType(SubmissionType.INSTRUCTOR);
submission = submissionRepository.save(submission);
studentParticipation.setSubmissions(Set.of(submission));
submission.setParticipation(studentParticipation);
participationRepository.save(studentParticipation);
}
} | /**
* Adds a new and empty programmingSubmission to the provided studentParticipation.
*
* @param studentParticipation the studentParticipation a new empty programming submission is created for
*/ | Adds a new and empty programmingSubmission to the provided studentParticipation.
@param studentParticipation the studentParticipation a new empty programming submission is created for | [
"Adds",
"a",
"new",
"and",
"empty",
"programmingSubmission",
"to",
"the",
"provided",
"studentParticipation",
".",
"@param",
"studentParticipation",
"the",
"studentParticipation",
"a",
"new",
"empty",
"programming",
"submission",
"is",
"created",
"for"
] | public void addEmptyProgrammingSubmissionToParticipation(StudentParticipation studentParticipation) {
if (studentParticipation.getExercise().isExamExercise()) {
Submission submission = new ProgrammingSubmission();
submission.setSubmissionDate(ZonedDateTime.now());
submission.setType(SubmissionType.INSTRUCTOR);
submission = submissionRepository.save(submission);
studentParticipation.setSubmissions(Set.of(submission));
submission.setParticipation(studentParticipation);
participationRepository.save(studentParticipation);
}
} | [
"public",
"void",
"addEmptyProgrammingSubmissionToParticipation",
"(",
"StudentParticipation",
"studentParticipation",
")",
"{",
"if",
"(",
"studentParticipation",
".",
"getExercise",
"(",
")",
".",
"isExamExercise",
"(",
")",
")",
"{",
"Submission",
"submission",
"=",
"new",
"ProgrammingSubmission",
"(",
")",
";",
"submission",
".",
"setSubmissionDate",
"(",
"ZonedDateTime",
".",
"now",
"(",
")",
")",
";",
"submission",
".",
"setType",
"(",
"SubmissionType",
".",
"INSTRUCTOR",
")",
";",
"submission",
"=",
"submissionRepository",
".",
"save",
"(",
"submission",
")",
";",
"studentParticipation",
".",
"setSubmissions",
"(",
"Set",
".",
"of",
"(",
"submission",
")",
")",
";",
"submission",
".",
"setParticipation",
"(",
"studentParticipation",
")",
";",
"participationRepository",
".",
"save",
"(",
"studentParticipation",
")",
";",
"}",
"}"
] | Adds a new and empty programmingSubmission to the provided studentParticipation. | [
"Adds",
"a",
"new",
"and",
"empty",
"programmingSubmission",
"to",
"the",
"provided",
"studentParticipation",
"."
] | [] | [
{
"param": "studentParticipation",
"type": "StudentParticipation"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "studentParticipation",
"type": "StudentParticipation",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
918,
527,
1921,
9459,
11987,
17865,
774,
1988,
24629,
367,
12,
19943,
319,
1988,
24629,
367,
18110,
1988,
24629,
367,
13,
288,
203,
3639,
309,
261,
26240,
1988,
24629,
367,
18,
588,
424,
20603,
7675,
291,
424,
301,
424,
20603,
10756,
288,
203,
5411,
2592,
3951,
8515,
273,
394,
13586,
11987,
17865,
5621,
203,
5411,
8515,
18,
542,
17865,
1626,
12,
62,
20461,
18,
3338,
10663,
203,
5411,
8515,
18,
542,
559,
12,
17865,
559,
18,
706,
13915,
916,
1769,
203,
5411,
8515,
273,
8515,
3305,
18,
5688,
12,
12684,
1769,
203,
5411,
18110,
1988,
24629,
367,
18,
542,
1676,
7300,
12,
694,
18,
792,
12,
12684,
10019,
203,
5411,
8515,
18,
542,
1988,
24629,
367,
12,
26240,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
15605,
279,
394,
471,
1008,
5402,
11987,
17865,
358,
326,
2112,
18110,
1988,
24629,
367,
18,
203,
377,
380,
203,
377,
380,
632,
891,
18110,
1988,
24629,
367,
326,
18110,
1988,
24629,
367,
279,
394,
1008,
5402,
11987,
8515,
353,
2522,
364,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6ed7e4ed5ff52fbdc9b621ebc4472b873a5e9e0d | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/service/SubmissionService.java | [
"MIT"
] | Java | prepareTestRunSubmissionForAssessment | Result | public Result prepareTestRunSubmissionForAssessment(Submission submission) {
Optional<Result> existingAutomaticResult = Optional.empty();
if (submission.getLatestResult() != null && AssessmentType.AUTOMATIC == submission.getLatestResult().getAssessmentType()) {
existingAutomaticResult = resultRepository.findByIdWithEagerFeedbacks(submission.getLatestResult().getId());
}
// we only support one correction round for test runs
var draftAssessment = lockSubmission(submission, 0);
// copy feedback from automatic result
if (existingAutomaticResult.isPresent()) {
draftAssessment.setAssessmentType(AssessmentType.SEMI_AUTOMATIC);
draftAssessment.setResultString(existingAutomaticResult.get().getResultString());
// also saves the draft assessment
draftAssessment.setFeedbacks(copyFeedbackToNewResult(draftAssessment, existingAutomaticResult.get()));
}
return draftAssessment;
} | /**
* Serves as a wrapper method to {@link SubmissionService#lockSubmission} for exam test runs
* Creates an empty draft assessment with the user as an assessor and copies the automatic feedback (if present) into the new result.
* NOTE: We only support one correction round for test runs.
*
* @param submission the submission
* @return the draft assessment
*/ | Serves as a wrapper method to SubmissionService#lockSubmission for exam test runs
Creates an empty draft assessment with the user as an assessor and copies the automatic feedback (if present) into the new result.
NOTE: We only support one correction round for test runs.
@param submission the submission
@return the draft assessment | [
"Serves",
"as",
"a",
"wrapper",
"method",
"to",
"SubmissionService#lockSubmission",
"for",
"exam",
"test",
"runs",
"Creates",
"an",
"empty",
"draft",
"assessment",
"with",
"the",
"user",
"as",
"an",
"assessor",
"and",
"copies",
"the",
"automatic",
"feedback",
"(",
"if",
"present",
")",
"into",
"the",
"new",
"result",
".",
"NOTE",
":",
"We",
"only",
"support",
"one",
"correction",
"round",
"for",
"test",
"runs",
".",
"@param",
"submission",
"the",
"submission",
"@return",
"the",
"draft",
"assessment"
] | public Result prepareTestRunSubmissionForAssessment(Submission submission) {
Optional<Result> existingAutomaticResult = Optional.empty();
if (submission.getLatestResult() != null && AssessmentType.AUTOMATIC == submission.getLatestResult().getAssessmentType()) {
existingAutomaticResult = resultRepository.findByIdWithEagerFeedbacks(submission.getLatestResult().getId());
}
var draftAssessment = lockSubmission(submission, 0);
if (existingAutomaticResult.isPresent()) {
draftAssessment.setAssessmentType(AssessmentType.SEMI_AUTOMATIC);
draftAssessment.setResultString(existingAutomaticResult.get().getResultString());
draftAssessment.setFeedbacks(copyFeedbackToNewResult(draftAssessment, existingAutomaticResult.get()));
}
return draftAssessment;
} | [
"public",
"Result",
"prepareTestRunSubmissionForAssessment",
"(",
"Submission",
"submission",
")",
"{",
"Optional",
"<",
"Result",
">",
"existingAutomaticResult",
"=",
"Optional",
".",
"empty",
"(",
")",
";",
"if",
"(",
"submission",
".",
"getLatestResult",
"(",
")",
"!=",
"null",
"&&",
"AssessmentType",
".",
"AUTOMATIC",
"==",
"submission",
".",
"getLatestResult",
"(",
")",
".",
"getAssessmentType",
"(",
")",
")",
"{",
"existingAutomaticResult",
"=",
"resultRepository",
".",
"findByIdWithEagerFeedbacks",
"(",
"submission",
".",
"getLatestResult",
"(",
")",
".",
"getId",
"(",
")",
")",
";",
"}",
"var",
"draftAssessment",
"=",
"lockSubmission",
"(",
"submission",
",",
"0",
")",
";",
"if",
"(",
"existingAutomaticResult",
".",
"isPresent",
"(",
")",
")",
"{",
"draftAssessment",
".",
"setAssessmentType",
"(",
"AssessmentType",
".",
"SEMI_AUTOMATIC",
")",
";",
"draftAssessment",
".",
"setResultString",
"(",
"existingAutomaticResult",
".",
"get",
"(",
")",
".",
"getResultString",
"(",
")",
")",
";",
"draftAssessment",
".",
"setFeedbacks",
"(",
"copyFeedbackToNewResult",
"(",
"draftAssessment",
",",
"existingAutomaticResult",
".",
"get",
"(",
")",
")",
")",
";",
"}",
"return",
"draftAssessment",
";",
"}"
] | Serves as a wrapper method to {@link SubmissionService#lockSubmission} for exam test runs
Creates an empty draft assessment with the user as an assessor and copies the automatic feedback (if present) into the new result. | [
"Serves",
"as",
"a",
"wrapper",
"method",
"to",
"{",
"@link",
"SubmissionService#lockSubmission",
"}",
"for",
"exam",
"test",
"runs",
"Creates",
"an",
"empty",
"draft",
"assessment",
"with",
"the",
"user",
"as",
"an",
"assessor",
"and",
"copies",
"the",
"automatic",
"feedback",
"(",
"if",
"present",
")",
"into",
"the",
"new",
"result",
"."
] | [
"// we only support one correction round for test runs",
"// copy feedback from automatic result",
"// also saves the draft assessment"
] | [
{
"param": "submission",
"type": "Submission"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "submission",
"type": "Submission",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
1071,
3438,
2911,
4709,
1997,
17865,
1290,
15209,
12,
17865,
8515,
13,
288,
203,
3639,
4055,
32,
1253,
34,
2062,
7150,
4941,
1253,
273,
4055,
18,
5531,
5621,
203,
3639,
309,
261,
12684,
18,
588,
18650,
1253,
1435,
480,
446,
597,
25241,
559,
18,
37,
1693,
1872,
11781,
422,
8515,
18,
588,
18650,
1253,
7675,
588,
15209,
559,
10756,
288,
203,
5411,
2062,
7150,
4941,
1253,
273,
563,
3305,
18,
4720,
5132,
1190,
41,
6817,
15888,
87,
12,
12684,
18,
588,
18650,
1253,
7675,
26321,
10663,
203,
3639,
289,
203,
203,
3639,
368,
732,
1338,
2865,
1245,
15104,
3643,
364,
1842,
7597,
203,
3639,
569,
12246,
15209,
273,
2176,
17865,
12,
12684,
16,
374,
1769,
203,
203,
3639,
368,
1610,
10762,
628,
5859,
563,
203,
3639,
309,
261,
11711,
7150,
4941,
1253,
18,
291,
6351,
10756,
288,
203,
5411,
12246,
15209,
18,
542,
15209,
559,
12,
15209,
559,
18,
1090,
7492,
67,
37,
1693,
1872,
11781,
1769,
203,
5411,
12246,
15209,
18,
542,
1253,
780,
12,
11711,
7150,
4941,
1253,
18,
588,
7675,
588,
1253,
780,
10663,
203,
5411,
368,
2546,
14649,
326,
12246,
14158,
203,
5411,
12246,
15209,
18,
542,
15888,
87,
12,
3530,
15888,
774,
1908,
1253,
12,
17153,
15209,
16,
2062,
7150,
4941,
1253,
18,
588,
1435,
10019,
203,
3639,
289,
203,
203,
3639,
327,
12246,
15209,
31,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
1275,
3324,
487,
279,
4053,
707,
358,
8901,
1232,
2592,
3951,
1179,
7,
739,
17865,
97,
364,
19707,
1842,
7597,
203,
377,
380,
10210,
392,
1008,
12246,
14158,
598,
326,
729,
487,
392,
1551,
403,
280,
471,
13200,
326,
5859,
10762,
261,
430,
3430,
13,
1368,
326,
394,
563,
18,
203,
377,
380,
5219,
30,
1660,
1338,
2865,
1245,
15104,
3643,
364,
1842,
7597,
18,
203,
377,
380,
203,
377,
380,
632,
891,
8515,
326,
8515,
203,
377,
380,
632,
2463,
326,
12246,
14158,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
6ed7e4ed5ff52fbdc9b621ebc4472b873a5e9e0d | ls1intum/Artemis | src/main/java/de/tum/in/www1/artemis/service/SubmissionService.java | [
"MIT"
] | Java | prepareComplaintAndSubmission | null | private void prepareComplaintAndSubmission(Complaint complaint, Submission submission) {
StudentParticipation studentParticipation = (StudentParticipation) complaint.getResult().getParticipation();
studentParticipation.setParticipant(null);
studentParticipation.setExercise(null);
complaint.setParticipant(null);
StudentParticipation submissionsParticipation = (StudentParticipation) submission.getParticipation();
submissionsParticipation.setParticipant(null);
submissionsParticipation.setExercise(null);
} | /**
* Helper method to prepare the complaint for the client
* @param complaint the complaint which gets prepared
*/ | Helper method to prepare the complaint for the client
@param complaint the complaint which gets prepared | [
"Helper",
"method",
"to",
"prepare",
"the",
"complaint",
"for",
"the",
"client",
"@param",
"complaint",
"the",
"complaint",
"which",
"gets",
"prepared"
] | private void prepareComplaintAndSubmission(Complaint complaint, Submission submission) {
StudentParticipation studentParticipation = (StudentParticipation) complaint.getResult().getParticipation();
studentParticipation.setParticipant(null);
studentParticipation.setExercise(null);
complaint.setParticipant(null);
StudentParticipation submissionsParticipation = (StudentParticipation) submission.getParticipation();
submissionsParticipation.setParticipant(null);
submissionsParticipation.setExercise(null);
} | [
"private",
"void",
"prepareComplaintAndSubmission",
"(",
"Complaint",
"complaint",
",",
"Submission",
"submission",
")",
"{",
"StudentParticipation",
"studentParticipation",
"=",
"(",
"StudentParticipation",
")",
"complaint",
".",
"getResult",
"(",
")",
".",
"getParticipation",
"(",
")",
";",
"studentParticipation",
".",
"setParticipant",
"(",
"null",
")",
";",
"studentParticipation",
".",
"setExercise",
"(",
"null",
")",
";",
"complaint",
".",
"setParticipant",
"(",
"null",
")",
";",
"StudentParticipation",
"submissionsParticipation",
"=",
"(",
"StudentParticipation",
")",
"submission",
".",
"getParticipation",
"(",
")",
";",
"submissionsParticipation",
".",
"setParticipant",
"(",
"null",
")",
";",
"submissionsParticipation",
".",
"setExercise",
"(",
"null",
")",
";",
"}"
] | Helper method to prepare the complaint for the client
@param complaint the complaint which gets prepared | [
"Helper",
"method",
"to",
"prepare",
"the",
"complaint",
"for",
"the",
"client",
"@param",
"complaint",
"the",
"complaint",
"which",
"gets",
"prepared"
] | [] | [
{
"param": "complaint",
"type": "Complaint"
},
{
"param": "submission",
"type": "Submission"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "complaint",
"type": "Complaint",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "submission",
"type": "Submission",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
2911,
799,
412,
1598,
1876,
17865,
12,
799,
412,
1598,
27534,
1598,
16,
2592,
3951,
8515,
13,
288,
203,
3639,
934,
1100,
319,
1988,
24629,
367,
18110,
1988,
24629,
367,
273,
261,
19943,
319,
1988,
24629,
367,
13,
27534,
1598,
18,
588,
1253,
7675,
588,
1988,
24629,
367,
5621,
203,
3639,
18110,
1988,
24629,
367,
18,
542,
22540,
12,
2011,
1769,
203,
3639,
18110,
1988,
24629,
367,
18,
542,
424,
20603,
12,
2011,
1769,
203,
3639,
27534,
1598,
18,
542,
22540,
12,
2011,
1769,
203,
203,
3639,
934,
1100,
319,
1988,
24629,
367,
22071,
1988,
24629,
367,
273,
261,
19943,
319,
1988,
24629,
367,
13,
8515,
18,
588,
1988,
24629,
367,
5621,
203,
3639,
22071,
1988,
24629,
367,
18,
542,
22540,
12,
2011,
1769,
203,
3639,
22071,
1988,
24629,
367,
18,
542,
424,
20603,
12,
2011,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
9705,
707,
358,
2911,
326,
27534,
1598,
364,
326,
1004,
203,
377,
380,
632,
891,
27534,
1598,
326,
27534,
1598,
1492,
5571,
8208,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7988432f8cf12612e57298ede78ce096f39f5da8 | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java | [
"MIT"
] | Java | checkCreatedNotification | null | private void checkCreatedNotification(GroupNotification createdNotification, String expectedTitle, String expectedText, String expectedTarget,
NotificationPriority expectedPriority) {
assertThat(createdNotification.getTitle()).isEqualTo(expectedTitle);
assertThat(createdNotification.getText()).isEqualTo(expectedText);
assertThat(createdNotification.getTarget()).isEqualTo(expectedTarget);
assertThat(createdNotification.getPriority()).isEqualTo(expectedPriority);
assertThat(createdNotification.getAuthor()).isEqualTo(user);
} | /**
* Shared collection of assertions that check if the created notification is correct
* @param createdNotification is the notification that should be checked for correctness.
* @param expectedTitle is the expected title that the notification should have.
* @param expectedText is the expected text that the notification should have.
* @param expectedTarget is the expected target that the notification should have.
* @param expectedPriority is the expected priority that the notification should have.
*/ | Shared collection of assertions that check if the created notification is correct
@param createdNotification is the notification that should be checked for correctness.
@param expectedTitle is the expected title that the notification should have.
@param expectedText is the expected text that the notification should have.
@param expectedTarget is the expected target that the notification should have.
@param expectedPriority is the expected priority that the notification should have. | [
"Shared",
"collection",
"of",
"assertions",
"that",
"check",
"if",
"the",
"created",
"notification",
"is",
"correct",
"@param",
"createdNotification",
"is",
"the",
"notification",
"that",
"should",
"be",
"checked",
"for",
"correctness",
".",
"@param",
"expectedTitle",
"is",
"the",
"expected",
"title",
"that",
"the",
"notification",
"should",
"have",
".",
"@param",
"expectedText",
"is",
"the",
"expected",
"text",
"that",
"the",
"notification",
"should",
"have",
".",
"@param",
"expectedTarget",
"is",
"the",
"expected",
"target",
"that",
"the",
"notification",
"should",
"have",
".",
"@param",
"expectedPriority",
"is",
"the",
"expected",
"priority",
"that",
"the",
"notification",
"should",
"have",
"."
] | private void checkCreatedNotification(GroupNotification createdNotification, String expectedTitle, String expectedText, String expectedTarget,
NotificationPriority expectedPriority) {
assertThat(createdNotification.getTitle()).isEqualTo(expectedTitle);
assertThat(createdNotification.getText()).isEqualTo(expectedText);
assertThat(createdNotification.getTarget()).isEqualTo(expectedTarget);
assertThat(createdNotification.getPriority()).isEqualTo(expectedPriority);
assertThat(createdNotification.getAuthor()).isEqualTo(user);
} | [
"private",
"void",
"checkCreatedNotification",
"(",
"GroupNotification",
"createdNotification",
",",
"String",
"expectedTitle",
",",
"String",
"expectedText",
",",
"String",
"expectedTarget",
",",
"NotificationPriority",
"expectedPriority",
")",
"{",
"assertThat",
"(",
"createdNotification",
".",
"getTitle",
"(",
")",
")",
".",
"isEqualTo",
"(",
"expectedTitle",
")",
";",
"assertThat",
"(",
"createdNotification",
".",
"getText",
"(",
")",
")",
".",
"isEqualTo",
"(",
"expectedText",
")",
";",
"assertThat",
"(",
"createdNotification",
".",
"getTarget",
"(",
")",
")",
".",
"isEqualTo",
"(",
"expectedTarget",
")",
";",
"assertThat",
"(",
"createdNotification",
".",
"getPriority",
"(",
")",
")",
".",
"isEqualTo",
"(",
"expectedPriority",
")",
";",
"assertThat",
"(",
"createdNotification",
".",
"getAuthor",
"(",
")",
")",
".",
"isEqualTo",
"(",
"user",
")",
";",
"}"
] | Shared collection of assertions that check if the created notification is correct
@param createdNotification is the notification that should be checked for correctness. | [
"Shared",
"collection",
"of",
"assertions",
"that",
"check",
"if",
"the",
"created",
"notification",
"is",
"correct",
"@param",
"createdNotification",
"is",
"the",
"notification",
"that",
"should",
"be",
"checked",
"for",
"correctness",
"."
] | [] | [
{
"param": "createdNotification",
"type": "GroupNotification"
},
{
"param": "expectedTitle",
"type": "String"
},
{
"param": "expectedText",
"type": "String"
},
{
"param": "expectedTarget",
"type": "String"
},
{
"param": "expectedPriority",
"type": "NotificationPriority"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "createdNotification",
"type": "GroupNotification",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "expectedTitle",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "expectedText",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "expectedTarget",
"type": "String",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "expectedPriority",
"type": "NotificationPriority",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
866,
6119,
4386,
12,
1114,
4386,
2522,
4386,
16,
514,
2665,
4247,
16,
514,
2665,
1528,
16,
514,
2665,
2326,
16,
203,
5411,
8050,
8183,
2665,
8183,
13,
288,
203,
3639,
1815,
18163,
12,
4824,
4386,
18,
588,
4247,
1435,
2934,
291,
5812,
774,
12,
3825,
4247,
1769,
203,
3639,
1815,
18163,
12,
4824,
4386,
18,
588,
1528,
1435,
2934,
291,
5812,
774,
12,
3825,
1528,
1769,
203,
3639,
1815,
18163,
12,
4824,
4386,
18,
588,
2326,
1435,
2934,
291,
5812,
774,
12,
3825,
2326,
1769,
203,
3639,
1815,
18163,
12,
4824,
4386,
18,
588,
8183,
1435,
2934,
291,
5812,
774,
12,
3825,
8183,
1769,
203,
3639,
1815,
18163,
12,
4824,
4386,
18,
588,
3594,
1435,
2934,
291,
5812,
774,
12,
1355,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
10314,
1849,
434,
7820,
716,
866,
309,
326,
2522,
3851,
353,
3434,
203,
377,
380,
632,
891,
2522,
4386,
353,
326,
3851,
716,
1410,
506,
5950,
364,
3434,
4496,
18,
203,
377,
380,
632,
891,
2665,
4247,
353,
326,
2665,
2077,
716,
326,
3851,
1410,
1240,
18,
203,
377,
380,
632,
891,
2665,
1528,
353,
326,
2665,
977,
716,
326,
3851,
1410,
1240,
18,
203,
377,
380,
632,
891,
2665,
2326,
353,
326,
2665,
1018,
716,
326,
3851,
1410,
1240,
18,
203,
377,
380,
632,
891,
2665,
8183,
353,
326,
2665,
4394,
716,
326,
3851,
1410,
1240,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7988432f8cf12612e57298ede78ce096f39f5da8 | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java | [
"MIT"
] | Java | createAndCheckNotification | null | private void createAndCheckNotification(Base base) {
switch (base) {
case ATTACHMENT: {
createdNotification = groupNotificationFactory.createNotification(attachment, user, groupNotificationType, notificationType, notificationText);
checkCreatedNotificationWithNotificationText();
createdNotification = groupNotificationFactory.createNotification(attachment, user, groupNotificationType, notificationType, null);
break;
}
case EXERCISE: {
createdNotification = groupNotificationFactory.createNotification(exercise, user, groupNotificationType, notificationType, notificationText);
checkCreatedNotificationWithNotificationText();
createdNotification = groupNotificationFactory.createNotification(exercise, user, groupNotificationType, notificationType, null);
break;
}
case POST: {
createdNotification = groupNotificationFactory.createNotification(post, user, groupNotificationType, notificationType);
break;
}
case ANSWER_POST: {
createdNotification = groupNotificationFactory.createNotification(answerPost, user, groupNotificationType, notificationType);
break;
}
case COURSE: {
createdNotification = groupNotificationFactory.createNotification(course, user, groupNotificationType, notificationType, archiveErrors);
break;
}
case EXAM: {
createdNotification = groupNotificationFactory.createNotification(exam, user, groupNotificationType, notificationType, archiveErrors);
break;
}
}
checkCreatedNotificationWithoutNotificationText();
} | /**
* Calls the real createNotification method of the groupNotificationFactory and tests if the result is correct.
* Two notifications are created for those cases that might use a manually set notification text
* @param base is the first input parameter used in the respective factory method to create the group notification.
*/ | Calls the real createNotification method of the groupNotificationFactory and tests if the result is correct.
Two notifications are created for those cases that might use a manually set notification text
@param base is the first input parameter used in the respective factory method to create the group notification. | [
"Calls",
"the",
"real",
"createNotification",
"method",
"of",
"the",
"groupNotificationFactory",
"and",
"tests",
"if",
"the",
"result",
"is",
"correct",
".",
"Two",
"notifications",
"are",
"created",
"for",
"those",
"cases",
"that",
"might",
"use",
"a",
"manually",
"set",
"notification",
"text",
"@param",
"base",
"is",
"the",
"first",
"input",
"parameter",
"used",
"in",
"the",
"respective",
"factory",
"method",
"to",
"create",
"the",
"group",
"notification",
"."
] | private void createAndCheckNotification(Base base) {
switch (base) {
case ATTACHMENT: {
createdNotification = groupNotificationFactory.createNotification(attachment, user, groupNotificationType, notificationType, notificationText);
checkCreatedNotificationWithNotificationText();
createdNotification = groupNotificationFactory.createNotification(attachment, user, groupNotificationType, notificationType, null);
break;
}
case EXERCISE: {
createdNotification = groupNotificationFactory.createNotification(exercise, user, groupNotificationType, notificationType, notificationText);
checkCreatedNotificationWithNotificationText();
createdNotification = groupNotificationFactory.createNotification(exercise, user, groupNotificationType, notificationType, null);
break;
}
case POST: {
createdNotification = groupNotificationFactory.createNotification(post, user, groupNotificationType, notificationType);
break;
}
case ANSWER_POST: {
createdNotification = groupNotificationFactory.createNotification(answerPost, user, groupNotificationType, notificationType);
break;
}
case COURSE: {
createdNotification = groupNotificationFactory.createNotification(course, user, groupNotificationType, notificationType, archiveErrors);
break;
}
case EXAM: {
createdNotification = groupNotificationFactory.createNotification(exam, user, groupNotificationType, notificationType, archiveErrors);
break;
}
}
checkCreatedNotificationWithoutNotificationText();
} | [
"private",
"void",
"createAndCheckNotification",
"(",
"Base",
"base",
")",
"{",
"switch",
"(",
"base",
")",
"{",
"case",
"ATTACHMENT",
":",
"{",
"createdNotification",
"=",
"groupNotificationFactory",
".",
"createNotification",
"(",
"attachment",
",",
"user",
",",
"groupNotificationType",
",",
"notificationType",
",",
"notificationText",
")",
";",
"checkCreatedNotificationWithNotificationText",
"(",
")",
";",
"createdNotification",
"=",
"groupNotificationFactory",
".",
"createNotification",
"(",
"attachment",
",",
"user",
",",
"groupNotificationType",
",",
"notificationType",
",",
"null",
")",
";",
"break",
";",
"}",
"case",
"EXERCISE",
":",
"{",
"createdNotification",
"=",
"groupNotificationFactory",
".",
"createNotification",
"(",
"exercise",
",",
"user",
",",
"groupNotificationType",
",",
"notificationType",
",",
"notificationText",
")",
";",
"checkCreatedNotificationWithNotificationText",
"(",
")",
";",
"createdNotification",
"=",
"groupNotificationFactory",
".",
"createNotification",
"(",
"exercise",
",",
"user",
",",
"groupNotificationType",
",",
"notificationType",
",",
"null",
")",
";",
"break",
";",
"}",
"case",
"POST",
":",
"{",
"createdNotification",
"=",
"groupNotificationFactory",
".",
"createNotification",
"(",
"post",
",",
"user",
",",
"groupNotificationType",
",",
"notificationType",
")",
";",
"break",
";",
"}",
"case",
"ANSWER_POST",
":",
"{",
"createdNotification",
"=",
"groupNotificationFactory",
".",
"createNotification",
"(",
"answerPost",
",",
"user",
",",
"groupNotificationType",
",",
"notificationType",
")",
";",
"break",
";",
"}",
"case",
"COURSE",
":",
"{",
"createdNotification",
"=",
"groupNotificationFactory",
".",
"createNotification",
"(",
"course",
",",
"user",
",",
"groupNotificationType",
",",
"notificationType",
",",
"archiveErrors",
")",
";",
"break",
";",
"}",
"case",
"EXAM",
":",
"{",
"createdNotification",
"=",
"groupNotificationFactory",
".",
"createNotification",
"(",
"exam",
",",
"user",
",",
"groupNotificationType",
",",
"notificationType",
",",
"archiveErrors",
")",
";",
"break",
";",
"}",
"}",
"checkCreatedNotificationWithoutNotificationText",
"(",
")",
";",
"}"
] | Calls the real createNotification method of the groupNotificationFactory and tests if the result is correct. | [
"Calls",
"the",
"real",
"createNotification",
"method",
"of",
"the",
"groupNotificationFactory",
"and",
"tests",
"if",
"the",
"result",
"is",
"correct",
"."
] | [] | [
{
"param": "base",
"type": "Base"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "base",
"type": "Base",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
3238,
918,
30545,
1564,
4386,
12,
2171,
1026,
13,
288,
203,
3639,
1620,
261,
1969,
13,
288,
203,
5411,
648,
7907,
18133,
3212,
30,
288,
203,
7734,
2522,
4386,
273,
1041,
4386,
1733,
18,
2640,
4386,
12,
11461,
16,
729,
16,
1041,
4386,
559,
16,
3851,
559,
16,
3851,
1528,
1769,
203,
7734,
866,
6119,
4386,
1190,
4386,
1528,
5621,
203,
7734,
2522,
4386,
273,
1041,
4386,
1733,
18,
2640,
4386,
12,
11461,
16,
729,
16,
1041,
4386,
559,
16,
3851,
559,
16,
446,
1769,
203,
7734,
898,
31,
203,
5411,
289,
203,
5411,
648,
5675,
654,
7266,
1090,
30,
288,
203,
7734,
2522,
4386,
273,
1041,
4386,
1733,
18,
2640,
4386,
12,
8913,
30708,
16,
729,
16,
1041,
4386,
559,
16,
3851,
559,
16,
3851,
1528,
1769,
203,
7734,
866,
6119,
4386,
1190,
4386,
1528,
5621,
203,
7734,
2522,
4386,
273,
1041,
4386,
1733,
18,
2640,
4386,
12,
8913,
30708,
16,
729,
16,
1041,
4386,
559,
16,
3851,
559,
16,
446,
1769,
203,
7734,
898,
31,
203,
5411,
289,
203,
5411,
648,
5485,
30,
288,
203,
7734,
2522,
4386,
273,
1041,
4386,
1733,
18,
2640,
4386,
12,
2767,
16,
729,
16,
1041,
4386,
559,
16,
3851,
559,
1769,
203,
7734,
898,
31,
203,
5411,
289,
203,
5411,
648,
432,
3156,
18839,
67,
3798,
30,
288,
203,
7734,
2522,
4386,
273,
1041,
4386,
1733,
18,
2640,
4386,
12,
13490,
3349,
16,
729,
16,
1041,
4386,
559,
16,
3851,
559,
1769,
203,
7734,
898,
31,
203,
5411,
289,
203,
5411,
648,
7910,
23875,
30,
288,
203,
7734,
2522,
4386,
273,
1041,
4386,
1733,
18,
2640,
4386,
12,
5566,
16,
729,
16,
1041,
4386,
559,
16,
3851,
559,
16,
5052,
4229,
1769,
203,
7734,
898,
31,
203,
5411,
289,
203,
5411,
648,
5675,
2192,
30,
288,
203,
7734,
2522,
4386,
273,
1041,
4386,
1733,
18,
2640,
4386,
12,
338,
301,
16,
729,
16,
1041,
4386,
559,
16,
3851,
559,
16,
5052,
4229,
1769,
203,
7734,
898,
31,
203,
5411,
289,
203,
3639,
289,
203,
3639,
866,
6119,
4386,
8073,
4386,
1528,
5621,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
23665,
326,
2863,
752,
4386,
707,
434,
326,
1041,
4386,
1733,
471,
7434,
309,
326,
563,
353,
3434,
18,
203,
377,
380,
16896,
9208,
854,
2522,
364,
5348,
6088,
716,
4825,
999,
279,
10036,
444,
3851,
977,
203,
377,
380,
632,
891,
1026,
353,
326,
1122,
810,
1569,
1399,
316,
326,
17613,
3272,
707,
358,
752,
326,
1041,
3851,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7988432f8cf12612e57298ede78ce096f39f5da8 | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java | [
"MIT"
] | Java | createNotificationBasedOnAttachment | null | @Test
public void createNotificationBasedOnAttachment() {
notificationType = NotificationType.ATTACHMENT_CHANGE;
expectedTitle = ATTACHMENT_CHANGE_TITLE;
expectedText = "Attachment \"" + attachment.getName() + "\" updated.";
expectedTarget = createDefaultExpectedTarget("attachmentUpdated", "lectures", lectureId);
expectedPriority = NotificationPriority.MEDIUM;
createAndCheckNotification(Base.ATTACHMENT);
} | /**
* Tests the functionality of the group notification factory that deals with notifications that originate from attachments.
*/ | Tests the functionality of the group notification factory that deals with notifications that originate from attachments. | [
"Tests",
"the",
"functionality",
"of",
"the",
"group",
"notification",
"factory",
"that",
"deals",
"with",
"notifications",
"that",
"originate",
"from",
"attachments",
"."
] | @Test
public void createNotificationBasedOnAttachment() {
notificationType = NotificationType.ATTACHMENT_CHANGE;
expectedTitle = ATTACHMENT_CHANGE_TITLE;
expectedText = "Attachment \"" + attachment.getName() + "\" updated.";
expectedTarget = createDefaultExpectedTarget("attachmentUpdated", "lectures", lectureId);
expectedPriority = NotificationPriority.MEDIUM;
createAndCheckNotification(Base.ATTACHMENT);
} | [
"@",
"Test",
"public",
"void",
"createNotificationBasedOnAttachment",
"(",
")",
"{",
"notificationType",
"=",
"NotificationType",
".",
"ATTACHMENT_CHANGE",
";",
"expectedTitle",
"=",
"ATTACHMENT_CHANGE_TITLE",
";",
"expectedText",
"=",
"\"Attachment \\\"\"",
"+",
"attachment",
".",
"getName",
"(",
")",
"+",
"\"\\\" updated.\"",
";",
"expectedTarget",
"=",
"createDefaultExpectedTarget",
"(",
"\"attachmentUpdated\"",
",",
"\"lectures\"",
",",
"lectureId",
")",
";",
"expectedPriority",
"=",
"NotificationPriority",
".",
"MEDIUM",
";",
"createAndCheckNotification",
"(",
"Base",
".",
"ATTACHMENT",
")",
";",
"}"
] | Tests the functionality of the group notification factory that deals with notifications that originate from attachments. | [
"Tests",
"the",
"functionality",
"of",
"the",
"group",
"notification",
"factory",
"that",
"deals",
"with",
"notifications",
"that",
"originate",
"from",
"attachments",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
752,
4386,
9802,
1398,
6803,
1435,
288,
203,
3639,
3851,
559,
273,
8050,
559,
18,
789,
9833,
1792,
3212,
67,
14473,
31,
203,
3639,
2665,
4247,
273,
7907,
18133,
3212,
67,
14473,
67,
14123,
31,
203,
3639,
2665,
1528,
273,
315,
6803,
11843,
397,
6042,
18,
17994,
1435,
397,
7023,
3526,
1199,
31,
203,
3639,
2665,
2326,
273,
27346,
6861,
2326,
2932,
11461,
7381,
3113,
315,
1582,
1823,
3113,
884,
299,
594,
548,
1769,
203,
3639,
2665,
8183,
273,
8050,
8183,
18,
15971,
2799,
31,
203,
203,
3639,
30545,
1564,
4386,
12,
2171,
18,
789,
9833,
1792,
3212,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
7766,
87,
326,
14176,
434,
326,
1041,
3851,
3272,
716,
443,
1031,
598,
9208,
716,
1647,
3322,
628,
10065,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7988432f8cf12612e57298ede78ce096f39f5da8 | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java | [
"MIT"
] | Java | createNotificationBasedOnExercise_withNotificationType_ExerciseCreated | null | @Test
public void createNotificationBasedOnExercise_withNotificationType_ExerciseCreated() {
notificationType = NotificationType.EXERCISE_CREATED;
expectedTitle = EXERCISE_CREATED_TITLE;
expectedText = "A new exercise \"" + exercise.getTitle() + "\" got created.";
expectedTarget = createDefaultExpectedTarget("exerciseCreated", "exercises", exerciseId);
expectedPriority = NotificationPriority.MEDIUM;
createAndCheckNotification(Base.EXERCISE);
} | /**
* Tests the functionality that deals with notifications that have the notification type of EXERCISE_CREATED.
* I.e. notifications that originate from a (newly) created exercise.
*/ | Tests the functionality that deals with notifications that have the notification type of EXERCISE_CREATED. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"EXERCISE_CREATED",
"."
] | @Test
public void createNotificationBasedOnExercise_withNotificationType_ExerciseCreated() {
notificationType = NotificationType.EXERCISE_CREATED;
expectedTitle = EXERCISE_CREATED_TITLE;
expectedText = "A new exercise \"" + exercise.getTitle() + "\" got created.";
expectedTarget = createDefaultExpectedTarget("exerciseCreated", "exercises", exerciseId);
expectedPriority = NotificationPriority.MEDIUM;
createAndCheckNotification(Base.EXERCISE);
} | [
"@",
"Test",
"public",
"void",
"createNotificationBasedOnExercise_withNotificationType_ExerciseCreated",
"(",
")",
"{",
"notificationType",
"=",
"NotificationType",
".",
"EXERCISE_CREATED",
";",
"expectedTitle",
"=",
"EXERCISE_CREATED_TITLE",
";",
"expectedText",
"=",
"\"A new exercise \\\"\"",
"+",
"exercise",
".",
"getTitle",
"(",
")",
"+",
"\"\\\" got created.\"",
";",
"expectedTarget",
"=",
"createDefaultExpectedTarget",
"(",
"\"exerciseCreated\"",
",",
"\"exercises\"",
",",
"exerciseId",
")",
";",
"expectedPriority",
"=",
"NotificationPriority",
".",
"MEDIUM",
";",
"createAndCheckNotification",
"(",
"Base",
".",
"EXERCISE",
")",
";",
"}"
] | Tests the functionality that deals with notifications that have the notification type of EXERCISE_CREATED. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"EXERCISE_CREATED",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
752,
4386,
9802,
1398,
424,
20603,
67,
1918,
4386,
559,
67,
424,
20603,
6119,
1435,
288,
203,
3639,
3851,
559,
273,
8050,
559,
18,
2294,
654,
7266,
1090,
67,
18546,
31,
203,
3639,
2665,
4247,
273,
5675,
654,
7266,
1090,
67,
18546,
67,
14123,
31,
203,
3639,
2665,
1528,
273,
315,
37,
394,
24165,
11843,
397,
24165,
18,
588,
4247,
1435,
397,
7023,
2363,
2522,
1199,
31,
203,
3639,
2665,
2326,
273,
27346,
6861,
2326,
2932,
8913,
30708,
6119,
3113,
315,
8913,
71,
6141,
3113,
24165,
548,
1769,
203,
3639,
2665,
8183,
273,
8050,
8183,
18,
15971,
2799,
31,
203,
203,
3639,
30545,
1564,
4386,
12,
2171,
18,
2294,
654,
7266,
1090,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
7766,
87,
326,
14176,
716,
443,
1031,
598,
9208,
716,
1240,
326,
3851,
618,
434,
5675,
654,
7266,
1090,
67,
18546,
18,
203,
377,
380,
467,
18,
73,
18,
9208,
716,
1647,
3322,
628,
279,
261,
2704,
715,
13,
2522,
24165,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7988432f8cf12612e57298ede78ce096f39f5da8 | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java | [
"MIT"
] | Java | createNotificationBasedOnExercise_withNotificationType_ExercisePractice | null | @Test
public void createNotificationBasedOnExercise_withNotificationType_ExercisePractice() {
notificationType = NotificationType.EXERCISE_PRACTICE;
expectedTitle = EXERCISE_PRACTICE_TITLE;
expectedText = "Exercise \"" + exercise.getTitle() + "\" is now open for practice.";
expectedTarget = createDefaultExpectedTarget("exerciseUpdated", "exercises", exerciseId);
expectedPriority = NotificationPriority.MEDIUM;
createAndCheckNotification(Base.EXERCISE);
} | /**
* Tests the functionality that deals with notifications that have the notification type of EXERCISE_PRACTICE.
* I.e. notifications that originate from (quiz)exercises that were (just) opened for practice.
*/ | Tests the functionality that deals with notifications that have the notification type of EXERCISE_PRACTICE. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"EXERCISE_PRACTICE",
"."
] | @Test
public void createNotificationBasedOnExercise_withNotificationType_ExercisePractice() {
notificationType = NotificationType.EXERCISE_PRACTICE;
expectedTitle = EXERCISE_PRACTICE_TITLE;
expectedText = "Exercise \"" + exercise.getTitle() + "\" is now open for practice.";
expectedTarget = createDefaultExpectedTarget("exerciseUpdated", "exercises", exerciseId);
expectedPriority = NotificationPriority.MEDIUM;
createAndCheckNotification(Base.EXERCISE);
} | [
"@",
"Test",
"public",
"void",
"createNotificationBasedOnExercise_withNotificationType_ExercisePractice",
"(",
")",
"{",
"notificationType",
"=",
"NotificationType",
".",
"EXERCISE_PRACTICE",
";",
"expectedTitle",
"=",
"EXERCISE_PRACTICE_TITLE",
";",
"expectedText",
"=",
"\"Exercise \\\"\"",
"+",
"exercise",
".",
"getTitle",
"(",
")",
"+",
"\"\\\" is now open for practice.\"",
";",
"expectedTarget",
"=",
"createDefaultExpectedTarget",
"(",
"\"exerciseUpdated\"",
",",
"\"exercises\"",
",",
"exerciseId",
")",
";",
"expectedPriority",
"=",
"NotificationPriority",
".",
"MEDIUM",
";",
"createAndCheckNotification",
"(",
"Base",
".",
"EXERCISE",
")",
";",
"}"
] | Tests the functionality that deals with notifications that have the notification type of EXERCISE_PRACTICE. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"EXERCISE_PRACTICE",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
752,
4386,
9802,
1398,
424,
20603,
67,
1918,
4386,
559,
67,
424,
20603,
52,
14266,
1812,
1435,
288,
203,
3639,
3851,
559,
273,
8050,
559,
18,
2294,
654,
7266,
1090,
67,
52,
2849,
1268,
11774,
31,
203,
3639,
2665,
4247,
273,
5675,
654,
7266,
1090,
67,
52,
2849,
1268,
11774,
67,
14123,
31,
203,
3639,
2665,
1528,
273,
315,
424,
20603,
11843,
397,
24165,
18,
588,
4247,
1435,
397,
7023,
353,
2037,
1696,
364,
27164,
1199,
31,
203,
3639,
2665,
2326,
273,
27346,
6861,
2326,
2932,
8913,
30708,
7381,
3113,
315,
8913,
71,
6141,
3113,
24165,
548,
1769,
203,
3639,
2665,
8183,
273,
8050,
8183,
18,
15971,
2799,
31,
203,
203,
3639,
30545,
1564,
4386,
12,
2171,
18,
2294,
654,
7266,
1090,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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913,
71,
6141,
716,
4591,
261,
3732,
13,
10191,
364,
27164,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7988432f8cf12612e57298ede78ce096f39f5da8 | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java | [
"MIT"
] | Java | createNotificationBasedOnExercise_withNotificationType_QuizExerciseStarted | null | @Test
public void createNotificationBasedOnExercise_withNotificationType_QuizExerciseStarted() {
notificationType = NotificationType.QUIZ_EXERCISE_STARTED;
expectedTitle = QUIZ_EXERCISE_STARTED_TITLE;
expectedText = "Quiz \"" + exercise.getTitle() + "\" just started.";
expectedTarget = createDefaultExpectedTarget("exerciseUpdated", "exercises", exerciseId);
expectedPriority = NotificationPriority.MEDIUM;
createAndCheckNotification(Base.EXERCISE);
} | /**
* Tests the functionality that deals with notifications that have the notification type of QUIZ_EXERCISE_STARTED.
* I.e. notifications that originate from (just) started quiz exercises.
*/ | Tests the functionality that deals with notifications that have the notification type of QUIZ_EXERCISE_STARTED. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"QUIZ_EXERCISE_STARTED",
"."
] | @Test
public void createNotificationBasedOnExercise_withNotificationType_QuizExerciseStarted() {
notificationType = NotificationType.QUIZ_EXERCISE_STARTED;
expectedTitle = QUIZ_EXERCISE_STARTED_TITLE;
expectedText = "Quiz \"" + exercise.getTitle() + "\" just started.";
expectedTarget = createDefaultExpectedTarget("exerciseUpdated", "exercises", exerciseId);
expectedPriority = NotificationPriority.MEDIUM;
createAndCheckNotification(Base.EXERCISE);
} | [
"@",
"Test",
"public",
"void",
"createNotificationBasedOnExercise_withNotificationType_QuizExerciseStarted",
"(",
")",
"{",
"notificationType",
"=",
"NotificationType",
".",
"QUIZ_EXERCISE_STARTED",
";",
"expectedTitle",
"=",
"QUIZ_EXERCISE_STARTED_TITLE",
";",
"expectedText",
"=",
"\"Quiz \\\"\"",
"+",
"exercise",
".",
"getTitle",
"(",
")",
"+",
"\"\\\" just started.\"",
";",
"expectedTarget",
"=",
"createDefaultExpectedTarget",
"(",
"\"exerciseUpdated\"",
",",
"\"exercises\"",
",",
"exerciseId",
")",
";",
"expectedPriority",
"=",
"NotificationPriority",
".",
"MEDIUM",
";",
"createAndCheckNotification",
"(",
"Base",
".",
"EXERCISE",
")",
";",
"}"
] | Tests the functionality that deals with notifications that have the notification type of QUIZ_EXERCISE_STARTED. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"QUIZ_EXERCISE_STARTED",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
752,
4386,
9802,
1398,
424,
20603,
67,
1918,
4386,
559,
67,
928,
452,
424,
20603,
9217,
1435,
288,
203,
3639,
3851,
559,
273,
8050,
559,
18,
3500,
6867,
67,
2294,
654,
7266,
1090,
67,
20943,
6404,
31,
203,
3639,
2665,
4247,
273,
2238,
5370,
62,
67,
2294,
654,
7266,
1090,
67,
20943,
6404,
67,
14123,
31,
203,
3639,
2665,
1528,
273,
315,
928,
452,
11843,
397,
24165,
18,
588,
4247,
1435,
397,
7023,
2537,
5746,
1199,
31,
203,
3639,
2665,
2326,
273,
27346,
6861,
2326,
2932,
8913,
30708,
7381,
3113,
315,
8913,
71,
6141,
3113,
24165,
548,
1769,
203,
3639,
2665,
8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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
7766,
87,
326,
14176,
716,
443,
1031,
598,
9208,
716,
1240,
326,
3851,
618,
434,
2238,
5370,
62,
67,
2294,
654,
7266,
1090,
67,
20943,
6404,
18,
203,
377,
380,
467,
18,
73,
18,
9208,
716,
1647,
3322,
628,
261,
3732,
13,
5746,
16479,
431,
12610,
6141,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7988432f8cf12612e57298ede78ce096f39f5da8 | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java | [
"MIT"
] | Java | createNotificationBasedOnExercise_withNotificationType_ExerciseUpdated_ExamExercise | null | @Test
public void createNotificationBasedOnExercise_withNotificationType_ExerciseUpdated_ExamExercise() {
notificationType = NotificationType.EXERCISE_UPDATED;
when(exercise.isExamExercise()).thenReturn(true);
expectedTitle = LIVE_EXAM_EXERCISE_UPDATE_NOTIFICATION_TITLE;
expectedPriority = NotificationPriority.HIGH;
expectedText = "Exam Exercise \"" + exercise.getTitle() + "\" updated.";
expectedTarget = "{\"problemStatement\":\"" + exercise.getProblemStatement() + "\",\"exercise\":" + exerciseId + ",\"exam\":" + examId + ",\"entity\":\"exams\",\"course\":"
+ courseId + ",\"mainPage\":\"courses\"}";
// EXERCISE_UPDATED's implementation differs from the other types therefore the testing has to be adjusted (more explicit)
// with notification text -> exam popup
createdNotification = groupNotificationFactory.createNotification(exercise, user, groupNotificationType, notificationType, notificationText);
checkCreatedNotificationWithNotificationText();
// without notification text -> silent exam update (expectedText = null)
createdNotification = groupNotificationFactory.createNotification(exercise, user, groupNotificationType, notificationType, null);
checkCreatedNotification(createdNotification, expectedTitle, null, expectedTarget, NotificationPriority.HIGH);
// set behavior back to course exercise
when(exercise.isExamExercise()).thenReturn(false);
} | /**
* Tests the functionality that deals with notifications that have the notification type of EXERCISE_UPDATED and are part of an exam.
* I.e. notifications that originate from an updated exam exercise.
*/ | Tests the functionality that deals with notifications that have the notification type of EXERCISE_UPDATED and are part of an exam. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"EXERCISE_UPDATED",
"and",
"are",
"part",
"of",
"an",
"exam",
"."
] | @Test
public void createNotificationBasedOnExercise_withNotificationType_ExerciseUpdated_ExamExercise() {
notificationType = NotificationType.EXERCISE_UPDATED;
when(exercise.isExamExercise()).thenReturn(true);
expectedTitle = LIVE_EXAM_EXERCISE_UPDATE_NOTIFICATION_TITLE;
expectedPriority = NotificationPriority.HIGH;
expectedText = "Exam Exercise \"" + exercise.getTitle() + "\" updated.";
expectedTarget = "{\"problemStatement\":\"" + exercise.getProblemStatement() + "\",\"exercise\":" + exerciseId + ",\"exam\":" + examId + ",\"entity\":\"exams\",\"course\":"
+ courseId + ",\"mainPage\":\"courses\"}";
createdNotification = groupNotificationFactory.createNotification(exercise, user, groupNotificationType, notificationType, notificationText);
checkCreatedNotificationWithNotificationText();
createdNotification = groupNotificationFactory.createNotification(exercise, user, groupNotificationType, notificationType, null);
checkCreatedNotification(createdNotification, expectedTitle, null, expectedTarget, NotificationPriority.HIGH);
when(exercise.isExamExercise()).thenReturn(false);
} | [
"@",
"Test",
"public",
"void",
"createNotificationBasedOnExercise_withNotificationType_ExerciseUpdated_ExamExercise",
"(",
")",
"{",
"notificationType",
"=",
"NotificationType",
".",
"EXERCISE_UPDATED",
";",
"when",
"(",
"exercise",
".",
"isExamExercise",
"(",
")",
")",
".",
"thenReturn",
"(",
"true",
")",
";",
"expectedTitle",
"=",
"LIVE_EXAM_EXERCISE_UPDATE_NOTIFICATION_TITLE",
";",
"expectedPriority",
"=",
"NotificationPriority",
".",
"HIGH",
";",
"expectedText",
"=",
"\"Exam Exercise \\\"\"",
"+",
"exercise",
".",
"getTitle",
"(",
")",
"+",
"\"\\\" updated.\"",
";",
"expectedTarget",
"=",
"\"{\\\"problemStatement\\\":\\\"\"",
"+",
"exercise",
".",
"getProblemStatement",
"(",
")",
"+",
"\"\\\",\\\"exercise\\\":\"",
"+",
"exerciseId",
"+",
"\",\\\"exam\\\":\"",
"+",
"examId",
"+",
"\",\\\"entity\\\":\\\"exams\\\",\\\"course\\\":\"",
"+",
"courseId",
"+",
"\",\\\"mainPage\\\":\\\"courses\\\"}\"",
";",
"createdNotification",
"=",
"groupNotificationFactory",
".",
"createNotification",
"(",
"exercise",
",",
"user",
",",
"groupNotificationType",
",",
"notificationType",
",",
"notificationText",
")",
";",
"checkCreatedNotificationWithNotificationText",
"(",
")",
";",
"createdNotification",
"=",
"groupNotificationFactory",
".",
"createNotification",
"(",
"exercise",
",",
"user",
",",
"groupNotificationType",
",",
"notificationType",
",",
"null",
")",
";",
"checkCreatedNotification",
"(",
"createdNotification",
",",
"expectedTitle",
",",
"null",
",",
"expectedTarget",
",",
"NotificationPriority",
".",
"HIGH",
")",
";",
"when",
"(",
"exercise",
".",
"isExamExercise",
"(",
")",
")",
".",
"thenReturn",
"(",
"false",
")",
";",
"}"
] | Tests the functionality that deals with notifications that have the notification type of EXERCISE_UPDATED and are part of an exam. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"EXERCISE_UPDATED",
"and",
"are",
"part",
"of",
"an",
"exam",
"."
] | [
"// EXERCISE_UPDATED's implementation differs from the other types therefore the testing has to be adjusted (more explicit)",
"// with notification text -> exam popup",
"// without notification text -> silent exam update (expectedText = null)",
"// set behavior back to course exercise"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
752,
4386,
9802,
1398,
424,
20603,
67,
1918,
4386,
559,
67,
424,
20603,
7381,
67,
424,
301,
424,
20603,
1435,
288,
203,
3639,
3851,
559,
273,
8050,
559,
18,
2294,
654,
7266,
1090,
67,
8217,
40,
31,
203,
203,
3639,
1347,
12,
8913,
30708,
18,
291,
424,
301,
424,
20603,
1435,
2934,
15991,
990,
12,
3767,
1769,
203,
203,
3639,
2665,
4247,
273,
511,
5354,
67,
2294,
2192,
67,
2294,
654,
7266,
1090,
67,
8217,
67,
4400,
14865,
67,
14123,
31,
203,
3639,
2665,
8183,
273,
8050,
8183,
18,
29996,
31,
203,
3639,
2665,
1528,
273,
315,
424,
301,
1312,
20603,
11843,
397,
24165,
18,
588,
4247,
1435,
397,
7023,
3526,
1199,
31,
203,
3639,
2665,
2326,
273,
4144,
2412,
18968,
3406,
21392,
8530,
397,
24165,
18,
588,
13719,
3406,
1435,
397,
1548,
3113,
2412,
8913,
30708,
2412,
2773,
397,
24165,
548,
397,
3104,
2412,
338,
301,
2412,
2773,
397,
19707,
548,
397,
3104,
2412,
1096,
21392,
2412,
338,
301,
87,
22564,
2412,
5566,
2412,
2773,
203,
7734,
397,
4362,
548,
397,
3104,
2412,
5254,
1964,
21392,
2412,
15804,
2412,
1532,
31,
203,
203,
3639,
368,
5675,
654,
7266,
1090,
67,
8217,
40,
1807,
4471,
21944,
628,
326,
1308,
1953,
13526,
326,
7769,
711,
358,
506,
13940,
261,
10161,
5515,
13,
203,
203,
3639,
368,
598,
3851,
977,
317,
19707,
10431,
203,
3639,
2522,
4386,
273,
1041,
4386,
1733,
18,
2640,
4386,
12,
8913,
30708,
16,
729,
16,
1041,
4386,
559,
16,
3851,
559,
16,
3851,
1528,
1769,
203,
3639,
866,
6119,
4386,
1190,
4386,
1528,
5621,
203,
203,
3639,
368,
2887,
3851,
977,
317,
10404,
19707,
1089,
261,
3825,
1528,
273,
446,
13,
203,
3639,
2522,
4386,
273,
1041,
4386,
1733,
18,
2640,
4386,
12,
8913,
30708,
16,
729,
16,
1041,
4386,
559,
16,
3851,
559,
16,
446,
1769,
203,
3639,
866,
6119,
4386,
12,
4824,
4386,
16,
2665,
4247,
16,
446,
16,
2665,
2326,
16,
8050,
8183,
18,
29996,
1769,
203,
203,
3639,
368,
444,
6885,
1473,
358,
4362,
24165,
203,
3639,
1347,
12,
8913,
30708,
18,
291,
424,
301,
424,
20603,
1435,
2934,
15991,
990,
12,
5743,
1769,
203,
565,
289,
2,
0,
0,
0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266,
1090,
67,
8217,
40,
471,
854,
1087,
434,
392,
19707,
18,
203,
377,
380,
467,
18,
73,
18,
9208,
716,
1647,
3322,
628,
392,
3526,
19707,
24165,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7988432f8cf12612e57298ede78ce096f39f5da8 | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java | [
"MIT"
] | Java | createNotificationBasedOnExercise_withNotificationType_ExerciseUpdated_CourseExercise | null | @Test
public void createNotificationBasedOnExercise_withNotificationType_ExerciseUpdated_CourseExercise() {
notificationType = NotificationType.EXERCISE_UPDATED;
expectedTitle = EXERCISE_UPDATED_TITLE;
expectedText = "Exercise \"" + exercise.getTitle() + "\" updated.";
expectedPriority = NotificationPriority.MEDIUM;
expectedTarget = createDefaultExpectedTarget("exerciseUpdated", "exercises", exerciseId);
createAndCheckNotification(Base.EXERCISE);
} | /**
* Tests the functionality that deals with notifications that have the notification type of EXERCISE_UPDATED and are course exercises.
* I.e. notifications that originate from an updated course exercise (not part of an exam).
*/ | Tests the functionality that deals with notifications that have the notification type of EXERCISE_UPDATED and are course exercises. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"EXERCISE_UPDATED",
"and",
"are",
"course",
"exercises",
"."
] | @Test
public void createNotificationBasedOnExercise_withNotificationType_ExerciseUpdated_CourseExercise() {
notificationType = NotificationType.EXERCISE_UPDATED;
expectedTitle = EXERCISE_UPDATED_TITLE;
expectedText = "Exercise \"" + exercise.getTitle() + "\" updated.";
expectedPriority = NotificationPriority.MEDIUM;
expectedTarget = createDefaultExpectedTarget("exerciseUpdated", "exercises", exerciseId);
createAndCheckNotification(Base.EXERCISE);
} | [
"@",
"Test",
"public",
"void",
"createNotificationBasedOnExercise_withNotificationType_ExerciseUpdated_CourseExercise",
"(",
")",
"{",
"notificationType",
"=",
"NotificationType",
".",
"EXERCISE_UPDATED",
";",
"expectedTitle",
"=",
"EXERCISE_UPDATED_TITLE",
";",
"expectedText",
"=",
"\"Exercise \\\"\"",
"+",
"exercise",
".",
"getTitle",
"(",
")",
"+",
"\"\\\" updated.\"",
";",
"expectedPriority",
"=",
"NotificationPriority",
".",
"MEDIUM",
";",
"expectedTarget",
"=",
"createDefaultExpectedTarget",
"(",
"\"exerciseUpdated\"",
",",
"\"exercises\"",
",",
"exerciseId",
")",
";",
"createAndCheckNotification",
"(",
"Base",
".",
"EXERCISE",
")",
";",
"}"
] | Tests the functionality that deals with notifications that have the notification type of EXERCISE_UPDATED and are course exercises. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"EXERCISE_UPDATED",
"and",
"are",
"course",
"exercises",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
752,
4386,
9802,
1398,
424,
20603,
67,
1918,
4386,
559,
67,
424,
20603,
7381,
67,
39,
3117,
424,
20603,
1435,
288,
203,
3639,
3851,
559,
273,
8050,
559,
18,
2294,
654,
7266,
1090,
67,
8217,
40,
31,
203,
203,
3639,
2665,
4247,
273,
5675,
654,
7266,
1090,
67,
8217,
40,
67,
14123,
31,
203,
3639,
2665,
1528,
273,
315,
424,
20603,
11843,
397,
24165,
18,
588,
4247,
1435,
397,
7023,
3526,
1199,
31,
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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
7766,
87,
326,
14176,
716,
443,
1031,
598,
9208,
716,
1240,
326,
3851,
618,
434,
5675,
654,
7266,
1090,
67,
8217,
40,
471,
854,
4362,
431,
12610,
6141,
18,
203,
377,
380,
467,
18,
73,
18,
9208,
716,
1647,
3322,
628,
392,
3526,
4362,
24165,
261,
902,
1087,
434,
392,
19707,
2934,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7988432f8cf12612e57298ede78ce096f39f5da8 | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java | [
"MIT"
] | Java | createNotificationBasedOnPost_withNotificationType_NewPostForExercise | null | @Test
public void createNotificationBasedOnPost_withNotificationType_NewPostForExercise() {
notificationType = NotificationType.NEW_POST_FOR_EXERCISE;
expectedTitle = NEW_POST_FOR_EXERCISE_TITLE;
expectedText = "Exercise \"" + exercise.getTitle() + "\" got a new post.";
expectedPriority = NotificationPriority.MEDIUM;
expectedTarget = createDefaultExpectedTarget("newPost", "exercises", exerciseId);
createAndCheckNotification(Base.POST);
} | /**
* Tests the functionality that deals with notifications that have the notification type of NEW_POST_FOR_EXERCISE.
* I.e. notifications that originate from a new post concerning an exercise.
*/ | Tests the functionality that deals with notifications that have the notification type of NEW_POST_FOR_EXERCISE. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"NEW_POST_FOR_EXERCISE",
"."
] | @Test
public void createNotificationBasedOnPost_withNotificationType_NewPostForExercise() {
notificationType = NotificationType.NEW_POST_FOR_EXERCISE;
expectedTitle = NEW_POST_FOR_EXERCISE_TITLE;
expectedText = "Exercise \"" + exercise.getTitle() + "\" got a new post.";
expectedPriority = NotificationPriority.MEDIUM;
expectedTarget = createDefaultExpectedTarget("newPost", "exercises", exerciseId);
createAndCheckNotification(Base.POST);
} | [
"@",
"Test",
"public",
"void",
"createNotificationBasedOnPost_withNotificationType_NewPostForExercise",
"(",
")",
"{",
"notificationType",
"=",
"NotificationType",
".",
"NEW_POST_FOR_EXERCISE",
";",
"expectedTitle",
"=",
"NEW_POST_FOR_EXERCISE_TITLE",
";",
"expectedText",
"=",
"\"Exercise \\\"\"",
"+",
"exercise",
".",
"getTitle",
"(",
")",
"+",
"\"\\\" got a new post.\"",
";",
"expectedPriority",
"=",
"NotificationPriority",
".",
"MEDIUM",
";",
"expectedTarget",
"=",
"createDefaultExpectedTarget",
"(",
"\"newPost\"",
",",
"\"exercises\"",
",",
"exerciseId",
")",
";",
"createAndCheckNotification",
"(",
"Base",
".",
"POST",
")",
";",
"}"
] | Tests the functionality that deals with notifications that have the notification type of NEW_POST_FOR_EXERCISE. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"NEW_POST_FOR_EXERCISE",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
752,
4386,
9802,
1398,
3349,
67,
1918,
4386,
559,
67,
1908,
3349,
1290,
424,
20603,
1435,
288,
203,
3639,
3851,
559,
273,
8050,
559,
18,
12917,
67,
3798,
67,
7473,
67,
2294,
654,
7266,
1090,
31,
203,
203,
3639,
2665,
4247,
273,
12887,
67,
3798,
67,
7473,
67,
2294,
654,
7266,
1090,
67,
14123,
31,
203,
3639,
2665,
1528,
273,
315,
424,
20603,
11843,
397,
24165,
18,
588,
4247,
1435,
397,
7023,
2363,
279,
394,
1603,
1199,
31,
203,
3639,
2665,
8183,
273,
8050,
8183,
18,
15971,
2799,
31,
203,
3639,
2665,
2326,
273,
27346,
6861,
2326,
2932,
2704,
3349,
3113,
315,
8913,
71,
6141,
3113,
24165,
548,
1769,
203,
203,
3639,
30545,
1564,
4386,
12,
2171,
18,
3798,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,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,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
7766,
87,
326,
14176,
716,
443,
1031,
598,
9208,
716,
1240,
326,
3851,
618,
434,
12887,
67,
3798,
67,
7473,
67,
2294,
654,
7266,
1090,
18,
203,
377,
380,
467,
18,
73,
18,
9208,
716,
1647,
3322,
628,
279,
394,
1603,
356,
2750,
2093,
392,
24165,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7988432f8cf12612e57298ede78ce096f39f5da8 | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java | [
"MIT"
] | Java | createNotificationBasedOnPost_withNotificationType_NewPostForLecture | null | @Test
public void createNotificationBasedOnPost_withNotificationType_NewPostForLecture() {
notificationType = NotificationType.NEW_POST_FOR_LECTURE;
expectedTitle = NEW_POST_FOR_LECTURE_TITLE;
expectedText = "Lecture \"" + lecture.getTitle() + "\" got a new post.";
expectedPriority = NotificationPriority.MEDIUM;
expectedTarget = createDefaultExpectedTarget("newPost", "lectures", lectureId);
createAndCheckNotification(Base.POST);
} | /**
* Tests the functionality that deals with notifications that have the notification type of NEW_POST_FOR_LECTURE.
* I.e. notifications that originate from a new post concerning a lecture.
*/ | Tests the functionality that deals with notifications that have the notification type of NEW_POST_FOR_LECTURE. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"NEW_POST_FOR_LECTURE",
"."
] | @Test
public void createNotificationBasedOnPost_withNotificationType_NewPostForLecture() {
notificationType = NotificationType.NEW_POST_FOR_LECTURE;
expectedTitle = NEW_POST_FOR_LECTURE_TITLE;
expectedText = "Lecture \"" + lecture.getTitle() + "\" got a new post.";
expectedPriority = NotificationPriority.MEDIUM;
expectedTarget = createDefaultExpectedTarget("newPost", "lectures", lectureId);
createAndCheckNotification(Base.POST);
} | [
"@",
"Test",
"public",
"void",
"createNotificationBasedOnPost_withNotificationType_NewPostForLecture",
"(",
")",
"{",
"notificationType",
"=",
"NotificationType",
".",
"NEW_POST_FOR_LECTURE",
";",
"expectedTitle",
"=",
"NEW_POST_FOR_LECTURE_TITLE",
";",
"expectedText",
"=",
"\"Lecture \\\"\"",
"+",
"lecture",
".",
"getTitle",
"(",
")",
"+",
"\"\\\" got a new post.\"",
";",
"expectedPriority",
"=",
"NotificationPriority",
".",
"MEDIUM",
";",
"expectedTarget",
"=",
"createDefaultExpectedTarget",
"(",
"\"newPost\"",
",",
"\"lectures\"",
",",
"lectureId",
")",
";",
"createAndCheckNotification",
"(",
"Base",
".",
"POST",
")",
";",
"}"
] | Tests the functionality that deals with notifications that have the notification type of NEW_POST_FOR_LECTURE. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"NEW_POST_FOR_LECTURE",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
752,
4386,
9802,
1398,
3349,
67,
1918,
4386,
559,
67,
1908,
3349,
1290,
48,
386,
594,
1435,
288,
203,
3639,
3851,
559,
273,
8050,
559,
18,
12917,
67,
3798,
67,
7473,
67,
3918,
4830,
31,
203,
203,
3639,
2665,
4247,
273,
12887,
67,
3798,
67,
7473,
67,
3918,
4830,
67,
14123,
31,
203,
3639,
2665,
1528,
273,
315,
48,
386,
594,
11843,
397,
884,
299,
594,
18,
588,
4247,
1435,
397,
7023,
2363,
279,
394,
1603,
1199,
31,
203,
3639,
2665,
8183,
273,
8050,
8183,
18,
15971,
2799,
31,
203,
3639,
2665,
2326,
273,
27346,
6861,
2326,
2932,
2704,
3349,
3113,
315,
1582,
1823,
3113,
884,
299,
594,
548,
1769,
203,
203,
3639,
30545,
1564,
4386,
12,
2171,
18,
3798,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
7766,
87,
326,
14176,
716,
443,
1031,
598,
9208,
716,
1240,
326,
3851,
618,
434,
12887,
67,
3798,
67,
7473,
67,
3918,
4830,
18,
203,
377,
380,
467,
18,
73,
18,
9208,
716,
1647,
3322,
628,
279,
394,
1603,
356,
2750,
2093,
279,
884,
299,
594,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7988432f8cf12612e57298ede78ce096f39f5da8 | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java | [
"MIT"
] | Java | createNotificationBasedOnAnswerPost_withNotificationType_NewAnswerPostForExercise | null | @Test
public void createNotificationBasedOnAnswerPost_withNotificationType_NewAnswerPostForExercise() {
notificationType = NotificationType.NEW_ANSWER_POST_FOR_EXERCISE;
expectedTitle = NEW_ANSWER_POST_FOR_EXERCISE_TITLE;
expectedText = "Exercise \"" + exercise.getTitle() + "\" got a new reply.";
expectedPriority = NotificationPriority.MEDIUM;
expectedTarget = createDefaultExpectedTarget("newAnswerPost", "exercises", exerciseId);
createAndCheckNotification(Base.ANSWER_POST);
} | /**
* Tests the functionality that deals with notifications that have the notification type of NEW_ANSWER_POST_FOR_EXERCISE.
* I.e. notifications that originate from a new answer post concerning an exercise.
*/ | Tests the functionality that deals with notifications that have the notification type of NEW_ANSWER_POST_FOR_EXERCISE. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"NEW_ANSWER_POST_FOR_EXERCISE",
"."
] | @Test
public void createNotificationBasedOnAnswerPost_withNotificationType_NewAnswerPostForExercise() {
notificationType = NotificationType.NEW_ANSWER_POST_FOR_EXERCISE;
expectedTitle = NEW_ANSWER_POST_FOR_EXERCISE_TITLE;
expectedText = "Exercise \"" + exercise.getTitle() + "\" got a new reply.";
expectedPriority = NotificationPriority.MEDIUM;
expectedTarget = createDefaultExpectedTarget("newAnswerPost", "exercises", exerciseId);
createAndCheckNotification(Base.ANSWER_POST);
} | [
"@",
"Test",
"public",
"void",
"createNotificationBasedOnAnswerPost_withNotificationType_NewAnswerPostForExercise",
"(",
")",
"{",
"notificationType",
"=",
"NotificationType",
".",
"NEW_ANSWER_POST_FOR_EXERCISE",
";",
"expectedTitle",
"=",
"NEW_ANSWER_POST_FOR_EXERCISE_TITLE",
";",
"expectedText",
"=",
"\"Exercise \\\"\"",
"+",
"exercise",
".",
"getTitle",
"(",
")",
"+",
"\"\\\" got a new reply.\"",
";",
"expectedPriority",
"=",
"NotificationPriority",
".",
"MEDIUM",
";",
"expectedTarget",
"=",
"createDefaultExpectedTarget",
"(",
"\"newAnswerPost\"",
",",
"\"exercises\"",
",",
"exerciseId",
")",
";",
"createAndCheckNotification",
"(",
"Base",
".",
"ANSWER_POST",
")",
";",
"}"
] | Tests the functionality that deals with notifications that have the notification type of NEW_ANSWER_POST_FOR_EXERCISE. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"NEW_ANSWER_POST_FOR_EXERCISE",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
752,
4386,
9802,
1398,
13203,
3349,
67,
1918,
4386,
559,
67,
1908,
13203,
3349,
1290,
424,
20603,
1435,
288,
203,
3639,
3851,
559,
273,
8050,
559,
18,
12917,
67,
11607,
18839,
67,
3798,
67,
7473,
67,
2294,
654,
7266,
1090,
31,
203,
203,
3639,
2665,
4247,
273,
12887,
67,
11607,
18839,
67,
3798,
67,
7473,
67,
2294,
654,
7266,
1090,
67,
14123,
31,
203,
3639,
2665,
1528,
273,
315,
424,
20603,
11843,
397,
24165,
18,
588,
4247,
1435,
397,
7023,
2363,
279,
394,
4332,
1199,
31,
203,
3639,
2665,
8183,
273,
8050,
8183,
18,
15971,
2799,
31,
203,
3639,
2665,
2326,
273,
27346,
6861,
2326,
2932,
2704,
13203,
3349,
3113,
315,
8913,
71,
6141,
3113,
24165,
548,
1769,
203,
203,
3639,
30545,
1564,
4386,
12,
2171,
18,
11607,
18839,
67,
3798,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
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
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
7766,
87,
326,
14176,
716,
443,
1031,
598,
9208,
716,
1240,
326,
3851,
618,
434,
12887,
67,
11607,
18839,
67,
3798,
67,
7473,
67,
2294,
654,
7266,
1090,
18,
203,
377,
380,
467,
18,
73,
18,
9208,
716,
1647,
3322,
628,
279,
394,
5803,
1603,
356,
2750,
2093,
392,
24165,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7988432f8cf12612e57298ede78ce096f39f5da8 | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java | [
"MIT"
] | Java | createNotificationBasedOnAnswerPost_withNotificationType_NewAnswerPostForLecture | null | @Test
public void createNotificationBasedOnAnswerPost_withNotificationType_NewAnswerPostForLecture() {
notificationType = NotificationType.NEW_ANSWER_POST_FOR_LECTURE;
expectedTitle = NEW_ANSWER_POST_FOR_LECTURE_TITLE;
expectedText = "Lecture \"" + lecture.getTitle() + "\" got a new reply.";
expectedPriority = NotificationPriority.MEDIUM;
expectedTarget = createDefaultExpectedTarget("newAnswerPost", "lectures", lectureId);
createAndCheckNotification(Base.ANSWER_POST);
} | /**
* Tests the functionality that deals with notifications that have the notification type of NEW_ANSWER_POST_FOR_LECTURE.
* I.e. notifications that originate from a new answer post concerning a lecture.
*/ | Tests the functionality that deals with notifications that have the notification type of NEW_ANSWER_POST_FOR_LECTURE. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"NEW_ANSWER_POST_FOR_LECTURE",
"."
] | @Test
public void createNotificationBasedOnAnswerPost_withNotificationType_NewAnswerPostForLecture() {
notificationType = NotificationType.NEW_ANSWER_POST_FOR_LECTURE;
expectedTitle = NEW_ANSWER_POST_FOR_LECTURE_TITLE;
expectedText = "Lecture \"" + lecture.getTitle() + "\" got a new reply.";
expectedPriority = NotificationPriority.MEDIUM;
expectedTarget = createDefaultExpectedTarget("newAnswerPost", "lectures", lectureId);
createAndCheckNotification(Base.ANSWER_POST);
} | [
"@",
"Test",
"public",
"void",
"createNotificationBasedOnAnswerPost_withNotificationType_NewAnswerPostForLecture",
"(",
")",
"{",
"notificationType",
"=",
"NotificationType",
".",
"NEW_ANSWER_POST_FOR_LECTURE",
";",
"expectedTitle",
"=",
"NEW_ANSWER_POST_FOR_LECTURE_TITLE",
";",
"expectedText",
"=",
"\"Lecture \\\"\"",
"+",
"lecture",
".",
"getTitle",
"(",
")",
"+",
"\"\\\" got a new reply.\"",
";",
"expectedPriority",
"=",
"NotificationPriority",
".",
"MEDIUM",
";",
"expectedTarget",
"=",
"createDefaultExpectedTarget",
"(",
"\"newAnswerPost\"",
",",
"\"lectures\"",
",",
"lectureId",
")",
";",
"createAndCheckNotification",
"(",
"Base",
".",
"ANSWER_POST",
")",
";",
"}"
] | Tests the functionality that deals with notifications that have the notification type of NEW_ANSWER_POST_FOR_LECTURE. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"NEW_ANSWER_POST_FOR_LECTURE",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
752,
4386,
9802,
1398,
13203,
3349,
67,
1918,
4386,
559,
67,
1908,
13203,
3349,
1290,
48,
386,
594,
1435,
288,
203,
3639,
3851,
559,
273,
8050,
559,
18,
12917,
67,
11607,
18839,
67,
3798,
67,
7473,
67,
3918,
4830,
31,
203,
203,
3639,
2665,
4247,
273,
12887,
67,
11607,
18839,
67,
3798,
67,
7473,
67,
3918,
4830,
67,
14123,
31,
203,
3639,
2665,
1528,
273,
315,
48,
386,
594,
11843,
397,
884,
299,
594,
18,
588,
4247,
1435,
397,
7023,
2363,
279,
394,
4332,
1199,
31,
203,
3639,
2665,
8183,
273,
8050,
8183,
18,
15971,
2799,
31,
203,
3639,
2665,
2326,
273,
27346,
6861,
2326,
2932,
2704,
13203,
3349,
3113,
315,
1582,
1823,
3113,
884,
299,
594,
548,
1769,
203,
203,
3639,
30545,
1564,
4386,
12,
2171,
18,
11607,
18839,
67,
3798,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
7766,
87,
326,
14176,
716,
443,
1031,
598,
9208,
716,
1240,
326,
3851,
618,
434,
12887,
67,
11607,
18839,
67,
3798,
67,
7473,
67,
3918,
4830,
18,
203,
377,
380,
467,
18,
73,
18,
9208,
716,
1647,
3322,
628,
279,
394,
5803,
1603,
356,
2750,
2093,
279,
884,
299,
594,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |
7988432f8cf12612e57298ede78ce096f39f5da8 | ls1intum/Artemis | src/test/java/de/tum/in/www1/artemis/domain/notification/GroupNotificationFactoryTest.java | [
"MIT"
] | Java | createNotificationBasedOnCourse_withNotificationType_CourseArchiveStarted | null | @Test
public void createNotificationBasedOnCourse_withNotificationType_CourseArchiveStarted() {
notificationType = NotificationType.COURSE_ARCHIVE_STARTED;
expectedTitle = COURSE_ARCHIVE_STARTED_TITLE;
expectedText = "The course \"" + course.getTitle() + "\" is being archived.";
expectedPriority = NotificationPriority.MEDIUM;
expectedTarget = createDefaultExpectedTarget("courseArchiveUpdated", "courses", courseId);
createAndCheckNotification(Base.COURSE);
} | /**
* Tests the functionality that deals with notifications that have the notification type of COURSE_ARCHIVE_STARTED.
* I.e. notifications that are created when the process of archiving a course has been started.
*/ | Tests the functionality that deals with notifications that have the notification type of COURSE_ARCHIVE_STARTED. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"COURSE_ARCHIVE_STARTED",
"."
] | @Test
public void createNotificationBasedOnCourse_withNotificationType_CourseArchiveStarted() {
notificationType = NotificationType.COURSE_ARCHIVE_STARTED;
expectedTitle = COURSE_ARCHIVE_STARTED_TITLE;
expectedText = "The course \"" + course.getTitle() + "\" is being archived.";
expectedPriority = NotificationPriority.MEDIUM;
expectedTarget = createDefaultExpectedTarget("courseArchiveUpdated", "courses", courseId);
createAndCheckNotification(Base.COURSE);
} | [
"@",
"Test",
"public",
"void",
"createNotificationBasedOnCourse_withNotificationType_CourseArchiveStarted",
"(",
")",
"{",
"notificationType",
"=",
"NotificationType",
".",
"COURSE_ARCHIVE_STARTED",
";",
"expectedTitle",
"=",
"COURSE_ARCHIVE_STARTED_TITLE",
";",
"expectedText",
"=",
"\"The course \\\"\"",
"+",
"course",
".",
"getTitle",
"(",
")",
"+",
"\"\\\" is being archived.\"",
";",
"expectedPriority",
"=",
"NotificationPriority",
".",
"MEDIUM",
";",
"expectedTarget",
"=",
"createDefaultExpectedTarget",
"(",
"\"courseArchiveUpdated\"",
",",
"\"courses\"",
",",
"courseId",
")",
";",
"createAndCheckNotification",
"(",
"Base",
".",
"COURSE",
")",
";",
"}"
] | Tests the functionality that deals with notifications that have the notification type of COURSE_ARCHIVE_STARTED. | [
"Tests",
"the",
"functionality",
"that",
"deals",
"with",
"notifications",
"that",
"have",
"the",
"notification",
"type",
"of",
"COURSE_ARCHIVE_STARTED",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} | [
1,
3495,
21872,
5110,
30,
632,
4709,
203,
565,
1071,
918,
752,
4386,
9802,
1398,
39,
3117,
67,
1918,
4386,
559,
67,
39,
3117,
7465,
9217,
1435,
288,
203,
3639,
3851,
559,
273,
8050,
559,
18,
3865,
23875,
67,
10586,
5354,
67,
20943,
6404,
31,
203,
203,
3639,
2665,
4247,
273,
7910,
23875,
67,
10586,
5354,
67,
20943,
6404,
67,
14123,
31,
203,
3639,
2665,
1528,
273,
315,
1986,
4362,
11843,
397,
4362,
18,
588,
4247,
1435,
397,
7023,
353,
3832,
23276,
1199,
31,
203,
3639,
2665,
8183,
273,
8050,
8183,
18,
15971,
2799,
31,
203,
3639,
2665,
2326,
273,
27346,
6861,
2326,
2932,
5566,
7465,
7381,
3113,
315,
15804,
3113,
4362,
548,
1769,
203,
203,
3639,
30545,
1564,
4386,
12,
2171,
18,
3865,
23875,
1769,
203,
565,
289,
2,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0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0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
] | [
1,
26873,
203,
377,
380,
7766,
87,
326,
14176,
716,
443,
1031,
598,
9208,
716,
1240,
326,
3851,
618,
434,
7910,
23875,
67,
10586,
5354,
67,
20943,
6404,
18,
203,
377,
380,
467,
18,
73,
18,
9208,
716,
854,
2522,
1347,
326,
1207,
434,
6637,
9288,
279,
4362,
711,
2118,
5746,
18,
203,
377,
1195,
2,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100,
-100
] |