repository_name stringlengths 7 54 | func_path_in_repository stringlengths 18 196 | func_name stringlengths 7 107 | whole_func_string stringlengths 76 3.82k | language stringclasses 1
value | func_code_string stringlengths 76 3.82k | func_code_tokens listlengths 22 717 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 508 | split_name stringclasses 1
value | func_code_url stringlengths 111 310 |
|---|---|---|---|---|---|---|---|---|---|---|
overturetool/overture | core/typechecker/src/main/java/org/overture/typechecker/TypeCheckInfo.java | TypeCheckInfo.contextSet | public <T> void contextSet(Class<T> key, T value)
{
synchronized (TypeCheckInfo.class)
{
Stack<T> contextStack = lookupListForType(key);
if (contextStack == null)
{
contextStack = new Stack<T>();
context.put(key, contextStack);
}
contextStack.push(value);
}
} | java | public <T> void contextSet(Class<T> key, T value)
{
synchronized (TypeCheckInfo.class)
{
Stack<T> contextStack = lookupListForType(key);
if (contextStack == null)
{
contextStack = new Stack<T>();
context.put(key, contextStack);
}
contextStack.push(value);
}
} | [
"public",
"<",
"T",
">",
"void",
"contextSet",
"(",
"Class",
"<",
"T",
">",
"key",
",",
"T",
"value",
")",
"{",
"synchronized",
"(",
"TypeCheckInfo",
".",
"class",
")",
"{",
"Stack",
"<",
"T",
">",
"contextStack",
"=",
"lookupListForType",
"(",
"key",
... | Associates the given key with the given value.
@param <T>
@param key
@param value | [
"Associates",
"the",
"given",
"key",
"with",
"the",
"given",
"value",
"."
] | train | https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/core/typechecker/src/main/java/org/overture/typechecker/TypeCheckInfo.java#L101-L113 |
keenon/loglinear | src/main/java/com/github/keenon/loglinear/inference/CliqueTree.java | CliqueTree.domainsOverlap | private boolean domainsOverlap(TableFactor f1, TableFactor f2) {
for (int n1 : f1.neighborIndices) {
for (int n2 : f2.neighborIndices) {
if (n1 == n2) return true;
}
}
return false;
} | java | private boolean domainsOverlap(TableFactor f1, TableFactor f2) {
for (int n1 : f1.neighborIndices) {
for (int n2 : f2.neighborIndices) {
if (n1 == n2) return true;
}
}
return false;
} | [
"private",
"boolean",
"domainsOverlap",
"(",
"TableFactor",
"f1",
",",
"TableFactor",
"f2",
")",
"{",
"for",
"(",
"int",
"n1",
":",
"f1",
".",
"neighborIndices",
")",
"{",
"for",
"(",
"int",
"n2",
":",
"f2",
".",
"neighborIndices",
")",
"{",
"if",
"(",... | Just a quick inline to check if two factors have overlapping domains. Since factor neighbor sets are super small,
this n^2 algorithm is fine.
@param f1 first factor to compare
@param f2 second factor to compare
@return whether their domains overlap | [
"Just",
"a",
"quick",
"inline",
"to",
"check",
"if",
"two",
"factors",
"have",
"overlapping",
"domains",
".",
"Since",
"factor",
"neighbor",
"sets",
"are",
"super",
"small",
"this",
"n^2",
"algorithm",
"is",
"fine",
"."
] | train | https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/inference/CliqueTree.java#L919-L926 |
jronrun/benayn | benayn-ustyle/src/main/java/com/benayn/ustyle/Gather.java | Gather.foreach | public <O> int foreach(Function<? super T, O> function) {
int count = 0;
for (T item : each()) {
function.apply(item);
++count;
}
return count;
} | java | public <O> int foreach(Function<? super T, O> function) {
int count = 0;
for (T item : each()) {
function.apply(item);
++count;
}
return count;
} | [
"public",
"<",
"O",
">",
"int",
"foreach",
"(",
"Function",
"<",
"?",
"super",
"T",
",",
"O",
">",
"function",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"T",
"item",
":",
"each",
"(",
")",
")",
"{",
"function",
".",
"apply",
"(",
"... | Invokes a function on each element of the delegate, ignoring the return value;
returns the number of elements that were present. | [
"Invokes",
"a",
"function",
"on",
"each",
"element",
"of",
"the",
"delegate",
"ignoring",
"the",
"return",
"value",
";",
"returns",
"the",
"number",
"of",
"elements",
"that",
"were",
"present",
"."
] | train | https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/Gather.java#L258-L266 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java | PactDslJsonArray.arrayEachLike | public static PactDslJsonBody arrayEachLike(Integer numberExamples) {
PactDslJsonArray parent = new PactDslJsonArray("", "", null, true);
parent.setNumberExamples(numberExamples);
parent.matchers.addRule("", parent.matchMin(0));
return new PactDslJsonBody(".", "", parent);
} | java | public static PactDslJsonBody arrayEachLike(Integer numberExamples) {
PactDslJsonArray parent = new PactDslJsonArray("", "", null, true);
parent.setNumberExamples(numberExamples);
parent.matchers.addRule("", parent.matchMin(0));
return new PactDslJsonBody(".", "", parent);
} | [
"public",
"static",
"PactDslJsonBody",
"arrayEachLike",
"(",
"Integer",
"numberExamples",
")",
"{",
"PactDslJsonArray",
"parent",
"=",
"new",
"PactDslJsonArray",
"(",
"\"\"",
",",
"\"\"",
",",
"null",
",",
"true",
")",
";",
"parent",
".",
"setNumberExamples",
"(... | Array where each item must match the following example
@param numberExamples Number of examples to generate | [
"Array",
"where",
"each",
"item",
"must",
"match",
"the",
"following",
"example"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L739-L744 |
infinispan/infinispan | commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java | UnsignedNumeric.writeUnsignedInt | public static int writeUnsignedInt(byte[] bytes, int offset, int i) {
int localOffset = offset;
while ((i & ~0x7F) != 0) {
bytes[localOffset++] = (byte) ((i & 0x7f) | 0x80);
i >>>= 7;
}
bytes[localOffset++] = (byte) i;
return localOffset - offset;
} | java | public static int writeUnsignedInt(byte[] bytes, int offset, int i) {
int localOffset = offset;
while ((i & ~0x7F) != 0) {
bytes[localOffset++] = (byte) ((i & 0x7f) | 0x80);
i >>>= 7;
}
bytes[localOffset++] = (byte) i;
return localOffset - offset;
} | [
"public",
"static",
"int",
"writeUnsignedInt",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"int",
"i",
")",
"{",
"int",
"localOffset",
"=",
"offset",
";",
"while",
"(",
"(",
"i",
"&",
"~",
"0x7F",
")",
"!=",
"0",
")",
"{",
"bytes",
... | Writes an int in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes.
Negative numbers are not supported.
@param i int to write | [
"Writes",
"an",
"int",
"in",
"a",
"variable",
"-",
"length",
"format",
".",
"Writes",
"between",
"one",
"and",
"five",
"bytes",
".",
"Smaller",
"values",
"take",
"fewer",
"bytes",
".",
"Negative",
"numbers",
"are",
"not",
"supported",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/io/UnsignedNumeric.java#L173-L181 |
hal/core | gui/src/main/java/org/jboss/as/console/client/rbac/SecurityContextImpl.java | SecurityContextImpl.checkPriviledge | private AuthorisationDecision checkPriviledge(Priviledge p, boolean includeOptional) {
AuthorisationDecision decision = new AuthorisationDecision(true);
for(AddressTemplate ref : requiredResources)
{
if(ref.isOptional()) continue; // skip optional ones
final Constraints model = getConstraints(ref, includeOptional);
if(model!=null)
{
if(!p.isGranted(model))
{
decision.getErrorMessages().add(ref.toString());
}
}
else
{
decision.getErrorMessages().add("Missing constraints for "+ ref.toString());
}
if(decision.hasErrorMessages())
{
decision.setGranted(false);
break;
}
}
return decision;
} | java | private AuthorisationDecision checkPriviledge(Priviledge p, boolean includeOptional) {
AuthorisationDecision decision = new AuthorisationDecision(true);
for(AddressTemplate ref : requiredResources)
{
if(ref.isOptional()) continue; // skip optional ones
final Constraints model = getConstraints(ref, includeOptional);
if(model!=null)
{
if(!p.isGranted(model))
{
decision.getErrorMessages().add(ref.toString());
}
}
else
{
decision.getErrorMessages().add("Missing constraints for "+ ref.toString());
}
if(decision.hasErrorMessages())
{
decision.setGranted(false);
break;
}
}
return decision;
} | [
"private",
"AuthorisationDecision",
"checkPriviledge",
"(",
"Priviledge",
"p",
",",
"boolean",
"includeOptional",
")",
"{",
"AuthorisationDecision",
"decision",
"=",
"new",
"AuthorisationDecision",
"(",
"true",
")",
";",
"for",
"(",
"AddressTemplate",
"ref",
":",
"r... | Iterates over all required (and optional) resources, grabs the related constraints and checks if the given
privilege for these constraints holds true.
@return granted if the privilege holds true for *all* tested resources | [
"Iterates",
"over",
"all",
"required",
"(",
"and",
"optional",
")",
"resources",
"grabs",
"the",
"related",
"constraints",
"and",
"checks",
"if",
"the",
"given",
"privilege",
"for",
"these",
"constraints",
"holds",
"true",
"."
] | train | https://github.com/hal/core/blob/d6d03f0bb128dc0470f5dc75fdb1ea1014400602/gui/src/main/java/org/jboss/as/console/client/rbac/SecurityContextImpl.java#L79-L108 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java | WTableRenderer.paintExpansionDetails | private void paintExpansionDetails(final WTable table, final XmlStringBuilder xml) {
xml.appendTagOpen("ui:rowexpansion");
switch (table.getExpandMode()) {
case CLIENT:
xml.appendAttribute("mode", "client");
break;
case LAZY:
xml.appendAttribute("mode", "lazy");
break;
case DYNAMIC:
xml.appendAttribute("mode", "dynamic");
break;
case NONE:
break;
default:
throw new SystemException("Unknown expand mode: " + table.getExpandMode());
}
xml.appendOptionalAttribute("expandAll", table.isExpandAll(), "true");
xml.appendEnd();
} | java | private void paintExpansionDetails(final WTable table, final XmlStringBuilder xml) {
xml.appendTagOpen("ui:rowexpansion");
switch (table.getExpandMode()) {
case CLIENT:
xml.appendAttribute("mode", "client");
break;
case LAZY:
xml.appendAttribute("mode", "lazy");
break;
case DYNAMIC:
xml.appendAttribute("mode", "dynamic");
break;
case NONE:
break;
default:
throw new SystemException("Unknown expand mode: " + table.getExpandMode());
}
xml.appendOptionalAttribute("expandAll", table.isExpandAll(), "true");
xml.appendEnd();
} | [
"private",
"void",
"paintExpansionDetails",
"(",
"final",
"WTable",
"table",
",",
"final",
"XmlStringBuilder",
"xml",
")",
"{",
"xml",
".",
"appendTagOpen",
"(",
"\"ui:rowexpansion\"",
")",
";",
"switch",
"(",
"table",
".",
"getExpandMode",
"(",
")",
")",
"{",... | Paint the row selection aspects of the table.
@param table the WDataTable being rendered
@param xml the string builder in use | [
"Paint",
"the",
"row",
"selection",
"aspects",
"of",
"the",
"table",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTableRenderer.java#L216-L237 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/LayoutManager.java | LayoutManager.savePageLayoutData | public static void savePageLayoutData(DockingManager manager, String pageId, String perspectiveId){
manager.saveLayoutDataAs(MessageFormat.format(PAGE_LAYOUT,
pageId, perspectiveId));
} | java | public static void savePageLayoutData(DockingManager manager, String pageId, String perspectiveId){
manager.saveLayoutDataAs(MessageFormat.format(PAGE_LAYOUT,
pageId, perspectiveId));
} | [
"public",
"static",
"void",
"savePageLayoutData",
"(",
"DockingManager",
"manager",
",",
"String",
"pageId",
",",
"String",
"perspectiveId",
")",
"{",
"manager",
".",
"saveLayoutDataAs",
"(",
"MessageFormat",
".",
"format",
"(",
"PAGE_LAYOUT",
",",
"pageId",
",",
... | Saves the current page layout.
@param manager The current docking manager
@param pageId The page to saved the layout for | [
"Saves",
"the",
"current",
"page",
"layout",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-jidedocking/src/main/java/org/valkyriercp/application/docking/LayoutManager.java#L76-L79 |
fommil/matrix-toolkits-java | src/main/java/no/uib/cipr/matrix/QRP.java | QRP.getP | public Matrix getP() {
Matrix P = new DenseMatrix(jpvt.length, jpvt.length);
for (int i = 0; i < jpvt.length; i++) {
P.set(jpvt[i], i, 1);
}
return P;
} | java | public Matrix getP() {
Matrix P = new DenseMatrix(jpvt.length, jpvt.length);
for (int i = 0; i < jpvt.length; i++) {
P.set(jpvt[i], i, 1);
}
return P;
} | [
"public",
"Matrix",
"getP",
"(",
")",
"{",
"Matrix",
"P",
"=",
"new",
"DenseMatrix",
"(",
"jpvt",
".",
"length",
",",
"jpvt",
".",
"length",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"jpvt",
".",
"length",
";",
"i",
"++",
")",
... | Returns the column pivoting matrix. This function allocates a new Matrix
to be returned, a more cheap option is tu use {@link #getPVector()}. | [
"Returns",
"the",
"column",
"pivoting",
"matrix",
".",
"This",
"function",
"allocates",
"a",
"new",
"Matrix",
"to",
"be",
"returned",
"a",
"more",
"cheap",
"option",
"is",
"tu",
"use",
"{"
] | train | https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/QRP.java#L225-L231 |
geomajas/geomajas-project-client-gwt | plugin/editing/editing-javascript-api-gwt/src/main/java/org/geomajas/plugin/editing/jsapi/gwt/client/gfx/style/JsPointSymbolizerShapeAndSize.java | JsPointSymbolizerShapeAndSize.setShape | @ExportInstanceMethod
public static void setShape(PointSymbolizerShapeAndSize instance, String shape) {
if ("circle".equals(shape)) {
instance.setShape(PointSymbolizerShapeAndSize.Shape.CIRCLE);
} else if ("square".equals(shape)) {
instance.setShape(PointSymbolizerShapeAndSize.Shape.SQUARE);
} else {
//default value
instance.setShape(PointSymbolizerShapeAndSize.Shape.SQUARE);
}
} | java | @ExportInstanceMethod
public static void setShape(PointSymbolizerShapeAndSize instance, String shape) {
if ("circle".equals(shape)) {
instance.setShape(PointSymbolizerShapeAndSize.Shape.CIRCLE);
} else if ("square".equals(shape)) {
instance.setShape(PointSymbolizerShapeAndSize.Shape.SQUARE);
} else {
//default value
instance.setShape(PointSymbolizerShapeAndSize.Shape.SQUARE);
}
} | [
"@",
"ExportInstanceMethod",
"public",
"static",
"void",
"setShape",
"(",
"PointSymbolizerShapeAndSize",
"instance",
",",
"String",
"shape",
")",
"{",
"if",
"(",
"\"circle\"",
".",
"equals",
"(",
"shape",
")",
")",
"{",
"instance",
".",
"setShape",
"(",
"Point... | Set the shape type of the point symbolizer. Can be a square (default) or circle.
@param shape The shape type as a string. | [
"Set",
"the",
"shape",
"type",
"of",
"the",
"point",
"symbolizer",
".",
"Can",
"be",
"a",
"square",
"(",
"default",
")",
"or",
"circle",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/editing/editing-javascript-api-gwt/src/main/java/org/geomajas/plugin/editing/jsapi/gwt/client/gfx/style/JsPointSymbolizerShapeAndSize.java#L54-L64 |
PistoiaHELM/HELM2NotationToolkit | src/main/java/org/helm/notation2/tools/ChangeObjects.java | ChangeObjects.deleteAnnotationFromMonomerNotation | public final static void deleteAnnotationFromMonomerNotation(PolymerNotation polymer, int position) {
polymer.getPolymerElements().getListOfElements().get(position).setAnnotation(null);
} | java | public final static void deleteAnnotationFromMonomerNotation(PolymerNotation polymer, int position) {
polymer.getPolymerElements().getListOfElements().get(position).setAnnotation(null);
} | [
"public",
"final",
"static",
"void",
"deleteAnnotationFromMonomerNotation",
"(",
"PolymerNotation",
"polymer",
",",
"int",
"position",
")",
"{",
"polymer",
".",
"getPolymerElements",
"(",
")",
".",
"getListOfElements",
"(",
")",
".",
"get",
"(",
"position",
")",
... | method to delete the annotation of a MonomerNotation
@param polymer
PolymerNotation
@param position
position of the MonomerNotation | [
"method",
"to",
"delete",
"the",
"annotation",
"of",
"a",
"MonomerNotation"
] | train | https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/ChangeObjects.java#L352-L354 |
Azure/azure-sdk-for-java | sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPoliciesInner.java | BackupLongTermRetentionPoliciesInner.listByDatabaseAsync | public Observable<BackupLongTermRetentionPolicyInner> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) {
return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<BackupLongTermRetentionPolicyInner>, BackupLongTermRetentionPolicyInner>() {
@Override
public BackupLongTermRetentionPolicyInner call(ServiceResponse<BackupLongTermRetentionPolicyInner> response) {
return response.body();
}
});
} | java | public Observable<BackupLongTermRetentionPolicyInner> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) {
return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<BackupLongTermRetentionPolicyInner>, BackupLongTermRetentionPolicyInner>() {
@Override
public BackupLongTermRetentionPolicyInner call(ServiceResponse<BackupLongTermRetentionPolicyInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"BackupLongTermRetentionPolicyInner",
">",
"listByDatabaseAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"listByDatabaseWithServiceResponseAsync",
"(",
"resourceGroupName... | Gets a database's long term retention policy.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the BackupLongTermRetentionPolicyInner object | [
"Gets",
"a",
"database",
"s",
"long",
"term",
"retention",
"policy",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/BackupLongTermRetentionPoliciesInner.java#L395-L402 |
yavijava/yavijava | src/main/java/com/vmware/vim25/mo/AlarmManager.java | AlarmManager.createAlarm | public Alarm createAlarm(ManagedEntity me, AlarmSpec as) throws InvalidName, DuplicateName, RuntimeFault, RemoteException {
if (me == null) {
throw new IllegalArgumentException("entity must not be null.");
}
ManagedObjectReference mor = getVimService().createAlarm(getMOR(), me.getMOR(), as);
return new Alarm(getServerConnection(), mor);
} | java | public Alarm createAlarm(ManagedEntity me, AlarmSpec as) throws InvalidName, DuplicateName, RuntimeFault, RemoteException {
if (me == null) {
throw new IllegalArgumentException("entity must not be null.");
}
ManagedObjectReference mor = getVimService().createAlarm(getMOR(), me.getMOR(), as);
return new Alarm(getServerConnection(), mor);
} | [
"public",
"Alarm",
"createAlarm",
"(",
"ManagedEntity",
"me",
",",
"AlarmSpec",
"as",
")",
"throws",
"InvalidName",
",",
"DuplicateName",
",",
"RuntimeFault",
",",
"RemoteException",
"{",
"if",
"(",
"me",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumen... | Create an alarm against the given managed entity using the alarm
specification
@param me
The {@link ManagedEntity} to alarm against.
@param as
The {@link AlarmSpec} used to generate the alarm.
@return The new {@link Alarm} created
@throws InvalidName
if the alarm name exceeds the max length or is empty.
@throws DuplicateName
if an alarm with the same name already exists.
@throws RuntimeFault
if any unhandled runtime fault occurs
@throws RemoteException | [
"Create",
"an",
"alarm",
"against",
"the",
"given",
"managed",
"entity",
"using",
"the",
"alarm",
"specification"
] | train | https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/AlarmManager.java#L147-L153 |
UrielCh/ovh-java-sdk | ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java | ApiOvhIp.loadBalancing_serviceName_portsRedirection_GET | public ArrayList<OvhLoadBalancingAdditionalPortEnum> loadBalancing_serviceName_portsRedirection_GET(String serviceName) throws IOException {
String qPath = "/ip/loadBalancing/{serviceName}/portsRedirection";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t6);
} | java | public ArrayList<OvhLoadBalancingAdditionalPortEnum> loadBalancing_serviceName_portsRedirection_GET(String serviceName) throws IOException {
String qPath = "/ip/loadBalancing/{serviceName}/portsRedirection";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t6);
} | [
"public",
"ArrayList",
"<",
"OvhLoadBalancingAdditionalPortEnum",
">",
"loadBalancing_serviceName_portsRedirection_GET",
"(",
"String",
"serviceName",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/ip/loadBalancing/{serviceName}/portsRedirection\"",
";",
"StringBu... | Get all srcPort
REST: GET /ip/loadBalancing/{serviceName}/portsRedirection
@param serviceName [required] The internal name of your IP load balancing | [
"Get",
"all",
"srcPort"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1526-L1531 |
radkovo/CSSBox | src/main/java/org/fit/cssbox/layout/VisualContext.java | VisualContext.fontAvailable | private String fontAvailable(String family, String[] avail)
{
for (int i = 0; i < avail.length; i++)
if (avail[i].equalsIgnoreCase(family)) return avail[i];
return null;
} | java | private String fontAvailable(String family, String[] avail)
{
for (int i = 0; i < avail.length; i++)
if (avail[i].equalsIgnoreCase(family)) return avail[i];
return null;
} | [
"private",
"String",
"fontAvailable",
"(",
"String",
"family",
",",
"String",
"[",
"]",
"avail",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"avail",
".",
"length",
";",
"i",
"++",
")",
"if",
"(",
"avail",
"[",
"i",
"]",
".",
"eq... | Returns true if the font family is available.
@return The exact name of the font family or null if it's not available | [
"Returns",
"true",
"if",
"the",
"font",
"family",
"is",
"available",
"."
] | train | https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/VisualContext.java#L737-L742 |
json-path/JsonPath | json-path/src/main/java/com/jayway/jsonpath/JsonPath.java | JsonPath.read | @SuppressWarnings({"unchecked"})
public <T> T read(Object jsonObject) {
return read(jsonObject, Configuration.defaultConfiguration());
} | java | @SuppressWarnings({"unchecked"})
public <T> T read(Object jsonObject) {
return read(jsonObject, Configuration.defaultConfiguration());
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
"}",
")",
"public",
"<",
"T",
">",
"T",
"read",
"(",
"Object",
"jsonObject",
")",
"{",
"return",
"read",
"(",
"jsonObject",
",",
"Configuration",
".",
"defaultConfiguration",
"(",
")",
")",
";",
"}"
] | Applies this JsonPath to the provided json document.
Note that the document must be identified as either a List or Map by
the {@link JsonProvider}
@param jsonObject a container Object
@param <T> expected return type
@return object(s) matched by the given path | [
"Applies",
"this",
"JsonPath",
"to",
"the",
"provided",
"json",
"document",
".",
"Note",
"that",
"the",
"document",
"must",
"be",
"identified",
"as",
"either",
"a",
"List",
"or",
"Map",
"by",
"the",
"{",
"@link",
"JsonProvider",
"}"
] | train | https://github.com/json-path/JsonPath/blob/5a09489c3252b74bbf81992aadb3073be59c04f9/json-path/src/main/java/com/jayway/jsonpath/JsonPath.java#L151-L154 |
UrielCh/ovh-java-sdk | ovh-java-sdk-sslGateway/src/main/java/net/minidev/ovh/api/ApiOvhSslGateway.java | ApiOvhSslGateway.serviceName_renewCertificate_POST | public ArrayList<String> serviceName_renewCertificate_POST(String serviceName, String domain) throws IOException {
String qPath = "/sslGateway/{serviceName}/renewCertificate";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "domain", domain);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, t1);
} | java | public ArrayList<String> serviceName_renewCertificate_POST(String serviceName, String domain) throws IOException {
String qPath = "/sslGateway/{serviceName}/renewCertificate";
StringBuilder sb = path(qPath, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "domain", domain);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"serviceName_renewCertificate_POST",
"(",
"String",
"serviceName",
",",
"String",
"domain",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/sslGateway/{serviceName}/renewCertificate\"",
";",
"StringBuilder",
"sb",
... | Renew your SSL certificates
REST: POST /sslGateway/{serviceName}/renewCertificate
@param domain [required] Domain on which you want to renew certificate
@param serviceName [required] The internal name of your SSL Gateway
API beta | [
"Renew",
"your",
"SSL",
"certificates"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sslGateway/src/main/java/net/minidev/ovh/api/ApiOvhSslGateway.java#L93-L100 |
cogroo/cogroo4 | lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/DialogBuilder.java | DialogBuilder.createUniqueName | public static String createUniqueName(XNameAccess _xElementContainer, String _sElementName) {
boolean bElementexists = true;
int i = 1;
String sIncSuffix = "";
String BaseName = _sElementName;
while (bElementexists) {
bElementexists = _xElementContainer.hasByName(_sElementName);
if (bElementexists) {
i += 1;
_sElementName = BaseName + Integer.toString(i);
}
}
return _sElementName;
} | java | public static String createUniqueName(XNameAccess _xElementContainer, String _sElementName) {
boolean bElementexists = true;
int i = 1;
String sIncSuffix = "";
String BaseName = _sElementName;
while (bElementexists) {
bElementexists = _xElementContainer.hasByName(_sElementName);
if (bElementexists) {
i += 1;
_sElementName = BaseName + Integer.toString(i);
}
}
return _sElementName;
} | [
"public",
"static",
"String",
"createUniqueName",
"(",
"XNameAccess",
"_xElementContainer",
",",
"String",
"_sElementName",
")",
"{",
"boolean",
"bElementexists",
"=",
"true",
";",
"int",
"i",
"=",
"1",
";",
"String",
"sIncSuffix",
"=",
"\"\"",
";",
"String",
... | makes a String unique by appending a numerical suffix
@param _xElementContainer the com.sun.star.container.XNameAccess container
that the new Element is going to be inserted to
@param _sElementName the StemName of the Element | [
"makes",
"a",
"String",
"unique",
"by",
"appending",
"a",
"numerical",
"suffix"
] | train | https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/lang/pt_br/cogroo-addon/src/org/cogroo/addon/dialogs/reporterror/DialogBuilder.java#L579-L592 |
google/closure-compiler | src/com/google/javascript/jscomp/CheckJSDoc.java | CheckJSDoc.validateDeprecatedJsDoc | private void validateDeprecatedJsDoc(Node n, JSDocInfo info) {
if (info != null && info.isExpose()) {
report(n, ANNOTATION_DEPRECATED, "@expose",
"Use @nocollapse or @export instead.");
}
} | java | private void validateDeprecatedJsDoc(Node n, JSDocInfo info) {
if (info != null && info.isExpose()) {
report(n, ANNOTATION_DEPRECATED, "@expose",
"Use @nocollapse or @export instead.");
}
} | [
"private",
"void",
"validateDeprecatedJsDoc",
"(",
"Node",
"n",
",",
"JSDocInfo",
"info",
")",
"{",
"if",
"(",
"info",
"!=",
"null",
"&&",
"info",
".",
"isExpose",
"(",
")",
")",
"{",
"report",
"(",
"n",
",",
"ANNOTATION_DEPRECATED",
",",
"\"@expose\"",
... | Checks that deprecated annotations such as @expose are not present | [
"Checks",
"that",
"deprecated",
"annotations",
"such",
"as"
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckJSDoc.java#L387-L392 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java | ParagraphVectors.similarityToLabel | public double similarityToLabel(List<VocabWord> document, String label) {
if (document.isEmpty())
throw new IllegalStateException("Document has no words inside");
/*
INDArray arr = Nd4j.create(document.size(), this.layerSize);
for (int i = 0; i < document.size(); i++) {
arr.putRow(i, getWordVectorMatrix(document.get(i).getWord()));
}*/
INDArray docMean = inferVector(document); //arr.mean(0);
INDArray otherVec = getWordVectorMatrix(label);
double sim = Transforms.cosineSim(docMean, otherVec);
return sim;
} | java | public double similarityToLabel(List<VocabWord> document, String label) {
if (document.isEmpty())
throw new IllegalStateException("Document has no words inside");
/*
INDArray arr = Nd4j.create(document.size(), this.layerSize);
for (int i = 0; i < document.size(); i++) {
arr.putRow(i, getWordVectorMatrix(document.get(i).getWord()));
}*/
INDArray docMean = inferVector(document); //arr.mean(0);
INDArray otherVec = getWordVectorMatrix(label);
double sim = Transforms.cosineSim(docMean, otherVec);
return sim;
} | [
"public",
"double",
"similarityToLabel",
"(",
"List",
"<",
"VocabWord",
">",
"document",
",",
"String",
"label",
")",
"{",
"if",
"(",
"document",
".",
"isEmpty",
"(",
")",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Document has no words inside\"",
")"... | This method returns similarity of the document to specific label, based on mean value
@param document
@param label
@return | [
"This",
"method",
"returns",
"similarity",
"of",
"the",
"document",
"to",
"specific",
"label",
"based",
"on",
"mean",
"value"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/paragraphvectors/ParagraphVectors.java#L695-L710 |
Ordinastie/MalisisCore | src/main/java/net/malisis/core/renderer/animation/transformation/ParallelTransformation.java | ParallelTransformation.doTransform | @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void doTransform(ITransformable transformable, float comp)
{
if (listTransformations.size() == 0)
return;
for (Transformation transformation : listTransformations)
transformation.transform(transformable, elapsedTimeCurrentLoop);
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
protected void doTransform(ITransformable transformable, float comp)
{
if (listTransformations.size() == 0)
return;
for (Transformation transformation : listTransformations)
transformation.transform(transformable, elapsedTimeCurrentLoop);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"@",
"Override",
"protected",
"void",
"doTransform",
"(",
"ITransformable",
"transformable",
",",
"float",
"comp",
")",
"{",
"if",
"(",
"listTransformations",
".",
"size",
"(",
... | Calculates the tranformation.
@param transformable the transformable
@param comp the comp | [
"Calculates",
"the",
"tranformation",
"."
] | train | https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/renderer/animation/transformation/ParallelTransformation.java#L82-L91 |
Microsoft/malmo | Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardForSendingMatchingChatMessageImplementation.java | RewardForSendingMatchingChatMessageImplementation.prepare | @Override
public void prepare(MissionInit missionInit) {
super.prepare(missionInit);
// We need to see chat commands as they come in.
// Following the example of RewardForSendingCommandImplementation.
MissionBehaviour mb = parentBehaviour();
ICommandHandler oldch = mb.commandHandler;
CommandGroup newch = new CommandGroup() {
protected boolean onExecute(String verb, String parameter, MissionInit missionInit) {
// See if this command gets handled by the legitimate handlers:
boolean handled = super.onExecute(verb, parameter, missionInit);
if (handled && verb.equalsIgnoreCase(ChatCommand.CHAT.value())) // Yes, so check if we need to produce a reward
{
Iterator<Map.Entry<Pattern, Float>> patternIt = patternMap.entrySet().iterator();
while (patternIt.hasNext()) {
Map.Entry<Pattern, Float> entry = patternIt.next();
Matcher m = entry.getKey().matcher(parameter);
if (m.matches()) {
String distribution = distributionMap.get(entry.getKey());
addAndShareCachedReward(RewardForSendingMatchingChatMessageImplementation.this.params.getDimension(), entry.getValue(), distribution);
}
}
}
return handled;
}
};
newch.setOverriding((oldch != null) ? oldch.isOverriding() : true);
if (oldch != null)
newch.addCommandHandler(oldch);
mb.commandHandler = newch;
} | java | @Override
public void prepare(MissionInit missionInit) {
super.prepare(missionInit);
// We need to see chat commands as they come in.
// Following the example of RewardForSendingCommandImplementation.
MissionBehaviour mb = parentBehaviour();
ICommandHandler oldch = mb.commandHandler;
CommandGroup newch = new CommandGroup() {
protected boolean onExecute(String verb, String parameter, MissionInit missionInit) {
// See if this command gets handled by the legitimate handlers:
boolean handled = super.onExecute(verb, parameter, missionInit);
if (handled && verb.equalsIgnoreCase(ChatCommand.CHAT.value())) // Yes, so check if we need to produce a reward
{
Iterator<Map.Entry<Pattern, Float>> patternIt = patternMap.entrySet().iterator();
while (patternIt.hasNext()) {
Map.Entry<Pattern, Float> entry = patternIt.next();
Matcher m = entry.getKey().matcher(parameter);
if (m.matches()) {
String distribution = distributionMap.get(entry.getKey());
addAndShareCachedReward(RewardForSendingMatchingChatMessageImplementation.this.params.getDimension(), entry.getValue(), distribution);
}
}
}
return handled;
}
};
newch.setOverriding((oldch != null) ? oldch.isOverriding() : true);
if (oldch != null)
newch.addCommandHandler(oldch);
mb.commandHandler = newch;
} | [
"@",
"Override",
"public",
"void",
"prepare",
"(",
"MissionInit",
"missionInit",
")",
"{",
"super",
".",
"prepare",
"(",
"missionInit",
")",
";",
"// We need to see chat commands as they come in.",
"// Following the example of RewardForSendingCommandImplementation.",
"MissionBe... | Called once before the mission starts - use for any necessary
initialisation.
@param missionInit | [
"Called",
"once",
"before",
"the",
"mission",
"starts",
"-",
"use",
"for",
"any",
"necessary",
"initialisation",
"."
] | train | https://github.com/Microsoft/malmo/blob/4139cd6f3e52f6e893a931a1d4b70d35f8e70e5a/Minecraft/src/main/java/com/microsoft/Malmo/MissionHandlers/RewardForSendingMatchingChatMessageImplementation.java#L86-L117 |
alkacon/opencms-core | src/org/opencms/ui/CmsVaadinUtils.java | CmsVaadinUtils.readAndLocalizeDesign | protected static void readAndLocalizeDesign(
Component component,
InputStream designStream,
CmsMessages messages,
Map<String, String> macros) {
try {
byte[] designBytes = CmsFileUtil.readFully(designStream, true);
final String encoding = "UTF-8";
String design = new String(designBytes, encoding);
CmsMacroResolver resolver = new CmsMacroResolver() {
@Override
public String getMacroValue(String macro) {
String result = super.getMacroValue(macro);
// The macro may contain quotes or angle brackets, so we need to escape the values for insertion into the design file
return CmsEncoder.escapeXml(result);
}
};
if (macros != null) {
for (Map.Entry<String, String> entry : macros.entrySet()) {
resolver.addMacro(entry.getKey(), entry.getValue());
}
}
if (messages != null) {
resolver.setMessages(messages);
}
String resolvedDesign = resolver.resolveMacros(design);
Design.read(new ByteArrayInputStream(resolvedDesign.getBytes(encoding)), component);
} catch (IOException e) {
throw new RuntimeException("Could not read design", e);
} finally {
try {
designStream.close();
} catch (IOException e) {
LOG.warn(e.getLocalizedMessage(), e);
}
}
} | java | protected static void readAndLocalizeDesign(
Component component,
InputStream designStream,
CmsMessages messages,
Map<String, String> macros) {
try {
byte[] designBytes = CmsFileUtil.readFully(designStream, true);
final String encoding = "UTF-8";
String design = new String(designBytes, encoding);
CmsMacroResolver resolver = new CmsMacroResolver() {
@Override
public String getMacroValue(String macro) {
String result = super.getMacroValue(macro);
// The macro may contain quotes or angle brackets, so we need to escape the values for insertion into the design file
return CmsEncoder.escapeXml(result);
}
};
if (macros != null) {
for (Map.Entry<String, String> entry : macros.entrySet()) {
resolver.addMacro(entry.getKey(), entry.getValue());
}
}
if (messages != null) {
resolver.setMessages(messages);
}
String resolvedDesign = resolver.resolveMacros(design);
Design.read(new ByteArrayInputStream(resolvedDesign.getBytes(encoding)), component);
} catch (IOException e) {
throw new RuntimeException("Could not read design", e);
} finally {
try {
designStream.close();
} catch (IOException e) {
LOG.warn(e.getLocalizedMessage(), e);
}
}
} | [
"protected",
"static",
"void",
"readAndLocalizeDesign",
"(",
"Component",
"component",
",",
"InputStream",
"designStream",
",",
"CmsMessages",
"messages",
",",
"Map",
"<",
"String",
",",
"String",
">",
"macros",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"designB... | Reads the given design and resolves the given macros and localizations.<p>
@param component the component whose design to read
@param designStream stream to read the design from
@param messages the message bundle to use for localization in the design (may be null)
@param macros other macros to substitute in the macro design (may be null) | [
"Reads",
"the",
"given",
"design",
"and",
"resolves",
"the",
"given",
"macros",
"and",
"localizations",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsVaadinUtils.java#L1295-L1336 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomQuadPnP.java | VisOdomQuadPnP.associateL2R | private void associateL2R( T left , T right ) {
// make the previous new observations into the new old ones
ImageInfo<TD> tmp = featsLeft1;
featsLeft1 = featsLeft0; featsLeft0 = tmp;
tmp = featsRight1;
featsRight1 = featsRight0; featsRight0 = tmp;
// detect and associate features in the two images
featsLeft1.reset();
featsRight1.reset();
// long time0 = System.currentTimeMillis();
describeImage(left,featsLeft1);
describeImage(right,featsRight1);
// long time1 = System.currentTimeMillis();
// detect and associate features in the current stereo pair
for( int i = 0; i < detector.getNumberOfSets(); i++ ) {
SetMatches matches = setMatches[i];
matches.swap();
matches.match2to3.reset();
FastQueue<Point2D_F64> leftLoc = featsLeft1.location[i];
FastQueue<Point2D_F64> rightLoc = featsRight1.location[i];
assocL2R.setSource(leftLoc,featsLeft1.description[i]);
assocL2R.setDestination(rightLoc, featsRight1.description[i]);
assocL2R.associate();
FastQueue<AssociatedIndex> found = assocL2R.getMatches();
// removeUnassociated(leftLoc,featsLeft1.description[i],rightLoc,featsRight1.description[i],found);
setMatches(matches.match2to3, found, leftLoc.size);
}
// long time2 = System.currentTimeMillis();
// System.out.println(" desc "+(time1-time0)+" assoc "+(time2-time1));
} | java | private void associateL2R( T left , T right ) {
// make the previous new observations into the new old ones
ImageInfo<TD> tmp = featsLeft1;
featsLeft1 = featsLeft0; featsLeft0 = tmp;
tmp = featsRight1;
featsRight1 = featsRight0; featsRight0 = tmp;
// detect and associate features in the two images
featsLeft1.reset();
featsRight1.reset();
// long time0 = System.currentTimeMillis();
describeImage(left,featsLeft1);
describeImage(right,featsRight1);
// long time1 = System.currentTimeMillis();
// detect and associate features in the current stereo pair
for( int i = 0; i < detector.getNumberOfSets(); i++ ) {
SetMatches matches = setMatches[i];
matches.swap();
matches.match2to3.reset();
FastQueue<Point2D_F64> leftLoc = featsLeft1.location[i];
FastQueue<Point2D_F64> rightLoc = featsRight1.location[i];
assocL2R.setSource(leftLoc,featsLeft1.description[i]);
assocL2R.setDestination(rightLoc, featsRight1.description[i]);
assocL2R.associate();
FastQueue<AssociatedIndex> found = assocL2R.getMatches();
// removeUnassociated(leftLoc,featsLeft1.description[i],rightLoc,featsRight1.description[i],found);
setMatches(matches.match2to3, found, leftLoc.size);
}
// long time2 = System.currentTimeMillis();
// System.out.println(" desc "+(time1-time0)+" assoc "+(time2-time1));
} | [
"private",
"void",
"associateL2R",
"(",
"T",
"left",
",",
"T",
"right",
")",
"{",
"// make the previous new observations into the new old ones",
"ImageInfo",
"<",
"TD",
">",
"tmp",
"=",
"featsLeft1",
";",
"featsLeft1",
"=",
"featsLeft0",
";",
"featsLeft0",
"=",
"t... | Associates image features from the left and right camera together while applying epipolar constraints.
@param left Image from left camera
@param right Image from right camera | [
"Associates",
"image",
"features",
"from",
"the",
"left",
"and",
"right",
"camera",
"together",
"while",
"applying",
"epipolar",
"constraints",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/VisOdomQuadPnP.java#L203-L239 |
apptik/jus | rx-jus/src/main/java/io/apptik/comm/jus/rx/queue/RxRequestQueue.java | RxRequestQueue.resultObservable | public static Observable<ResultEvent<?>> resultObservable(
RequestQueue queue, RequestQueue.RequestFilter filter) {
return Observable.create(new QRequestResponseOnSubscribe(queue, filter));
} | java | public static Observable<ResultEvent<?>> resultObservable(
RequestQueue queue, RequestQueue.RequestFilter filter) {
return Observable.create(new QRequestResponseOnSubscribe(queue, filter));
} | [
"public",
"static",
"Observable",
"<",
"ResultEvent",
"<",
"?",
">",
">",
"resultObservable",
"(",
"RequestQueue",
"queue",
",",
"RequestQueue",
".",
"RequestFilter",
"filter",
")",
"{",
"return",
"Observable",
".",
"create",
"(",
"new",
"QRequestResponseOnSubscri... | Returns {@link Observable} of the successful results coming as {@link ResultEvent}
@param queue the {@link RequestQueue} to listen to
@param filter the {@link io.apptik.comm.jus.RequestQueue.RequestFilter} which will filter
the requests to hook to. Set null for no filtering.
@return {@link Observable} of results | [
"Returns",
"{",
"@link",
"Observable",
"}",
"of",
"the",
"successful",
"results",
"coming",
"as",
"{",
"@link",
"ResultEvent",
"}"
] | train | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/rx-jus/src/main/java/io/apptik/comm/jus/rx/queue/RxRequestQueue.java#L63-L66 |
mikepenz/FastAdapter | library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/UndoHelper.java | UndoHelper.withSnackBar | public void withSnackBar(@NonNull Snackbar snackBar, String actionText) {
mSnackBar = snackBar;
mSnackbarActionText = actionText;
mSnackBar.addCallback(mSnackbarCallback)
.setAction(actionText, new View.OnClickListener() {
@Override
public void onClick(View v) {
undoChange();
}
});
} | java | public void withSnackBar(@NonNull Snackbar snackBar, String actionText) {
mSnackBar = snackBar;
mSnackbarActionText = actionText;
mSnackBar.addCallback(mSnackbarCallback)
.setAction(actionText, new View.OnClickListener() {
@Override
public void onClick(View v) {
undoChange();
}
});
} | [
"public",
"void",
"withSnackBar",
"(",
"@",
"NonNull",
"Snackbar",
"snackBar",
",",
"String",
"actionText",
")",
"{",
"mSnackBar",
"=",
"snackBar",
";",
"mSnackbarActionText",
"=",
"actionText",
";",
"mSnackBar",
".",
"addCallback",
"(",
"mSnackbarCallback",
")",
... | an optional method to add a {@link Snackbar} of your own with custom styling.
note that using this method will override your custom action
@param snackBar your own Snackbar
@param actionText the text to show for the Undo Action | [
"an",
"optional",
"method",
"to",
"add",
"a",
"{",
"@link",
"Snackbar",
"}",
"of",
"your",
"own",
"with",
"custom",
"styling",
".",
"note",
"that",
"using",
"this",
"method",
"will",
"override",
"your",
"custom",
"action"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/UndoHelper.java#L74-L85 |
pgjdbc/pgjdbc | pgjdbc/src/main/java/org/postgresql/core/Utils.java | Utils.doAppendEscapedIdentifier | private static void doAppendEscapedIdentifier(Appendable sbuf, String value) throws SQLException {
try {
sbuf.append('"');
for (int i = 0; i < value.length(); ++i) {
char ch = value.charAt(i);
if (ch == '\0') {
throw new PSQLException(GT.tr("Zero bytes may not occur in identifiers."),
PSQLState.INVALID_PARAMETER_VALUE);
}
if (ch == '"') {
sbuf.append(ch);
}
sbuf.append(ch);
}
sbuf.append('"');
} catch (IOException e) {
throw new PSQLException(GT.tr("No IOException expected from StringBuffer or StringBuilder"),
PSQLState.UNEXPECTED_ERROR, e);
}
} | java | private static void doAppendEscapedIdentifier(Appendable sbuf, String value) throws SQLException {
try {
sbuf.append('"');
for (int i = 0; i < value.length(); ++i) {
char ch = value.charAt(i);
if (ch == '\0') {
throw new PSQLException(GT.tr("Zero bytes may not occur in identifiers."),
PSQLState.INVALID_PARAMETER_VALUE);
}
if (ch == '"') {
sbuf.append(ch);
}
sbuf.append(ch);
}
sbuf.append('"');
} catch (IOException e) {
throw new PSQLException(GT.tr("No IOException expected from StringBuffer or StringBuilder"),
PSQLState.UNEXPECTED_ERROR, e);
}
} | [
"private",
"static",
"void",
"doAppendEscapedIdentifier",
"(",
"Appendable",
"sbuf",
",",
"String",
"value",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"sbuf",
".",
"append",
"(",
"'",
"'",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<"... | Common part for appendEscapedIdentifier.
@param sbuf Either StringBuffer or StringBuilder as we do not expect any IOException to be
thrown.
@param value value to append | [
"Common",
"part",
"for",
"appendEscapedIdentifier",
"."
] | train | https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/Utils.java#L152-L173 |
keenon/loglinear | src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java | GraphicalModel.addStaticBinaryFactor | public Factor addStaticBinaryFactor(int a, int cardA, int b, int cardB, BiFunction<Integer, Integer, Double> value) {
return addStaticFactor(new int[]{a, b}, new int[]{cardA, cardB}, assignment -> value.apply(assignment[0], assignment[1]));
} | java | public Factor addStaticBinaryFactor(int a, int cardA, int b, int cardB, BiFunction<Integer, Integer, Double> value) {
return addStaticFactor(new int[]{a, b}, new int[]{cardA, cardB}, assignment -> value.apply(assignment[0], assignment[1]));
} | [
"public",
"Factor",
"addStaticBinaryFactor",
"(",
"int",
"a",
",",
"int",
"cardA",
",",
"int",
"b",
",",
"int",
"cardB",
",",
"BiFunction",
"<",
"Integer",
",",
"Integer",
",",
"Double",
">",
"value",
")",
"{",
"return",
"addStaticFactor",
"(",
"new",
"i... | Add a binary factor, where we just want to hard-code the value of the factor.
@param a The index of the first variable.
@param cardA The cardinality (i.e, dimension) of the first factor
@param b The index of the second variable
@param cardB The cardinality (i.e, dimension) of the second factor
@param value A mapping from assignments of the two variables, to a factor value.
@return a reference to the created factor. This can be safely ignored, as the factor is already saved in the model | [
"Add",
"a",
"binary",
"factor",
"where",
"we",
"just",
"want",
"to",
"hard",
"-",
"code",
"the",
"value",
"of",
"the",
"factor",
"."
] | train | https://github.com/keenon/loglinear/blob/fa0c370ab6782015412f676ef2ab11c97be58e29/src/main/java/com/github/keenon/loglinear/model/GraphicalModel.java#L489-L491 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/TokenCachingStrategy.java | TokenCachingStrategy.putPermissions | public static void putPermissions(Bundle bundle, List<String> value) {
Validate.notNull(bundle, "bundle");
Validate.notNull(value, "value");
ArrayList<String> arrayList;
if (value instanceof ArrayList<?>) {
arrayList = (ArrayList<String>) value;
} else {
arrayList = new ArrayList<String>(value);
}
bundle.putStringArrayList(PERMISSIONS_KEY, arrayList);
} | java | public static void putPermissions(Bundle bundle, List<String> value) {
Validate.notNull(bundle, "bundle");
Validate.notNull(value, "value");
ArrayList<String> arrayList;
if (value instanceof ArrayList<?>) {
arrayList = (ArrayList<String>) value;
} else {
arrayList = new ArrayList<String>(value);
}
bundle.putStringArrayList(PERMISSIONS_KEY, arrayList);
} | [
"public",
"static",
"void",
"putPermissions",
"(",
"Bundle",
"bundle",
",",
"List",
"<",
"String",
">",
"value",
")",
"{",
"Validate",
".",
"notNull",
"(",
"bundle",
",",
"\"bundle\"",
")",
";",
"Validate",
".",
"notNull",
"(",
"value",
",",
"\"value\"",
... | Puts the list of permissions into a Bundle.
@param bundle
A Bundle in which the list of permissions should be stored.
@param value
The List<String> representing the list of permissions,
or null.
@throws NullPointerException if the passed in Bundle or permissions list are null | [
"Puts",
"the",
"list",
"of",
"permissions",
"into",
"a",
"Bundle",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/TokenCachingStrategy.java#L262-L273 |
threerings/nenya | tools/src/main/java/com/threerings/cast/tools/xml/ActionRuleSet.java | ActionRuleSet.addRuleInstances | @Override
public void addRuleInstances (Digester digester)
{
// this creates the appropriate instance when we encounter a
// <action> tag
digester.addObjectCreate(_prefix + ACTION_PATH,
ActionSequence.class.getName());
// grab the name attribute from the <action> tag
digester.addRule(_prefix + ACTION_PATH, new SetPropertyFieldsRule());
// grab the other attributes from their respective tags
digester.addRule(_prefix + ACTION_PATH + "/framesPerSecond",
new SetFieldRule("framesPerSecond"));
CallMethodSpecialRule origin = new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
throws Exception {
int[] coords = StringUtil.parseIntArray(bodyText);
if (coords.length != 2) {
String errmsg = "Invalid <origin> specification '" +
bodyText + "'.";
throw new Exception(errmsg);
}
((ActionSequence)target).origin.setLocation(
coords[0], coords[1]);
}
};
digester.addRule(_prefix + ACTION_PATH + "/origin", origin);
CallMethodSpecialRule orient = new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
throws Exception {
ActionSequence seq = ((ActionSequence)target);
String[] ostrs = StringUtil.parseStringArray(bodyText);
seq.orients = new int[ostrs.length];
for (int ii = 0; ii < ostrs.length; ii++) {
int orient = DirectionUtil.fromShortString(ostrs[ii]);
if (orient != DirectionCodes.NONE) {
seq.orients[ii] = orient;
} else {
String errmsg = "Invalid orientation specification " +
"[index=" + ii + ", orient=" + ostrs[ii] + "].";
throw new Exception(errmsg);
}
}
}
};
digester.addRule(_prefix + ACTION_PATH + "/orients", orient);
} | java | @Override
public void addRuleInstances (Digester digester)
{
// this creates the appropriate instance when we encounter a
// <action> tag
digester.addObjectCreate(_prefix + ACTION_PATH,
ActionSequence.class.getName());
// grab the name attribute from the <action> tag
digester.addRule(_prefix + ACTION_PATH, new SetPropertyFieldsRule());
// grab the other attributes from their respective tags
digester.addRule(_prefix + ACTION_PATH + "/framesPerSecond",
new SetFieldRule("framesPerSecond"));
CallMethodSpecialRule origin = new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
throws Exception {
int[] coords = StringUtil.parseIntArray(bodyText);
if (coords.length != 2) {
String errmsg = "Invalid <origin> specification '" +
bodyText + "'.";
throw new Exception(errmsg);
}
((ActionSequence)target).origin.setLocation(
coords[0], coords[1]);
}
};
digester.addRule(_prefix + ACTION_PATH + "/origin", origin);
CallMethodSpecialRule orient = new CallMethodSpecialRule() {
@Override
public void parseAndSet (String bodyText, Object target)
throws Exception {
ActionSequence seq = ((ActionSequence)target);
String[] ostrs = StringUtil.parseStringArray(bodyText);
seq.orients = new int[ostrs.length];
for (int ii = 0; ii < ostrs.length; ii++) {
int orient = DirectionUtil.fromShortString(ostrs[ii]);
if (orient != DirectionCodes.NONE) {
seq.orients[ii] = orient;
} else {
String errmsg = "Invalid orientation specification " +
"[index=" + ii + ", orient=" + ostrs[ii] + "].";
throw new Exception(errmsg);
}
}
}
};
digester.addRule(_prefix + ACTION_PATH + "/orients", orient);
} | [
"@",
"Override",
"public",
"void",
"addRuleInstances",
"(",
"Digester",
"digester",
")",
"{",
"// this creates the appropriate instance when we encounter a",
"// <action> tag",
"digester",
".",
"addObjectCreate",
"(",
"_prefix",
"+",
"ACTION_PATH",
",",
"ActionSequence",
".... | Adds the necessary rules to the digester to parse our actions. | [
"Adds",
"the",
"necessary",
"rules",
"to",
"the",
"digester",
"to",
"parse",
"our",
"actions",
"."
] | train | https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/tools/src/main/java/com/threerings/cast/tools/xml/ActionRuleSet.java#L70-L121 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/ResourceAssignmentFactory.java | ResourceAssignmentFactory.processHyperlinkData | private void processHyperlinkData(ResourceAssignment assignment, byte[] data)
{
if (data != null)
{
int offset = 12;
offset += 12;
String hyperlink = MPPUtility.getUnicodeString(data, offset);
offset += ((hyperlink.length() + 1) * 2);
offset += 12;
String address = MPPUtility.getUnicodeString(data, offset);
offset += ((address.length() + 1) * 2);
offset += 12;
String subaddress = MPPUtility.getUnicodeString(data, offset);
offset += ((subaddress.length() + 1) * 2);
offset += 12;
String screentip = MPPUtility.getUnicodeString(data, offset);
assignment.setHyperlink(hyperlink);
assignment.setHyperlinkAddress(address);
assignment.setHyperlinkSubAddress(subaddress);
assignment.setHyperlinkScreenTip(screentip);
}
} | java | private void processHyperlinkData(ResourceAssignment assignment, byte[] data)
{
if (data != null)
{
int offset = 12;
offset += 12;
String hyperlink = MPPUtility.getUnicodeString(data, offset);
offset += ((hyperlink.length() + 1) * 2);
offset += 12;
String address = MPPUtility.getUnicodeString(data, offset);
offset += ((address.length() + 1) * 2);
offset += 12;
String subaddress = MPPUtility.getUnicodeString(data, offset);
offset += ((subaddress.length() + 1) * 2);
offset += 12;
String screentip = MPPUtility.getUnicodeString(data, offset);
assignment.setHyperlink(hyperlink);
assignment.setHyperlinkAddress(address);
assignment.setHyperlinkSubAddress(subaddress);
assignment.setHyperlinkScreenTip(screentip);
}
} | [
"private",
"void",
"processHyperlinkData",
"(",
"ResourceAssignment",
"assignment",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"int",
"offset",
"=",
"12",
";",
"offset",
"+=",
"12",
";",
"String",
"hyperlink",
"="... | Extract assignment hyperlink data.
@param assignment assignment instance
@param data hyperlink data | [
"Extract",
"assignment",
"hyperlink",
"data",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ResourceAssignmentFactory.java#L277-L303 |
FedericoPecora/meta-csp-framework | src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java | TrajectoryEnvelope.makeFootprint | public Geometry makeFootprint(double x, double y, double theta) {
AffineTransformation at = new AffineTransformation();
at.rotate(theta);
at.translate(x,y);
Geometry rect = at.transform(footprint);
return rect;
} | java | public Geometry makeFootprint(double x, double y, double theta) {
AffineTransformation at = new AffineTransformation();
at.rotate(theta);
at.translate(x,y);
Geometry rect = at.transform(footprint);
return rect;
} | [
"public",
"Geometry",
"makeFootprint",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"theta",
")",
"{",
"AffineTransformation",
"at",
"=",
"new",
"AffineTransformation",
"(",
")",
";",
"at",
".",
"rotate",
"(",
"theta",
")",
";",
"at",
".",
"tra... | Returns a {@link Geometry} representing the footprint of the robot in a given pose.
@param x The x coordinate of the pose used to create the footprint.
@param y The y coordinate of the pose used to create the footprint.
@param theta The orientation of the pose used to create the footprint.
@return A {@link Geometry} representing the footprint of the robot in a given pose. | [
"Returns",
"a",
"{"
] | train | https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelope.java#L631-L637 |
spotify/helios | helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java | ZooKeeperMasterModel.getDeploymentGroups | @Override
public Map<String, DeploymentGroup> getDeploymentGroups() {
log.debug("getting deployment groups");
final String folder = Paths.configDeploymentGroups();
final ZooKeeperClient client = provider.get("getDeploymentGroups");
try {
final List<String> names;
try {
names = client.getChildren(folder);
} catch (NoNodeException e) {
return Maps.newHashMap();
}
final Map<String, DeploymentGroup> descriptors = Maps.newHashMap();
for (final String name : names) {
final String path = Paths.configDeploymentGroup(name);
try {
final byte[] data = client.getData(path);
final DeploymentGroup descriptor = parse(data, DeploymentGroup.class);
descriptors.put(descriptor.getName(), descriptor);
} catch (NoNodeException e) {
// Ignore, the deployment group was deleted before we had a chance to read it.
log.debug("Ignoring deleted deployment group {}", name);
}
}
return descriptors;
} catch (KeeperException | IOException e) {
throw new HeliosRuntimeException("getting deployment groups failed", e);
}
} | java | @Override
public Map<String, DeploymentGroup> getDeploymentGroups() {
log.debug("getting deployment groups");
final String folder = Paths.configDeploymentGroups();
final ZooKeeperClient client = provider.get("getDeploymentGroups");
try {
final List<String> names;
try {
names = client.getChildren(folder);
} catch (NoNodeException e) {
return Maps.newHashMap();
}
final Map<String, DeploymentGroup> descriptors = Maps.newHashMap();
for (final String name : names) {
final String path = Paths.configDeploymentGroup(name);
try {
final byte[] data = client.getData(path);
final DeploymentGroup descriptor = parse(data, DeploymentGroup.class);
descriptors.put(descriptor.getName(), descriptor);
} catch (NoNodeException e) {
// Ignore, the deployment group was deleted before we had a chance to read it.
log.debug("Ignoring deleted deployment group {}", name);
}
}
return descriptors;
} catch (KeeperException | IOException e) {
throw new HeliosRuntimeException("getting deployment groups failed", e);
}
} | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"DeploymentGroup",
">",
"getDeploymentGroups",
"(",
")",
"{",
"log",
".",
"debug",
"(",
"\"getting deployment groups\"",
")",
";",
"final",
"String",
"folder",
"=",
"Paths",
".",
"configDeploymentGroups",
"("... | Returns a {@link Map} of deployment group name to {@link DeploymentGroup} objects for all of
the deployment groups known. | [
"Returns",
"a",
"{"
] | train | https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/master/ZooKeeperMasterModel.java#L1249-L1277 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/internal/config/MergePolicyValidator.java | MergePolicyValidator.checkMapMergePolicy | static void checkMapMergePolicy(MapConfig mapConfig, MergePolicyProvider mergePolicyProvider) {
String mergePolicyClassName = mapConfig.getMergePolicyConfig().getPolicy();
Object mergePolicyInstance = getMergePolicyInstance(mergePolicyProvider, mergePolicyClassName);
List<Class> requiredMergeTypes = checkMergePolicy(mapConfig, mergePolicyInstance);
if (!mapConfig.isStatisticsEnabled() && requiredMergeTypes != null) {
checkMapMergePolicyWhenStatisticsAreDisabled(mergePolicyClassName, requiredMergeTypes);
}
} | java | static void checkMapMergePolicy(MapConfig mapConfig, MergePolicyProvider mergePolicyProvider) {
String mergePolicyClassName = mapConfig.getMergePolicyConfig().getPolicy();
Object mergePolicyInstance = getMergePolicyInstance(mergePolicyProvider, mergePolicyClassName);
List<Class> requiredMergeTypes = checkMergePolicy(mapConfig, mergePolicyInstance);
if (!mapConfig.isStatisticsEnabled() && requiredMergeTypes != null) {
checkMapMergePolicyWhenStatisticsAreDisabled(mergePolicyClassName, requiredMergeTypes);
}
} | [
"static",
"void",
"checkMapMergePolicy",
"(",
"MapConfig",
"mapConfig",
",",
"MergePolicyProvider",
"mergePolicyProvider",
")",
"{",
"String",
"mergePolicyClassName",
"=",
"mapConfig",
".",
"getMergePolicyConfig",
"(",
")",
".",
"getPolicy",
"(",
")",
";",
"Object",
... | Checks the merge policy configuration of the given {@link MapConfig}.
@param mapConfig the {@link MapConfig}
@param mergePolicyProvider the {@link MergePolicyProvider} to resolve merge policy classes | [
"Checks",
"the",
"merge",
"policy",
"configuration",
"of",
"the",
"given",
"{",
"@link",
"MapConfig",
"}",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/config/MergePolicyValidator.java#L140-L147 |
xiancloud/xian | xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheObjectUtil.java | CacheObjectUtil.luaScript | public static Object luaScript(String scripts, int keyCount, List<String> params) {
return luaScript(CacheService.CACHE_CONFIG_BEAN, scripts, keyCount, params);
} | java | public static Object luaScript(String scripts, int keyCount, List<String> params) {
return luaScript(CacheService.CACHE_CONFIG_BEAN, scripts, keyCount, params);
} | [
"public",
"static",
"Object",
"luaScript",
"(",
"String",
"scripts",
",",
"int",
"keyCount",
",",
"List",
"<",
"String",
">",
"params",
")",
"{",
"return",
"luaScript",
"(",
"CacheService",
".",
"CACHE_CONFIG_BEAN",
",",
"scripts",
",",
"keyCount",
",",
"par... | execute the lua script
@param scripts the script to be executed.
@param keyCount the key count
@param params the parameters
@return the result object | [
"execute",
"the",
"lua",
"script"
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-core/src/main/java/info/xiancloud/core/support/cache/api/CacheObjectUtil.java#L35-L37 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/fixture/slim/web/SeleniumDriverSetup.java | SeleniumDriverSetup.setPropertyValue | public boolean setPropertyValue(String propName, String value) {
if (OVERRIDE_ACTIVE) {
return true;
}
System.setProperty(propName, value);
return true;
} | java | public boolean setPropertyValue(String propName, String value) {
if (OVERRIDE_ACTIVE) {
return true;
}
System.setProperty(propName, value);
return true;
} | [
"public",
"boolean",
"setPropertyValue",
"(",
"String",
"propName",
",",
"String",
"value",
")",
"{",
"if",
"(",
"OVERRIDE_ACTIVE",
")",
"{",
"return",
"true",
";",
"}",
"System",
".",
"setProperty",
"(",
"propName",
",",
"value",
")",
";",
"return",
"true... | Sets system property (needed by the WebDriver to be set up).
@param propName name of property to set.
@param value value to set.
@return true. | [
"Sets",
"system",
"property",
"(",
"needed",
"by",
"the",
"WebDriver",
"to",
"be",
"set",
"up",
")",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/web/SeleniumDriverSetup.java#L45-L52 |
liferay/com-liferay-commerce | commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java | CPDefinitionSpecificationOptionValuePersistenceImpl.findByCPDefinitionId | @Override
public List<CPDefinitionSpecificationOptionValue> findByCPDefinitionId(
long CPDefinitionId, int start, int end) {
return findByCPDefinitionId(CPDefinitionId, start, end, null);
} | java | @Override
public List<CPDefinitionSpecificationOptionValue> findByCPDefinitionId(
long CPDefinitionId, int start, int end) {
return findByCPDefinitionId(CPDefinitionId, start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CPDefinitionSpecificationOptionValue",
">",
"findByCPDefinitionId",
"(",
"long",
"CPDefinitionId",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findByCPDefinitionId",
"(",
"CPDefinitionId",
",",
"start",
",",
... | Returns a range of all the cp definition specification option values where CPDefinitionId = ?.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionSpecificationOptionValueModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param CPDefinitionId the cp definition ID
@param start the lower bound of the range of cp definition specification option values
@param end the upper bound of the range of cp definition specification option values (not inclusive)
@return the range of matching cp definition specification option values | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"cp",
"definition",
"specification",
"option",
"values",
"where",
"CPDefinitionId",
"=",
"?",
";",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionSpecificationOptionValuePersistenceImpl.java#L2092-L2096 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.toAsyncThrowing | public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Func8<T1, T2, T3, T4, T5, T6, T7, T8, Observable<R>> toAsyncThrowing(final ThrowingFunc8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> func, final Scheduler scheduler) {
return new Func8<T1, T2, T3, T4, T5, T6, T7, T8, Observable<R>>() {
@Override
public Observable<R> call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8) {
return startCallable(ThrowingFunctions.toCallable(func, t1, t2, t3, t4, t5, t6, t7, t8), scheduler);
}
};
} | java | public static <T1, T2, T3, T4, T5, T6, T7, T8, R> Func8<T1, T2, T3, T4, T5, T6, T7, T8, Observable<R>> toAsyncThrowing(final ThrowingFunc8<? super T1, ? super T2, ? super T3, ? super T4, ? super T5, ? super T6, ? super T7, ? super T8, ? extends R> func, final Scheduler scheduler) {
return new Func8<T1, T2, T3, T4, T5, T6, T7, T8, Observable<R>>() {
@Override
public Observable<R> call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8) {
return startCallable(ThrowingFunctions.toCallable(func, t1, t2, t3, t4, t5, t6, t7, t8), scheduler);
}
};
} | [
"public",
"static",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"T7",
",",
"T8",
",",
"R",
">",
"Func8",
"<",
"T1",
",",
"T2",
",",
"T3",
",",
"T4",
",",
"T5",
",",
"T6",
",",
"T7",
",",
"T8",
",",
"Observable",... | Convert a synchronous function call into an asynchronous function call through an Observable.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/toAsync.s.png" alt="">
@param <T1> the first parameter type
@param <T2> the second parameter type
@param <T3> the third parameter type
@param <T4> the fourth parameter type
@param <T5> the fifth parameter type
@param <T6> the sixth parameter type
@param <T7> the seventh parameter type
@param <T8> the eighth parameter type
@param <R> the result type
@param func the function to convert
@param scheduler the Scheduler used to call the {@code func}
@return a function that returns an Observable that executes the {@code func} and emits its returned value
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-toasync-or-asyncaction-or-asyncfunc">RxJava Wiki: toAsync()</a>
@see <a href="http://msdn.microsoft.com/en-us/library/hh228956.aspx">MSDN: Observable.ToAsync</a> | [
"Convert",
"a",
"synchronous",
"function",
"call",
"into",
"an",
"asynchronous",
"function",
"call",
"through",
"an",
"Observable",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
".",
"com",
"/",
"wiki"... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L1505-L1512 |
Azure/azure-sdk-for-java | signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java | SignalRsInner.updateAsync | public Observable<SignalRResourceInner> updateAsync(String resourceGroupName, String resourceName) {
return updateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() {
@Override
public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) {
return response.body();
}
});
} | java | public Observable<SignalRResourceInner> updateAsync(String resourceGroupName, String resourceName) {
return updateWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<SignalRResourceInner>, SignalRResourceInner>() {
@Override
public SignalRResourceInner call(ServiceResponse<SignalRResourceInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SignalRResourceInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"updateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".",
"map",
"(",
"new"... | Operation to update an exiting SignalR service.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param resourceName The name of the SignalR resource.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Operation",
"to",
"update",
"an",
"exiting",
"SignalR",
"service",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/signalr/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/signalr/v2018_03_01_preview/implementation/SignalRsInner.java#L1469-L1476 |
lievendoclo/Valkyrie-RCP | valkyrie-rcp-core/src/main/java/org/valkyriercp/application/session/ApplicationSession.java | ApplicationSession.getAttribute | public Object getAttribute(String key, Object defaultValue)
{
Object attributeValue = getUserAttribute(key, null);
if (attributeValue != null)
return attributeValue;
attributeValue = getSessionAttribute(key, null);
if (attributeValue != null)
return attributeValue;
return defaultValue;
} | java | public Object getAttribute(String key, Object defaultValue)
{
Object attributeValue = getUserAttribute(key, null);
if (attributeValue != null)
return attributeValue;
attributeValue = getSessionAttribute(key, null);
if (attributeValue != null)
return attributeValue;
return defaultValue;
} | [
"public",
"Object",
"getAttribute",
"(",
"String",
"key",
",",
"Object",
"defaultValue",
")",
"{",
"Object",
"attributeValue",
"=",
"getUserAttribute",
"(",
"key",
",",
"null",
")",
";",
"if",
"(",
"attributeValue",
"!=",
"null",
")",
"return",
"attributeValue... | Get a value from the user OR session attributes map.
@param key
name of the attribute
@param defaultValue
a default value to return if no value is found.
@return the attribute value | [
"Get",
"a",
"value",
"from",
"the",
"user",
"OR",
"session",
"attributes",
"map",
"."
] | train | https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/session/ApplicationSession.java#L329-L338 |
alkacon/opencms-core | src/org/opencms/ui/apps/CmsFileExplorer.java | CmsFileExplorer.createSiteSelect | private ComboBox createSiteSelect(CmsObject cms) {
final IndexedContainer availableSites = CmsVaadinUtils.getAvailableSitesContainer(cms, SITE_CAPTION);
ComboBox combo = new ComboBox(null, availableSites);
combo.setTextInputAllowed(true);
combo.setNullSelectionAllowed(false);
combo.setWidth("200px");
combo.setInputPrompt(
Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_CLICK_TO_EDIT_0));
combo.setItemCaptionPropertyId(SITE_CAPTION);
combo.select(cms.getRequestContext().getSiteRoot());
combo.setFilteringMode(FilteringMode.CONTAINS);
combo.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
String value = (String)event.getProperty().getValue();
if (availableSites.containsId(value)) {
changeSite(value, null);
m_appContext.updateOnChange();
availableSites.removeAllContainerFilters();
}
}
});
if (Page.getCurrent().getBrowserWindowHeight() > 650) {
combo.setPageLength(20);
}
return combo;
} | java | private ComboBox createSiteSelect(CmsObject cms) {
final IndexedContainer availableSites = CmsVaadinUtils.getAvailableSitesContainer(cms, SITE_CAPTION);
ComboBox combo = new ComboBox(null, availableSites);
combo.setTextInputAllowed(true);
combo.setNullSelectionAllowed(false);
combo.setWidth("200px");
combo.setInputPrompt(
Messages.get().getBundle(UI.getCurrent().getLocale()).key(Messages.GUI_EXPLORER_CLICK_TO_EDIT_0));
combo.setItemCaptionPropertyId(SITE_CAPTION);
combo.select(cms.getRequestContext().getSiteRoot());
combo.setFilteringMode(FilteringMode.CONTAINS);
combo.addValueChangeListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
String value = (String)event.getProperty().getValue();
if (availableSites.containsId(value)) {
changeSite(value, null);
m_appContext.updateOnChange();
availableSites.removeAllContainerFilters();
}
}
});
if (Page.getCurrent().getBrowserWindowHeight() > 650) {
combo.setPageLength(20);
}
return combo;
} | [
"private",
"ComboBox",
"createSiteSelect",
"(",
"CmsObject",
"cms",
")",
"{",
"final",
"IndexedContainer",
"availableSites",
"=",
"CmsVaadinUtils",
".",
"getAvailableSitesContainer",
"(",
"cms",
",",
"SITE_CAPTION",
")",
";",
"ComboBox",
"combo",
"=",
"new",
"ComboB... | Creates the site selector combo box.<p>
@param cms the current cms context
@return the combo box | [
"Creates",
"the",
"site",
"selector",
"combo",
"box",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/CmsFileExplorer.java#L1730-L1760 |
Javen205/IJPay | src/main/java/com/jpay/unionpay/AcpService.java | AcpService.createAutoFormHtml | public static String createAutoFormHtml(String reqUrl, Map<String, String> hiddens,String encoding) {
StringBuffer sf = new StringBuffer();
sf.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset="+encoding+"\"/></head><body>");
sf.append("<form id = \"pay_form\" action=\"" + reqUrl
+ "\" method=\"post\">");
if (null != hiddens && 0 != hiddens.size()) {
Set<Entry<String, String>> set = hiddens.entrySet();
Iterator<Entry<String, String>> it = set.iterator();
while (it.hasNext()) {
Entry<String, String> ey = it.next();
String key = ey.getKey();
String value = ey.getValue();
sf.append("<input type=\"hidden\" name=\"" + key + "\" id=\""
+ key + "\" value=\"" + value + "\"/>");
}
}
sf.append("</form>");
sf.append("</body>");
sf.append("<script type=\"text/javascript\">");
sf.append("document.all.pay_form.submit();");
sf.append("</script>");
sf.append("</html>");
return sf.toString();
} | java | public static String createAutoFormHtml(String reqUrl, Map<String, String> hiddens,String encoding) {
StringBuffer sf = new StringBuffer();
sf.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset="+encoding+"\"/></head><body>");
sf.append("<form id = \"pay_form\" action=\"" + reqUrl
+ "\" method=\"post\">");
if (null != hiddens && 0 != hiddens.size()) {
Set<Entry<String, String>> set = hiddens.entrySet();
Iterator<Entry<String, String>> it = set.iterator();
while (it.hasNext()) {
Entry<String, String> ey = it.next();
String key = ey.getKey();
String value = ey.getValue();
sf.append("<input type=\"hidden\" name=\"" + key + "\" id=\""
+ key + "\" value=\"" + value + "\"/>");
}
}
sf.append("</form>");
sf.append("</body>");
sf.append("<script type=\"text/javascript\">");
sf.append("document.all.pay_form.submit();");
sf.append("</script>");
sf.append("</html>");
return sf.toString();
} | [
"public",
"static",
"String",
"createAutoFormHtml",
"(",
"String",
"reqUrl",
",",
"Map",
"<",
"String",
",",
"String",
">",
"hiddens",
",",
"String",
"encoding",
")",
"{",
"StringBuffer",
"sf",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"sf",
".",
"append"... | 功能:前台交易构造HTTP POST自动提交表单<br>
@param action 表单提交地址<br>
@param hiddens 以MAP形式存储的表单键值<br>
@param encoding 上送请求报文域encoding字段的值<br>
@return 构造好的HTTP POST交易表单<br> | [
"功能:前台交易构造HTTP",
"POST自动提交表单<br",
">"
] | train | https://github.com/Javen205/IJPay/blob/78da6be4b70675abc6a41df74817532fa257ef29/src/main/java/com/jpay/unionpay/AcpService.java#L88-L111 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/rules/ngrams/GoogleToken.java | GoogleToken.getGoogleTokens | static List<GoogleToken> getGoogleTokens(AnalyzedSentence sentence, boolean addStartToken, Tokenizer wordTokenizer) {
List<GoogleToken> result = new ArrayList<>();
if (addStartToken) {
result.add(new GoogleToken(LanguageModel.GOOGLE_SENTENCE_START, 0, 0));
}
List<String> tokens = wordTokenizer.tokenize(sentence.getText());
int startPos = 0;
for (String token : tokens) {
if (!StringTools.isWhitespace(token)) {
int endPos = startPos + token.length();
Set<AnalyzedToken> pos = findOriginalAnalyzedTokens(sentence, startPos, endPos);
GoogleToken gToken = new GoogleToken(token, startPos, endPos, pos);
result.add(gToken);
}
startPos += token.length();
}
return result;
} | java | static List<GoogleToken> getGoogleTokens(AnalyzedSentence sentence, boolean addStartToken, Tokenizer wordTokenizer) {
List<GoogleToken> result = new ArrayList<>();
if (addStartToken) {
result.add(new GoogleToken(LanguageModel.GOOGLE_SENTENCE_START, 0, 0));
}
List<String> tokens = wordTokenizer.tokenize(sentence.getText());
int startPos = 0;
for (String token : tokens) {
if (!StringTools.isWhitespace(token)) {
int endPos = startPos + token.length();
Set<AnalyzedToken> pos = findOriginalAnalyzedTokens(sentence, startPos, endPos);
GoogleToken gToken = new GoogleToken(token, startPos, endPos, pos);
result.add(gToken);
}
startPos += token.length();
}
return result;
} | [
"static",
"List",
"<",
"GoogleToken",
">",
"getGoogleTokens",
"(",
"AnalyzedSentence",
"sentence",
",",
"boolean",
"addStartToken",
",",
"Tokenizer",
"wordTokenizer",
")",
"{",
"List",
"<",
"GoogleToken",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
... | so we use getTokenizer() and simple ignore the LT tokens. Also adds POS tags from original sentence if trivially possible. | [
"so",
"we",
"use",
"getTokenizer",
"()",
"and",
"simple",
"ignore",
"the",
"LT",
"tokens",
".",
"Also",
"adds",
"POS",
"tags",
"from",
"original",
"sentence",
"if",
"trivially",
"possible",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/rules/ngrams/GoogleToken.java#L86-L103 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java | PropertiesConfigHelper.getCustomBundleProperty | public String getCustomBundleProperty(String bundleName, String key, String defaultValue) {
return props.getProperty(prefix + PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_PROPERTY + bundleName + key,
defaultValue);
} | java | public String getCustomBundleProperty(String bundleName, String key, String defaultValue) {
return props.getProperty(prefix + PropertiesBundleConstant.BUNDLE_FACTORY_CUSTOM_PROPERTY + bundleName + key,
defaultValue);
} | [
"public",
"String",
"getCustomBundleProperty",
"(",
"String",
"bundleName",
",",
"String",
"key",
",",
"String",
"defaultValue",
")",
"{",
"return",
"props",
".",
"getProperty",
"(",
"prefix",
"+",
"PropertiesBundleConstant",
".",
"BUNDLE_FACTORY_CUSTOM_PROPERTY",
"+"... | Returns the value of the custom bundle property, or the default value if
no value is defined
@param bundleName
the bundle name
@param key
the key of the property
@param defaultValue
the default value
@return the value of the custom bundle property, or the default value if
no value is defined | [
"Returns",
"the",
"value",
"of",
"the",
"custom",
"bundle",
"property",
"or",
"the",
"default",
"value",
"if",
"no",
"value",
"is",
"defined"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PropertiesConfigHelper.java#L138-L141 |
xm-online/xm-commons | xm-commons-security/src/main/java/com/icthh/xm/commons/security/oauth2/OAuth2JwtAccessTokenConverter.java | OAuth2JwtAccessTokenConverter.extractAuthentication | @Override
public OAuth2Authentication extractAuthentication(Map<String, ?> claims) {
OAuth2Authentication authentication = super.extractAuthentication(claims);
authentication.setDetails(claims);
return authentication;
} | java | @Override
public OAuth2Authentication extractAuthentication(Map<String, ?> claims) {
OAuth2Authentication authentication = super.extractAuthentication(claims);
authentication.setDetails(claims);
return authentication;
} | [
"@",
"Override",
"public",
"OAuth2Authentication",
"extractAuthentication",
"(",
"Map",
"<",
"String",
",",
"?",
">",
"claims",
")",
"{",
"OAuth2Authentication",
"authentication",
"=",
"super",
".",
"extractAuthentication",
"(",
"claims",
")",
";",
"authentication",... | Extract JWT claims and set it to OAuth2Authentication decoded details.
Here is how to get details:
<pre>
<code>
SecurityContext securityContext = SecurityContextHolder.getContext();
Authentication authentication = securityContext.getAuthentication();
if (authentication != null) {
Object details = authentication.getDetails();
if(details instanceof OAuth2AuthenticationDetails) {
Object decodedDetails = ((OAuth2AuthenticationDetails) details).getDecodedDetails();
if(decodedDetails != null && decodedDetails instanceof Map) {
String detailFoo = ((Map) decodedDetails).get("foo");
}
}
}
</code>
</pre>
@param claims OAuth2JWTToken claims
@return OAuth2Authentication | [
"Extract",
"JWT",
"claims",
"and",
"set",
"it",
"to",
"OAuth2Authentication",
"decoded",
"details",
".",
"Here",
"is",
"how",
"to",
"get",
"details",
":"
] | train | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-security/src/main/java/com/icthh/xm/commons/security/oauth2/OAuth2JwtAccessTokenConverter.java#L103-L108 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/debug/GVRConsoleFactory.java | GVRConsoleFactory.createConsoleShell | public static Shell createConsoleShell(String prompt, String appName, Object mainHandler,
BufferedReader in, PrintStream out, PrintStream err,
ConsoleIO.PromptListener promptListener) {
ConsoleIO io = new ConsoleIO(in, out, err);
if (promptListener != null) {
io.setPromptListener(promptListener);
}
List<String> path = new ArrayList<String>(1);
path.add(prompt);
MultiMap<String, Object> modifAuxHandlers = new ArrayHashMultiMap<String, Object>();
modifAuxHandlers.put("!", io);
Shell theShell = new Shell(new Shell.Settings(io, io, modifAuxHandlers, false),
new CommandTable(new DashJoinedNamer(true)), path);
theShell.setAppName(appName);
theShell.addMainHandler(theShell, "!");
theShell.addMainHandler(new HelpCommandHandler(), "?");
theShell.addMainHandler(mainHandler, "");
return theShell;
} | java | public static Shell createConsoleShell(String prompt, String appName, Object mainHandler,
BufferedReader in, PrintStream out, PrintStream err,
ConsoleIO.PromptListener promptListener) {
ConsoleIO io = new ConsoleIO(in, out, err);
if (promptListener != null) {
io.setPromptListener(promptListener);
}
List<String> path = new ArrayList<String>(1);
path.add(prompt);
MultiMap<String, Object> modifAuxHandlers = new ArrayHashMultiMap<String, Object>();
modifAuxHandlers.put("!", io);
Shell theShell = new Shell(new Shell.Settings(io, io, modifAuxHandlers, false),
new CommandTable(new DashJoinedNamer(true)), path);
theShell.setAppName(appName);
theShell.addMainHandler(theShell, "!");
theShell.addMainHandler(new HelpCommandHandler(), "?");
theShell.addMainHandler(mainHandler, "");
return theShell;
} | [
"public",
"static",
"Shell",
"createConsoleShell",
"(",
"String",
"prompt",
",",
"String",
"appName",
",",
"Object",
"mainHandler",
",",
"BufferedReader",
"in",
",",
"PrintStream",
"out",
",",
"PrintStream",
"err",
",",
"ConsoleIO",
".",
"PromptListener",
"promptL... | Facade method for operating the Shell allowing specification of auxiliary
handlers (i.e. handlers that are to be passed to all subshells).
Run the obtained Shell with commandLoop().
@see org.gearvrf.debug.cli.Shell#Shell(org.gearvrf.debug.cli.Shell.Settings, org.gearvrf.debug.cli.CommandTable, java.util.List)
@param prompt Prompt to be displayed.
@param appName The app name string.
@param mainHandler Main command handler.
@param in Input reader.
@param out Output stream.
@param err Error output stream.
@param promptListener Listener for console prompt. It can be {@code null}.
@return Shell that can be either further customized or run directly by calling commandLoop(). | [
"Facade",
"method",
"for",
"operating",
"the",
"Shell",
"allowing",
"specification",
"of",
"auxiliary",
"handlers",
"(",
"i",
".",
"e",
".",
"handlers",
"that",
"are",
"to",
"be",
"passed",
"to",
"all",
"subshells",
")",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/debug/GVRConsoleFactory.java#L61-L84 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/XfaForm.java | XfaForm.findFieldName | public String findFieldName(String name, AcroFields af) {
HashMap items = af.getFields();
if (items.containsKey(name))
return name;
if (acroFieldsSom == null) {
if (items.isEmpty() && xfaPresent)
acroFieldsSom = new AcroFieldsSearch(datasetsSom.getName2Node().keySet());
else
acroFieldsSom = new AcroFieldsSearch(items.keySet());
}
if (acroFieldsSom.getAcroShort2LongName().containsKey(name))
return (String)acroFieldsSom.getAcroShort2LongName().get(name);
return acroFieldsSom.inverseSearchGlobal(Xml2Som.splitParts(name));
} | java | public String findFieldName(String name, AcroFields af) {
HashMap items = af.getFields();
if (items.containsKey(name))
return name;
if (acroFieldsSom == null) {
if (items.isEmpty() && xfaPresent)
acroFieldsSom = new AcroFieldsSearch(datasetsSom.getName2Node().keySet());
else
acroFieldsSom = new AcroFieldsSearch(items.keySet());
}
if (acroFieldsSom.getAcroShort2LongName().containsKey(name))
return (String)acroFieldsSom.getAcroShort2LongName().get(name);
return acroFieldsSom.inverseSearchGlobal(Xml2Som.splitParts(name));
} | [
"public",
"String",
"findFieldName",
"(",
"String",
"name",
",",
"AcroFields",
"af",
")",
"{",
"HashMap",
"items",
"=",
"af",
".",
"getFields",
"(",
")",
";",
"if",
"(",
"items",
".",
"containsKey",
"(",
"name",
")",
")",
"return",
"name",
";",
"if",
... | Finds the complete field name contained in the "classic" forms from a partial
name.
@param name the complete or partial name
@param af the fields
@return the complete name or <CODE>null</CODE> if not found | [
"Finds",
"the",
"complete",
"field",
"name",
"contained",
"in",
"the",
"classic",
"forms",
"from",
"a",
"partial",
"name",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/XfaForm.java#L277-L290 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java | DatabasesInner.listByRecommendedElasticPool | public List<DatabaseInner> listByRecommendedElasticPool(String resourceGroupName, String serverName, String recommendedElasticPoolName) {
return listByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).toBlocking().single().body();
} | java | public List<DatabaseInner> listByRecommendedElasticPool(String resourceGroupName, String serverName, String recommendedElasticPoolName) {
return listByRecommendedElasticPoolWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).toBlocking().single().body();
} | [
"public",
"List",
"<",
"DatabaseInner",
">",
"listByRecommendedElasticPool",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"recommendedElasticPoolName",
")",
"{",
"return",
"listByRecommendedElasticPoolWithServiceResponseAsync",
"(",
"resourc... | Returns a list of databases inside a recommented elastic pool.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the List<DatabaseInner> object if successful. | [
"Returns",
"a",
"list",
"of",
"databases",
"inside",
"a",
"recommented",
"elastic",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabasesInner.java#L1639-L1641 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Fraction.java | Fraction.addAndCheck | private static int addAndCheck(final int x, final int y) {
final long s = (long) x + (long) y;
if (s < Integer.MIN_VALUE || s > Integer.MAX_VALUE) {
throw new ArithmeticException("overflow: add");
}
return (int) s;
} | java | private static int addAndCheck(final int x, final int y) {
final long s = (long) x + (long) y;
if (s < Integer.MIN_VALUE || s > Integer.MAX_VALUE) {
throw new ArithmeticException("overflow: add");
}
return (int) s;
} | [
"private",
"static",
"int",
"addAndCheck",
"(",
"final",
"int",
"x",
",",
"final",
"int",
"y",
")",
"{",
"final",
"long",
"s",
"=",
"(",
"long",
")",
"x",
"+",
"(",
"long",
")",
"y",
";",
"if",
"(",
"s",
"<",
"Integer",
".",
"MIN_VALUE",
"||",
... | Add two integers, checking for overflow.
@param x
an addend
@param y
an addend
@return the sum <code>x+y</code>
@throws ArithmeticException
if the result can not be represented as an int | [
"Add",
"two",
"integers",
"checking",
"for",
"overflow",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Fraction.java#L800-L806 |
chr78rm/tracelogger | src/main/java/de/christofreichardt/diagnosis/AbstractTracer.java | AbstractTracer.logMessage | public void logMessage(LogLevel logLevel, String message, Class clazz, String methodName) {
Date timeStamp = new Date();
char border[] = new char[logLevel.toString().length() + 4];
Arrays.fill(border, '*');
synchronized (this.syncObject) {
this.tracePrintStream.println(border);
this.tracePrintStream.printf("* %s * [%tc] [%d,%s] [%s] [%s] \"%s\"%n", logLevel.toString(), timeStamp, Thread.currentThread().getId(),
Thread.currentThread().getName(), clazz.getName(), methodName, message);
this.tracePrintStream.println(border);
}
} | java | public void logMessage(LogLevel logLevel, String message, Class clazz, String methodName) {
Date timeStamp = new Date();
char border[] = new char[logLevel.toString().length() + 4];
Arrays.fill(border, '*');
synchronized (this.syncObject) {
this.tracePrintStream.println(border);
this.tracePrintStream.printf("* %s * [%tc] [%d,%s] [%s] [%s] \"%s\"%n", logLevel.toString(), timeStamp, Thread.currentThread().getId(),
Thread.currentThread().getName(), clazz.getName(), methodName, message);
this.tracePrintStream.println(border);
}
} | [
"public",
"void",
"logMessage",
"(",
"LogLevel",
"logLevel",
",",
"String",
"message",
",",
"Class",
"clazz",
",",
"String",
"methodName",
")",
"{",
"Date",
"timeStamp",
"=",
"new",
"Date",
"(",
")",
";",
"char",
"border",
"[",
"]",
"=",
"new",
"char",
... | Logs a message with the given logLevel and the originating class.
@param logLevel one of the predefined levels INFO, WARNING, ERROR, FATAL and SEVERE
@param message the to be logged message
@param clazz the originating class
@param methodName the originating method | [
"Logs",
"a",
"message",
"with",
"the",
"given",
"logLevel",
"and",
"the",
"originating",
"class",
"."
] | train | https://github.com/chr78rm/tracelogger/blob/ad22452b20f8111ad4d367302c2b26a100a20200/src/main/java/de/christofreichardt/diagnosis/AbstractTracer.java#L521-L532 |
google/closure-compiler | src/com/google/javascript/jscomp/CheckAccessControls.java | CheckAccessControls.shouldEmitDeprecationWarning | private boolean shouldEmitDeprecationWarning(NodeTraversal t, Node n) {
// In the global scope, there are only two kinds of accesses that should
// be flagged for warnings:
// 1) Calls of deprecated functions and methods.
// 2) Instantiations of deprecated classes.
// For now, we just let everything else by.
if (t.inGlobalScope()) {
if (!NodeUtil.isInvocationTarget(n) && !n.isNew()) {
return false;
}
}
return !canAccessDeprecatedTypes(t);
} | java | private boolean shouldEmitDeprecationWarning(NodeTraversal t, Node n) {
// In the global scope, there are only two kinds of accesses that should
// be flagged for warnings:
// 1) Calls of deprecated functions and methods.
// 2) Instantiations of deprecated classes.
// For now, we just let everything else by.
if (t.inGlobalScope()) {
if (!NodeUtil.isInvocationTarget(n) && !n.isNew()) {
return false;
}
}
return !canAccessDeprecatedTypes(t);
} | [
"private",
"boolean",
"shouldEmitDeprecationWarning",
"(",
"NodeTraversal",
"t",
",",
"Node",
"n",
")",
"{",
"// In the global scope, there are only two kinds of accesses that should",
"// be flagged for warnings:",
"// 1) Calls of deprecated functions and methods.",
"// 2) Instantiation... | Determines whether a deprecation warning should be emitted.
@param t The current traversal.
@param n The node which we are checking.
@param parent The parent of the node which we are checking. | [
"Determines",
"whether",
"a",
"deprecation",
"warning",
"should",
"be",
"emitted",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckAccessControls.java#L1057-L1070 |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/dialog/factories/JDialogFactory.java | JDialogFactory.newJDialog | public static JDialog newJDialog(@NonNull JOptionPane pane, String title)
{
return newJDialog(null, pane, title);
} | java | public static JDialog newJDialog(@NonNull JOptionPane pane, String title)
{
return newJDialog(null, pane, title);
} | [
"public",
"static",
"JDialog",
"newJDialog",
"(",
"@",
"NonNull",
"JOptionPane",
"pane",
",",
"String",
"title",
")",
"{",
"return",
"newJDialog",
"(",
"null",
",",
"pane",
",",
"title",
")",
";",
"}"
] | Factory method for create a {@link JDialog} object over the given {@link JOptionPane}
@param pane
the pane
@param title
the title
@return the new {@link JDialog} | [
"Factory",
"method",
"for",
"create",
"a",
"{",
"@link",
"JDialog",
"}",
"object",
"over",
"the",
"given",
"{",
"@link",
"JOptionPane",
"}"
] | train | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/dialog/factories/JDialogFactory.java#L113-L116 |
Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java | CompletableFuture.completeOnTimeout | public CompletableFuture<T> completeOnTimeout(T value, long timeout, TimeUnit unit) {
Objects.requireNonNull(unit);
if (result == null)
whenComplete(
new Canceller(Delayer.delay(new DelayedCompleter<T>(this, value), timeout, unit)));
return this;
} | java | public CompletableFuture<T> completeOnTimeout(T value, long timeout, TimeUnit unit) {
Objects.requireNonNull(unit);
if (result == null)
whenComplete(
new Canceller(Delayer.delay(new DelayedCompleter<T>(this, value), timeout, unit)));
return this;
} | [
"public",
"CompletableFuture",
"<",
"T",
">",
"completeOnTimeout",
"(",
"T",
"value",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"unit",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"whenComplete"... | Completes this CompletableFuture with the given value if not otherwise completed before the
given timeout.
@param value the value to use upon timeout
@param timeout how long to wait before completing normally with the given value, in units of
{@code unit}
@param unit a {@code TimeUnit} determining how to interpret the {@code timeout} parameter
@return this CompletableFuture
@since 9 | [
"Completes",
"this",
"CompletableFuture",
"with",
"the",
"given",
"value",
"if",
"not",
"otherwise",
"completed",
"before",
"the",
"given",
"timeout",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java#L1860-L1866 |
likethecolor/Alchemy-API | src/main/java/com/likethecolor/alchemy/api/parser/json/NamedEntityParser.java | NamedEntityParser.isValidNamedEntity | private boolean isValidNamedEntity(final Double score, final String text) {
return !StringUtils.isBlank(text)
|| score != null;
} | java | private boolean isValidNamedEntity(final Double score, final String text) {
return !StringUtils.isBlank(text)
|| score != null;
} | [
"private",
"boolean",
"isValidNamedEntity",
"(",
"final",
"Double",
"score",
",",
"final",
"String",
"text",
")",
"{",
"return",
"!",
"StringUtils",
".",
"isBlank",
"(",
"text",
")",
"||",
"score",
"!=",
"null",
";",
"}"
] | Return true if at least one of the values is not null/empty.
@param score relevance score
@param text detected entity text
@return true if at least one of the values is not null/empty | [
"Return",
"true",
"if",
"at",
"least",
"one",
"of",
"the",
"values",
"is",
"not",
"null",
"/",
"empty",
"."
] | train | https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/NamedEntityParser.java#L129-L132 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java | RouteFiltersInner.getByResourceGroup | public RouteFilterInner getByResourceGroup(String resourceGroupName, String routeFilterName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, routeFilterName, expand).toBlocking().single().body();
} | java | public RouteFilterInner getByResourceGroup(String resourceGroupName, String routeFilterName, String expand) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, routeFilterName, expand).toBlocking().single().body();
} | [
"public",
"RouteFilterInner",
"getByResourceGroup",
"(",
"String",
"resourceGroupName",
",",
"String",
"routeFilterName",
",",
"String",
"expand",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"routeFilterName",
",",
"expan... | Gets the specified route filter.
@param resourceGroupName The name of the resource group.
@param routeFilterName The name of the route filter.
@param expand Expands referenced express route bgp peering resources.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the RouteFilterInner object if successful. | [
"Gets",
"the",
"specified",
"route",
"filter",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/RouteFiltersInner.java#L355-L357 |
nohana/Amalgam | amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java | DialogFragmentUtils.supportDismissOnLoaderCallback | public static void supportDismissOnLoaderCallback(Handler handler, final android.support.v4.app.FragmentManager manager, final String tag) {
handler.post(new Runnable() {
@Override
public void run() {
android.support.v4.app.DialogFragment fragment = (android.support.v4.app.DialogFragment) manager.findFragmentByTag(tag);
if (fragment != null) {
fragment.dismiss();
}
}
});
} | java | public static void supportDismissOnLoaderCallback(Handler handler, final android.support.v4.app.FragmentManager manager, final String tag) {
handler.post(new Runnable() {
@Override
public void run() {
android.support.v4.app.DialogFragment fragment = (android.support.v4.app.DialogFragment) manager.findFragmentByTag(tag);
if (fragment != null) {
fragment.dismiss();
}
}
});
} | [
"public",
"static",
"void",
"supportDismissOnLoaderCallback",
"(",
"Handler",
"handler",
",",
"final",
"android",
".",
"support",
".",
"v4",
".",
"app",
".",
"FragmentManager",
"manager",
",",
"final",
"String",
"tag",
")",
"{",
"handler",
".",
"post",
"(",
... | Dismiss {@link android.support.v4.app.DialogFragment} for the tag on the loader callbacks with the specified {@link android.os.Handler}.
@param handler the handler, in most case, this handler is the main handler.
@param manager the manager.
@param tag the tag string that is related to the {@link android.support.v4.app.DialogFragment}. | [
"Dismiss",
"{"
] | train | https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/app/DialogFragmentUtils.java#L104-L114 |
alkacon/opencms-core | src/org/opencms/ade/configuration/CmsADEManager.java | CmsADEManager.getDetailPage | public String getDetailPage(CmsObject cms, String pageRootPath, String originPath) {
return getDetailPage(cms, pageRootPath, originPath, null);
} | java | public String getDetailPage(CmsObject cms, String pageRootPath, String originPath) {
return getDetailPage(cms, pageRootPath, originPath, null);
} | [
"public",
"String",
"getDetailPage",
"(",
"CmsObject",
"cms",
",",
"String",
"pageRootPath",
",",
"String",
"originPath",
")",
"{",
"return",
"getDetailPage",
"(",
"cms",
",",
"pageRootPath",
",",
"originPath",
",",
"null",
")",
";",
"}"
] | Gets the detail page for a content element.<p>
@param cms the CMS context
@param pageRootPath the element's root path
@param originPath the path in which the the detail page is being requested
@return the detail page for the content element | [
"Gets",
"the",
"detail",
"page",
"for",
"a",
"content",
"element",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEManager.java#L427-L430 |
mgm-tp/jfunk | jfunk-common/src/main/java/com/mgmtp/jfunk/common/cli/CliUtils.java | CliUtils.executeCommandLine | public static CliOutput executeCommandLine(final Commandline cli, final String loggerName) {
return executeCommandLine(cli, loggerName, null);
} | java | public static CliOutput executeCommandLine(final Commandline cli, final String loggerName) {
return executeCommandLine(cli, loggerName, null);
} | [
"public",
"static",
"CliOutput",
"executeCommandLine",
"(",
"final",
"Commandline",
"cli",
",",
"final",
"String",
"loggerName",
")",
"{",
"return",
"executeCommandLine",
"(",
"cli",
",",
"loggerName",
",",
"null",
")",
";",
"}"
] | Executes the specified command line and blocks until the process has finished. The output of
the process is captured, returned, as well as logged with info (stdout) and error (stderr)
level, respectively.
@param cli
the command line
@param loggerName
the name of the logger to use (passed to {@link LoggerFactory#getLogger(String)});
if {@code null} this class' name is used
@return the process' output | [
"Executes",
"the",
"specified",
"command",
"line",
"and",
"blocks",
"until",
"the",
"process",
"has",
"finished",
".",
"The",
"output",
"of",
"the",
"process",
"is",
"captured",
"returned",
"as",
"well",
"as",
"logged",
"with",
"info",
"(",
"stdout",
")",
... | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/cli/CliUtils.java#L62-L64 |
gallandarakhneorg/afc | core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d1/Transform1D.java | Transform1D.toTransform2D | @Pure
public final Transform2D toTransform2D(Segment1D<?, ?> segment) {
assert segment != null : AssertMessages.notNullParameter(0);
final Point2D<?, ?> a = segment.getFirstPoint();
if (a == null) {
return null;
}
final Point2D<?, ?> b = segment.getLastPoint();
if (b == null) {
return null;
}
return toTransform2D(a.getX(), a.getY(), b.getX(), b.getY());
} | java | @Pure
public final Transform2D toTransform2D(Segment1D<?, ?> segment) {
assert segment != null : AssertMessages.notNullParameter(0);
final Point2D<?, ?> a = segment.getFirstPoint();
if (a == null) {
return null;
}
final Point2D<?, ?> b = segment.getLastPoint();
if (b == null) {
return null;
}
return toTransform2D(a.getX(), a.getY(), b.getX(), b.getY());
} | [
"@",
"Pure",
"public",
"final",
"Transform2D",
"toTransform2D",
"(",
"Segment1D",
"<",
"?",
",",
"?",
">",
"segment",
")",
"{",
"assert",
"segment",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
"0",
")",
";",
"final",
"Point2D",
"<",
... | Replies a 2D transformation that is corresponding to this transformation.
@param segment is the segment.
@return the 2D transformation or <code>null</code> if the segment could not be mapped
to 2D. | [
"Replies",
"a",
"2D",
"transformation",
"that",
"is",
"corresponding",
"to",
"this",
"transformation",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d1/Transform1D.java#L614-L626 |
facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobHistory.java | CoronaJobHistory.logTaskUpdates | public void logTaskUpdates(TaskID taskId, long finishTime) {
if (disableHistory) {
return;
}
JobID id = taskId.getJobID();
if (!this.jobId.equals(id)) {
throw new RuntimeException("JobId from task: " + id +
" does not match expected: " + jobId);
}
if (null != writers) {
log(writers, RecordTypes.Task,
new Keys[]{Keys.TASKID, Keys.FINISH_TIME},
new String[]{ taskId.toString(),
String.valueOf(finishTime)});
}
} | java | public void logTaskUpdates(TaskID taskId, long finishTime) {
if (disableHistory) {
return;
}
JobID id = taskId.getJobID();
if (!this.jobId.equals(id)) {
throw new RuntimeException("JobId from task: " + id +
" does not match expected: " + jobId);
}
if (null != writers) {
log(writers, RecordTypes.Task,
new Keys[]{Keys.TASKID, Keys.FINISH_TIME},
new String[]{ taskId.toString(),
String.valueOf(finishTime)});
}
} | [
"public",
"void",
"logTaskUpdates",
"(",
"TaskID",
"taskId",
",",
"long",
"finishTime",
")",
"{",
"if",
"(",
"disableHistory",
")",
"{",
"return",
";",
"}",
"JobID",
"id",
"=",
"taskId",
".",
"getJobID",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"j... | Update the finish time of task.
@param taskId task id
@param finishTime finish time of task in ms | [
"Update",
"the",
"finish",
"time",
"of",
"task",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/CoronaJobHistory.java#L536-L553 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/PruneStructureFromSceneMetric.java | PruneStructureFromSceneMetric.prunePoints | public void prunePoints(int neighbors , double distance ) {
// Use a nearest neighbor search to find near by points
Point3D_F64 worldX = new Point3D_F64();
List<Point3D_F64> cloud = new ArrayList<>();
for (int i = 0; i < structure.points.length; i++) {
SceneStructureMetric.Point structureP = structure.points[i];
structureP.get(worldX);
cloud.add(worldX.copy());
}
NearestNeighbor<Point3D_F64> nn = FactoryNearestNeighbor.kdtree(new KdTreePoint3D_F64());
NearestNeighbor.Search<Point3D_F64> search = nn.createSearch();
nn.setPoints(cloud,false);
FastQueue<NnData<Point3D_F64>> resultsNN = new FastQueue(NnData.class,true);
// Create a look up table containing from old to new indexes for each point
int oldToNew[] = new int[ structure.points.length ];
Arrays.fill(oldToNew,-1); // crash is bug
// List of point ID's which are to be removed.
GrowQueue_I32 prunePointID = new GrowQueue_I32();
// identify points which need to be pruned
for (int pointId = 0; pointId < structure.points.length; pointId++) {
SceneStructureMetric.Point structureP = structure.points[pointId];
structureP.get(worldX);
// distance is squared
search.findNearest(cloud.get(pointId),distance*distance,neighbors+1,resultsNN);
// Don't prune if it has enough neighbors. Remember that it will always find itself.
if( resultsNN.size() > neighbors ) {
oldToNew[pointId] = pointId-prunePointID.size;
continue;
}
prunePointID.add(pointId);
// Remove observations of this point
for (int viewIdx = 0; viewIdx < structureP.views.size; viewIdx++) {
SceneObservations.View v = observations.getView(structureP.views.data[viewIdx]);
int pointIdx = v.point.indexOf(pointId);
if( pointIdx < 0 )
throw new RuntimeException("Bad structure. Point not found in view's observation " +
"which was in its structure");
v.remove(pointIdx);
}
}
pruneUpdatePointID(oldToNew, prunePointID);
} | java | public void prunePoints(int neighbors , double distance ) {
// Use a nearest neighbor search to find near by points
Point3D_F64 worldX = new Point3D_F64();
List<Point3D_F64> cloud = new ArrayList<>();
for (int i = 0; i < structure.points.length; i++) {
SceneStructureMetric.Point structureP = structure.points[i];
structureP.get(worldX);
cloud.add(worldX.copy());
}
NearestNeighbor<Point3D_F64> nn = FactoryNearestNeighbor.kdtree(new KdTreePoint3D_F64());
NearestNeighbor.Search<Point3D_F64> search = nn.createSearch();
nn.setPoints(cloud,false);
FastQueue<NnData<Point3D_F64>> resultsNN = new FastQueue(NnData.class,true);
// Create a look up table containing from old to new indexes for each point
int oldToNew[] = new int[ structure.points.length ];
Arrays.fill(oldToNew,-1); // crash is bug
// List of point ID's which are to be removed.
GrowQueue_I32 prunePointID = new GrowQueue_I32();
// identify points which need to be pruned
for (int pointId = 0; pointId < structure.points.length; pointId++) {
SceneStructureMetric.Point structureP = structure.points[pointId];
structureP.get(worldX);
// distance is squared
search.findNearest(cloud.get(pointId),distance*distance,neighbors+1,resultsNN);
// Don't prune if it has enough neighbors. Remember that it will always find itself.
if( resultsNN.size() > neighbors ) {
oldToNew[pointId] = pointId-prunePointID.size;
continue;
}
prunePointID.add(pointId);
// Remove observations of this point
for (int viewIdx = 0; viewIdx < structureP.views.size; viewIdx++) {
SceneObservations.View v = observations.getView(structureP.views.data[viewIdx]);
int pointIdx = v.point.indexOf(pointId);
if( pointIdx < 0 )
throw new RuntimeException("Bad structure. Point not found in view's observation " +
"which was in its structure");
v.remove(pointIdx);
}
}
pruneUpdatePointID(oldToNew, prunePointID);
} | [
"public",
"void",
"prunePoints",
"(",
"int",
"neighbors",
",",
"double",
"distance",
")",
"{",
"// Use a nearest neighbor search to find near by points",
"Point3D_F64",
"worldX",
"=",
"new",
"Point3D_F64",
"(",
")",
";",
"List",
"<",
"Point3D_F64",
">",
"cloud",
"="... | Prune a feature it has fewer than X neighbors within Y distance. Observations
associated with this feature are also pruned.
Call {@link #pruneViews(int)} to makes sure the graph is valid.
@param neighbors Number of other features which need to be near by
@param distance Maximum distance a point can be to be considered a feature | [
"Prune",
"a",
"feature",
"it",
"has",
"fewer",
"than",
"X",
"neighbors",
"within",
"Y",
"distance",
".",
"Observations",
"associated",
"with",
"this",
"feature",
"are",
"also",
"pruned",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/abst/geo/bundle/PruneStructureFromSceneMetric.java#L235-L286 |
OpenLiberty/open-liberty | dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/AbstractDirector.java | AbstractDirector.containFeature | boolean containFeature(Map<String, ProvisioningFeatureDefinition> installedFeatures, String feature) {
if (installedFeatures.containsKey(feature))
return true;
for (ProvisioningFeatureDefinition pfd : installedFeatures.values()) {
String shortName = InstallUtils.getShortName(pfd);
if (shortName != null && shortName.equalsIgnoreCase(feature))
return true;
}
return false;
} | java | boolean containFeature(Map<String, ProvisioningFeatureDefinition> installedFeatures, String feature) {
if (installedFeatures.containsKey(feature))
return true;
for (ProvisioningFeatureDefinition pfd : installedFeatures.values()) {
String shortName = InstallUtils.getShortName(pfd);
if (shortName != null && shortName.equalsIgnoreCase(feature))
return true;
}
return false;
} | [
"boolean",
"containFeature",
"(",
"Map",
"<",
"String",
",",
"ProvisioningFeatureDefinition",
">",
"installedFeatures",
",",
"String",
"feature",
")",
"{",
"if",
"(",
"installedFeatures",
".",
"containsKey",
"(",
"feature",
")",
")",
"return",
"true",
";",
"for"... | Checks if the feature is in installedFeatures
@param installedFeatures the map of installed features
@param feature the feature to look for
@return true if feature is in installedFeatures | [
"Checks",
"if",
"the",
"feature",
"is",
"in",
"installedFeatures"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/AbstractDirector.java#L154-L163 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.renderPixel | public static Point2D_F64 renderPixel( Se3_F64 worldToCamera , DMatrixRMaj K , Point3D_F64 X ) {
return ImplPerspectiveOps_F64.renderPixel(worldToCamera,K,X);
// if( K == null )
// return renderPixel(worldToCamera,X);
// return ImplPerspectiveOps_F64.renderPixel(worldToCamera,
// K.data[0], K.data[1], K.data[2], K.data[4], K.data[5], X);
} | java | public static Point2D_F64 renderPixel( Se3_F64 worldToCamera , DMatrixRMaj K , Point3D_F64 X ) {
return ImplPerspectiveOps_F64.renderPixel(worldToCamera,K,X);
// if( K == null )
// return renderPixel(worldToCamera,X);
// return ImplPerspectiveOps_F64.renderPixel(worldToCamera,
// K.data[0], K.data[1], K.data[2], K.data[4], K.data[5], X);
} | [
"public",
"static",
"Point2D_F64",
"renderPixel",
"(",
"Se3_F64",
"worldToCamera",
",",
"DMatrixRMaj",
"K",
",",
"Point3D_F64",
"X",
")",
"{",
"return",
"ImplPerspectiveOps_F64",
".",
"renderPixel",
"(",
"worldToCamera",
",",
"K",
",",
"X",
")",
";",
"//\t\tif( ... | Renders a point in world coordinates into the image plane in pixels or normalized image
coordinates.
@param worldToCamera Transform from world to camera frame
@param K Optional. Intrinsic camera calibration matrix. If null then normalized image coordinates are returned.
@param X 3D Point in world reference frame..
@return 2D Render point on image plane or null if it's behind the camera | [
"Renders",
"a",
"point",
"in",
"world",
"coordinates",
"into",
"the",
"image",
"plane",
"in",
"pixels",
"or",
"normalized",
"image",
"coordinates",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L513-L519 |
op4j/op4j | src/main/java/org/op4j/Op.java | Op.onArrayFor | public static <T> Level0ArrayOperator<Integer[],Integer> onArrayFor(final Integer... elements) {
return onArrayOf(Types.INTEGER, VarArgsUtil.asRequiredObjectArray(elements));
} | java | public static <T> Level0ArrayOperator<Integer[],Integer> onArrayFor(final Integer... elements) {
return onArrayOf(Types.INTEGER, VarArgsUtil.asRequiredObjectArray(elements));
} | [
"public",
"static",
"<",
"T",
">",
"Level0ArrayOperator",
"<",
"Integer",
"[",
"]",
",",
"Integer",
">",
"onArrayFor",
"(",
"final",
"Integer",
"...",
"elements",
")",
"{",
"return",
"onArrayOf",
"(",
"Types",
".",
"INTEGER",
",",
"VarArgsUtil",
".",
"asRe... | <p>
Creates an array with the specified elements and an <i>operation expression</i> on it.
</p>
@param elements the elements of the array being created
@return an operator, ready for chaining | [
"<p",
">",
"Creates",
"an",
"array",
"with",
"the",
"specified",
"elements",
"and",
"an",
"<i",
">",
"operation",
"expression<",
"/",
"i",
">",
"on",
"it",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L906-L908 |
versionone/VersionOne.SDK.Java.ObjectModel | src/main/java/com/versionone/om/V1InstanceCreator.java | V1InstanceCreator.buildProject | public BuildProject buildProject(String name, String reference) {
return buildProject(name, reference, null);
} | java | public BuildProject buildProject(String name, String reference) {
return buildProject(name, reference, null);
} | [
"public",
"BuildProject",
"buildProject",
"(",
"String",
"name",
",",
"String",
"reference",
")",
"{",
"return",
"buildProject",
"(",
"name",
",",
"reference",
",",
"null",
")",
";",
"}"
] | Create a new Build Project with a name and reference.
@param name Initial name.
@param reference Reference value.
@return A newly minted Build Project that exists in the VersionOne
system. | [
"Create",
"a",
"new",
"Build",
"Project",
"with",
"a",
"name",
"and",
"reference",
"."
] | train | https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceCreator.java#L865-L867 |
avianey/facebook-api-android-maven | facebook/src/main/java/com/facebook/TokenCachingStrategy.java | TokenCachingStrategy.putToken | public static void putToken(Bundle bundle, String value) {
Validate.notNull(bundle, "bundle");
Validate.notNull(value, "value");
bundle.putString(TOKEN_KEY, value);
} | java | public static void putToken(Bundle bundle, String value) {
Validate.notNull(bundle, "bundle");
Validate.notNull(value, "value");
bundle.putString(TOKEN_KEY, value);
} | [
"public",
"static",
"void",
"putToken",
"(",
"Bundle",
"bundle",
",",
"String",
"value",
")",
"{",
"Validate",
".",
"notNull",
"(",
"bundle",
",",
"\"bundle\"",
")",
";",
"Validate",
".",
"notNull",
"(",
"value",
",",
"\"value\"",
")",
";",
"bundle",
"."... | Puts the token value into a Bundle.
@param bundle
A Bundle in which the token value should be stored.
@param value
The String representing the token value, or null.
@throws NullPointerException if the passed in Bundle or token value are null | [
"Puts",
"the",
"token",
"value",
"into",
"a",
"Bundle",
"."
] | train | https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/TokenCachingStrategy.java#L170-L174 |
apache/groovy | src/main/groovy/groovy/lang/MetaClassImpl.java | MetaClassImpl.getStaticMethods | private Object getStaticMethods(Class sender, String name) {
final MetaMethodIndex.Entry entry = metaMethodIndex.getMethods(sender, name);
if (entry == null)
return FastArray.EMPTY_LIST;
Object answer = entry.staticMethods;
if (answer == null)
return FastArray.EMPTY_LIST;
return answer;
} | java | private Object getStaticMethods(Class sender, String name) {
final MetaMethodIndex.Entry entry = metaMethodIndex.getMethods(sender, name);
if (entry == null)
return FastArray.EMPTY_LIST;
Object answer = entry.staticMethods;
if (answer == null)
return FastArray.EMPTY_LIST;
return answer;
} | [
"private",
"Object",
"getStaticMethods",
"(",
"Class",
"sender",
",",
"String",
"name",
")",
"{",
"final",
"MetaMethodIndex",
".",
"Entry",
"entry",
"=",
"metaMethodIndex",
".",
"getMethods",
"(",
"sender",
",",
"name",
")",
";",
"if",
"(",
"entry",
"==",
... | Returns all the normal static methods on this class for the given name
@return all the normal static methods available on this class for the
given name | [
"Returns",
"all",
"the",
"normal",
"static",
"methods",
"on",
"this",
"class",
"for",
"the",
"given",
"name"
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/MetaClassImpl.java#L748-L756 |
JOML-CI/JOML | src/org/joml/Vector3f.java | Vector3f.setComponent | public Vector3f setComponent(int component, float value) throws IllegalArgumentException {
switch (component) {
case 0:
x = value;
break;
case 1:
y = value;
break;
case 2:
z = value;
break;
default:
throw new IllegalArgumentException();
}
return this;
} | java | public Vector3f setComponent(int component, float value) throws IllegalArgumentException {
switch (component) {
case 0:
x = value;
break;
case 1:
y = value;
break;
case 2:
z = value;
break;
default:
throw new IllegalArgumentException();
}
return this;
} | [
"public",
"Vector3f",
"setComponent",
"(",
"int",
"component",
",",
"float",
"value",
")",
"throws",
"IllegalArgumentException",
"{",
"switch",
"(",
"component",
")",
"{",
"case",
"0",
":",
"x",
"=",
"value",
";",
"break",
";",
"case",
"1",
":",
"y",
"="... | Set the value of the specified component of this vector.
@param component
the component whose value to set, within <code>[0..2]</code>
@param value
the value to set
@return this
@throws IllegalArgumentException if <code>component</code> is not within <code>[0..2]</code> | [
"Set",
"the",
"value",
"of",
"the",
"specified",
"component",
"of",
"this",
"vector",
"."
] | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector3f.java#L430-L445 |
loldevs/riotapi | rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java | ThrottledApiHandler.getMasteryPagesMultipleUsers | public Future<Map<Integer, Set<MasteryPage>>> getMasteryPagesMultipleUsers(Integer... ids) {
return new ApiFuture<>(() -> handler.getMasteryPagesMultipleUsers(ids));
} | java | public Future<Map<Integer, Set<MasteryPage>>> getMasteryPagesMultipleUsers(Integer... ids) {
return new ApiFuture<>(() -> handler.getMasteryPagesMultipleUsers(ids));
} | [
"public",
"Future",
"<",
"Map",
"<",
"Integer",
",",
"Set",
"<",
"MasteryPage",
">",
">",
">",
"getMasteryPagesMultipleUsers",
"(",
"Integer",
"...",
"ids",
")",
"{",
"return",
"new",
"ApiFuture",
"<>",
"(",
"(",
")",
"->",
"handler",
".",
"getMasteryPages... | Retrieve mastery pages for multiple users
@param ids The ids of the users
@return A map, mapping player ids to their respective mastery pages
@see <a href=https://developer.riotgames.com/api/methods#!/620/1933>Official API documentation</a> | [
"Retrieve",
"mastery",
"pages",
"for",
"multiple",
"users"
] | train | https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/rest/src/main/java/net/boreeas/riotapi/rest/ThrottledApiHandler.java#L1131-L1133 |
gwtplus/google-gin | src/main/java/com/google/gwt/inject/rebind/util/MethodCallUtil.java | MethodCallUtil.createConstructorInjection | public SourceSnippet createConstructorInjection(
MethodLiteral<?, Constructor<?>> constructor, NameGenerator nameGenerator,
List<InjectorMethod> methodsOutput) throws NoSourceNameException {
return createMethodCallWithInjection(constructor, null, nameGenerator, methodsOutput);
} | java | public SourceSnippet createConstructorInjection(
MethodLiteral<?, Constructor<?>> constructor, NameGenerator nameGenerator,
List<InjectorMethod> methodsOutput) throws NoSourceNameException {
return createMethodCallWithInjection(constructor, null, nameGenerator, methodsOutput);
} | [
"public",
"SourceSnippet",
"createConstructorInjection",
"(",
"MethodLiteral",
"<",
"?",
",",
"Constructor",
"<",
"?",
">",
">",
"constructor",
",",
"NameGenerator",
"nameGenerator",
",",
"List",
"<",
"InjectorMethod",
">",
"methodsOutput",
")",
"throws",
"NoSourceN... | Creates a constructor injecting method and returns a string that invokes
the new method. The new method returns the constructed object.
@param constructor constructor to call
@param nameGenerator NameGenerator to be used for ensuring method name uniqueness
@param methodsOutput a list where all new methods created by this
call are added
@return source snippet calling the generated method | [
"Creates",
"a",
"constructor",
"injecting",
"method",
"and",
"returns",
"a",
"string",
"that",
"invokes",
"the",
"new",
"method",
".",
"The",
"new",
"method",
"returns",
"the",
"constructed",
"object",
"."
] | train | https://github.com/gwtplus/google-gin/blob/595e61ee0d2fa508815c016e924ec0e5cea2a2aa/src/main/java/com/google/gwt/inject/rebind/util/MethodCallUtil.java#L52-L56 |
jboss-integration/fuse-bxms-integ | switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/builder/patch/PatchedRuntimeEnvironmentBuilder.java | PatchedRuntimeEnvironmentBuilder.addConfiguration | public RuntimeEnvironmentBuilder addConfiguration(String name, String value) {
if (name == null || value == null) {
return this;
}
_runtimeEnvironment.addToConfiguration(name, value);
return this;
} | java | public RuntimeEnvironmentBuilder addConfiguration(String name, String value) {
if (name == null || value == null) {
return this;
}
_runtimeEnvironment.addToConfiguration(name, value);
return this;
} | [
"public",
"RuntimeEnvironmentBuilder",
"addConfiguration",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"if",
"(",
"name",
"==",
"null",
"||",
"value",
"==",
"null",
")",
"{",
"return",
"this",
";",
"}",
"_runtimeEnvironment",
".",
"addToConfigurat... | Adds a configuration name/value pair.
@param name name
@param value value
@return this RuntimeEnvironmentBuilder | [
"Adds",
"a",
"configuration",
"name",
"/",
"value",
"pair",
"."
] | train | https://github.com/jboss-integration/fuse-bxms-integ/blob/ca5c012bf867ea15d1250f0991af3cd7e708aaaf/switchyard/switchyard-component-common-knowledge/src/main/java/org/switchyard/component/common/knowledge/config/builder/patch/PatchedRuntimeEnvironmentBuilder.java#L387-L394 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java | KeyUtil.generatePBEKey | public static SecretKey generatePBEKey(String algorithm, char[] key) {
if (StrUtil.isBlank(algorithm) || false == algorithm.startsWith("PBE")) {
throw new CryptoException("Algorithm [{}] is not a PBE algorithm!");
}
if (null == key) {
key = RandomUtil.randomString(32).toCharArray();
}
PBEKeySpec keySpec = new PBEKeySpec(key);
return generateKey(algorithm, keySpec);
} | java | public static SecretKey generatePBEKey(String algorithm, char[] key) {
if (StrUtil.isBlank(algorithm) || false == algorithm.startsWith("PBE")) {
throw new CryptoException("Algorithm [{}] is not a PBE algorithm!");
}
if (null == key) {
key = RandomUtil.randomString(32).toCharArray();
}
PBEKeySpec keySpec = new PBEKeySpec(key);
return generateKey(algorithm, keySpec);
} | [
"public",
"static",
"SecretKey",
"generatePBEKey",
"(",
"String",
"algorithm",
",",
"char",
"[",
"]",
"key",
")",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"algorithm",
")",
"||",
"false",
"==",
"algorithm",
".",
"startsWith",
"(",
"\"PBE\"",
")",
... | 生成PBE {@link SecretKey}
@param algorithm PBE算法,包括:PBEWithMD5AndDES、PBEWithSHA1AndDESede、PBEWithSHA1AndRC2_40等
@param key 密钥
@return {@link SecretKey} | [
"生成PBE",
"{",
"@link",
"SecretKey",
"}"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L169-L179 |
cdk/cdk | base/core/src/main/java/org/openscience/cdk/graph/Cycles.java | Cycles._invoke | private static Cycles _invoke(CycleFinder finder, IAtomContainer container) {
return _invoke(finder, container, container.getAtomCount());
} | java | private static Cycles _invoke(CycleFinder finder, IAtomContainer container) {
return _invoke(finder, container, container.getAtomCount());
} | [
"private",
"static",
"Cycles",
"_invoke",
"(",
"CycleFinder",
"finder",
",",
"IAtomContainer",
"container",
")",
"{",
"return",
"_invoke",
"(",
"finder",
",",
"container",
",",
"container",
".",
"getAtomCount",
"(",
")",
")",
";",
"}"
] | Internal method to wrap cycle computations which <i>should</i> be
tractable. That is they currently won't throw the exception - if the
method does throw an exception an internal error is triggered as a sanity
check.
@param finder the cycle finding method
@param container the molecule to find the cycles of
@return the cycles of the molecule | [
"Internal",
"method",
"to",
"wrap",
"cycle",
"computations",
"which",
"<i",
">",
"should<",
"/",
"i",
">",
"be",
"tractable",
".",
"That",
"is",
"they",
"currently",
"won",
"t",
"throw",
"the",
"exception",
"-",
"if",
"the",
"method",
"does",
"throw",
"a... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/core/src/main/java/org/openscience/cdk/graph/Cycles.java#L691-L693 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java | BlocksMap.addNode | boolean addNode(Block b, DatanodeDescriptor node, int replication) {
// insert into the map if not there yet
BlockInfo info = checkBlockInfo(b, replication);
// add block to the data-node list and the node to the block info
return node.addBlock(info);
} | java | boolean addNode(Block b, DatanodeDescriptor node, int replication) {
// insert into the map if not there yet
BlockInfo info = checkBlockInfo(b, replication);
// add block to the data-node list and the node to the block info
return node.addBlock(info);
} | [
"boolean",
"addNode",
"(",
"Block",
"b",
",",
"DatanodeDescriptor",
"node",
",",
"int",
"replication",
")",
"{",
"// insert into the map if not there yet",
"BlockInfo",
"info",
"=",
"checkBlockInfo",
"(",
"b",
",",
"replication",
")",
";",
"// add block to the data-no... | returns true if the node does not already exists and is added.
false if the node already exists. | [
"returns",
"true",
"if",
"the",
"node",
"does",
"not",
"already",
"exists",
"and",
"is",
"added",
".",
"false",
"if",
"the",
"node",
"already",
"exists",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L543-L548 |
ttddyy/datasource-proxy | src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultJsonQueryLogEntryCreator.java | DefaultJsonQueryLogEntryCreator.writeQueriesEntry | protected void writeQueriesEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
sb.append("\"query\":[");
for (QueryInfo queryInfo : queryInfoList) {
sb.append("\"");
sb.append(escapeSpecialCharacter(queryInfo.getQuery()));
sb.append("\",");
}
chompIfEndWith(sb, ',');
sb.append("], ");
} | java | protected void writeQueriesEntry(StringBuilder sb, ExecutionInfo execInfo, List<QueryInfo> queryInfoList) {
sb.append("\"query\":[");
for (QueryInfo queryInfo : queryInfoList) {
sb.append("\"");
sb.append(escapeSpecialCharacter(queryInfo.getQuery()));
sb.append("\",");
}
chompIfEndWith(sb, ',');
sb.append("], ");
} | [
"protected",
"void",
"writeQueriesEntry",
"(",
"StringBuilder",
"sb",
",",
"ExecutionInfo",
"execInfo",
",",
"List",
"<",
"QueryInfo",
">",
"queryInfoList",
")",
"{",
"sb",
".",
"append",
"(",
"\"\\\"query\\\":[\"",
")",
";",
"for",
"(",
"QueryInfo",
"queryInfo"... | Write queries as json.
<p>default: "query":["select 1","select 2"],
@param sb StringBuilder to write
@param execInfo execution info
@param queryInfoList query info list | [
"Write",
"queries",
"as",
"json",
"."
] | train | https://github.com/ttddyy/datasource-proxy/blob/62163ccf9a569a99aa3ad9f9151a32567447a62e/src/main/java/net/ttddyy/dsproxy/listener/logging/DefaultJsonQueryLogEntryCreator.java#L197-L206 |
CenturyLinkCloud/mdw | mdw-services/src/com/centurylink/mdw/service/data/process/EngineDataAccessCache.java | EngineDataAccessCache.updateDocumentContent | public synchronized void updateDocumentContent(Long docid, String content) throws SQLException {
if (cache_document==CACHE_OFF) {
edadb.updateDocumentContent(docid, content);
} else if (cache_document==CACHE_ONLY) {
Document docvo = documentCache.get(docid);
if (docvo!=null) docvo.setContent(content);
} else {
edadb.updateDocumentContent(docid, content);
Document docvo = documentCache.get(docid);
if (docvo!=null) docvo.setContent(content);
}
} | java | public synchronized void updateDocumentContent(Long docid, String content) throws SQLException {
if (cache_document==CACHE_OFF) {
edadb.updateDocumentContent(docid, content);
} else if (cache_document==CACHE_ONLY) {
Document docvo = documentCache.get(docid);
if (docvo!=null) docvo.setContent(content);
} else {
edadb.updateDocumentContent(docid, content);
Document docvo = documentCache.get(docid);
if (docvo!=null) docvo.setContent(content);
}
} | [
"public",
"synchronized",
"void",
"updateDocumentContent",
"(",
"Long",
"docid",
",",
"String",
"content",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"cache_document",
"==",
"CACHE_OFF",
")",
"{",
"edadb",
".",
"updateDocumentContent",
"(",
"docid",
",",
"co... | Update the content (actual document object) bound to the given
document reference object.
@param docid
@param content
@throws DataAccessException | [
"Update",
"the",
"content",
"(",
"actual",
"document",
"object",
")",
"bound",
"to",
"the",
"given",
"document",
"reference",
"object",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/service/data/process/EngineDataAccessCache.java#L152-L163 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/detector/AbstractServerDetector.java | AbstractServerDetector.isClassLoaded | protected boolean isClassLoaded(String className, Instrumentation instrumentation) {
if (instrumentation == null || className == null) {
throw new IllegalArgumentException("instrumentation and className must not be null");
}
Class<?>[] classes = instrumentation.getAllLoadedClasses();
for (Class<?> c : classes) {
if (className.equals(c.getName())) {
return true;
}
}
return false;
} | java | protected boolean isClassLoaded(String className, Instrumentation instrumentation) {
if (instrumentation == null || className == null) {
throw new IllegalArgumentException("instrumentation and className must not be null");
}
Class<?>[] classes = instrumentation.getAllLoadedClasses();
for (Class<?> c : classes) {
if (className.equals(c.getName())) {
return true;
}
}
return false;
} | [
"protected",
"boolean",
"isClassLoaded",
"(",
"String",
"className",
",",
"Instrumentation",
"instrumentation",
")",
"{",
"if",
"(",
"instrumentation",
"==",
"null",
"||",
"className",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"ins... | Tests if the given class name has been loaded by the JVM. Don't use this method
in case you have access to the class loader which will be loading the class
because the used approach is not very efficient.
@param className the name of the class to check
@param instrumentation
@return true if the class has been loaded by the JVM
@throws IllegalArgumentException in case instrumentation or the provided class is null | [
"Tests",
"if",
"the",
"given",
"class",
"name",
"has",
"been",
"loaded",
"by",
"the",
"JVM",
".",
"Don",
"t",
"use",
"this",
"method",
"in",
"case",
"you",
"have",
"access",
"to",
"the",
"class",
"loader",
"which",
"will",
"be",
"loading",
"the",
"clas... | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/detector/AbstractServerDetector.java#L183-L194 |
dlemmermann/CalendarFX | CalendarFXRecurrence/src/main/java/com/google/ical/iter/Util.java | Util.rollToNextWeekStart | static void rollToNextWeekStart(DTBuilder builder, Weekday wkst) {
DateValue bd = builder.toDate();
builder.day += (7 - ((7 + (Weekday.valueOf(bd).javaDayNum
- wkst.javaDayNum))
% 7)) % 7;
builder.normalize();
} | java | static void rollToNextWeekStart(DTBuilder builder, Weekday wkst) {
DateValue bd = builder.toDate();
builder.day += (7 - ((7 + (Weekday.valueOf(bd).javaDayNum
- wkst.javaDayNum))
% 7)) % 7;
builder.normalize();
} | [
"static",
"void",
"rollToNextWeekStart",
"(",
"DTBuilder",
"builder",
",",
"Weekday",
"wkst",
")",
"{",
"DateValue",
"bd",
"=",
"builder",
".",
"toDate",
"(",
")",
";",
"builder",
".",
"day",
"+=",
"(",
"7",
"-",
"(",
"(",
"7",
"+",
"(",
"Weekday",
"... | advances builder to the earliest day on or after builder that falls on
wkst.
@param builder non null.
@param wkst the day of the week that the week starts on | [
"advances",
"builder",
"to",
"the",
"earliest",
"day",
"on",
"or",
"after",
"builder",
"that",
"falls",
"on",
"wkst",
"."
] | train | https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXRecurrence/src/main/java/com/google/ical/iter/Util.java#L41-L47 |
youngmonkeys/ezyfox-sfs2x | src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/RoomExtensionDestroyEventHandler.java | RoomExtensionDestroyEventHandler.notifyHandler | protected void notifyHandler(ServerHandlerClass handler, Object zoneAgent) {
ReflectMethodUtil.invokeHandleMethod(handler.getHandleMethod(),
handler.newInstance(), context, zoneAgent);
} | java | protected void notifyHandler(ServerHandlerClass handler, Object zoneAgent) {
ReflectMethodUtil.invokeHandleMethod(handler.getHandleMethod(),
handler.newInstance(), context, zoneAgent);
} | [
"protected",
"void",
"notifyHandler",
"(",
"ServerHandlerClass",
"handler",
",",
"Object",
"zoneAgent",
")",
"{",
"ReflectMethodUtil",
".",
"invokeHandleMethod",
"(",
"handler",
".",
"getHandleMethod",
"(",
")",
",",
"handler",
".",
"newInstance",
"(",
")",
",",
... | Propagate event to handler
@param handler structure of handler class
@param zoneAgent the zone agent | [
"Propagate",
"event",
"to",
"handler"
] | train | https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/RoomExtensionDestroyEventHandler.java#L85-L88 |
glyptodon/guacamole-client | extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/ticket/TicketValidationService.java | TicketValidationService.validateTicket | public String validateTicket(String ticket, Credentials credentials) throws GuacamoleException {
// Retrieve the configured CAS URL, establish a ticket validator,
// and then attempt to validate the supplied ticket. If that succeeds,
// grab the principal returned by the validator.
URI casServerUrl = confService.getAuthorizationEndpoint();
Cas20ProxyTicketValidator validator = new Cas20ProxyTicketValidator(casServerUrl.toString());
validator.setAcceptAnyProxy(true);
validator.setEncoding("UTF-8");
try {
URI confRedirectURI = confService.getRedirectURI();
Assertion a = validator.validate(ticket, confRedirectURI.toString());
AttributePrincipal principal = a.getPrincipal();
// Retrieve username and set the credentials.
String username = principal.getName();
if (username != null)
credentials.setUsername(username);
// Retrieve password, attempt decryption, and set credentials.
Object credObj = principal.getAttributes().get("credential");
if (credObj != null) {
String clearPass = decryptPassword(credObj.toString());
if (clearPass != null && !clearPass.isEmpty())
credentials.setPassword(clearPass);
}
return username;
}
catch (TicketValidationException e) {
throw new GuacamoleException("Ticket validation failed.", e);
}
catch (Throwable t) {
logger.error("Error validating ticket with CAS server: {}", t.getMessage());
throw new GuacamoleInvalidCredentialsException("CAS login failed.", CredentialsInfo.USERNAME_PASSWORD);
}
} | java | public String validateTicket(String ticket, Credentials credentials) throws GuacamoleException {
// Retrieve the configured CAS URL, establish a ticket validator,
// and then attempt to validate the supplied ticket. If that succeeds,
// grab the principal returned by the validator.
URI casServerUrl = confService.getAuthorizationEndpoint();
Cas20ProxyTicketValidator validator = new Cas20ProxyTicketValidator(casServerUrl.toString());
validator.setAcceptAnyProxy(true);
validator.setEncoding("UTF-8");
try {
URI confRedirectURI = confService.getRedirectURI();
Assertion a = validator.validate(ticket, confRedirectURI.toString());
AttributePrincipal principal = a.getPrincipal();
// Retrieve username and set the credentials.
String username = principal.getName();
if (username != null)
credentials.setUsername(username);
// Retrieve password, attempt decryption, and set credentials.
Object credObj = principal.getAttributes().get("credential");
if (credObj != null) {
String clearPass = decryptPassword(credObj.toString());
if (clearPass != null && !clearPass.isEmpty())
credentials.setPassword(clearPass);
}
return username;
}
catch (TicketValidationException e) {
throw new GuacamoleException("Ticket validation failed.", e);
}
catch (Throwable t) {
logger.error("Error validating ticket with CAS server: {}", t.getMessage());
throw new GuacamoleInvalidCredentialsException("CAS login failed.", CredentialsInfo.USERNAME_PASSWORD);
}
} | [
"public",
"String",
"validateTicket",
"(",
"String",
"ticket",
",",
"Credentials",
"credentials",
")",
"throws",
"GuacamoleException",
"{",
"// Retrieve the configured CAS URL, establish a ticket validator,",
"// and then attempt to validate the supplied ticket. If that succeeds,",
"/... | Validates and parses the given ID ticket, returning the username
provided by the CAS server in the ticket. If the
ticket is invalid an exception is thrown.
@param ticket
The ID ticket to validate and parse.
@param credentials
The Credentials object to store retrieved username and
password values in.
@return
The username derived from the ticket.
@throws GuacamoleException
If the ID ticket is not valid or guacamole.properties could
not be parsed. | [
"Validates",
"and",
"parses",
"the",
"given",
"ID",
"ticket",
"returning",
"the",
"username",
"provided",
"by",
"the",
"CAS",
"server",
"in",
"the",
"ticket",
".",
"If",
"the",
"ticket",
"is",
"invalid",
"an",
"exception",
"is",
"thrown",
"."
] | train | https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-cas/src/main/java/org/apache/guacamole/auth/cas/ticket/TicketValidationService.java#L82-L120 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/geometry/BondTools.java | BondTools.stereosAreOpposite | public static boolean stereosAreOpposite(IAtomContainer container, IAtom atom) {
List<IAtom> atoms = container.getConnectedAtomsList(atom);
TreeMap<Double, Integer> hm = new TreeMap<Double, Integer>();
for (int i = 1; i < atoms.size(); i++) {
hm.put(giveAngle(atom, atoms.get(0), atoms.get(i)), i);
}
Object[] ohere = hm.values().toArray();
IBond.Stereo stereoOne = container.getBond(atom, atoms.get(0)).getStereo();
IBond.Stereo stereoOpposite = container.getBond(atom, atoms.get((Integer) ohere[1])).getStereo();
return stereoOpposite == stereoOne;
} | java | public static boolean stereosAreOpposite(IAtomContainer container, IAtom atom) {
List<IAtom> atoms = container.getConnectedAtomsList(atom);
TreeMap<Double, Integer> hm = new TreeMap<Double, Integer>();
for (int i = 1; i < atoms.size(); i++) {
hm.put(giveAngle(atom, atoms.get(0), atoms.get(i)), i);
}
Object[] ohere = hm.values().toArray();
IBond.Stereo stereoOne = container.getBond(atom, atoms.get(0)).getStereo();
IBond.Stereo stereoOpposite = container.getBond(atom, atoms.get((Integer) ohere[1])).getStereo();
return stereoOpposite == stereoOne;
} | [
"public",
"static",
"boolean",
"stereosAreOpposite",
"(",
"IAtomContainer",
"container",
",",
"IAtom",
"atom",
")",
"{",
"List",
"<",
"IAtom",
">",
"atoms",
"=",
"container",
".",
"getConnectedAtomsList",
"(",
"atom",
")",
";",
"TreeMap",
"<",
"Double",
",",
... | Says if of four atoms connected two one atom the up and down bonds are
opposite or not, i. e.if it's tetrehedral or square planar. The method
does not check if there are four atoms and if two or up and two are down
@param atom The atom which is the center
@param container The atomContainer the atom is in
@return true=are opposite, false=are not | [
"Says",
"if",
"of",
"four",
"atoms",
"connected",
"two",
"one",
"atom",
"the",
"up",
"and",
"down",
"bonds",
"are",
"opposite",
"or",
"not",
"i",
".",
"e",
".",
"if",
"it",
"s",
"tetrehedral",
"or",
"square",
"planar",
".",
"The",
"method",
"does",
"... | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/geometry/BondTools.java#L511-L521 |
calimero-project/calimero-core | src/tuwien/auto/calimero/dptxlator/TranslatorTypes.java | TranslatorTypes.hasTranslator | public static boolean hasTranslator(final int mainNumber, final String dptId)
{
try {
final MainType t = getMainType(getMainNumber(mainNumber, dptId));
if (t != null)
return t.getSubTypes().get(dptId) != null;
}
catch (final NumberFormatException e) {}
catch (final KNXException e) {}
return false;
} | java | public static boolean hasTranslator(final int mainNumber, final String dptId)
{
try {
final MainType t = getMainType(getMainNumber(mainNumber, dptId));
if (t != null)
return t.getSubTypes().get(dptId) != null;
}
catch (final NumberFormatException e) {}
catch (final KNXException e) {}
return false;
} | [
"public",
"static",
"boolean",
"hasTranslator",
"(",
"final",
"int",
"mainNumber",
",",
"final",
"String",
"dptId",
")",
"{",
"try",
"{",
"final",
"MainType",
"t",
"=",
"getMainType",
"(",
"getMainNumber",
"(",
"mainNumber",
",",
"dptId",
")",
")",
";",
"i... | Does a lookup if the specified DPT is supported by a DPT translator.
@param mainNumber data type main number, number ≥ 0; use 0 to infer translator type from <code>dptId</code>
argument only
@param dptId datapoint type ID to lookup this particular kind of value translation
@return <code>true</code> iff translator was found, <code>false</code> otherwise | [
"Does",
"a",
"lookup",
"if",
"the",
"specified",
"DPT",
"is",
"supported",
"by",
"a",
"DPT",
"translator",
"."
] | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/dptxlator/TranslatorTypes.java#L533-L543 |
westnordost/osmapi | src/main/java/de/westnordost/osmapi/changesets/ChangesetsDao.java | ChangesetsDao.getData | public void getData(long id, MapDataChangesHandler handler, MapDataFactory factory)
{
osm.makeAuthenticatedRequest(CHANGESET + "/" + id + "/download", null,
new MapDataChangesParser(handler, factory));
} | java | public void getData(long id, MapDataChangesHandler handler, MapDataFactory factory)
{
osm.makeAuthenticatedRequest(CHANGESET + "/" + id + "/download", null,
new MapDataChangesParser(handler, factory));
} | [
"public",
"void",
"getData",
"(",
"long",
"id",
",",
"MapDataChangesHandler",
"handler",
",",
"MapDataFactory",
"factory",
")",
"{",
"osm",
".",
"makeAuthenticatedRequest",
"(",
"CHANGESET",
"+",
"\"/\"",
"+",
"id",
"+",
"\"/download\"",
",",
"null",
",",
"new... | Get map data changes associated with the given changeset.
@throws OsmAuthorizationException if not logged in
@throws OsmNotFoundException if changeset with the given id does not exist | [
"Get",
"map",
"data",
"changes",
"associated",
"with",
"the",
"given",
"changeset",
"."
] | train | https://github.com/westnordost/osmapi/blob/dda6978fd12e117d0cf17812bc22037f61e22c4b/src/main/java/de/westnordost/osmapi/changesets/ChangesetsDao.java#L193-L197 |
OpenLiberty/open-liberty | dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java | MongoService.assertLibrary | private void assertLibrary(ClassLoader loader, boolean sslEnabled) {
Class<?> MongoClient = loadClass(loader, com_mongodb_MongoClient);
int minor = -1, major = -1;
if (MongoClient == null) {
// Version 1.0 of the mongo driver used these static variables, but were deprecated in a subsequent release.
// If getMajor/MinorVersion doesn't exist, will check for these fields.
Class<?> Mongo = loadClass(loader, "com.mongodb.Mongo");
// If we can't find either class, die
if (Mongo == null) {
// CWKKD0014.missing.driver=CWKKD0014E: The {0} service was unable to locate the required MongoDB driver classes at shared library {1}.
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0014.missing.driver", MONGO, libraryRef.getService().id()));
}
major = getVersionFromMongo(Mongo, "MAJOR_VERSION");
minor = getVersionFromMongo(Mongo, "MINOR_VERSION");
} else {
major = getVersionFromMongoClient(MongoClient, "getMajorVersion");
minor = getVersionFromMongoClient(MongoClient, "getMinorVersion");
}
final int MIN_MAJOR = 2;
final int MIN_MINOR = 10;
final int SSL_MIN_MINOR = 11;
final int CERT_AUTH_MIN_MINOR = 12;
if (useCertAuth && ((major < MIN_MAJOR) || (major == MIN_MAJOR && minor < CERT_AUTH_MIN_MINOR))) {
Tr.error(tc, "CWKKD0023.ssl.certauth.incompatible.driver", MONGO, id, libraryRef.getService().id(),
MIN_MAJOR + "." + CERT_AUTH_MIN_MINOR, major + "." + minor);
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0023.ssl.certauth.incompatible.driver", MONGO, id, libraryRef.getService().id(),
MIN_MAJOR + "." + CERT_AUTH_MIN_MINOR, major + "." + minor));
}
if (sslEnabled && ((major < MIN_MAJOR) || (major == MIN_MAJOR && minor < SSL_MIN_MINOR))) {
Tr.error(tc, "CWKKD0017.ssl.incompatible.driver", MONGO, id, libraryRef.getService().id(),
MIN_MAJOR + "." + SSL_MIN_MINOR, major + "." + minor);
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0017.ssl.incompatible.driver", MONGO, id, libraryRef.getService().id(),
MIN_MAJOR + "." + SSL_MIN_MINOR, major + "." + minor));
}
if (major > MIN_MAJOR || (major == MIN_MAJOR && minor >= MIN_MINOR)) {
return;
}
// CWKKD0013.unsupported.driver=CWKKD0013E: The {0} service encountered down level version of the MongoDB
// driver at shared library {1}. Expected a minimum level of {2}, but found {3}.
Tr.error(tc, "CWKKD0013.unsupported.driver", MONGO, libraryRef.getService().id(),
MIN_MAJOR + "." + MIN_MINOR, major + "." + minor);
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0013.unsupported.driver", MONGO, libraryRef.getService().id(),
MIN_MAJOR + "." + MIN_MINOR, major + "." + minor));
} | java | private void assertLibrary(ClassLoader loader, boolean sslEnabled) {
Class<?> MongoClient = loadClass(loader, com_mongodb_MongoClient);
int minor = -1, major = -1;
if (MongoClient == null) {
// Version 1.0 of the mongo driver used these static variables, but were deprecated in a subsequent release.
// If getMajor/MinorVersion doesn't exist, will check for these fields.
Class<?> Mongo = loadClass(loader, "com.mongodb.Mongo");
// If we can't find either class, die
if (Mongo == null) {
// CWKKD0014.missing.driver=CWKKD0014E: The {0} service was unable to locate the required MongoDB driver classes at shared library {1}.
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0014.missing.driver", MONGO, libraryRef.getService().id()));
}
major = getVersionFromMongo(Mongo, "MAJOR_VERSION");
minor = getVersionFromMongo(Mongo, "MINOR_VERSION");
} else {
major = getVersionFromMongoClient(MongoClient, "getMajorVersion");
minor = getVersionFromMongoClient(MongoClient, "getMinorVersion");
}
final int MIN_MAJOR = 2;
final int MIN_MINOR = 10;
final int SSL_MIN_MINOR = 11;
final int CERT_AUTH_MIN_MINOR = 12;
if (useCertAuth && ((major < MIN_MAJOR) || (major == MIN_MAJOR && minor < CERT_AUTH_MIN_MINOR))) {
Tr.error(tc, "CWKKD0023.ssl.certauth.incompatible.driver", MONGO, id, libraryRef.getService().id(),
MIN_MAJOR + "." + CERT_AUTH_MIN_MINOR, major + "." + minor);
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0023.ssl.certauth.incompatible.driver", MONGO, id, libraryRef.getService().id(),
MIN_MAJOR + "." + CERT_AUTH_MIN_MINOR, major + "." + minor));
}
if (sslEnabled && ((major < MIN_MAJOR) || (major == MIN_MAJOR && minor < SSL_MIN_MINOR))) {
Tr.error(tc, "CWKKD0017.ssl.incompatible.driver", MONGO, id, libraryRef.getService().id(),
MIN_MAJOR + "." + SSL_MIN_MINOR, major + "." + minor);
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0017.ssl.incompatible.driver", MONGO, id, libraryRef.getService().id(),
MIN_MAJOR + "." + SSL_MIN_MINOR, major + "." + minor));
}
if (major > MIN_MAJOR || (major == MIN_MAJOR && minor >= MIN_MINOR)) {
return;
}
// CWKKD0013.unsupported.driver=CWKKD0013E: The {0} service encountered down level version of the MongoDB
// driver at shared library {1}. Expected a minimum level of {2}, but found {3}.
Tr.error(tc, "CWKKD0013.unsupported.driver", MONGO, libraryRef.getService().id(),
MIN_MAJOR + "." + MIN_MINOR, major + "." + minor);
throw new RuntimeException(Tr.formatMessage(tc, "CWKKD0013.unsupported.driver", MONGO, libraryRef.getService().id(),
MIN_MAJOR + "." + MIN_MINOR, major + "." + minor));
} | [
"private",
"void",
"assertLibrary",
"(",
"ClassLoader",
"loader",
",",
"boolean",
"sslEnabled",
")",
"{",
"Class",
"<",
"?",
">",
"MongoClient",
"=",
"loadClass",
"(",
"loader",
",",
"com_mongodb_MongoClient",
")",
";",
"int",
"minor",
"=",
"-",
"1",
",",
... | This private worker method will assert that the configured shared library has the correct level
of the mongoDB java driver. It will throw a RuntimeException if it is :
<li> unable to locate com.mongodb.Mongo.class or com.mongodb.MongoDB.class
<li> if the configured library is less than the min supported level | [
"This",
"private",
"worker",
"method",
"will",
"assert",
"that",
"the",
"configured",
"shared",
"library",
"has",
"the",
"correct",
"level",
"of",
"the",
"mongoDB",
"java",
"driver",
".",
"It",
"will",
"throw",
"a",
"RuntimeException",
"if",
"it",
"is",
":",... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.mongo/src/com/ibm/ws/mongo/internal/MongoService.java#L823-L871 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java | FastDateFormat.getTimeInstance | public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone, final Locale locale) {
return cache.getTimeInstance(style, timeZone, locale);
} | java | public static FastDateFormat getTimeInstance(final int style, final TimeZone timeZone, final Locale locale) {
return cache.getTimeInstance(style, timeZone, locale);
} | [
"public",
"static",
"FastDateFormat",
"getTimeInstance",
"(",
"final",
"int",
"style",
",",
"final",
"TimeZone",
"timeZone",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"cache",
".",
"getTimeInstance",
"(",
"style",
",",
"timeZone",
",",
"locale",
")... | 获得 {@link FastDateFormat} 实例<br>
支持缓存
@param style time style: FULL, LONG, MEDIUM, or SHORT
@param timeZone optional time zone, overrides time zone of formatted time
@param locale {@link Locale} 日期地理位置
@return 本地化 {@link FastDateFormat} | [
"获得",
"{",
"@link",
"FastDateFormat",
"}",
"实例<br",
">",
"支持缓存"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L207-L209 |
rey5137/material | app/src/main/java/com/rey/material/app/Recurring.java | Recurring.getDay | private static int getDay(Calendar cal, int dayOfWeek, int orderNum){
int day = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
cal.set(Calendar.DAY_OF_MONTH, day);
int lastWeekday = cal.get(Calendar.DAY_OF_WEEK);
int shift = lastWeekday >= dayOfWeek ? (lastWeekday - dayOfWeek) : (lastWeekday + 7 - dayOfWeek);
//find last dayOfWeek of this month
day -= shift;
if(orderNum < 0)
return day;
cal.set(Calendar.DAY_OF_MONTH, day);
int lastOrderNum = (cal.get(Calendar.DAY_OF_MONTH) - 1) / 7;
if(orderNum >= lastOrderNum)
return day;
return day - (lastOrderNum - orderNum) * 7;
} | java | private static int getDay(Calendar cal, int dayOfWeek, int orderNum){
int day = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
cal.set(Calendar.DAY_OF_MONTH, day);
int lastWeekday = cal.get(Calendar.DAY_OF_WEEK);
int shift = lastWeekday >= dayOfWeek ? (lastWeekday - dayOfWeek) : (lastWeekday + 7 - dayOfWeek);
//find last dayOfWeek of this month
day -= shift;
if(orderNum < 0)
return day;
cal.set(Calendar.DAY_OF_MONTH, day);
int lastOrderNum = (cal.get(Calendar.DAY_OF_MONTH) - 1) / 7;
if(orderNum >= lastOrderNum)
return day;
return day - (lastOrderNum - orderNum) * 7;
} | [
"private",
"static",
"int",
"getDay",
"(",
"Calendar",
"cal",
",",
"int",
"dayOfWeek",
",",
"int",
"orderNum",
")",
"{",
"int",
"day",
"=",
"cal",
".",
"getActualMaximum",
"(",
"Calendar",
".",
"DAY_OF_MONTH",
")",
";",
"cal",
".",
"set",
"(",
"Calendar"... | Get the day in month of the current month of Calendar.
@param cal
@param dayOfWeek The day of week.
@param orderNum The order number, 0 mean the first, -1 mean the last.
@return The day int month | [
"Get",
"the",
"day",
"in",
"month",
"of",
"the",
"current",
"month",
"of",
"Calendar",
"."
] | train | https://github.com/rey5137/material/blob/1bbcac2686a0023ef7720d3fe455bb116d115af8/app/src/main/java/com/rey/material/app/Recurring.java#L331-L351 |
alkacon/opencms-core | src/org/opencms/module/CmsModuleXmlHandler.java | CmsModuleXmlHandler.addParameter | public void addParameter(String key, String value) {
if (CmsStringUtil.isNotEmpty(key)) {
key = key.trim();
}
if (CmsStringUtil.isNotEmpty(value)) {
value = value.trim();
}
m_parameters.put(key, value);
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_ADD_MOD_PARAM_KEY_2, key, value));
}
} | java | public void addParameter(String key, String value) {
if (CmsStringUtil.isNotEmpty(key)) {
key = key.trim();
}
if (CmsStringUtil.isNotEmpty(value)) {
value = value.trim();
}
m_parameters.put(key, value);
if (LOG.isDebugEnabled()) {
LOG.debug(Messages.get().getBundle().key(Messages.LOG_ADD_MOD_PARAM_KEY_2, key, value));
}
} | [
"public",
"void",
"addParameter",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"CmsStringUtil",
".",
"isNotEmpty",
"(",
"key",
")",
")",
"{",
"key",
"=",
"key",
".",
"trim",
"(",
")",
";",
"}",
"if",
"(",
"CmsStringUtil",
".",
... | Adds a module parameter to the module configuration.<p>
@param key the parameter key
@param value the parameter value | [
"Adds",
"a",
"module",
"parameter",
"to",
"the",
"module",
"configuration",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/module/CmsModuleXmlHandler.java#L611-L623 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java | WSConnectionRequestInfoImpl.matchSchema | private final boolean matchSchema(WSConnectionRequestInfoImpl cri){
// At least one of the CRIs should know the default value.
String defaultValue = defaultSchema == null ? cri.defaultSchema : defaultSchema;
return match(ivSchema, cri.ivSchema)
|| ivSchema == null && match(defaultValue, cri.ivSchema)
|| cri.ivSchema == null && match(ivSchema, defaultValue);
} | java | private final boolean matchSchema(WSConnectionRequestInfoImpl cri){
// At least one of the CRIs should know the default value.
String defaultValue = defaultSchema == null ? cri.defaultSchema : defaultSchema;
return match(ivSchema, cri.ivSchema)
|| ivSchema == null && match(defaultValue, cri.ivSchema)
|| cri.ivSchema == null && match(ivSchema, defaultValue);
} | [
"private",
"final",
"boolean",
"matchSchema",
"(",
"WSConnectionRequestInfoImpl",
"cri",
")",
"{",
"// At least one of the CRIs should know the default value.",
"String",
"defaultValue",
"=",
"defaultSchema",
"==",
"null",
"?",
"cri",
".",
"defaultSchema",
":",
"defaultSche... | Determine if the schema property matches. It is considered to match if
- Both schema values are unspecified.
- Both schema values are the same value.
- One of the schema values is unspecified and the other CRI requested the default value.
@return true if the schema match, otherwise false. | [
"Determine",
"if",
"the",
"schema",
"property",
"matches",
".",
"It",
"is",
"considered",
"to",
"match",
"if",
"-",
"Both",
"schema",
"values",
"are",
"unspecified",
".",
"-",
"Both",
"schema",
"values",
"are",
"the",
"same",
"value",
".",
"-",
"One",
"o... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSConnectionRequestInfoImpl.java#L591-L598 |
couchbase/java-dcp-client | src/main/java/com/couchbase/client/dcp/config/DcpControl.java | DcpControl.put | public DcpControl put(final Names name, final String value) {
// Provide a default NOOP interval because the client needs
// to know the interval in order to detect dead connections.
if (name == Names.ENABLE_NOOP && get(Names.SET_NOOP_INTERVAL) == null) {
put(Names.SET_NOOP_INTERVAL, Integer.toString(DEFAULT_NOOP_INTERVAL_SECONDS));
}
values.put(name.value(), value);
return this;
} | java | public DcpControl put(final Names name, final String value) {
// Provide a default NOOP interval because the client needs
// to know the interval in order to detect dead connections.
if (name == Names.ENABLE_NOOP && get(Names.SET_NOOP_INTERVAL) == null) {
put(Names.SET_NOOP_INTERVAL, Integer.toString(DEFAULT_NOOP_INTERVAL_SECONDS));
}
values.put(name.value(), value);
return this;
} | [
"public",
"DcpControl",
"put",
"(",
"final",
"Names",
"name",
",",
"final",
"String",
"value",
")",
"{",
"// Provide a default NOOP interval because the client needs",
"// to know the interval in order to detect dead connections.",
"if",
"(",
"name",
"==",
"Names",
".",
"EN... | Store/Override a control parameter.
@param name the name of the control parameter.
@param value the stringified version what it should be set to.
@return the {@link DcpControl} instance for chainability. | [
"Store",
"/",
"Override",
"a",
"control",
"parameter",
"."
] | train | https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/config/DcpControl.java#L81-L90 |
OpenTSDB/opentsdb | src/tsd/HttpSerializer.java | HttpSerializer.formatThreadStatsV1 | public ChannelBuffer formatThreadStatsV1(final List<Map<String, Object>> stats) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatThreadStatsV1");
} | java | public ChannelBuffer formatThreadStatsV1(final List<Map<String, Object>> stats) {
throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED,
"The requested API endpoint has not been implemented",
this.getClass().getCanonicalName() +
" has not implemented formatThreadStatsV1");
} | [
"public",
"ChannelBuffer",
"formatThreadStatsV1",
"(",
"final",
"List",
"<",
"Map",
"<",
"String",
",",
"Object",
">",
">",
"stats",
")",
"{",
"throw",
"new",
"BadRequestException",
"(",
"HttpResponseStatus",
".",
"NOT_IMPLEMENTED",
",",
"\"The requested API endpoin... | Format a list of thread statistics
@param stats The thread statistics list to format
@return A ChannelBuffer object to pass on to the caller
@throws BadRequestException if the plugin has not implemented this method
@since 2.2 | [
"Format",
"a",
"list",
"of",
"thread",
"statistics"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L726-L731 |
maxirosson/jdroid-android | jdroid-android-core/src/main/java/com/jdroid/android/utils/SharedPreferencesHelper.java | SharedPreferencesHelper.loadPreferenceAsFloat | public Float loadPreferenceAsFloat(String key, Float defaultValue) {
Float value = defaultValue;
if (hasPreference(key)) {
value = getSharedPreferences().getFloat(key, 0);
}
logLoad(key, value);
return value;
} | java | public Float loadPreferenceAsFloat(String key, Float defaultValue) {
Float value = defaultValue;
if (hasPreference(key)) {
value = getSharedPreferences().getFloat(key, 0);
}
logLoad(key, value);
return value;
} | [
"public",
"Float",
"loadPreferenceAsFloat",
"(",
"String",
"key",
",",
"Float",
"defaultValue",
")",
"{",
"Float",
"value",
"=",
"defaultValue",
";",
"if",
"(",
"hasPreference",
"(",
"key",
")",
")",
"{",
"value",
"=",
"getSharedPreferences",
"(",
")",
".",
... | Retrieve a Float value from the preferences.
@param key The name of the preference to retrieve
@param defaultValue Value to return if this preference does not exist
@return the preference value if it exists, or defaultValue. | [
"Retrieve",
"a",
"Float",
"value",
"from",
"the",
"preferences",
"."
] | train | https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/utils/SharedPreferencesHelper.java#L281-L288 |
jboss/jboss-servlet-api_spec | src/main/java/javax/servlet/http/HttpUtils.java | HttpUtils.parseQueryString | public static Hashtable<String, String[]> parseQueryString(String s) {
String valArray[] = null;
if (s == null) {
throw new IllegalArgumentException();
}
Hashtable<String, String[]> ht = new Hashtable<String, String[]>();
StringBuilder sb = new StringBuilder();
StringTokenizer st = new StringTokenizer(s, "&");
while (st.hasMoreTokens()) {
String pair = st.nextToken();
int pos = pair.indexOf('=');
if (pos == -1) {
// XXX
// should give more detail about the illegal argument
throw new IllegalArgumentException();
}
String key = parseName(pair.substring(0, pos), sb);
String val = parseName(pair.substring(pos+1, pair.length()), sb);
if (ht.containsKey(key)) {
String oldVals[] = ht.get(key);
valArray = new String[oldVals.length + 1];
for (int i = 0; i < oldVals.length; i++) {
valArray[i] = oldVals[i];
}
valArray[oldVals.length] = val;
} else {
valArray = new String[1];
valArray[0] = val;
}
ht.put(key, valArray);
}
return ht;
} | java | public static Hashtable<String, String[]> parseQueryString(String s) {
String valArray[] = null;
if (s == null) {
throw new IllegalArgumentException();
}
Hashtable<String, String[]> ht = new Hashtable<String, String[]>();
StringBuilder sb = new StringBuilder();
StringTokenizer st = new StringTokenizer(s, "&");
while (st.hasMoreTokens()) {
String pair = st.nextToken();
int pos = pair.indexOf('=');
if (pos == -1) {
// XXX
// should give more detail about the illegal argument
throw new IllegalArgumentException();
}
String key = parseName(pair.substring(0, pos), sb);
String val = parseName(pair.substring(pos+1, pair.length()), sb);
if (ht.containsKey(key)) {
String oldVals[] = ht.get(key);
valArray = new String[oldVals.length + 1];
for (int i = 0; i < oldVals.length; i++) {
valArray[i] = oldVals[i];
}
valArray[oldVals.length] = val;
} else {
valArray = new String[1];
valArray[0] = val;
}
ht.put(key, valArray);
}
return ht;
} | [
"public",
"static",
"Hashtable",
"<",
"String",
",",
"String",
"[",
"]",
">",
"parseQueryString",
"(",
"String",
"s",
")",
"{",
"String",
"valArray",
"[",
"]",
"=",
"null",
";",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentEx... | Parses a query string passed from the client to the
server and builds a <code>HashTable</code> object
with key-value pairs.
The query string should be in the form of a string
packaged by the GET or POST method, that is, it
should have key-value pairs in the form <i>key=value</i>,
with each pair separated from the next by a & character.
<p>A key can appear more than once in the query string
with different values. However, the key appears only once in
the hashtable, with its value being
an array of strings containing the multiple values sent
by the query string.
<p>The keys and values in the hashtable are stored in their
decoded form, so
any + characters are converted to spaces, and characters
sent in hexadecimal notation (like <i>%xx</i>) are
converted to ASCII characters.
@param s a string containing the query to be parsed
@return a <code>HashTable</code> object built
from the parsed key-value pairs
@exception IllegalArgumentException if the query string is invalid | [
"Parses",
"a",
"query",
"string",
"passed",
"from",
"the",
"client",
"to",
"the",
"server",
"and",
"builds",
"a",
"<code",
">",
"HashTable<",
"/",
"code",
">",
"object",
"with",
"key",
"-",
"value",
"pairs",
".",
"The",
"query",
"string",
"should",
"be",... | train | https://github.com/jboss/jboss-servlet-api_spec/blob/5bc96f2b833c072baff6eb8ae49bc7b5e503e9b2/src/main/java/javax/servlet/http/HttpUtils.java#L117-L153 |
kaazing/gateway | samples/security/TokenLoginModule.java | TokenLoginModule.processToken | private void processToken(String tokenData) throws JSONException, LoginException {
JSONObject json = new JSONObject(tokenData);
// Validate that the token hasn't expired.
ZonedDateTime expires = ZonedDateTime.parse(json.getString("tokenExpires"));
ZonedDateTime now = ZonedDateTime.now(expires.getZone());
if (expires.isBefore(now)) {
throw new LoginException("Token has expired");
}
/*
* The following check that expiringState is not null can be removed once the expiring state API is made public. Until then,
* it can be enabled by setting the early access flag "login.module.expiring.state". See the documentation for how to set
* the early access flag:
*
* https://kaazing.com/doc/5.0/admin-reference/p_configure_gateway_opts/index.html#enable-early-access-features
*/
if (expiringState != null) {
// Validate that the token hasn't been used already. If not, then store it until it expires in case it is replayed.
long duration = Duration.between(now, expires).toMillis();
String nonce = json.getString("nonce");
if (expiringState.putIfAbsent(nonce, nonce, duration, TimeUnit.MILLISECONDS) != null) {
throw new LoginException(String.format("Token nonce has already been used: %s", nonce));
}
}
// Token has passed validity checks. Store the username to be used by the commit() method.
this.username = json.getString("username");
logger.fine(String.format("Login: Token is valid for user %s", username));
} | java | private void processToken(String tokenData) throws JSONException, LoginException {
JSONObject json = new JSONObject(tokenData);
// Validate that the token hasn't expired.
ZonedDateTime expires = ZonedDateTime.parse(json.getString("tokenExpires"));
ZonedDateTime now = ZonedDateTime.now(expires.getZone());
if (expires.isBefore(now)) {
throw new LoginException("Token has expired");
}
/*
* The following check that expiringState is not null can be removed once the expiring state API is made public. Until then,
* it can be enabled by setting the early access flag "login.module.expiring.state". See the documentation for how to set
* the early access flag:
*
* https://kaazing.com/doc/5.0/admin-reference/p_configure_gateway_opts/index.html#enable-early-access-features
*/
if (expiringState != null) {
// Validate that the token hasn't been used already. If not, then store it until it expires in case it is replayed.
long duration = Duration.between(now, expires).toMillis();
String nonce = json.getString("nonce");
if (expiringState.putIfAbsent(nonce, nonce, duration, TimeUnit.MILLISECONDS) != null) {
throw new LoginException(String.format("Token nonce has already been used: %s", nonce));
}
}
// Token has passed validity checks. Store the username to be used by the commit() method.
this.username = json.getString("username");
logger.fine(String.format("Login: Token is valid for user %s", username));
} | [
"private",
"void",
"processToken",
"(",
"String",
"tokenData",
")",
"throws",
"JSONException",
",",
"LoginException",
"{",
"JSONObject",
"json",
"=",
"new",
"JSONObject",
"(",
"tokenData",
")",
";",
"// Validate that the token hasn't expired.",
"ZonedDateTime",
"expires... | Validate the token and extract the username to add to shared state. An exception is thrown if the token is found to be
invalid
This method expects the token to be in JSON format:
{
username: "joe",
nonce: "5171483440790326",
tokenExpires: "2017-04-20T15:48:49.187Z"
} | [
"Validate",
"the",
"token",
"and",
"extract",
"the",
"username",
"to",
"add",
"to",
"shared",
"state",
".",
"An",
"exception",
"is",
"thrown",
"if",
"the",
"token",
"is",
"found",
"to",
"be",
"invalid"
] | train | https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/samples/security/TokenLoginModule.java#L199-L230 |
sdl/odata | odata_renderer/src/main/java/com/sdl/odata/renderer/metadata/MetadataDocumentWriter.java | MetadataDocumentWriter.writeMetadataDocument | public void writeMetadataDocument() throws ODataRenderException {
try {
xmlWriter.writeStartElement(EDMX_NS, EDMX);
xmlWriter.writeNamespace(EDMX_PREFIX, EDMX_NS);
xmlWriter.writeAttribute(VERSION, ODATA_VERSION);
xmlWriter.writeStartElement(EDMX_NS, EDMX_DATA_SERVICES);
boolean entityContinerWritten = false;
// Loop over all the schemas present in the Entity Data Model
for (Schema schema : entityDataModel.getSchemas()) {
xmlWriter.writeStartElement(SCHEMA);
xmlWriter.writeDefaultNamespace(EDM_NS);
xmlWriter.writeAttribute(NAMESPACE, schema.getNamespace());
for (Type type : schema.getTypes()) {
switch (type.getMetaType()) {
case ENTITY:
entityTypeWriter.write((EntityType) type);
break;
case COMPLEX:
complexTypeWriter.write((ComplexType) type);
break;
case ENUM:
enumTypeWriter.write((EnumType) type);
break;
default:
LOG.error("Unexpected type: {}", type.getFullyQualifiedName());
throw new ODataRenderException("Unexpected type: " + type.getFullyQualifiedName());
}
}
if (!entityContinerWritten) {
writeEntityContainer(entityDataModel.getEntityContainer());
entityContinerWritten = true;
}
// End of <Schema> element
xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement();
} catch (XMLStreamException e) {
LOG.error("Not possible to start stream XML");
throw new ODataRenderException("Not possible to start stream XML: ", e);
}
} | java | public void writeMetadataDocument() throws ODataRenderException {
try {
xmlWriter.writeStartElement(EDMX_NS, EDMX);
xmlWriter.writeNamespace(EDMX_PREFIX, EDMX_NS);
xmlWriter.writeAttribute(VERSION, ODATA_VERSION);
xmlWriter.writeStartElement(EDMX_NS, EDMX_DATA_SERVICES);
boolean entityContinerWritten = false;
// Loop over all the schemas present in the Entity Data Model
for (Schema schema : entityDataModel.getSchemas()) {
xmlWriter.writeStartElement(SCHEMA);
xmlWriter.writeDefaultNamespace(EDM_NS);
xmlWriter.writeAttribute(NAMESPACE, schema.getNamespace());
for (Type type : schema.getTypes()) {
switch (type.getMetaType()) {
case ENTITY:
entityTypeWriter.write((EntityType) type);
break;
case COMPLEX:
complexTypeWriter.write((ComplexType) type);
break;
case ENUM:
enumTypeWriter.write((EnumType) type);
break;
default:
LOG.error("Unexpected type: {}", type.getFullyQualifiedName());
throw new ODataRenderException("Unexpected type: " + type.getFullyQualifiedName());
}
}
if (!entityContinerWritten) {
writeEntityContainer(entityDataModel.getEntityContainer());
entityContinerWritten = true;
}
// End of <Schema> element
xmlWriter.writeEndElement();
}
xmlWriter.writeEndElement();
} catch (XMLStreamException e) {
LOG.error("Not possible to start stream XML");
throw new ODataRenderException("Not possible to start stream XML: ", e);
}
} | [
"public",
"void",
"writeMetadataDocument",
"(",
")",
"throws",
"ODataRenderException",
"{",
"try",
"{",
"xmlWriter",
".",
"writeStartElement",
"(",
"EDMX_NS",
",",
"EDMX",
")",
";",
"xmlWriter",
".",
"writeNamespace",
"(",
"EDMX_PREFIX",
",",
"EDMX_NS",
")",
";"... | Write the 'Metadata Document'.
@throws ODataRenderException if unable to render metadata document | [
"Write",
"the",
"Metadata",
"Document",
"."
] | train | https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/renderer/metadata/MetadataDocumentWriter.java#L122-L166 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.getDomainSummaryStatistics | public GetDomainSummaryStatisticsResponse getDomainSummaryStatistics(String startTime, String endTime) {
GetDomainSummaryStatisticsRequest request = new GetDomainSummaryStatisticsRequest();
request.withStartTime(startTime).withEndTime(endTime);
return getDomainSummaryStatistics(request);
} | java | public GetDomainSummaryStatisticsResponse getDomainSummaryStatistics(String startTime, String endTime) {
GetDomainSummaryStatisticsRequest request = new GetDomainSummaryStatisticsRequest();
request.withStartTime(startTime).withEndTime(endTime);
return getDomainSummaryStatistics(request);
} | [
"public",
"GetDomainSummaryStatisticsResponse",
"getDomainSummaryStatistics",
"(",
"String",
"startTime",
",",
"String",
"endTime",
")",
"{",
"GetDomainSummaryStatisticsRequest",
"request",
"=",
"new",
"GetDomainSummaryStatisticsRequest",
"(",
")",
";",
"request",
".",
"wit... | get all domains' summary statistics in the live stream service.
@param startTime start time
@param endTime start time
@return the response | [
"get",
"all",
"domains",
"summary",
"statistics",
"in",
"the",
"live",
"stream",
"service",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1840-L1844 |
Mozu/mozu-java | mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/entitylists/EntityUrl.java | EntityUrl.getEntityUrl | public static MozuUrl getEntityUrl(String entityListFullName, String id, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/entitylists/{entityListFullName}/entities/{id}?responseFields={responseFields}");
formatter.formatUrl("entityListFullName", entityListFullName);
formatter.formatUrl("id", id);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java | public static MozuUrl getEntityUrl(String entityListFullName, String id, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/entitylists/{entityListFullName}/entities/{id}?responseFields={responseFields}");
formatter.formatUrl("entityListFullName", entityListFullName);
formatter.formatUrl("id", id);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | [
"public",
"static",
"MozuUrl",
"getEntityUrl",
"(",
"String",
"entityListFullName",
",",
"String",
"id",
",",
"String",
"responseFields",
")",
"{",
"UrlFormatter",
"formatter",
"=",
"new",
"UrlFormatter",
"(",
"\"/api/platform/entitylists/{entityListFullName}/entities/{id}?... | Get Resource Url for GetEntity
@param entityListFullName The full name of the EntityList including namespace in name@nameSpace format
@param id Unique identifier of the customer segment to retrieve.
@param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss.
@return String Resource Url | [
"Get",
"Resource",
"Url",
"for",
"GetEntity"
] | train | https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/entitylists/EntityUrl.java#L23-L30 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java | ScopedServletUtils.getRelativeURI | public static final String getRelativeURI( String contextPath, String uri )
{
String requestUrl = uri;
int overlap = requestUrl.indexOf( contextPath + '/' );
assert overlap != -1 : "contextPath: " + contextPath + ", uri: " + uri;
return requestUrl.substring( overlap + contextPath.length() );
} | java | public static final String getRelativeURI( String contextPath, String uri )
{
String requestUrl = uri;
int overlap = requestUrl.indexOf( contextPath + '/' );
assert overlap != -1 : "contextPath: " + contextPath + ", uri: " + uri;
return requestUrl.substring( overlap + contextPath.length() );
} | [
"public",
"static",
"final",
"String",
"getRelativeURI",
"(",
"String",
"contextPath",
",",
"String",
"uri",
")",
"{",
"String",
"requestUrl",
"=",
"uri",
";",
"int",
"overlap",
"=",
"requestUrl",
".",
"indexOf",
"(",
"contextPath",
"+",
"'",
"'",
")",
";"... | Get a URI relative to a given webapp root.
@param contextPath the webapp context path, e.g., "/myWebapp"
@param uri the URI which should be made relative. | [
"Get",
"a",
"URI",
"relative",
"to",
"a",
"given",
"webapp",
"root",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java#L395-L401 |
rvs-fluid-it/mvn-fluid-cd | mvn-ext-freeze/src/main/java/be/fluid_it/mvn/cd/x/freeze/replace/FreezeHandler.java | FreezeHandler.getName | private String getName(String s1, String s2) {
if (s1 == null || "".equals(s1)) return s2;
else return s1;
} | java | private String getName(String s1, String s2) {
if (s1 == null || "".equals(s1)) return s2;
else return s1;
} | [
"private",
"String",
"getName",
"(",
"String",
"s1",
",",
"String",
"s2",
")",
"{",
"if",
"(",
"s1",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"s1",
")",
")",
"return",
"s2",
";",
"else",
"return",
"s1",
";",
"}"
] | If the first String parameter is nonempty, return it,
else return the second string parameter.
@param s1 The string to be tested.
@param s2 The alternate String.
@return s1 if it isn't empty, else s2. | [
"If",
"the",
"first",
"String",
"parameter",
"is",
"nonempty",
"return",
"it",
"else",
"return",
"the",
"second",
"string",
"parameter",
"."
] | train | https://github.com/rvs-fluid-it/mvn-fluid-cd/blob/2aad8ed1cb40f94bd24bad7e6a127956cc277077/mvn-ext-freeze/src/main/java/be/fluid_it/mvn/cd/x/freeze/replace/FreezeHandler.java#L261-L264 |
wellner/jcarafe | jcarafe-core/src/main/java/cern/colt/list/BooleanArrayList.java | BooleanArrayList.replaceFromToWithFrom | public void replaceFromToWithFrom(int from, int to, AbstractBooleanList other, int otherFrom) {
// overridden for performance only.
if (! (other instanceof BooleanArrayList)) {
// slower
super.replaceFromToWithFrom(from,to,other,otherFrom);
return;
}
int length=to-from+1;
if (length>0) {
checkRangeFromTo(from, to, size());
checkRangeFromTo(otherFrom,otherFrom+length-1,other.size());
System.arraycopy(((BooleanArrayList) other).elements, otherFrom, elements, from, length);
}
} | java | public void replaceFromToWithFrom(int from, int to, AbstractBooleanList other, int otherFrom) {
// overridden for performance only.
if (! (other instanceof BooleanArrayList)) {
// slower
super.replaceFromToWithFrom(from,to,other,otherFrom);
return;
}
int length=to-from+1;
if (length>0) {
checkRangeFromTo(from, to, size());
checkRangeFromTo(otherFrom,otherFrom+length-1,other.size());
System.arraycopy(((BooleanArrayList) other).elements, otherFrom, elements, from, length);
}
} | [
"public",
"void",
"replaceFromToWithFrom",
"(",
"int",
"from",
",",
"int",
"to",
",",
"AbstractBooleanList",
"other",
",",
"int",
"otherFrom",
")",
"{",
"// overridden for performance only.\r",
"if",
"(",
"!",
"(",
"other",
"instanceof",
"BooleanArrayList",
")",
"... | Replaces a number of elements in the receiver with the same number of elements of another list.
Replaces elements in the receiver, between <code>from</code> (inclusive) and <code>to</code> (inclusive),
with elements of <code>other</code>, starting from <code>otherFrom</code> (inclusive).
@param from the position of the first element to be replaced in the receiver
@param to the position of the last element to be replaced in the receiver
@param other list holding elements to be copied into the receiver.
@param otherFrom position of first element within other list to be copied. | [
"Replaces",
"a",
"number",
"of",
"elements",
"in",
"the",
"receiver",
"with",
"the",
"same",
"number",
"of",
"elements",
"of",
"another",
"list",
".",
"Replaces",
"elements",
"in",
"the",
"receiver",
"between",
"<code",
">",
"from<",
"/",
"code",
">",
"(",... | train | https://github.com/wellner/jcarafe/blob/ab8b0a83dbf600fe80c27711815c90bd3055b217/jcarafe-core/src/main/java/cern/colt/list/BooleanArrayList.java#L365-L378 |
alkacon/opencms-core | src/org/opencms/jlan/CmsByteBuffer.java | CmsByteBuffer.writeBytes | public void writeBytes(byte[] src, int srcStart, int destStart, int len) {
int newEnd = destStart + len;
ensureCapacity(newEnd);
if (newEnd > m_size) {
m_size = newEnd;
}
System.arraycopy(src, srcStart, m_buffer, destStart, len);
} | java | public void writeBytes(byte[] src, int srcStart, int destStart, int len) {
int newEnd = destStart + len;
ensureCapacity(newEnd);
if (newEnd > m_size) {
m_size = newEnd;
}
System.arraycopy(src, srcStart, m_buffer, destStart, len);
} | [
"public",
"void",
"writeBytes",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"srcStart",
",",
"int",
"destStart",
",",
"int",
"len",
")",
"{",
"int",
"newEnd",
"=",
"destStart",
"+",
"len",
";",
"ensureCapacity",
"(",
"newEnd",
")",
";",
"if",
"(",
"new... | Writes some bytes to this buffer, expanding the buffer if necessary.<p>
@param src the source from which to write the bytes
@param srcStart the start index in the source array
@param destStart the start index in this buffer
@param len the number of bytes to write | [
"Writes",
"some",
"bytes",
"to",
"this",
"buffer",
"expanding",
"the",
"buffer",
"if",
"necessary",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jlan/CmsByteBuffer.java#L149-L157 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.