repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 192 | func_name stringlengths 5 108 | whole_func_string stringlengths 75 3.91k | language stringclasses 1
value | func_code_string stringlengths 75 3.91k | func_code_tokens listlengths 21 629 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 111 306 |
|---|---|---|---|---|---|---|---|---|---|---|
Alluxio/alluxio | core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java | NetworkAddressUtils.getBindAddress | public static InetSocketAddress getBindAddress(ServiceType service, AlluxioConfiguration conf) {
int port = getPort(service, conf);
assertValidPort(port);
return new InetSocketAddress(getBindHost(service, conf), getPort(service, conf));
} | java | public static InetSocketAddress getBindAddress(ServiceType service, AlluxioConfiguration conf) {
int port = getPort(service, conf);
assertValidPort(port);
return new InetSocketAddress(getBindHost(service, conf), getPort(service, conf));
} | [
"public",
"static",
"InetSocketAddress",
"getBindAddress",
"(",
"ServiceType",
"service",
",",
"AlluxioConfiguration",
"conf",
")",
"{",
"int",
"port",
"=",
"getPort",
"(",
"service",
",",
"conf",
")",
";",
"assertValidPort",
"(",
"port",
")",
";",
"return",
"... | Helper method to get the bind hostname for a given service.
@param service the service name
@param conf Alluxio configuration
@return the InetSocketAddress the service will bind to | [
"Helper",
"method",
"to",
"get",
"the",
"bind",
"hostname",
"for",
"a",
"given",
"service",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/util/network/NetworkAddressUtils.java#L319-L323 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_SharedRendererUtils.java | _SharedRendererUtils.getSelectItemsValueConverter | static Converter getSelectItemsValueConverter(Iterator<SelectItem> iterator, FacesContext facesContext)
{
// Attention!
// This code is duplicated in jsfapi component package.
// If you change something here please do the same in the other class!
Converter converter = null;
while (converter == null && iterator.hasNext())
{
SelectItem item = iterator.next();
if (item instanceof SelectItemGroup)
{
Iterator<SelectItem> groupIterator = Arrays.asList(
((SelectItemGroup) item).getSelectItems()).iterator();
converter = getSelectItemsValueConverter(groupIterator, facesContext);
}
else
{
Class<?> selectItemsType = item.getValue().getClass();
// optimization: no conversion for String values
if (String.class.equals(selectItemsType))
{
return null;
}
try
{
converter = facesContext.getApplication().createConverter(selectItemsType);
}
catch (FacesException e)
{
// nothing - try again
}
}
}
return converter;
} | java | static Converter getSelectItemsValueConverter(Iterator<SelectItem> iterator, FacesContext facesContext)
{
// Attention!
// This code is duplicated in jsfapi component package.
// If you change something here please do the same in the other class!
Converter converter = null;
while (converter == null && iterator.hasNext())
{
SelectItem item = iterator.next();
if (item instanceof SelectItemGroup)
{
Iterator<SelectItem> groupIterator = Arrays.asList(
((SelectItemGroup) item).getSelectItems()).iterator();
converter = getSelectItemsValueConverter(groupIterator, facesContext);
}
else
{
Class<?> selectItemsType = item.getValue().getClass();
// optimization: no conversion for String values
if (String.class.equals(selectItemsType))
{
return null;
}
try
{
converter = facesContext.getApplication().createConverter(selectItemsType);
}
catch (FacesException e)
{
// nothing - try again
}
}
}
return converter;
} | [
"static",
"Converter",
"getSelectItemsValueConverter",
"(",
"Iterator",
"<",
"SelectItem",
">",
"iterator",
",",
"FacesContext",
"facesContext",
")",
"{",
"// Attention!",
"// This code is duplicated in jsfapi component package.",
"// If you change something here please do the same i... | Iterates through the SelectItems with the given Iterator and tries to obtain
a by-class-converter based on the Class of SelectItem.getValue().
@param iterator
@param facesContext
@return The first suitable Converter for the given SelectItems or null. | [
"Iterates",
"through",
"the",
"SelectItems",
"with",
"the",
"given",
"Iterator",
"and",
"tries",
"to",
"obtain",
"a",
"by",
"-",
"class",
"-",
"converter",
"based",
"on",
"the",
"Class",
"of",
"SelectItem",
".",
"getValue",
"()",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_SharedRendererUtils.java#L447-L484 |
haifengl/smile | symbolic/src/main/java/smile/symbolic/Calculus.java | Calculus.diff | public static final double diff(String expression, double val) throws InvalidExpressionException {
ExpressionTree expTree = parseToTree(expression);
expTree.derive();
expTree.reduce();
return expTree.getVal();
} | java | public static final double diff(String expression, double val) throws InvalidExpressionException {
ExpressionTree expTree = parseToTree(expression);
expTree.derive();
expTree.reduce();
return expTree.getVal();
} | [
"public",
"static",
"final",
"double",
"diff",
"(",
"String",
"expression",
",",
"double",
"val",
")",
"throws",
"InvalidExpressionException",
"{",
"ExpressionTree",
"expTree",
"=",
"parseToTree",
"(",
"expression",
")",
";",
"expTree",
".",
"derive",
"(",
")",
... | Compute numeric derivative
@param expression the mathematical expression
@param val the value for which to evaluate the expression at
@return numeric derivative | [
"Compute",
"numeric",
"derivative"
] | train | https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/symbolic/src/main/java/smile/symbolic/Calculus.java#L45-L53 |
radkovo/CSSBox | src/main/java/org/fit/cssbox/layout/CSSDecoder.java | CSSDecoder.getLength | public int getLength(TermLengthOrPercent value, boolean auto, int defval, int autoval, int whole)
{
if (auto)
return autoval;
else if (value == null)
return defval;
else
return (int) context.pxLength(value, whole);
} | java | public int getLength(TermLengthOrPercent value, boolean auto, int defval, int autoval, int whole)
{
if (auto)
return autoval;
else if (value == null)
return defval;
else
return (int) context.pxLength(value, whole);
} | [
"public",
"int",
"getLength",
"(",
"TermLengthOrPercent",
"value",
",",
"boolean",
"auto",
",",
"int",
"defval",
",",
"int",
"autoval",
",",
"int",
"whole",
")",
"{",
"if",
"(",
"auto",
")",
"return",
"autoval",
";",
"else",
"if",
"(",
"value",
"==",
"... | Returns the length in pixels from a CSS definition
@param value The length or percentage value to be converted
@param auto True, if the property is set to <code>auto</code>
@param defval The length value to be used when the first one is null
@param autoval The value to be used when "auto" is specified
@param whole the length to be returned as 100% (in case of percentage values) | [
"Returns",
"the",
"length",
"in",
"pixels",
"from",
"a",
"CSS",
"definition"
] | train | https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/CSSDecoder.java#L99-L107 |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3f.java | Path3f.setLastPoint | public void setLastPoint(double x, double y, double z) {
if (this.numCoords>=3) {
this.coords[this.numCoords-3] = x;
this.coords[this.numCoords-2] = y;
this.coords[this.numCoords-1] = z;
this.graphicalBounds = null;
this.logicalBounds = null;
}
} | java | public void setLastPoint(double x, double y, double z) {
if (this.numCoords>=3) {
this.coords[this.numCoords-3] = x;
this.coords[this.numCoords-2] = y;
this.coords[this.numCoords-1] = z;
this.graphicalBounds = null;
this.logicalBounds = null;
}
} | [
"public",
"void",
"setLastPoint",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"z",
")",
"{",
"if",
"(",
"this",
".",
"numCoords",
">=",
"3",
")",
"{",
"this",
".",
"coords",
"[",
"this",
".",
"numCoords",
"-",
"3",
"]",
"=",
"x",
";",
... | Change the coordinates of the last inserted point.
@param x
@param y
@param z | [
"Change",
"the",
"coordinates",
"of",
"the",
"last",
"inserted",
"point",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3f.java#L1817-L1825 |
whitesource/agents | wss-agent-api/src/main/java/org/whitesource/agent/api/dispatch/RequestFactory.java | RequestFactory.newCheckPolicyComplianceRequest | @Deprecated
public CheckPolicyComplianceRequest newCheckPolicyComplianceRequest(String orgToken,
String product,
String productVersion,
Collection<AgentProjectInfo> projects,
boolean forceCheckAllDependencies,
String userKey,
String requesterEmail,
boolean aggregateModules,
boolean preserveModuleStructure,
String aggregateProjectName,
String aggregateProjectToken) {
return (CheckPolicyComplianceRequest) prepareRequest(new CheckPolicyComplianceRequest(projects, forceCheckAllDependencies), orgToken, requesterEmail, product,
productVersion, userKey, aggregateModules, preserveModuleStructure, aggregateProjectName, aggregateProjectToken, null,
null, null, null);
} | java | @Deprecated
public CheckPolicyComplianceRequest newCheckPolicyComplianceRequest(String orgToken,
String product,
String productVersion,
Collection<AgentProjectInfo> projects,
boolean forceCheckAllDependencies,
String userKey,
String requesterEmail,
boolean aggregateModules,
boolean preserveModuleStructure,
String aggregateProjectName,
String aggregateProjectToken) {
return (CheckPolicyComplianceRequest) prepareRequest(new CheckPolicyComplianceRequest(projects, forceCheckAllDependencies), orgToken, requesterEmail, product,
productVersion, userKey, aggregateModules, preserveModuleStructure, aggregateProjectName, aggregateProjectToken, null,
null, null, null);
} | [
"@",
"Deprecated",
"public",
"CheckPolicyComplianceRequest",
"newCheckPolicyComplianceRequest",
"(",
"String",
"orgToken",
",",
"String",
"product",
",",
"String",
"productVersion",
",",
"Collection",
"<",
"AgentProjectInfo",
">",
"projects",
",",
"boolean",
"forceCheckAl... | Create new Check policies request.
@param orgToken WhiteSource organization token.
@param projects Projects status statement to check.
@param product Name or WhiteSource service token of the product whose policies to check.
@param productVersion Version of the product whose policies to check.
@param forceCheckAllDependencies boolean check that all/added dependencies sent to WhiteSource
@param userKey user key uniquely identifying the account at white source.
@param requesterEmail Email of the WhiteSource user that requests to update WhiteSource.
@param aggregateModules to combine all pom modules into a single WhiteSource project with an aggregated dependency flat list (no hierarchy).
@param preserveModuleStructure combine all pom modules to be dependencies of single project, each module will be represented as a parent of its dependencies.
@param aggregateProjectName aggregate project name identifier.
@param aggregateProjectToken aggregate project token identifier.
@return Newly created request to check policies application. | [
"Create",
"new",
"Check",
"policies",
"request",
"."
] | train | https://github.com/whitesource/agents/blob/8a947a3dbad257aff70f23f79fb3a55ca90b765f/wss-agent-api/src/main/java/org/whitesource/agent/api/dispatch/RequestFactory.java#L454-L469 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java | FeatureOverlayQuery.tileFeatureCount | public long tileFeatureCount(Point point, int zoom) {
TileGrid tileGrid = TileBoundingBoxUtils.getTileGridFromWGS84(point, zoom);
return featureTiles.queryIndexedFeaturesCount((int) tileGrid.getMinX(), (int) tileGrid.getMinY(), zoom);
} | java | public long tileFeatureCount(Point point, int zoom) {
TileGrid tileGrid = TileBoundingBoxUtils.getTileGridFromWGS84(point, zoom);
return featureTiles.queryIndexedFeaturesCount((int) tileGrid.getMinX(), (int) tileGrid.getMinY(), zoom);
} | [
"public",
"long",
"tileFeatureCount",
"(",
"Point",
"point",
",",
"int",
"zoom",
")",
"{",
"TileGrid",
"tileGrid",
"=",
"TileBoundingBoxUtils",
".",
"getTileGridFromWGS84",
"(",
"point",
",",
"zoom",
")",
";",
"return",
"featureTiles",
".",
"queryIndexedFeaturesCo... | Get the count of features in the tile at the point coordinate and zoom level
@param point point location
@param zoom zoom level
@return count | [
"Get",
"the",
"count",
"of",
"features",
"in",
"the",
"tile",
"at",
"the",
"point",
"coordinate",
"and",
"zoom",
"level"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/tiles/overlay/FeatureOverlayQuery.java#L242-L245 |
talenguyen/PrettySharedPreferences | prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java | PrettySharedPreferences.getStringEditor | protected StringEditor getStringEditor(String key) {
TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key);
if (typeEditor == null) {
typeEditor = new StringEditor(this, sharedPreferences, key);
TYPE_EDITOR_MAP.put(key, typeEditor);
} else if (!(typeEditor instanceof StringEditor)) {
throw new IllegalArgumentException(String.format("key %s is already used for other type", key));
}
return (StringEditor) typeEditor;
} | java | protected StringEditor getStringEditor(String key) {
TypeEditor typeEditor = TYPE_EDITOR_MAP.get(key);
if (typeEditor == null) {
typeEditor = new StringEditor(this, sharedPreferences, key);
TYPE_EDITOR_MAP.put(key, typeEditor);
} else if (!(typeEditor instanceof StringEditor)) {
throw new IllegalArgumentException(String.format("key %s is already used for other type", key));
}
return (StringEditor) typeEditor;
} | [
"protected",
"StringEditor",
"getStringEditor",
"(",
"String",
"key",
")",
"{",
"TypeEditor",
"typeEditor",
"=",
"TYPE_EDITOR_MAP",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"typeEditor",
"==",
"null",
")",
"{",
"typeEditor",
"=",
"new",
"StringEditor",
"... | Call to get a {@link com.tale.prettysharedpreferences.StringEditor} object for the specific
key. <code>NOTE:</code> There is a unique {@link com.tale.prettysharedpreferences.TypeEditor}
object for a unique key.
@param key The name of the preference.
@return {@link com.tale.prettysharedpreferences.StringEditor} object to be store or retrieve
a {@link java.lang.String} value. | [
"Call",
"to",
"get",
"a",
"{",
"@link",
"com",
".",
"tale",
".",
"prettysharedpreferences",
".",
"StringEditor",
"}",
"object",
"for",
"the",
"specific",
"key",
".",
"<code",
">",
"NOTE",
":",
"<",
"/",
"code",
">",
"There",
"is",
"a",
"unique",
"{",
... | train | https://github.com/talenguyen/PrettySharedPreferences/blob/b97edf86c8fa65be2165f2cd790545c78c971c22/prettysharedpreferences/src/main/java/com/tale/prettysharedpreferences/PrettySharedPreferences.java#L32-L41 |
lessthanoptimal/ddogleg | src/org/ddogleg/clustering/FactoryClustering.java | FactoryClustering.kMeans_F64 | public static StandardKMeans_F64 kMeans_F64( KMeansInitializers initializer,
int maxIterations, int maxConverge , double convergeTol) {
InitializeKMeans_F64 seed;
if( initializer == null ) {
seed = new InitializePlusPlus();
} else {
switch (initializer) {
case PLUS_PLUS:
seed = new InitializePlusPlus();
break;
case STANDARD:
seed = new InitializeStandard_F64();
break;
default:
throw new RuntimeException("Unknown initializer " + initializer);
}
}
return new StandardKMeans_F64(maxIterations,maxConverge,convergeTol,seed);
} | java | public static StandardKMeans_F64 kMeans_F64( KMeansInitializers initializer,
int maxIterations, int maxConverge , double convergeTol) {
InitializeKMeans_F64 seed;
if( initializer == null ) {
seed = new InitializePlusPlus();
} else {
switch (initializer) {
case PLUS_PLUS:
seed = new InitializePlusPlus();
break;
case STANDARD:
seed = new InitializeStandard_F64();
break;
default:
throw new RuntimeException("Unknown initializer " + initializer);
}
}
return new StandardKMeans_F64(maxIterations,maxConverge,convergeTol,seed);
} | [
"public",
"static",
"StandardKMeans_F64",
"kMeans_F64",
"(",
"KMeansInitializers",
"initializer",
",",
"int",
"maxIterations",
",",
"int",
"maxConverge",
",",
"double",
"convergeTol",
")",
"{",
"InitializeKMeans_F64",
"seed",
";",
"if",
"(",
"initializer",
"==",
"nu... | High level interface for creating k-means cluster. If more flexibility is needed (e.g. custom seeds)
then create and instance of {@link org.ddogleg.clustering.kmeans.StandardKMeans_F64} directly
@param initializer Specify which method should be used to select the initial seeds for the clusters. null means default.
@param maxIterations Maximum number of iterations it will perform.
@param maxConverge Maximum iterations allowed before convergence. Re-seeded if it doesn't converge.
@param convergeTol Distance based convergence tolerance. Try 1e-8
@return StandardKMeans_F64 | [
"High",
"level",
"interface",
"for",
"creating",
"k",
"-",
"means",
"cluster",
".",
"If",
"more",
"flexibility",
"is",
"needed",
"(",
"e",
".",
"g",
".",
"custom",
"seeds",
")",
"then",
"create",
"and",
"instance",
"of",
"{",
"@link",
"org",
".",
"ddog... | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/clustering/FactoryClustering.java#L67-L88 |
infinispan/infinispan | core/src/main/java/org/infinispan/stream/impl/KeyWatchingCompletionListener.java | KeyWatchingCompletionListener.valueIterated | public void valueIterated(Object key) {
// If we set to null that tells segment completion to just notify above in accept
if (!currentKey.compareAndSet(key, null)) {
// Otherwise we have to check if this key was linked to a group of pending segments
Supplier<PrimitiveIterator.OfInt> segments = pendingSegments.remove(key);
if (segments != null) {
completionListener.accept(segments);
}
}
} | java | public void valueIterated(Object key) {
// If we set to null that tells segment completion to just notify above in accept
if (!currentKey.compareAndSet(key, null)) {
// Otherwise we have to check if this key was linked to a group of pending segments
Supplier<PrimitiveIterator.OfInt> segments = pendingSegments.remove(key);
if (segments != null) {
completionListener.accept(segments);
}
}
} | [
"public",
"void",
"valueIterated",
"(",
"Object",
"key",
")",
"{",
"// If we set to null that tells segment completion to just notify above in accept",
"if",
"(",
"!",
"currentKey",
".",
"compareAndSet",
"(",
"key",
",",
"null",
")",
")",
"{",
"// Otherwise we have to che... | This method is to be invoked on possibly a different thread at any point which states that a key has
been iterated upon. This is the signal that if a set of segments is waiting for a key to be iterated upon
to notify the iteration
@param key the key just returning | [
"This",
"method",
"is",
"to",
"be",
"invoked",
"on",
"possibly",
"a",
"different",
"thread",
"at",
"any",
"point",
"which",
"states",
"that",
"a",
"key",
"has",
"been",
"iterated",
"upon",
".",
"This",
"is",
"the",
"signal",
"that",
"if",
"a",
"set",
"... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/stream/impl/KeyWatchingCompletionListener.java#L72-L81 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/api/loader/FileBatch.java | FileBatch.readFromZip | public static FileBatch readFromZip(InputStream is) throws IOException {
String originalUris = null;
Map<Integer, byte[]> bytesMap = new HashMap<>();
try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(is))) {
ZipEntry ze;
while ((ze = zis.getNextEntry()) != null) {
String name = ze.getName();
byte[] bytes = IOUtils.toByteArray(zis);
if (name.equals(ORIGINAL_PATHS_FILENAME)) {
originalUris = new String(bytes, 0, bytes.length, StandardCharsets.UTF_8);
} else {
int idxSplit = name.indexOf("_");
int idxSplit2 = name.indexOf(".");
int fileIdx = Integer.parseInt(name.substring(idxSplit + 1, idxSplit2));
bytesMap.put(fileIdx, bytes);
}
}
}
List<byte[]> list = new ArrayList<>(bytesMap.size());
for (int i = 0; i < bytesMap.size(); i++) {
list.add(bytesMap.get(i));
}
List<String> origPaths = Arrays.asList(originalUris.split("\n"));
return new FileBatch(list, origPaths);
} | java | public static FileBatch readFromZip(InputStream is) throws IOException {
String originalUris = null;
Map<Integer, byte[]> bytesMap = new HashMap<>();
try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(is))) {
ZipEntry ze;
while ((ze = zis.getNextEntry()) != null) {
String name = ze.getName();
byte[] bytes = IOUtils.toByteArray(zis);
if (name.equals(ORIGINAL_PATHS_FILENAME)) {
originalUris = new String(bytes, 0, bytes.length, StandardCharsets.UTF_8);
} else {
int idxSplit = name.indexOf("_");
int idxSplit2 = name.indexOf(".");
int fileIdx = Integer.parseInt(name.substring(idxSplit + 1, idxSplit2));
bytesMap.put(fileIdx, bytes);
}
}
}
List<byte[]> list = new ArrayList<>(bytesMap.size());
for (int i = 0; i < bytesMap.size(); i++) {
list.add(bytesMap.get(i));
}
List<String> origPaths = Arrays.asList(originalUris.split("\n"));
return new FileBatch(list, origPaths);
} | [
"public",
"static",
"FileBatch",
"readFromZip",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"String",
"originalUris",
"=",
"null",
";",
"Map",
"<",
"Integer",
",",
"byte",
"[",
"]",
">",
"bytesMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
... | Read a FileBatch from the specified input stream. This method assumes the FileBatch was previously saved to
zip format using {@link #writeAsZip(File)} or {@link #writeAsZip(OutputStream)}
@param is Input stream to read from
@return The loaded FileBatch
@throws IOException If an error occurs during reading | [
"Read",
"a",
"FileBatch",
"from",
"the",
"specified",
"input",
"stream",
".",
"This",
"method",
"assumes",
"the",
"FileBatch",
"was",
"previously",
"saved",
"to",
"zip",
"format",
"using",
"{",
"@link",
"#writeAsZip",
"(",
"File",
")",
"}",
"or",
"{",
"@li... | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/api/loader/FileBatch.java#L59-L85 |
wildfly/wildfly-core | elytron/src/main/java/org/wildfly/extension/elytron/ServiceStateDefinition.java | ServiceStateDefinition.populateResponse | static void populateResponse(final ModelNode response, final ServiceController<?> serviceController) {
response.set(serviceController.getState().toString());
} | java | static void populateResponse(final ModelNode response, final ServiceController<?> serviceController) {
response.set(serviceController.getState().toString());
} | [
"static",
"void",
"populateResponse",
"(",
"final",
"ModelNode",
"response",
",",
"final",
"ServiceController",
"<",
"?",
">",
"serviceController",
")",
"{",
"response",
".",
"set",
"(",
"serviceController",
".",
"getState",
"(",
")",
".",
"toString",
"(",
")"... | Populate the supplied response {@link ModelNode} with information about the supplied {@link ServiceController}
@param response the response to populate.
@param serviceController the {@link ServiceController} to use when populating the response. | [
"Populate",
"the",
"supplied",
"response",
"{",
"@link",
"ModelNode",
"}",
"with",
"information",
"about",
"the",
"supplied",
"{",
"@link",
"ServiceController",
"}"
] | train | https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/elytron/src/main/java/org/wildfly/extension/elytron/ServiceStateDefinition.java#L46-L48 |
bwkimmel/java-util | src/main/java/ca/eandb/util/args/ArgumentProcessor.java | ArgumentProcessor.addCommand | public void addCommand(String key, Command<? super T> handler) {
commands.put(key, handler);
} | java | public void addCommand(String key, Command<? super T> handler) {
commands.put(key, handler);
} | [
"public",
"void",
"addCommand",
"(",
"String",
"key",
",",
"Command",
"<",
"?",
"super",
"T",
">",
"handler",
")",
"{",
"commands",
".",
"put",
"(",
"key",
",",
"handler",
")",
";",
"}"
] | Adds a new command handler.
@param key The <code>String</code> that identifies this command. The
command may be triggered by a command line argument with this
value.
@param handler The <code>Command</code> that is used to process the
command. | [
"Adds",
"a",
"new",
"command",
"handler",
"."
] | train | https://github.com/bwkimmel/java-util/blob/0c03664d42f0e6b111f64447f222aa73c2819e5c/src/main/java/ca/eandb/util/args/ArgumentProcessor.java#L539-L541 |
JodaOrg/joda-time | src/main/java/org/joda/time/LocalDateTime.java | LocalDateTime.readResolve | private Object readResolve() {
if (iChronology == null) {
return new LocalDateTime(iLocalMillis, ISOChronology.getInstanceUTC());
}
if (DateTimeZone.UTC.equals(iChronology.getZone()) == false) {
return new LocalDateTime(iLocalMillis, iChronology.withUTC());
}
return this;
} | java | private Object readResolve() {
if (iChronology == null) {
return new LocalDateTime(iLocalMillis, ISOChronology.getInstanceUTC());
}
if (DateTimeZone.UTC.equals(iChronology.getZone()) == false) {
return new LocalDateTime(iLocalMillis, iChronology.withUTC());
}
return this;
} | [
"private",
"Object",
"readResolve",
"(",
")",
"{",
"if",
"(",
"iChronology",
"==",
"null",
")",
"{",
"return",
"new",
"LocalDateTime",
"(",
"iLocalMillis",
",",
"ISOChronology",
".",
"getInstanceUTC",
"(",
")",
")",
";",
"}",
"if",
"(",
"DateTimeZone",
"."... | Handle broken serialization from other tools.
@return the resolved object, not null | [
"Handle",
"broken",
"serialization",
"from",
"other",
"tools",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/LocalDateTime.java#L521-L529 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/cdn/CdnClient.java | CdnClient.setDomainIpACL | public SetDomainIpACLResponse setDomainIpACL(SetDomainIpACLRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest = createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config");
internalRequest.addParameter("ipACL","");
this.attachRequestToBody(request, internalRequest);
return invokeHttpClient(internalRequest, SetDomainIpACLResponse.class);
} | java | public SetDomainIpACLResponse setDomainIpACL(SetDomainIpACLRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
InternalRequest internalRequest = createRequest(request, HttpMethodName.PUT, DOMAIN, request.getDomain(), "config");
internalRequest.addParameter("ipACL","");
this.attachRequestToBody(request, internalRequest);
return invokeHttpClient(internalRequest, SetDomainIpACLResponse.class);
} | [
"public",
"SetDomainIpACLResponse",
"setDomainIpACL",
"(",
"SetDomainIpACLRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"InternalRequest",
"internalRequest",
"=",
"createRequest",
"(",
"request",... | Update IpACL rules of specified domain acceleration.
@param request The request containing all of the options related to the update request.
@return Result of the setDomainIpACL operation returned by the service. | [
"Update",
"IpACL",
"rules",
"of",
"specified",
"domain",
"acceleration",
"."
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/cdn/CdnClient.java#L412-L418 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/core/DoradusServer.java | DoradusServer.startEmbedded | public static void startEmbedded(String[] args, String[] services) {
instance().initEmbedded(args, services);
instance().start();
} | java | public static void startEmbedded(String[] args, String[] services) {
instance().initEmbedded(args, services);
instance().start();
} | [
"public",
"static",
"void",
"startEmbedded",
"(",
"String",
"[",
"]",
"args",
",",
"String",
"[",
"]",
"services",
")",
"{",
"instance",
"(",
")",
".",
"initEmbedded",
"(",
"args",
",",
"services",
")",
";",
"instance",
"(",
")",
".",
"start",
"(",
"... | Entrypoint method to embed a Doradus server in an application. The args parameter
is the same as {@link #startServer(String[])} and {@link #main(String[])}, which
override doradus.yaml file defaults. However, instead of starting all services,
only those in the given services parameter plus "required" services are started. At
least one storage service must be given, otherwise an exception is thrown. Once all
services have been started, this method returns, allowing the application to use
the now-running embedded server. When the application is done, it should call
{@link #shutDown()} or {@link #stopServer(String[])} to gracefully shut down the
server.
@param args See {@link #main(String[])} for more details.
@param services List of service modules to start. The full package name of each
must be provided. | [
"Entrypoint",
"method",
"to",
"embed",
"a",
"Doradus",
"server",
"in",
"an",
"application",
".",
"The",
"args",
"parameter",
"is",
"the",
"same",
"as",
"{",
"@link",
"#startServer",
"(",
"String",
"[]",
")",
"}",
"and",
"{",
"@link",
"#main",
"(",
"Strin... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/core/DoradusServer.java#L165-L168 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java | RuntimeUtil.exec | public static Process exec(String[] envp, File dir, String... cmds) {
if (ArrayUtil.isEmpty(cmds)) {
throw new NullPointerException("Command is empty !");
}
// 单条命令的情况
if (1 == cmds.length) {
final String cmd = cmds[0];
if (StrUtil.isBlank(cmd)) {
throw new NullPointerException("Command is empty !");
}
cmds = StrUtil.splitToArray(cmd, StrUtil.C_SPACE);
}
try {
return Runtime.getRuntime().exec(cmds, envp, dir);
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | java | public static Process exec(String[] envp, File dir, String... cmds) {
if (ArrayUtil.isEmpty(cmds)) {
throw new NullPointerException("Command is empty !");
}
// 单条命令的情况
if (1 == cmds.length) {
final String cmd = cmds[0];
if (StrUtil.isBlank(cmd)) {
throw new NullPointerException("Command is empty !");
}
cmds = StrUtil.splitToArray(cmd, StrUtil.C_SPACE);
}
try {
return Runtime.getRuntime().exec(cmds, envp, dir);
} catch (IOException e) {
throw new IORuntimeException(e);
}
} | [
"public",
"static",
"Process",
"exec",
"(",
"String",
"[",
"]",
"envp",
",",
"File",
"dir",
",",
"String",
"...",
"cmds",
")",
"{",
"if",
"(",
"ArrayUtil",
".",
"isEmpty",
"(",
"cmds",
")",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"Comm... | 执行命令<br>
命令带参数时参数可作为其中一个参数,也可以将命令和参数组合为一个字符串传入
@param envp 环境变量参数,传入形式为key=value,null表示继承系统环境变量
@param dir 执行命令所在目录(用于相对路径命令执行),null表示使用当前进程执行的目录
@param cmds 命令
@return {@link Process}
@since 4.1.6 | [
"执行命令<br",
">",
"命令带参数时参数可作为其中一个参数,也可以将命令和参数组合为一个字符串传入"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RuntimeUtil.java#L122-L140 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java | ApplicationGatewaysInner.getByResourceGroupAsync | public Observable<ApplicationGatewayInner> getByResourceGroupAsync(String resourceGroupName, String applicationGatewayName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, applicationGatewayName).map(new Func1<ServiceResponse<ApplicationGatewayInner>, ApplicationGatewayInner>() {
@Override
public ApplicationGatewayInner call(ServiceResponse<ApplicationGatewayInner> response) {
return response.body();
}
});
} | java | public Observable<ApplicationGatewayInner> getByResourceGroupAsync(String resourceGroupName, String applicationGatewayName) {
return getByResourceGroupWithServiceResponseAsync(resourceGroupName, applicationGatewayName).map(new Func1<ServiceResponse<ApplicationGatewayInner>, ApplicationGatewayInner>() {
@Override
public ApplicationGatewayInner call(ServiceResponse<ApplicationGatewayInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ApplicationGatewayInner",
">",
"getByResourceGroupAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"applicationGatewayName",
")",
"{",
"return",
"getByResourceGroupWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"applicationGate... | Gets the specified application gateway.
@param resourceGroupName The name of the resource group.
@param applicationGatewayName The name of the application gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ApplicationGatewayInner object | [
"Gets",
"the",
"specified",
"application",
"gateway",
"."
] | 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/ApplicationGatewaysInner.java#L346-L353 |
Graylog2/graylog2-server | graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/processors/PipelineInterpreter.java | PipelineInterpreter.processForPipelines | public List<Message> processForPipelines(Message message,
Set<String> pipelineIds,
InterpreterListener interpreterListener,
State state) {
final Map<String, Pipeline> currentPipelines = state.getCurrentPipelines();
final ImmutableSet<Pipeline> pipelinesToRun = pipelineIds.stream()
.map(currentPipelines::get)
.filter(Objects::nonNull)
.collect(ImmutableSet.toImmutableSet());
return processForResolvedPipelines(message, message.getId(), pipelinesToRun, interpreterListener, state);
} | java | public List<Message> processForPipelines(Message message,
Set<String> pipelineIds,
InterpreterListener interpreterListener,
State state) {
final Map<String, Pipeline> currentPipelines = state.getCurrentPipelines();
final ImmutableSet<Pipeline> pipelinesToRun = pipelineIds.stream()
.map(currentPipelines::get)
.filter(Objects::nonNull)
.collect(ImmutableSet.toImmutableSet());
return processForResolvedPipelines(message, message.getId(), pipelinesToRun, interpreterListener, state);
} | [
"public",
"List",
"<",
"Message",
">",
"processForPipelines",
"(",
"Message",
"message",
",",
"Set",
"<",
"String",
">",
"pipelineIds",
",",
"InterpreterListener",
"interpreterListener",
",",
"State",
"state",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"Pip... | Given a set of pipeline ids, process the given message according to the passed state.
This method returns the list of messages produced by the configuration in state, it does not
look at the database or any other external resource besides what is being passed as
parameters.
This can be used to simulate pipelines without having to store them in the database.
@param message the message to process
@param pipelineIds the ids of the pipelines to resolve and run the message through
@param interpreterListener the listener tracing the execution
@param state the pipeline/stage/rule state to interpret
@return the list of messages created during the interpreter run | [
"Given",
"a",
"set",
"of",
"pipeline",
"ids",
"process",
"the",
"given",
"message",
"according",
"to",
"the",
"passed",
"state",
"."
] | train | https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog/plugins/pipelineprocessor/processors/PipelineInterpreter.java#L233-L244 |
h2oai/h2o-3 | h2o-genmodel/src/main/java/hex/genmodel/descriptor/JsonModelDescriptorReader.java | JsonModelDescriptorReader.extractTableFromJson | public static Table extractTableFromJson(final JsonObject modelJson, final String tablePath) {
Objects.requireNonNull(modelJson);
JsonElement potentialTableJson = findInJson(modelJson, tablePath);
if (potentialTableJson.isJsonNull()) {
System.out.println(String.format("Failed to extract element '%s' MojoModel dump.",
tablePath));
return null;
}
final JsonObject tableJson = potentialTableJson.getAsJsonObject();
final int rowCount = tableJson.get("rowcount").getAsInt();
final String[] columnHeaders;
final Table.ColumnType[] columnTypes;
final Object[][] data;
// Extract column attributes
final JsonArray columns = findInJson(tableJson, "columns").getAsJsonArray();
final int columnCount = columns.size();
columnHeaders = new String[columnCount];
columnTypes = new Table.ColumnType[columnCount];
for (int i = 0; i < columnCount; i++) {
final JsonObject column = columns.get(i).getAsJsonObject();
columnHeaders[i] = column.get("description").getAsString();
columnTypes[i] = Table.ColumnType.extractType(column.get("type").getAsString());
}
// Extract data
JsonArray dataColumns = findInJson(tableJson, "data").getAsJsonArray();
data = new Object[columnCount][rowCount];
for (int i = 0; i < columnCount; i++) {
JsonArray column = dataColumns.get(i).getAsJsonArray();
for (int j = 0; j < rowCount; j++) {
final JsonPrimitive primitiveValue = column.get(j).getAsJsonPrimitive();
switch (columnTypes[i]) {
case LONG:
data[i][j] = primitiveValue.getAsLong();
break;
case DOUBLE:
data[i][j] = primitiveValue.getAsDouble();
break;
case STRING:
data[i][j] = primitiveValue.getAsString();
break;
}
}
}
return new Table(tableJson.get("name").getAsString(), tableJson.get("description").getAsString(),
new String[rowCount], columnHeaders, columnTypes, "", data);
} | java | public static Table extractTableFromJson(final JsonObject modelJson, final String tablePath) {
Objects.requireNonNull(modelJson);
JsonElement potentialTableJson = findInJson(modelJson, tablePath);
if (potentialTableJson.isJsonNull()) {
System.out.println(String.format("Failed to extract element '%s' MojoModel dump.",
tablePath));
return null;
}
final JsonObject tableJson = potentialTableJson.getAsJsonObject();
final int rowCount = tableJson.get("rowcount").getAsInt();
final String[] columnHeaders;
final Table.ColumnType[] columnTypes;
final Object[][] data;
// Extract column attributes
final JsonArray columns = findInJson(tableJson, "columns").getAsJsonArray();
final int columnCount = columns.size();
columnHeaders = new String[columnCount];
columnTypes = new Table.ColumnType[columnCount];
for (int i = 0; i < columnCount; i++) {
final JsonObject column = columns.get(i).getAsJsonObject();
columnHeaders[i] = column.get("description").getAsString();
columnTypes[i] = Table.ColumnType.extractType(column.get("type").getAsString());
}
// Extract data
JsonArray dataColumns = findInJson(tableJson, "data").getAsJsonArray();
data = new Object[columnCount][rowCount];
for (int i = 0; i < columnCount; i++) {
JsonArray column = dataColumns.get(i).getAsJsonArray();
for (int j = 0; j < rowCount; j++) {
final JsonPrimitive primitiveValue = column.get(j).getAsJsonPrimitive();
switch (columnTypes[i]) {
case LONG:
data[i][j] = primitiveValue.getAsLong();
break;
case DOUBLE:
data[i][j] = primitiveValue.getAsDouble();
break;
case STRING:
data[i][j] = primitiveValue.getAsString();
break;
}
}
}
return new Table(tableJson.get("name").getAsString(), tableJson.get("description").getAsString(),
new String[rowCount], columnHeaders, columnTypes, "", data);
} | [
"public",
"static",
"Table",
"extractTableFromJson",
"(",
"final",
"JsonObject",
"modelJson",
",",
"final",
"String",
"tablePath",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"modelJson",
")",
";",
"JsonElement",
"potentialTableJson",
"=",
"findInJson",
"(",
... | Extracts a Table from H2O's model serialized into JSON.
@param modelJson Full JSON representation of a model
@param tablePath Path in the given JSON to the desired table. Levels are dot-separated.
@return An instance of {@link Table}, if there was a table found by following the given path. Otherwise null. | [
"Extracts",
"a",
"Table",
"from",
"H2O",
"s",
"model",
"serialized",
"into",
"JSON",
"."
] | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/descriptor/JsonModelDescriptorReader.java#L36-L90 |
RestComm/media-core | rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTPCryptoContext.java | SRTPCryptoContext.checkReplay | boolean checkReplay(int seqNo, long guessedIndex) {
// compute the index of previously received packet and its
// delta to the new received packet
long localIndex = (((long) this.roc) << 16) | this.seqNum;
long delta = guessedIndex - localIndex;
if (delta > 0) {
/* Packet not yet received */
return true;
} else {
if (-delta > REPLAY_WINDOW_SIZE) {
/* Packet too old */
return false;
} else {
if (((this.replayWindow >> (-delta)) & 0x1) != 0) {
/* Packet already received ! */
return false;
} else {
/* Packet not yet received */
return true;
}
}
}
} | java | boolean checkReplay(int seqNo, long guessedIndex) {
// compute the index of previously received packet and its
// delta to the new received packet
long localIndex = (((long) this.roc) << 16) | this.seqNum;
long delta = guessedIndex - localIndex;
if (delta > 0) {
/* Packet not yet received */
return true;
} else {
if (-delta > REPLAY_WINDOW_SIZE) {
/* Packet too old */
return false;
} else {
if (((this.replayWindow >> (-delta)) & 0x1) != 0) {
/* Packet already received ! */
return false;
} else {
/* Packet not yet received */
return true;
}
}
}
} | [
"boolean",
"checkReplay",
"(",
"int",
"seqNo",
",",
"long",
"guessedIndex",
")",
"{",
"// compute the index of previously received packet and its",
"// delta to the new received packet",
"long",
"localIndex",
"=",
"(",
"(",
"(",
"long",
")",
"this",
".",
"roc",
")",
"... | Checks if a packet is a replayed on based on its sequence number.
This method supports a 64 packet history relative the the given sequence
number.
Sequence Number is guaranteed to be real (not faked) through
authentication.
@param seqNo
sequence number of the packet
@param guessedIndex
guessed roc
@return true if this sequence number indicates the packet is not a
replayed one, false if not | [
"Checks",
"if",
"a",
"packet",
"is",
"a",
"replayed",
"on",
"based",
"on",
"its",
"sequence",
"number",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTPCryptoContext.java#L552-L575 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTransform.java | GVRTransform.rotateByAxis | public void rotateByAxis(float angle, float x, float y, float z) {
NativeTransform.rotateByAxis(getNative(), angle * TO_RADIANS, x, y, z);
} | java | public void rotateByAxis(float angle, float x, float y, float z) {
NativeTransform.rotateByAxis(getNative(), angle * TO_RADIANS, x, y, z);
} | [
"public",
"void",
"rotateByAxis",
"(",
"float",
"angle",
",",
"float",
"x",
",",
"float",
"y",
",",
"float",
"z",
")",
"{",
"NativeTransform",
".",
"rotateByAxis",
"(",
"getNative",
"(",
")",
",",
"angle",
"*",
"TO_RADIANS",
",",
"x",
",",
"y",
",",
... | Modify the transform's current rotation in angle/axis terms.
@param angle
Angle of rotation in degrees.
@param x
'X' component of the axis.
@param y
'Y' component of the axis.
@param z
'Z' component of the axis. | [
"Modify",
"the",
"transform",
"s",
"current",
"rotation",
"in",
"angle",
"/",
"axis",
"terms",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRTransform.java#L444-L446 |
davetcc/tcMenu | tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java | MenuTree.replaceMenuById | public void replaceMenuById(SubMenuItem subMenu, MenuItem toReplace) {
synchronized (subMenuItems) {
ArrayList<MenuItem> list = subMenuItems.get(subMenu);
int idx = -1;
for (int i = 0; i < list.size(); ++i) {
if (list.get(i).getId() == toReplace.getId()) {
idx = i;
}
}
if (idx != -1) {
MenuItem oldItem = list.set(idx, toReplace);
if (toReplace.hasChildren()) {
ArrayList<MenuItem> items = subMenuItems.remove(oldItem);
subMenuItems.put(toReplace, items);
}
}
}
} | java | public void replaceMenuById(SubMenuItem subMenu, MenuItem toReplace) {
synchronized (subMenuItems) {
ArrayList<MenuItem> list = subMenuItems.get(subMenu);
int idx = -1;
for (int i = 0; i < list.size(); ++i) {
if (list.get(i).getId() == toReplace.getId()) {
idx = i;
}
}
if (idx != -1) {
MenuItem oldItem = list.set(idx, toReplace);
if (toReplace.hasChildren()) {
ArrayList<MenuItem> items = subMenuItems.remove(oldItem);
subMenuItems.put(toReplace, items);
}
}
}
} | [
"public",
"void",
"replaceMenuById",
"(",
"SubMenuItem",
"subMenu",
",",
"MenuItem",
"toReplace",
")",
"{",
"synchronized",
"(",
"subMenuItems",
")",
"{",
"ArrayList",
"<",
"MenuItem",
">",
"list",
"=",
"subMenuItems",
".",
"get",
"(",
"subMenu",
")",
";",
"... | Replace the menu item that has a given parent with the one provided
@param subMenu the parent
@param toReplace the menu item to replace by ID | [
"Replace",
"the",
"menu",
"item",
"that",
"has",
"a",
"given",
"parent",
"with",
"the",
"one",
"provided"
] | train | https://github.com/davetcc/tcMenu/blob/61546e4b982b25ceaff384073fe9ec1fff55e64a/tcMenuJavaApi/src/main/java/com/thecoderscorner/menu/domain/state/MenuTree.java#L129-L148 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/ipc/ProtocolSignature.java | ProtocolSignature.getProtocolSignature | public static ProtocolSignature getProtocolSignature(
int clientMethodsHashCode,
long serverVersion,
Class<? extends VersionedProtocol> protocol) {
// try to get the finger print & signature from the cache
ProtocolSigFingerprint sig = getSigFingerprint(protocol, serverVersion);
// check if the client side protocol matches the one on the server side
if (clientMethodsHashCode == sig.fingerprint) {
return new ProtocolSignature(serverVersion, null); // null indicates a match
}
return sig.signature;
} | java | public static ProtocolSignature getProtocolSignature(
int clientMethodsHashCode,
long serverVersion,
Class<? extends VersionedProtocol> protocol) {
// try to get the finger print & signature from the cache
ProtocolSigFingerprint sig = getSigFingerprint(protocol, serverVersion);
// check if the client side protocol matches the one on the server side
if (clientMethodsHashCode == sig.fingerprint) {
return new ProtocolSignature(serverVersion, null); // null indicates a match
}
return sig.signature;
} | [
"public",
"static",
"ProtocolSignature",
"getProtocolSignature",
"(",
"int",
"clientMethodsHashCode",
",",
"long",
"serverVersion",
",",
"Class",
"<",
"?",
"extends",
"VersionedProtocol",
">",
"protocol",
")",
"{",
"// try to get the finger print & signature from the cache",
... | Get a server protocol's signature
@param clientMethodsHashCode client protocol methods hashcode
@param serverVersion server protocol version
@param protocol protocol
@return the server's protocol signature | [
"Get",
"a",
"server",
"protocol",
"s",
"signature"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/ipc/ProtocolSignature.java#L207-L220 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java | CipherUtil.validateTime | public static void validateTime(String timestamp, int duration) throws Exception {
Date date = getTimestampFormatter().parse(timestamp);
long sign_time = date.getTime();
long now_time = System.currentTimeMillis();
long diff = now_time - sign_time;
long min_diff = diff / (60 * 1000);
if (min_diff >= duration) {
throw new GeneralSecurityException("Authorization token has expired.");
}
} | java | public static void validateTime(String timestamp, int duration) throws Exception {
Date date = getTimestampFormatter().parse(timestamp);
long sign_time = date.getTime();
long now_time = System.currentTimeMillis();
long diff = now_time - sign_time;
long min_diff = diff / (60 * 1000);
if (min_diff >= duration) {
throw new GeneralSecurityException("Authorization token has expired.");
}
} | [
"public",
"static",
"void",
"validateTime",
"(",
"String",
"timestamp",
",",
"int",
"duration",
")",
"throws",
"Exception",
"{",
"Date",
"date",
"=",
"getTimestampFormatter",
"(",
")",
".",
"parse",
"(",
"timestamp",
")",
";",
"long",
"sign_time",
"=",
"date... | Validates the timestamp and insures that it falls within the specified duration.
@param timestamp Timestamp in yyyyMMddHHmmssz format.
@param duration Validity duration in minutes.
@throws Exception Unspecified exception. | [
"Validates",
"the",
"timestamp",
"and",
"insures",
"that",
"it",
"falls",
"within",
"the",
"specified",
"duration",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java#L140-L150 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/gui2/Panel.java | Panel.addComponent | public Panel addComponent(Component component, LayoutData layoutData) {
if(component != null) {
component.setLayoutData(layoutData);
addComponent(component);
}
return this;
} | java | public Panel addComponent(Component component, LayoutData layoutData) {
if(component != null) {
component.setLayoutData(layoutData);
addComponent(component);
}
return this;
} | [
"public",
"Panel",
"addComponent",
"(",
"Component",
"component",
",",
"LayoutData",
"layoutData",
")",
"{",
"if",
"(",
"component",
"!=",
"null",
")",
"{",
"component",
".",
"setLayoutData",
"(",
"layoutData",
")",
";",
"addComponent",
"(",
"component",
")",
... | This method is a shortcut for calling:
<pre>
{@code
component.setLayoutData(layoutData);
panel.addComponent(component);
}
</pre>
@param component Component to add to the panel
@param layoutData Layout data to assign to the component
@return Itself | [
"This",
"method",
"is",
"a",
"shortcut",
"for",
"calling",
":",
"<pre",
">",
"{"
] | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/Panel.java#L116-L122 |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/WorkspacesApi.java | WorkspacesApi.listWorkspaceFilePages | public PageImages listWorkspaceFilePages(String accountId, String workspaceId, String folderId, String fileId) throws ApiException {
return listWorkspaceFilePages(accountId, workspaceId, folderId, fileId, null);
} | java | public PageImages listWorkspaceFilePages(String accountId, String workspaceId, String folderId, String fileId) throws ApiException {
return listWorkspaceFilePages(accountId, workspaceId, folderId, fileId, null);
} | [
"public",
"PageImages",
"listWorkspaceFilePages",
"(",
"String",
"accountId",
",",
"String",
"workspaceId",
",",
"String",
"folderId",
",",
"String",
"fileId",
")",
"throws",
"ApiException",
"{",
"return",
"listWorkspaceFilePages",
"(",
"accountId",
",",
"workspaceId"... | List File Pages
Retrieves a workspace file as rasterized pages.
@param accountId The external account number (int) or account ID Guid. (required)
@param workspaceId Specifies the workspace ID GUID. (required)
@param folderId The ID of the folder being accessed. (required)
@param fileId Specifies the room file ID GUID. (required)
@return PageImages | [
"List",
"File",
"Pages",
"Retrieves",
"a",
"workspace",
"file",
"as",
"rasterized",
"pages",
"."
] | train | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/WorkspacesApi.java#L477-L479 |
geomajas/geomajas-project-client-gwt | client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java | SvgGraphicsContext.setSize | public void setSize(int newWidth, int newHeight) {
this.width = newWidth;
this.height = newHeight;
if (helper.getRootElement() != null) {
String sWidth = Integer.toString(newWidth);
String sHeight = Integer.toString(newHeight);
Dom.setElementAttribute(helper.getRootElement(), "width", sWidth);
Dom.setElementAttribute(helper.getRootElement(), "height", sHeight);
Dom.setElementAttribute(helper.getRootElement(), "viewBox", "0 0 " + sWidth + " " + sHeight);
}
} | java | public void setSize(int newWidth, int newHeight) {
this.width = newWidth;
this.height = newHeight;
if (helper.getRootElement() != null) {
String sWidth = Integer.toString(newWidth);
String sHeight = Integer.toString(newHeight);
Dom.setElementAttribute(helper.getRootElement(), "width", sWidth);
Dom.setElementAttribute(helper.getRootElement(), "height", sHeight);
Dom.setElementAttribute(helper.getRootElement(), "viewBox", "0 0 " + sWidth + " " + sHeight);
}
} | [
"public",
"void",
"setSize",
"(",
"int",
"newWidth",
",",
"int",
"newHeight",
")",
"{",
"this",
".",
"width",
"=",
"newWidth",
";",
"this",
".",
"height",
"=",
"newHeight",
";",
"if",
"(",
"helper",
".",
"getRootElement",
"(",
")",
"!=",
"null",
")",
... | Apply a new size on the graphics context.
@param newWidth
The new newWidth in pixels for this graphics context.
@param newHeight
The new newHeight in pixels for this graphics context. | [
"Apply",
"a",
"new",
"size",
"on",
"the",
"graphics",
"context",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/SvgGraphicsContext.java#L709-L720 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/log/AbstractLogAdapter.java | AbstractLogAdapter.throwError | protected void throwError(final MessageItem messageItem, final Throwable t, final Object... parameters) {
if (messageItem.getLevel() == JRLevel.Exception ||
messageItem.getLevel() == JRLevel.Error && CoreParameters.DEVELOPER_MODE.get()) {
throw new CoreRuntimeException(messageItem, t, parameters);
}
} | java | protected void throwError(final MessageItem messageItem, final Throwable t, final Object... parameters) {
if (messageItem.getLevel() == JRLevel.Exception ||
messageItem.getLevel() == JRLevel.Error && CoreParameters.DEVELOPER_MODE.get()) {
throw new CoreRuntimeException(messageItem, t, parameters);
}
} | [
"protected",
"void",
"throwError",
"(",
"final",
"MessageItem",
"messageItem",
",",
"final",
"Throwable",
"t",
",",
"final",
"Object",
"...",
"parameters",
")",
"{",
"if",
"(",
"messageItem",
".",
"getLevel",
"(",
")",
"==",
"JRLevel",
".",
"Exception",
"||"... | If an error is logged when running in Developer Mode, Throw a Runtime Exception.
When an exception is logged and when an error is logged and we are running in Developer Mode
@param messageItem the message to display for the exception thrown
@param t the throwable source (could be null)
@param parameters the message parameters | [
"If",
"an",
"error",
"is",
"logged",
"when",
"running",
"in",
"Developer",
"Mode",
"Throw",
"a",
"Runtime",
"Exception",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/log/AbstractLogAdapter.java#L46-L51 |
mgm-tp/jfunk | jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptContext.java | ScriptContext.setToFormEntry | @Cmd
public void setToFormEntry(final String configProperty, final String dataSetKey, final String entryKey) {
String resolvedConfigProperty = resolveProperty(configProperty);
String resolvedDataSetKey = resolveProperty(dataSetKey);
String resolvedEntryKey = resolveProperty(entryKey);
DataSet dataSet = dataSourceProvider.get().getCurrentDataSet(resolvedDataSetKey);
if (dataSet == null) {
throw new IllegalStateException("DataSet " + resolvedDataSetKey + " was null.");
}
String value = dataSet.getValue(resolvedEntryKey);
log.info("Setting property '{}' to '{}'", resolvedConfigProperty, value);
config.put(resolvedConfigProperty, value);
} | java | @Cmd
public void setToFormEntry(final String configProperty, final String dataSetKey, final String entryKey) {
String resolvedConfigProperty = resolveProperty(configProperty);
String resolvedDataSetKey = resolveProperty(dataSetKey);
String resolvedEntryKey = resolveProperty(entryKey);
DataSet dataSet = dataSourceProvider.get().getCurrentDataSet(resolvedDataSetKey);
if (dataSet == null) {
throw new IllegalStateException("DataSet " + resolvedDataSetKey + " was null.");
}
String value = dataSet.getValue(resolvedEntryKey);
log.info("Setting property '{}' to '{}'", resolvedConfigProperty, value);
config.put(resolvedConfigProperty, value);
} | [
"@",
"Cmd",
"public",
"void",
"setToFormEntry",
"(",
"final",
"String",
"configProperty",
",",
"final",
"String",
"dataSetKey",
",",
"final",
"String",
"entryKey",
")",
"{",
"String",
"resolvedConfigProperty",
"=",
"resolveProperty",
"(",
"configProperty",
")",
";... | Sets a {@link DataSet} entry from a configuration property.
@param configProperty
the configuration key
@param dataSetKey
the {@link DataSet} key
@param entryKey
the key of the {@link DataSet} entry | [
"Sets",
"a",
"{",
"@link",
"DataSet",
"}",
"entry",
"from",
"a",
"configuration",
"property",
"."
] | train | https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/scripting/ScriptContext.java#L883-L897 |
unbescape/unbescape | src/main/java/org/unbescape/java/JavaEscape.java | JavaEscape.unescapeJava | public static void unescapeJava(final Reader reader, final Writer writer)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
JavaEscapeUtil.unescape(reader, writer);
} | java | public static void unescapeJava(final Reader reader, final Writer writer)
throws IOException {
if (writer == null) {
throw new IllegalArgumentException("Argument 'writer' cannot be null");
}
JavaEscapeUtil.unescape(reader, writer);
} | [
"public",
"static",
"void",
"unescapeJava",
"(",
"final",
"Reader",
"reader",
",",
"final",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Argument 'writer' ... | <p>
Perform a Java <strong>unescape</strong> operation on a <tt>Reader</tt> input, writing results
to a <tt>Writer</tt>.
</p>
<p>
No additional configuration arguments are required. Unescape operations
will always perform <em>complete</em> Java unescape of SECs, u-based and octal escapes.
</p>
<p>
This method is <strong>thread-safe</strong>.
</p>
@param reader the <tt>Reader</tt> reading the text to be unescaped.
@param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will
be written at all to this writer if input is <tt>null</tt>.
@throws IOException if an input/output exception occurs
@since 1.1.2 | [
"<p",
">",
"Perform",
"a",
"Java",
"<strong",
">",
"unescape<",
"/",
"strong",
">",
"operation",
"on",
"a",
"<tt",
">",
"Reader<",
"/",
"tt",
">",
"input",
"writing",
"results",
"to",
"a",
"<tt",
">",
"Writer<",
"/",
"tt",
">",
".",
"<",
"/",
"p",
... | train | https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/java/JavaEscape.java#L918-L927 |
EXIficient/exificient-core | src/main/java/com/siemens/ct/exi/core/values/DateTimeValue.java | DateTimeValue.setMonthDay | protected static void setMonthDay(int monthDay, Calendar cal) {
// monthDay = month * 32 + day;
int month = monthDay / MONTH_MULTIPLICATOR;
cal.set(Calendar.MONTH, month - 1);
int day = monthDay - month * MONTH_MULTIPLICATOR;
cal.set(Calendar.DAY_OF_MONTH, day);
} | java | protected static void setMonthDay(int monthDay, Calendar cal) {
// monthDay = month * 32 + day;
int month = monthDay / MONTH_MULTIPLICATOR;
cal.set(Calendar.MONTH, month - 1);
int day = monthDay - month * MONTH_MULTIPLICATOR;
cal.set(Calendar.DAY_OF_MONTH, day);
} | [
"protected",
"static",
"void",
"setMonthDay",
"(",
"int",
"monthDay",
",",
"Calendar",
"cal",
")",
"{",
"// monthDay = month * 32 + day;",
"int",
"month",
"=",
"monthDay",
"/",
"MONTH_MULTIPLICATOR",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"MONTH",
",",
... | Sets month and day of the given calendar making use of of the monthDay
representation defined in EXI format
@param monthDay
monthDay
@param cal
calendar | [
"Sets",
"month",
"and",
"day",
"of",
"the",
"given",
"calendar",
"making",
"use",
"of",
"of",
"the",
"monthDay",
"representation",
"defined",
"in",
"EXI",
"format"
] | train | https://github.com/EXIficient/exificient-core/blob/b6026c5fd39e9cc3d7874caa20f084e264e0ddc7/src/main/java/com/siemens/ct/exi/core/values/DateTimeValue.java#L488-L494 |
reactor/reactor-netty | src/main/java/reactor/netty/http/Cookies.java | Cookies.newServerRequestHolder | public static Cookies newServerRequestHolder(HttpHeaders headers, ServerCookieDecoder decoder) {
return new Cookies(headers, HttpHeaderNames.COOKIE, false, decoder);
} | java | public static Cookies newServerRequestHolder(HttpHeaders headers, ServerCookieDecoder decoder) {
return new Cookies(headers, HttpHeaderNames.COOKIE, false, decoder);
} | [
"public",
"static",
"Cookies",
"newServerRequestHolder",
"(",
"HttpHeaders",
"headers",
",",
"ServerCookieDecoder",
"decoder",
")",
"{",
"return",
"new",
"Cookies",
"(",
"headers",
",",
"HttpHeaderNames",
".",
"COOKIE",
",",
"false",
",",
"decoder",
")",
";",
"}... | Return a new cookies holder from server request headers
@param headers server request headers
@return a new cookies holder from server request headers | [
"Return",
"a",
"new",
"cookies",
"holder",
"from",
"server",
"request",
"headers"
] | train | https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/http/Cookies.java#L55-L57 |
apache/incubator-heron | heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java | SchedulerStateManagerAdaptor.getTopology | public TopologyAPI.Topology getTopology(String topologyName) {
return awaitResult(delegate.getTopology(null, topologyName));
} | java | public TopologyAPI.Topology getTopology(String topologyName) {
return awaitResult(delegate.getTopology(null, topologyName));
} | [
"public",
"TopologyAPI",
".",
"Topology",
"getTopology",
"(",
"String",
"topologyName",
")",
"{",
"return",
"awaitResult",
"(",
"delegate",
".",
"getTopology",
"(",
"null",
",",
"topologyName",
")",
")",
";",
"}"
] | Get the topology definition for the given topology
@return Topology | [
"Get",
"the",
"topology",
"definition",
"for",
"the",
"given",
"topology"
] | train | https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java#L275-L277 |
igniterealtime/Smack | smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpPubSubUtil.java | OpenPgpPubSubUtil.depositSecretKey | public static void depositSecretKey(XMPPConnection connection, SecretkeyElement element)
throws InterruptedException, PubSubException.NotALeafNodeException,
XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException,
SmackException.FeatureNotSupportedException {
if (!OpenPgpManager.serverSupportsSecretKeyBackups(connection)) {
throw new SmackException.FeatureNotSupportedException("http://jabber.org/protocol/pubsub#access-whitelist");
}
PubSubManager pm = PepManager.getInstanceFor(connection).getPepPubSubManager();
LeafNode secretKeyNode = pm.getOrCreateLeafNode(PEP_NODE_SECRET_KEY);
OpenPgpPubSubUtil.changeAccessModelIfNecessary(secretKeyNode, AccessModel.whitelist);
secretKeyNode.publish(new PayloadItem<>(element));
} | java | public static void depositSecretKey(XMPPConnection connection, SecretkeyElement element)
throws InterruptedException, PubSubException.NotALeafNodeException,
XMPPException.XMPPErrorException, SmackException.NotConnectedException, SmackException.NoResponseException,
SmackException.FeatureNotSupportedException {
if (!OpenPgpManager.serverSupportsSecretKeyBackups(connection)) {
throw new SmackException.FeatureNotSupportedException("http://jabber.org/protocol/pubsub#access-whitelist");
}
PubSubManager pm = PepManager.getInstanceFor(connection).getPepPubSubManager();
LeafNode secretKeyNode = pm.getOrCreateLeafNode(PEP_NODE_SECRET_KEY);
OpenPgpPubSubUtil.changeAccessModelIfNecessary(secretKeyNode, AccessModel.whitelist);
secretKeyNode.publish(new PayloadItem<>(element));
} | [
"public",
"static",
"void",
"depositSecretKey",
"(",
"XMPPConnection",
"connection",
",",
"SecretkeyElement",
"element",
")",
"throws",
"InterruptedException",
",",
"PubSubException",
".",
"NotALeafNodeException",
",",
"XMPPException",
".",
"XMPPErrorException",
",",
"Sma... | Publishes a {@link SecretkeyElement} to the secret key node.
The node will be configured to use the whitelist access model to prevent access from subscribers.
@see <a href="https://xmpp.org/extensions/xep-0373.html#synchro-pep">
XEP-0373 §5. Synchronizing the Secret Key with a Private PEP Node</a>
@param connection {@link XMPPConnection} of the user
@param element a {@link SecretkeyElement} containing the encrypted secret key of the user
@throws InterruptedException if the thread gets interrupted.
@throws PubSubException.NotALeafNodeException if something is wrong with the PubSub node
@throws XMPPException.XMPPErrorException in case of an protocol related error
@throws SmackException.NotConnectedException if we are not connected
@throws SmackException.NoResponseException /watch?v=0peBq89ZTrc
@throws SmackException.FeatureNotSupportedException if the Server doesn't support the whitelist access model | [
"Publishes",
"a",
"{",
"@link",
"SecretkeyElement",
"}",
"to",
"the",
"secret",
"key",
"node",
".",
"The",
"node",
"will",
"be",
"configured",
"to",
"use",
"the",
"whitelist",
"access",
"model",
"to",
"prevent",
"access",
"from",
"subscribers",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpPubSubUtil.java#L342-L354 |
elki-project/elki | elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/AbstractRStarTree.java | AbstractRStarTree.insertDirectoryEntry | protected void insertDirectoryEntry(E entry, int depth) {
lastInsertedEntry = entry;
// choose node for insertion of o
IndexTreePath<E> subtree = choosePath(getRootPath(), entry, depth, 1);
if(getLogger().isDebugging()) {
getLogger().debugFine("subtree " + subtree);
}
N parent = getNode(subtree.getEntry());
parent.addDirectoryEntry(entry);
writeNode(parent);
// adjust the tree from subtree to root
adjustTree(subtree);
} | java | protected void insertDirectoryEntry(E entry, int depth) {
lastInsertedEntry = entry;
// choose node for insertion of o
IndexTreePath<E> subtree = choosePath(getRootPath(), entry, depth, 1);
if(getLogger().isDebugging()) {
getLogger().debugFine("subtree " + subtree);
}
N parent = getNode(subtree.getEntry());
parent.addDirectoryEntry(entry);
writeNode(parent);
// adjust the tree from subtree to root
adjustTree(subtree);
} | [
"protected",
"void",
"insertDirectoryEntry",
"(",
"E",
"entry",
",",
"int",
"depth",
")",
"{",
"lastInsertedEntry",
"=",
"entry",
";",
"// choose node for insertion of o",
"IndexTreePath",
"<",
"E",
">",
"subtree",
"=",
"choosePath",
"(",
"getRootPath",
"(",
")",
... | Inserts the specified directory entry at the specified level into this
R*-Tree.
@param entry the directory entry to be inserted
@param depth the depth at which the directory entry is to be inserted | [
"Inserts",
"the",
"specified",
"directory",
"entry",
"at",
"the",
"specified",
"level",
"into",
"this",
"R",
"*",
"-",
"Tree",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-rtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/spatial/rstarvariants/AbstractRStarTree.java#L182-L196 |
menacher/java-game-server | jetclient/src/main/java/org/menacheri/jetclient/communication/NettyTCPMessageSender.java | NettyTCPMessageSender.closeAfterFlushingPendingWrites | public void closeAfterFlushingPendingWrites(Channel channel, Event event)
{
if (channel.isConnected())
{
channel.write(event).addListener(ChannelFutureListener.CLOSE);
}
else
{
System.err.println("Unable to write the Event :" + event
+ " to socket as channel is ot connected");
}
} | java | public void closeAfterFlushingPendingWrites(Channel channel, Event event)
{
if (channel.isConnected())
{
channel.write(event).addListener(ChannelFutureListener.CLOSE);
}
else
{
System.err.println("Unable to write the Event :" + event
+ " to socket as channel is ot connected");
}
} | [
"public",
"void",
"closeAfterFlushingPendingWrites",
"(",
"Channel",
"channel",
",",
"Event",
"event",
")",
"{",
"if",
"(",
"channel",
".",
"isConnected",
"(",
")",
")",
"{",
"channel",
".",
"write",
"(",
"event",
")",
".",
"addListener",
"(",
"ChannelFuture... | This method will write an event to the channel and then add a close
listener which will close it after the write has completed.
@param channel
@param event | [
"This",
"method",
"will",
"write",
"an",
"event",
"to",
"the",
"channel",
"and",
"then",
"add",
"a",
"close",
"listener",
"which",
"will",
"close",
"it",
"after",
"the",
"write",
"has",
"completed",
"."
] | train | https://github.com/menacher/java-game-server/blob/668ca49e8bd1dac43add62378cf6c22a93125d48/jetclient/src/main/java/org/menacheri/jetclient/communication/NettyTCPMessageSender.java#L78-L89 |
OpenLiberty/open-liberty | dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/ChunkStepControllerImpl.java | ChunkStepControllerImpl.publishCheckpointEvent | private void publishCheckpointEvent(String stepName, long jobInstanceId, long jobExecutionId, long stepExecutionId) {
BatchEventsPublisher publisher = getBatchEventsPublisher();
if (publisher != null) {
String correlationId = runtimeWorkUnitExecution.getCorrelationId();
publisher.publishCheckpointEvent(stepName, jobInstanceId, jobExecutionId, stepExecutionId, correlationId);
}
} | java | private void publishCheckpointEvent(String stepName, long jobInstanceId, long jobExecutionId, long stepExecutionId) {
BatchEventsPublisher publisher = getBatchEventsPublisher();
if (publisher != null) {
String correlationId = runtimeWorkUnitExecution.getCorrelationId();
publisher.publishCheckpointEvent(stepName, jobInstanceId, jobExecutionId, stepExecutionId, correlationId);
}
} | [
"private",
"void",
"publishCheckpointEvent",
"(",
"String",
"stepName",
",",
"long",
"jobInstanceId",
",",
"long",
"jobExecutionId",
",",
"long",
"stepExecutionId",
")",
"{",
"BatchEventsPublisher",
"publisher",
"=",
"getBatchEventsPublisher",
"(",
")",
";",
"if",
"... | Helper method to publish checkpoint event
@param stepName
@param jobInstanceId
@param jobExecutionId | [
"Helper",
"method",
"to",
"publish",
"checkpoint",
"event"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/ChunkStepControllerImpl.java#L718-L725 |
code4everything/util | src/main/java/com/zhazhapan/util/RandomUtils.java | RandomUtils.getRandomDouble | public static double getRandomDouble(double floor, double ceil, int precision) {
BigDecimal decimal = new BigDecimal(floor + new Random().nextDouble() * (ceil - floor));
return decimal.setScale(precision, RoundingMode.HALF_UP).doubleValue();
} | java | public static double getRandomDouble(double floor, double ceil, int precision) {
BigDecimal decimal = new BigDecimal(floor + new Random().nextDouble() * (ceil - floor));
return decimal.setScale(precision, RoundingMode.HALF_UP).doubleValue();
} | [
"public",
"static",
"double",
"getRandomDouble",
"(",
"double",
"floor",
",",
"double",
"ceil",
",",
"int",
"precision",
")",
"{",
"BigDecimal",
"decimal",
"=",
"new",
"BigDecimal",
"(",
"floor",
"+",
"new",
"Random",
"(",
")",
".",
"nextDouble",
"(",
")",... | 获取随机浮点数
@param floor 下限
@param ceil 上限
@param precision 精度(小数位数)
@return {@link Double} | [
"获取随机浮点数"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/RandomUtils.java#L171-L174 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java | SquareRegularClustersIntoGrids.pickNot | static SquareNode pickNot( SquareNode target , SquareNode child ) {
for (int i = 0; i < 4; i++) {
SquareEdge e = target.edges[i];
if( e == null )
continue;
SquareNode c = e.destination(target);
if( c != child )
return c;
}
throw new RuntimeException("There was no odd one out some how");
} | java | static SquareNode pickNot( SquareNode target , SquareNode child ) {
for (int i = 0; i < 4; i++) {
SquareEdge e = target.edges[i];
if( e == null )
continue;
SquareNode c = e.destination(target);
if( c != child )
return c;
}
throw new RuntimeException("There was no odd one out some how");
} | [
"static",
"SquareNode",
"pickNot",
"(",
"SquareNode",
"target",
",",
"SquareNode",
"child",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"4",
";",
"i",
"++",
")",
"{",
"SquareEdge",
"e",
"=",
"target",
".",
"edges",
"[",
"i",
"]",
"... | There are only two edges on target. Pick the edge which does not go to the provided child | [
"There",
"are",
"only",
"two",
"edges",
"on",
"target",
".",
"Pick",
"the",
"edge",
"which",
"does",
"not",
"go",
"to",
"the",
"provided",
"child"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/calib/squares/SquareRegularClustersIntoGrids.java#L334-L344 |
stephanenicolas/robospice | robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java | SpiceManager.getFromCacheAndLoadFromNetworkIfExpired | public <T> void getFromCacheAndLoadFromNetworkIfExpired(final SpiceRequest<T> request, final Object requestCacheKey, final long cacheExpiryDuration, final RequestListener<T> requestListener) {
final CachedSpiceRequest<T> cachedSpiceRequest = new CachedSpiceRequest<T>(request, requestCacheKey, cacheExpiryDuration);
cachedSpiceRequest.setAcceptingDirtyCache(true);
execute(cachedSpiceRequest, requestListener);
} | java | public <T> void getFromCacheAndLoadFromNetworkIfExpired(final SpiceRequest<T> request, final Object requestCacheKey, final long cacheExpiryDuration, final RequestListener<T> requestListener) {
final CachedSpiceRequest<T> cachedSpiceRequest = new CachedSpiceRequest<T>(request, requestCacheKey, cacheExpiryDuration);
cachedSpiceRequest.setAcceptingDirtyCache(true);
execute(cachedSpiceRequest, requestListener);
} | [
"public",
"<",
"T",
">",
"void",
"getFromCacheAndLoadFromNetworkIfExpired",
"(",
"final",
"SpiceRequest",
"<",
"T",
">",
"request",
",",
"final",
"Object",
"requestCacheKey",
",",
"final",
"long",
"cacheExpiryDuration",
",",
"final",
"RequestListener",
"<",
"T",
"... | Gets data from cache, expired or not, and executes a request normaly.
Before invoking the method {@link SpiceRequest#loadDataFromNetwork()},
the cache will be checked : if a result has been cached with the cache
key <i>requestCacheKey</i>, RoboSpice will consider the parameter
<i>cacheExpiryDuration</i> to determine whether the result in the cache
is expired or not. If it is not expired, then listeners will receive the
data in cache only. If the result is absent or expired, then
{@link SpiceRequest#loadDataFromNetwork()} will be invoked and the result
will be stored in cache using the cache key <i>requestCacheKey</i>.
@param request
the request to execute
@param requestCacheKey
the key used to store and retrieve the result of the request
in the cache
@param cacheExpiryDuration
duration in milliseconds after which the content of the cache
will be considered to be expired.
{@link DurationInMillis#ALWAYS_RETURNED} means data in cache
is always returned if it exists.
{@link DurationInMillis#ALWAYS_EXPIRED} doesn't make much
sense here.
@param requestListener
the listener to notify when the request will finish | [
"Gets",
"data",
"from",
"cache",
"expired",
"or",
"not",
"and",
"executes",
"a",
"request",
"normaly",
".",
"Before",
"invoking",
"the",
"method",
"{"
] | train | https://github.com/stephanenicolas/robospice/blob/8bffde88b3534a961a13cab72a8f07a755f0a0fe/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java#L518-L522 |
ZieIony/Carbon | carbon/src/main/java/carbon/shadow/ShapeAppearanceModel.java | ShapeAppearanceModel.setBottomRightCorner | public void setBottomRightCorner(@CornerFamily int cornerFamily, @Dimension int cornerSize) {
setBottomRightCorner(MaterialShapeUtils.createCornerTreatment(cornerFamily, cornerSize));
} | java | public void setBottomRightCorner(@CornerFamily int cornerFamily, @Dimension int cornerSize) {
setBottomRightCorner(MaterialShapeUtils.createCornerTreatment(cornerFamily, cornerSize));
} | [
"public",
"void",
"setBottomRightCorner",
"(",
"@",
"CornerFamily",
"int",
"cornerFamily",
",",
"@",
"Dimension",
"int",
"cornerSize",
")",
"{",
"setBottomRightCorner",
"(",
"MaterialShapeUtils",
".",
"createCornerTreatment",
"(",
"cornerFamily",
",",
"cornerSize",
")... | Sets the corner treatment for the bottom-right corner.
@param cornerFamily the family to use to create the corner treatment
@param cornerSize the size to use to create the corner treatment | [
"Sets",
"the",
"corner",
"treatment",
"for",
"the",
"bottom",
"-",
"right",
"corner",
"."
] | train | https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/shadow/ShapeAppearanceModel.java#L288-L290 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java | SynchronousRequest.getEventDetailedInfo | public EventDetail getEventDetailedInfo(String id) throws GuildWars2Exception {
isParamValid(new ParamChecker(ParamType.ID, id));
try {
Response<EventDetail> response = gw2API.getEventDetailedInfo(id, GuildWars2.lang.getValue()).execute();
if (!response.isSuccessful()) throwError(response.code(), response.errorBody());
return response.body();
} catch (IOException e) {
throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage());
}
} | java | public EventDetail getEventDetailedInfo(String id) throws GuildWars2Exception {
isParamValid(new ParamChecker(ParamType.ID, id));
try {
Response<EventDetail> response = gw2API.getEventDetailedInfo(id, GuildWars2.lang.getValue()).execute();
if (!response.isSuccessful()) throwError(response.code(), response.errorBody());
return response.body();
} catch (IOException e) {
throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage());
}
} | [
"public",
"EventDetail",
"getEventDetailedInfo",
"(",
"String",
"id",
")",
"throws",
"GuildWars2Exception",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ParamType",
".",
"ID",
",",
"id",
")",
")",
";",
"try",
"{",
"Response",
"<",
"EventDetail",
">",... | For more info on event detail API go <a href="https://wiki.guildwars2.com/wiki/API:1/event_details">here</a><br/>
@param id event id
@return event details
@throws GuildWars2Exception see {@link ErrorCode} for detail
@see EventDetail event detail | [
"For",
"more",
"info",
"on",
"event",
"detail",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"1",
"/",
"event_details",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">"
] | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L79-L88 |
ReactiveX/RxJavaAsyncUtil | src/main/java/rx/util/async/Async.java | Async.fromAction | public static <R> Observable<R> fromAction(Action0 action, R result) {
return fromAction(action, result, Schedulers.computation());
} | java | public static <R> Observable<R> fromAction(Action0 action, R result) {
return fromAction(action, result, Schedulers.computation());
} | [
"public",
"static",
"<",
"R",
">",
"Observable",
"<",
"R",
">",
"fromAction",
"(",
"Action0",
"action",
",",
"R",
"result",
")",
"{",
"return",
"fromAction",
"(",
"action",
",",
"result",
",",
"Schedulers",
".",
"computation",
"(",
")",
")",
";",
"}"
] | Return an Observable that calls the given action and emits the given result when an Observer subscribes.
<p>
<img width="640" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/fromAction.png" alt="">
<p>
The action is run on the default thread pool for computation.
@param <R> the return type
@param action the action to invoke on each subscription
@param result the result to emit to observers
@return an Observable that calls the given action and emits the given result when an Observer subscribes
@see <a href="https://github.com/ReactiveX/RxJava/wiki/Async-Operators#wiki-fromaction">RxJava Wiki: fromAction()</a> | [
"Return",
"an",
"Observable",
"that",
"calls",
"the",
"given",
"action",
"and",
"emits",
"the",
"given",
"result",
"when",
"an",
"Observer",
"subscribes",
".",
"<p",
">",
"<img",
"width",
"=",
"640",
"src",
"=",
"https",
":",
"//",
"raw",
".",
"github",
... | train | https://github.com/ReactiveX/RxJavaAsyncUtil/blob/6294e1da30e639df79f76399906229314c14e74d/src/main/java/rx/util/async/Async.java#L1987-L1989 |
Azure/azure-sdk-for-java | automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscConfigurationsInner.java | DscConfigurationsInner.listByAutomationAccountAsync | public Observable<Page<DscConfigurationInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName, final String filter, final Integer skip, final Integer top, final String inlinecount) {
return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName, filter, skip, top, inlinecount)
.map(new Func1<ServiceResponse<Page<DscConfigurationInner>>, Page<DscConfigurationInner>>() {
@Override
public Page<DscConfigurationInner> call(ServiceResponse<Page<DscConfigurationInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<DscConfigurationInner>> listByAutomationAccountAsync(final String resourceGroupName, final String automationAccountName, final String filter, final Integer skip, final Integer top, final String inlinecount) {
return listByAutomationAccountWithServiceResponseAsync(resourceGroupName, automationAccountName, filter, skip, top, inlinecount)
.map(new Func1<ServiceResponse<Page<DscConfigurationInner>>, Page<DscConfigurationInner>>() {
@Override
public Page<DscConfigurationInner> call(ServiceResponse<Page<DscConfigurationInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"DscConfigurationInner",
">",
">",
"listByAutomationAccountAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"automationAccountName",
",",
"final",
"String",
"filter",
",",
"final",
"Integer",
"skip"... | Retrieve a list of configurations.
@param resourceGroupName Name of an Azure Resource group.
@param automationAccountName The name of the automation account.
@param filter The filter to apply on the operation.
@param skip The number of rows to skip.
@param top The the number of rows to take.
@param inlinecount Return total rows.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DscConfigurationInner> object | [
"Retrieve",
"a",
"list",
"of",
"configurations",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscConfigurationsInner.java#L830-L838 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java | FSDataset.isBlockFinalizedWithLock | private boolean isBlockFinalizedWithLock(int namespaceId, Block b) {
lock.readLock().lock();
try {
return isBlockFinalizedInternal(namespaceId, b, true);
} finally {
lock.readLock().unlock();
}
} | java | private boolean isBlockFinalizedWithLock(int namespaceId, Block b) {
lock.readLock().lock();
try {
return isBlockFinalizedInternal(namespaceId, b, true);
} finally {
lock.readLock().unlock();
}
} | [
"private",
"boolean",
"isBlockFinalizedWithLock",
"(",
"int",
"namespaceId",
",",
"Block",
"b",
")",
"{",
"lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"isBlockFinalizedInternal",
"(",
"namespaceId",
",",
"b",
",",
"t... | is this block finalized? Returns true if the block is already
finalized, otherwise returns false. | [
"is",
"this",
"block",
"finalized?",
"Returns",
"true",
"if",
"the",
"block",
"is",
"already",
"finalized",
"otherwise",
"returns",
"false",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/FSDataset.java#L2418-L2425 |
netscaler/sdx_nitro | src/main/java/com/citrix/sdx/nitro/resource/config/xen/disk_adapter.java | disk_adapter.get_nitro_bulk_response | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
disk_adapter_responses result = (disk_adapter_responses) service.get_payload_formatter().string_to_resource(disk_adapter_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.disk_adapter_response_array);
}
disk_adapter[] result_disk_adapter = new disk_adapter[result.disk_adapter_response_array.length];
for(int i = 0; i < result.disk_adapter_response_array.length; i++)
{
result_disk_adapter[i] = result.disk_adapter_response_array[i].disk_adapter[0];
}
return result_disk_adapter;
} | java | protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception
{
disk_adapter_responses result = (disk_adapter_responses) service.get_payload_formatter().string_to_resource(disk_adapter_responses.class, response);
if(result.errorcode != 0)
{
if (result.errorcode == SESSION_NOT_EXISTS)
service.clear_session();
throw new nitro_exception(result.message, result.errorcode, (base_response [])result.disk_adapter_response_array);
}
disk_adapter[] result_disk_adapter = new disk_adapter[result.disk_adapter_response_array.length];
for(int i = 0; i < result.disk_adapter_response_array.length; i++)
{
result_disk_adapter[i] = result.disk_adapter_response_array[i].disk_adapter[0];
}
return result_disk_adapter;
} | [
"protected",
"base_resource",
"[",
"]",
"get_nitro_bulk_response",
"(",
"nitro_service",
"service",
",",
"String",
"response",
")",
"throws",
"Exception",
"{",
"disk_adapter_responses",
"result",
"=",
"(",
"disk_adapter_responses",
")",
"service",
".",
"get_payload_form... | <pre>
Converts API response of bulk operation into object and returns the object array in case of get request.
</pre> | [
"<pre",
">",
"Converts",
"API",
"response",
"of",
"bulk",
"operation",
"into",
"object",
"and",
"returns",
"the",
"object",
"array",
"in",
"case",
"of",
"get",
"request",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/disk_adapter.java#L244-L261 |
op4j/op4j | src/main/java/org/op4j/functions/FnString.java | FnString.toBigDecimal | public static final Function<String,BigDecimal> toBigDecimal(final int scale, final RoundingMode roundingMode, final Locale locale) {
return new ToBigDecimal(scale, roundingMode, locale);
} | java | public static final Function<String,BigDecimal> toBigDecimal(final int scale, final RoundingMode roundingMode, final Locale locale) {
return new ToBigDecimal(scale, roundingMode, locale);
} | [
"public",
"static",
"final",
"Function",
"<",
"String",
",",
"BigDecimal",
">",
"toBigDecimal",
"(",
"final",
"int",
"scale",
",",
"final",
"RoundingMode",
"roundingMode",
",",
"final",
"Locale",
"locale",
")",
"{",
"return",
"new",
"ToBigDecimal",
"(",
"scale... | <p>
Converts a String into a BigDecimal, using the specified locale for decimal
point and thousands separator configuration and establishing the specified scale. Rounding
mode is used for setting the scale to the specified value.
</p>
@param scale the desired scale for the resulting BigDecimal object
@param roundingMode the rounding mode to be used when setting the scale
@param locale the locale defining the way in which the number was written
@return the resulting BigDecimal object | [
"<p",
">",
"Converts",
"a",
"String",
"into",
"a",
"BigDecimal",
"using",
"the",
"specified",
"locale",
"for",
"decimal",
"point",
"and",
"thousands",
"separator",
"configuration",
"and",
"establishing",
"the",
"specified",
"scale",
".",
"Rounding",
"mode",
"is"... | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L221-L223 |
Appendium/objectlabkit | datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java | WorkingWeek.withWorkingDayFromCalendar | public WorkingWeek withWorkingDayFromCalendar(final boolean working, final int dayOfWeek) {
final int day = adjustDay(dayOfWeek);
WorkingWeek ret = this;
if (working && !isWorkingDayFromCalendar(dayOfWeek)) {
ret = new WorkingWeek((byte) (workingDays + WORKING_WEEK_DAYS_OFFSET[day]));
} else if (!working && isWorkingDayFromCalendar(dayOfWeek)) {
ret = new WorkingWeek((byte) (workingDays - WORKING_WEEK_DAYS_OFFSET[day]));
}
return ret;
} | java | public WorkingWeek withWorkingDayFromCalendar(final boolean working, final int dayOfWeek) {
final int day = adjustDay(dayOfWeek);
WorkingWeek ret = this;
if (working && !isWorkingDayFromCalendar(dayOfWeek)) {
ret = new WorkingWeek((byte) (workingDays + WORKING_WEEK_DAYS_OFFSET[day]));
} else if (!working && isWorkingDayFromCalendar(dayOfWeek)) {
ret = new WorkingWeek((byte) (workingDays - WORKING_WEEK_DAYS_OFFSET[day]));
}
return ret;
} | [
"public",
"WorkingWeek",
"withWorkingDayFromCalendar",
"(",
"final",
"boolean",
"working",
",",
"final",
"int",
"dayOfWeek",
")",
"{",
"final",
"int",
"day",
"=",
"adjustDay",
"(",
"dayOfWeek",
")",
";",
"WorkingWeek",
"ret",
"=",
"this",
";",
"if",
"(",
"wo... | If the value for the given day has changed, return a NEW WorkingWeek.
@param working
true if working day
@param dayOfWeek
e.g. Calendar.MONDAY, Calendar.TUESDAY, etc
@return a new instance of a <code>WorkingWeek</code> with the working
day set | [
"If",
"the",
"value",
"for",
"the",
"given",
"day",
"has",
"changed",
"return",
"a",
"NEW",
"WorkingWeek",
"."
] | train | https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/datecalc-common/src/main/java/net/objectlab/kit/datecalc/common/WorkingWeek.java#L133-L142 |
SonarSource/sonarqube | server/sonar-db-dao/src/main/java/org/sonar/db/permission/GroupPermissionDao.java | GroupPermissionDao.deleteByRootComponentIdAndPermission | public int deleteByRootComponentIdAndPermission(DbSession dbSession, long rootComponentId, String permission) {
return mapper(dbSession).deleteByRootComponentIdAndPermission(rootComponentId, permission);
} | java | public int deleteByRootComponentIdAndPermission(DbSession dbSession, long rootComponentId, String permission) {
return mapper(dbSession).deleteByRootComponentIdAndPermission(rootComponentId, permission);
} | [
"public",
"int",
"deleteByRootComponentIdAndPermission",
"(",
"DbSession",
"dbSession",
",",
"long",
"rootComponentId",
",",
"String",
"permission",
")",
"{",
"return",
"mapper",
"(",
"dbSession",
")",
".",
"deleteByRootComponentIdAndPermission",
"(",
"rootComponentId",
... | Delete the specified permission for the specified component for any group (including group AnyOne). | [
"Delete",
"the",
"specified",
"permission",
"for",
"the",
"specified",
"component",
"for",
"any",
"group",
"(",
"including",
"group",
"AnyOne",
")",
"."
] | train | https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/permission/GroupPermissionDao.java#L162-L164 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/TextModerationsImpl.java | TextModerationsImpl.screenTextAsync | public Observable<Screen> screenTextAsync(String textContentType, byte[] textContent, ScreenTextOptionalParameter screenTextOptionalParameter) {
return screenTextWithServiceResponseAsync(textContentType, textContent, screenTextOptionalParameter).map(new Func1<ServiceResponse<Screen>, Screen>() {
@Override
public Screen call(ServiceResponse<Screen> response) {
return response.body();
}
});
} | java | public Observable<Screen> screenTextAsync(String textContentType, byte[] textContent, ScreenTextOptionalParameter screenTextOptionalParameter) {
return screenTextWithServiceResponseAsync(textContentType, textContent, screenTextOptionalParameter).map(new Func1<ServiceResponse<Screen>, Screen>() {
@Override
public Screen call(ServiceResponse<Screen> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Screen",
">",
"screenTextAsync",
"(",
"String",
"textContentType",
",",
"byte",
"[",
"]",
"textContent",
",",
"ScreenTextOptionalParameter",
"screenTextOptionalParameter",
")",
"{",
"return",
"screenTextWithServiceResponseAsync",
"(",
"textCo... | Detect profanity and match against custom and shared blacklists.
Detects profanity in more than 100 languages and match against custom and shared blacklists.
@param textContentType The content type. Possible values include: 'text/plain', 'text/html', 'text/xml', 'text/markdown'
@param textContent Content to screen.
@param screenTextOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the Screen object | [
"Detect",
"profanity",
"and",
"match",
"against",
"custom",
"and",
"shared",
"blacklists",
".",
"Detects",
"profanity",
"in",
"more",
"than",
"100",
"languages",
"and",
"match",
"against",
"custom",
"and",
"shared",
"blacklists",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/TextModerationsImpl.java#L113-L120 |
oasp/oasp4j | modules/jpa-envers/src/main/java/io/oasp/module/jpa/dataaccess/base/AbstractGenericRevisionedDao.java | AbstractGenericRevisionedDao.loadRevision | protected ENTITY loadRevision(Object id, Number revision) {
Class<? extends ENTITY> entityClassImplementation = getEntityClass();
ENTITY entity = getAuditReader().find(entityClassImplementation, id, revision);
if (entity != null) {
entity.setRevision(revision);
}
return entity;
} | java | protected ENTITY loadRevision(Object id, Number revision) {
Class<? extends ENTITY> entityClassImplementation = getEntityClass();
ENTITY entity = getAuditReader().find(entityClassImplementation, id, revision);
if (entity != null) {
entity.setRevision(revision);
}
return entity;
} | [
"protected",
"ENTITY",
"loadRevision",
"(",
"Object",
"id",
",",
"Number",
"revision",
")",
"{",
"Class",
"<",
"?",
"extends",
"ENTITY",
">",
"entityClassImplementation",
"=",
"getEntityClass",
"(",
")",
";",
"ENTITY",
"entity",
"=",
"getAuditReader",
"(",
")"... | This method gets a historic revision of the {@link net.sf.mmm.util.entity.api.GenericEntity} with the given
<code>id</code>.
@param id is the {@link net.sf.mmm.util.entity.api.GenericEntity#getId() ID} of the requested
{@link net.sf.mmm.util.entity.api.GenericEntity entity}.
@param revision is the {@link MutablePersistenceEntity#getRevision() revision}
@return the requested {@link net.sf.mmm.util.entity.api.GenericEntity entity}. | [
"This",
"method",
"gets",
"a",
"historic",
"revision",
"of",
"the",
"{",
"@link",
"net",
".",
"sf",
".",
"mmm",
".",
"util",
".",
"entity",
".",
"api",
".",
"GenericEntity",
"}",
"with",
"the",
"given",
"<code",
">",
"id<",
"/",
"code",
">",
"."
] | train | https://github.com/oasp/oasp4j/blob/03f90132699fad95e52ec8efa54aa391f8d3c7e4/modules/jpa-envers/src/main/java/io/oasp/module/jpa/dataaccess/base/AbstractGenericRevisionedDao.java#L64-L72 |
aws/aws-sdk-java | aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateRobotRequest.java | CreateRobotRequest.withTags | public CreateRobotRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | java | public CreateRobotRequest withTags(java.util.Map<String, String> tags) {
setTags(tags);
return this;
} | [
"public",
"CreateRobotRequest",
"withTags",
"(",
"java",
".",
"util",
".",
"Map",
"<",
"String",
",",
"String",
">",
"tags",
")",
"{",
"setTags",
"(",
"tags",
")",
";",
"return",
"this",
";",
"}"
] | <p>
A map that contains tag keys and tag values that are attached to the robot.
</p>
@param tags
A map that contains tag keys and tag values that are attached to the robot.
@return Returns a reference to this object so that method calls can be chained together. | [
"<p",
">",
"A",
"map",
"that",
"contains",
"tag",
"keys",
"and",
"tag",
"values",
"that",
"are",
"attached",
"to",
"the",
"robot",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-robomaker/src/main/java/com/amazonaws/services/robomaker/model/CreateRobotRequest.java#L227-L230 |
Azure/azure-sdk-for-java | streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/FunctionsInner.java | FunctionsInner.updateAsync | public Observable<FunctionInner> updateAsync(String resourceGroupName, String jobName, String functionName, FunctionInner function, String ifMatch) {
return updateWithServiceResponseAsync(resourceGroupName, jobName, functionName, function, ifMatch).map(new Func1<ServiceResponseWithHeaders<FunctionInner, FunctionsUpdateHeaders>, FunctionInner>() {
@Override
public FunctionInner call(ServiceResponseWithHeaders<FunctionInner, FunctionsUpdateHeaders> response) {
return response.body();
}
});
} | java | public Observable<FunctionInner> updateAsync(String resourceGroupName, String jobName, String functionName, FunctionInner function, String ifMatch) {
return updateWithServiceResponseAsync(resourceGroupName, jobName, functionName, function, ifMatch).map(new Func1<ServiceResponseWithHeaders<FunctionInner, FunctionsUpdateHeaders>, FunctionInner>() {
@Override
public FunctionInner call(ServiceResponseWithHeaders<FunctionInner, FunctionsUpdateHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"FunctionInner",
">",
"updateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"jobName",
",",
"String",
"functionName",
",",
"FunctionInner",
"function",
",",
"String",
"ifMatch",
")",
"{",
"return",
"updateWithServiceResponseAsy... | Updates an existing function under an existing streaming job. This can be used to partially update (ie. update one or two properties) a function without affecting the rest the job or function definition.
@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 jobName The name of the streaming job.
@param functionName The name of the function.
@param function A function object. The properties specified here will overwrite the corresponding properties in the existing function (ie. Those properties will be updated). Any properties that are set to null here will mean that the corresponding property in the existing function will remain the same and not change as a result of this PATCH operation.
@param ifMatch The ETag of the function. Omit this value to always overwrite the current function. Specify the last-seen ETag value to prevent accidentally overwritting concurrent changes.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the FunctionInner object | [
"Updates",
"an",
"existing",
"function",
"under",
"an",
"existing",
"streaming",
"job",
".",
"This",
"can",
"be",
"used",
"to",
"partially",
"update",
"(",
"ie",
".",
"update",
"one",
"or",
"two",
"properties",
")",
"a",
"function",
"without",
"affecting",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/FunctionsInner.java#L454-L461 |
xm-online/xm-commons | xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/MdcUtils.java | MdcUtils.generateRid | public static String generateRid() {
byte[] encode = Base64.getEncoder().encode(DigestUtils.sha256(UUID.randomUUID().toString()));
try {
String rid = new String(encode, StandardCharsets.UTF_8.name());
rid = StringUtils.replaceChars(rid, "+/=", "");
return StringUtils.right(rid, RID_LENGTH);
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
}
} | java | public static String generateRid() {
byte[] encode = Base64.getEncoder().encode(DigestUtils.sha256(UUID.randomUUID().toString()));
try {
String rid = new String(encode, StandardCharsets.UTF_8.name());
rid = StringUtils.replaceChars(rid, "+/=", "");
return StringUtils.right(rid, RID_LENGTH);
} catch (UnsupportedEncodingException e) {
throw new IllegalStateException(e);
}
} | [
"public",
"static",
"String",
"generateRid",
"(",
")",
"{",
"byte",
"[",
"]",
"encode",
"=",
"Base64",
".",
"getEncoder",
"(",
")",
".",
"encode",
"(",
"DigestUtils",
".",
"sha256",
"(",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toString",
"(",
")",
... | Generates request id based on UID and SHA-256.
@return request identity | [
"Generates",
"request",
"id",
"based",
"on",
"UID",
"and",
"SHA",
"-",
"256",
"."
] | train | https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-logging/src/main/java/com/icthh/xm/commons/logging/util/MdcUtils.java#L82-L91 |
GII/broccoli | broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owl/OWLValueObject.java | OWLValueObject.buildFromOWLValueAndClass | private static OWLValueObject buildFromOWLValueAndClass(OWLModel model, OWLValue value, Class clas) throws NotYetImplementedException, OWLTranslationException {
Object objectValue = ObjectOWLSTranslator.jenaResourceToBean(
model,
(ResourceImpl) value.getImplementation(),
clas);
return new OWLValueObject(model, OWLURIClass.from(objectValue), value);
} | java | private static OWLValueObject buildFromOWLValueAndClass(OWLModel model, OWLValue value, Class clas) throws NotYetImplementedException, OWLTranslationException {
Object objectValue = ObjectOWLSTranslator.jenaResourceToBean(
model,
(ResourceImpl) value.getImplementation(),
clas);
return new OWLValueObject(model, OWLURIClass.from(objectValue), value);
} | [
"private",
"static",
"OWLValueObject",
"buildFromOWLValueAndClass",
"(",
"OWLModel",
"model",
",",
"OWLValue",
"value",
",",
"Class",
"clas",
")",
"throws",
"NotYetImplementedException",
",",
"OWLTranslationException",
"{",
"Object",
"objectValue",
"=",
"ObjectOWLSTransla... | Builds an instance
@param model
@param value
@param clas
@return
@throws NotYetImplementedException
@throws OWLTranslationException | [
"Builds",
"an",
"instance"
] | train | https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owl/OWLValueObject.java#L231-L237 |
alkacon/opencms-core | src/org/opencms/i18n/CmsResourceBundleLoader.java | CmsResourceBundleLoader.tryBundle | private static ResourceBundle tryBundle(String baseName, Locale locale, boolean wantBase) {
I_CmsResourceBundle first = null; // The most specialized bundle.
I_CmsResourceBundle last = null; // The least specialized bundle.
List<String> bundleNames = CmsLocaleManager.getLocaleVariants(baseName, locale, true, true);
for (String bundleName : bundleNames) {
// break if we would try the base bundle, but we do not want it directly
if (bundleName.equals(baseName) && !wantBase && (first == null)) {
break;
}
I_CmsResourceBundle foundBundle = tryBundle(bundleName);
if (foundBundle != null) {
if (first == null) {
first = foundBundle;
}
if (last != null) {
last.setParent((ResourceBundle)foundBundle);
}
foundBundle.setLocale(locale);
last = foundBundle;
}
}
return (ResourceBundle)first;
} | java | private static ResourceBundle tryBundle(String baseName, Locale locale, boolean wantBase) {
I_CmsResourceBundle first = null; // The most specialized bundle.
I_CmsResourceBundle last = null; // The least specialized bundle.
List<String> bundleNames = CmsLocaleManager.getLocaleVariants(baseName, locale, true, true);
for (String bundleName : bundleNames) {
// break if we would try the base bundle, but we do not want it directly
if (bundleName.equals(baseName) && !wantBase && (first == null)) {
break;
}
I_CmsResourceBundle foundBundle = tryBundle(bundleName);
if (foundBundle != null) {
if (first == null) {
first = foundBundle;
}
if (last != null) {
last.setParent((ResourceBundle)foundBundle);
}
foundBundle.setLocale(locale);
last = foundBundle;
}
}
return (ResourceBundle)first;
} | [
"private",
"static",
"ResourceBundle",
"tryBundle",
"(",
"String",
"baseName",
",",
"Locale",
"locale",
",",
"boolean",
"wantBase",
")",
"{",
"I_CmsResourceBundle",
"first",
"=",
"null",
";",
"// The most specialized bundle.",
"I_CmsResourceBundle",
"last",
"=",
"null... | Tries to load a the bundle for a given locale, also loads the backup
locales with the same language.
@param baseName the raw bundle name, without locale qualifiers
@param locale the locale
@param wantBase whether a resource bundle made only from the base name
(with no locale information attached) should be returned.
@return the resource bundle if it was loaded, otherwise the backup | [
"Tries",
"to",
"load",
"a",
"the",
"bundle",
"for",
"a",
"given",
"locale",
"also",
"loads",
"the",
"backup",
"locales",
"with",
"the",
"same",
"language",
"."
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsResourceBundleLoader.java#L424-L450 |
wmdietl/jsr308-langtools | src/share/classes/com/sun/tools/javadoc/DocLocale.java | DocLocale.htmlSentenceTerminatorFound | private boolean htmlSentenceTerminatorFound(String str, int index) {
for (int i = 0; i < sentenceTerminators.length; i++) {
String terminator = sentenceTerminators[i];
if (str.regionMatches(true, index, terminator,
0, terminator.length())) {
return true;
}
}
return false;
} | java | private boolean htmlSentenceTerminatorFound(String str, int index) {
for (int i = 0; i < sentenceTerminators.length; i++) {
String terminator = sentenceTerminators[i];
if (str.regionMatches(true, index, terminator,
0, terminator.length())) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"htmlSentenceTerminatorFound",
"(",
"String",
"str",
",",
"int",
"index",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"sentenceTerminators",
".",
"length",
";",
"i",
"++",
")",
"{",
"String",
"terminator",
"=",
"sente... | Find out if there is any HTML tag in the given string. If found
return true else return false. | [
"Find",
"out",
"if",
"there",
"is",
"any",
"HTML",
"tag",
"in",
"the",
"given",
"string",
".",
"If",
"found",
"return",
"true",
"else",
"return",
"false",
"."
] | train | https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javadoc/DocLocale.java#L233-L242 |
adamfisk/littleshoot-util | src/main/java/org/littleshoot/util/xml/XPathUtils.java | XPathUtils.newXPath | public static XPathUtils newXPath(final Document doc) {
final XPathFactory xpfactory = XPathFactory.newInstance();
final XPath xPath = xpfactory.newXPath();
return new XPathUtils(xPath, doc);
} | java | public static XPathUtils newXPath(final Document doc) {
final XPathFactory xpfactory = XPathFactory.newInstance();
final XPath xPath = xpfactory.newXPath();
return new XPathUtils(xPath, doc);
} | [
"public",
"static",
"XPathUtils",
"newXPath",
"(",
"final",
"Document",
"doc",
")",
"{",
"final",
"XPathFactory",
"xpfactory",
"=",
"XPathFactory",
".",
"newInstance",
"(",
")",
";",
"final",
"XPath",
"xPath",
"=",
"xpfactory",
".",
"newXPath",
"(",
")",
";"... | Creates a new {@link XPathUtils} instance.
@param doc The XML data.
@return A new {@link XPathUtils} instance. | [
"Creates",
"a",
"new",
"{",
"@link",
"XPathUtils",
"}",
"instance",
"."
] | train | https://github.com/adamfisk/littleshoot-util/blob/3c0dc4955116b3382d6b0575d2f164b7508a4f73/src/main/java/org/littleshoot/util/xml/XPathUtils.java#L116-L120 |
mabe02/lanterna | src/main/java/com/googlecode/lanterna/terminal/ansi/TelnetTerminalServer.java | TelnetTerminalServer.acceptConnection | public TelnetTerminal acceptConnection() throws IOException {
Socket clientSocket = serverSocket.accept();
clientSocket.setTcpNoDelay(true);
return new TelnetTerminal(clientSocket, charset);
} | java | public TelnetTerminal acceptConnection() throws IOException {
Socket clientSocket = serverSocket.accept();
clientSocket.setTcpNoDelay(true);
return new TelnetTerminal(clientSocket, charset);
} | [
"public",
"TelnetTerminal",
"acceptConnection",
"(",
")",
"throws",
"IOException",
"{",
"Socket",
"clientSocket",
"=",
"serverSocket",
".",
"accept",
"(",
")",
";",
"clientSocket",
".",
"setTcpNoDelay",
"(",
"true",
")",
";",
"return",
"new",
"TelnetTerminal",
"... | Waits for the next client to connect in to our server and returns a Terminal implementation, TelnetTerminal, that
represents the remote terminal this client is running. The terminal can be used just like any other Terminal, but
keep in mind that all operations are sent over the network.
@return TelnetTerminal for the remote client's terminal
@throws IOException If there was an underlying I/O exception | [
"Waits",
"for",
"the",
"next",
"client",
"to",
"connect",
"in",
"to",
"our",
"server",
"and",
"returns",
"a",
"Terminal",
"implementation",
"TelnetTerminal",
"that",
"represents",
"the",
"remote",
"terminal",
"this",
"client",
"is",
"running",
".",
"The",
"ter... | train | https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/terminal/ansi/TelnetTerminalServer.java#L100-L104 |
javamonkey/beetl2.0 | beetl-core/src/main/java/org/beetl/core/GroupTemplate.java | GroupTemplate.runScript | public Map runScript(String key, Map<String, Object> paras, Writer w, ResourceLoader loader) throws ScriptEvalError
{
Template t = loadScriptTemplate(key, loader);
t.fastBinding(paras);
if (w == null)
{
t.render();
}
else
{
t.renderTo(w);
}
try
{
Map map = getSrirptTopScopeVars(t);
if (map == null)
{
throw new ScriptEvalError();
}
return map;
}
catch (ScriptEvalError ex)
{
throw ex;
}
catch (Exception ex)
{
throw new ScriptEvalError(ex);
}
} | java | public Map runScript(String key, Map<String, Object> paras, Writer w, ResourceLoader loader) throws ScriptEvalError
{
Template t = loadScriptTemplate(key, loader);
t.fastBinding(paras);
if (w == null)
{
t.render();
}
else
{
t.renderTo(w);
}
try
{
Map map = getSrirptTopScopeVars(t);
if (map == null)
{
throw new ScriptEvalError();
}
return map;
}
catch (ScriptEvalError ex)
{
throw ex;
}
catch (Exception ex)
{
throw new ScriptEvalError(ex);
}
} | [
"public",
"Map",
"runScript",
"(",
"String",
"key",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"paras",
",",
"Writer",
"w",
",",
"ResourceLoader",
"loader",
")",
"throws",
"ScriptEvalError",
"{",
"Template",
"t",
"=",
"loadScriptTemplate",
"(",
"key",
... | 执行某个脚本,参数是paras,返回的是顶级变量
@param key
@param paras
@param w
@param loader 额外的资源管理器就在脚本
@return
@throws ScriptEvalError | [
"执行某个脚本,参数是paras,返回的是顶级变量"
] | train | https://github.com/javamonkey/beetl2.0/blob/f32f729ad238079df5aca6e38a3c3ba0a55c78d6/beetl-core/src/main/java/org/beetl/core/GroupTemplate.java#L389-L420 |
johncarl81/transfuse | transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java | Contract.notEmpty | public static void notEmpty(final Object[] array, final String arrayName) {
notNull(array, arrayName);
if (array.length == 0) {
throw new IllegalArgumentException("expecting " + maskNullArgument(arrayName) + " to contain 1 or more elements");
}
} | java | public static void notEmpty(final Object[] array, final String arrayName) {
notNull(array, arrayName);
if (array.length == 0) {
throw new IllegalArgumentException("expecting " + maskNullArgument(arrayName) + " to contain 1 or more elements");
}
} | [
"public",
"static",
"void",
"notEmpty",
"(",
"final",
"Object",
"[",
"]",
"array",
",",
"final",
"String",
"arrayName",
")",
"{",
"notNull",
"(",
"array",
",",
"arrayName",
")",
";",
"if",
"(",
"array",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"n... | Check that an array is not empty
@param array the array to check
@param arrayName the name of the array
@throws IllegalArgumentException if array is null or if the array is empty | [
"Check",
"that",
"an",
"array",
"is",
"not",
"empty"
] | train | https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L96-L102 |
apache/incubator-gobblin | gobblin-modules/gobblin-parquet/src/main/java/org/apache/gobblin/converter/parquet/JsonElementConversionFactory.java | JsonElementConversionFactory.getConverter | public static JsonElementConverter getConverter(JsonSchema schema, boolean repeated) {
InputType fieldType = schema.getInputType();
switch (fieldType) {
case INT:
return new IntConverter(schema, repeated);
case LONG:
return new LongConverter(schema, repeated);
case FLOAT:
return new FloatConverter(schema, repeated);
case DOUBLE:
return new DoubleConverter(schema, repeated);
case BOOLEAN:
return new BooleanConverter(schema, repeated);
case STRING:
return new StringConverter(schema, repeated);
case ARRAY:
return new ArrayConverter(schema);
case ENUM:
return new EnumConverter(schema);
case RECORD:
return new RecordConverter(schema);
case MAP:
return new MapConverter(schema);
case DATE:
case TIMESTAMP:
return new StringConverter(schema, repeated);
default:
throw new UnsupportedOperationException(fieldType + " is unsupported");
}
} | java | public static JsonElementConverter getConverter(JsonSchema schema, boolean repeated) {
InputType fieldType = schema.getInputType();
switch (fieldType) {
case INT:
return new IntConverter(schema, repeated);
case LONG:
return new LongConverter(schema, repeated);
case FLOAT:
return new FloatConverter(schema, repeated);
case DOUBLE:
return new DoubleConverter(schema, repeated);
case BOOLEAN:
return new BooleanConverter(schema, repeated);
case STRING:
return new StringConverter(schema, repeated);
case ARRAY:
return new ArrayConverter(schema);
case ENUM:
return new EnumConverter(schema);
case RECORD:
return new RecordConverter(schema);
case MAP:
return new MapConverter(schema);
case DATE:
case TIMESTAMP:
return new StringConverter(schema, repeated);
default:
throw new UnsupportedOperationException(fieldType + " is unsupported");
}
} | [
"public",
"static",
"JsonElementConverter",
"getConverter",
"(",
"JsonSchema",
"schema",
",",
"boolean",
"repeated",
")",
"{",
"InputType",
"fieldType",
"=",
"schema",
".",
"getInputType",
"(",
")",
";",
"switch",
"(",
"fieldType",
")",
"{",
"case",
"INT",
":"... | Use to create a converter for a single field from a parquetSchema.
@param schema
@param repeated - Is the {@link Type} repeated in the parent {@link Group}
@return | [
"Use",
"to",
"create",
"a",
"converter",
"for",
"a",
"single",
"field",
"from",
"a",
"parquetSchema",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-parquet/src/main/java/org/apache/gobblin/converter/parquet/JsonElementConversionFactory.java#L74-L115 |
hypercube1024/firefly | firefly-common/src/main/java/com/firefly/utils/ClassUtils.java | ClassUtils.isAssignable | public static boolean isAssignable(Class<?> lhsType, Class<?> rhsType) {
Assert.notNull(lhsType, "Left-hand side type must not be null");
Assert.notNull(rhsType, "Right-hand side type must not be null");
if (lhsType.isAssignableFrom(rhsType)) {
return true;
}
if (lhsType.isPrimitive()) {
Class<?> resolvedPrimitive = primitiveWrapperTypeMap.get(rhsType);
if (lhsType == resolvedPrimitive) {
return true;
}
} else {
Class<?> resolvedWrapper = primitiveTypeToWrapperMap.get(rhsType);
if (resolvedWrapper != null && lhsType.isAssignableFrom(resolvedWrapper)) {
return true;
}
}
return false;
} | java | public static boolean isAssignable(Class<?> lhsType, Class<?> rhsType) {
Assert.notNull(lhsType, "Left-hand side type must not be null");
Assert.notNull(rhsType, "Right-hand side type must not be null");
if (lhsType.isAssignableFrom(rhsType)) {
return true;
}
if (lhsType.isPrimitive()) {
Class<?> resolvedPrimitive = primitiveWrapperTypeMap.get(rhsType);
if (lhsType == resolvedPrimitive) {
return true;
}
} else {
Class<?> resolvedWrapper = primitiveTypeToWrapperMap.get(rhsType);
if (resolvedWrapper != null && lhsType.isAssignableFrom(resolvedWrapper)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isAssignable",
"(",
"Class",
"<",
"?",
">",
"lhsType",
",",
"Class",
"<",
"?",
">",
"rhsType",
")",
"{",
"Assert",
".",
"notNull",
"(",
"lhsType",
",",
"\"Left-hand side type must not be null\"",
")",
";",
"Assert",
".",
"notN... | Check if the right-hand side type may be assigned to the left-hand side
type, assuming setting by reflection. Considers primitive wrapper
classes as assignable to the corresponding primitive types.
@param lhsType the target type
@param rhsType the value type that should be assigned to the target type
@return if the target type is assignable from the value type | [
"Check",
"if",
"the",
"right",
"-",
"hand",
"side",
"type",
"may",
"be",
"assigned",
"to",
"the",
"left",
"-",
"hand",
"side",
"type",
"assuming",
"setting",
"by",
"reflection",
".",
"Considers",
"primitive",
"wrapper",
"classes",
"as",
"assignable",
"to",
... | train | https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/ClassUtils.java#L842-L860 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java | ClassPathBuilder.scanJarManifestForClassPathEntries | private void scanJarManifestForClassPathEntries(LinkedList<WorkListItem> workList, ICodeBase codeBase) throws IOException {
// See if this codebase has a jar manifest
ICodeBaseEntry manifestEntry = codeBase.lookupResource("META-INF/MANIFEST.MF");
if (manifestEntry == null) {
// Do nothing - no Jar manifest found
return;
}
// Try to read the manifest
InputStream in = null;
try {
in = manifestEntry.openResource();
Manifest manifest = new Manifest(in);
Attributes mainAttrs = manifest.getMainAttributes();
String classPath = mainAttrs.getValue("Class-Path");
if (classPath != null) {
String[] pathList = classPath.split("\\s+");
for (String path : pathList) {
// Create a codebase locator for the classpath entry
// relative to the codebase in which we discovered the Jar
// manifest
ICodeBaseLocator relativeCodeBaseLocator = codeBase.getCodeBaseLocator().createRelativeCodeBaseLocator(path);
// Codebases found in Class-Path entries are always
// added to the aux classpath, not the application.
addToWorkList(workList, new WorkListItem(relativeCodeBaseLocator, false, ICodeBase.Discovered.IN_JAR_MANIFEST));
}
}
} finally {
if (in != null) {
IO.close(in);
}
}
} | java | private void scanJarManifestForClassPathEntries(LinkedList<WorkListItem> workList, ICodeBase codeBase) throws IOException {
// See if this codebase has a jar manifest
ICodeBaseEntry manifestEntry = codeBase.lookupResource("META-INF/MANIFEST.MF");
if (manifestEntry == null) {
// Do nothing - no Jar manifest found
return;
}
// Try to read the manifest
InputStream in = null;
try {
in = manifestEntry.openResource();
Manifest manifest = new Manifest(in);
Attributes mainAttrs = manifest.getMainAttributes();
String classPath = mainAttrs.getValue("Class-Path");
if (classPath != null) {
String[] pathList = classPath.split("\\s+");
for (String path : pathList) {
// Create a codebase locator for the classpath entry
// relative to the codebase in which we discovered the Jar
// manifest
ICodeBaseLocator relativeCodeBaseLocator = codeBase.getCodeBaseLocator().createRelativeCodeBaseLocator(path);
// Codebases found in Class-Path entries are always
// added to the aux classpath, not the application.
addToWorkList(workList, new WorkListItem(relativeCodeBaseLocator, false, ICodeBase.Discovered.IN_JAR_MANIFEST));
}
}
} finally {
if (in != null) {
IO.close(in);
}
}
} | [
"private",
"void",
"scanJarManifestForClassPathEntries",
"(",
"LinkedList",
"<",
"WorkListItem",
">",
"workList",
",",
"ICodeBase",
"codeBase",
")",
"throws",
"IOException",
"{",
"// See if this codebase has a jar manifest",
"ICodeBaseEntry",
"manifestEntry",
"=",
"codeBase",... | Check a codebase for a Jar manifest to examine for Class-Path entries.
@param workList
the worklist
@param codeBase
the codebase for examine for a Jar manifest
@throws IOException | [
"Check",
"a",
"codebase",
"for",
"a",
"Jar",
"manifest",
"to",
"examine",
"for",
"Class",
"-",
"Path",
"entries",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java#L757-L792 |
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java | FeatureShapes.addMapShape | public void addMapShape(GoogleMapShape mapShape, long featureId, String database, String table) {
FeatureShape featureShape = getFeatureShape(database, table, featureId);
featureShape.addShape(mapShape);
} | java | public void addMapShape(GoogleMapShape mapShape, long featureId, String database, String table) {
FeatureShape featureShape = getFeatureShape(database, table, featureId);
featureShape.addShape(mapShape);
} | [
"public",
"void",
"addMapShape",
"(",
"GoogleMapShape",
"mapShape",
",",
"long",
"featureId",
",",
"String",
"database",
",",
"String",
"table",
")",
"{",
"FeatureShape",
"featureShape",
"=",
"getFeatureShape",
"(",
"database",
",",
"table",
",",
"featureId",
")... | Add a map shape with the feature id, database, and table
@param mapShape map shape
@param featureId feature id
@param database GeoPackage database
@param table table name | [
"Add",
"a",
"map",
"shape",
"with",
"the",
"feature",
"id",
"database",
"and",
"table"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L180-L183 |
igniterealtime/Smack | smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java | MultiUserChatLightManager.unblockRooms | public void unblockRooms(DomainBareJid mucLightService, List<Jid> roomsJids)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
HashMap<Jid, Boolean> rooms = new HashMap<>();
for (Jid jid : roomsJids) {
rooms.put(jid, true);
}
sendUnblockRooms(mucLightService, rooms);
} | java | public void unblockRooms(DomainBareJid mucLightService, List<Jid> roomsJids)
throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
HashMap<Jid, Boolean> rooms = new HashMap<>();
for (Jid jid : roomsJids) {
rooms.put(jid, true);
}
sendUnblockRooms(mucLightService, rooms);
} | [
"public",
"void",
"unblockRooms",
"(",
"DomainBareJid",
"mucLightService",
",",
"List",
"<",
"Jid",
">",
"roomsJids",
")",
"throws",
"NoResponseException",
",",
"XMPPErrorException",
",",
"NotConnectedException",
",",
"InterruptedException",
"{",
"HashMap",
"<",
"Jid"... | Unblock rooms.
@param mucLightService
@param roomsJids
@throws NoResponseException
@throws XMPPErrorException
@throws NotConnectedException
@throws InterruptedException | [
"Unblock",
"rooms",
"."
] | train | https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/muclight/MultiUserChatLightManager.java#L357-L364 |
alkacon/opencms-core | src/org/opencms/workplace/CmsDialog.java | CmsDialog.dialogContent | public String dialogContent(int segment, String title) {
if (segment == HTML_START) {
StringBuffer result = new StringBuffer(512);
// null title is ok, we always want the title headline
result.append(dialogHead(title));
result.append("<div class=\"dialogcontent\" unselectable=\"on\">\n");
result.append("<!-- dialogcontent start -->\n");
return result.toString();
} else {
return "<!-- dialogcontent end -->\n</div>\n";
}
} | java | public String dialogContent(int segment, String title) {
if (segment == HTML_START) {
StringBuffer result = new StringBuffer(512);
// null title is ok, we always want the title headline
result.append(dialogHead(title));
result.append("<div class=\"dialogcontent\" unselectable=\"on\">\n");
result.append("<!-- dialogcontent start -->\n");
return result.toString();
} else {
return "<!-- dialogcontent end -->\n</div>\n";
}
} | [
"public",
"String",
"dialogContent",
"(",
"int",
"segment",
",",
"String",
"title",
")",
"{",
"if",
"(",
"segment",
"==",
"HTML_START",
")",
"{",
"StringBuffer",
"result",
"=",
"new",
"StringBuffer",
"(",
"512",
")",
";",
"// null title is ok, we always want the... | Builds the content area of the dialog window.<p>
@param segment the HTML segment (START / END)
@param title the title String for the dialog window
@return a content area start / end segment | [
"Builds",
"the",
"content",
"area",
"of",
"the",
"dialog",
"window",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/CmsDialog.java#L769-L781 |
umeding/fuzzer | src/main/java/com/uwemeding/fuzzer/Variable.java | Variable.haveMember | public boolean haveMember(String hedgeName, String memberName) {
String fullName = hedgeName + "$" + memberName;
return haveMember(fullName);
} | java | public boolean haveMember(String hedgeName, String memberName) {
String fullName = hedgeName + "$" + memberName;
return haveMember(fullName);
} | [
"public",
"boolean",
"haveMember",
"(",
"String",
"hedgeName",
",",
"String",
"memberName",
")",
"{",
"String",
"fullName",
"=",
"hedgeName",
"+",
"\"$\"",
"+",
"memberName",
";",
"return",
"haveMember",
"(",
"fullName",
")",
";",
"}"
] | Test if we have a hedged member
<p>
@param hedgeName is the hedge name
@param memberName is the member name
@return true/false | [
"Test",
"if",
"we",
"have",
"a",
"hedged",
"member",
"<p",
">"
] | train | https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/Variable.java#L188-L191 |
lessthanoptimal/ddogleg | src/org/ddogleg/optimization/trustregion/TrustRegionBase_F64.java | TrustRegionBase_F64.initialize | public void initialize(double initial[] , int numberOfParameters , double minimumFunctionValue ) {
super.initialize(initial,numberOfParameters);
tmp_p.reshape(numberOfParameters,1);
regionRadius = config.regionInitial;
fx = cost(x);
if( verbose != null ) {
verbose.println("Steps fx change |step| f-test g-test tr-ratio region ");
verbose.printf("%-4d %9.3E %10.3E %9.3E %9.3E %9.3E %6.2f %6.2E\n",
totalSelectSteps, fx, 0.0,0.0,0.0,0.0, 0.0, regionRadius);
}
this.parameterUpdate.initialize(this,numberOfParameters, minimumFunctionValue);
// a perfect initial guess is a pathological case. easiest to handle it here
if( fx <= minimumFunctionValue ) {
if( verbose != null ) {
verbose.println("Converged minimum value");
}
mode = TrustRegionBase_F64.Mode.CONVERGED;
} else {
mode = TrustRegionBase_F64.Mode.COMPUTE_DERIVATIVES;
}
} | java | public void initialize(double initial[] , int numberOfParameters , double minimumFunctionValue ) {
super.initialize(initial,numberOfParameters);
tmp_p.reshape(numberOfParameters,1);
regionRadius = config.regionInitial;
fx = cost(x);
if( verbose != null ) {
verbose.println("Steps fx change |step| f-test g-test tr-ratio region ");
verbose.printf("%-4d %9.3E %10.3E %9.3E %9.3E %9.3E %6.2f %6.2E\n",
totalSelectSteps, fx, 0.0,0.0,0.0,0.0, 0.0, regionRadius);
}
this.parameterUpdate.initialize(this,numberOfParameters, minimumFunctionValue);
// a perfect initial guess is a pathological case. easiest to handle it here
if( fx <= minimumFunctionValue ) {
if( verbose != null ) {
verbose.println("Converged minimum value");
}
mode = TrustRegionBase_F64.Mode.CONVERGED;
} else {
mode = TrustRegionBase_F64.Mode.COMPUTE_DERIVATIVES;
}
} | [
"public",
"void",
"initialize",
"(",
"double",
"initial",
"[",
"]",
",",
"int",
"numberOfParameters",
",",
"double",
"minimumFunctionValue",
")",
"{",
"super",
".",
"initialize",
"(",
"initial",
",",
"numberOfParameters",
")",
";",
"tmp_p",
".",
"reshape",
"("... | Specifies initial state of the search and completion criteria
@param initial Initial parameter state
@param numberOfParameters Number many parameters are being optimized.
@param minimumFunctionValue The minimum possible value that the function can output | [
"Specifies",
"initial",
"state",
"of",
"the",
"search",
"and",
"completion",
"criteria"
] | train | https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/optimization/trustregion/TrustRegionBase_F64.java#L91-L117 |
codeprimate-software/cp-elements | src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java | ElementsExceptionsFactory.newNoAvailablePortException | public static NoAvailablePortException newNoAvailablePortException(Throwable cause, String message, Object... args) {
return new NoAvailablePortException(format(message, args), cause);
} | java | public static NoAvailablePortException newNoAvailablePortException(Throwable cause, String message, Object... args) {
return new NoAvailablePortException(format(message, args), cause);
} | [
"public",
"static",
"NoAvailablePortException",
"newNoAvailablePortException",
"(",
"Throwable",
"cause",
",",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"return",
"new",
"NoAvailablePortException",
"(",
"format",
"(",
"message",
",",
"args",
")",
... | Constructs and initializes a new {@link NoAvailablePortException} with the given {@link Throwable cause}
and {@link String message} formatted with the given {@link Object[] arguments}.
@param cause {@link Throwable} identified as the reason this {@link NoAvailablePortException} was thrown.
@param message {@link String} describing the {@link NoAvailablePortException exception}.
@param args {@link Object[] arguments} used to replace format placeholders in the {@link String message}.
@return a new {@link NoAvailablePortException} with the given {@link Throwable cause} and {@link String message}.
@see org.cp.elements.net.NoAvailablePortException | [
"Constructs",
"and",
"initializes",
"a",
"new",
"{",
"@link",
"NoAvailablePortException",
"}",
"with",
"the",
"given",
"{",
"@link",
"Throwable",
"cause",
"}",
"and",
"{",
"@link",
"String",
"message",
"}",
"formatted",
"with",
"the",
"given",
"{",
"@link",
... | train | https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/ElementsExceptionsFactory.java#L569-L571 |
arquillian/arquillian-algeron | common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java | GitOperations.checkoutTag | public Ref checkoutTag(Git git, String tag) {
try {
return git.checkout()
.setName("tags/" + tag).call();
} catch (GitAPIException e) {
throw new IllegalStateException(e);
}
} | java | public Ref checkoutTag(Git git, String tag) {
try {
return git.checkout()
.setName("tags/" + tag).call();
} catch (GitAPIException e) {
throw new IllegalStateException(e);
}
} | [
"public",
"Ref",
"checkoutTag",
"(",
"Git",
"git",
",",
"String",
"tag",
")",
"{",
"try",
"{",
"return",
"git",
".",
"checkout",
"(",
")",
".",
"setName",
"(",
"\"tags/\"",
"+",
"tag",
")",
".",
"call",
"(",
")",
";",
"}",
"catch",
"(",
"GitAPIExce... | Checkout existing tag.
@param git
instance.
@param tag
to move
@return Ref to current branch | [
"Checkout",
"existing",
"tag",
"."
] | train | https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java#L78-L85 |
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.beginRegenerateKeyAsync | public Observable<SignalRKeysInner> beginRegenerateKeyAsync(String resourceGroupName, String resourceName) {
return beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<SignalRKeysInner>, SignalRKeysInner>() {
@Override
public SignalRKeysInner call(ServiceResponse<SignalRKeysInner> response) {
return response.body();
}
});
} | java | public Observable<SignalRKeysInner> beginRegenerateKeyAsync(String resourceGroupName, String resourceName) {
return beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<SignalRKeysInner>, SignalRKeysInner>() {
@Override
public SignalRKeysInner call(ServiceResponse<SignalRKeysInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"SignalRKeysInner",
">",
"beginRegenerateKeyAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"resourceName",
")",
"{",
"return",
"beginRegenerateKeyWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"resourceName",
")",
".",
"... | Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot be regenerated at the same time.
@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 to the SignalRKeysInner object | [
"Regenerate",
"SignalR",
"service",
"access",
"key",
".",
"PrimaryKey",
"and",
"SecondaryKey",
"cannot",
"be",
"regenerated",
"at",
"the",
"same",
"time",
"."
] | 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#L764-L771 |
apptik/jus | jus-java/src/main/java/io/apptik/comm/jus/toolbox/HttpHeaderParser.java | HttpHeaderParser.parseCharset | public static String parseCharset(Map<String, String> headers, String defaultCharset) {
String contentType = headers.get(HTTP.CONTENT_TYPE);
if (contentType != null) {
String[] params = contentType.split(";");
for (int i = 1; i < params.length; i++) {
String[] pair = params[i].trim().split("=");
if (pair.length == 2) {
if (pair[0].equals("charset")) {
return pair[1];
}
}
}
}
return defaultCharset;
} | java | public static String parseCharset(Map<String, String> headers, String defaultCharset) {
String contentType = headers.get(HTTP.CONTENT_TYPE);
if (contentType != null) {
String[] params = contentType.split(";");
for (int i = 1; i < params.length; i++) {
String[] pair = params[i].trim().split("=");
if (pair.length == 2) {
if (pair[0].equals("charset")) {
return pair[1];
}
}
}
}
return defaultCharset;
} | [
"public",
"static",
"String",
"parseCharset",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"headers",
",",
"String",
"defaultCharset",
")",
"{",
"String",
"contentType",
"=",
"headers",
".",
"get",
"(",
"HTTP",
".",
"CONTENT_TYPE",
")",
";",
"if",
"(",
... | Retrieve a charset from headers
@param headers An {@link java.util.Map} of headers
@param defaultCharset Charset to return if none can be found
@return Returns the charset specified in the Content-Type of this header,
or the defaultCharset if none can be found. | [
"Retrieve",
"a",
"charset",
"from",
"headers"
] | train | https://github.com/apptik/jus/blob/8a37a21b41f897d68eaeaab07368ec22a1e5a60e/jus-java/src/main/java/io/apptik/comm/jus/toolbox/HttpHeaderParser.java#L152-L167 |
steveash/jopenfst | src/main/java/com/github/steveash/jopenfst/MutableFst.java | MutableFst.addArc | public MutableArc addArc(String startStateSymbol, String inSymbol, String outSymbol, String endStateSymbol, double weight) {
Preconditions.checkNotNull(stateSymbols, "cant use this without state symbols; call useStateSymbols()");
return addArc(
getOrNewState(startStateSymbol),
inSymbol,
outSymbol,
getOrNewState(endStateSymbol),
weight
);
} | java | public MutableArc addArc(String startStateSymbol, String inSymbol, String outSymbol, String endStateSymbol, double weight) {
Preconditions.checkNotNull(stateSymbols, "cant use this without state symbols; call useStateSymbols()");
return addArc(
getOrNewState(startStateSymbol),
inSymbol,
outSymbol,
getOrNewState(endStateSymbol),
weight
);
} | [
"public",
"MutableArc",
"addArc",
"(",
"String",
"startStateSymbol",
",",
"String",
"inSymbol",
",",
"String",
"outSymbol",
",",
"String",
"endStateSymbol",
",",
"double",
"weight",
")",
"{",
"Preconditions",
".",
"checkNotNull",
"(",
"stateSymbols",
",",
"\"cant ... | Adds a new arc in the FST between startStateSymbol and endStateSymbol with inSymbol and outSymbol
and edge weight; if the state symbols or in/out symbols dont exist then they will be added
@param startStateSymbol
@param inSymbol
@param outSymbol
@param endStateSymbol
@param weight
@return | [
"Adds",
"a",
"new",
"arc",
"in",
"the",
"FST",
"between",
"startStateSymbol",
"and",
"endStateSymbol",
"with",
"inSymbol",
"and",
"outSymbol",
"and",
"edge",
"weight",
";",
"if",
"the",
"state",
"symbols",
"or",
"in",
"/",
"out",
"symbols",
"dont",
"exist",
... | train | https://github.com/steveash/jopenfst/blob/4c675203015c1cfad2072556cb532b6edc73261d/src/main/java/com/github/steveash/jopenfst/MutableFst.java#L368-L377 |
elki-project/elki | elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java | BitsUtil.cycleLeftI | public static long[] cycleLeftI(long[] v, int shift, int len) {
long[] t = copy(v, len, shift);
return orI(shiftRightI(v, len - shift), truncateI(t, len));
} | java | public static long[] cycleLeftI(long[] v, int shift, int len) {
long[] t = copy(v, len, shift);
return orI(shiftRightI(v, len - shift), truncateI(t, len));
} | [
"public",
"static",
"long",
"[",
"]",
"cycleLeftI",
"(",
"long",
"[",
"]",
"v",
",",
"int",
"shift",
",",
"int",
"len",
")",
"{",
"long",
"[",
"]",
"t",
"=",
"copy",
"(",
"v",
",",
"len",
",",
"shift",
")",
";",
"return",
"orI",
"(",
"shiftRigh... | Cycle a bitstring to the right.
@param v Bit string
@param shift Number of steps to cycle
@param len Length | [
"Cycle",
"a",
"bitstring",
"to",
"the",
"right",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/BitsUtil.java#L851-L854 |
atomix/atomix | utils/src/main/java/io/atomix/utils/concurrent/ComposableFuture.java | ComposableFuture.exceptAsync | public CompletableFuture<T> exceptAsync(Consumer<Throwable> consumer) {
return whenCompleteAsync((result, error) -> {
if (error != null) {
consumer.accept(error);
}
});
} | java | public CompletableFuture<T> exceptAsync(Consumer<Throwable> consumer) {
return whenCompleteAsync((result, error) -> {
if (error != null) {
consumer.accept(error);
}
});
} | [
"public",
"CompletableFuture",
"<",
"T",
">",
"exceptAsync",
"(",
"Consumer",
"<",
"Throwable",
">",
"consumer",
")",
"{",
"return",
"whenCompleteAsync",
"(",
"(",
"result",
",",
"error",
")",
"->",
"{",
"if",
"(",
"error",
"!=",
"null",
")",
"{",
"consu... | Sets a consumer to be called asynchronously when the future is failed.
@param consumer The consumer to call.
@return A new future. | [
"Sets",
"a",
"consumer",
"to",
"be",
"called",
"asynchronously",
"when",
"the",
"future",
"is",
"failed",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/utils/src/main/java/io/atomix/utils/concurrent/ComposableFuture.java#L59-L65 |
dynjs/dynjs | src/main/java/org/dynjs/ir/representations/CFGLinearizer.java | CFGLinearizer.addJumpIfNextNotDestination | private static void addJumpIfNextNotDestination(CFG cfg, BasicBlock next, Instruction lastInstr, BasicBlock current) {
Iterator<BasicBlock> outs = cfg.getOutgoingDestinations(current).iterator();
BasicBlock target = outs.hasNext() ? outs.next() : null;
if (target != null && !outs.hasNext()) {
if ((target != next) && ((lastInstr == null) || !lastInstr.transfersControl())) {
current.addInstr(new Jump(target.getLabel()));
}
}
} | java | private static void addJumpIfNextNotDestination(CFG cfg, BasicBlock next, Instruction lastInstr, BasicBlock current) {
Iterator<BasicBlock> outs = cfg.getOutgoingDestinations(current).iterator();
BasicBlock target = outs.hasNext() ? outs.next() : null;
if (target != null && !outs.hasNext()) {
if ((target != next) && ((lastInstr == null) || !lastInstr.transfersControl())) {
current.addInstr(new Jump(target.getLabel()));
}
}
} | [
"private",
"static",
"void",
"addJumpIfNextNotDestination",
"(",
"CFG",
"cfg",
",",
"BasicBlock",
"next",
",",
"Instruction",
"lastInstr",
",",
"BasicBlock",
"current",
")",
"{",
"Iterator",
"<",
"BasicBlock",
">",
"outs",
"=",
"cfg",
".",
"getOutgoingDestinations... | If there is no jump at add of block and the next block is not destination insert a valid jump | [
"If",
"there",
"is",
"no",
"jump",
"at",
"add",
"of",
"block",
"and",
"the",
"next",
"block",
"is",
"not",
"destination",
"insert",
"a",
"valid",
"jump"
] | train | https://github.com/dynjs/dynjs/blob/4bc6715eff8768f8cd92c6a167d621bbfc1e1a91/src/main/java/org/dynjs/ir/representations/CFGLinearizer.java#L127-L136 |
uscexp/grappa.extension | src/main/java/com/github/uscexp/grappa/extension/interpreter/ProcessStore.java | ProcessStore.setVariable | public boolean setVariable(Object key, Object value) {
boolean success = false;
Object object = null;
for (int i = working.size() - 1; i >= 0; --i) {
Map<Object, Object> map = working.get(i);
object = map.get(key);
if (object != null) {
map.put(key, value);
success = true;
break;
}
}
if (!success) {
object = global.get(key);
if (object != null) {
global.put(key, value);
success = true;
}
}
return success;
} | java | public boolean setVariable(Object key, Object value) {
boolean success = false;
Object object = null;
for (int i = working.size() - 1; i >= 0; --i) {
Map<Object, Object> map = working.get(i);
object = map.get(key);
if (object != null) {
map.put(key, value);
success = true;
break;
}
}
if (!success) {
object = global.get(key);
if (object != null) {
global.put(key, value);
success = true;
}
}
return success;
} | [
"public",
"boolean",
"setVariable",
"(",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"boolean",
"success",
"=",
"false",
";",
"Object",
"object",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"working",
".",
"size",
"(",
")",
"-",
"1",
";",
... | set an already defined variable, first from the highest block hierarchy
down to the global variables.
@param key
name of the variable
@param value
value of the variable
@return true if successfully assignd to an existing variable else false | [
"set",
"an",
"already",
"defined",
"variable",
"first",
"from",
"the",
"highest",
"block",
"hierarchy",
"down",
"to",
"the",
"global",
"variables",
"."
] | train | https://github.com/uscexp/grappa.extension/blob/a6001eb6eee434a09e2870e7513f883c7fdaea94/src/main/java/com/github/uscexp/grappa/extension/interpreter/ProcessStore.java#L267-L288 |
tvesalainen/util | util/src/main/java/org/vesalainen/math/Vectors.java | Vectors.areAligned | public static final boolean areAligned(double ox, double oy, double x1, double y1, double x2, double y2)
{
return areAligned(x1-ox, y1-oy, x2-ox, y2-oy);
} | java | public static final boolean areAligned(double ox, double oy, double x1, double y1, double x2, double y2)
{
return areAligned(x1-ox, y1-oy, x2-ox, y2-oy);
} | [
"public",
"static",
"final",
"boolean",
"areAligned",
"(",
"double",
"ox",
",",
"double",
"oy",
",",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"x2",
",",
"double",
"y2",
")",
"{",
"return",
"areAligned",
"(",
"x1",
"-",
"ox",
",",
"y1",
"-"... | Returns true if vectors (x1, y1) and (x2, y2) are aligned (ox, oy) centered
coordinate.
@param ox
@param oy
@param x1
@param y1
@param x2
@param y2
@return | [
"Returns",
"true",
"if",
"vectors",
"(",
"x1",
"y1",
")",
"and",
"(",
"x2",
"y2",
")",
"are",
"aligned",
"(",
"ox",
"oy",
")",
"centered",
"coordinate",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Vectors.java#L91-L94 |
landawn/AbacusUtil | src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java | PoolablePreparedStatement.setSQLXML | @Override
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
internalStmt.setSQLXML(parameterIndex, xmlObject);
} | java | @Override
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException {
internalStmt.setSQLXML(parameterIndex, xmlObject);
} | [
"@",
"Override",
"public",
"void",
"setSQLXML",
"(",
"int",
"parameterIndex",
",",
"SQLXML",
"xmlObject",
")",
"throws",
"SQLException",
"{",
"internalStmt",
".",
"setSQLXML",
"(",
"parameterIndex",
",",
"xmlObject",
")",
";",
"}"
] | Method setSQLXML.
@param parameterIndex
@param xmlObject
@throws SQLException
@see java.sql.PreparedStatement#setSQLXML(int, SQLXML) | [
"Method",
"setSQLXML",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L965-L968 |
alkacon/opencms-core | src/org/opencms/widgets/A_CmsWidget.java | A_CmsWidget.getJsHelpMouseHandler | protected String getJsHelpMouseHandler(I_CmsWidgetDialog widgetDialog, String key, String value) {
String jsShow;
String jsHide;
String keyHide;
if (widgetDialog.useNewStyle()) {
// Administration style
jsShow = "sMH";
jsHide = "hMH";
keyHide = "'" + key + "'";
} else {
// Dialog style
jsShow = "showHelpText";
jsHide = "hideHelpText";
keyHide = "";
}
StringBuffer result = new StringBuffer(128);
result.append(" onmouseover=\"");
result.append(jsShow);
result.append("('");
result.append(key);
if (!widgetDialog.useNewStyle()) {
result.append("', '");
result.append(value);
}
result.append("');\" onmouseout=\"");
result.append(jsHide);
result.append("(");
result.append(keyHide);
result.append(");\"");
return result.toString();
} | java | protected String getJsHelpMouseHandler(I_CmsWidgetDialog widgetDialog, String key, String value) {
String jsShow;
String jsHide;
String keyHide;
if (widgetDialog.useNewStyle()) {
// Administration style
jsShow = "sMH";
jsHide = "hMH";
keyHide = "'" + key + "'";
} else {
// Dialog style
jsShow = "showHelpText";
jsHide = "hideHelpText";
keyHide = "";
}
StringBuffer result = new StringBuffer(128);
result.append(" onmouseover=\"");
result.append(jsShow);
result.append("('");
result.append(key);
if (!widgetDialog.useNewStyle()) {
result.append("', '");
result.append(value);
}
result.append("');\" onmouseout=\"");
result.append(jsHide);
result.append("(");
result.append(keyHide);
result.append(");\"");
return result.toString();
} | [
"protected",
"String",
"getJsHelpMouseHandler",
"(",
"I_CmsWidgetDialog",
"widgetDialog",
",",
"String",
"key",
",",
"String",
"value",
")",
"{",
"String",
"jsShow",
";",
"String",
"jsHide",
";",
"String",
"keyHide",
";",
"if",
"(",
"widgetDialog",
".",
"useNewS... | Returns the HTML for the JavaScript mouse handlers that show / hide the help text.<p>
This is required since the handler differs between the "Dialog" and the "Administration" mode.<p>
@param widgetDialog the dialog where the widget is displayed on
@param key the key for the help bubble
@param value the localized help text, has to be an escaped String for JS usage, is only used in XML content editor
@return the HTML for the JavaScript mouse handlers that show / hide the help text | [
"Returns",
"the",
"HTML",
"for",
"the",
"JavaScript",
"mouse",
"handlers",
"that",
"show",
"/",
"hide",
"the",
"help",
"text",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/A_CmsWidget.java#L452-L484 |
m-m-m/util | nls/src/main/java/net/sf/mmm/util/nls/base/NlsFormatterMap.java | NlsFormatterMap.registerFormatter | public NlsFormatter<?> registerFormatter(NlsFormatterPlugin<?> formatter) {
return registerFormatter(formatter, formatter.getType(), formatter.getStyle());
} | java | public NlsFormatter<?> registerFormatter(NlsFormatterPlugin<?> formatter) {
return registerFormatter(formatter, formatter.getType(), formatter.getStyle());
} | [
"public",
"NlsFormatter",
"<",
"?",
">",
"registerFormatter",
"(",
"NlsFormatterPlugin",
"<",
"?",
">",
"formatter",
")",
"{",
"return",
"registerFormatter",
"(",
"formatter",
",",
"formatter",
".",
"getType",
"(",
")",
",",
"formatter",
".",
"getStyle",
"(",
... | This method registers the given {@code formatBuilder}.
@param formatter is the {@link NlsFormatterPlugin} to register.
@return the {@link NlsFormatter} that was registered for the given {@link NlsFormatterPlugin#getType()
type} and {@link NlsFormatterPlugin#getStyle() style} and is now replaced by the given
{@code formatter} or {@code null} if no {@link NlsFormatter} was replaced. | [
"This",
"method",
"registers",
"the",
"given",
"{",
"@code",
"formatBuilder",
"}",
"."
] | train | https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/nls/src/main/java/net/sf/mmm/util/nls/base/NlsFormatterMap.java#L48-L51 |
andriusvelykis/reflow-maven-skin | reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java | HtmlTool.reorderToTop | public String reorderToTop(String content, String selector, int amount) {
return reorderToTop(content, selector, amount, null);
} | java | public String reorderToTop(String content, String selector, int amount) {
return reorderToTop(content, selector, amount, null);
} | [
"public",
"String",
"reorderToTop",
"(",
"String",
"content",
",",
"String",
"selector",
",",
"int",
"amount",
")",
"{",
"return",
"reorderToTop",
"(",
"content",
",",
"selector",
",",
"amount",
",",
"null",
")",
";",
"}"
] | Reorders elements in HTML content so that selected elements are found at the top of the
content. Can be limited to a certain amount, e.g. to bring just the first of selected
elements to the top.
@param content
HTML content to reorder
@param selector
CSS selector for elements to bring to top of the content
@param amount
Maximum number of elements to reorder
@return HTML content with reordered elements, or the original content if no such elements
found.
@since 1.0 | [
"Reorders",
"elements",
"in",
"HTML",
"content",
"so",
"that",
"selected",
"elements",
"are",
"found",
"at",
"the",
"top",
"of",
"the",
"content",
".",
"Can",
"be",
"limited",
"to",
"a",
"certain",
"amount",
"e",
".",
"g",
".",
"to",
"bring",
"just",
"... | train | https://github.com/andriusvelykis/reflow-maven-skin/blob/01170ae1426a1adfe7cc9c199e77aaa2ecb37ef2/reflow-velocity-tools/src/main/java/lt/velykis/maven/skins/reflow/HtmlTool.java#L357-L359 |
apache/incubator-druid | processing/src/main/java/org/apache/druid/segment/filter/Filters.java | Filters.matchPredicateNoUnion | public static Iterable<ImmutableBitmap> matchPredicateNoUnion(
final String dimension,
final BitmapIndexSelector selector,
final Predicate<String> predicate
)
{
Preconditions.checkNotNull(dimension, "dimension");
Preconditions.checkNotNull(selector, "selector");
Preconditions.checkNotNull(predicate, "predicate");
// Missing dimension -> match all rows if the predicate matches null; match no rows otherwise
try (final CloseableIndexed<String> dimValues = selector.getDimensionValues(dimension)) {
if (dimValues == null || dimValues.size() == 0) {
return ImmutableList.of(predicate.apply(null) ? allTrue(selector) : allFalse(selector));
}
// Apply predicate to all dimension values and union the matching bitmaps
final BitmapIndex bitmapIndex = selector.getBitmapIndex(dimension);
return makePredicateQualifyingBitmapIterable(bitmapIndex, predicate, dimValues);
}
catch (IOException e) {
throw new UncheckedIOException(e);
}
} | java | public static Iterable<ImmutableBitmap> matchPredicateNoUnion(
final String dimension,
final BitmapIndexSelector selector,
final Predicate<String> predicate
)
{
Preconditions.checkNotNull(dimension, "dimension");
Preconditions.checkNotNull(selector, "selector");
Preconditions.checkNotNull(predicate, "predicate");
// Missing dimension -> match all rows if the predicate matches null; match no rows otherwise
try (final CloseableIndexed<String> dimValues = selector.getDimensionValues(dimension)) {
if (dimValues == null || dimValues.size() == 0) {
return ImmutableList.of(predicate.apply(null) ? allTrue(selector) : allFalse(selector));
}
// Apply predicate to all dimension values and union the matching bitmaps
final BitmapIndex bitmapIndex = selector.getBitmapIndex(dimension);
return makePredicateQualifyingBitmapIterable(bitmapIndex, predicate, dimValues);
}
catch (IOException e) {
throw new UncheckedIOException(e);
}
} | [
"public",
"static",
"Iterable",
"<",
"ImmutableBitmap",
">",
"matchPredicateNoUnion",
"(",
"final",
"String",
"dimension",
",",
"final",
"BitmapIndexSelector",
"selector",
",",
"final",
"Predicate",
"<",
"String",
">",
"predicate",
")",
"{",
"Preconditions",
".",
... | Return an iterable of bitmaps for all values matching a particular predicate. Unioning these bitmaps
yields the same result that {@link #matchPredicate(String, BitmapIndexSelector, BitmapResultFactory, Predicate)}
would have returned.
@param dimension dimension to look at
@param selector bitmap selector
@param predicate predicate to use
@return iterable of bitmaps of matching rows | [
"Return",
"an",
"iterable",
"of",
"bitmaps",
"for",
"all",
"values",
"matching",
"a",
"particular",
"predicate",
".",
"Unioning",
"these",
"bitmaps",
"yields",
"the",
"same",
"result",
"that",
"{",
"@link",
"#matchPredicate",
"(",
"String",
"BitmapIndexSelector",
... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/filter/Filters.java#L263-L286 |
aerogear/aerogear-unifiedpush-server | push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/sender/FCMPushNotificationSender.java | FCMPushNotificationSender.sendPushMessage | @Override
public void sendPushMessage(Variant variant, Collection<String> tokens, UnifiedPushMessage pushMessage, String pushMessageInformationId, NotificationSenderCallback callback) {
// no need to send empty list
if (tokens.isEmpty()) {
return;
}
final List<String> pushTargets = new ArrayList<>(tokens);
final AndroidVariant androidVariant = (AndroidVariant) variant;
// payload builder:
Builder fcmBuilder = new Message.Builder();
org.jboss.aerogear.unifiedpush.message.Message message = pushMessage.getMessage();
// add the "recognized" keys...
fcmBuilder.addData("alert", message.getAlert());
fcmBuilder.addData("sound", message.getSound());
fcmBuilder.addData("badge", String.valueOf(message.getBadge()));
/*
The Message defaults to a Normal priority. High priority is used
by FCM to wake up devices in Doze mode as well as apps in AppStandby
mode. This has no effect on devices older than Android 6.0
*/
fcmBuilder.priority(
message.getPriority() == Priority.HIGH ?
Message.Priority.HIGH :
Message.Priority.NORMAL
);
// if present, apply the time-to-live metadata:
int ttl = pushMessage.getConfig().getTimeToLive();
if (ttl != -1) {
fcmBuilder.timeToLive(ttl);
}
// iterate over the missing keys:
message.getUserData().keySet()
.forEach(key -> fcmBuilder.addData(key, String.valueOf(message.getUserData().get(key))));
//add the aerogear-push-id
fcmBuilder.addData(InternalUnifiedPushMessage.PUSH_MESSAGE_ID, pushMessageInformationId);
Message fcmMessage = fcmBuilder.build();
// send it out.....
try {
logger.debug("Sending transformed FCM payload: {}", fcmMessage);
final ConfigurableFCMSender sender = new ConfigurableFCMSender(androidVariant.getGoogleKey());
// we are about to send HTTP requests for all tokens of topics of this batch
promPrushRequestsAndroid.inc();
// send out a message to a batch of devices...
processFCM(androidVariant, pushTargets, fcmMessage , sender);
logger.debug("Message batch to FCM has been submitted");
callback.onSuccess();
} catch (Exception e) {
// FCM exceptions:
callback.onError(String.format("Error sending payload to FCM server: %s", e.getMessage()));
}
} | java | @Override
public void sendPushMessage(Variant variant, Collection<String> tokens, UnifiedPushMessage pushMessage, String pushMessageInformationId, NotificationSenderCallback callback) {
// no need to send empty list
if (tokens.isEmpty()) {
return;
}
final List<String> pushTargets = new ArrayList<>(tokens);
final AndroidVariant androidVariant = (AndroidVariant) variant;
// payload builder:
Builder fcmBuilder = new Message.Builder();
org.jboss.aerogear.unifiedpush.message.Message message = pushMessage.getMessage();
// add the "recognized" keys...
fcmBuilder.addData("alert", message.getAlert());
fcmBuilder.addData("sound", message.getSound());
fcmBuilder.addData("badge", String.valueOf(message.getBadge()));
/*
The Message defaults to a Normal priority. High priority is used
by FCM to wake up devices in Doze mode as well as apps in AppStandby
mode. This has no effect on devices older than Android 6.0
*/
fcmBuilder.priority(
message.getPriority() == Priority.HIGH ?
Message.Priority.HIGH :
Message.Priority.NORMAL
);
// if present, apply the time-to-live metadata:
int ttl = pushMessage.getConfig().getTimeToLive();
if (ttl != -1) {
fcmBuilder.timeToLive(ttl);
}
// iterate over the missing keys:
message.getUserData().keySet()
.forEach(key -> fcmBuilder.addData(key, String.valueOf(message.getUserData().get(key))));
//add the aerogear-push-id
fcmBuilder.addData(InternalUnifiedPushMessage.PUSH_MESSAGE_ID, pushMessageInformationId);
Message fcmMessage = fcmBuilder.build();
// send it out.....
try {
logger.debug("Sending transformed FCM payload: {}", fcmMessage);
final ConfigurableFCMSender sender = new ConfigurableFCMSender(androidVariant.getGoogleKey());
// we are about to send HTTP requests for all tokens of topics of this batch
promPrushRequestsAndroid.inc();
// send out a message to a batch of devices...
processFCM(androidVariant, pushTargets, fcmMessage , sender);
logger.debug("Message batch to FCM has been submitted");
callback.onSuccess();
} catch (Exception e) {
// FCM exceptions:
callback.onError(String.format("Error sending payload to FCM server: %s", e.getMessage()));
}
} | [
"@",
"Override",
"public",
"void",
"sendPushMessage",
"(",
"Variant",
"variant",
",",
"Collection",
"<",
"String",
">",
"tokens",
",",
"UnifiedPushMessage",
"pushMessage",
",",
"String",
"pushMessageInformationId",
",",
"NotificationSenderCallback",
"callback",
")",
"... | Sends FCM notifications ({@link UnifiedPushMessage}) to all devices, that are represented by
the {@link List} of tokens for the given {@link AndroidVariant}. | [
"Sends",
"FCM",
"notifications",
"(",
"{"
] | train | https://github.com/aerogear/aerogear-unifiedpush-server/blob/c7b798f085449117d84345d8c378b27165cad32b/push-sender/src/main/java/org/jboss/aerogear/unifiedpush/message/sender/FCMPushNotificationSender.java#L72-L137 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java | JobOperations.listJobs | public PagedList<CloudJob> listJobs() throws BatchErrorException, IOException {
return listJobs(null, (Iterable<BatchClientBehavior>) null);
} | java | public PagedList<CloudJob> listJobs() throws BatchErrorException, IOException {
return listJobs(null, (Iterable<BatchClientBehavior>) null);
} | [
"public",
"PagedList",
"<",
"CloudJob",
">",
"listJobs",
"(",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"return",
"listJobs",
"(",
"null",
",",
"(",
"Iterable",
"<",
"BatchClientBehavior",
">",
")",
"null",
")",
";",
"}"
] | Lists the {@link CloudJob jobs} in the Batch account.
@return A list of {@link CloudJob} objects.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Lists",
"the",
"{",
"@link",
"CloudJob",
"jobs",
"}",
"in",
"the",
"Batch",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java#L158-L160 |
scireum/s3ninja | src/main/java/ninja/S3Dispatcher.java | S3Dispatcher.putObject | private void putObject(WebContext ctx, Bucket bucket, String id, InputStreamHandler inputStream)
throws IOException {
StoredObject object = bucket.getObject(id);
if (inputStream == null) {
signalObjectError(ctx, HttpResponseStatus.BAD_REQUEST, "No content posted");
return;
}
try (FileOutputStream out = new FileOutputStream(object.getFile())) {
ByteStreams.copy(inputStream, out);
}
Map<String, String> properties = Maps.newTreeMap();
for (String name : ctx.getRequest().headers().names()) {
String nameLower = name.toLowerCase();
if (nameLower.startsWith("x-amz-meta-") || "content-md5".equals(nameLower) || "content-type".equals(
nameLower) || "x-amz-acl".equals(nameLower)) {
properties.put(name, ctx.getHeader(name));
}
}
HashCode hash = Files.hash(object.getFile(), Hashing.md5());
String md5 = BaseEncoding.base64().encode(hash.asBytes());
String contentMd5 = properties.get("Content-MD5");
if (properties.containsKey("Content-MD5") && !md5.equals(contentMd5)) {
object.delete();
signalObjectError(ctx,
HttpResponseStatus.BAD_REQUEST,
Strings.apply("Invalid MD5 checksum (Input: %s, Expected: %s)", contentMd5, md5));
return;
}
String etag = BaseEncoding.base16().encode(hash.asBytes());
properties.put(HTTP_HEADER_NAME_ETAG, etag);
object.storeProperties(properties);
Response response = ctx.respondWith();
response.addHeader(HTTP_HEADER_NAME_ETAG, etag(etag)).status(HttpResponseStatus.OK);
response.addHeader(HttpHeaderNames.ACCESS_CONTROL_EXPOSE_HEADERS, HTTP_HEADER_NAME_ETAG);
signalObjectSuccess(ctx);
} | java | private void putObject(WebContext ctx, Bucket bucket, String id, InputStreamHandler inputStream)
throws IOException {
StoredObject object = bucket.getObject(id);
if (inputStream == null) {
signalObjectError(ctx, HttpResponseStatus.BAD_REQUEST, "No content posted");
return;
}
try (FileOutputStream out = new FileOutputStream(object.getFile())) {
ByteStreams.copy(inputStream, out);
}
Map<String, String> properties = Maps.newTreeMap();
for (String name : ctx.getRequest().headers().names()) {
String nameLower = name.toLowerCase();
if (nameLower.startsWith("x-amz-meta-") || "content-md5".equals(nameLower) || "content-type".equals(
nameLower) || "x-amz-acl".equals(nameLower)) {
properties.put(name, ctx.getHeader(name));
}
}
HashCode hash = Files.hash(object.getFile(), Hashing.md5());
String md5 = BaseEncoding.base64().encode(hash.asBytes());
String contentMd5 = properties.get("Content-MD5");
if (properties.containsKey("Content-MD5") && !md5.equals(contentMd5)) {
object.delete();
signalObjectError(ctx,
HttpResponseStatus.BAD_REQUEST,
Strings.apply("Invalid MD5 checksum (Input: %s, Expected: %s)", contentMd5, md5));
return;
}
String etag = BaseEncoding.base16().encode(hash.asBytes());
properties.put(HTTP_HEADER_NAME_ETAG, etag);
object.storeProperties(properties);
Response response = ctx.respondWith();
response.addHeader(HTTP_HEADER_NAME_ETAG, etag(etag)).status(HttpResponseStatus.OK);
response.addHeader(HttpHeaderNames.ACCESS_CONTROL_EXPOSE_HEADERS, HTTP_HEADER_NAME_ETAG);
signalObjectSuccess(ctx);
} | [
"private",
"void",
"putObject",
"(",
"WebContext",
"ctx",
",",
"Bucket",
"bucket",
",",
"String",
"id",
",",
"InputStreamHandler",
"inputStream",
")",
"throws",
"IOException",
"{",
"StoredObject",
"object",
"=",
"bucket",
".",
"getObject",
"(",
"id",
")",
";",... | Handles PUT /bucket/id
@param ctx the context describing the current request
@param bucket the bucket containing the object to upload
@param id name of the object to upload | [
"Handles",
"PUT",
"/",
"bucket",
"/",
"id"
] | train | https://github.com/scireum/s3ninja/blob/445eec55c91780267a7f987818b3fedecae009c5/src/main/java/ninja/S3Dispatcher.java#L492-L530 |
ysc/word | src/main/java/org/apdplat/word/analysis/JaroDistanceTextSimilarity.java | JaroDistanceTextSimilarity.getCharacterConjunction | private String getCharacterConjunction(String text1, String text2, int windowLength) {
StringBuilder conjunction = new StringBuilder();
StringBuilder target = new StringBuilder(text2);
int len1 = text1.length();
for (int i = 0; i < len1; i++) {
char source = text1.charAt(i);
boolean found = false;
int start = Math.max(0, i - windowLength);
int end = Math.min(i + windowLength, text2.length());
for (int j = start; !found && j < end; j++) {
if (source == target.charAt(j)) {
found = true;
conjunction.append(source);
target.setCharAt(j,'*');
}
}
}
return conjunction.toString();
} | java | private String getCharacterConjunction(String text1, String text2, int windowLength) {
StringBuilder conjunction = new StringBuilder();
StringBuilder target = new StringBuilder(text2);
int len1 = text1.length();
for (int i = 0; i < len1; i++) {
char source = text1.charAt(i);
boolean found = false;
int start = Math.max(0, i - windowLength);
int end = Math.min(i + windowLength, text2.length());
for (int j = start; !found && j < end; j++) {
if (source == target.charAt(j)) {
found = true;
conjunction.append(source);
target.setCharAt(j,'*');
}
}
}
return conjunction.toString();
} | [
"private",
"String",
"getCharacterConjunction",
"(",
"String",
"text1",
",",
"String",
"text2",
",",
"int",
"windowLength",
")",
"{",
"StringBuilder",
"conjunction",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"StringBuilder",
"target",
"=",
"new",
"StringBuilder"... | 获取两段文本的共有字符即字符交集
@param text1 文本1
@param text2 文本2
@param windowLength 字符交集窗口大小
@return 字符交集 | [
"获取两段文本的共有字符即字符交集"
] | train | https://github.com/ysc/word/blob/5e45607f4e97207f55d1e3bc561abda6b34f7c54/src/main/java/org/apdplat/word/analysis/JaroDistanceTextSimilarity.java#L106-L124 |
rundeck/rundeck | core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProjectConfig.java | FrameworkProjectConfig.createDirectProjectPropertyLookup | private static PropertyLookup createDirectProjectPropertyLookup(
IFilesystemFramework filesystemFramework,
String projectName
)
{
PropertyLookup lookup;
final Properties ownProps = new Properties();
ownProps.setProperty("project.name", projectName);
File projectsBaseDir = filesystemFramework.getFrameworkProjectsBaseDir();
//generic framework properties for a project
final File propertyFile = getProjectPropertyFile(new File(projectsBaseDir, projectName));
final Properties projectProps = PropertyLookup.fetchProperties(propertyFile);
lookup = PropertyLookup.create(projectProps, PropertyLookup.create(ownProps));
lookup.expand();
return lookup;
} | java | private static PropertyLookup createDirectProjectPropertyLookup(
IFilesystemFramework filesystemFramework,
String projectName
)
{
PropertyLookup lookup;
final Properties ownProps = new Properties();
ownProps.setProperty("project.name", projectName);
File projectsBaseDir = filesystemFramework.getFrameworkProjectsBaseDir();
//generic framework properties for a project
final File propertyFile = getProjectPropertyFile(new File(projectsBaseDir, projectName));
final Properties projectProps = PropertyLookup.fetchProperties(propertyFile);
lookup = PropertyLookup.create(projectProps, PropertyLookup.create(ownProps));
lookup.expand();
return lookup;
} | [
"private",
"static",
"PropertyLookup",
"createDirectProjectPropertyLookup",
"(",
"IFilesystemFramework",
"filesystemFramework",
",",
"String",
"projectName",
")",
"{",
"PropertyLookup",
"lookup",
";",
"final",
"Properties",
"ownProps",
"=",
"new",
"Properties",
"(",
")",
... | Create PropertyLookup for a project from the framework basedir
@param filesystemFramework the filesystem | [
"Create",
"PropertyLookup",
"for",
"a",
"project",
"from",
"the",
"framework",
"basedir"
] | train | https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/common/FrameworkProjectConfig.java#L283-L301 |
JavaMoney/jsr354-ri-bp | src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java | MonetaryFunctions.sortCurrencyUnitDesc | public static Comparator<MonetaryAmount> sortCurrencyUnitDesc(){
return new Comparator<MonetaryAmount>() {
@Override
public int compare(MonetaryAmount o1, MonetaryAmount o2) {
return sortCurrencyUnit().compare(o1, o2) * -1;
}
};
} | java | public static Comparator<MonetaryAmount> sortCurrencyUnitDesc(){
return new Comparator<MonetaryAmount>() {
@Override
public int compare(MonetaryAmount o1, MonetaryAmount o2) {
return sortCurrencyUnit().compare(o1, o2) * -1;
}
};
} | [
"public",
"static",
"Comparator",
"<",
"MonetaryAmount",
">",
"sortCurrencyUnitDesc",
"(",
")",
"{",
"return",
"new",
"Comparator",
"<",
"MonetaryAmount",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"MonetaryAmount",
"o1",
",",
"Monet... | Get a comparator for sorting CurrencyUnits descending.
@return the Comparator to sort by CurrencyUnit in descending order, not null. | [
"Get",
"a",
"comparator",
"for",
"sorting",
"CurrencyUnits",
"descending",
"."
] | train | https://github.com/JavaMoney/jsr354-ri-bp/blob/9c147ef5623d8032a6dc4c0e5eefdfb41641a9a2/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java#L131-L138 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java | Item.withLong | public Item withLong(String attrName, long val) {
checkInvalidAttrName(attrName);
return withNumber(attrName, Long.valueOf(val));
} | java | public Item withLong(String attrName, long val) {
checkInvalidAttrName(attrName);
return withNumber(attrName, Long.valueOf(val));
} | [
"public",
"Item",
"withLong",
"(",
"String",
"attrName",
",",
"long",
"val",
")",
"{",
"checkInvalidAttrName",
"(",
"attrName",
")",
";",
"return",
"withNumber",
"(",
"attrName",
",",
"Long",
".",
"valueOf",
"(",
"val",
")",
")",
";",
"}"
] | Sets the value of the specified attribute in the current item to the
given value. | [
"Sets",
"the",
"value",
"of",
"the",
"specified",
"attribute",
"in",
"the",
"current",
"item",
"to",
"the",
"given",
"value",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/Item.java#L332-L335 |
ZenHarbinger/l2fprod-properties-editor | src/main/java/com/l2fprod/common/propertysheet/PropertySheetTableModel.java | PropertySheetTableModel.addPropertiesToModel | private void addPropertiesToModel(List<Property> localProperties, Item parent) {
for (Property property : localProperties) {
Item propertyItem = new Item(property, parent);
model.add(propertyItem);
// add any sub-properties
Property[] subProperties = property.getSubProperties();
if (subProperties != null && subProperties.length > 0) {
addPropertiesToModel(Arrays.asList(subProperties), propertyItem);
}
}
} | java | private void addPropertiesToModel(List<Property> localProperties, Item parent) {
for (Property property : localProperties) {
Item propertyItem = new Item(property, parent);
model.add(propertyItem);
// add any sub-properties
Property[] subProperties = property.getSubProperties();
if (subProperties != null && subProperties.length > 0) {
addPropertiesToModel(Arrays.asList(subProperties), propertyItem);
}
}
} | [
"private",
"void",
"addPropertiesToModel",
"(",
"List",
"<",
"Property",
">",
"localProperties",
",",
"Item",
"parent",
")",
"{",
"for",
"(",
"Property",
"property",
":",
"localProperties",
")",
"{",
"Item",
"propertyItem",
"=",
"new",
"Item",
"(",
"property",... | Add the specified properties to the model using the specified parent.
@param localProperties the properties to add to the end of the model
@param parent the {@link Item} parent of these properties, null if none | [
"Add",
"the",
"specified",
"properties",
"to",
"the",
"model",
"using",
"the",
"specified",
"parent",
"."
] | train | https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTableModel.java#L516-L527 |
IanGClifton/AndroidFloatLabel | FloatLabel/src/com/iangclifton/android/floatlabel/FloatLabel.java | FloatLabel.setTextWithoutAnimation | public void setTextWithoutAnimation(CharSequence text, TextView.BufferType type) {
mSkipAnimation = true;
mEditText.setText(text, type);
} | java | public void setTextWithoutAnimation(CharSequence text, TextView.BufferType type) {
mSkipAnimation = true;
mEditText.setText(text, type);
} | [
"public",
"void",
"setTextWithoutAnimation",
"(",
"CharSequence",
"text",
",",
"TextView",
".",
"BufferType",
"type",
")",
"{",
"mSkipAnimation",
"=",
"true",
";",
"mEditText",
".",
"setText",
"(",
"text",
",",
"type",
")",
";",
"}"
] | Sets the EditText's text without animating the label
@param text CharSequence to set
@param type TextView.BufferType | [
"Sets",
"the",
"EditText",
"s",
"text",
"without",
"animating",
"the",
"label"
] | train | https://github.com/IanGClifton/AndroidFloatLabel/blob/b0a39c26f010f17d5f3648331e9784a41e025c0d/FloatLabel/src/com/iangclifton/android/floatlabel/FloatLabel.java#L323-L326 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWComponent.java | AbstractWComponent.createErrorDiagnostic | protected Diagnostic createErrorDiagnostic(final WComponent source, final String message,
final Serializable... args) {
return new DiagnosticImpl(Diagnostic.ERROR, source, message, args);
} | java | protected Diagnostic createErrorDiagnostic(final WComponent source, final String message,
final Serializable... args) {
return new DiagnosticImpl(Diagnostic.ERROR, source, message, args);
} | [
"protected",
"Diagnostic",
"createErrorDiagnostic",
"(",
"final",
"WComponent",
"source",
",",
"final",
"String",
"message",
",",
"final",
"Serializable",
"...",
"args",
")",
"{",
"return",
"new",
"DiagnosticImpl",
"(",
"Diagnostic",
".",
"ERROR",
",",
"source",
... | Create and return an error diagnostic associated to the given error source.
@param source the source of the error.
@param message the error message, using {@link MessageFormat} syntax.
@param args optional arguments for the message.
@return an error diagnostic for this component. | [
"Create",
"and",
"return",
"an",
"error",
"diagnostic",
"associated",
"to",
"the",
"given",
"error",
"source",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/AbstractWComponent.java#L772-L775 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ParameterUtility.java | ParameterUtility.buildCustomizableClass | public static <D extends Object> Object buildCustomizableClass(final ParameterItem<Class<?>> parameter, final Class<D> defaultObject, final Class<?> interfaceClass) {
Object object = null;
try {
object = parameter.get().newInstance();
} catch (InstantiationException | IllegalAccessException e) {
LOGGER.error(CUSTOM_CLASS_LOADING_ERROR, e, interfaceClass.getSimpleName());
try {
object = defaultObject.newInstance();
} catch (InstantiationException | IllegalAccessException e2) {
throw new CoreRuntimeException("Impossible to build Default " + interfaceClass.getSimpleName(), e2);
}
}
return object;
} | java | public static <D extends Object> Object buildCustomizableClass(final ParameterItem<Class<?>> parameter, final Class<D> defaultObject, final Class<?> interfaceClass) {
Object object = null;
try {
object = parameter.get().newInstance();
} catch (InstantiationException | IllegalAccessException e) {
LOGGER.error(CUSTOM_CLASS_LOADING_ERROR, e, interfaceClass.getSimpleName());
try {
object = defaultObject.newInstance();
} catch (InstantiationException | IllegalAccessException e2) {
throw new CoreRuntimeException("Impossible to build Default " + interfaceClass.getSimpleName(), e2);
}
}
return object;
} | [
"public",
"static",
"<",
"D",
"extends",
"Object",
">",
"Object",
"buildCustomizableClass",
"(",
"final",
"ParameterItem",
"<",
"Class",
"<",
"?",
">",
">",
"parameter",
",",
"final",
"Class",
"<",
"D",
">",
"defaultObject",
",",
"final",
"Class",
"<",
"?"... | Build a customizable class.
@param parameter The parameter class to load
@param defaultObject the default object class to use as fallback
@param interfaceClass the interface that the wanted type shall implement (for log purpose)
@param <D> the type wanted
@return a new instance of the generic type | [
"Build",
"a",
"customizable",
"class",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/ParameterUtility.java#L55-L68 |
sundrio/sundrio | annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java | ToPojo.readArrayProperty | private static String readArrayProperty(String ref, TypeDef source, Property property) {
TypeRef typeRef = property.getTypeRef();
if (typeRef instanceof ClassRef) {
//TODO: This needs further breakdown, to cover edge cases.
return readObjectArrayProperty(ref, source, property);
}
if (typeRef instanceof PrimitiveRef) {
return readPrimitiveArrayProperty(ref, source, property);
}
throw new IllegalStateException("Property should be either an object or a primitive.");
} | java | private static String readArrayProperty(String ref, TypeDef source, Property property) {
TypeRef typeRef = property.getTypeRef();
if (typeRef instanceof ClassRef) {
//TODO: This needs further breakdown, to cover edge cases.
return readObjectArrayProperty(ref, source, property);
}
if (typeRef instanceof PrimitiveRef) {
return readPrimitiveArrayProperty(ref, source, property);
}
throw new IllegalStateException("Property should be either an object or a primitive.");
} | [
"private",
"static",
"String",
"readArrayProperty",
"(",
"String",
"ref",
",",
"TypeDef",
"source",
",",
"Property",
"property",
")",
"{",
"TypeRef",
"typeRef",
"=",
"property",
".",
"getTypeRef",
"(",
")",
";",
"if",
"(",
"typeRef",
"instanceof",
"ClassRef",
... | Returns the string representation of the code that reads an array property.
@param ref The reference.
@param source The type of the reference.
@param property The property to read.
@return The code. | [
"Returns",
"the",
"string",
"representation",
"of",
"the",
"code",
"that",
"reads",
"an",
"array",
"property",
"."
] | train | https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java#L610-L621 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSField.java | JSField.estimateSizeOfUnassembledValue | public int estimateSizeOfUnassembledValue(Object val, int indirect) {
if (indirect == 0)
return estimateUnassembledSize(val);
else
return coder.estimateUnassembledSize(val);
} | java | public int estimateSizeOfUnassembledValue(Object val, int indirect) {
if (indirect == 0)
return estimateUnassembledSize(val);
else
return coder.estimateUnassembledSize(val);
} | [
"public",
"int",
"estimateSizeOfUnassembledValue",
"(",
"Object",
"val",
",",
"int",
"indirect",
")",
"{",
"if",
"(",
"indirect",
"==",
"0",
")",
"return",
"estimateUnassembledSize",
"(",
"val",
")",
";",
"else",
"return",
"coder",
".",
"estimateUnassembledSize"... | estimateSizeOfUnassembledValue
Return the estimated size of the value if unassembled.
This size includes a guess at the heap overhead of the object(s) which
would be created.
@param val the object whose unassembled length is desired
@param indirect the list indirection that applies to the object or -1 if the
JSField's maximum list indirection (based on the number of JSRepeated nodes that
dominate it in the schema) is to be used: this, of course, includes the possibility
that it isn't a list at all.
@return int the estimated size of the unassembled object in the heap. | [
"estimateSizeOfUnassembledValue",
"Return",
"the",
"estimated",
"size",
"of",
"the",
"value",
"if",
"unassembled",
".",
"This",
"size",
"includes",
"a",
"guess",
"at",
"the",
"heap",
"overhead",
"of",
"the",
"object",
"(",
"s",
")",
"which",
"would",
"be",
"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/jmf/impl/JSField.java#L200-L205 |
TheHortonMachine/hortonmachine | hmachine/src/main/java/org/hortonmachine/hmachine/modules/demmanipulation/pitfiller/OmsPitfiller.java | OmsPitfiller.setDirection | private void setDirection( double pitValue, int row, int col, int[][] dir, double[] fact ) {
dir[col][row] = 0; /* This necessary to repeat passes after level raised */
double smax = 0.0;
// examine adjacent cells first
for( int k = 1; k <= 8; k++ ) {
int cn = col + DIR_WITHFLOW_EXITING_INVERTED[k][0];
int rn = row + DIR_WITHFLOW_EXITING_INVERTED[k][1];
double pitN = pitIter.getSampleDouble(cn, rn, 0);
if (isNovalue(pitN)) {
dir[col][row] = -1;
break;
}
if (dir[col][row] != -1) {
double slope = fact[k] * (pitValue - pitN);
if (slope > smax) {
smax = slope;
// maximum slope gives the drainage direction
dir[col][row] = k;
}
}
}
} | java | private void setDirection( double pitValue, int row, int col, int[][] dir, double[] fact ) {
dir[col][row] = 0; /* This necessary to repeat passes after level raised */
double smax = 0.0;
// examine adjacent cells first
for( int k = 1; k <= 8; k++ ) {
int cn = col + DIR_WITHFLOW_EXITING_INVERTED[k][0];
int rn = row + DIR_WITHFLOW_EXITING_INVERTED[k][1];
double pitN = pitIter.getSampleDouble(cn, rn, 0);
if (isNovalue(pitN)) {
dir[col][row] = -1;
break;
}
if (dir[col][row] != -1) {
double slope = fact[k] * (pitValue - pitN);
if (slope > smax) {
smax = slope;
// maximum slope gives the drainage direction
dir[col][row] = k;
}
}
}
} | [
"private",
"void",
"setDirection",
"(",
"double",
"pitValue",
",",
"int",
"row",
",",
"int",
"col",
",",
"int",
"[",
"]",
"[",
"]",
"dir",
",",
"double",
"[",
"]",
"fact",
")",
"{",
"dir",
"[",
"col",
"]",
"[",
"row",
"]",
"=",
"0",
";",
"/* Th... | Calculate the drainage direction with the D8 method.
<p>Find the direction that has the maximum
slope and set it as the drainage direction the in the cell (r,c)
in the dir matrix.
@param pitValue the value of pit in row/col.
@param row row of the cell in the matrix.
@param col col of the cell in the matrix.
@param dir the drainage direction matrix to set the dircetion in. The cell contains an int value in the range 0 to 8
(or 10 if it is an outlet point).
@param fact is the direction factor (1/lenght). | [
"Calculate",
"the",
"drainage",
"direction",
"with",
"the",
"D8",
"method",
"."
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/demmanipulation/pitfiller/OmsPitfiller.java#L600-L623 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java | JSONConverter.writeNotifications | public void writeNotifications(OutputStream out, Notification[] value) throws IOException {
final NotificationRecord[] records;
if (value != null) {
records = new NotificationRecord[value.length];
for (int i = 0; i < value.length; ++i) {
Notification n = value[i];
if (n != null) {
Object source = n.getSource();
NotificationRecord nr;
if (source instanceof ObjectName) {
nr = new NotificationRecord(n, (ObjectName) source);
} else {
nr = new NotificationRecord(n, (source != null) ? source.toString() : null);
}
records[i] = nr;
}
}
} else {
records = null;
}
writeNotificationRecords(out, records);
} | java | public void writeNotifications(OutputStream out, Notification[] value) throws IOException {
final NotificationRecord[] records;
if (value != null) {
records = new NotificationRecord[value.length];
for (int i = 0; i < value.length; ++i) {
Notification n = value[i];
if (n != null) {
Object source = n.getSource();
NotificationRecord nr;
if (source instanceof ObjectName) {
nr = new NotificationRecord(n, (ObjectName) source);
} else {
nr = new NotificationRecord(n, (source != null) ? source.toString() : null);
}
records[i] = nr;
}
}
} else {
records = null;
}
writeNotificationRecords(out, records);
} | [
"public",
"void",
"writeNotifications",
"(",
"OutputStream",
"out",
",",
"Notification",
"[",
"]",
"value",
")",
"throws",
"IOException",
"{",
"final",
"NotificationRecord",
"[",
"]",
"records",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"records",
"="... | Encode an array of Notification instance as JSON:
@param out The stream to write JSON to
@param value The Notification array to encode. Value can be null,
but its items can't be null.
The "source" of the items must be an instance of ObjectName.
@throws IOException If an I/O error occurs
@see #readNotifications(InputStream) | [
"Encode",
"an",
"array",
"of",
"Notification",
"instance",
"as",
"JSON",
":"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jmx.connector.client.rest/src/com/ibm/ws/jmx/connector/converter/JSONConverter.java#L1628-L1649 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.