id
int32
0
165k
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
12,300
Harium/keel
src/main/java/com/harium/keel/effect/CosineTransform.java
CosineTransform.PowerSpectrum
private void PowerSpectrum() { Power = new double[data.length][data[0].length]; PowerMax = 0; for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[0].length; j++) { double p = data[i][j]; if (p < 0) p = -p; Power[i][j] = p; if (p > PowerMax) PowerMax = p; } } }
java
private void PowerSpectrum() { Power = new double[data.length][data[0].length]; PowerMax = 0; for (int i = 0; i < data.length; i++) { for (int j = 0; j < data[0].length; j++) { double p = data[i][j]; if (p < 0) p = -p; Power[i][j] = p; if (p > PowerMax) PowerMax = p; } } }
[ "private", "void", "PowerSpectrum", "(", ")", "{", "Power", "=", "new", "double", "[", "data", ".", "length", "]", "[", "data", "[", "0", "]", ".", "length", "]", ";", "PowerMax", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "data", ".", "length", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "0", ";", "j", "<", "data", "[", "0", "]", ".", "length", ";", "j", "++", ")", "{", "double", "p", "=", "data", "[", "i", "]", "[", "j", "]", ";", "if", "(", "p", "<", "0", ")", "p", "=", "-", "p", ";", "Power", "[", "i", "]", "[", "j", "]", "=", "p", ";", "if", "(", "p", ">", "PowerMax", ")", "PowerMax", "=", "p", ";", "}", "}", "}" ]
compute the Power Spectrum;
[ "compute", "the", "Power", "Spectrum", ";" ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/CosineTransform.java#L147-L159
12,301
Harium/keel
src/main/java/com/harium/keel/effect/normal/SimpleNormalMap.java
SimpleNormalMap.apply
@Override public ImageSource apply(ImageSource input) { int w = input.getWidth(); int h = input.getHeight(); MatrixSource output = new MatrixSource(w, h); Vector3 s = new Vector3(1, 0, 0); Vector3 t = new Vector3(0, 1, 0); for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { if (x < border || x == w - border || y < border || y == h - border) { output.setRGB(x, y, VectorHelper.Z_NORMAL); continue; } float dh = input.getR(x + 1, y) - input.getR(x - 1, y); float dv = input.getR(x, y + 1) - input.getR(x, y - 1); s.set(scale, 0, dh); t.set(0, scale, dv); Vector3 cross = s.crs(t).nor(); int rgb = VectorHelper.vectorToColor(cross); output.setRGB(x, y, rgb); } } return new MatrixSource(output); }
java
@Override public ImageSource apply(ImageSource input) { int w = input.getWidth(); int h = input.getHeight(); MatrixSource output = new MatrixSource(w, h); Vector3 s = new Vector3(1, 0, 0); Vector3 t = new Vector3(0, 1, 0); for (int y = 0; y < h; y++) { for (int x = 0; x < w; x++) { if (x < border || x == w - border || y < border || y == h - border) { output.setRGB(x, y, VectorHelper.Z_NORMAL); continue; } float dh = input.getR(x + 1, y) - input.getR(x - 1, y); float dv = input.getR(x, y + 1) - input.getR(x, y - 1); s.set(scale, 0, dh); t.set(0, scale, dv); Vector3 cross = s.crs(t).nor(); int rgb = VectorHelper.vectorToColor(cross); output.setRGB(x, y, rgb); } } return new MatrixSource(output); }
[ "@", "Override", "public", "ImageSource", "apply", "(", "ImageSource", "input", ")", "{", "int", "w", "=", "input", ".", "getWidth", "(", ")", ";", "int", "h", "=", "input", ".", "getHeight", "(", ")", ";", "MatrixSource", "output", "=", "new", "MatrixSource", "(", "w", ",", "h", ")", ";", "Vector3", "s", "=", "new", "Vector3", "(", "1", ",", "0", ",", "0", ")", ";", "Vector3", "t", "=", "new", "Vector3", "(", "0", ",", "1", ",", "0", ")", ";", "for", "(", "int", "y", "=", "0", ";", "y", "<", "h", ";", "y", "++", ")", "{", "for", "(", "int", "x", "=", "0", ";", "x", "<", "w", ";", "x", "++", ")", "{", "if", "(", "x", "<", "border", "||", "x", "==", "w", "-", "border", "||", "y", "<", "border", "||", "y", "==", "h", "-", "border", ")", "{", "output", ".", "setRGB", "(", "x", ",", "y", ",", "VectorHelper", ".", "Z_NORMAL", ")", ";", "continue", ";", "}", "float", "dh", "=", "input", ".", "getR", "(", "x", "+", "1", ",", "y", ")", "-", "input", ".", "getR", "(", "x", "-", "1", ",", "y", ")", ";", "float", "dv", "=", "input", ".", "getR", "(", "x", ",", "y", "+", "1", ")", "-", "input", ".", "getR", "(", "x", ",", "y", "-", "1", ")", ";", "s", ".", "set", "(", "scale", ",", "0", ",", "dh", ")", ";", "t", ".", "set", "(", "0", ",", "scale", ",", "dv", ")", ";", "Vector3", "cross", "=", "s", ".", "crs", "(", "t", ")", ".", "nor", "(", ")", ";", "int", "rgb", "=", "VectorHelper", ".", "vectorToColor", "(", "cross", ")", ";", "output", ".", "setRGB", "(", "x", ",", "y", ",", "rgb", ")", ";", "}", "}", "return", "new", "MatrixSource", "(", "output", ")", ";", "}" ]
Simple method to generate bump map from a height map @param input - A height map @return bump map
[ "Simple", "method", "to", "generate", "bump", "map", "from", "a", "height", "map" ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/normal/SimpleNormalMap.java#L19-L50
12,302
Harium/keel
src/main/java/jdt/triangulation/DelaunayTriangulation.java
DelaunayTriangulation.findClosePoint
public Vector3 findClosePoint(Vector3 pointToDelete) { Triangle triangle = find(pointToDelete); Vector3 p1 = triangle.p1(); Vector3 p2 = triangle.p2(); double d1 = distanceXY(p1, pointToDelete); double d2 = distanceXY(p2, pointToDelete); if(triangle.isHalfplane()) { if(d1<=d2) { return p1; } else { return p2; } } else { Vector3 p3 = triangle.p3(); double d3 = distanceXY(p3, pointToDelete); if(d1<=d2 && d1<=d3) { return p1; } else if(d2<=d1 && d2<=d3) { return p2; } else { return p3; } } }
java
public Vector3 findClosePoint(Vector3 pointToDelete) { Triangle triangle = find(pointToDelete); Vector3 p1 = triangle.p1(); Vector3 p2 = triangle.p2(); double d1 = distanceXY(p1, pointToDelete); double d2 = distanceXY(p2, pointToDelete); if(triangle.isHalfplane()) { if(d1<=d2) { return p1; } else { return p2; } } else { Vector3 p3 = triangle.p3(); double d3 = distanceXY(p3, pointToDelete); if(d1<=d2 && d1<=d3) { return p1; } else if(d2<=d1 && d2<=d3) { return p2; } else { return p3; } } }
[ "public", "Vector3", "findClosePoint", "(", "Vector3", "pointToDelete", ")", "{", "Triangle", "triangle", "=", "find", "(", "pointToDelete", ")", ";", "Vector3", "p1", "=", "triangle", ".", "p1", "(", ")", ";", "Vector3", "p2", "=", "triangle", ".", "p2", "(", ")", ";", "double", "d1", "=", "distanceXY", "(", "p1", ",", "pointToDelete", ")", ";", "double", "d2", "=", "distanceXY", "(", "p2", ",", "pointToDelete", ")", ";", "if", "(", "triangle", ".", "isHalfplane", "(", ")", ")", "{", "if", "(", "d1", "<=", "d2", ")", "{", "return", "p1", ";", "}", "else", "{", "return", "p2", ";", "}", "}", "else", "{", "Vector3", "p3", "=", "triangle", ".", "p3", "(", ")", ";", "double", "d3", "=", "distanceXY", "(", "p3", ",", "pointToDelete", ")", ";", "if", "(", "d1", "<=", "d2", "&&", "d1", "<=", "d3", ")", "{", "return", "p1", ";", "}", "else", "if", "(", "d2", "<=", "d1", "&&", "d2", "<=", "d3", ")", "{", "return", "p2", ";", "}", "else", "{", "return", "p3", ";", "}", "}", "}" ]
return a point from the trangulation that is close to pointToDelete @param pointToDelete the point that the user wants to delete @return a point from the trangulation that is close to pointToDelete By Eyal Roth & Doron Ganel (2009).
[ "return", "a", "point", "from", "the", "trangulation", "that", "is", "close", "to", "pointToDelete" ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/jdt/triangulation/DelaunayTriangulation.java#L207-L235
12,303
Harium/keel
src/main/java/jdt/triangulation/DelaunayTriangulation.java
DelaunayTriangulation.findTriangleNeighborhood
public List<Triangle> findTriangleNeighborhood(Triangle firstTriangle, Vector3 point) { List<Triangle> triangles = new ArrayList<Triangle>(30); triangles.add(firstTriangle); Triangle prevTriangle = null; Triangle currentTriangle = firstTriangle; Triangle nextTriangle = currentTriangle.nextNeighbor(point, prevTriangle); while (!nextTriangle.equals(firstTriangle)) { //the point is on the perimeter if(nextTriangle.isHalfplane()) { return null; } triangles.add(nextTriangle); prevTriangle = currentTriangle; currentTriangle = nextTriangle; nextTriangle = currentTriangle.nextNeighbor(point, prevTriangle); } return triangles; }
java
public List<Triangle> findTriangleNeighborhood(Triangle firstTriangle, Vector3 point) { List<Triangle> triangles = new ArrayList<Triangle>(30); triangles.add(firstTriangle); Triangle prevTriangle = null; Triangle currentTriangle = firstTriangle; Triangle nextTriangle = currentTriangle.nextNeighbor(point, prevTriangle); while (!nextTriangle.equals(firstTriangle)) { //the point is on the perimeter if(nextTriangle.isHalfplane()) { return null; } triangles.add(nextTriangle); prevTriangle = currentTriangle; currentTriangle = nextTriangle; nextTriangle = currentTriangle.nextNeighbor(point, prevTriangle); } return triangles; }
[ "public", "List", "<", "Triangle", ">", "findTriangleNeighborhood", "(", "Triangle", "firstTriangle", ",", "Vector3", "point", ")", "{", "List", "<", "Triangle", ">", "triangles", "=", "new", "ArrayList", "<", "Triangle", ">", "(", "30", ")", ";", "triangles", ".", "add", "(", "firstTriangle", ")", ";", "Triangle", "prevTriangle", "=", "null", ";", "Triangle", "currentTriangle", "=", "firstTriangle", ";", "Triangle", "nextTriangle", "=", "currentTriangle", ".", "nextNeighbor", "(", "point", ",", "prevTriangle", ")", ";", "while", "(", "!", "nextTriangle", ".", "equals", "(", "firstTriangle", ")", ")", "{", "//the point is on the perimeter\r", "if", "(", "nextTriangle", ".", "isHalfplane", "(", ")", ")", "{", "return", "null", ";", "}", "triangles", ".", "add", "(", "nextTriangle", ")", ";", "prevTriangle", "=", "currentTriangle", ";", "currentTriangle", "=", "nextTriangle", ";", "nextTriangle", "=", "currentTriangle", ".", "nextNeighbor", "(", "point", ",", "prevTriangle", ")", ";", "}", "return", "triangles", ";", "}" ]
changed to public by Udi
[ "changed", "to", "public", "by", "Udi" ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/jdt/triangulation/DelaunayTriangulation.java#L1180-L1201
12,304
Harium/keel
src/main/java/jdt/triangulation/DelaunayTriangulation.java
DelaunayTriangulation.getConvexHullVerticesIterator
private Iterator<Vector3> getConvexHullVerticesIterator() { List<Vector3> ans = new ArrayList<Vector3>(); Triangle curr = this.startTriangleHull; boolean cont = true; double x0 = bbMin.x, x1 = bbMax.x; double y0 = bbMin.y, y1 = bbMax.y; boolean sx, sy; while (cont) { sx = curr.p1().x == x0 || curr.p1().x == x1; sy = curr.p1().y == y0 || curr.p1().y == y1; if ((sx && sy) || (!sx && !sy)) { ans.add(curr.p1()); } if (curr.bcnext != null && curr.bcnext.halfplane) curr = curr.bcnext; if (curr == this.startTriangleHull) cont = false; } return ans.iterator(); }
java
private Iterator<Vector3> getConvexHullVerticesIterator() { List<Vector3> ans = new ArrayList<Vector3>(); Triangle curr = this.startTriangleHull; boolean cont = true; double x0 = bbMin.x, x1 = bbMax.x; double y0 = bbMin.y, y1 = bbMax.y; boolean sx, sy; while (cont) { sx = curr.p1().x == x0 || curr.p1().x == x1; sy = curr.p1().y == y0 || curr.p1().y == y1; if ((sx && sy) || (!sx && !sy)) { ans.add(curr.p1()); } if (curr.bcnext != null && curr.bcnext.halfplane) curr = curr.bcnext; if (curr == this.startTriangleHull) cont = false; } return ans.iterator(); }
[ "private", "Iterator", "<", "Vector3", ">", "getConvexHullVerticesIterator", "(", ")", "{", "List", "<", "Vector3", ">", "ans", "=", "new", "ArrayList", "<", "Vector3", ">", "(", ")", ";", "Triangle", "curr", "=", "this", ".", "startTriangleHull", ";", "boolean", "cont", "=", "true", ";", "double", "x0", "=", "bbMin", ".", "x", ",", "x1", "=", "bbMax", ".", "x", ";", "double", "y0", "=", "bbMin", ".", "y", ",", "y1", "=", "bbMax", ".", "y", ";", "boolean", "sx", ",", "sy", ";", "while", "(", "cont", ")", "{", "sx", "=", "curr", ".", "p1", "(", ")", ".", "x", "==", "x0", "||", "curr", ".", "p1", "(", ")", ".", "x", "==", "x1", ";", "sy", "=", "curr", ".", "p1", "(", ")", ".", "y", "==", "y0", "||", "curr", ".", "p1", "(", ")", ".", "y", "==", "y1", ";", "if", "(", "(", "sx", "&&", "sy", ")", "||", "(", "!", "sx", "&&", "!", "sy", ")", ")", "{", "ans", ".", "add", "(", "curr", ".", "p1", "(", ")", ")", ";", "}", "if", "(", "curr", ".", "bcnext", "!=", "null", "&&", "curr", ".", "bcnext", ".", "halfplane", ")", "curr", "=", "curr", ".", "bcnext", ";", "if", "(", "curr", "==", "this", ".", "startTriangleHull", ")", "cont", "=", "false", ";", "}", "return", "ans", ".", "iterator", "(", ")", ";", "}" ]
returns an iterator to the set of all the points on the XY-convex hull @return iterator to the set of all the points on the XY-convex hull.
[ "returns", "an", "iterator", "to", "the", "set", "of", "all", "the", "points", "on", "the", "XY", "-", "convex", "hull" ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/jdt/triangulation/DelaunayTriangulation.java#L1369-L1388
12,305
Harium/keel
src/main/java/com/harium/keel/effect/rotate/RotateOperation.java
RotateOperation.angle
public RotateOperation angle(double angle) { this.angle = angle; // Calculate cos and sin with negative angle double angleRad = -angle * Math.PI / 180; angleCos = Math.cos(angleRad); angleSin = Math.sin(angleRad); return this; }
java
public RotateOperation angle(double angle) { this.angle = angle; // Calculate cos and sin with negative angle double angleRad = -angle * Math.PI / 180; angleCos = Math.cos(angleRad); angleSin = Math.sin(angleRad); return this; }
[ "public", "RotateOperation", "angle", "(", "double", "angle", ")", "{", "this", ".", "angle", "=", "angle", ";", "// Calculate cos and sin with negative angle", "double", "angleRad", "=", "-", "angle", "*", "Math", ".", "PI", "/", "180", ";", "angleCos", "=", "Math", ".", "cos", "(", "angleRad", ")", ";", "angleSin", "=", "Math", ".", "sin", "(", "angleRad", ")", ";", "return", "this", ";", "}" ]
Set Angle. @param angle Angle [0..360].
[ "Set", "Angle", "." ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/rotate/RotateOperation.java#L35-L42
12,306
Harium/keel
src/main/java/com/harium/keel/effect/rotate/RotateOperation.java
RotateOperation.fillColor
public RotateOperation fillColor(int red, int green, int blue) { this.fillRed = red; this.fillGreen = green; this.fillBlue = blue; return this; }
java
public RotateOperation fillColor(int red, int green, int blue) { this.fillRed = red; this.fillGreen = green; this.fillBlue = blue; return this; }
[ "public", "RotateOperation", "fillColor", "(", "int", "red", ",", "int", "green", ",", "int", "blue", ")", "{", "this", ".", "fillRed", "=", "red", ";", "this", ".", "fillGreen", "=", "green", ";", "this", ".", "fillBlue", "=", "blue", ";", "return", "this", ";", "}" ]
Set Fill color. @param red Red channel's value. @param green Green channel's value. @param blue Blue channel's value.
[ "Set", "Fill", "color", "." ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/rotate/RotateOperation.java#L70-L75
12,307
Harium/keel
src/main/java/com/harium/keel/effect/helper/Curve.java
Curve.makeLut
public int[] makeLut() { int numKnots = x.length; float[] nx = new float[numKnots + 2]; float[] ny = new float[numKnots + 2]; System.arraycopy(x, 0, nx, 1, numKnots); System.arraycopy(y, 0, ny, 1, numKnots); nx[0] = nx[1]; ny[0] = ny[1]; nx[numKnots + 1] = nx[numKnots]; ny[numKnots + 1] = ny[numKnots]; int[] table = new int[256]; for (int i = 0; i < 1024; i++) { float f = i / 1024.0f; int x = (int) (255 * Curve.Spline(f, nx.length, nx) + 0.5f); int y = (int) (255 * Curve.Spline(f, nx.length, ny) + 0.5f); x = x > 255 ? 255 : x; x = x < 0 ? 0 : x; y = y > 255 ? 255 : y; y = y < 0 ? 0 : y; table[x] = y; } return table; }
java
public int[] makeLut() { int numKnots = x.length; float[] nx = new float[numKnots + 2]; float[] ny = new float[numKnots + 2]; System.arraycopy(x, 0, nx, 1, numKnots); System.arraycopy(y, 0, ny, 1, numKnots); nx[0] = nx[1]; ny[0] = ny[1]; nx[numKnots + 1] = nx[numKnots]; ny[numKnots + 1] = ny[numKnots]; int[] table = new int[256]; for (int i = 0; i < 1024; i++) { float f = i / 1024.0f; int x = (int) (255 * Curve.Spline(f, nx.length, nx) + 0.5f); int y = (int) (255 * Curve.Spline(f, nx.length, ny) + 0.5f); x = x > 255 ? 255 : x; x = x < 0 ? 0 : x; y = y > 255 ? 255 : y; y = y < 0 ? 0 : y; table[x] = y; } return table; }
[ "public", "int", "[", "]", "makeLut", "(", ")", "{", "int", "numKnots", "=", "x", ".", "length", ";", "float", "[", "]", "nx", "=", "new", "float", "[", "numKnots", "+", "2", "]", ";", "float", "[", "]", "ny", "=", "new", "float", "[", "numKnots", "+", "2", "]", ";", "System", ".", "arraycopy", "(", "x", ",", "0", ",", "nx", ",", "1", ",", "numKnots", ")", ";", "System", ".", "arraycopy", "(", "y", ",", "0", ",", "ny", ",", "1", ",", "numKnots", ")", ";", "nx", "[", "0", "]", "=", "nx", "[", "1", "]", ";", "ny", "[", "0", "]", "=", "ny", "[", "1", "]", ";", "nx", "[", "numKnots", "+", "1", "]", "=", "nx", "[", "numKnots", "]", ";", "ny", "[", "numKnots", "+", "1", "]", "=", "ny", "[", "numKnots", "]", ";", "int", "[", "]", "table", "=", "new", "int", "[", "256", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "1024", ";", "i", "++", ")", "{", "float", "f", "=", "i", "/", "1024.0f", ";", "int", "x", "=", "(", "int", ")", "(", "255", "*", "Curve", ".", "Spline", "(", "f", ",", "nx", ".", "length", ",", "nx", ")", "+", "0.5f", ")", ";", "int", "y", "=", "(", "int", ")", "(", "255", "*", "Curve", ".", "Spline", "(", "f", ",", "nx", ".", "length", ",", "ny", ")", "+", "0.5f", ")", ";", "x", "=", "x", ">", "255", "?", "255", ":", "x", ";", "x", "=", "x", "<", "0", "?", "0", ":", "x", ";", "y", "=", "y", ">", "255", "?", "255", ":", "y", ";", "y", "=", "y", "<", "0", "?", "0", ":", "y", ";", "table", "[", "x", "]", "=", "y", ";", "}", "return", "table", ";", "}" ]
Create LUT. @return LUT.
[ "Create", "LUT", "." ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/helper/Curve.java#L206-L229
12,308
Harium/keel
src/main/java/com/harium/keel/effect/helper/Curve.java
Curve.Spline
public static float Spline(float x, int numKnots, float[] knots) { int span; int numSpans = numKnots - 3; float k0, k1, k2, k3; float c0, c1, c2, c3; if (numSpans < 1) throw new IllegalArgumentException("Too few knots in spline"); x = x > 1 ? 1 : x; x = x < 0 ? 0 : x; x *= numSpans; span = (int) x; if (span > numKnots - 4) span = numKnots - 4; x -= span; k0 = knots[span]; k1 = knots[span + 1]; k2 = knots[span + 2]; k3 = knots[span + 3]; c3 = -0.5f * k0 + 1.5f * k1 + -1.5f * k2 + 0.5f * k3; c2 = 1f * k0 + -2.5f * k1 + 2f * k2 + -0.5f * k3; c1 = -0.5f * k0 + 0f * k1 + 0.5f * k2 + 0f * k3; c0 = 0f * k0 + 1f * k1 + 0f * k2 + 0f * k3; return ((c3 * x + c2) * x + c1) * x + c0; }
java
public static float Spline(float x, int numKnots, float[] knots) { int span; int numSpans = numKnots - 3; float k0, k1, k2, k3; float c0, c1, c2, c3; if (numSpans < 1) throw new IllegalArgumentException("Too few knots in spline"); x = x > 1 ? 1 : x; x = x < 0 ? 0 : x; x *= numSpans; span = (int) x; if (span > numKnots - 4) span = numKnots - 4; x -= span; k0 = knots[span]; k1 = knots[span + 1]; k2 = knots[span + 2]; k3 = knots[span + 3]; c3 = -0.5f * k0 + 1.5f * k1 + -1.5f * k2 + 0.5f * k3; c2 = 1f * k0 + -2.5f * k1 + 2f * k2 + -0.5f * k3; c1 = -0.5f * k0 + 0f * k1 + 0.5f * k2 + 0f * k3; c0 = 0f * k0 + 1f * k1 + 0f * k2 + 0f * k3; return ((c3 * x + c2) * x + c1) * x + c0; }
[ "public", "static", "float", "Spline", "(", "float", "x", ",", "int", "numKnots", ",", "float", "[", "]", "knots", ")", "{", "int", "span", ";", "int", "numSpans", "=", "numKnots", "-", "3", ";", "float", "k0", ",", "k1", ",", "k2", ",", "k3", ";", "float", "c0", ",", "c1", ",", "c2", ",", "c3", ";", "if", "(", "numSpans", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"Too few knots in spline\"", ")", ";", "x", "=", "x", ">", "1", "?", "1", ":", "x", ";", "x", "=", "x", "<", "0", "?", "0", ":", "x", ";", "x", "*=", "numSpans", ";", "span", "=", "(", "int", ")", "x", ";", "if", "(", "span", ">", "numKnots", "-", "4", ")", "span", "=", "numKnots", "-", "4", ";", "x", "-=", "span", ";", "k0", "=", "knots", "[", "span", "]", ";", "k1", "=", "knots", "[", "span", "+", "1", "]", ";", "k2", "=", "knots", "[", "span", "+", "2", "]", ";", "k3", "=", "knots", "[", "span", "+", "3", "]", ";", "c3", "=", "-", "0.5f", "*", "k0", "+", "1.5f", "*", "k1", "+", "-", "1.5f", "*", "k2", "+", "0.5f", "*", "k3", ";", "c2", "=", "1f", "*", "k0", "+", "-", "2.5f", "*", "k1", "+", "2f", "*", "k2", "+", "-", "0.5f", "*", "k3", ";", "c1", "=", "-", "0.5f", "*", "k0", "+", "0f", "*", "k1", "+", "0.5f", "*", "k2", "+", "0f", "*", "k3", ";", "c0", "=", "0f", "*", "k0", "+", "1f", "*", "k1", "+", "0f", "*", "k2", "+", "0f", "*", "k3", ";", "return", "(", "(", "c3", "*", "x", "+", "c2", ")", "*", "x", "+", "c1", ")", "*", "x", "+", "c0", ";", "}" ]
compute a Catmull-Rom spline. @param x the input parameter @param numKnots the number of knots in the spline @param knots the array of knots @return the spline value
[ "compute", "a", "Catmull", "-", "Rom", "spline", "." ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/helper/Curve.java#L239-L267
12,309
Harium/keel
src/main/java/com/harium/keel/effect/helper/Curve.java
Curve.Spline
public static float Spline(float x, int numKnots, int[] xknots, int[] yknots) { int span; int numSpans = numKnots - 3; float k0, k1, k2, k3; float c0, c1, c2, c3; if (numSpans < 1) throw new IllegalArgumentException("Too few knots in spline"); for (span = 0; span < numSpans; span++) if (xknots[span + 1] > x) break; if (span > numKnots - 3) span = numKnots - 3; float t = (float) (x - xknots[span]) / (xknots[span + 1] - xknots[span]); span--; if (span < 0) { span = 0; t = 0; } k0 = yknots[span]; k1 = yknots[span + 1]; k2 = yknots[span + 2]; k3 = yknots[span + 3]; c3 = -0.5f * k0 + 1.5f * k1 + -1.5f * k2 + 0.5f * k3; c2 = 1f * k0 + -2.5f * k1 + 2f * k2 + -0.5f * k3; c1 = -0.5f * k0 + 0f * k1 + 0.5f * k2 + 0f * k3; c0 = 0f * k0 + 1f * k1 + 0f * k2 + 0f * k3; return ((c3 * t + c2) * t + c1) * t + c0; }
java
public static float Spline(float x, int numKnots, int[] xknots, int[] yknots) { int span; int numSpans = numKnots - 3; float k0, k1, k2, k3; float c0, c1, c2, c3; if (numSpans < 1) throw new IllegalArgumentException("Too few knots in spline"); for (span = 0; span < numSpans; span++) if (xknots[span + 1] > x) break; if (span > numKnots - 3) span = numKnots - 3; float t = (float) (x - xknots[span]) / (xknots[span + 1] - xknots[span]); span--; if (span < 0) { span = 0; t = 0; } k0 = yknots[span]; k1 = yknots[span + 1]; k2 = yknots[span + 2]; k3 = yknots[span + 3]; c3 = -0.5f * k0 + 1.5f * k1 + -1.5f * k2 + 0.5f * k3; c2 = 1f * k0 + -2.5f * k1 + 2f * k2 + -0.5f * k3; c1 = -0.5f * k0 + 0f * k1 + 0.5f * k2 + 0f * k3; c0 = 0f * k0 + 1f * k1 + 0f * k2 + 0f * k3; return ((c3 * t + c2) * t + c1) * t + c0; }
[ "public", "static", "float", "Spline", "(", "float", "x", ",", "int", "numKnots", ",", "int", "[", "]", "xknots", ",", "int", "[", "]", "yknots", ")", "{", "int", "span", ";", "int", "numSpans", "=", "numKnots", "-", "3", ";", "float", "k0", ",", "k1", ",", "k2", ",", "k3", ";", "float", "c0", ",", "c1", ",", "c2", ",", "c3", ";", "if", "(", "numSpans", "<", "1", ")", "throw", "new", "IllegalArgumentException", "(", "\"Too few knots in spline\"", ")", ";", "for", "(", "span", "=", "0", ";", "span", "<", "numSpans", ";", "span", "++", ")", "if", "(", "xknots", "[", "span", "+", "1", "]", ">", "x", ")", "break", ";", "if", "(", "span", ">", "numKnots", "-", "3", ")", "span", "=", "numKnots", "-", "3", ";", "float", "t", "=", "(", "float", ")", "(", "x", "-", "xknots", "[", "span", "]", ")", "/", "(", "xknots", "[", "span", "+", "1", "]", "-", "xknots", "[", "span", "]", ")", ";", "span", "--", ";", "if", "(", "span", "<", "0", ")", "{", "span", "=", "0", ";", "t", "=", "0", ";", "}", "k0", "=", "yknots", "[", "span", "]", ";", "k1", "=", "yknots", "[", "span", "+", "1", "]", ";", "k2", "=", "yknots", "[", "span", "+", "2", "]", ";", "k3", "=", "yknots", "[", "span", "+", "3", "]", ";", "c3", "=", "-", "0.5f", "*", "k0", "+", "1.5f", "*", "k1", "+", "-", "1.5f", "*", "k2", "+", "0.5f", "*", "k3", ";", "c2", "=", "1f", "*", "k0", "+", "-", "2.5f", "*", "k1", "+", "2f", "*", "k2", "+", "-", "0.5f", "*", "k3", ";", "c1", "=", "-", "0.5f", "*", "k0", "+", "0f", "*", "k1", "+", "0.5f", "*", "k2", "+", "0f", "*", "k3", ";", "c0", "=", "0f", "*", "k0", "+", "1f", "*", "k1", "+", "0f", "*", "k2", "+", "0f", "*", "k3", ";", "return", "(", "(", "c3", "*", "t", "+", "c2", ")", "*", "t", "+", "c1", ")", "*", "t", "+", "c0", ";", "}" ]
compute a Catmull-Rom spline, but with variable knot spacing. @param x the input parameter @param numKnots the number of knots in the spline @param xknots the array of knot x values @param yknots the array of knot y values @return the spline value
[ "compute", "a", "Catmull", "-", "Rom", "spline", "but", "with", "variable", "knot", "spacing", "." ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/helper/Curve.java#L278-L310
12,310
skuzzle/jeve
jeve/src/main/java/de/skuzzle/jeve/EventPredicates.java
EventPredicates.withListenerClass
public static Predicate<Event<?, ?>> withListenerClass( Class<? extends Listener> cls) { if (cls == null) { throw new IllegalArgumentException("cls is null"); } return event -> event.getListenerClass() == cls; }
java
public static Predicate<Event<?, ?>> withListenerClass( Class<? extends Listener> cls) { if (cls == null) { throw new IllegalArgumentException("cls is null"); } return event -> event.getListenerClass() == cls; }
[ "public", "static", "Predicate", "<", "Event", "<", "?", ",", "?", ">", ">", "withListenerClass", "(", "Class", "<", "?", "extends", "Listener", ">", "cls", ")", "{", "if", "(", "cls", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"cls is null\"", ")", ";", "}", "return", "event", "->", "event", ".", "getListenerClass", "(", ")", "==", "cls", ";", "}" ]
Creates a predicate that matches events for the given listener class. @param cls The listener class to check for. @return The predicate.
[ "Creates", "a", "predicate", "that", "matches", "events", "for", "the", "given", "listener", "class", "." ]
42cc18947c9c8596c34410336e4e375e9fcd7c47
https://github.com/skuzzle/jeve/blob/42cc18947c9c8596c34410336e4e375e9fcd7c47/jeve/src/main/java/de/skuzzle/jeve/EventPredicates.java#L23-L29
12,311
Harium/keel
src/main/java/com/harium/keel/util/CameraUtil.java
CameraUtil.fieldOfView
public static float fieldOfView(float focalLength, float sensorWidth) { double fov = 2 * Math.atan(.5 * sensorWidth / focalLength); return (float) Math.toDegrees(fov); }
java
public static float fieldOfView(float focalLength, float sensorWidth) { double fov = 2 * Math.atan(.5 * sensorWidth / focalLength); return (float) Math.toDegrees(fov); }
[ "public", "static", "float", "fieldOfView", "(", "float", "focalLength", ",", "float", "sensorWidth", ")", "{", "double", "fov", "=", "2", "*", "Math", ".", "atan", "(", ".5", "*", "sensorWidth", "/", "focalLength", ")", ";", "return", "(", "float", ")", "Math", ".", "toDegrees", "(", "fov", ")", ";", "}" ]
Calculate the FOV of camera, using focalLength and sensorWidth @param focalLength @param sensorWidth @return FOV
[ "Calculate", "the", "FOV", "of", "camera", "using", "focalLength", "and", "sensorWidth" ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/util/CameraUtil.java#L24-L27
12,312
Harium/keel
src/main/java/com/harium/keel/effect/GammaCorrection.java
GammaCorrection.gammaLUT
private static int[] gammaLUT(double gammaValue) { int[] gammaLUT = new int[256]; for (int i = 0; i < gammaLUT.length; i++) { gammaLUT[i] = (int) (255 * (Math.pow((double) i / (double) 255, gammaValue))); } return gammaLUT; }
java
private static int[] gammaLUT(double gammaValue) { int[] gammaLUT = new int[256]; for (int i = 0; i < gammaLUT.length; i++) { gammaLUT[i] = (int) (255 * (Math.pow((double) i / (double) 255, gammaValue))); } return gammaLUT; }
[ "private", "static", "int", "[", "]", "gammaLUT", "(", "double", "gammaValue", ")", "{", "int", "[", "]", "gammaLUT", "=", "new", "int", "[", "256", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "gammaLUT", ".", "length", ";", "i", "++", ")", "{", "gammaLUT", "[", "i", "]", "=", "(", "int", ")", "(", "255", "*", "(", "Math", ".", "pow", "(", "(", "double", ")", "i", "/", "(", "double", ")", "255", ",", "gammaValue", ")", ")", ")", ";", "}", "return", "gammaLUT", ";", "}" ]
Create the gamma correction lookup table
[ "Create", "the", "gamma", "correction", "lookup", "table" ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/GammaCorrection.java#L50-L58
12,313
Harium/keel
src/main/java/com/harium/keel/catalano/math/function/Beta.java
Beta.Log
public static double Log(double a, double b) { return Gamma.Log(a) + Gamma.Log(b) - Gamma.Log(a + b); }
java
public static double Log(double a, double b) { return Gamma.Log(a) + Gamma.Log(b) - Gamma.Log(a + b); }
[ "public", "static", "double", "Log", "(", "double", "a", ",", "double", "b", ")", "{", "return", "Gamma", ".", "Log", "(", "a", ")", "+", "Gamma", ".", "Log", "(", "b", ")", "-", "Gamma", ".", "Log", "(", "a", "+", "b", ")", ";", "}" ]
Natural logarithm of the Beta function. @param a Value. @param b Value. @return Result.
[ "Natural", "logarithm", "of", "the", "Beta", "function", "." ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/function/Beta.java#L60-L62
12,314
Harium/keel
src/main/java/com/harium/keel/catalano/math/transform/FourierTransform.java
FourierTransform.DFT
public static void DFT(ComplexNumber[] data, Direction direction) { int n = data.length; ComplexNumber[] c = new ComplexNumber[n]; // for each destination element for (int i = 0; i < n; i++) { c[i] = new ComplexNumber(0, 0); double sumRe = 0; double sumIm = 0; double phim = 2 * Math.PI * i / n; // sum source elements for (int j = 0; j < n; j++) { double gRe = data[j].real; double gIm = data[j].imaginary; double cosw = Math.cos(phim * j); double sinw = Math.sin(phim * j); if (direction == Direction.Backward) sinw = -sinw; sumRe += (gRe * cosw + data[j].imaginary * sinw); sumIm += (gIm * cosw - data[j].real * sinw); } c[i] = new ComplexNumber(sumRe, sumIm); } if (direction == Direction.Backward) { for (int i = 0; i < c.length; i++) { data[i].real = c[i].real / n; data[i].imaginary = c[i].imaginary / n; } } else { for (int i = 0; i < c.length; i++) { data[i].real = c[i].real; data[i].imaginary = c[i].imaginary; } } }
java
public static void DFT(ComplexNumber[] data, Direction direction) { int n = data.length; ComplexNumber[] c = new ComplexNumber[n]; // for each destination element for (int i = 0; i < n; i++) { c[i] = new ComplexNumber(0, 0); double sumRe = 0; double sumIm = 0; double phim = 2 * Math.PI * i / n; // sum source elements for (int j = 0; j < n; j++) { double gRe = data[j].real; double gIm = data[j].imaginary; double cosw = Math.cos(phim * j); double sinw = Math.sin(phim * j); if (direction == Direction.Backward) sinw = -sinw; sumRe += (gRe * cosw + data[j].imaginary * sinw); sumIm += (gIm * cosw - data[j].real * sinw); } c[i] = new ComplexNumber(sumRe, sumIm); } if (direction == Direction.Backward) { for (int i = 0; i < c.length; i++) { data[i].real = c[i].real / n; data[i].imaginary = c[i].imaginary / n; } } else { for (int i = 0; i < c.length; i++) { data[i].real = c[i].real; data[i].imaginary = c[i].imaginary; } } }
[ "public", "static", "void", "DFT", "(", "ComplexNumber", "[", "]", "data", ",", "Direction", "direction", ")", "{", "int", "n", "=", "data", ".", "length", ";", "ComplexNumber", "[", "]", "c", "=", "new", "ComplexNumber", "[", "n", "]", ";", "// for each destination element\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "c", "[", "i", "]", "=", "new", "ComplexNumber", "(", "0", ",", "0", ")", ";", "double", "sumRe", "=", "0", ";", "double", "sumIm", "=", "0", ";", "double", "phim", "=", "2", "*", "Math", ".", "PI", "*", "i", "/", "n", ";", "// sum source elements\r", "for", "(", "int", "j", "=", "0", ";", "j", "<", "n", ";", "j", "++", ")", "{", "double", "gRe", "=", "data", "[", "j", "]", ".", "real", ";", "double", "gIm", "=", "data", "[", "j", "]", ".", "imaginary", ";", "double", "cosw", "=", "Math", ".", "cos", "(", "phim", "*", "j", ")", ";", "double", "sinw", "=", "Math", ".", "sin", "(", "phim", "*", "j", ")", ";", "if", "(", "direction", "==", "Direction", ".", "Backward", ")", "sinw", "=", "-", "sinw", ";", "sumRe", "+=", "(", "gRe", "*", "cosw", "+", "data", "[", "j", "]", ".", "imaginary", "*", "sinw", ")", ";", "sumIm", "+=", "(", "gIm", "*", "cosw", "-", "data", "[", "j", "]", ".", "real", "*", "sinw", ")", ";", "}", "c", "[", "i", "]", "=", "new", "ComplexNumber", "(", "sumRe", ",", "sumIm", ")", ";", "}", "if", "(", "direction", "==", "Direction", ".", "Backward", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "c", ".", "length", ";", "i", "++", ")", "{", "data", "[", "i", "]", ".", "real", "=", "c", "[", "i", "]", ".", "real", "/", "n", ";", "data", "[", "i", "]", ".", "imaginary", "=", "c", "[", "i", "]", ".", "imaginary", "/", "n", ";", "}", "}", "else", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "c", ".", "length", ";", "i", "++", ")", "{", "data", "[", "i", "]", ".", "real", "=", "c", "[", "i", "]", ".", "real", ";", "data", "[", "i", "]", ".", "imaginary", "=", "c", "[", "i", "]", ".", "imaginary", ";", "}", "}", "}" ]
1-D Discrete Fourier Transform. @param data Data to transform. @param direction Transformation direction.
[ "1", "-", "D", "Discrete", "Fourier", "Transform", "." ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/transform/FourierTransform.java#L84-L122
12,315
Harium/keel
src/main/java/com/harium/keel/catalano/math/transform/FourierTransform.java
FourierTransform.DFT2
public static void DFT2(ComplexNumber[][] data, Direction direction) { int n = data.length; int m = data[0].length; ComplexNumber[] row = new ComplexNumber[Math.max(m, n)]; for (int i = 0; i < n; i++) { // copy row for (int j = 0; j < n; j++) row[j] = data[i][j]; // transform it FourierTransform.DFT(row, direction); // copy back for (int j = 0; j < n; j++) data[i][j] = row[j]; } // process columns ComplexNumber[] col = new ComplexNumber[n]; for (int j = 0; j < n; j++) { // copy column for (int i = 0; i < n; i++) col[i] = data[i][j]; // transform it FourierTransform.DFT(col, direction); // copy back for (int i = 0; i < n; i++) data[i][j] = col[i]; } }
java
public static void DFT2(ComplexNumber[][] data, Direction direction) { int n = data.length; int m = data[0].length; ComplexNumber[] row = new ComplexNumber[Math.max(m, n)]; for (int i = 0; i < n; i++) { // copy row for (int j = 0; j < n; j++) row[j] = data[i][j]; // transform it FourierTransform.DFT(row, direction); // copy back for (int j = 0; j < n; j++) data[i][j] = row[j]; } // process columns ComplexNumber[] col = new ComplexNumber[n]; for (int j = 0; j < n; j++) { // copy column for (int i = 0; i < n; i++) col[i] = data[i][j]; // transform it FourierTransform.DFT(col, direction); // copy back for (int i = 0; i < n; i++) data[i][j] = col[i]; } }
[ "public", "static", "void", "DFT2", "(", "ComplexNumber", "[", "]", "[", "]", "data", ",", "Direction", "direction", ")", "{", "int", "n", "=", "data", ".", "length", ";", "int", "m", "=", "data", "[", "0", "]", ".", "length", ";", "ComplexNumber", "[", "]", "row", "=", "new", "ComplexNumber", "[", "Math", ".", "max", "(", "m", ",", "n", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "// copy row\r", "for", "(", "int", "j", "=", "0", ";", "j", "<", "n", ";", "j", "++", ")", "row", "[", "j", "]", "=", "data", "[", "i", "]", "[", "j", "]", ";", "// transform it\r", "FourierTransform", ".", "DFT", "(", "row", ",", "direction", ")", ";", "// copy back\r", "for", "(", "int", "j", "=", "0", ";", "j", "<", "n", ";", "j", "++", ")", "data", "[", "i", "]", "[", "j", "]", "=", "row", "[", "j", "]", ";", "}", "// process columns\r", "ComplexNumber", "[", "]", "col", "=", "new", "ComplexNumber", "[", "n", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "n", ";", "j", "++", ")", "{", "// copy column\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "col", "[", "i", "]", "=", "data", "[", "i", "]", "[", "j", "]", ";", "// transform it\r", "FourierTransform", ".", "DFT", "(", "col", ",", "direction", ")", ";", "// copy back\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "data", "[", "i", "]", "[", "j", "]", "=", "col", "[", "i", "]", ";", "}", "}" ]
2-D Discrete Fourier Transform. @param data Data to transform. @param direction Transformation direction.
[ "2", "-", "D", "Discrete", "Fourier", "Transform", "." ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/transform/FourierTransform.java#L130-L160
12,316
Harium/keel
src/main/java/com/harium/keel/catalano/math/transform/FourierTransform.java
FourierTransform.FFT
public static void FFT(ComplexNumber[] data, Direction direction) { double[] real = ComplexNumber.getReal(data); double[] img = ComplexNumber.getImaginary(data); if (direction == Direction.Forward) FFT(real, img); else FFT(img, real); if (direction == Direction.Forward) { for (int i = 0; i < real.length; i++) { data[i] = new ComplexNumber(real[i], img[i]); } } else { int n = real.length; for (int i = 0; i < n; i++) { data[i] = new ComplexNumber(real[i] / n, img[i] / n); } } }
java
public static void FFT(ComplexNumber[] data, Direction direction) { double[] real = ComplexNumber.getReal(data); double[] img = ComplexNumber.getImaginary(data); if (direction == Direction.Forward) FFT(real, img); else FFT(img, real); if (direction == Direction.Forward) { for (int i = 0; i < real.length; i++) { data[i] = new ComplexNumber(real[i], img[i]); } } else { int n = real.length; for (int i = 0; i < n; i++) { data[i] = new ComplexNumber(real[i] / n, img[i] / n); } } }
[ "public", "static", "void", "FFT", "(", "ComplexNumber", "[", "]", "data", ",", "Direction", "direction", ")", "{", "double", "[", "]", "real", "=", "ComplexNumber", ".", "getReal", "(", "data", ")", ";", "double", "[", "]", "img", "=", "ComplexNumber", ".", "getImaginary", "(", "data", ")", ";", "if", "(", "direction", "==", "Direction", ".", "Forward", ")", "FFT", "(", "real", ",", "img", ")", ";", "else", "FFT", "(", "img", ",", "real", ")", ";", "if", "(", "direction", "==", "Direction", ".", "Forward", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "real", ".", "length", ";", "i", "++", ")", "{", "data", "[", "i", "]", "=", "new", "ComplexNumber", "(", "real", "[", "i", "]", ",", "img", "[", "i", "]", ")", ";", "}", "}", "else", "{", "int", "n", "=", "real", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "data", "[", "i", "]", "=", "new", "ComplexNumber", "(", "real", "[", "i", "]", "/", "n", ",", "img", "[", "i", "]", "/", "n", ")", ";", "}", "}", "}" ]
1-D Fast Fourier Transform. @param data Data to transform. @param direction Transformation direction.
[ "1", "-", "D", "Fast", "Fourier", "Transform", "." ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/transform/FourierTransform.java#L168-L185
12,317
Harium/keel
src/main/java/com/harium/keel/catalano/math/transform/FourierTransform.java
FourierTransform.FFT2
public static void FFT2(ComplexNumber[][] data, Direction direction) { int n = data.length; int m = data[0].length; //ComplexNumber[] row = new ComplexNumber[m];//Math.max(m, n)]; for (int i = 0; i < n; i++) { // copy row //for ( int j = 0; j < m; j++ ) //row[j] = data[i][j]; ComplexNumber[] row = data[i]; // transform it FourierTransform.FFT(row, direction); // copy back for (int j = 0; j < m; j++) data[i][j] = row[j]; } // process columns ComplexNumber[] col = new ComplexNumber[n]; for (int j = 0; j < m; j++) { // copy column for (int i = 0; i < n; i++) col[i] = data[i][j]; // transform it FourierTransform.FFT(col, direction); // copy back for (int i = 0; i < n; i++) data[i][j] = col[i]; } }
java
public static void FFT2(ComplexNumber[][] data, Direction direction) { int n = data.length; int m = data[0].length; //ComplexNumber[] row = new ComplexNumber[m];//Math.max(m, n)]; for (int i = 0; i < n; i++) { // copy row //for ( int j = 0; j < m; j++ ) //row[j] = data[i][j]; ComplexNumber[] row = data[i]; // transform it FourierTransform.FFT(row, direction); // copy back for (int j = 0; j < m; j++) data[i][j] = row[j]; } // process columns ComplexNumber[] col = new ComplexNumber[n]; for (int j = 0; j < m; j++) { // copy column for (int i = 0; i < n; i++) col[i] = data[i][j]; // transform it FourierTransform.FFT(col, direction); // copy back for (int i = 0; i < n; i++) data[i][j] = col[i]; } }
[ "public", "static", "void", "FFT2", "(", "ComplexNumber", "[", "]", "[", "]", "data", ",", "Direction", "direction", ")", "{", "int", "n", "=", "data", ".", "length", ";", "int", "m", "=", "data", "[", "0", "]", ".", "length", ";", "//ComplexNumber[] row = new ComplexNumber[m];//Math.max(m, n)];\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "{", "// copy row\r", "//for ( int j = 0; j < m; j++ )\r", "//row[j] = data[i][j];\r", "ComplexNumber", "[", "]", "row", "=", "data", "[", "i", "]", ";", "// transform it\r", "FourierTransform", ".", "FFT", "(", "row", ",", "direction", ")", ";", "// copy back\r", "for", "(", "int", "j", "=", "0", ";", "j", "<", "m", ";", "j", "++", ")", "data", "[", "i", "]", "[", "j", "]", "=", "row", "[", "j", "]", ";", "}", "// process columns\r", "ComplexNumber", "[", "]", "col", "=", "new", "ComplexNumber", "[", "n", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "m", ";", "j", "++", ")", "{", "// copy column\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "col", "[", "i", "]", "=", "data", "[", "i", "]", "[", "j", "]", ";", "// transform it\r", "FourierTransform", ".", "FFT", "(", "col", ",", "direction", ")", ";", "// copy back\r", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "i", "++", ")", "data", "[", "i", "]", "[", "j", "]", "=", "col", "[", "i", "]", ";", "}", "}" ]
2-D Fast Fourier Transform. @param data Data to transform. @param direction Transformation direction.
[ "2", "-", "D", "Fast", "Fourier", "Transform", "." ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/transform/FourierTransform.java#L193-L223
12,318
Harium/keel
src/main/java/com/harium/keel/effect/neuroph/LetterSegmentation.java
LetterSegmentation.BFS
public ImageSource BFS(int startI, int startJ, /*String imageName*/ImageSource originalImage) { LinkedList<Vector2i> queue = new LinkedList<>(); //============================================================================= int gapX = 30; int gapY = 30; MatrixSource letter = new MatrixSource(letterWidth, letterHeight); //BufferedImage letter = new BufferedImage(letterWidth, letterHeight, BufferedImage.TYPE_BYTE_BINARY); int alpha = originalImage.getA(startI, startJ); int white = ColorHelper.getARGB(255, 255, 255, alpha); int black = ColorHelper.getARGB(0, 0, 0, alpha); for (int j = 0; j < letterHeight; j++) { for (int i = 0; i < letterWidth; i++) { letter.setRGB(i, j, white); } } //============================================================================= int count = 0; Vector2i positions = new Vector2i(startI, startJ); visited[startI][startJ] = true; queue.addLast(positions); while (!queue.isEmpty()) { Vector2i pos = queue.removeFirst(); int x = pos.getX(); int y = pos.getY(); visited[x][y] = true; //set black pixel to letter image=================================== int posX = startI - x + gapX; int posY = startJ - y + gapY; count++; if(posX>=originalImage.getWidth() || posY>=originalImage.getHeight()) { continue; } else { letter.setRGB(posX, posY, black); /*try { letter.setRGB(posX, posY, black); } catch (Exception e) { e.printStackTrace(); System.out.println("posX " + posX); System.out.println("posY " + posY); System.out.println("letterWidth " + letter.getWidth()); System.out.println("letterHeight " + letter.getHeight()); throw e; }*/ } //================================================================== for (int i = x - 1; i <= x + 1; i++) { for (int j = y - 1; j <= y + 1; j++) { if (i >= 0 && j >= 0 && i < originalImage.getWidth() && j < originalImage.getHeight()) { if (!visited[i][j]) { int color = originalImage.getGray(i, j); if (color < 10) { visited[i][j] = true; Vector2i tmpPos = new Vector2i(i, j); queue.addLast(tmpPos); } } } } //i } //j } System.out.println("count = " + count); //save letter=========================================================== if (count < 3) { return letter; } /*try { saveToFile(letter, imageName); // } catch (IOException ex) { ex.printStackTrace(); }*/ return letter; }
java
public ImageSource BFS(int startI, int startJ, /*String imageName*/ImageSource originalImage) { LinkedList<Vector2i> queue = new LinkedList<>(); //============================================================================= int gapX = 30; int gapY = 30; MatrixSource letter = new MatrixSource(letterWidth, letterHeight); //BufferedImage letter = new BufferedImage(letterWidth, letterHeight, BufferedImage.TYPE_BYTE_BINARY); int alpha = originalImage.getA(startI, startJ); int white = ColorHelper.getARGB(255, 255, 255, alpha); int black = ColorHelper.getARGB(0, 0, 0, alpha); for (int j = 0; j < letterHeight; j++) { for (int i = 0; i < letterWidth; i++) { letter.setRGB(i, j, white); } } //============================================================================= int count = 0; Vector2i positions = new Vector2i(startI, startJ); visited[startI][startJ] = true; queue.addLast(positions); while (!queue.isEmpty()) { Vector2i pos = queue.removeFirst(); int x = pos.getX(); int y = pos.getY(); visited[x][y] = true; //set black pixel to letter image=================================== int posX = startI - x + gapX; int posY = startJ - y + gapY; count++; if(posX>=originalImage.getWidth() || posY>=originalImage.getHeight()) { continue; } else { letter.setRGB(posX, posY, black); /*try { letter.setRGB(posX, posY, black); } catch (Exception e) { e.printStackTrace(); System.out.println("posX " + posX); System.out.println("posY " + posY); System.out.println("letterWidth " + letter.getWidth()); System.out.println("letterHeight " + letter.getHeight()); throw e; }*/ } //================================================================== for (int i = x - 1; i <= x + 1; i++) { for (int j = y - 1; j <= y + 1; j++) { if (i >= 0 && j >= 0 && i < originalImage.getWidth() && j < originalImage.getHeight()) { if (!visited[i][j]) { int color = originalImage.getGray(i, j); if (color < 10) { visited[i][j] = true; Vector2i tmpPos = new Vector2i(i, j); queue.addLast(tmpPos); } } } } //i } //j } System.out.println("count = " + count); //save letter=========================================================== if (count < 3) { return letter; } /*try { saveToFile(letter, imageName); // } catch (IOException ex) { ex.printStackTrace(); }*/ return letter; }
[ "public", "ImageSource", "BFS", "(", "int", "startI", ",", "int", "startJ", ",", "/*String imageName*/", "ImageSource", "originalImage", ")", "{", "LinkedList", "<", "Vector2i", ">", "queue", "=", "new", "LinkedList", "<>", "(", ")", ";", "//=============================================================================", "int", "gapX", "=", "30", ";", "int", "gapY", "=", "30", ";", "MatrixSource", "letter", "=", "new", "MatrixSource", "(", "letterWidth", ",", "letterHeight", ")", ";", "//BufferedImage letter = new BufferedImage(letterWidth, letterHeight, BufferedImage.TYPE_BYTE_BINARY);", "int", "alpha", "=", "originalImage", ".", "getA", "(", "startI", ",", "startJ", ")", ";", "int", "white", "=", "ColorHelper", ".", "getARGB", "(", "255", ",", "255", ",", "255", ",", "alpha", ")", ";", "int", "black", "=", "ColorHelper", ".", "getARGB", "(", "0", ",", "0", ",", "0", ",", "alpha", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "letterHeight", ";", "j", "++", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "letterWidth", ";", "i", "++", ")", "{", "letter", ".", "setRGB", "(", "i", ",", "j", ",", "white", ")", ";", "}", "}", "//=============================================================================", "int", "count", "=", "0", ";", "Vector2i", "positions", "=", "new", "Vector2i", "(", "startI", ",", "startJ", ")", ";", "visited", "[", "startI", "]", "[", "startJ", "]", "=", "true", ";", "queue", ".", "addLast", "(", "positions", ")", ";", "while", "(", "!", "queue", ".", "isEmpty", "(", ")", ")", "{", "Vector2i", "pos", "=", "queue", ".", "removeFirst", "(", ")", ";", "int", "x", "=", "pos", ".", "getX", "(", ")", ";", "int", "y", "=", "pos", ".", "getY", "(", ")", ";", "visited", "[", "x", "]", "[", "y", "]", "=", "true", ";", "//set black pixel to letter image===================================", "int", "posX", "=", "startI", "-", "x", "+", "gapX", ";", "int", "posY", "=", "startJ", "-", "y", "+", "gapY", ";", "count", "++", ";", "if", "(", "posX", ">=", "originalImage", ".", "getWidth", "(", ")", "||", "posY", ">=", "originalImage", ".", "getHeight", "(", ")", ")", "{", "continue", ";", "}", "else", "{", "letter", ".", "setRGB", "(", "posX", ",", "posY", ",", "black", ")", ";", "/*try {\n letter.setRGB(posX, posY, black);\n } catch (Exception e) {\n e.printStackTrace();\n System.out.println(\"posX \" + posX);\n System.out.println(\"posY \" + posY);\n System.out.println(\"letterWidth \" + letter.getWidth());\n System.out.println(\"letterHeight \" + letter.getHeight());\n throw e;\n }*/", "}", "//==================================================================", "for", "(", "int", "i", "=", "x", "-", "1", ";", "i", "<=", "x", "+", "1", ";", "i", "++", ")", "{", "for", "(", "int", "j", "=", "y", "-", "1", ";", "j", "<=", "y", "+", "1", ";", "j", "++", ")", "{", "if", "(", "i", ">=", "0", "&&", "j", ">=", "0", "&&", "i", "<", "originalImage", ".", "getWidth", "(", ")", "&&", "j", "<", "originalImage", ".", "getHeight", "(", ")", ")", "{", "if", "(", "!", "visited", "[", "i", "]", "[", "j", "]", ")", "{", "int", "color", "=", "originalImage", ".", "getGray", "(", "i", ",", "j", ")", ";", "if", "(", "color", "<", "10", ")", "{", "visited", "[", "i", "]", "[", "j", "]", "=", "true", ";", "Vector2i", "tmpPos", "=", "new", "Vector2i", "(", "i", ",", "j", ")", ";", "queue", ".", "addLast", "(", "tmpPos", ")", ";", "}", "}", "}", "}", "//i", "}", "//j", "}", "System", ".", "out", ".", "println", "(", "\"count = \"", "+", "count", ")", ";", "//save letter===========================================================", "if", "(", "count", "<", "3", ")", "{", "return", "letter", ";", "}", "/*try {\n saveToFile(letter, imageName);\n //\n } catch (IOException ex) {\n ex.printStackTrace();\n }*/", "return", "letter", ";", "}" ]
Breadth first search
[ "Breadth", "first", "search" ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/neuroph/LetterSegmentation.java#L60-L146
12,319
Harium/keel
src/main/java/com/harium/keel/catalano/core/FloatPoint.java
FloatPoint.Subtract
public FloatPoint Subtract(FloatPoint point1, FloatPoint point2) { FloatPoint result = new FloatPoint(point1); result.Subtract(point2); return result; }
java
public FloatPoint Subtract(FloatPoint point1, FloatPoint point2) { FloatPoint result = new FloatPoint(point1); result.Subtract(point2); return result; }
[ "public", "FloatPoint", "Subtract", "(", "FloatPoint", "point1", ",", "FloatPoint", "point2", ")", "{", "FloatPoint", "result", "=", "new", "FloatPoint", "(", "point1", ")", ";", "result", ".", "Subtract", "(", "point2", ")", ";", "return", "result", ";", "}" ]
Subtracts values of two points. @param point1 FloatPoint. @param point2 FloatPoint. @return A new FloatPoint with the subtract operation.
[ "Subtracts", "values", "of", "two", "points", "." ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/FloatPoint.java#L170-L174
12,320
Harium/keel
src/main/java/com/harium/keel/catalano/core/FloatPoint.java
FloatPoint.Divide
public FloatPoint Divide(FloatPoint point1, FloatPoint point2) { FloatPoint result = new FloatPoint(point1); result.Divide(point2); return result; }
java
public FloatPoint Divide(FloatPoint point1, FloatPoint point2) { FloatPoint result = new FloatPoint(point1); result.Divide(point2); return result; }
[ "public", "FloatPoint", "Divide", "(", "FloatPoint", "point1", ",", "FloatPoint", "point2", ")", "{", "FloatPoint", "result", "=", "new", "FloatPoint", "(", "point1", ")", ";", "result", ".", "Divide", "(", "point2", ")", ";", "return", "result", ";", "}" ]
Divide values of two points. @param point1 FloatPoint. @param point2 FloatPoint. @return A new FloatPoint with the division operation.
[ "Divide", "values", "of", "two", "points", "." ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/core/FloatPoint.java#L236-L240
12,321
Harium/keel
src/main/java/com/harium/keel/effect/LevelsCurve.java
LevelsCurve.setCurve
public void setCurve(Curve curveRed, Curve curveGreen, Curve curveBlue) { this.curveRed = curveRed; this.curveGreen = curveGreen; this.curveBlue = curveBlue; }
java
public void setCurve(Curve curveRed, Curve curveGreen, Curve curveBlue) { this.curveRed = curveRed; this.curveGreen = curveGreen; this.curveBlue = curveBlue; }
[ "public", "void", "setCurve", "(", "Curve", "curveRed", ",", "Curve", "curveGreen", ",", "Curve", "curveBlue", ")", "{", "this", ".", "curveRed", "=", "curveRed", ";", "this", ".", "curveGreen", "=", "curveGreen", ";", "this", ".", "curveBlue", "=", "curveBlue", ";", "}" ]
Set curves. @param curveRed Red curve. @param curveGreen Green curve. @param curveBlue Blue curve.
[ "Set", "curves", "." ]
0369ae674f9e664bccc5f9e161ae7e7a3b949a1e
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/effect/LevelsCurve.java#L104-L108
12,322
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/reframing/ReframingResponseObserver.java
ReframingResponseObserver.deliver
private void deliver() { try { deliverUnsafe(); } catch (Throwable t) { // This should never happen. If does, it means we are in an inconsistent state and should // close the stream and further processing should be prevented. This is accomplished by // purposefully leaving the lock non-zero and notifying the outerResponseObserver of the // error. Care must be taken to avoid calling close twice in case the first invocation threw // an error. innerController.cancel(); if (!finished) { outerResponseObserver.onError(t); } } }
java
private void deliver() { try { deliverUnsafe(); } catch (Throwable t) { // This should never happen. If does, it means we are in an inconsistent state and should // close the stream and further processing should be prevented. This is accomplished by // purposefully leaving the lock non-zero and notifying the outerResponseObserver of the // error. Care must be taken to avoid calling close twice in case the first invocation threw // an error. innerController.cancel(); if (!finished) { outerResponseObserver.onError(t); } } }
[ "private", "void", "deliver", "(", ")", "{", "try", "{", "deliverUnsafe", "(", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "// This should never happen. If does, it means we are in an inconsistent state and should", "// close the stream and further processing should be prevented. This is accomplished by", "// purposefully leaving the lock non-zero and notifying the outerResponseObserver of the", "// error. Care must be taken to avoid calling close twice in case the first invocation threw", "// an error.", "innerController", ".", "cancel", "(", ")", ";", "if", "(", "!", "finished", ")", "{", "outerResponseObserver", ".", "onError", "(", "t", ")", ";", "}", "}", "}" ]
Tries to kick off the delivery loop, wrapping it in error handling.
[ "Tries", "to", "kick", "off", "the", "delivery", "loop", "wrapping", "it", "in", "error", "handling", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/reframing/ReframingResponseObserver.java#L238-L252
12,323
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/reframing/ReframingResponseObserver.java
ReframingResponseObserver.maybeFinish
private boolean maybeFinish() { // Check for cancellations Throwable localError = this.cancellation.get(); if (localError != null) { finished = true; outerResponseObserver.onError(localError); return true; } // Check for upstream termination and exhaustion of local buffers if (done && !reframer.hasFullFrame() && !awaitingInner) { finished = true; if (error != null) { outerResponseObserver.onError(error); } else if (reframer.hasPartialFrame()) { outerResponseObserver.onError(new IncompleteStreamException()); } else { outerResponseObserver.onComplete(); } return true; } // No termination conditions found, go back to business as usual return false; }
java
private boolean maybeFinish() { // Check for cancellations Throwable localError = this.cancellation.get(); if (localError != null) { finished = true; outerResponseObserver.onError(localError); return true; } // Check for upstream termination and exhaustion of local buffers if (done && !reframer.hasFullFrame() && !awaitingInner) { finished = true; if (error != null) { outerResponseObserver.onError(error); } else if (reframer.hasPartialFrame()) { outerResponseObserver.onError(new IncompleteStreamException()); } else { outerResponseObserver.onComplete(); } return true; } // No termination conditions found, go back to business as usual return false; }
[ "private", "boolean", "maybeFinish", "(", ")", "{", "// Check for cancellations", "Throwable", "localError", "=", "this", ".", "cancellation", ".", "get", "(", ")", ";", "if", "(", "localError", "!=", "null", ")", "{", "finished", "=", "true", ";", "outerResponseObserver", ".", "onError", "(", "localError", ")", ";", "return", "true", ";", "}", "// Check for upstream termination and exhaustion of local buffers", "if", "(", "done", "&&", "!", "reframer", ".", "hasFullFrame", "(", ")", "&&", "!", "awaitingInner", ")", "{", "finished", "=", "true", ";", "if", "(", "error", "!=", "null", ")", "{", "outerResponseObserver", ".", "onError", "(", "error", ")", ";", "}", "else", "if", "(", "reframer", ".", "hasPartialFrame", "(", ")", ")", "{", "outerResponseObserver", ".", "onError", "(", "new", "IncompleteStreamException", "(", ")", ")", ";", "}", "else", "{", "outerResponseObserver", ".", "onComplete", "(", ")", ";", "}", "return", "true", ";", "}", "// No termination conditions found, go back to business as usual", "return", "false", ";", "}" ]
Completes the outer observer if appropriate. <p>Grounds for completion: <ul> <li>Caller cancelled the stream <li>Upstream has been exhausted and there is no hope of completing another frame. </ul> <p>Upon upstream exhaustion, the outer observer will be notified via onComplete only if all buffers have been consumed. Otherwise it will be notified with an IncompleteStreamException. @return true if the outer observer has been notified of completion.
[ "Completes", "the", "outer", "observer", "if", "appropriate", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/gaxx/reframing/ReframingResponseObserver.java#L352-L378
12,324
googleapis/google-cloud-java
google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/CompanyServiceClient.java
CompanyServiceClient.updateCompany
public final Company updateCompany(Company company) { UpdateCompanyRequest request = UpdateCompanyRequest.newBuilder().setCompany(company).build(); return updateCompany(request); }
java
public final Company updateCompany(Company company) { UpdateCompanyRequest request = UpdateCompanyRequest.newBuilder().setCompany(company).build(); return updateCompany(request); }
[ "public", "final", "Company", "updateCompany", "(", "Company", "company", ")", "{", "UpdateCompanyRequest", "request", "=", "UpdateCompanyRequest", ".", "newBuilder", "(", ")", ".", "setCompany", "(", "company", ")", ".", "build", "(", ")", ";", "return", "updateCompany", "(", "request", ")", ";", "}" ]
Updates specified company. <p>Sample code: <pre><code> try (CompanyServiceClient companyServiceClient = CompanyServiceClient.create()) { Company company = Company.newBuilder().build(); Company response = companyServiceClient.updateCompany(company); } </code></pre> @param company Required. <p>The company resource to replace the current resource in the system. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "specified", "company", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-talent/src/main/java/com/google/cloud/talent/v4beta1/CompanyServiceClient.java#L389-L393
12,325
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesClient.java
EntityTypesClient.createEntityType
public final EntityType createEntityType( String parent, EntityType entityType, String languageCode) { CreateEntityTypeRequest request = CreateEntityTypeRequest.newBuilder() .setParent(parent) .setEntityType(entityType) .setLanguageCode(languageCode) .build(); return createEntityType(request); }
java
public final EntityType createEntityType( String parent, EntityType entityType, String languageCode) { CreateEntityTypeRequest request = CreateEntityTypeRequest.newBuilder() .setParent(parent) .setEntityType(entityType) .setLanguageCode(languageCode) .build(); return createEntityType(request); }
[ "public", "final", "EntityType", "createEntityType", "(", "String", "parent", ",", "EntityType", "entityType", ",", "String", "languageCode", ")", "{", "CreateEntityTypeRequest", "request", "=", "CreateEntityTypeRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", ")", ".", "setEntityType", "(", "entityType", ")", ".", "setLanguageCode", "(", "languageCode", ")", ".", "build", "(", ")", ";", "return", "createEntityType", "(", "request", ")", ";", "}" ]
Creates an entity type in the specified agent. <p>Sample code: <pre><code> try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) { ProjectAgentName parent = ProjectAgentName.of("[PROJECT]"); EntityType entityType = EntityType.newBuilder().build(); String languageCode = ""; EntityType response = entityTypesClient.createEntityType(parent.toString(), entityType, languageCode); } </code></pre> @param parent Required. The agent to create a entity type for. Format: `projects/&lt;Project ID&gt;/agent`. @param entityType Required. The entity type to create. @param languageCode Optional. The language of entity synonyms defined in `entity_type`. If not specified, the agent's default language is used. [Many languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are supported. Note: languages must be enabled in the agent before they can be used. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "an", "entity", "type", "in", "the", "specified", "agent", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesClient.java#L663-L673
12,326
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesClient.java
EntityTypesClient.batchUpdateEntitiesAsync
@BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty, Struct> batchUpdateEntitiesAsync( BatchUpdateEntitiesRequest request) { return batchUpdateEntitiesOperationCallable().futureCall(request); }
java
@BetaApi( "The surface for long-running operations is not stable yet and may change in the future.") public final OperationFuture<Empty, Struct> batchUpdateEntitiesAsync( BatchUpdateEntitiesRequest request) { return batchUpdateEntitiesOperationCallable().futureCall(request); }
[ "@", "BetaApi", "(", "\"The surface for long-running operations is not stable yet and may change in the future.\"", ")", "public", "final", "OperationFuture", "<", "Empty", ",", "Struct", ">", "batchUpdateEntitiesAsync", "(", "BatchUpdateEntitiesRequest", "request", ")", "{", "return", "batchUpdateEntitiesOperationCallable", "(", ")", ".", "futureCall", "(", "request", ")", ";", "}" ]
Updates or creates multiple entities in the specified entity type. This method does not affect entities in the entity type that aren't explicitly specified in the request. <p>Operation &lt;response: [google.protobuf.Empty][google.protobuf.Empty]&gt; <p>Sample code: <pre><code> try (EntityTypesClient entityTypesClient = EntityTypesClient.create()) { EntityTypeName parent = EntityTypeName.of("[PROJECT]", "[ENTITY_TYPE]"); List&lt;EntityType.Entity&gt; entities = new ArrayList&lt;&gt;(); BatchUpdateEntitiesRequest request = BatchUpdateEntitiesRequest.newBuilder() .setParent(parent.toString()) .addAllEntities(entities) .build(); entityTypesClient.batchUpdateEntitiesAsync(request).get(); } </code></pre> @param request The request object containing all of the parameters for the API call. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "or", "creates", "multiple", "entities", "in", "the", "specified", "entity", "type", ".", "This", "method", "does", "not", "affect", "entities", "in", "the", "entity", "type", "that", "aren", "t", "explicitly", "specified", "in", "the", "request", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2/EntityTypesClient.java#L1555-L1560
12,327
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValueList.java
FieldValueList.get
public FieldValue get(String name) { if (schema == null) { throw new UnsupportedOperationException( "Retrieving field value by name is not supported when there is no fields schema provided"); } return get(schema.getIndex(name)); }
java
public FieldValue get(String name) { if (schema == null) { throw new UnsupportedOperationException( "Retrieving field value by name is not supported when there is no fields schema provided"); } return get(schema.getIndex(name)); }
[ "public", "FieldValue", "get", "(", "String", "name", ")", "{", "if", "(", "schema", "==", "null", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"Retrieving field value by name is not supported when there is no fields schema provided\"", ")", ";", "}", "return", "get", "(", "schema", ".", "getIndex", "(", "name", ")", ")", ";", "}" ]
Gets field value by index. @param name field name (defined in schema) @throws IllegalArgumentException if schema is not provided or if {@code name} was not found in the schema
[ "Gets", "field", "value", "by", "index", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldValueList.java#L67-L73
12,328
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskTypeId.java
DiskTypeId.of
public static DiskTypeId of(ZoneId zoneId, String type) { return new DiskTypeId(zoneId.getProject(), zoneId.getZone(), type); }
java
public static DiskTypeId of(ZoneId zoneId, String type) { return new DiskTypeId(zoneId.getProject(), zoneId.getZone(), type); }
[ "public", "static", "DiskTypeId", "of", "(", "ZoneId", "zoneId", ",", "String", "type", ")", "{", "return", "new", "DiskTypeId", "(", "zoneId", ".", "getProject", "(", ")", ",", "zoneId", ".", "getZone", "(", ")", ",", "type", ")", ";", "}" ]
Returns a disk type identity given the zone identity and the disk type name.
[ "Returns", "a", "disk", "type", "identity", "given", "the", "zone", "identity", "and", "the", "disk", "type", "name", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskTypeId.java#L111-L113
12,329
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskTypeId.java
DiskTypeId.of
public static DiskTypeId of(String zone, String type) { return of(ZoneId.of(null, zone), type); }
java
public static DiskTypeId of(String zone, String type) { return of(ZoneId.of(null, zone), type); }
[ "public", "static", "DiskTypeId", "of", "(", "String", "zone", ",", "String", "type", ")", "{", "return", "of", "(", "ZoneId", ".", "of", "(", "null", ",", "zone", ")", ",", "type", ")", ";", "}" ]
Returns a disk type identity given the zone and disk type names.
[ "Returns", "a", "disk", "type", "identity", "given", "the", "zone", "and", "disk", "type", "names", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskTypeId.java#L116-L118
12,330
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskTypeId.java
DiskTypeId.of
public static DiskTypeId of(String project, String zone, String type) { return of(ZoneId.of(project, zone), type); }
java
public static DiskTypeId of(String project, String zone, String type) { return of(ZoneId.of(project, zone), type); }
[ "public", "static", "DiskTypeId", "of", "(", "String", "project", ",", "String", "zone", ",", "String", "type", ")", "{", "return", "of", "(", "ZoneId", ".", "of", "(", "project", ",", "zone", ")", ",", "type", ")", ";", "}" ]
Returns a disk type identity given project disk, zone and disk type names.
[ "Returns", "a", "disk", "type", "identity", "given", "project", "disk", "zone", "and", "disk", "type", "names", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskTypeId.java#L121-L123
12,331
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/GCRules.java
GCRules.maxAge
public DurationRule maxAge(long maxAge, TimeUnit timeUnit) { return maxAge(Duration.ofNanos(TimeUnit.NANOSECONDS.convert(maxAge, timeUnit))); }
java
public DurationRule maxAge(long maxAge, TimeUnit timeUnit) { return maxAge(Duration.ofNanos(TimeUnit.NANOSECONDS.convert(maxAge, timeUnit))); }
[ "public", "DurationRule", "maxAge", "(", "long", "maxAge", ",", "TimeUnit", "timeUnit", ")", "{", "return", "maxAge", "(", "Duration", ".", "ofNanos", "(", "TimeUnit", ".", "NANOSECONDS", ".", "convert", "(", "maxAge", ",", "timeUnit", ")", ")", ")", ";", "}" ]
Creates a new instance of the DurationRule @param maxAge - maximum age of the cell to keep @param timeUnit - timeunit for the age
[ "Creates", "a", "new", "instance", "of", "the", "DurationRule" ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/models/GCRules.java#L66-L68
12,332
googleapis/google-cloud-java
google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerImpl.java
SpannerImpl.runWithRetries
static <T> T runWithRetries(Callable<T> callable) { // Use same backoff setting as abort, somewhat arbitrarily. Span span = tracer.getCurrentSpan(); ExponentialBackOff backOff = newBackOff(); Context context = Context.current(); int attempt = 0; while (true) { attempt++; try { span.addAnnotation( "Starting operation", ImmutableMap.of("Attempt", AttributeValue.longAttributeValue(attempt))); T result = callable.call(); return result; } catch (SpannerException e) { if (!e.isRetryable()) { throw e; } logger.log(Level.FINE, "Retryable exception, will sleep and retry", e); long delay = e.getRetryDelayInMillis(); if (delay != -1) { backoffSleep(context, delay); } else { backoffSleep(context, backOff); } } catch (Exception e) { Throwables.throwIfUnchecked(e); throw newSpannerException(ErrorCode.INTERNAL, "Unexpected exception thrown", e); } } }
java
static <T> T runWithRetries(Callable<T> callable) { // Use same backoff setting as abort, somewhat arbitrarily. Span span = tracer.getCurrentSpan(); ExponentialBackOff backOff = newBackOff(); Context context = Context.current(); int attempt = 0; while (true) { attempt++; try { span.addAnnotation( "Starting operation", ImmutableMap.of("Attempt", AttributeValue.longAttributeValue(attempt))); T result = callable.call(); return result; } catch (SpannerException e) { if (!e.isRetryable()) { throw e; } logger.log(Level.FINE, "Retryable exception, will sleep and retry", e); long delay = e.getRetryDelayInMillis(); if (delay != -1) { backoffSleep(context, delay); } else { backoffSleep(context, backOff); } } catch (Exception e) { Throwables.throwIfUnchecked(e); throw newSpannerException(ErrorCode.INTERNAL, "Unexpected exception thrown", e); } } }
[ "static", "<", "T", ">", "T", "runWithRetries", "(", "Callable", "<", "T", ">", "callable", ")", "{", "// Use same backoff setting as abort, somewhat arbitrarily.", "Span", "span", "=", "tracer", ".", "getCurrentSpan", "(", ")", ";", "ExponentialBackOff", "backOff", "=", "newBackOff", "(", ")", ";", "Context", "context", "=", "Context", ".", "current", "(", ")", ";", "int", "attempt", "=", "0", ";", "while", "(", "true", ")", "{", "attempt", "++", ";", "try", "{", "span", ".", "addAnnotation", "(", "\"Starting operation\"", ",", "ImmutableMap", ".", "of", "(", "\"Attempt\"", ",", "AttributeValue", ".", "longAttributeValue", "(", "attempt", ")", ")", ")", ";", "T", "result", "=", "callable", ".", "call", "(", ")", ";", "return", "result", ";", "}", "catch", "(", "SpannerException", "e", ")", "{", "if", "(", "!", "e", ".", "isRetryable", "(", ")", ")", "{", "throw", "e", ";", "}", "logger", ".", "log", "(", "Level", ".", "FINE", ",", "\"Retryable exception, will sleep and retry\"", ",", "e", ")", ";", "long", "delay", "=", "e", ".", "getRetryDelayInMillis", "(", ")", ";", "if", "(", "delay", "!=", "-", "1", ")", "{", "backoffSleep", "(", "context", ",", "delay", ")", ";", "}", "else", "{", "backoffSleep", "(", "context", ",", "backOff", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "Throwables", ".", "throwIfUnchecked", "(", "e", ")", ";", "throw", "newSpannerException", "(", "ErrorCode", ".", "INTERNAL", ",", "\"Unexpected exception thrown\"", ",", "e", ")", ";", "}", "}", "}" ]
Helper to execute some work, retrying with backoff on retryable errors. <p>TODO: Consider replacing with RetryHelper from gcloud-core.
[ "Helper", "to", "execute", "some", "work", "retrying", "with", "backoff", "on", "retryable", "errors", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerImpl.java#L164-L194
12,333
googleapis/google-cloud-java
google-cloud-clients/google-cloud-core-http/src/main/java/com/google/cloud/http/HttpTransportOptions.java
HttpTransportOptions.getHttpRequestInitializer
public HttpRequestInitializer getHttpRequestInitializer( final ServiceOptions<?, ?> serviceOptions) { Credentials scopedCredentials = serviceOptions.getScopedCredentials(); final HttpRequestInitializer delegate = scopedCredentials != null && scopedCredentials != NoCredentials.getInstance() ? new HttpCredentialsAdapter(scopedCredentials) : null; HeaderProvider internalHeaderProvider = getInternalHeaderProviderBuilder(serviceOptions).build(); final HeaderProvider headerProvider = serviceOptions.getMergedHeaderProvider(internalHeaderProvider); return new HttpRequestInitializer() { @Override public void initialize(HttpRequest httpRequest) throws IOException { if (delegate != null) { delegate.initialize(httpRequest); } if (connectTimeout >= 0) { httpRequest.setConnectTimeout(connectTimeout); } if (readTimeout >= 0) { httpRequest.setReadTimeout(readTimeout); } HttpHeadersUtils.setHeaders(httpRequest.getHeaders(), headerProvider.getHeaders()); } }; }
java
public HttpRequestInitializer getHttpRequestInitializer( final ServiceOptions<?, ?> serviceOptions) { Credentials scopedCredentials = serviceOptions.getScopedCredentials(); final HttpRequestInitializer delegate = scopedCredentials != null && scopedCredentials != NoCredentials.getInstance() ? new HttpCredentialsAdapter(scopedCredentials) : null; HeaderProvider internalHeaderProvider = getInternalHeaderProviderBuilder(serviceOptions).build(); final HeaderProvider headerProvider = serviceOptions.getMergedHeaderProvider(internalHeaderProvider); return new HttpRequestInitializer() { @Override public void initialize(HttpRequest httpRequest) throws IOException { if (delegate != null) { delegate.initialize(httpRequest); } if (connectTimeout >= 0) { httpRequest.setConnectTimeout(connectTimeout); } if (readTimeout >= 0) { httpRequest.setReadTimeout(readTimeout); } HttpHeadersUtils.setHeaders(httpRequest.getHeaders(), headerProvider.getHeaders()); } }; }
[ "public", "HttpRequestInitializer", "getHttpRequestInitializer", "(", "final", "ServiceOptions", "<", "?", ",", "?", ">", "serviceOptions", ")", "{", "Credentials", "scopedCredentials", "=", "serviceOptions", ".", "getScopedCredentials", "(", ")", ";", "final", "HttpRequestInitializer", "delegate", "=", "scopedCredentials", "!=", "null", "&&", "scopedCredentials", "!=", "NoCredentials", ".", "getInstance", "(", ")", "?", "new", "HttpCredentialsAdapter", "(", "scopedCredentials", ")", ":", "null", ";", "HeaderProvider", "internalHeaderProvider", "=", "getInternalHeaderProviderBuilder", "(", "serviceOptions", ")", ".", "build", "(", ")", ";", "final", "HeaderProvider", "headerProvider", "=", "serviceOptions", ".", "getMergedHeaderProvider", "(", "internalHeaderProvider", ")", ";", "return", "new", "HttpRequestInitializer", "(", ")", "{", "@", "Override", "public", "void", "initialize", "(", "HttpRequest", "httpRequest", ")", "throws", "IOException", "{", "if", "(", "delegate", "!=", "null", ")", "{", "delegate", ".", "initialize", "(", "httpRequest", ")", ";", "}", "if", "(", "connectTimeout", ">=", "0", ")", "{", "httpRequest", ".", "setConnectTimeout", "(", "connectTimeout", ")", ";", "}", "if", "(", "readTimeout", ">=", "0", ")", "{", "httpRequest", ".", "setReadTimeout", "(", "readTimeout", ")", ";", "}", "HttpHeadersUtils", ".", "setHeaders", "(", "httpRequest", ".", "getHeaders", "(", ")", ",", "headerProvider", ".", "getHeaders", "(", ")", ")", ";", "}", "}", ";", "}" ]
Returns a request initializer responsible for initializing requests according to service options.
[ "Returns", "a", "request", "initializer", "responsible", "for", "initializing", "requests", "according", "to", "service", "options", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-core-http/src/main/java/com/google/cloud/http/HttpTransportOptions.java#L143-L171
12,334
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Query.java
Query.shard
public List<Query> shard(SortedSet<ByteString> splitPoints) { Preconditions.checkState(builder.getRowsLimit() == 0, "Can't shard a query with a row limit"); List<RowSet> shardedRowSets = RowSetUtil.shard(builder.getRows(), splitPoints); List<Query> shards = Lists.newArrayListWithCapacity(shardedRowSets.size()); for (RowSet rowSet : shardedRowSets) { Query queryShard = new Query(tableId); queryShard.builder.mergeFrom(this.builder.build()); queryShard.builder.setRows(rowSet); shards.add(queryShard); } return shards; }
java
public List<Query> shard(SortedSet<ByteString> splitPoints) { Preconditions.checkState(builder.getRowsLimit() == 0, "Can't shard a query with a row limit"); List<RowSet> shardedRowSets = RowSetUtil.shard(builder.getRows(), splitPoints); List<Query> shards = Lists.newArrayListWithCapacity(shardedRowSets.size()); for (RowSet rowSet : shardedRowSets) { Query queryShard = new Query(tableId); queryShard.builder.mergeFrom(this.builder.build()); queryShard.builder.setRows(rowSet); shards.add(queryShard); } return shards; }
[ "public", "List", "<", "Query", ">", "shard", "(", "SortedSet", "<", "ByteString", ">", "splitPoints", ")", "{", "Preconditions", ".", "checkState", "(", "builder", ".", "getRowsLimit", "(", ")", "==", "0", ",", "\"Can't shard a query with a row limit\"", ")", ";", "List", "<", "RowSet", ">", "shardedRowSets", "=", "RowSetUtil", ".", "shard", "(", "builder", ".", "getRows", "(", ")", ",", "splitPoints", ")", ";", "List", "<", "Query", ">", "shards", "=", "Lists", ".", "newArrayListWithCapacity", "(", "shardedRowSets", ".", "size", "(", ")", ")", ";", "for", "(", "RowSet", "rowSet", ":", "shardedRowSets", ")", "{", "Query", "queryShard", "=", "new", "Query", "(", "tableId", ")", ";", "queryShard", ".", "builder", ".", "mergeFrom", "(", "this", ".", "builder", ".", "build", "(", ")", ")", ";", "queryShard", ".", "builder", ".", "setRows", "(", "rowSet", ")", ";", "shards", ".", "add", "(", "queryShard", ")", ";", "}", "return", "shards", ";", "}" ]
Split this query into multiple queries that logically combine into this query. This is intended to be used by map reduce style frameworks like Beam to split a query across multiple workers. <p>Expected Usage: <pre>{@code List<ByteString> splitPoints = ...; List<Query> queryShards = myQuery.shard(splitPoints); List<ApiFuture<List<Row>>> futures = new ArrayList(); for (Query subQuery : queryShards) { futures.add(dataClient.readRowsCallable().all().futureCall(subQuery)); } List<List<Row>> results = ApiFutures.allAsList(futures).get(); }</pre>
[ "Split", "this", "query", "into", "multiple", "queries", "that", "logically", "combine", "into", "this", "query", ".", "This", "is", "intended", "to", "be", "used", "by", "map", "reduce", "style", "frameworks", "like", "Beam", "to", "split", "a", "query", "across", "multiple", "workers", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/models/Query.java#L225-L239
12,335
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/MachineTypeId.java
MachineTypeId.of
public static MachineTypeId of(String zone, String type) { return new MachineTypeId(null, zone, type); }
java
public static MachineTypeId of(String zone, String type) { return new MachineTypeId(null, zone, type); }
[ "public", "static", "MachineTypeId", "of", "(", "String", "zone", ",", "String", "type", ")", "{", "return", "new", "MachineTypeId", "(", "null", ",", "zone", ",", "type", ")", ";", "}" ]
Returns a machine type identity given the zone and type names.
[ "Returns", "a", "machine", "type", "identity", "given", "the", "zone", "and", "type", "names", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/MachineTypeId.java#L111-L113
12,336
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/MachineTypeId.java
MachineTypeId.of
public static MachineTypeId of(String project, String zone, String type) { return new MachineTypeId(project, zone, type); }
java
public static MachineTypeId of(String project, String zone, String type) { return new MachineTypeId(project, zone, type); }
[ "public", "static", "MachineTypeId", "of", "(", "String", "project", ",", "String", "zone", ",", "String", "type", ")", "{", "return", "new", "MachineTypeId", "(", "project", ",", "zone", ",", "type", ")", ";", "}" ]
Returns a machine type identity given project, zone and type names.
[ "Returns", "a", "machine", "type", "identity", "given", "project", "zone", "and", "type", "names", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/MachineTypeId.java#L116-L118
12,337
googleapis/google-cloud-java
google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java
BlobInfo.getMd5ToHexString
public String getMd5ToHexString() { if (md5 == null) { return null; } byte[] decodedMd5 = BaseEncoding.base64().decode(md5); StringBuilder stringBuilder = new StringBuilder(); for (byte b : decodedMd5) { stringBuilder.append(String.format("%02x", b & 0xff)); } return stringBuilder.toString(); }
java
public String getMd5ToHexString() { if (md5 == null) { return null; } byte[] decodedMd5 = BaseEncoding.base64().decode(md5); StringBuilder stringBuilder = new StringBuilder(); for (byte b : decodedMd5) { stringBuilder.append(String.format("%02x", b & 0xff)); } return stringBuilder.toString(); }
[ "public", "String", "getMd5ToHexString", "(", ")", "{", "if", "(", "md5", "==", "null", ")", "{", "return", "null", ";", "}", "byte", "[", "]", "decodedMd5", "=", "BaseEncoding", ".", "base64", "(", ")", ".", "decode", "(", "md5", ")", ";", "StringBuilder", "stringBuilder", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "byte", "b", ":", "decodedMd5", ")", "{", "stringBuilder", ".", "append", "(", "String", ".", "format", "(", "\"%02x\"", ",", "b", "&", "0xff", ")", ")", ";", "}", "return", "stringBuilder", ".", "toString", "(", ")", ";", "}" ]
Returns the MD5 hash of blob's data decoded to string. @see <a href="https://cloud.google.com/storage/docs/hashes-etags#_JSONAPI">Hashes and ETags: Best Practices</a>
[ "Returns", "the", "MD5", "hash", "of", "blob", "s", "data", "decoded", "to", "string", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java#L730-L740
12,338
googleapis/google-cloud-java
google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java
BlobInfo.getMetadata
public Map<String, String> getMetadata() { return metadata == null || Data.isNull(metadata) ? null : Collections.unmodifiableMap(metadata); }
java
public Map<String, String> getMetadata() { return metadata == null || Data.isNull(metadata) ? null : Collections.unmodifiableMap(metadata); }
[ "public", "Map", "<", "String", ",", "String", ">", "getMetadata", "(", ")", "{", "return", "metadata", "==", "null", "||", "Data", ".", "isNull", "(", "metadata", ")", "?", "null", ":", "Collections", ".", "unmodifiableMap", "(", "metadata", ")", ";", "}" ]
Returns blob's user provided metadata.
[ "Returns", "blob", "s", "user", "provided", "metadata", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-storage/src/main/java/com/google/cloud/storage/BlobInfo.java#L780-L782
12,339
googleapis/google-cloud-java
google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClient.java
NotificationChannelServiceClient.updateNotificationChannel
public final NotificationChannel updateNotificationChannel( FieldMask updateMask, NotificationChannel notificationChannel) { UpdateNotificationChannelRequest request = UpdateNotificationChannelRequest.newBuilder() .setUpdateMask(updateMask) .setNotificationChannel(notificationChannel) .build(); return updateNotificationChannel(request); }
java
public final NotificationChannel updateNotificationChannel( FieldMask updateMask, NotificationChannel notificationChannel) { UpdateNotificationChannelRequest request = UpdateNotificationChannelRequest.newBuilder() .setUpdateMask(updateMask) .setNotificationChannel(notificationChannel) .build(); return updateNotificationChannel(request); }
[ "public", "final", "NotificationChannel", "updateNotificationChannel", "(", "FieldMask", "updateMask", ",", "NotificationChannel", "notificationChannel", ")", "{", "UpdateNotificationChannelRequest", "request", "=", "UpdateNotificationChannelRequest", ".", "newBuilder", "(", ")", ".", "setUpdateMask", "(", "updateMask", ")", ".", "setNotificationChannel", "(", "notificationChannel", ")", ".", "build", "(", ")", ";", "return", "updateNotificationChannel", "(", "request", ")", ";", "}" ]
Updates a notification channel. Fields not specified in the field mask remain unchanged. <p>Sample code: <pre><code> try (NotificationChannelServiceClient notificationChannelServiceClient = NotificationChannelServiceClient.create()) { FieldMask updateMask = FieldMask.newBuilder().build(); NotificationChannel notificationChannel = NotificationChannel.newBuilder().build(); NotificationChannel response = notificationChannelServiceClient.updateNotificationChannel(updateMask, notificationChannel); } </code></pre> @param updateMask The fields to update. @param notificationChannel A description of the changes to be applied to the specified notification channel. The description must provide a definition for fields to be updated; the names of these fields should also be included in the `update_mask`. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "a", "notification", "channel", ".", "Fields", "not", "specified", "in", "the", "field", "mask", "remain", "unchanged", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-monitoring/src/main/java/com/google/cloud/monitoring/v3/NotificationChannelServiceClient.java#L824-L833
12,340
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java
JobControllerClient.submitJob
public final Job submitJob(String projectId, String region, Job job) { SubmitJobRequest request = SubmitJobRequest.newBuilder().setProjectId(projectId).setRegion(region).setJob(job).build(); return submitJob(request); }
java
public final Job submitJob(String projectId, String region, Job job) { SubmitJobRequest request = SubmitJobRequest.newBuilder().setProjectId(projectId).setRegion(region).setJob(job).build(); return submitJob(request); }
[ "public", "final", "Job", "submitJob", "(", "String", "projectId", ",", "String", "region", ",", "Job", "job", ")", "{", "SubmitJobRequest", "request", "=", "SubmitJobRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "projectId", ")", ".", "setRegion", "(", "region", ")", ".", "setJob", "(", "job", ")", ".", "build", "(", ")", ";", "return", "submitJob", "(", "request", ")", ";", "}" ]
Submits a job to a cluster. <p>Sample code: <pre><code> try (JobControllerClient jobControllerClient = JobControllerClient.create()) { String projectId = ""; String region = ""; Job job = Job.newBuilder().build(); Job response = jobControllerClient.submitJob(projectId, region, job); } </code></pre> @param projectId Required. The ID of the Google Cloud Platform project that the job belongs to. @param region Required. The Cloud Dataproc region in which to handle the request. @param job Required. The job resource. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Submits", "a", "job", "to", "a", "cluster", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java#L179-L184
12,341
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java
JobControllerClient.getJob
public final Job getJob(String projectId, String region, String jobId) { GetJobRequest request = GetJobRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setJobId(jobId) .build(); return getJob(request); }
java
public final Job getJob(String projectId, String region, String jobId) { GetJobRequest request = GetJobRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setJobId(jobId) .build(); return getJob(request); }
[ "public", "final", "Job", "getJob", "(", "String", "projectId", ",", "String", "region", ",", "String", "jobId", ")", "{", "GetJobRequest", "request", "=", "GetJobRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "projectId", ")", ".", "setRegion", "(", "region", ")", ".", "setJobId", "(", "jobId", ")", ".", "build", "(", ")", ";", "return", "getJob", "(", "request", ")", ";", "}" ]
Gets the resource representation for a job in a project. <p>Sample code: <pre><code> try (JobControllerClient jobControllerClient = JobControllerClient.create()) { String projectId = ""; String region = ""; String jobId = ""; Job response = jobControllerClient.getJob(projectId, region, jobId); } </code></pre> @param projectId Required. The ID of the Google Cloud Platform project that the job belongs to. @param region Required. The Cloud Dataproc region in which to handle the request. @param jobId Required. The job ID. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Gets", "the", "resource", "representation", "for", "a", "job", "in", "a", "project", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java#L259-L268
12,342
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java
JobControllerClient.deleteJob
public final void deleteJob(String projectId, String region, String jobId) { DeleteJobRequest request = DeleteJobRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setJobId(jobId) .build(); deleteJob(request); }
java
public final void deleteJob(String projectId, String region, String jobId) { DeleteJobRequest request = DeleteJobRequest.newBuilder() .setProjectId(projectId) .setRegion(region) .setJobId(jobId) .build(); deleteJob(request); }
[ "public", "final", "void", "deleteJob", "(", "String", "projectId", ",", "String", "region", ",", "String", "jobId", ")", "{", "DeleteJobRequest", "request", "=", "DeleteJobRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "projectId", ")", ".", "setRegion", "(", "region", ")", ".", "setJobId", "(", "jobId", ")", ".", "build", "(", ")", ";", "deleteJob", "(", "request", ")", ";", "}" ]
Deletes the job from the project. If the job is active, the delete fails, and the response returns `FAILED_PRECONDITION`. <p>Sample code: <pre><code> try (JobControllerClient jobControllerClient = JobControllerClient.create()) { String projectId = ""; String region = ""; String jobId = ""; jobControllerClient.deleteJob(projectId, region, jobId); } </code></pre> @param projectId Required. The ID of the Google Cloud Platform project that the job belongs to. @param region Required. The Cloud Dataproc region in which to handle the request. @param jobId Required. The job ID. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Deletes", "the", "job", "from", "the", "project", ".", "If", "the", "job", "is", "active", "the", "delete", "fails", "and", "the", "response", "returns", "FAILED_PRECONDITION", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dataproc/src/main/java/com/google/cloud/dataproc/v1/JobControllerClient.java#L647-L656
12,343
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldList.java
FieldList.getIndex
public int getIndex(String name) { Integer index = nameIndex.get(name); if (index == null) { throw new IllegalArgumentException("Field with name '" + name + "' was not found"); } return index; }
java
public int getIndex(String name) { Integer index = nameIndex.get(name); if (index == null) { throw new IllegalArgumentException("Field with name '" + name + "' was not found"); } return index; }
[ "public", "int", "getIndex", "(", "String", "name", ")", "{", "Integer", "index", "=", "nameIndex", ".", "get", "(", "name", ")", ";", "if", "(", "index", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Field with name '\"", "+", "name", "+", "\"' was not found\"", ")", ";", "}", "return", "index", ";", "}" ]
Get schema field's index by name. @param name field (column) name
[ "Get", "schema", "field", "s", "index", "by", "name", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/FieldList.java#L75-L81
12,344
googleapis/google-cloud-java
google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TimestampBound.java
TimestampBound.ofReadTimestamp
public static TimestampBound ofReadTimestamp(Timestamp timestamp) { return new TimestampBound(Mode.READ_TIMESTAMP, checkNotNull(timestamp), null); }
java
public static TimestampBound ofReadTimestamp(Timestamp timestamp) { return new TimestampBound(Mode.READ_TIMESTAMP, checkNotNull(timestamp), null); }
[ "public", "static", "TimestampBound", "ofReadTimestamp", "(", "Timestamp", "timestamp", ")", "{", "return", "new", "TimestampBound", "(", "Mode", ".", "READ_TIMESTAMP", ",", "checkNotNull", "(", "timestamp", ")", ",", "null", ")", ";", "}" ]
Returns a timestamp bound that will perform reads and queries at the given timestamp. Unlike other modes, reads at a specific timestamp are repeatable; the same read at the same timestamp always returns the same data. If the timestamp is in the future, the read will block until the specified timestamp, modulo the read's deadline. <p>This mode is useful for large scale consistent reads such as mapreduces, or for coordinating many reads against a consistent snapshot of the data.
[ "Returns", "a", "timestamp", "bound", "that", "will", "perform", "reads", "and", "queries", "at", "the", "given", "timestamp", ".", "Unlike", "other", "modes", "reads", "at", "a", "specific", "timestamp", "are", "repeatable", ";", "the", "same", "read", "at", "the", "same", "timestamp", "always", "returns", "the", "same", "data", ".", "If", "the", "timestamp", "is", "in", "the", "future", "the", "read", "will", "block", "until", "the", "specified", "timestamp", "modulo", "the", "read", "s", "deadline", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TimestampBound.java#L152-L154
12,345
googleapis/google-cloud-java
google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TimestampBound.java
TimestampBound.ofExactStaleness
public static TimestampBound ofExactStaleness(long num, TimeUnit units) { checkStaleness(num); return new TimestampBound(Mode.EXACT_STALENESS, null, createDuration(num, units)); }
java
public static TimestampBound ofExactStaleness(long num, TimeUnit units) { checkStaleness(num); return new TimestampBound(Mode.EXACT_STALENESS, null, createDuration(num, units)); }
[ "public", "static", "TimestampBound", "ofExactStaleness", "(", "long", "num", ",", "TimeUnit", "units", ")", "{", "checkStaleness", "(", "num", ")", ";", "return", "new", "TimestampBound", "(", "Mode", ".", "EXACT_STALENESS", ",", "null", ",", "createDuration", "(", "num", ",", "units", ")", ")", ";", "}" ]
Returns a timestamp bound that will perform reads and queries at an exact staleness. The timestamp is chosen soon after the read is started. <p>Guarantees that all writes that have committed more than the specified number of seconds ago are visible. Because Cloud Spanner chooses the exact timestamp, this mode works even if the client's local clock is substantially skewed from Cloud Spanner commit timestamps. <p>Useful for reading at nearby replicas without the distributed timestamp negotiation overhead of {@link #ofMaxStaleness(long, TimeUnit)}.
[ "Returns", "a", "timestamp", "bound", "that", "will", "perform", "reads", "and", "queries", "at", "an", "exact", "staleness", ".", "The", "timestamp", "is", "chosen", "soon", "after", "the", "read", "is", "started", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/TimestampBound.java#L180-L183
12,346
googleapis/google-cloud-java
google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/Date.java
Date.toJavaUtilDate
public static java.util.Date toJavaUtilDate(Date date) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); // Calender.MONTH starts from 0 while G C date starts from 1 cal.set(date.year, date.month - 1, date.dayOfMonth); return cal.getTime(); }
java
public static java.util.Date toJavaUtilDate(Date date) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); // Calender.MONTH starts from 0 while G C date starts from 1 cal.set(date.year, date.month - 1, date.dayOfMonth); return cal.getTime(); }
[ "public", "static", "java", ".", "util", ".", "Date", "toJavaUtilDate", "(", "Date", "date", ")", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "SECOND", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "0", ")", ";", "// Calender.MONTH starts from 0 while G C date starts from 1", "cal", ".", "set", "(", "date", ".", "year", ",", "date", ".", "month", "-", "1", ",", "date", ".", "dayOfMonth", ")", ";", "return", "cal", ".", "getTime", "(", ")", ";", "}" ]
Convert a Google Date to a Java Util Date. @param date the date of the Google Date. @return java.util.Date
[ "Convert", "a", "Google", "Date", "to", "a", "Java", "Util", "Date", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/Date.java#L78-L87
12,347
googleapis/google-cloud-java
google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/Date.java
Date.fromJavaUtilDate
public static Date fromJavaUtilDate(java.util.Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); // Calender.MONTH starts from 0 while G C date starts from 1 return new Date( cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH)); }
java
public static Date fromJavaUtilDate(java.util.Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); // Calender.MONTH starts from 0 while G C date starts from 1 return new Date( cal.get(Calendar.YEAR), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH)); }
[ "public", "static", "Date", "fromJavaUtilDate", "(", "java", ".", "util", ".", "Date", "date", ")", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "date", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "SECOND", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "0", ")", ";", "// Calender.MONTH starts from 0 while G C date starts from 1", "return", "new", "Date", "(", "cal", ".", "get", "(", "Calendar", ".", "YEAR", ")", ",", "cal", ".", "get", "(", "Calendar", ".", "MONTH", ")", "+", "1", ",", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ")", ";", "}" ]
Convert a Java Util Date to a Google Date. @param date the date of the java.util.Date @return Google Java Date
[ "Convert", "a", "Java", "Util", "Date", "to", "a", "Google", "Date", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/Date.java#L95-L105
12,348
googleapis/google-cloud-java
google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java
GrafeasV1Beta1Client.createNote
public final Note createNote(ProjectName parent, String noteId, Note note) { CreateNoteRequest request = CreateNoteRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setNoteId(noteId) .setNote(note) .build(); return createNote(request); }
java
public final Note createNote(ProjectName parent, String noteId, Note note) { CreateNoteRequest request = CreateNoteRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setNoteId(noteId) .setNote(note) .build(); return createNote(request); }
[ "public", "final", "Note", "createNote", "(", "ProjectName", "parent", ",", "String", "noteId", ",", "Note", "note", ")", "{", "CreateNoteRequest", "request", "=", "CreateNoteRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", "==", "null", "?", "null", ":", "parent", ".", "toString", "(", ")", ")", ".", "setNoteId", "(", "noteId", ")", ".", "setNote", "(", "note", ")", ".", "build", "(", ")", ";", "return", "createNote", "(", "request", ")", ";", "}" ]
Creates a new note. <p>Sample code: <pre><code> try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); String noteId = ""; Note note = Note.newBuilder().build(); Note response = grafeasV1Beta1Client.createNote(parent, noteId, note); } </code></pre> @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the note is to be created. @param noteId The ID to use for this note. @param note The note to create. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "new", "note", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java#L1287-L1296
12,349
googleapis/google-cloud-java
google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java
GrafeasV1Beta1Client.batchCreateNotes
public final BatchCreateNotesResponse batchCreateNotes( ProjectName parent, Map<String, Note> notes) { BatchCreateNotesRequest request = BatchCreateNotesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .putAllNotes(notes) .build(); return batchCreateNotes(request); }
java
public final BatchCreateNotesResponse batchCreateNotes( ProjectName parent, Map<String, Note> notes) { BatchCreateNotesRequest request = BatchCreateNotesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .putAllNotes(notes) .build(); return batchCreateNotes(request); }
[ "public", "final", "BatchCreateNotesResponse", "batchCreateNotes", "(", "ProjectName", "parent", ",", "Map", "<", "String", ",", "Note", ">", "notes", ")", "{", "BatchCreateNotesRequest", "request", "=", "BatchCreateNotesRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", "==", "null", "?", "null", ":", "parent", ".", "toString", "(", ")", ")", ".", "putAllNotes", "(", "notes", ")", ".", "build", "(", ")", ";", "return", "batchCreateNotes", "(", "request", ")", ";", "}" ]
Creates new notes in batch. <p>Sample code: <pre><code> try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { ProjectName parent = ProjectName.of("[PROJECT]"); Map&lt;String, Note&gt; notes = new HashMap&lt;&gt;(); BatchCreateNotesResponse response = grafeasV1Beta1Client.batchCreateNotes(parent, notes); } </code></pre> @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the notes are to be created. @param notes The notes to create. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "new", "notes", "in", "batch", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/GrafeasV1Beta1Client.java#L1398-L1407
12,350
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/ResourcePath.java
ResourcePath.create
static ResourcePath create(DatabaseRootName databaseName, ImmutableList<String> segments) { return new AutoValue_ResourcePath(segments, databaseName); }
java
static ResourcePath create(DatabaseRootName databaseName, ImmutableList<String> segments) { return new AutoValue_ResourcePath(segments, databaseName); }
[ "static", "ResourcePath", "create", "(", "DatabaseRootName", "databaseName", ",", "ImmutableList", "<", "String", ">", "segments", ")", "{", "return", "new", "AutoValue_ResourcePath", "(", "segments", ",", "databaseName", ")", ";", "}" ]
Creates a new Path. @param databaseName The Firestore database name. @param segments The segments of the path relative to the root collections.
[ "Creates", "a", "new", "Path", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/ResourcePath.java#L37-L39
12,351
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/ResourcePath.java
ResourcePath.create
static ResourcePath create(String resourceName) { String[] parts = resourceName.split("/"); if (parts.length >= 6 && parts[0].equals("projects") && parts[2].equals("databases")) { String[] path = Arrays.copyOfRange(parts, 5, parts.length); return create( DatabaseRootName.of(parts[1], parts[3]), ImmutableList.<String>builder().add(path).build()); } return create(DatabaseRootName.parse(resourceName)); }
java
static ResourcePath create(String resourceName) { String[] parts = resourceName.split("/"); if (parts.length >= 6 && parts[0].equals("projects") && parts[2].equals("databases")) { String[] path = Arrays.copyOfRange(parts, 5, parts.length); return create( DatabaseRootName.of(parts[1], parts[3]), ImmutableList.<String>builder().add(path).build()); } return create(DatabaseRootName.parse(resourceName)); }
[ "static", "ResourcePath", "create", "(", "String", "resourceName", ")", "{", "String", "[", "]", "parts", "=", "resourceName", ".", "split", "(", "\"/\"", ")", ";", "if", "(", "parts", ".", "length", ">=", "6", "&&", "parts", "[", "0", "]", ".", "equals", "(", "\"projects\"", ")", "&&", "parts", "[", "2", "]", ".", "equals", "(", "\"databases\"", ")", ")", "{", "String", "[", "]", "path", "=", "Arrays", ".", "copyOfRange", "(", "parts", ",", "5", ",", "parts", ".", "length", ")", ";", "return", "create", "(", "DatabaseRootName", ".", "of", "(", "parts", "[", "1", "]", ",", "parts", "[", "3", "]", ")", ",", "ImmutableList", ".", "<", "String", ">", "builder", "(", ")", ".", "add", "(", "path", ")", ".", "build", "(", ")", ")", ";", "}", "return", "create", "(", "DatabaseRootName", ".", "parse", "(", "resourceName", ")", ")", ";", "}" ]
Create a new Path from its string representation. @param resourceName The Firestore resource name of this path.
[ "Create", "a", "new", "Path", "from", "its", "string", "representation", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/ResourcePath.java#L55-L66
12,352
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/ResourcePath.java
ResourcePath.getName
String getName() { String path = getPath(); if (path.isEmpty()) { return getDatabaseName() + "/documents"; } else { return getDatabaseName() + "/documents/" + getPath(); } }
java
String getName() { String path = getPath(); if (path.isEmpty()) { return getDatabaseName() + "/documents"; } else { return getDatabaseName() + "/documents/" + getPath(); } }
[ "String", "getName", "(", ")", "{", "String", "path", "=", "getPath", "(", ")", ";", "if", "(", "path", ".", "isEmpty", "(", ")", ")", "{", "return", "getDatabaseName", "(", ")", "+", "\"/documents\"", ";", "}", "else", "{", "return", "getDatabaseName", "(", ")", "+", "\"/documents/\"", "+", "getPath", "(", ")", ";", "}", "}" ]
String representation as expected by the Firestore API. @return The formatted name of the resource.
[ "String", "representation", "as", "expected", "by", "the", "Firestore", "API", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/ResourcePath.java#L128-L135
12,353
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dns/src/main/java/com/google/cloud/dns/DnsBatch.java
DnsBatch.createZoneCallback
private RpcBatch.Callback<ManagedZone> createZoneCallback( final DnsOptions serviceOptions, final DnsBatchResult<Zone> result, final boolean nullForNotFound, final boolean idempotent) { return new RpcBatch.Callback<ManagedZone>() { @Override public void onSuccess(ManagedZone response) { result.success( response == null ? null : Zone.fromPb(serviceOptions.getService(), response)); } @Override public void onFailure(GoogleJsonError googleJsonError) { DnsException serviceException = new DnsException(googleJsonError, idempotent); if (nullForNotFound && serviceException.getCode() == HTTP_NOT_FOUND) { result.success(null); } else { result.error(serviceException); } } }; }
java
private RpcBatch.Callback<ManagedZone> createZoneCallback( final DnsOptions serviceOptions, final DnsBatchResult<Zone> result, final boolean nullForNotFound, final boolean idempotent) { return new RpcBatch.Callback<ManagedZone>() { @Override public void onSuccess(ManagedZone response) { result.success( response == null ? null : Zone.fromPb(serviceOptions.getService(), response)); } @Override public void onFailure(GoogleJsonError googleJsonError) { DnsException serviceException = new DnsException(googleJsonError, idempotent); if (nullForNotFound && serviceException.getCode() == HTTP_NOT_FOUND) { result.success(null); } else { result.error(serviceException); } } }; }
[ "private", "RpcBatch", ".", "Callback", "<", "ManagedZone", ">", "createZoneCallback", "(", "final", "DnsOptions", "serviceOptions", ",", "final", "DnsBatchResult", "<", "Zone", ">", "result", ",", "final", "boolean", "nullForNotFound", ",", "final", "boolean", "idempotent", ")", "{", "return", "new", "RpcBatch", ".", "Callback", "<", "ManagedZone", ">", "(", ")", "{", "@", "Override", "public", "void", "onSuccess", "(", "ManagedZone", "response", ")", "{", "result", ".", "success", "(", "response", "==", "null", "?", "null", ":", "Zone", ".", "fromPb", "(", "serviceOptions", ".", "getService", "(", ")", ",", "response", ")", ")", ";", "}", "@", "Override", "public", "void", "onFailure", "(", "GoogleJsonError", "googleJsonError", ")", "{", "DnsException", "serviceException", "=", "new", "DnsException", "(", "googleJsonError", ",", "idempotent", ")", ";", "if", "(", "nullForNotFound", "&&", "serviceException", ".", "getCode", "(", ")", "==", "HTTP_NOT_FOUND", ")", "{", "result", ".", "success", "(", "null", ")", ";", "}", "else", "{", "result", ".", "error", "(", "serviceException", ")", ";", "}", "}", "}", ";", "}" ]
A joint callback for both "get zone" and "create zone" operations.
[ "A", "joint", "callback", "for", "both", "get", "zone", "and", "create", "zone", "operations", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dns/src/main/java/com/google/cloud/dns/DnsBatch.java#L258-L280
12,354
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dns/src/main/java/com/google/cloud/dns/DnsBatch.java
DnsBatch.createChangeRequestCallback
private RpcBatch.Callback<Change> createChangeRequestCallback( final String zoneName, final DnsBatchResult<ChangeRequest> result, final boolean nullForNotFound, final boolean idempotent) { return new RpcBatch.Callback<Change>() { @Override public void onSuccess(Change response) { result.success( response == null ? null : ChangeRequest.fromPb(options.getService(), zoneName, response)); } @Override public void onFailure(GoogleJsonError googleJsonError) { DnsException serviceException = new DnsException(googleJsonError, idempotent); if (serviceException.getCode() == HTTP_NOT_FOUND) { if ("entity.parameters.changeId".equals(serviceException.getLocation()) || (serviceException.getMessage() != null && serviceException.getMessage().contains("parameters.changeId"))) { // the change id was not found, but the zone exists result.success(null); return; } // the zone does not exist, so throw an exception } result.error(serviceException); } }; }
java
private RpcBatch.Callback<Change> createChangeRequestCallback( final String zoneName, final DnsBatchResult<ChangeRequest> result, final boolean nullForNotFound, final boolean idempotent) { return new RpcBatch.Callback<Change>() { @Override public void onSuccess(Change response) { result.success( response == null ? null : ChangeRequest.fromPb(options.getService(), zoneName, response)); } @Override public void onFailure(GoogleJsonError googleJsonError) { DnsException serviceException = new DnsException(googleJsonError, idempotent); if (serviceException.getCode() == HTTP_NOT_FOUND) { if ("entity.parameters.changeId".equals(serviceException.getLocation()) || (serviceException.getMessage() != null && serviceException.getMessage().contains("parameters.changeId"))) { // the change id was not found, but the zone exists result.success(null); return; } // the zone does not exist, so throw an exception } result.error(serviceException); } }; }
[ "private", "RpcBatch", ".", "Callback", "<", "Change", ">", "createChangeRequestCallback", "(", "final", "String", "zoneName", ",", "final", "DnsBatchResult", "<", "ChangeRequest", ">", "result", ",", "final", "boolean", "nullForNotFound", ",", "final", "boolean", "idempotent", ")", "{", "return", "new", "RpcBatch", ".", "Callback", "<", "Change", ">", "(", ")", "{", "@", "Override", "public", "void", "onSuccess", "(", "Change", "response", ")", "{", "result", ".", "success", "(", "response", "==", "null", "?", "null", ":", "ChangeRequest", ".", "fromPb", "(", "options", ".", "getService", "(", ")", ",", "zoneName", ",", "response", ")", ")", ";", "}", "@", "Override", "public", "void", "onFailure", "(", "GoogleJsonError", "googleJsonError", ")", "{", "DnsException", "serviceException", "=", "new", "DnsException", "(", "googleJsonError", ",", "idempotent", ")", ";", "if", "(", "serviceException", ".", "getCode", "(", ")", "==", "HTTP_NOT_FOUND", ")", "{", "if", "(", "\"entity.parameters.changeId\"", ".", "equals", "(", "serviceException", ".", "getLocation", "(", ")", ")", "||", "(", "serviceException", ".", "getMessage", "(", ")", "!=", "null", "&&", "serviceException", ".", "getMessage", "(", ")", ".", "contains", "(", "\"parameters.changeId\"", ")", ")", ")", "{", "// the change id was not found, but the zone exists", "result", ".", "success", "(", "null", ")", ";", "return", ";", "}", "// the zone does not exist, so throw an exception", "}", "result", ".", "error", "(", "serviceException", ")", ";", "}", "}", ";", "}" ]
A joint callback for both "get change request" and "create change request" operations.
[ "A", "joint", "callback", "for", "both", "get", "change", "request", "and", "create", "change", "request", "operations", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dns/src/main/java/com/google/cloud/dns/DnsBatch.java#L351-L381
12,355
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.createImplicitOrderBy
private List<FieldOrder> createImplicitOrderBy() { List<FieldOrder> implicitOrders = new ArrayList<>(options.fieldOrders); boolean hasDocumentId = false; if (implicitOrders.isEmpty()) { // If no explicit ordering is specified, use the first inequality to define an implicit order. for (FieldFilter fieldFilter : options.fieldFilters) { if (!fieldFilter.isEqualsFilter()) { implicitOrders.add(new FieldOrder(fieldFilter.fieldPath, Direction.ASCENDING)); break; } } } else { for (FieldOrder fieldOrder : options.fieldOrders) { if (fieldOrder.fieldPath.equals(FieldPath.DOCUMENT_ID)) { hasDocumentId = true; } } } if (!hasDocumentId) { // Add implicit sorting by name, using the last specified direction. Direction lastDirection = implicitOrders.isEmpty() ? Direction.ASCENDING : implicitOrders.get(implicitOrders.size() - 1).direction; implicitOrders.add(new FieldOrder(FieldPath.documentId(), lastDirection)); } return implicitOrders; }
java
private List<FieldOrder> createImplicitOrderBy() { List<FieldOrder> implicitOrders = new ArrayList<>(options.fieldOrders); boolean hasDocumentId = false; if (implicitOrders.isEmpty()) { // If no explicit ordering is specified, use the first inequality to define an implicit order. for (FieldFilter fieldFilter : options.fieldFilters) { if (!fieldFilter.isEqualsFilter()) { implicitOrders.add(new FieldOrder(fieldFilter.fieldPath, Direction.ASCENDING)); break; } } } else { for (FieldOrder fieldOrder : options.fieldOrders) { if (fieldOrder.fieldPath.equals(FieldPath.DOCUMENT_ID)) { hasDocumentId = true; } } } if (!hasDocumentId) { // Add implicit sorting by name, using the last specified direction. Direction lastDirection = implicitOrders.isEmpty() ? Direction.ASCENDING : implicitOrders.get(implicitOrders.size() - 1).direction; implicitOrders.add(new FieldOrder(FieldPath.documentId(), lastDirection)); } return implicitOrders; }
[ "private", "List", "<", "FieldOrder", ">", "createImplicitOrderBy", "(", ")", "{", "List", "<", "FieldOrder", ">", "implicitOrders", "=", "new", "ArrayList", "<>", "(", "options", ".", "fieldOrders", ")", ";", "boolean", "hasDocumentId", "=", "false", ";", "if", "(", "implicitOrders", ".", "isEmpty", "(", ")", ")", "{", "// If no explicit ordering is specified, use the first inequality to define an implicit order.", "for", "(", "FieldFilter", "fieldFilter", ":", "options", ".", "fieldFilters", ")", "{", "if", "(", "!", "fieldFilter", ".", "isEqualsFilter", "(", ")", ")", "{", "implicitOrders", ".", "add", "(", "new", "FieldOrder", "(", "fieldFilter", ".", "fieldPath", ",", "Direction", ".", "ASCENDING", ")", ")", ";", "break", ";", "}", "}", "}", "else", "{", "for", "(", "FieldOrder", "fieldOrder", ":", "options", ".", "fieldOrders", ")", "{", "if", "(", "fieldOrder", ".", "fieldPath", ".", "equals", "(", "FieldPath", ".", "DOCUMENT_ID", ")", ")", "{", "hasDocumentId", "=", "true", ";", "}", "}", "}", "if", "(", "!", "hasDocumentId", ")", "{", "// Add implicit sorting by name, using the last specified direction.", "Direction", "lastDirection", "=", "implicitOrders", ".", "isEmpty", "(", ")", "?", "Direction", ".", "ASCENDING", ":", "implicitOrders", ".", "get", "(", "implicitOrders", ".", "size", "(", ")", "-", "1", ")", ".", "direction", ";", "implicitOrders", ".", "add", "(", "new", "FieldOrder", "(", "FieldPath", ".", "documentId", "(", ")", ",", "lastDirection", ")", ")", ";", "}", "return", "implicitOrders", ";", "}" ]
Computes the backend ordering semantics for DocumentSnapshot cursors.
[ "Computes", "the", "backend", "ordering", "semantics", "for", "DocumentSnapshot", "cursors", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L286-L316
12,356
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.limit
@Nonnull public Query limit(int limit) { QueryOptions newOptions = new QueryOptions(options); newOptions.limit = limit; return new Query(firestore, path, newOptions); }
java
@Nonnull public Query limit(int limit) { QueryOptions newOptions = new QueryOptions(options); newOptions.limit = limit; return new Query(firestore, path, newOptions); }
[ "@", "Nonnull", "public", "Query", "limit", "(", "int", "limit", ")", "{", "QueryOptions", "newOptions", "=", "new", "QueryOptions", "(", "options", ")", ";", "newOptions", ".", "limit", "=", "limit", ";", "return", "new", "Query", "(", "firestore", ",", "path", ",", "newOptions", ")", ";", "}" ]
Creates and returns a new Query that's additionally limited to only return up to the specified number of documents. @param limit The maximum number of items to return. @return The created Query.
[ "Creates", "and", "returns", "a", "new", "Query", "that", "s", "additionally", "limited", "to", "only", "return", "up", "to", "the", "specified", "number", "of", "documents", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L678-L683
12,357
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.offset
@Nonnull public Query offset(int offset) { QueryOptions newOptions = new QueryOptions(options); newOptions.offset = offset; return new Query(firestore, path, newOptions); }
java
@Nonnull public Query offset(int offset) { QueryOptions newOptions = new QueryOptions(options); newOptions.offset = offset; return new Query(firestore, path, newOptions); }
[ "@", "Nonnull", "public", "Query", "offset", "(", "int", "offset", ")", "{", "QueryOptions", "newOptions", "=", "new", "QueryOptions", "(", "options", ")", ";", "newOptions", ".", "offset", "=", "offset", ";", "return", "new", "Query", "(", "firestore", ",", "path", ",", "newOptions", ")", ";", "}" ]
Creates and returns a new Query that skips the first n results. @param offset The number of items to skip. @return The created Query.
[ "Creates", "and", "returns", "a", "new", "Query", "that", "skips", "the", "first", "n", "results", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L691-L696
12,358
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.startAt
@Nonnull public Query startAt(Object... fieldValues) { QueryOptions newOptions = new QueryOptions(options); newOptions.startCursor = createCursor(newOptions.fieldOrders, fieldValues, true); return new Query(firestore, path, newOptions); }
java
@Nonnull public Query startAt(Object... fieldValues) { QueryOptions newOptions = new QueryOptions(options); newOptions.startCursor = createCursor(newOptions.fieldOrders, fieldValues, true); return new Query(firestore, path, newOptions); }
[ "@", "Nonnull", "public", "Query", "startAt", "(", "Object", "...", "fieldValues", ")", "{", "QueryOptions", "newOptions", "=", "new", "QueryOptions", "(", "options", ")", ";", "newOptions", ".", "startCursor", "=", "createCursor", "(", "newOptions", ".", "fieldOrders", ",", "fieldValues", ",", "true", ")", ";", "return", "new", "Query", "(", "firestore", ",", "path", ",", "newOptions", ")", ";", "}" ]
Creates and returns a new Query that starts at the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query. @param fieldValues The field values to start this query at, in order of the query's order by. @return The created Query.
[ "Creates", "and", "returns", "a", "new", "Query", "that", "starts", "at", "the", "provided", "fields", "relative", "to", "the", "order", "of", "the", "query", ".", "The", "order", "of", "the", "field", "values", "must", "match", "the", "order", "of", "the", "order", "by", "clauses", "of", "the", "query", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L721-L726
12,359
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.startAfter
public Query startAfter(Object... fieldValues) { QueryOptions newOptions = new QueryOptions(options); newOptions.startCursor = createCursor(newOptions.fieldOrders, fieldValues, false); return new Query(firestore, path, newOptions); }
java
public Query startAfter(Object... fieldValues) { QueryOptions newOptions = new QueryOptions(options); newOptions.startCursor = createCursor(newOptions.fieldOrders, fieldValues, false); return new Query(firestore, path, newOptions); }
[ "public", "Query", "startAfter", "(", "Object", "...", "fieldValues", ")", "{", "QueryOptions", "newOptions", "=", "new", "QueryOptions", "(", "options", ")", ";", "newOptions", ".", "startCursor", "=", "createCursor", "(", "newOptions", ".", "fieldOrders", ",", "fieldValues", ",", "false", ")", ";", "return", "new", "Query", "(", "firestore", ",", "path", ",", "newOptions", ")", ";", "}" ]
Creates and returns a new Query that starts after the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query. @param fieldValues The field values to start this query after, in order of the query's order by. @return The created Query.
[ "Creates", "and", "returns", "a", "new", "Query", "that", "starts", "after", "the", "provided", "fields", "relative", "to", "the", "order", "of", "the", "query", ".", "The", "order", "of", "the", "field", "values", "must", "match", "the", "order", "of", "the", "order", "by", "clauses", "of", "the", "query", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L798-L802
12,360
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.endBefore
@Nonnull public Query endBefore(Object... fieldValues) { QueryOptions newOptions = new QueryOptions(options); newOptions.endCursor = createCursor(newOptions.fieldOrders, fieldValues, true); return new Query(firestore, path, newOptions); }
java
@Nonnull public Query endBefore(Object... fieldValues) { QueryOptions newOptions = new QueryOptions(options); newOptions.endCursor = createCursor(newOptions.fieldOrders, fieldValues, true); return new Query(firestore, path, newOptions); }
[ "@", "Nonnull", "public", "Query", "endBefore", "(", "Object", "...", "fieldValues", ")", "{", "QueryOptions", "newOptions", "=", "new", "QueryOptions", "(", "options", ")", ";", "newOptions", ".", "endCursor", "=", "createCursor", "(", "newOptions", ".", "fieldOrders", ",", "fieldValues", ",", "true", ")", ";", "return", "new", "Query", "(", "firestore", ",", "path", ",", "newOptions", ")", ";", "}" ]
Creates and returns a new Query that ends before the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query. @param fieldValues The field values to end this query before, in order of the query's order by. @return The created Query.
[ "Creates", "and", "returns", "a", "new", "Query", "that", "ends", "before", "the", "provided", "fields", "relative", "to", "the", "order", "of", "the", "query", ".", "The", "order", "of", "the", "field", "values", "must", "match", "the", "order", "of", "the", "order", "by", "clauses", "of", "the", "query", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L828-L833
12,361
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.endAt
@Nonnull public Query endAt(Object... fieldValues) { QueryOptions newOptions = new QueryOptions(options); newOptions.endCursor = createCursor(newOptions.fieldOrders, fieldValues, false); return new Query(firestore, path, newOptions); }
java
@Nonnull public Query endAt(Object... fieldValues) { QueryOptions newOptions = new QueryOptions(options); newOptions.endCursor = createCursor(newOptions.fieldOrders, fieldValues, false); return new Query(firestore, path, newOptions); }
[ "@", "Nonnull", "public", "Query", "endAt", "(", "Object", "...", "fieldValues", ")", "{", "QueryOptions", "newOptions", "=", "new", "QueryOptions", "(", "options", ")", ";", "newOptions", ".", "endCursor", "=", "createCursor", "(", "newOptions", ".", "fieldOrders", ",", "fieldValues", ",", "false", ")", ";", "return", "new", "Query", "(", "firestore", ",", "path", ",", "newOptions", ")", ";", "}" ]
Creates and returns a new Query that ends at the provided fields relative to the order of the query. The order of the field values must match the order of the order by clauses of the query. @param fieldValues The field values to end this query at, in order of the query's order by. @return The created Query.
[ "Creates", "and", "returns", "a", "new", "Query", "that", "ends", "at", "the", "provided", "fields", "relative", "to", "the", "order", "of", "the", "query", ".", "The", "order", "of", "the", "field", "values", "must", "match", "the", "order", "of", "the", "order", "by", "clauses", "of", "the", "query", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L842-L847
12,362
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.buildQuery
StructuredQuery.Builder buildQuery() { StructuredQuery.Builder structuredQuery = StructuredQuery.newBuilder(); structuredQuery.addFrom( StructuredQuery.CollectionSelector.newBuilder().setCollectionId(path.getId())); if (options.fieldFilters.size() == 1) { Filter filter = options.fieldFilters.get(0).toProto(); if (filter.hasFieldFilter()) { structuredQuery.getWhereBuilder().setFieldFilter(filter.getFieldFilter()); } else { Preconditions.checkState( filter.hasUnaryFilter(), "Expected a UnaryFilter or a FieldFilter."); structuredQuery.getWhereBuilder().setUnaryFilter(filter.getUnaryFilter()); } } else if (options.fieldFilters.size() > 1) { Filter.Builder filter = Filter.newBuilder(); StructuredQuery.CompositeFilter.Builder compositeFilter = StructuredQuery.CompositeFilter.newBuilder(); compositeFilter.setOp(CompositeFilter.Operator.AND); for (FieldFilter fieldFilter : options.fieldFilters) { compositeFilter.addFilters(fieldFilter.toProto()); } filter.setCompositeFilter(compositeFilter.build()); structuredQuery.setWhere(filter.build()); } if (!options.fieldOrders.isEmpty()) { for (FieldOrder order : options.fieldOrders) { structuredQuery.addOrderBy(order.toProto()); } } if (!options.fieldProjections.isEmpty()) { structuredQuery.getSelectBuilder().addAllFields(options.fieldProjections); } if (options.limit != -1) { structuredQuery.setLimit(Int32Value.newBuilder().setValue(options.limit)); } if (options.offset != -1) { structuredQuery.setOffset(options.offset); } if (options.startCursor != null) { structuredQuery.setStartAt(options.startCursor); } if (options.endCursor != null) { structuredQuery.setEndAt(options.endCursor); } return structuredQuery; }
java
StructuredQuery.Builder buildQuery() { StructuredQuery.Builder structuredQuery = StructuredQuery.newBuilder(); structuredQuery.addFrom( StructuredQuery.CollectionSelector.newBuilder().setCollectionId(path.getId())); if (options.fieldFilters.size() == 1) { Filter filter = options.fieldFilters.get(0).toProto(); if (filter.hasFieldFilter()) { structuredQuery.getWhereBuilder().setFieldFilter(filter.getFieldFilter()); } else { Preconditions.checkState( filter.hasUnaryFilter(), "Expected a UnaryFilter or a FieldFilter."); structuredQuery.getWhereBuilder().setUnaryFilter(filter.getUnaryFilter()); } } else if (options.fieldFilters.size() > 1) { Filter.Builder filter = Filter.newBuilder(); StructuredQuery.CompositeFilter.Builder compositeFilter = StructuredQuery.CompositeFilter.newBuilder(); compositeFilter.setOp(CompositeFilter.Operator.AND); for (FieldFilter fieldFilter : options.fieldFilters) { compositeFilter.addFilters(fieldFilter.toProto()); } filter.setCompositeFilter(compositeFilter.build()); structuredQuery.setWhere(filter.build()); } if (!options.fieldOrders.isEmpty()) { for (FieldOrder order : options.fieldOrders) { structuredQuery.addOrderBy(order.toProto()); } } if (!options.fieldProjections.isEmpty()) { structuredQuery.getSelectBuilder().addAllFields(options.fieldProjections); } if (options.limit != -1) { structuredQuery.setLimit(Int32Value.newBuilder().setValue(options.limit)); } if (options.offset != -1) { structuredQuery.setOffset(options.offset); } if (options.startCursor != null) { structuredQuery.setStartAt(options.startCursor); } if (options.endCursor != null) { structuredQuery.setEndAt(options.endCursor); } return structuredQuery; }
[ "StructuredQuery", ".", "Builder", "buildQuery", "(", ")", "{", "StructuredQuery", ".", "Builder", "structuredQuery", "=", "StructuredQuery", ".", "newBuilder", "(", ")", ";", "structuredQuery", ".", "addFrom", "(", "StructuredQuery", ".", "CollectionSelector", ".", "newBuilder", "(", ")", ".", "setCollectionId", "(", "path", ".", "getId", "(", ")", ")", ")", ";", "if", "(", "options", ".", "fieldFilters", ".", "size", "(", ")", "==", "1", ")", "{", "Filter", "filter", "=", "options", ".", "fieldFilters", ".", "get", "(", "0", ")", ".", "toProto", "(", ")", ";", "if", "(", "filter", ".", "hasFieldFilter", "(", ")", ")", "{", "structuredQuery", ".", "getWhereBuilder", "(", ")", ".", "setFieldFilter", "(", "filter", ".", "getFieldFilter", "(", ")", ")", ";", "}", "else", "{", "Preconditions", ".", "checkState", "(", "filter", ".", "hasUnaryFilter", "(", ")", ",", "\"Expected a UnaryFilter or a FieldFilter.\"", ")", ";", "structuredQuery", ".", "getWhereBuilder", "(", ")", ".", "setUnaryFilter", "(", "filter", ".", "getUnaryFilter", "(", ")", ")", ";", "}", "}", "else", "if", "(", "options", ".", "fieldFilters", ".", "size", "(", ")", ">", "1", ")", "{", "Filter", ".", "Builder", "filter", "=", "Filter", ".", "newBuilder", "(", ")", ";", "StructuredQuery", ".", "CompositeFilter", ".", "Builder", "compositeFilter", "=", "StructuredQuery", ".", "CompositeFilter", ".", "newBuilder", "(", ")", ";", "compositeFilter", ".", "setOp", "(", "CompositeFilter", ".", "Operator", ".", "AND", ")", ";", "for", "(", "FieldFilter", "fieldFilter", ":", "options", ".", "fieldFilters", ")", "{", "compositeFilter", ".", "addFilters", "(", "fieldFilter", ".", "toProto", "(", ")", ")", ";", "}", "filter", ".", "setCompositeFilter", "(", "compositeFilter", ".", "build", "(", ")", ")", ";", "structuredQuery", ".", "setWhere", "(", "filter", ".", "build", "(", ")", ")", ";", "}", "if", "(", "!", "options", ".", "fieldOrders", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "FieldOrder", "order", ":", "options", ".", "fieldOrders", ")", "{", "structuredQuery", ".", "addOrderBy", "(", "order", ".", "toProto", "(", ")", ")", ";", "}", "}", "if", "(", "!", "options", ".", "fieldProjections", ".", "isEmpty", "(", ")", ")", "{", "structuredQuery", ".", "getSelectBuilder", "(", ")", ".", "addAllFields", "(", "options", ".", "fieldProjections", ")", ";", "}", "if", "(", "options", ".", "limit", "!=", "-", "1", ")", "{", "structuredQuery", ".", "setLimit", "(", "Int32Value", ".", "newBuilder", "(", ")", ".", "setValue", "(", "options", ".", "limit", ")", ")", ";", "}", "if", "(", "options", ".", "offset", "!=", "-", "1", ")", "{", "structuredQuery", ".", "setOffset", "(", "options", ".", "offset", ")", ";", "}", "if", "(", "options", ".", "startCursor", "!=", "null", ")", "{", "structuredQuery", ".", "setStartAt", "(", "options", ".", "startCursor", ")", ";", "}", "if", "(", "options", ".", "endCursor", "!=", "null", ")", "{", "structuredQuery", ".", "setEndAt", "(", "options", ".", "endCursor", ")", ";", "}", "return", "structuredQuery", ";", "}" ]
Build the final Firestore query.
[ "Build", "the", "final", "Firestore", "query", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L866-L919
12,363
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java
Query.stream
public void stream(@Nonnull final ApiStreamObserver<DocumentSnapshot> responseObserver) { stream( new QuerySnapshotObserver() { @Override public void onNext(QueryDocumentSnapshot documentSnapshot) { responseObserver.onNext(documentSnapshot); } @Override public void onError(Throwable throwable) { responseObserver.onError(throwable); } @Override public void onCompleted() { responseObserver.onCompleted(); } }, null); }
java
public void stream(@Nonnull final ApiStreamObserver<DocumentSnapshot> responseObserver) { stream( new QuerySnapshotObserver() { @Override public void onNext(QueryDocumentSnapshot documentSnapshot) { responseObserver.onNext(documentSnapshot); } @Override public void onError(Throwable throwable) { responseObserver.onError(throwable); } @Override public void onCompleted() { responseObserver.onCompleted(); } }, null); }
[ "public", "void", "stream", "(", "@", "Nonnull", "final", "ApiStreamObserver", "<", "DocumentSnapshot", ">", "responseObserver", ")", "{", "stream", "(", "new", "QuerySnapshotObserver", "(", ")", "{", "@", "Override", "public", "void", "onNext", "(", "QueryDocumentSnapshot", "documentSnapshot", ")", "{", "responseObserver", ".", "onNext", "(", "documentSnapshot", ")", ";", "}", "@", "Override", "public", "void", "onError", "(", "Throwable", "throwable", ")", "{", "responseObserver", ".", "onError", "(", "throwable", ")", ";", "}", "@", "Override", "public", "void", "onCompleted", "(", ")", "{", "responseObserver", ".", "onCompleted", "(", ")", ";", "}", "}", ",", "null", ")", ";", "}" ]
Executes the query and streams the results as a StreamObserver of DocumentSnapshots. @param responseObserver The observer to be notified when results arrive.
[ "Executes", "the", "query", "and", "streams", "the", "results", "as", "a", "StreamObserver", "of", "DocumentSnapshots", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Query.java#L926-L945
12,364
googleapis/google-cloud-java
google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Operation.java
Operation.reload
public Operation<R, M> reload() throws SpannerException { if (isDone) { return this; } com.google.longrunning.Operation proto = rpc.getOperation(name); return Operation.<R, M>create(rpc, proto, parser); }
java
public Operation<R, M> reload() throws SpannerException { if (isDone) { return this; } com.google.longrunning.Operation proto = rpc.getOperation(name); return Operation.<R, M>create(rpc, proto, parser); }
[ "public", "Operation", "<", "R", ",", "M", ">", "reload", "(", ")", "throws", "SpannerException", "{", "if", "(", "isDone", ")", "{", "return", "this", ";", "}", "com", ".", "google", ".", "longrunning", ".", "Operation", "proto", "=", "rpc", ".", "getOperation", "(", "name", ")", ";", "return", "Operation", ".", "<", "R", ",", "M", ">", "create", "(", "rpc", ",", "proto", ",", "parser", ")", ";", "}" ]
Fetches the current status of this operation.
[ "Fetches", "the", "current", "status", "of", "this", "operation", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Operation.java#L124-L130
12,365
googleapis/google-cloud-java
google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Operation.java
Operation.waitFor
public Operation<R, M> waitFor(RetryOption... waitOptions) throws SpannerException { if (isDone()) { return this; } RetrySettings waitSettings = RetryOption.mergeToSettings(DEFAULT_OPERATION_WAIT_SETTINGS, waitOptions); try { com.google.longrunning.Operation proto = RetryHelper.poll( new Callable<com.google.longrunning.Operation>() { @Override public com.google.longrunning.Operation call() throws Exception { return rpc.getOperation(name); } }, waitSettings, new BasicResultRetryAlgorithm<com.google.longrunning.Operation>() { @Override public boolean shouldRetry( Throwable prevThrowable, com.google.longrunning.Operation prevResponse) { if (prevResponse != null) { return !prevResponse.getDone(); } if (prevThrowable instanceof SpannerException) { SpannerException spannerException = (SpannerException) prevThrowable; return spannerException.getErrorCode() != ErrorCode.NOT_FOUND && spannerException.isRetryable(); } return false; } }, clock); return Operation.create(rpc, proto, parser); } catch (InterruptedException e) { throw SpannerExceptionFactory.propagateInterrupt(e); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof SpannerException) { SpannerException spannerException = (SpannerException) cause; if (spannerException.getErrorCode() == ErrorCode.NOT_FOUND) { return null; } throw spannerException; } if (cause instanceof PollException) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.DEADLINE_EXCEEDED, "Operation did not complete in the given time"); } throw SpannerExceptionFactory.newSpannerException(cause); } }
java
public Operation<R, M> waitFor(RetryOption... waitOptions) throws SpannerException { if (isDone()) { return this; } RetrySettings waitSettings = RetryOption.mergeToSettings(DEFAULT_OPERATION_WAIT_SETTINGS, waitOptions); try { com.google.longrunning.Operation proto = RetryHelper.poll( new Callable<com.google.longrunning.Operation>() { @Override public com.google.longrunning.Operation call() throws Exception { return rpc.getOperation(name); } }, waitSettings, new BasicResultRetryAlgorithm<com.google.longrunning.Operation>() { @Override public boolean shouldRetry( Throwable prevThrowable, com.google.longrunning.Operation prevResponse) { if (prevResponse != null) { return !prevResponse.getDone(); } if (prevThrowable instanceof SpannerException) { SpannerException spannerException = (SpannerException) prevThrowable; return spannerException.getErrorCode() != ErrorCode.NOT_FOUND && spannerException.isRetryable(); } return false; } }, clock); return Operation.create(rpc, proto, parser); } catch (InterruptedException e) { throw SpannerExceptionFactory.propagateInterrupt(e); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof SpannerException) { SpannerException spannerException = (SpannerException) cause; if (spannerException.getErrorCode() == ErrorCode.NOT_FOUND) { return null; } throw spannerException; } if (cause instanceof PollException) { throw SpannerExceptionFactory.newSpannerException( ErrorCode.DEADLINE_EXCEEDED, "Operation did not complete in the given time"); } throw SpannerExceptionFactory.newSpannerException(cause); } }
[ "public", "Operation", "<", "R", ",", "M", ">", "waitFor", "(", "RetryOption", "...", "waitOptions", ")", "throws", "SpannerException", "{", "if", "(", "isDone", "(", ")", ")", "{", "return", "this", ";", "}", "RetrySettings", "waitSettings", "=", "RetryOption", ".", "mergeToSettings", "(", "DEFAULT_OPERATION_WAIT_SETTINGS", ",", "waitOptions", ")", ";", "try", "{", "com", ".", "google", ".", "longrunning", ".", "Operation", "proto", "=", "RetryHelper", ".", "poll", "(", "new", "Callable", "<", "com", ".", "google", ".", "longrunning", ".", "Operation", ">", "(", ")", "{", "@", "Override", "public", "com", ".", "google", ".", "longrunning", ".", "Operation", "call", "(", ")", "throws", "Exception", "{", "return", "rpc", ".", "getOperation", "(", "name", ")", ";", "}", "}", ",", "waitSettings", ",", "new", "BasicResultRetryAlgorithm", "<", "com", ".", "google", ".", "longrunning", ".", "Operation", ">", "(", ")", "{", "@", "Override", "public", "boolean", "shouldRetry", "(", "Throwable", "prevThrowable", ",", "com", ".", "google", ".", "longrunning", ".", "Operation", "prevResponse", ")", "{", "if", "(", "prevResponse", "!=", "null", ")", "{", "return", "!", "prevResponse", ".", "getDone", "(", ")", ";", "}", "if", "(", "prevThrowable", "instanceof", "SpannerException", ")", "{", "SpannerException", "spannerException", "=", "(", "SpannerException", ")", "prevThrowable", ";", "return", "spannerException", ".", "getErrorCode", "(", ")", "!=", "ErrorCode", ".", "NOT_FOUND", "&&", "spannerException", ".", "isRetryable", "(", ")", ";", "}", "return", "false", ";", "}", "}", ",", "clock", ")", ";", "return", "Operation", ".", "create", "(", "rpc", ",", "proto", ",", "parser", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "SpannerExceptionFactory", ".", "propagateInterrupt", "(", "e", ")", ";", "}", "catch", "(", "ExecutionException", "e", ")", "{", "Throwable", "cause", "=", "e", ".", "getCause", "(", ")", ";", "if", "(", "cause", "instanceof", "SpannerException", ")", "{", "SpannerException", "spannerException", "=", "(", "SpannerException", ")", "cause", ";", "if", "(", "spannerException", ".", "getErrorCode", "(", ")", "==", "ErrorCode", ".", "NOT_FOUND", ")", "{", "return", "null", ";", "}", "throw", "spannerException", ";", "}", "if", "(", "cause", "instanceof", "PollException", ")", "{", "throw", "SpannerExceptionFactory", ".", "newSpannerException", "(", "ErrorCode", ".", "DEADLINE_EXCEEDED", ",", "\"Operation did not complete in the given time\"", ")", ";", "}", "throw", "SpannerExceptionFactory", ".", "newSpannerException", "(", "cause", ")", ";", "}", "}" ]
Blocks till the operation is complete or maximum time, if specified, has elapsed. @return null if operation is not found otherwise the current operation.
[ "Blocks", "till", "the", "operation", "is", "complete", "or", "maximum", "time", "if", "specified", "has", "elapsed", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Operation.java#L137-L187
12,366
googleapis/google-cloud-java
google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java
SecurityCenterClient.createFinding
public final Finding createFinding(SourceName parent, String findingId, Finding finding) { CreateFindingRequest request = CreateFindingRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFindingId(findingId) .setFinding(finding) .build(); return createFinding(request); }
java
public final Finding createFinding(SourceName parent, String findingId, Finding finding) { CreateFindingRequest request = CreateFindingRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFindingId(findingId) .setFinding(finding) .build(); return createFinding(request); }
[ "public", "final", "Finding", "createFinding", "(", "SourceName", "parent", ",", "String", "findingId", ",", "Finding", "finding", ")", "{", "CreateFindingRequest", "request", "=", "CreateFindingRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", "==", "null", "?", "null", ":", "parent", ".", "toString", "(", ")", ")", ".", "setFindingId", "(", "findingId", ")", ".", "setFinding", "(", "finding", ")", ".", "build", "(", ")", ";", "return", "createFinding", "(", "request", ")", ";", "}" ]
Creates a finding. The corresponding source must exist for finding creation to succeed. <p>Sample code: <pre><code> try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) { SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]"); String findingId = ""; Finding finding = Finding.newBuilder().build(); Finding response = securityCenterClient.createFinding(parent, findingId, finding); } </code></pre> @param parent Resource name of the new finding's parent. Its format should be "organizations/[organization_id]/sources/[source_id]". @param findingId Unique identifier provided by the client within the parent scope. It must be alphanumeric and less than or equal to 32 characters and greater than 0 characters in length. @param finding The Finding being created. The name and security_marks will be ignored as they are both output only fields on this resource. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "finding", ".", "The", "corresponding", "source", "must", "exist", "for", "finding", "creation", "to", "succeed", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java#L311-L320
12,367
googleapis/google-cloud-java
google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java
SecurityCenterClient.updateFinding
public final Finding updateFinding(Finding finding) { UpdateFindingRequest request = UpdateFindingRequest.newBuilder().setFinding(finding).build(); return updateFinding(request); }
java
public final Finding updateFinding(Finding finding) { UpdateFindingRequest request = UpdateFindingRequest.newBuilder().setFinding(finding).build(); return updateFinding(request); }
[ "public", "final", "Finding", "updateFinding", "(", "Finding", "finding", ")", "{", "UpdateFindingRequest", "request", "=", "UpdateFindingRequest", ".", "newBuilder", "(", ")", ".", "setFinding", "(", "finding", ")", ".", "build", "(", ")", ";", "return", "updateFinding", "(", "request", ")", ";", "}" ]
Creates or updates a finding. The corresponding source must exist for a finding creation to succeed. <p>Sample code: <pre><code> try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) { Finding finding = Finding.newBuilder().build(); Finding response = securityCenterClient.updateFinding(finding); } </code></pre> @param finding The finding resource to update or create if it does not already exist. parent, security_marks, and update_time will be ignored. <p>In the case of creation, the finding id portion of the name must be alphanumeric and less than or equal to 32 characters and greater than 0 characters in length. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "or", "updates", "a", "finding", ".", "The", "corresponding", "source", "must", "exist", "for", "a", "finding", "creation", "to", "succeed", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java#L1763-L1767
12,368
googleapis/google-cloud-java
google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java
SecurityCenterClient.updateOrganizationSettings
public final OrganizationSettings updateOrganizationSettings( OrganizationSettings organizationSettings) { UpdateOrganizationSettingsRequest request = UpdateOrganizationSettingsRequest.newBuilder() .setOrganizationSettings(organizationSettings) .build(); return updateOrganizationSettings(request); }
java
public final OrganizationSettings updateOrganizationSettings( OrganizationSettings organizationSettings) { UpdateOrganizationSettingsRequest request = UpdateOrganizationSettingsRequest.newBuilder() .setOrganizationSettings(organizationSettings) .build(); return updateOrganizationSettings(request); }
[ "public", "final", "OrganizationSettings", "updateOrganizationSettings", "(", "OrganizationSettings", "organizationSettings", ")", "{", "UpdateOrganizationSettingsRequest", "request", "=", "UpdateOrganizationSettingsRequest", ".", "newBuilder", "(", ")", ".", "setOrganizationSettings", "(", "organizationSettings", ")", ".", "build", "(", ")", ";", "return", "updateOrganizationSettings", "(", "request", ")", ";", "}" ]
Updates an organization's settings. <p>Sample code: <pre><code> try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) { OrganizationSettings organizationSettings = OrganizationSettings.newBuilder().build(); OrganizationSettings response = securityCenterClient.updateOrganizationSettings(organizationSettings); } </code></pre> @param organizationSettings The organization settings resource to update. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "an", "organization", "s", "settings", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java#L1832-L1840
12,369
googleapis/google-cloud-java
google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java
SecurityCenterClient.updateSource
public final Source updateSource(Source source) { UpdateSourceRequest request = UpdateSourceRequest.newBuilder().setSource(source).build(); return updateSource(request); }
java
public final Source updateSource(Source source) { UpdateSourceRequest request = UpdateSourceRequest.newBuilder().setSource(source).build(); return updateSource(request); }
[ "public", "final", "Source", "updateSource", "(", "Source", "source", ")", "{", "UpdateSourceRequest", "request", "=", "UpdateSourceRequest", ".", "newBuilder", "(", ")", ".", "setSource", "(", "source", ")", ".", "build", "(", ")", ";", "return", "updateSource", "(", "request", ")", ";", "}" ]
Updates a source. <p>Sample code: <pre><code> try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) { Source source = Source.newBuilder().build(); Source response = securityCenterClient.updateSource(source); } </code></pre> @param source The source resource to update. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "a", "source", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java#L1905-L1909
12,370
googleapis/google-cloud-java
google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java
SecurityCenterClient.updateSecurityMarks
public final SecurityMarks updateSecurityMarks(SecurityMarks securityMarks) { UpdateSecurityMarksRequest request = UpdateSecurityMarksRequest.newBuilder().setSecurityMarks(securityMarks).build(); return updateSecurityMarks(request); }
java
public final SecurityMarks updateSecurityMarks(SecurityMarks securityMarks) { UpdateSecurityMarksRequest request = UpdateSecurityMarksRequest.newBuilder().setSecurityMarks(securityMarks).build(); return updateSecurityMarks(request); }
[ "public", "final", "SecurityMarks", "updateSecurityMarks", "(", "SecurityMarks", "securityMarks", ")", "{", "UpdateSecurityMarksRequest", "request", "=", "UpdateSecurityMarksRequest", ".", "newBuilder", "(", ")", ".", "setSecurityMarks", "(", "securityMarks", ")", ".", "build", "(", ")", ";", "return", "updateSecurityMarks", "(", "request", ")", ";", "}" ]
Updates security marks. <p>Sample code: <pre><code> try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) { SecurityMarks securityMarks = SecurityMarks.newBuilder().build(); SecurityMarks response = securityCenterClient.updateSecurityMarks(securityMarks); } </code></pre> @param securityMarks The security marks resource to update. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "security", "marks", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java#L1972-L1977
12,371
googleapis/google-cloud-java
google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java
SpannerClient.listSessions
public final ListSessionsPagedResponse listSessions(String database) { ListSessionsRequest request = ListSessionsRequest.newBuilder().setDatabase(database).build(); return listSessions(request); }
java
public final ListSessionsPagedResponse listSessions(String database) { ListSessionsRequest request = ListSessionsRequest.newBuilder().setDatabase(database).build(); return listSessions(request); }
[ "public", "final", "ListSessionsPagedResponse", "listSessions", "(", "String", "database", ")", "{", "ListSessionsRequest", "request", "=", "ListSessionsRequest", ".", "newBuilder", "(", ")", ".", "setDatabase", "(", "database", ")", ".", "build", "(", ")", ";", "return", "listSessions", "(", "request", ")", ";", "}" ]
Lists all sessions in a given database. <p>Sample code: <pre><code> try (SpannerClient spannerClient = SpannerClient.create()) { String formattedDatabase = DatabaseName.format("[PROJECT]", "[INSTANCE]", "[DATABASE]"); for (Session element : spannerClient.listSessions(formattedDatabase).iterateAll()) { // doThingsWith(element); } } </code></pre> @param database Required. The database in which to list sessions. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Lists", "all", "sessions", "in", "a", "given", "database", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/v1/SpannerClient.java#L443-L446
12,372
googleapis/google-cloud-java
google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Key.java
Key.toUrlSafe
public String toUrlSafe() { try { return URLEncoder.encode(TextFormat.printToString(toPb()), UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Unexpected encoding exception", e); } }
java
public String toUrlSafe() { try { return URLEncoder.encode(TextFormat.printToString(toPb()), UTF_8.name()); } catch (UnsupportedEncodingException e) { throw new IllegalStateException("Unexpected encoding exception", e); } }
[ "public", "String", "toUrlSafe", "(", ")", "{", "try", "{", "return", "URLEncoder", ".", "encode", "(", "TextFormat", ".", "printToString", "(", "toPb", "(", ")", ")", ",", "UTF_8", ".", "name", "(", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Unexpected encoding exception\"", ",", "e", ")", ";", "}", "}" ]
Returns the key in an encoded form that can be used as part of a URL.
[ "Returns", "the", "key", "in", "an", "encoded", "form", "that", "can", "be", "used", "as", "part", "of", "a", "URL", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datastore/src/main/java/com/google/cloud/datastore/Key.java#L129-L135
12,373
googleapis/google-cloud-java
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java
InstanceAdminExample.createProdInstance
public void createProdInstance() { // Checks if instance exists, creates instance if does not exists. if (!adminClient.exists(instanceId)) { System.out.println("Instance does not exist, creating a PRODUCTION instance"); // [START bigtable_create_prod_instance] // Creates a Production Instance with the ID "ssd-instance", // cluster id "ssd-cluster", 3 nodes and location "us-central1-f". CreateInstanceRequest createInstanceRequest = CreateInstanceRequest.of(instanceId) .addCluster(clusterId, "us-central1-f", 3, StorageType.SSD) .setType(Instance.Type.PRODUCTION) .addLabel("department", "accounting"); // Creates a production instance with the given request. try { Instance instance = adminClient.createInstance(createInstanceRequest); System.out.printf("PRODUCTION type instance %s created successfully%n", instance.getId()); } catch (Exception e) { System.err.println("Failed to create instance: " + e.getMessage()); throw e; } // [END bigtable_create_prod_instance] } }
java
public void createProdInstance() { // Checks if instance exists, creates instance if does not exists. if (!adminClient.exists(instanceId)) { System.out.println("Instance does not exist, creating a PRODUCTION instance"); // [START bigtable_create_prod_instance] // Creates a Production Instance with the ID "ssd-instance", // cluster id "ssd-cluster", 3 nodes and location "us-central1-f". CreateInstanceRequest createInstanceRequest = CreateInstanceRequest.of(instanceId) .addCluster(clusterId, "us-central1-f", 3, StorageType.SSD) .setType(Instance.Type.PRODUCTION) .addLabel("department", "accounting"); // Creates a production instance with the given request. try { Instance instance = adminClient.createInstance(createInstanceRequest); System.out.printf("PRODUCTION type instance %s created successfully%n", instance.getId()); } catch (Exception e) { System.err.println("Failed to create instance: " + e.getMessage()); throw e; } // [END bigtable_create_prod_instance] } }
[ "public", "void", "createProdInstance", "(", ")", "{", "// Checks if instance exists, creates instance if does not exists.", "if", "(", "!", "adminClient", ".", "exists", "(", "instanceId", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Instance does not exist, creating a PRODUCTION instance\"", ")", ";", "// [START bigtable_create_prod_instance]", "// Creates a Production Instance with the ID \"ssd-instance\",", "// cluster id \"ssd-cluster\", 3 nodes and location \"us-central1-f\".", "CreateInstanceRequest", "createInstanceRequest", "=", "CreateInstanceRequest", ".", "of", "(", "instanceId", ")", ".", "addCluster", "(", "clusterId", ",", "\"us-central1-f\"", ",", "3", ",", "StorageType", ".", "SSD", ")", ".", "setType", "(", "Instance", ".", "Type", ".", "PRODUCTION", ")", ".", "addLabel", "(", "\"department\"", ",", "\"accounting\"", ")", ";", "// Creates a production instance with the given request.", "try", "{", "Instance", "instance", "=", "adminClient", ".", "createInstance", "(", "createInstanceRequest", ")", ";", "System", ".", "out", ".", "printf", "(", "\"PRODUCTION type instance %s created successfully%n\"", ",", "instance", ".", "getId", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Failed to create instance: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "throw", "e", ";", "}", "// [END bigtable_create_prod_instance]", "}", "}" ]
Demonstrates how to create a Production instance within a provided project.
[ "Demonstrates", "how", "to", "create", "a", "Production", "instance", "within", "a", "provided", "project", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java#L95-L117
12,374
googleapis/google-cloud-java
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java
InstanceAdminExample.listInstances
public void listInstances() { System.out.println("\nListing Instances"); // [START bigtable_list_instances] try { List<Instance> instances = adminClient.listInstances(); for (Instance instance : instances) { System.out.println(instance.getId()); } } catch (PartialListInstancesException e) { System.err.println("Failed to list instances: " + e.getMessage()); System.err.println("The following zones are unavailable: " + e.getUnavailableZones()); System.err.println("But the following instances are reachable: " + e.getInstances()); } // [END bigtable_list_instances] }
java
public void listInstances() { System.out.println("\nListing Instances"); // [START bigtable_list_instances] try { List<Instance> instances = adminClient.listInstances(); for (Instance instance : instances) { System.out.println(instance.getId()); } } catch (PartialListInstancesException e) { System.err.println("Failed to list instances: " + e.getMessage()); System.err.println("The following zones are unavailable: " + e.getUnavailableZones()); System.err.println("But the following instances are reachable: " + e.getInstances()); } // [END bigtable_list_instances] }
[ "public", "void", "listInstances", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"\\nListing Instances\"", ")", ";", "// [START bigtable_list_instances]", "try", "{", "List", "<", "Instance", ">", "instances", "=", "adminClient", ".", "listInstances", "(", ")", ";", "for", "(", "Instance", "instance", ":", "instances", ")", "{", "System", ".", "out", ".", "println", "(", "instance", ".", "getId", "(", ")", ")", ";", "}", "}", "catch", "(", "PartialListInstancesException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Failed to list instances: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "System", ".", "err", ".", "println", "(", "\"The following zones are unavailable: \"", "+", "e", ".", "getUnavailableZones", "(", ")", ")", ";", "System", ".", "err", ".", "println", "(", "\"But the following instances are reachable: \"", "+", "e", ".", "getInstances", "(", ")", ")", ";", "}", "// [END bigtable_list_instances]", "}" ]
Demonstrates how to list all instances within a project.
[ "Demonstrates", "how", "to", "list", "all", "instances", "within", "a", "project", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java#L120-L134
12,375
googleapis/google-cloud-java
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java
InstanceAdminExample.getInstance
public Instance getInstance() { System.out.println("\nGet Instance"); // [START bigtable_get_instance] Instance instance = null; try { instance = adminClient.getInstance(instanceId); System.out.println("Instance ID: " + instance.getId()); System.out.println("Display Name: " + instance.getDisplayName()); System.out.print("Labels: "); Map<String, String> labels = instance.getLabels(); for (String key : labels.keySet()) { System.out.printf("%s - %s", key, labels.get(key)); } System.out.println("\nState: " + instance.getState()); System.out.println("Type: " + instance.getType()); } catch (NotFoundException e) { System.err.println("Failed to get non-existent instance: " + e.getMessage()); } // [END bigtable_get_instance] return instance; }
java
public Instance getInstance() { System.out.println("\nGet Instance"); // [START bigtable_get_instance] Instance instance = null; try { instance = adminClient.getInstance(instanceId); System.out.println("Instance ID: " + instance.getId()); System.out.println("Display Name: " + instance.getDisplayName()); System.out.print("Labels: "); Map<String, String> labels = instance.getLabels(); for (String key : labels.keySet()) { System.out.printf("%s - %s", key, labels.get(key)); } System.out.println("\nState: " + instance.getState()); System.out.println("Type: " + instance.getType()); } catch (NotFoundException e) { System.err.println("Failed to get non-existent instance: " + e.getMessage()); } // [END bigtable_get_instance] return instance; }
[ "public", "Instance", "getInstance", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"\\nGet Instance\"", ")", ";", "// [START bigtable_get_instance]", "Instance", "instance", "=", "null", ";", "try", "{", "instance", "=", "adminClient", ".", "getInstance", "(", "instanceId", ")", ";", "System", ".", "out", ".", "println", "(", "\"Instance ID: \"", "+", "instance", ".", "getId", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"Display Name: \"", "+", "instance", ".", "getDisplayName", "(", ")", ")", ";", "System", ".", "out", ".", "print", "(", "\"Labels: \"", ")", ";", "Map", "<", "String", ",", "String", ">", "labels", "=", "instance", ".", "getLabels", "(", ")", ";", "for", "(", "String", "key", ":", "labels", ".", "keySet", "(", ")", ")", "{", "System", ".", "out", ".", "printf", "(", "\"%s - %s\"", ",", "key", ",", "labels", ".", "get", "(", "key", ")", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"\\nState: \"", "+", "instance", ".", "getState", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", "\"Type: \"", "+", "instance", ".", "getType", "(", ")", ")", ";", "}", "catch", "(", "NotFoundException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Failed to get non-existent instance: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "// [END bigtable_get_instance]", "return", "instance", ";", "}" ]
Demonstrates how to get an instance.
[ "Demonstrates", "how", "to", "get", "an", "instance", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java#L137-L157
12,376
googleapis/google-cloud-java
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java
InstanceAdminExample.listClusters
public void listClusters() { System.out.println("\nListing Clusters"); // [START bigtable_get_clusters] try { List<Cluster> clusters = adminClient.listClusters(instanceId); for (Cluster cluster : clusters) { System.out.println(cluster.getId()); } } catch (NotFoundException e) { System.err.println("Failed to list clusters from a non-existent instance: " + e.getMessage()); } // [END bigtable_get_clusters] }
java
public void listClusters() { System.out.println("\nListing Clusters"); // [START bigtable_get_clusters] try { List<Cluster> clusters = adminClient.listClusters(instanceId); for (Cluster cluster : clusters) { System.out.println(cluster.getId()); } } catch (NotFoundException e) { System.err.println("Failed to list clusters from a non-existent instance: " + e.getMessage()); } // [END bigtable_get_clusters] }
[ "public", "void", "listClusters", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"\\nListing Clusters\"", ")", ";", "// [START bigtable_get_clusters]", "try", "{", "List", "<", "Cluster", ">", "clusters", "=", "adminClient", ".", "listClusters", "(", "instanceId", ")", ";", "for", "(", "Cluster", "cluster", ":", "clusters", ")", "{", "System", ".", "out", ".", "println", "(", "cluster", ".", "getId", "(", ")", ")", ";", "}", "}", "catch", "(", "NotFoundException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Failed to list clusters from a non-existent instance: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "// [END bigtable_get_clusters]", "}" ]
Demonstrates how to list clusters within an instance.
[ "Demonstrates", "how", "to", "list", "clusters", "within", "an", "instance", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java#L160-L172
12,377
googleapis/google-cloud-java
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java
InstanceAdminExample.deleteInstance
public void deleteInstance() { System.out.println("\nDeleting Instance"); // [START bigtable_delete_instance] try { adminClient.deleteInstance(instanceId); System.out.println("Instance deleted: " + instanceId); } catch (NotFoundException e) { System.err.println("Failed to delete non-existent instance: " + e.getMessage()); } // [END bigtable_delete_instance] }
java
public void deleteInstance() { System.out.println("\nDeleting Instance"); // [START bigtable_delete_instance] try { adminClient.deleteInstance(instanceId); System.out.println("Instance deleted: " + instanceId); } catch (NotFoundException e) { System.err.println("Failed to delete non-existent instance: " + e.getMessage()); } // [END bigtable_delete_instance] }
[ "public", "void", "deleteInstance", "(", ")", "{", "System", ".", "out", ".", "println", "(", "\"\\nDeleting Instance\"", ")", ";", "// [START bigtable_delete_instance]", "try", "{", "adminClient", ".", "deleteInstance", "(", "instanceId", ")", ";", "System", ".", "out", ".", "println", "(", "\"Instance deleted: \"", "+", "instanceId", ")", ";", "}", "catch", "(", "NotFoundException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Failed to delete non-existent instance: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "// [END bigtable_delete_instance]", "}" ]
Demonstrates how to delete an instance.
[ "Demonstrates", "how", "to", "delete", "an", "instance", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java#L175-L185
12,378
googleapis/google-cloud-java
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java
InstanceAdminExample.addCluster
public void addCluster() { System.out.printf("%nAdding cluster: %s to instance: %s%n", CLUSTER, instanceId); // [START bigtable_create_cluster] try { adminClient.createCluster( CreateClusterRequest.of(instanceId, CLUSTER) .setZone("us-central1-c") .setServeNodes(3) .setStorageType(StorageType.SSD)); System.out.printf("Cluster: %s created successfully%n", CLUSTER); } catch (AlreadyExistsException e) { System.err.println("Failed to add cluster, already exists: " + e.getMessage()); } // [END bigtable_create_cluster] }
java
public void addCluster() { System.out.printf("%nAdding cluster: %s to instance: %s%n", CLUSTER, instanceId); // [START bigtable_create_cluster] try { adminClient.createCluster( CreateClusterRequest.of(instanceId, CLUSTER) .setZone("us-central1-c") .setServeNodes(3) .setStorageType(StorageType.SSD)); System.out.printf("Cluster: %s created successfully%n", CLUSTER); } catch (AlreadyExistsException e) { System.err.println("Failed to add cluster, already exists: " + e.getMessage()); } // [END bigtable_create_cluster] }
[ "public", "void", "addCluster", "(", ")", "{", "System", ".", "out", ".", "printf", "(", "\"%nAdding cluster: %s to instance: %s%n\"", ",", "CLUSTER", ",", "instanceId", ")", ";", "// [START bigtable_create_cluster]", "try", "{", "adminClient", ".", "createCluster", "(", "CreateClusterRequest", ".", "of", "(", "instanceId", ",", "CLUSTER", ")", ".", "setZone", "(", "\"us-central1-c\"", ")", ".", "setServeNodes", "(", "3", ")", ".", "setStorageType", "(", "StorageType", ".", "SSD", ")", ")", ";", "System", ".", "out", ".", "printf", "(", "\"Cluster: %s created successfully%n\"", ",", "CLUSTER", ")", ";", "}", "catch", "(", "AlreadyExistsException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Failed to add cluster, already exists: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "// [END bigtable_create_cluster]", "}" ]
Demonstrates how to add a cluster to an instance.
[ "Demonstrates", "how", "to", "add", "a", "cluster", "to", "an", "instance", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java#L188-L202
12,379
googleapis/google-cloud-java
google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java
InstanceAdminExample.deleteCluster
public void deleteCluster() { System.out.printf("%nDeleting cluster: %s from instance: %s%n", CLUSTER, instanceId); // [START bigtable_delete_cluster] try { adminClient.deleteCluster(instanceId, CLUSTER); System.out.printf("Cluster: %s deleted successfully%n", CLUSTER); } catch (NotFoundException e) { System.err.println("Failed to delete a non-existent cluster: " + e.getMessage()); } // [END bigtable_delete_cluster] }
java
public void deleteCluster() { System.out.printf("%nDeleting cluster: %s from instance: %s%n", CLUSTER, instanceId); // [START bigtable_delete_cluster] try { adminClient.deleteCluster(instanceId, CLUSTER); System.out.printf("Cluster: %s deleted successfully%n", CLUSTER); } catch (NotFoundException e) { System.err.println("Failed to delete a non-existent cluster: " + e.getMessage()); } // [END bigtable_delete_cluster] }
[ "public", "void", "deleteCluster", "(", ")", "{", "System", ".", "out", ".", "printf", "(", "\"%nDeleting cluster: %s from instance: %s%n\"", ",", "CLUSTER", ",", "instanceId", ")", ";", "// [START bigtable_delete_cluster]", "try", "{", "adminClient", ".", "deleteCluster", "(", "instanceId", ",", "CLUSTER", ")", ";", "System", ".", "out", ".", "printf", "(", "\"Cluster: %s deleted successfully%n\"", ",", "CLUSTER", ")", ";", "}", "catch", "(", "NotFoundException", "e", ")", "{", "System", ".", "err", ".", "println", "(", "\"Failed to delete a non-existent cluster: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "// [END bigtable_delete_cluster]", "}" ]
Demonstrates how to delete a cluster from an instance.
[ "Demonstrates", "how", "to", "delete", "a", "cluster", "from", "an", "instance", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-examples/src/main/java/com/google/cloud/examples/bigtable/InstanceAdminExample.java#L205-L215
12,380
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java
Disk.createSnapshot
public Operation createSnapshot(String snapshot, OperationOption... options) { return compute.create(SnapshotInfo.of(SnapshotId.of(snapshot), getDiskId()), options); }
java
public Operation createSnapshot(String snapshot, OperationOption... options) { return compute.create(SnapshotInfo.of(SnapshotId.of(snapshot), getDiskId()), options); }
[ "public", "Operation", "createSnapshot", "(", "String", "snapshot", ",", "OperationOption", "...", "options", ")", "{", "return", "compute", ".", "create", "(", "SnapshotInfo", ".", "of", "(", "SnapshotId", ".", "of", "(", "snapshot", ")", ",", "getDiskId", "(", ")", ")", ",", "options", ")", ";", "}" ]
Creates a snapshot for this disk given the snapshot's name. @return a zone operation for snapshot creation @throws ComputeException upon failure
[ "Creates", "a", "snapshot", "for", "this", "disk", "given", "the", "snapshot", "s", "name", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java#L169-L171
12,381
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java
Disk.createSnapshot
public Operation createSnapshot(String snapshot, String description, OperationOption... options) { SnapshotInfo snapshotInfo = SnapshotInfo.newBuilder(SnapshotId.of(snapshot), getDiskId()) .setDescription(description) .build(); return compute.create(snapshotInfo, options); }
java
public Operation createSnapshot(String snapshot, String description, OperationOption... options) { SnapshotInfo snapshotInfo = SnapshotInfo.newBuilder(SnapshotId.of(snapshot), getDiskId()) .setDescription(description) .build(); return compute.create(snapshotInfo, options); }
[ "public", "Operation", "createSnapshot", "(", "String", "snapshot", ",", "String", "description", ",", "OperationOption", "...", "options", ")", "{", "SnapshotInfo", "snapshotInfo", "=", "SnapshotInfo", ".", "newBuilder", "(", "SnapshotId", ".", "of", "(", "snapshot", ")", ",", "getDiskId", "(", ")", ")", ".", "setDescription", "(", "description", ")", ".", "build", "(", ")", ";", "return", "compute", ".", "create", "(", "snapshotInfo", ",", "options", ")", ";", "}" ]
Creates a snapshot for this disk given the snapshot's name and description. @return a zone operation for snapshot creation @throws ComputeException upon failure
[ "Creates", "a", "snapshot", "for", "this", "disk", "given", "the", "snapshot", "s", "name", "and", "description", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java#L179-L185
12,382
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java
Disk.createImage
public Operation createImage(String image, OperationOption... options) { ImageInfo imageInfo = ImageInfo.of(ImageId.of(image), DiskImageConfiguration.of(getDiskId())); return compute.create(imageInfo, options); }
java
public Operation createImage(String image, OperationOption... options) { ImageInfo imageInfo = ImageInfo.of(ImageId.of(image), DiskImageConfiguration.of(getDiskId())); return compute.create(imageInfo, options); }
[ "public", "Operation", "createImage", "(", "String", "image", ",", "OperationOption", "...", "options", ")", "{", "ImageInfo", "imageInfo", "=", "ImageInfo", ".", "of", "(", "ImageId", ".", "of", "(", "image", ")", ",", "DiskImageConfiguration", ".", "of", "(", "getDiskId", "(", ")", ")", ")", ";", "return", "compute", ".", "create", "(", "imageInfo", ",", "options", ")", ";", "}" ]
Creates an image for this disk given the image's name. @return a global operation if the image creation was successfully requested @throws ComputeException upon failure
[ "Creates", "an", "image", "for", "this", "disk", "given", "the", "image", "s", "name", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java#L193-L196
12,383
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java
Disk.createImage
public Operation createImage(String image, String description, OperationOption... options) { ImageInfo imageInfo = ImageInfo.newBuilder(ImageId.of(image), DiskImageConfiguration.of(getDiskId())) .setDescription(description) .build(); return compute.create(imageInfo, options); }
java
public Operation createImage(String image, String description, OperationOption... options) { ImageInfo imageInfo = ImageInfo.newBuilder(ImageId.of(image), DiskImageConfiguration.of(getDiskId())) .setDescription(description) .build(); return compute.create(imageInfo, options); }
[ "public", "Operation", "createImage", "(", "String", "image", ",", "String", "description", ",", "OperationOption", "...", "options", ")", "{", "ImageInfo", "imageInfo", "=", "ImageInfo", ".", "newBuilder", "(", "ImageId", ".", "of", "(", "image", ")", ",", "DiskImageConfiguration", ".", "of", "(", "getDiskId", "(", ")", ")", ")", ".", "setDescription", "(", "description", ")", ".", "build", "(", ")", ";", "return", "compute", ".", "create", "(", "imageInfo", ",", "options", ")", ";", "}" ]
Creates an image for this disk given the image's name and description. @return a global operation if the image creation was successfully requested @throws ComputeException upon failure
[ "Creates", "an", "image", "for", "this", "disk", "given", "the", "image", "s", "name", "and", "description", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java#L204-L210
12,384
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java
Disk.resize
public Operation resize(long sizeGb, OperationOption... options) { return compute.resize(getDiskId(), sizeGb, options); }
java
public Operation resize(long sizeGb, OperationOption... options) { return compute.resize(getDiskId(), sizeGb, options); }
[ "public", "Operation", "resize", "(", "long", "sizeGb", ",", "OperationOption", "...", "options", ")", "{", "return", "compute", ".", "resize", "(", "getDiskId", "(", ")", ",", "sizeGb", ",", "options", ")", ";", "}" ]
Resizes this disk to the requested size. The new size must be larger than the previous one. @return a zone operation if the resize request was issued correctly, {@code null} if this disk was not found @throws ComputeException upon failure or if the new disk size is smaller than the previous one
[ "Resizes", "this", "disk", "to", "the", "requested", "size", ".", "The", "new", "size", "must", "be", "larger", "than", "the", "previous", "one", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Disk.java#L219-L221
12,385
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java
LoadJobConfiguration.newBuilder
public static Builder newBuilder(TableId destinationTable, List<String> sourceUris) { return new Builder().setDestinationTable(destinationTable).setSourceUris(sourceUris); }
java
public static Builder newBuilder(TableId destinationTable, List<String> sourceUris) { return new Builder().setDestinationTable(destinationTable).setSourceUris(sourceUris); }
[ "public", "static", "Builder", "newBuilder", "(", "TableId", "destinationTable", ",", "List", "<", "String", ">", "sourceUris", ")", "{", "return", "new", "Builder", "(", ")", ".", "setDestinationTable", "(", "destinationTable", ")", ".", "setSourceUris", "(", "sourceUris", ")", ";", "}" ]
Creates a builder for a BigQuery Load Job configuration given the destination table and source URIs.
[ "Creates", "a", "builder", "for", "a", "BigQuery", "Load", "Job", "configuration", "given", "the", "destination", "table", "and", "source", "URIs", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java#L493-L495
12,386
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java
LoadJobConfiguration.newBuilder
public static Builder newBuilder( TableId destinationTable, List<String> sourceUris, FormatOptions format) { return newBuilder(destinationTable, sourceUris).setFormatOptions(format); }
java
public static Builder newBuilder( TableId destinationTable, List<String> sourceUris, FormatOptions format) { return newBuilder(destinationTable, sourceUris).setFormatOptions(format); }
[ "public", "static", "Builder", "newBuilder", "(", "TableId", "destinationTable", ",", "List", "<", "String", ">", "sourceUris", ",", "FormatOptions", "format", ")", "{", "return", "newBuilder", "(", "destinationTable", ",", "sourceUris", ")", ".", "setFormatOptions", "(", "format", ")", ";", "}" ]
Creates a builder for a BigQuery Load Job configuration given the destination table, format and source URIs.
[ "Creates", "a", "builder", "for", "a", "BigQuery", "Load", "Job", "configuration", "given", "the", "destination", "table", "format", "and", "source", "URIs", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java#L517-L520
12,387
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java
LoadJobConfiguration.newBuilder
public static Builder newBuilder( TableId destinationTable, String sourceUri, FormatOptions format) { return newBuilder(destinationTable, ImmutableList.of(sourceUri), format); }
java
public static Builder newBuilder( TableId destinationTable, String sourceUri, FormatOptions format) { return newBuilder(destinationTable, ImmutableList.of(sourceUri), format); }
[ "public", "static", "Builder", "newBuilder", "(", "TableId", "destinationTable", ",", "String", "sourceUri", ",", "FormatOptions", "format", ")", "{", "return", "newBuilder", "(", "destinationTable", ",", "ImmutableList", ".", "of", "(", "sourceUri", ")", ",", "format", ")", ";", "}" ]
Creates a builder for a BigQuery Load Job configuration given the destination table, format and source URI.
[ "Creates", "a", "builder", "for", "a", "BigQuery", "Load", "Job", "configuration", "given", "the", "destination", "table", "format", "and", "source", "URI", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java#L526-L529
12,388
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java
LoadJobConfiguration.of
public static LoadJobConfiguration of(TableId destinationTable, List<String> sourceUris) { return newBuilder(destinationTable, sourceUris).build(); }
java
public static LoadJobConfiguration of(TableId destinationTable, List<String> sourceUris) { return newBuilder(destinationTable, sourceUris).build(); }
[ "public", "static", "LoadJobConfiguration", "of", "(", "TableId", "destinationTable", ",", "List", "<", "String", ">", "sourceUris", ")", "{", "return", "newBuilder", "(", "destinationTable", ",", "sourceUris", ")", ".", "build", "(", ")", ";", "}" ]
Returns a BigQuery Load Job Configuration for the given destination table and source URIs.
[ "Returns", "a", "BigQuery", "Load", "Job", "Configuration", "for", "the", "given", "destination", "table", "and", "source", "URIs", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java#L532-L534
12,389
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java
LoadJobConfiguration.of
public static LoadJobConfiguration of(TableId destinationTable, String sourceUri) { return of(destinationTable, ImmutableList.of(sourceUri)); }
java
public static LoadJobConfiguration of(TableId destinationTable, String sourceUri) { return of(destinationTable, ImmutableList.of(sourceUri)); }
[ "public", "static", "LoadJobConfiguration", "of", "(", "TableId", "destinationTable", ",", "String", "sourceUri", ")", "{", "return", "of", "(", "destinationTable", ",", "ImmutableList", ".", "of", "(", "sourceUri", ")", ")", ";", "}" ]
Returns a BigQuery Load Job Configuration for the given destination table and source URI.
[ "Returns", "a", "BigQuery", "Load", "Job", "Configuration", "for", "the", "given", "destination", "table", "and", "source", "URI", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java#L537-L539
12,390
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java
LoadJobConfiguration.of
public static LoadJobConfiguration of( TableId destinationTable, String sourceUri, FormatOptions format) { return of(destinationTable, ImmutableList.of(sourceUri), format); }
java
public static LoadJobConfiguration of( TableId destinationTable, String sourceUri, FormatOptions format) { return of(destinationTable, ImmutableList.of(sourceUri), format); }
[ "public", "static", "LoadJobConfiguration", "of", "(", "TableId", "destinationTable", ",", "String", "sourceUri", ",", "FormatOptions", "format", ")", "{", "return", "of", "(", "destinationTable", ",", "ImmutableList", ".", "of", "(", "sourceUri", ")", ",", "format", ")", ";", "}" ]
Returns a BigQuery Load Job Configuration for the given destination table, format and source URI.
[ "Returns", "a", "BigQuery", "Load", "Job", "Configuration", "for", "the", "given", "destination", "table", "format", "and", "source", "URI", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java#L554-L557
12,391
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Dataset.java
Dataset.create
public Table create(String tableId, TableDefinition definition, TableOption... options) { TableInfo tableInfo = TableInfo.of(TableId.of(getDatasetId().getDataset(), tableId), definition); return bigquery.create(tableInfo, options); }
java
public Table create(String tableId, TableDefinition definition, TableOption... options) { TableInfo tableInfo = TableInfo.of(TableId.of(getDatasetId().getDataset(), tableId), definition); return bigquery.create(tableInfo, options); }
[ "public", "Table", "create", "(", "String", "tableId", ",", "TableDefinition", "definition", ",", "TableOption", "...", "options", ")", "{", "TableInfo", "tableInfo", "=", "TableInfo", ".", "of", "(", "TableId", ".", "of", "(", "getDatasetId", "(", ")", ".", "getDataset", "(", ")", ",", "tableId", ")", ",", "definition", ")", ";", "return", "bigquery", ".", "create", "(", "tableInfo", ",", "options", ")", ";", "}" ]
Creates a new table in this dataset. <p>Example of creating a table in the dataset with schema and time partitioning. <pre>{@code String tableName = “my_table”; String fieldName = “my_field”; Schema schema = Schema.of(Field.of(fieldName, LegacySQLTypeName.STRING)); StandardTableDefinition definition = StandardTableDefinition.newBuilder() .setSchema(schema) .setTimePartitioning(TimePartitioning.of(TimePartitioning.Type.DAY)) .build(); Table table = dataset.create(tableName, definition); }</pre> @param tableId the table's user-defined id @param definition the table's definition @param options options for table creation @return a {@code Table} object for the created table @throws BigQueryException upon failure
[ "Creates", "a", "new", "table", "in", "this", "dataset", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Dataset.java#L290-L294
12,392
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Transaction.java
Transaction.begin
ApiFuture<Void> begin() { BeginTransactionRequest.Builder beginTransaction = BeginTransactionRequest.newBuilder(); beginTransaction.setDatabase(firestore.getDatabaseName()); if (previousTransactionId != null) { beginTransaction .getOptionsBuilder() .getReadWriteBuilder() .setRetryTransaction(previousTransactionId); } ApiFuture<BeginTransactionResponse> transactionBeginFuture = firestore.sendRequest( beginTransaction.build(), firestore.getClient().beginTransactionCallable()); return ApiFutures.transform( transactionBeginFuture, new ApiFunction<BeginTransactionResponse, Void>() { @Override public Void apply(BeginTransactionResponse beginTransactionResponse) { transactionId = beginTransactionResponse.getTransaction(); pending = true; return null; } }); }
java
ApiFuture<Void> begin() { BeginTransactionRequest.Builder beginTransaction = BeginTransactionRequest.newBuilder(); beginTransaction.setDatabase(firestore.getDatabaseName()); if (previousTransactionId != null) { beginTransaction .getOptionsBuilder() .getReadWriteBuilder() .setRetryTransaction(previousTransactionId); } ApiFuture<BeginTransactionResponse> transactionBeginFuture = firestore.sendRequest( beginTransaction.build(), firestore.getClient().beginTransactionCallable()); return ApiFutures.transform( transactionBeginFuture, new ApiFunction<BeginTransactionResponse, Void>() { @Override public Void apply(BeginTransactionResponse beginTransactionResponse) { transactionId = beginTransactionResponse.getTransaction(); pending = true; return null; } }); }
[ "ApiFuture", "<", "Void", ">", "begin", "(", ")", "{", "BeginTransactionRequest", ".", "Builder", "beginTransaction", "=", "BeginTransactionRequest", ".", "newBuilder", "(", ")", ";", "beginTransaction", ".", "setDatabase", "(", "firestore", ".", "getDatabaseName", "(", ")", ")", ";", "if", "(", "previousTransactionId", "!=", "null", ")", "{", "beginTransaction", ".", "getOptionsBuilder", "(", ")", ".", "getReadWriteBuilder", "(", ")", ".", "setRetryTransaction", "(", "previousTransactionId", ")", ";", "}", "ApiFuture", "<", "BeginTransactionResponse", ">", "transactionBeginFuture", "=", "firestore", ".", "sendRequest", "(", "beginTransaction", ".", "build", "(", ")", ",", "firestore", ".", "getClient", "(", ")", ".", "beginTransactionCallable", "(", ")", ")", ";", "return", "ApiFutures", ".", "transform", "(", "transactionBeginFuture", ",", "new", "ApiFunction", "<", "BeginTransactionResponse", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "apply", "(", "BeginTransactionResponse", "beginTransactionResponse", ")", "{", "transactionId", "=", "beginTransactionResponse", ".", "getTransaction", "(", ")", ";", "pending", "=", "true", ";", "return", "null", ";", "}", "}", ")", ";", "}" ]
Starts a transaction and obtains the transaction id from the server.
[ "Starts", "a", "transaction", "and", "obtains", "the", "transaction", "id", "from", "the", "server", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Transaction.java#L72-L97
12,393
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Transaction.java
Transaction.rollback
ApiFuture<Void> rollback() { pending = false; RollbackRequest.Builder reqBuilder = RollbackRequest.newBuilder(); reqBuilder.setTransaction(transactionId); reqBuilder.setDatabase(firestore.getDatabaseName()); ApiFuture<Empty> rollbackFuture = firestore.sendRequest(reqBuilder.build(), firestore.getClient().rollbackCallable()); return ApiFutures.transform( rollbackFuture, new ApiFunction<Empty, Void>() { @Override public Void apply(Empty beginTransactionResponse) { return null; } }); }
java
ApiFuture<Void> rollback() { pending = false; RollbackRequest.Builder reqBuilder = RollbackRequest.newBuilder(); reqBuilder.setTransaction(transactionId); reqBuilder.setDatabase(firestore.getDatabaseName()); ApiFuture<Empty> rollbackFuture = firestore.sendRequest(reqBuilder.build(), firestore.getClient().rollbackCallable()); return ApiFutures.transform( rollbackFuture, new ApiFunction<Empty, Void>() { @Override public Void apply(Empty beginTransactionResponse) { return null; } }); }
[ "ApiFuture", "<", "Void", ">", "rollback", "(", ")", "{", "pending", "=", "false", ";", "RollbackRequest", ".", "Builder", "reqBuilder", "=", "RollbackRequest", ".", "newBuilder", "(", ")", ";", "reqBuilder", ".", "setTransaction", "(", "transactionId", ")", ";", "reqBuilder", ".", "setDatabase", "(", "firestore", ".", "getDatabaseName", "(", ")", ")", ";", "ApiFuture", "<", "Empty", ">", "rollbackFuture", "=", "firestore", ".", "sendRequest", "(", "reqBuilder", ".", "build", "(", ")", ",", "firestore", ".", "getClient", "(", ")", ".", "rollbackCallable", "(", ")", ")", ";", "return", "ApiFutures", ".", "transform", "(", "rollbackFuture", ",", "new", "ApiFunction", "<", "Empty", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "apply", "(", "Empty", "beginTransactionResponse", ")", "{", "return", "null", ";", "}", "}", ")", ";", "}" ]
Rolls a transaction back and releases all read locks.
[ "Rolls", "a", "transaction", "back", "and", "releases", "all", "read", "locks", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Transaction.java#L106-L124
12,394
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquerydatatransfer/src/main/java/com/google/cloud/bigquery/datatransfer/v1/DataTransferServiceClient.java
DataTransferServiceClient.updateTransferConfig
public final TransferConfig updateTransferConfig( TransferConfig transferConfig, FieldMask updateMask) { UpdateTransferConfigRequest request = UpdateTransferConfigRequest.newBuilder() .setTransferConfig(transferConfig) .setUpdateMask(updateMask) .build(); return updateTransferConfig(request); }
java
public final TransferConfig updateTransferConfig( TransferConfig transferConfig, FieldMask updateMask) { UpdateTransferConfigRequest request = UpdateTransferConfigRequest.newBuilder() .setTransferConfig(transferConfig) .setUpdateMask(updateMask) .build(); return updateTransferConfig(request); }
[ "public", "final", "TransferConfig", "updateTransferConfig", "(", "TransferConfig", "transferConfig", ",", "FieldMask", "updateMask", ")", "{", "UpdateTransferConfigRequest", "request", "=", "UpdateTransferConfigRequest", ".", "newBuilder", "(", ")", ".", "setTransferConfig", "(", "transferConfig", ")", ".", "setUpdateMask", "(", "updateMask", ")", ".", "build", "(", ")", ";", "return", "updateTransferConfig", "(", "request", ")", ";", "}" ]
Updates a data transfer configuration. All fields must be set, even if they are not updated. <p>Sample code: <pre><code> try (DataTransferServiceClient dataTransferServiceClient = DataTransferServiceClient.create()) { TransferConfig transferConfig = TransferConfig.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); TransferConfig response = dataTransferServiceClient.updateTransferConfig(transferConfig, updateMask); } </code></pre> @param transferConfig Data transfer configuration to create. @param updateMask Required list of fields to be updated in this request. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "a", "data", "transfer", "configuration", ".", "All", "fields", "must", "be", "set", "even", "if", "they", "are", "not", "updated", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquerydatatransfer/src/main/java/com/google/cloud/bigquery/datatransfer/v1/DataTransferServiceClient.java#L516-L525
12,395
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/readrows/StateMachine.java
StateMachine.handleLastScannedRow
void handleLastScannedRow(ByteString key) { try { currentState = currentState.handleLastScannedRow(key); } catch (RuntimeException e) { currentState = null; throw e; } }
java
void handleLastScannedRow(ByteString key) { try { currentState = currentState.handleLastScannedRow(key); } catch (RuntimeException e) { currentState = null; throw e; } }
[ "void", "handleLastScannedRow", "(", "ByteString", "key", ")", "{", "try", "{", "currentState", "=", "currentState", ".", "handleLastScannedRow", "(", "key", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "currentState", "=", "null", ";", "throw", "e", ";", "}", "}" ]
Handle last scanned row events from the server. <p>The server might return the row key of the last row it has scanned. The client can use this to construct a more efficient retry request if needed: any row keys or portions of ranges less than this row key can be dropped from the request. The retry logic is implemented downstream from the logical rows produced by this class. To communicate this information to the retry logic, the state machine will encode the last scanned keys as scan marker rows using {@link RowBuilder#createScanMarkerRow(ByteString)}. It is the responsibility of the retry logic to filter out these marker before delivering the results to the user. <p>The scan marker must be immediately consumed before any more events are processed. <dl> <dt>Valid states: <dd>{@link StateMachine#AWAITING_NEW_ROW} <dt>Resulting states: <dd>{@link StateMachine#AWAITING_ROW_CONSUME} </dl>
[ "Handle", "last", "scanned", "row", "events", "from", "the", "server", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/readrows/StateMachine.java#L121-L128
12,396
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/readrows/StateMachine.java
StateMachine.handleChunk
void handleChunk(CellChunk chunk) { try { currentState = currentState.handleChunk(chunk); } catch (RuntimeException e) { currentState = null; throw e; } }
java
void handleChunk(CellChunk chunk) { try { currentState = currentState.handleChunk(chunk); } catch (RuntimeException e) { currentState = null; throw e; } }
[ "void", "handleChunk", "(", "CellChunk", "chunk", ")", "{", "try", "{", "currentState", "=", "currentState", ".", "handleChunk", "(", "chunk", ")", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "currentState", "=", "null", ";", "throw", "e", ";", "}", "}" ]
Feeds a new chunk into the sate machine. If the chunk is invalid, the state machine will throw an exception and should not be used for further input. <dl> <dt>Valid states: <dd>{@link StateMachine#AWAITING_NEW_ROW} <dd>{@link StateMachine#AWAITING_NEW_CELL} <dd>{@link StateMachine#AWAITING_CELL_VALUE} <dt>Resulting states: <dd>{@link StateMachine#AWAITING_NEW_CELL} <dd>{@link StateMachine#AWAITING_CELL_VALUE} <dd>{@link StateMachine#AWAITING_ROW_CONSUME} </dl> @param chunk The new chunk to process. @throws InvalidInputException When the chunk is not applicable to the current state. @throws IllegalStateException When the internal state is inconsistent
[ "Feeds", "a", "new", "chunk", "into", "the", "sate", "machine", ".", "If", "the", "chunk", "is", "invalid", "the", "state", "machine", "will", "throw", "an", "exception", "and", "should", "not", "be", "used", "for", "further", "input", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/readrows/StateMachine.java#L149-L156
12,397
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/readrows/StateMachine.java
StateMachine.consumeRow
RowT consumeRow() { Preconditions.checkState(currentState == AWAITING_ROW_CONSUME, "No row to consume"); RowT row = completeRow; reset(); return row; }
java
RowT consumeRow() { Preconditions.checkState(currentState == AWAITING_ROW_CONSUME, "No row to consume"); RowT row = completeRow; reset(); return row; }
[ "RowT", "consumeRow", "(", ")", "{", "Preconditions", ".", "checkState", "(", "currentState", "==", "AWAITING_ROW_CONSUME", ",", "\"No row to consume\"", ")", ";", "RowT", "row", "=", "completeRow", ";", "reset", "(", ")", ";", "return", "row", ";", "}" ]
Returns the last completed row and transitions to awaiting a new row. @return The last completed row. @throws IllegalStateException If the last chunk did not complete a row.
[ "Returns", "the", "last", "completed", "row", "and", "transitions", "to", "awaiting", "a", "new", "row", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/data/v2/stub/readrows/StateMachine.java#L164-L169
12,398
googleapis/google-cloud-java
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
DataLabelingServiceClient.formatAnnotatedDatasetName
@Deprecated public static final String formatAnnotatedDatasetName( String project, String dataset, String annotatedDataset) { return ANNOTATED_DATASET_PATH_TEMPLATE.instantiate( "project", project, "dataset", dataset, "annotated_dataset", annotatedDataset); }
java
@Deprecated public static final String formatAnnotatedDatasetName( String project, String dataset, String annotatedDataset) { return ANNOTATED_DATASET_PATH_TEMPLATE.instantiate( "project", project, "dataset", dataset, "annotated_dataset", annotatedDataset); }
[ "@", "Deprecated", "public", "static", "final", "String", "formatAnnotatedDatasetName", "(", "String", "project", ",", "String", "dataset", ",", "String", "annotatedDataset", ")", "{", "return", "ANNOTATED_DATASET_PATH_TEMPLATE", ".", "instantiate", "(", "\"project\"", ",", "project", ",", "\"dataset\"", ",", "dataset", ",", "\"annotated_dataset\"", ",", "annotatedDataset", ")", ";", "}" ]
Formats a string containing the fully-qualified path to represent a annotated_dataset resource. @deprecated Use the {@link AnnotatedDatasetName} class instead.
[ "Formats", "a", "string", "containing", "the", "fully", "-", "qualified", "path", "to", "represent", "a", "annotated_dataset", "resource", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L147-L154
12,399
googleapis/google-cloud-java
google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java
DataLabelingServiceClient.formatAnnotationSpecSetName
@Deprecated public static final String formatAnnotationSpecSetName(String project, String annotationSpecSet) { return ANNOTATION_SPEC_SET_PATH_TEMPLATE.instantiate( "project", project, "annotation_spec_set", annotationSpecSet); }
java
@Deprecated public static final String formatAnnotationSpecSetName(String project, String annotationSpecSet) { return ANNOTATION_SPEC_SET_PATH_TEMPLATE.instantiate( "project", project, "annotation_spec_set", annotationSpecSet); }
[ "@", "Deprecated", "public", "static", "final", "String", "formatAnnotationSpecSetName", "(", "String", "project", ",", "String", "annotationSpecSet", ")", "{", "return", "ANNOTATION_SPEC_SET_PATH_TEMPLATE", ".", "instantiate", "(", "\"project\"", ",", "project", ",", "\"annotation_spec_set\"", ",", "annotationSpecSet", ")", ";", "}" ]
Formats a string containing the fully-qualified path to represent a annotation_spec_set resource. @deprecated Use the {@link AnnotationSpecSetName} class instead.
[ "Formats", "a", "string", "containing", "the", "fully", "-", "qualified", "path", "to", "represent", "a", "annotation_spec_set", "resource", "." ]
d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-datalabeling/src/main/java/com/google/cloud/datalabeling/v1beta1/DataLabelingServiceClient.java#L162-L167