repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
classgraph/classgraph | src/main/java/io/github/classgraph/ClasspathElementDir.java | ClasspathElementDir.getResource | @Override
Resource getResource(final String relativePath) {
final File resourceFile = new File(classpathEltDir, relativePath);
return resourceFile.canRead() && resourceFile.isFile() ? newResource(relativePath, resourceFile) : null;
} | java | @Override
Resource getResource(final String relativePath) {
final File resourceFile = new File(classpathEltDir, relativePath);
return resourceFile.canRead() && resourceFile.isFile() ? newResource(relativePath, resourceFile) : null;
} | [
"@",
"Override",
"Resource",
"getResource",
"(",
"final",
"String",
"relativePath",
")",
"{",
"final",
"File",
"resourceFile",
"=",
"new",
"File",
"(",
"classpathEltDir",
",",
"relativePath",
")",
";",
"return",
"resourceFile",
".",
"canRead",
"(",
")",
"&&",
... | Get the {@link Resource} for a given relative path.
@param relativePath
The relative path of the {@link Resource} to return.
@return The {@link Resource} for the given relative path, or null if relativePath does not exist in this
classpath element. | [
"Get",
"the",
"{",
"@link",
"Resource",
"}",
"for",
"a",
"given",
"relative",
"path",
"."
] | train | https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ClasspathElementDir.java#L284-L288 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTreeRenderer.java | WTreeRenderer.handlePaintCustom | protected void handlePaintCustom(final WTree tree, final XmlStringBuilder xml) {
TreeItemModel model = tree.getTreeModel();
TreeItemIdNode root = tree.getCustomTree();
Set<String> selectedRows = new HashSet(tree.getSelectedRows());
Set<String> expandedRows = new HashSet(tree.getExpandedRows());
WTree.ExpandMode mode = tree.getExpandMode();
// Process root nodes
for (TreeItemIdNode node : root.getChildren()) {
paintCustomItem(tree, mode, model, node, xml, selectedRows, expandedRows);
}
} | java | protected void handlePaintCustom(final WTree tree, final XmlStringBuilder xml) {
TreeItemModel model = tree.getTreeModel();
TreeItemIdNode root = tree.getCustomTree();
Set<String> selectedRows = new HashSet(tree.getSelectedRows());
Set<String> expandedRows = new HashSet(tree.getExpandedRows());
WTree.ExpandMode mode = tree.getExpandMode();
// Process root nodes
for (TreeItemIdNode node : root.getChildren()) {
paintCustomItem(tree, mode, model, node, xml, selectedRows, expandedRows);
}
} | [
"protected",
"void",
"handlePaintCustom",
"(",
"final",
"WTree",
"tree",
",",
"final",
"XmlStringBuilder",
"xml",
")",
"{",
"TreeItemModel",
"model",
"=",
"tree",
".",
"getTreeModel",
"(",
")",
";",
"TreeItemIdNode",
"root",
"=",
"tree",
".",
"getCustomTree",
... | Paint the custom tree layout.
@param tree the WTree to render
@param xml the XML string builder | [
"Paint",
"the",
"custom",
"tree",
"layout",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WTreeRenderer.java#L205-L217 |
playn/playn | scene/src/playn/scene/LayerUtil.java | LayerUtil.parentToLayer | public static Point parentToLayer(Layer parent, Layer layer, XY point, Point into) {
into.set(point);
Layer immediateParent = layer.parent();
if (immediateParent != parent) parentToLayer(parent, immediateParent, into, into);
parentToLayer(layer, into, into);
return into;
} | java | public static Point parentToLayer(Layer parent, Layer layer, XY point, Point into) {
into.set(point);
Layer immediateParent = layer.parent();
if (immediateParent != parent) parentToLayer(parent, immediateParent, into, into);
parentToLayer(layer, into, into);
return into;
} | [
"public",
"static",
"Point",
"parentToLayer",
"(",
"Layer",
"parent",
",",
"Layer",
"layer",
",",
"XY",
"point",
",",
"Point",
"into",
")",
"{",
"into",
".",
"set",
"(",
"point",
")",
";",
"Layer",
"immediateParent",
"=",
"layer",
".",
"parent",
"(",
"... | Converts the supplied point from coordinates relative to the specified parent to coordinates
relative to the specified child layer. The results are stored into {@code into}, which is
returned for convenience. | [
"Converts",
"the",
"supplied",
"point",
"from",
"coordinates",
"relative",
"to",
"the",
"specified",
"parent",
"to",
"coordinates",
"relative",
"to",
"the",
"specified",
"child",
"layer",
".",
"The",
"results",
"are",
"stored",
"into",
"{"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L116-L122 |
JoeKerouac/utils | src/main/java/com/joe/utils/reflect/BeanUtils.java | BeanUtils.copy | public static <E> E copy(E dest, Object... sources) {
if (dest == null || sources == null || sources.length == 0) {
return dest;
}
for (Object obj : sources) {
if (dest == obj) {
continue;
}
copy(dest, obj);
}
return dest;
} | java | public static <E> E copy(E dest, Object... sources) {
if (dest == null || sources == null || sources.length == 0) {
return dest;
}
for (Object obj : sources) {
if (dest == obj) {
continue;
}
copy(dest, obj);
}
return dest;
} | [
"public",
"static",
"<",
"E",
">",
"E",
"copy",
"(",
"E",
"dest",
",",
"Object",
"...",
"sources",
")",
"{",
"if",
"(",
"dest",
"==",
"null",
"||",
"sources",
"==",
"null",
"||",
"sources",
".",
"length",
"==",
"0",
")",
"{",
"return",
"dest",
";... | 将sources中所有与dest同名的字段的值复制到dest中,如果dest中包含字段A,同时sources中多个对象都包含字段A,那么将
以sources中最后一个包含字段A的对象的值为准,source中的{@link Alias Alias}注解将会生效,需要注意的是source中的Alias注解
不要对应dest中的多个字段,否则会发生不可预测错误
@param dest 目标
@param sources 源
@param <E> 目标对象的实际类型
@return 复制后的目标对象 | [
"将sources中所有与dest同名的字段的值复制到dest中,如果dest中包含字段A,同时sources中多个对象都包含字段A,那么将",
"以sources中最后一个包含字段A的对象的值为准,source中的",
"{",
"@link",
"Alias",
"Alias",
"}",
"注解将会生效,需要注意的是source中的Alias注解",
"不要对应dest中的多个字段,否则会发生不可预测错误"
] | train | https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/BeanUtils.java#L168-L179 |
dita-ot/dita-ot | src/main/java/org/ditang/relaxng/defaults/RelaxNGDefaultsComponent.java | RelaxNGDefaultsComponent.onStartElement | private void onStartElement(QName name, XMLAttributes atts) {
if (detecting) {
detecting = false;
loadDefaults();
}
if (defaults != null) {
checkAndAddDefaults(name, atts);
}
} | java | private void onStartElement(QName name, XMLAttributes atts) {
if (detecting) {
detecting = false;
loadDefaults();
}
if (defaults != null) {
checkAndAddDefaults(name, atts);
}
} | [
"private",
"void",
"onStartElement",
"(",
"QName",
"name",
",",
"XMLAttributes",
"atts",
")",
"{",
"if",
"(",
"detecting",
")",
"{",
"detecting",
"=",
"false",
";",
"loadDefaults",
"(",
")",
";",
"}",
"if",
"(",
"defaults",
"!=",
"null",
")",
"{",
"che... | On start element
@param name The element name
@param atts The attributes | [
"On",
"start",
"element"
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/ditang/relaxng/defaults/RelaxNGDefaultsComponent.java#L220-L228 |
BotMill/fb-botmill | src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/GenericTemplateBuilder.java | GenericTemplateBuilder.addQuickReply | public GenericTemplateBuilder addQuickReply(String title, String payload) {
this.messageBuilder.addQuickReply(title, payload);
return this;
} | java | public GenericTemplateBuilder addQuickReply(String title, String payload) {
this.messageBuilder.addQuickReply(title, payload);
return this;
} | [
"public",
"GenericTemplateBuilder",
"addQuickReply",
"(",
"String",
"title",
",",
"String",
"payload",
")",
"{",
"this",
".",
"messageBuilder",
".",
"addQuickReply",
"(",
"title",
",",
"payload",
")",
";",
"return",
"this",
";",
"}"
] | Adds a {@link QuickReply} to the current object.
@param title
the quick reply button label. It can't be empty.
@param payload
the payload sent back when the button is pressed. It can't be
empty.
@return this builder.
@see <a href=
"https://developers.facebook.com/docs/messenger-platform/send-api-reference/quick-replies"
> Facebook's Messenger Platform Quick Replies Documentation</a> | [
"Adds",
"a",
"{",
"@link",
"QuickReply",
"}",
"to",
"the",
"current",
"object",
"."
] | train | https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/GenericTemplateBuilder.java#L99-L102 |
FINRAOS/JTAF-ExtWebDriver | src/main/java/org/finra/jtaf/ewd/properties/GUIHierarchyConcatenationProperties.java | GUIHierarchyConcatenationProperties.getPropertyValue | public String getPropertyValue(String[] propertyNames, String... parameters) {
// Create possible combinations of property names
String value;
List<String> possiblePropertyNames = new ArrayList<String>();
StringBuffer fullName = new StringBuffer();
for (int i = 0; i < propertyNames.length; i++) {
fullName.append(propertyNames[propertyNames.length - i - 1]);
possiblePropertyNames.add(fullName.toString());
}
// Try to find the property
for (int i = 0; i < possiblePropertyNames.size(); i++) {
String propertyNameCurrent = possiblePropertyNames.get(possiblePropertyNames.size() - i
- 1);
for (int y = 0; y < propertyFiles.size(); y++) {
try {
GUIProperties propertyFile = propertyFiles.get(y);
if (parameters != null && parameters.length > 0) {
value = propertyFile.getPropertyValue(propertyNameCurrent, parameters);
} else {
value = propertyFile.getPropertyValue(propertyNameCurrent);
}
return value;
} catch (MissingResourceException e) {
// Ignore and continue searching
}
}
}
throw new MissingGUIPropertyException(possiblePropertyNames, propertyFilesNames);
} | java | public String getPropertyValue(String[] propertyNames, String... parameters) {
// Create possible combinations of property names
String value;
List<String> possiblePropertyNames = new ArrayList<String>();
StringBuffer fullName = new StringBuffer();
for (int i = 0; i < propertyNames.length; i++) {
fullName.append(propertyNames[propertyNames.length - i - 1]);
possiblePropertyNames.add(fullName.toString());
}
// Try to find the property
for (int i = 0; i < possiblePropertyNames.size(); i++) {
String propertyNameCurrent = possiblePropertyNames.get(possiblePropertyNames.size() - i
- 1);
for (int y = 0; y < propertyFiles.size(); y++) {
try {
GUIProperties propertyFile = propertyFiles.get(y);
if (parameters != null && parameters.length > 0) {
value = propertyFile.getPropertyValue(propertyNameCurrent, parameters);
} else {
value = propertyFile.getPropertyValue(propertyNameCurrent);
}
return value;
} catch (MissingResourceException e) {
// Ignore and continue searching
}
}
}
throw new MissingGUIPropertyException(possiblePropertyNames, propertyFilesNames);
} | [
"public",
"String",
"getPropertyValue",
"(",
"String",
"[",
"]",
"propertyNames",
",",
"String",
"...",
"parameters",
")",
"{",
"// Create possible combinations of property names",
"String",
"value",
";",
"List",
"<",
"String",
">",
"possiblePropertyNames",
"=",
"new"... | Searches over the group of {@code GUIProperties} for a property
corresponding to a hierarchical concatenation of the given names.
<p>
Concatenation of property names is done from high index to low. That is
to say, for the array {@code ["a", "b", "c"]}, the names searched will be
{@code "cba"}, {@code "cb"}, {@code "c"} in that order.
@param propertyNames
names to be concatenated and searched for
@param parameters
instances of the {@code String} literal <code>"{n}"</code> in
the retrieved value will be replaced by {@code params[n]}
@return the first property found associated with a concatenation of the
given names
@throws MissingGUIPropertyException | [
"Searches",
"over",
"the",
"group",
"of",
"{",
"@code",
"GUIProperties",
"}",
"for",
"a",
"property",
"corresponding",
"to",
"a",
"hierarchical",
"concatenation",
"of",
"the",
"given",
"names",
".",
"<p",
">",
"Concatenation",
"of",
"property",
"names",
"is",
... | train | https://github.com/FINRAOS/JTAF-ExtWebDriver/blob/78d646def1bf0904f79b19a81df0241e07f2c73a/src/main/java/org/finra/jtaf/ewd/properties/GUIHierarchyConcatenationProperties.java#L140-L171 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Validator.java | Validator.validateNotEmptyAndNotEqual | public static void validateNotEmptyAndNotEqual(Object t1, Object t2, String errorMsg) throws ValidateException {
validateNotEmpty(t1, errorMsg);
validateNotEqual(t1, t2, errorMsg);
} | java | public static void validateNotEmptyAndNotEqual(Object t1, Object t2, String errorMsg) throws ValidateException {
validateNotEmpty(t1, errorMsg);
validateNotEqual(t1, t2, errorMsg);
} | [
"public",
"static",
"void",
"validateNotEmptyAndNotEqual",
"(",
"Object",
"t1",
",",
"Object",
"t2",
",",
"String",
"errorMsg",
")",
"throws",
"ValidateException",
"{",
"validateNotEmpty",
"(",
"t1",
",",
"errorMsg",
")",
";",
"validateNotEqual",
"(",
"t1",
",",... | 验证是否非空且与指定值相等<br>
当数据为空时抛出验证异常<br>
当两值相等时抛出异常
@param t1 对象1
@param t2 对象2
@param errorMsg 错误信息
@throws ValidateException 验证异常 | [
"验证是否非空且与指定值相等<br",
">",
"当数据为空时抛出验证异常<br",
">",
"当两值相等时抛出异常"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L294-L297 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java | AFPChainXMLParser.getPositionForPDBresunm | private static int getPositionForPDBresunm(String pdbresnum, String authId , Atom[] atoms){
ResidueNumber residueNumber = ResidueNumber.fromString(pdbresnum);
residueNumber.setChainName(authId);
boolean blankChain = authId == null || authId.equalsIgnoreCase("null") || authId.equals("_");
for ( int i =0; i< atoms.length ;i++){
Group g = atoms[i].getGroup();
// match _ to any chain
if( blankChain ) {
residueNumber.setChainName(g.getChain().getName());
}
//System.out.println(g.getResidueNumber() + "< ? >" + residueNumber +"<");
if ( g.getResidueNumber().equals(residueNumber)){
//System.out.println(g + " == " + residueNumber );
Chain c = g.getChain();
if ( blankChain || c.getName().equals(authId)){
return i;
}
}
}
return -1;
} | java | private static int getPositionForPDBresunm(String pdbresnum, String authId , Atom[] atoms){
ResidueNumber residueNumber = ResidueNumber.fromString(pdbresnum);
residueNumber.setChainName(authId);
boolean blankChain = authId == null || authId.equalsIgnoreCase("null") || authId.equals("_");
for ( int i =0; i< atoms.length ;i++){
Group g = atoms[i].getGroup();
// match _ to any chain
if( blankChain ) {
residueNumber.setChainName(g.getChain().getName());
}
//System.out.println(g.getResidueNumber() + "< ? >" + residueNumber +"<");
if ( g.getResidueNumber().equals(residueNumber)){
//System.out.println(g + " == " + residueNumber );
Chain c = g.getChain();
if ( blankChain || c.getName().equals(authId)){
return i;
}
}
}
return -1;
} | [
"private",
"static",
"int",
"getPositionForPDBresunm",
"(",
"String",
"pdbresnum",
",",
"String",
"authId",
",",
"Atom",
"[",
"]",
"atoms",
")",
"{",
"ResidueNumber",
"residueNumber",
"=",
"ResidueNumber",
".",
"fromString",
"(",
"pdbresnum",
")",
";",
"residueN... | get the position of PDB residue nr X in the ato marray
@param pdbresnum pdbresidue number
@param authId chain name
@param atoms atom array
@return | [
"get",
"the",
"position",
"of",
"PDB",
"residue",
"nr",
"X",
"in",
"the",
"ato",
"marray"
] | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/align/xml/AFPChainXMLParser.java#L519-L543 |
JRebirth/JRebirth | org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirth.java | JRebirth.runIntoJTPSync | public static void runIntoJTPSync(final String runnableName, final PriorityLevel runnablePriority, final Runnable runnable, final long... timeout) {
runIntoJTPSync(new JrbReferenceRunnable(runnableName, runnablePriority, runnable), timeout);
} | java | public static void runIntoJTPSync(final String runnableName, final PriorityLevel runnablePriority, final Runnable runnable, final long... timeout) {
runIntoJTPSync(new JrbReferenceRunnable(runnableName, runnablePriority, runnable), timeout);
} | [
"public",
"static",
"void",
"runIntoJTPSync",
"(",
"final",
"String",
"runnableName",
",",
"final",
"PriorityLevel",
"runnablePriority",
",",
"final",
"Runnable",
"runnable",
",",
"final",
"long",
"...",
"timeout",
")",
"{",
"runIntoJTPSync",
"(",
"new",
"JrbRefer... | Run into the JRebirth Thread Pool [JTP] <b>Synchronously</b>.
Be careful this method can be called through any thread.
@param runnableName the name of the runnable for logging purpose
@param runnablePriority the priority to try to apply to the runnable
@param runnable the task to run
@param timeout the optional timeout value after which the thread will be released (default is 1000 ms) | [
"Run",
"into",
"the",
"JRebirth",
"Thread",
"Pool",
"[",
"JTP",
"]",
"<b",
">",
"Synchronously<",
"/",
"b",
">",
"."
] | train | https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/concurrent/JRebirth.java#L380-L382 |
apache/incubator-gobblin | gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetrics.java | GobblinMetrics.startMetricReportingWithFileSuffix | public void startMetricReportingWithFileSuffix(State state, String metricsFileSuffix) {
Properties metricsReportingProps = new Properties();
metricsReportingProps.putAll(state.getProperties());
String oldMetricsFileSuffix =
state.getProp(ConfigurationKeys.METRICS_FILE_SUFFIX, ConfigurationKeys.DEFAULT_METRICS_FILE_SUFFIX);
if (Strings.isNullOrEmpty(oldMetricsFileSuffix)) {
oldMetricsFileSuffix = metricsFileSuffix;
} else {
oldMetricsFileSuffix += "." + metricsFileSuffix;
}
metricsReportingProps.setProperty(ConfigurationKeys.METRICS_FILE_SUFFIX, oldMetricsFileSuffix);
startMetricReporting(metricsReportingProps);
} | java | public void startMetricReportingWithFileSuffix(State state, String metricsFileSuffix) {
Properties metricsReportingProps = new Properties();
metricsReportingProps.putAll(state.getProperties());
String oldMetricsFileSuffix =
state.getProp(ConfigurationKeys.METRICS_FILE_SUFFIX, ConfigurationKeys.DEFAULT_METRICS_FILE_SUFFIX);
if (Strings.isNullOrEmpty(oldMetricsFileSuffix)) {
oldMetricsFileSuffix = metricsFileSuffix;
} else {
oldMetricsFileSuffix += "." + metricsFileSuffix;
}
metricsReportingProps.setProperty(ConfigurationKeys.METRICS_FILE_SUFFIX, oldMetricsFileSuffix);
startMetricReporting(metricsReportingProps);
} | [
"public",
"void",
"startMetricReportingWithFileSuffix",
"(",
"State",
"state",
",",
"String",
"metricsFileSuffix",
")",
"{",
"Properties",
"metricsReportingProps",
"=",
"new",
"Properties",
"(",
")",
";",
"metricsReportingProps",
".",
"putAll",
"(",
"state",
".",
"g... | Starts metric reporting and appends the given metrics file suffix to the current value of
{@link ConfigurationKeys#METRICS_FILE_SUFFIX}. | [
"Starts",
"metric",
"reporting",
"and",
"appends",
"the",
"given",
"metrics",
"file",
"suffix",
"to",
"the",
"current",
"value",
"of",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics/src/main/java/org/apache/gobblin/metrics/GobblinMetrics.java#L353-L366 |
Kickflip/kickflip-android-sdk | sdk/src/main/java/io/kickflip/sdk/av/FFmpegMuxer.java | FFmpegMuxer.addAdtsToPacket | private void addAdtsToPacket(byte[] packet, int packetLen) {
packet[0] = (byte) 0xFF; // 11111111 = syncword
packet[1] = (byte) 0xF9; // 1111 1 00 1 = syncword MPEG-2 Layer CRC
packet[2] = (byte) (((profile - 1) << 6) + (freqIdx << 2) + (chanCfg >> 2));
packet[3] = (byte) (((chanCfg & 3) << 6) + (packetLen >> 11));
packet[4] = (byte) ((packetLen & 0x7FF) >> 3);
packet[5] = (byte) (((packetLen & 7) << 5) + 0x1F);
packet[6] = (byte) 0xFC;
} | java | private void addAdtsToPacket(byte[] packet, int packetLen) {
packet[0] = (byte) 0xFF; // 11111111 = syncword
packet[1] = (byte) 0xF9; // 1111 1 00 1 = syncword MPEG-2 Layer CRC
packet[2] = (byte) (((profile - 1) << 6) + (freqIdx << 2) + (chanCfg >> 2));
packet[3] = (byte) (((chanCfg & 3) << 6) + (packetLen >> 11));
packet[4] = (byte) ((packetLen & 0x7FF) >> 3);
packet[5] = (byte) (((packetLen & 7) << 5) + 0x1F);
packet[6] = (byte) 0xFC;
} | [
"private",
"void",
"addAdtsToPacket",
"(",
"byte",
"[",
"]",
"packet",
",",
"int",
"packetLen",
")",
"{",
"packet",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"0xFF",
";",
"// 11111111 = syncword",
"packet",
"[",
"1",
"]",
"=",
"(",
"byte",
")",
"0... | Add ADTS header at the beginning of each and every AAC packet.
This is needed as MediaCodec encoder generates a packet of raw
AAC data.
<p/>
Note the packetLen must count in the ADTS header itself.
See: http://wiki.multimedia.cx/index.php?title=ADTS
Also: http://wiki.multimedia.cx/index.php?title=MPEG-4_Audio#Channel_Configurations | [
"Add",
"ADTS",
"header",
"at",
"the",
"beginning",
"of",
"each",
"and",
"every",
"AAC",
"packet",
".",
"This",
"is",
"needed",
"as",
"MediaCodec",
"encoder",
"generates",
"a",
"packet",
"of",
"raw",
"AAC",
"data",
".",
"<p",
"/",
">",
"Note",
"the",
"p... | train | https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/FFmpegMuxer.java#L344-L352 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/InnerClassAccessMap.java | InnerClassAccessMap.getInnerClassAccess | public InnerClassAccess getInnerClassAccess(String className, String methodName) throws ClassNotFoundException {
Map<String, InnerClassAccess> map = getAccessMapForClass(className);
return map.get(methodName);
} | java | public InnerClassAccess getInnerClassAccess(String className, String methodName) throws ClassNotFoundException {
Map<String, InnerClassAccess> map = getAccessMapForClass(className);
return map.get(methodName);
} | [
"public",
"InnerClassAccess",
"getInnerClassAccess",
"(",
"String",
"className",
",",
"String",
"methodName",
")",
"throws",
"ClassNotFoundException",
"{",
"Map",
"<",
"String",
",",
"InnerClassAccess",
">",
"map",
"=",
"getAccessMapForClass",
"(",
"className",
")",
... | Get the InnerClassAccess in given class with the given method name.
@param className
the name of the class
@param methodName
the name of the access method
@return the InnerClassAccess object for the method, or null if the method
doesn't seem to be an inner class access | [
"Get",
"the",
"InnerClassAccess",
"in",
"given",
"class",
"with",
"the",
"given",
"method",
"name",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/InnerClassAccessMap.java#L93-L96 |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.L1_L3 | @Pure
public static Point2d L1_L3(double x, double y) {
final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
LAMBERT_1_N,
LAMBERT_1_C,
LAMBERT_1_XS,
LAMBERT_1_YS);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_3_N,
LAMBERT_3_C,
LAMBERT_3_XS,
LAMBERT_3_YS);
} | java | @Pure
public static Point2d L1_L3(double x, double y) {
final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y,
LAMBERT_1_N,
LAMBERT_1_C,
LAMBERT_1_XS,
LAMBERT_1_YS);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_3_N,
LAMBERT_3_C,
LAMBERT_3_XS,
LAMBERT_3_YS);
} | [
"@",
"Pure",
"public",
"static",
"Point2d",
"L1_L3",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"NTFLambert_NTFLambdaPhi",
"(",
"x",
",",
"y",
",",
"LAMBERT_1_N",
",",
"LAMBERT_1_C",
",",
"LAMBERT_1_XS",
",",
... | This function convert France Lambert I coordinate to
France Lambert III coordinate.
@param x is the coordinate in France Lambert I
@param y is the coordinate in France Lambert I
@return the France Lambert III coordinate. | [
"This",
"function",
"convert",
"France",
"Lambert",
"I",
"coordinate",
"to",
"France",
"Lambert",
"III",
"coordinate",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L351-L364 |
payneteasy/superfly | superfly-demo/src/main/java/com/payneteasy/superfly/demo/web/utils/CommonsHttpInvokerRequestExecutor.java | CommonsHttpInvokerRequestExecutor.doExecuteRequest | @Override
protected RemoteInvocationResult doExecuteRequest(
HttpInvokerClientConfiguration config, ByteArrayOutputStream baos)
throws IOException, ClassNotFoundException {
PostMethod postMethod = createPostMethod(config);
try {
setRequestBody(config, postMethod, baos);
executePostMethod(config, getHttpClient(), postMethod);
validateResponse(config, postMethod);
InputStream responseBody = getResponseBody(config, postMethod);
return readRemoteInvocationResult(responseBody, config.getCodebaseUrl());
}
finally {
// Need to explicitly release because it might be pooled.
postMethod.releaseConnection();
}
} | java | @Override
protected RemoteInvocationResult doExecuteRequest(
HttpInvokerClientConfiguration config, ByteArrayOutputStream baos)
throws IOException, ClassNotFoundException {
PostMethod postMethod = createPostMethod(config);
try {
setRequestBody(config, postMethod, baos);
executePostMethod(config, getHttpClient(), postMethod);
validateResponse(config, postMethod);
InputStream responseBody = getResponseBody(config, postMethod);
return readRemoteInvocationResult(responseBody, config.getCodebaseUrl());
}
finally {
// Need to explicitly release because it might be pooled.
postMethod.releaseConnection();
}
} | [
"@",
"Override",
"protected",
"RemoteInvocationResult",
"doExecuteRequest",
"(",
"HttpInvokerClientConfiguration",
"config",
",",
"ByteArrayOutputStream",
"baos",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"PostMethod",
"postMethod",
"=",
"createPostMet... | Execute the given request through Commons HttpClient.
<p>This method implements the basic processing workflow:
The actual work happens in this class's template methods.
@see #createPostMethod
@see #setRequestBody
@see #executePostMethod
@see #validateResponse
@see #getResponseBody | [
"Execute",
"the",
"given",
"request",
"through",
"Commons",
"HttpClient",
".",
"<p",
">",
"This",
"method",
"implements",
"the",
"basic",
"processing",
"workflow",
":",
"The",
"actual",
"work",
"happens",
"in",
"this",
"class",
"s",
"template",
"methods",
"."
... | train | https://github.com/payneteasy/superfly/blob/4cad6d0f8e951a61f3c302c49b13a51d179076f8/superfly-demo/src/main/java/com/payneteasy/superfly/demo/web/utils/CommonsHttpInvokerRequestExecutor.java#L118-L135 |
Carbonado/Carbonado | src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java | SyntheticStorableReferenceBuilder.addKeyProperty | public SyntheticProperty addKeyProperty(String name, Direction direction) {
StorableProperty<S> prop = mMasterStorableInfo.getAllProperties().get(name);
if (prop == null) {
throw new IllegalArgumentException(name + " is not a property of "
+ mMasterStorableInfo.getName());
}
mPrimaryKey.addProperty(name, direction);
SyntheticProperty result = addProperty(prop);
mUserProps.add(result);
return result;
} | java | public SyntheticProperty addKeyProperty(String name, Direction direction) {
StorableProperty<S> prop = mMasterStorableInfo.getAllProperties().get(name);
if (prop == null) {
throw new IllegalArgumentException(name + " is not a property of "
+ mMasterStorableInfo.getName());
}
mPrimaryKey.addProperty(name, direction);
SyntheticProperty result = addProperty(prop);
mUserProps.add(result);
return result;
} | [
"public",
"SyntheticProperty",
"addKeyProperty",
"(",
"String",
"name",
",",
"Direction",
"direction",
")",
"{",
"StorableProperty",
"<",
"S",
">",
"prop",
"=",
"mMasterStorableInfo",
".",
"getAllProperties",
"(",
")",
".",
"get",
"(",
"name",
")",
";",
"if",
... | Add a property to the primary key which is a member of the Storable type
being referenced by this one.
@param name | [
"Add",
"a",
"property",
"to",
"the",
"primary",
"key",
"which",
"is",
"a",
"member",
"of",
"the",
"Storable",
"type",
"being",
"referenced",
"by",
"this",
"one",
"."
] | train | https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/synthetic/SyntheticStorableReferenceBuilder.java#L243-L255 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java | Activator.postInvoke | public void postInvoke(ContainerTx tx, BeanO bean)
{
bean.getActivationStrategy().atPostInvoke(tx, bean);
} | java | public void postInvoke(ContainerTx tx, BeanO bean)
{
bean.getActivationStrategy().atPostInvoke(tx, bean);
} | [
"public",
"void",
"postInvoke",
"(",
"ContainerTx",
"tx",
",",
"BeanO",
"bean",
")",
"{",
"bean",
".",
"getActivationStrategy",
"(",
")",
".",
"atPostInvoke",
"(",
"tx",
",",
"bean",
")",
";",
"}"
] | Perform actions required following method invocation; this is
the complement to activateBean, and should be called by the container
to balance activateBean. <p> | [
"Perform",
"actions",
"required",
"following",
"method",
"invocation",
";",
"this",
"is",
"the",
"complement",
"to",
"activateBean",
"and",
"should",
"be",
"called",
"by",
"the",
"container",
"to",
"balance",
"activateBean",
".",
"<p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/activator/Activator.java#L312-L315 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/ThreeViewEstimateMetricScene.java | ThreeViewEstimateMetricScene.setupMetricBundleAdjustment | private void setupMetricBundleAdjustment(List<AssociatedTriple> inliers) {
// Construct bundle adjustment data structure
structure = new SceneStructureMetric(false);
observations = new SceneObservations(3);
structure.initialize(3,3,inliers.size());
for (int i = 0; i < listPinhole.size(); i++) {
CameraPinhole cp = listPinhole.get(i);
BundlePinholeSimplified bp = new BundlePinholeSimplified();
bp.f = cp.fx;
structure.setCamera(i,false,bp);
structure.setView(i,i==0,worldToView.get(i));
structure.connectViewToCamera(i,i);
}
for (int i = 0; i < inliers.size(); i++) {
AssociatedTriple t = inliers.get(i);
observations.getView(0).add(i,(float)t.p1.x,(float)t.p1.y);
observations.getView(1).add(i,(float)t.p2.x,(float)t.p2.y);
observations.getView(2).add(i,(float)t.p3.x,(float)t.p3.y);
structure.connectPointToView(i,0);
structure.connectPointToView(i,1);
structure.connectPointToView(i,2);
}
// Initial estimate for point 3D locations
triangulatePoints(structure,observations);
} | java | private void setupMetricBundleAdjustment(List<AssociatedTriple> inliers) {
// Construct bundle adjustment data structure
structure = new SceneStructureMetric(false);
observations = new SceneObservations(3);
structure.initialize(3,3,inliers.size());
for (int i = 0; i < listPinhole.size(); i++) {
CameraPinhole cp = listPinhole.get(i);
BundlePinholeSimplified bp = new BundlePinholeSimplified();
bp.f = cp.fx;
structure.setCamera(i,false,bp);
structure.setView(i,i==0,worldToView.get(i));
structure.connectViewToCamera(i,i);
}
for (int i = 0; i < inliers.size(); i++) {
AssociatedTriple t = inliers.get(i);
observations.getView(0).add(i,(float)t.p1.x,(float)t.p1.y);
observations.getView(1).add(i,(float)t.p2.x,(float)t.p2.y);
observations.getView(2).add(i,(float)t.p3.x,(float)t.p3.y);
structure.connectPointToView(i,0);
structure.connectPointToView(i,1);
structure.connectPointToView(i,2);
}
// Initial estimate for point 3D locations
triangulatePoints(structure,observations);
} | [
"private",
"void",
"setupMetricBundleAdjustment",
"(",
"List",
"<",
"AssociatedTriple",
">",
"inliers",
")",
"{",
"// Construct bundle adjustment data structure",
"structure",
"=",
"new",
"SceneStructureMetric",
"(",
"false",
")",
";",
"observations",
"=",
"new",
"Scene... | Using the initial metric reconstruction, provide the initial configurations for bundle adjustment | [
"Using",
"the",
"initial",
"metric",
"reconstruction",
"provide",
"the",
"initial",
"configurations",
"for",
"bundle",
"adjustment"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/structure/ThreeViewEstimateMetricScene.java#L339-L368 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractInputHandler.java | AbstractInputHandler.registerMessage | public void registerMessage(MessageItem msg, TransactionCommon tran) throws SIIncorrectCallException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "registerMessage", new Object[] { msg, tran });
if (tran != null && !tran.isAlive())
{
SIMPIncorrectCallException e = new SIMPIncorrectCallException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_16", // TRANSACTION_SEND_USAGE_ERROR_CWSIP0093
new Object[] { _destination },
null) );
e.setExceptionReason(SIRCConstants.SIRC0016_TRANSACTION_SEND_USAGE_ERROR);
e.setExceptionInserts(new String[] { _destination.getName() });
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "registerMessage", e);
throw e;
}
registerForEvents(msg);
/* Register the message with the pre-prepare callback on the transaction.
* When called back, the choice of OutputHandler for the message is made
* and the message is put to the itemstream of the chosen OutputHandler.
*/
tran.registerCallback(msg);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "registerMessage");
} | java | public void registerMessage(MessageItem msg, TransactionCommon tran) throws SIIncorrectCallException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "registerMessage", new Object[] { msg, tran });
if (tran != null && !tran.isAlive())
{
SIMPIncorrectCallException e = new SIMPIncorrectCallException(
nls_cwsik.getFormattedMessage(
"DELIVERY_ERROR_SIRC_16", // TRANSACTION_SEND_USAGE_ERROR_CWSIP0093
new Object[] { _destination },
null) );
e.setExceptionReason(SIRCConstants.SIRC0016_TRANSACTION_SEND_USAGE_ERROR);
e.setExceptionInserts(new String[] { _destination.getName() });
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
SibTr.exception(tc, e);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "registerMessage", e);
throw e;
}
registerForEvents(msg);
/* Register the message with the pre-prepare callback on the transaction.
* When called back, the choice of OutputHandler for the message is made
* and the message is put to the itemstream of the chosen OutputHandler.
*/
tran.registerCallback(msg);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "registerMessage");
} | [
"public",
"void",
"registerMessage",
"(",
"MessageItem",
"msg",
",",
"TransactionCommon",
"tran",
")",
"throws",
"SIIncorrectCallException",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
... | Method registerMessage.
@param msg
@param tran
<p>Register the message with the pre-prepare callback on the transaction.
When called back, the choice of OutputHandler for the message is made
and the message is put to the itemstream of the chosen OutputHandler.
</p> | [
"Method",
"registerMessage",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/AbstractInputHandler.java#L411-L446 |
gosu-lang/gosu-lang | gosu-core/src/main/java/gw/internal/gosu/parser/GosuParserFactoryImpl.java | GosuParserFactoryImpl.createParser | public IGosuParser createParser( String strSource, ISymbolTable symTable )
{
return createParser( strSource, symTable, null );
} | java | public IGosuParser createParser( String strSource, ISymbolTable symTable )
{
return createParser( strSource, symTable, null );
} | [
"public",
"IGosuParser",
"createParser",
"(",
"String",
"strSource",
",",
"ISymbolTable",
"symTable",
")",
"{",
"return",
"createParser",
"(",
"strSource",
",",
"symTable",
",",
"null",
")",
";",
"}"
] | Creates an IGosuParser appropriate for parsing and executing Gosu.
@param strSource The text of the the rule source
@param symTable The symbol table the parser uses to parse and execute the rule
@return A parser appropriate for parsing Gosu source. | [
"Creates",
"an",
"IGosuParser",
"appropriate",
"for",
"parsing",
"and",
"executing",
"Gosu",
"."
] | train | https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core/src/main/java/gw/internal/gosu/parser/GosuParserFactoryImpl.java#L79-L82 |
couchbase/couchbase-java-client | src/main/java/com/couchbase/client/java/query/dsl/functions/StringFunctions.java | StringFunctions.ltrim | public static Expression ltrim(String expression, String characters) {
return ltrim(x(expression), characters);
} | java | public static Expression ltrim(String expression, String characters) {
return ltrim(x(expression), characters);
} | [
"public",
"static",
"Expression",
"ltrim",
"(",
"String",
"expression",
",",
"String",
"characters",
")",
"{",
"return",
"ltrim",
"(",
"x",
"(",
"expression",
")",
",",
"characters",
")",
";",
"}"
] | Returned expression results in the string with all leading chars removed (any char in the characters string). | [
"Returned",
"expression",
"results",
"in",
"the",
"string",
"with",
"all",
"leading",
"chars",
"removed",
"(",
"any",
"char",
"in",
"the",
"characters",
"string",
")",
"."
] | train | https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/StringFunctions.java#L137-L139 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/EntrySerializer.java | EntrySerializer.readHeader | Header readHeader(@NonNull InputStream input) throws IOException {
byte version = (byte) input.read();
int keyLength = BitConverter.readInt(input);
int valueLength = BitConverter.readInt(input);
long entryVersion = BitConverter.readLong(input);
validateHeader(keyLength, valueLength);
return new Header(version, keyLength, valueLength, entryVersion);
} | java | Header readHeader(@NonNull InputStream input) throws IOException {
byte version = (byte) input.read();
int keyLength = BitConverter.readInt(input);
int valueLength = BitConverter.readInt(input);
long entryVersion = BitConverter.readLong(input);
validateHeader(keyLength, valueLength);
return new Header(version, keyLength, valueLength, entryVersion);
} | [
"Header",
"readHeader",
"(",
"@",
"NonNull",
"InputStream",
"input",
")",
"throws",
"IOException",
"{",
"byte",
"version",
"=",
"(",
"byte",
")",
"input",
".",
"read",
"(",
")",
";",
"int",
"keyLength",
"=",
"BitConverter",
".",
"readInt",
"(",
"input",
... | Reads the Entry's Header from the given {@link InputStream}.
@param input The {@link InputStream} to read from.
@return The Entry Header.
@throws IOException If an invalid header was detected or another IOException occurred. | [
"Reads",
"the",
"Entry",
"s",
"Header",
"from",
"the",
"given",
"{",
"@link",
"InputStream",
"}",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/EntrySerializer.java#L197-L204 |
ironjacamar/ironjacamar | core/src/main/java/org/ironjacamar/core/bootstrapcontext/BootstrapContextCoordinator.java | BootstrapContextCoordinator.createIdentifier | public String createIdentifier(String raClz, Collection<ConfigProperty> configProperties)
{
return createIdentifier(raClz, configProperties, null);
} | java | public String createIdentifier(String raClz, Collection<ConfigProperty> configProperties)
{
return createIdentifier(raClz, configProperties, null);
} | [
"public",
"String",
"createIdentifier",
"(",
"String",
"raClz",
",",
"Collection",
"<",
"ConfigProperty",
">",
"configProperties",
")",
"{",
"return",
"createIdentifier",
"(",
"raClz",
",",
"configProperties",
",",
"null",
")",
";",
"}"
] | Create an identifier
@param raClz The resource adapter class name
@param configProperties The config properties
@return The id | [
"Create",
"an",
"identifier"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/bootstrapcontext/BootstrapContextCoordinator.java#L263-L266 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPartialDateField.java | WPartialDateField.setPartialDate | public void setPartialDate(final Integer day, final Integer month, final Integer year) {
// Validate Year
if (!isValidYear(year)) {
throw new IllegalArgumentException("Setting invalid partial year value (" + year
+ "). Year should be between " + YEAR_MIN + " to " + YEAR_MAX + ".");
}
// Validate Month
if (!isValidMonth(month)) {
throw new IllegalArgumentException("Setting invalid partial month value (" + month
+ "). Month should be between " + MONTH_MIN + " to " + MONTH_MAX + ".");
}
// Validate Day
if (!isValidDay(day)) {
throw new IllegalArgumentException("Setting invalid partial day value (" + day
+ "). Day should be between " + DAY_MIN + " to " + DAY_MAX + ".");
}
String formatted = formatPartialDateToString(day, month, year, getPaddingChar());
setData(formatted);
PartialDateFieldModel model = getOrCreateComponentModel();
model.text = null;
model.validDate = true;
} | java | public void setPartialDate(final Integer day, final Integer month, final Integer year) {
// Validate Year
if (!isValidYear(year)) {
throw new IllegalArgumentException("Setting invalid partial year value (" + year
+ "). Year should be between " + YEAR_MIN + " to " + YEAR_MAX + ".");
}
// Validate Month
if (!isValidMonth(month)) {
throw new IllegalArgumentException("Setting invalid partial month value (" + month
+ "). Month should be between " + MONTH_MIN + " to " + MONTH_MAX + ".");
}
// Validate Day
if (!isValidDay(day)) {
throw new IllegalArgumentException("Setting invalid partial day value (" + day
+ "). Day should be between " + DAY_MIN + " to " + DAY_MAX + ".");
}
String formatted = formatPartialDateToString(day, month, year, getPaddingChar());
setData(formatted);
PartialDateFieldModel model = getOrCreateComponentModel();
model.text = null;
model.validDate = true;
} | [
"public",
"void",
"setPartialDate",
"(",
"final",
"Integer",
"day",
",",
"final",
"Integer",
"month",
",",
"final",
"Integer",
"year",
")",
"{",
"// Validate Year",
"if",
"(",
"!",
"isValidYear",
"(",
"year",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentEx... | Set the WPartialDateField with the given day, month and year. Each of the day, month and year parameters that
make up the partial date are optional.
@param day A number from 1 to 31 or null if unknown.
@param month A number from 1 to 12, or null if unknown.
@param year A number, or null if unknown. | [
"Set",
"the",
"WPartialDateField",
"with",
"the",
"given",
"day",
"month",
"and",
"year",
".",
"Each",
"of",
"the",
"day",
"month",
"and",
"year",
"parameters",
"that",
"make",
"up",
"the",
"partial",
"date",
"are",
"optional",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WPartialDateField.java#L240-L265 |
lisicnu/droidUtil | src/main/java/com/github/lisicnu/libDroid/util/ShellUtils.java | ShellUtils.execCommand | public static CommandResult execCommand(List<String> commands, boolean isRoot, boolean isNeedResultMsg) {
return execCommand(commands == null ? null : commands.toArray(new String[]{}), isRoot, isNeedResultMsg);
} | java | public static CommandResult execCommand(List<String> commands, boolean isRoot, boolean isNeedResultMsg) {
return execCommand(commands == null ? null : commands.toArray(new String[]{}), isRoot, isNeedResultMsg);
} | [
"public",
"static",
"CommandResult",
"execCommand",
"(",
"List",
"<",
"String",
">",
"commands",
",",
"boolean",
"isRoot",
",",
"boolean",
"isNeedResultMsg",
")",
"{",
"return",
"execCommand",
"(",
"commands",
"==",
"null",
"?",
"null",
":",
"commands",
".",
... | execute shell commands
@param commands command list
@param isRoot whether need to run with root
@param isNeedResultMsg whether need result msg
@return
@see ShellUtils#execCommand(String[], boolean, boolean) | [
"execute",
"shell",
"commands"
] | train | https://github.com/lisicnu/droidUtil/blob/e4d6cf3e3f60e5efb5a75672607ded94d1725519/src/main/java/com/github/lisicnu/libDroid/util/ShellUtils.java#L94-L96 |
jtrfp/javamod | src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java | MP3FileID3Controller.setTextFrame | public void setTextFrame(String id, String data)
{
if (allow(ID3V2))
{
id3v2.setTextFrame(id, data);
}
} | java | public void setTextFrame(String id, String data)
{
if (allow(ID3V2))
{
id3v2.setTextFrame(id, data);
}
} | [
"public",
"void",
"setTextFrame",
"(",
"String",
"id",
",",
"String",
"data",
")",
"{",
"if",
"(",
"allow",
"(",
"ID3V2",
")",
")",
"{",
"id3v2",
".",
"setTextFrame",
"(",
"id",
",",
"data",
")",
";",
"}",
"}"
] | Set the text of the text frame specified by the id (id3v2 only). The
id should be one of the static strings specifed in ID3v2Frames class.
All id's that begin with 'T' (excluding "TXXX") are considered text
frames.
@param id the id of the frame to set the data for
@param data the data to set | [
"Set",
"the",
"text",
"of",
"the",
"text",
"frame",
"specified",
"by",
"the",
"id",
"(",
"id3v2",
"only",
")",
".",
"The",
"id",
"should",
"be",
"one",
"of",
"the",
"static",
"strings",
"specifed",
"in",
"ID3v2Frames",
"class",
".",
"All",
"id",
"s",
... | train | https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L364-L370 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/interest/FactoryDetectPoint.java | FactoryDetectPoint.createShiTomasi | public static <T extends ImageGray<T>, D extends ImageGray<D>>
GeneralFeatureDetector<T, D> createShiTomasi( @Nullable ConfigGeneralDetector configDetector,
@Nullable ConfigShiTomasi configCorner,
Class<D> derivType) {
if( configDetector == null)
configDetector = new ConfigGeneralDetector();
if( configCorner == null ) {
configCorner = new ConfigShiTomasi();
configCorner.radius = configDetector.radius;
}
GradientCornerIntensity<D> cornerIntensity =
FactoryIntensityPointAlg.shiTomasi(configCorner.radius, configCorner.weighted, derivType);
return createGeneral(cornerIntensity, configDetector);
} | java | public static <T extends ImageGray<T>, D extends ImageGray<D>>
GeneralFeatureDetector<T, D> createShiTomasi( @Nullable ConfigGeneralDetector configDetector,
@Nullable ConfigShiTomasi configCorner,
Class<D> derivType) {
if( configDetector == null)
configDetector = new ConfigGeneralDetector();
if( configCorner == null ) {
configCorner = new ConfigShiTomasi();
configCorner.radius = configDetector.radius;
}
GradientCornerIntensity<D> cornerIntensity =
FactoryIntensityPointAlg.shiTomasi(configCorner.radius, configCorner.weighted, derivType);
return createGeneral(cornerIntensity, configDetector);
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageGray",
"<",
"T",
">",
",",
"D",
"extends",
"ImageGray",
"<",
"D",
">",
">",
"GeneralFeatureDetector",
"<",
"T",
",",
"D",
">",
"createShiTomasi",
"(",
"@",
"Nullable",
"ConfigGeneralDetector",
"configDetector",
... | Detects Shi-Tomasi corners.
@param configDetector Configuration for feature extractor.
@param configCorner Configuration for corner intensity computation. If null radius will match detector radius
@param derivType Type of derivative image.
@see boofcv.alg.feature.detect.intensity.ShiTomasiCornerIntensity | [
"Detects",
"Shi",
"-",
"Tomasi",
"corners",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/factory/feature/detect/interest/FactoryDetectPoint.java#L86-L101 |
lucastheisen/jsch-extension | src/main/java/com/pastdev/jsch/DefaultSessionFactory.java | DefaultSessionFactory.setConfig | public void setConfig( String key, String value ) {
if ( config == null ) {
config = new HashMap<String, String>();
}
config.put( key, value );
} | java | public void setConfig( String key, String value ) {
if ( config == null ) {
config = new HashMap<String, String>();
}
config.put( key, value );
} | [
"public",
"void",
"setConfig",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"config",
"==",
"null",
")",
"{",
"config",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"}",
"config",
".",
"put",
"(",
... | Adds a single configuration options for the sessions created by this
factory. Details on the supported options can be found in the source for
{@link com.jcraft.jsch.Session#applyConfig()}.
@param key
The name of the option
@param value
The value of the option
@see #setConfig(Map)
@see com.jcraft.jsch.Session#setConfig(java.util.Hashtable)
@see com.jcraft.jsch.Session#applyConfig() | [
"Adds",
"a",
"single",
"configuration",
"options",
"for",
"the",
"sessions",
"created",
"by",
"this",
"factory",
".",
"Details",
"on",
"the",
"supported",
"options",
"can",
"be",
"found",
"in",
"the",
"source",
"for",
"{",
"@link",
"com",
".",
"jcraft",
".... | train | https://github.com/lucastheisen/jsch-extension/blob/3c5bfae84d63e8632828a10721f2e605b68d749a/src/main/java/com/pastdev/jsch/DefaultSessionFactory.java#L245-L250 |
nostra13/Android-Universal-Image-Loader | library/src/main/java/com/nostra13/universalimageloader/core/download/BaseImageDownloader.java | BaseImageDownloader.getStreamFromNetwork | protected InputStream getStreamFromNetwork(String imageUri, Object extra) throws IOException {
HttpURLConnection conn = createConnection(imageUri, extra);
int redirectCount = 0;
while (conn.getResponseCode() / 100 == 3 && redirectCount < MAX_REDIRECT_COUNT) {
conn = createConnection(conn.getHeaderField("Location"), extra);
redirectCount++;
}
InputStream imageStream;
try {
imageStream = conn.getInputStream();
} catch (IOException e) {
// Read all data to allow reuse connection (http://bit.ly/1ad35PY)
IoUtils.readAndCloseStream(conn.getErrorStream());
throw e;
}
if (!shouldBeProcessed(conn)) {
IoUtils.closeSilently(imageStream);
throw new IOException("Image request failed with response code " + conn.getResponseCode());
}
return new ContentLengthInputStream(new BufferedInputStream(imageStream, BUFFER_SIZE), conn.getContentLength());
} | java | protected InputStream getStreamFromNetwork(String imageUri, Object extra) throws IOException {
HttpURLConnection conn = createConnection(imageUri, extra);
int redirectCount = 0;
while (conn.getResponseCode() / 100 == 3 && redirectCount < MAX_REDIRECT_COUNT) {
conn = createConnection(conn.getHeaderField("Location"), extra);
redirectCount++;
}
InputStream imageStream;
try {
imageStream = conn.getInputStream();
} catch (IOException e) {
// Read all data to allow reuse connection (http://bit.ly/1ad35PY)
IoUtils.readAndCloseStream(conn.getErrorStream());
throw e;
}
if (!shouldBeProcessed(conn)) {
IoUtils.closeSilently(imageStream);
throw new IOException("Image request failed with response code " + conn.getResponseCode());
}
return new ContentLengthInputStream(new BufferedInputStream(imageStream, BUFFER_SIZE), conn.getContentLength());
} | [
"protected",
"InputStream",
"getStreamFromNetwork",
"(",
"String",
"imageUri",
",",
"Object",
"extra",
")",
"throws",
"IOException",
"{",
"HttpURLConnection",
"conn",
"=",
"createConnection",
"(",
"imageUri",
",",
"extra",
")",
";",
"int",
"redirectCount",
"=",
"0... | Retrieves {@link InputStream} of image by URI (image is located in the network).
@param imageUri Image URI
@param extra Auxiliary object which was passed to {@link DisplayImageOptions.Builder#extraForDownloader(Object)
DisplayImageOptions.extraForDownloader(Object)}; can be null
@return {@link InputStream} of image
@throws IOException if some I/O error occurs during network request or if no InputStream could be created for
URL. | [
"Retrieves",
"{",
"@link",
"InputStream",
"}",
"of",
"image",
"by",
"URI",
"(",
"image",
"is",
"located",
"in",
"the",
"network",
")",
"."
] | train | https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/download/BaseImageDownloader.java#L113-L136 |
randomizedtesting/randomizedtesting | junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/ForkedJvmInfo.java | ForkedJvmInfo.decodeStreams | public void decodeStreams(List<IEvent> events, Writer sysout, Writer syserr) throws IOException {
int lineBuffer = 160;
WriterOutputStream stdout = new WriterOutputStream(sysout, getCharset(), lineBuffer, true);
WriterOutputStream stderr = new WriterOutputStream(syserr, getCharset(), lineBuffer, true);
for (IEvent evt : events) {
switch (evt.getType()) {
case APPEND_STDOUT:
if (sysout != null) {
((IStreamEvent) evt).copyTo(stdout);
}
break;
case APPEND_STDERR:
if (syserr != null) {
((IStreamEvent) evt).copyTo(stderr);
}
break;
default:
break;
}
}
stdout.flush();
stderr.flush();
} | java | public void decodeStreams(List<IEvent> events, Writer sysout, Writer syserr) throws IOException {
int lineBuffer = 160;
WriterOutputStream stdout = new WriterOutputStream(sysout, getCharset(), lineBuffer, true);
WriterOutputStream stderr = new WriterOutputStream(syserr, getCharset(), lineBuffer, true);
for (IEvent evt : events) {
switch (evt.getType()) {
case APPEND_STDOUT:
if (sysout != null) {
((IStreamEvent) evt).copyTo(stdout);
}
break;
case APPEND_STDERR:
if (syserr != null) {
((IStreamEvent) evt).copyTo(stderr);
}
break;
default:
break;
}
}
stdout.flush();
stderr.flush();
} | [
"public",
"void",
"decodeStreams",
"(",
"List",
"<",
"IEvent",
">",
"events",
",",
"Writer",
"sysout",
",",
"Writer",
"syserr",
")",
"throws",
"IOException",
"{",
"int",
"lineBuffer",
"=",
"160",
";",
"WriterOutputStream",
"stdout",
"=",
"new",
"WriterOutputSt... | Filter through events looking for sysouts and syserrs and decode them
into a character streams. If both {@link Writer} arguments are the same object
the streams will be combined. | [
"Filter",
"through",
"events",
"looking",
"for",
"sysouts",
"and",
"syserrs",
"and",
"decode",
"them",
"into",
"a",
"character",
"streams",
".",
"If",
"both",
"{"
] | train | https://github.com/randomizedtesting/randomizedtesting/blob/85a0c7eff5d03d98da4d1f9502a11af74d26478a/junit4-ant/src/main/java/com/carrotsearch/ant/tasks/junit4/ForkedJvmInfo.java#L131-L156 |
Mangopay/mangopay2-java-sdk | src/main/java/com/mangopay/core/APIs/ApiBase.java | ApiBase.getObject | protected <T extends Dto> T getObject(Class<T> classOfT, String methodKey, String entityId, String secondEntityId) throws Exception {
String urlMethod = String.format(this.getRequestUrl(methodKey), entityId, secondEntityId);
RestTool rest = new RestTool(this.root, true);
T response = rest.request(classOfT, null, urlMethod, this.getRequestType(methodKey));
return response;
} | java | protected <T extends Dto> T getObject(Class<T> classOfT, String methodKey, String entityId, String secondEntityId) throws Exception {
String urlMethod = String.format(this.getRequestUrl(methodKey), entityId, secondEntityId);
RestTool rest = new RestTool(this.root, true);
T response = rest.request(classOfT, null, urlMethod, this.getRequestType(methodKey));
return response;
} | [
"protected",
"<",
"T",
"extends",
"Dto",
">",
"T",
"getObject",
"(",
"Class",
"<",
"T",
">",
"classOfT",
",",
"String",
"methodKey",
",",
"String",
"entityId",
",",
"String",
"secondEntityId",
")",
"throws",
"Exception",
"{",
"String",
"urlMethod",
"=",
"S... | Gets the Dto instance from API.
@param <T> Type on behalf of which the request is being called.
@param classOfT Type on behalf of which the request is being called.
@param methodKey Relevant method key.
@param entityId Entity identifier.
@param secondEntityId Entity identifier for the second entity.
@return The Dto instance returned from API.
@throws Exception | [
"Gets",
"the",
"Dto",
"instance",
"from",
"API",
"."
] | train | https://github.com/Mangopay/mangopay2-java-sdk/blob/037cecb44ea62def63b507817fd9961649151157/src/main/java/com/mangopay/core/APIs/ApiBase.java#L287-L295 |
lionsoul2014/jcseg | jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/DictionaryFactory.java | DictionaryFactory.createDefaultDictionary | public static ADictionary createDefaultDictionary(JcsegTaskConfig config, boolean loadDic)
{
return createDefaultDictionary(config, config.isAutoload(), loadDic);
} | java | public static ADictionary createDefaultDictionary(JcsegTaskConfig config, boolean loadDic)
{
return createDefaultDictionary(config, config.isAutoload(), loadDic);
} | [
"public",
"static",
"ADictionary",
"createDefaultDictionary",
"(",
"JcsegTaskConfig",
"config",
",",
"boolean",
"loadDic",
")",
"{",
"return",
"createDefaultDictionary",
"(",
"config",
",",
"config",
".",
"isAutoload",
"(",
")",
",",
"loadDic",
")",
";",
"}"
] | create the ADictionary according to the JcsegTaskConfig
@param config
@param loadDic
@return ADictionary | [
"create",
"the",
"ADictionary",
"according",
"to",
"the",
"JcsegTaskConfig"
] | train | https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/core/DictionaryFactory.java#L123-L126 |
mangstadt/biweekly | src/main/java/biweekly/component/ICalComponent.java | ICalComponent.setExperimentalProperty | public RawProperty setExperimentalProperty(String name, ICalDataType dataType, String value) {
removeExperimentalProperties(name);
return addExperimentalProperty(name, dataType, value);
} | java | public RawProperty setExperimentalProperty(String name, ICalDataType dataType, String value) {
removeExperimentalProperties(name);
return addExperimentalProperty(name, dataType, value);
} | [
"public",
"RawProperty",
"setExperimentalProperty",
"(",
"String",
"name",
",",
"ICalDataType",
"dataType",
",",
"String",
"value",
")",
"{",
"removeExperimentalProperties",
"(",
"name",
")",
";",
"return",
"addExperimentalProperty",
"(",
"name",
",",
"dataType",
",... | Adds an experimental property to this component, removing all existing
properties that have the same name.
@param name the property name (e.g. "X-ALT-DESC")
@param dataType the property's data type or null if unknown
@param value the property value
@return the property object that was created | [
"Adds",
"an",
"experimental",
"property",
"to",
"this",
"component",
"removing",
"all",
"existing",
"properties",
"that",
"have",
"the",
"same",
"name",
"."
] | train | https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/ICalComponent.java#L266-L269 |
google/closure-compiler | src/com/google/javascript/jscomp/FunctionTypeBuilder.java | FunctionTypeBuilder.inferConstructorParameters | FunctionTypeBuilder inferConstructorParameters(Node argsParent, @Nullable JSDocInfo info) {
// Look for template parameters in 'info': these will be added to anything from the class.
if (info != null) {
setConstructorTemplateTypeNames(
buildTemplateTypesFromJSDocInfo(info, true), argsParent.getParent());
}
inferParameterTypes(argsParent, info);
return this;
} | java | FunctionTypeBuilder inferConstructorParameters(Node argsParent, @Nullable JSDocInfo info) {
// Look for template parameters in 'info': these will be added to anything from the class.
if (info != null) {
setConstructorTemplateTypeNames(
buildTemplateTypesFromJSDocInfo(info, true), argsParent.getParent());
}
inferParameterTypes(argsParent, info);
return this;
} | [
"FunctionTypeBuilder",
"inferConstructorParameters",
"(",
"Node",
"argsParent",
",",
"@",
"Nullable",
"JSDocInfo",
"info",
")",
"{",
"// Look for template parameters in 'info': these will be added to anything from the class.",
"if",
"(",
"info",
"!=",
"null",
")",
"{",
"setCo... | Infer parameters from the params list and info. Also maybe add extra templates. | [
"Infer",
"parameters",
"from",
"the",
"params",
"list",
"and",
"info",
".",
"Also",
"maybe",
"add",
"extra",
"templates",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/FunctionTypeBuilder.java#L681-L691 |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.makeAbsolute | @Pure
public static URL makeAbsolute(File filename, URL current) {
if (filename != null) {
if (!filename.isAbsolute() && current != null) {
return join(current, filename);
}
try {
return new URL(URISchemeType.FILE.toString() + fromFileStandardToURLStandard(filename.getAbsolutePath()));
} catch (MalformedURLException exception) {
// ignore error
}
}
return null;
} | java | @Pure
public static URL makeAbsolute(File filename, URL current) {
if (filename != null) {
if (!filename.isAbsolute() && current != null) {
return join(current, filename);
}
try {
return new URL(URISchemeType.FILE.toString() + fromFileStandardToURLStandard(filename.getAbsolutePath()));
} catch (MalformedURLException exception) {
// ignore error
}
}
return null;
} | [
"@",
"Pure",
"public",
"static",
"URL",
"makeAbsolute",
"(",
"File",
"filename",
",",
"URL",
"current",
")",
"{",
"if",
"(",
"filename",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"filename",
".",
"isAbsolute",
"(",
")",
"&&",
"current",
"!=",
"null",
"... | Make the given filename absolute from the given root if it is not already absolute.
<table border="1" width="100%" summary="Cases">
<thead>
<tr>
<td>{@code filename}</td><td>{@code current}</td><td>Result</td>
</tr>
</thead>
<tr>
<td><code>null</code></td>
<td><code>null</code></td>
<td><code>null</code></td>
</tr>
<tr>
<td><code>null</code></td>
<td><code>file:/myroot</code></td>
<td><code>null</code></td>
</tr>
<tr>
<td><code>null</code></td>
<td><code>http://host.com/myroot</code></td>
<td><code>null</code></td>
</tr>
<tr>
<td><code>path/to/file</code></td>
<td><code>null</code></td>
<td><code>file:path/to/file</code></td>
</tr>
<tr>
<td><code>path/to/file</code></td>
<td><code>file:/myroot</code></td>
<td><code>file:/myroot/path/to/file</code></td>
</tr>
<tr>
<td><code>path/to/file</code></td>
<td><code>http://host.com/myroot</code></td>
<td><code>http://host.com/myroot/path/to/file</code></td>
</tr>
<tr>
<td><code>/path/to/file</code></td>
<td><code>null</code></td>
<td><code>file:/path/to/file</code></td>
</tr>
<tr>
<td><code>/path/to/file</code></td>
<td><code>file:/myroot</code></td>
<td><code>file:/path/to/file</code></td>
</tr>
<tr>
<td><code>/path/to/file</code></td>
<td><code>http://host.com/myroot</code></td>
<td><code>file:/path/to/file</code></td>
</tr>
</table>
@param filename is the name to make absolute.
@param current is the current directory which permits to make absolute.
@return an absolute filename.
@since 5.0 | [
"Make",
"the",
"given",
"filename",
"absolute",
"from",
"the",
"given",
"root",
"if",
"it",
"is",
"not",
"already",
"absolute",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L2447-L2460 |
CloudSlang/cs-actions | cs-json/src/main/java/io/cloudslang/content/json/actions/ArraySize.java | ArraySize.execute | @Action(name = "Array Size",
outputs = {
@Output(OutputNames.RETURN_RESULT),
@Output(OutputNames.RETURN_CODE),
@Output(OutputNames.EXCEPTION)
},
responses = {
@Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
@Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
})
public Map<String, String> execute(@Param(value = Constants.InputNames.ARRAY, required = true) String array) {
Map<String, String> returnResult = new HashMap<>();
if (StringUtilities.isBlank(array)) {
return populateResult(returnResult, new Exception(NOT_A_VALID_JSON_ARRAY_MESSAGE));
}
JsonNode jsonNode;
try {
ObjectMapper mapper = new ObjectMapper();
jsonNode = mapper.readTree(array);
} catch (IOException exception) {
final String value = "Invalid jsonObject provided! " + exception.getMessage();
return populateResult(returnResult, value, exception);
}
final String result;
if (jsonNode instanceof ArrayNode) {
final ArrayNode asJsonArray = (ArrayNode) jsonNode;
result = Integer.toString(asJsonArray.size());
} else {
return populateResult(returnResult, new Exception(NOT_A_VALID_JSON_ARRAY_MESSAGE));
}
return populateResult(returnResult, result, null);
} | java | @Action(name = "Array Size",
outputs = {
@Output(OutputNames.RETURN_RESULT),
@Output(OutputNames.RETURN_CODE),
@Output(OutputNames.EXCEPTION)
},
responses = {
@Response(text = ResponseNames.SUCCESS, field = OutputNames.RETURN_CODE, value = ReturnCodes.SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
@Response(text = ResponseNames.FAILURE, field = OutputNames.RETURN_CODE, value = ReturnCodes.FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
})
public Map<String, String> execute(@Param(value = Constants.InputNames.ARRAY, required = true) String array) {
Map<String, String> returnResult = new HashMap<>();
if (StringUtilities.isBlank(array)) {
return populateResult(returnResult, new Exception(NOT_A_VALID_JSON_ARRAY_MESSAGE));
}
JsonNode jsonNode;
try {
ObjectMapper mapper = new ObjectMapper();
jsonNode = mapper.readTree(array);
} catch (IOException exception) {
final String value = "Invalid jsonObject provided! " + exception.getMessage();
return populateResult(returnResult, value, exception);
}
final String result;
if (jsonNode instanceof ArrayNode) {
final ArrayNode asJsonArray = (ArrayNode) jsonNode;
result = Integer.toString(asJsonArray.size());
} else {
return populateResult(returnResult, new Exception(NOT_A_VALID_JSON_ARRAY_MESSAGE));
}
return populateResult(returnResult, result, null);
} | [
"@",
"Action",
"(",
"name",
"=",
"\"Array Size\"",
",",
"outputs",
"=",
"{",
"@",
"Output",
"(",
"OutputNames",
".",
"RETURN_RESULT",
")",
",",
"@",
"Output",
"(",
"OutputNames",
".",
"RETURN_CODE",
")",
",",
"@",
"Output",
"(",
"OutputNames",
".",
"EXCE... | This operation determines the number of elements in the given JSON array. If an element
is itself another JSON array, it only counts as 1 element; in other
words, it will not expand and count embedded arrays. Null values are also
considered to be an element.
@param array The string representation of a JSON array object.
@return a map containing the output of the operation. Keys present in the map are:
<p/>
<br><br><b>returnResult</b> - This will contain size of the json array given in the input.
<br><b>exception</b> - In case of success response, this result is empty. In case of failure response,
this result contains the java stack trace of the runtime exception.
<br><br><b>returnCode</b> - The returnCode of the operation: 0 for success, -1 for failure. | [
"This",
"operation",
"determines",
"the",
"number",
"of",
"elements",
"in",
"the",
"given",
"JSON",
"array",
".",
"If",
"an",
"element",
"is",
"itself",
"another",
"JSON",
"array",
"it",
"only",
"counts",
"as",
"1",
"element",
";",
"in",
"other",
"words",
... | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-json/src/main/java/io/cloudslang/content/json/actions/ArraySize.java#L63-L96 |
radkovo/jStyleParser | src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java | CSSErrorStrategy.consumeUntilGreedy | public void consumeUntilGreedy(Parser recognizer, IntervalSet follow, CSSLexerState.RecoveryMode mode, CSSLexerState ls) {
consumeUntil(recognizer, follow, mode, ls);
recognizer.getInputStream().consume();
} | java | public void consumeUntilGreedy(Parser recognizer, IntervalSet follow, CSSLexerState.RecoveryMode mode, CSSLexerState ls) {
consumeUntil(recognizer, follow, mode, ls);
recognizer.getInputStream().consume();
} | [
"public",
"void",
"consumeUntilGreedy",
"(",
"Parser",
"recognizer",
",",
"IntervalSet",
"follow",
",",
"CSSLexerState",
".",
"RecoveryMode",
"mode",
",",
"CSSLexerState",
"ls",
")",
"{",
"consumeUntil",
"(",
"recognizer",
",",
"follow",
",",
"mode",
",",
"ls",
... | Consumes token until lexer state is function-balanced and
token from follow is matched. Matched token is also consumed. | [
"Consumes",
"token",
"until",
"lexer",
"state",
"is",
"function",
"-",
"balanced",
"and",
"token",
"from",
"follow",
"is",
"matched",
".",
"Matched",
"token",
"is",
"also",
"consumed",
"."
] | train | https://github.com/radkovo/jStyleParser/blob/8ab049ac6866aa52c4d7deee25c9e294e7191957/src/main/java/cz/vutbr/web/csskit/antlr4/CSSErrorStrategy.java#L95-L98 |
Netflix/servo | servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java | Monitors.newTimer | public static Timer newTimer(String name, TimeUnit unit, TaggingContext context) {
final MonitorConfig config = MonitorConfig.builder(name).build();
return new ContextualTimer(config, context, new TimerFactory(unit));
} | java | public static Timer newTimer(String name, TimeUnit unit, TaggingContext context) {
final MonitorConfig config = MonitorConfig.builder(name).build();
return new ContextualTimer(config, context, new TimerFactory(unit));
} | [
"public",
"static",
"Timer",
"newTimer",
"(",
"String",
"name",
",",
"TimeUnit",
"unit",
",",
"TaggingContext",
"context",
")",
"{",
"final",
"MonitorConfig",
"config",
"=",
"MonitorConfig",
".",
"builder",
"(",
"name",
")",
".",
"build",
"(",
")",
";",
"r... | Create a new timer with a name and context. The returned timer will maintain separate
sub-monitors for each distinct set of tags returned from the context on an update operation. | [
"Create",
"a",
"new",
"timer",
"with",
"a",
"name",
"and",
"context",
".",
"The",
"returned",
"timer",
"will",
"maintain",
"separate",
"sub",
"-",
"monitors",
"for",
"each",
"distinct",
"set",
"of",
"tags",
"returned",
"from",
"the",
"context",
"on",
"an",... | train | https://github.com/Netflix/servo/blob/d67b5afce8c50bd9e9e31c288dbf4b78fb2ac815/servo-core/src/main/java/com/netflix/servo/monitor/Monitors.java#L105-L108 |
baidubce/bce-sdk-java | src/main/java/com/baidubce/services/lss/LssClient.java | LssClient.queryApp | public GetAppResponse queryApp(GetAppRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getApp(), "The parameter app should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_APP,
request.getApp());
return invokeHttpClient(internalRequest, GetAppResponse.class);
} | java | public GetAppResponse queryApp(GetAppRequest request) {
checkNotNull(request, "The parameter request should NOT be null.");
checkStringNotEmpty(request.getApp(), "The parameter app should NOT be null or empty string.");
InternalRequest internalRequest = createRequest(HttpMethodName.GET, request, LIVE_APP,
request.getApp());
return invokeHttpClient(internalRequest, GetAppResponse.class);
} | [
"public",
"GetAppResponse",
"queryApp",
"(",
"GetAppRequest",
"request",
")",
"{",
"checkNotNull",
"(",
"request",
",",
"\"The parameter request should NOT be null.\"",
")",
";",
"checkStringNotEmpty",
"(",
"request",
".",
"getApp",
"(",
")",
",",
"\"The parameter app s... | get detail of your app by name
@param request The request object containing all parameters for querying app.
@return the response | [
"get",
"detail",
"of",
"your",
"app",
"by",
"name"
] | train | https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L798-L804 |
jsurfer/JsonSurfer | jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java | JsonSurfer.collectOne | @Deprecated
public Object collectOne(Reader reader, String... paths) {
return collectOne(reader, compile(paths));
} | java | @Deprecated
public Object collectOne(Reader reader, String... paths) {
return collectOne(reader, compile(paths));
} | [
"@",
"Deprecated",
"public",
"Object",
"collectOne",
"(",
"Reader",
"reader",
",",
"String",
"...",
"paths",
")",
"{",
"return",
"collectOne",
"(",
"reader",
",",
"compile",
"(",
"paths",
")",
")",
";",
"}"
] | Collect the first matched value and stop parsing immediately
@param reader Json reader
@param paths JsonPath
@return Value
@deprecated use {@link #collectOne(InputStream, String...)} instead | [
"Collect",
"the",
"first",
"matched",
"value",
"and",
"stop",
"parsing",
"immediately"
] | train | https://github.com/jsurfer/JsonSurfer/blob/52bd75a453338b86e115092803da140bf99cee62/jsurfer-core/src/main/java/org/jsfr/json/JsonSurfer.java#L429-L432 |
httl/httl | httl/src/main/java/httl/spi/codecs/json/JSONObject.java | JSONObject.getLong | public long getLong(String key, long def) {
Object tmp = objectMap.get(key);
return tmp != null && tmp instanceof Number ? ((Number) tmp)
.longValue() : def;
} | java | public long getLong(String key, long def) {
Object tmp = objectMap.get(key);
return tmp != null && tmp instanceof Number ? ((Number) tmp)
.longValue() : def;
} | [
"public",
"long",
"getLong",
"(",
"String",
"key",
",",
"long",
"def",
")",
"{",
"Object",
"tmp",
"=",
"objectMap",
".",
"get",
"(",
"key",
")",
";",
"return",
"tmp",
"!=",
"null",
"&&",
"tmp",
"instanceof",
"Number",
"?",
"(",
"(",
"Number",
")",
... | get long value.
@param key key.
@param def default value.
@return value or default value. | [
"get",
"long",
"value",
"."
] | train | https://github.com/httl/httl/blob/e13e00f4ab41252a8f53d6dafd4a6610be9dcaad/httl/src/main/java/httl/spi/codecs/json/JSONObject.java#L76-L80 |
leancloud/java-sdk-all | android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/sns/GetMsgSendIntentApi.java | GetMsgSendIntentApi.getMsgSendIntent | public void getMsgSendIntent(SnsMsg msg, boolean needResult, GetMsgSendIntentHandler handler){
HMSAgentLog.i("getMsgSendIntent:msg=" + StrUtils.objDesc(msg) + " needResult=" + needResult + " handler=" + StrUtils.objDesc(handler));
this.msg = msg;
this.needResult = needResult;
this.handler = handler;
retryTimes = MAX_RETRY_TIMES;
connect();
} | java | public void getMsgSendIntent(SnsMsg msg, boolean needResult, GetMsgSendIntentHandler handler){
HMSAgentLog.i("getMsgSendIntent:msg=" + StrUtils.objDesc(msg) + " needResult=" + needResult + " handler=" + StrUtils.objDesc(handler));
this.msg = msg;
this.needResult = needResult;
this.handler = handler;
retryTimes = MAX_RETRY_TIMES;
connect();
} | [
"public",
"void",
"getMsgSendIntent",
"(",
"SnsMsg",
"msg",
",",
"boolean",
"needResult",
",",
"GetMsgSendIntentHandler",
"handler",
")",
"{",
"HMSAgentLog",
".",
"i",
"(",
"\"getMsgSendIntent:msg=\"",
"+",
"StrUtils",
".",
"objDesc",
"(",
"msg",
")",
"+",
"\" ... | 获取发送社交消息的intent
@param msg 要发送的消息体
@param needResult 在社交界面发送完图文消息是否自动跳转回调用者应用界面
True:发完消息自动跳转回调用者界面
False:发完消息停留在社交界面
@param handler 结果回调 | [
"获取发送社交消息的intent"
] | train | https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/sns/GetMsgSendIntentApi.java#L119-L126 |
deeplearning4j/deeplearning4j | nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/CounterMap.java | CounterMap.incrementCount | public void incrementCount(F first, S second, double inc) {
Counter<S> counter = maps.get(first);
if (counter == null) {
counter = new Counter<S>();
maps.put(first, counter);
}
counter.incrementCount(second, inc);
} | java | public void incrementCount(F first, S second, double inc) {
Counter<S> counter = maps.get(first);
if (counter == null) {
counter = new Counter<S>();
maps.put(first, counter);
}
counter.incrementCount(second, inc);
} | [
"public",
"void",
"incrementCount",
"(",
"F",
"first",
",",
"S",
"second",
",",
"double",
"inc",
")",
"{",
"Counter",
"<",
"S",
">",
"counter",
"=",
"maps",
".",
"get",
"(",
"first",
")",
";",
"if",
"(",
"counter",
"==",
"null",
")",
"{",
"counter"... | This method will increment counts for a given first/second pair
@param first
@param second
@param inc | [
"This",
"method",
"will",
"increment",
"counts",
"for",
"a",
"given",
"first",
"/",
"second",
"pair"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/linalg/primitives/CounterMap.java#L90-L98 |
salesforce/Argus | ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java | UserResources.getUserById | @GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/id/{userId}")
@Description("Returns the user having the given ID.")
public PrincipalUserDto getUserById(@Context HttpServletRequest req,
@PathParam("userId") final BigInteger userId) {
if (userId == null || userId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("User Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
PrincipalUser remoteUser = validateAndGetOwner(req, null);
PrincipalUser user = _uService.findUserByPrimaryKey(userId);
if (user != null) {
super.validateResourceAuthorization(req, user, remoteUser);
return PrincipalUserDto.transformToDto(user);
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} | java | @GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/id/{userId}")
@Description("Returns the user having the given ID.")
public PrincipalUserDto getUserById(@Context HttpServletRequest req,
@PathParam("userId") final BigInteger userId) {
if (userId == null || userId.compareTo(BigInteger.ZERO) < 1) {
throw new WebApplicationException("User Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
}
PrincipalUser remoteUser = validateAndGetOwner(req, null);
PrincipalUser user = _uService.findUserByPrimaryKey(userId);
if (user != null) {
super.validateResourceAuthorization(req, user, remoteUser);
return PrincipalUserDto.transformToDto(user);
}
throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
} | [
"@",
"GET",
"@",
"Produces",
"(",
"MediaType",
".",
"APPLICATION_JSON",
")",
"@",
"Path",
"(",
"\"/id/{userId}\"",
")",
"@",
"Description",
"(",
"\"Returns the user having the given ID.\"",
")",
"public",
"PrincipalUserDto",
"getUserById",
"(",
"@",
"Context",
"Http... | Returns the user having the given ID.
@param req The HTTP request.
@param userId The user ID to retrieve
@return The corresponding user DTO.
@throws WebApplicationException If an error occurs. | [
"Returns",
"the",
"user",
"having",
"the",
"given",
"ID",
"."
] | train | https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusWebServices/src/main/java/com/salesforce/dva/argus/ws/resources/UserResources.java#L106-L124 |
belaban/JGroups | src/org/jgroups/protocols/pbcast/FLUSH.java | FLUSH.onSuspend | private void onSuspend(final List<Address> members) {
Message msg = null;
Collection<Address> participantsInFlush = null;
synchronized (sharedLock) {
flushCoordinator = localAddress;
// start FLUSH only on group members that we need to flush
participantsInFlush = members;
participantsInFlush.retainAll(currentView.getMembers());
flushMembers.clear();
flushMembers.addAll(participantsInFlush);
flushMembers.removeAll(suspected);
msg = new Message(null).src(localAddress).setBuffer(marshal(participantsInFlush, null))
.putHeader(this.id, new FlushHeader(FlushHeader.START_FLUSH, currentViewId()));
}
if (participantsInFlush.isEmpty()) {
flush_promise.setResult(SUCCESS_START_FLUSH);
} else {
down_prot.down(msg);
if (log.isDebugEnabled())
log.debug(localAddress + ": flush coordinator "
+ " is starting FLUSH with participants " + participantsInFlush);
}
} | java | private void onSuspend(final List<Address> members) {
Message msg = null;
Collection<Address> participantsInFlush = null;
synchronized (sharedLock) {
flushCoordinator = localAddress;
// start FLUSH only on group members that we need to flush
participantsInFlush = members;
participantsInFlush.retainAll(currentView.getMembers());
flushMembers.clear();
flushMembers.addAll(participantsInFlush);
flushMembers.removeAll(suspected);
msg = new Message(null).src(localAddress).setBuffer(marshal(participantsInFlush, null))
.putHeader(this.id, new FlushHeader(FlushHeader.START_FLUSH, currentViewId()));
}
if (participantsInFlush.isEmpty()) {
flush_promise.setResult(SUCCESS_START_FLUSH);
} else {
down_prot.down(msg);
if (log.isDebugEnabled())
log.debug(localAddress + ": flush coordinator "
+ " is starting FLUSH with participants " + participantsInFlush);
}
} | [
"private",
"void",
"onSuspend",
"(",
"final",
"List",
"<",
"Address",
">",
"members",
")",
"{",
"Message",
"msg",
"=",
"null",
";",
"Collection",
"<",
"Address",
">",
"participantsInFlush",
"=",
"null",
";",
"synchronized",
"(",
"sharedLock",
")",
"{",
"fl... | Starts the flush protocol
@param members List of participants in the flush protocol. Guaranteed to be non-null | [
"Starts",
"the",
"flush",
"protocol"
] | train | https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/protocols/pbcast/FLUSH.java#L688-L713 |
zaproxy/zaproxy | src/org/parosproxy/paros/view/WorkbenchPanel.java | WorkbenchPanel.removePanel | public void removePanel(AbstractPanel panel, PanelType panelType) {
validateNotNull(panel, "panel");
validateNotNull(panelType, "panelType");
removeTabPanel(getTabbedFull(), panel);
getTabbedFull().revalidate();
switch (panelType) {
case SELECT:
removeTabPanel(getTabbedSelect(), panel);
getTabbedSelect().revalidate();
break;
case STATUS:
removeTabPanel(getTabbedStatus(), panel);
getTabbedStatus().revalidate();
break;
case WORK:
removeTabPanel(getTabbedWork(), panel);
getTabbedWork().revalidate();
break;
default:
break;
}
} | java | public void removePanel(AbstractPanel panel, PanelType panelType) {
validateNotNull(panel, "panel");
validateNotNull(panelType, "panelType");
removeTabPanel(getTabbedFull(), panel);
getTabbedFull().revalidate();
switch (panelType) {
case SELECT:
removeTabPanel(getTabbedSelect(), panel);
getTabbedSelect().revalidate();
break;
case STATUS:
removeTabPanel(getTabbedStatus(), panel);
getTabbedStatus().revalidate();
break;
case WORK:
removeTabPanel(getTabbedWork(), panel);
getTabbedWork().revalidate();
break;
default:
break;
}
} | [
"public",
"void",
"removePanel",
"(",
"AbstractPanel",
"panel",
",",
"PanelType",
"panelType",
")",
"{",
"validateNotNull",
"(",
"panel",
",",
"\"panel\"",
")",
";",
"validateNotNull",
"(",
"panelType",
",",
"\"panelType\"",
")",
";",
"removeTabPanel",
"(",
"get... | Removes the given panel of given panel type from the workbench panel.
@param panel the panel to remove from the workbench panel
@param panelType the type of the panel
@throws IllegalArgumentException if any of the parameters is {@code null}.
@since 2.5.0
@see #addPanel(AbstractPanel, PanelType)
@see #removePanels(List, PanelType) | [
"Removes",
"the",
"given",
"panel",
"of",
"given",
"panel",
"type",
"from",
"the",
"workbench",
"panel",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L1006-L1029 |
looly/hulu | src/main/java/com/xiaoleilu/hulu/ActionHandler.java | ActionHandler.handle | public final boolean handle(HttpServletRequest req, HttpServletResponse res, String target) {
final String method = req.getMethod();
if (HuluSetting.isDevMode) {
log.debug("Client [{}] {} [{}]", HttpUtil.getClientIP(req), method, target);
}
final ActionMethod actionMethod = actionMapping.getActionMethod(target);
if (actionMethod == null || actionMethod.isHttpMethodMatch(method) == false) {
//无对应的Action或者Http方法不匹配,跳过执行后续过程
return false;
}
//找到对应的ActionMethod后注入ServletRequst和ServletResponse
//在此阶段注入的目的是提升性能,避免没有匹配的ActionMethod依旧注入的问题
fillReqAndRes(req, res);
//重置过滤器执行游标,从第一个过滤器开始执行
actionMethod.resetInterceptorPosition();
try {
actionMethod.invoke();
} catch (ActionException e) {
Render.renderError500(e.getCause());
}finally{
clearReqAndRes();
}
return true;
} | java | public final boolean handle(HttpServletRequest req, HttpServletResponse res, String target) {
final String method = req.getMethod();
if (HuluSetting.isDevMode) {
log.debug("Client [{}] {} [{}]", HttpUtil.getClientIP(req), method, target);
}
final ActionMethod actionMethod = actionMapping.getActionMethod(target);
if (actionMethod == null || actionMethod.isHttpMethodMatch(method) == false) {
//无对应的Action或者Http方法不匹配,跳过执行后续过程
return false;
}
//找到对应的ActionMethod后注入ServletRequst和ServletResponse
//在此阶段注入的目的是提升性能,避免没有匹配的ActionMethod依旧注入的问题
fillReqAndRes(req, res);
//重置过滤器执行游标,从第一个过滤器开始执行
actionMethod.resetInterceptorPosition();
try {
actionMethod.invoke();
} catch (ActionException e) {
Render.renderError500(e.getCause());
}finally{
clearReqAndRes();
}
return true;
} | [
"public",
"final",
"boolean",
"handle",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"String",
"target",
")",
"{",
"final",
"String",
"method",
"=",
"req",
".",
"getMethod",
"(",
")",
";",
"if",
"(",
"HuluSetting",
".",
"isDevMod... | 处理请求
@param req ServletRequest
@param res ServletResponse
@param target 请求目标(请求路径)
@return 是否处理成功 | [
"处理请求"
] | train | https://github.com/looly/hulu/blob/4072de684e2e2f28ac8a3a44c0d5a690b289ef28/src/main/java/com/xiaoleilu/hulu/ActionHandler.java#L49-L76 |
albfernandez/itext2 | src/main/java/com/lowagie/text/pdf/TrueTypeFont.java | TrueTypeFont.getRawWidth | int getRawWidth(int c, String name) {
int[] metric = getMetricsTT(c);
if (metric == null)
return 0;
return metric[1];
} | java | int getRawWidth(int c, String name) {
int[] metric = getMetricsTT(c);
if (metric == null)
return 0;
return metric[1];
} | [
"int",
"getRawWidth",
"(",
"int",
"c",
",",
"String",
"name",
")",
"{",
"int",
"[",
"]",
"metric",
"=",
"getMetricsTT",
"(",
"c",
")",
";",
"if",
"(",
"metric",
"==",
"null",
")",
"return",
"0",
";",
"return",
"metric",
"[",
"1",
"]",
";",
"}"
] | Gets the width from the font according to the unicode char <CODE>c</CODE>.
If the <CODE>name</CODE> is null it's a symbolic font.
@param c the unicode char
@param name the glyph name
@return the width of the char | [
"Gets",
"the",
"width",
"from",
"the",
"font",
"according",
"to",
"the",
"unicode",
"char",
"<CODE",
">",
"c<",
"/",
"CODE",
">",
".",
"If",
"the",
"<CODE",
">",
"name<",
"/",
"CODE",
">",
"is",
"null",
"it",
"s",
"a",
"symbolic",
"font",
"."
] | train | https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/TrueTypeFont.java#L1041-L1046 |
UrielCh/ovh-java-sdk | ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java | ApiOvhOrder.email_pro_service_account_duration_POST | public OvhOrder email_pro_service_account_duration_POST(String service, String duration, Long number) throws IOException {
String qPath = "/order/email/pro/{service}/account/{duration}";
StringBuilder sb = path(qPath, service, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "number", number);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | java | public OvhOrder email_pro_service_account_duration_POST(String service, String duration, Long number) throws IOException {
String qPath = "/order/email/pro/{service}/account/{duration}";
StringBuilder sb = path(qPath, service, duration);
HashMap<String, Object>o = new HashMap<String, Object>();
addBody(o, "number", number);
String resp = exec(qPath, "POST", sb.toString(), o);
return convertTo(resp, OvhOrder.class);
} | [
"public",
"OvhOrder",
"email_pro_service_account_duration_POST",
"(",
"String",
"service",
",",
"String",
"duration",
",",
"Long",
"number",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/order/email/pro/{service}/account/{duration}\"",
";",
"StringBuilder",... | Create order
REST: POST /order/email/pro/{service}/account/{duration}
@param number [required] Number of Accounts to order
@param service [required] The internal name of your pro organization
@param duration [required] Duration | [
"Create",
"order"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L4062-L4069 |
OpenBEL/openbel-framework | org.openbel.framework.core/src/main/java/org/openbel/framework/core/CommandLineApplication.java | CommandLineApplication.initializeSystemConfiguration | protected final void initializeSystemConfiguration() {
try {
attemptSystemConfiguration();
} catch (IOException e) {
// Can't recover from this
final String err = SYSCFG_READ_FAILURE;
throw new BELRuntimeException(err, ExitCode.UNRECOVERABLE_ERROR, e);
}
} | java | protected final void initializeSystemConfiguration() {
try {
attemptSystemConfiguration();
} catch (IOException e) {
// Can't recover from this
final String err = SYSCFG_READ_FAILURE;
throw new BELRuntimeException(err, ExitCode.UNRECOVERABLE_ERROR, e);
}
} | [
"protected",
"final",
"void",
"initializeSystemConfiguration",
"(",
")",
"{",
"try",
"{",
"attemptSystemConfiguration",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"// Can't recover from this",
"final",
"String",
"err",
"=",
"SYSCFG_READ_FAILURE"... | Initializes the system configuration from either {@link #SHRT_OPT_SYSCFG}
or system defaults.
<p>
This method will initialize the system configuration or die trying.
</p>
@throws IOException Thrown if an I/O error occurs during initialization
of the system configuration
@see #attemptSystemConfiguration() | [
"Initializes",
"the",
"system",
"configuration",
"from",
"either",
"{",
"@link",
"#SHRT_OPT_SYSCFG",
"}",
"or",
"system",
"defaults",
".",
"<p",
">",
"This",
"method",
"will",
"initialize",
"the",
"system",
"configuration",
"or",
"die",
"trying",
".",
"<",
"/"... | train | https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/CommandLineApplication.java#L627-L635 |
Alexey1Gavrilov/ExpectIt | expectit-core/src/main/java/net/sf/expectit/ExpectBuilder.java | ExpectBuilder.withInputFilters | public final ExpectBuilder withInputFilters(Filter filter, Filter... moreFilters) {
if (moreFilters.length == 0) {
this.filter = filter;
} else {
Filter[] filters = new Filter[moreFilters.length + 1];
filters[0] = filter;
System.arraycopy(moreFilters, 0, filters, 1, moreFilters.length);
this.filter = Filters.chain(filters);
}
return this;
} | java | public final ExpectBuilder withInputFilters(Filter filter, Filter... moreFilters) {
if (moreFilters.length == 0) {
this.filter = filter;
} else {
Filter[] filters = new Filter[moreFilters.length + 1];
filters[0] = filter;
System.arraycopy(moreFilters, 0, filters, 1, moreFilters.length);
this.filter = Filters.chain(filters);
}
return this;
} | [
"public",
"final",
"ExpectBuilder",
"withInputFilters",
"(",
"Filter",
"filter",
",",
"Filter",
"...",
"moreFilters",
")",
"{",
"if",
"(",
"moreFilters",
".",
"length",
"==",
"0",
")",
"{",
"this",
".",
"filter",
"=",
"filter",
";",
"}",
"else",
"{",
"Fi... | Sets a filter for the input. Optional, by default no filter is applied.
<p/>
Filters can be used to modify the input before performing expect operations. For example,
to remove
non-printable characters. Filters can be switched on and off while working with the expect
instance.
@param filter the filter
@param moreFilters more filter to apply. if specified then all the filters are combined
using the
{@link Filters#chain(Filter...)} method.s
@return this | [
"Sets",
"a",
"filter",
"for",
"the",
"input",
".",
"Optional",
"by",
"default",
"no",
"filter",
"is",
"applied",
".",
"<p",
"/",
">",
"Filters",
"can",
"be",
"used",
"to",
"modify",
"the",
"input",
"before",
"performing",
"expect",
"operations",
".",
"Fo... | train | https://github.com/Alexey1Gavrilov/ExpectIt/blob/5acbe1f8f895fe1dbd63e29bf3ab8e5bbf0873c3/expectit-core/src/main/java/net/sf/expectit/ExpectBuilder.java#L210-L220 |
liferay/com-liferay-commerce | commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderNotePersistenceImpl.java | CommerceOrderNotePersistenceImpl.fetchByC_ERC | @Override
public CommerceOrderNote fetchByC_ERC(long companyId,
String externalReferenceCode) {
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | java | @Override
public CommerceOrderNote fetchByC_ERC(long companyId,
String externalReferenceCode) {
return fetchByC_ERC(companyId, externalReferenceCode, true);
} | [
"@",
"Override",
"public",
"CommerceOrderNote",
"fetchByC_ERC",
"(",
"long",
"companyId",
",",
"String",
"externalReferenceCode",
")",
"{",
"return",
"fetchByC_ERC",
"(",
"companyId",
",",
"externalReferenceCode",
",",
"true",
")",
";",
"}"
] | Returns the commerce order note where companyId = ? and externalReferenceCode = ? or returns <code>null</code> if it could not be found. Uses the finder cache.
@param companyId the company ID
@param externalReferenceCode the external reference code
@return the matching commerce order note, or <code>null</code> if a matching commerce order note could not be found | [
"Returns",
"the",
"commerce",
"order",
"note",
"where",
"companyId",
"=",
"?",
";",
"and",
"externalReferenceCode",
"=",
"?",
";",
"or",
"returns",
"<code",
">",
"null<",
"/",
"code",
">",
"if",
"it",
"could",
"not",
"be",
"found",
".",
"Uses",
"th... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceOrderNotePersistenceImpl.java#L1224-L1228 |
wcm-io/wcm-io-tooling | commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/unpack/ContentUnpacker.java | ContentUnpacker.sortWeakReferenceValues | private String sortWeakReferenceValues(String name, String value) {
Set<String> refs = new TreeSet<>();
DocViewProperty prop = DocViewProperty.parse(name, value);
for (int i = 0; i < prop.values.length; i++) {
refs.add(prop.values[i]);
}
List<Value> values = new ArrayList<>();
for (String ref : refs) {
values.add(new MockValue(ref, PropertyType.WEAKREFERENCE));
}
try {
String sortedValues = DocViewProperty.format(new MockProperty(name, true, values.toArray(new Value[values.size()])));
return sortedValues;
}
catch (RepositoryException ex) {
throw new RuntimeException("Unable to format value for " + name, ex);
}
} | java | private String sortWeakReferenceValues(String name, String value) {
Set<String> refs = new TreeSet<>();
DocViewProperty prop = DocViewProperty.parse(name, value);
for (int i = 0; i < prop.values.length; i++) {
refs.add(prop.values[i]);
}
List<Value> values = new ArrayList<>();
for (String ref : refs) {
values.add(new MockValue(ref, PropertyType.WEAKREFERENCE));
}
try {
String sortedValues = DocViewProperty.format(new MockProperty(name, true, values.toArray(new Value[values.size()])));
return sortedValues;
}
catch (RepositoryException ex) {
throw new RuntimeException("Unable to format value for " + name, ex);
}
} | [
"private",
"String",
"sortWeakReferenceValues",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"Set",
"<",
"String",
">",
"refs",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"DocViewProperty",
"prop",
"=",
"DocViewProperty",
".",
"parse",
"(",
"n... | Sort weak reference values alphabetically to ensure consistent ordering.
@param name Property name
@param value Property value
@return Property value with sorted references | [
"Sort",
"weak",
"reference",
"values",
"alphabetically",
"to",
"ensure",
"consistent",
"ordering",
"."
] | train | https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/unpack/ContentUnpacker.java#L369-L386 |
UrielCh/ovh-java-sdk | ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java | ApiOvhCloud.project_serviceName_region_regionName_workflow_backup_backupWorkflowId_DELETE | public void project_serviceName_region_regionName_workflow_backup_backupWorkflowId_DELETE(String serviceName, String regionName, String backupWorkflowId) throws IOException {
String qPath = "/cloud/project/{serviceName}/region/{regionName}/workflow/backup/{backupWorkflowId}";
StringBuilder sb = path(qPath, serviceName, regionName, backupWorkflowId);
exec(qPath, "DELETE", sb.toString(), null);
} | java | public void project_serviceName_region_regionName_workflow_backup_backupWorkflowId_DELETE(String serviceName, String regionName, String backupWorkflowId) throws IOException {
String qPath = "/cloud/project/{serviceName}/region/{regionName}/workflow/backup/{backupWorkflowId}";
StringBuilder sb = path(qPath, serviceName, regionName, backupWorkflowId);
exec(qPath, "DELETE", sb.toString(), null);
} | [
"public",
"void",
"project_serviceName_region_regionName_workflow_backup_backupWorkflowId_DELETE",
"(",
"String",
"serviceName",
",",
"String",
"regionName",
",",
"String",
"backupWorkflowId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/cloud/project/{service... | Delete a backup workflow process
REST: DELETE /cloud/project/{serviceName}/region/{regionName}/workflow/backup/{backupWorkflowId}
@param backupWorkflowId [required] ID of your backup workflow
@param regionName [required] Public Cloud region
@param serviceName [required] Public Cloud project
API beta | [
"Delete",
"a",
"backup",
"workflow",
"process"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L215-L219 |
FedericoPecora/meta-csp-framework | src/main/java/org/metacsp/utility/UI/CurvedArrow.java | CurvedArrow.setEnd | public void setEnd(int x2, int y2) {
end.x = x2;
end.y = y2;
needsRefresh = true;
} | java | public void setEnd(int x2, int y2) {
end.x = x2;
end.y = y2;
needsRefresh = true;
} | [
"public",
"void",
"setEnd",
"(",
"int",
"x2",
",",
"int",
"y2",
")",
"{",
"end",
".",
"x",
"=",
"x2",
";",
"end",
".",
"y",
"=",
"y2",
";",
"needsRefresh",
"=",
"true",
";",
"}"
] | Sets the end point.
@param x2
the x coordinate of the end point
@param y2
the y coordinate of the end point | [
"Sets",
"the",
"end",
"point",
"."
] | train | https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/utility/UI/CurvedArrow.java#L115-L119 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java | RecommendedElasticPoolsInner.getAsync | public Observable<RecommendedElasticPoolInner> getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1<ServiceResponse<RecommendedElasticPoolInner>, RecommendedElasticPoolInner>() {
@Override
public RecommendedElasticPoolInner call(ServiceResponse<RecommendedElasticPoolInner> response) {
return response.body();
}
});
} | java | public Observable<RecommendedElasticPoolInner> getAsync(String resourceGroupName, String serverName, String recommendedElasticPoolName) {
return getWithServiceResponseAsync(resourceGroupName, serverName, recommendedElasticPoolName).map(new Func1<ServiceResponse<RecommendedElasticPoolInner>, RecommendedElasticPoolInner>() {
@Override
public RecommendedElasticPoolInner call(ServiceResponse<RecommendedElasticPoolInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RecommendedElasticPoolInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"recommendedElasticPoolName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"se... | Gets a recommented elastic pool.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param recommendedElasticPoolName The name of the recommended elastic pool to be retrieved.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the RecommendedElasticPoolInner object | [
"Gets",
"a",
"recommented",
"elastic",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/RecommendedElasticPoolsInner.java#L107-L114 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateRecurringTask | private void populateRecurringTask(Record record, RecurringTask task) throws MPXJException
{
//System.out.println(record);
task.setStartDate(record.getDateTime(1));
task.setFinishDate(record.getDateTime(2));
task.setDuration(RecurrenceUtility.getDuration(m_projectFile.getProjectProperties(), record.getInteger(3), record.getInteger(4)));
task.setOccurrences(record.getInteger(5));
task.setRecurrenceType(RecurrenceUtility.getRecurrenceType(record.getInteger(6)));
task.setUseEndDate(NumberHelper.getInt(record.getInteger(8)) == 1);
task.setWorkingDaysOnly(NumberHelper.getInt(record.getInteger(9)) == 1);
task.setWeeklyDaysFromBitmap(RecurrenceUtility.getDays(record.getString(10)), RecurrenceUtility.RECURRING_TASK_DAY_MASKS);
RecurrenceType type = task.getRecurrenceType();
if (type != null)
{
switch (task.getRecurrenceType())
{
case DAILY:
{
task.setFrequency(record.getInteger(13));
break;
}
case WEEKLY:
{
task.setFrequency(record.getInteger(14));
break;
}
case MONTHLY:
{
task.setRelative(NumberHelper.getInt(record.getInteger(11)) == 1);
if (task.getRelative())
{
task.setFrequency(record.getInteger(17));
task.setDayNumber(record.getInteger(15));
task.setDayOfWeek(RecurrenceUtility.getDay(record.getInteger(16)));
}
else
{
task.setFrequency(record.getInteger(19));
task.setDayNumber(record.getInteger(18));
}
break;
}
case YEARLY:
{
task.setRelative(NumberHelper.getInt(record.getInteger(12)) != 1);
if (task.getRelative())
{
task.setDayNumber(record.getInteger(20));
task.setDayOfWeek(RecurrenceUtility.getDay(record.getInteger(21)));
task.setMonthNumber(record.getInteger(22));
}
else
{
task.setYearlyAbsoluteFromDate(record.getDateTime(23));
}
break;
}
}
}
//System.out.println(task);
} | java | private void populateRecurringTask(Record record, RecurringTask task) throws MPXJException
{
//System.out.println(record);
task.setStartDate(record.getDateTime(1));
task.setFinishDate(record.getDateTime(2));
task.setDuration(RecurrenceUtility.getDuration(m_projectFile.getProjectProperties(), record.getInteger(3), record.getInteger(4)));
task.setOccurrences(record.getInteger(5));
task.setRecurrenceType(RecurrenceUtility.getRecurrenceType(record.getInteger(6)));
task.setUseEndDate(NumberHelper.getInt(record.getInteger(8)) == 1);
task.setWorkingDaysOnly(NumberHelper.getInt(record.getInteger(9)) == 1);
task.setWeeklyDaysFromBitmap(RecurrenceUtility.getDays(record.getString(10)), RecurrenceUtility.RECURRING_TASK_DAY_MASKS);
RecurrenceType type = task.getRecurrenceType();
if (type != null)
{
switch (task.getRecurrenceType())
{
case DAILY:
{
task.setFrequency(record.getInteger(13));
break;
}
case WEEKLY:
{
task.setFrequency(record.getInteger(14));
break;
}
case MONTHLY:
{
task.setRelative(NumberHelper.getInt(record.getInteger(11)) == 1);
if (task.getRelative())
{
task.setFrequency(record.getInteger(17));
task.setDayNumber(record.getInteger(15));
task.setDayOfWeek(RecurrenceUtility.getDay(record.getInteger(16)));
}
else
{
task.setFrequency(record.getInteger(19));
task.setDayNumber(record.getInteger(18));
}
break;
}
case YEARLY:
{
task.setRelative(NumberHelper.getInt(record.getInteger(12)) != 1);
if (task.getRelative())
{
task.setDayNumber(record.getInteger(20));
task.setDayOfWeek(RecurrenceUtility.getDay(record.getInteger(21)));
task.setMonthNumber(record.getInteger(22));
}
else
{
task.setYearlyAbsoluteFromDate(record.getDateTime(23));
}
break;
}
}
}
//System.out.println(task);
} | [
"private",
"void",
"populateRecurringTask",
"(",
"Record",
"record",
",",
"RecurringTask",
"task",
")",
"throws",
"MPXJException",
"{",
"//System.out.println(record);",
"task",
".",
"setStartDate",
"(",
"record",
".",
"getDateTime",
"(",
"1",
")",
")",
";",
"task"... | Populates a recurring task.
@param record MPX record
@param task recurring task
@throws MPXJException | [
"Populates",
"a",
"recurring",
"task",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L1329-L1394 |
wcm-io-caravan/caravan-hal | docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java | GenerateHalDocsJsonMojo.toLinkRelation | private LinkRelation toLinkRelation(JavaClass javaClazz, JavaField javaField, ClassLoader compileClassLoader) {
LinkRelation rel = new LinkRelation();
rel.setShortDescription(buildShortDescription(javaField.getComment()));
rel.setDescriptionMarkup(javaField.getComment());
rel.setRel(getStaticFieldValue(javaClazz, javaField, compileClassLoader, String.class));
LinkRelationDoc relDoc = getAnnotation(javaClazz, javaField, compileClassLoader, LinkRelationDoc.class);
rel.setJsonSchemaRef(buildJsonSchemaRefModel(relDoc.jsonSchema(), relDoc.model()));
Arrays.stream(relDoc.embedded()).forEach(embedded -> rel.addResourceRef(embedded.value(), embedded.description(),
buildJsonSchemaRefModel(embedded.jsonSchema(), embedded.model())));
Arrays.stream(relDoc.links()).forEach(link -> rel.addLinkRelationRef(link.value(), link.description()));
return rel;
} | java | private LinkRelation toLinkRelation(JavaClass javaClazz, JavaField javaField, ClassLoader compileClassLoader) {
LinkRelation rel = new LinkRelation();
rel.setShortDescription(buildShortDescription(javaField.getComment()));
rel.setDescriptionMarkup(javaField.getComment());
rel.setRel(getStaticFieldValue(javaClazz, javaField, compileClassLoader, String.class));
LinkRelationDoc relDoc = getAnnotation(javaClazz, javaField, compileClassLoader, LinkRelationDoc.class);
rel.setJsonSchemaRef(buildJsonSchemaRefModel(relDoc.jsonSchema(), relDoc.model()));
Arrays.stream(relDoc.embedded()).forEach(embedded -> rel.addResourceRef(embedded.value(), embedded.description(),
buildJsonSchemaRefModel(embedded.jsonSchema(), embedded.model())));
Arrays.stream(relDoc.links()).forEach(link -> rel.addLinkRelationRef(link.value(), link.description()));
return rel;
} | [
"private",
"LinkRelation",
"toLinkRelation",
"(",
"JavaClass",
"javaClazz",
",",
"JavaField",
"javaField",
",",
"ClassLoader",
"compileClassLoader",
")",
"{",
"LinkRelation",
"rel",
"=",
"new",
"LinkRelation",
"(",
")",
";",
"rel",
".",
"setShortDescription",
"(",
... | Builds a {@link LinkRelation} from a field definition with {@link LinkRelationDoc} annotation.
@param javaClazz QDox class
@param javaField QDox field
@param compileClassLoader Classloader for compile dependencies
@return Link relation | [
"Builds",
"a",
"{"
] | train | https://github.com/wcm-io-caravan/caravan-hal/blob/25d58756b58c70c8c48a17fe781e673dd93d5085/docs-maven-plugin/src/main/java/io/wcm/caravan/maven/plugins/haldocs/GenerateHalDocsJsonMojo.java#L196-L213 |
alkacon/opencms-core | src/org/opencms/db/generic/CmsVfsDriver.java | CmsVfsDriver.replaceProject | private String replaceProject(String query, boolean online) {
return query.replace("%(PROJECT)", online ? ONLINE : OFFLINE);
} | java | private String replaceProject(String query, boolean online) {
return query.replace("%(PROJECT)", online ? ONLINE : OFFLINE);
} | [
"private",
"String",
"replaceProject",
"(",
"String",
"query",
",",
"boolean",
"online",
")",
"{",
"return",
"query",
".",
"replace",
"(",
"\"%(PROJECT)\"",
",",
"online",
"?",
"ONLINE",
":",
"OFFLINE",
")",
";",
"}"
] | Replaces the %(PROJECT) macro inside a query with either ONLINE or OFFLINE, depending on the value
of a flag.<p>
We use this instead of the ${PROJECT} replacement mechanism when we need explicit control over the
project, and don't want to implicitly use the project of the DB context.<p>
@param query the query in which the macro should be replaced
@param online if true, the macro will be replaced with "ONLINE", else "OFFLINE"
@return the query with the replaced macro | [
"Replaces",
"the",
"%",
"(",
"PROJECT",
")",
"macro",
"inside",
"a",
"query",
"with",
"either",
"ONLINE",
"or",
"OFFLINE",
"depending",
"on",
"the",
"value",
"of",
"a",
"flag",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsVfsDriver.java#L4822-L4825 |
thelinmichael/spotify-web-api-java | src/main/java/com/wrapper/spotify/SpotifyApi.java | SpotifyApi.getPlaylist | @Deprecated
public GetPlaylistRequest.Builder getPlaylist(String user_id, String playlist_id) {
return new GetPlaylistRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.user_id(user_id)
.playlist_id(playlist_id);
} | java | @Deprecated
public GetPlaylistRequest.Builder getPlaylist(String user_id, String playlist_id) {
return new GetPlaylistRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.user_id(user_id)
.playlist_id(playlist_id);
} | [
"@",
"Deprecated",
"public",
"GetPlaylistRequest",
".",
"Builder",
"getPlaylist",
"(",
"String",
"user_id",
",",
"String",
"playlist_id",
")",
"{",
"return",
"new",
"GetPlaylistRequest",
".",
"Builder",
"(",
"accessToken",
")",
".",
"setDefaults",
"(",
"httpManage... | Get a playlist.
@deprecated Playlist IDs are unique for themselves. This parameter is thus no longer used.
(https://developer.spotify.com/community/news/2018/06/12/changes-to-playlist-uris/)
@param user_id The playlists owners username.
@param playlist_id The playlists ID.
@return A {@link GetPlaylistRequest.Builder}.
@see <a href="https://developer.spotify.com/web-api/user-guide/#spotify-uris-and-ids">Spotify: URLs & IDs</a> | [
"Get",
"a",
"playlist",
"."
] | train | https://github.com/thelinmichael/spotify-web-api-java/blob/c06b8512344c0310d0c1df362fa267879021da2e/src/main/java/com/wrapper/spotify/SpotifyApi.java#L1198-L1204 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java | JobsImpl.listNextAsync | public Observable<Page<CloudJob>> listNextAsync(final String nextPageLink, final JobListNextOptions jobListNextOptions) {
return listNextWithServiceResponseAsync(nextPageLink, jobListNextOptions)
.map(new Func1<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>, Page<CloudJob>>() {
@Override
public Page<CloudJob> call(ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders> response) {
return response.body();
}
});
} | java | public Observable<Page<CloudJob>> listNextAsync(final String nextPageLink, final JobListNextOptions jobListNextOptions) {
return listNextWithServiceResponseAsync(nextPageLink, jobListNextOptions)
.map(new Func1<ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders>, Page<CloudJob>>() {
@Override
public Page<CloudJob> call(ServiceResponseWithHeaders<Page<CloudJob>, JobListHeaders> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Page",
"<",
"CloudJob",
">",
">",
"listNextAsync",
"(",
"final",
"String",
"nextPageLink",
",",
"final",
"JobListNextOptions",
"jobListNextOptions",
")",
"{",
"return",
"listNextWithServiceResponseAsync",
"(",
"nextPageLink",
",",
"jobLis... | Lists all of the jobs in the specified account.
@param nextPageLink The NextLink from the previous successful call to List operation.
@param jobListNextOptions Additional parameters for the operation
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<CloudJob> object | [
"Lists",
"all",
"of",
"the",
"jobs",
"in",
"the",
"specified",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L3467-L3475 |
OpenLiberty/open-liberty | dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java | RegisteredResources.generateNewBranch | protected Xid generateNewBranch() {
if (tc.isEntryEnabled())
Tr.entry(tc, "generateNewBranch");
// Create a new Xid branch
final XidImpl result = new XidImpl(_txServiceXid, ++_branchCount);
if (tc.isEntryEnabled())
Tr.exit(tc, "generateNewBranch", result);
return result;
} | java | protected Xid generateNewBranch() {
if (tc.isEntryEnabled())
Tr.entry(tc, "generateNewBranch");
// Create a new Xid branch
final XidImpl result = new XidImpl(_txServiceXid, ++_branchCount);
if (tc.isEntryEnabled())
Tr.exit(tc, "generateNewBranch", result);
return result;
} | [
"protected",
"Xid",
"generateNewBranch",
"(",
")",
"{",
"if",
"(",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"Tr",
".",
"entry",
"(",
"tc",
",",
"\"generateNewBranch\"",
")",
";",
"// Create a new Xid branch",
"final",
"XidImpl",
"result",
"=",
"new",
"Xid... | Generates a new XidImpl to represent a new branch of this
transaction.
@return A new XidImpl representing a new branch of this transaction. | [
"Generates",
"a",
"new",
"XidImpl",
"to",
"represent",
"a",
"new",
"branch",
"of",
"this",
"transaction",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.tx.core/src/com/ibm/tx/jta/impl/RegisteredResources.java#L630-L640 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/core/QueryParserBase.java | QueryParserBase.createCalculatedFieldFragment | protected String createCalculatedFieldFragment(CalculatedField calculatedField, @Nullable Class<?> domainType) {
return StringUtils.isNotBlank(calculatedField.getAlias())
? (calculatedField.getAlias() + ":" + createFunctionFragment(calculatedField.getFunction(), 0, domainType))
: createFunctionFragment(calculatedField.getFunction(), 0, domainType);
} | java | protected String createCalculatedFieldFragment(CalculatedField calculatedField, @Nullable Class<?> domainType) {
return StringUtils.isNotBlank(calculatedField.getAlias())
? (calculatedField.getAlias() + ":" + createFunctionFragment(calculatedField.getFunction(), 0, domainType))
: createFunctionFragment(calculatedField.getFunction(), 0, domainType);
} | [
"protected",
"String",
"createCalculatedFieldFragment",
"(",
"CalculatedField",
"calculatedField",
",",
"@",
"Nullable",
"Class",
"<",
"?",
">",
"domainType",
")",
"{",
"return",
"StringUtils",
".",
"isNotBlank",
"(",
"calculatedField",
".",
"getAlias",
"(",
")",
... | Create {@link SolrClient} readable String representation for {@link CalculatedField}.
@param calculatedField
@return
@since 1.1 | [
"Create",
"{",
"@link",
"SolrClient",
"}",
"readable",
"String",
"representation",
"for",
"{",
"@link",
"CalculatedField",
"}",
"."
] | train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/QueryParserBase.java#L349-L353 |
dashorst/wicket-stuff-markup-validator | jing/src/main/java/com/thaiopensource/validate/nvdl/NamespaceSpecification.java | NamespaceSpecification.matchPrefix | static private boolean matchPrefix(String s1, String s2) {
return s1.startsWith(s2) || s2.startsWith(s1);
} | java | static private boolean matchPrefix(String s1, String s2) {
return s1.startsWith(s2) || s2.startsWith(s1);
} | [
"static",
"private",
"boolean",
"matchPrefix",
"(",
"String",
"s1",
",",
"String",
"s2",
")",
"{",
"return",
"s1",
".",
"startsWith",
"(",
"s2",
")",
"||",
"s2",
".",
"startsWith",
"(",
"s1",
")",
";",
"}"
] | Checks with either of the strings starts with the other.
@param s1 a String
@param s2 a String
@return true if s1 starts with s2 or s2 starts with s1, false otherwise | [
"Checks",
"with",
"either",
"of",
"the",
"strings",
"starts",
"with",
"the",
"other",
"."
] | train | https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/jing/src/main/java/com/thaiopensource/validate/nvdl/NamespaceSpecification.java#L102-L104 |
atomix/atomix | protocols/raft/src/main/java/io/atomix/protocols/raft/roles/PassiveRole.java | PassiveRole.checkTerm | protected boolean checkTerm(AppendRequest request, CompletableFuture<AppendResponse> future) {
RaftLogWriter writer = raft.getLogWriter();
if (request.term() < raft.getTerm()) {
log.debug("Rejected {}: request term is less than the current term ({})", request, raft.getTerm());
return failAppend(writer.getLastIndex(), future);
}
return true;
} | java | protected boolean checkTerm(AppendRequest request, CompletableFuture<AppendResponse> future) {
RaftLogWriter writer = raft.getLogWriter();
if (request.term() < raft.getTerm()) {
log.debug("Rejected {}: request term is less than the current term ({})", request, raft.getTerm());
return failAppend(writer.getLastIndex(), future);
}
return true;
} | [
"protected",
"boolean",
"checkTerm",
"(",
"AppendRequest",
"request",
",",
"CompletableFuture",
"<",
"AppendResponse",
">",
"future",
")",
"{",
"RaftLogWriter",
"writer",
"=",
"raft",
".",
"getLogWriter",
"(",
")",
";",
"if",
"(",
"request",
".",
"term",
"(",
... | Checks the leader's term of the given AppendRequest, returning a boolean indicating whether to continue
handling the request. | [
"Checks",
"the",
"leader",
"s",
"term",
"of",
"the",
"given",
"AppendRequest",
"returning",
"a",
"boolean",
"indicating",
"whether",
"to",
"continue",
"handling",
"the",
"request",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/raft/src/main/java/io/atomix/protocols/raft/roles/PassiveRole.java#L134-L141 |
mgormley/prim | src/main/java_generated/edu/jhu/prim/arrays/IntArrays.java | IntArrays.countUnique | public static int countUnique(int[] indices1, int[] indices2) {
int numUniqueIndices = 0;
int i = 0;
int j = 0;
while (i < indices1.length && j < indices2.length) {
if (indices1[i] < indices2[j]) {
numUniqueIndices++;
i++;
} else if (indices2[j] < indices1[i]) {
numUniqueIndices++;
j++;
} else {
// Equal indices.
i++;
j++;
}
}
for (; i < indices1.length; i++) {
numUniqueIndices++;
}
for (; j < indices2.length; j++) {
numUniqueIndices++;
}
return numUniqueIndices;
} | java | public static int countUnique(int[] indices1, int[] indices2) {
int numUniqueIndices = 0;
int i = 0;
int j = 0;
while (i < indices1.length && j < indices2.length) {
if (indices1[i] < indices2[j]) {
numUniqueIndices++;
i++;
} else if (indices2[j] < indices1[i]) {
numUniqueIndices++;
j++;
} else {
// Equal indices.
i++;
j++;
}
}
for (; i < indices1.length; i++) {
numUniqueIndices++;
}
for (; j < indices2.length; j++) {
numUniqueIndices++;
}
return numUniqueIndices;
} | [
"public",
"static",
"int",
"countUnique",
"(",
"int",
"[",
"]",
"indices1",
",",
"int",
"[",
"]",
"indices2",
")",
"{",
"int",
"numUniqueIndices",
"=",
"0",
";",
"int",
"i",
"=",
"0",
";",
"int",
"j",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"indic... | Counts the number of unique indices in two arrays.
@param indices1 Sorted array of indices.
@param indices2 Sorted array of indices. | [
"Counts",
"the",
"number",
"of",
"unique",
"indices",
"in",
"two",
"arrays",
"."
] | train | https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java_generated/edu/jhu/prim/arrays/IntArrays.java#L183-L207 |
eclipse/xtext-extras | org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/references/CompoundTypeReference.java | CompoundTypeReference.toJavaCompliantTypeReference | @Override
public JvmTypeReference toJavaCompliantTypeReference(IVisibilityHelper visibilityHelper) {
if (!isSynonym()) {
List<LightweightTypeReference> nonInterfaceTypes = getNonInterfaceTypes(components);
if (nonInterfaceTypes != null) {
return toJavaCompliantTypeReference(nonInterfaceTypes, visibilityHelper);
}
}
return toJavaCompliantTypeReference(components, visibilityHelper);
} | java | @Override
public JvmTypeReference toJavaCompliantTypeReference(IVisibilityHelper visibilityHelper) {
if (!isSynonym()) {
List<LightweightTypeReference> nonInterfaceTypes = getNonInterfaceTypes(components);
if (nonInterfaceTypes != null) {
return toJavaCompliantTypeReference(nonInterfaceTypes, visibilityHelper);
}
}
return toJavaCompliantTypeReference(components, visibilityHelper);
} | [
"@",
"Override",
"public",
"JvmTypeReference",
"toJavaCompliantTypeReference",
"(",
"IVisibilityHelper",
"visibilityHelper",
")",
"{",
"if",
"(",
"!",
"isSynonym",
"(",
")",
")",
"{",
"List",
"<",
"LightweightTypeReference",
">",
"nonInterfaceTypes",
"=",
"getNonInter... | {@inheritDoc}
If this is a multi-type rather than a {@link #isSynonym() synonym}, the Java compliant
type reference is determined from the common super type of all participating, non-interface types.
If there is no such type or this is a synonym, all the component types are used to compute
the common super type and use that one as the type. | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/references/CompoundTypeReference.java#L78-L87 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java | SeaGlassLookAndFeel.updateSeaglassStyle | public static SynthStyle updateSeaglassStyle(SynthContext context, SeaglassUI ui) {
SynthStyle newStyle = getStyle(context.getComponent(), context.getRegion());
// TODO rossi 04.07.2011 this code is now private in the Synth L&F
// SynthStyle oldStyle = context.getStyle();
//
// if (newStyle != oldStyle) {
// if (oldStyle != null) {
// oldStyle.uninstallDefaults(context);
// }
// context.setStyle(newStyle);
// newStyle.installDefaults(context, ui);
// }
return newStyle;
} | java | public static SynthStyle updateSeaglassStyle(SynthContext context, SeaglassUI ui) {
SynthStyle newStyle = getStyle(context.getComponent(), context.getRegion());
// TODO rossi 04.07.2011 this code is now private in the Synth L&F
// SynthStyle oldStyle = context.getStyle();
//
// if (newStyle != oldStyle) {
// if (oldStyle != null) {
// oldStyle.uninstallDefaults(context);
// }
// context.setStyle(newStyle);
// newStyle.installDefaults(context, ui);
// }
return newStyle;
} | [
"public",
"static",
"SynthStyle",
"updateSeaglassStyle",
"(",
"SynthContext",
"context",
",",
"SeaglassUI",
"ui",
")",
"{",
"SynthStyle",
"newStyle",
"=",
"getStyle",
"(",
"context",
".",
"getComponent",
"(",
")",
",",
"context",
".",
"getRegion",
"(",
")",
")... | A convience method that will reset the Style of StyleContext if
necessary.
@return newStyle | [
"A",
"convience",
"method",
"that",
"will",
"reset",
"the",
"Style",
"of",
"StyleContext",
"if",
"necessary",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/SeaGlassLookAndFeel.java#L603-L616 |
apache/incubator-gobblin | gobblin-service/src/main/java/org/apache/gobblin/service/monitoring/KafkaJobStatusMonitor.java | KafkaJobStatusMonitor.addJobStatusToStateStore | @VisibleForTesting
static void addJobStatusToStateStore(org.apache.gobblin.configuration.State jobStatus, StateStore stateStore)
throws IOException {
if (!jobStatus.contains(TimingEvent.FlowEventConstants.JOB_NAME_FIELD)) {
jobStatus.setProp(TimingEvent.FlowEventConstants.JOB_NAME_FIELD, JobStatusRetriever.NA_KEY);
}
if (!jobStatus.contains(TimingEvent.FlowEventConstants.JOB_GROUP_FIELD)) {
jobStatus.setProp(TimingEvent.FlowEventConstants.JOB_GROUP_FIELD, JobStatusRetriever.NA_KEY);
}
String flowName = jobStatus.getProp(TimingEvent.FlowEventConstants.FLOW_NAME_FIELD);
String flowGroup = jobStatus.getProp(TimingEvent.FlowEventConstants.FLOW_GROUP_FIELD);
String flowExecutionId = jobStatus.getProp(TimingEvent.FlowEventConstants.FLOW_EXECUTION_ID_FIELD);
String jobName = jobStatus.getProp(TimingEvent.FlowEventConstants.JOB_NAME_FIELD);
String jobGroup = jobStatus.getProp(TimingEvent.FlowEventConstants.JOB_GROUP_FIELD);
String storeName = jobStatusStoreName(flowGroup, flowName);
String tableName = jobStatusTableName(flowExecutionId, jobGroup, jobName);
jobStatus = mergedProperties(storeName, tableName, jobStatus, stateStore);
stateStore.put(storeName, tableName, jobStatus);
} | java | @VisibleForTesting
static void addJobStatusToStateStore(org.apache.gobblin.configuration.State jobStatus, StateStore stateStore)
throws IOException {
if (!jobStatus.contains(TimingEvent.FlowEventConstants.JOB_NAME_FIELD)) {
jobStatus.setProp(TimingEvent.FlowEventConstants.JOB_NAME_FIELD, JobStatusRetriever.NA_KEY);
}
if (!jobStatus.contains(TimingEvent.FlowEventConstants.JOB_GROUP_FIELD)) {
jobStatus.setProp(TimingEvent.FlowEventConstants.JOB_GROUP_FIELD, JobStatusRetriever.NA_KEY);
}
String flowName = jobStatus.getProp(TimingEvent.FlowEventConstants.FLOW_NAME_FIELD);
String flowGroup = jobStatus.getProp(TimingEvent.FlowEventConstants.FLOW_GROUP_FIELD);
String flowExecutionId = jobStatus.getProp(TimingEvent.FlowEventConstants.FLOW_EXECUTION_ID_FIELD);
String jobName = jobStatus.getProp(TimingEvent.FlowEventConstants.JOB_NAME_FIELD);
String jobGroup = jobStatus.getProp(TimingEvent.FlowEventConstants.JOB_GROUP_FIELD);
String storeName = jobStatusStoreName(flowGroup, flowName);
String tableName = jobStatusTableName(flowExecutionId, jobGroup, jobName);
jobStatus = mergedProperties(storeName, tableName, jobStatus, stateStore);
stateStore.put(storeName, tableName, jobStatus);
} | [
"@",
"VisibleForTesting",
"static",
"void",
"addJobStatusToStateStore",
"(",
"org",
".",
"apache",
".",
"gobblin",
".",
"configuration",
".",
"State",
"jobStatus",
",",
"StateStore",
"stateStore",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"jobStatus",
"... | Persist job status to the underlying {@link StateStore}.
It fills missing fields in job status and also merge the fields with the
existing job status in the state store. Merging is required because we
do not want to lose the information sent by other GobblinTrackingEvents.
@param jobStatus
@throws IOException | [
"Persist",
"job",
"status",
"to",
"the",
"underlying",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/monitoring/KafkaJobStatusMonitor.java#L131-L152 |
deeplearning4j/deeplearning4j | datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java | BaseSerializer.deserializeConditionList | public List<Condition> deserializeConditionList(String str) {
return load(str, ListWrappers.ConditionList.class).getList();
} | java | public List<Condition> deserializeConditionList(String str) {
return load(str, ListWrappers.ConditionList.class).getList();
} | [
"public",
"List",
"<",
"Condition",
">",
"deserializeConditionList",
"(",
"String",
"str",
")",
"{",
"return",
"load",
"(",
"str",
",",
"ListWrappers",
".",
"ConditionList",
".",
"class",
")",
".",
"getList",
"(",
")",
";",
"}"
] | Deserialize a Condition List serialized using {@link #serializeConditionList(List)}, or
an array serialized using {@link #serialize(Condition[])}
@param str String representation (YAML/JSON) of the Condition list
@return {@code List<Condition>} | [
"Deserialize",
"a",
"Condition",
"List",
"serialized",
"using",
"{",
"@link",
"#serializeConditionList",
"(",
"List",
")",
"}",
"or",
"an",
"array",
"serialized",
"using",
"{",
"@link",
"#serialize",
"(",
"Condition",
"[]",
")",
"}"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java#L300-L302 |
VoltDB/voltdb | src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java | JDBCResultSet.getDate | public Date getDate(int columnIndex, Calendar cal) throws SQLException {
TimestampData t = (TimestampData) getColumnInType(columnIndex,
Type.SQL_DATE);
long millis = t.getSeconds() * 1000;
int zoneOffset = HsqlDateTime.getZoneMillis(cal, millis);
return new Date(millis - zoneOffset);
} | java | public Date getDate(int columnIndex, Calendar cal) throws SQLException {
TimestampData t = (TimestampData) getColumnInType(columnIndex,
Type.SQL_DATE);
long millis = t.getSeconds() * 1000;
int zoneOffset = HsqlDateTime.getZoneMillis(cal, millis);
return new Date(millis - zoneOffset);
} | [
"public",
"Date",
"getDate",
"(",
"int",
"columnIndex",
",",
"Calendar",
"cal",
")",
"throws",
"SQLException",
"{",
"TimestampData",
"t",
"=",
"(",
"TimestampData",
")",
"getColumnInType",
"(",
"columnIndex",
",",
"Type",
".",
"SQL_DATE",
")",
";",
"long",
"... | <!-- start generic documentation -->
Retrieves the value of the designated column in the current row
of this <code>ResultSet</code> object as a <code>java.sql.Date</code> object
in the Java programming language.
This method uses the given calendar to construct an appropriate millisecond
value for the date if the underlying database does not store
timezone information.
<!-- end generic documentation -->
@param columnIndex the first column is 1, the second is 2, ...
@param cal the <code>java.util.Calendar</code> object
to use in constructing the date
@return the column value as a <code>java.sql.Date</code> object;
if the value is SQL <code>NULL</code>,
the value returned is <code>null</code> in the Java programming language
@exception SQLException if a database access error occurs
or this method is called on a closed result set
@since JDK 1.2 (JDK 1.1.x developers: read the overview for
JDBCResultSet) | [
"<!",
"--",
"start",
"generic",
"documentation",
"--",
">",
"Retrieves",
"the",
"value",
"of",
"the",
"designated",
"column",
"in",
"the",
"current",
"row",
"of",
"this",
"<code",
">",
"ResultSet<",
"/",
"code",
">",
"object",
"as",
"a",
"<code",
">",
"j... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java#L4499-L4507 |
fcrepo3/fcrepo | fcrepo-security/fcrepo-security-pep/src/main/java/org/fcrepo/server/security/xacml/pep/ResponseCacheImpl.java | ResponseCacheImpl.makeHash | private String makeHash(String request) throws CacheException {
RequestCtx reqCtx = null;
try {
reqCtx = m_contextUtil.makeRequestCtx(request);
} catch (MelcoeXacmlException pe) {
throw new CacheException("Error converting request", pe);
}
byte[] hash = null;
// ensure thread safety, don't want concurrent invocations of this method all modifying digest at once
// (alternative is to construct a new digest for each(
synchronized(digest) {
digest.reset();
hashSubjectList(reqCtx.getSubjectsAsList(), digest);
hashAttributeList(reqCtx.getResourceAsList(), digest);
hashAttributeList(reqCtx.getActionAsList(), digest);
hashAttributeList(reqCtx.getEnvironmentAttributesAsList(), digest);
hash = digest.digest();
}
return byte2hex(hash);
} | java | private String makeHash(String request) throws CacheException {
RequestCtx reqCtx = null;
try {
reqCtx = m_contextUtil.makeRequestCtx(request);
} catch (MelcoeXacmlException pe) {
throw new CacheException("Error converting request", pe);
}
byte[] hash = null;
// ensure thread safety, don't want concurrent invocations of this method all modifying digest at once
// (alternative is to construct a new digest for each(
synchronized(digest) {
digest.reset();
hashSubjectList(reqCtx.getSubjectsAsList(), digest);
hashAttributeList(reqCtx.getResourceAsList(), digest);
hashAttributeList(reqCtx.getActionAsList(), digest);
hashAttributeList(reqCtx.getEnvironmentAttributesAsList(), digest);
hash = digest.digest();
}
return byte2hex(hash);
} | [
"private",
"String",
"makeHash",
"(",
"String",
"request",
")",
"throws",
"CacheException",
"{",
"RequestCtx",
"reqCtx",
"=",
"null",
";",
"try",
"{",
"reqCtx",
"=",
"m_contextUtil",
".",
"makeRequestCtx",
"(",
"request",
")",
";",
"}",
"catch",
"(",
"Melcoe... | Given a request, this method generates a hash.
@param request
the request to hash
@return the hash
@throws CacheException | [
"Given",
"a",
"request",
"this",
"method",
"generates",
"a",
"hash",
"."
] | train | https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-security/fcrepo-security-pep/src/main/java/org/fcrepo/server/security/xacml/pep/ResponseCacheImpl.java#L254-L279 |
Jasig/uPortal | uPortal-tools/src/main/java/org/apereo/portal/version/dao/jpa/JpaVersionDao.java | JpaVersionDao.getSimpleVersion | private Version getSimpleVersion(String product) {
final Tuple coreNumbers;
try {
final TypedQuery<Tuple> coreNumbersQuery =
this.createQuery(this.findCoreVersionNumbers);
coreNumbersQuery.setParameter(this.productParameter, product);
coreNumbers = DataAccessUtils.singleResult(coreNumbersQuery.getResultList());
} catch (SQLGrammarException e) {
logger.warn("UP_VERSION table doesn't exist, returning null for version of " + product);
return null;
}
if (coreNumbers == null) {
// Table exists but no version data for the product
return null;
}
// Pull out the maj/min/pat values
final Integer major =
coreNumbers.get(
VersionImpl_.major.getName(), VersionImpl_.major.getBindableJavaType());
final Integer minor =
coreNumbers.get(
VersionImpl_.minor.getName(), VersionImpl_.minor.getBindableJavaType());
final Integer patch =
coreNumbers.get(
VersionImpl_.patch.getName(), VersionImpl_.patch.getBindableJavaType());
// See if the optional local version value exists
Integer local;
try {
final TypedQuery<Integer> localNumberQuery =
this.createQuery(this.findLocalVersionNumber);
localNumberQuery.setParameter(this.productParameter, product);
local = DataAccessUtils.singleResult(localNumberQuery.getResultList());
} catch (PersistenceException e) {
local = null;
}
return new VersionImpl(product, major, minor, patch, local);
} | java | private Version getSimpleVersion(String product) {
final Tuple coreNumbers;
try {
final TypedQuery<Tuple> coreNumbersQuery =
this.createQuery(this.findCoreVersionNumbers);
coreNumbersQuery.setParameter(this.productParameter, product);
coreNumbers = DataAccessUtils.singleResult(coreNumbersQuery.getResultList());
} catch (SQLGrammarException e) {
logger.warn("UP_VERSION table doesn't exist, returning null for version of " + product);
return null;
}
if (coreNumbers == null) {
// Table exists but no version data for the product
return null;
}
// Pull out the maj/min/pat values
final Integer major =
coreNumbers.get(
VersionImpl_.major.getName(), VersionImpl_.major.getBindableJavaType());
final Integer minor =
coreNumbers.get(
VersionImpl_.minor.getName(), VersionImpl_.minor.getBindableJavaType());
final Integer patch =
coreNumbers.get(
VersionImpl_.patch.getName(), VersionImpl_.patch.getBindableJavaType());
// See if the optional local version value exists
Integer local;
try {
final TypedQuery<Integer> localNumberQuery =
this.createQuery(this.findLocalVersionNumber);
localNumberQuery.setParameter(this.productParameter, product);
local = DataAccessUtils.singleResult(localNumberQuery.getResultList());
} catch (PersistenceException e) {
local = null;
}
return new VersionImpl(product, major, minor, patch, local);
} | [
"private",
"Version",
"getSimpleVersion",
"(",
"String",
"product",
")",
"{",
"final",
"Tuple",
"coreNumbers",
";",
"try",
"{",
"final",
"TypedQuery",
"<",
"Tuple",
">",
"coreNumbersQuery",
"=",
"this",
".",
"createQuery",
"(",
"this",
".",
"findCoreVersionNumbe... | Load a Version object with direct field queries. Used to deal with DB upgrades where not all
of the fields have been loaded | [
"Load",
"a",
"Version",
"object",
"with",
"direct",
"field",
"queries",
".",
"Used",
"to",
"deal",
"with",
"DB",
"upgrades",
"where",
"not",
"all",
"of",
"the",
"fields",
"have",
"been",
"loaded"
] | train | https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-tools/src/main/java/org/apereo/portal/version/dao/jpa/JpaVersionDao.java#L109-L149 |
mygreen/xlsmapper | src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/AbstractFieldValidator.java | AbstractFieldValidator.error | public void error(final CellField<T> cellField, final String messageKey, final Map<String, Object> messageVariables) {
ArgUtils.notEmpty(messageKey, "messageKey");
ArgUtils.notNull(cellField, "cellField");
ArgUtils.notNull(messageVariables, "messageVariables");
cellField.rejectValue(messageKey, messageVariables);
} | java | public void error(final CellField<T> cellField, final String messageKey, final Map<String, Object> messageVariables) {
ArgUtils.notEmpty(messageKey, "messageKey");
ArgUtils.notNull(cellField, "cellField");
ArgUtils.notNull(messageVariables, "messageVariables");
cellField.rejectValue(messageKey, messageVariables);
} | [
"public",
"void",
"error",
"(",
"final",
"CellField",
"<",
"T",
">",
"cellField",
",",
"final",
"String",
"messageKey",
",",
"final",
"Map",
"<",
"String",
",",
"Object",
">",
"messageVariables",
")",
"{",
"ArgUtils",
".",
"notEmpty",
"(",
"messageKey",
",... | メッセージキーを指定して、エラー情報を追加します。
@param cellField フィールド情報
@param messageKey メッセージキー
@param messageVariables メッセージ中の変数
@throws IllegalArgumentException {@literal cellField == null or messageKey == null or messageVariables == null}
@throws IllegalArgumentException {@literal messageKey.length() == 0} | [
"メッセージキーを指定して、エラー情報を追加します。"
] | train | https://github.com/mygreen/xlsmapper/blob/a0c6b25c622e5f3a50b199ef685d2ee46ad5483c/src/main/java/com/gh/mygreen/xlsmapper/validation/fieldvalidation/AbstractFieldValidator.java#L113-L120 |
marklogic/java-client-api | marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java | StructuredQueryBuilder.temporalLsqtQuery | public StructuredQueryDefinition temporalLsqtQuery(String temporalCollection, String timestamp,
double weight, String... options)
{
if ( temporalCollection == null ) throw new IllegalArgumentException("temporalCollection cannot be null");
return new TemporalLsqtQuery(temporalCollection, timestamp, weight, options);
} | java | public StructuredQueryDefinition temporalLsqtQuery(String temporalCollection, String timestamp,
double weight, String... options)
{
if ( temporalCollection == null ) throw new IllegalArgumentException("temporalCollection cannot be null");
return new TemporalLsqtQuery(temporalCollection, timestamp, weight, options);
} | [
"public",
"StructuredQueryDefinition",
"temporalLsqtQuery",
"(",
"String",
"temporalCollection",
",",
"String",
"timestamp",
",",
"double",
"weight",
",",
"String",
"...",
"options",
")",
"{",
"if",
"(",
"temporalCollection",
"==",
"null",
")",
"throw",
"new",
"Il... | Matches documents with LSQT prior to timestamp
@param temporalCollection the temporal collection to query
@param timestamp timestamp in ISO 8601 format - documents with lsqt equal to or
prior to this timestamp will match
@param weight the weight for this query
@param options string options from the list for
<a href="http://docs.marklogic.com/cts:lsqt-query">cts:lsqt-query calls</a>
@return a query to filter by lsqt
@see <a href="http://docs.marklogic.com/cts:lsqt-query">cts:lsqt-query</a>
@see <a href="http://docs.marklogic.com/guide/search-dev/structured-query#id_85930">
Structured Queries: lsqt-query</a> | [
"Matches",
"documents",
"with",
"LSQT",
"prior",
"to",
"timestamp"
] | train | https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L2866-L2871 |
qiniu/java-sdk | src/main/java/com/qiniu/storage/BucketManager.java | BucketManager.fetch | public FetchRet fetch(String url, String bucket, String key) throws QiniuException {
String resource = UrlSafeBase64.encodeToString(url);
String to = encodedEntry(bucket, key);
String path = String.format("/fetch/%s/to/%s", resource, to);
Response res = ioPost(bucket, path);
if (!res.isOK()) {
throw new QiniuException(res);
}
FetchRet fetchRet = res.jsonToObject(FetchRet.class);
res.close();
return fetchRet;
} | java | public FetchRet fetch(String url, String bucket, String key) throws QiniuException {
String resource = UrlSafeBase64.encodeToString(url);
String to = encodedEntry(bucket, key);
String path = String.format("/fetch/%s/to/%s", resource, to);
Response res = ioPost(bucket, path);
if (!res.isOK()) {
throw new QiniuException(res);
}
FetchRet fetchRet = res.jsonToObject(FetchRet.class);
res.close();
return fetchRet;
} | [
"public",
"FetchRet",
"fetch",
"(",
"String",
"url",
",",
"String",
"bucket",
",",
"String",
"key",
")",
"throws",
"QiniuException",
"{",
"String",
"resource",
"=",
"UrlSafeBase64",
".",
"encodeToString",
"(",
"url",
")",
";",
"String",
"to",
"=",
"encodedEn... | 抓取指定地址的文件,以指定名称保存在指定空间
要求指定url可访问,大文件不建议使用此接口抓取。可先下载再上传
@param url 待抓取的文件链接
@param bucket 文件抓取后保存的空间
@param key 文件抓取后保存的文件名
@throws QiniuException | [
"抓取指定地址的文件,以指定名称保存在指定空间",
"要求指定url可访问,大文件不建议使用此接口抓取。可先下载再上传"
] | train | https://github.com/qiniu/java-sdk/blob/6c05f3fb718403a496c725b048e9241f80171499/src/main/java/com/qiniu/storage/BucketManager.java#L449-L460 |
osglworks/java-tool | src/main/java/org/osgl/Lang.java | F4.andThen | public <T> F4<P1, P2, P3, P4, T> andThen(final Function<? super R, ? extends T> f) {
E.NPE(f);
final Func4<P1, P2, P3, P4, R> me = this;
return new F4<P1, P2, P3, P4, T>() {
@Override
public T apply(P1 p1, P2 p2, P3 p3, P4 p4) {
R r = me.apply(p1, p2, p3, p4);
return f.apply(r);
}
};
} | java | public <T> F4<P1, P2, P3, P4, T> andThen(final Function<? super R, ? extends T> f) {
E.NPE(f);
final Func4<P1, P2, P3, P4, R> me = this;
return new F4<P1, P2, P3, P4, T>() {
@Override
public T apply(P1 p1, P2 p2, P3 p3, P4 p4) {
R r = me.apply(p1, p2, p3, p4);
return f.apply(r);
}
};
} | [
"public",
"<",
"T",
">",
"F4",
"<",
"P1",
",",
"P2",
",",
"P3",
",",
"P4",
",",
"T",
">",
"andThen",
"(",
"final",
"Function",
"<",
"?",
"super",
"R",
",",
"?",
"extends",
"T",
">",
"f",
")",
"{",
"E",
".",
"NPE",
"(",
"f",
")",
";",
"fin... | Returns a composed function from this function and the specified function that takes the
result of this function. When applying the composed function, this function is applied
first to given parameter and then the specified function is applied to the result of
this function.
@param f
the function takes the <code>R</code> type parameter and return <code>T</code>
type result
@param <T>
the return type of function {@code f}
@return the composed function
@throws NullPointerException
if <code>f</code> is null | [
"Returns",
"a",
"composed",
"function",
"from",
"this",
"function",
"and",
"the",
"specified",
"function",
"that",
"takes",
"the",
"result",
"of",
"this",
"function",
".",
"When",
"applying",
"the",
"composed",
"function",
"this",
"function",
"is",
"applied",
... | train | https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L1550-L1560 |
google/gson | gson/src/main/java/com/google/gson/Gson.java | Gson.fromJson | @SuppressWarnings("unchecked")
public <T> T fromJson(JsonElement json, Type typeOfT) throws JsonSyntaxException {
if (json == null) {
return null;
}
return (T) fromJson(new JsonTreeReader(json), typeOfT);
} | java | @SuppressWarnings("unchecked")
public <T> T fromJson(JsonElement json, Type typeOfT) throws JsonSyntaxException {
if (json == null) {
return null;
}
return (T) fromJson(new JsonTreeReader(json), typeOfT);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"T",
">",
"T",
"fromJson",
"(",
"JsonElement",
"json",
",",
"Type",
"typeOfT",
")",
"throws",
"JsonSyntaxException",
"{",
"if",
"(",
"json",
"==",
"null",
")",
"{",
"return",
"null",
";",
... | This method deserializes the Json read from the specified parse tree into an object of the
specified type. This method is useful if the specified object is a generic type. For
non-generic objects, use {@link #fromJson(JsonElement, Class)} instead.
@param <T> the type of the desired object
@param json the root of the parse tree of {@link JsonElement}s from which the object is to
be deserialized
@param typeOfT The specific genericized type of src. You can obtain this type by using the
{@link com.google.gson.reflect.TypeToken} class. For example, to get the type for
{@code Collection<Foo>}, you should use:
<pre>
Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
</pre>
@return an object of type T from the json. Returns {@code null} if {@code json} is {@code null}
or if {@code json} is empty.
@throws JsonSyntaxException if json is not a valid representation for an object of type typeOfT
@since 1.3 | [
"This",
"method",
"deserializes",
"the",
"Json",
"read",
"from",
"the",
"specified",
"parse",
"tree",
"into",
"an",
"object",
"of",
"the",
"specified",
"type",
".",
"This",
"method",
"is",
"useful",
"if",
"the",
"specified",
"object",
"is",
"a",
"generic",
... | train | https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/gson/src/main/java/com/google/gson/Gson.java#L998-L1004 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/obl/StateSet.java | StateSet.addObligation | public void addObligation(final Obligation obligation, int basicBlockId) throws ObligationAcquiredOrReleasedInLoopException {
Map<ObligationSet, State> updatedStateMap = new HashMap<>();
if (stateMap.isEmpty()) {
State s = new State(factory);
s.getObligationSet().add(obligation);
updatedStateMap.put(s.getObligationSet(), s);
} else {
for (State state : stateMap.values()) {
checkCircularity(state, obligation, basicBlockId);
state.getObligationSet().add(obligation);
updatedStateMap.put(state.getObligationSet(), state);
}
}
replaceMap(updatedStateMap);
} | java | public void addObligation(final Obligation obligation, int basicBlockId) throws ObligationAcquiredOrReleasedInLoopException {
Map<ObligationSet, State> updatedStateMap = new HashMap<>();
if (stateMap.isEmpty()) {
State s = new State(factory);
s.getObligationSet().add(obligation);
updatedStateMap.put(s.getObligationSet(), s);
} else {
for (State state : stateMap.values()) {
checkCircularity(state, obligation, basicBlockId);
state.getObligationSet().add(obligation);
updatedStateMap.put(state.getObligationSet(), state);
}
}
replaceMap(updatedStateMap);
} | [
"public",
"void",
"addObligation",
"(",
"final",
"Obligation",
"obligation",
",",
"int",
"basicBlockId",
")",
"throws",
"ObligationAcquiredOrReleasedInLoopException",
"{",
"Map",
"<",
"ObligationSet",
",",
"State",
">",
"updatedStateMap",
"=",
"new",
"HashMap",
"<>",
... | Add an obligation to every State in the StateSet.
@param obligation
the obligation to add
@param basicBlockId
the id of the basic block (path component) adding the
obligation | [
"Add",
"an",
"obligation",
"to",
"every",
"State",
"in",
"the",
"StateSet",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/obl/StateSet.java#L189-L204 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java | BufferUtil.readStr | public static String readStr(ByteBuffer buffer, Charset charset) {
return StrUtil.str(readBytes(buffer), charset);
} | java | public static String readStr(ByteBuffer buffer, Charset charset) {
return StrUtil.str(readBytes(buffer), charset);
} | [
"public",
"static",
"String",
"readStr",
"(",
"ByteBuffer",
"buffer",
",",
"Charset",
"charset",
")",
"{",
"return",
"StrUtil",
".",
"str",
"(",
"readBytes",
"(",
"buffer",
")",
",",
"charset",
")",
";",
"}"
] | 读取剩余部分并转为字符串
@param buffer ByteBuffer
@param charset 编码
@return 字符串
@since 4.5.0 | [
"读取剩余部分并转为字符串"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/BufferUtil.java#L89-L91 |
xhsun/gw2wrapper | src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java | SynchronousRequest.getQuagganInfo | public List<Map<String, String>> getQuagganInfo(String[] ids) throws GuildWars2Exception {
isParamValid(new ParamChecker(ids));
try {
Response<List<Map<String, String>>> response = gw2API.getQuagganInfo(processIds(ids)).execute();
if (!response.isSuccessful()) throwError(response.code(), response.errorBody());
return response.body();
} catch (IOException e) {
throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage());
}
} | java | public List<Map<String, String>> getQuagganInfo(String[] ids) throws GuildWars2Exception {
isParamValid(new ParamChecker(ids));
try {
Response<List<Map<String, String>>> response = gw2API.getQuagganInfo(processIds(ids)).execute();
if (!response.isSuccessful()) throwError(response.code(), response.errorBody());
return response.body();
} catch (IOException e) {
throw new GuildWars2Exception(ErrorCode.Network, "Network Error: " + e.getMessage());
}
} | [
"public",
"List",
"<",
"Map",
"<",
"String",
",",
"String",
">",
">",
"getQuagganInfo",
"(",
"String",
"[",
"]",
"ids",
")",
"throws",
"GuildWars2Exception",
"{",
"isParamValid",
"(",
"new",
"ParamChecker",
"(",
"ids",
")",
")",
";",
"try",
"{",
"Respons... | For more info on quaggans API go <a href="https://wiki.guildwars2.com/wiki/API:2/quaggans">here</a><br/>
@param ids list of quaggan id(s)
@return list of map of id and url
@throws GuildWars2Exception see {@link ErrorCode} for detail | [
"For",
"more",
"info",
"on",
"quaggans",
"API",
"go",
"<a",
"href",
"=",
"https",
":",
"//",
"wiki",
".",
"guildwars2",
".",
"com",
"/",
"wiki",
"/",
"API",
":",
"2",
"/",
"quaggans",
">",
"here<",
"/",
"a",
">",
"<br",
"/",
">"
] | train | https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/SynchronousRequest.java#L2993-L3002 |
carrotsearch/hppc | hppc/src/main/templates/com/carrotsearch/hppc/KTypeVTypeHashMap.java | KTypeVTypeHashMap.putOrAdd | @Override
public VType putOrAdd(KType key, VType putValue, VType incrementValue) {
assert assigned < mask + 1;
int keyIndex = indexOf(key);
if (indexExists(keyIndex)) {
putValue = Intrinsics.<VType> add(Intrinsics.<VType> cast(values[keyIndex]), incrementValue);
indexReplace(keyIndex, putValue);
} else {
indexInsert(keyIndex, key, putValue);
}
return putValue;
} | java | @Override
public VType putOrAdd(KType key, VType putValue, VType incrementValue) {
assert assigned < mask + 1;
int keyIndex = indexOf(key);
if (indexExists(keyIndex)) {
putValue = Intrinsics.<VType> add(Intrinsics.<VType> cast(values[keyIndex]), incrementValue);
indexReplace(keyIndex, putValue);
} else {
indexInsert(keyIndex, key, putValue);
}
return putValue;
} | [
"@",
"Override",
"public",
"VType",
"putOrAdd",
"(",
"KType",
"key",
",",
"VType",
"putValue",
",",
"VType",
"incrementValue",
")",
"{",
"assert",
"assigned",
"<",
"mask",
"+",
"1",
";",
"int",
"keyIndex",
"=",
"indexOf",
"(",
"key",
")",
";",
"if",
"(... | If <code>key</code> exists, <code>putValue</code> is inserted into the map,
otherwise any existing value is incremented by <code>additionValue</code>.
@param key
The key of the value to adjust.
@param putValue
The value to put if <code>key</code> does not exist.
@param incrementValue
The value to add to the existing value if <code>key</code> exists.
@return Returns the current value associated with <code>key</code> (after
changes). | [
"If",
"<code",
">",
"key<",
"/",
"code",
">",
"exists",
"<code",
">",
"putValue<",
"/",
"code",
">",
"is",
"inserted",
"into",
"the",
"map",
"otherwise",
"any",
"existing",
"value",
"is",
"incremented",
"by",
"<code",
">",
"additionValue<",
"/",
"code",
... | train | https://github.com/carrotsearch/hppc/blob/e359e9da358e846fcbffc64a765611df954ba3f6/hppc/src/main/templates/com/carrotsearch/hppc/KTypeVTypeHashMap.java#L251-L263 |
threerings/narya | core/src/main/java/com/threerings/presents/server/net/PresentsConnectionManager.java | PresentsConnectionManager.startOutgoingConnection | protected void startOutgoingConnection (final Connection conn, InetSocketAddress addr)
{
final SocketChannel sockchan = conn.getChannel();
try {
// register our channel with the selector (if this fails, we abandon ship immediately)
conn.selkey = sockchan.register(_selector, SelectionKey.OP_CONNECT);
// start our connection process (now if we fail we need to clean things up)
NetEventHandler handler;
if (sockchan.connect(addr)) {
_outConnValidator.validateOutgoing(sockchan); // may throw
// it is possible even for a non-blocking socket to connect immediately, in which
// case we stick the connection in as its event handler immediately
handler = conn;
} else {
// otherwise we wire up a special event handler that will wait for our socket to
// finish the connection process and then wire things up fully
handler = new OutgoingConnectionHandler(conn);
}
_handlers.put(conn.selkey, handler);
} catch (IOException ioe) {
log.warning("Failed to initiate connection for " + sockchan + ".", ioe);
conn.connectFailure(ioe); // nothing else to clean up
}
} | java | protected void startOutgoingConnection (final Connection conn, InetSocketAddress addr)
{
final SocketChannel sockchan = conn.getChannel();
try {
// register our channel with the selector (if this fails, we abandon ship immediately)
conn.selkey = sockchan.register(_selector, SelectionKey.OP_CONNECT);
// start our connection process (now if we fail we need to clean things up)
NetEventHandler handler;
if (sockchan.connect(addr)) {
_outConnValidator.validateOutgoing(sockchan); // may throw
// it is possible even for a non-blocking socket to connect immediately, in which
// case we stick the connection in as its event handler immediately
handler = conn;
} else {
// otherwise we wire up a special event handler that will wait for our socket to
// finish the connection process and then wire things up fully
handler = new OutgoingConnectionHandler(conn);
}
_handlers.put(conn.selkey, handler);
} catch (IOException ioe) {
log.warning("Failed to initiate connection for " + sockchan + ".", ioe);
conn.connectFailure(ioe); // nothing else to clean up
}
} | [
"protected",
"void",
"startOutgoingConnection",
"(",
"final",
"Connection",
"conn",
",",
"InetSocketAddress",
"addr",
")",
"{",
"final",
"SocketChannel",
"sockchan",
"=",
"conn",
".",
"getChannel",
"(",
")",
";",
"try",
"{",
"// register our channel with the selector ... | Starts the connection process for an outgoing connection. This is called as part of the
conmgr tick for any pending outgoing connections. | [
"Starts",
"the",
"connection",
"process",
"for",
"an",
"outgoing",
"connection",
".",
"This",
"is",
"called",
"as",
"part",
"of",
"the",
"conmgr",
"tick",
"for",
"any",
"pending",
"outgoing",
"connections",
"."
] | train | https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/server/net/PresentsConnectionManager.java#L384-L410 |
pressgang-ccms/PressGangCCMSBuilder | src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java | DocBookBuildUtilities.processTopicID | public static void processTopicID(final BuildData buildData, final ITopicNode topicNode, final Document doc) {
final BaseTopicWrapper<?> topic = topicNode.getTopic();
// Ignore info topics
if (!topic.hasTag(buildData.getServerEntities().getInfoTagId())) {
// Get the id value
final String errorXRefID = ((SpecNode) topicNode).getUniqueLinkId(buildData.isUseFixedUrls());
// Set the id
setDOMElementId(buildData.getDocBookVersion(), doc.getDocumentElement(), errorXRefID);
}
// Add the remap parameter
final Integer topicId = topicNode.getDBId();
doc.getDocumentElement().setAttribute("remap", "TID_" + topicId);
} | java | public static void processTopicID(final BuildData buildData, final ITopicNode topicNode, final Document doc) {
final BaseTopicWrapper<?> topic = topicNode.getTopic();
// Ignore info topics
if (!topic.hasTag(buildData.getServerEntities().getInfoTagId())) {
// Get the id value
final String errorXRefID = ((SpecNode) topicNode).getUniqueLinkId(buildData.isUseFixedUrls());
// Set the id
setDOMElementId(buildData.getDocBookVersion(), doc.getDocumentElement(), errorXRefID);
}
// Add the remap parameter
final Integer topicId = topicNode.getDBId();
doc.getDocumentElement().setAttribute("remap", "TID_" + topicId);
} | [
"public",
"static",
"void",
"processTopicID",
"(",
"final",
"BuildData",
"buildData",
",",
"final",
"ITopicNode",
"topicNode",
",",
"final",
"Document",
"doc",
")",
"{",
"final",
"BaseTopicWrapper",
"<",
"?",
">",
"topic",
"=",
"topicNode",
".",
"getTopic",
"(... | Sets the topic xref id to the topic database id.
@param buildData Information and data structures for the build.
@param topicNode The topic to be used to set the id attribute.
@param doc The document object for the topics XML. | [
"Sets",
"the",
"topic",
"xref",
"id",
"to",
"the",
"topic",
"database",
"id",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/utils/DocBookBuildUtilities.java#L541-L556 |
jboss/jboss-jstl-api_spec | src/main/java/org/apache/taglibs/standard/tag/common/core/ForTokensSupport.java | ForTokensSupport.prepare | @Override
protected void prepare() throws JspTagException {
if (items instanceof ValueExpression) {
deferredExpression = (ValueExpression) items;
itemsValueIteratedExpression = new IteratedExpression(deferredExpression, getDelims());
currentIndex = 0;
Object originalValue = deferredExpression.getValue(pageContext.getELContext());
if (originalValue instanceof String) {
st = new StringTokenizer((String) originalValue, delims);
} else {
throw new JspTagException();
}
} else {
st = new StringTokenizer((String) items, delims);
}
} | java | @Override
protected void prepare() throws JspTagException {
if (items instanceof ValueExpression) {
deferredExpression = (ValueExpression) items;
itemsValueIteratedExpression = new IteratedExpression(deferredExpression, getDelims());
currentIndex = 0;
Object originalValue = deferredExpression.getValue(pageContext.getELContext());
if (originalValue instanceof String) {
st = new StringTokenizer((String) originalValue, delims);
} else {
throw new JspTagException();
}
} else {
st = new StringTokenizer((String) items, delims);
}
} | [
"@",
"Override",
"protected",
"void",
"prepare",
"(",
")",
"throws",
"JspTagException",
"{",
"if",
"(",
"items",
"instanceof",
"ValueExpression",
")",
"{",
"deferredExpression",
"=",
"(",
"ValueExpression",
")",
"items",
";",
"itemsValueIteratedExpression",
"=",
"... | /*
These just create and use a StringTokenizer.
We inherit semantics and Javadoc from LoopTagSupport. | [
"/",
"*",
"These",
"just",
"create",
"and",
"use",
"a",
"StringTokenizer",
".",
"We",
"inherit",
"semantics",
"and",
"Javadoc",
"from",
"LoopTagSupport",
"."
] | train | https://github.com/jboss/jboss-jstl-api_spec/blob/4ad412ae5be1ae606b8d33c188cb3d98bfcbe84c/src/main/java/org/apache/taglibs/standard/tag/common/core/ForTokensSupport.java#L71-L87 |
citrusframework/citrus | modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/DomXmlMessageValidator.java | DomXmlMessageValidator.doText | private void doText(Element received, Element source) {
if (log.isDebugEnabled()) {
log.debug("Validating node value for element: " + received.getLocalName());
}
String receivedText = DomUtils.getTextValue(received);
String sourceText = DomUtils.getTextValue(source);
if (receivedText != null) {
Assert.isTrue(sourceText != null,
ValidationUtils.buildValueMismatchErrorMessage("Node value not equal for element '"
+ received.getLocalName() + "'", null, receivedText.trim()));
Assert.isTrue(receivedText.trim().equals(sourceText.trim()),
ValidationUtils.buildValueMismatchErrorMessage("Node value not equal for element '"
+ received.getLocalName() + "'", sourceText.trim(),
receivedText.trim()));
} else {
Assert.isTrue(sourceText == null,
ValidationUtils.buildValueMismatchErrorMessage("Node value not equal for element '"
+ received.getLocalName() + "'", sourceText.trim(), null));
}
if (log.isDebugEnabled()) {
log.debug("Node value '" + receivedText.trim() + "': OK");
}
} | java | private void doText(Element received, Element source) {
if (log.isDebugEnabled()) {
log.debug("Validating node value for element: " + received.getLocalName());
}
String receivedText = DomUtils.getTextValue(received);
String sourceText = DomUtils.getTextValue(source);
if (receivedText != null) {
Assert.isTrue(sourceText != null,
ValidationUtils.buildValueMismatchErrorMessage("Node value not equal for element '"
+ received.getLocalName() + "'", null, receivedText.trim()));
Assert.isTrue(receivedText.trim().equals(sourceText.trim()),
ValidationUtils.buildValueMismatchErrorMessage("Node value not equal for element '"
+ received.getLocalName() + "'", sourceText.trim(),
receivedText.trim()));
} else {
Assert.isTrue(sourceText == null,
ValidationUtils.buildValueMismatchErrorMessage("Node value not equal for element '"
+ received.getLocalName() + "'", sourceText.trim(), null));
}
if (log.isDebugEnabled()) {
log.debug("Node value '" + receivedText.trim() + "': OK");
}
} | [
"private",
"void",
"doText",
"(",
"Element",
"received",
",",
"Element",
"source",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Validating node value for element: \"",
"+",
"received",
".",
"getLocalName",... | Handle text node during validation.
@param received
@param source | [
"Handle",
"text",
"node",
"during",
"validation",
"."
] | train | https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/validation/xml/DomXmlMessageValidator.java#L548-L574 |
headius/invokebinder | src/main/java/com/headius/invokebinder/Binder.java | Binder.from | public static Binder from(MethodHandles.Lookup lookup, Class<?> returnType, Class<?> argType0, Class<?>... argTypes) {
return from(lookup, MethodType.methodType(returnType, argType0, argTypes));
} | java | public static Binder from(MethodHandles.Lookup lookup, Class<?> returnType, Class<?> argType0, Class<?>... argTypes) {
return from(lookup, MethodType.methodType(returnType, argType0, argTypes));
} | [
"public",
"static",
"Binder",
"from",
"(",
"MethodHandles",
".",
"Lookup",
"lookup",
",",
"Class",
"<",
"?",
">",
"returnType",
",",
"Class",
"<",
"?",
">",
"argType0",
",",
"Class",
"<",
"?",
">",
"...",
"argTypes",
")",
"{",
"return",
"from",
"(",
... | Construct a new Binder using a return type and argument types.
@param lookup the Lookup context to use for direct handles
@param returnType the return type of the incoming signature
@param argType0 the first argument type of the incoming signature
@param argTypes the remaining argument types of the incoming signature
@return the Binder object | [
"Construct",
"a",
"new",
"Binder",
"using",
"a",
"return",
"type",
"and",
"argument",
"types",
"."
] | train | https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Binder.java#L241-L243 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ComparableTimSort.java | ComparableTimSort.reverseRange | private static void reverseRange(Object[] a, int lo, int hi) {
hi--;
while (lo < hi) {
Object t = a[lo];
a[lo++] = a[hi];
a[hi--] = t;
}
} | java | private static void reverseRange(Object[] a, int lo, int hi) {
hi--;
while (lo < hi) {
Object t = a[lo];
a[lo++] = a[hi];
a[hi--] = t;
}
} | [
"private",
"static",
"void",
"reverseRange",
"(",
"Object",
"[",
"]",
"a",
",",
"int",
"lo",
",",
"int",
"hi",
")",
"{",
"hi",
"--",
";",
"while",
"(",
"lo",
"<",
"hi",
")",
"{",
"Object",
"t",
"=",
"a",
"[",
"lo",
"]",
";",
"a",
"[",
"lo",
... | Reverse the specified range of the specified array.
@param a the array in which a range is to be reversed
@param lo the index of the first element in the range to be reversed
@param hi the index after the last element in the range to be reversed | [
"Reverse",
"the",
"specified",
"range",
"of",
"the",
"specified",
"array",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/ComparableTimSort.java#L339-L346 |
apache/reef | lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/LocalRuntimeDriverConfigurationGenerator.java | LocalRuntimeDriverConfigurationGenerator.writeConfiguration | public Configuration writeConfiguration(final File jobFolder,
final String jobId,
final String clientRemoteId) throws IOException {
final File driverFolder = new File(jobFolder, PreparedDriverFolderLauncher.DRIVER_FOLDER_NAME);
final Configuration driverConfiguration1 = driverConfigurationProvider
.getDriverConfiguration(jobFolder.toURI(), clientRemoteId,
jobId, Constants.DRIVER_CONFIGURATION_WITH_HTTP_AND_NAMESERVER);
final ConfigurationBuilder configurationBuilder = Tang.Factory.getTang().newConfigurationBuilder();
for (final ConfigurationProvider configurationProvider : this.configurationProviders) {
configurationBuilder.addConfiguration(configurationProvider.getConfiguration());
}
final Configuration providedConfigurations = configurationBuilder.build();
final Configuration driverConfiguration = Configurations.merge(
driverConfiguration1,
Tang.Factory.getTang()
.newConfigurationBuilder()
.bindNamedParameter(JobSubmissionDirectory.class, driverFolder.toString())
.build(),
providedConfigurations);
final File driverConfigurationFile = new File(driverFolder, fileNames.getDriverConfigurationPath());
configurationSerializer.toFile(driverConfiguration, driverConfigurationFile);
return driverConfiguration;
} | java | public Configuration writeConfiguration(final File jobFolder,
final String jobId,
final String clientRemoteId) throws IOException {
final File driverFolder = new File(jobFolder, PreparedDriverFolderLauncher.DRIVER_FOLDER_NAME);
final Configuration driverConfiguration1 = driverConfigurationProvider
.getDriverConfiguration(jobFolder.toURI(), clientRemoteId,
jobId, Constants.DRIVER_CONFIGURATION_WITH_HTTP_AND_NAMESERVER);
final ConfigurationBuilder configurationBuilder = Tang.Factory.getTang().newConfigurationBuilder();
for (final ConfigurationProvider configurationProvider : this.configurationProviders) {
configurationBuilder.addConfiguration(configurationProvider.getConfiguration());
}
final Configuration providedConfigurations = configurationBuilder.build();
final Configuration driverConfiguration = Configurations.merge(
driverConfiguration1,
Tang.Factory.getTang()
.newConfigurationBuilder()
.bindNamedParameter(JobSubmissionDirectory.class, driverFolder.toString())
.build(),
providedConfigurations);
final File driverConfigurationFile = new File(driverFolder, fileNames.getDriverConfigurationPath());
configurationSerializer.toFile(driverConfiguration, driverConfigurationFile);
return driverConfiguration;
} | [
"public",
"Configuration",
"writeConfiguration",
"(",
"final",
"File",
"jobFolder",
",",
"final",
"String",
"jobId",
",",
"final",
"String",
"clientRemoteId",
")",
"throws",
"IOException",
"{",
"final",
"File",
"driverFolder",
"=",
"new",
"File",
"(",
"jobFolder",... | Writes driver configuration to disk.
@param jobFolder The folder in which the job is staged.
@param jobId id of the job to be submitted
@param clientRemoteId The client remote id
@return the configuration
@throws IOException | [
"Writes",
"driver",
"configuration",
"to",
"disk",
"."
] | train | https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-bridge-client/src/main/java/org/apache/reef/bridge/client/LocalRuntimeDriverConfigurationGenerator.java#L69-L92 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/factory/geo/FactoryMultiViewRobust.java | FactoryMultiViewRobust.baselineRansac | public static ModelMatcherMultiview<Se3_F64, AssociatedPair> baselineRansac(@Nullable ConfigEssential essential,
@Nonnull ConfigRansac ransac )
{
if( essential == null )
essential = new ConfigEssential();
else
essential.checkValidity();
ransac.checkValidity();
if( essential.errorModel != ConfigEssential.ErrorModel.GEOMETRIC) {
throw new RuntimeException("Error model has to be Euclidean");
}
Estimate1ofEpipolar epipolar = FactoryMultiView.
essential_1(essential.which, essential.numResolve);
Triangulate2ViewsMetric triangulate = FactoryMultiView.triangulate2ViewMetric(
new ConfigTriangulation(ConfigTriangulation.Type.GEOMETRIC));
ModelManager<Se3_F64> manager = new ModelManagerSe3_F64();
ModelGenerator<Se3_F64, AssociatedPair> generateEpipolarMotion =
new Se3FromEssentialGenerator(epipolar, triangulate);
DistanceFromModelMultiView<Se3_F64, AssociatedPair> distanceSe3 =
new DistanceSe3SymmetricSq(triangulate);
double ransacTOL = ransac.inlierThreshold * ransac.inlierThreshold * 2.0;
return new RansacMultiView<>(ransac.randSeed, manager, generateEpipolarMotion, distanceSe3,
ransac.maxIterations, ransacTOL);
} | java | public static ModelMatcherMultiview<Se3_F64, AssociatedPair> baselineRansac(@Nullable ConfigEssential essential,
@Nonnull ConfigRansac ransac )
{
if( essential == null )
essential = new ConfigEssential();
else
essential.checkValidity();
ransac.checkValidity();
if( essential.errorModel != ConfigEssential.ErrorModel.GEOMETRIC) {
throw new RuntimeException("Error model has to be Euclidean");
}
Estimate1ofEpipolar epipolar = FactoryMultiView.
essential_1(essential.which, essential.numResolve);
Triangulate2ViewsMetric triangulate = FactoryMultiView.triangulate2ViewMetric(
new ConfigTriangulation(ConfigTriangulation.Type.GEOMETRIC));
ModelManager<Se3_F64> manager = new ModelManagerSe3_F64();
ModelGenerator<Se3_F64, AssociatedPair> generateEpipolarMotion =
new Se3FromEssentialGenerator(epipolar, triangulate);
DistanceFromModelMultiView<Se3_F64, AssociatedPair> distanceSe3 =
new DistanceSe3SymmetricSq(triangulate);
double ransacTOL = ransac.inlierThreshold * ransac.inlierThreshold * 2.0;
return new RansacMultiView<>(ransac.randSeed, manager, generateEpipolarMotion, distanceSe3,
ransac.maxIterations, ransacTOL);
} | [
"public",
"static",
"ModelMatcherMultiview",
"<",
"Se3_F64",
",",
"AssociatedPair",
">",
"baselineRansac",
"(",
"@",
"Nullable",
"ConfigEssential",
"essential",
",",
"@",
"Nonnull",
"ConfigRansac",
"ransac",
")",
"{",
"if",
"(",
"essential",
"==",
"null",
")",
"... | Robust solution for estimating the stereo baseline {@link Se3_F64} using epipolar geometry from two views with
{@link RansacMultiView}. Input observations are in normalized image coordinates.
<p>See code for all the details.</p>
@param essential Essential matrix estimation parameters.
@param ransac Parameters for RANSAC. Can't be null.
@return Robust Se3_F64 estimator | [
"Robust",
"solution",
"for",
"estimating",
"the",
"stereo",
"baseline",
"{",
"@link",
"Se3_F64",
"}",
"using",
"epipolar",
"geometry",
"from",
"two",
"views",
"with",
"{",
"@link",
"RansacMultiView",
"}",
".",
"Input",
"observations",
"are",
"in",
"normalized",
... | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/factory/geo/FactoryMultiViewRobust.java#L212-L241 |
linkedin/dexmaker | dexmaker/src/main/java/com/android/dx/Code.java | Code.newArray | public <T> void newArray(Local<T> target, Local<Integer> length) {
addInstruction(new ThrowingCstInsn(Rops.opNewArray(target.type.ropType), sourcePosition,
RegisterSpecList.make(length.spec()), catches, target.type.constant));
moveResult(target, true);
} | java | public <T> void newArray(Local<T> target, Local<Integer> length) {
addInstruction(new ThrowingCstInsn(Rops.opNewArray(target.type.ropType), sourcePosition,
RegisterSpecList.make(length.spec()), catches, target.type.constant));
moveResult(target, true);
} | [
"public",
"<",
"T",
">",
"void",
"newArray",
"(",
"Local",
"<",
"T",
">",
"target",
",",
"Local",
"<",
"Integer",
">",
"length",
")",
"{",
"addInstruction",
"(",
"new",
"ThrowingCstInsn",
"(",
"Rops",
".",
"opNewArray",
"(",
"target",
".",
"type",
".",... | Assigns {@code target} to a newly allocated array of length {@code
length}. The array's type is the same as {@code target}'s type. | [
"Assigns",
"{"
] | train | https://github.com/linkedin/dexmaker/blob/c58ffebcbb2564c7d1fa6fb58b48f351c330296d/dexmaker/src/main/java/com/android/dx/Code.java#L794-L798 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/svd/implicitqr/SvdImplicitQrAlgorithm_DDRM.java | SvdImplicitQrAlgorithm_DDRM.updateRotator | protected void updateRotator(DMatrixRMaj Q , int m, int n, double c, double s) {
int rowA = m*Q.numCols;
int rowB = n*Q.numCols;
// for( int i = 0; i < Q.numCols; i++ ) {
// double a = Q.get(rowA+i);
// double b = Q.get(rowB+i);
// Q.set( rowA+i, c*a + s*b);
// Q.set( rowB+i, -s*a + c*b);
// }
// System.out.println("------ AFter Update Rotator "+m+" "+n);
// Q.print();
// System.out.println();
int endA = rowA + Q.numCols;
for( ; rowA != endA; rowA++ , rowB++ ) {
double a = Q.get(rowA);
double b = Q.get(rowB);
Q.set(rowA, c*a + s*b);
Q.set(rowB, -s*a + c*b);
}
} | java | protected void updateRotator(DMatrixRMaj Q , int m, int n, double c, double s) {
int rowA = m*Q.numCols;
int rowB = n*Q.numCols;
// for( int i = 0; i < Q.numCols; i++ ) {
// double a = Q.get(rowA+i);
// double b = Q.get(rowB+i);
// Q.set( rowA+i, c*a + s*b);
// Q.set( rowB+i, -s*a + c*b);
// }
// System.out.println("------ AFter Update Rotator "+m+" "+n);
// Q.print();
// System.out.println();
int endA = rowA + Q.numCols;
for( ; rowA != endA; rowA++ , rowB++ ) {
double a = Q.get(rowA);
double b = Q.get(rowB);
Q.set(rowA, c*a + s*b);
Q.set(rowB, -s*a + c*b);
}
} | [
"protected",
"void",
"updateRotator",
"(",
"DMatrixRMaj",
"Q",
",",
"int",
"m",
",",
"int",
"n",
",",
"double",
"c",
",",
"double",
"s",
")",
"{",
"int",
"rowA",
"=",
"m",
"*",
"Q",
".",
"numCols",
";",
"int",
"rowB",
"=",
"n",
"*",
"Q",
".",
"... | Multiplied a transpose orthogonal matrix Q by the specified rotator. This is used
to update the U and V matrices. Updating the transpose of the matrix is faster
since it only modifies the rows.
@param Q Orthogonal matrix
@param m Coordinate of rotator.
@param n Coordinate of rotator.
@param c cosine of rotator.
@param s sine of rotator. | [
"Multiplied",
"a",
"transpose",
"orthogonal",
"matrix",
"Q",
"by",
"the",
"specified",
"rotator",
".",
"This",
"is",
"used",
"to",
"update",
"the",
"U",
"and",
"V",
"matrices",
".",
"Updating",
"the",
"transpose",
"of",
"the",
"matrix",
"is",
"faster",
"si... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/svd/implicitqr/SvdImplicitQrAlgorithm_DDRM.java#L384-L404 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/VoiceApi.java | VoiceApi.completeCall | public ApiSuccessResponse completeCall(String id, UserData userData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = completeCallWithHttpInfo(id, userData);
return resp.getData();
} | java | public ApiSuccessResponse completeCall(String id, UserData userData) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = completeCallWithHttpInfo(id, userData);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"completeCall",
"(",
"String",
"id",
",",
"UserData",
"userData",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"completeCallWithHttpInfo",
"(",
"id",
",",
"userData",
")",
";",
"ret... | Complete a call
Complete the specified call by adding information to its user data after it has been released. You should make this request on released calls if you set automatic complete to false in [/activate-channels](/reference/workspace/Session/index.html#activateChannels).
@param id The connection ID of the call. (required)
@param userData Key/value data to include with the call. (required)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Complete",
"a",
"call",
"Complete",
"the",
"specified",
"call",
"by",
"adding",
"information",
"to",
"its",
"user",
"data",
"after",
"it",
"has",
"been",
"released",
".",
"You",
"should",
"make",
"this",
"request",
"on",
"released",
"calls",
"if",
"you",
... | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L815-L818 |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/util/ProjectUtilities.java | ProjectUtilities.removeFindBugsNature | public static void removeFindBugsNature(IProject project, IProgressMonitor monitor) throws CoreException {
if (!hasFindBugsNature(project)) {
return;
}
IProjectDescription description = project.getDescription();
String[] prevNatures = description.getNatureIds();
ArrayList<String> newNaturesList = new ArrayList<>();
for (int i = 0; i < prevNatures.length; i++) {
if (!FindbugsPlugin.NATURE_ID.equals(prevNatures[i])) {
newNaturesList.add(prevNatures[i]);
}
}
String[] newNatures = newNaturesList.toArray(new String[newNaturesList.size()]);
description.setNatureIds(newNatures);
project.setDescription(description, monitor);
} | java | public static void removeFindBugsNature(IProject project, IProgressMonitor monitor) throws CoreException {
if (!hasFindBugsNature(project)) {
return;
}
IProjectDescription description = project.getDescription();
String[] prevNatures = description.getNatureIds();
ArrayList<String> newNaturesList = new ArrayList<>();
for (int i = 0; i < prevNatures.length; i++) {
if (!FindbugsPlugin.NATURE_ID.equals(prevNatures[i])) {
newNaturesList.add(prevNatures[i]);
}
}
String[] newNatures = newNaturesList.toArray(new String[newNaturesList.size()]);
description.setNatureIds(newNatures);
project.setDescription(description, monitor);
} | [
"public",
"static",
"void",
"removeFindBugsNature",
"(",
"IProject",
"project",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"!",
"hasFindBugsNature",
"(",
"project",
")",
")",
"{",
"return",
";",
"}",
"IProjectDescription",
... | Removes the FindBugs nature from a project.
@param project
The project the nature will be removed from.
@param monitor
A progress monitor. Must not be null.
@throws CoreException | [
"Removes",
"the",
"FindBugs",
"nature",
"from",
"a",
"project",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/util/ProjectUtilities.java#L121-L136 |
audit4j/audit4j-core | src/main/java/org/audit4j/core/annotation/DeIdentifyUtil.java | DeIdentifyUtil.deidentifyMiddle | public static String deidentifyMiddle(String str, int start, int end) {
int repeat;
if (end - start > str.length()) {
repeat = str.length();
} else {
repeat = (str.length()- end) - start;
}
return StringUtils.overlay(str, StringUtils.repeat('*', repeat), start, str.length()-end);
} | java | public static String deidentifyMiddle(String str, int start, int end) {
int repeat;
if (end - start > str.length()) {
repeat = str.length();
} else {
repeat = (str.length()- end) - start;
}
return StringUtils.overlay(str, StringUtils.repeat('*', repeat), start, str.length()-end);
} | [
"public",
"static",
"String",
"deidentifyMiddle",
"(",
"String",
"str",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"int",
"repeat",
";",
"if",
"(",
"end",
"-",
"start",
">",
"str",
".",
"length",
"(",
")",
")",
"{",
"repeat",
"=",
"str",
"."... | Deidentify middle.
@param str the str
@param start the start
@param end the end
@return the string
@since 2.0.0 | [
"Deidentify",
"middle",
"."
] | train | https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/annotation/DeIdentifyUtil.java#L129-L138 |
lettuce-io/lettuce-core | src/main/java/io/lettuce/core/internal/TimeoutProvider.java | TimeoutProvider.getTimeoutNs | public long getTimeoutNs(RedisCommand<?, ?, ?> command) {
long timeoutNs = -1;
State state = this.state;
if (state == null) {
state = this.state = new State(timeoutOptionsSupplier.get());
}
if (!state.applyDefaultTimeout) {
timeoutNs = state.timeoutSource.getTimeUnit().toNanos(state.timeoutSource.getTimeout(command));
}
return timeoutNs > 0 ? timeoutNs : defaultTimeoutSupplier.getAsLong();
} | java | public long getTimeoutNs(RedisCommand<?, ?, ?> command) {
long timeoutNs = -1;
State state = this.state;
if (state == null) {
state = this.state = new State(timeoutOptionsSupplier.get());
}
if (!state.applyDefaultTimeout) {
timeoutNs = state.timeoutSource.getTimeUnit().toNanos(state.timeoutSource.getTimeout(command));
}
return timeoutNs > 0 ? timeoutNs : defaultTimeoutSupplier.getAsLong();
} | [
"public",
"long",
"getTimeoutNs",
"(",
"RedisCommand",
"<",
"?",
",",
"?",
",",
"?",
">",
"command",
")",
"{",
"long",
"timeoutNs",
"=",
"-",
"1",
";",
"State",
"state",
"=",
"this",
".",
"state",
";",
"if",
"(",
"state",
"==",
"null",
")",
"{",
... | Returns the timeout in {@link TimeUnit#NANOSECONDS} for {@link RedisCommand}.
@param command the command.
@return timeout in {@link TimeUnit#NANOSECONDS}. | [
"Returns",
"the",
"timeout",
"in",
"{",
"@link",
"TimeUnit#NANOSECONDS",
"}",
"for",
"{",
"@link",
"RedisCommand",
"}",
"."
] | train | https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/internal/TimeoutProvider.java#L62-L76 |
brianwhu/xillium | data/src/main/java/org/xillium/data/persistence/ParametricStatement.java | ParametricStatement.executeUpdate | public int executeUpdate(Connection conn, DataObject object) throws SQLException {
PreparedStatement statement = conn.prepareStatement(_sql);
try {
load(statement, object);
return statement.executeUpdate();
} finally {
statement.close();
}
} | java | public int executeUpdate(Connection conn, DataObject object) throws SQLException {
PreparedStatement statement = conn.prepareStatement(_sql);
try {
load(statement, object);
return statement.executeUpdate();
} finally {
statement.close();
}
} | [
"public",
"int",
"executeUpdate",
"(",
"Connection",
"conn",
",",
"DataObject",
"object",
")",
"throws",
"SQLException",
"{",
"PreparedStatement",
"statement",
"=",
"conn",
".",
"prepareStatement",
"(",
"_sql",
")",
";",
"try",
"{",
"load",
"(",
"statement",
"... | Executes an UPDATE or DELETE statement.
@return the number of rows affected | [
"Executes",
"an",
"UPDATE",
"or",
"DELETE",
"statement",
"."
] | train | https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/persistence/ParametricStatement.java#L271-L279 |
JodaOrg/joda-time | src/main/java/org/joda/time/DateTimeUtils.java | DateTimeUtils.getReadableInterval | public static final ReadableInterval getReadableInterval(ReadableInterval interval) {
if (interval == null) {
long now = DateTimeUtils.currentTimeMillis();
interval = new Interval(now, now);
}
return interval;
} | java | public static final ReadableInterval getReadableInterval(ReadableInterval interval) {
if (interval == null) {
long now = DateTimeUtils.currentTimeMillis();
interval = new Interval(now, now);
}
return interval;
} | [
"public",
"static",
"final",
"ReadableInterval",
"getReadableInterval",
"(",
"ReadableInterval",
"interval",
")",
"{",
"if",
"(",
"interval",
"==",
"null",
")",
"{",
"long",
"now",
"=",
"DateTimeUtils",
".",
"currentTimeMillis",
"(",
")",
";",
"interval",
"=",
... | Gets the interval handling null.
<p>
If the interval is <code>null</code>, an interval representing now
to now in the {@link ISOChronology#getInstance() ISOChronology}
will be returned. Otherwise, the interval specified is returned.
@param interval the interval to use, null means now to now
@return the interval, never null
@since 1.1 | [
"Gets",
"the",
"interval",
"handling",
"null",
".",
"<p",
">",
"If",
"the",
"interval",
"is",
"<code",
">",
"null<",
"/",
"code",
">",
"an",
"interval",
"representing",
"now",
"to",
"now",
"in",
"the",
"{",
"@link",
"ISOChronology#getInstance",
"()",
"ISOC... | train | https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/DateTimeUtils.java#L249-L255 |
blinkfox/zealot | src/main/java/com/blinkfox/zealot/core/builder/SqlInfoBuilder.java | SqlInfoBuilder.buildNormalSql | public SqlInfo buildNormalSql(String fieldText, Object value, String suffix) {
join.append(prefix).append(fieldText).append(suffix);
params.add(value);
return sqlInfo.setJoin(join).setParams(params);
} | java | public SqlInfo buildNormalSql(String fieldText, Object value, String suffix) {
join.append(prefix).append(fieldText).append(suffix);
params.add(value);
return sqlInfo.setJoin(join).setParams(params);
} | [
"public",
"SqlInfo",
"buildNormalSql",
"(",
"String",
"fieldText",
",",
"Object",
"value",
",",
"String",
"suffix",
")",
"{",
"join",
".",
"append",
"(",
"prefix",
")",
".",
"append",
"(",
"fieldText",
")",
".",
"append",
"(",
"suffix",
")",
";",
"params... | 构建普通查询需要的SqlInfo信息.
@param fieldText 数据库字段的文本
@param value 参数值
@param suffix 后缀,如:大于、等于、小于等
@return sqlInfo | [
"构建普通查询需要的SqlInfo信息",
"."
] | train | https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/builder/SqlInfoBuilder.java#L72-L76 |
badamowicz/sonar-hla | sonar-hla-maven-plugin/src/main/java/com/github/badamowicz/sonar/hla/plugin/helper/LogHelper.java | LogHelper.logMeasures | public static void logMeasures(HLAMeasure[] measures, final Logger log) {
log.info("\nAvailable measures are:");
log.info("======================");
for (HLAMeasure currMeasure : measures) {
log.info(" - " + currMeasure.getSonarName());
}
LogHelper.moo(log);
} | java | public static void logMeasures(HLAMeasure[] measures, final Logger log) {
log.info("\nAvailable measures are:");
log.info("======================");
for (HLAMeasure currMeasure : measures) {
log.info(" - " + currMeasure.getSonarName());
}
LogHelper.moo(log);
} | [
"public",
"static",
"void",
"logMeasures",
"(",
"HLAMeasure",
"[",
"]",
"measures",
",",
"final",
"Logger",
"log",
")",
"{",
"log",
".",
"info",
"(",
"\"\\nAvailable measures are:\"",
")",
";",
"log",
".",
"info",
"(",
"\"======================\"",
")",
";",
... | Log the given array of measure objects in some readable way.
@param measures The array of measures.
@param log A {@link Logger} which will be used for output. | [
"Log",
"the",
"given",
"array",
"of",
"measure",
"objects",
"in",
"some",
"readable",
"way",
"."
] | train | https://github.com/badamowicz/sonar-hla/blob/21bd8a853d81966b47e96b518430abbc07ccd5f3/sonar-hla-maven-plugin/src/main/java/com/github/badamowicz/sonar/hla/plugin/helper/LogHelper.java#L54-L65 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.