repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 201 | func_name stringlengths 4 126 | whole_func_string stringlengths 75 3.57k | language stringclasses 1
value | func_code_string stringlengths 75 3.57k | func_code_tokens listlengths 21 599 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 478 | split_name stringclasses 1
value | func_code_url stringlengths 111 308 |
|---|---|---|---|---|---|---|---|---|---|---|
structr/structr | structr-ui/src/main/java/org/structr/web/servlet/HtmlServlet.java | HtmlServlet.findFirstNodeByName | private AbstractNode findFirstNodeByName(final SecurityContext securityContext, final HttpServletRequest request, final String path) throws FrameworkException {
final String name = PathHelper.getName(path);
if (!name.isEmpty()) {
logger.debug("Requested name: {}", name);
final Query query = StructrApp.getInstance(securityContext).nodeQuery();
final ConfigurationProvider config = StructrApp.getConfiguration();
if (!possiblePropertyNamesForEntityResolving.isEmpty()) {
query.and();
resolvePossiblePropertyNamesForObjectResolution(config, query, name);
query.parent();
}
final List<AbstractNode> results = Iterables.toList(query.getResultStream());
logger.debug("{} results", results.size());
request.setAttribute(POSSIBLE_ENTRY_POINTS_KEY, results);
return (results.size() > 0 ? (AbstractNode) results.get(0) : null);
}
return null;
} | java | private AbstractNode findFirstNodeByName(final SecurityContext securityContext, final HttpServletRequest request, final String path) throws FrameworkException {
final String name = PathHelper.getName(path);
if (!name.isEmpty()) {
logger.debug("Requested name: {}", name);
final Query query = StructrApp.getInstance(securityContext).nodeQuery();
final ConfigurationProvider config = StructrApp.getConfiguration();
if (!possiblePropertyNamesForEntityResolving.isEmpty()) {
query.and();
resolvePossiblePropertyNamesForObjectResolution(config, query, name);
query.parent();
}
final List<AbstractNode> results = Iterables.toList(query.getResultStream());
logger.debug("{} results", results.size());
request.setAttribute(POSSIBLE_ENTRY_POINTS_KEY, results);
return (results.size() > 0 ? (AbstractNode) results.get(0) : null);
}
return null;
} | [
"private",
"AbstractNode",
"findFirstNodeByName",
"(",
"final",
"SecurityContext",
"securityContext",
",",
"final",
"HttpServletRequest",
"request",
",",
"final",
"String",
"path",
")",
"throws",
"FrameworkException",
"{",
"final",
"String",
"name",
"=",
"PathHelper",
... | Find first node whose name matches the last part of the given path
@param securityContext
@param request
@param path
@return node
@throws FrameworkException | [
"Find",
"first",
"node",
"whose",
"name",
"matches",
"the",
"last",
"part",
"of",
"the",
"given",
"path"
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-ui/src/main/java/org/structr/web/servlet/HtmlServlet.java#L965-L993 |
groovy/groovy-core | src/main/groovy/beans/BindableASTTransformation.java | BindableASTTransformation.createSetterMethod | protected void createSetterMethod(ClassNode declaringClass, PropertyNode propertyNode, String setterName, Statement setterBlock) {
MethodNode setter = new MethodNode(
setterName,
propertyNode.getModifiers(),
ClassHelper.VOID_TYPE,
params(param(propertyNode.getType(), "value")),
ClassNode.EMPTY_ARRAY,
setterBlock);
setter.setSynthetic(true);
// add it to the class
declaringClass.addMethod(setter);
} | java | protected void createSetterMethod(ClassNode declaringClass, PropertyNode propertyNode, String setterName, Statement setterBlock) {
MethodNode setter = new MethodNode(
setterName,
propertyNode.getModifiers(),
ClassHelper.VOID_TYPE,
params(param(propertyNode.getType(), "value")),
ClassNode.EMPTY_ARRAY,
setterBlock);
setter.setSynthetic(true);
// add it to the class
declaringClass.addMethod(setter);
} | [
"protected",
"void",
"createSetterMethod",
"(",
"ClassNode",
"declaringClass",
",",
"PropertyNode",
"propertyNode",
",",
"String",
"setterName",
",",
"Statement",
"setterBlock",
")",
"{",
"MethodNode",
"setter",
"=",
"new",
"MethodNode",
"(",
"setterName",
",",
"pro... | Creates a setter method with the given body.
@param declaringClass the class to which we will add the setter
@param propertyNode the field to back the setter
@param setterName the name of the setter
@param setterBlock the statement representing the setter block | [
"Creates",
"a",
"setter",
"method",
"with",
"the",
"given",
"body",
"."
] | train | https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/groovy/beans/BindableASTTransformation.java#L247-L258 |
OpenTSDB/opentsdb | src/query/pojo/Validatable.java | Validatable.validatePOJO | <T extends Validatable> void validatePOJO(final T pojo, final String name) {
try {
pojo.validate();
} catch (final IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid " + name, e);
}
} | java | <T extends Validatable> void validatePOJO(final T pojo, final String name) {
try {
pojo.validate();
} catch (final IllegalArgumentException e) {
throw new IllegalArgumentException("Invalid " + name, e);
}
} | [
"<",
"T",
"extends",
"Validatable",
">",
"void",
"validatePOJO",
"(",
"final",
"T",
"pojo",
",",
"final",
"String",
"name",
")",
"{",
"try",
"{",
"pojo",
".",
"validate",
"(",
")",
";",
"}",
"catch",
"(",
"final",
"IllegalArgumentException",
"e",
")",
... | Validate a single POJO validate
@param pojo The POJO object to validate
@param name name of the field | [
"Validate",
"a",
"single",
"POJO",
"validate"
] | train | https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/query/pojo/Validatable.java#L52-L58 |
jmrozanec/cron-utils | src/main/java/com/cronutils/descriptor/DescriptionStrategyFactory.java | DescriptionStrategyFactory.daysOfMonthInstance | public static DescriptionStrategy daysOfMonthInstance(final ResourceBundle bundle, final FieldExpression expression) {
final NominalDescriptionStrategy dom = new NominalDescriptionStrategy(bundle, null, expression);
dom.addDescription(fieldExpression -> {
if (fieldExpression instanceof On) {
final On on = (On) fieldExpression;
switch (on.getSpecialChar().getValue()) {
case W:
return String
.format("%s %s %s ", bundle.getString("the_nearest_weekday_to_the"), on.getTime().getValue(), bundle.getString("of_the_month"));
case L:
return bundle.getString("last_day_of_month");
case LW:
return bundle.getString("last_weekday_of_month");
default:
return "";
}
}
return "";
});
return dom;
} | java | public static DescriptionStrategy daysOfMonthInstance(final ResourceBundle bundle, final FieldExpression expression) {
final NominalDescriptionStrategy dom = new NominalDescriptionStrategy(bundle, null, expression);
dom.addDescription(fieldExpression -> {
if (fieldExpression instanceof On) {
final On on = (On) fieldExpression;
switch (on.getSpecialChar().getValue()) {
case W:
return String
.format("%s %s %s ", bundle.getString("the_nearest_weekday_to_the"), on.getTime().getValue(), bundle.getString("of_the_month"));
case L:
return bundle.getString("last_day_of_month");
case LW:
return bundle.getString("last_weekday_of_month");
default:
return "";
}
}
return "";
});
return dom;
} | [
"public",
"static",
"DescriptionStrategy",
"daysOfMonthInstance",
"(",
"final",
"ResourceBundle",
"bundle",
",",
"final",
"FieldExpression",
"expression",
")",
"{",
"final",
"NominalDescriptionStrategy",
"dom",
"=",
"new",
"NominalDescriptionStrategy",
"(",
"bundle",
",",... | Creates description strategy for days of month.
@param bundle - locale
@param expression - CronFieldExpression
@return - DescriptionStrategy instance, never null | [
"Creates",
"description",
"strategy",
"for",
"days",
"of",
"month",
"."
] | train | https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/DescriptionStrategyFactory.java#L74-L95 |
elki-project/elki | addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/detail/DetailView.java | DetailView.addBackground | private void addBackground(VisualizerContext context) {
// Make a background
CSSClass cls = new CSSClass(this, "background");
cls.setStatement(SVGConstants.CSS_FILL_PROPERTY, context.getStyleLibrary().getBackgroundColor(StyleLibrary.PAGE));
addCSSClassOrLogError(cls);
Element bg = this.svgElement(SVGConstants.SVG_RECT_TAG, cls.getName());
SVGUtil.setAtt(bg, SVGConstants.SVG_X_ATTRIBUTE, "0");
SVGUtil.setAtt(bg, SVGConstants.SVG_Y_ATTRIBUTE, "0");
SVGUtil.setAtt(bg, SVGConstants.SVG_WIDTH_ATTRIBUTE, "100%");
SVGUtil.setAtt(bg, SVGConstants.SVG_HEIGHT_ATTRIBUTE, "100%");
SVGUtil.setAtt(bg, NO_EXPORT_ATTRIBUTE, NO_EXPORT_ATTRIBUTE);
// Note that we rely on this being called before any other drawing routines.
getRoot().appendChild(bg);
} | java | private void addBackground(VisualizerContext context) {
// Make a background
CSSClass cls = new CSSClass(this, "background");
cls.setStatement(SVGConstants.CSS_FILL_PROPERTY, context.getStyleLibrary().getBackgroundColor(StyleLibrary.PAGE));
addCSSClassOrLogError(cls);
Element bg = this.svgElement(SVGConstants.SVG_RECT_TAG, cls.getName());
SVGUtil.setAtt(bg, SVGConstants.SVG_X_ATTRIBUTE, "0");
SVGUtil.setAtt(bg, SVGConstants.SVG_Y_ATTRIBUTE, "0");
SVGUtil.setAtt(bg, SVGConstants.SVG_WIDTH_ATTRIBUTE, "100%");
SVGUtil.setAtt(bg, SVGConstants.SVG_HEIGHT_ATTRIBUTE, "100%");
SVGUtil.setAtt(bg, NO_EXPORT_ATTRIBUTE, NO_EXPORT_ATTRIBUTE);
// Note that we rely on this being called before any other drawing routines.
getRoot().appendChild(bg);
} | [
"private",
"void",
"addBackground",
"(",
"VisualizerContext",
"context",
")",
"{",
"// Make a background",
"CSSClass",
"cls",
"=",
"new",
"CSSClass",
"(",
"this",
",",
"\"background\"",
")",
";",
"cls",
".",
"setStatement",
"(",
"SVGConstants",
".",
"CSS_FILL_PROP... | Create a background node. Note: don't call this at arbitrary times - the
background may cover already drawn parts of the image!
@param context | [
"Create",
"a",
"background",
"node",
".",
"Note",
":",
"don",
"t",
"call",
"this",
"at",
"arbitrary",
"times",
"-",
"the",
"background",
"may",
"cover",
"already",
"drawn",
"parts",
"of",
"the",
"image!"
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/gui/detail/DetailView.java#L134-L148 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapMultiPoint.java | MapMultiPoint.getDistance | @Override
@Pure
public double getDistance(Point2D<?, ?> point) {
double mind = Double.MAX_VALUE;
for (final Point2d p : points()) {
final double d = p.getDistance(point);
if (d < mind) {
mind = d;
}
}
return mind;
} | java | @Override
@Pure
public double getDistance(Point2D<?, ?> point) {
double mind = Double.MAX_VALUE;
for (final Point2d p : points()) {
final double d = p.getDistance(point);
if (d < mind) {
mind = d;
}
}
return mind;
} | [
"@",
"Override",
"@",
"Pure",
"public",
"double",
"getDistance",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"point",
")",
"{",
"double",
"mind",
"=",
"Double",
".",
"MAX_VALUE",
";",
"for",
"(",
"final",
"Point2d",
"p",
":",
"points",
"(",
")",
")",
... | Replies the distance between this MapElement and
point.
@param point the point to compute the distance to.
@return the distance. Should be negative depending of the MapElement type. | [
"Replies",
"the",
"distance",
"between",
"this",
"MapElement",
"and",
"point",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapMultiPoint.java#L128-L139 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.email_exchange_organizationName_service_exchangeService_accountUpgrade_GET | public ArrayList<String> email_exchange_organizationName_service_exchangeService_accountUpgrade_GET(String organizationName, String exchangeService, OvhAccountQuotaEnum newQuota, String primaryEmailAddress) throws IOException {
String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/accountUpgrade";
StringBuilder sb = path(qPath, organizationName, exchangeService);
query(sb, "newQuota", newQuota);
query(sb, "primaryEmailAddress", primaryEmailAddress);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> email_exchange_organizationName_service_exchangeService_accountUpgrade_GET(String organizationName, String exchangeService, OvhAccountQuotaEnum newQuota, String primaryEmailAddress) throws IOException {
String qPath = "/order/email/exchange/{organizationName}/service/{exchangeService}/accountUpgrade";
StringBuilder sb = path(qPath, organizationName, exchangeService);
query(sb, "newQuota", newQuota);
query(sb, "primaryEmailAddress", primaryEmailAddress);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"email_exchange_organizationName_service_exchangeService_accountUpgrade_GET",
"(",
"String",
"organizationName",
",",
"String",
"exchangeService",
",",
"OvhAccountQuotaEnum",
"newQuota",
",",
"String",
"primaryEmailAddress",
")",
"thro... | Get allowed durations for 'accountUpgrade' option
REST: GET /order/email/exchange/{organizationName}/service/{exchangeService}/accountUpgrade
@param newQuota [required] New storage quota for that account
@param primaryEmailAddress [required] The account you wish to upgrade
@param organizationName [required] The internal name of your exchange organization
@param exchangeService [required] The internal name of your exchange service | [
"Get",
"allowed",
"durations",
"for",
"accountUpgrade",
"option"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3965-L3972 |
ppicas/custom-typeface | library/src/main/java/cat/ppicas/customtypeface/CustomTypefaceFactory.java | CustomTypefaceFactory.onCreateView | @Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
String prefix = null;
if (name.indexOf('.') == -1) {
prefix = "android.widget.";
}
try {
View view = null;
if (mFactory != null) {
view = mFactory.onCreateView(name, context, attrs);
}
if (view == null) {
view = createView(name, prefix, context, attrs);
}
mCustomTypeface.applyTypeface(view, attrs);
return view;
} catch (ClassNotFoundException e) {
return null;
}
} | java | @Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
String prefix = null;
if (name.indexOf('.') == -1) {
prefix = "android.widget.";
}
try {
View view = null;
if (mFactory != null) {
view = mFactory.onCreateView(name, context, attrs);
}
if (view == null) {
view = createView(name, prefix, context, attrs);
}
mCustomTypeface.applyTypeface(view, attrs);
return view;
} catch (ClassNotFoundException e) {
return null;
}
} | [
"@",
"Override",
"public",
"View",
"onCreateView",
"(",
"String",
"name",
",",
"Context",
"context",
",",
"AttributeSet",
"attrs",
")",
"{",
"String",
"prefix",
"=",
"null",
";",
"if",
"(",
"name",
".",
"indexOf",
"(",
"'",
"'",
")",
"==",
"-",
"1",
... | Implements {@link LayoutInflater.Factory} interface. Inflate the {@link View} for the
specified tag name and apply custom {@link Typeface} if is required. This
method first will delegate to the {@code LayoutInflater.Factory} if it was specified on the
constructor. When the {@code View} is created, this method will call {@link
CustomTypeface#applyTypeface(View, AttributeSet)} on it.
<p>
This method can be used to delegate the implementation of {@link
LayoutInflater.Factory#onCreateView}
or {@link LayoutInflater.Factory2#onCreateView}.
</p>
@param name Tag name to be inflated.
@param context The context the view is being created in.
@param attrs Inflation attributes as specified in XML file.
@return Newly created view.
@see LayoutInflater.Factory
@see CustomTypeface#applyTypeface(View, AttributeSet) | [
"Implements",
"{",
"@link",
"LayoutInflater",
".",
"Factory",
"}",
"interface",
".",
"Inflate",
"the",
"{",
"@link",
"View",
"}",
"for",
"the",
"specified",
"tag",
"name",
"and",
"apply",
"custom",
"{",
"@link",
"Typeface",
"}",
"if",
"is",
"required",
"."... | train | https://github.com/ppicas/custom-typeface/blob/3a2a68cc8584a72076c545a8b7c9f741f6002241/library/src/main/java/cat/ppicas/customtypeface/CustomTypefaceFactory.java#L133-L152 |
Guichaguri/MinimalFTP | src/main/java/com/guichaguri/minimalftp/FTPServer.java | FTPServer.listen | public void listen(InetAddress address, int port) throws IOException {
if(auth == null) throw new NullPointerException("The Authenticator is null");
if(socket != null) throw new IOException("Server already started");
socket = Utils.createServer(port, 50, address, ssl, !explicitSecurity);
serverThread = new ServerThread();
serverThread.setDaemon(true);
serverThread.start();
} | java | public void listen(InetAddress address, int port) throws IOException {
if(auth == null) throw new NullPointerException("The Authenticator is null");
if(socket != null) throw new IOException("Server already started");
socket = Utils.createServer(port, 50, address, ssl, !explicitSecurity);
serverThread = new ServerThread();
serverThread.setDaemon(true);
serverThread.start();
} | [
"public",
"void",
"listen",
"(",
"InetAddress",
"address",
",",
"int",
"port",
")",
"throws",
"IOException",
"{",
"if",
"(",
"auth",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"The Authenticator is null\"",
")",
";",
"if",
"(",
"socket",... | Starts the FTP server asynchronously.
@param address The server address or {@code null} for a local address
@param port The server port or {@code 0} to automatically allocate the port
@throws IOException When an error occurs while starting the server | [
"Starts",
"the",
"FTP",
"server",
"asynchronously",
"."
] | train | https://github.com/Guichaguri/MinimalFTP/blob/ddd81e26ec88079ee4c37fe53d8efe420996e9b1/src/main/java/com/guichaguri/minimalftp/FTPServer.java#L197-L206 |
Impetus/Kundera | src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/event/EntityEventDispatcher.java | EntityEventDispatcher.fireEventListeners | public void fireEventListeners(EntityMetadata metadata, Object entity, Class<?> event)
{
// handle external listeners first
List<? extends CallbackMethod> callBackMethods = metadata.getCallbackMethods(event);
if (null != callBackMethods && !callBackMethods.isEmpty() && null != entity)
{
log.debug("Callback >> " + event.getSimpleName() + " on " + metadata.getEntityClazz().getName());
for (CallbackMethod callback : callBackMethods)
{
log.debug("Firing >> " + callback);
callback.invoke(entity);
}
}
} | java | public void fireEventListeners(EntityMetadata metadata, Object entity, Class<?> event)
{
// handle external listeners first
List<? extends CallbackMethod> callBackMethods = metadata.getCallbackMethods(event);
if (null != callBackMethods && !callBackMethods.isEmpty() && null != entity)
{
log.debug("Callback >> " + event.getSimpleName() + " on " + metadata.getEntityClazz().getName());
for (CallbackMethod callback : callBackMethods)
{
log.debug("Firing >> " + callback);
callback.invoke(entity);
}
}
} | [
"public",
"void",
"fireEventListeners",
"(",
"EntityMetadata",
"metadata",
",",
"Object",
"entity",
",",
"Class",
"<",
"?",
">",
"event",
")",
"{",
"// handle external listeners first\r",
"List",
"<",
"?",
"extends",
"CallbackMethod",
">",
"callBackMethods",
"=",
... | Fire event listeners.
@param metadata
the metadata
@param entity
the entity
@param event
the event
@throws PersistenceException
the persistence exception | [
"Fire",
"event",
"listeners",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/event/EntityEventDispatcher.java#L49-L66 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | FSNamesystem.isGoodReplica | private boolean isGoodReplica(DatanodeDescriptor node, Block block) {
Collection<Block> excessBlocks =
excessReplicateMap.get(node.getStorageID());
Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(block);
return (nodesCorrupt == null || !nodesCorrupt.contains(node)) // not corrupt
// not over scheduling for replication
&& (node.getNumberOfBlocksToBeReplicated() < maxReplicationStreams)
// not alredy scheduled for removal
&& (excessBlocks == null || !excessBlocks.contains(block))
&& !node.isDecommissioned(); // not decommissioned
} | java | private boolean isGoodReplica(DatanodeDescriptor node, Block block) {
Collection<Block> excessBlocks =
excessReplicateMap.get(node.getStorageID());
Collection<DatanodeDescriptor> nodesCorrupt = corruptReplicas.getNodes(block);
return (nodesCorrupt == null || !nodesCorrupt.contains(node)) // not corrupt
// not over scheduling for replication
&& (node.getNumberOfBlocksToBeReplicated() < maxReplicationStreams)
// not alredy scheduled for removal
&& (excessBlocks == null || !excessBlocks.contains(block))
&& !node.isDecommissioned(); // not decommissioned
} | [
"private",
"boolean",
"isGoodReplica",
"(",
"DatanodeDescriptor",
"node",
",",
"Block",
"block",
")",
"{",
"Collection",
"<",
"Block",
">",
"excessBlocks",
"=",
"excessReplicateMap",
".",
"get",
"(",
"node",
".",
"getStorageID",
"(",
")",
")",
";",
"Collection... | Decide if a replica is valid
@param node datanode the block is located
@param block a block
@return true if a replica is valid | [
"Decide",
"if",
"a",
"replica",
"is",
"valid"
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L5697-L5707 |
JakeWharton/ActionBarSherlock | actionbarsherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/PropertyValuesHolder.java | PropertyValuesHolder.setupValue | private void setupValue(Object target, Keyframe kf) {
//if (mProperty != null) {
// kf.setValue(mProperty.get(target));
//}
try {
if (mGetter == null) {
Class targetClass = target.getClass();
setupGetter(targetClass);
}
kf.setValue(mGetter.invoke(target));
} catch (InvocationTargetException e) {
Log.e("PropertyValuesHolder", e.toString());
} catch (IllegalAccessException e) {
Log.e("PropertyValuesHolder", e.toString());
}
} | java | private void setupValue(Object target, Keyframe kf) {
//if (mProperty != null) {
// kf.setValue(mProperty.get(target));
//}
try {
if (mGetter == null) {
Class targetClass = target.getClass();
setupGetter(targetClass);
}
kf.setValue(mGetter.invoke(target));
} catch (InvocationTargetException e) {
Log.e("PropertyValuesHolder", e.toString());
} catch (IllegalAccessException e) {
Log.e("PropertyValuesHolder", e.toString());
}
} | [
"private",
"void",
"setupValue",
"(",
"Object",
"target",
",",
"Keyframe",
"kf",
")",
"{",
"//if (mProperty != null) {",
"// kf.setValue(mProperty.get(target));",
"//}",
"try",
"{",
"if",
"(",
"mGetter",
"==",
"null",
")",
"{",
"Class",
"targetClass",
"=",
"tar... | Utility function to set the value stored in a particular Keyframe. The value used is
whatever the value is for the property name specified in the keyframe on the target object.
@param target The target object from which the current value should be extracted.
@param kf The keyframe which holds the property name and value. | [
"Utility",
"function",
"to",
"set",
"the",
"value",
"stored",
"in",
"a",
"particular",
"Keyframe",
".",
"The",
"value",
"used",
"is",
"whatever",
"the",
"value",
"is",
"for",
"the",
"property",
"name",
"specified",
"in",
"the",
"keyframe",
"on",
"the",
"ta... | train | https://github.com/JakeWharton/ActionBarSherlock/blob/2c71339e756bcc0b1424c4525680549ba3a2dc97/actionbarsherlock/src/com/actionbarsherlock/internal/nineoldandroids/animation/PropertyValuesHolder.java#L532-L547 |
pravega/pravega | client/src/main/java/io/pravega/client/stream/impl/StreamSegments.java | StreamSegments.verifyReplacementRange | private void verifyReplacementRange(SegmentWithRange replacedSegment, StreamSegmentsWithPredecessors replacementSegments) {
log.debug("Verification of replacement segments {} with the current segments {}", replacementSegments, segments);
Map<Long, List<SegmentWithRange>> replacementRanges = replacementSegments.getReplacementRanges();
List<SegmentWithRange> replacements = replacementRanges.get(replacedSegment.getSegment().getSegmentId());
Preconditions.checkArgument(replacements != null, "Replacement segments did not contain replacements for segment being replaced");
if (replacementRanges.size() == 1) {
//Simple split
Preconditions.checkArgument(replacedSegment.getHigh() == getUpperBound(replacements));
Preconditions.checkArgument(replacedSegment.getLow() == getLowerBound(replacements));
} else {
Preconditions.checkArgument(replacedSegment.getHigh() <= getUpperBound(replacements));
Preconditions.checkArgument(replacedSegment.getLow() >= getLowerBound(replacements));
}
for (Entry<Long, List<SegmentWithRange>> ranges : replacementRanges.entrySet()) {
Entry<Double, SegmentWithRange> upperReplacedSegment = segments.floorEntry(getUpperBound(ranges.getValue()));
Entry<Double, SegmentWithRange> lowerReplacedSegment = segments.higherEntry(getLowerBound(ranges.getValue()));
Preconditions.checkArgument(upperReplacedSegment != null, "Missing replaced replacement segments %s",
replacementSegments);
Preconditions.checkArgument(lowerReplacedSegment != null, "Missing replaced replacement segments %s",
replacementSegments);
}
} | java | private void verifyReplacementRange(SegmentWithRange replacedSegment, StreamSegmentsWithPredecessors replacementSegments) {
log.debug("Verification of replacement segments {} with the current segments {}", replacementSegments, segments);
Map<Long, List<SegmentWithRange>> replacementRanges = replacementSegments.getReplacementRanges();
List<SegmentWithRange> replacements = replacementRanges.get(replacedSegment.getSegment().getSegmentId());
Preconditions.checkArgument(replacements != null, "Replacement segments did not contain replacements for segment being replaced");
if (replacementRanges.size() == 1) {
//Simple split
Preconditions.checkArgument(replacedSegment.getHigh() == getUpperBound(replacements));
Preconditions.checkArgument(replacedSegment.getLow() == getLowerBound(replacements));
} else {
Preconditions.checkArgument(replacedSegment.getHigh() <= getUpperBound(replacements));
Preconditions.checkArgument(replacedSegment.getLow() >= getLowerBound(replacements));
}
for (Entry<Long, List<SegmentWithRange>> ranges : replacementRanges.entrySet()) {
Entry<Double, SegmentWithRange> upperReplacedSegment = segments.floorEntry(getUpperBound(ranges.getValue()));
Entry<Double, SegmentWithRange> lowerReplacedSegment = segments.higherEntry(getLowerBound(ranges.getValue()));
Preconditions.checkArgument(upperReplacedSegment != null, "Missing replaced replacement segments %s",
replacementSegments);
Preconditions.checkArgument(lowerReplacedSegment != null, "Missing replaced replacement segments %s",
replacementSegments);
}
} | [
"private",
"void",
"verifyReplacementRange",
"(",
"SegmentWithRange",
"replacedSegment",
",",
"StreamSegmentsWithPredecessors",
"replacementSegments",
")",
"{",
"log",
".",
"debug",
"(",
"\"Verification of replacement segments {} with the current segments {}\"",
",",
"replacementSe... | Checks that replacementSegments provided are consistent with the segments that are currently being used.
@param replacedSegment The segment on which EOS was reached
@param replacementSegments The StreamSegmentsWithPredecessors to verify | [
"Checks",
"that",
"replacementSegments",
"provided",
"are",
"consistent",
"with",
"the",
"segments",
"that",
"are",
"currently",
"being",
"used",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/client/src/main/java/io/pravega/client/stream/impl/StreamSegments.java#L145-L166 |
Impetus/Kundera | src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBSchemaManager.java | CouchDBSchemaManager.createViewForSelectAllIfNotExist | private void createViewForSelectAllIfNotExist(TableInfo tableInfo, Map<String, MapReduce> views)
{
if (views.get("all") == null)
{
createViewForSelectAll(tableInfo, views);
}
} | java | private void createViewForSelectAllIfNotExist(TableInfo tableInfo, Map<String, MapReduce> views)
{
if (views.get("all") == null)
{
createViewForSelectAll(tableInfo, views);
}
} | [
"private",
"void",
"createViewForSelectAllIfNotExist",
"(",
"TableInfo",
"tableInfo",
",",
"Map",
"<",
"String",
",",
"MapReduce",
">",
"views",
")",
"{",
"if",
"(",
"views",
".",
"get",
"(",
"\"all\"",
")",
"==",
"null",
")",
"{",
"createViewForSelectAll",
... | Creates the view for select all if not exist.
@param tableInfo
the table info
@param views
the views | [
"Creates",
"the",
"view",
"for",
"select",
"all",
"if",
"not",
"exist",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBSchemaManager.java#L642-L648 |
pressgang-ccms/PressGangCCMSCommonUtilities | src/main/java/org/jboss/pressgang/ccms/utils/common/FileUtilities.java | FileUtilities.saveFile | public static void saveFile(final File file, final String contents, final String encoding) throws IOException {
saveFile(file, contents.getBytes(encoding));
} | java | public static void saveFile(final File file, final String contents, final String encoding) throws IOException {
saveFile(file, contents.getBytes(encoding));
} | [
"public",
"static",
"void",
"saveFile",
"(",
"final",
"File",
"file",
",",
"final",
"String",
"contents",
",",
"final",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"saveFile",
"(",
"file",
",",
"contents",
".",
"getBytes",
"(",
"encoding",
")",
... | Save the data, represented as a String to a file
@param file The location/name of the file to be saved.
@param contents The data that is to be written to the file.
@throws IOException | [
"Save",
"the",
"data",
"represented",
"as",
"a",
"String",
"to",
"a",
"file"
] | train | https://github.com/pressgang-ccms/PressGangCCMSCommonUtilities/blob/5ebf5ed30a94c34c33f4708caa04a8da99cbb15c/src/main/java/org/jboss/pressgang/ccms/utils/common/FileUtilities.java#L250-L252 |
eclipse/xtext-core | org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/syntaxcoloring/DefaultSemanticHighlightingCalculator.java | DefaultSemanticHighlightingCalculator.highlightNode | protected void highlightNode(IHighlightedPositionAcceptor acceptor, INode node, String... styleIds) {
if (node == null)
return;
if (node instanceof ILeafNode) {
ITextRegion textRegion = node.getTextRegion();
acceptor.addPosition(textRegion.getOffset(), textRegion.getLength(), styleIds);
} else {
for (ILeafNode leaf : node.getLeafNodes()) {
if (!leaf.isHidden()) {
ITextRegion leafRegion = leaf.getTextRegion();
acceptor.addPosition(leafRegion.getOffset(), leafRegion.getLength(), styleIds);
}
}
}
} | java | protected void highlightNode(IHighlightedPositionAcceptor acceptor, INode node, String... styleIds) {
if (node == null)
return;
if (node instanceof ILeafNode) {
ITextRegion textRegion = node.getTextRegion();
acceptor.addPosition(textRegion.getOffset(), textRegion.getLength(), styleIds);
} else {
for (ILeafNode leaf : node.getLeafNodes()) {
if (!leaf.isHidden()) {
ITextRegion leafRegion = leaf.getTextRegion();
acceptor.addPosition(leafRegion.getOffset(), leafRegion.getLength(), styleIds);
}
}
}
} | [
"protected",
"void",
"highlightNode",
"(",
"IHighlightedPositionAcceptor",
"acceptor",
",",
"INode",
"node",
",",
"String",
"...",
"styleIds",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"return",
";",
"if",
"(",
"node",
"instanceof",
"ILeafNode",
")",
"... | Highlights the non-hidden parts of {@code node} with the styles given by the {@code styleIds} | [
"Highlights",
"the",
"non",
"-",
"hidden",
"parts",
"of",
"{"
] | train | https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/editor/syntaxcoloring/DefaultSemanticHighlightingCalculator.java#L121-L135 |
phax/ph-commons | ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriter.java | XMLWriter.getNodeAsString | @Nullable
public static String getNodeAsString (@Nonnull final Node aNode, @Nonnull final IXMLWriterSettings aSettings)
{
// start serializing
try (final NonBlockingStringWriter aWriter = new NonBlockingStringWriter (50 * CGlobal.BYTES_PER_KILOBYTE))
{
if (writeToWriter (aNode, aWriter, aSettings).isSuccess ())
{
s_aSizeHdl.addSize (aWriter.size ());
return aWriter.getAsString ();
}
}
catch (final Exception ex)
{
if (LOGGER.isErrorEnabled ())
LOGGER.error ("Error serializing DOM node with settings " + aSettings.toString (), ex);
}
return null;
} | java | @Nullable
public static String getNodeAsString (@Nonnull final Node aNode, @Nonnull final IXMLWriterSettings aSettings)
{
// start serializing
try (final NonBlockingStringWriter aWriter = new NonBlockingStringWriter (50 * CGlobal.BYTES_PER_KILOBYTE))
{
if (writeToWriter (aNode, aWriter, aSettings).isSuccess ())
{
s_aSizeHdl.addSize (aWriter.size ());
return aWriter.getAsString ();
}
}
catch (final Exception ex)
{
if (LOGGER.isErrorEnabled ())
LOGGER.error ("Error serializing DOM node with settings " + aSettings.toString (), ex);
}
return null;
} | [
"@",
"Nullable",
"public",
"static",
"String",
"getNodeAsString",
"(",
"@",
"Nonnull",
"final",
"Node",
"aNode",
",",
"@",
"Nonnull",
"final",
"IXMLWriterSettings",
"aSettings",
")",
"{",
"// start serializing",
"try",
"(",
"final",
"NonBlockingStringWriter",
"aWrit... | Convert the passed DOM node to an XML string using the provided XML writer
settings.
@param aNode
The node to be converted to a string. May not be <code>null</code> .
@param aSettings
The XML writer settings to be used. May not be <code>null</code>.
@return The string representation of the passed node.
@since 8.6.3 | [
"Convert",
"the",
"passed",
"DOM",
"node",
"to",
"an",
"XML",
"string",
"using",
"the",
"provided",
"XML",
"writer",
"settings",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLWriter.java#L202-L220 |
Azure/azure-sdk-for-java | edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java | DevicesInner.downloadUpdatesAsync | public Observable<Void> downloadUpdatesAsync(String deviceName, String resourceGroupName) {
return downloadUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> downloadUpdatesAsync(String deviceName, String resourceGroupName) {
return downloadUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"downloadUpdatesAsync",
"(",
"String",
"deviceName",
",",
"String",
"resourceGroupName",
")",
"{",
"return",
"downloadUpdatesWithServiceResponseAsync",
"(",
"deviceName",
",",
"resourceGroupName",
")",
".",
"map",
"(",
"new",
... | Downloads the updates on a data box edge/gateway device.
@param deviceName The device name.
@param resourceGroupName The resource group name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Downloads",
"the",
"updates",
"on",
"a",
"data",
"box",
"edge",
"/",
"gateway",
"device",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1227-L1234 |
ops4j/org.ops4j.pax.logging | pax-logging-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java | StringBuilders.trimToMaxSize | public static void trimToMaxSize(final StringBuilder stringBuilder, final int maxSize) {
if (stringBuilder != null && stringBuilder.capacity() > maxSize) {
stringBuilder.setLength(maxSize);
stringBuilder.trimToSize();
}
} | java | public static void trimToMaxSize(final StringBuilder stringBuilder, final int maxSize) {
if (stringBuilder != null && stringBuilder.capacity() > maxSize) {
stringBuilder.setLength(maxSize);
stringBuilder.trimToSize();
}
} | [
"public",
"static",
"void",
"trimToMaxSize",
"(",
"final",
"StringBuilder",
"stringBuilder",
",",
"final",
"int",
"maxSize",
")",
"{",
"if",
"(",
"stringBuilder",
"!=",
"null",
"&&",
"stringBuilder",
".",
"capacity",
"(",
")",
">",
"maxSize",
")",
"{",
"stri... | Ensures that the char[] array of the specified StringBuilder does not exceed the specified number of characters.
This method is useful to ensure that excessively long char[] arrays are not kept in memory forever.
@param stringBuilder the StringBuilder to check
@param maxSize the maximum number of characters the StringBuilder is allowed to have
@since 2.9 | [
"Ensures",
"that",
"the",
"char",
"[]",
"array",
"of",
"the",
"specified",
"StringBuilder",
"does",
"not",
"exceed",
"the",
"specified",
"number",
"of",
"characters",
".",
"This",
"method",
"is",
"useful",
"to",
"ensure",
"that",
"excessively",
"long",
"char",... | train | https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/util/StringBuilders.java#L155-L160 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/layout/LayoutFactory.java | LayoutFactory.layoutFor | public Layout layoutFor(Class<? extends Storable> type)
throws FetchException, PersistException
{
return layoutFor(type, null);
} | java | public Layout layoutFor(Class<? extends Storable> type)
throws FetchException, PersistException
{
return layoutFor(type, null);
} | [
"public",
"Layout",
"layoutFor",
"(",
"Class",
"<",
"?",
"extends",
"Storable",
">",
"type",
")",
"throws",
"FetchException",
",",
"PersistException",
"{",
"return",
"layoutFor",
"(",
"type",
",",
"null",
")",
";",
"}"
] | Returns the layout matching the current definition of the given type.
@throws PersistException if type represents a new generation, but
persisting this information failed | [
"Returns",
"the",
"layout",
"matching",
"the",
"current",
"definition",
"of",
"the",
"given",
"type",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/layout/LayoutFactory.java#L97-L101 |
xiancloud/xian | xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java | ZKPaths.deleteChildren | public static void deleteChildren(ZooKeeper zookeeper, String path, boolean deleteSelf) throws InterruptedException, KeeperException
{
PathUtils.validatePath(path);
List<String> children = zookeeper.getChildren(path, null);
for ( String child : children )
{
String fullPath = makePath(path, child);
deleteChildren(zookeeper, fullPath, true);
}
if ( deleteSelf )
{
try
{
zookeeper.delete(path, -1);
}
catch ( KeeperException.NotEmptyException e )
{
//someone has created a new child since we checked ... delete again.
deleteChildren(zookeeper, path, true);
}
catch ( KeeperException.NoNodeException e )
{
// ignore... someone else has deleted the node it since we checked
}
}
} | java | public static void deleteChildren(ZooKeeper zookeeper, String path, boolean deleteSelf) throws InterruptedException, KeeperException
{
PathUtils.validatePath(path);
List<String> children = zookeeper.getChildren(path, null);
for ( String child : children )
{
String fullPath = makePath(path, child);
deleteChildren(zookeeper, fullPath, true);
}
if ( deleteSelf )
{
try
{
zookeeper.delete(path, -1);
}
catch ( KeeperException.NotEmptyException e )
{
//someone has created a new child since we checked ... delete again.
deleteChildren(zookeeper, path, true);
}
catch ( KeeperException.NoNodeException e )
{
// ignore... someone else has deleted the node it since we checked
}
}
} | [
"public",
"static",
"void",
"deleteChildren",
"(",
"ZooKeeper",
"zookeeper",
",",
"String",
"path",
",",
"boolean",
"deleteSelf",
")",
"throws",
"InterruptedException",
",",
"KeeperException",
"{",
"PathUtils",
".",
"validatePath",
"(",
"path",
")",
";",
"List",
... | Recursively deletes children of a node.
@param zookeeper the client
@param path path of the node to delete
@param deleteSelf flag that indicates that the node should also get deleted
@throws InterruptedException
@throws KeeperException | [
"Recursively",
"deletes",
"children",
"of",
"a",
"node",
"."
] | train | https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-client/src/main/java/org/apache/curator/utils/ZKPaths.java#L312-L339 |
aws/aws-sdk-java | aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/PrimaryKey.java | PrimaryKey.addComponent | public PrimaryKey addComponent(String keyAttributeName, Object keyAttributeValue) {
components.put(keyAttributeName,
new KeyAttribute(keyAttributeName, keyAttributeValue));
return this;
} | java | public PrimaryKey addComponent(String keyAttributeName, Object keyAttributeValue) {
components.put(keyAttributeName,
new KeyAttribute(keyAttributeName, keyAttributeValue));
return this;
} | [
"public",
"PrimaryKey",
"addComponent",
"(",
"String",
"keyAttributeName",
",",
"Object",
"keyAttributeValue",
")",
"{",
"components",
".",
"put",
"(",
"keyAttributeName",
",",
"new",
"KeyAttribute",
"(",
"keyAttributeName",
",",
"keyAttributeValue",
")",
")",
";",
... | Add a key component to this primary key.
Note adding a key component with the same name as that of an existing
one would overwrite and become a single key component instead of two. | [
"Add",
"a",
"key",
"component",
"to",
"this",
"primary",
"key",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/PrimaryKey.java#L101-L105 |
roboconf/roboconf-platform | core/roboconf-core/src/main/java/net/roboconf/core/dsl/ParsingModelIo.java | ParsingModelIo.saveRelationsFile | public static void saveRelationsFile( FileDefinition relationsFile, boolean writeComments, String lineSeparator )
throws IOException {
if( relationsFile.getEditedFile() == null )
throw new IOException( "Save operation could not be performed. The model was not loaded from a local file." );
saveRelationsFileInto( relationsFile.getEditedFile(), relationsFile, writeComments, lineSeparator );
} | java | public static void saveRelationsFile( FileDefinition relationsFile, boolean writeComments, String lineSeparator )
throws IOException {
if( relationsFile.getEditedFile() == null )
throw new IOException( "Save operation could not be performed. The model was not loaded from a local file." );
saveRelationsFileInto( relationsFile.getEditedFile(), relationsFile, writeComments, lineSeparator );
} | [
"public",
"static",
"void",
"saveRelationsFile",
"(",
"FileDefinition",
"relationsFile",
",",
"boolean",
"writeComments",
",",
"String",
"lineSeparator",
")",
"throws",
"IOException",
"{",
"if",
"(",
"relationsFile",
".",
"getEditedFile",
"(",
")",
"==",
"null",
"... | Saves the model into the original file.
@param relationsFile the relations file
@param writeComments true to write comments
@param lineSeparator the line separator (if null, the OS' one is used)
@throws IOException if the file could not be saved | [
"Saves",
"the",
"model",
"into",
"the",
"original",
"file",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/dsl/ParsingModelIo.java#L87-L94 |
apereo/cas | support/cas-server-support-wsfederation/src/main/java/org/apereo/cas/support/wsfederation/WsFederationConfiguration.java | WsFederationConfiguration.getAuthorizationUrl | public String getAuthorizationUrl(final String relyingPartyIdentifier, final String wctx) {
return String.format(getIdentityProviderUrl() + QUERYSTRING, relyingPartyIdentifier, wctx);
} | java | public String getAuthorizationUrl(final String relyingPartyIdentifier, final String wctx) {
return String.format(getIdentityProviderUrl() + QUERYSTRING, relyingPartyIdentifier, wctx);
} | [
"public",
"String",
"getAuthorizationUrl",
"(",
"final",
"String",
"relyingPartyIdentifier",
",",
"final",
"String",
"wctx",
")",
"{",
"return",
"String",
".",
"format",
"(",
"getIdentityProviderUrl",
"(",
")",
"+",
"QUERYSTRING",
",",
"relyingPartyIdentifier",
",",... | Gets authorization url.
@param relyingPartyIdentifier the relying party identifier
@param wctx the wctx
@return the authorization url | [
"Gets",
"authorization",
"url",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-wsfederation/src/main/java/org/apereo/cas/support/wsfederation/WsFederationConfiguration.java#L137-L139 |
GerdHolz/TOVAL | src/de/invation/code/toval/misc/SetUtils.java | SetUtils.getRandomSubsetMin | public static <T> Set<T> getRandomSubsetMin(Set<T> set, int minCount) {
int count = RandomUtils.randomIntBetween(minCount, set.size());
return getRandomSubset(set, count);
} | java | public static <T> Set<T> getRandomSubsetMin(Set<T> set, int minCount) {
int count = RandomUtils.randomIntBetween(minCount, set.size());
return getRandomSubset(set, count);
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"getRandomSubsetMin",
"(",
"Set",
"<",
"T",
">",
"set",
",",
"int",
"minCount",
")",
"{",
"int",
"count",
"=",
"RandomUtils",
".",
"randomIntBetween",
"(",
"minCount",
",",
"set",
".",
"size",
... | Generates a random subset of <code>set</code>, that contains at least
<code>maxCount</code> elements.
@param <T>
Type of set elements
@param set
Basic set for operation
@param minCount
Minimum number of items
@return A subset with at least <code>minCount</code> elements | [
"Generates",
"a",
"random",
"subset",
"of",
"<code",
">",
"set<",
"/",
"code",
">",
"that",
"contains",
"at",
"least",
"<code",
">",
"maxCount<",
"/",
"code",
">",
"elements",
"."
] | train | https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/misc/SetUtils.java#L63-L66 |
cybazeitalia/emaze-dysfunctional | src/main/java/net/emaze/dysfunctional/Spies.java | Spies.spy1st | public static <R, T> Function<T, R> spy1st(Function<T, R> function, Box<T> param) {
return spy(function, Box.<R>empty(), param);
} | java | public static <R, T> Function<T, R> spy1st(Function<T, R> function, Box<T> param) {
return spy(function, Box.<R>empty(), param);
} | [
"public",
"static",
"<",
"R",
",",
"T",
">",
"Function",
"<",
"T",
",",
"R",
">",
"spy1st",
"(",
"Function",
"<",
"T",
",",
"R",
">",
"function",
",",
"Box",
"<",
"T",
">",
"param",
")",
"{",
"return",
"spy",
"(",
"function",
",",
"Box",
".",
... | Proxies a function spying for parameter.
@param <R> the function result type
@param <T> the function parameter type
@param function the function that will be spied
@param param a box that will be containing spied parameter
@return the proxied function | [
"Proxies",
"a",
"function",
"spying",
"for",
"parameter",
"."
] | train | https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L307-L309 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.serviceName_pca_pcaServiceName_billing_billingId_GET | public OvhBilling serviceName_pca_pcaServiceName_billing_billingId_GET(String serviceName, String pcaServiceName, Long billingId) throws IOException {
String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/billing/{billingId}";
StringBuilder sb = path(qPath, serviceName, pcaServiceName, billingId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBilling.class);
} | java | public OvhBilling serviceName_pca_pcaServiceName_billing_billingId_GET(String serviceName, String pcaServiceName, Long billingId) throws IOException {
String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/billing/{billingId}";
StringBuilder sb = path(qPath, serviceName, pcaServiceName, billingId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhBilling.class);
} | [
"public",
"OvhBilling",
"serviceName_pca_pcaServiceName_billing_billingId_GET",
"(",
"String",
"serviceName",
",",
"String",
"pcaServiceName",
",",
"Long",
"billingId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/{serviceName}/pca/{pcaServiceName}/billi... | Get this object properties
REST: GET /cloud/{serviceName}/pca/{pcaServiceName}/billing/{billingId}
@param serviceName [required] The internal name of your public cloud passport
@param pcaServiceName [required] The internal name of your PCA offer
@param billingId [required] Billing id
@deprecated | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2581-L2586 |
adamfisk/littleshoot-commons-id | src/main/java/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGenerator.java | TimeBasedAlphanumericIdentifierGenerator.getMillisecondsFromId | public long getMillisecondsFromId(final Object id, final long offset) {
if (id instanceof String && id.toString().length() >= MAX_LONG_ALPHANUMERIC_VALUE_LENGTH) {
final char[] buffer = new char[MAX_LONG_ALPHANUMERIC_VALUE_LENGTH];
System.arraycopy(
id.toString().toCharArray(), 0, buffer, 0, MAX_LONG_ALPHANUMERIC_VALUE_LENGTH);
final boolean overflow = buffer[0] > '1';
if (overflow) {
buffer[0] -= 2;
}
long value = Long.parseLong(new String(buffer), ALPHA_NUMERIC_CHARSET_SIZE);
if (overflow) {
value -= Long.MAX_VALUE + 1;
}
return value + offset;
}
throw new IllegalArgumentException("'" + id + "' is not an id from this generator");
} | java | public long getMillisecondsFromId(final Object id, final long offset) {
if (id instanceof String && id.toString().length() >= MAX_LONG_ALPHANUMERIC_VALUE_LENGTH) {
final char[] buffer = new char[MAX_LONG_ALPHANUMERIC_VALUE_LENGTH];
System.arraycopy(
id.toString().toCharArray(), 0, buffer, 0, MAX_LONG_ALPHANUMERIC_VALUE_LENGTH);
final boolean overflow = buffer[0] > '1';
if (overflow) {
buffer[0] -= 2;
}
long value = Long.parseLong(new String(buffer), ALPHA_NUMERIC_CHARSET_SIZE);
if (overflow) {
value -= Long.MAX_VALUE + 1;
}
return value + offset;
}
throw new IllegalArgumentException("'" + id + "' is not an id from this generator");
} | [
"public",
"long",
"getMillisecondsFromId",
"(",
"final",
"Object",
"id",
",",
"final",
"long",
"offset",
")",
"{",
"if",
"(",
"id",
"instanceof",
"String",
"&&",
"id",
".",
"toString",
"(",
")",
".",
"length",
"(",
")",
">=",
"MAX_LONG_ALPHANUMERIC_VALUE_LEN... | Retrieve the number of milliseconds since 1st Jan 1970 that were the base for the given id.
@param id the id to use
@param offset the offset used to create the id
@return the number of milliseconds
@throws IllegalArgumentException if <code>id</code> is not a valid id from this type of
generator | [
"Retrieve",
"the",
"number",
"of",
"milliseconds",
"since",
"1st",
"Jan",
"1970",
"that",
"were",
"the",
"base",
"for",
"the",
"given",
"id",
"."
] | train | https://github.com/adamfisk/littleshoot-commons-id/blob/49a8f5f2b10831c509876ca463bf1a87e1e49ae9/src/main/java/org/apache/commons/id/serial/TimeBasedAlphanumericIdentifierGenerator.java#L192-L208 |
joniles/mpxj | src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java | MapFileGenerator.addClass | private void addClass(URLClassLoader loader, JarEntry jarEntry, XMLStreamWriter writer, boolean mapClassMethods) throws ClassNotFoundException, XMLStreamException, IntrospectionException
{
String className = jarEntry.getName().replaceAll("\\.class", "").replaceAll("/", ".");
writer.writeStartElement("class");
writer.writeAttribute("name", className);
Set<Method> methodSet = new HashSet<Method>();
Class<?> aClass = loader.loadClass(className);
processProperties(writer, methodSet, aClass);
if (mapClassMethods && !Modifier.isInterface(aClass.getModifiers()))
{
processClassMethods(writer, aClass, methodSet);
}
writer.writeEndElement();
} | java | private void addClass(URLClassLoader loader, JarEntry jarEntry, XMLStreamWriter writer, boolean mapClassMethods) throws ClassNotFoundException, XMLStreamException, IntrospectionException
{
String className = jarEntry.getName().replaceAll("\\.class", "").replaceAll("/", ".");
writer.writeStartElement("class");
writer.writeAttribute("name", className);
Set<Method> methodSet = new HashSet<Method>();
Class<?> aClass = loader.loadClass(className);
processProperties(writer, methodSet, aClass);
if (mapClassMethods && !Modifier.isInterface(aClass.getModifiers()))
{
processClassMethods(writer, aClass, methodSet);
}
writer.writeEndElement();
} | [
"private",
"void",
"addClass",
"(",
"URLClassLoader",
"loader",
",",
"JarEntry",
"jarEntry",
",",
"XMLStreamWriter",
"writer",
",",
"boolean",
"mapClassMethods",
")",
"throws",
"ClassNotFoundException",
",",
"XMLStreamException",
",",
"IntrospectionException",
"{",
"Str... | Add an individual class to the map file.
@param loader jar file class loader
@param jarEntry jar file entry
@param writer XML stream writer
@param mapClassMethods true if we want to produce .Net style class method names
@throws ClassNotFoundException
@throws XMLStreamException
@throws IntrospectionException | [
"Add",
"an",
"individual",
"class",
"to",
"the",
"map",
"file",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L178-L194 |
citrusframework/citrus | modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/message/KubernetesMessageConverter.java | KubernetesMessageConverter.getCommand | private KubernetesCommand<?> getCommand(Message message, KubernetesEndpointConfiguration endpointConfiguration) {
Object payload = message.getPayload();
KubernetesCommand<?> command;
if (message instanceof KubernetesMessage) {
command = createCommandFromRequest(message.getPayload(KubernetesRequest.class));
} else if (message.getHeaders().containsKey(KubernetesMessageHeaders.COMMAND) &&
(payload == null || !StringUtils.hasText(payload.toString()))) {
command = getCommandByName(message.getHeader(KubernetesMessageHeaders.COMMAND).toString());
} else if (payload instanceof KubernetesCommand) {
command = (KubernetesCommand) payload;
} else {
try {
KubernetesRequest request = endpointConfiguration.getObjectMapper()
.readValue(message.getPayload(String.class), KubernetesRequest.class);
command = createCommandFromRequest(request);
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read kubernetes request from payload", e);
}
}
if (command == null) {
throw new CitrusRuntimeException("Unable to create proper Kubernetes command from payload: " + payload);
}
return command;
} | java | private KubernetesCommand<?> getCommand(Message message, KubernetesEndpointConfiguration endpointConfiguration) {
Object payload = message.getPayload();
KubernetesCommand<?> command;
if (message instanceof KubernetesMessage) {
command = createCommandFromRequest(message.getPayload(KubernetesRequest.class));
} else if (message.getHeaders().containsKey(KubernetesMessageHeaders.COMMAND) &&
(payload == null || !StringUtils.hasText(payload.toString()))) {
command = getCommandByName(message.getHeader(KubernetesMessageHeaders.COMMAND).toString());
} else if (payload instanceof KubernetesCommand) {
command = (KubernetesCommand) payload;
} else {
try {
KubernetesRequest request = endpointConfiguration.getObjectMapper()
.readValue(message.getPayload(String.class), KubernetesRequest.class);
command = createCommandFromRequest(request);
} catch (IOException e) {
throw new CitrusRuntimeException("Failed to read kubernetes request from payload", e);
}
}
if (command == null) {
throw new CitrusRuntimeException("Unable to create proper Kubernetes command from payload: " + payload);
}
return command;
} | [
"private",
"KubernetesCommand",
"<",
"?",
">",
"getCommand",
"(",
"Message",
"message",
",",
"KubernetesEndpointConfiguration",
"endpointConfiguration",
")",
"{",
"Object",
"payload",
"=",
"message",
".",
"getPayload",
"(",
")",
";",
"KubernetesCommand",
"<",
"?",
... | Reads Citrus internal mail message model object from message payload. Either payload is actually a mail message object or
XML payload String is unmarshalled to mail message object.
@param message
@param endpointConfiguration
@return | [
"Reads",
"Citrus",
"internal",
"mail",
"message",
"model",
"object",
"from",
"message",
"payload",
".",
"Either",
"payload",
"is",
"actually",
"a",
"mail",
"message",
"object",
"or",
"XML",
"payload",
"String",
"is",
"unmarshalled",
"to",
"mail",
"message",
"o... | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-kubernetes/src/main/java/com/consol/citrus/kubernetes/message/KubernetesMessageConverter.java#L161-L187 |
timehop/sticky-headers-recyclerview | library/src/main/java/com/timehop/stickyheadersrecyclerview/rendering/HeaderRenderer.java | HeaderRenderer.drawHeader | public void drawHeader(RecyclerView recyclerView, Canvas canvas, View header, Rect offset) {
canvas.save();
if (recyclerView.getLayoutManager().getClipToPadding()) {
// Clip drawing of headers to the padding of the RecyclerView. Avoids drawing in the padding
initClipRectForHeader(mTempRect, recyclerView, header);
canvas.clipRect(mTempRect);
}
canvas.translate(offset.left, offset.top);
header.draw(canvas);
canvas.restore();
} | java | public void drawHeader(RecyclerView recyclerView, Canvas canvas, View header, Rect offset) {
canvas.save();
if (recyclerView.getLayoutManager().getClipToPadding()) {
// Clip drawing of headers to the padding of the RecyclerView. Avoids drawing in the padding
initClipRectForHeader(mTempRect, recyclerView, header);
canvas.clipRect(mTempRect);
}
canvas.translate(offset.left, offset.top);
header.draw(canvas);
canvas.restore();
} | [
"public",
"void",
"drawHeader",
"(",
"RecyclerView",
"recyclerView",
",",
"Canvas",
"canvas",
",",
"View",
"header",
",",
"Rect",
"offset",
")",
"{",
"canvas",
".",
"save",
"(",
")",
";",
"if",
"(",
"recyclerView",
".",
"getLayoutManager",
"(",
")",
".",
... | Draws a header to a canvas, offsetting by some x and y amount
@param recyclerView the parent recycler view for drawing the header into
@param canvas the canvas on which to draw the header
@param header the view to draw as the header
@param offset a Rect used to define the x/y offset of the header. Specify x/y offset by setting
the {@link Rect#left} and {@link Rect#top} properties, respectively. | [
"Draws",
"a",
"header",
"to",
"a",
"canvas",
"offsetting",
"by",
"some",
"x",
"and",
"y",
"amount"
] | train | https://github.com/timehop/sticky-headers-recyclerview/blob/f5a9e9b8f5d96734e20439b0a41381865fa52fb7/library/src/main/java/com/timehop/stickyheadersrecyclerview/rendering/HeaderRenderer.java#L45-L58 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/MPPUtility.java | MPPUtility.decodeBuffer | public static final void decodeBuffer(byte[] data, byte encryptionCode)
{
for (int i = 0; i < data.length; i++)
{
data[i] = (byte) (data[i] ^ encryptionCode);
}
} | java | public static final void decodeBuffer(byte[] data, byte encryptionCode)
{
for (int i = 0; i < data.length; i++)
{
data[i] = (byte) (data[i] ^ encryptionCode);
}
} | [
"public",
"static",
"final",
"void",
"decodeBuffer",
"(",
"byte",
"[",
"]",
"data",
",",
"byte",
"encryptionCode",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"data",
"[",
"i",
"]",
... | This method decodes a byte array with the given encryption code
using XOR encryption.
@param data Source data
@param encryptionCode Encryption code | [
"This",
"method",
"decodes",
"a",
"byte",
"array",
"with",
"the",
"given",
"encryption",
"code",
"using",
"XOR",
"encryption",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L64-L70 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/RouteFilterRulesInner.java | RouteFilterRulesInner.listByRouteFilterAsync | public Observable<Page<RouteFilterRuleInner>> listByRouteFilterAsync(final String resourceGroupName, final String routeFilterName) {
return listByRouteFilterWithServiceResponseAsync(resourceGroupName, routeFilterName)
.map(new Func1<ServiceResponse<Page<RouteFilterRuleInner>>, Page<RouteFilterRuleInner>>() {
@Override
public Page<RouteFilterRuleInner> call(ServiceResponse<Page<RouteFilterRuleInner>> response) {
return response.body();
}
});
} | java | public Observable<Page<RouteFilterRuleInner>> listByRouteFilterAsync(final String resourceGroupName, final String routeFilterName) {
return listByRouteFilterWithServiceResponseAsync(resourceGroupName, routeFilterName)
.map(new Func1<ServiceResponse<Page<RouteFilterRuleInner>>, Page<RouteFilterRuleInner>>() {
@Override
public Page<RouteFilterRuleInner> call(ServiceResponse<Page<RouteFilterRuleInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"RouteFilterRuleInner",
">",
">",
"listByRouteFilterAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"routeFilterName",
")",
"{",
"return",
"listByRouteFilterWithServiceResponseAsync",
"(",
"resourceGro... | Gets all RouteFilterRules in a route filter.
@param resourceGroupName The name of the resource group.
@param routeFilterName The name of the route filter.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<RouteFilterRuleInner> object | [
"Gets",
"all",
"RouteFilterRules",
"in",
"a",
"route",
"filter",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/RouteFilterRulesInner.java#L772-L780 |
IanGClifton/AndroidFloatLabel | FloatLabel/src/com/iangclifton/android/floatlabel/FloatLabel.java | FloatLabel.setTextWithoutAnimation | public void setTextWithoutAnimation(int resid, TextView.BufferType type) {
mSkipAnimation = true;
mEditText.setText(resid, type);
} | java | public void setTextWithoutAnimation(int resid, TextView.BufferType type) {
mSkipAnimation = true;
mEditText.setText(resid, type);
} | [
"public",
"void",
"setTextWithoutAnimation",
"(",
"int",
"resid",
",",
"TextView",
".",
"BufferType",
"type",
")",
"{",
"mSkipAnimation",
"=",
"true",
";",
"mEditText",
".",
"setText",
"(",
"resid",
",",
"type",
")",
";",
"}"
] | Sets the EditText's text without animating the label
@param resid int String resource ID
@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#L302-L305 |
netty/netty | handler/src/main/java/io/netty/handler/ssl/ConscryptAlpnSslEngine.java | ConscryptAlpnSslEngine.calculateOutNetBufSize | final int calculateOutNetBufSize(int plaintextBytes, int numBuffers) {
// Assuming a max of one frame per component in a composite buffer.
long maxOverhead = (long) Conscrypt.maxSealOverhead(getWrappedEngine()) * numBuffers;
// TODO(nmittler): update this to use MAX_ENCRYPTED_PACKET_LENGTH instead of Integer.MAX_VALUE
return (int) min(Integer.MAX_VALUE, plaintextBytes + maxOverhead);
} | java | final int calculateOutNetBufSize(int plaintextBytes, int numBuffers) {
// Assuming a max of one frame per component in a composite buffer.
long maxOverhead = (long) Conscrypt.maxSealOverhead(getWrappedEngine()) * numBuffers;
// TODO(nmittler): update this to use MAX_ENCRYPTED_PACKET_LENGTH instead of Integer.MAX_VALUE
return (int) min(Integer.MAX_VALUE, plaintextBytes + maxOverhead);
} | [
"final",
"int",
"calculateOutNetBufSize",
"(",
"int",
"plaintextBytes",
",",
"int",
"numBuffers",
")",
"{",
"// Assuming a max of one frame per component in a composite buffer.",
"long",
"maxOverhead",
"=",
"(",
"long",
")",
"Conscrypt",
".",
"maxSealOverhead",
"(",
"getW... | Calculates the maximum size of the encrypted output buffer required to wrap the given plaintext bytes. Assumes
as a worst case that there is one TLS record per buffer.
@param plaintextBytes the number of plaintext bytes to be wrapped.
@param numBuffers the number of buffers that the plaintext bytes are spread across.
@return the maximum size of the encrypted output buffer required for the wrap operation. | [
"Calculates",
"the",
"maximum",
"size",
"of",
"the",
"encrypted",
"output",
"buffer",
"required",
"to",
"wrap",
"the",
"given",
"plaintext",
"bytes",
".",
"Assumes",
"as",
"a",
"worst",
"case",
"that",
"there",
"is",
"one",
"TLS",
"record",
"per",
"buffer",
... | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/ConscryptAlpnSslEngine.java#L85-L90 |
EdwardRaff/JSAT | JSAT/src/jsat/classifiers/calibration/BinaryCalibration.java | BinaryCalibration.setCalibrationHoldOut | public void setCalibrationHoldOut(double holdOut)
{
if(Double.isNaN(holdOut) || holdOut <= 0 || holdOut >= 1)
throw new IllegalArgumentException("HoldOut must be in (0, 1), not " + holdOut);
this.holdOut = holdOut;
} | java | public void setCalibrationHoldOut(double holdOut)
{
if(Double.isNaN(holdOut) || holdOut <= 0 || holdOut >= 1)
throw new IllegalArgumentException("HoldOut must be in (0, 1), not " + holdOut);
this.holdOut = holdOut;
} | [
"public",
"void",
"setCalibrationHoldOut",
"(",
"double",
"holdOut",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"holdOut",
")",
"||",
"holdOut",
"<=",
"0",
"||",
"holdOut",
">=",
"1",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"HoldOut mu... | If the calibration mode is set to {@link CalibrationMode#HOLD_OUT}, this
what portion of the data set is randomly selected to be the hold out set.
The default is 0.3.
@param holdOut the portion in (0, 1) to hold out | [
"If",
"the",
"calibration",
"mode",
"is",
"set",
"to",
"{",
"@link",
"CalibrationMode#HOLD_OUT",
"}",
"this",
"what",
"portion",
"of",
"the",
"data",
"set",
"is",
"randomly",
"selected",
"to",
"be",
"the",
"hold",
"out",
"set",
".",
"The",
"default",
"is",... | train | https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/calibration/BinaryCalibration.java#L192-L197 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/limit/ConcurrencyLimitingHttpClient.java | ConcurrencyLimitingHttpClient.newDecorator | public static Function<Client<HttpRequest, HttpResponse>, ConcurrencyLimitingHttpClient>
newDecorator(int maxConcurrency) {
validateMaxConcurrency(maxConcurrency);
return delegate -> new ConcurrencyLimitingHttpClient(delegate, maxConcurrency);
} | java | public static Function<Client<HttpRequest, HttpResponse>, ConcurrencyLimitingHttpClient>
newDecorator(int maxConcurrency) {
validateMaxConcurrency(maxConcurrency);
return delegate -> new ConcurrencyLimitingHttpClient(delegate, maxConcurrency);
} | [
"public",
"static",
"Function",
"<",
"Client",
"<",
"HttpRequest",
",",
"HttpResponse",
">",
",",
"ConcurrencyLimitingHttpClient",
">",
"newDecorator",
"(",
"int",
"maxConcurrency",
")",
"{",
"validateMaxConcurrency",
"(",
"maxConcurrency",
")",
";",
"return",
"dele... | Creates a new {@link Client} decorator that limits the concurrent number of active HTTP requests. | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/limit/ConcurrencyLimitingHttpClient.java#L44-L48 |
libgdx/gdx-ai | gdx-ai/src/com/badlogic/gdx/ai/steer/behaviors/Hide.java | Hide.getHidingPosition | protected T getHidingPosition (T obstaclePosition, float obstacleRadius, T targetPosition) {
// Calculate how far away the agent is to be from the chosen
// obstacle's bounding radius
float distanceAway = obstacleRadius + distanceFromBoundary;
// Calculate the normalized vector toward the obstacle from the target
toObstacle.set(obstaclePosition).sub(targetPosition).nor();
// Scale it to size and add to the obstacle's position to get
// the hiding spot.
return toObstacle.scl(distanceAway).add(obstaclePosition);
} | java | protected T getHidingPosition (T obstaclePosition, float obstacleRadius, T targetPosition) {
// Calculate how far away the agent is to be from the chosen
// obstacle's bounding radius
float distanceAway = obstacleRadius + distanceFromBoundary;
// Calculate the normalized vector toward the obstacle from the target
toObstacle.set(obstaclePosition).sub(targetPosition).nor();
// Scale it to size and add to the obstacle's position to get
// the hiding spot.
return toObstacle.scl(distanceAway).add(obstaclePosition);
} | [
"protected",
"T",
"getHidingPosition",
"(",
"T",
"obstaclePosition",
",",
"float",
"obstacleRadius",
",",
"T",
"targetPosition",
")",
"{",
"// Calculate how far away the agent is to be from the chosen",
"// obstacle's bounding radius",
"float",
"distanceAway",
"=",
"obstacleRad... | Given the position of a target and the position and radius of an obstacle, this method calculates a position
{@code distanceFromBoundary} away from the object's bounding radius and directly opposite the target. It does this by scaling
the normalized "to obstacle" vector by the required distance away from the center of the obstacle and then adding the result
to the obstacle's position.
@param obstaclePosition
@param obstacleRadius
@param targetPosition
@return the hiding position behind the obstacle. | [
"Given",
"the",
"position",
"of",
"a",
"target",
"and",
"the",
"position",
"and",
"radius",
"of",
"an",
"obstacle",
"this",
"method",
"calculates",
"a",
"position",
"{"
] | train | https://github.com/libgdx/gdx-ai/blob/2d1523a97193a45e18e11a4837c6800d08f177c5/gdx-ai/src/com/badlogic/gdx/ai/steer/behaviors/Hide.java#L161-L172 |
geomajas/geomajas-project-server | common-servlet/src/main/java/org/geomajas/servlet/CacheFilter.java | CacheFilter.checkPrefixes | public boolean checkPrefixes(String uri, String[] patterns) {
for (String pattern : patterns) {
if (pattern.length() > 0) {
if (uri.startsWith(pattern)) {
return true;
}
}
}
return false;
} | java | public boolean checkPrefixes(String uri, String[] patterns) {
for (String pattern : patterns) {
if (pattern.length() > 0) {
if (uri.startsWith(pattern)) {
return true;
}
}
}
return false;
} | [
"public",
"boolean",
"checkPrefixes",
"(",
"String",
"uri",
",",
"String",
"[",
"]",
"patterns",
")",
"{",
"for",
"(",
"String",
"pattern",
":",
"patterns",
")",
"{",
"if",
"(",
"pattern",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"if",
"(",
"ur... | Check whether the URL start with one of the given prefixes.
@param uri URI
@param patterns possible prefixes
@return true when URL starts with one of the prefixes | [
"Check",
"whether",
"the",
"URL",
"start",
"with",
"one",
"of",
"the",
"given",
"prefixes",
"."
] | train | https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/common-servlet/src/main/java/org/geomajas/servlet/CacheFilter.java#L281-L290 |
gosu-lang/gosu-lang | gosu-core-api/src/main/java/gw/date/GosuDateUtil.java | GosuDateUtil.addWeeks | public static Date addWeeks(Date date, int iWeeks) {
Calendar dateTime = dateToCalendar(date);
dateTime.add(Calendar.WEEK_OF_YEAR, iWeeks);
return dateTime.getTime();
} | java | public static Date addWeeks(Date date, int iWeeks) {
Calendar dateTime = dateToCalendar(date);
dateTime.add(Calendar.WEEK_OF_YEAR, iWeeks);
return dateTime.getTime();
} | [
"public",
"static",
"Date",
"addWeeks",
"(",
"Date",
"date",
",",
"int",
"iWeeks",
")",
"{",
"Calendar",
"dateTime",
"=",
"dateToCalendar",
"(",
"date",
")",
";",
"dateTime",
".",
"add",
"(",
"Calendar",
".",
"WEEK_OF_YEAR",
",",
"iWeeks",
")",
";",
"ret... | Adds the specified (signed) amount of weeks to the given date. For
example, to subtract 5 weeks from the current date, you can
achieve it by calling: <code>addWeeks(Date, -5)</code>.
@param date The time.
@param iWeeks The amount of weeks to add.
@return A new date with the weeks added. | [
"Adds",
"the",
"specified",
"(",
"signed",
")",
"amount",
"of",
"weeks",
"to",
"the",
"given",
"date",
".",
"For",
"example",
"to",
"subtract",
"5",
"weeks",
"from",
"the",
"current",
"date",
"you",
"can",
"achieve",
"it",
"by",
"calling",
":",
"<code",
... | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/date/GosuDateUtil.java#L93-L97 |
JodaOrg/joda-time | src/main/java/org/joda/time/format/DateTimeFormat.java | DateTimeFormat.isNumericToken | private static boolean isNumericToken(String token) {
int tokenLen = token.length();
if (tokenLen > 0) {
char c = token.charAt(0);
switch (c) {
case 'c': // century (number)
case 'C': // century of era (number)
case 'x': // weekyear (number)
case 'y': // year (number)
case 'Y': // year of era (number)
case 'd': // day of month (number)
case 'h': // hour of day (number, 1..12)
case 'H': // hour of day (number, 0..23)
case 'm': // minute of hour (number)
case 's': // second of minute (number)
case 'S': // fraction of second (number)
case 'e': // day of week (number)
case 'D': // day of year (number)
case 'F': // day of week in month (number)
case 'w': // week of year (number)
case 'W': // week of month (number)
case 'k': // hour of day (1..24)
case 'K': // hour of day (0..11)
return true;
case 'M': // month of year (text and number)
if (tokenLen <= 2) {
return true;
}
}
}
return false;
} | java | private static boolean isNumericToken(String token) {
int tokenLen = token.length();
if (tokenLen > 0) {
char c = token.charAt(0);
switch (c) {
case 'c': // century (number)
case 'C': // century of era (number)
case 'x': // weekyear (number)
case 'y': // year (number)
case 'Y': // year of era (number)
case 'd': // day of month (number)
case 'h': // hour of day (number, 1..12)
case 'H': // hour of day (number, 0..23)
case 'm': // minute of hour (number)
case 's': // second of minute (number)
case 'S': // fraction of second (number)
case 'e': // day of week (number)
case 'D': // day of year (number)
case 'F': // day of week in month (number)
case 'w': // week of year (number)
case 'W': // week of month (number)
case 'k': // hour of day (1..24)
case 'K': // hour of day (0..11)
return true;
case 'M': // month of year (text and number)
if (tokenLen <= 2) {
return true;
}
}
}
return false;
} | [
"private",
"static",
"boolean",
"isNumericToken",
"(",
"String",
"token",
")",
"{",
"int",
"tokenLen",
"=",
"token",
".",
"length",
"(",
")",
";",
"if",
"(",
"tokenLen",
">",
"0",
")",
"{",
"char",
"c",
"=",
"token",
".",
"charAt",
"(",
"0",
")",
"... | Returns true if token should be parsed as a numeric field.
@param token the token to parse
@return true if numeric field | [
"Returns",
"true",
"if",
"token",
"should",
"be",
"parsed",
"as",
"a",
"numeric",
"field",
"."
] | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/DateTimeFormat.java#L638-L670 |
haraldk/TwelveMonkeys | common/common-image/src/main/java/com/twelvemonkeys/image/CopyDither.java | CopyDither.filter | public final WritableRaster filter(final Raster pSource, WritableRaster pDest) {
return filter(pSource, pDest, getICM(pSource));
} | java | public final WritableRaster filter(final Raster pSource, WritableRaster pDest) {
return filter(pSource, pDest, getICM(pSource));
} | [
"public",
"final",
"WritableRaster",
"filter",
"(",
"final",
"Raster",
"pSource",
",",
"WritableRaster",
"pDest",
")",
"{",
"return",
"filter",
"(",
"pSource",
",",
"pDest",
",",
"getICM",
"(",
"pSource",
")",
")",
";",
"}"
] | Performs a single-input/single-output dither operation, applying basic
Floyd-Steinberg error-diffusion to the image.
@param pSource
@param pDest
@return the destination raster, or a new raster, if {@code pDest} was
{@code null}. | [
"Performs",
"a",
"single",
"-",
"input",
"/",
"single",
"-",
"output",
"dither",
"operation",
"applying",
"basic",
"Floyd",
"-",
"Steinberg",
"error",
"-",
"diffusion",
"to",
"the",
"image",
"."
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/CopyDither.java#L220-L222 |
algolia/instantsearch-android | ui/src/main/java/com/algolia/instantsearch/ui/databinding/RenderingHelper.java | RenderingHelper.shouldSnippet | public boolean shouldSnippet(@NonNull View view, @NonNull String attribute) {
return snippettedAttributes.contains(new Pair<>(view.getId(), attribute));
} | java | public boolean shouldSnippet(@NonNull View view, @NonNull String attribute) {
return snippettedAttributes.contains(new Pair<>(view.getId(), attribute));
} | [
"public",
"boolean",
"shouldSnippet",
"(",
"@",
"NonNull",
"View",
"view",
",",
"@",
"NonNull",
"String",
"attribute",
")",
"{",
"return",
"snippettedAttributes",
".",
"contains",
"(",
"new",
"Pair",
"<>",
"(",
"view",
".",
"getId",
"(",
")",
",",
"attribu... | Checks if an attribute should be snippetted in a view.
@param view the view using this attribute.
@param attribute the attribute's name.
@return {@code true} if the attribute was marked for snippeting. | [
"Checks",
"if",
"an",
"attribute",
"should",
"be",
"snippetted",
"in",
"a",
"view",
"."
] | train | https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/databinding/RenderingHelper.java#L97-L99 |
apache/groovy | subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java | NioGroovyMethods.newPrintWriter | public static PrintWriter newPrintWriter(Path self, String charset) throws IOException {
return new GroovyPrintWriter(newWriter(self, charset));
} | java | public static PrintWriter newPrintWriter(Path self, String charset) throws IOException {
return new GroovyPrintWriter(newWriter(self, charset));
} | [
"public",
"static",
"PrintWriter",
"newPrintWriter",
"(",
"Path",
"self",
",",
"String",
"charset",
")",
"throws",
"IOException",
"{",
"return",
"new",
"GroovyPrintWriter",
"(",
"newWriter",
"(",
"self",
",",
"charset",
")",
")",
";",
"}"
] | Create a new PrintWriter for this file, using specified
charset.
@param self a Path
@param charset the charset
@return a PrintWriter
@throws java.io.IOException if an IOException occurs.
@since 2.3.0 | [
"Create",
"a",
"new",
"PrintWriter",
"for",
"this",
"file",
"using",
"specified",
"charset",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-nio/src/main/java/org/codehaus/groovy/runtime/NioGroovyMethods.java#L1747-L1749 |
jaxio/javaee-lab | javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/DefaultLuceneQueryBuilder.java | DefaultLuceneQueryBuilder.escapeForFuzzy | private String escapeForFuzzy(String word) {
int length = word.length();
char[] tmp = new char[length * 4];
length = ASCIIFoldingFilter.foldToASCII(word.toCharArray(), 0, tmp, 0, length);
return new String(tmp, 0, length);
} | java | private String escapeForFuzzy(String word) {
int length = word.length();
char[] tmp = new char[length * 4];
length = ASCIIFoldingFilter.foldToASCII(word.toCharArray(), 0, tmp, 0, length);
return new String(tmp, 0, length);
} | [
"private",
"String",
"escapeForFuzzy",
"(",
"String",
"word",
")",
"{",
"int",
"length",
"=",
"word",
".",
"length",
"(",
")",
";",
"char",
"[",
"]",
"tmp",
"=",
"new",
"char",
"[",
"length",
"*",
"4",
"]",
";",
"length",
"=",
"ASCIIFoldingFilter",
"... | Apply same filtering as "custom" analyzer. Lowercase is done by QueryParser for fuzzy search.
@param word word
@return word escaped | [
"Apply",
"same",
"filtering",
"as",
"custom",
"analyzer",
".",
"Lowercase",
"is",
"done",
"by",
"QueryParser",
"for",
"fuzzy",
"search",
"."
] | train | https://github.com/jaxio/javaee-lab/blob/61238b967952446d81cc68424a4e809093a77fcf/javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/DefaultLuceneQueryBuilder.java#L163-L168 |
saxsys/SynchronizeFX | synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/RemoveFromListRepairer.java | RemoveFromListRepairer.repairCommand | public List<RemoveFromList> repairCommand(final RemoveFromList toRepair, final RemoveFromList repairAgainst) {
if (toRepair.getStartPosition() + toRepair.getRemoveCount() <= repairAgainst.getStartPosition()) {
return asList(toRepair);
}
if (toRepair.getStartPosition() >= repairAgainst.getStartPosition() + repairAgainst.getRemoveCount()) {
return asList(createRepaired(toRepair, toRepair.getStartPosition() - repairAgainst.getRemoveCount(),
toRepair.getRemoveCount()));
}
final int startPosition = toRepair.getStartPosition() < repairAgainst.getStartPosition() ? toRepair
.getStartPosition() : repairAgainst.getStartPosition();
final int indicesBefore = repairAgainst.getStartPosition() - toRepair.getStartPosition();
final int indicesAfter = (toRepair.getStartPosition() + toRepair.getRemoveCount())
- (repairAgainst.getStartPosition() + repairAgainst.getRemoveCount());
final int indicesBeforeAndAfter = max(indicesBefore, 0) + max(indicesAfter, 0);
if (indicesBeforeAndAfter == 0) {
return asList(createRepaired(toRepair, 0, 0));
}
final int removeCount = min(indicesBeforeAndAfter, toRepair.getRemoveCount());
return asList(createRepaired(toRepair, startPosition, removeCount));
} | java | public List<RemoveFromList> repairCommand(final RemoveFromList toRepair, final RemoveFromList repairAgainst) {
if (toRepair.getStartPosition() + toRepair.getRemoveCount() <= repairAgainst.getStartPosition()) {
return asList(toRepair);
}
if (toRepair.getStartPosition() >= repairAgainst.getStartPosition() + repairAgainst.getRemoveCount()) {
return asList(createRepaired(toRepair, toRepair.getStartPosition() - repairAgainst.getRemoveCount(),
toRepair.getRemoveCount()));
}
final int startPosition = toRepair.getStartPosition() < repairAgainst.getStartPosition() ? toRepair
.getStartPosition() : repairAgainst.getStartPosition();
final int indicesBefore = repairAgainst.getStartPosition() - toRepair.getStartPosition();
final int indicesAfter = (toRepair.getStartPosition() + toRepair.getRemoveCount())
- (repairAgainst.getStartPosition() + repairAgainst.getRemoveCount());
final int indicesBeforeAndAfter = max(indicesBefore, 0) + max(indicesAfter, 0);
if (indicesBeforeAndAfter == 0) {
return asList(createRepaired(toRepair, 0, 0));
}
final int removeCount = min(indicesBeforeAndAfter, toRepair.getRemoveCount());
return asList(createRepaired(toRepair, startPosition, removeCount));
} | [
"public",
"List",
"<",
"RemoveFromList",
">",
"repairCommand",
"(",
"final",
"RemoveFromList",
"toRepair",
",",
"final",
"RemoveFromList",
"repairAgainst",
")",
"{",
"if",
"(",
"toRepair",
".",
"getStartPosition",
"(",
")",
"+",
"toRepair",
".",
"getRemoveCount",
... | Repairs a {@link RemoveFromList} in relation to a {@link RemoveFromList} command.
@param toRepair
The command to repair.
@param repairAgainst
The command to repair against.
@return The repaired command. | [
"Repairs",
"a",
"{",
"@link",
"RemoveFromList",
"}",
"in",
"relation",
"to",
"a",
"{",
"@link",
"RemoveFromList",
"}",
"command",
"."
] | train | https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/executors/lists/RemoveFromListRepairer.java#L69-L91 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java | MutateInBuilder.arrayInsert | public <T> MutateInBuilder arrayInsert(String path, T value) {
asyncBuilder.arrayInsert(path, value);
return this;
} | java | public <T> MutateInBuilder arrayInsert(String path, T value) {
asyncBuilder.arrayInsert(path, value);
return this;
} | [
"public",
"<",
"T",
">",
"MutateInBuilder",
"arrayInsert",
"(",
"String",
"path",
",",
"T",
"value",
")",
"{",
"asyncBuilder",
".",
"arrayInsert",
"(",
"path",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | Insert into an existing array at a specific position
(denoted in the path, eg. "sub.array[2]").
@param path the path (including array position) where to insert the value.
@param value the value to insert in the array. | [
"Insert",
"into",
"an",
"existing",
"array",
"at",
"a",
"specific",
"position",
"(",
"denoted",
"in",
"the",
"path",
"eg",
".",
"sub",
".",
"array",
"[",
"2",
"]",
")",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/subdoc/MutateInBuilder.java#L911-L914 |
liferay/com-liferay-commerce | commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java | CommerceDiscountPersistenceImpl.findByUUID_G | @Override
public CommerceDiscount findByUUID_G(String uuid, long groupId)
throws NoSuchDiscountException {
CommerceDiscount commerceDiscount = fetchByUUID_G(uuid, groupId);
if (commerceDiscount == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchDiscountException(msg.toString());
}
return commerceDiscount;
} | java | @Override
public CommerceDiscount findByUUID_G(String uuid, long groupId)
throws NoSuchDiscountException {
CommerceDiscount commerceDiscount = fetchByUUID_G(uuid, groupId);
if (commerceDiscount == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("uuid=");
msg.append(uuid);
msg.append(", groupId=");
msg.append(groupId);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchDiscountException(msg.toString());
}
return commerceDiscount;
} | [
"@",
"Override",
"public",
"CommerceDiscount",
"findByUUID_G",
"(",
"String",
"uuid",
",",
"long",
"groupId",
")",
"throws",
"NoSuchDiscountException",
"{",
"CommerceDiscount",
"commerceDiscount",
"=",
"fetchByUUID_G",
"(",
"uuid",
",",
"groupId",
")",
";",
"if",
... | Returns the commerce discount where uuid = ? and groupId = ? or throws a {@link NoSuchDiscountException} if it could not be found.
@param uuid the uuid
@param groupId the group ID
@return the matching commerce discount
@throws NoSuchDiscountException if a matching commerce discount could not be found | [
"Returns",
"the",
"commerce",
"discount",
"where",
"uuid",
"=",
"?",
";",
"and",
"groupId",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchDiscountException",
"}",
"if",
"it",
"could",
"not",
"be",
"found",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-discount-service/src/main/java/com/liferay/commerce/discount/service/persistence/impl/CommerceDiscountPersistenceImpl.java#L670-L696 |
apereo/cas | support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/artifact/Saml1ArtifactResolutionProfileHandlerController.java | Saml1ArtifactResolutionProfileHandlerController.handlePostRequest | @PostMapping(path = SamlIdPConstants.ENDPOINT_SAML1_SOAP_ARTIFACT_RESOLUTION)
protected void handlePostRequest(final HttpServletResponse response,
final HttpServletRequest request) {
val ctx = decodeSoapRequest(request);
val artifactMsg = (ArtifactResolve) ctx.getMessage();
try {
val issuer = artifactMsg.getIssuer().getValue();
val service = verifySamlRegisteredService(issuer);
val adaptor = getSamlMetadataFacadeFor(service, artifactMsg);
if (adaptor.isEmpty()) {
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, "Cannot find metadata linked to " + issuer);
}
val facade = adaptor.get();
verifyAuthenticationContextSignature(ctx, request, artifactMsg, facade);
val artifactId = artifactMsg.getArtifact().getArtifact();
val ticketId = getSamlProfileHandlerConfigurationContext().getArtifactTicketFactory().createTicketIdFor(artifactId);
val ticket = getSamlProfileHandlerConfigurationContext().getTicketRegistry().getTicket(ticketId, SamlArtifactTicket.class);
val issuerService = getSamlProfileHandlerConfigurationContext().getWebApplicationServiceFactory().createService(issuer);
val casAssertion = buildCasAssertion(ticket.getTicketGrantingTicket().getAuthentication(),
issuerService, service,
CollectionUtils.wrap("artifact", ticket));
getSamlProfileHandlerConfigurationContext().getResponseBuilder().build(artifactMsg, request, response, casAssertion,
service, facade, SAMLConstants.SAML2_ARTIFACT_BINDING_URI, ctx);
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
request.setAttribute(SamlIdPConstants.REQUEST_ATTRIBUTE_ERROR, e.getMessage());
getSamlProfileHandlerConfigurationContext().getSamlFaultResponseBuilder().build(artifactMsg, request, response,
null, null, null, SAMLConstants.SAML2_ARTIFACT_BINDING_URI, ctx);
}
} | java | @PostMapping(path = SamlIdPConstants.ENDPOINT_SAML1_SOAP_ARTIFACT_RESOLUTION)
protected void handlePostRequest(final HttpServletResponse response,
final HttpServletRequest request) {
val ctx = decodeSoapRequest(request);
val artifactMsg = (ArtifactResolve) ctx.getMessage();
try {
val issuer = artifactMsg.getIssuer().getValue();
val service = verifySamlRegisteredService(issuer);
val adaptor = getSamlMetadataFacadeFor(service, artifactMsg);
if (adaptor.isEmpty()) {
throw new UnauthorizedServiceException(UnauthorizedServiceException.CODE_UNAUTHZ_SERVICE, "Cannot find metadata linked to " + issuer);
}
val facade = adaptor.get();
verifyAuthenticationContextSignature(ctx, request, artifactMsg, facade);
val artifactId = artifactMsg.getArtifact().getArtifact();
val ticketId = getSamlProfileHandlerConfigurationContext().getArtifactTicketFactory().createTicketIdFor(artifactId);
val ticket = getSamlProfileHandlerConfigurationContext().getTicketRegistry().getTicket(ticketId, SamlArtifactTicket.class);
val issuerService = getSamlProfileHandlerConfigurationContext().getWebApplicationServiceFactory().createService(issuer);
val casAssertion = buildCasAssertion(ticket.getTicketGrantingTicket().getAuthentication(),
issuerService, service,
CollectionUtils.wrap("artifact", ticket));
getSamlProfileHandlerConfigurationContext().getResponseBuilder().build(artifactMsg, request, response, casAssertion,
service, facade, SAMLConstants.SAML2_ARTIFACT_BINDING_URI, ctx);
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
request.setAttribute(SamlIdPConstants.REQUEST_ATTRIBUTE_ERROR, e.getMessage());
getSamlProfileHandlerConfigurationContext().getSamlFaultResponseBuilder().build(artifactMsg, request, response,
null, null, null, SAMLConstants.SAML2_ARTIFACT_BINDING_URI, ctx);
}
} | [
"@",
"PostMapping",
"(",
"path",
"=",
"SamlIdPConstants",
".",
"ENDPOINT_SAML1_SOAP_ARTIFACT_RESOLUTION",
")",
"protected",
"void",
"handlePostRequest",
"(",
"final",
"HttpServletResponse",
"response",
",",
"final",
"HttpServletRequest",
"request",
")",
"{",
"val",
"ctx... | Handle post request.
@param response the response
@param request the request | [
"Handle",
"post",
"request",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/artifact/Saml1ArtifactResolutionProfileHandlerController.java#L37-L67 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java | HtmlLinkRendererBase.getStyle | protected String getStyle(FacesContext facesContext, UIComponent link)
{
if (link instanceof HtmlCommandLink)
{
return ((HtmlCommandLink)link).getStyle();
}
return (String)link.getAttributes().get(HTML.STYLE_ATTR);
} | java | protected String getStyle(FacesContext facesContext, UIComponent link)
{
if (link instanceof HtmlCommandLink)
{
return ((HtmlCommandLink)link).getStyle();
}
return (String)link.getAttributes().get(HTML.STYLE_ATTR);
} | [
"protected",
"String",
"getStyle",
"(",
"FacesContext",
"facesContext",
",",
"UIComponent",
"link",
")",
"{",
"if",
"(",
"link",
"instanceof",
"HtmlCommandLink",
")",
"{",
"return",
"(",
"(",
"HtmlCommandLink",
")",
"link",
")",
".",
"getStyle",
"(",
")",
";... | Can be overwritten by derived classes to overrule the style to be used. | [
"Can",
"be",
"overwritten",
"by",
"derived",
"classes",
"to",
"overrule",
"the",
"style",
"to",
"be",
"used",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlLinkRendererBase.java#L161-L170 |
redkale/redkale | src/org/redkale/source/ColumnValue.java | ColumnValue.orr | public static ColumnValue orr(String column, Serializable value) {
return new ColumnValue(column, ORR, value);
} | java | public static ColumnValue orr(String column, Serializable value) {
return new ColumnValue(column, ORR, value);
} | [
"public",
"static",
"ColumnValue",
"orr",
"(",
"String",
"column",
",",
"Serializable",
"value",
")",
"{",
"return",
"new",
"ColumnValue",
"(",
"column",
",",
"ORR",
",",
"value",
")",
";",
"}"
] | 返回 {column} = {column} | {value} 操作
@param column 字段名
@param value 字段值
@return ColumnValue | [
"返回",
"{",
"column",
"}",
"=",
"{",
"column",
"}",
"|",
"{",
"value",
"}",
"操作"
] | train | https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/source/ColumnValue.java#L109-L111 |
rhuss/jolokia | agent/core/src/main/java/org/jolokia/util/NetworkUtil.java | NetworkUtil.useInetAddress | private static boolean useInetAddress(NetworkInterface networkInterface, InetAddress interfaceAddress) {
return checkMethod(networkInterface, isUp) &&
checkMethod(networkInterface, supportsMulticast) &&
// TODO: IpV6 support
!(interfaceAddress instanceof Inet6Address) &&
!interfaceAddress.isLoopbackAddress();
} | java | private static boolean useInetAddress(NetworkInterface networkInterface, InetAddress interfaceAddress) {
return checkMethod(networkInterface, isUp) &&
checkMethod(networkInterface, supportsMulticast) &&
// TODO: IpV6 support
!(interfaceAddress instanceof Inet6Address) &&
!interfaceAddress.isLoopbackAddress();
} | [
"private",
"static",
"boolean",
"useInetAddress",
"(",
"NetworkInterface",
"networkInterface",
",",
"InetAddress",
"interfaceAddress",
")",
"{",
"return",
"checkMethod",
"(",
"networkInterface",
",",
"isUp",
")",
"&&",
"checkMethod",
"(",
"networkInterface",
",",
"sup... | Only use the given interface on the given network interface if it is up and supports multicast | [
"Only",
"use",
"the",
"given",
"interface",
"on",
"the",
"given",
"network",
"interface",
"if",
"it",
"is",
"up",
"and",
"supports",
"multicast"
] | train | https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/util/NetworkUtil.java#L212-L218 |
code4everything/util | src/main/java/com/zhazhapan/util/dialog/Alerts.java | Alerts.showError | public static Optional<ButtonType> showError(String title, String header, String content) {
return alert(title, header, content, AlertType.ERROR);
} | java | public static Optional<ButtonType> showError(String title, String header, String content) {
return alert(title, header, content, AlertType.ERROR);
} | [
"public",
"static",
"Optional",
"<",
"ButtonType",
">",
"showError",
"(",
"String",
"title",
",",
"String",
"header",
",",
"String",
"content",
")",
"{",
"return",
"alert",
"(",
"title",
",",
"header",
",",
"content",
",",
"AlertType",
".",
"ERROR",
")",
... | 弹出错误框
@param title 标题
@param header 信息头
@param content 内容
@return {@link ButtonType} | [
"弹出错误框"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/dialog/Alerts.java#L95-L97 |
jcuda/jcudnn | JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java | JCudnn.cudnnSetRNNDescriptor_v6 | public static int cudnnSetRNNDescriptor_v6(
cudnnHandle handle,
cudnnRNNDescriptor rnnDesc,
int hiddenSize,
int numLayers,
cudnnDropoutDescriptor dropoutDesc,
int inputMode,
int direction,
int mode,
int algo,
int dataType)
{
return checkResult(cudnnSetRNNDescriptor_v6Native(handle, rnnDesc, hiddenSize, numLayers, dropoutDesc, inputMode, direction, mode, algo, dataType));
} | java | public static int cudnnSetRNNDescriptor_v6(
cudnnHandle handle,
cudnnRNNDescriptor rnnDesc,
int hiddenSize,
int numLayers,
cudnnDropoutDescriptor dropoutDesc,
int inputMode,
int direction,
int mode,
int algo,
int dataType)
{
return checkResult(cudnnSetRNNDescriptor_v6Native(handle, rnnDesc, hiddenSize, numLayers, dropoutDesc, inputMode, direction, mode, algo, dataType));
} | [
"public",
"static",
"int",
"cudnnSetRNNDescriptor_v6",
"(",
"cudnnHandle",
"handle",
",",
"cudnnRNNDescriptor",
"rnnDesc",
",",
"int",
"hiddenSize",
",",
"int",
"numLayers",
",",
"cudnnDropoutDescriptor",
"dropoutDesc",
",",
"int",
"inputMode",
",",
"int",
"direction"... | <pre>
DEPRECATED routines to be removed next release :
User should use the non-suffixed version (which has the API and functionality of _v6 version)
Routines with _v5 suffix has the functionality of the non-suffixed routines in the CUDNN V6
</pre> | [
"<pre",
">",
"DEPRECATED",
"routines",
"to",
"be",
"removed",
"next",
"release",
":",
"User",
"should",
"use",
"the",
"non",
"-",
"suffixed",
"version",
"(",
"which",
"has",
"the",
"API",
"and",
"functionality",
"of",
"_v6",
"version",
")",
"Routines",
"wi... | train | https://github.com/jcuda/jcudnn/blob/ce71f2fc02817cecace51a80e6db5f0c7f10cffc/JCudnnJava/src/main/java/jcuda/jcudnn/JCudnn.java#L4273-L4286 |
google/closure-compiler | src/com/google/javascript/jscomp/TypeValidator.java | TypeValidator.expectString | void expectString(Node n, JSType type, String msg) {
if (!type.matchesStringContext()) {
mismatch(n, msg, type, STRING_TYPE);
}
} | java | void expectString(Node n, JSType type, String msg) {
if (!type.matchesStringContext()) {
mismatch(n, msg, type, STRING_TYPE);
}
} | [
"void",
"expectString",
"(",
"Node",
"n",
",",
"JSType",
"type",
",",
"String",
"msg",
")",
"{",
"if",
"(",
"!",
"type",
".",
"matchesStringContext",
"(",
")",
")",
"{",
"mismatch",
"(",
"n",
",",
"msg",
",",
"type",
",",
"STRING_TYPE",
")",
";",
"... | Expect the type to be a string, or a type convertible to string. If the expectation is not met,
issue a warning at the provided node's source code position. | [
"Expect",
"the",
"type",
"to",
"be",
"a",
"string",
"or",
"a",
"type",
"convertible",
"to",
"string",
".",
"If",
"the",
"expectation",
"is",
"not",
"met",
"issue",
"a",
"warning",
"at",
"the",
"provided",
"node",
"s",
"source",
"code",
"position",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/TypeValidator.java#L363-L367 |
RestComm/jss7 | mtp/mtp-impl/src/main/java/org/restcomm/protocols/ss7/mtp/Mtp3UserPartBaseImpl.java | Mtp3UserPartBaseImpl.sendTransferMessageToLocalUser | protected void sendTransferMessageToLocalUser(Mtp3TransferPrimitive msg, int seqControl) {
if (this.isStarted) {
MsgTransferDeliveryHandler hdl = new MsgTransferDeliveryHandler(msg);
seqControl = seqControl & slsFilter;
this.msgDeliveryExecutors[this.slsTable[seqControl]].execute(hdl);
} else {
logger.error(String.format(
"Received Mtp3TransferPrimitive=%s but Mtp3UserPart is not started. Message will be dropped", msg));
}
} | java | protected void sendTransferMessageToLocalUser(Mtp3TransferPrimitive msg, int seqControl) {
if (this.isStarted) {
MsgTransferDeliveryHandler hdl = new MsgTransferDeliveryHandler(msg);
seqControl = seqControl & slsFilter;
this.msgDeliveryExecutors[this.slsTable[seqControl]].execute(hdl);
} else {
logger.error(String.format(
"Received Mtp3TransferPrimitive=%s but Mtp3UserPart is not started. Message will be dropped", msg));
}
} | [
"protected",
"void",
"sendTransferMessageToLocalUser",
"(",
"Mtp3TransferPrimitive",
"msg",
",",
"int",
"seqControl",
")",
"{",
"if",
"(",
"this",
".",
"isStarted",
")",
"{",
"MsgTransferDeliveryHandler",
"hdl",
"=",
"new",
"MsgTransferDeliveryHandler",
"(",
"msg",
... | Deliver an incoming message to the local user
@param msg
@param effectiveSls For the thread selection (for message delivering) | [
"Deliver",
"an",
"incoming",
"message",
"to",
"the",
"local",
"user"
] | train | https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/mtp/mtp-impl/src/main/java/org/restcomm/protocols/ss7/mtp/Mtp3UserPartBaseImpl.java#L251-L261 |
apache/incubator-druid | extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java | BloomKFilter.addBytes | public static void addBytes(ByteBuffer buffer, byte[] val, int offset, int length)
{
long hash64 = val == null ? Murmur3.NULL_HASHCODE :
Murmur3.hash64(val, offset, length);
addHash(buffer, hash64);
} | java | public static void addBytes(ByteBuffer buffer, byte[] val, int offset, int length)
{
long hash64 = val == null ? Murmur3.NULL_HASHCODE :
Murmur3.hash64(val, offset, length);
addHash(buffer, hash64);
} | [
"public",
"static",
"void",
"addBytes",
"(",
"ByteBuffer",
"buffer",
",",
"byte",
"[",
"]",
"val",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"long",
"hash64",
"=",
"val",
"==",
"null",
"?",
"Murmur3",
".",
"NULL_HASHCODE",
":",
"Murmur3",
"... | ByteBuffer based copy of {@link BloomKFilter#addBytes(byte[], int, int)} that adds a value to the ByteBuffer
in place. | [
"ByteBuffer",
"based",
"copy",
"of",
"{"
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/druid-bloom-filter/src/main/java/org/apache/druid/query/filter/BloomKFilter.java#L374-L379 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java | AccountsImpl.listPoolNodeCountsAsync | public ServiceFuture<List<PoolNodeCounts>> listPoolNodeCountsAsync(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions, final ListOperationCallback<PoolNodeCounts> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listPoolNodeCountsSinglePageAsync(accountListPoolNodeCountsOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> call(String nextPageLink) {
AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null;
if (accountListPoolNodeCountsOptions != null) {
accountListPoolNodeCountsNextOptions = new AccountListPoolNodeCountsNextOptions();
accountListPoolNodeCountsNextOptions.withClientRequestId(accountListPoolNodeCountsOptions.clientRequestId());
accountListPoolNodeCountsNextOptions.withReturnClientRequestId(accountListPoolNodeCountsOptions.returnClientRequestId());
accountListPoolNodeCountsNextOptions.withOcpDate(accountListPoolNodeCountsOptions.ocpDate());
}
return listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions);
}
},
serviceCallback);
} | java | public ServiceFuture<List<PoolNodeCounts>> listPoolNodeCountsAsync(final AccountListPoolNodeCountsOptions accountListPoolNodeCountsOptions, final ListOperationCallback<PoolNodeCounts> serviceCallback) {
return AzureServiceFuture.fromHeaderPageResponse(
listPoolNodeCountsSinglePageAsync(accountListPoolNodeCountsOptions),
new Func1<String, Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>>>() {
@Override
public Observable<ServiceResponseWithHeaders<Page<PoolNodeCounts>, AccountListPoolNodeCountsHeaders>> call(String nextPageLink) {
AccountListPoolNodeCountsNextOptions accountListPoolNodeCountsNextOptions = null;
if (accountListPoolNodeCountsOptions != null) {
accountListPoolNodeCountsNextOptions = new AccountListPoolNodeCountsNextOptions();
accountListPoolNodeCountsNextOptions.withClientRequestId(accountListPoolNodeCountsOptions.clientRequestId());
accountListPoolNodeCountsNextOptions.withReturnClientRequestId(accountListPoolNodeCountsOptions.returnClientRequestId());
accountListPoolNodeCountsNextOptions.withOcpDate(accountListPoolNodeCountsOptions.ocpDate());
}
return listPoolNodeCountsNextSinglePageAsync(nextPageLink, accountListPoolNodeCountsNextOptions);
}
},
serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"List",
"<",
"PoolNodeCounts",
">",
">",
"listPoolNodeCountsAsync",
"(",
"final",
"AccountListPoolNodeCountsOptions",
"accountListPoolNodeCountsOptions",
",",
"final",
"ListOperationCallback",
"<",
"PoolNodeCounts",
">",
"serviceCallback",
")",... | Gets the number of nodes in each state, grouped by pool.
@param accountListPoolNodeCountsOptions Additional parameters for the operation
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Gets",
"the",
"number",
"of",
"nodes",
"in",
"each",
"state",
"grouped",
"by",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/AccountsImpl.java#L508-L525 |
OpenCompare/OpenCompare | org.opencompare/pcmdata-importers/src/main/java/misc/PCMUtil.java | PCMUtil.getFeature | public static Feature getFeature(PCM pcm, String ftName) {
List<Feature> fts = pcm.getConcreteFeatures();
for (Feature ft : fts) {
if (ft.getName().equals(ftName)) {
return ft;
}
}
return null;
} | java | public static Feature getFeature(PCM pcm, String ftName) {
List<Feature> fts = pcm.getConcreteFeatures();
for (Feature ft : fts) {
if (ft.getName().equals(ftName)) {
return ft;
}
}
return null;
} | [
"public",
"static",
"Feature",
"getFeature",
"(",
"PCM",
"pcm",
",",
"String",
"ftName",
")",
"{",
"List",
"<",
"Feature",
">",
"fts",
"=",
"pcm",
".",
"getConcreteFeatures",
"(",
")",
";",
"for",
"(",
"Feature",
"ft",
":",
"fts",
")",
"{",
"if",
"("... | of course this is weird to put such methods as an helper/utility
alternatives are to consider putting such facility as part of PCM class
@param pcm
@param ftName
@return | [
"of",
"course",
"this",
"is",
"weird",
"to",
"put",
"such",
"methods",
"as",
"an",
"helper",
"/",
"utility",
"alternatives",
"are",
"to",
"consider",
"putting",
"such",
"facility",
"as",
"part",
"of",
"PCM",
"class"
] | train | https://github.com/OpenCompare/OpenCompare/blob/6cd776466b375cb8ecca08fcd94e573d65e20b14/org.opencompare/pcmdata-importers/src/main/java/misc/PCMUtil.java#L28-L39 |
geomajas/geomajas-project-client-gwt2 | plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/feature/featureinfo/builder/AttributeWidgetFactory.java | AttributeWidgetFactory.createAttributeWidget | public Widget createAttributeWidget(Feature feature, AttributeDescriptor descriptor) {
Attribute<?> attribute = feature.getAttributes().get(descriptor.getName());
// Get a builder for the attribute
// attribute.getValue is e.g. StringAttribute, ImageURLAttribute, ...
AttributeWidgetBuilder builder = builders.get(attribute.getValue().getClass());
if (builder == null) {
builder = new DefaultAttributeWidgetBuilder();
}
// Build the widget and return it:
return builder.buildAttributeWidget(attribute.getValue());
} | java | public Widget createAttributeWidget(Feature feature, AttributeDescriptor descriptor) {
Attribute<?> attribute = feature.getAttributes().get(descriptor.getName());
// Get a builder for the attribute
// attribute.getValue is e.g. StringAttribute, ImageURLAttribute, ...
AttributeWidgetBuilder builder = builders.get(attribute.getValue().getClass());
if (builder == null) {
builder = new DefaultAttributeWidgetBuilder();
}
// Build the widget and return it:
return builder.buildAttributeWidget(attribute.getValue());
} | [
"public",
"Widget",
"createAttributeWidget",
"(",
"Feature",
"feature",
",",
"AttributeDescriptor",
"descriptor",
")",
"{",
"Attribute",
"<",
"?",
">",
"attribute",
"=",
"feature",
".",
"getAttributes",
"(",
")",
".",
"get",
"(",
"descriptor",
".",
"getName",
... | Create a widget for an attribute of a {@link Feature}.
@param feature the feature of the attribute.
@param descriptor the descriptor of the attribute of the feature.
@return the (possible custom) widget for a feature attribute. | [
"Create",
"a",
"widget",
"for",
"an",
"attribute",
"of",
"a",
"{",
"@link",
"Feature",
"}",
"."
] | train | https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/corewidget/corewidget/src/main/java/org/geomajas/gwt2/plugin/corewidget/client/feature/featureinfo/builder/AttributeWidgetFactory.java#L56-L68 |
rubenlagus/TelegramBots | telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/DefaultBotCommand.java | DefaultBotCommand.processMessage | @Override
public void processMessage(AbsSender absSender, Message message, String[] arguments) {
execute(absSender, message.getFrom(), message.getChat(), message.getMessageId(), arguments);
} | java | @Override
public void processMessage(AbsSender absSender, Message message, String[] arguments) {
execute(absSender, message.getFrom(), message.getChat(), message.getMessageId(), arguments);
} | [
"@",
"Override",
"public",
"void",
"processMessage",
"(",
"AbsSender",
"absSender",
",",
"Message",
"message",
",",
"String",
"[",
"]",
"arguments",
")",
"{",
"execute",
"(",
"absSender",
",",
"message",
".",
"getFrom",
"(",
")",
",",
"message",
".",
"getC... | Process the message and execute the command
@param absSender absSender to send messages over
@param message the message to process
@param arguments passed arguments | [
"Process",
"the",
"message",
"and",
"execute",
"the",
"command"
] | train | https://github.com/rubenlagus/TelegramBots/blob/d62354915d7664597a40fd9858f16bce67ef1478/telegrambots-extensions/src/main/java/org/telegram/telegrambots/extensions/bots/commandbot/commands/DefaultBotCommand.java#L33-L36 |
mpetazzoni/ttorrent | ttorrent-client/src/main/java/com/turn/ttorrent/client/CommunicationManager.java | CommunicationManager.addTorrent | public TorrentManager addTorrent(String dotTorrentFilePath,
String downloadDirPath,
PieceStorageFactory pieceStorageFactory) throws IOException {
return addTorrent(dotTorrentFilePath, downloadDirPath, pieceStorageFactory, Collections.<TorrentListener>emptyList());
} | java | public TorrentManager addTorrent(String dotTorrentFilePath,
String downloadDirPath,
PieceStorageFactory pieceStorageFactory) throws IOException {
return addTorrent(dotTorrentFilePath, downloadDirPath, pieceStorageFactory, Collections.<TorrentListener>emptyList());
} | [
"public",
"TorrentManager",
"addTorrent",
"(",
"String",
"dotTorrentFilePath",
",",
"String",
"downloadDirPath",
",",
"PieceStorageFactory",
"pieceStorageFactory",
")",
"throws",
"IOException",
"{",
"return",
"addTorrent",
"(",
"dotTorrentFilePath",
",",
"downloadDirPath",
... | Adds torrent to storage with specified {@link PieceStorageFactory}.
It can be used for skipping initial validation of data
@param dotTorrentFilePath path to torrent metadata file
@param downloadDirPath path to directory where downloaded files are placed
@param pieceStorageFactory factory for creating {@link PieceStorage}.
@return {@link TorrentManager} instance for monitoring torrent state
@throws IOException if IO error occurs in reading metadata file | [
"Adds",
"torrent",
"to",
"storage",
"with",
"specified",
"{",
"@link",
"PieceStorageFactory",
"}",
".",
"It",
"can",
"be",
"used",
"for",
"skipping",
"initial",
"validation",
"of",
"data"
] | train | https://github.com/mpetazzoni/ttorrent/blob/ecd0e6caf853b63393c4ab63cfd8f20114f73f70/ttorrent-client/src/main/java/com/turn/ttorrent/client/CommunicationManager.java#L156-L160 |
Azure/azure-sdk-for-java | common/azure-common/src/main/java/com/azure/common/implementation/serializer/HttpResponseBodyDecoder.java | HttpResponseBodyDecoder.deserializePage | private static Object deserializePage(String value, Type resultType, Type wireType, SerializerAdapter serializer, SerializerEncoding encoding) throws IOException {
final Type wireResponseType;
if (wireType == Page.class) {
// If the type is the 'Page' interface [i.e. `@ReturnValueWireType(Page.class)`], we will use the 'ItemPage' class instead.
wireResponseType = TypeUtil.createParameterizedType(ItemPage.class, resultType);
} else {
wireResponseType = wireType;
}
return serializer.deserialize(value, wireResponseType, encoding);
} | java | private static Object deserializePage(String value, Type resultType, Type wireType, SerializerAdapter serializer, SerializerEncoding encoding) throws IOException {
final Type wireResponseType;
if (wireType == Page.class) {
// If the type is the 'Page' interface [i.e. `@ReturnValueWireType(Page.class)`], we will use the 'ItemPage' class instead.
wireResponseType = TypeUtil.createParameterizedType(ItemPage.class, resultType);
} else {
wireResponseType = wireType;
}
return serializer.deserialize(value, wireResponseType, encoding);
} | [
"private",
"static",
"Object",
"deserializePage",
"(",
"String",
"value",
",",
"Type",
"resultType",
",",
"Type",
"wireType",
",",
"SerializerAdapter",
"serializer",
",",
"SerializerEncoding",
"encoding",
")",
"throws",
"IOException",
"{",
"final",
"Type",
"wireResp... | Deserializes a response body as a Page<T> given that {@param wireType} is either:
1. A type that implements the interface
2. Is of {@link Page}
@param value The string to deserialize
@param resultType The type T, of the page contents.
@param wireType The {@link Type} that either is, or implements {@link Page}
@param serializer The serializer used to deserialize the value.
@param encoding Encoding used to deserialize string
@return An object representing an instance of {@param wireType}
@throws IOException if the serializer is unable to deserialize the value. | [
"Deserializes",
"a",
"response",
"body",
"as",
"a",
"Page<T",
">",
"given",
"that",
"{",
"@param",
"wireType",
"}",
"is",
"either",
":",
"1",
".",
"A",
"type",
"that",
"implements",
"the",
"interface",
"2",
".",
"Is",
"of",
"{",
"@link",
"Page",
"}"
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/implementation/serializer/HttpResponseBodyDecoder.java#L237-L248 |
james-hu/jabb-core | src/main/java/net/sf/jabb/camel/RegistryUtility.java | RegistryUtility.addDecoder | @SuppressWarnings("unchecked")
static public void addDecoder(CamelContext context, String name, ChannelUpstreamHandler decoder){
CombinedRegistry registry = getCombinedRegistry(context);
addCodecOnly(registry, name, decoder);
List<ChannelUpstreamHandler> decoders;
Object o = registry.lookup(NAME_DECODERS);
if (o == null){
decoders = new ArrayList<ChannelUpstreamHandler>();
registry.getDefaultSimpleRegistry().put(NAME_DECODERS, decoders);
}else{
try{
decoders = (List<ChannelUpstreamHandler>)o;
}catch(Exception e){
throw new IllegalArgumentException("Preserved name '" + NAME_DECODERS + "' is already being used by others in at least one of the registries.");
}
}
decoders.add(decoder);
} | java | @SuppressWarnings("unchecked")
static public void addDecoder(CamelContext context, String name, ChannelUpstreamHandler decoder){
CombinedRegistry registry = getCombinedRegistry(context);
addCodecOnly(registry, name, decoder);
List<ChannelUpstreamHandler> decoders;
Object o = registry.lookup(NAME_DECODERS);
if (o == null){
decoders = new ArrayList<ChannelUpstreamHandler>();
registry.getDefaultSimpleRegistry().put(NAME_DECODERS, decoders);
}else{
try{
decoders = (List<ChannelUpstreamHandler>)o;
}catch(Exception e){
throw new IllegalArgumentException("Preserved name '" + NAME_DECODERS + "' is already being used by others in at least one of the registries.");
}
}
decoders.add(decoder);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"public",
"void",
"addDecoder",
"(",
"CamelContext",
"context",
",",
"String",
"name",
",",
"ChannelUpstreamHandler",
"decoder",
")",
"{",
"CombinedRegistry",
"registry",
"=",
"getCombinedRegistry",
"(",
... | Adds an Netty decoder to Registry.<br>
向Registry中增加一个给Netty用的decoder。
@param context The CamelContext must be based on CombinedRegistry, otherwise ClassCastException will be thrown.<br>
这个context必须是采用CombinedRegistry类型的Registry的,否则会抛出格式转换异常。
@param name Name of the decoder in Registry.<br>
decoder在Registry中的名字。
@param decoder The decoder that will be used by Netty.<br>
将被Netty用到的decoder。 | [
"Adds",
"an",
"Netty",
"decoder",
"to",
"Registry",
".",
"<br",
">",
"向Registry中增加一个给Netty用的decoder。"
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/camel/RegistryUtility.java#L106-L124 |
grpc/grpc-java | api/src/main/java/io/grpc/MethodDescriptor.java | MethodDescriptor.generateFullMethodName | public static String generateFullMethodName(String fullServiceName, String methodName) {
return checkNotNull(fullServiceName, "fullServiceName")
+ "/"
+ checkNotNull(methodName, "methodName");
} | java | public static String generateFullMethodName(String fullServiceName, String methodName) {
return checkNotNull(fullServiceName, "fullServiceName")
+ "/"
+ checkNotNull(methodName, "methodName");
} | [
"public",
"static",
"String",
"generateFullMethodName",
"(",
"String",
"fullServiceName",
",",
"String",
"methodName",
")",
"{",
"return",
"checkNotNull",
"(",
"fullServiceName",
",",
"\"fullServiceName\"",
")",
"+",
"\"/\"",
"+",
"checkNotNull",
"(",
"methodName",
... | Generate the fully qualified method name. This matches the name
@param fullServiceName the fully qualified service name that is prefixed with the package name
@param methodName the short method name
@since 1.0.0 | [
"Generate",
"the",
"fully",
"qualified",
"method",
"name",
".",
"This",
"matches",
"the",
"name"
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/MethodDescriptor.java#L386-L390 |
nmdp-bioinformatics/ngs | reads/src/main/java/org/nmdp/ngs/reads/paired/PairedEndFastqReader.java | PairedEndFastqReader.streamInterleaved | public static void streamInterleaved(final Readable readable, final PairedEndListener listener) throws IOException {
checkNotNull(readable);
checkNotNull(listener);
StreamListener streamListener = new StreamListener() {
private Fastq left;
@Override
public void fastq(final Fastq fastq) {
if (isLeft(fastq) && (left == null)) {
left = fastq;
}
else if (isRight(fastq) && (left != null) && (prefix(left).equals(prefix(fastq)))) {
Fastq right = fastq;
listener.paired(left, right);
left = null;
}
else {
throw new PairedEndFastqReaderException("invalid interleaved FASTQ format, left=" + (left == null ? "null" : left.getDescription()) + " right=" + (fastq == null ? "null" : fastq.getDescription()));
}
}
};
try {
new SangerFastqReader().stream(readable, streamListener);
}
catch (PairedEndFastqReaderException e) {
throw new IOException("could not stream interleaved paired end FASTQ reads", e);
}
} | java | public static void streamInterleaved(final Readable readable, final PairedEndListener listener) throws IOException {
checkNotNull(readable);
checkNotNull(listener);
StreamListener streamListener = new StreamListener() {
private Fastq left;
@Override
public void fastq(final Fastq fastq) {
if (isLeft(fastq) && (left == null)) {
left = fastq;
}
else if (isRight(fastq) && (left != null) && (prefix(left).equals(prefix(fastq)))) {
Fastq right = fastq;
listener.paired(left, right);
left = null;
}
else {
throw new PairedEndFastqReaderException("invalid interleaved FASTQ format, left=" + (left == null ? "null" : left.getDescription()) + " right=" + (fastq == null ? "null" : fastq.getDescription()));
}
}
};
try {
new SangerFastqReader().stream(readable, streamListener);
}
catch (PairedEndFastqReaderException e) {
throw new IOException("could not stream interleaved paired end FASTQ reads", e);
}
} | [
"public",
"static",
"void",
"streamInterleaved",
"(",
"final",
"Readable",
"readable",
",",
"final",
"PairedEndListener",
"listener",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"readable",
")",
";",
"checkNotNull",
"(",
"listener",
")",
";",
"StreamLi... | Stream the specified interleaved paired end reads. Per the interleaved format, all reads must be sorted and paired.
@param readable readable, must not be null
@param listener paired end listener, must not be null
@throws IOException if an I/O error occurs | [
"Stream",
"the",
"specified",
"interleaved",
"paired",
"end",
"reads",
".",
"Per",
"the",
"interleaved",
"format",
"all",
"reads",
"must",
"be",
"sorted",
"and",
"paired",
"."
] | train | https://github.com/nmdp-bioinformatics/ngs/blob/277627e4311313a80f5dc110b3185b0d7af32bd0/reads/src/main/java/org/nmdp/ngs/reads/paired/PairedEndFastqReader.java#L265-L294 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java | HtmlTree.A | public static HtmlTree A(HtmlVersion htmlVersion, String attr, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.A);
htmltree.addAttr((htmlVersion == HtmlVersion.HTML4)
? HtmlAttr.NAME
: HtmlAttr.ID,
nullCheck(attr));
htmltree.addContent(nullCheck(body));
return htmltree;
} | java | public static HtmlTree A(HtmlVersion htmlVersion, String attr, Content body) {
HtmlTree htmltree = new HtmlTree(HtmlTag.A);
htmltree.addAttr((htmlVersion == HtmlVersion.HTML4)
? HtmlAttr.NAME
: HtmlAttr.ID,
nullCheck(attr));
htmltree.addContent(nullCheck(body));
return htmltree;
} | [
"public",
"static",
"HtmlTree",
"A",
"(",
"HtmlVersion",
"htmlVersion",
",",
"String",
"attr",
",",
"Content",
"body",
")",
"{",
"HtmlTree",
"htmltree",
"=",
"new",
"HtmlTree",
"(",
"HtmlTag",
".",
"A",
")",
";",
"htmltree",
".",
"addAttr",
"(",
"(",
"ht... | Generates an HTML anchor tag with an id or a name attribute and content.
@param htmlVersion the version of the generated HTML
@param attr name or id attribute for the anchor tag
@param body content for the anchor tag
@return an HtmlTree object | [
"Generates",
"an",
"HTML",
"anchor",
"tag",
"with",
"an",
"id",
"or",
"a",
"name",
"attribute",
"and",
"content",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlTree.java#L243-L251 |
opendatatrentino/s-match | src/main/java/it/unitn/disi/common/components/Configurable.java | Configurable.loadProperties | public static Properties loadProperties(String filename) throws ConfigurableException {
log.info("Loading properties from " + filename);
Properties properties = new Properties();
FileInputStream input = null;
try {
input = new FileInputStream(filename);
properties.load(input);
} catch (IOException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new ConfigurableException(errMessage, e);
} finally {
if (null != input) {
try {
input.close();
} catch (IOException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
}
}
}
return properties;
} | java | public static Properties loadProperties(String filename) throws ConfigurableException {
log.info("Loading properties from " + filename);
Properties properties = new Properties();
FileInputStream input = null;
try {
input = new FileInputStream(filename);
properties.load(input);
} catch (IOException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new ConfigurableException(errMessage, e);
} finally {
if (null != input) {
try {
input.close();
} catch (IOException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
}
}
}
return properties;
} | [
"public",
"static",
"Properties",
"loadProperties",
"(",
"String",
"filename",
")",
"throws",
"ConfigurableException",
"{",
"log",
".",
"info",
"(",
"\"Loading properties from \"",
"+",
"filename",
")",
";",
"Properties",
"properties",
"=",
"new",
"Properties",
"(",... | Loads the properties from the properties file.
@param filename the properties file name
@return Properties instance
@throws ConfigurableException ConfigurableException | [
"Loads",
"the",
"properties",
"from",
"the",
"properties",
"file",
"."
] | train | https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/common/components/Configurable.java#L192-L215 |
agmip/agmip-common-functions | src/main/java/org/agmip/functions/PTSaxton2006.java | PTSaxton2006.calcSatMatric | public static String calcSatMatric(String slsnd, String slcly, String omPct) {
String satMt = divide(calcSaturatedMoisture(slsnd, slcly, omPct), "100");
String mt33 = divide(calcMoisture33Kpa(slsnd, slcly, omPct), "100");
String lamda = calcLamda(slsnd, slcly, omPct);
String ret = product("1930", pow(substract(satMt, mt33), substract("3", lamda)));
LOG.debug("Calculate result for Saturated conductivity (matric soil), mm/h is {}", ret);
return ret;
} | java | public static String calcSatMatric(String slsnd, String slcly, String omPct) {
String satMt = divide(calcSaturatedMoisture(slsnd, slcly, omPct), "100");
String mt33 = divide(calcMoisture33Kpa(slsnd, slcly, omPct), "100");
String lamda = calcLamda(slsnd, slcly, omPct);
String ret = product("1930", pow(substract(satMt, mt33), substract("3", lamda)));
LOG.debug("Calculate result for Saturated conductivity (matric soil), mm/h is {}", ret);
return ret;
} | [
"public",
"static",
"String",
"calcSatMatric",
"(",
"String",
"slsnd",
",",
"String",
"slcly",
",",
"String",
"omPct",
")",
"{",
"String",
"satMt",
"=",
"divide",
"(",
"calcSaturatedMoisture",
"(",
"slsnd",
",",
"slcly",
",",
"omPct",
")",
",",
"\"100\"",
... | Equation 16 for calculating Saturated conductivity (matric soil), mm/h
@param slsnd Sand weight percentage by layer ([0,100]%)
@param slcly Clay weight percentage by layer ([0,100]%)
@param omPct Organic matter weight percentage by layer ([0,100]%), (=
SLOC * 1.72) | [
"Equation",
"16",
"for",
"calculating",
"Saturated",
"conductivity",
"(",
"matric",
"soil",
")",
"mm",
"/",
"h"
] | train | https://github.com/agmip/agmip-common-functions/blob/4efa3042178841b026ca6fba9c96da02fbfb9a8e/src/main/java/org/agmip/functions/PTSaxton2006.java#L337-L345 |
cycorp/api-suite | core-api/src/main/java/com/cyc/kb/exception/DeleteException.java | DeleteException.fromThrowable | public static DeleteException fromThrowable(String message, Throwable cause) {
return (cause instanceof DeleteException && Objects.equals(message, cause.getMessage()))
? (DeleteException) cause
: new DeleteException(message, cause);
} | java | public static DeleteException fromThrowable(String message, Throwable cause) {
return (cause instanceof DeleteException && Objects.equals(message, cause.getMessage()))
? (DeleteException) cause
: new DeleteException(message, cause);
} | [
"public",
"static",
"DeleteException",
"fromThrowable",
"(",
"String",
"message",
",",
"Throwable",
"cause",
")",
"{",
"return",
"(",
"cause",
"instanceof",
"DeleteException",
"&&",
"Objects",
".",
"equals",
"(",
"message",
",",
"cause",
".",
"getMessage",
"(",
... | Converts a Throwable to a DeleteException with the specified detail message. If the
Throwable is a DeleteException and if the Throwable's message is identical to the
one supplied, the Throwable will be passed through unmodified; otherwise, it will be wrapped in
a new DeleteException with the detail message.
@param cause the Throwable to convert
@param message the specified detail message
@return a DeleteException | [
"Converts",
"a",
"Throwable",
"to",
"a",
"DeleteException",
"with",
"the",
"specified",
"detail",
"message",
".",
"If",
"the",
"Throwable",
"is",
"a",
"DeleteException",
"and",
"if",
"the",
"Throwable",
"s",
"message",
"is",
"identical",
"to",
"the",
"one",
... | train | https://github.com/cycorp/api-suite/blob/1d52affabc4635e3715a059e38741712cbdbf2d5/core-api/src/main/java/com/cyc/kb/exception/DeleteException.java#L62-L66 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/ByteArray.java | ByteArray.copyFrom | public static final ByteArray copyFrom(String string) {
return new ByteArray(ByteString.copyFrom(string, StandardCharsets.UTF_8));
} | java | public static final ByteArray copyFrom(String string) {
return new ByteArray(ByteString.copyFrom(string, StandardCharsets.UTF_8));
} | [
"public",
"static",
"final",
"ByteArray",
"copyFrom",
"(",
"String",
"string",
")",
"{",
"return",
"new",
"ByteArray",
"(",
"ByteString",
".",
"copyFrom",
"(",
"string",
",",
"StandardCharsets",
".",
"UTF_8",
")",
")",
";",
"}"
] | Creates a {@code ByteArray} object given a string. The string is encoded in {@code UTF-8}. The
bytes are copied. | [
"Creates",
"a",
"{"
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-core/src/main/java/com/google/cloud/ByteArray.java#L132-L134 |
OpenBEL/openbel-framework | org.openbel.framework.common/src/main/java/org/openbel/framework/common/record/Record.java | Record.readColumn | public final byte[] readColumn(byte[] buffer, int column) {
if (buffer == null) {
throw new InvalidArgument("buffer", buffer);
} else if (buffer.length != recordSize) {
final String fmt = "invalid buffer (%d bytes, expected %d)";
final String msg = format(fmt, buffer.length, recordSize);
throw new InvalidArgument(msg);
}
int i = 0, offset = 0;
for (; i < column; i++) {
offset += columns[i].size;
}
Column<?> c = columns[i];
byte[] ret = new byte[c.size];
arraycopy(buffer, offset, ret, 0, c.size);
return ret;
} | java | public final byte[] readColumn(byte[] buffer, int column) {
if (buffer == null) {
throw new InvalidArgument("buffer", buffer);
} else if (buffer.length != recordSize) {
final String fmt = "invalid buffer (%d bytes, expected %d)";
final String msg = format(fmt, buffer.length, recordSize);
throw new InvalidArgument(msg);
}
int i = 0, offset = 0;
for (; i < column; i++) {
offset += columns[i].size;
}
Column<?> c = columns[i];
byte[] ret = new byte[c.size];
arraycopy(buffer, offset, ret, 0, c.size);
return ret;
} | [
"public",
"final",
"byte",
"[",
"]",
"readColumn",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"column",
")",
"{",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"throw",
"new",
"InvalidArgument",
"(",
"\"buffer\"",
",",
"buffer",
")",
";",
"}",
"else... | Returns the {@code column's} byte array data contained in {@code buffer}.
@param buffer {@code byte[]}; must be non-null and of the same length as
{@link #getRecordSize()}
@param column Column to read
@return {@code byte[]}
@throws InvalidArgument Thrown if {@code buffer} is null or invalid | [
"Returns",
"the",
"{",
"@code",
"column",
"s",
"}",
"byte",
"array",
"data",
"contained",
"in",
"{",
"@code",
"buffer",
"}",
"."
] | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/record/Record.java#L126-L144 |
mikepenz/FastAdapter | library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/utilities/SubItemUtil.java | SubItemUtil.notifyItemsChanged | public static <Item extends IItem & IExpandable> void notifyItemsChanged(final FastAdapter adapter, ExpandableExtension expandableExtension, Set<Long> identifiers) {
notifyItemsChanged(adapter, expandableExtension, identifiers, false);
} | java | public static <Item extends IItem & IExpandable> void notifyItemsChanged(final FastAdapter adapter, ExpandableExtension expandableExtension, Set<Long> identifiers) {
notifyItemsChanged(adapter, expandableExtension, identifiers, false);
} | [
"public",
"static",
"<",
"Item",
"extends",
"IItem",
"&",
"IExpandable",
">",
"void",
"notifyItemsChanged",
"(",
"final",
"FastAdapter",
"adapter",
",",
"ExpandableExtension",
"expandableExtension",
",",
"Set",
"<",
"Long",
">",
"identifiers",
")",
"{",
"notifyIte... | notifies items (incl. sub items if they are currently extended)
@param adapter the adapter
@param identifiers set of identifiers that should be notified | [
"notifies",
"items",
"(",
"incl",
".",
"sub",
"items",
"if",
"they",
"are",
"currently",
"extended",
")"
] | train | https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-extensions/src/main/java/com/mikepenz/fastadapter_extensions/utilities/SubItemUtil.java#L489-L491 |
alibaba/jstorm | jstorm-on-yarn/src/main/java/com/alibaba/jstorm/yarn/appmaster/JstormMaster.java | JstormMaster.setupContainerAskForRM | public ContainerRequest setupContainerAskForRM(int containerMemory, int containerVirtualCores, int priority, String host) {
// setup requirements for hosts
// using * as any host will do for the jstorm app
// set the priority for the request
Priority pri = Priority.newInstance(priority);
// Set up resource type requirements
// For now, memory and CPU are supported so we set memory and cpu requirements
Resource capability = Resource.newInstance(containerMemory,
containerVirtualCores);
ContainerRequest request = new ContainerRequest(capability, null, null,
pri);
LOG.info("By Thrift Server Requested container ask: " + request.toString());
return request;
} | java | public ContainerRequest setupContainerAskForRM(int containerMemory, int containerVirtualCores, int priority, String host) {
// setup requirements for hosts
// using * as any host will do for the jstorm app
// set the priority for the request
Priority pri = Priority.newInstance(priority);
// Set up resource type requirements
// For now, memory and CPU are supported so we set memory and cpu requirements
Resource capability = Resource.newInstance(containerMemory,
containerVirtualCores);
ContainerRequest request = new ContainerRequest(capability, null, null,
pri);
LOG.info("By Thrift Server Requested container ask: " + request.toString());
return request;
} | [
"public",
"ContainerRequest",
"setupContainerAskForRM",
"(",
"int",
"containerMemory",
",",
"int",
"containerVirtualCores",
",",
"int",
"priority",
",",
"String",
"host",
")",
"{",
"// setup requirements for hosts",
"// using * as any host will do for the jstorm app",
"// set t... | Setup the request that will be sent to the RM for the container ask.
@return the setup ResourceRequest to be sent to RM | [
"Setup",
"the",
"request",
"that",
"will",
"be",
"sent",
"to",
"the",
"RM",
"for",
"the",
"container",
"ask",
"."
] | train | https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-on-yarn/src/main/java/com/alibaba/jstorm/yarn/appmaster/JstormMaster.java#L1070-L1084 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsDynamicFunctionParser.java | CmsDynamicFunctionParser.parseProperty | protected CmsXmlContentProperty parseProperty(CmsObject cms, I_CmsXmlContentLocation field) {
String name = getString(cms, field.getSubValue("PropertyName"));
String widget = getString(cms, field.getSubValue("Widget"));
if (CmsStringUtil.isEmptyOrWhitespaceOnly(widget)) {
widget = "string";
}
String type = getString(cms, field.getSubValue("Type"));
if (CmsStringUtil.isEmptyOrWhitespaceOnly(type)) {
type = "string";
}
String widgetConfig = getString(cms, field.getSubValue("WidgetConfig"));
String ruleRegex = getString(cms, field.getSubValue("RuleRegex"));
String ruleType = getString(cms, field.getSubValue("RuleType"));
String default1 = getString(cms, field.getSubValue("Default"));
String error = getString(cms, field.getSubValue("Error"));
String niceName = getString(cms, field.getSubValue("DisplayName"));
String description = getString(cms, field.getSubValue("Description"));
CmsXmlContentProperty prop = new CmsXmlContentProperty(
name,
type,
widget,
widgetConfig,
ruleRegex,
ruleType,
default1,
niceName,
description,
error,
"true");
return prop;
} | java | protected CmsXmlContentProperty parseProperty(CmsObject cms, I_CmsXmlContentLocation field) {
String name = getString(cms, field.getSubValue("PropertyName"));
String widget = getString(cms, field.getSubValue("Widget"));
if (CmsStringUtil.isEmptyOrWhitespaceOnly(widget)) {
widget = "string";
}
String type = getString(cms, field.getSubValue("Type"));
if (CmsStringUtil.isEmptyOrWhitespaceOnly(type)) {
type = "string";
}
String widgetConfig = getString(cms, field.getSubValue("WidgetConfig"));
String ruleRegex = getString(cms, field.getSubValue("RuleRegex"));
String ruleType = getString(cms, field.getSubValue("RuleType"));
String default1 = getString(cms, field.getSubValue("Default"));
String error = getString(cms, field.getSubValue("Error"));
String niceName = getString(cms, field.getSubValue("DisplayName"));
String description = getString(cms, field.getSubValue("Description"));
CmsXmlContentProperty prop = new CmsXmlContentProperty(
name,
type,
widget,
widgetConfig,
ruleRegex,
ruleType,
default1,
niceName,
description,
error,
"true");
return prop;
} | [
"protected",
"CmsXmlContentProperty",
"parseProperty",
"(",
"CmsObject",
"cms",
",",
"I_CmsXmlContentLocation",
"field",
")",
"{",
"String",
"name",
"=",
"getString",
"(",
"cms",
",",
"field",
".",
"getSubValue",
"(",
"\"PropertyName\"",
")",
")",
";",
"String",
... | Helper method for parsing a settings definition.<p>
@param cms the current CMS context
@param field the node from which to read the settings definition
@return the parsed setting definition | [
"Helper",
"method",
"for",
"parsing",
"a",
"settings",
"definition",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsDynamicFunctionParser.java#L333-L365 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/stat/ns/nsmemory_stats.java | nsmemory_stats.get | public static nsmemory_stats get(nitro_service service, String pool) throws Exception{
nsmemory_stats obj = new nsmemory_stats();
obj.set_pool(pool);
nsmemory_stats response = (nsmemory_stats) obj.stat_resource(service);
return response;
} | java | public static nsmemory_stats get(nitro_service service, String pool) throws Exception{
nsmemory_stats obj = new nsmemory_stats();
obj.set_pool(pool);
nsmemory_stats response = (nsmemory_stats) obj.stat_resource(service);
return response;
} | [
"public",
"static",
"nsmemory_stats",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"pool",
")",
"throws",
"Exception",
"{",
"nsmemory_stats",
"obj",
"=",
"new",
"nsmemory_stats",
"(",
")",
";",
"obj",
".",
"set_pool",
"(",
"pool",
")",
";",
"nsmemo... | Use this API to fetch statistics of nsmemory_stats resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"statistics",
"of",
"nsmemory_stats",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/ns/nsmemory_stats.java#L159-L164 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/random/RandomFloat.java | RandomFloat.updateFloat | public static float updateFloat(float value, float range) {
range = range == 0 ? (float) (0.1 * value) : range;
float min = value - range;
float max = value + range;
return nextFloat(min, max);
} | java | public static float updateFloat(float value, float range) {
range = range == 0 ? (float) (0.1 * value) : range;
float min = value - range;
float max = value + range;
return nextFloat(min, max);
} | [
"public",
"static",
"float",
"updateFloat",
"(",
"float",
"value",
",",
"float",
"range",
")",
"{",
"range",
"=",
"range",
"==",
"0",
"?",
"(",
"float",
")",
"(",
"0.1",
"*",
"value",
")",
":",
"range",
";",
"float",
"min",
"=",
"value",
"-",
"rang... | Updates (drifts) a float value within specified range defined
@param value a float value to drift.
@param range (optional) a range. Default: 10% of the value
@return updated random float value. | [
"Updates",
"(",
"drifts",
")",
"a",
"float",
"value",
"within",
"specified",
"range",
"defined"
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/random/RandomFloat.java#L59-L64 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/Expression.java | Expression.equalTo | @NonNull
public Expression equalTo(@NonNull Expression expression) {
if (expression == null) {
throw new IllegalArgumentException("expression cannot be null.");
}
return new BinaryExpression(this, expression, BinaryExpression.OpType.EqualTo);
} | java | @NonNull
public Expression equalTo(@NonNull Expression expression) {
if (expression == null) {
throw new IllegalArgumentException("expression cannot be null.");
}
return new BinaryExpression(this, expression, BinaryExpression.OpType.EqualTo);
} | [
"@",
"NonNull",
"public",
"Expression",
"equalTo",
"(",
"@",
"NonNull",
"Expression",
"expression",
")",
"{",
"if",
"(",
"expression",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"expression cannot be null.\"",
")",
";",
"}",
"retu... | Create an equal to expression that evaluates whether or not the current expression
is equal to the given expression.
@param expression the expression to compare with the current expression.
@return an equal to expression. | [
"Create",
"an",
"equal",
"to",
"expression",
"that",
"evaluates",
"whether",
"or",
"not",
"the",
"current",
"expression",
"is",
"equal",
"to",
"the",
"given",
"expression",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Expression.java#L675-L681 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFormatterImpl.java | SimpleFormatterImpl.formatAndAppend | public static StringBuilder formatAndAppend(
String compiledPattern, StringBuilder appendTo, int[] offsets, CharSequence... values) {
int valuesLength = values != null ? values.length : 0;
if (valuesLength < getArgumentLimit(compiledPattern)) {
throw new IllegalArgumentException("Too few values.");
}
return format(compiledPattern, values, appendTo, null, true, offsets);
} | java | public static StringBuilder formatAndAppend(
String compiledPattern, StringBuilder appendTo, int[] offsets, CharSequence... values) {
int valuesLength = values != null ? values.length : 0;
if (valuesLength < getArgumentLimit(compiledPattern)) {
throw new IllegalArgumentException("Too few values.");
}
return format(compiledPattern, values, appendTo, null, true, offsets);
} | [
"public",
"static",
"StringBuilder",
"formatAndAppend",
"(",
"String",
"compiledPattern",
",",
"StringBuilder",
"appendTo",
",",
"int",
"[",
"]",
"offsets",
",",
"CharSequence",
"...",
"values",
")",
"{",
"int",
"valuesLength",
"=",
"values",
"!=",
"null",
"?",
... | Formats the given values, appending to the appendTo builder.
@param compiledPattern Compiled form of a pattern string.
@param appendTo Gets the formatted pattern and values appended.
@param offsets offsets[i] receives the offset of where
values[i] replaced pattern argument {i}.
Can be null, or can be shorter or longer than values.
If there is no {i} in the pattern, then offsets[i] is set to -1.
@param values The argument values.
An argument value must not be the same object as appendTo.
values.length must be at least getArgumentLimit().
Can be null if getArgumentLimit()==0.
@return appendTo | [
"Formats",
"the",
"given",
"values",
"appending",
"to",
"the",
"appendTo",
"builder",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/SimpleFormatterImpl.java#L227-L234 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/buffer/BufferUtil.java | BufferUtil.iterateUntil | public static int iterateUntil(ShortBuffer array, int pos, int length, int min) {
while (pos < length && toIntUnsigned(array.get(pos)) < min) {
pos++;
}
return pos;
} | java | public static int iterateUntil(ShortBuffer array, int pos, int length, int min) {
while (pos < length && toIntUnsigned(array.get(pos)) < min) {
pos++;
}
return pos;
} | [
"public",
"static",
"int",
"iterateUntil",
"(",
"ShortBuffer",
"array",
",",
"int",
"pos",
",",
"int",
"length",
",",
"int",
"min",
")",
"{",
"while",
"(",
"pos",
"<",
"length",
"&&",
"toIntUnsigned",
"(",
"array",
".",
"get",
"(",
"pos",
")",
")",
"... | Find the smallest integer larger than pos such that array[pos]>= min. If none can be found,
return length.
@param array array to search within
@param pos starting position of the search
@param length length of the array to search
@param min minimum value
@return x greater than pos such that array[pos] is at least as large as min, pos is is equal to
length if it is not possible. | [
"Find",
"the",
"smallest",
"integer",
"larger",
"than",
"pos",
"such",
"that",
"array",
"[",
"pos",
"]",
">",
";",
"=",
"min",
".",
"If",
"none",
"can",
"be",
"found",
"return",
"length",
"."
] | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/BufferUtil.java#L178-L183 |
dkpro/dkpro-jwpl | de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/util/MathUtilities.java | MathUtilities.percentFrom | public static String percentFrom(final double a, final double b)
{
double bVal = b;
if (bVal == 0.) {
bVal = 1.;
}
StringBuilder rep = new StringBuilder();
double d = ((long) ((a / bVal) * 10000) / 100.);
if (d < 10.0) {
rep.append('0');
}
rep.append(d);
while (rep.length() < 5) {
rep.append('0');
}
return rep + "%";
} | java | public static String percentFrom(final double a, final double b)
{
double bVal = b;
if (bVal == 0.) {
bVal = 1.;
}
StringBuilder rep = new StringBuilder();
double d = ((long) ((a / bVal) * 10000) / 100.);
if (d < 10.0) {
rep.append('0');
}
rep.append(d);
while (rep.length() < 5) {
rep.append('0');
}
return rep + "%";
} | [
"public",
"static",
"String",
"percentFrom",
"(",
"final",
"double",
"a",
",",
"final",
"double",
"b",
")",
"{",
"double",
"bVal",
"=",
"b",
";",
"if",
"(",
"bVal",
"==",
"0.",
")",
"{",
"bVal",
"=",
"1.",
";",
"}",
"StringBuilder",
"rep",
"=",
"ne... | Returns the result of (a / b) as a percentage string
@param a
value a
@param b
value b
@return xx.xx% | [
"Returns",
"the",
"result",
"of",
"(",
"a",
"/",
"b",
")",
"as",
"a",
"percentage",
"string"
] | train | https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/util/MathUtilities.java#L99-L120 |
exoplatform/jcr | exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java | RegistryService.recreateEntry | @Override
public void recreateEntry(final SessionProvider sessionProvider, final String groupPath, final RegistryEntry entry)
throws RepositoryException
{
final String entryRelPath = EXO_REGISTRY + "/" + groupPath + "/" + entry.getName();
final String parentFullPath = "/" + EXO_REGISTRY + "/" + groupPath;
try
{
Session session = session(sessionProvider, repositoryService.getCurrentRepository());
// Don't care about concurrency, Session should be dedicated to the Thread, see JCR-765
// synchronized (session) {
Node node = session.getRootNode().getNode(entryRelPath);
// delete existing entry...
node.remove();
// create same entry,
// [PN] no check we need here, as we have deleted this node before
// checkGroup(sessionProvider, fullParentPath);
session.importXML(parentFullPath, entry.getAsInputStream(), IMPORT_UUID_CREATE_NEW);
// save recreated changes
session.save();
// }
}
catch (IOException ioe)
{
throw new RepositoryException("Item " + parentFullPath + "can't be created " + ioe);
}
catch (TransformerException te)
{
throw new RepositoryException("Can't get XML representation from stream " + te);
}
} | java | @Override
public void recreateEntry(final SessionProvider sessionProvider, final String groupPath, final RegistryEntry entry)
throws RepositoryException
{
final String entryRelPath = EXO_REGISTRY + "/" + groupPath + "/" + entry.getName();
final String parentFullPath = "/" + EXO_REGISTRY + "/" + groupPath;
try
{
Session session = session(sessionProvider, repositoryService.getCurrentRepository());
// Don't care about concurrency, Session should be dedicated to the Thread, see JCR-765
// synchronized (session) {
Node node = session.getRootNode().getNode(entryRelPath);
// delete existing entry...
node.remove();
// create same entry,
// [PN] no check we need here, as we have deleted this node before
// checkGroup(sessionProvider, fullParentPath);
session.importXML(parentFullPath, entry.getAsInputStream(), IMPORT_UUID_CREATE_NEW);
// save recreated changes
session.save();
// }
}
catch (IOException ioe)
{
throw new RepositoryException("Item " + parentFullPath + "can't be created " + ioe);
}
catch (TransformerException te)
{
throw new RepositoryException("Can't get XML representation from stream " + te);
}
} | [
"@",
"Override",
"public",
"void",
"recreateEntry",
"(",
"final",
"SessionProvider",
"sessionProvider",
",",
"final",
"String",
"groupPath",
",",
"final",
"RegistryEntry",
"entry",
")",
"throws",
"RepositoryException",
"{",
"final",
"String",
"entryRelPath",
"=",
"E... | Re-creates an entry in the group.
@param sessionProvider the session provider
@throws RepositoryException | [
"Re",
"-",
"creates",
"an",
"entry",
"in",
"the",
"group",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.ext/src/main/java/org/exoplatform/services/jcr/ext/registry/RegistryService.java#L239-L275 |
cdk/cdk | tool/hash/src/main/java/org/openscience/cdk/hash/stereo/DoubleBondElementEncoderFactory.java | DoubleBondElementEncoderFactory.findOther | private static int findOther(int[] vs, int u, int x) {
for (int v : vs) {
if (v != u && v != x) return v;
}
throw new IllegalArgumentException("vs[] did not contain another vertex");
} | java | private static int findOther(int[] vs, int u, int x) {
for (int v : vs) {
if (v != u && v != x) return v;
}
throw new IllegalArgumentException("vs[] did not contain another vertex");
} | [
"private",
"static",
"int",
"findOther",
"(",
"int",
"[",
"]",
"vs",
",",
"int",
"u",
",",
"int",
"x",
")",
"{",
"for",
"(",
"int",
"v",
":",
"vs",
")",
"{",
"if",
"(",
"v",
"!=",
"u",
"&&",
"v",
"!=",
"x",
")",
"return",
"v",
";",
"}",
"... | Finds a vertex in 'vs' which is not 'u' or 'x'.
.
@param vs fixed size array of 3 elements
@param u a vertex in 'vs'
@param x another vertex in 'vs'
@return the other vertex | [
"Finds",
"a",
"vertex",
"in",
"vs",
"which",
"is",
"not",
"u",
"or",
"x",
".",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/hash/src/main/java/org/openscience/cdk/hash/stereo/DoubleBondElementEncoderFactory.java#L127-L132 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java | IPv6AddressSection.toEUI | public MACAddressSection toEUI(boolean extended) {
MACAddressSegment[] segs = toEUISegments(extended);
if(segs == null) {
return null;
}
MACAddressCreator creator = getMACNetwork().getAddressCreator();
return createSectionInternal(creator, segs, Math.max(0, addressSegmentIndex - 4) << 1, extended);
} | java | public MACAddressSection toEUI(boolean extended) {
MACAddressSegment[] segs = toEUISegments(extended);
if(segs == null) {
return null;
}
MACAddressCreator creator = getMACNetwork().getAddressCreator();
return createSectionInternal(creator, segs, Math.max(0, addressSegmentIndex - 4) << 1, extended);
} | [
"public",
"MACAddressSection",
"toEUI",
"(",
"boolean",
"extended",
")",
"{",
"MACAddressSegment",
"[",
"]",
"segs",
"=",
"toEUISegments",
"(",
"extended",
")",
";",
"if",
"(",
"segs",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"MACAddressCreator",
... | Returns the corresponding mac section, or null if this address section does not correspond to a mac section.
If this address section has a prefix length it is ignored.
@param extended
@return | [
"Returns",
"the",
"corresponding",
"mac",
"section",
"or",
"null",
"if",
"this",
"address",
"section",
"does",
"not",
"correspond",
"to",
"a",
"mac",
"section",
".",
"If",
"this",
"address",
"section",
"has",
"a",
"prefix",
"length",
"it",
"is",
"ignored",
... | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/ipv6/IPv6AddressSection.java#L1160-L1167 |
CenturyLinkCloud/mdw | mdw-common/src/com/centurylink/mdw/translator/VariableTranslator.java | VariableTranslator.realToObject | public static Object realToObject(Package pkg, String type, String value) {
if (StringHelper.isEmpty(value))
return null;
com.centurylink.mdw.variable.VariableTranslator trans = getTranslator(pkg, type);
if (trans instanceof DocumentReferenceTranslator)
return ((DocumentReferenceTranslator)trans).realToObject(value);
else
return trans.toObject(value);
} | java | public static Object realToObject(Package pkg, String type, String value) {
if (StringHelper.isEmpty(value))
return null;
com.centurylink.mdw.variable.VariableTranslator trans = getTranslator(pkg, type);
if (trans instanceof DocumentReferenceTranslator)
return ((DocumentReferenceTranslator)trans).realToObject(value);
else
return trans.toObject(value);
} | [
"public",
"static",
"Object",
"realToObject",
"(",
"Package",
"pkg",
",",
"String",
"type",
",",
"String",
"value",
")",
"{",
"if",
"(",
"StringHelper",
".",
"isEmpty",
"(",
"value",
")",
")",
"return",
"null",
";",
"com",
".",
"centurylink",
".",
"mdw",... | Deserializes variable string values to runtime objects.
@param pkg workflow package
@param type variable type
@param value string value
@return deserialized object | [
"Deserializes",
"variable",
"string",
"values",
"to",
"runtime",
"objects",
"."
] | train | https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/translator/VariableTranslator.java#L157-L165 |
vlingo/vlingo-actors | src/main/java/io/vlingo/actors/Stage.java | Stage.actorProxyFor | final <T> T actorProxyFor(final Class<T> protocol, final Actor actor, final Mailbox mailbox) {
return ActorProxy.createFor(protocol, actor, mailbox);
} | java | final <T> T actorProxyFor(final Class<T> protocol, final Actor actor, final Mailbox mailbox) {
return ActorProxy.createFor(protocol, actor, mailbox);
} | [
"final",
"<",
"T",
">",
"T",
"actorProxyFor",
"(",
"final",
"Class",
"<",
"T",
">",
"protocol",
",",
"final",
"Actor",
"actor",
",",
"final",
"Mailbox",
"mailbox",
")",
"{",
"return",
"ActorProxy",
".",
"createFor",
"(",
"protocol",
",",
"actor",
",",
... | Answers the T protocol proxy for this newly created Actor. (INTERNAL ONLY)
@param <T> the protocol type
@param protocol the {@code Class<T>} protocol of the Actor
@param actor the Actor instance that backs the proxy protocol
@param mailbox the Mailbox instance of this Actor
@return T | [
"Answers",
"the",
"T",
"protocol",
"proxy",
"for",
"this",
"newly",
"created",
"Actor",
".",
"(",
"INTERNAL",
"ONLY",
")"
] | train | https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/Stage.java#L477-L479 |
xwiki/xwiki-commons | xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java | DefaultInstalledExtensionRepository.getInstalledFeatureFromCache | private InstalledFeature getInstalledFeatureFromCache(String feature, String namespace)
{
if (feature == null) {
return null;
}
Map<String, InstalledFeature> installedExtensionsForFeature = this.extensionNamespaceByFeature.get(feature);
if (installedExtensionsForFeature == null) {
return null;
}
InstalledFeature installedExtension = installedExtensionsForFeature.get(namespace);
// Fallback on root namespace if the feature could not be found
if (installedExtension == null && namespace != null) {
installedExtension = getInstalledFeatureFromCache(feature, null);
}
return installedExtension;
} | java | private InstalledFeature getInstalledFeatureFromCache(String feature, String namespace)
{
if (feature == null) {
return null;
}
Map<String, InstalledFeature> installedExtensionsForFeature = this.extensionNamespaceByFeature.get(feature);
if (installedExtensionsForFeature == null) {
return null;
}
InstalledFeature installedExtension = installedExtensionsForFeature.get(namespace);
// Fallback on root namespace if the feature could not be found
if (installedExtension == null && namespace != null) {
installedExtension = getInstalledFeatureFromCache(feature, null);
}
return installedExtension;
} | [
"private",
"InstalledFeature",
"getInstalledFeatureFromCache",
"(",
"String",
"feature",
",",
"String",
"namespace",
")",
"{",
"if",
"(",
"feature",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Map",
"<",
"String",
",",
"InstalledFeature",
">",
"instal... | Get extension registered as installed for the provided feature and namespace (including on root namespace).
@param feature the feature provided by the extension
@param namespace the namespace where the extension is installed
@return the installed extension informations | [
"Get",
"extension",
"registered",
"as",
"installed",
"for",
"the",
"provided",
"feature",
"and",
"namespace",
"(",
"including",
"on",
"root",
"namespace",
")",
"."
] | train | https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/installed/DefaultInstalledExtensionRepository.java#L671-L691 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/domassign/DirectAnalyzer.java | DirectAnalyzer.getElementStyle | public NodeData getElementStyle(Element el, PseudoElementType pseudo, MediaSpec media)
{
final OrderedRule[] applicableRules = AnalyzerUtil.getApplicableRules(sheets, el, media);
return AnalyzerUtil.getElementStyle(el, pseudo, getElementMatcher(), getMatchCondition(), applicableRules);
} | java | public NodeData getElementStyle(Element el, PseudoElementType pseudo, MediaSpec media)
{
final OrderedRule[] applicableRules = AnalyzerUtil.getApplicableRules(sheets, el, media);
return AnalyzerUtil.getElementStyle(el, pseudo, getElementMatcher(), getMatchCondition(), applicableRules);
} | [
"public",
"NodeData",
"getElementStyle",
"(",
"Element",
"el",
",",
"PseudoElementType",
"pseudo",
",",
"MediaSpec",
"media",
")",
"{",
"final",
"OrderedRule",
"[",
"]",
"applicableRules",
"=",
"AnalyzerUtil",
".",
"getApplicableRules",
"(",
"sheets",
",",
"el",
... | Computes the style of an element with an eventual pseudo element for the given media.
@param el The DOM element.
@param pseudo A pseudo element that should be used for style computation or <code>null</code> if no pseudo element should be used (e.g. :after).
@param media Used media specification.
@return The relevant declarations from the registered style sheets. | [
"Computes",
"the",
"style",
"of",
"an",
"element",
"with",
"an",
"eventual",
"pseudo",
"element",
"for",
"the",
"given",
"media",
"."
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/domassign/DirectAnalyzer.java#L57-L61 |
azkaban/azkaban | az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/ValidationUtils.java | ValidationUtils.validateAllOrNone | public static void validateAllOrNone(Props props, String... keys) {
Objects.requireNonNull(keys);
boolean allExist = true;
boolean someExist = false;
for (String key : keys) {
Object val = props.get(key);
allExist &= val != null;
someExist |= val != null;
}
if (someExist && !allExist) {
throw new IllegalArgumentException(
"Either all of properties exist or none of them should exist for " + Arrays
.toString(keys));
}
} | java | public static void validateAllOrNone(Props props, String... keys) {
Objects.requireNonNull(keys);
boolean allExist = true;
boolean someExist = false;
for (String key : keys) {
Object val = props.get(key);
allExist &= val != null;
someExist |= val != null;
}
if (someExist && !allExist) {
throw new IllegalArgumentException(
"Either all of properties exist or none of them should exist for " + Arrays
.toString(keys));
}
} | [
"public",
"static",
"void",
"validateAllOrNone",
"(",
"Props",
"props",
",",
"String",
"...",
"keys",
")",
"{",
"Objects",
".",
"requireNonNull",
"(",
"keys",
")",
";",
"boolean",
"allExist",
"=",
"true",
";",
"boolean",
"someExist",
"=",
"false",
";",
"fo... | Validates if all of the keys exist of none of them exist
@throws IllegalArgumentException only if some of the keys exist | [
"Validates",
"if",
"all",
"of",
"the",
"keys",
"exist",
"of",
"none",
"of",
"them",
"exist"
] | train | https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/az-hadoop-jobtype-plugin/src/main/java/azkaban/jobtype/javautils/ValidationUtils.java#L38-L54 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java | SSLConfigManager.registerSSLConfigChangeListener | public synchronized void registerSSLConfigChangeListener(SSLConfigChangeListener listener, SSLConfigChangeEvent event) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "registerSSLConfigChangeListener", new Object[] { listener, event });
List<SSLConfigChangeListener> listenerList = sslConfigListenerMap.get(event.getAlias());
if (listenerList != null) {
// used to hold sslconfig -> list of listener references
listenerList.add(listener);
sslConfigListenerMap.put(event.getAlias(), listenerList);
} else {
listenerList = new ArrayList<SSLConfigChangeListener>();
listenerList.add(listener);
sslConfigListenerMap.put(event.getAlias(), listenerList);
}
// used to hold listener -> listener event references
sslConfigListenerEventMap.put(listener, event);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "registerSSLConfigChangeListener");
} | java | public synchronized void registerSSLConfigChangeListener(SSLConfigChangeListener listener, SSLConfigChangeEvent event) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.entry(tc, "registerSSLConfigChangeListener", new Object[] { listener, event });
List<SSLConfigChangeListener> listenerList = sslConfigListenerMap.get(event.getAlias());
if (listenerList != null) {
// used to hold sslconfig -> list of listener references
listenerList.add(listener);
sslConfigListenerMap.put(event.getAlias(), listenerList);
} else {
listenerList = new ArrayList<SSLConfigChangeListener>();
listenerList.add(listener);
sslConfigListenerMap.put(event.getAlias(), listenerList);
}
// used to hold listener -> listener event references
sslConfigListenerEventMap.put(listener, event);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
Tr.exit(tc, "registerSSLConfigChangeListener");
} | [
"public",
"synchronized",
"void",
"registerSSLConfigChangeListener",
"(",
"SSLConfigChangeListener",
"listener",
",",
"SSLConfigChangeEvent",
"event",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
... | *
This method is called by JSSEHelper to register new listeners for config
changes. Notifications get sent when the config changes or gets deleted.
@param listener
@param event
* | [
"*",
"This",
"method",
"is",
"called",
"by",
"JSSEHelper",
"to",
"register",
"new",
"listeners",
"for",
"config",
"changes",
".",
"Notifications",
"get",
"sent",
"when",
"the",
"config",
"changes",
"or",
"gets",
"deleted",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java#L1494-L1515 |
minio/minio-java | api/src/main/java/io/minio/MinioClient.java | MinioClient.executeHead | private HttpResponse executeHead(String bucketName, String objectName, Map<String,String> headerMap)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
HttpResponse response = execute(Method.HEAD, getRegion(bucketName), bucketName, objectName, headerMap,
null, null, 0);
response.body().close();
return response;
} | java | private HttpResponse executeHead(String bucketName, String objectName, Map<String,String> headerMap)
throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException,
InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException,
InternalException {
HttpResponse response = execute(Method.HEAD, getRegion(bucketName), bucketName, objectName, headerMap,
null, null, 0);
response.body().close();
return response;
} | [
"private",
"HttpResponse",
"executeHead",
"(",
"String",
"bucketName",
",",
"String",
"objectName",
",",
"Map",
"<",
"String",
",",
"String",
">",
"headerMap",
")",
"throws",
"InvalidBucketNameException",
",",
"NoSuchAlgorithmException",
",",
"InsufficientDataException"... | Executes HEAD method for given request parameters.
@param bucketName Bucket name.
@param objectName Object name in the bucket.
@param headerMap Map of header parameters of the request. | [
"Executes",
"HEAD",
"method",
"for",
"given",
"request",
"parameters",
"."
] | train | https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L1325-L1334 |
j256/ormlite-android | src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java | OrmLiteConfigUtil.writeConfigFile | public static void writeConfigFile(File configFile, Class<?>[] classes) throws SQLException, IOException {
writeConfigFile(configFile, classes, false);
} | java | public static void writeConfigFile(File configFile, Class<?>[] classes) throws SQLException, IOException {
writeConfigFile(configFile, classes, false);
} | [
"public",
"static",
"void",
"writeConfigFile",
"(",
"File",
"configFile",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"classes",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"writeConfigFile",
"(",
"configFile",
",",
"classes",
",",
"false",
")",
";",
... | Write a configuration file with the configuration for classes. | [
"Write",
"a",
"configuration",
"file",
"with",
"the",
"configuration",
"for",
"classes",
"."
] | train | https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L186-L188 |
Waikato/moa | moa/src/main/java/moa/gui/experimentertab/ImageChart.java | ImageChart.exportIMG | public void exportIMG(String path, String type) throws IOException {
switch (type) {
case "JPG":
try {
ChartUtilities.saveChartAsJPEG(new File(path + File.separator + name + ".jpg"), chart, width, height);
} catch (IOException e) {
}
break;
case "PNG":
try {
ChartUtilities.saveChartAsPNG(new File(path + File.separator + name + ".png"), chart, width, height);
} catch (IOException e) {
}
break;
case "SVG":
String svg = generateSVG(width, height);
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(new File(path + File.separator + name + ".svg")));
writer.write("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
writer.write(svg + "\n");
writer.flush();
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
break;
}
} | java | public void exportIMG(String path, String type) throws IOException {
switch (type) {
case "JPG":
try {
ChartUtilities.saveChartAsJPEG(new File(path + File.separator + name + ".jpg"), chart, width, height);
} catch (IOException e) {
}
break;
case "PNG":
try {
ChartUtilities.saveChartAsPNG(new File(path + File.separator + name + ".png"), chart, width, height);
} catch (IOException e) {
}
break;
case "SVG":
String svg = generateSVG(width, height);
BufferedWriter writer = null;
try {
writer = new BufferedWriter(new FileWriter(new File(path + File.separator + name + ".svg")));
writer.write("<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n");
writer.write(svg + "\n");
writer.flush();
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
break;
}
} | [
"public",
"void",
"exportIMG",
"(",
"String",
"path",
",",
"String",
"type",
")",
"throws",
"IOException",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"\"JPG\"",
":",
"try",
"{",
"ChartUtilities",
".",
"saveChartAsJPEG",
"(",
"new",
"File",
"(",
"path",
... | Export the image to formats JPG, PNG, SVG and EPS.
@param path
@param type
@throws IOException | [
"Export",
"the",
"image",
"to",
"formats",
"JPG",
"PNG",
"SVG",
"and",
"EPS",
"."
] | train | https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/gui/experimentertab/ImageChart.java#L169-L207 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/error/ServletErrorReport.java | ServletErrorReport.isApplicationError | private boolean isApplicationError(Throwable rootEx, String pkgRoot) {
if (rootEx != null) {
StackTraceElement[] stackTrace = rootEx.getStackTrace();
if (stackTrace != null && stackTrace.length > 0) {
StackTraceElement rootThrower = stackTrace[0];
String className = rootThrower.getClassName();
if (className != null && !!!className.startsWith(pkgRoot)) {
return true;
}
}
}
return false;
} | java | private boolean isApplicationError(Throwable rootEx, String pkgRoot) {
if (rootEx != null) {
StackTraceElement[] stackTrace = rootEx.getStackTrace();
if (stackTrace != null && stackTrace.length > 0) {
StackTraceElement rootThrower = stackTrace[0];
String className = rootThrower.getClassName();
if (className != null && !!!className.startsWith(pkgRoot)) {
return true;
}
}
}
return false;
} | [
"private",
"boolean",
"isApplicationError",
"(",
"Throwable",
"rootEx",
",",
"String",
"pkgRoot",
")",
"{",
"if",
"(",
"rootEx",
"!=",
"null",
")",
"{",
"StackTraceElement",
"[",
"]",
"stackTrace",
"=",
"rootEx",
".",
"getStackTrace",
"(",
")",
";",
"if",
... | This method determines if the error is initiated by an application or not.
@param rootEx the exception being tested
@return true if a nice friendly app error should be returned, false otherwise. | [
"This",
"method",
"determines",
"if",
"the",
"error",
"is",
"initiated",
"by",
"an",
"application",
"or",
"not",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/websphere/servlet/error/ServletErrorReport.java#L320-L334 |
jeremylong/DependencyCheck | core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java | DependencyBundlingAnalyzer.isCore | protected boolean isCore(Dependency left, Dependency right) {
final String leftName = left.getFileName().toLowerCase();
final String rightName = right.getFileName().toLowerCase();
final boolean returnVal;
//TODO - should we get rid of this merging? It removes a true BOM...
if (left.isVirtual() && !right.isVirtual()) {
returnVal = true;
} else if (!left.isVirtual() && right.isVirtual()) {
returnVal = false;
} else if ((!rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") && leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+"))
|| (rightName.contains("core") && !leftName.contains("core"))
|| (rightName.contains("kernel") && !leftName.contains("kernel"))
|| (rightName.contains("akka-stream") && !leftName.contains("akka-stream"))
|| (rightName.contains("netty-transport") && !leftName.contains("netty-transport"))) {
returnVal = false;
} else if ((rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") && !leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+"))
|| (!rightName.contains("core") && leftName.contains("core"))
|| (!rightName.contains("kernel") && leftName.contains("kernel"))
|| (!rightName.contains("akka-stream") && leftName.contains("akka-stream"))
|| (!rightName.contains("netty-transport") && leftName.contains("netty-transport"))) {
returnVal = true;
} else {
/*
* considered splitting the names up and comparing the components,
* but decided that the file name length should be sufficient as the
* "core" component, if this follows a normal naming protocol should
* be shorter:
* axis2-saaj-1.4.1.jar
* axis2-1.4.1.jar <-----
* axis2-kernel-1.4.1.jar
*/
returnVal = leftName.length() <= rightName.length();
}
LOGGER.debug("IsCore={} ({}, {})", returnVal, left.getFileName(), right.getFileName());
return returnVal;
} | java | protected boolean isCore(Dependency left, Dependency right) {
final String leftName = left.getFileName().toLowerCase();
final String rightName = right.getFileName().toLowerCase();
final boolean returnVal;
//TODO - should we get rid of this merging? It removes a true BOM...
if (left.isVirtual() && !right.isVirtual()) {
returnVal = true;
} else if (!left.isVirtual() && right.isVirtual()) {
returnVal = false;
} else if ((!rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") && leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+"))
|| (rightName.contains("core") && !leftName.contains("core"))
|| (rightName.contains("kernel") && !leftName.contains("kernel"))
|| (rightName.contains("akka-stream") && !leftName.contains("akka-stream"))
|| (rightName.contains("netty-transport") && !leftName.contains("netty-transport"))) {
returnVal = false;
} else if ((rightName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+") && !leftName.matches(".*\\.(tar|tgz|gz|zip|ear|war).+"))
|| (!rightName.contains("core") && leftName.contains("core"))
|| (!rightName.contains("kernel") && leftName.contains("kernel"))
|| (!rightName.contains("akka-stream") && leftName.contains("akka-stream"))
|| (!rightName.contains("netty-transport") && leftName.contains("netty-transport"))) {
returnVal = true;
} else {
/*
* considered splitting the names up and comparing the components,
* but decided that the file name length should be sufficient as the
* "core" component, if this follows a normal naming protocol should
* be shorter:
* axis2-saaj-1.4.1.jar
* axis2-1.4.1.jar <-----
* axis2-kernel-1.4.1.jar
*/
returnVal = leftName.length() <= rightName.length();
}
LOGGER.debug("IsCore={} ({}, {})", returnVal, left.getFileName(), right.getFileName());
return returnVal;
} | [
"protected",
"boolean",
"isCore",
"(",
"Dependency",
"left",
",",
"Dependency",
"right",
")",
"{",
"final",
"String",
"leftName",
"=",
"left",
".",
"getFileName",
"(",
")",
".",
"toLowerCase",
"(",
")",
";",
"final",
"String",
"rightName",
"=",
"right",
".... | This is likely a very broken attempt at determining if the 'left'
dependency is the 'core' library in comparison to the 'right' library.
@param left the dependency to test
@param right the dependency to test against
@return a boolean indicating whether or not the left dependency should be
considered the "core" version. | [
"This",
"is",
"likely",
"a",
"very",
"broken",
"attempt",
"at",
"determining",
"if",
"the",
"left",
"dependency",
"is",
"the",
"core",
"library",
"in",
"comparison",
"to",
"the",
"right",
"library",
"."
] | train | https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java#L342-L379 |
sebastiangraf/treetank | interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/algorithm/fmes/Matching.java | Matching.updateSubtreeMap | private void updateSubtreeMap(final ITreeData paramNode, final INodeReadTrx paramRtx) throws TTIOException {
assert paramNode != null;
assert paramRtx != null;
mIsInSubtree.set(paramNode, paramNode, true);
if (paramNode.hasParent()) {
paramRtx.moveTo(paramNode.getDataKey());
while (((ITreeStructData)paramRtx.getNode()).hasParent()) {
paramRtx.moveTo(paramRtx.getNode().getParentKey());
mIsInSubtree.set(paramRtx.getNode(), paramNode, true);
}
}
} | java | private void updateSubtreeMap(final ITreeData paramNode, final INodeReadTrx paramRtx) throws TTIOException {
assert paramNode != null;
assert paramRtx != null;
mIsInSubtree.set(paramNode, paramNode, true);
if (paramNode.hasParent()) {
paramRtx.moveTo(paramNode.getDataKey());
while (((ITreeStructData)paramRtx.getNode()).hasParent()) {
paramRtx.moveTo(paramRtx.getNode().getParentKey());
mIsInSubtree.set(paramRtx.getNode(), paramNode, true);
}
}
} | [
"private",
"void",
"updateSubtreeMap",
"(",
"final",
"ITreeData",
"paramNode",
",",
"final",
"INodeReadTrx",
"paramRtx",
")",
"throws",
"TTIOException",
"{",
"assert",
"paramNode",
"!=",
"null",
";",
"assert",
"paramRtx",
"!=",
"null",
";",
"mIsInSubtree",
".",
... | For each anchestor of n: n is in it's subtree.
@param paramNode
node in subtree
@param paramRtx
{@link IReadTransaction} reference
@throws TTIOException | [
"For",
"each",
"anchestor",
"of",
"n",
":",
"n",
"is",
"in",
"it",
"s",
"subtree",
"."
] | train | https://github.com/sebastiangraf/treetank/blob/9b96d631b6c2a8502a0cc958dcb02bd6a6fd8b60/interfacemodules/xml/src/main/java/org/treetank/service/xml/diff/algorithm/fmes/Matching.java#L122-L134 |
respoke/respoke-sdk-android | respokeSDK/src/main/java/com/digium/respokesdk/RespokeCall.java | RespokeCall.iceCandidatesReceived | public void iceCandidatesReceived(JSONArray candidates) {
if (isActive()) {
for (int ii = 0; ii < candidates.length(); ii++) {
try {
JSONObject eachCandidate = (JSONObject) candidates.get(ii);
String mid = eachCandidate.getString("sdpMid");
int sdpLineIndex = eachCandidate.getInt("sdpMLineIndex");
String sdp = eachCandidate.getString("candidate");
IceCandidate rtcCandidate = new IceCandidate(mid, sdpLineIndex, sdp);
try {
// Start critical block
queuedRemoteCandidatesSemaphore.acquire();
if (null != queuedRemoteCandidates) {
queuedRemoteCandidates.add(rtcCandidate);
} else {
peerConnection.addIceCandidate(rtcCandidate);
}
// End critical block
queuedRemoteCandidatesSemaphore.release();
} catch (InterruptedException e) {
Log.d(TAG, "Error with remote candidates semaphore");
}
} catch (JSONException e) {
Log.d(TAG, "Error processing remote ice candidate data");
}
}
}
} | java | public void iceCandidatesReceived(JSONArray candidates) {
if (isActive()) {
for (int ii = 0; ii < candidates.length(); ii++) {
try {
JSONObject eachCandidate = (JSONObject) candidates.get(ii);
String mid = eachCandidate.getString("sdpMid");
int sdpLineIndex = eachCandidate.getInt("sdpMLineIndex");
String sdp = eachCandidate.getString("candidate");
IceCandidate rtcCandidate = new IceCandidate(mid, sdpLineIndex, sdp);
try {
// Start critical block
queuedRemoteCandidatesSemaphore.acquire();
if (null != queuedRemoteCandidates) {
queuedRemoteCandidates.add(rtcCandidate);
} else {
peerConnection.addIceCandidate(rtcCandidate);
}
// End critical block
queuedRemoteCandidatesSemaphore.release();
} catch (InterruptedException e) {
Log.d(TAG, "Error with remote candidates semaphore");
}
} catch (JSONException e) {
Log.d(TAG, "Error processing remote ice candidate data");
}
}
}
} | [
"public",
"void",
"iceCandidatesReceived",
"(",
"JSONArray",
"candidates",
")",
"{",
"if",
"(",
"isActive",
"(",
")",
")",
"{",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"candidates",
".",
"length",
"(",
")",
";",
"ii",
"++",
")",
"{",
"tr... | Process ICE candidates suggested by the remote endpoint. This is used internally to the SDK and should not be called directly by your client application.
@param candidates Array of candidates to evaluate | [
"Process",
"ICE",
"candidates",
"suggested",
"by",
"the",
"remote",
"endpoint",
".",
"This",
"is",
"used",
"internally",
"to",
"the",
"SDK",
"and",
"should",
"not",
"be",
"called",
"directly",
"by",
"your",
"client",
"application",
"."
] | train | https://github.com/respoke/respoke-sdk-android/blob/34a15f0558d29b1f1bc8481bbc5c505e855e05ef/respokeSDK/src/main/java/com/digium/respokesdk/RespokeCall.java#L605-L637 |
UrielCh/ovh-java-sdk | ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java | ApiOvhTelephony.billingAccount_fax_serviceName_screenLists_reset_POST | public void billingAccount_fax_serviceName_screenLists_reset_POST(String billingAccount, String serviceName, Boolean blacklistedNumbers, Boolean blacklistedTSI, Boolean whitelistedNumbers, Boolean whitelistedTSI) throws IOException {
String qPath = "/telephony/{billingAccount}/fax/{serviceName}/screenLists/reset";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "blacklistedNumbers", blacklistedNumbers);
addBody(o, "blacklistedTSI", blacklistedTSI);
addBody(o, "whitelistedNumbers", whitelistedNumbers);
addBody(o, "whitelistedTSI", whitelistedTSI);
exec(qPath, "POST", sb.toString(), o);
} | java | public void billingAccount_fax_serviceName_screenLists_reset_POST(String billingAccount, String serviceName, Boolean blacklistedNumbers, Boolean blacklistedTSI, Boolean whitelistedNumbers, Boolean whitelistedTSI) throws IOException {
String qPath = "/telephony/{billingAccount}/fax/{serviceName}/screenLists/reset";
StringBuilder sb = path(qPath, billingAccount, serviceName);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "blacklistedNumbers", blacklistedNumbers);
addBody(o, "blacklistedTSI", blacklistedTSI);
addBody(o, "whitelistedNumbers", whitelistedNumbers);
addBody(o, "whitelistedTSI", whitelistedTSI);
exec(qPath, "POST", sb.toString(), o);
} | [
"public",
"void",
"billingAccount_fax_serviceName_screenLists_reset_POST",
"(",
"String",
"billingAccount",
",",
"String",
"serviceName",
",",
"Boolean",
"blacklistedNumbers",
",",
"Boolean",
"blacklistedTSI",
",",
"Boolean",
"whitelistedNumbers",
",",
"Boolean",
"whitelisted... | Reset a specifical fax screenList
REST: POST /telephony/{billingAccount}/fax/{serviceName}/screenLists/reset
@param whitelistedTSI [required] List of white login (TSI or ID)
@param blacklistedTSI [required] List of black login (TSI or ID)
@param blacklistedNumbers [required] List of black numbers
@param whitelistedNumbers [required] List of white numbers
@param billingAccount [required] The name of your billingAccount
@param serviceName [required] | [
"Reset",
"a",
"specifical",
"fax",
"screenList"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4499-L4508 |
infinispan/infinispan | core/src/main/java/org/infinispan/interceptors/distribution/TxDistributionInterceptor.java | TxDistributionInterceptor.handleTxWriteCommand | private Object handleTxWriteCommand(InvocationContext ctx, AbstractDataWriteCommand command,
Object key) throws Throwable {
try {
if (!ctx.isOriginLocal()) {
LocalizedCacheTopology cacheTopology = checkTopologyId(command);
// Ignore any remote command when we aren't the owner
if (!cacheTopology.isSegmentWriteOwner(command.getSegment())) {
return null;
}
}
CacheEntry entry = ctx.lookupEntry(command.getKey());
if (entry == null) {
if (isLocalModeForced(command) || command.hasAnyFlag(FlagBitSets.SKIP_REMOTE_LOOKUP) || !needsPreviousValue(ctx, command)) {
// in transactional mode, we always need the entry wrapped
entryFactory.wrapExternalEntry(ctx, key, null, false, true);
} else {
// we need to retrieve the value locally regardless of load type; in transactional mode all operations
// execute on origin
// Also, operations that need value on backup [delta write] need to do the remote lookup even on
// non-origin
Object result = asyncInvokeNext(ctx, command, remoteGetSingleKey(ctx, command, command.getKey(), true));
return makeStage(result)
.andFinally(ctx, command, (rCtx, rCommand, rv, t) ->
updateMatcherForRetry((WriteCommand) rCommand));
}
}
// already wrapped, we can continue
return invokeNextAndFinally(ctx, command, (rCtx, rCommand, rv, t) -> updateMatcherForRetry((WriteCommand) rCommand));
} catch (Throwable t) {
updateMatcherForRetry(command);
throw t;
}
} | java | private Object handleTxWriteCommand(InvocationContext ctx, AbstractDataWriteCommand command,
Object key) throws Throwable {
try {
if (!ctx.isOriginLocal()) {
LocalizedCacheTopology cacheTopology = checkTopologyId(command);
// Ignore any remote command when we aren't the owner
if (!cacheTopology.isSegmentWriteOwner(command.getSegment())) {
return null;
}
}
CacheEntry entry = ctx.lookupEntry(command.getKey());
if (entry == null) {
if (isLocalModeForced(command) || command.hasAnyFlag(FlagBitSets.SKIP_REMOTE_LOOKUP) || !needsPreviousValue(ctx, command)) {
// in transactional mode, we always need the entry wrapped
entryFactory.wrapExternalEntry(ctx, key, null, false, true);
} else {
// we need to retrieve the value locally regardless of load type; in transactional mode all operations
// execute on origin
// Also, operations that need value on backup [delta write] need to do the remote lookup even on
// non-origin
Object result = asyncInvokeNext(ctx, command, remoteGetSingleKey(ctx, command, command.getKey(), true));
return makeStage(result)
.andFinally(ctx, command, (rCtx, rCommand, rv, t) ->
updateMatcherForRetry((WriteCommand) rCommand));
}
}
// already wrapped, we can continue
return invokeNextAndFinally(ctx, command, (rCtx, rCommand, rv, t) -> updateMatcherForRetry((WriteCommand) rCommand));
} catch (Throwable t) {
updateMatcherForRetry(command);
throw t;
}
} | [
"private",
"Object",
"handleTxWriteCommand",
"(",
"InvocationContext",
"ctx",
",",
"AbstractDataWriteCommand",
"command",
",",
"Object",
"key",
")",
"throws",
"Throwable",
"{",
"try",
"{",
"if",
"(",
"!",
"ctx",
".",
"isOriginLocal",
"(",
")",
")",
"{",
"Local... | If we are within one transaction we won't do any replication as replication would only be performed at commit
time. If the operation didn't originate locally we won't do any replication either. | [
"If",
"we",
"are",
"within",
"one",
"transaction",
"we",
"won",
"t",
"do",
"any",
"replication",
"as",
"replication",
"would",
"only",
"be",
"performed",
"at",
"commit",
"time",
".",
"If",
"the",
"operation",
"didn",
"t",
"originate",
"locally",
"we",
"won... | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/interceptors/distribution/TxDistributionInterceptor.java#L400-L432 |
amsa-code/risky | geo-analyzer/src/main/java/au/gov/amsa/util/navigation/Position.java | Position.getDistanceKmToPath | public final double getDistanceKmToPath(Position p1, Position p2) {
double d = radiusEarthKm
* asin(sin(getDistanceToKm(p1) / radiusEarthKm)
* sin(toRadians(getBearingDegrees(p1)
- p1.getBearingDegrees(p2))));
return abs(d);
} | java | public final double getDistanceKmToPath(Position p1, Position p2) {
double d = radiusEarthKm
* asin(sin(getDistanceToKm(p1) / radiusEarthKm)
* sin(toRadians(getBearingDegrees(p1)
- p1.getBearingDegrees(p2))));
return abs(d);
} | [
"public",
"final",
"double",
"getDistanceKmToPath",
"(",
"Position",
"p1",
",",
"Position",
"p2",
")",
"{",
"double",
"d",
"=",
"radiusEarthKm",
"*",
"asin",
"(",
"sin",
"(",
"getDistanceToKm",
"(",
"p1",
")",
"/",
"radiusEarthKm",
")",
"*",
"sin",
"(",
... | calculates the distance of a point to the great circle path between p1
and p2.
Formula from: http://www.movable-type.co.uk/scripts/latlong.html
@param p1
@param p2
@return | [
"calculates",
"the",
"distance",
"of",
"a",
"point",
"to",
"the",
"great",
"circle",
"path",
"between",
"p1",
"and",
"p2",
"."
] | train | https://github.com/amsa-code/risky/blob/13649942aeddfdb9210eec072c605bc5d7a6daf3/geo-analyzer/src/main/java/au/gov/amsa/util/navigation/Position.java#L341-L347 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.