repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
johnlcox/motif | motif/src/main/java/com/leacox/motif/matching/FluentMatchingR.java | FluentMatchingR.getMatch | public R getMatch() {
for (Pattern<T, R> pattern : patterns) {
if (pattern.matches(value)) {
return pattern.apply(value);
}
}
throw new MatchException("No match found for " + value);
} | java | public R getMatch() {
for (Pattern<T, R> pattern : patterns) {
if (pattern.matches(value)) {
return pattern.apply(value);
}
}
throw new MatchException("No match found for " + value);
} | [
"public",
"R",
"getMatch",
"(",
")",
"{",
"for",
"(",
"Pattern",
"<",
"T",
",",
"R",
">",
"pattern",
":",
"patterns",
")",
"{",
"if",
"(",
"pattern",
".",
"matches",
"(",
"value",
")",
")",
"{",
"return",
"pattern",
".",
"apply",
"(",
"value",
")... | Runs through the possible matches and executes the specified action of the first match and
returns the result.
@throws MatchException if no match is found. | [
"Runs",
"through",
"the",
"possible",
"matches",
"and",
"executes",
"the",
"specified",
"action",
"of",
"the",
"first",
"match",
"and",
"returns",
"the",
"result",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/motif/src/main/java/com/leacox/motif/matching/FluentMatchingR.java#L115-L123 | train |
opentelecoms-org/zrtp-java | src/zorg/platform/blackberry/BBRandomGenerator.java | BBRandomGenerator.seedUsingPcmAudio | public void seedUsingPcmAudio(byte[] data) {
byte[] key = new byte[64];
for (int i = 0; i < key.length; i++) {
int x = 0;
//Pick 4 random bytes from the PCM audio data, from each of the bytes
//take the two least significant bits and concatenate them to form
... | java | public void seedUsingPcmAudio(byte[] data) {
byte[] key = new byte[64];
for (int i = 0; i < key.length; i++) {
int x = 0;
//Pick 4 random bytes from the PCM audio data, from each of the bytes
//take the two least significant bits and concatenate them to form
... | [
"public",
"void",
"seedUsingPcmAudio",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"byte",
"[",
"]",
"key",
"=",
"new",
"byte",
"[",
"64",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"key",
".",
"length",
";",
"i",
"++",
")",
"{",... | Seed the random generator with 2 least significant bits of randomly picked
bytes within the provided PCM audio data
@param data PCM audio data | [
"Seed",
"the",
"random",
"generator",
"with",
"2",
"least",
"significant",
"bits",
"of",
"randomly",
"picked",
"bytes",
"within",
"the",
"provided",
"PCM",
"audio",
"data"
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/platform/blackberry/BBRandomGenerator.java#L63-L77 | train |
opentelecoms-org/zrtp-java | src/zorg/platform/blackberry/BBRandomGenerator.java | BBRandomGenerator.getInt | public int getInt() {
try {
byte[] rand = fipsGenerator.getBytes(4);
int result = rand[0];
for (int i = 1; i < 4; i++) {
result = (result << 8) | rand[i];
}
return result;
} catch (Throwable ex) {
BBPlatform.getPlatform... | java | public int getInt() {
try {
byte[] rand = fipsGenerator.getBytes(4);
int result = rand[0];
for (int i = 1; i < 4; i++) {
result = (result << 8) | rand[i];
}
return result;
} catch (Throwable ex) {
BBPlatform.getPlatform... | [
"public",
"int",
"getInt",
"(",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"rand",
"=",
"fipsGenerator",
".",
"getBytes",
"(",
"4",
")",
";",
"int",
"result",
"=",
"rand",
"[",
"0",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"4",... | Returns a random integer
@return A random value of type int | [
"Returns",
"a",
"random",
"integer"
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/platform/blackberry/BBRandomGenerator.java#L94-L106 | train |
opentelecoms-org/zrtp-java | src/zorg/platform/blackberry/BBRandomGenerator.java | BBRandomGenerator.getBytes | public void getBytes(byte[] buffer) {
try {
fipsGenerator.getBytes(buffer);
} catch (Throwable ex) {
BBPlatform.getPlatform().getLogger().logException("RandomGenerator.getBytes() Falling back to RandomSource... " + ex.getMessage());
RandomSource.getBytes(buffer);
... | java | public void getBytes(byte[] buffer) {
try {
fipsGenerator.getBytes(buffer);
} catch (Throwable ex) {
BBPlatform.getPlatform().getLogger().logException("RandomGenerator.getBytes() Falling back to RandomSource... " + ex.getMessage());
RandomSource.getBytes(buffer);
... | [
"public",
"void",
"getBytes",
"(",
"byte",
"[",
"]",
"buffer",
")",
"{",
"try",
"{",
"fipsGenerator",
".",
"getBytes",
"(",
"buffer",
")",
";",
"}",
"catch",
"(",
"Throwable",
"ex",
")",
"{",
"BBPlatform",
".",
"getPlatform",
"(",
")",
".",
"getLogger"... | Generates random bytes filling the given buffer entirely
@param buffer The byte array to fill with random bytes | [
"Generates",
"random",
"bytes",
"filling",
"the",
"given",
"buffer",
"entirely"
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/platform/blackberry/BBRandomGenerator.java#L113-L120 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Path.java | Path.checkBuf | protected void checkBuf (int pointCount, boolean checkMove) {
if (checkMove && typeSize == 0) {
throw new IllegalPathStateException("First segment must be a SEG_MOVETO");
}
if (typeSize == types.length) {
byte[] tmp = new byte[typeSize + BUFFER_CAPACITY];
Syst... | java | protected void checkBuf (int pointCount, boolean checkMove) {
if (checkMove && typeSize == 0) {
throw new IllegalPathStateException("First segment must be a SEG_MOVETO");
}
if (typeSize == types.length) {
byte[] tmp = new byte[typeSize + BUFFER_CAPACITY];
Syst... | [
"protected",
"void",
"checkBuf",
"(",
"int",
"pointCount",
",",
"boolean",
"checkMove",
")",
"{",
"if",
"(",
"checkMove",
"&&",
"typeSize",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalPathStateException",
"(",
"\"First segment must be a SEG_MOVETO\"",
")",
";",
... | Checks points and types buffer size to add pointCount points. If necessary realloc buffers
to enlarge size.
@param pointCount the point count to be added in buffer | [
"Checks",
"points",
"and",
"types",
"buffer",
"size",
"to",
"add",
"pointCount",
"points",
".",
"If",
"necessary",
"realloc",
"buffers",
"to",
"enlarge",
"size",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Path.java#L264-L278 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Path.java | Path.isInside | protected boolean isInside (int cross) {
return (rule == WIND_NON_ZERO) ? Crossing.isInsideNonZero(cross) :
Crossing.isInsideEvenOdd(cross);
} | java | protected boolean isInside (int cross) {
return (rule == WIND_NON_ZERO) ? Crossing.isInsideNonZero(cross) :
Crossing.isInsideEvenOdd(cross);
} | [
"protected",
"boolean",
"isInside",
"(",
"int",
"cross",
")",
"{",
"return",
"(",
"rule",
"==",
"WIND_NON_ZERO",
")",
"?",
"Crossing",
".",
"isInsideNonZero",
"(",
"cross",
")",
":",
"Crossing",
".",
"isInsideEvenOdd",
"(",
"cross",
")",
";",
"}"
] | Checks cross count according to path rule to define is it point inside shape or not.
@param cross the point cross count.
@return true if point is inside path, or false otherwise. | [
"Checks",
"cross",
"count",
"according",
"to",
"path",
"rule",
"to",
"define",
"is",
"it",
"point",
"inside",
"shape",
"or",
"not",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Path.java#L286-L289 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/GeometryUtil.java | GeometryUtil.subQuad | public static void subQuad (double[] coef, double t0, boolean left) {
if (left) {
coef[2] = (1 - t0) * coef[0] + t0 * coef[2];
coef[3] = (1 - t0) * coef[1] + t0 * coef[3];
} else {
coef[2] = (1 - t0) * coef[2] + t0 * coef[4];
coef[3] = (1 - t0) * coef[3] +... | java | public static void subQuad (double[] coef, double t0, boolean left) {
if (left) {
coef[2] = (1 - t0) * coef[0] + t0 * coef[2];
coef[3] = (1 - t0) * coef[1] + t0 * coef[3];
} else {
coef[2] = (1 - t0) * coef[2] + t0 * coef[4];
coef[3] = (1 - t0) * coef[3] +... | [
"public",
"static",
"void",
"subQuad",
"(",
"double",
"[",
"]",
"coef",
",",
"double",
"t0",
",",
"boolean",
"left",
")",
"{",
"if",
"(",
"left",
")",
"{",
"coef",
"[",
"2",
"]",
"=",
"(",
"1",
"-",
"t0",
")",
"*",
"coef",
"[",
"0",
"]",
"+",... | t0 - ? | [
"t0",
"-",
"?"
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/GeometryUtil.java#L362-L370 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/ProbeHandlerThread.java | ProbeHandlerThread.sendResponse | private boolean sendResponse(String respondToURL, String payloadType, ResponseWrapper payload) {
// This method will likely need some thought and care in the error handling
// and error reporting
// It's a had job at the moment.
String responseStr = null;
String contentType = null; // MIME type
... | java | private boolean sendResponse(String respondToURL, String payloadType, ResponseWrapper payload) {
// This method will likely need some thought and care in the error handling
// and error reporting
// It's a had job at the moment.
String responseStr = null;
String contentType = null; // MIME type
... | [
"private",
"boolean",
"sendResponse",
"(",
"String",
"respondToURL",
",",
"String",
"payloadType",
",",
"ResponseWrapper",
"payload",
")",
"{",
"// This method will likely need some thought and care in the error handling",
"// and error reporting",
"// It's a had job at the moment.",... | If the probe yields responses from the handler, then send this method will
send the responses to the given respondTo addresses.
@param respondToURL - address to send the response to
@param payloadType - JSON or XML
@param payload - the actual service records to return
@return true if the send was successful | [
"If",
"the",
"probe",
"yields",
"responses",
"from",
"the",
"handler",
"then",
"send",
"this",
"method",
"will",
"send",
"the",
"responses",
"to",
"the",
"given",
"respondTo",
"addresses",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/ProbeHandlerThread.java#L94-L170 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/ProbeHandlerThread.java | ProbeHandlerThread.run | public void run() {
ResponseWrapper response = null;
LOGGER.info("Received probe id: " + probe.getProbeId());
// Only handle probes that we haven't handled before
// The Probe Generator needs to send a stream of identical UDP packets
// to compensate for UDP reliability issues. Therefore, the Res... | java | public void run() {
ResponseWrapper response = null;
LOGGER.info("Received probe id: " + probe.getProbeId());
// Only handle probes that we haven't handled before
// The Probe Generator needs to send a stream of identical UDP packets
// to compensate for UDP reliability issues. Therefore, the Res... | [
"public",
"void",
"run",
"(",
")",
"{",
"ResponseWrapper",
"response",
"=",
"null",
";",
"LOGGER",
".",
"info",
"(",
"\"Received probe id: \"",
"+",
"probe",
".",
"getProbeId",
"(",
")",
")",
";",
"// Only handle probes that we haven't handled before",
"// The Probe... | Handle the probe. | [
"Handle",
"the",
"probe",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/ProbeHandlerThread.java#L197-L246 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Crossing.java | Crossing.fixRoots | protected static int fixRoots (float[] res, int rc) {
int tc = 0;
for (int i = 0; i < rc; i++) {
out: {
for (int j = i + 1; j < rc; j++) {
if (isZero(res[i] - res[j])) {
break out;
}
}
... | java | protected static int fixRoots (float[] res, int rc) {
int tc = 0;
for (int i = 0; i < rc; i++) {
out: {
for (int j = i + 1; j < rc; j++) {
if (isZero(res[i] - res[j])) {
break out;
}
}
... | [
"protected",
"static",
"int",
"fixRoots",
"(",
"float",
"[",
"]",
"res",
",",
"int",
"rc",
")",
"{",
"int",
"tc",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"rc",
";",
"i",
"++",
")",
"{",
"out",
":",
"{",
"for",
"(",
... | Excludes double roots. Roots are double if they lies enough close with each other.
@param res the roots
@param rc the roots count
@return new roots count | [
"Excludes",
"double",
"roots",
".",
"Roots",
"are",
"double",
"if",
"they",
"lies",
"enough",
"close",
"with",
"each",
"other",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Crossing.java#L111-L124 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Crossing.java | Crossing.intersectQuad | public static int intersectQuad (float x1, float y1, float cx, float cy, float x2,
float y2, float rx1, float ry1, float rx2, float ry2) {
// LEFT/RIGHT/UP ------------------------------------------------------
if ((rx2 < x1 && rx2 < cx && rx2 < x2) || (rx1 > x1 && r... | java | public static int intersectQuad (float x1, float y1, float cx, float cy, float x2,
float y2, float rx1, float ry1, float rx2, float ry2) {
// LEFT/RIGHT/UP ------------------------------------------------------
if ((rx2 < x1 && rx2 < cx && rx2 < x2) || (rx1 > x1 && r... | [
"public",
"static",
"int",
"intersectQuad",
"(",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"cx",
",",
"float",
"cy",
",",
"float",
"x2",
",",
"float",
"y2",
",",
"float",
"rx1",
",",
"float",
"ry1",
",",
"float",
"rx2",
",",
"float",
"ry2",
... | Returns how many times rectangle stripe cross quad curve or the are
intersect | [
"Returns",
"how",
"many",
"times",
"rectangle",
"stripe",
"cross",
"quad",
"curve",
"or",
"the",
"are",
"intersect"
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Crossing.java#L557-L621 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Crossing.java | Crossing.intersectPath | public static int intersectPath (PathIterator p, float x, float y, float w, float h) {
int cross = 0;
int count;
float mx, my, cx, cy;
mx = my = cx = cy = 0f;
float[] coords = new float[6];
float rx1 = x;
float ry1 = y;
float rx2 = x + w;
float ry... | java | public static int intersectPath (PathIterator p, float x, float y, float w, float h) {
int cross = 0;
int count;
float mx, my, cx, cy;
mx = my = cx = cy = 0f;
float[] coords = new float[6];
float rx1 = x;
float ry1 = y;
float rx2 = x + w;
float ry... | [
"public",
"static",
"int",
"intersectPath",
"(",
"PathIterator",
"p",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"w",
",",
"float",
"h",
")",
"{",
"int",
"cross",
"=",
"0",
";",
"int",
"count",
";",
"float",
"mx",
",",
"my",
",",
"cx",
"... | Returns how many times rectangle stripe cross path or the are intersect | [
"Returns",
"how",
"many",
"times",
"rectangle",
"stripe",
"cross",
"path",
"or",
"the",
"are",
"intersect"
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Crossing.java#L701-L756 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Crossing.java | Crossing.intersectShape | public static int intersectShape (IShape s, float x, float y, float w, float h) {
if (!s.bounds().intersects(x, y, w, h)) {
return 0;
}
return intersectPath(s.pathIterator(null), x, y, w, h);
} | java | public static int intersectShape (IShape s, float x, float y, float w, float h) {
if (!s.bounds().intersects(x, y, w, h)) {
return 0;
}
return intersectPath(s.pathIterator(null), x, y, w, h);
} | [
"public",
"static",
"int",
"intersectShape",
"(",
"IShape",
"s",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"w",
",",
"float",
"h",
")",
"{",
"if",
"(",
"!",
"s",
".",
"bounds",
"(",
")",
".",
"intersects",
"(",
"x",
",",
"y",
",",
"w"... | Returns how many times rectangle stripe cross shape or the are intersect | [
"Returns",
"how",
"many",
"times",
"rectangle",
"stripe",
"cross",
"shape",
"or",
"the",
"are",
"intersect"
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Crossing.java#L761-L766 | train |
di2e/Argo | CommonUtils/src/main/java/ws/argo/common/cache/ExpiringService.java | ExpiringService.isExpired | public boolean isExpired() {
if (_service.getTtl() == 0) {
return false;
}
long t = this.cacheStartTime.getTime();
Date validTime = new Date(t + (_service.getTtl() * ONE_MINUTE_IN_MILLIS));
Date now = new Date();
return (now.getTime() > validTime.getTime());
} | java | public boolean isExpired() {
if (_service.getTtl() == 0) {
return false;
}
long t = this.cacheStartTime.getTime();
Date validTime = new Date(t + (_service.getTtl() * ONE_MINUTE_IN_MILLIS));
Date now = new Date();
return (now.getTime() > validTime.getTime());
} | [
"public",
"boolean",
"isExpired",
"(",
")",
"{",
"if",
"(",
"_service",
".",
"getTtl",
"(",
")",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"long",
"t",
"=",
"this",
".",
"cacheStartTime",
".",
"getTime",
"(",
")",
";",
"Date",
"validTime",
... | Determine if the service record is expired. The service record include a
TTL that tells the client how many minutes the client can count on the
information in the service record. If the cache times out, then those
service records that have expired should be expunged from the cache.
@return true if the service record s... | [
"Determine",
"if",
"the",
"service",
"record",
"is",
"expired",
".",
"The",
"service",
"record",
"include",
"a",
"TTL",
"that",
"tells",
"the",
"client",
"how",
"many",
"minutes",
"the",
"client",
"can",
"count",
"on",
"the",
"information",
"in",
"the",
"s... | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CommonUtils/src/main/java/ws/argo/common/cache/ExpiringService.java#L56-L65 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Matrix4.java | Matrix4.setToTransform | public Matrix4 setToTransform (IVector3 translation, IQuaternion rotation) {
return setToRotation(rotation).setTranslation(translation);
} | java | public Matrix4 setToTransform (IVector3 translation, IQuaternion rotation) {
return setToRotation(rotation).setTranslation(translation);
} | [
"public",
"Matrix4",
"setToTransform",
"(",
"IVector3",
"translation",
",",
"IQuaternion",
"rotation",
")",
"{",
"return",
"setToRotation",
"(",
"rotation",
")",
".",
"setTranslation",
"(",
"translation",
")",
";",
"}"
] | Sets this to a matrix that first rotates, then translates.
@return a reference to this matrix, for chaining. | [
"Sets",
"this",
"to",
"a",
"matrix",
"that",
"first",
"rotates",
"then",
"translates",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix4.java#L103-L105 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Matrix4.java | Matrix4.setToTranslation | public Matrix4 setToTranslation (IVector3 translation) {
return setToTranslation(translation.x(), translation.y(), translation.z());
} | java | public Matrix4 setToTranslation (IVector3 translation) {
return setToTranslation(translation.x(), translation.y(), translation.z());
} | [
"public",
"Matrix4",
"setToTranslation",
"(",
"IVector3",
"translation",
")",
"{",
"return",
"setToTranslation",
"(",
"translation",
".",
"x",
"(",
")",
",",
"translation",
".",
"y",
"(",
")",
",",
"translation",
".",
"z",
"(",
")",
")",
";",
"}"
] | Sets this to a translation matrix.
@return a reference to this matrix, for chaining. | [
"Sets",
"this",
"to",
"a",
"translation",
"matrix",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix4.java#L139-L141 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Matrix4.java | Matrix4.setToRotationScale | public Matrix4 setToRotationScale (IMatrix3 rotScale) {
return set(rotScale.m00(), rotScale.m01(), rotScale.m02(), 0f,
rotScale.m10(), rotScale.m11(), rotScale.m12(), 0f,
rotScale.m20(), rotScale.m21(), rotScale.m22(), 0f,
0, 0, 0, 1);
} | java | public Matrix4 setToRotationScale (IMatrix3 rotScale) {
return set(rotScale.m00(), rotScale.m01(), rotScale.m02(), 0f,
rotScale.m10(), rotScale.m11(), rotScale.m12(), 0f,
rotScale.m20(), rotScale.m21(), rotScale.m22(), 0f,
0, 0, 0, 1);
} | [
"public",
"Matrix4",
"setToRotationScale",
"(",
"IMatrix3",
"rotScale",
")",
"{",
"return",
"set",
"(",
"rotScale",
".",
"m00",
"(",
")",
",",
"rotScale",
".",
"m01",
"(",
")",
",",
"rotScale",
".",
"m02",
"(",
")",
",",
"0f",
",",
"rotScale",
".",
"... | Sets this to a rotation plus scale matrix.
@return a reference to this matrix, for chaining. | [
"Sets",
"this",
"to",
"a",
"rotation",
"plus",
"scale",
"matrix",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix4.java#L243-L248 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Matrix4.java | Matrix4.setToPerspective | public Matrix4 setToPerspective (double fovy, double aspect, double near, double far) {
double f = 1f / Math.tan(fovy / 2f), dscale = 1f / (near - far);
return set(f/aspect, 0f, 0f, 0f,
0f, f, 0f, 0f,
0f, 0f, (far+near) * dscale, 2f * far * near * dscale,
... | java | public Matrix4 setToPerspective (double fovy, double aspect, double near, double far) {
double f = 1f / Math.tan(fovy / 2f), dscale = 1f / (near - far);
return set(f/aspect, 0f, 0f, 0f,
0f, f, 0f, 0f,
0f, 0f, (far+near) * dscale, 2f * far * near * dscale,
... | [
"public",
"Matrix4",
"setToPerspective",
"(",
"double",
"fovy",
",",
"double",
"aspect",
",",
"double",
"near",
",",
"double",
"far",
")",
"{",
"double",
"f",
"=",
"1f",
"/",
"Math",
".",
"tan",
"(",
"fovy",
"/",
"2f",
")",
",",
"dscale",
"=",
"1f",
... | Sets this to a perspective projection matrix. The formula comes from the OpenGL
documentation for the gluPerspective function.
@return a reference to this matrix, for chaining. | [
"Sets",
"this",
"to",
"a",
"perspective",
"projection",
"matrix",
".",
"The",
"formula",
"comes",
"from",
"the",
"OpenGL",
"documentation",
"for",
"the",
"gluPerspective",
"function",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix4.java#L373-L379 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Matrix4.java | Matrix4.setToFrustum | public Matrix4 setToFrustum (
double left, double right, double bottom, double top, double near, double far) {
return setToFrustum(left, right, bottom, top, near, far, Vector3.UNIT_Z);
} | java | public Matrix4 setToFrustum (
double left, double right, double bottom, double top, double near, double far) {
return setToFrustum(left, right, bottom, top, near, far, Vector3.UNIT_Z);
} | [
"public",
"Matrix4",
"setToFrustum",
"(",
"double",
"left",
",",
"double",
"right",
",",
"double",
"bottom",
",",
"double",
"top",
",",
"double",
"near",
",",
"double",
"far",
")",
"{",
"return",
"setToFrustum",
"(",
"left",
",",
"right",
",",
"bottom",
... | Sets this to a perspective projection matrix. The formula comes from the OpenGL
documentation for the glFrustum function.
@return a reference to this matrix, for chaining. | [
"Sets",
"this",
"to",
"a",
"perspective",
"projection",
"matrix",
".",
"The",
"formula",
"comes",
"from",
"the",
"OpenGL",
"documentation",
"for",
"the",
"glFrustum",
"function",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix4.java#L387-L390 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Matrix4.java | Matrix4.setToFrustum | public Matrix4 setToFrustum (
double left, double right, double bottom, double top,
double near, double far, IVector3 nearFarNormal) {
double rrl = 1f / (right - left);
double rtb = 1f / (top - bottom);
double rnf = 1f / (near - far);
double n2 = 2f * near;
double... | java | public Matrix4 setToFrustum (
double left, double right, double bottom, double top,
double near, double far, IVector3 nearFarNormal) {
double rrl = 1f / (right - left);
double rtb = 1f / (top - bottom);
double rnf = 1f / (near - far);
double n2 = 2f * near;
double... | [
"public",
"Matrix4",
"setToFrustum",
"(",
"double",
"left",
",",
"double",
"right",
",",
"double",
"bottom",
",",
"double",
"top",
",",
"double",
"near",
",",
"double",
"far",
",",
"IVector3",
"nearFarNormal",
")",
"{",
"double",
"rrl",
"=",
"1f",
"/",
"... | Sets this to a perspective projection matrix.
@return a reference to this matrix, for chaining. | [
"Sets",
"this",
"to",
"a",
"perspective",
"projection",
"matrix",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix4.java#L397-L409 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Matrix4.java | Matrix4.setToOrtho | public Matrix4 setToOrtho (
double left, double right, double bottom, double top,
double near, double far, IVector3 nearFarNormal) {
double rlr = 1f / (left - right);
double rbt = 1f / (bottom - top);
double rnf = 1f / (near - far);
double s = 2f / (near*nearFarNormal.z()... | java | public Matrix4 setToOrtho (
double left, double right, double bottom, double top,
double near, double far, IVector3 nearFarNormal) {
double rlr = 1f / (left - right);
double rbt = 1f / (bottom - top);
double rnf = 1f / (near - far);
double s = 2f / (near*nearFarNormal.z()... | [
"public",
"Matrix4",
"setToOrtho",
"(",
"double",
"left",
",",
"double",
"right",
",",
"double",
"bottom",
",",
"double",
"top",
",",
"double",
"near",
",",
"double",
"far",
",",
"IVector3",
"nearFarNormal",
")",
"{",
"double",
"rlr",
"=",
"1f",
"/",
"("... | Sets this to an orthographic projection matrix.
@return a reference to this matrix, for chaining. | [
"Sets",
"this",
"to",
"an",
"orthographic",
"projection",
"matrix",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix4.java#L427-L438 | train |
samskivert/pythagoras | src/main/java/pythagoras/i/Points.java | Points.distanceSq | public static int distanceSq (int x1, int y1, int x2, int y2) {
x2 -= x1;
y2 -= y1;
return x2 * x2 + y2 * y2;
} | java | public static int distanceSq (int x1, int y1, int x2, int y2) {
x2 -= x1;
y2 -= y1;
return x2 * x2 + y2 * y2;
} | [
"public",
"static",
"int",
"distanceSq",
"(",
"int",
"x1",
",",
"int",
"y1",
",",
"int",
"x2",
",",
"int",
"y2",
")",
"{",
"x2",
"-=",
"x1",
";",
"y2",
"-=",
"y1",
";",
"return",
"x2",
"*",
"x2",
"+",
"y2",
"*",
"y2",
";",
"}"
] | Returns the squared Euclidian distance between the specified two points. | [
"Returns",
"the",
"squared",
"Euclidian",
"distance",
"between",
"the",
"specified",
"two",
"points",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/i/Points.java#L15-L19 | train |
samskivert/pythagoras | src/main/java/pythagoras/i/Points.java | Points.distance | public static int distance (int x1, int y1, int x2, int y2) {
return (int)Math.sqrt(distanceSq(x1, y1, x2, y2));
} | java | public static int distance (int x1, int y1, int x2, int y2) {
return (int)Math.sqrt(distanceSq(x1, y1, x2, y2));
} | [
"public",
"static",
"int",
"distance",
"(",
"int",
"x1",
",",
"int",
"y1",
",",
"int",
"x2",
",",
"int",
"y2",
")",
"{",
"return",
"(",
"int",
")",
"Math",
".",
"sqrt",
"(",
"distanceSq",
"(",
"x1",
",",
"y1",
",",
"x2",
",",
"y2",
")",
")",
... | Returns the Euclidian distance between the specified two points, truncated to the nearest
integer. | [
"Returns",
"the",
"Euclidian",
"distance",
"between",
"the",
"specified",
"two",
"points",
"truncated",
"to",
"the",
"nearest",
"integer",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/i/Points.java#L25-L27 | train |
samskivert/pythagoras | src/main/java/pythagoras/i/Points.java | Points.manhattanDistance | public static int manhattanDistance (int x1, int y1, int x2, int y2)
{
return Math.abs(x2 - x1) + Math.abs(y2 - y1);
} | java | public static int manhattanDistance (int x1, int y1, int x2, int y2)
{
return Math.abs(x2 - x1) + Math.abs(y2 - y1);
} | [
"public",
"static",
"int",
"manhattanDistance",
"(",
"int",
"x1",
",",
"int",
"y1",
",",
"int",
"x2",
",",
"int",
"y2",
")",
"{",
"return",
"Math",
".",
"abs",
"(",
"x2",
"-",
"x1",
")",
"+",
"Math",
".",
"abs",
"(",
"y2",
"-",
"y1",
")",
";",
... | Returns the Manhattan distance between the specified two points. | [
"Returns",
"the",
"Manhattan",
"distance",
"between",
"the",
"specified",
"two",
"points",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/i/Points.java#L32-L35 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/MathUtil.java | MathUtil.roundNearest | public static double roundNearest (double v, double target) {
target = Math.abs(target);
if (v >= 0) {
return target * Math.floor((v + 0.5f * target) / target);
} else {
return target * Math.ceil((v - 0.5f * target) / target);
}
} | java | public static double roundNearest (double v, double target) {
target = Math.abs(target);
if (v >= 0) {
return target * Math.floor((v + 0.5f * target) / target);
} else {
return target * Math.ceil((v - 0.5f * target) / target);
}
} | [
"public",
"static",
"double",
"roundNearest",
"(",
"double",
"v",
",",
"double",
"target",
")",
"{",
"target",
"=",
"Math",
".",
"abs",
"(",
"target",
")",
";",
"if",
"(",
"v",
">=",
"0",
")",
"{",
"return",
"target",
"*",
"Math",
".",
"floor",
"("... | Rounds a value to the nearest multiple of a target. | [
"Rounds",
"a",
"value",
"to",
"the",
"nearest",
"multiple",
"of",
"a",
"target",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/MathUtil.java#L61-L68 | train |
di2e/Argo | ProbeSender/src/main/java/ws/argo/probe/ProbeSender.java | ProbeSender.sendProbe | public List<Probe> sendProbe(Probe probe) throws ProbeSenderException {
List<Probe> actualProbesToSend;
try {
actualProbesToSend = splitProbe(probe);
} catch (MalformedURLException | JAXBException | UnsupportedPayloadType e) {
throw new ProbeSenderException("Issue splitting the probe.", e);
... | java | public List<Probe> sendProbe(Probe probe) throws ProbeSenderException {
List<Probe> actualProbesToSend;
try {
actualProbesToSend = splitProbe(probe);
} catch (MalformedURLException | JAXBException | UnsupportedPayloadType e) {
throw new ProbeSenderException("Issue splitting the probe.", e);
... | [
"public",
"List",
"<",
"Probe",
">",
"sendProbe",
"(",
"Probe",
"probe",
")",
"throws",
"ProbeSenderException",
"{",
"List",
"<",
"Probe",
">",
"actualProbesToSend",
";",
"try",
"{",
"actualProbesToSend",
"=",
"splitProbe",
"(",
"probe",
")",
";",
"}",
"catc... | Send the probe. It will take the provided probe and then disassemble it
into a number of smaller probes based on the max payload size of the
transport provided.
@param probe the probe to send
@return the list of actual probes sent (which were created when the
provided probe was spit into smaller ones that complied wit... | [
"Send",
"the",
"probe",
".",
"It",
"will",
"take",
"the",
"provided",
"probe",
"and",
"then",
"disassemble",
"it",
"into",
"a",
"number",
"of",
"smaller",
"probes",
"based",
"on",
"the",
"max",
"payload",
"size",
"of",
"the",
"transport",
"provided",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ProbeSender/src/main/java/ws/argo/probe/ProbeSender.java#L67-L88 | train |
di2e/Argo | ProbeSender/src/main/java/ws/argo/probe/ProbeSender.java | ProbeSender.splitProbe | private List<Probe> splitProbe(Probe probe) throws ProbeSenderException, JAXBException, MalformedURLException, UnsupportedPayloadType {
List<Probe> actualProbeList = new ArrayList<Probe>();
int maxPayloadSize = this.probeTransport.maxPayloadSize();
LinkedList<ProbeIdEntry> combinedList = probe.getComb... | java | private List<Probe> splitProbe(Probe probe) throws ProbeSenderException, JAXBException, MalformedURLException, UnsupportedPayloadType {
List<Probe> actualProbeList = new ArrayList<Probe>();
int maxPayloadSize = this.probeTransport.maxPayloadSize();
LinkedList<ProbeIdEntry> combinedList = probe.getComb... | [
"private",
"List",
"<",
"Probe",
">",
"splitProbe",
"(",
"Probe",
"probe",
")",
"throws",
"ProbeSenderException",
",",
"JAXBException",
",",
"MalformedURLException",
",",
"UnsupportedPayloadType",
"{",
"List",
"<",
"Probe",
">",
"actualProbeList",
"=",
"new",
"Arr... | This method will take the given probe to send and then chop it up into
smaller probes that will fit under the maximum packet size specified by the
transport. This is important because Argo wants the UDP packets to not get
chopped up by the network routers of at all possible. This makes the
overall reliability of the pr... | [
"This",
"method",
"will",
"take",
"the",
"given",
"probe",
"to",
"send",
"and",
"then",
"chop",
"it",
"up",
"into",
"smaller",
"probes",
"that",
"will",
"fit",
"under",
"the",
"maximum",
"packet",
"size",
"specified",
"by",
"the",
"transport",
".",
"This",... | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ProbeSender/src/main/java/ws/argo/probe/ProbeSender.java#L114-L172 | train |
di2e/Argo | ProbeSender/src/main/java/ws/argo/probe/ProbeSender.java | ProbeSender.getDescription | public String getDescription() {
StringBuffer buf = new StringBuffer();
buf.append("ProbeSender for ");
buf.append(probeTransport.toString());
return buf.toString();
} | java | public String getDescription() {
StringBuffer buf = new StringBuffer();
buf.append("ProbeSender for ");
buf.append(probeTransport.toString());
return buf.toString();
} | [
"public",
"String",
"getDescription",
"(",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\"ProbeSender for \"",
")",
";",
"buf",
".",
"append",
"(",
"probeTransport",
".",
"toString",
"(",
")",
")",... | Return the description of the ProbeSender.
@return description | [
"Return",
"the",
"description",
"of",
"the",
"ProbeSender",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ProbeSender/src/main/java/ws/argo/probe/ProbeSender.java#L179-L184 | train |
opentelecoms-org/zrtp-java | src/zorg/ZRTPCache.java | ZRTPCache.getMyZid | public byte[] getMyZid() {
ZrtpCacheEntry ce = cache.get(LOCAL_ZID_KEY);
if (ce != null) {
return ce.getData();
} else {
byte[] zid = new byte[12];
platform.getCrypto().getRandomGenerator().getBytes(zid);
cache.put(LOCAL_ZID_KEY, zid, null);
platform.getLogger().log("[ZRTP] created new ZID=", zid);... | java | public byte[] getMyZid() {
ZrtpCacheEntry ce = cache.get(LOCAL_ZID_KEY);
if (ce != null) {
return ce.getData();
} else {
byte[] zid = new byte[12];
platform.getCrypto().getRandomGenerator().getBytes(zid);
cache.put(LOCAL_ZID_KEY, zid, null);
platform.getLogger().log("[ZRTP] created new ZID=", zid);... | [
"public",
"byte",
"[",
"]",
"getMyZid",
"(",
")",
"{",
"ZrtpCacheEntry",
"ce",
"=",
"cache",
".",
"get",
"(",
"LOCAL_ZID_KEY",
")",
";",
"if",
"(",
"ce",
"!=",
"null",
")",
"{",
"return",
"ce",
".",
"getData",
"(",
")",
";",
"}",
"else",
"{",
"by... | Retrieves this clients cached ZID. If there's no cached ZID, i.e. on
first run, a random ZID is created and stored.
@return this client's ZID. | [
"Retrieves",
"this",
"clients",
"cached",
"ZID",
".",
"If",
"there",
"s",
"no",
"cached",
"ZID",
"i",
".",
"e",
".",
"on",
"first",
"run",
"a",
"random",
"ZID",
"is",
"created",
"and",
"stored",
"."
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/ZRTPCache.java#L67-L78 | train |
opentelecoms-org/zrtp-java | src/zorg/ZRTPCache.java | ZRTPCache.selectEntry | public void selectEntry(byte[] remoteZID) {
platform.getLogger().log(
"ZRTPCache: selectEntry("
+ platform.getUtils().byteToHexString(remoteZID) + ")");
String zidString = new String(remoteZID);
if (currentZid != null && currentZid.equals(zidString)) {
return;
}
currentZid = null;
currentRs1 = ... | java | public void selectEntry(byte[] remoteZID) {
platform.getLogger().log(
"ZRTPCache: selectEntry("
+ platform.getUtils().byteToHexString(remoteZID) + ")");
String zidString = new String(remoteZID);
if (currentZid != null && currentZid.equals(zidString)) {
return;
}
currentZid = null;
currentRs1 = ... | [
"public",
"void",
"selectEntry",
"(",
"byte",
"[",
"]",
"remoteZID",
")",
"{",
"platform",
".",
"getLogger",
"(",
")",
".",
"log",
"(",
"\"ZRTPCache: selectEntry(\"",
"+",
"platform",
".",
"getUtils",
"(",
")",
".",
"byteToHexString",
"(",
"remoteZID",
")",
... | Selects a cache entry base on remote ZID
@param remoteZID
the remote ZID of the requested entry. | [
"Selects",
"a",
"cache",
"entry",
"base",
"on",
"remote",
"ZID"
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/ZRTPCache.java#L118-L185 | train |
opentelecoms-org/zrtp-java | src/zorg/ZRTPCache.java | ZRTPCache.updateEntry | public void updateEntry(long expiryTime, boolean trust,
byte[] retainedSecret, byte[] rs2, String number) {
if (platform.isVerboseLogging()) {
platform.getLogger().log(
"ZRTPCache: updateEntry("
+ expiryTime
+ ", "
+ trust
+ ", "
+ platform.getUtils().byteToHexString(
... | java | public void updateEntry(long expiryTime, boolean trust,
byte[] retainedSecret, byte[] rs2, String number) {
if (platform.isVerboseLogging()) {
platform.getLogger().log(
"ZRTPCache: updateEntry("
+ expiryTime
+ ", "
+ trust
+ ", "
+ platform.getUtils().byteToHexString(
... | [
"public",
"void",
"updateEntry",
"(",
"long",
"expiryTime",
",",
"boolean",
"trust",
",",
"byte",
"[",
"]",
"retainedSecret",
",",
"byte",
"[",
"]",
"rs2",
",",
"String",
"number",
")",
"{",
"if",
"(",
"platform",
".",
"isVerboseLogging",
"(",
")",
")",
... | Updates the entry for the selected remote ZID.
@param retainedSecret
the new retained secret.
@param expiryTime
the expiry time, 0 means the entry should be erased.
@param keepRs2
specifies whether the old rs2 should be kept rather than
copying old rs1 into rs2.
@param number
Phone Number associated with the current z... | [
"Updates",
"the",
"entry",
"for",
"the",
"selected",
"remote",
"ZID",
"."
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/ZRTPCache.java#L200-L237 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/commands/util/Cache.java | Cache.descriptionsForResponseIDs | public List<String> descriptionsForResponseIDs(List<String> _ids, boolean payload, boolean pretty) {
List<String> descriptions = new ArrayList<String>();
for (ServiceWrapper s : _cache) {
if (_ids.isEmpty() || _responseIds.contains(s.getResponseId())) {
StringBuffer buf = serviceDesciption(payloa... | java | public List<String> descriptionsForResponseIDs(List<String> _ids, boolean payload, boolean pretty) {
List<String> descriptions = new ArrayList<String>();
for (ServiceWrapper s : _cache) {
if (_ids.isEmpty() || _responseIds.contains(s.getResponseId())) {
StringBuffer buf = serviceDesciption(payloa... | [
"public",
"List",
"<",
"String",
">",
"descriptionsForResponseIDs",
"(",
"List",
"<",
"String",
">",
"_ids",
",",
"boolean",
"payload",
",",
"boolean",
"pretty",
")",
"{",
"List",
"<",
"String",
">",
"descriptions",
"=",
"new",
"ArrayList",
"<",
"String",
... | Return the list of description strings for a list of response ids.
@param _ids list of response ids
@param payload print the whole payload
@param pretty make it pretty
@return the string of all the specified response payloads | [
"Return",
"the",
"list",
"of",
"description",
"strings",
"for",
"a",
"list",
"of",
"response",
"ids",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/commands/util/Cache.java#L91-L102 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/commands/util/Cache.java | Cache.descriptionsForProbeIDs | public List<String> descriptionsForProbeIDs(List<String> _ids, boolean payload, boolean pretty) {
List<String> descriptions = new ArrayList<String>();
for (ServiceWrapper s : _cache) {
if (_ids.isEmpty() || _probeIds.contains(s.getProbeId())) {
StringBuffer buf = serviceDesciption(payload, pretty... | java | public List<String> descriptionsForProbeIDs(List<String> _ids, boolean payload, boolean pretty) {
List<String> descriptions = new ArrayList<String>();
for (ServiceWrapper s : _cache) {
if (_ids.isEmpty() || _probeIds.contains(s.getProbeId())) {
StringBuffer buf = serviceDesciption(payload, pretty... | [
"public",
"List",
"<",
"String",
">",
"descriptionsForProbeIDs",
"(",
"List",
"<",
"String",
">",
"_ids",
",",
"boolean",
"payload",
",",
"boolean",
"pretty",
")",
"{",
"List",
"<",
"String",
">",
"descriptions",
"=",
"new",
"ArrayList",
"<",
"String",
">"... | Return the list of description strings for a list of probe ids.
@param _ids list of response ids
@param payload print the whole payload
@param pretty pretty make it pretty
@return the string of all the specified response payloads | [
"Return",
"the",
"list",
"of",
"description",
"strings",
"for",
"a",
"list",
"of",
"probe",
"ids",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/commands/util/Cache.java#L112-L123 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/commands/util/Cache.java | Cache.asJSON | public String asJSON(boolean pretty) {
JSONSerializer ser = new JSONSerializer();
Gson gson = new Gson();
Gson prettyJson = new GsonBuilder().setPrettyPrinting().create();
JsonArray cacheArray = new JsonArray();
String cacheAsString;
for (ServiceWrapper s : _cache) {
String json = ser.m... | java | public String asJSON(boolean pretty) {
JSONSerializer ser = new JSONSerializer();
Gson gson = new Gson();
Gson prettyJson = new GsonBuilder().setPrettyPrinting().create();
JsonArray cacheArray = new JsonArray();
String cacheAsString;
for (ServiceWrapper s : _cache) {
String json = ser.m... | [
"public",
"String",
"asJSON",
"(",
"boolean",
"pretty",
")",
"{",
"JSONSerializer",
"ser",
"=",
"new",
"JSONSerializer",
"(",
")",
";",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";",
"Gson",
"prettyJson",
"=",
"new",
"GsonBuilder",
"(",
")",
".",
"... | Return the cache as JSON.
@param pretty make it pretty
@return the string as JSON | [
"Return",
"the",
"cache",
"as",
"JSON",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/commands/util/Cache.java#L151-L173 | train |
di2e/Argo | ProbeSender/src/main/java/ws/argo/transport/probe/standard/MulticastTransport.java | MulticastTransport.sendProbe | @Override
public void sendProbe(Probe probe) throws TransportException {
LOGGER.info("Sending probe [" + probe.getProbeID() + "] on network inteface [" + networkInterface.getName() + "] at port [" + multicastAddress + ":" + multicastPort + "]");
LOGGER.debug("Probe requesting TTL of [" + probe.getHopLimit() ... | java | @Override
public void sendProbe(Probe probe) throws TransportException {
LOGGER.info("Sending probe [" + probe.getProbeID() + "] on network inteface [" + networkInterface.getName() + "] at port [" + multicastAddress + ":" + multicastPort + "]");
LOGGER.debug("Probe requesting TTL of [" + probe.getHopLimit() ... | [
"@",
"Override",
"public",
"void",
"sendProbe",
"(",
"Probe",
"probe",
")",
"throws",
"TransportException",
"{",
"LOGGER",
".",
"info",
"(",
"\"Sending probe [\"",
"+",
"probe",
".",
"getProbeID",
"(",
")",
"+",
"\"] on network inteface [\"",
"+",
"networkInterfac... | Actually send the probe out on the wire.
@param probe the Probe instance that has been pre-configured
@throws TransportException if something bad happened when sending the
probe | [
"Actually",
"send",
"the",
"probe",
"out",
"on",
"the",
"wire",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ProbeSender/src/main/java/ws/argo/transport/probe/standard/MulticastTransport.java#L226-L254 | train |
di2e/Argo | ArgoWirelineFormat/src/main/java/ws/argo/wireline/response/XMLSerializer.java | XMLSerializer.unmarshal | public ResponseWrapper unmarshal(String payload) throws ResponseParseException {
Services xmlServices = parseResponsePayload(payload);
ResponseWrapper response = constructResponseWrapperFromResponse(xmlServices);
return response;
} | java | public ResponseWrapper unmarshal(String payload) throws ResponseParseException {
Services xmlServices = parseResponsePayload(payload);
ResponseWrapper response = constructResponseWrapperFromResponse(xmlServices);
return response;
} | [
"public",
"ResponseWrapper",
"unmarshal",
"(",
"String",
"payload",
")",
"throws",
"ResponseParseException",
"{",
"Services",
"xmlServices",
"=",
"parseResponsePayload",
"(",
"payload",
")",
";",
"ResponseWrapper",
"response",
"=",
"constructResponseWrapperFromResponse",
... | Translate the wireline string into an instance of a ResponseWrapper object.
@param payload the wireline string
@return a new instance of a {@link ResponseWrapper}.
@throws ResponseParseException if some issues occurred parsing the response | [
"Translate",
"the",
"wireline",
"string",
"into",
"an",
"instance",
"of",
"a",
"ResponseWrapper",
"object",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ArgoWirelineFormat/src/main/java/ws/argo/wireline/response/XMLSerializer.java#L176-L184 | train |
di2e/Argo | ArgoWirelineFormat/src/main/java/ws/argo/wireline/response/XMLSerializer.java | XMLSerializer.unmarshalService | public ServiceWrapper unmarshalService(String payload) throws ResponseParseException {
Service xmlService = parseServicePayload(payload);
ServiceWrapper service = constructServiceWrapperFromService(xmlService);
return service;
} | java | public ServiceWrapper unmarshalService(String payload) throws ResponseParseException {
Service xmlService = parseServicePayload(payload);
ServiceWrapper service = constructServiceWrapperFromService(xmlService);
return service;
} | [
"public",
"ServiceWrapper",
"unmarshalService",
"(",
"String",
"payload",
")",
"throws",
"ResponseParseException",
"{",
"Service",
"xmlService",
"=",
"parseServicePayload",
"(",
"payload",
")",
";",
"ServiceWrapper",
"service",
"=",
"constructServiceWrapperFromService",
"... | Translate the wireline string to an instance of a ServiceWrapper object.
@param payload the wireline string
@return a new instance of a {@link ServiceWrapper}.
@throws ResponseParseException if some issues occurred parsing the response | [
"Translate",
"the",
"wireline",
"string",
"to",
"an",
"instance",
"of",
"a",
"ServiceWrapper",
"object",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ArgoWirelineFormat/src/main/java/ws/argo/wireline/response/XMLSerializer.java#L193-L201 | train |
konmik/satellite | valuemap/src/main/java/valuemap/ValueMap.java | ValueMap.get | public <T> T get(String key, T defaultValue) {
if (map.containsKey(key)) {
Object value = map.get(key);
return (T)(value instanceof byte[] ? unmarshall((byte[])value) : value);
}
return defaultValue;
} | java | public <T> T get(String key, T defaultValue) {
if (map.containsKey(key)) {
Object value = map.get(key);
return (T)(value instanceof byte[] ? unmarshall((byte[])value) : value);
}
return defaultValue;
} | [
"public",
"<",
"T",
">",
"T",
"get",
"(",
"String",
"key",
",",
"T",
"defaultValue",
")",
"{",
"if",
"(",
"map",
".",
"containsKey",
"(",
"key",
")",
")",
"{",
"Object",
"value",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"return",
"(",
"T",... | Returns the value of the mapping with the specified key, or the given default value. | [
"Returns",
"the",
"value",
"of",
"the",
"mapping",
"with",
"the",
"specified",
"key",
"or",
"the",
"given",
"default",
"value",
"."
] | 7b0d3194bf84b3db4c233a131890a23e2d5825b9 | https://github.com/konmik/satellite/blob/7b0d3194bf84b3db4c233a131890a23e2d5825b9/valuemap/src/main/java/valuemap/ValueMap.java#L91-L97 | train |
di2e/Argo | PluginFramework/src/main/java/ws/argo/probe/Probe.java | Probe.setRespondToPayloadType | public void setRespondToPayloadType(String respondToPayloadType) throws UnsupportedPayloadType {
// Sanity check on the payload type values. Should be XML or JSON
// If the probe goes out with a bad value here, then the Responder may have
// problems
if (respondToPayloadType == null || respondToPayloadT... | java | public void setRespondToPayloadType(String respondToPayloadType) throws UnsupportedPayloadType {
// Sanity check on the payload type values. Should be XML or JSON
// If the probe goes out with a bad value here, then the Responder may have
// problems
if (respondToPayloadType == null || respondToPayloadT... | [
"public",
"void",
"setRespondToPayloadType",
"(",
"String",
"respondToPayloadType",
")",
"throws",
"UnsupportedPayloadType",
"{",
"// Sanity check on the payload type values. Should be XML or JSON",
"// If the probe goes out with a bad value here, then the Responder may have",
"// problems",... | set the payload type for the response from the Responder. It only support
XML and JSON.
@param respondToPayloadType a payload type string - XML or JSON
@throws UnsupportedPayloadType if you don't pass in XML or JSON | [
"set",
"the",
"payload",
"type",
"for",
"the",
"response",
"from",
"the",
"Responder",
".",
"It",
"only",
"support",
"XML",
"and",
"JSON",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/PluginFramework/src/main/java/ws/argo/probe/Probe.java#L194-L202 | train |
di2e/Argo | PluginFramework/src/main/java/ws/argo/probe/Probe.java | Probe.getCombinedIdentifierList | public LinkedList<ProbeIdEntry> getCombinedIdentifierList() {
LinkedList<ProbeIdEntry> combinedList = new LinkedList<ProbeIdEntry>();
for (String id : this.getProbeWrapper().getServiceContractIDs()) {
combinedList.add(new ProbeIdEntry("scid", id));
}
for (String id : this.getProbeWrapper().getSer... | java | public LinkedList<ProbeIdEntry> getCombinedIdentifierList() {
LinkedList<ProbeIdEntry> combinedList = new LinkedList<ProbeIdEntry>();
for (String id : this.getProbeWrapper().getServiceContractIDs()) {
combinedList.add(new ProbeIdEntry("scid", id));
}
for (String id : this.getProbeWrapper().getSer... | [
"public",
"LinkedList",
"<",
"ProbeIdEntry",
">",
"getCombinedIdentifierList",
"(",
")",
"{",
"LinkedList",
"<",
"ProbeIdEntry",
">",
"combinedList",
"=",
"new",
"LinkedList",
"<",
"ProbeIdEntry",
">",
"(",
")",
";",
"for",
"(",
"String",
"id",
":",
"this",
... | Create and return a LinkedList of a combination of both scids and siids.
This is a method that is used primarily in the creation of split packets.
@return combined LikedList | [
"Create",
"and",
"return",
"a",
"LinkedList",
"of",
"a",
"combination",
"of",
"both",
"scids",
"and",
"siids",
".",
"This",
"is",
"a",
"method",
"that",
"is",
"used",
"primarily",
"in",
"the",
"creation",
"of",
"split",
"packets",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/PluginFramework/src/main/java/ws/argo/probe/Probe.java#L283-L293 | train |
opentelecoms-org/zrtp-java | src/zorg/LegacyClientUtils.java | LegacyClientUtils.checkClientId | public static boolean checkClientId(boolean isLegacyAttributeList, String farEndClientID) {
if (ZRTP.CLIENT_ID_LEGACY.equals(farEndClientID))
return true;
if (ZRTP.CLIENT_ID_RFC.equals(farEndClientID))
return false;
boolean isPrintable = true;
for (int i = 0; i < farEndClientID.length(... | java | public static boolean checkClientId(boolean isLegacyAttributeList, String farEndClientID) {
if (ZRTP.CLIENT_ID_LEGACY.equals(farEndClientID))
return true;
if (ZRTP.CLIENT_ID_RFC.equals(farEndClientID))
return false;
boolean isPrintable = true;
for (int i = 0; i < farEndClientID.length(... | [
"public",
"static",
"boolean",
"checkClientId",
"(",
"boolean",
"isLegacyAttributeList",
",",
"String",
"farEndClientID",
")",
"{",
"if",
"(",
"ZRTP",
".",
"CLIENT_ID_LEGACY",
".",
"equals",
"(",
"farEndClientID",
")",
")",
"return",
"true",
";",
"if",
"(",
"Z... | Legacy Client send ZRTP.CLIENT_ID_LEGACY or a non-printable ClientId | [
"Legacy",
"Client",
"send",
"ZRTP",
".",
"CLIENT_ID_LEGACY",
"or",
"a",
"non",
"-",
"printable",
"ClientId"
] | 10a0c77866c5d1b1504df161db9a447f5069ed54 | https://github.com/opentelecoms-org/zrtp-java/blob/10a0c77866c5d1b1504df161db9a447f5069ed54/src/zorg/LegacyClientUtils.java#L49-L65 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Rectangles.java | Rectangles.pointRectDistanceSq | public static float pointRectDistanceSq (IRectangle r, IPoint p) {
Point p2 = closestInteriorPoint(r, p);
return Points.distanceSq(p.x(), p.y(), p2.x, p2.y);
} | java | public static float pointRectDistanceSq (IRectangle r, IPoint p) {
Point p2 = closestInteriorPoint(r, p);
return Points.distanceSq(p.x(), p.y(), p2.x, p2.y);
} | [
"public",
"static",
"float",
"pointRectDistanceSq",
"(",
"IRectangle",
"r",
",",
"IPoint",
"p",
")",
"{",
"Point",
"p2",
"=",
"closestInteriorPoint",
"(",
"r",
",",
"p",
")",
";",
"return",
"Points",
".",
"distanceSq",
"(",
"p",
".",
"x",
"(",
")",
","... | Returns the squared Euclidean distance between the given point and the nearest point inside
the bounds of the given rectangle. If the supplied point is inside the rectangle, the
distance will be zero. | [
"Returns",
"the",
"squared",
"Euclidean",
"distance",
"between",
"the",
"given",
"point",
"and",
"the",
"nearest",
"point",
"inside",
"the",
"bounds",
"of",
"the",
"given",
"rectangle",
".",
"If",
"the",
"supplied",
"point",
"is",
"inside",
"the",
"rectangle",... | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Rectangles.java#L58-L61 | train |
di2e/Argo | CommonUtils/src/main/java/ws/argo/common/cache/ResponseCache.java | ResponseCache.cacheAll | public void cacheAll(ArrayList<ExpiringService> list) {
for (ExpiringService service : list) {
cache.put(service.getService().getId(), service);
}
} | java | public void cacheAll(ArrayList<ExpiringService> list) {
for (ExpiringService service : list) {
cache.put(service.getService().getId(), service);
}
} | [
"public",
"void",
"cacheAll",
"(",
"ArrayList",
"<",
"ExpiringService",
">",
"list",
")",
"{",
"for",
"(",
"ExpiringService",
"service",
":",
"list",
")",
"{",
"cache",
".",
"put",
"(",
"service",
".",
"getService",
"(",
")",
".",
"getId",
"(",
")",
",... | Put a list of services in the cache.
@param list the list of service to put in the cache | [
"Put",
"a",
"list",
"of",
"services",
"in",
"the",
"cache",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CommonUtils/src/main/java/ws/argo/common/cache/ResponseCache.java#L58-L64 | train |
di2e/Argo | CommonUtils/src/main/java/ws/argo/common/cache/ResponseCache.java | ResponseCache.asJSON | public String asJSON() {
Gson gson = new Gson();
clearExpired();
Cache jsonCache = new Cache();
for (ExpiringService svc : cache.values()) {
jsonCache.cache.add(svc.getService());
}
String json = gson.toJson(jsonCache);
return json;
} | java | public String asJSON() {
Gson gson = new Gson();
clearExpired();
Cache jsonCache = new Cache();
for (ExpiringService svc : cache.values()) {
jsonCache.cache.add(svc.getService());
}
String json = gson.toJson(jsonCache);
return json;
} | [
"public",
"String",
"asJSON",
"(",
")",
"{",
"Gson",
"gson",
"=",
"new",
"Gson",
"(",
")",
";",
"clearExpired",
"(",
")",
";",
"Cache",
"jsonCache",
"=",
"new",
"Cache",
"(",
")",
";",
"for",
"(",
"ExpiringService",
"svc",
":",
"cache",
".",
"values"... | Return the JSON string of the response cache. Leverage the Gson nature of
the domain wireline classes
@return the JSON string | [
"Return",
"the",
"JSON",
"string",
"of",
"the",
"response",
"cache",
".",
"Leverage",
"the",
"Gson",
"nature",
"of",
"the",
"domain",
"wireline",
"classes"
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CommonUtils/src/main/java/ws/argo/common/cache/ResponseCache.java#L76-L89 | train |
di2e/Argo | ArgoWirelineFormat/src/main/java/ws/argo/wireline/probe/ProbeWrapper.java | ProbeWrapper.addRespondToURL | public void addRespondToURL(String label, String url) {
RespondToURL respondToURL = new RespondToURL();
respondToURL.label = label;
respondToURL.url = url;
respondToURLs.add(respondToURL);
} | java | public void addRespondToURL(String label, String url) {
RespondToURL respondToURL = new RespondToURL();
respondToURL.label = label;
respondToURL.url = url;
respondToURLs.add(respondToURL);
} | [
"public",
"void",
"addRespondToURL",
"(",
"String",
"label",
",",
"String",
"url",
")",
"{",
"RespondToURL",
"respondToURL",
"=",
"new",
"RespondToURL",
"(",
")",
";",
"respondToURL",
".",
"label",
"=",
"label",
";",
"respondToURL",
".",
"url",
"=",
"url",
... | Add a response URL to the probe.
@param label the string label for the respondTo address
@param url the actual URL string | [
"Add",
"a",
"response",
"URL",
"to",
"the",
"probe",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ArgoWirelineFormat/src/main/java/ws/argo/wireline/probe/ProbeWrapper.java#L257-L265 | train |
di2e/Argo | ArgoWirelineFormat/src/main/java/ws/argo/wireline/probe/ProbeWrapper.java | ProbeWrapper.asString | public String asString() {
StringBuffer buf = new StringBuffer();
buf.append(" PID: [ ").append(this.id).append(" ]");;
buf.append(" CID: [ ").append(this.clientId).append(" ]");;
buf.append(" DES: [ ").append(this.desVersion).append(" ]");;
buf.append(" SCIDS: [ " );
for (String scid : serviceC... | java | public String asString() {
StringBuffer buf = new StringBuffer();
buf.append(" PID: [ ").append(this.id).append(" ]");;
buf.append(" CID: [ ").append(this.clientId).append(" ]");;
buf.append(" DES: [ ").append(this.desVersion).append(" ]");;
buf.append(" SCIDS: [ " );
for (String scid : serviceC... | [
"public",
"String",
"asString",
"(",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\" PID: [ \"",
")",
".",
"append",
"(",
"this",
".",
"id",
")",
".",
"append",
"(",
"\" ]\"",
")",
";",
";",
... | This will return the single-line textual representation. This was crafted
for the command line client. Your mileage may vary.
@return the single line description | [
"This",
"will",
"return",
"the",
"single",
"-",
"line",
"textual",
"representation",
".",
"This",
"was",
"crafted",
"for",
"the",
"command",
"line",
"client",
".",
"Your",
"mileage",
"may",
"vary",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ArgoWirelineFormat/src/main/java/ws/argo/wireline/probe/ProbeWrapper.java#L319-L342 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/RectangularShape.java | RectangularShape.setFrame | public void setFrame (XY loc, IDimension size) {
setFrame(loc.x(), loc.y(), size.width(), size.height());
} | java | public void setFrame (XY loc, IDimension size) {
setFrame(loc.x(), loc.y(), size.width(), size.height());
} | [
"public",
"void",
"setFrame",
"(",
"XY",
"loc",
",",
"IDimension",
"size",
")",
"{",
"setFrame",
"(",
"loc",
".",
"x",
"(",
")",
",",
"loc",
".",
"y",
"(",
")",
",",
"size",
".",
"width",
"(",
")",
",",
"size",
".",
"height",
"(",
")",
")",
"... | Sets the location and size of the framing rectangle of this shape to the supplied values. | [
"Sets",
"the",
"location",
"and",
"size",
"of",
"the",
"framing",
"rectangle",
"of",
"this",
"shape",
"to",
"the",
"supplied",
"values",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/RectangularShape.java#L21-L23 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/RectangularShape.java | RectangularShape.setFrame | public void setFrame (IRectangle r) {
setFrame(r.x(), r.y(), r.width(), r.height());
} | java | public void setFrame (IRectangle r) {
setFrame(r.x(), r.y(), r.width(), r.height());
} | [
"public",
"void",
"setFrame",
"(",
"IRectangle",
"r",
")",
"{",
"setFrame",
"(",
"r",
".",
"x",
"(",
")",
",",
"r",
".",
"y",
"(",
")",
",",
"r",
".",
"width",
"(",
")",
",",
"r",
".",
"height",
"(",
")",
")",
";",
"}"
] | Sets the location and size of the framing rectangle of this shape to be equal to the
supplied rectangle. | [
"Sets",
"the",
"location",
"and",
"size",
"of",
"the",
"framing",
"rectangle",
"of",
"this",
"shape",
"to",
"be",
"equal",
"to",
"the",
"supplied",
"rectangle",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/RectangularShape.java#L29-L31 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/RectangularShape.java | RectangularShape.setFrameFromDiagonal | public void setFrameFromDiagonal (XY p1, XY p2) {
setFrameFromDiagonal(p1.x(), p1.y(), p2.x(), p2.y());
} | java | public void setFrameFromDiagonal (XY p1, XY p2) {
setFrameFromDiagonal(p1.x(), p1.y(), p2.x(), p2.y());
} | [
"public",
"void",
"setFrameFromDiagonal",
"(",
"XY",
"p1",
",",
"XY",
"p2",
")",
"{",
"setFrameFromDiagonal",
"(",
"p1",
".",
"x",
"(",
")",
",",
"p1",
".",
"y",
"(",
")",
",",
"p2",
".",
"x",
"(",
")",
",",
"p2",
".",
"y",
"(",
")",
")",
";"... | Sets the location and size of the framing rectangle of this shape based on the supplied
diagonal line. | [
"Sets",
"the",
"location",
"and",
"size",
"of",
"the",
"framing",
"rectangle",
"of",
"this",
"shape",
"based",
"on",
"the",
"supplied",
"diagonal",
"line",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/RectangularShape.java#L60-L62 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/RectangularShape.java | RectangularShape.setFrameFromCenter | public void setFrameFromCenter (XY center, XY corner) {
setFrameFromCenter(center.x(), center.y(), corner.x(), corner.y());
} | java | public void setFrameFromCenter (XY center, XY corner) {
setFrameFromCenter(center.x(), center.y(), corner.x(), corner.y());
} | [
"public",
"void",
"setFrameFromCenter",
"(",
"XY",
"center",
",",
"XY",
"corner",
")",
"{",
"setFrameFromCenter",
"(",
"center",
".",
"x",
"(",
")",
",",
"center",
".",
"y",
"(",
")",
",",
"corner",
".",
"x",
"(",
")",
",",
"corner",
".",
"y",
"(",... | Sets the location and size of the framing rectangle of this shape based on the supplied
center and corner points. | [
"Sets",
"the",
"location",
"and",
"size",
"of",
"the",
"framing",
"rectangle",
"of",
"this",
"shape",
"based",
"on",
"the",
"supplied",
"center",
"and",
"corner",
"points",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/RectangularShape.java#L79-L81 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Points.java | Points.inverseTransform | public static Point inverseTransform (double x, double y, double sx, double sy, double rotation,
double tx, double ty, Point result) {
x -= tx; y -= ty; // untranslate
double sinnega = Math.sin(-rotation), cosnega = Math.cos(-rotation);
double nx = (x * ... | java | public static Point inverseTransform (double x, double y, double sx, double sy, double rotation,
double tx, double ty, Point result) {
x -= tx; y -= ty; // untranslate
double sinnega = Math.sin(-rotation), cosnega = Math.cos(-rotation);
double nx = (x * ... | [
"public",
"static",
"Point",
"inverseTransform",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"sx",
",",
"double",
"sy",
",",
"double",
"rotation",
",",
"double",
"tx",
",",
"double",
"ty",
",",
"Point",
"result",
")",
"{",
"x",
"-=",
"tx",
... | Inverse transforms a point as specified, storing the result in the point provided.
@return a reference to the result point, for chaining. | [
"Inverse",
"transforms",
"a",
"point",
"as",
"specified",
"storing",
"the",
"result",
"in",
"the",
"point",
"provided",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Points.java#L64-L71 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/plugin/configfile/ConfigFileProbeHandlerPlugin.java | ConfigFileProbeHandlerPlugin.setServiceList | public void setServiceList(ArrayList<ServiceWrapper> services) {
writeLock.lock();
try {
LOGGER.info("Updating service list by " + Thread.currentThread().getName());
this.serviceList = services;
} finally {
writeLock.unlock();
}
} | java | public void setServiceList(ArrayList<ServiceWrapper> services) {
writeLock.lock();
try {
LOGGER.info("Updating service list by " + Thread.currentThread().getName());
this.serviceList = services;
} finally {
writeLock.unlock();
}
} | [
"public",
"void",
"setServiceList",
"(",
"ArrayList",
"<",
"ServiceWrapper",
">",
"services",
")",
"{",
"writeLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"LOGGER",
".",
"info",
"(",
"\"Updating service list by \"",
"+",
"Thread",
".",
"currentThread",
"(",
... | As the Responder is multi-threaded, make sure that the access to the
services list which might change out if the user changes it, is
synchronized to make sure nothing weird happens.
<p>There is lock on this that will always allow a read unless another thread
is updating the service list.
@param services - the ArrayLi... | [
"As",
"the",
"Responder",
"is",
"multi",
"-",
"threaded",
"make",
"sure",
"that",
"the",
"access",
"to",
"the",
"services",
"list",
"which",
"might",
"change",
"out",
"if",
"the",
"user",
"changes",
"it",
"is",
"synchronized",
"to",
"make",
"sure",
"nothin... | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/plugin/configfile/ConfigFileProbeHandlerPlugin.java#L87-L95 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/plugin/configfile/ConfigFileProbeHandlerPlugin.java | ConfigFileProbeHandlerPlugin.initializeWithPropertiesFilename | public void initializeWithPropertiesFilename(String filename) throws ProbeHandlerConfigException {
InputStream is;
// try to load the properties file off the classpath first
if (ConfigFileProbeHandlerPlugin.class.getResource(filename) != null) {
is = ConfigFileProbeHandlerPlugin.class.getResourceAsS... | java | public void initializeWithPropertiesFilename(String filename) throws ProbeHandlerConfigException {
InputStream is;
// try to load the properties file off the classpath first
if (ConfigFileProbeHandlerPlugin.class.getResource(filename) != null) {
is = ConfigFileProbeHandlerPlugin.class.getResourceAsS... | [
"public",
"void",
"initializeWithPropertiesFilename",
"(",
"String",
"filename",
")",
"throws",
"ProbeHandlerConfigException",
"{",
"InputStream",
"is",
";",
"// try to load the properties file off the classpath first",
"if",
"(",
"ConfigFileProbeHandlerPlugin",
".",
"class",
"... | Initialize the handler. | [
"Initialize",
"the",
"handler",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/plugin/configfile/ConfigFileProbeHandlerPlugin.java#L163-L198 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/ArgoClientContext.java | ArgoClientContext.initializeTransports | private void initializeTransports(ArrayList<TransportConfig> transportConfigs) {
for (TransportConfig config : transportConfigs) {
ClientProbeSenders transport = new ClientProbeSenders(config);
try {
transport.initialize(this);
_clientSenders.add(transport);
} catch (TransportConfi... | java | private void initializeTransports(ArrayList<TransportConfig> transportConfigs) {
for (TransportConfig config : transportConfigs) {
ClientProbeSenders transport = new ClientProbeSenders(config);
try {
transport.initialize(this);
_clientSenders.add(transport);
} catch (TransportConfi... | [
"private",
"void",
"initializeTransports",
"(",
"ArrayList",
"<",
"TransportConfig",
">",
"transportConfigs",
")",
"{",
"for",
"(",
"TransportConfig",
"config",
":",
"transportConfigs",
")",
"{",
"ClientProbeSenders",
"transport",
"=",
"new",
"ClientProbeSenders",
"("... | Initializes the Transports.
@param transportConfigs the list if the transport configurations to use | [
"Initializes",
"the",
"Transports",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/ArgoClientContext.java#L74-L86 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/ArgoClientContext.java | ArgoClientContext.initializeLocalhostNI | private void initializeLocalhostNI() {
InetAddress localhost;
try {
localhost = InetAddress.getLocalHost();
NetworkInterface ni = NetworkInterface.getByInetAddress(localhost);
if (ni != null)
getNIList().add(ni.getName());
} catch (UnknownHostException | SocketException e) {
... | java | private void initializeLocalhostNI() {
InetAddress localhost;
try {
localhost = InetAddress.getLocalHost();
NetworkInterface ni = NetworkInterface.getByInetAddress(localhost);
if (ni != null)
getNIList().add(ni.getName());
} catch (UnknownHostException | SocketException e) {
... | [
"private",
"void",
"initializeLocalhostNI",
"(",
")",
"{",
"InetAddress",
"localhost",
";",
"try",
"{",
"localhost",
"=",
"InetAddress",
".",
"getLocalHost",
"(",
")",
";",
"NetworkInterface",
"ni",
"=",
"NetworkInterface",
".",
"getByInetAddress",
"(",
"localhost... | Sets up the network interface list with at least the localhost NI. | [
"Sets",
"up",
"the",
"network",
"interface",
"list",
"with",
"at",
"least",
"the",
"localhost",
"NI",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/ArgoClientContext.java#L156-L170 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/ArgoClientContext.java | ArgoClientContext.getAvailableNetworkInterfaces | public List<String> getAvailableNetworkInterfaces(boolean requiresMulticast) throws SocketException {
Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces();
List<String> multicastNIs = new ArrayList<String>();
// Console.info("Available Multicast-enabled Network Interfaces");
wh... | java | public List<String> getAvailableNetworkInterfaces(boolean requiresMulticast) throws SocketException {
Enumeration<NetworkInterface> nis = NetworkInterface.getNetworkInterfaces();
List<String> multicastNIs = new ArrayList<String>();
// Console.info("Available Multicast-enabled Network Interfaces");
wh... | [
"public",
"List",
"<",
"String",
">",
"getAvailableNetworkInterfaces",
"(",
"boolean",
"requiresMulticast",
")",
"throws",
"SocketException",
"{",
"Enumeration",
"<",
"NetworkInterface",
">",
"nis",
"=",
"NetworkInterface",
".",
"getNetworkInterfaces",
"(",
")",
";",
... | This gets a list of all the available network interface names.
@param requiresMulticast return only NIs that are multicast capable
@return the list of the currently available network interface names
@throws SocketException if the
{@linkplain NetworkInterface#getNetworkInterfaces()} call fails | [
"This",
"gets",
"a",
"list",
"of",
"all",
"the",
"available",
"network",
"interface",
"names",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/ArgoClientContext.java#L181-L202 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/ArgoClientContext.java | ArgoClientContext.getClientTransportNamed | public ClientProbeSenders getClientTransportNamed(String transportName) {
ClientProbeSenders found = null;
for (ClientProbeSenders t : _clientSenders) {
if (t.getName().equalsIgnoreCase(transportName)) {
found = t;
break;
}
}
return found;
} | java | public ClientProbeSenders getClientTransportNamed(String transportName) {
ClientProbeSenders found = null;
for (ClientProbeSenders t : _clientSenders) {
if (t.getName().equalsIgnoreCase(transportName)) {
found = t;
break;
}
}
return found;
} | [
"public",
"ClientProbeSenders",
"getClientTransportNamed",
"(",
"String",
"transportName",
")",
"{",
"ClientProbeSenders",
"found",
"=",
"null",
";",
"for",
"(",
"ClientProbeSenders",
"t",
":",
"_clientSenders",
")",
"{",
"if",
"(",
"t",
".",
"getName",
"(",
")"... | Returns the client transport specified by given name.
@param transportName client transport name
@return the ClientTransport that matches the name | [
"Returns",
"the",
"client",
"transport",
"specified",
"by",
"given",
"name",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/ArgoClientContext.java#L209-L221 | train |
johnlcox/motif | motif/src/main/java/com/leacox/motif/cases/Case3Cases.java | Case3Cases.case3 | public static <T extends Case3<A, B, C>, A, B, C> DecomposableMatchBuilder0<T> case3(
Class<T> clazz, MatchesExact<A> a, MatchesExact<B> b, MatchesExact<C> c) {
List<Matcher<Object>> matchers =
Lists.of(ArgumentMatchers.eq(a.t), ArgumentMatchers.eq(b.t), ArgumentMatchers.eq(c.t));
return new Decom... | java | public static <T extends Case3<A, B, C>, A, B, C> DecomposableMatchBuilder0<T> case3(
Class<T> clazz, MatchesExact<A> a, MatchesExact<B> b, MatchesExact<C> c) {
List<Matcher<Object>> matchers =
Lists.of(ArgumentMatchers.eq(a.t), ArgumentMatchers.eq(b.t), ArgumentMatchers.eq(c.t));
return new Decom... | [
"public",
"static",
"<",
"T",
"extends",
"Case3",
"<",
"A",
",",
"B",
",",
"C",
">",
",",
"A",
",",
"B",
",",
"C",
">",
"DecomposableMatchBuilder0",
"<",
"T",
">",
"case3",
"(",
"Class",
"<",
"T",
">",
"clazz",
",",
"MatchesExact",
"<",
"A",
">",... | Matches a case class of three elements. | [
"Matches",
"a",
"case",
"class",
"of",
"three",
"elements",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/motif/src/main/java/com/leacox/motif/cases/Case3Cases.java#L48-L53 | train |
di2e/Argo | clui/src/main/java/net/dharwin/common/tools/cli/api/Command.java | Command.execute | public CommandResult execute(T context) {
try {
return innerExecute(context);
} catch (Exception e) {
Console.error(e.getMessage());
return CommandResult.ERROR;
}
} | java | public CommandResult execute(T context) {
try {
return innerExecute(context);
} catch (Exception e) {
Console.error(e.getMessage());
return CommandResult.ERROR;
}
} | [
"public",
"CommandResult",
"execute",
"(",
"T",
"context",
")",
"{",
"try",
"{",
"return",
"innerExecute",
"(",
"context",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"Console",
".",
"error",
"(",
"e",
".",
"getMessage",
"(",
")",
")",
"... | Executes the command. The command line arguments contains all of the
key-value pairs and switches, but does not include the command name that
came from the original arguments.
@param context the context object from the application
@return The result of the execution of this command. | [
"Executes",
"the",
"command",
".",
"The",
"command",
"line",
"arguments",
"contains",
"all",
"of",
"the",
"key",
"-",
"value",
"pairs",
"and",
"switches",
"but",
"does",
"not",
"include",
"the",
"command",
"name",
"that",
"came",
"from",
"the",
"original",
... | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/Command.java#L50-L57 | train |
johnlcox/motif | examples/src/main/java/com/leacox/motif/example/FactorialExample.java | FactorialExample.factMatching | public long factMatching(long n) {
return match(n)
.when(caseLong(0)).get(() -> 1L)
.when(caseLong(any())).get(i -> i * factMatching(i - 1))
.getMatch();
} | java | public long factMatching(long n) {
return match(n)
.when(caseLong(0)).get(() -> 1L)
.when(caseLong(any())).get(i -> i * factMatching(i - 1))
.getMatch();
} | [
"public",
"long",
"factMatching",
"(",
"long",
"n",
")",
"{",
"return",
"match",
"(",
"n",
")",
".",
"when",
"(",
"caseLong",
"(",
"0",
")",
")",
".",
"get",
"(",
"(",
")",
"->",
"1L",
")",
".",
"when",
"(",
"caseLong",
"(",
"any",
"(",
")",
... | An implementation of factorial using motif pattern matching. | [
"An",
"implementation",
"of",
"factorial",
"using",
"motif",
"pattern",
"matching",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/examples/src/main/java/com/leacox/motif/example/FactorialExample.java#L43-L48 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Transforms.java | Transforms.createTransformedShape | public static IShape createTransformedShape (Transform t, IShape src) {
if (src == null) {
return null;
}
if (src instanceof Path) {
return ((Path)src).createTransformedShape(t);
}
PathIterator path = src.pathIterator(t);
Path dst = new Path(path.w... | java | public static IShape createTransformedShape (Transform t, IShape src) {
if (src == null) {
return null;
}
if (src instanceof Path) {
return ((Path)src).createTransformedShape(t);
}
PathIterator path = src.pathIterator(t);
Path dst = new Path(path.w... | [
"public",
"static",
"IShape",
"createTransformedShape",
"(",
"Transform",
"t",
",",
"IShape",
"src",
")",
"{",
"if",
"(",
"src",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"src",
"instanceof",
"Path",
")",
"{",
"return",
"(",
"(",
... | Creates and returns a new shape that is the supplied shape transformed by this transform's
matrix. | [
"Creates",
"and",
"returns",
"a",
"new",
"shape",
"that",
"is",
"the",
"supplied",
"shape",
"transformed",
"by",
"this",
"transform",
"s",
"matrix",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Transforms.java#L16-L27 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/CrossingHelper.java | CrossingHelper.sort | private static void sort (double[] coords1, int length1,
double[] coords2, int length2, int[] array) {
int temp;
int length = length1 + length2;
double x1, y1, x2, y2;
for (int i = 1; i < length; i++) {
if (array[i - 1] < length1) {
... | java | private static void sort (double[] coords1, int length1,
double[] coords2, int length2, int[] array) {
int temp;
int length = length1 + length2;
double x1, y1, x2, y2;
for (int i = 1; i < length; i++) {
if (array[i - 1] < length1) {
... | [
"private",
"static",
"void",
"sort",
"(",
"double",
"[",
"]",
"coords1",
",",
"int",
"length1",
",",
"double",
"[",
"]",
"coords2",
",",
"int",
"length2",
",",
"int",
"[",
"]",
"array",
")",
"{",
"int",
"temp",
";",
"int",
"length",
"=",
"length1",
... | the array sorting | [
"the",
"array",
"sorting"
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/CrossingHelper.java#L208-L253 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/RectangularShape.java | RectangularShape.setFrameFromDiagonal | public void setFrameFromDiagonal (float x1, float y1, float x2, float y2) {
float rx, ry, rw, rh;
if (x1 < x2) {
rx = x1;
rw = x2 - x1;
} else {
rx = x2;
rw = x1 - x2;
}
if (y1 < y2) {
ry = y1;
rh = y2 - y1;
... | java | public void setFrameFromDiagonal (float x1, float y1, float x2, float y2) {
float rx, ry, rw, rh;
if (x1 < x2) {
rx = x1;
rw = x2 - x1;
} else {
rx = x2;
rw = x1 - x2;
}
if (y1 < y2) {
ry = y1;
rh = y2 - y1;
... | [
"public",
"void",
"setFrameFromDiagonal",
"(",
"float",
"x1",
",",
"float",
"y1",
",",
"float",
"x2",
",",
"float",
"y2",
")",
"{",
"float",
"rx",
",",
"ry",
",",
"rw",
",",
"rh",
";",
"if",
"(",
"x1",
"<",
"x2",
")",
"{",
"rx",
"=",
"x1",
";",... | Sets the location and size of the framing rectangle of this shape based on the specified
diagonal line. | [
"Sets",
"the",
"location",
"and",
"size",
"of",
"the",
"framing",
"rectangle",
"of",
"this",
"shape",
"based",
"on",
"the",
"specified",
"diagonal",
"line",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/RectangularShape.java#L37-L54 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/RectangularShape.java | RectangularShape.setFrameFromCenter | public void setFrameFromCenter (float centerX, float centerY,
float cornerX, float cornerY) {
float width = Math.abs(cornerX - centerX);
float height = Math.abs(cornerY - centerY);
setFrame(centerX - width, centerY - height, width * 2, height * 2);
} | java | public void setFrameFromCenter (float centerX, float centerY,
float cornerX, float cornerY) {
float width = Math.abs(cornerX - centerX);
float height = Math.abs(cornerY - centerY);
setFrame(centerX - width, centerY - height, width * 2, height * 2);
} | [
"public",
"void",
"setFrameFromCenter",
"(",
"float",
"centerX",
",",
"float",
"centerY",
",",
"float",
"cornerX",
",",
"float",
"cornerY",
")",
"{",
"float",
"width",
"=",
"Math",
".",
"abs",
"(",
"cornerX",
"-",
"centerX",
")",
";",
"float",
"height",
... | Sets the location and size of the framing rectangle of this shape based on the specified
center and corner points. | [
"Sets",
"the",
"location",
"and",
"size",
"of",
"the",
"framing",
"rectangle",
"of",
"this",
"shape",
"based",
"on",
"the",
"specified",
"center",
"and",
"corner",
"points",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/RectangularShape.java#L68-L73 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/listener/ProbeResponseResource.java | ProbeResponseResource.handleJSONProbeResponse | @POST
@Path("/probeResponse")
@Consumes("application/json")
public String handleJSONProbeResponse(String probeResponseJSON) {
JSONSerializer serializer = new JSONSerializer();
ResponseWrapper response;
try {
response = serializer.unmarshal(probeResponseJSON);
} catch (ResponseParseExceptio... | java | @POST
@Path("/probeResponse")
@Consumes("application/json")
public String handleJSONProbeResponse(String probeResponseJSON) {
JSONSerializer serializer = new JSONSerializer();
ResponseWrapper response;
try {
response = serializer.unmarshal(probeResponseJSON);
} catch (ResponseParseExceptio... | [
"@",
"POST",
"@",
"Path",
"(",
"\"/probeResponse\"",
")",
"@",
"Consumes",
"(",
"\"application/json\"",
")",
"public",
"String",
"handleJSONProbeResponse",
"(",
"String",
"probeResponseJSON",
")",
"{",
"JSONSerializer",
"serializer",
"=",
"new",
"JSONSerializer",
"(... | Inbound JSON responses get processed here.
@param probeResponseJSON - the actual wireline response payload
@return some innocuous string | [
"Inbound",
"JSON",
"responses",
"get",
"processed",
"here",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/listener/ProbeResponseResource.java#L69-L97 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Circle.java | Circle.set | public Circle set (ICircle c) {
return set(c.x(), c.y(), c.radius());
} | java | public Circle set (ICircle c) {
return set(c.x(), c.y(), c.radius());
} | [
"public",
"Circle",
"set",
"(",
"ICircle",
"c",
")",
"{",
"return",
"set",
"(",
"c",
".",
"x",
"(",
")",
",",
"c",
".",
"y",
"(",
")",
",",
"c",
".",
"radius",
"(",
")",
")",
";",
"}"
] | Sets the properties of this circle to be equal to those of the supplied circle.
@return a reference to this this, for chaining. | [
"Sets",
"the",
"properties",
"of",
"this",
"circle",
"to",
"be",
"equal",
"to",
"those",
"of",
"the",
"supplied",
"circle",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Circle.java#L54-L56 | train |
samskivert/pythagoras | src/main/java/pythagoras/d/Circle.java | Circle.set | public Circle set (double x, double y, double radius) {
this.x = x;
this.y = y;
this.radius = radius;
return this;
} | java | public Circle set (double x, double y, double radius) {
this.x = x;
this.y = y;
this.radius = radius;
return this;
} | [
"public",
"Circle",
"set",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"radius",
")",
"{",
"this",
".",
"x",
"=",
"x",
";",
"this",
".",
"y",
"=",
"y",
";",
"this",
".",
"radius",
"=",
"radius",
";",
"return",
"this",
";",
"}"
] | Sets the properties of this circle to the supplied values.
@return a reference to this this, for chaining. | [
"Sets",
"the",
"properties",
"of",
"this",
"circle",
"to",
"the",
"supplied",
"values",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Circle.java#L60-L65 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Matrix4.java | Matrix4.setToRotation | public Matrix4 setToRotation (float angle, float x, float y, float z) {
float c = FloatMath.cos(angle), s = FloatMath.sin(angle), omc = 1f - c;
float xs = x*s, ys = y*s, zs = z*s, xy = x*y, xz = x*z, yz = y*z;
return set(x*x*omc + c, xy*omc - zs, xz*omc + ys, 0f,
xy*omc + zs, ... | java | public Matrix4 setToRotation (float angle, float x, float y, float z) {
float c = FloatMath.cos(angle), s = FloatMath.sin(angle), omc = 1f - c;
float xs = x*s, ys = y*s, zs = z*s, xy = x*y, xz = x*z, yz = y*z;
return set(x*x*omc + c, xy*omc - zs, xz*omc + ys, 0f,
xy*omc + zs, ... | [
"public",
"Matrix4",
"setToRotation",
"(",
"float",
"angle",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"float",
"c",
"=",
"FloatMath",
".",
"cos",
"(",
"angle",
")",
",",
"s",
"=",
"FloatMath",
".",
"sin",
"(",
"angle",
")"... | Sets this to a rotation matrix. The formula comes from the OpenGL documentation for the
glRotatef function.
@return a reference to this matrix, for chaining. | [
"Sets",
"this",
"to",
"a",
"rotation",
"matrix",
".",
"The",
"formula",
"comes",
"from",
"the",
"OpenGL",
"documentation",
"for",
"the",
"glRotatef",
"function",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Matrix4.java#L212-L219 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Matrix4.java | Matrix4.setToReflection | public Matrix4 setToReflection (float x, float y, float z, float w) {
float x2 = -2f*x, y2 = -2f*y, z2 = -2f*z;
float xy2 = x2*y, xz2 = x2*z, yz2 = y2*z;
float x2y2z2 = x*x + y*y + z*z;
return set(1f + x2*x, xy2, xz2, x2*w*x2y2z2,
xy2, 1f + y2*y, yz2, y2*w*x2y2z2,
... | java | public Matrix4 setToReflection (float x, float y, float z, float w) {
float x2 = -2f*x, y2 = -2f*y, z2 = -2f*z;
float xy2 = x2*y, xz2 = x2*z, yz2 = y2*z;
float x2y2z2 = x*x + y*y + z*z;
return set(1f + x2*x, xy2, xz2, x2*w*x2y2z2,
xy2, 1f + y2*y, yz2, y2*w*x2y2z2,
... | [
"public",
"Matrix4",
"setToReflection",
"(",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
",",
"float",
"w",
")",
"{",
"float",
"x2",
"=",
"-",
"2f",
"*",
"x",
",",
"y2",
"=",
"-",
"2f",
"*",
"y",
",",
"z2",
"=",
"-",
"2f",
"*",
"z",
... | Sets this to a reflection across the specified plane.
@return a reference to this matrix, for chaining. | [
"Sets",
"this",
"to",
"a",
"reflection",
"across",
"the",
"specified",
"plane",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Matrix4.java#L326-L334 | train |
samskivert/pythagoras | src/main/java/pythagoras/f/Matrix4.java | Matrix4.set | public Matrix4 set (float[] values) {
return set(values[0], values[1], values[2], values[3],
values[4], values[5], values[6], values[7],
values[8], values[9], values[10], values[11],
values[12], values[13], values[14], values[15]);
} | java | public Matrix4 set (float[] values) {
return set(values[0], values[1], values[2], values[3],
values[4], values[5], values[6], values[7],
values[8], values[9], values[10], values[11],
values[12], values[13], values[14], values[15]);
} | [
"public",
"Matrix4",
"set",
"(",
"float",
"[",
"]",
"values",
")",
"{",
"return",
"set",
"(",
"values",
"[",
"0",
"]",
",",
"values",
"[",
"1",
"]",
",",
"values",
"[",
"2",
"]",
",",
"values",
"[",
"3",
"]",
",",
"values",
"[",
"4",
"]",
","... | Copies the elements of a row-major array.
@return a reference to this matrix, for chaining. | [
"Copies",
"the",
"elements",
"of",
"a",
"row",
"-",
"major",
"array",
"."
] | b8fea743ee8a7d742ad9c06ee4f11f50571fbd32 | https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/Matrix4.java#L457-L462 | train |
konmik/satellite | satellite/src/main/java/satellite/Restartable.java | Restartable.launch | public void launch(Object arg) {
ReconnectableMap.INSTANCE.dismiss(key);
out.put("restore", true);
out.put("arg", arg);
launches.onNext(arg);
} | java | public void launch(Object arg) {
ReconnectableMap.INSTANCE.dismiss(key);
out.put("restore", true);
out.put("arg", arg);
launches.onNext(arg);
} | [
"public",
"void",
"launch",
"(",
"Object",
"arg",
")",
"{",
"ReconnectableMap",
".",
"INSTANCE",
".",
"dismiss",
"(",
"key",
")",
";",
"out",
".",
"put",
"(",
"\"restore\"",
",",
"true",
")",
";",
"out",
".",
"put",
"(",
"\"arg\"",
",",
"arg",
")",
... | Launches an observable providing an argument.
Dismisses the previous observable instance if it is not completed yet.
Note that to make use of arguments, both
{@link #channel(DeliveryMethod, ObservableFactory)} and
{@link #launch(Object)} variants should be used.
@param arg an argument for the new observable.
It must ... | [
"Launches",
"an",
"observable",
"providing",
"an",
"argument",
".",
"Dismisses",
"the",
"previous",
"observable",
"instance",
"if",
"it",
"is",
"not",
"completed",
"yet",
"."
] | 7b0d3194bf84b3db4c233a131890a23e2d5825b9 | https://github.com/konmik/satellite/blob/7b0d3194bf84b3db4c233a131890a23e2d5825b9/satellite/src/main/java/satellite/Restartable.java#L123-L128 | train |
johnlcox/motif | motif/src/main/java/com/leacox/motif/extract/util/Lists.java | Lists.of | public static <E> List<E> of(E e1, E e2, E e3, E e4) {
List<E> list = new ArrayList<>();
list.add(e1);
list.add(e2);
list.add(e3);
list.add(e4);
return list;
} | java | public static <E> List<E> of(E e1, E e2, E e3, E e4) {
List<E> list = new ArrayList<>();
list.add(e1);
list.add(e2);
list.add(e3);
list.add(e4);
return list;
} | [
"public",
"static",
"<",
"E",
">",
"List",
"<",
"E",
">",
"of",
"(",
"E",
"e1",
",",
"E",
"e2",
",",
"E",
"e3",
",",
"E",
"e4",
")",
"{",
"List",
"<",
"E",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"list",
".",
"add",
"("... | Returns a list of the given elements, in order. | [
"Returns",
"a",
"list",
"of",
"the",
"given",
"elements",
"in",
"order",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/motif/src/main/java/com/leacox/motif/extract/util/Lists.java#L75-L82 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/plugin/configfile/ConfigFileMonitorTask.java | ConfigFileMonitorTask.run | public void run() {
LOGGER.debug("begin scan for config file changes ...");
try {
Date lastModified = new Date(_xmlConfigFile.lastModified());
if (_lastTimeRead == null || lastModified.after(_lastTimeRead)) {
LOGGER.info("loading config file changes ...");
this.loadServiceConfigFile... | java | public void run() {
LOGGER.debug("begin scan for config file changes ...");
try {
Date lastModified = new Date(_xmlConfigFile.lastModified());
if (_lastTimeRead == null || lastModified.after(_lastTimeRead)) {
LOGGER.info("loading config file changes ...");
this.loadServiceConfigFile... | [
"public",
"void",
"run",
"(",
")",
"{",
"LOGGER",
".",
"debug",
"(",
"\"begin scan for config file changes ...\"",
")",
";",
"try",
"{",
"Date",
"lastModified",
"=",
"new",
"Date",
"(",
"_xmlConfigFile",
".",
"lastModified",
"(",
")",
")",
";",
"if",
"(",
... | When the timer goes off, look for changes to the specified xml config file.
For comparison, we are only interested in the last time we read the file. A
null value for lastTimeRead means that we never read the file before. | [
"When",
"the",
"timer",
"goes",
"off",
"look",
"for",
"changes",
"to",
"the",
"specified",
"xml",
"config",
"file",
".",
"For",
"comparison",
"we",
"are",
"only",
"interested",
"in",
"the",
"last",
"time",
"we",
"read",
"the",
"file",
".",
"A",
"null",
... | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/plugin/configfile/ConfigFileMonitorTask.java#L86-L101 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/plugin/configfile/ConfigFileMonitorTask.java | ConfigFileMonitorTask.loadServiceConfigFile | private void loadServiceConfigFile() throws ConfigurationException {
Properties properties = _plugin.getConfiguration();
Configuration config = ConfigurationConverter.getConfiguration(properties);
String xmlConfigFilename = config.getString("xmlConfigFilename");
_config = new ServiceListConfiguration(xmlCon... | java | private void loadServiceConfigFile() throws ConfigurationException {
Properties properties = _plugin.getConfiguration();
Configuration config = ConfigurationConverter.getConfiguration(properties);
String xmlConfigFilename = config.getString("xmlConfigFilename");
_config = new ServiceListConfiguration(xmlCon... | [
"private",
"void",
"loadServiceConfigFile",
"(",
")",
"throws",
"ConfigurationException",
"{",
"Properties",
"properties",
"=",
"_plugin",
".",
"getConfiguration",
"(",
")",
";",
"Configuration",
"config",
"=",
"ConfigurationConverter",
".",
"getConfiguration",
"(",
"... | actually load the xml configuration file. If anything goes wrong throws an
exception. This created a list of service records. When done, set the
service record list in the plugin. The plugin set function should be
synchronized so that it won't squash any concurrent access to the old set
of services.
@throws JAXBExcept... | [
"actually",
"load",
"the",
"xml",
"configuration",
"file",
".",
"If",
"anything",
"goes",
"wrong",
"throws",
"an",
"exception",
".",
"This",
"created",
"a",
"list",
"of",
"service",
"records",
".",
"When",
"done",
"set",
"the",
"service",
"record",
"list",
... | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/plugin/configfile/ConfigFileMonitorTask.java#L114-L131 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java | ClientProbeSenders.initialize | public void initialize(ArgoClientContext context) throws TransportConfigException {
transportProps = processPropertiesFile(config.getPropertiesFilename());
createProbeSenders(context);
} | java | public void initialize(ArgoClientContext context) throws TransportConfigException {
transportProps = processPropertiesFile(config.getPropertiesFilename());
createProbeSenders(context);
} | [
"public",
"void",
"initialize",
"(",
"ArgoClientContext",
"context",
")",
"throws",
"TransportConfigException",
"{",
"transportProps",
"=",
"processPropertiesFile",
"(",
"config",
".",
"getPropertiesFilename",
"(",
")",
")",
";",
"createProbeSenders",
"(",
"context",
... | Initialize the actual ProbeSenders.
@param context the context of the client application for parameters
@throws TransportConfigException if something goes wonky reading specific
configs for each transport | [
"Initialize",
"the",
"actual",
"ProbeSenders",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java#L50-L55 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java | ClientProbeSenders.getDescription | public String getDescription() {
StringBuffer buf = new StringBuffer();
String transportName = config.getName();
for (ProbeSender sender : senders) {
buf.append(transportName).append(" -- ").append(isEnabled() ? "Enabled" : "Disabled")
.append(" -- ").append(sender.getDescription());
}
... | java | public String getDescription() {
StringBuffer buf = new StringBuffer();
String transportName = config.getName();
for (ProbeSender sender : senders) {
buf.append(transportName).append(" -- ").append(isEnabled() ? "Enabled" : "Disabled")
.append(" -- ").append(sender.getDescription());
}
... | [
"public",
"String",
"getDescription",
"(",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"String",
"transportName",
"=",
"config",
".",
"getName",
"(",
")",
";",
"for",
"(",
"ProbeSender",
"sender",
":",
"senders",
")",
"{",
... | return the text description of the transport and its associated
ProbeSenders.
@return text description (one liner) | [
"return",
"the",
"text",
"description",
"of",
"the",
"transport",
"and",
"its",
"associated",
"ProbeSenders",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java#L79-L88 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java | ClientProbeSenders.showConfiguration | public String showConfiguration() {
StringBuffer buf = new StringBuffer();
buf.append("\n Client Transport Configuration\n");
buf.append(" Name ...................... ").append(config.getName()).append("\n");
buf.append(" Is Enabled................. ").append(isEnabled()).append("\n");
buf.... | java | public String showConfiguration() {
StringBuffer buf = new StringBuffer();
buf.append("\n Client Transport Configuration\n");
buf.append(" Name ...................... ").append(config.getName()).append("\n");
buf.append(" Is Enabled................. ").append(isEnabled()).append("\n");
buf.... | [
"public",
"String",
"showConfiguration",
"(",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"buf",
".",
"append",
"(",
"\"\\n Client Transport Configuration\\n\"",
")",
";",
"buf",
".",
"append",
"(",
"\" Name ........................ | Show the configuration for a Client Transport.
@return the configuration description of the ClientTransport | [
"Show",
"the",
"configuration",
"for",
"a",
"Client",
"Transport",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java#L95-L113 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java | ClientProbeSenders.close | public void close() {
for (ProbeSender sender : getSenders()) {
try {
sender.close();
} catch (TransportException e) {
LOGGER.warn( "Issue closing the ProbeSender [" + sender.getDescription() + "]", e);
}
}
} | java | public void close() {
for (ProbeSender sender : getSenders()) {
try {
sender.close();
} catch (TransportException e) {
LOGGER.warn( "Issue closing the ProbeSender [" + sender.getDescription() + "]", e);
}
}
} | [
"public",
"void",
"close",
"(",
")",
"{",
"for",
"(",
"ProbeSender",
"sender",
":",
"getSenders",
"(",
")",
")",
"{",
"try",
"{",
"sender",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"TransportException",
"e",
")",
"{",
"LOGGER",
".",
"warn",
... | This closes any of the underlying resources that a ProbeSender might be
using, such as a connection to a server somewhere. | [
"This",
"closes",
"any",
"of",
"the",
"underlying",
"resources",
"that",
"a",
"ProbeSender",
"might",
"be",
"using",
"such",
"as",
"a",
"connection",
"to",
"a",
"server",
"somewhere",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java#L119-L127 | train |
di2e/Argo | CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java | ClientProbeSenders.createProbeSenders | private void createProbeSenders(ArgoClientContext context) throws TransportConfigException {
senders = new ArrayList<ProbeSender>();
if (config.usesNetworkInterface()) {
try {
for (String niName : context.getAvailableNetworkInterfaces(config.requiresMulticast())) {
try {
... | java | private void createProbeSenders(ArgoClientContext context) throws TransportConfigException {
senders = new ArrayList<ProbeSender>();
if (config.usesNetworkInterface()) {
try {
for (String niName : context.getAvailableNetworkInterfaces(config.requiresMulticast())) {
try {
... | [
"private",
"void",
"createProbeSenders",
"(",
"ArgoClientContext",
"context",
")",
"throws",
"TransportConfigException",
"{",
"senders",
"=",
"new",
"ArrayList",
"<",
"ProbeSender",
">",
"(",
")",
";",
"if",
"(",
"config",
".",
"usesNetworkInterface",
"(",
")",
... | Create the actual ProbeSender instances given the configuration
information. If the transport depends on Network Interfaces, then create a
ProbeSender for each NI we can find on this machine.
@param context the main client configuration information
@throws TransportConfigException if there is some issue initializing t... | [
"Create",
"the",
"actual",
"ProbeSender",
"instances",
"given",
"the",
"configuration",
"information",
".",
"If",
"the",
"transport",
"depends",
"on",
"Network",
"Interfaces",
"then",
"create",
"a",
"ProbeSender",
"for",
"each",
"NI",
"we",
"can",
"find",
"on",
... | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/CLClient/src/main/java/ws/argo/CLClient/ClientProbeSenders.java#L161-L186 | train |
johnlcox/motif | generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java | BaseMatchMethodPermutationBuilder.getTypeVariables | protected List<TypeVariableName> getTypeVariables(TypeName t) {
return match(t)
.when(typeOf(TypeVariableName.class)).get(
v -> {
if (v.bounds.isEmpty()) {
return ImmutableList.of(v);
} else {
return Stream.concat(
S... | java | protected List<TypeVariableName> getTypeVariables(TypeName t) {
return match(t)
.when(typeOf(TypeVariableName.class)).get(
v -> {
if (v.bounds.isEmpty()) {
return ImmutableList.of(v);
} else {
return Stream.concat(
S... | [
"protected",
"List",
"<",
"TypeVariableName",
">",
"getTypeVariables",
"(",
"TypeName",
"t",
")",
"{",
"return",
"match",
"(",
"t",
")",
".",
"when",
"(",
"typeOf",
"(",
"TypeVariableName",
".",
"class",
")",
")",
".",
"get",
"(",
"v",
"->",
"{",
"if",... | Returns a list of type variables for a given type.
<p>There are several cases for what the returned type variables will be:
<ul>
<li>If {@code t} is a type variable itself, and has no bounds, then a singleton list
containing only {@code t} will be returned.</li>
<li>If {@code t} is a type variable with bounds, then th... | [
"Returns",
"a",
"list",
"of",
"type",
"variables",
"for",
"a",
"given",
"type",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java#L75-L96 | train |
johnlcox/motif | generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java | BaseMatchMethodPermutationBuilder.createTypeArityList | protected List<TypeNameWithArity> createTypeArityList(
TypeName t, String extractVariableName, int maxArity) {
TypeName u = match(t)
.when(typeOf(TypeVariableName.class))
.get(x -> (TypeName) TypeVariableName.get("E" + x.name, x))
.orElse(x -> x)
.getMatch();
List<TypeName... | java | protected List<TypeNameWithArity> createTypeArityList(
TypeName t, String extractVariableName, int maxArity) {
TypeName u = match(t)
.when(typeOf(TypeVariableName.class))
.get(x -> (TypeName) TypeVariableName.get("E" + x.name, x))
.orElse(x -> x)
.getMatch();
List<TypeName... | [
"protected",
"List",
"<",
"TypeNameWithArity",
">",
"createTypeArityList",
"(",
"TypeName",
"t",
",",
"String",
"extractVariableName",
",",
"int",
"maxArity",
")",
"{",
"TypeName",
"u",
"=",
"match",
"(",
"t",
")",
".",
"when",
"(",
"typeOf",
"(",
"TypeVaria... | Returns a list of pairs of types and arities up to a given max arity. | [
"Returns",
"a",
"list",
"of",
"pairs",
"of",
"types",
"and",
"arities",
"up",
"to",
"a",
"given",
"max",
"arity",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java#L118-L143 | train |
johnlcox/motif | generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java | BaseMatchMethodPermutationBuilder.createTypeVariables | protected TypeName[] createTypeVariables(
TypeName extractedType, String extractVariableName, int extractArity) {
List<TypeName> typeVariables = new ArrayList<>();
typeVariables.add(extractedType);
if (extractArity > 0) {
typeVariables.addAll(
IntStream.rangeClosed(1, extractArity)
... | java | protected TypeName[] createTypeVariables(
TypeName extractedType, String extractVariableName, int extractArity) {
List<TypeName> typeVariables = new ArrayList<>();
typeVariables.add(extractedType);
if (extractArity > 0) {
typeVariables.addAll(
IntStream.rangeClosed(1, extractArity)
... | [
"protected",
"TypeName",
"[",
"]",
"createTypeVariables",
"(",
"TypeName",
"extractedType",
",",
"String",
"extractVariableName",
",",
"int",
"extractArity",
")",
"{",
"List",
"<",
"TypeName",
">",
"typeVariables",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
... | Returns an array of type variables for a given type and arity. | [
"Returns",
"an",
"array",
"of",
"type",
"variables",
"for",
"a",
"given",
"type",
"and",
"arity",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java#L148-L160 | train |
johnlcox/motif | generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java | BaseMatchMethodPermutationBuilder.getMatcherStatementArgs | protected static Object[] getMatcherStatementArgs(int matchedCount) {
TypeName matcher = ParameterizedTypeName.get(ClassName.get(Matcher.class), TypeName.OBJECT);
TypeName listOfMatchers = ParameterizedTypeName.get(ClassName.get(List.class), matcher);
TypeName lists = TypeName.get(Lists.class);
TypeName... | java | protected static Object[] getMatcherStatementArgs(int matchedCount) {
TypeName matcher = ParameterizedTypeName.get(ClassName.get(Matcher.class), TypeName.OBJECT);
TypeName listOfMatchers = ParameterizedTypeName.get(ClassName.get(List.class), matcher);
TypeName lists = TypeName.get(Lists.class);
TypeName... | [
"protected",
"static",
"Object",
"[",
"]",
"getMatcherStatementArgs",
"(",
"int",
"matchedCount",
")",
"{",
"TypeName",
"matcher",
"=",
"ParameterizedTypeName",
".",
"get",
"(",
"ClassName",
".",
"get",
"(",
"Matcher",
".",
"class",
")",
",",
"TypeName",
".",
... | Returns the statement arguments for the match method matcher statement. | [
"Returns",
"the",
"statement",
"arguments",
"for",
"the",
"match",
"method",
"matcher",
"statement",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java#L165-L176 | train |
johnlcox/motif | generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java | BaseMatchMethodPermutationBuilder.getMatchType | protected MatchType getMatchType(TypeName m) {
return match(m)
.when(typeOf(ParameterizedTypeName.class)).get(
t -> {
if (isDecomposableBuilder(t.rawType)) {
return MatchType.DECOMPOSE;
} else if (t.rawType.equals(MATCH_ANY)) {
return M... | java | protected MatchType getMatchType(TypeName m) {
return match(m)
.when(typeOf(ParameterizedTypeName.class)).get(
t -> {
if (isDecomposableBuilder(t.rawType)) {
return MatchType.DECOMPOSE;
} else if (t.rawType.equals(MATCH_ANY)) {
return M... | [
"protected",
"MatchType",
"getMatchType",
"(",
"TypeName",
"m",
")",
"{",
"return",
"match",
"(",
"m",
")",
".",
"when",
"(",
"typeOf",
"(",
"ParameterizedTypeName",
".",
"class",
")",
")",
".",
"get",
"(",
"t",
"->",
"{",
"if",
"(",
"isDecomposableBuild... | Returns the type of match to use for a given type. | [
"Returns",
"the",
"type",
"of",
"match",
"to",
"use",
"for",
"a",
"given",
"type",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java#L181-L198 | train |
johnlcox/motif | generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java | BaseMatchMethodPermutationBuilder.getExtractedTypes | protected List<TypeName> getExtractedTypes(TypeName permutationType, TypeName paramType) {
return match(permutationType)
.when(typeOf(ParameterizedTypeName.class)).get(
t -> {
if (isDecomposableBuilder(t.rawType)) {
return t.typeArguments.subList(1, t.typeArguments.... | java | protected List<TypeName> getExtractedTypes(TypeName permutationType, TypeName paramType) {
return match(permutationType)
.when(typeOf(ParameterizedTypeName.class)).get(
t -> {
if (isDecomposableBuilder(t.rawType)) {
return t.typeArguments.subList(1, t.typeArguments.... | [
"protected",
"List",
"<",
"TypeName",
">",
"getExtractedTypes",
"(",
"TypeName",
"permutationType",
",",
"TypeName",
"paramType",
")",
"{",
"return",
"match",
"(",
"permutationType",
")",
".",
"when",
"(",
"typeOf",
"(",
"ParameterizedTypeName",
".",
"class",
")... | Returns the extracted type parameters. | [
"Returns",
"the",
"extracted",
"type",
"parameters",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java#L216-L232 | train |
johnlcox/motif | generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java | BaseMatchMethodPermutationBuilder.getReturnStatementArgs | protected List<TypeName> getReturnStatementArgs(MatchType matchType, TypeName paramType) {
List<TypeName> extractA;
if (matchType == MatchType.DECOMPOSE) {
TypeName u = match(paramType)
.when(typeOf(TypeVariableName.class)).get(
x -> (TypeName) TypeVariableName.get("E" + x.name, x)... | java | protected List<TypeName> getReturnStatementArgs(MatchType matchType, TypeName paramType) {
List<TypeName> extractA;
if (matchType == MatchType.DECOMPOSE) {
TypeName u = match(paramType)
.when(typeOf(TypeVariableName.class)).get(
x -> (TypeName) TypeVariableName.get("E" + x.name, x)... | [
"protected",
"List",
"<",
"TypeName",
">",
"getReturnStatementArgs",
"(",
"MatchType",
"matchType",
",",
"TypeName",
"paramType",
")",
"{",
"List",
"<",
"TypeName",
">",
"extractA",
";",
"if",
"(",
"matchType",
"==",
"MatchType",
".",
"DECOMPOSE",
")",
"{",
... | Returns the statement arguments for the match method returns statement. | [
"Returns",
"the",
"statement",
"arguments",
"for",
"the",
"match",
"method",
"returns",
"statement",
"."
] | 33a72d79fcbac16c89f8c4b0567856f2442f59be | https://github.com/johnlcox/motif/blob/33a72d79fcbac16c89f8c4b0567856f2442f59be/generator/src/main/java/com/leacox/motif/generate/BaseMatchMethodPermutationBuilder.java#L237-L253 | train |
di2e/Argo | ProbeSender/src/main/java/ws/argo/probe/ProbeSenderFactory.java | ProbeSenderFactory.createMulticastProbeSender | public static ProbeSender createMulticastProbeSender() throws ProbeSenderException, TransportConfigException {
Transport mcastTransport = new MulticastTransport("");
ProbeSender gen = new ProbeSender(mcastTransport);
return gen;
} | java | public static ProbeSender createMulticastProbeSender() throws ProbeSenderException, TransportConfigException {
Transport mcastTransport = new MulticastTransport("");
ProbeSender gen = new ProbeSender(mcastTransport);
return gen;
} | [
"public",
"static",
"ProbeSender",
"createMulticastProbeSender",
"(",
")",
"throws",
"ProbeSenderException",
",",
"TransportConfigException",
"{",
"Transport",
"mcastTransport",
"=",
"new",
"MulticastTransport",
"(",
"\"\"",
")",
";",
"ProbeSender",
"gen",
"=",
"new",
... | Create a Multicast ProbeSender with all the default values. The default
values are the default multicast group address and port of the Argo
protocol. The Network Interface is the NI associated with the localhost
address.
@return configured ProbeSender instance
@throws ProbeSenderException if something went wrong
@thro... | [
"Create",
"a",
"Multicast",
"ProbeSender",
"with",
"all",
"the",
"default",
"values",
".",
"The",
"default",
"values",
"are",
"the",
"default",
"multicast",
"group",
"address",
"and",
"port",
"of",
"the",
"Argo",
"protocol",
".",
"The",
"Network",
"Interface",... | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ProbeSender/src/main/java/ws/argo/probe/ProbeSenderFactory.java#L48-L53 | train |
di2e/Argo | ProbeSender/src/main/java/ws/argo/probe/ProbeSenderFactory.java | ProbeSenderFactory.createMulticastProbeSender | public static ProbeSender createMulticastProbeSender(String niName) throws TransportConfigException {
Transport mcastTransport = new MulticastTransport(niName);
ProbeSender gen = new ProbeSender(mcastTransport);
return gen;
} | java | public static ProbeSender createMulticastProbeSender(String niName) throws TransportConfigException {
Transport mcastTransport = new MulticastTransport(niName);
ProbeSender gen = new ProbeSender(mcastTransport);
return gen;
} | [
"public",
"static",
"ProbeSender",
"createMulticastProbeSender",
"(",
"String",
"niName",
")",
"throws",
"TransportConfigException",
"{",
"Transport",
"mcastTransport",
"=",
"new",
"MulticastTransport",
"(",
"niName",
")",
";",
"ProbeSender",
"gen",
"=",
"new",
"Probe... | Create a Multicast ProbeSender specifying the Network Interface to send
on.
@param niName network interface name
@return configured ProbeSender instance
@throws TransportConfigException if something went wrong | [
"Create",
"a",
"Multicast",
"ProbeSender",
"specifying",
"the",
"Network",
"Interface",
"to",
"send",
"on",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ProbeSender/src/main/java/ws/argo/probe/ProbeSenderFactory.java#L63-L67 | train |
di2e/Argo | ProbeSender/src/main/java/ws/argo/probe/ProbeSenderFactory.java | ProbeSenderFactory.createSNSProbeSender | public static ProbeSender createSNSProbeSender(String ak, String sk) throws ProbeSenderException {
Transport snsTransport = new AmazonSNSTransport(ak, sk);
ProbeSender gen = new ProbeSender(snsTransport);
return gen;
} | java | public static ProbeSender createSNSProbeSender(String ak, String sk) throws ProbeSenderException {
Transport snsTransport = new AmazonSNSTransport(ak, sk);
ProbeSender gen = new ProbeSender(snsTransport);
return gen;
} | [
"public",
"static",
"ProbeSender",
"createSNSProbeSender",
"(",
"String",
"ak",
",",
"String",
"sk",
")",
"throws",
"ProbeSenderException",
"{",
"Transport",
"snsTransport",
"=",
"new",
"AmazonSNSTransport",
"(",
"ak",
",",
"sk",
")",
";",
"ProbeSender",
"gen",
... | Create a AmazonSNS transport ProbeSender using the default values.
@param ak the amazon access key
@param sk the amazon secret key
@return configured ProbeSender instance
@throws ProbeSenderException if something went wrong | [
"Create",
"a",
"AmazonSNS",
"transport",
"ProbeSender",
"using",
"the",
"default",
"values",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/ProbeSender/src/main/java/ws/argo/probe/ProbeSenderFactory.java#L108-L112 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java | Responder.initializeHTTPClient | private void initializeHTTPClient() {
if (_config.isHTTPSConfigured()) {
try {
KeyStore trustKeystore = getClientTruststore();
SSLContext sslContext = SSLContexts.custom()
.loadTrustMaterial(trustKeystore, new TrustSelfSignedStrategy())
.build();
SSLConnection... | java | private void initializeHTTPClient() {
if (_config.isHTTPSConfigured()) {
try {
KeyStore trustKeystore = getClientTruststore();
SSLContext sslContext = SSLContexts.custom()
.loadTrustMaterial(trustKeystore, new TrustSelfSignedStrategy())
.build();
SSLConnection... | [
"private",
"void",
"initializeHTTPClient",
"(",
")",
"{",
"if",
"(",
"_config",
".",
"isHTTPSConfigured",
"(",
")",
")",
"{",
"try",
"{",
"KeyStore",
"trustKeystore",
"=",
"getClientTruststore",
"(",
")",
";",
"SSLContext",
"sslContext",
"=",
"SSLContexts",
".... | Create HTTP Client. | [
"Create",
"HTTP",
"Client",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java#L153-L184 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java | Responder.getClientTruststore | private KeyStore getClientTruststore() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
KeyStore ks = null;
if (_config.getTruststoreType() != null && !_config.getTruststoreType().isEmpty()) {
try {
ks = KeyStore.getInstance(_config.getTruststoreType())... | java | private KeyStore getClientTruststore() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException {
KeyStore ks = null;
if (_config.getTruststoreType() != null && !_config.getTruststoreType().isEmpty()) {
try {
ks = KeyStore.getInstance(_config.getTruststoreType())... | [
"private",
"KeyStore",
"getClientTruststore",
"(",
")",
"throws",
"KeyStoreException",
",",
"NoSuchAlgorithmException",
",",
"CertificateException",
",",
"IOException",
"{",
"KeyStore",
"ks",
"=",
"null",
";",
"if",
"(",
"_config",
".",
"getTruststoreType",
"(",
")"... | Read the KeyStore information supplied from the responder configuration file.
@return the KeyStore object
@throws KeyStoreException if there is an issue reading the keystore
@throws NoSuchAlgorithmException if the truststore type is incorrect
@throws CertificateException if there is some issues reading in the certs
@t... | [
"Read",
"the",
"KeyStore",
"information",
"supplied",
"from",
"the",
"responder",
"configuration",
"file",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java#L195-L224 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java | Responder.stopResponder | public void stopResponder() {
LOGGER.info("Force shutdown of Responder [" + _runtimeId + "]");
_shutdownHook.start();
Runtime.getRuntime().removeShutdownHook(_shutdownHook);
} | java | public void stopResponder() {
LOGGER.info("Force shutdown of Responder [" + _runtimeId + "]");
_shutdownHook.start();
Runtime.getRuntime().removeShutdownHook(_shutdownHook);
} | [
"public",
"void",
"stopResponder",
"(",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Force shutdown of Responder [\"",
"+",
"_runtimeId",
"+",
"\"]\"",
")",
";",
"_shutdownHook",
".",
"start",
"(",
")",
";",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"removeSh... | Close the socket and tell the processing loop to terminate. This is a
forced shutdown rather then a natural shutdown. A natural shutdown happens
when the shutdown hook fires when the VM exists. This method forces all
that to happen. This is done to allow multiple Responders to be created and
destroyed during a single V... | [
"Close",
"the",
"socket",
"and",
"tell",
"the",
"processing",
"loop",
"to",
"terminate",
".",
"This",
"is",
"a",
"forced",
"shutdown",
"rather",
"then",
"a",
"natural",
"shutdown",
".",
"A",
"natural",
"shutdown",
"happens",
"when",
"the",
"shutdown",
"hook"... | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java#L333-L337 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java | Responder.shutdown | public void shutdown() {
LOGGER.info("Responder shutting down: [" + _runtimeId + "]");
for (Transport t : _transports) {
try {
t.shutdown();
} catch (TransportException e) {
LOGGER.warn( "Error shutting down transport: [" + t.transportName() + "]", e);
}
}
} | java | public void shutdown() {
LOGGER.info("Responder shutting down: [" + _runtimeId + "]");
for (Transport t : _transports) {
try {
t.shutdown();
} catch (TransportException e) {
LOGGER.warn( "Error shutting down transport: [" + t.transportName() + "]", e);
}
}
} | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Responder shutting down: [\"",
"+",
"_runtimeId",
"+",
"\"]\"",
")",
";",
"for",
"(",
"Transport",
"t",
":",
"_transports",
")",
"{",
"try",
"{",
"t",
".",
"shutdown",
"(",
")",
... | This will shutdown the listening socket and remove the responder from the
multicast group. Part of the natural life cycle. It also will end the run
loop of the responder automatically - it will interrupt any read operation
going on and exit the run loop. | [
"This",
"will",
"shutdown",
"the",
"listening",
"socket",
"and",
"remove",
"the",
"responder",
"from",
"the",
"multicast",
"group",
".",
"Part",
"of",
"the",
"natural",
"life",
"cycle",
".",
"It",
"also",
"will",
"end",
"the",
"run",
"loop",
"of",
"the",
... | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java#L345-L354 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java | Responder.run | public void run() {
// I hope that this hits you over the head with its simplicity.
// That's the idea. The instances of the transports are supposed to be self
// contained.
Thread transportThread;
for (Transport t : _transports) {
transportThread = new Thread(t);
transportThread.setN... | java | public void run() {
// I hope that this hits you over the head with its simplicity.
// That's the idea. The instances of the transports are supposed to be self
// contained.
Thread transportThread;
for (Transport t : _transports) {
transportThread = new Thread(t);
transportThread.setN... | [
"public",
"void",
"run",
"(",
")",
"{",
"// I hope that this hits you over the head with its simplicity.",
"// That's the idea. The instances of the transports are supposed to be self",
"// contained.",
"Thread",
"transportThread",
";",
"for",
"(",
"Transport",
"t",
":",
"_transpor... | This is the main run method for the Argo Responder. It starts up all the
configured transports in their own thread and starts their receive loops.
<p>
Transports run in their own thread. Thus, when all the transports are
running, this method will exit. You can shutdown the Responder by calling
the {@linkplain #shutdow... | [
"This",
"is",
"the",
"main",
"run",
"method",
"for",
"the",
"Argo",
"Responder",
".",
"It",
"starts",
"up",
"all",
"the",
"configured",
"transports",
"in",
"their",
"own",
"thread",
"and",
"starts",
"their",
"receive",
"loops",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java#L372-L387 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java | Responder.probesPerSecond | public synchronized float probesPerSecond() {
Instant now = new Instant();
Instant event = null;
int events = 0;
boolean done = false;
long timeWindow = 0;
long oldestTime = 0;
do {
event = messages.poll();
if (event != null) {
events++;
if (events == 1)
... | java | public synchronized float probesPerSecond() {
Instant now = new Instant();
Instant event = null;
int events = 0;
boolean done = false;
long timeWindow = 0;
long oldestTime = 0;
do {
event = messages.poll();
if (event != null) {
events++;
if (events == 1)
... | [
"public",
"synchronized",
"float",
"probesPerSecond",
"(",
")",
"{",
"Instant",
"now",
"=",
"new",
"Instant",
"(",
")",
";",
"Instant",
"event",
"=",
"null",
";",
"int",
"events",
"=",
"0",
";",
"boolean",
"done",
"=",
"false",
";",
"long",
"timeWindow",... | Calculates the number of probes per second over the last 1000 probes.
@return probes per second | [
"Calculates",
"the",
"number",
"of",
"probes",
"per",
"second",
"over",
"the",
"last",
"1000",
"probes",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java#L402-L431 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java | Responder.main | public static void main(String[] args) throws ResponderConfigException {
Responder responder = initialize(args);
if (responder != null) {
responder.run();
}
} | java | public static void main(String[] args) throws ResponderConfigException {
Responder responder = initialize(args);
if (responder != null) {
responder.run();
}
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"ResponderConfigException",
"{",
"Responder",
"responder",
"=",
"initialize",
"(",
"args",
")",
";",
"if",
"(",
"responder",
"!=",
"null",
")",
"{",
"responder",
".",
"run"... | Main entry point for Argo Responder.
@param args command line arguments
@throws ResponderConfigException if bad things happen with the
configuration files | [
"Main",
"entry",
"point",
"for",
"Argo",
"Responder",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java#L491-L498 | train |
di2e/Argo | Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java | Responder.initialize | public static Responder initialize(String[] args) throws ResponderConfigException {
readVersionProperties();
LOGGER.info("Starting Argo Responder daemon process. Version " + ARGO_VERSION);
ResponderConfiguration config = parseCommandLine(args);
if (config == null) {
LOGGER.error( "Invalid Respo... | java | public static Responder initialize(String[] args) throws ResponderConfigException {
readVersionProperties();
LOGGER.info("Starting Argo Responder daemon process. Version " + ARGO_VERSION);
ResponderConfiguration config = parseCommandLine(args);
if (config == null) {
LOGGER.error( "Invalid Respo... | [
"public",
"static",
"Responder",
"initialize",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"ResponderConfigException",
"{",
"readVersionProperties",
"(",
")",
";",
"LOGGER",
".",
"info",
"(",
"\"Starting Argo Responder daemon process. Version \"",
"+",
"ARGO_VERSION... | Create a new Responder given the command line arguments.
@param args - command line arguments
@return the new Responder instance or null if something wonky happened
@throws ResponderConfigException if bad things happen with the
configuration files and the content of the files. For example if
the classnames for the pro... | [
"Create",
"a",
"new",
"Responder",
"given",
"the",
"command",
"line",
"arguments",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/Responder/ResponderDaemon/src/main/java/ws/argo/responder/Responder.java#L510-L543 | train |
di2e/Argo | clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java | CLIContext.loadProperties | private void loadProperties(String propFileName) {
if (propFileName != null) {
loadProperties(getClass().getResourceAsStream(propFileName), propFileName);
}
} | java | private void loadProperties(String propFileName) {
if (propFileName != null) {
loadProperties(getClass().getResourceAsStream(propFileName), propFileName);
}
} | [
"private",
"void",
"loadProperties",
"(",
"String",
"propFileName",
")",
"{",
"if",
"(",
"propFileName",
"!=",
"null",
")",
"{",
"loadProperties",
"(",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"(",
"propFileName",
")",
",",
"propFileName",
")",
";",
... | Load properties from a resource stream.
@param propFileName The resource name. | [
"Load",
"properties",
"from",
"a",
"resource",
"stream",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java#L54-L58 | train |
di2e/Argo | clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java | CLIContext.loadProperties | private void loadProperties(InputStream stream, String path) {
if (stream == null) {
return;
}
try {
Properties props = new Properties();
props.load(stream);
Iterator<Object> keyIt = props.keySet().iterator();
while (keyIt.hasNext()) {
String key = keyIt.next().toString();
... | java | private void loadProperties(InputStream stream, String path) {
if (stream == null) {
return;
}
try {
Properties props = new Properties();
props.load(stream);
Iterator<Object> keyIt = props.keySet().iterator();
while (keyIt.hasNext()) {
String key = keyIt.next().toString();
... | [
"private",
"void",
"loadProperties",
"(",
"InputStream",
"stream",
",",
"String",
"path",
")",
"{",
"if",
"(",
"stream",
"==",
"null",
")",
"{",
"return",
";",
"}",
"try",
"{",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")",
";",
"props",
".... | Loads properties from the given stream.
This will close the stream.
@param stream The stream to load from.
@param path The path represented by the stream. | [
"Loads",
"properties",
"from",
"the",
"given",
"stream",
".",
"This",
"will",
"close",
"the",
"stream",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java#L82-L110 | train |
di2e/Argo | clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java | CLIContext.put | public Object put(String key, Object o) {
return _properties.put(key, o);
} | java | public Object put(String key, Object o) {
return _properties.put(key, o);
} | [
"public",
"Object",
"put",
"(",
"String",
"key",
",",
"Object",
"o",
")",
"{",
"return",
"_properties",
".",
"put",
"(",
"key",
",",
"o",
")",
";",
"}"
] | Add an object to the context.
@param key The key to add.
@param o The object to add.
@return The previous object associated with this key, or null if there was none. | [
"Add",
"an",
"object",
"to",
"the",
"context",
"."
] | f537a03d2d25fdfecda7999ec10e1da67dc3b8f3 | https://github.com/di2e/Argo/blob/f537a03d2d25fdfecda7999ec10e1da67dc3b8f3/clui/src/main/java/net/dharwin/common/tools/cli/api/CLIContext.java#L134-L136 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.