repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ppiastucki/recast4j | detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java | PathCorridor.setCorridor | public void setCorridor(float[] target, List<Long> path) {
vCopy(m_target, target);
m_path = new ArrayList<>(path);
} | java | public void setCorridor(float[] target, List<Long> path) {
vCopy(m_target, target);
m_path = new ArrayList<>(path);
} | [
"public",
"void",
"setCorridor",
"(",
"float",
"[",
"]",
"target",
",",
"List",
"<",
"Long",
">",
"path",
")",
"{",
"vCopy",
"(",
"m_target",
",",
"target",
")",
";",
"m_path",
"=",
"new",
"ArrayList",
"<>",
"(",
"path",
")",
";",
"}"
] | Loads a new path and target into the corridor. The current corridor position is expected to be within the first
polygon in the path. The target is expected to be in the last polygon.
@warning The size of the path must not exceed the size of corridor's path buffer set during #init().
@param target
The target location w... | [
"Loads",
"a",
"new",
"path",
"and",
"target",
"into",
"the",
"corridor",
".",
"The",
"current",
"corridor",
"position",
"is",
"expected",
"to",
"be",
"within",
"the",
"first",
"polygon",
"in",
"the",
"path",
".",
"The",
"target",
"is",
"expected",
"to",
... | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detourcrowd/src/main/java/org/recast4j/detour/crowd/PathCorridor.java#L446-L449 | train |
ppiastucki/recast4j | detour-extras/src/main/java/org/recast4j/detour/extras/PolyUtils.java | PolyUtils.findEdge | public static int findEdge(Poly node, Poly neighbour, MeshData tile, MeshData neighbourTile) {
// Compare indices first assuming there are no duplicate vertices
for (int i = 0; i < node.vertCount; i++) {
int j = (i + 1) % node.vertCount;
for (int k = 0; k < neighbour.vertCount; k++) {
int l = (k + 1) % ne... | java | public static int findEdge(Poly node, Poly neighbour, MeshData tile, MeshData neighbourTile) {
// Compare indices first assuming there are no duplicate vertices
for (int i = 0; i < node.vertCount; i++) {
int j = (i + 1) % node.vertCount;
for (int k = 0; k < neighbour.vertCount; k++) {
int l = (k + 1) % ne... | [
"public",
"static",
"int",
"findEdge",
"(",
"Poly",
"node",
",",
"Poly",
"neighbour",
",",
"MeshData",
"tile",
",",
"MeshData",
"neighbourTile",
")",
"{",
"// Compare indices first assuming there are no duplicate vertices",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"... | Find edge shared by 2 polygons within the same tile | [
"Find",
"edge",
"shared",
"by",
"2",
"polygons",
"within",
"the",
"same",
"tile"
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour-extras/src/main/java/org/recast4j/detour/extras/PolyUtils.java#L11-L37 | train |
ppiastucki/recast4j | detour-extras/src/main/java/org/recast4j/detour/extras/PolyUtils.java | PolyUtils.findEdge | public static int findEdge(Poly node, MeshData tile, float value, int comp) {
float error = Float.MAX_VALUE;
int edge = 0;
for (int i = 0; i < node.vertCount; i++) {
int j = (i + 1) % node.vertCount;
float v1 = tile.verts[3 * node.verts[i] + comp] - value;
float v2 = tile.verts[3 * node.verts[j] + comp] ... | java | public static int findEdge(Poly node, MeshData tile, float value, int comp) {
float error = Float.MAX_VALUE;
int edge = 0;
for (int i = 0; i < node.vertCount; i++) {
int j = (i + 1) % node.vertCount;
float v1 = tile.verts[3 * node.verts[i] + comp] - value;
float v2 = tile.verts[3 * node.verts[j] + comp] ... | [
"public",
"static",
"int",
"findEdge",
"(",
"Poly",
"node",
",",
"MeshData",
"tile",
",",
"float",
"value",
",",
"int",
"comp",
")",
"{",
"float",
"error",
"=",
"Float",
".",
"MAX_VALUE",
";",
"int",
"edge",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"... | Find edge closest to the given coordinate | [
"Find",
"edge",
"closest",
"to",
"the",
"given",
"coordinate"
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour-extras/src/main/java/org/recast4j/detour/extras/PolyUtils.java#L51-L65 | train |
ppiastucki/recast4j | detour-extras/src/main/java/org/recast4j/detour/extras/unity/astar/LinkBuilder.java | LinkBuilder.build | void build(int nodeOffset, GraphMeshData graphData, List<int[]> connections) {
for (int n = 0; n < connections.size(); n++) {
int[] nodeConnections = connections.get(n);
MeshData tile = graphData.getTile(n);
Poly node = graphData.getNode(n);
for (int connection : nodeConnections) {
MeshData neighbourT... | java | void build(int nodeOffset, GraphMeshData graphData, List<int[]> connections) {
for (int n = 0; n < connections.size(); n++) {
int[] nodeConnections = connections.get(n);
MeshData tile = graphData.getTile(n);
Poly node = graphData.getNode(n);
for (int connection : nodeConnections) {
MeshData neighbourT... | [
"void",
"build",
"(",
"int",
"nodeOffset",
",",
"GraphMeshData",
"graphData",
",",
"List",
"<",
"int",
"[",
"]",
">",
"connections",
")",
"{",
"for",
"(",
"int",
"n",
"=",
"0",
";",
"n",
"<",
"connections",
".",
"size",
"(",
")",
";",
"n",
"++",
... | Process connections and transform them into recast neighbour flags | [
"Process",
"connections",
"and",
"transform",
"them",
"into",
"recast",
"neighbour",
"flags"
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour-extras/src/main/java/org/recast4j/detour/extras/unity/astar/LinkBuilder.java#L13-L28 | train |
ppiastucki/recast4j | detour-extras/src/main/java/org/recast4j/detour/extras/unity/astar/LinkBuilder.java | LinkBuilder.buildExternalLink | private void buildExternalLink(MeshData tile, Poly node, MeshData neighbourTile) {
if (neighbourTile.header.bmin[0] > tile.header.bmin[0]) {
node.neis[PolyUtils.findEdge(node, tile, neighbourTile.header.bmin[0], 0)] = NavMesh.DT_EXT_LINK;
} else if (neighbourTile.header.bmin[0] < tile.header.bmin[0]) {
node.n... | java | private void buildExternalLink(MeshData tile, Poly node, MeshData neighbourTile) {
if (neighbourTile.header.bmin[0] > tile.header.bmin[0]) {
node.neis[PolyUtils.findEdge(node, tile, neighbourTile.header.bmin[0], 0)] = NavMesh.DT_EXT_LINK;
} else if (neighbourTile.header.bmin[0] < tile.header.bmin[0]) {
node.n... | [
"private",
"void",
"buildExternalLink",
"(",
"MeshData",
"tile",
",",
"Poly",
"node",
",",
"MeshData",
"neighbourTile",
")",
"{",
"if",
"(",
"neighbourTile",
".",
"header",
".",
"bmin",
"[",
"0",
"]",
">",
"tile",
".",
"header",
".",
"bmin",
"[",
"0",
... | In case of external link to other tiles we must find the direction | [
"In",
"case",
"of",
"external",
"link",
"to",
"other",
"tiles",
"we",
"must",
"find",
"the",
"direction"
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour-extras/src/main/java/org/recast4j/detour/extras/unity/astar/LinkBuilder.java#L40-L50 | train |
ppiastucki/recast4j | recast/src/main/java/org/recast4j/recast/RecastContour.java | RecastContour.findLeftMostVertex | private static int[] findLeftMostVertex(Contour contour) {
int minx = contour.verts[0];
int minz = contour.verts[2];
int leftmost = 0;
for (int i = 1; i < contour.nverts; i++) {
int x = contour.verts[i * 4 + 0];
int z = contour.verts[i * 4 + 2];
if (x ... | java | private static int[] findLeftMostVertex(Contour contour) {
int minx = contour.verts[0];
int minz = contour.verts[2];
int leftmost = 0;
for (int i = 1; i < contour.nverts; i++) {
int x = contour.verts[i * 4 + 0];
int z = contour.verts[i * 4 + 2];
if (x ... | [
"private",
"static",
"int",
"[",
"]",
"findLeftMostVertex",
"(",
"Contour",
"contour",
")",
"{",
"int",
"minx",
"=",
"contour",
".",
"verts",
"[",
"0",
"]",
";",
"int",
"minz",
"=",
"contour",
".",
"verts",
"[",
"2",
"]",
";",
"int",
"leftmost",
"=",... | Finds the lowest leftmost vertex of a contour. | [
"Finds",
"the",
"lowest",
"leftmost",
"vertex",
"of",
"a",
"contour",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/recast/src/main/java/org/recast4j/recast/RecastContour.java#L537-L551 | train |
ppiastucki/recast4j | detour/src/main/java/org/recast4j/detour/NavMeshQuery.java | NavMeshQuery.queryPolygons | public Result<List<Long>> queryPolygons(float[] center, float[] halfExtents, QueryFilter filter) {
if (Objects.isNull(center) || !vIsFinite(center) || Objects.isNull(halfExtents) || !vIsFinite(halfExtents)
|| Objects.isNull(filter)) {
// return DT_FAILURE | DT_INVALID_PARAM;
... | java | public Result<List<Long>> queryPolygons(float[] center, float[] halfExtents, QueryFilter filter) {
if (Objects.isNull(center) || !vIsFinite(center) || Objects.isNull(halfExtents) || !vIsFinite(halfExtents)
|| Objects.isNull(filter)) {
// return DT_FAILURE | DT_INVALID_PARAM;
... | [
"public",
"Result",
"<",
"List",
"<",
"Long",
">",
">",
"queryPolygons",
"(",
"float",
"[",
"]",
"center",
",",
"float",
"[",
"]",
"halfExtents",
",",
"QueryFilter",
"filter",
")",
"{",
"if",
"(",
"Objects",
".",
"isNull",
"(",
"center",
")",
"||",
"... | Finds polygons that overlap the search box.
If no polygons are found, the function will return with a polyCount of zero.
@param center
The center of the search box. [(x, y, z)]
@param halfExtents
The search distance along each axis. [(x, y, z)]
@param filter
The polygon filter to apply to the query.
@return The refer... | [
"Finds",
"polygons",
"that",
"overlap",
"the",
"search",
"box",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/NavMeshQuery.java#L657-L682 | train |
ppiastucki/recast4j | detour/src/main/java/org/recast4j/detour/NavMeshQuery.java | NavMeshQuery.initSlicedFindPath | public Status initSlicedFindPath(long startRef, long endRef, float[] startPos, float[] endPos, QueryFilter filter,
int options) {
// Init path state.
m_query = new QueryData();
m_query.status = Status.FAILURE;
m_query.startRef = startRef;
m_query.endRef = endRef;
... | java | public Status initSlicedFindPath(long startRef, long endRef, float[] startPos, float[] endPos, QueryFilter filter,
int options) {
// Init path state.
m_query = new QueryData();
m_query.status = Status.FAILURE;
m_query.startRef = startRef;
m_query.endRef = endRef;
... | [
"public",
"Status",
"initSlicedFindPath",
"(",
"long",
"startRef",
",",
"long",
"endRef",
",",
"float",
"[",
"]",
"startPos",
",",
"float",
"[",
"]",
"endPos",
",",
"QueryFilter",
"filter",
",",
"int",
"options",
")",
"{",
"// Init path state.",
"m_query",
"... | Intializes a sliced path query.
Common use case: -# Call initSlicedFindPath() to initialize the sliced path query. -# Call updateSlicedFindPath()
until it returns complete. -# Call finalizeSlicedFindPath() to get the path.
@param startRef
The reference id of the start polygon.
@param endRef
The reference id of the en... | [
"Intializes",
"a",
"sliced",
"path",
"query",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/NavMeshQuery.java#L889-L939 | train |
ppiastucki/recast4j | detour/src/main/java/org/recast4j/detour/NavMeshQuery.java | NavMeshQuery.getEdgeMidPoint | protected Result<float[]> getEdgeMidPoint(long from, long to) {
Result<PortalResult> ppoints = getPortalPoints(from, to);
if (ppoints.failed()) {
return Result.of(ppoints.status, ppoints.message);
}
float[] left = ppoints.result.left;
float[] right = ppoints.result.ri... | java | protected Result<float[]> getEdgeMidPoint(long from, long to) {
Result<PortalResult> ppoints = getPortalPoints(from, to);
if (ppoints.failed()) {
return Result.of(ppoints.status, ppoints.message);
}
float[] left = ppoints.result.left;
float[] right = ppoints.result.ri... | [
"protected",
"Result",
"<",
"float",
"[",
"]",
">",
"getEdgeMidPoint",
"(",
"long",
"from",
",",
"long",
"to",
")",
"{",
"Result",
"<",
"PortalResult",
">",
"ppoints",
"=",
"getPortalPoints",
"(",
"from",
",",
"to",
")",
";",
"if",
"(",
"ppoints",
".",... | Returns edge mid point between two polygons. | [
"Returns",
"edge",
"mid",
"point",
"between",
"two",
"polygons",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/NavMeshQuery.java#L1851-L1863 | train |
ppiastucki/recast4j | detour/src/main/java/org/recast4j/detour/NavMeshQuery.java | NavMeshQuery.getPathFromDijkstraSearch | public Result<List<Long>> getPathFromDijkstraSearch(long endRef) {
if (!m_nav.isValidPolyRef(endRef)) {
return Result.invalidParam("Invalid end ref");
}
List<Node> nodes = m_nodePool.findNodes(endRef);
if (nodes.size() != 1) {
return Result.invalidParam("Invalid e... | java | public Result<List<Long>> getPathFromDijkstraSearch(long endRef) {
if (!m_nav.isValidPolyRef(endRef)) {
return Result.invalidParam("Invalid end ref");
}
List<Node> nodes = m_nodePool.findNodes(endRef);
if (nodes.size() != 1) {
return Result.invalidParam("Invalid e... | [
"public",
"Result",
"<",
"List",
"<",
"Long",
">",
">",
"getPathFromDijkstraSearch",
"(",
"long",
"endRef",
")",
"{",
"if",
"(",
"!",
"m_nav",
".",
"isValidPolyRef",
"(",
"endRef",
")",
")",
"{",
"return",
"Result",
".",
"invalidParam",
"(",
"\"Invalid end... | Gets a path from the explored nodes in the previous search.
@param endRef
The reference id of the end polygon.
@returns An ordered list of polygon references representing the path. (Start to end.)
@remarks The result of this function depends on the state of the query object. For that reason it should only be
used imme... | [
"Gets",
"a",
"path",
"from",
"the",
"explored",
"nodes",
"in",
"the",
"previous",
"search",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/NavMeshQuery.java#L3033-L3046 | train |
ppiastucki/recast4j | detour/src/main/java/org/recast4j/detour/NavMeshQuery.java | NavMeshQuery.getPathToNode | private List<Long> getPathToNode(Node endNode) {
List<Long> path = new ArrayList<>();
// Reverse the path.
Node curNode = endNode;
do {
path.add(0, curNode.id);
curNode = m_nodePool.getNodeAtIdx(curNode.pidx);
} while (curNode != null);
return pat... | java | private List<Long> getPathToNode(Node endNode) {
List<Long> path = new ArrayList<>();
// Reverse the path.
Node curNode = endNode;
do {
path.add(0, curNode.id);
curNode = m_nodePool.getNodeAtIdx(curNode.pidx);
} while (curNode != null);
return pat... | [
"private",
"List",
"<",
"Long",
">",
"getPathToNode",
"(",
"Node",
"endNode",
")",
"{",
"List",
"<",
"Long",
">",
"path",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"// Reverse the path.",
"Node",
"curNode",
"=",
"endNode",
";",
"do",
"{",
"path",
"... | Gets the path leading to the specified end node. | [
"Gets",
"the",
"path",
"leading",
"to",
"the",
"specified",
"end",
"node",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/NavMeshQuery.java#L3051-L3061 | train |
ppiastucki/recast4j | detourtilecache/src/main/java/org/recast4j/detour/tilecache/TileCache.java | TileCache.update | public boolean update() {
if (m_update.isEmpty()) {
// Process requests.
for (ObstacleRequest req : m_reqs) {
int idx = decodeObstacleIdObstacle(req.ref);
if (idx >= m_obstacles.size()) {
continue;
}
TileCacheObstacle ob = m_obstacles.get(idx);
int salt = deco... | java | public boolean update() {
if (m_update.isEmpty()) {
// Process requests.
for (ObstacleRequest req : m_reqs) {
int idx = decodeObstacleIdObstacle(req.ref);
if (idx >= m_obstacles.size()) {
continue;
}
TileCacheObstacle ob = m_obstacles.get(idx);
int salt = deco... | [
"public",
"boolean",
"update",
"(",
")",
"{",
"if",
"(",
"m_update",
".",
"isEmpty",
"(",
")",
")",
"{",
"// Process requests.",
"for",
"(",
"ObstacleRequest",
"req",
":",
"m_reqs",
")",
"{",
"int",
"idx",
"=",
"decodeObstacleIdObstacle",
"(",
"req",
".",
... | Updates the tile cache by rebuilding tiles touched by unfinished obstacle requests.
@return Returns true if the tile cache is fully up to date with obstacle requests and tile rebuilds. If the tile
cache is up to date another (immediate) call to update will have no effect; otherwise another call will
continue processin... | [
"Updates",
"the",
"tile",
"cache",
"by",
"rebuilding",
"tiles",
"touched",
"by",
"unfinished",
"obstacle",
"requests",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detourtilecache/src/main/java/org/recast4j/detour/tilecache/TileCache.java#L398-L478 | train |
ppiastucki/recast4j | detour/src/main/java/org/recast4j/detour/DetourCommon.java | DetourCommon.randomPointInConvexPoly | static float[] randomPointInConvexPoly(float[] pts, int npts, float[] areas, float s, float t) {
// Calc triangle araes
float areasum = 0.0f;
for (int i = 2; i < npts; i++) {
areas[i] = triArea2D(pts, 0, (i - 1) * 3, i * 3);
areasum += Math.max(0.001f, areas[i]);
... | java | static float[] randomPointInConvexPoly(float[] pts, int npts, float[] areas, float s, float t) {
// Calc triangle araes
float areasum = 0.0f;
for (int i = 2; i < npts; i++) {
areas[i] = triArea2D(pts, 0, (i - 1) * 3, i * 3);
areasum += Math.max(0.001f, areas[i]);
... | [
"static",
"float",
"[",
"]",
"randomPointInConvexPoly",
"(",
"float",
"[",
"]",
"pts",
",",
"int",
"npts",
",",
"float",
"[",
"]",
"areas",
",",
"float",
"s",
",",
"float",
"t",
")",
"{",
"// Calc triangle araes",
"float",
"areasum",
"=",
"0.0f",
";",
... | Adapted from Graphics Gems article. | [
"Adapted",
"from",
"Graphics",
"Gems",
"article",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/detour/src/main/java/org/recast4j/detour/DetourCommon.java#L440-L474 | train |
ppiastucki/recast4j | recast/src/main/java/org/recast4j/recast/RecastMeshDetail.java | RecastMeshDetail.polyMinExtent | private static float polyMinExtent(float[] verts, int nverts) {
float minDist = Float.MAX_VALUE;
for (int i = 0; i < nverts; i++) {
int ni = (i + 1) % nverts;
int p1 = i * 3;
int p2 = ni * 3;
float maxEdgeDist = 0;
for (int j = 0; j < nverts; j... | java | private static float polyMinExtent(float[] verts, int nverts) {
float minDist = Float.MAX_VALUE;
for (int i = 0; i < nverts; i++) {
int ni = (i + 1) % nverts;
int p1 = i * 3;
int p2 = ni * 3;
float maxEdgeDist = 0;
for (int j = 0; j < nverts; j... | [
"private",
"static",
"float",
"polyMinExtent",
"(",
"float",
"[",
"]",
"verts",
",",
"int",
"nverts",
")",
"{",
"float",
"minDist",
"=",
"Float",
".",
"MAX_VALUE",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"nverts",
";",
"i",
"++",
")",... | Calculate minimum extend of the polygon. | [
"Calculate",
"minimum",
"extend",
"of",
"the",
"polygon",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/recast/src/main/java/org/recast4j/recast/RecastMeshDetail.java#L526-L543 | train |
ppiastucki/recast4j | recast/src/main/java/org/recast4j/recast/RecastMesh.java | RecastMesh.left | static boolean left(int[] verts, int a, int b, int c) {
return area2(verts, a, b, c) < 0;
} | java | static boolean left(int[] verts, int a, int b, int c) {
return area2(verts, a, b, c) < 0;
} | [
"static",
"boolean",
"left",
"(",
"int",
"[",
"]",
"verts",
",",
"int",
"a",
",",
"int",
"b",
",",
"int",
"c",
")",
"{",
"return",
"area2",
"(",
"verts",
",",
"a",
",",
"b",
",",
"c",
")",
"<",
"0",
";",
"}"
] | line through a to b. | [
"line",
"through",
"a",
"to",
"b",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/recast/src/main/java/org/recast4j/recast/RecastMesh.java#L158-L160 | train |
ppiastucki/recast4j | recast/src/main/java/org/recast4j/recast/RecastMesh.java | RecastMesh.intersectProp | private static boolean intersectProp(int[] verts, int a, int b, int c, int d) {
// Eliminate improper cases.
if (collinear(verts, a, b, c) || collinear(verts, a, b, d) || collinear(verts, c, d, a)
|| collinear(verts, c, d, b))
return false;
return (left(verts, a, b, ... | java | private static boolean intersectProp(int[] verts, int a, int b, int c, int d) {
// Eliminate improper cases.
if (collinear(verts, a, b, c) || collinear(verts, a, b, d) || collinear(verts, c, d, a)
|| collinear(verts, c, d, b))
return false;
return (left(verts, a, b, ... | [
"private",
"static",
"boolean",
"intersectProp",
"(",
"int",
"[",
"]",
"verts",
",",
"int",
"a",
",",
"int",
"b",
",",
"int",
"c",
",",
"int",
"d",
")",
"{",
"// Eliminate improper cases.",
"if",
"(",
"collinear",
"(",
"verts",
",",
"a",
",",
"b",
",... | intersection is ensured by using strict leftness. | [
"intersection",
"is",
"ensured",
"by",
"using",
"strict",
"leftness",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/recast/src/main/java/org/recast4j/recast/RecastMesh.java#L173-L180 | train |
ppiastucki/recast4j | recast/src/main/java/org/recast4j/recast/RecastMesh.java | RecastMesh.between | private static boolean between(int[] verts, int a, int b, int c) {
if (!collinear(verts, a, b, c))
return false;
// If ab not vertical, check betweenness on x; else on y.
if (verts[a + 0] != verts[b + 0])
return ((verts[a + 0] <= verts[c + 0]) && (verts[c + 0] <= verts[b ... | java | private static boolean between(int[] verts, int a, int b, int c) {
if (!collinear(verts, a, b, c))
return false;
// If ab not vertical, check betweenness on x; else on y.
if (verts[a + 0] != verts[b + 0])
return ((verts[a + 0] <= verts[c + 0]) && (verts[c + 0] <= verts[b ... | [
"private",
"static",
"boolean",
"between",
"(",
"int",
"[",
"]",
"verts",
",",
"int",
"a",
",",
"int",
"b",
",",
"int",
"c",
")",
"{",
"if",
"(",
"!",
"collinear",
"(",
"verts",
",",
"a",
",",
"b",
",",
"c",
")",
")",
"return",
"false",
";",
... | on the closed segement ab. | [
"on",
"the",
"closed",
"segement",
"ab",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/recast/src/main/java/org/recast4j/recast/RecastMesh.java#L184-L194 | train |
ppiastucki/recast4j | recast/src/main/java/org/recast4j/recast/RecastMesh.java | RecastMesh.intersect | static boolean intersect(int[] verts, int a, int b, int c, int d) {
if (intersectProp(verts, a, b, c, d))
return true;
else if (between(verts, a, b, c) || between(verts, a, b, d) || between(verts, c, d, a)
|| between(verts, c, d, b))
return true;
else
... | java | static boolean intersect(int[] verts, int a, int b, int c, int d) {
if (intersectProp(verts, a, b, c, d))
return true;
else if (between(verts, a, b, c) || between(verts, a, b, d) || between(verts, c, d, a)
|| between(verts, c, d, b))
return true;
else
... | [
"static",
"boolean",
"intersect",
"(",
"int",
"[",
"]",
"verts",
",",
"int",
"a",
",",
"int",
"b",
",",
"int",
"c",
",",
"int",
"d",
")",
"{",
"if",
"(",
"intersectProp",
"(",
"verts",
",",
"a",
",",
"b",
",",
"c",
",",
"d",
")",
")",
"return... | Returns true iff segments ab and cd intersect, properly or improperly. | [
"Returns",
"true",
"iff",
"segments",
"ab",
"and",
"cd",
"intersect",
"properly",
"or",
"improperly",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/recast/src/main/java/org/recast4j/recast/RecastMesh.java#L197-L205 | train |
ppiastucki/recast4j | recast/src/main/java/org/recast4j/recast/RecastMesh.java | RecastMesh.inCone | private static boolean inCone(int i, int j, int n, int[] verts, int[] indices) {
int pi = (indices[i] & 0x0fffffff) * 4;
int pj = (indices[j] & 0x0fffffff) * 4;
int pi1 = (indices[next(i, n)] & 0x0fffffff) * 4;
int pin1 = (indices[prev(i, n)] & 0x0fffffff) * 4;
// If P[i] is a co... | java | private static boolean inCone(int i, int j, int n, int[] verts, int[] indices) {
int pi = (indices[i] & 0x0fffffff) * 4;
int pj = (indices[j] & 0x0fffffff) * 4;
int pi1 = (indices[next(i, n)] & 0x0fffffff) * 4;
int pin1 = (indices[prev(i, n)] & 0x0fffffff) * 4;
// If P[i] is a co... | [
"private",
"static",
"boolean",
"inCone",
"(",
"int",
"i",
",",
"int",
"j",
",",
"int",
"n",
",",
"int",
"[",
"]",
"verts",
",",
"int",
"[",
"]",
"indices",
")",
"{",
"int",
"pi",
"=",
"(",
"indices",
"[",
"i",
"]",
"&",
"0x0fffffff",
")",
"*",... | polygon P in the neighborhood of the i endpoint. | [
"polygon",
"P",
"in",
"the",
"neighborhood",
"of",
"the",
"i",
"endpoint",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/recast/src/main/java/org/recast4j/recast/RecastMesh.java#L237-L249 | train |
ppiastucki/recast4j | recast/src/main/java/org/recast4j/recast/RecastMesh.java | RecastMesh.diagonal | private static boolean diagonal(int i, int j, int n, int[] verts, int[] indices) {
return inCone(i, j, n, verts, indices) && diagonalie(i, j, n, verts, indices);
} | java | private static boolean diagonal(int i, int j, int n, int[] verts, int[] indices) {
return inCone(i, j, n, verts, indices) && diagonalie(i, j, n, verts, indices);
} | [
"private",
"static",
"boolean",
"diagonal",
"(",
"int",
"i",
",",
"int",
"j",
",",
"int",
"n",
",",
"int",
"[",
"]",
"verts",
",",
"int",
"[",
"]",
"indices",
")",
"{",
"return",
"inCone",
"(",
"i",
",",
"j",
",",
"n",
",",
"verts",
",",
"indic... | diagonal of P. | [
"diagonal",
"of",
"P",
"."
] | a414dc34f16b87c95fb4e0f46c28a7830d421788 | https://github.com/ppiastucki/recast4j/blob/a414dc34f16b87c95fb4e0f46c28a7830d421788/recast/src/main/java/org/recast4j/recast/RecastMesh.java#L253-L255 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/util/AESHelper.java | AESHelper.encrypt | public static String encrypt(String c, String key) {
try {
SecretKeySpec skeySpec = new SecretKeySpec(Hex.decodeHex(key.toCharArray()), "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] encoded = cipher.doFinal(c... | java | public static String encrypt(String c, String key) {
try {
SecretKeySpec skeySpec = new SecretKeySpec(Hex.decodeHex(key.toCharArray()), "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] encoded = cipher.doFinal(c... | [
"public",
"static",
"String",
"encrypt",
"(",
"String",
"c",
",",
"String",
"key",
")",
"{",
"try",
"{",
"SecretKeySpec",
"skeySpec",
"=",
"new",
"SecretKeySpec",
"(",
"Hex",
".",
"decodeHex",
"(",
"key",
".",
"toCharArray",
"(",
")",
")",
",",
"\"AES\""... | Encrypts a string.
@param c The string to encrypt.
@return The encrypted string in HEX. | [
"Encrypts",
"a",
"string",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/util/AESHelper.java#L44-L56 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java | AbstractTranslator.inject | protected void inject(Collection<? extends Expression> objs) {
for (Object o : objs) {
if (o == null) {
continue;
}
injector.injectMembers(o);
}
} | java | protected void inject(Collection<? extends Expression> objs) {
for (Object o : objs) {
if (o == null) {
continue;
}
injector.injectMembers(o);
}
} | [
"protected",
"void",
"inject",
"(",
"Collection",
"<",
"?",
"extends",
"Expression",
">",
"objs",
")",
"{",
"for",
"(",
"Object",
"o",
":",
"objs",
")",
"{",
"if",
"(",
"o",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"injector",
".",
"injectMember... | Injects dependencies on the given objects.
@param objs The objects to be injected. | [
"Injects",
"dependencies",
"on",
"the",
"given",
"objects",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java#L102-L110 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java | AbstractTranslator.join | protected String join(Collection<?> list, String delimiter) {
return Joiner.on(delimiter).join(list);
} | java | protected String join(Collection<?> list, String delimiter) {
return Joiner.on(delimiter).join(list);
} | [
"protected",
"String",
"join",
"(",
"Collection",
"<",
"?",
">",
"list",
",",
"String",
"delimiter",
")",
"{",
"return",
"Joiner",
".",
"on",
"(",
"delimiter",
")",
".",
"join",
"(",
"list",
")",
";",
"}"
] | Joins a collection of objects given the delimiter.
@param list The collection of objects to join.
@param delimiter The delimiter.
@return A String representing the given objects separated by the delimiter. | [
"Joins",
"a",
"collection",
"of",
"objects",
"given",
"the",
"delimiter",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java#L119-L121 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java | AbstractTranslator.translate | public String translate(final When when) {
inject(when.condition);
inject(when.action);
return String.format("WHEN %s THEN %s",
when.condition.translate(),
when.action.translate());
} | java | public String translate(final When when) {
inject(when.condition);
inject(when.action);
return String.format("WHEN %s THEN %s",
when.condition.translate(),
when.action.translate());
} | [
"public",
"String",
"translate",
"(",
"final",
"When",
"when",
")",
"{",
"inject",
"(",
"when",
".",
"condition",
")",
";",
"inject",
"(",
"when",
".",
"action",
")",
";",
"return",
"String",
".",
"format",
"(",
"\"WHEN %s THEN %s\"",
",",
"when",
".",
... | Translates When.
@param when a when.
@return when translation. | [
"Translates",
"When",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java#L377-L384 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java | AbstractTranslator.translate | public String translate(final Case aCase) {
String elseString = "";
if (aCase.getFalseAction() != null) {
inject(aCase.getFalseAction());
elseString = String.format("ELSE %s", aCase.getFalseAction().translate());
}
final String whens = aCase.whens.stream()
... | java | public String translate(final Case aCase) {
String elseString = "";
if (aCase.getFalseAction() != null) {
inject(aCase.getFalseAction());
elseString = String.format("ELSE %s", aCase.getFalseAction().translate());
}
final String whens = aCase.whens.stream()
... | [
"public",
"String",
"translate",
"(",
"final",
"Case",
"aCase",
")",
"{",
"String",
"elseString",
"=",
"\"\"",
";",
"if",
"(",
"aCase",
".",
"getFalseAction",
"(",
")",
"!=",
"null",
")",
"{",
"inject",
"(",
"aCase",
".",
"getFalseAction",
"(",
")",
")... | Translates Case.
@param aCase a case.
@return case translation. | [
"Translates",
"Case",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java#L392-L407 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java | AbstractTranslator.translate | public String translate(final Values values) {
final ArrayList<Values.Row> rows = new ArrayList<>(values.getRows());
final String[] aliases = values.getAliases();
// If aliases does not exist, throw an exception.
// Otherwise, apply them to the columns.
if (aliases == null || al... | java | public String translate(final Values values) {
final ArrayList<Values.Row> rows = new ArrayList<>(values.getRows());
final String[] aliases = values.getAliases();
// If aliases does not exist, throw an exception.
// Otherwise, apply them to the columns.
if (aliases == null || al... | [
"public",
"String",
"translate",
"(",
"final",
"Values",
"values",
")",
"{",
"final",
"ArrayList",
"<",
"Values",
".",
"Row",
">",
"rows",
"=",
"new",
"ArrayList",
"<>",
"(",
"values",
".",
"getRows",
"(",
")",
")",
";",
"final",
"String",
"[",
"]",
... | Translates Values.
@param values a values.
@return values translation. | [
"Translates",
"Values",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java#L440-L474 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java | AbstractTranslator.translate | public String translate(final Values.Row row) {
inject(row.getExpressions());
final String translation = row.getExpressions().stream()
.map(expression -> {
// Enforce aliases to be translated.
final String alias = expression.isAliased() ? " AS " +... | java | public String translate(final Values.Row row) {
inject(row.getExpressions());
final String translation = row.getExpressions().stream()
.map(expression -> {
// Enforce aliases to be translated.
final String alias = expression.isAliased() ? " AS " +... | [
"public",
"String",
"translate",
"(",
"final",
"Values",
".",
"Row",
"row",
")",
"{",
"inject",
"(",
"row",
".",
"getExpressions",
"(",
")",
")",
";",
"final",
"String",
"translation",
"=",
"row",
".",
"getExpressions",
"(",
")",
".",
"stream",
"(",
")... | Translates Values.Row.
@param row a values.row.
@return values.row translation. | [
"Translates",
"Values",
".",
"Row",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java#L482-L494 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java | AbstractTranslator.rowsToUnion | protected Union rowsToUnion(final List<Expression> rows) {
// Create an union in form of a binary tree from a list of rows.
// The tree shape is to prevent stack overflow on some
// database engines when the list of rows is too big.
List<Expression> rowsWithSelect = new ArrayList<>(rows... | java | protected Union rowsToUnion(final List<Expression> rows) {
// Create an union in form of a binary tree from a list of rows.
// The tree shape is to prevent stack overflow on some
// database engines when the list of rows is too big.
List<Expression> rowsWithSelect = new ArrayList<>(rows... | [
"protected",
"Union",
"rowsToUnion",
"(",
"final",
"List",
"<",
"Expression",
">",
"rows",
")",
"{",
"// Create an union in form of a binary tree from a list of rows.",
"// The tree shape is to prevent stack overflow on some",
"// database engines when the list of rows is too big.",
"L... | Transform values' rows into a union.
@param rows the values' rows
@return the resulting union | [
"Transform",
"values",
"rows",
"into",
"a",
"union",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractTranslator.java#L502-L532 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/Query.java | Query.select | public Query select(final Expression... selectColumns) {
if (selectColumns == null) {
return this;
}
return select(Arrays.asList(selectColumns));
} | java | public Query select(final Expression... selectColumns) {
if (selectColumns == null) {
return this;
}
return select(Arrays.asList(selectColumns));
} | [
"public",
"Query",
"select",
"(",
"final",
"Expression",
"...",
"selectColumns",
")",
"{",
"if",
"(",
"selectColumns",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"return",
"select",
"(",
"Arrays",
".",
"asList",
"(",
"selectColumns",
")",
")",
"... | Adds the SELECT columns.
@param selectColumns The columns.
@return This expression. | [
"Adds",
"the",
"SELECT",
"columns",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/Query.java#L180-L186 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/impl/SqlServerTranslator.java | SqlServerTranslator.getParsedOrderByColumn | private Expression getParsedOrderByColumn(final Expression column) {
if (column instanceof Name) {
final Name columnName = (Name) column;
final String environment = columnName.getEnvironment();
if (environment != null && !environment.isEmpty()) {
final Expres... | java | private Expression getParsedOrderByColumn(final Expression column) {
if (column instanceof Name) {
final Name columnName = (Name) column;
final String environment = columnName.getEnvironment();
if (environment != null && !environment.isEmpty()) {
final Expres... | [
"private",
"Expression",
"getParsedOrderByColumn",
"(",
"final",
"Expression",
"column",
")",
"{",
"if",
"(",
"column",
"instanceof",
"Name",
")",
"{",
"final",
"Name",
"columnName",
"=",
"(",
"Name",
")",
"column",
";",
"final",
"String",
"environment",
"=",
... | Helper method which removes the environment parameter from a column when it is used inside an order by statement
and in a paginated query. This is needed in order to avoid "The multi-part identifier could not be bound" error
which only happens in SQL Server.
@param column The column that will be parsed.
@return The ne... | [
"Helper",
"method",
"which",
"removes",
"the",
"environment",
"parameter",
"from",
"a",
"column",
"when",
"it",
"is",
"used",
"inside",
"an",
"order",
"by",
"statement",
"and",
"in",
"a",
"paginated",
"query",
".",
"This",
"is",
"needed",
"in",
"order",
"t... | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/impl/SqlServerTranslator.java#L467-L489 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/batch/AbstractBatch.java | AbstractBatch.start | protected void start() {
// if a periodic execution throws an exception, future executions are suspended,
// this task wraps the call in a try-catch block to prevent that. Errors are still propagated.
final Runnable resilientTask = () -> {
try {
run();
} c... | java | protected void start() {
// if a periodic execution throws an exception, future executions are suspended,
// this task wraps the call in a try-catch block to prevent that. Errors are still propagated.
final Runnable resilientTask = () -> {
try {
run();
} c... | [
"protected",
"void",
"start",
"(",
")",
"{",
"// if a periodic execution throws an exception, future executions are suspended,",
"// this task wraps the call in a try-catch block to prevent that. Errors are still propagated.",
"final",
"Runnable",
"resilientTask",
"=",
"(",
")",
"->",
... | Starts the timer task. | [
"Starts",
"the",
"timer",
"task",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/batch/AbstractBatch.java#L236-L248 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/batch/AbstractBatch.java | AbstractBatch.destroy | public void destroy() {
logger.trace("{} - Destroy called on Batch", name);
scheduler.shutdown();
try {
if (!scheduler.awaitTermination(maxAwaitTimeShutdown, TimeUnit.MILLISECONDS)) {
logger.warn(
"Could not terminate batch within {}. Forcing ... | java | public void destroy() {
logger.trace("{} - Destroy called on Batch", name);
scheduler.shutdown();
try {
if (!scheduler.awaitTermination(maxAwaitTimeShutdown, TimeUnit.MILLISECONDS)) {
logger.warn(
"Could not terminate batch within {}. Forcing ... | [
"public",
"void",
"destroy",
"(",
")",
"{",
"logger",
".",
"trace",
"(",
"\"{} - Destroy called on Batch\"",
",",
"name",
")",
";",
"scheduler",
".",
"shutdown",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"scheduler",
".",
"awaitTermination",
"(",
"maxAwai... | Destroys this batch. | [
"Destroys",
"this",
"batch",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/batch/AbstractBatch.java#L253-L275 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/batch/AbstractBatch.java | AbstractBatch.flush | public void flush() {
List<BatchEntry> temp;
bufferLock.lock();
try {
// Reset the last flush timestamp, even if the batch is empty or flush fails
lastFlush = System.currentTimeMillis();
// No-op if batch is empty
if (batch == batchSize) {
... | java | public void flush() {
List<BatchEntry> temp;
bufferLock.lock();
try {
// Reset the last flush timestamp, even if the batch is empty or flush fails
lastFlush = System.currentTimeMillis();
// No-op if batch is empty
if (batch == batchSize) {
... | [
"public",
"void",
"flush",
"(",
")",
"{",
"List",
"<",
"BatchEntry",
">",
"temp",
";",
"bufferLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"// Reset the last flush timestamp, even if the batch is empty or flush fails",
"lastFlush",
"=",
"System",
".",
"currentTime... | Flushes the pending batches.
@implSpec Same as {@link #flush(boolean)} with {@link false}. | [
"Flushes",
"the",
"pending",
"batches",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/batch/AbstractBatch.java#L312-L401 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/configuration/PdbProperties.java | PdbProperties.merge | public final void merge(final Properties properties) {
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
setProperty(entry.getKey().toString(), entry.getValue().toString());
}
} | java | public final void merge(final Properties properties) {
for (Map.Entry<Object, Object> entry : properties.entrySet()) {
setProperty(entry.getKey().toString(), entry.getValue().toString());
}
} | [
"public",
"final",
"void",
"merge",
"(",
"final",
"Properties",
"properties",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Object",
">",
"entry",
":",
"properties",
".",
"entrySet",
"(",
")",
")",
"{",
"setProperty",
"(",
"entry",
".... | Merges properties with the existing ones.
@param properties The properties to merge. | [
"Merges",
"properties",
"with",
"the",
"existing",
"ones",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/configuration/PdbProperties.java#L207-L211 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/configuration/PdbProperties.java | PdbProperties.getIsolationLevel | public int getIsolationLevel() {
final Optional<IsolationLevel> e = Enums.getIfPresent(IsolationLevel.class, getProperty(ISOLATION_LEVEL).toUpperCase());
if (!e.isPresent()) {
throw new DatabaseEngineRuntimeException(ISOLATION_LEVEL + " must be set and be one of the following: " + EnumSet.a... | java | public int getIsolationLevel() {
final Optional<IsolationLevel> e = Enums.getIfPresent(IsolationLevel.class, getProperty(ISOLATION_LEVEL).toUpperCase());
if (!e.isPresent()) {
throw new DatabaseEngineRuntimeException(ISOLATION_LEVEL + " must be set and be one of the following: " + EnumSet.a... | [
"public",
"int",
"getIsolationLevel",
"(",
")",
"{",
"final",
"Optional",
"<",
"IsolationLevel",
">",
"e",
"=",
"Enums",
".",
"getIfPresent",
"(",
"IsolationLevel",
".",
"class",
",",
"getProperty",
"(",
"ISOLATION_LEVEL",
")",
".",
"toUpperCase",
"(",
")",
... | Gets the isolation level.
@return The isolation level. | [
"Gets",
"the",
"isolation",
"level",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/configuration/PdbProperties.java#L371-L391 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/configuration/PdbProperties.java | PdbProperties.checkMandatoryProperties | public void checkMandatoryProperties() throws PdbConfigurationException {
StringBuilder exceptionMessage = new StringBuilder();
if (StringUtils.isBlank(getJdbc())) {
exceptionMessage.append("- A connection string should be declared under the 'database.jdbc' property.\n");
}
... | java | public void checkMandatoryProperties() throws PdbConfigurationException {
StringBuilder exceptionMessage = new StringBuilder();
if (StringUtils.isBlank(getJdbc())) {
exceptionMessage.append("- A connection string should be declared under the 'database.jdbc' property.\n");
}
... | [
"public",
"void",
"checkMandatoryProperties",
"(",
")",
"throws",
"PdbConfigurationException",
"{",
"StringBuilder",
"exceptionMessage",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"getJdbc",
"(",
")",
")",
")",
"{"... | Checks if the configuration validates for mandatory properties.
@throws PdbConfigurationException If mandatory fields are not set. | [
"Checks",
"if",
"the",
"configuration",
"validates",
"for",
"mandatory",
"properties",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/configuration/PdbProperties.java#L479-L493 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/impl/DB2Engine.java | DB2Engine.reorg | private String reorg(String tableName) {
List<String> statement = new ArrayList<>();
statement.add("CALL sysproc.admin_cmd('REORG TABLE");
statement.add(quotize(tableName));
statement.add("')");
return join(statement, " ");
} | java | private String reorg(String tableName) {
List<String> statement = new ArrayList<>();
statement.add("CALL sysproc.admin_cmd('REORG TABLE");
statement.add(quotize(tableName));
statement.add("')");
return join(statement, " ");
} | [
"private",
"String",
"reorg",
"(",
"String",
"tableName",
")",
"{",
"List",
"<",
"String",
">",
"statement",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"statement",
".",
"add",
"(",
"\"CALL sysproc.admin_cmd('REORG TABLE\"",
")",
";",
"statement",
".",
"a... | Reorganizes the table so it doesn't contain fragments.
@param tableName The table name to reorganize.
@return The command to perform the operation. | [
"Reorganizes",
"the",
"table",
"so",
"it",
"doesn",
"t",
"contain",
"fragments",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/impl/DB2Engine.java#L285-L292 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/impl/DB2Engine.java | DB2Engine.alterColumnSetNotNull | private String alterColumnSetNotNull(String tableName, List<String> columnNames) {
List<String> statement = new ArrayList<>();
statement.add("ALTER TABLE");
statement.add(quotize(tableName));
for (String columnName : columnNames) {
statement.add("ALTER COLUMN");
... | java | private String alterColumnSetNotNull(String tableName, List<String> columnNames) {
List<String> statement = new ArrayList<>();
statement.add("ALTER TABLE");
statement.add(quotize(tableName));
for (String columnName : columnNames) {
statement.add("ALTER COLUMN");
... | [
"private",
"String",
"alterColumnSetNotNull",
"(",
"String",
"tableName",
",",
"List",
"<",
"String",
">",
"columnNames",
")",
"{",
"List",
"<",
"String",
">",
"statement",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"statement",
".",
"add",
"(",
"\"ALTE... | Generates a command to set the specified columns to enforce non nullability.
@param tableName The table name.
@param columnNames The columns.
@return The command to perform the operation. | [
"Generates",
"a",
"command",
"to",
"set",
"the",
"specified",
"columns",
"to",
"enforce",
"non",
"nullability",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/impl/DB2Engine.java#L301-L313 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/util/StringUtils.java | StringUtils.md5 | public static String md5(final String message) {
byte[] res;
try {
MessageDigest instance = MessageDigest.getInstance("MD5");
instance.reset();
instance.update(message.getBytes());
res = instance.digest();
} catch (final NoSuchAlgorithmException ... | java | public static String md5(final String message) {
byte[] res;
try {
MessageDigest instance = MessageDigest.getInstance("MD5");
instance.reset();
instance.update(message.getBytes());
res = instance.digest();
} catch (final NoSuchAlgorithmException ... | [
"public",
"static",
"String",
"md5",
"(",
"final",
"String",
"message",
")",
"{",
"byte",
"[",
"]",
"res",
";",
"try",
"{",
"MessageDigest",
"instance",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"\"MD5\"",
")",
";",
"instance",
".",
"reset",
"(",
")... | Generates the MD5 checksum for the specified message.
@param message The message.
@return The hexadecimal checksum. | [
"Generates",
"the",
"MD5",
"checksum",
"for",
"the",
"specified",
"message",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/util/StringUtils.java#L69-L88 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/util/StringUtils.java | StringUtils.md5 | public static String md5(final String message, final int nchar) {
final String hash = md5(message);
return nchar > hash.length() ? hash : hash.substring(0, nchar);
} | java | public static String md5(final String message, final int nchar) {
final String hash = md5(message);
return nchar > hash.length() ? hash : hash.substring(0, nchar);
} | [
"public",
"static",
"String",
"md5",
"(",
"final",
"String",
"message",
",",
"final",
"int",
"nchar",
")",
"{",
"final",
"String",
"hash",
"=",
"md5",
"(",
"message",
")",
";",
"return",
"nchar",
">",
"hash",
".",
"length",
"(",
")",
"?",
"hash",
":"... | Generates de MD5 checksum for the specified message.
@param message The message.
@param nchar The maximum number of chars for the result hash.
@return The hexadecimal checksum with the specified maximum number of chars. | [
"Generates",
"de",
"MD5",
"checksum",
"for",
"the",
"specified",
"message",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/util/StringUtils.java#L97-L100 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/util/StringUtils.java | StringUtils.readString | public static String readString(final InputStream stream) throws IOException {
InputStreamReader br = null;
StringBuilder sb = new StringBuilder();
try {
br = new InputStreamReader(stream);
int got;
while (!Thread.currentThread().isInterrupted()) {
... | java | public static String readString(final InputStream stream) throws IOException {
InputStreamReader br = null;
StringBuilder sb = new StringBuilder();
try {
br = new InputStreamReader(stream);
int got;
while (!Thread.currentThread().isInterrupted()) {
... | [
"public",
"static",
"String",
"readString",
"(",
"final",
"InputStream",
"stream",
")",
"throws",
"IOException",
"{",
"InputStreamReader",
"br",
"=",
"null",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"{",
"br",
"=",
"new"... | Reads a string from the input stream.
@param stream The stream.
@return The string from that stream.
@throws IOException If an I/O error occurs. | [
"Reads",
"a",
"string",
"from",
"the",
"input",
"stream",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/util/StringUtils.java#L109-L135 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/result/PostgreSqlResultColumn.java | PostgreSqlResultColumn.processObject | @Override
protected Object processObject(Object o) {
if (o instanceof PGobject &&
((PGobject)o).getType().equals("jsonb")) {
return ((PGobject) o).getValue();
}
return super.processObject(o);
} | java | @Override
protected Object processObject(Object o) {
if (o instanceof PGobject &&
((PGobject)o).getType().equals("jsonb")) {
return ((PGobject) o).getValue();
}
return super.processObject(o);
} | [
"@",
"Override",
"protected",
"Object",
"processObject",
"(",
"Object",
"o",
")",
"{",
"if",
"(",
"o",
"instanceof",
"PGobject",
"&&",
"(",
"(",
"PGobject",
")",
"o",
")",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"\"jsonb\"",
")",
")",
"{",
"ret... | Overrides default behaviour for JSON values, that are converted to strings.
@param o The object in need of some kind of processing before being set.
@return The processed object.
@since 2.1.5 | [
"Overrides",
"default",
"behaviour",
"for",
"JSON",
"values",
"that",
"are",
"converted",
"to",
"strings",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/result/PostgreSqlResultColumn.java#L45-L52 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/DatabaseFactory.java | DatabaseFactory.getConnection | public static DatabaseEngine getConnection(Properties p) throws DatabaseFactoryException {
PdbProperties pdbProperties = new PdbProperties(p, true);
final String engine = pdbProperties.getEngine();
if (StringUtils.isBlank(engine)) {
throw new DatabaseFactoryException("pdb.engine pro... | java | public static DatabaseEngine getConnection(Properties p) throws DatabaseFactoryException {
PdbProperties pdbProperties = new PdbProperties(p, true);
final String engine = pdbProperties.getEngine();
if (StringUtils.isBlank(engine)) {
throw new DatabaseFactoryException("pdb.engine pro... | [
"public",
"static",
"DatabaseEngine",
"getConnection",
"(",
"Properties",
"p",
")",
"throws",
"DatabaseFactoryException",
"{",
"PdbProperties",
"pdbProperties",
"=",
"new",
"PdbProperties",
"(",
"p",
",",
"true",
")",
";",
"final",
"String",
"engine",
"=",
"pdbPro... | Gets a database connection from the specified properties.
@param p The database properties.
@return A reference of the specified database engine.
@throws DatabaseFactoryException If the class specified does not exist or its not well implemented. | [
"Gets",
"a",
"database",
"connection",
"from",
"the",
"specified",
"properties",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/DatabaseFactory.java#L50-L89 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java | SqlBuilder.caseWhen | public static Case caseWhen(final Expression condition, final Expression trueAction) {
return Case.caseWhen(condition, trueAction);
} | java | public static Case caseWhen(final Expression condition, final Expression trueAction) {
return Case.caseWhen(condition, trueAction);
} | [
"public",
"static",
"Case",
"caseWhen",
"(",
"final",
"Expression",
"condition",
",",
"final",
"Expression",
"trueAction",
")",
"{",
"return",
"Case",
".",
"caseWhen",
"(",
"condition",
",",
"trueAction",
")",
";",
"}"
] | Creates a case expression.
@param condition The name of the view.
@param trueAction The name of the view.
@return The case when representation. | [
"Creates",
"a",
"case",
"expression",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java#L592-L594 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java | SqlBuilder.in | public static Expression in(final Expression e1, final Expression e2) {
return new RepeatDelimiter(IN, e1.isEnclosed() ? e1 : e1.enclose(), e2.isEnclosed() ? e2 : e2.enclose());
} | java | public static Expression in(final Expression e1, final Expression e2) {
return new RepeatDelimiter(IN, e1.isEnclosed() ? e1 : e1.enclose(), e2.isEnclosed() ? e2 : e2.enclose());
} | [
"public",
"static",
"Expression",
"in",
"(",
"final",
"Expression",
"e1",
",",
"final",
"Expression",
"e2",
")",
"{",
"return",
"new",
"RepeatDelimiter",
"(",
"IN",
",",
"e1",
".",
"isEnclosed",
"(",
")",
"?",
"e1",
":",
"e1",
".",
"enclose",
"(",
")",... | The IN expression.
@param e1 The first expression.
@param e2 The second expression.
@return The expression. | [
"The",
"IN",
"expression",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java#L683-L685 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java | SqlBuilder.notIn | public static Expression notIn(final Expression e1, final Expression e2) {
return new RepeatDelimiter(NOTIN, e1.isEnclosed() ? e1 : e1.enclose(), e2.isEnclosed() ? e2 : e2.enclose());
} | java | public static Expression notIn(final Expression e1, final Expression e2) {
return new RepeatDelimiter(NOTIN, e1.isEnclosed() ? e1 : e1.enclose(), e2.isEnclosed() ? e2 : e2.enclose());
} | [
"public",
"static",
"Expression",
"notIn",
"(",
"final",
"Expression",
"e1",
",",
"final",
"Expression",
"e2",
")",
"{",
"return",
"new",
"RepeatDelimiter",
"(",
"NOTIN",
",",
"e1",
".",
"isEnclosed",
"(",
")",
"?",
"e1",
":",
"e1",
".",
"enclose",
"(",
... | The NOT IN expression.
@param e1 The first expression.
@param e2 The second expression.
@return The expression. | [
"The",
"NOT",
"IN",
"expression",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java#L694-L696 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java | SqlBuilder.between | public static Between between(final Expression exp1, final Expression exp2, final Expression exp3) {
return new Between(exp1, and(exp2, exp3));
} | java | public static Between between(final Expression exp1, final Expression exp2, final Expression exp3) {
return new Between(exp1, and(exp2, exp3));
} | [
"public",
"static",
"Between",
"between",
"(",
"final",
"Expression",
"exp1",
",",
"final",
"Expression",
"exp2",
",",
"final",
"Expression",
"exp3",
")",
"{",
"return",
"new",
"Between",
"(",
"exp1",
",",
"and",
"(",
"exp2",
",",
"exp3",
")",
")",
";",
... | The BETWEEN operator.
@param exp1 The column.
@param exp2 The first bound.
@param exp3 The second bound.
@return The between expression. | [
"The",
"BETWEEN",
"operator",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java#L717-L719 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java | SqlBuilder.notBetween | public static Between notBetween(final Expression exp1, final Expression exp2, final Expression exp3) {
return new Between(exp1, and(exp2, exp3)).not();
} | java | public static Between notBetween(final Expression exp1, final Expression exp2, final Expression exp3) {
return new Between(exp1, and(exp2, exp3)).not();
} | [
"public",
"static",
"Between",
"notBetween",
"(",
"final",
"Expression",
"exp1",
",",
"final",
"Expression",
"exp2",
",",
"final",
"Expression",
"exp3",
")",
"{",
"return",
"new",
"Between",
"(",
"exp1",
",",
"and",
"(",
"exp2",
",",
"exp3",
")",
")",
".... | The NOT BETWEEN operator.
@param exp1 The column.
@param exp2 The first bound.
@param exp3 The second bound.
@return The between expression. | [
"The",
"NOT",
"BETWEEN",
"operator",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java#L729-L731 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java | SqlBuilder.alterColumn | public static AlterColumn alterColumn(Expression table, Name column, DbColumnType dbColumnType, DbColumnConstraint... constraints) {
return alterColumn(
table,
dbColumn().name(column.getName()).type(dbColumnType).addConstraints(constraints).build());
} | java | public static AlterColumn alterColumn(Expression table, Name column, DbColumnType dbColumnType, DbColumnConstraint... constraints) {
return alterColumn(
table,
dbColumn().name(column.getName()).type(dbColumnType).addConstraints(constraints).build());
} | [
"public",
"static",
"AlterColumn",
"alterColumn",
"(",
"Expression",
"table",
",",
"Name",
"column",
",",
"DbColumnType",
"dbColumnType",
",",
"DbColumnConstraint",
"...",
"constraints",
")",
"{",
"return",
"alterColumn",
"(",
"table",
",",
"dbColumn",
"(",
")",
... | Alter column operator.
@param table The table containing the column.
@param column The column of the table.
@param dbColumnType The db column type.
@param constraints The constraints of the column.
@return The alter column operator. | [
"Alter",
"column",
"operator",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java#L803-L807 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java | SqlBuilder.dbColumn | public static DbColumn.Builder dbColumn(String name, DbColumnType type, boolean autoInc) {
return new DbColumn.Builder().name(name).type(type).autoInc(autoInc);
} | java | public static DbColumn.Builder dbColumn(String name, DbColumnType type, boolean autoInc) {
return new DbColumn.Builder().name(name).type(type).autoInc(autoInc);
} | [
"public",
"static",
"DbColumn",
".",
"Builder",
"dbColumn",
"(",
"String",
"name",
",",
"DbColumnType",
"type",
",",
"boolean",
"autoInc",
")",
"{",
"return",
"new",
"DbColumn",
".",
"Builder",
"(",
")",
".",
"name",
"(",
"name",
")",
".",
"type",
"(",
... | Creates a Database Column builder.
@return A Database Column Key builder. | [
"Creates",
"a",
"Database",
"Column",
"builder",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/dialect/SqlBuilder.java#L861-L863 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/With.java | With.andWith | public With andWith(final String alias, final Expression expression) {
this.clauses.add(new ImmutablePair<>(new Name(alias), expression));
return this;
} | java | public With andWith(final String alias, final Expression expression) {
this.clauses.add(new ImmutablePair<>(new Name(alias), expression));
return this;
} | [
"public",
"With",
"andWith",
"(",
"final",
"String",
"alias",
",",
"final",
"Expression",
"expression",
")",
"{",
"this",
".",
"clauses",
".",
"add",
"(",
"new",
"ImmutablePair",
"<>",
"(",
"new",
"Name",
"(",
"alias",
")",
",",
"expression",
")",
")",
... | Adds an alias and expression to the with clause.
@param alias expression alias
@param expression expression to be aliased.
@return this object. | [
"Adds",
"an",
"alias",
"and",
"expression",
"to",
"the",
"with",
"clause",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/With.java#L76-L79 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/impl/MySqlEngine.java | MySqlEngine.setAnsiMode | private void setAnsiMode() throws SQLException {
Statement s = conn.createStatement();
s.executeUpdate("SET sql_mode = 'ansi'");
s.close();
} | java | private void setAnsiMode() throws SQLException {
Statement s = conn.createStatement();
s.executeUpdate("SET sql_mode = 'ansi'");
s.close();
} | [
"private",
"void",
"setAnsiMode",
"(",
")",
"throws",
"SQLException",
"{",
"Statement",
"s",
"=",
"conn",
".",
"createStatement",
"(",
")",
";",
"s",
".",
"executeUpdate",
"(",
"\"SET sql_mode = 'ansi'\"",
")",
";",
"s",
".",
"close",
"(",
")",
";",
"}"
] | Sets the session to ANSI mode.
@throws SQLException If something goes wrong contacting the database. | [
"Sets",
"the",
"session",
"to",
"ANSI",
"mode",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/impl/MySqlEngine.java#L108-L112 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/ddl/DbEntity.java | DbEntity.containsColumn | public boolean containsColumn(String columnName) {
return columns.stream()
.map(DbColumn::getName)
.anyMatch(listColName -> listColName.equals(columnName));
} | java | public boolean containsColumn(String columnName) {
return columns.stream()
.map(DbColumn::getName)
.anyMatch(listColName -> listColName.equals(columnName));
} | [
"public",
"boolean",
"containsColumn",
"(",
"String",
"columnName",
")",
"{",
"return",
"columns",
".",
"stream",
"(",
")",
".",
"map",
"(",
"DbColumn",
"::",
"getName",
")",
".",
"anyMatch",
"(",
"listColName",
"->",
"listColName",
".",
"equals",
"(",
"co... | Checks if the given column is present in the list of columns.
@param columnName The column name to check.
@return {@code true} if the column is present in the list of columns, {@code false} otherwise. | [
"Checks",
"if",
"the",
"given",
"column",
"is",
"present",
"in",
"the",
"list",
"of",
"columns",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/ddl/DbEntity.java#L124-L128 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/ddl/DbEntity.java | DbEntity.newBuilder | public Builder newBuilder() {
return new Builder()
.name(name)
.addColumn(columns)
.addFk(fks)
.pkFields(pkFields)
.addIndexes(indexes);
} | java | public Builder newBuilder() {
return new Builder()
.name(name)
.addColumn(columns)
.addFk(fks)
.pkFields(pkFields)
.addIndexes(indexes);
} | [
"public",
"Builder",
"newBuilder",
"(",
")",
"{",
"return",
"new",
"Builder",
"(",
")",
".",
"name",
"(",
"name",
")",
".",
"addColumn",
"(",
"columns",
")",
".",
"addFk",
"(",
"fks",
")",
".",
"pkFields",
"(",
"pkFields",
")",
".",
"addIndexes",
"("... | Returns a new builder out of the configuration.
@return A new builder out of the configuration. | [
"Returns",
"a",
"new",
"builder",
"out",
"of",
"the",
"configuration",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/ddl/DbEntity.java#L135-L142 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/Case.java | Case.when | public Case when(final Expression condition, final Expression action) {
whens.add(When.when(condition, action));
return this;
} | java | public Case when(final Expression condition, final Expression action) {
whens.add(When.when(condition, action));
return this;
} | [
"public",
"Case",
"when",
"(",
"final",
"Expression",
"condition",
",",
"final",
"Expression",
"action",
")",
"{",
"whens",
".",
"add",
"(",
"When",
".",
"when",
"(",
"condition",
",",
"action",
")",
")",
";",
"return",
"this",
";",
"}"
] | Adds a new when clause to this case.
@param condition condition to verify.
@param action action to be executed if the condition is true.
@return this case. | [
"Adds",
"a",
"new",
"when",
"clause",
"to",
"this",
"case",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/Case.java#L88-L91 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/impl/PostgreSqlEngine.java | PostgreSqlEngine.getJSONValue | private Object getJSONValue(String val) throws DatabaseEngineException {
try {
PGobject dataObject = new PGobject();
dataObject.setType("jsonb");
dataObject.setValue(val);
return dataObject;
} catch (final SQLException ex) {
throw new DatabaseE... | java | private Object getJSONValue(String val) throws DatabaseEngineException {
try {
PGobject dataObject = new PGobject();
dataObject.setType("jsonb");
dataObject.setValue(val);
return dataObject;
} catch (final SQLException ex) {
throw new DatabaseE... | [
"private",
"Object",
"getJSONValue",
"(",
"String",
"val",
")",
"throws",
"DatabaseEngineException",
"{",
"try",
"{",
"PGobject",
"dataObject",
"=",
"new",
"PGobject",
"(",
")",
";",
"dataObject",
".",
"setType",
"(",
"\"jsonb\"",
")",
";",
"dataObject",
".",
... | Converts a String value into a PG JSON value ready to be assigned to bind variables in Prepared Statements.
@param val The String representation of the JSON value.
@return The correspondent JSON value
@throws DatabaseEngineException if there is an error creating the value. It should never be thrown.
@since 2.1.... | [
"Converts",
"a",
"String",
"value",
"into",
"a",
"PG",
"JSON",
"value",
"ready",
"to",
"be",
"assigned",
"to",
"bind",
"variables",
"in",
"Prepared",
"Statements",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/impl/PostgreSqlEngine.java#L169-L178 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/dml/Expression.java | Expression.leftOuterJoin | public Expression leftOuterJoin(final Expression table, final Expression expr) {
if (table instanceof Query) {
table.enclose();
}
joins.add(new Join("LEFT OUTER JOIN", table, expr));
return this;
} | java | public Expression leftOuterJoin(final Expression table, final Expression expr) {
if (table instanceof Query) {
table.enclose();
}
joins.add(new Join("LEFT OUTER JOIN", table, expr));
return this;
} | [
"public",
"Expression",
"leftOuterJoin",
"(",
"final",
"Expression",
"table",
",",
"final",
"Expression",
"expr",
")",
"{",
"if",
"(",
"table",
"instanceof",
"Query",
")",
"{",
"table",
".",
"enclose",
"(",
")",
";",
"}",
"joins",
".",
"add",
"(",
"new",... | Sets a left outer join with the current table.
@param table The table to join.
@param expr The expressions to join.
@return This expression. | [
"Sets",
"a",
"left",
"outer",
"join",
"with",
"the",
"current",
"table",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/dml/Expression.java#L182-L190 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/ddl/DbColumn.java | DbColumn.newBuilder | public Builder newBuilder() {
return new Builder()
.name(name)
.type(dbColumnType)
.size(size)
.addConstraints(columnConstraints)
.autoInc(autoInc)
.defaultValue(defaultValue);
} | java | public Builder newBuilder() {
return new Builder()
.name(name)
.type(dbColumnType)
.size(size)
.addConstraints(columnConstraints)
.autoInc(autoInc)
.defaultValue(defaultValue);
} | [
"public",
"Builder",
"newBuilder",
"(",
")",
"{",
"return",
"new",
"Builder",
"(",
")",
".",
"name",
"(",
"name",
")",
".",
"type",
"(",
"dbColumnType",
")",
".",
"size",
"(",
"size",
")",
".",
"addConstraints",
"(",
"columnConstraints",
")",
".",
"aut... | Returns a new builder out of this configuration.
@return a new builder out of this configuration. | [
"Returns",
"a",
"new",
"builder",
"out",
"of",
"this",
"configuration",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/ddl/DbColumn.java#L156-L164 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.getPrivateKey | protected String getPrivateKey() throws Exception {
String location = this.properties.getProperty(SECRET_LOCATION);
if (StringUtils.isBlank(location)) {
throw new DatabaseEngineException("Encryption was specified but there's no location specified for the private key.");
}
Fi... | java | protected String getPrivateKey() throws Exception {
String location = this.properties.getProperty(SECRET_LOCATION);
if (StringUtils.isBlank(location)) {
throw new DatabaseEngineException("Encryption was specified but there's no location specified for the private key.");
}
Fi... | [
"protected",
"String",
"getPrivateKey",
"(",
")",
"throws",
"Exception",
"{",
"String",
"location",
"=",
"this",
".",
"properties",
".",
"getProperty",
"(",
"SECRET_LOCATION",
")",
";",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"location",
")",
")",
"{"... | Reads the private key from the secret location.
@return A string with the private key.
@throws Exception If something occurs while reading. | [
"Reads",
"the",
"private",
"key",
"from",
"the",
"secret",
"location",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L210-L222 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.close | @Override
public synchronized void close() {
try {
for (final PreparedStatementCapsule preparedStatement : stmts.values()) {
try {
preparedStatement.ps.close();
} catch (final SQLException e) {
logger.warn("Could not close ... | java | @Override
public synchronized void close() {
try {
for (final PreparedStatementCapsule preparedStatement : stmts.values()) {
try {
preparedStatement.ps.close();
} catch (final SQLException e) {
logger.warn("Could not close ... | [
"@",
"Override",
"public",
"synchronized",
"void",
"close",
"(",
")",
"{",
"try",
"{",
"for",
"(",
"final",
"PreparedStatementCapsule",
"preparedStatement",
":",
"stmts",
".",
"values",
"(",
")",
")",
"{",
"try",
"{",
"preparedStatement",
".",
"ps",
".",
"... | Closes the connection to the database. | [
"Closes",
"the",
"connection",
"to",
"the",
"database",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L401-L427 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.addEntity | private void addEntity(DbEntity entity, boolean recovering) throws DatabaseEngineException {
if (!recovering) {
try {
getConnection();
} catch (final Exception e) {
throw new DatabaseEngineException("Could not add entity", e);
}
va... | java | private void addEntity(DbEntity entity, boolean recovering) throws DatabaseEngineException {
if (!recovering) {
try {
getConnection();
} catch (final Exception e) {
throw new DatabaseEngineException("Could not add entity", e);
}
va... | [
"private",
"void",
"addEntity",
"(",
"DbEntity",
"entity",
",",
"boolean",
"recovering",
")",
"throws",
"DatabaseEngineException",
"{",
"if",
"(",
"!",
"recovering",
")",
"{",
"try",
"{",
"getConnection",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"Exception... | Adds an entity to the engine. It will create tables and everything necessary so persistence can work.
@param entity The entity to add.
@param recovering True if entities are being add due to recovery.
@throws DatabaseEngineException If something goes wrong while creating the structures. | [
"Adds",
"an",
"entity",
"to",
"the",
"engine",
".",
"It",
"will",
"create",
"tables",
"and",
"everything",
"necessary",
"so",
"persistence",
"can",
"work",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L520-L548 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.dropEntity | @Override
public synchronized void dropEntity(String entity) throws DatabaseEngineException {
if (!containsEntity(entity)) {
return;
}
dropEntity(entities.get(entity).getEntity());
} | java | @Override
public synchronized void dropEntity(String entity) throws DatabaseEngineException {
if (!containsEntity(entity)) {
return;
}
dropEntity(entities.get(entity).getEntity());
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"dropEntity",
"(",
"String",
"entity",
")",
"throws",
"DatabaseEngineException",
"{",
"if",
"(",
"!",
"containsEntity",
"(",
"entity",
")",
")",
"{",
"return",
";",
"}",
"dropEntity",
"(",
"entities",
".",
"... | Drops an entity.
@param entity The entity name.
@throws DatabaseEngineException If something goes wrong while dropping the entity. | [
"Drops",
"an",
"entity",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L658-L665 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.dropEntity | @Override
public synchronized void dropEntity(final DbEntity entity) throws DatabaseEngineException {
dropSequences(entity);
dropTable(entity);
entities.remove(entity.getName());
logger.trace("Entity {} dropped", entity.getName());
} | java | @Override
public synchronized void dropEntity(final DbEntity entity) throws DatabaseEngineException {
dropSequences(entity);
dropTable(entity);
entities.remove(entity.getName());
logger.trace("Entity {} dropped", entity.getName());
} | [
"@",
"Override",
"public",
"synchronized",
"void",
"dropEntity",
"(",
"final",
"DbEntity",
"entity",
")",
"throws",
"DatabaseEngineException",
"{",
"dropSequences",
"(",
"entity",
")",
";",
"dropTable",
"(",
"entity",
")",
";",
"entities",
".",
"remove",
"(",
... | Drops everything that belongs to the entity.
@param entity The entity.
@throws DatabaseEngineException If something goes wrong while dropping the structures. | [
"Drops",
"everything",
"that",
"belongs",
"to",
"the",
"entity",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L673-L679 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.dropAllEntities | private void dropAllEntities() {
for (final MappedEntity mappedEntity : ImmutableList.copyOf(entities.values())) {
try {
dropEntity(mappedEntity.getEntity());
} catch (final DatabaseEngineException ex) {
logger.debug(String.format("Failed to drop entity '... | java | private void dropAllEntities() {
for (final MappedEntity mappedEntity : ImmutableList.copyOf(entities.values())) {
try {
dropEntity(mappedEntity.getEntity());
} catch (final DatabaseEngineException ex) {
logger.debug(String.format("Failed to drop entity '... | [
"private",
"void",
"dropAllEntities",
"(",
")",
"{",
"for",
"(",
"final",
"MappedEntity",
"mappedEntity",
":",
"ImmutableList",
".",
"copyOf",
"(",
"entities",
".",
"values",
"(",
")",
")",
")",
"{",
"try",
"{",
"dropEntity",
"(",
"mappedEntity",
".",
"get... | Drops all entities associated with this engine.
@since 2.1.13 | [
"Drops",
"all",
"entities",
"associated",
"with",
"this",
"engine",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L686-L695 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.flush | @Override
public synchronized void flush() throws DatabaseEngineException {
/*
* Reconnect on this method does not make sense since a new connection will have nothing to flush.
*/
try {
for (MappedEntity me : entities.values()) {
me.getInsert().executeB... | java | @Override
public synchronized void flush() throws DatabaseEngineException {
/*
* Reconnect on this method does not make sense since a new connection will have nothing to flush.
*/
try {
for (MappedEntity me : entities.values()) {
me.getInsert().executeB... | [
"@",
"Override",
"public",
"synchronized",
"void",
"flush",
"(",
")",
"throws",
"DatabaseEngineException",
"{",
"/*\n * Reconnect on this method does not make sense since a new connection will have nothing to flush.\n */",
"try",
"{",
"for",
"(",
"MappedEntity",
"me... | Flushes the batches for all the registered entities.
@throws DatabaseEngineException If something goes wrong while persisting data. | [
"Flushes",
"the",
"batches",
"for",
"all",
"the",
"registered",
"entities",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L733-L746 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.executeUpdate | @Override
public synchronized int executeUpdate(final String query) throws DatabaseEngineException {
Statement s = null;
try {
getConnection();
s = conn.createStatement();
return s.executeUpdate(query);
} catch (final Exception ex) {
throw new ... | java | @Override
public synchronized int executeUpdate(final String query) throws DatabaseEngineException {
Statement s = null;
try {
getConnection();
s = conn.createStatement();
return s.executeUpdate(query);
} catch (final Exception ex) {
throw new ... | [
"@",
"Override",
"public",
"synchronized",
"int",
"executeUpdate",
"(",
"final",
"String",
"query",
")",
"throws",
"DatabaseEngineException",
"{",
"Statement",
"s",
"=",
"null",
";",
"try",
"{",
"getConnection",
"(",
")",
";",
"s",
"=",
"conn",
".",
"createS... | Executes a native query.
@param query The query to execute.
@return The number of rows updated.
@throws DatabaseEngineException If something goes wrong executing the native query. | [
"Executes",
"a",
"native",
"query",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L816-L834 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.executeUpdate | @Override
public synchronized int executeUpdate(final Expression query) throws DatabaseEngineException {
/*
* Reconnection is already assured by "void executeUpdate(final String query)".
*/
final String trans = translate(query);
logger.trace(trans);
return executeUp... | java | @Override
public synchronized int executeUpdate(final Expression query) throws DatabaseEngineException {
/*
* Reconnection is already assured by "void executeUpdate(final String query)".
*/
final String trans = translate(query);
logger.trace(trans);
return executeUp... | [
"@",
"Override",
"public",
"synchronized",
"int",
"executeUpdate",
"(",
"final",
"Expression",
"query",
")",
"throws",
"DatabaseEngineException",
"{",
"/*\n * Reconnection is already assured by \"void executeUpdate(final String query)\".\n */",
"final",
"String",
"t... | Executes the given update.
@param query The update to execute.
@throws DatabaseEngineException If something goes wrong executing the update. | [
"Executes",
"the",
"given",
"update",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L842-L850 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.checkConnection | @Override
public synchronized boolean checkConnection(final boolean forceReconnect) {
if (checkConnection(conn)) {
return true;
} else if (forceReconnect) {
try {
connect();
recover();
return true;
} catch (final Ex... | java | @Override
public synchronized boolean checkConnection(final boolean forceReconnect) {
if (checkConnection(conn)) {
return true;
} else if (forceReconnect) {
try {
connect();
recover();
return true;
} catch (final Ex... | [
"@",
"Override",
"public",
"synchronized",
"boolean",
"checkConnection",
"(",
"final",
"boolean",
"forceReconnect",
")",
"{",
"if",
"(",
"checkConnection",
"(",
"conn",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"forceReconnect",
")",
"{",... | Checks if the connection is alive.
@param forceReconnect True to force the connection in case of failure.
@return True if the connection is valid, false otherwise. | [
"Checks",
"if",
"the",
"connection",
"is",
"alive",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L990-L1007 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.addBatch | @Override
public synchronized void addBatch(final String name, final EntityEntry entry) throws DatabaseEngineException {
try {
final MappedEntity me = entities.get(name);
if (me == null) {
throw new DatabaseEngineException(String.format("Unknown entity '%s'", name)... | java | @Override
public synchronized void addBatch(final String name, final EntityEntry entry) throws DatabaseEngineException {
try {
final MappedEntity me = entities.get(name);
if (me == null) {
throw new DatabaseEngineException(String.format("Unknown entity '%s'", name)... | [
"@",
"Override",
"public",
"synchronized",
"void",
"addBatch",
"(",
"final",
"String",
"name",
",",
"final",
"EntityEntry",
"entry",
")",
"throws",
"DatabaseEngineException",
"{",
"try",
"{",
"final",
"MappedEntity",
"me",
"=",
"entities",
".",
"get",
"(",
"na... | Add an entry to the batch.
@param name The entity name.
@param entry The entry to persist.
@throws DatabaseEngineException If something goes wrong while persisting data. | [
"Add",
"an",
"entry",
"to",
"the",
"batch",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1026-L1045 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.duplicate | @Override
public synchronized DatabaseEngine duplicate(Properties mergeProperties, final boolean copyEntities) throws DuplicateEngineException {
if (mergeProperties == null) {
mergeProperties = new Properties();
}
final PdbProperties niwProps = properties.clone();
niwPro... | java | @Override
public synchronized DatabaseEngine duplicate(Properties mergeProperties, final boolean copyEntities) throws DuplicateEngineException {
if (mergeProperties == null) {
mergeProperties = new Properties();
}
final PdbProperties niwProps = properties.clone();
niwPro... | [
"@",
"Override",
"public",
"synchronized",
"DatabaseEngine",
"duplicate",
"(",
"Properties",
"mergeProperties",
",",
"final",
"boolean",
"copyEntities",
")",
"throws",
"DuplicateEngineException",
"{",
"if",
"(",
"mergeProperties",
"==",
"null",
")",
"{",
"mergePropert... | Duplicates a connection.
@param mergeProperties Merge properties with the ones already existing.
@param copyEntities True to include the entities in the new connection, false otherwise.
@return The new connection.
@throws DuplicateEngineException If policy is set to other than 'create' or 'none' or duplication fail... | [
"Duplicates",
"a",
"connection",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1551-L1578 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.getPSResultSet | @Override
public synchronized List<Map<String, ResultColumn>> getPSResultSet(final String name) throws DatabaseEngineException {
return processResultIterator(getPSIterator(name));
} | java | @Override
public synchronized List<Map<String, ResultColumn>> getPSResultSet(final String name) throws DatabaseEngineException {
return processResultIterator(getPSIterator(name));
} | [
"@",
"Override",
"public",
"synchronized",
"List",
"<",
"Map",
"<",
"String",
",",
"ResultColumn",
">",
">",
"getPSResultSet",
"(",
"final",
"String",
"name",
")",
"throws",
"DatabaseEngineException",
"{",
"return",
"processResultIterator",
"(",
"getPSIterator",
"... | Gets the result set of the specified prepared statement.
@param name The prepared statement name.
@return The result.
@throws DatabaseEngineException If something occurs getting the result. | [
"Gets",
"the",
"result",
"set",
"of",
"the",
"specified",
"prepared",
"statement",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1632-L1635 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.executePS | @Override
public synchronized void executePS(final String name) throws DatabaseEngineException, ConnectionResetException {
final PreparedStatementCapsule ps = stmts.get(name);
if (ps == null) {
throw new DatabaseEngineRuntimeException(String.format("PreparedStatement named '%s' does not ... | java | @Override
public synchronized void executePS(final String name) throws DatabaseEngineException, ConnectionResetException {
final PreparedStatementCapsule ps = stmts.get(name);
if (ps == null) {
throw new DatabaseEngineRuntimeException(String.format("PreparedStatement named '%s' does not ... | [
"@",
"Override",
"public",
"synchronized",
"void",
"executePS",
"(",
"final",
"String",
"name",
")",
"throws",
"DatabaseEngineException",
",",
"ConnectionResetException",
"{",
"final",
"PreparedStatementCapsule",
"ps",
"=",
"stmts",
".",
"get",
"(",
"name",
")",
"... | Executes the specified prepared statement.
@param name The prepared statement name.
@throws DatabaseEngineException If something goes wrong while executing.
@throws ConnectionResetException If the connection is down and reestablishment occurs. If this happens, the user must reset the parameters and re-execute
the que... | [
"Executes",
"the",
"specified",
"prepared",
"statement",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1724-L1749 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.clearParameters | @Override
public synchronized void clearParameters(final String name) throws DatabaseEngineException, ConnectionResetException {
final PreparedStatementCapsule ps = stmts.get(name);
if (ps == null) {
throw new DatabaseEngineRuntimeException(String.format("PreparedStatement named '%s' doe... | java | @Override
public synchronized void clearParameters(final String name) throws DatabaseEngineException, ConnectionResetException {
final PreparedStatementCapsule ps = stmts.get(name);
if (ps == null) {
throw new DatabaseEngineRuntimeException(String.format("PreparedStatement named '%s' doe... | [
"@",
"Override",
"public",
"synchronized",
"void",
"clearParameters",
"(",
"final",
"String",
"name",
")",
"throws",
"DatabaseEngineException",
",",
"ConnectionResetException",
"{",
"final",
"PreparedStatementCapsule",
"ps",
"=",
"stmts",
".",
"get",
"(",
"name",
")... | Clears the prepared statement parameters.
@param name The prepared statement name.
@throws DatabaseEngineException If something occurs while clearing the parameters. | [
"Clears",
"the",
"prepared",
"statement",
"parameters",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1757-L1780 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.executePSUpdate | @Override
public synchronized Integer executePSUpdate(final String name) throws DatabaseEngineException, ConnectionResetException {
final PreparedStatementCapsule ps = stmts.get(name);
if (ps == null) {
throw new DatabaseEngineRuntimeException(String.format("PreparedStatement named '%s' ... | java | @Override
public synchronized Integer executePSUpdate(final String name) throws DatabaseEngineException, ConnectionResetException {
final PreparedStatementCapsule ps = stmts.get(name);
if (ps == null) {
throw new DatabaseEngineRuntimeException(String.format("PreparedStatement named '%s' ... | [
"@",
"Override",
"public",
"synchronized",
"Integer",
"executePSUpdate",
"(",
"final",
"String",
"name",
")",
"throws",
"DatabaseEngineException",
",",
"ConnectionResetException",
"{",
"final",
"PreparedStatementCapsule",
"ps",
"=",
"stmts",
".",
"get",
"(",
"name",
... | Executes update on the specified prepared statement.
@param name The prepared statement name.
@throws DatabaseEngineException If the prepared statement does not exist or something goes wrong while executing.
@throws ConnectionResetException If the connection is down and reestablishment occurs. If this happens, the us... | [
"Executes",
"update",
"on",
"the",
"specified",
"prepared",
"statement",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1801-L1825 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.createPreparedStatement | private void createPreparedStatement(final String name, final String query, final int timeout, final boolean recovering) throws NameAlreadyExistsException, DatabaseEngineException {
if (!recovering) {
if (stmts.containsKey(name)) {
throw new NameAlreadyExistsException(String.format(... | java | private void createPreparedStatement(final String name, final String query, final int timeout, final boolean recovering) throws NameAlreadyExistsException, DatabaseEngineException {
if (!recovering) {
if (stmts.containsKey(name)) {
throw new NameAlreadyExistsException(String.format(... | [
"private",
"void",
"createPreparedStatement",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"query",
",",
"final",
"int",
"timeout",
",",
"final",
"boolean",
"recovering",
")",
"throws",
"NameAlreadyExistsException",
",",
"DatabaseEngineException",
"{",
"i... | Creates a prepared statement.
@param name The name of the prepared statement.
@param query The query.
@param timeout The timeout (in seconds) if applicable. Only applicable if > 0.
@param recovering True if calling from recovering, false otherwise.
@throws NameAlreadyExistsException If the name already e... | [
"Creates",
"a",
"prepared",
"statement",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1837-L1860 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.objectToArray | protected final synchronized byte[] objectToArray(Object val) throws IOException {
final ByteArrayOutputStream bos = new InitiallyReusableByteArrayOutputStream(getReusableByteBuffer());
final ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(val);
return bos.toByteAr... | java | protected final synchronized byte[] objectToArray(Object val) throws IOException {
final ByteArrayOutputStream bos = new InitiallyReusableByteArrayOutputStream(getReusableByteBuffer());
final ObjectOutputStream oos = new ObjectOutputStream(bos);
oos.writeObject(val);
return bos.toByteAr... | [
"protected",
"final",
"synchronized",
"byte",
"[",
"]",
"objectToArray",
"(",
"Object",
"val",
")",
"throws",
"IOException",
"{",
"final",
"ByteArrayOutputStream",
"bos",
"=",
"new",
"InitiallyReusableByteArrayOutputStream",
"(",
"getReusableByteBuffer",
"(",
")",
")"... | Converts an object to byte array.
@param val The object to convert.
@return The byte array representation of the object.
@throws IOException If the buffer is not enough to make the conversion. | [
"Converts",
"an",
"object",
"to",
"byte",
"array",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1912-L1918 | train |
feedzai/pdb | src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java | AbstractDatabaseEngine.hasIdentityColumn | public boolean hasIdentityColumn(DbEntity entity) {
for (final DbColumn column : entity.getColumns()) {
if (column.isAutoInc()) {
return true;
}
}
return false;
} | java | public boolean hasIdentityColumn(DbEntity entity) {
for (final DbColumn column : entity.getColumns()) {
if (column.isAutoInc()) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"hasIdentityColumn",
"(",
"DbEntity",
"entity",
")",
"{",
"for",
"(",
"final",
"DbColumn",
"column",
":",
"entity",
".",
"getColumns",
"(",
")",
")",
"{",
"if",
"(",
"column",
".",
"isAutoInc",
"(",
")",
")",
"{",
"return",
"true",
... | Check if the entity has an identity column.
@param entity The entity to check.
@return True if the entity has an identity column and false otherwise. | [
"Check",
"if",
"the",
"entity",
"has",
"an",
"identity",
"column",
"."
] | fe07ca08417e0ddcd620a36aa1fdbca7f338be98 | https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L1926-L1933 | train |
knowm/Yank | src/main/java/org/knowm/yank/PropertiesUtils.java | PropertiesUtils.getPropertiesFromClasspath | public static Properties getPropertiesFromClasspath(String fileName)
throws PropertiesFileNotFoundException {
Properties props = new Properties();
try {
InputStream is = ClassLoader.getSystemResourceAsStream(fileName);
if (is == null) { // try this instead
is = Thread.currentThread().... | java | public static Properties getPropertiesFromClasspath(String fileName)
throws PropertiesFileNotFoundException {
Properties props = new Properties();
try {
InputStream is = ClassLoader.getSystemResourceAsStream(fileName);
if (is == null) { // try this instead
is = Thread.currentThread().... | [
"public",
"static",
"Properties",
"getPropertiesFromClasspath",
"(",
"String",
"fileName",
")",
"throws",
"PropertiesFileNotFoundException",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"try",
"{",
"InputStream",
"is",
"=",
"ClassLoader",
"."... | Loads a Properties file from the classpath matching the given file name
@param fileName
@return The Properties file
@throws PropertiesFileNotFoundException if the Properties file could not be loaded from the
classpath | [
"Loads",
"a",
"Properties",
"file",
"from",
"the",
"classpath",
"matching",
"the",
"given",
"file",
"name"
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/PropertiesUtils.java#L30-L46 | train |
knowm/Yank | src/main/java/org/knowm/yank/PropertiesUtils.java | PropertiesUtils.getPropertiesFromPath | public static Properties getPropertiesFromPath(String fileName)
throws PropertiesFileNotFoundException {
Properties props = new Properties();
FileInputStream fis;
try {
fis = new FileInputStream(fileName);
props.load(fis);
fis.close();
} catch (Exception e) {
throw new Pro... | java | public static Properties getPropertiesFromPath(String fileName)
throws PropertiesFileNotFoundException {
Properties props = new Properties();
FileInputStream fis;
try {
fis = new FileInputStream(fileName);
props.load(fis);
fis.close();
} catch (Exception e) {
throw new Pro... | [
"public",
"static",
"Properties",
"getPropertiesFromPath",
"(",
"String",
"fileName",
")",
"throws",
"PropertiesFileNotFoundException",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"FileInputStream",
"fis",
";",
"try",
"{",
"fis",
"=",
"new... | Loads a Properties file from the given file name
@param fileName
@return The Properties file
@throws PropertiesFileNotFoundException if the Properties file could not be loaded from the
given path and file name | [
"Loads",
"a",
"Properties",
"file",
"from",
"the",
"given",
"file",
"name"
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/PropertiesUtils.java#L56-L70 | train |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.execute | public static int execute(String sql, Object[] params) throws YankSQLException {
return execute(YankPoolManager.DEFAULT_POOL_NAME, sql, params);
} | java | public static int execute(String sql, Object[] params) throws YankSQLException {
return execute(YankPoolManager.DEFAULT_POOL_NAME, sql, params);
} | [
"public",
"static",
"int",
"execute",
"(",
"String",
"sql",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"YankSQLException",
"{",
"return",
"execute",
"(",
"YankPoolManager",
".",
"DEFAULT_POOL_NAME",
",",
"sql",
",",
"params",
")",
";",
"}"
] | Executes the given INSERT, UPDATE, DELETE, REPLACE or UPSERT SQL prepared statement. Returns
the number of rows affected using the default connection pool.
@param sql The query to execute
@param params The replacement parameters
@return The number of rows affected | [
"Executes",
"the",
"given",
"INSERT",
"UPDATE",
"DELETE",
"REPLACE",
"or",
"UPSERT",
"SQL",
"prepared",
"statement",
".",
"Returns",
"the",
"number",
"of",
"rows",
"affected",
"using",
"the",
"default",
"connection",
"pool",
"."
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L187-L190 | train |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.execute | public static int execute(String poolName, String sql, Object[] params) throws YankSQLException {
int returnInt = 0;
try {
returnInt =
new QueryRunner(YANK_POOL_MANAGER.getConnectionPool(poolName)).update(sql, params);
} catch (SQLException e) {
handleSQLException(e, poolName, sql)... | java | public static int execute(String poolName, String sql, Object[] params) throws YankSQLException {
int returnInt = 0;
try {
returnInt =
new QueryRunner(YANK_POOL_MANAGER.getConnectionPool(poolName)).update(sql, params);
} catch (SQLException e) {
handleSQLException(e, poolName, sql)... | [
"public",
"static",
"int",
"execute",
"(",
"String",
"poolName",
",",
"String",
"sql",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"YankSQLException",
"{",
"int",
"returnInt",
"=",
"0",
";",
"try",
"{",
"returnInt",
"=",
"new",
"QueryRunner",
"(",
... | Executes the given INSERT, UPDATE, DELETE, REPLACE or UPSERT SQL prepared statement. Returns
the number of rows affected.
@param poolName The name of the connection pool to query against
@param sql The query to execute
@param params The replacement parameters
@return The number of rows affected | [
"Executes",
"the",
"given",
"INSERT",
"UPDATE",
"DELETE",
"REPLACE",
"or",
"UPSERT",
"SQL",
"prepared",
"statement",
".",
"Returns",
"the",
"number",
"of",
"rows",
"affected",
"."
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L201-L215 | train |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.queryScalar | public static <T> T queryScalar(String sql, Class<T> scalarType, Object[] params)
throws SQLStatementNotFoundException, YankSQLException {
return queryScalar(YankPoolManager.DEFAULT_POOL_NAME, sql, scalarType, params);
} | java | public static <T> T queryScalar(String sql, Class<T> scalarType, Object[] params)
throws SQLStatementNotFoundException, YankSQLException {
return queryScalar(YankPoolManager.DEFAULT_POOL_NAME, sql, scalarType, params);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"queryScalar",
"(",
"String",
"sql",
",",
"Class",
"<",
"T",
">",
"scalarType",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"SQLStatementNotFoundException",
",",
"YankSQLException",
"{",
"return",
"queryScalar",
... | Return just one scalar given a an SQL statement using the default connection pool.
@param scalarType The Class of the desired return scalar matching the table
@param params The replacement parameters
@return The scalar Object
@throws SQLStatementNotFoundException if an SQL statement could not be found for the given
sq... | [
"Return",
"just",
"one",
"scalar",
"given",
"a",
"an",
"SQL",
"statement",
"using",
"the",
"default",
"connection",
"pool",
"."
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L274-L278 | train |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.queryScalar | public static <T> T queryScalar(String poolName, String sql, Class<T> scalarType, Object[] params)
throws SQLStatementNotFoundException, YankSQLException {
T returnObject = null;
try {
ScalarHandler<T> resultSetHandler;
if (scalarType.equals(Integer.class)) {
resultSetHandler = (Scal... | java | public static <T> T queryScalar(String poolName, String sql, Class<T> scalarType, Object[] params)
throws SQLStatementNotFoundException, YankSQLException {
T returnObject = null;
try {
ScalarHandler<T> resultSetHandler;
if (scalarType.equals(Integer.class)) {
resultSetHandler = (Scal... | [
"public",
"static",
"<",
"T",
">",
"T",
"queryScalar",
"(",
"String",
"poolName",
",",
"String",
"sql",
",",
"Class",
"<",
"T",
">",
"scalarType",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"SQLStatementNotFoundException",
",",
"YankSQLException",
"{"... | Return just one scalar given a an SQL statement
@param poolName The name of the connection pool to query against
@param scalarType The Class of the desired return scalar matching the table
@param params The replacement parameters
@return The scalar Object
@throws SQLStatementNotFoundException if an SQL statement could... | [
"Return",
"just",
"one",
"scalar",
"given",
"a",
"an",
"SQL",
"statement"
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L290-L320 | train |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.queryBean | public static <T> T queryBean(String sql, Class<T> beanType, Object[] params)
throws YankSQLException {
return queryBean(YankPoolManager.DEFAULT_POOL_NAME, sql, beanType, params);
} | java | public static <T> T queryBean(String sql, Class<T> beanType, Object[] params)
throws YankSQLException {
return queryBean(YankPoolManager.DEFAULT_POOL_NAME, sql, beanType, params);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"queryBean",
"(",
"String",
"sql",
",",
"Class",
"<",
"T",
">",
"beanType",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"YankSQLException",
"{",
"return",
"queryBean",
"(",
"YankPoolManager",
".",
"DEFAULT_POOL... | Return just one Bean given an SQL statement. If more than one row match the query, only the
first row is returned using the default connection pool.
@param sql The SQL statement
@param params The replacement parameters
@param beanType The Class of the desired return Object matching the table
@return The Object | [
"Return",
"just",
"one",
"Bean",
"given",
"an",
"SQL",
"statement",
".",
"If",
"more",
"than",
"one",
"row",
"match",
"the",
"query",
"only",
"the",
"first",
"row",
"is",
"returned",
"using",
"the",
"default",
"connection",
"pool",
"."
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L379-L383 | train |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.queryBean | public static <T> T queryBean(String poolName, String sql, Class<T> beanType, Object[] params)
throws YankSQLException {
T returnObject = null;
try {
BeanHandler<T> resultSetHandler =
new BeanHandler<T>(beanType, new BasicRowProcessor(new YankBeanProcessor<T>(beanType)));
returnO... | java | public static <T> T queryBean(String poolName, String sql, Class<T> beanType, Object[] params)
throws YankSQLException {
T returnObject = null;
try {
BeanHandler<T> resultSetHandler =
new BeanHandler<T>(beanType, new BasicRowProcessor(new YankBeanProcessor<T>(beanType)));
returnO... | [
"public",
"static",
"<",
"T",
">",
"T",
"queryBean",
"(",
"String",
"poolName",
",",
"String",
"sql",
",",
"Class",
"<",
"T",
">",
"beanType",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"YankSQLException",
"{",
"T",
"returnObject",
"=",
"null",
... | Return just one Bean given an SQL statement. If more than one row match the query, only the
first row is returned.
@param poolName The name of the connection pool to query against
@param sql The SQL statement
@param params The replacement parameters
@param beanType The Class of the desired return Object matching the t... | [
"Return",
"just",
"one",
"Bean",
"given",
"an",
"SQL",
"statement",
".",
"If",
"more",
"than",
"one",
"row",
"match",
"the",
"query",
"only",
"the",
"first",
"row",
"is",
"returned",
"."
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L395-L414 | train |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.queryBeanList | public static <T> List<T> queryBeanList(String sql, Class<T> beanType, Object[] params)
throws YankSQLException {
return queryBeanList(YankPoolManager.DEFAULT_POOL_NAME, sql, beanType, params);
} | java | public static <T> List<T> queryBeanList(String sql, Class<T> beanType, Object[] params)
throws YankSQLException {
return queryBeanList(YankPoolManager.DEFAULT_POOL_NAME, sql, beanType, params);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"queryBeanList",
"(",
"String",
"sql",
",",
"Class",
"<",
"T",
">",
"beanType",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"YankSQLException",
"{",
"return",
"queryBeanList",
"(",
"YankPool... | Return a List of Beans given an SQL statement using the default connection pool.
@param sql The SQL statement
@param beanType The Class of the desired return Objects matching the table
@param params The replacement parameters
@return The List of Objects | [
"Return",
"a",
"List",
"of",
"Beans",
"given",
"an",
"SQL",
"statement",
"using",
"the",
"default",
"connection",
"pool",
"."
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L470-L474 | train |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.queryBeanList | public static <T> List<T> queryBeanList(
String poolName, String sql, Class<T> beanType, Object[] params) throws YankSQLException {
List<T> returnList = null;
try {
BeanListHandler<T> resultSetHandler =
new BeanListHandler<T>(
beanType, new BasicRowProcessor(new YankBeanPr... | java | public static <T> List<T> queryBeanList(
String poolName, String sql, Class<T> beanType, Object[] params) throws YankSQLException {
List<T> returnList = null;
try {
BeanListHandler<T> resultSetHandler =
new BeanListHandler<T>(
beanType, new BasicRowProcessor(new YankBeanPr... | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"queryBeanList",
"(",
"String",
"poolName",
",",
"String",
"sql",
",",
"Class",
"<",
"T",
">",
"beanType",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"YankSQLException",
"{",
"List",
"<",... | Return a List of Beans given an SQL statement
@param poolName The name of the connection pool to query against
@param sql The SQL statement
@param beanType The Class of the desired return Objects matching the table
@param params The replacement parameters
@return The List of Objects | [
"Return",
"a",
"List",
"of",
"Beans",
"given",
"an",
"SQL",
"statement"
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L485-L504 | train |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.queryColumn | public static <T> List<T> queryColumn(
String sql, String columnName, Class<T> columnType, Object[] params) throws YankSQLException {
return queryColumn(YankPoolManager.DEFAULT_POOL_NAME, sql, columnName, columnType, params);
} | java | public static <T> List<T> queryColumn(
String sql, String columnName, Class<T> columnType, Object[] params) throws YankSQLException {
return queryColumn(YankPoolManager.DEFAULT_POOL_NAME, sql, columnName, columnType, params);
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"queryColumn",
"(",
"String",
"sql",
",",
"String",
"columnName",
",",
"Class",
"<",
"T",
">",
"columnType",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"YankSQLException",
"{",
"return",
... | Return a List of Objects from a single table column given an SQL statement using the default
connection pool.
@param <T>
@param sql The SQL statement
@param params The replacement parameters
@param columnType The Class of the desired return Objects matching the table
@return The Column as a List | [
"Return",
"a",
"List",
"of",
"Objects",
"from",
"a",
"single",
"table",
"column",
"given",
"an",
"SQL",
"statement",
"using",
"the",
"default",
"connection",
"pool",
"."
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L565-L569 | train |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.queryColumn | public static <T> List<T> queryColumn(
String poolName, String sql, String columnName, Class<T> columnType, Object[] params)
throws YankSQLException {
List<T> returnList = null;
try {
ColumnListHandler<T> resultSetHandler;
if (columnType.equals(Integer.class)) {
resultSetHandle... | java | public static <T> List<T> queryColumn(
String poolName, String sql, String columnName, Class<T> columnType, Object[] params)
throws YankSQLException {
List<T> returnList = null;
try {
ColumnListHandler<T> resultSetHandler;
if (columnType.equals(Integer.class)) {
resultSetHandle... | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"queryColumn",
"(",
"String",
"poolName",
",",
"String",
"sql",
",",
"String",
"columnName",
",",
"Class",
"<",
"T",
">",
"columnType",
",",
"Object",
"[",
"]",
"params",
")",
"throws",
"YankSQL... | Return a List of Objects from a single table column given an SQL statement
@param poolName The name of the connection pool to query against
@param sql The SQL statement
@param params The replacement parameters
@param columnType The Class of the desired return Objects matching the table
@return The Column as a List | [
"Return",
"a",
"List",
"of",
"Objects",
"from",
"a",
"single",
"table",
"column",
"given",
"an",
"SQL",
"statement"
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L580-L611 | train |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.executeBatch | public static int[] executeBatch(String sql, Object[][] params) throws YankSQLException {
return executeBatch(YankPoolManager.DEFAULT_POOL_NAME, sql, params);
} | java | public static int[] executeBatch(String sql, Object[][] params) throws YankSQLException {
return executeBatch(YankPoolManager.DEFAULT_POOL_NAME, sql, params);
} | [
"public",
"static",
"int",
"[",
"]",
"executeBatch",
"(",
"String",
"sql",
",",
"Object",
"[",
"]",
"[",
"]",
"params",
")",
"throws",
"YankSQLException",
"{",
"return",
"executeBatch",
"(",
"YankPoolManager",
".",
"DEFAULT_POOL_NAME",
",",
"sql",
",",
"para... | Batch executes the given INSERT, UPDATE, DELETE, REPLACE or UPSERT SQL statement using the
default connection pool.
@param sql The SQL statement
@param params An array of query replacement parameters. Each row in this array is one set of
batch replacement values
@return The number of rows affected or each individual e... | [
"Batch",
"executes",
"the",
"given",
"INSERT",
"UPDATE",
"DELETE",
"REPLACE",
"or",
"UPSERT",
"SQL",
"statement",
"using",
"the",
"default",
"connection",
"pool",
"."
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L753-L756 | train |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.executeBatch | public static int[] executeBatch(String poolName, String sql, Object[][] params)
throws YankSQLException {
int[] returnIntArray = null;
try {
returnIntArray =
new QueryRunner(YANK_POOL_MANAGER.getConnectionPool(poolName)).batch(sql, params);
} catch (SQLException e) {
handleS... | java | public static int[] executeBatch(String poolName, String sql, Object[][] params)
throws YankSQLException {
int[] returnIntArray = null;
try {
returnIntArray =
new QueryRunner(YANK_POOL_MANAGER.getConnectionPool(poolName)).batch(sql, params);
} catch (SQLException e) {
handleS... | [
"public",
"static",
"int",
"[",
"]",
"executeBatch",
"(",
"String",
"poolName",
",",
"String",
"sql",
",",
"Object",
"[",
"]",
"[",
"]",
"params",
")",
"throws",
"YankSQLException",
"{",
"int",
"[",
"]",
"returnIntArray",
"=",
"null",
";",
"try",
"{",
... | Batch executes the given INSERT, UPDATE, DELETE, REPLACE or UPSERT SQL statement
@param poolName The name of the connection pool to query against
@param sql The SQL statement
@param params An array of query replacement parameters. Each row in this array is one set of
batch replacement values
@return The number of rows... | [
"Batch",
"executes",
"the",
"given",
"INSERT",
"UPDATE",
"DELETE",
"REPLACE",
"or",
"UPSERT",
"SQL",
"statement"
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L767-L782 | train |
knowm/Yank | src/main/java/org/knowm/yank/Yank.java | Yank.handleSQLException | private static void handleSQLException(SQLException e, String poolName, String sql) {
YankSQLException yankSQLException = new YankSQLException(e, poolName, sql);
if (throwWrappedExceptions) {
throw yankSQLException;
} else {
logger.error(yankSQLException.getMessage(), yankSQLException);
}
... | java | private static void handleSQLException(SQLException e, String poolName, String sql) {
YankSQLException yankSQLException = new YankSQLException(e, poolName, sql);
if (throwWrappedExceptions) {
throw yankSQLException;
} else {
logger.error(yankSQLException.getMessage(), yankSQLException);
}
... | [
"private",
"static",
"void",
"handleSQLException",
"(",
"SQLException",
"e",
",",
"String",
"poolName",
",",
"String",
"sql",
")",
"{",
"YankSQLException",
"yankSQLException",
"=",
"new",
"YankSQLException",
"(",
"e",
",",
"poolName",
",",
"sql",
")",
";",
"if... | Handles exceptions and logs them
@param e the SQLException | [
"Handles",
"exceptions",
"and",
"logs",
"them"
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/Yank.java#L789-L798 | train |
knowm/Yank | src/main/java/org/knowm/yank/YankPoolManager.java | YankPoolManager.createPool | private void createPool(String poolName, Properties connectionPoolProperties) {
releaseConnectionPool(poolName);
// DBUtils execute methods require autoCommit to be true.
connectionPoolProperties.put("autoCommit", true);
HikariConfig config = new HikariConfig(connectionPoolProperties);
config.set... | java | private void createPool(String poolName, Properties connectionPoolProperties) {
releaseConnectionPool(poolName);
// DBUtils execute methods require autoCommit to be true.
connectionPoolProperties.put("autoCommit", true);
HikariConfig config = new HikariConfig(connectionPoolProperties);
config.set... | [
"private",
"void",
"createPool",
"(",
"String",
"poolName",
",",
"Properties",
"connectionPoolProperties",
")",
"{",
"releaseConnectionPool",
"(",
"poolName",
")",
";",
"// DBUtils execute methods require autoCommit to be true.",
"connectionPoolProperties",
".",
"put",
"(",
... | Creates a Hikari connection pool and puts it in the pools map.
@param poolName
@param connectionPoolProperties | [
"Creates",
"a",
"Hikari",
"connection",
"pool",
"and",
"puts",
"it",
"in",
"the",
"pools",
"map",
"."
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/YankPoolManager.java#L76-L88 | train |
knowm/Yank | src/main/java/org/knowm/yank/YankPoolManager.java | YankPoolManager.releaseConnectionPool | protected synchronized void releaseConnectionPool(String poolName) {
HikariDataSource pool = pools.get(poolName);
if (pool != null) {
logger.info("Releasing pool: {}...", pool.getPoolName());
pool.close();
}
} | java | protected synchronized void releaseConnectionPool(String poolName) {
HikariDataSource pool = pools.get(poolName);
if (pool != null) {
logger.info("Releasing pool: {}...", pool.getPoolName());
pool.close();
}
} | [
"protected",
"synchronized",
"void",
"releaseConnectionPool",
"(",
"String",
"poolName",
")",
"{",
"HikariDataSource",
"pool",
"=",
"pools",
".",
"get",
"(",
"poolName",
")",
";",
"if",
"(",
"pool",
"!=",
"null",
")",
"{",
"logger",
".",
"info",
"(",
"\"Re... | Closes a connection pool
@param poolName | [
"Closes",
"a",
"connection",
"pool"
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/YankPoolManager.java#L101-L109 | train |
knowm/Yank | src/main/java/org/knowm/yank/YankPoolManager.java | YankPoolManager.releaseAllConnectionPools | protected synchronized void releaseAllConnectionPools() {
for (HikariDataSource pool : pools.values()) {
if (pool != null) {
logger.info("Releasing pool: {}...", pool.getPoolName());
pool.close();
}
}
} | java | protected synchronized void releaseAllConnectionPools() {
for (HikariDataSource pool : pools.values()) {
if (pool != null) {
logger.info("Releasing pool: {}...", pool.getPoolName());
pool.close();
}
}
} | [
"protected",
"synchronized",
"void",
"releaseAllConnectionPools",
"(",
")",
"{",
"for",
"(",
"HikariDataSource",
"pool",
":",
"pools",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"pool",
"!=",
"null",
")",
"{",
"logger",
".",
"info",
"(",
"\"Releasing po... | Closes all connection pools | [
"Closes",
"all",
"connection",
"pools"
] | b2071dcd94da99db6904355f9557456b8b292a6b | https://github.com/knowm/Yank/blob/b2071dcd94da99db6904355f9557456b8b292a6b/src/main/java/org/knowm/yank/YankPoolManager.java#L112-L121 | train |
optimaize/language-detector | src/main/java/com/optimaize/langdetect/DetectedLanguage.java | DetectedLanguage.compareTo | @Override
public int compareTo(DetectedLanguage o) {
int compare = Double.compare(o.probability, this.probability);
if (compare!=0) return compare;
return this.locale.toString().compareTo(o.locale.toString());
} | java | @Override
public int compareTo(DetectedLanguage o) {
int compare = Double.compare(o.probability, this.probability);
if (compare!=0) return compare;
return this.locale.toString().compareTo(o.locale.toString());
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"DetectedLanguage",
"o",
")",
"{",
"int",
"compare",
"=",
"Double",
".",
"compare",
"(",
"o",
".",
"probability",
",",
"this",
".",
"probability",
")",
";",
"if",
"(",
"compare",
"!=",
"0",
")",
"retu... | See class header. | [
"See",
"class",
"header",
"."
] | 1a322c462f977b29eca8d3142b816b7111d3fa19 | https://github.com/optimaize/language-detector/blob/1a322c462f977b29eca8d3142b816b7111d3fa19/src/main/java/com/optimaize/langdetect/DetectedLanguage.java#L70-L75 | train |
optimaize/language-detector | src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java | CommandLineInterface.main | public static void main(String[] args) throws IOException {
CommandLineInterface cli = new CommandLineInterface();
cli.addOpt("-d", "directory", "./");
cli.addOpt("-a", "alpha", "" + DEFAULT_ALPHA);
cli.addOpt("-s", "seed", null);
cli.parse(args);
if (cli.hasParam("--gen... | java | public static void main(String[] args) throws IOException {
CommandLineInterface cli = new CommandLineInterface();
cli.addOpt("-d", "directory", "./");
cli.addOpt("-a", "alpha", "" + DEFAULT_ALPHA);
cli.addOpt("-s", "seed", null);
cli.parse(args);
if (cli.hasParam("--gen... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"CommandLineInterface",
"cli",
"=",
"new",
"CommandLineInterface",
"(",
")",
";",
"cli",
".",
"addOpt",
"(",
"\"-d\"",
",",
"\"directory\"",
",",
"\"./\""... | Command Line Interface
@param args command line arguments | [
"Command",
"Line",
"Interface"
] | 1a322c462f977b29eca8d3142b816b7111d3fa19 | https://github.com/optimaize/language-detector/blob/1a322c462f977b29eca8d3142b816b7111d3fa19/src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java#L66-L80 | train |
optimaize/language-detector | src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java | CommandLineInterface.parse | private void parse(String[] args) {
for (int i=0; i<args.length; i++) {
if (opt_with_value.containsKey(args[i])) {
String key = opt_with_value.get(args[i]);
values.put(key, args[i+1]);
i++;
} else if (args[i].startsWith("-")) {
... | java | private void parse(String[] args) {
for (int i=0; i<args.length; i++) {
if (opt_with_value.containsKey(args[i])) {
String key = opt_with_value.get(args[i]);
values.put(key, args[i+1]);
i++;
} else if (args[i].startsWith("-")) {
... | [
"private",
"void",
"parse",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"args",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"opt_with_value",
".",
"containsKey",
"(",
"args",
"[",
"i",
"]"... | Command line easy parser
@param args command line arguments | [
"Command",
"line",
"easy",
"parser"
] | 1a322c462f977b29eca8d3142b816b7111d3fa19 | https://github.com/optimaize/language-detector/blob/1a322c462f977b29eca8d3142b816b7111d3fa19/src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java#L86-L98 | train |
optimaize/language-detector | src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java | CommandLineInterface.getParamDouble | private double getParamDouble(String key, double defaultValue) {
String value = values.get(key);
if (value==null || value.isEmpty()) {
return defaultValue;
}
try {
return Double.valueOf(value);
} catch (NumberFormatException e) {
throw new Runt... | java | private double getParamDouble(String key, double defaultValue) {
String value = values.get(key);
if (value==null || value.isEmpty()) {
return defaultValue;
}
try {
return Double.valueOf(value);
} catch (NumberFormatException e) {
throw new Runt... | [
"private",
"double",
"getParamDouble",
"(",
"String",
"key",
",",
"double",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"values",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"isEmpty",
"(",
")",
")",
... | Returns the double, or the default is absent. Throws if the double is specified but invalid. | [
"Returns",
"the",
"double",
"or",
"the",
"default",
"is",
"absent",
".",
"Throws",
"if",
"the",
"double",
"is",
"specified",
"but",
"invalid",
"."
] | 1a322c462f977b29eca8d3142b816b7111d3fa19 | https://github.com/optimaize/language-detector/blob/1a322c462f977b29eca8d3142b816b7111d3fa19/src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java#L117-L127 | train |
optimaize/language-detector | src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java | CommandLineInterface.generateProfile | public void generateProfile() {
File directory = new File(arglist.get(0));
String lang = arglist.get(1);
File file = searchFile(directory, lang + "wiki-.*-abstract\\.xml.*");
if (file == null) {
System.err.println("Not Found text file : lang = " + lang);
return;
... | java | public void generateProfile() {
File directory = new File(arglist.get(0));
String lang = arglist.get(1);
File file = searchFile(directory, lang + "wiki-.*-abstract\\.xml.*");
if (file == null) {
System.err.println("Not Found text file : lang = " + lang);
return;
... | [
"public",
"void",
"generateProfile",
"(",
")",
"{",
"File",
"directory",
"=",
"new",
"File",
"(",
"arglist",
".",
"get",
"(",
"0",
")",
")",
";",
"String",
"lang",
"=",
"arglist",
".",
"get",
"(",
"1",
")",
";",
"File",
"file",
"=",
"searchFile",
"... | Generate Language Profile from a text file.
<pre>
usage: --genprofile [text file] [language name]
</pre> | [
"Generate",
"Language",
"Profile",
"from",
"a",
"text",
"file",
"."
] | 1a322c462f977b29eca8d3142b816b7111d3fa19 | https://github.com/optimaize/language-detector/blob/1a322c462f977b29eca8d3142b816b7111d3fa19/src/main/java/com/optimaize/langdetect/cybozu/CommandLineInterface.java#L176-L192 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.