repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.setUserAsFuture
public FutureAPIResponse setUserAsFuture(String uid, Map<String, Object> properties) throws IOException { return setUserAsFuture(uid, properties, new DateTime()); }
java
public FutureAPIResponse setUserAsFuture(String uid, Map<String, Object> properties) throws IOException { return setUserAsFuture(uid, properties, new DateTime()); }
[ "public", "FutureAPIResponse", "setUserAsFuture", "(", "String", "uid", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "IOException", "{", "return", "setUserAsFuture", "(", "uid", ",", "properties", ",", "new", "DateTime", "(", ")"...
Sends a set user properties request. Same as {@link #setUserAsFuture(String, Map, DateTime) setUserAsFuture(String, Map&lt;String, Object&gt;, DateTime)} except event time is not specified and recorded as the time when the function is called.
[ "Sends", "a", "set", "user", "properties", "request", ".", "Same", "as", "{" ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L310-L313
apache/incubator-druid
core/src/main/java/org/apache/druid/utils/CompressionUtils.java
CompressionUtils.getGzBaseName
public static String getGzBaseName(String fname) { final String reducedFname = Files.getNameWithoutExtension(fname); if (isGz(fname) && !reducedFname.isEmpty()) { return reducedFname; } throw new IAE("[%s] is not a valid gz file name", fname); }
java
public static String getGzBaseName(String fname) { final String reducedFname = Files.getNameWithoutExtension(fname); if (isGz(fname) && !reducedFname.isEmpty()) { return reducedFname; } throw new IAE("[%s] is not a valid gz file name", fname); }
[ "public", "static", "String", "getGzBaseName", "(", "String", "fname", ")", "{", "final", "String", "reducedFname", "=", "Files", ".", "getNameWithoutExtension", "(", "fname", ")", ";", "if", "(", "isGz", "(", "fname", ")", "&&", "!", "reducedFname", ".", ...
Get the file name without the .gz extension @param fname The name of the gzip file @return fname without the ".gz" extension @throws IAE if fname is not a valid "*.gz" file name
[ "Get", "the", "file", "name", "without", "the", ".", "gz", "extension" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/core/src/main/java/org/apache/druid/utils/CompressionUtils.java#L563-L570
alkacon/opencms-core
src/org/opencms/ade/configuration/formatters/CmsFormatterConfigurationCache.java
CmsFormatterConfigurationCache.readFormatter
protected I_CmsFormatterBean readFormatter(CmsUUID structureId) { I_CmsFormatterBean formatterBean = null; CmsResource formatterRes = null; try { formatterRes = m_cms.readResource(structureId); CmsFile formatterFile = m_cms.readFile(formatterRes); CmsFormatterBeanParser parser = new CmsFormatterBeanParser(m_cms, m_settingConfigs); CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, formatterFile); formatterBean = parser.parse(content, formatterRes.getRootPath(), "" + formatterRes.getStructureId()); } catch (Exception e) { if (formatterRes == null) { // normal case if resources get deleted, should not be written to the error channel LOG.info("Could not read formatter with id " + structureId); } else { LOG.error( "Error while trying to read formatter configuration " + formatterRes.getRootPath() + ": " + e.getLocalizedMessage(), e); } } return formatterBean; }
java
protected I_CmsFormatterBean readFormatter(CmsUUID structureId) { I_CmsFormatterBean formatterBean = null; CmsResource formatterRes = null; try { formatterRes = m_cms.readResource(structureId); CmsFile formatterFile = m_cms.readFile(formatterRes); CmsFormatterBeanParser parser = new CmsFormatterBeanParser(m_cms, m_settingConfigs); CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, formatterFile); formatterBean = parser.parse(content, formatterRes.getRootPath(), "" + formatterRes.getStructureId()); } catch (Exception e) { if (formatterRes == null) { // normal case if resources get deleted, should not be written to the error channel LOG.info("Could not read formatter with id " + structureId); } else { LOG.error( "Error while trying to read formatter configuration " + formatterRes.getRootPath() + ": " + e.getLocalizedMessage(), e); } } return formatterBean; }
[ "protected", "I_CmsFormatterBean", "readFormatter", "(", "CmsUUID", "structureId", ")", "{", "I_CmsFormatterBean", "formatterBean", "=", "null", ";", "CmsResource", "formatterRes", "=", "null", ";", "try", "{", "formatterRes", "=", "m_cms", ".", "readResource", "(",...
Reads a formatter given its structure id and returns it, or null if the formatter couldn't be read.<p> @param structureId the structure id of the formatter configuration @return the formatter bean, or null if no formatter could be read for some reason
[ "Reads", "a", "formatter", "given", "its", "structure", "id", "and", "returns", "it", "or", "null", "if", "the", "formatter", "couldn", "t", "be", "read", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/formatters/CmsFormatterConfigurationCache.java#L334-L359
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java
StructureSequenceMatcher.getProteinSequenceForStructure
public static ProteinSequence getProteinSequenceForStructure(Structure struct, Map<Integer,Group> groupIndexPosition ) { if( groupIndexPosition != null) { groupIndexPosition.clear(); } StringBuilder seqStr = new StringBuilder(); for(Chain chain : struct.getChains()) { List<Group> groups = chain.getAtomGroups(); Map<Integer,Integer> chainIndexPosition = new HashMap<Integer, Integer>(); int prevLen = seqStr.length(); // get the sequence for this chain String chainSeq = SeqRes2AtomAligner.getFullAtomSequence(groups, chainIndexPosition, false); seqStr.append(chainSeq); // fix up the position to include previous chains, and map the value back to a Group for(Integer seqIndex : chainIndexPosition.keySet()) { Integer groupIndex = chainIndexPosition.get(seqIndex); groupIndexPosition.put(prevLen + seqIndex, groups.get(groupIndex)); } } ProteinSequence s = null; try { s = new ProteinSequence(seqStr.toString()); } catch (CompoundNotFoundException e) { // I believe this can't happen, please correct this if I'm wrong - JD 2014-10-24 // we can log an error if it does, it would mean there's a bad bug somewhere logger.error("Could not create protein sequence, unknown compounds in string: {}", e.getMessage()); } return s; }
java
public static ProteinSequence getProteinSequenceForStructure(Structure struct, Map<Integer,Group> groupIndexPosition ) { if( groupIndexPosition != null) { groupIndexPosition.clear(); } StringBuilder seqStr = new StringBuilder(); for(Chain chain : struct.getChains()) { List<Group> groups = chain.getAtomGroups(); Map<Integer,Integer> chainIndexPosition = new HashMap<Integer, Integer>(); int prevLen = seqStr.length(); // get the sequence for this chain String chainSeq = SeqRes2AtomAligner.getFullAtomSequence(groups, chainIndexPosition, false); seqStr.append(chainSeq); // fix up the position to include previous chains, and map the value back to a Group for(Integer seqIndex : chainIndexPosition.keySet()) { Integer groupIndex = chainIndexPosition.get(seqIndex); groupIndexPosition.put(prevLen + seqIndex, groups.get(groupIndex)); } } ProteinSequence s = null; try { s = new ProteinSequence(seqStr.toString()); } catch (CompoundNotFoundException e) { // I believe this can't happen, please correct this if I'm wrong - JD 2014-10-24 // we can log an error if it does, it would mean there's a bad bug somewhere logger.error("Could not create protein sequence, unknown compounds in string: {}", e.getMessage()); } return s; }
[ "public", "static", "ProteinSequence", "getProteinSequenceForStructure", "(", "Structure", "struct", ",", "Map", "<", "Integer", ",", "Group", ">", "groupIndexPosition", ")", "{", "if", "(", "groupIndexPosition", "!=", "null", ")", "{", "groupIndexPosition", ".", ...
Generates a ProteinSequence corresponding to the sequence of struct, and maintains a mapping from the sequence back to the original groups. Chains are appended to one another. 'X' is used for heteroatoms. @param struct Input structure @param groupIndexPosition An empty map, which will be populated with (residue index in returned ProteinSequence) -> (Group within struct) @return A ProteinSequence with the full sequence of struct. Chains are concatenated in the same order as the input structures @see {@link SeqRes2AtomAligner#getFullAtomSequence(List, Map)}, which does the heavy lifting.
[ "Generates", "a", "ProteinSequence", "corresponding", "to", "the", "sequence", "of", "struct", "and", "maintains", "a", "mapping", "from", "the", "sequence", "back", "to", "the", "original", "groups", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/StructureSequenceMatcher.java#L112-L147
realtime-framework/RealtimeStorage-Android
library/src/main/java/co/realtime/storage/TableRef.java
TableRef.isNull
public TableRef isNull(String attributeName){ filters.add(new Filter(StorageFilter.NULL, attributeName, null, null)); return this; }
java
public TableRef isNull(String attributeName){ filters.add(new Filter(StorageFilter.NULL, attributeName, null, null)); return this; }
[ "public", "TableRef", "isNull", "(", "String", "attributeName", ")", "{", "filters", ".", "add", "(", "new", "Filter", "(", "StorageFilter", ".", "NULL", ",", "attributeName", ",", "null", ",", "null", ")", ")", ";", "return", "this", ";", "}" ]
Applies a filter to the table. When fetched, it will return the null values. <pre> StorageRef storage = new StorageRef("your_app_key", "your_token"); TableRef tableRef = storage.table("your_table"); // Retrieve all items where their "itemProperty" value is null tableRef.isNull("itemProperty").getItems(new OnItemSnapshot() { &#064;Override public void run(ItemSnapshot itemSnapshot) { if (itemSnapshot != null) { Log.d("TableRef", "Item retrieved: " + itemSnapshot.val()); } } }, new OnError() { &#064;Override public void run(Integer code, String errorMessage) { Log.e("TableRef", "Error retrieving items: " + errorMessage); } }); </pre> @param attributeName The name of the property to filter. @return Current table reference
[ "Applies", "a", "filter", "to", "the", "table", ".", "When", "fetched", "it", "will", "return", "the", "null", "values", "." ]
train
https://github.com/realtime-framework/RealtimeStorage-Android/blob/05816a6b7a6dcc83f9e7400ac3048494dadca302/library/src/main/java/co/realtime/storage/TableRef.java#L829-L832
liyiorg/weixin-popular
src/main/java/weixin/popular/api/MessageAPI.java
MessageAPI.mediaUploadnews
public static Media mediaUploadnews(String access_token, String messageJson) { return MediaAPI.mediaUploadnews(access_token, messageJson); }
java
public static Media mediaUploadnews(String access_token, String messageJson) { return MediaAPI.mediaUploadnews(access_token, messageJson); }
[ "public", "static", "Media", "mediaUploadnews", "(", "String", "access_token", ",", "String", "messageJson", ")", "{", "return", "MediaAPI", ".", "mediaUploadnews", "(", "access_token", ",", "messageJson", ")", ";", "}" ]
高级群发 构成 MassMPnewsMessage 对象的前置请求接口 @param access_token access_token @param messageJson messageJson @return result
[ "高级群发", "构成", "MassMPnewsMessage", "对象的前置请求接口" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/MessageAPI.java#L112-L114
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/CommonSteps.java
CommonSteps.checkInputText
@Conditioned @Et("Je vérifie le texte '(.*)-(.*)' avec '(.*)'[\\.|\\?]") @And("I check text '(.*)-(.*)' with '(.*)'[\\.|\\?]") public void checkInputText(String page, String elementName, String textOrKey, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException { if (!checkInputText(Page.getInstance(page).getPageElementByKey('-' + elementName), textOrKey)) { checkText(Page.getInstance(page).getPageElementByKey('-' + elementName), textOrKey); } }
java
@Conditioned @Et("Je vérifie le texte '(.*)-(.*)' avec '(.*)'[\\.|\\?]") @And("I check text '(.*)-(.*)' with '(.*)'[\\.|\\?]") public void checkInputText(String page, String elementName, String textOrKey, List<GherkinStepCondition> conditions) throws FailureException, TechnicalException { if (!checkInputText(Page.getInstance(page).getPageElementByKey('-' + elementName), textOrKey)) { checkText(Page.getInstance(page).getPageElementByKey('-' + elementName), textOrKey); } }
[ "@", "Conditioned", "@", "Et", "(", "\"Je vérifie le texte '(.*)-(.*)' avec '(.*)'[\\\\.|\\\\?]\")", "\r", "@", "And", "(", "\"I check text '(.*)-(.*)' with '(.*)'[\\\\.|\\\\?]\"", ")", "public", "void", "checkInputText", "(", "String", "page", ",", "String", "elementName", ...
Checks if html input text contains expected value. @param page The concerned page of elementName @param elementName The key of the PageElement to check @param textOrKey Is the new data (text or text in context (after a save)) @param conditions list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). @throws TechnicalException is throws if you have a technical error (format, configuration, datas, ...) in NoraUi. Exception with message and with screenshot and with exception if functional error but no screenshot and no exception if technical error. @throws FailureException if the scenario encounters a functional error
[ "Checks", "if", "html", "input", "text", "contains", "expected", "value", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L687-L694
mapsforge/mapsforge
mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/MapViewerTemplate.java
MapViewerTemplate.initializePosition
protected IMapViewPosition initializePosition(IMapViewPosition mvp) { LatLong center = mvp.getCenter(); if (center.equals(new LatLong(0, 0))) { mvp.setMapPosition(this.getInitialPosition()); } mvp.setZoomLevelMax(getZoomLevelMax()); mvp.setZoomLevelMin(getZoomLevelMin()); return mvp; }
java
protected IMapViewPosition initializePosition(IMapViewPosition mvp) { LatLong center = mvp.getCenter(); if (center.equals(new LatLong(0, 0))) { mvp.setMapPosition(this.getInitialPosition()); } mvp.setZoomLevelMax(getZoomLevelMax()); mvp.setZoomLevelMin(getZoomLevelMin()); return mvp; }
[ "protected", "IMapViewPosition", "initializePosition", "(", "IMapViewPosition", "mvp", ")", "{", "LatLong", "center", "=", "mvp", ".", "getCenter", "(", ")", ";", "if", "(", "center", ".", "equals", "(", "new", "LatLong", "(", "0", ",", "0", ")", ")", ")...
initializes the map view position. @param mvp the map view position to be set @return the mapviewposition set
[ "initializes", "the", "map", "view", "position", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-android/src/main/java/org/mapsforge/map/android/util/MapViewerTemplate.java#L252-L261
morimekta/providence
providence-reflect/src/main/java/net/morimekta/providence/reflect/contained/CField.java
CField.equalsQualifiedName
private static boolean equalsQualifiedName(PDescriptor a, PDescriptor b) { return (a != null) && (b != null) && (a.getQualifiedName() .equals(b.getQualifiedName())); }
java
private static boolean equalsQualifiedName(PDescriptor a, PDescriptor b) { return (a != null) && (b != null) && (a.getQualifiedName() .equals(b.getQualifiedName())); }
[ "private", "static", "boolean", "equalsQualifiedName", "(", "PDescriptor", "a", ",", "PDescriptor", "b", ")", "{", "return", "(", "a", "!=", "null", ")", "&&", "(", "b", "!=", "null", ")", "&&", "(", "a", ".", "getQualifiedName", "(", ")", ".", "equals...
Check if the two descriptors has the same qualified name, i..e symbolically represent the same type. @param a The first type. @param b The second type. @return If the two types are the same.
[ "Check", "if", "the", "two", "descriptors", "has", "the", "same", "qualified", "name", "i", "..", "e", "symbolically", "represent", "the", "same", "type", "." ]
train
https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-reflect/src/main/java/net/morimekta/providence/reflect/contained/CField.java#L190-L193
mgormley/pacaya
src/main/java/edu/jhu/pacaya/autodiff/Tensor.java
Tensor.ravelIndexMatlab
public static int ravelIndexMatlab(int[] indices, int[] dims) { indices = indices.clone(); ArrayUtils.reverse(indices); dims = dims.clone(); ArrayUtils.reverse(dims); return ravelIndex(indices, dims); }
java
public static int ravelIndexMatlab(int[] indices, int[] dims) { indices = indices.clone(); ArrayUtils.reverse(indices); dims = dims.clone(); ArrayUtils.reverse(dims); return ravelIndex(indices, dims); }
[ "public", "static", "int", "ravelIndexMatlab", "(", "int", "[", "]", "indices", ",", "int", "[", "]", "dims", ")", "{", "indices", "=", "indices", ".", "clone", "(", ")", ";", "ArrayUtils", ".", "reverse", "(", "indices", ")", ";", "dims", "=", "dims...
Gets the index into the values array that corresponds to the indices.
[ "Gets", "the", "index", "into", "the", "values", "array", "that", "corresponds", "to", "the", "indices", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/autodiff/Tensor.java#L178-L184
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/core/ServerConfig.java
ServerConfig.setParamFromString
private static boolean setParamFromString(String name, String value) throws ConfigurationException { try { Field field = config.getClass().getDeclaredField(name); String fieldType = field.getType().toString(); if (fieldType.compareToIgnoreCase("int") == 0) { field.set(config, Integer.parseInt(value)); } else if (fieldType.compareToIgnoreCase("boolean") == 0) { field.set(config, Boolean.parseBoolean(value)); } else if (fieldType.endsWith("List")) { setCollectionParam(name, Arrays.asList(value.split(","))); } else { field.set(config, value); } return true; } catch (SecurityException | NoSuchFieldException | IllegalAccessException e) { return false; } catch (IllegalArgumentException e) { throw new ConfigurationException("Couldn't parse parameter: " + value); } }
java
private static boolean setParamFromString(String name, String value) throws ConfigurationException { try { Field field = config.getClass().getDeclaredField(name); String fieldType = field.getType().toString(); if (fieldType.compareToIgnoreCase("int") == 0) { field.set(config, Integer.parseInt(value)); } else if (fieldType.compareToIgnoreCase("boolean") == 0) { field.set(config, Boolean.parseBoolean(value)); } else if (fieldType.endsWith("List")) { setCollectionParam(name, Arrays.asList(value.split(","))); } else { field.set(config, value); } return true; } catch (SecurityException | NoSuchFieldException | IllegalAccessException e) { return false; } catch (IllegalArgumentException e) { throw new ConfigurationException("Couldn't parse parameter: " + value); } }
[ "private", "static", "boolean", "setParamFromString", "(", "String", "name", ",", "String", "value", ")", "throws", "ConfigurationException", "{", "try", "{", "Field", "field", "=", "config", ".", "getClass", "(", ")", ".", "getDeclaredField", "(", "name", ")"...
Return false if given name is not a known scalar configuration parameter
[ "Return", "false", "if", "given", "name", "is", "not", "a", "known", "scalar", "configuration", "parameter" ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/core/ServerConfig.java#L411-L430
WASdev/standards.jsr352.jbatch
com.ibm.jbatch.container/src/main/java/com/ibm/jbatch/container/services/impl/JDBCPersistenceManagerImpl.java
JDBCPersistenceManagerImpl.getPartitionLevelJobInstanceWildCard
private String getPartitionLevelJobInstanceWildCard(long rootJobInstanceId, String stepName) { StringBuilder sb = new StringBuilder(":"); sb.append(Long.toString(rootJobInstanceId)); sb.append(":"); sb.append(stepName); sb.append(":%"); return sb.toString(); }
java
private String getPartitionLevelJobInstanceWildCard(long rootJobInstanceId, String stepName) { StringBuilder sb = new StringBuilder(":"); sb.append(Long.toString(rootJobInstanceId)); sb.append(":"); sb.append(stepName); sb.append(":%"); return sb.toString(); }
[ "private", "String", "getPartitionLevelJobInstanceWildCard", "(", "long", "rootJobInstanceId", ",", "String", "stepName", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "\":\"", ")", ";", "sb", ".", "append", "(", "Long", ".", "toString", "("...
Obviously would be nice if the code writing this special format were in the same place as this code reading it. Assumes format like: JOBINSTANCEDATA (jobinstanceid name, ...) 1197,"partitionMetrics","NOTSET" 1198,":1197:step1:0","NOTSET" 1199,":1197:step1:1","NOTSET" 1200,":1197:step2:0","NOTSET" @param rootJobExecutionId JobExecution id of the top-level job @param stepName Step name of the top-level stepName
[ "Obviously", "would", "be", "nice", "if", "the", "code", "writing", "this", "special", "format", "were", "in", "the", "same", "place", "as", "this", "code", "reading", "it", "." ]
train
https://github.com/WASdev/standards.jsr352.jbatch/blob/e267e79dccd4f0bd4bf9c2abc41a8a47b65be28f/com.ibm.jbatch.container/src/main/java/com/ibm/jbatch/container/services/impl/JDBCPersistenceManagerImpl.java#L1919-L1928
cqframework/clinical_quality_language
Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java
ElmBaseVisitor.visitTupleTypeSpecifier
public T visitTupleTypeSpecifier(TupleTypeSpecifier elm, C context) { for (TupleElementDefinition element : elm.getElement()) { visitElement(element, context); } return null; }
java
public T visitTupleTypeSpecifier(TupleTypeSpecifier elm, C context) { for (TupleElementDefinition element : elm.getElement()) { visitElement(element, context); } return null; }
[ "public", "T", "visitTupleTypeSpecifier", "(", "TupleTypeSpecifier", "elm", ",", "C", "context", ")", "{", "for", "(", "TupleElementDefinition", "element", ":", "elm", ".", "getElement", "(", ")", ")", "{", "visitElement", "(", "element", ",", "context", ")", ...
Visit a TupleTypeSpecifier. This method will be called for every node in the tree that is a TupleTypeSpecifier. @param elm the ELM tree @param context the context passed to the visitor @return the visitor result
[ "Visit", "a", "TupleTypeSpecifier", ".", "This", "method", "will", "be", "called", "for", "every", "node", "in", "the", "tree", "that", "is", "a", "TupleTypeSpecifier", "." ]
train
https://github.com/cqframework/clinical_quality_language/blob/67459d1ef453e49db8d7c5c86e87278377ed0a0b/Src/java/elm/src/main/java/org/cqframework/cql/elm/visiting/ElmBaseVisitor.java#L110-L115
ZieIony/Carbon
carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java
LayerDrawable.refreshChildPadding
private boolean refreshChildPadding(int i, ChildDrawable r) { if (r.mDrawable != null) { final Rect rect = mTmpRect; r.mDrawable.getPadding(rect); if (rect.left != mPaddingL[i] || rect.top != mPaddingT[i] || rect.right != mPaddingR[i] || rect.bottom != mPaddingB[i]) { mPaddingL[i] = rect.left; mPaddingT[i] = rect.top; mPaddingR[i] = rect.right; mPaddingB[i] = rect.bottom; return true; } } return false; }
java
private boolean refreshChildPadding(int i, ChildDrawable r) { if (r.mDrawable != null) { final Rect rect = mTmpRect; r.mDrawable.getPadding(rect); if (rect.left != mPaddingL[i] || rect.top != mPaddingT[i] || rect.right != mPaddingR[i] || rect.bottom != mPaddingB[i]) { mPaddingL[i] = rect.left; mPaddingT[i] = rect.top; mPaddingR[i] = rect.right; mPaddingB[i] = rect.bottom; return true; } } return false; }
[ "private", "boolean", "refreshChildPadding", "(", "int", "i", ",", "ChildDrawable", "r", ")", "{", "if", "(", "r", ".", "mDrawable", "!=", "null", ")", "{", "final", "Rect", "rect", "=", "mTmpRect", ";", "r", ".", "mDrawable", ".", "getPadding", "(", "...
Refreshes the cached padding values for the specified child. @return true if the child's padding has changed
[ "Refreshes", "the", "cached", "padding", "values", "for", "the", "specified", "child", "." ]
train
https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java#L1551-L1565
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/RunnersApi.java
RunnersApi.disableRunner
public Runner disableRunner(Object projectIdOrPath, Integer runnerId) throws GitLabApiException { Response response = delete(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "runners", runnerId); return (response.readEntity(Runner.class)); }
java
public Runner disableRunner(Object projectIdOrPath, Integer runnerId) throws GitLabApiException { Response response = delete(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "runners", runnerId); return (response.readEntity(Runner.class)); }
[ "public", "Runner", "disableRunner", "(", "Object", "projectIdOrPath", ",", "Integer", "runnerId", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "delete", "(", "Response", ".", "Status", ".", "OK", ",", "null", ",", "\"projects\"", ",", ...
Disable a specific runner from the project. It works only if the project isn't the only project associated with the specified runner. If so, an error is returned. Use the {@link #removeRunner(Integer)} instead. <pre><code>GitLab Endpoint: DELETE /projects/:id/runners/:runner_id</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param runnerId The ID of a runner @return Runner instance of the Runner disabled @throws GitLabApiException if any exception occurs
[ "Disable", "a", "specific", "runner", "from", "the", "project", ".", "It", "works", "only", "if", "the", "project", "isn", "t", "the", "only", "project", "associated", "with", "the", "specified", "runner", ".", "If", "so", "an", "error", "is", "returned", ...
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RunnersApi.java#L477-L481
knightliao/apollo
src/main/java/com/github/knightliao/apollo/utils/time/DateUtils.java
DateUtils.formatDate
public static String formatDate(java.util.Date pDate, String format) { if (pDate == null) { pDate = new java.util.Date(); } SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(pDate); }
java
public static String formatDate(java.util.Date pDate, String format) { if (pDate == null) { pDate = new java.util.Date(); } SimpleDateFormat sdf = new SimpleDateFormat(format); return sdf.format(pDate); }
[ "public", "static", "String", "formatDate", "(", "java", ".", "util", ".", "Date", "pDate", ",", "String", "format", ")", "{", "if", "(", "pDate", "==", "null", ")", "{", "pDate", "=", "new", "java", ".", "util", ".", "Date", "(", ")", ";", "}", ...
按照给定格式返回代表日期的字符串 @param pDate Date @param format String 日期格式 @return String 代表日期的字符串
[ "按照给定格式返回代表日期的字符串" ]
train
https://github.com/knightliao/apollo/blob/d7a283659fa3e67af6375db8969b2d065a8ce6eb/src/main/java/com/github/knightliao/apollo/utils/time/DateUtils.java#L61-L68
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java
ComputeNodeOperations.uploadBatchServiceLogs
public UploadBatchServiceLogsResult uploadBatchServiceLogs(String poolId, String nodeId, String containerUrl, DateTime startTime) throws BatchErrorException, IOException { return uploadBatchServiceLogs(poolId, nodeId, containerUrl, startTime, null, null); }
java
public UploadBatchServiceLogsResult uploadBatchServiceLogs(String poolId, String nodeId, String containerUrl, DateTime startTime) throws BatchErrorException, IOException { return uploadBatchServiceLogs(poolId, nodeId, containerUrl, startTime, null, null); }
[ "public", "UploadBatchServiceLogsResult", "uploadBatchServiceLogs", "(", "String", "poolId", ",", "String", "nodeId", ",", "String", "containerUrl", ",", "DateTime", "startTime", ")", "throws", "BatchErrorException", ",", "IOException", "{", "return", "uploadBatchServiceL...
Upload Azure Batch service log files from the specified compute node to Azure Blob Storage. This is for gathering Azure Batch service log files in an automated fashion from nodes if you are experiencing an error and wish to escalate to Azure support. The Azure Batch service log files should be shared with Azure support to aid in debugging issues with the Batch service. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node from which you want to upload the Azure Batch service log files. @param containerUrl The URL of the container within Azure Blob Storage to which to upload the Batch Service log file(s). @param startTime The start of the time range from which to upload Batch Service log file(s). @return The result of uploading Batch service log files from a specific compute node. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Upload", "Azure", "Batch", "service", "log", "files", "from", "the", "specified", "compute", "node", "to", "Azure", "Blob", "Storage", ".", "This", "is", "for", "gathering", "Azure", "Batch", "service", "log", "files", "in", "an", "automated", "fashion", "f...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L554-L557
fabric8io/docker-maven-plugin
src/main/java/io/fabric8/maven/docker/access/ecr/AwsSigner4.java
AwsSigner4.task3
final byte[] task3(AwsSigner4Request sr, AuthConfig credentials) { return hmacSha256(getSigningKey(sr, credentials), task2(sr)); }
java
final byte[] task3(AwsSigner4Request sr, AuthConfig credentials) { return hmacSha256(getSigningKey(sr, credentials), task2(sr)); }
[ "final", "byte", "[", "]", "task3", "(", "AwsSigner4Request", "sr", ",", "AuthConfig", "credentials", ")", "{", "return", "hmacSha256", "(", "getSigningKey", "(", "sr", ",", "credentials", ")", ",", "task2", "(", "sr", ")", ")", ";", "}" ]
Task 3. <a href="https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html">Calculate the Signature for AWS Signature Version 4</a>
[ "Task", "3", ".", "<a", "href", "=", "https", ":", "//", "docs", ".", "aws", ".", "amazon", ".", "com", "/", "general", "/", "latest", "/", "gr", "/", "sigv4", "-", "create", "-", "string", "-", "to", "-", "sign", ".", "html", ">", "Calculate", ...
train
https://github.com/fabric8io/docker-maven-plugin/blob/70ce4f56125d8efb8ddcf2ad4dbb5d6e2c7642b3/src/main/java/io/fabric8/maven/docker/access/ecr/AwsSigner4.java#L98-L100
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java
AmazonS3Client.addDateHeader
private static void addDateHeader(Request<?> request, String header, Date value) { if (value != null) { request.addHeader(header, ServiceUtils.formatRfc822Date(value)); } }
java
private static void addDateHeader(Request<?> request, String header, Date value) { if (value != null) { request.addHeader(header, ServiceUtils.formatRfc822Date(value)); } }
[ "private", "static", "void", "addDateHeader", "(", "Request", "<", "?", ">", "request", ",", "String", "header", ",", "Date", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "request", ".", "addHeader", "(", "header", ",", "ServiceUtils", ...
<p> Adds the specified date header in RFC 822 date format to the specified request. This method will not add a date header if the specified date value is <code>null</code>. </p> @param request The request to add the header to. @param header The header name. @param value The header value.
[ "<p", ">", "Adds", "the", "specified", "date", "header", "in", "RFC", "822", "date", "format", "to", "the", "specified", "request", ".", "This", "method", "will", "not", "add", "a", "date", "header", "if", "the", "specified", "date", "value", "is", "<cod...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java#L4491-L4495
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java
XHTMLText.appendOpenHeaderTag
public XHTMLText appendOpenHeaderTag(int level, String style) { if (level > 3 || level < 1) { throw new IllegalArgumentException("Level must be between 1 and 3"); } text.halfOpenElement(H + Integer.toString(level)); text.optAttribute(STYLE, style); text.rightAngleBracket(); return this; }
java
public XHTMLText appendOpenHeaderTag(int level, String style) { if (level > 3 || level < 1) { throw new IllegalArgumentException("Level must be between 1 and 3"); } text.halfOpenElement(H + Integer.toString(level)); text.optAttribute(STYLE, style); text.rightAngleBracket(); return this; }
[ "public", "XHTMLText", "appendOpenHeaderTag", "(", "int", "level", ",", "String", "style", ")", "{", "if", "(", "level", ">", "3", "||", "level", "<", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Level must be between 1 and 3\"", ")", ";"...
Appends a tag that indicates a header, a title of a section of the message. @param level the level of the Header. It must be a value between 1 and 3 @param style the XHTML style of the blockquote @return this.
[ "Appends", "a", "tag", "that", "indicates", "a", "header", "a", "title", "of", "a", "section", "of", "the", "message", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLText.java#L200-L208
lets-blade/blade
src/main/java/com/blade/kit/IocKit.java
IocKit.getInjectFields
private static List<FieldInjector> getInjectFields(Ioc ioc, ClassDefine classDefine) { List<FieldInjector> injectors = new ArrayList<>(); for (Field field : classDefine.getDeclaredFields()) { if (null != field.getAnnotation(InjectWith.class) || null != field.getAnnotation(Inject.class)) { injectors.add(new FieldInjector(ioc, field)); } } if (injectors.size() == 0) { return new ArrayList<>(); } return injectors; }
java
private static List<FieldInjector> getInjectFields(Ioc ioc, ClassDefine classDefine) { List<FieldInjector> injectors = new ArrayList<>(); for (Field field : classDefine.getDeclaredFields()) { if (null != field.getAnnotation(InjectWith.class) || null != field.getAnnotation(Inject.class)) { injectors.add(new FieldInjector(ioc, field)); } } if (injectors.size() == 0) { return new ArrayList<>(); } return injectors; }
[ "private", "static", "List", "<", "FieldInjector", ">", "getInjectFields", "(", "Ioc", "ioc", ",", "ClassDefine", "classDefine", ")", "{", "List", "<", "FieldInjector", ">", "injectors", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Field", "f...
Get @Inject Annotated field @param ioc ioc container @param classDefine classDefine @return return FieldInjector
[ "Get", "@Inject", "Annotated", "field" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/IocKit.java#L51-L62
jayantk/jklol
src/com/jayantkrish/jklol/models/DiscreteFactor.java
DiscreteFactor.describeAssignments
public String describeAssignments(List<Assignment> assignments, boolean includeZeros) { StringBuilder sb = new StringBuilder(); for (Assignment assignment : assignments) { double unnormalizedProb = getUnnormalizedProbability(assignment); if (unnormalizedProb != 0.0 || includeZeros) { Outcome outcome = new Outcome(assignment, unnormalizedProb); sb.append(outcome.toString()); sb.append("\n"); } } return sb.toString(); }
java
public String describeAssignments(List<Assignment> assignments, boolean includeZeros) { StringBuilder sb = new StringBuilder(); for (Assignment assignment : assignments) { double unnormalizedProb = getUnnormalizedProbability(assignment); if (unnormalizedProb != 0.0 || includeZeros) { Outcome outcome = new Outcome(assignment, unnormalizedProb); sb.append(outcome.toString()); sb.append("\n"); } } return sb.toString(); }
[ "public", "String", "describeAssignments", "(", "List", "<", "Assignment", ">", "assignments", ",", "boolean", "includeZeros", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Assignment", "assignment", ":", "assignments"...
Gets a string description of {@code assignments} and their weights in {@code this}. @param assignments @param includeZeros if {@code false}, zero weight assignments are omitted. @return
[ "Gets", "a", "string", "description", "of", "{", "@code", "assignments", "}", "and", "their", "weights", "in", "{", "@code", "this", "}", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/models/DiscreteFactor.java#L384-L395
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClient.java
BigtableInstanceAdminClient.getCluster
@SuppressWarnings("WeakerAccess") public Cluster getCluster(String instanceId, String clusterId) { return ApiExceptions.callAndTranslateApiException(getClusterAsync(instanceId, clusterId)); }
java
@SuppressWarnings("WeakerAccess") public Cluster getCluster(String instanceId, String clusterId) { return ApiExceptions.callAndTranslateApiException(getClusterAsync(instanceId, clusterId)); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "Cluster", "getCluster", "(", "String", "instanceId", ",", "String", "clusterId", ")", "{", "return", "ApiExceptions", ".", "callAndTranslateApiException", "(", "getClusterAsync", "(", "instanceId", ",",...
Get the cluster representation by ID. <p>Sample code: <pre>{@code Cluster cluster = client.getCluster("my-instance", "my-cluster"); }</pre>
[ "Get", "the", "cluster", "representation", "by", "ID", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigtable/src/main/java/com/google/cloud/bigtable/admin/v2/BigtableInstanceAdminClient.java#L572-L575
JavaMoney/jsr354-api
src/main/java/javax/money/CurrencyQueryBuilder.java
CurrencyQueryBuilder.setCurrencyCodes
public CurrencyQueryBuilder setCurrencyCodes(String... codes) { return set(CurrencyQuery.KEY_QUERY_CURRENCY_CODES, Arrays.asList(codes)); }
java
public CurrencyQueryBuilder setCurrencyCodes(String... codes) { return set(CurrencyQuery.KEY_QUERY_CURRENCY_CODES, Arrays.asList(codes)); }
[ "public", "CurrencyQueryBuilder", "setCurrencyCodes", "(", "String", "...", "codes", ")", "{", "return", "set", "(", "CurrencyQuery", ".", "KEY_QUERY_CURRENCY_CODES", ",", "Arrays", ".", "asList", "(", "codes", ")", ")", ";", "}" ]
Sets the currency code, or the regular expression to select codes. @param codes the currency codes or code expressions, not null. @return the query for chaining.
[ "Sets", "the", "currency", "code", "or", "the", "regular", "expression", "to", "select", "codes", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/CurrencyQueryBuilder.java#L68-L70
samskivert/pythagoras
src/main/java/pythagoras/f/MathUtil.java
MathUtil.lerpa
public static float lerpa (float a1, float a2, float t) { float ma1 = mirrorAngle(a1), ma2 = mirrorAngle(a2); float d = Math.abs(a2 - a1), md = Math.abs(ma1 - ma2); return (d <= md) ? lerp(a1, a2, t) : mirrorAngle(lerp(ma1, ma2, t)); }
java
public static float lerpa (float a1, float a2, float t) { float ma1 = mirrorAngle(a1), ma2 = mirrorAngle(a2); float d = Math.abs(a2 - a1), md = Math.abs(ma1 - ma2); return (d <= md) ? lerp(a1, a2, t) : mirrorAngle(lerp(ma1, ma2, t)); }
[ "public", "static", "float", "lerpa", "(", "float", "a1", ",", "float", "a2", ",", "float", "t", ")", "{", "float", "ma1", "=", "mirrorAngle", "(", "a1", ")", ",", "ma2", "=", "mirrorAngle", "(", "a2", ")", ";", "float", "d", "=", "Math", ".", "a...
Linearly interpolates between two angles, taking the shortest path around the circle. This assumes that both angles are in [-pi, +pi].
[ "Linearly", "interpolates", "between", "two", "angles", "taking", "the", "shortest", "path", "around", "the", "circle", ".", "This", "assumes", "that", "both", "angles", "are", "in", "[", "-", "pi", "+", "pi", "]", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/f/MathUtil.java#L103-L107
ddf-project/DDF
core/src/main/java/io/ddf/Factor.java
Factor.setLevels
public void setLevels(List<String> levels, boolean isOrdered) throws DDFException { this.setLevels(levels, null, isOrdered); }
java
public void setLevels(List<String> levels, boolean isOrdered) throws DDFException { this.setLevels(levels, null, isOrdered); }
[ "public", "void", "setLevels", "(", "List", "<", "String", ">", "levels", ",", "boolean", "isOrdered", ")", "throws", "DDFException", "{", "this", ".", "setLevels", "(", "levels", ",", "null", ",", "isOrdered", ")", ";", "}" ]
Typically, levels are automatically computed from the data, but in some rare instances, the user may want to specify the levels explicitly, e.g., when the data column does not contain all the levels desired. @param levels @param isOrdered a flag indicating whether the levels actually have "less than" and "greater than" left-to-right order meaning @throws DDFException
[ "Typically", "levels", "are", "automatically", "computed", "from", "the", "data", "but", "in", "some", "rare", "instances", "the", "user", "may", "want", "to", "specify", "the", "levels", "explicitly", "e", ".", "g", ".", "when", "the", "data", "column", "...
train
https://github.com/ddf-project/DDF/blob/e4e68315dcec1ed8b287bf1ee73baa88e7e41eba/core/src/main/java/io/ddf/Factor.java#L157-L159
javamelody/javamelody
javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MPdfWriter.java
MPdfWriter.print
@Override public void print(final MBasicTable table, final OutputStream out) throws IOException { writePdf(table, out); }
java
@Override public void print(final MBasicTable table, final OutputStream out) throws IOException { writePdf(table, out); }
[ "@", "Override", "public", "void", "print", "(", "final", "MBasicTable", "table", ",", "final", "OutputStream", "out", ")", "throws", "IOException", "{", "writePdf", "(", "table", ",", "out", ")", ";", "}" ]
Lance l'impression (Méthode abstraite assurant le polymorphisme des instances.). @param table MBasicTable @param out OutputStream @throws IOException Erreur disque
[ "Lance", "l", "impression", "(", "Méthode", "abstraite", "assurant", "le", "polymorphisme", "des", "instances", ".", ")", "." ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-swing/src/main/java/net/bull/javamelody/swing/print/MPdfWriter.java#L108-L111
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java
SimpleDateFormat.parseInt
private Number parseInt(String text, ParsePosition pos, boolean allowNegative, NumberFormat fmt) { return parseInt(text, -1, pos, allowNegative, fmt); }
java
private Number parseInt(String text, ParsePosition pos, boolean allowNegative, NumberFormat fmt) { return parseInt(text, -1, pos, allowNegative, fmt); }
[ "private", "Number", "parseInt", "(", "String", "text", ",", "ParsePosition", "pos", ",", "boolean", "allowNegative", ",", "NumberFormat", "fmt", ")", "{", "return", "parseInt", "(", "text", ",", "-", "1", ",", "pos", ",", "allowNegative", ",", "fmt", ")",...
Parse an integer using numberFormat. This method is semantically const, but actually may modify fNumberFormat.
[ "Parse", "an", "integer", "using", "numberFormat", ".", "This", "method", "is", "semantically", "const", "but", "actually", "may", "modify", "fNumberFormat", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L3720-L3725
google/closure-compiler
src/com/google/javascript/jscomp/AbstractCompiler.java
AbstractCompiler.setAnnotation
void setAnnotation(String key, Object object) { checkArgument(object != null, "The stored annotation value cannot be null."); Preconditions.checkArgument( !annotationMap.containsKey(key), "Cannot overwrite the existing annotation '%s'.", key); annotationMap.put(key, object); }
java
void setAnnotation(String key, Object object) { checkArgument(object != null, "The stored annotation value cannot be null."); Preconditions.checkArgument( !annotationMap.containsKey(key), "Cannot overwrite the existing annotation '%s'.", key); annotationMap.put(key, object); }
[ "void", "setAnnotation", "(", "String", "key", ",", "Object", "object", ")", "{", "checkArgument", "(", "object", "!=", "null", ",", "\"The stored annotation value cannot be null.\"", ")", ";", "Preconditions", ".", "checkArgument", "(", "!", "annotationMap", ".", ...
Sets an annotation for the given key. @param key the annotation key @param object the object to store as the annotation
[ "Sets", "an", "annotation", "for", "the", "given", "key", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/AbstractCompiler.java#L688-L693
haifengl/smile
math/src/main/java/smile/math/IntArrayList.java
IntArrayList.set
public IntArrayList set(int index, int val) { if (index < 0 || index >= size) { throw new IndexOutOfBoundsException(String.valueOf(index)); } data[index] = val; return this; }
java
public IntArrayList set(int index, int val) { if (index < 0 || index >= size) { throw new IndexOutOfBoundsException(String.valueOf(index)); } data[index] = val; return this; }
[ "public", "IntArrayList", "set", "(", "int", "index", ",", "int", "val", ")", "{", "if", "(", "index", "<", "0", "||", "index", ">=", "size", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "String", ".", "valueOf", "(", "index", ")", ")", ...
Replaces the value at the specified position in this list with the specified value. @param index index of the value to replace @param val value to be stored at the specified position @throws IndexOutOfBoundsException if the index is out of range (index &lt; 0 || index &ge; size())
[ "Replaces", "the", "value", "at", "the", "specified", "position", "in", "this", "list", "with", "the", "specified", "value", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/IntArrayList.java#L150-L156
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Assert.java
Assert.notEmpty
public static <K, V> Map<K, V> notEmpty(Map<K, V> map, String errorMsgTemplate, Object... params) throws IllegalArgumentException { if (CollectionUtil.isEmpty(map)) { throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params)); } return map; }
java
public static <K, V> Map<K, V> notEmpty(Map<K, V> map, String errorMsgTemplate, Object... params) throws IllegalArgumentException { if (CollectionUtil.isEmpty(map)) { throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params)); } return map; }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "notEmpty", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "String", "errorMsgTemplate", ",", "Object", "...", "params", ")", "throws", "IllegalArgumentException", "{", "i...
断言给定Map非空 <pre class="code"> Assert.notEmpty(map, "Map must have entries"); </pre> @param <K> Key类型 @param <V> Value类型 @param map 被检查的Map @param errorMsgTemplate 异常时的消息模板 @param params 参数列表 @return 被检查的Map @throws IllegalArgumentException if the map is {@code null} or has no entries
[ "断言给定Map非空" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L390-L395
googleads/googleads-java-lib
modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/NodeExtractor.java
NodeExtractor.extractNode
public Node extractNode(@Nullable Node parentNode, Iterable<String> xPath) { Preconditions.checkNotNull(xPath, "Null xpath list"); Node node = parentNode; boolean wasMatch = false; Iterator<String> xPathElementsIter = xPath.iterator(); while (xPathElementsIter.hasNext() && node != null) { wasMatch = false; String localName = xPathElementsIter.next(); NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node childNode = childNodes.item(i); String childName = childNode.getLocalName(); if (childName == null || childName.contains(":")) { childName = childNode.getNodeName(); } if (localName.equals(childName)) { node = childNode; wasMatch = true; break; } } } return wasMatch ? node : null; }
java
public Node extractNode(@Nullable Node parentNode, Iterable<String> xPath) { Preconditions.checkNotNull(xPath, "Null xpath list"); Node node = parentNode; boolean wasMatch = false; Iterator<String> xPathElementsIter = xPath.iterator(); while (xPathElementsIter.hasNext() && node != null) { wasMatch = false; String localName = xPathElementsIter.next(); NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node childNode = childNodes.item(i); String childName = childNode.getLocalName(); if (childName == null || childName.contains(":")) { childName = childNode.getNodeName(); } if (localName.equals(childName)) { node = childNode; wasMatch = true; break; } } } return wasMatch ? node : null; }
[ "public", "Node", "extractNode", "(", "@", "Nullable", "Node", "parentNode", ",", "Iterable", "<", "String", ">", "xPath", ")", "{", "Preconditions", ".", "checkNotNull", "(", "xPath", ",", "\"Null xpath list\"", ")", ";", "Node", "node", "=", "parentNode", ...
Extracts the node specified by the xpath list. @param parentNode the node to extract the child node from. @param xPath xpath elements for <em>local</em> names that make up the child node's xpath. @return the matching {@link Node}, or {@code null} if no such child node exists.
[ "Extracts", "the", "node", "specified", "by", "the", "xpath", "list", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/NodeExtractor.java#L55-L78
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java
ProcessGroovyMethods.leftShift
public static Writer leftShift(Process self, Object value) throws IOException { return IOGroovyMethods.leftShift(self.getOutputStream(), value); }
java
public static Writer leftShift(Process self, Object value) throws IOException { return IOGroovyMethods.leftShift(self.getOutputStream(), value); }
[ "public", "static", "Writer", "leftShift", "(", "Process", "self", ",", "Object", "value", ")", "throws", "IOException", "{", "return", "IOGroovyMethods", ".", "leftShift", "(", "self", ".", "getOutputStream", "(", ")", ",", "value", ")", ";", "}" ]
Overloads the left shift operator (&lt;&lt;) to provide an append mechanism to pipe data to a Process. @param self a Process instance @param value a value to append @return a Writer @throws java.io.IOException if an IOException occurs. @since 1.0
[ "Overloads", "the", "left", "shift", "operator", "(", "&lt", ";", "&lt", ";", ")", "to", "provide", "an", "append", "mechanism", "to", "pipe", "data", "to", "a", "Process", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java#L114-L116
RogerParkinson/madura-objects-parent
madura-objects/src/main/java/nz/co/senanque/validationengine/ValidationSession.java
ValidationSession.invokeListeners
public void invokeListeners(final ValidationObject object, final String fieldName, final Object newValue, final Object currentValue) { m_validationEngine.invokeListeners(object, fieldName, newValue, currentValue, this); }
java
public void invokeListeners(final ValidationObject object, final String fieldName, final Object newValue, final Object currentValue) { m_validationEngine.invokeListeners(object, fieldName, newValue, currentValue, this); }
[ "public", "void", "invokeListeners", "(", "final", "ValidationObject", "object", ",", "final", "String", "fieldName", ",", "final", "Object", "newValue", ",", "final", "Object", "currentValue", ")", "{", "m_validationEngine", ".", "invokeListeners", "(", "object", ...
This is called after a successful setter call on one of the fields. If any listeners are attached to the field they are invoked from here. @param object @param fieldName @param newValue @param currentValue
[ "This", "is", "called", "after", "a", "successful", "setter", "call", "on", "one", "of", "the", "fields", ".", "If", "any", "listeners", "are", "attached", "to", "the", "field", "they", "are", "invoked", "from", "here", "." ]
train
https://github.com/RogerParkinson/madura-objects-parent/blob/9b5385dd0437611f0ce8506f63646e018d06fb8e/madura-objects/src/main/java/nz/co/senanque/validationengine/ValidationSession.java#L104-L106
AltBeacon/android-beacon-library
lib/src/main/java/org/altbeacon/beacon/BeaconParser.java
BeaconParser.fromScanData
public Beacon fromScanData(byte[] scanData, int rssi, BluetoothDevice device) { return fromScanData(scanData, rssi, device, new Beacon()); }
java
public Beacon fromScanData(byte[] scanData, int rssi, BluetoothDevice device) { return fromScanData(scanData, rssi, device, new Beacon()); }
[ "public", "Beacon", "fromScanData", "(", "byte", "[", "]", "scanData", ",", "int", "rssi", ",", "BluetoothDevice", "device", ")", "{", "return", "fromScanData", "(", "scanData", ",", "rssi", ",", "device", ",", "new", "Beacon", "(", ")", ")", ";", "}" ]
Construct a Beacon from a Bluetooth LE packet collected by Android's Bluetooth APIs, including the raw Bluetooth device info @param scanData The actual packet bytes @param rssi The measured signal strength of the packet @param device The Bluetooth device that was detected @return An instance of a <code>Beacon</code>
[ "Construct", "a", "Beacon", "from", "a", "Bluetooth", "LE", "packet", "collected", "by", "Android", "s", "Bluetooth", "APIs", "including", "the", "raw", "Bluetooth", "device", "info" ]
train
https://github.com/AltBeacon/android-beacon-library/blob/f7f3a323ea7415d53e7bd695ff6a01f1501d5dc3/lib/src/main/java/org/altbeacon/beacon/BeaconParser.java#L417-L419
fuinorg/utils4j
src/main/java/org/fuin/utils4j/Utils4J.java
Utils4J.createHash
public static String createHash(final File file, final String algorithm) { checkNotNull("file", file); checkNotNull("algorithm", algorithm); try { try (final FileInputStream in = new FileInputStream(file)) { return createHash(in, algorithm); } } catch (final IOException ex) { throw new RuntimeException(ex); } }
java
public static String createHash(final File file, final String algorithm) { checkNotNull("file", file); checkNotNull("algorithm", algorithm); try { try (final FileInputStream in = new FileInputStream(file)) { return createHash(in, algorithm); } } catch (final IOException ex) { throw new RuntimeException(ex); } }
[ "public", "static", "String", "createHash", "(", "final", "File", "file", ",", "final", "String", "algorithm", ")", "{", "checkNotNull", "(", "\"file\"", ",", "file", ")", ";", "checkNotNull", "(", "\"algorithm\"", ",", "algorithm", ")", ";", "try", "{", "...
Creates a HEX encoded hash from a file. @param file File to create a hash for - Cannot be <code>null</code>. @param algorithm Hash algorithm like "MD5" or "SHA" - Cannot be <code>null</code>. @return HEX encoded hash.
[ "Creates", "a", "HEX", "encoded", "hash", "from", "a", "file", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/Utils4J.java#L324-L334
pugwoo/nimble-orm
src/main/java/com/pugwoo/dbhelper/DBHelperInterceptor.java
DBHelperInterceptor.beforeUpdate
public boolean beforeUpdate(List<Object> tList, String setSql, List<Object> setSqlArgs) { return true; }
java
public boolean beforeUpdate(List<Object> tList, String setSql, List<Object> setSqlArgs) { return true; }
[ "public", "boolean", "beforeUpdate", "(", "List", "<", "Object", ">", "tList", ",", "String", "setSql", ",", "List", "<", "Object", ">", "setSqlArgs", ")", "{", "return", "true", ";", "}" ]
update前执行 @param tList 更新前的对象列表 @param setSql 如果使用了updateCustom方法,传入的setSql将传入。否则该值为null @param setSqlArgs 如果使用了updateCustom方法,传入的args将传入,否则该值为null。 注意,修改此值会修改实际被设置的值,谨慎! @return 返回true继续执行,返回false中断执行并抛出NotAllowQueryException
[ "update前执行" ]
train
https://github.com/pugwoo/nimble-orm/blob/dd496f3e57029e4f22f9a2f00d18a6513ef94d08/src/main/java/com/pugwoo/dbhelper/DBHelperInterceptor.java#L70-L72
GenesysPureEngage/authentication-client-java
src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java
AuthenticationApi.signOut
public ModelApiResponse signOut(String authorization, Boolean global) throws ApiException { ApiResponse<ModelApiResponse> resp = signOutWithHttpInfo(authorization, global); return resp.getData(); }
java
public ModelApiResponse signOut(String authorization, Boolean global) throws ApiException { ApiResponse<ModelApiResponse> resp = signOutWithHttpInfo(authorization, global); return resp.getData(); }
[ "public", "ModelApiResponse", "signOut", "(", "String", "authorization", ",", "Boolean", "global", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ModelApiResponse", ">", "resp", "=", "signOutWithHttpInfo", "(", "authorization", ",", "global", ")", ";", "...
Sign-out a logged in user Sign-out the current user and invalidate either the current token or all tokens associated with the user. @param authorization The OAuth 2 bearer access token you received from [/auth/v3/oauth/token](/reference/authentication/Authentication/index.html#retrieveToken). For example: \&quot;Authorization: bearer a4b5da75-a584-4053-9227-0f0ab23ff06e\&quot; (required) @param global Specifies whether to invalidate all tokens for the current user (&#x60;true&#x60;) or only the current token (&#x60;false&#x60;). (optional) @return ModelApiResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Sign", "-", "out", "a", "logged", "in", "user", "Sign", "-", "out", "the", "current", "user", "and", "invalidate", "either", "the", "current", "token", "or", "all", "tokens", "associated", "with", "the", "user", "." ]
train
https://github.com/GenesysPureEngage/authentication-client-java/blob/eb0d58343ee42ebd3c037163c1137f611dfcbb3a/src/main/java/com/genesys/internal/authentication/api/AuthenticationApi.java#L1328-L1331
alkacon/opencms-core
src/org/opencms/ugc/CmsUgcSession.java
CmsUgcSession.checkNotFinished
private void checkNotFinished() throws CmsUgcException { if (m_finished) { String message = Messages.get().container(Messages.ERR_FORM_SESSION_ALREADY_FINISHED_0).key( getCmsObject().getRequestContext().getLocale()); throw new CmsUgcException(CmsUgcConstants.ErrorCode.errInvalidAction, message); } }
java
private void checkNotFinished() throws CmsUgcException { if (m_finished) { String message = Messages.get().container(Messages.ERR_FORM_SESSION_ALREADY_FINISHED_0).key( getCmsObject().getRequestContext().getLocale()); throw new CmsUgcException(CmsUgcConstants.ErrorCode.errInvalidAction, message); } }
[ "private", "void", "checkNotFinished", "(", ")", "throws", "CmsUgcException", "{", "if", "(", "m_finished", ")", "{", "String", "message", "=", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_FORM_SESSION_ALREADY_FINISHED_0", ")", ...
Checks that the session is not finished, and throws an exception otherwise.<p> @throws CmsUgcException if the session is finished
[ "Checks", "that", "the", "session", "is", "not", "finished", "and", "throws", "an", "exception", "otherwise", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSession.java#L688-L695
saxsys/SynchronizeFX
synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java
CommandListCreator.commandsForDomainModel
public void commandsForDomainModel(final Object root, final CommandsForDomainModelCallback callback) { final State state = createCommandList(new WithCommandType() { @Override public void invoke(final State state) { createObservableObject(root, state); } }, false); final SetRootElement msg = new SetRootElement(); msg.setRootElementId(objectRegistry.getIdOrFail(root)); // prepend it to the ClearReferences command state.commands.add(state.commands.size() - 1, msg); callback.commandsReady(state.commands); }
java
public void commandsForDomainModel(final Object root, final CommandsForDomainModelCallback callback) { final State state = createCommandList(new WithCommandType() { @Override public void invoke(final State state) { createObservableObject(root, state); } }, false); final SetRootElement msg = new SetRootElement(); msg.setRootElementId(objectRegistry.getIdOrFail(root)); // prepend it to the ClearReferences command state.commands.add(state.commands.size() - 1, msg); callback.commandsReady(state.commands); }
[ "public", "void", "commandsForDomainModel", "(", "final", "Object", "root", ",", "final", "CommandsForDomainModelCallback", "callback", ")", "{", "final", "State", "state", "=", "createCommandList", "(", "new", "WithCommandType", "(", ")", "{", "@", "Override", "p...
@see MetaModel#commandsForDomainModel() @param root The root object of the domain model. @param callback The callback that takes the commands necessary to rebuild the domain model at it's current state.
[ "@see", "MetaModel#commandsForDomainModel", "()" ]
train
https://github.com/saxsys/SynchronizeFX/blob/f3683020e4749110b38514eb5bc73a247998b579/synchronizefx-core/src/main/java/de/saxsys/synchronizefx/core/metamodel/CommandListCreator.java#L98-L112
apache/flink
flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/util/InterpreterUtils.java
InterpreterUtils.initAndExecPythonScript
public static void initAndExecPythonScript(PythonEnvironmentFactory factory, java.nio.file.Path scriptDirectory, String scriptName, String[] args) { String[] fullArgs = new String[args.length + 1]; fullArgs[0] = scriptDirectory.resolve(scriptName).toString(); System.arraycopy(args, 0, fullArgs, 1, args.length); PythonInterpreter pythonInterpreter = initPythonInterpreter(fullArgs, scriptDirectory.toUri().getPath(), scriptName); pythonInterpreter.set("__flink_env_factory__", factory); pythonInterpreter.exec(scriptName + ".main(__flink_env_factory__)"); }
java
public static void initAndExecPythonScript(PythonEnvironmentFactory factory, java.nio.file.Path scriptDirectory, String scriptName, String[] args) { String[] fullArgs = new String[args.length + 1]; fullArgs[0] = scriptDirectory.resolve(scriptName).toString(); System.arraycopy(args, 0, fullArgs, 1, args.length); PythonInterpreter pythonInterpreter = initPythonInterpreter(fullArgs, scriptDirectory.toUri().getPath(), scriptName); pythonInterpreter.set("__flink_env_factory__", factory); pythonInterpreter.exec(scriptName + ".main(__flink_env_factory__)"); }
[ "public", "static", "void", "initAndExecPythonScript", "(", "PythonEnvironmentFactory", "factory", ",", "java", ".", "nio", ".", "file", ".", "Path", "scriptDirectory", ",", "String", "scriptName", ",", "String", "[", "]", "args", ")", "{", "String", "[", "]",...
Initializes the Jython interpreter and executes a python script. @param factory environment factory @param scriptDirectory the directory containing all required user python scripts @param scriptName the name of the main python script @param args Command line arguments that will be delivered to the executed python script
[ "Initializes", "the", "Jython", "interpreter", "and", "executes", "a", "python", "script", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/util/InterpreterUtils.java#L105-L114
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/filter/CompareFileFilter.java
CompareFileFilter.init
public void init(Record record, String fieldNameToCheck, String strToCompare, String strSeekSign, Converter pconvFlag, boolean bDontFilterIfNullCompare, BaseField fldToCheck, BaseField fldToCompare) { super.init(record); this.setMasterSlaveFlag(FileListener.RUN_IN_SLAVE); // This runs on the slave (if there is a slave) this.fieldNameToCheck = fieldNameToCheck; m_fldToCheck = fldToCheck; m_fldToCompare = fldToCompare; m_strSeekSign = strSeekSign; m_convFlag = pconvFlag; m_bDontFilterIfNullCompare = bDontFilterIfNullCompare; m_strToCompare = strToCompare; if ((m_strSeekSign == null) || (m_strSeekSign.length() == 0)) m_strSeekSign = DBConstants.EQUALS; // Default comparison }
java
public void init(Record record, String fieldNameToCheck, String strToCompare, String strSeekSign, Converter pconvFlag, boolean bDontFilterIfNullCompare, BaseField fldToCheck, BaseField fldToCompare) { super.init(record); this.setMasterSlaveFlag(FileListener.RUN_IN_SLAVE); // This runs on the slave (if there is a slave) this.fieldNameToCheck = fieldNameToCheck; m_fldToCheck = fldToCheck; m_fldToCompare = fldToCompare; m_strSeekSign = strSeekSign; m_convFlag = pconvFlag; m_bDontFilterIfNullCompare = bDontFilterIfNullCompare; m_strToCompare = strToCompare; if ((m_strSeekSign == null) || (m_strSeekSign.length() == 0)) m_strSeekSign = DBConstants.EQUALS; // Default comparison }
[ "public", "void", "init", "(", "Record", "record", ",", "String", "fieldNameToCheck", ",", "String", "strToCompare", ",", "String", "strSeekSign", ",", "Converter", "pconvFlag", ",", "boolean", "bDontFilterIfNullCompare", ",", "BaseField", "fldToCheck", ",", "BaseFi...
Constructor. @param fsToCheck The field sequence in this record to compare (see m_fldToCheck). @param fldToCheck The field in this record to compare. @param szstrSeekSign The comparison sign. @param pconvFlag If this field is non-null and the state is false, don't do this comparison. @param pfldToCompare The field to compare the target field to. @param strToCompare The string to compare the target field to. @param bValidOnNull Is this record valid if the compare field is null?
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/filter/CompareFileFilter.java#L144-L159
zaproxy/zaproxy
src/org/zaproxy/zap/extension/httpsessions/HttpSessionsSite.java
HttpSessionsSite.renameHttpSession
public boolean renameHttpSession(String oldName, String newName) { // Check new name validity if (newName == null || newName.isEmpty()) { log.warn("Trying to rename session from " + oldName + " illegal name: " + newName); return false; } // Check existing old name HttpSession session = getHttpSession(oldName); if (session == null) { return false; } // Check new name uniqueness if (getHttpSession(newName) != null) { log.warn("Trying to rename session from " + oldName + " to already existing: " + newName); return false; } // Rename the session and notify model session.setName(newName); this.model.fireHttpSessionUpdated(session); return true; }
java
public boolean renameHttpSession(String oldName, String newName) { // Check new name validity if (newName == null || newName.isEmpty()) { log.warn("Trying to rename session from " + oldName + " illegal name: " + newName); return false; } // Check existing old name HttpSession session = getHttpSession(oldName); if (session == null) { return false; } // Check new name uniqueness if (getHttpSession(newName) != null) { log.warn("Trying to rename session from " + oldName + " to already existing: " + newName); return false; } // Rename the session and notify model session.setName(newName); this.model.fireHttpSessionUpdated(session); return true; }
[ "public", "boolean", "renameHttpSession", "(", "String", "oldName", ",", "String", "newName", ")", "{", "// Check new name validity", "if", "(", "newName", "==", "null", "||", "newName", ".", "isEmpty", "(", ")", ")", "{", "log", ".", "warn", "(", "\"Trying ...
Renames a http session, making sure the new name is unique for the site. @param oldName the old name @param newName the new name @return true, if successful
[ "Renames", "a", "http", "session", "making", "sure", "the", "new", "name", "is", "unique", "for", "the", "site", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/httpsessions/HttpSessionsSite.java#L615-L639
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/view/HeaderAndFooterGridView.java
HeaderAndFooterGridView.getNumColumnsCompatible
protected final int getNumColumnsCompatible() { try { Field numColumns = GridView.class.getDeclaredField("mNumColumns"); numColumns.setAccessible(true); return numColumns.getInt(this); } catch (Exception e) { throw new RuntimeException("Unable to retrieve number of columns", e); } }
java
protected final int getNumColumnsCompatible() { try { Field numColumns = GridView.class.getDeclaredField("mNumColumns"); numColumns.setAccessible(true); return numColumns.getInt(this); } catch (Exception e) { throw new RuntimeException("Unable to retrieve number of columns", e); } }
[ "protected", "final", "int", "getNumColumnsCompatible", "(", ")", "{", "try", "{", "Field", "numColumns", "=", "GridView", ".", "class", ".", "getDeclaredField", "(", "\"mNumColumns\"", ")", ";", "numColumns", ".", "setAccessible", "(", "true", ")", ";", "retu...
Returns the number of the grid view's columns by either using the <code>getNumColumns</code>-method on devices with API level 11 or greater, or via reflection on older devices. @return The number of the grid view's columns as an {@link Integer} value or {@link #AUTO_FIT}, if the layout is pending
[ "Returns", "the", "number", "of", "the", "grid", "view", "s", "columns", "by", "either", "using", "the", "<code", ">", "getNumColumns<", "/", "code", ">", "-", "method", "on", "devices", "with", "API", "level", "11", "or", "greater", "or", "via", "reflec...
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/view/HeaderAndFooterGridView.java#L436-L444
intellimate/Izou
src/main/java/org/intellimate/izou/events/EventDistributor.java
EventDistributor.unregisterEventListener
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") public void unregisterEventListener(EventModel<EventModel> event, EventListenerModel eventListener) throws IllegalArgumentException { for (String id : event.getAllInformations()) { ArrayList<EventListenerModel> listenersList = listeners.get(id); if (listenersList == null) { return; } synchronized (listenersList) { listenersList.remove(eventListener); } } }
java
@SuppressWarnings("SynchronizationOnLocalVariableOrMethodParameter") public void unregisterEventListener(EventModel<EventModel> event, EventListenerModel eventListener) throws IllegalArgumentException { for (String id : event.getAllInformations()) { ArrayList<EventListenerModel> listenersList = listeners.get(id); if (listenersList == null) { return; } synchronized (listenersList) { listenersList.remove(eventListener); } } }
[ "@", "SuppressWarnings", "(", "\"SynchronizationOnLocalVariableOrMethodParameter\"", ")", "public", "void", "unregisterEventListener", "(", "EventModel", "<", "EventModel", ">", "event", ",", "EventListenerModel", "eventListener", ")", "throws", "IllegalArgumentException", "{...
unregister an EventListener It will unregister for all Descriptors individually! It will also ignore if this listener is not listening to an Event. Method is thread-safe. @param event the Event to stop listen to @param eventListener the ActivatorEventListener used to listen for events @throws IllegalArgumentException if Listener is already listening to the Event or the id is not allowed
[ "unregister", "an", "EventListener" ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/events/EventDistributor.java#L158-L169
symphonyoss/messageml-utils
src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java
IndentedPrintStream.printAlignedBlock
private void printAlignedBlock(String separator, String terminator) { if (alignedBlock != null) { alignedBlock.print(separator, terminator); alignedBlock = null; } }
java
private void printAlignedBlock(String separator, String terminator) { if (alignedBlock != null) { alignedBlock.print(separator, terminator); alignedBlock = null; } }
[ "private", "void", "printAlignedBlock", "(", "String", "separator", ",", "String", "terminator", ")", "{", "if", "(", "alignedBlock", "!=", "null", ")", "{", "alignedBlock", ".", "print", "(", "separator", ",", "terminator", ")", ";", "alignedBlock", "=", "n...
Prints the alignedblock, with all strings aligned in columns dependent on the order in which they were declared in Align @param separator text added to the end of each line except the last line @param terminator text added to the end of the last line of the block
[ "Prints", "the", "alignedblock", "with", "all", "strings", "aligned", "in", "columns", "dependent", "on", "the", "order", "in", "which", "they", "were", "declared", "in", "Align" ]
train
https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/IndentedPrintStream.java#L76-L81
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java
Hierarchy.findXField
public static @CheckForNull XField findXField(FieldInstruction fins, @Nonnull ConstantPoolGen cpg) { String className = fins.getClassName(cpg); String fieldName = fins.getFieldName(cpg); String fieldSig = fins.getSignature(cpg); boolean isStatic = (fins.getOpcode() == Const.GETSTATIC || fins.getOpcode() == Const.PUTSTATIC); XField xfield = findXField(className, fieldName, fieldSig, isStatic); short opcode = fins.getOpcode(); if (xfield != null && xfield.isResolved() && xfield.isStatic() == (opcode == Const.GETSTATIC || opcode == Const.PUTSTATIC)) { return xfield; } else { return null; } }
java
public static @CheckForNull XField findXField(FieldInstruction fins, @Nonnull ConstantPoolGen cpg) { String className = fins.getClassName(cpg); String fieldName = fins.getFieldName(cpg); String fieldSig = fins.getSignature(cpg); boolean isStatic = (fins.getOpcode() == Const.GETSTATIC || fins.getOpcode() == Const.PUTSTATIC); XField xfield = findXField(className, fieldName, fieldSig, isStatic); short opcode = fins.getOpcode(); if (xfield != null && xfield.isResolved() && xfield.isStatic() == (opcode == Const.GETSTATIC || opcode == Const.PUTSTATIC)) { return xfield; } else { return null; } }
[ "public", "static", "@", "CheckForNull", "XField", "findXField", "(", "FieldInstruction", "fins", ",", "@", "Nonnull", "ConstantPoolGen", "cpg", ")", "{", "String", "className", "=", "fins", ".", "getClassName", "(", "cpg", ")", ";", "String", "fieldName", "="...
Look up the field referenced by given FieldInstruction, returning it as an {@link XField XField} object. @param fins the FieldInstruction @param cpg the ConstantPoolGen used by the class containing the instruction @return an XField object representing the field, or null if no such field could be found
[ "Look", "up", "the", "field", "referenced", "by", "given", "FieldInstruction", "returning", "it", "as", "an", "{", "@link", "XField", "XField", "}", "object", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/Hierarchy.java#L941-L957
google/j2objc
jre_emul/android/frameworks/base/core/java/android/util/Log.java
Log.isLoggable
public static boolean isLoggable(String tag, int level) { Integer minimumLevel = tagLevels.get(tag); if (minimumLevel != null) { return level > minimumLevel.intValue(); } return true; // Let java.util.logging filter it. }
java
public static boolean isLoggable(String tag, int level) { Integer minimumLevel = tagLevels.get(tag); if (minimumLevel != null) { return level > minimumLevel.intValue(); } return true; // Let java.util.logging filter it. }
[ "public", "static", "boolean", "isLoggable", "(", "String", "tag", ",", "int", "level", ")", "{", "Integer", "minimumLevel", "=", "tagLevels", ".", "get", "(", "tag", ")", ";", "if", "(", "minimumLevel", "!=", "null", ")", "{", "return", "level", ">", ...
Checks to see whether or not a log for the specified tag is loggable at the specified level. The default level of any tag is set to INFO. This means that any level above and including INFO will be logged. Before you make any calls to a logging method you should check to see if your tag should be logged. You can change the default level by setting a system property: 'setprop log.tag.&lt;YOUR_LOG_TAG> &lt;LEVEL>' Where level is either VERBOSE, DEBUG, INFO, WARN, ERROR, ASSERT, or SUPPRESS. SUPPRESS will turn off all logging for your tag. You can also create a local.prop file that with the following in it: 'log.tag.&lt;YOUR_LOG_TAG>=&lt;LEVEL>' and place that in /data/local.prop. @param tag The tag to check. @param level The level to check. @return Whether or not that this is allowed to be logged. @throws IllegalArgumentException is thrown if the tag.length() > 23.
[ "Checks", "to", "see", "whether", "or", "not", "a", "log", "for", "the", "specified", "tag", "is", "loggable", "at", "the", "specified", "level", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/Log.java#L258-L264
datumbox/datumbox-framework
datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java
SimpleRandomSampling.randomSampling
public static FlatDataCollection randomSampling(FlatDataList idList, int n, boolean withReplacement) { FlatDataList sampledIds = new FlatDataList(); int populationN = idList.size(); for(int i=0;i<n;) { if(withReplacement==false && populationN<=n) { /* if replacement is not allowed and we already sampled everything that it can stop */ break; } int randomPosition = PHPMethods.mt_rand(0, populationN-1); Object pointID = idList.get(randomPosition); if(withReplacement==false && sampledIds.contains(pointID)) { continue; } sampledIds.add(pointID); ++i; } return sampledIds.toFlatDataCollection(); }
java
public static FlatDataCollection randomSampling(FlatDataList idList, int n, boolean withReplacement) { FlatDataList sampledIds = new FlatDataList(); int populationN = idList.size(); for(int i=0;i<n;) { if(withReplacement==false && populationN<=n) { /* if replacement is not allowed and we already sampled everything that it can stop */ break; } int randomPosition = PHPMethods.mt_rand(0, populationN-1); Object pointID = idList.get(randomPosition); if(withReplacement==false && sampledIds.contains(pointID)) { continue; } sampledIds.add(pointID); ++i; } return sampledIds.toFlatDataCollection(); }
[ "public", "static", "FlatDataCollection", "randomSampling", "(", "FlatDataList", "idList", ",", "int", "n", ",", "boolean", "withReplacement", ")", "{", "FlatDataList", "sampledIds", "=", "new", "FlatDataList", "(", ")", ";", "int", "populationN", "=", "idList", ...
Samples n ids by using SimpleRandomSampling (Simple Random Sampling). @param idList @param n @param withReplacement @return
[ "Samples", "n", "ids", "by", "using", "SimpleRandomSampling", "(", "Simple", "Random", "Sampling", ")", "." ]
train
https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/statistics/sampling/SimpleRandomSampling.java#L84-L110
janus-project/guava.janusproject.io
guava/src/com/google/common/base/Objects.java
Objects.firstNonNull
@Deprecated public static <T> T firstNonNull(@Nullable T first, @Nullable T second) { return MoreObjects.firstNonNull(first, second); }
java
@Deprecated public static <T> T firstNonNull(@Nullable T first, @Nullable T second) { return MoreObjects.firstNonNull(first, second); }
[ "@", "Deprecated", "public", "static", "<", "T", ">", "T", "firstNonNull", "(", "@", "Nullable", "T", "first", ",", "@", "Nullable", "T", "second", ")", "{", "return", "MoreObjects", ".", "firstNonNull", "(", "first", ",", "second", ")", ";", "}" ]
Returns the first of two given parameters that is not {@code null}, if either is, or otherwise throws a {@link NullPointerException}. <p><b>Note:</b> if {@code first} is represented as an {@link Optional}, this can be accomplished with {@linkplain Optional#or(Object) first.or(second)}. That approach also allows for lazy evaluation of the fallback instance, using {@linkplain Optional#or(Supplier) first.or(Supplier)}. @return {@code first} if {@code first} is not {@code null}, or {@code second} if {@code first} is {@code null} and {@code second} is not {@code null} @throws NullPointerException if both {@code first} and {@code second} were {@code null} @since 3.0 @deprecated Use {@link MoreObjects#firstNonNull} instead. This method is scheduled for removal in June 2016.
[ "Returns", "the", "first", "of", "two", "given", "parameters", "that", "is", "not", "{", "@code", "null", "}", "if", "either", "is", "or", "otherwise", "throws", "a", "{", "@link", "NullPointerException", "}", "." ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/base/Objects.java#L184-L187
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetTime.java
OffsetTime.ofInstant
public static OffsetTime ofInstant(Instant instant, ZoneId zone) { Objects.requireNonNull(instant, "instant"); Objects.requireNonNull(zone, "zone"); ZoneRules rules = zone.getRules(); ZoneOffset offset = rules.getOffset(instant); long localSecond = instant.getEpochSecond() + offset.getTotalSeconds(); // overflow caught later int secsOfDay = (int) Math.floorMod(localSecond, SECONDS_PER_DAY); LocalTime time = LocalTime.ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + instant.getNano()); return new OffsetTime(time, offset); }
java
public static OffsetTime ofInstant(Instant instant, ZoneId zone) { Objects.requireNonNull(instant, "instant"); Objects.requireNonNull(zone, "zone"); ZoneRules rules = zone.getRules(); ZoneOffset offset = rules.getOffset(instant); long localSecond = instant.getEpochSecond() + offset.getTotalSeconds(); // overflow caught later int secsOfDay = (int) Math.floorMod(localSecond, SECONDS_PER_DAY); LocalTime time = LocalTime.ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + instant.getNano()); return new OffsetTime(time, offset); }
[ "public", "static", "OffsetTime", "ofInstant", "(", "Instant", "instant", ",", "ZoneId", "zone", ")", "{", "Objects", ".", "requireNonNull", "(", "instant", ",", "\"instant\"", ")", ";", "Objects", ".", "requireNonNull", "(", "zone", ",", "\"zone\"", ")", ";...
Obtains an instance of {@code OffsetTime} from an {@code Instant} and zone ID. <p> This creates an offset time with the same instant as that specified. Finding the offset from UTC/Greenwich is simple as there is only one valid offset for each instant. <p> The date component of the instant is dropped during the conversion. This means that the conversion can never fail due to the instant being out of the valid range of dates. @param instant the instant to create the time from, not null @param zone the time-zone, which may be an offset, not null @return the offset time, not null
[ "Obtains", "an", "instance", "of", "{", "@code", "OffsetTime", "}", "from", "an", "{", "@code", "Instant", "}", "and", "zone", "ID", ".", "<p", ">", "This", "creates", "an", "offset", "time", "with", "the", "same", "instant", "as", "that", "specified", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetTime.java#L249-L258
VoltDB/voltdb
src/frontend/org/voltdb/StatsProcProfTable.java
StatsProcProfTable.compareByAvg
public int compareByAvg(ProcProfRow lhs, ProcProfRow rhs) { if (lhs.avg * lhs.invocations > rhs.avg * rhs.invocations) { return 1; } else if (lhs.avg * lhs.invocations < rhs.avg * rhs.invocations) { return -1; } else { return 0; } }
java
public int compareByAvg(ProcProfRow lhs, ProcProfRow rhs) { if (lhs.avg * lhs.invocations > rhs.avg * rhs.invocations) { return 1; } else if (lhs.avg * lhs.invocations < rhs.avg * rhs.invocations) { return -1; } else { return 0; } }
[ "public", "int", "compareByAvg", "(", "ProcProfRow", "lhs", ",", "ProcProfRow", "rhs", ")", "{", "if", "(", "lhs", ".", "avg", "*", "lhs", ".", "invocations", ">", "rhs", ".", "avg", "*", "rhs", ".", "invocations", ")", "{", "return", "1", ";", "}", ...
Sort by average, weighting the sampled average by the real invocation count.
[ "Sort", "by", "average", "weighting", "the", "sampled", "average", "by", "the", "real", "invocation", "count", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/StatsProcProfTable.java#L169-L178
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Form.java
Form.renderNameAndId
private String renderNameAndId(HttpServletRequest request, String id) { // if id is not set then we need to exit if (id == null) return null; // Legacy Java Script support -- This writes out a single table with both the id and names // mixed. This is legacy support to match the pre beehive behavior. String idScript = null; IScriptReporter scriptReporter = getScriptReporter(); ScriptRequestState srs = ScriptRequestState.getScriptRequestState(request); if (TagConfig.isLegacyJavaScript()) { idScript = srs.mapLegacyTagId(scriptReporter, id, _state.id); } // map the tagId to the real id if (TagConfig.isDefaultJavaScript()) { String script = srs.mapTagId(scriptReporter, id, _state.id, _state.name); // if we wrote out script in legacy mode, we need to make sure we preserve it. if (idScript != null) { idScript = idScript + script; } else { idScript = script; } } return idScript; }
java
private String renderNameAndId(HttpServletRequest request, String id) { // if id is not set then we need to exit if (id == null) return null; // Legacy Java Script support -- This writes out a single table with both the id and names // mixed. This is legacy support to match the pre beehive behavior. String idScript = null; IScriptReporter scriptReporter = getScriptReporter(); ScriptRequestState srs = ScriptRequestState.getScriptRequestState(request); if (TagConfig.isLegacyJavaScript()) { idScript = srs.mapLegacyTagId(scriptReporter, id, _state.id); } // map the tagId to the real id if (TagConfig.isDefaultJavaScript()) { String script = srs.mapTagId(scriptReporter, id, _state.id, _state.name); // if we wrote out script in legacy mode, we need to make sure we preserve it. if (idScript != null) { idScript = idScript + script; } else { idScript = script; } } return idScript; }
[ "private", "String", "renderNameAndId", "(", "HttpServletRequest", "request", ",", "String", "id", ")", "{", "// if id is not set then we need to exit", "if", "(", "id", "==", "null", ")", "return", "null", ";", "// Legacy Java Script support -- This writes out a single tab...
This mehtod will render the JavaScript associated with the id lookup if id has been set. @param request @param id @return
[ "This", "mehtod", "will", "render", "the", "JavaScript", "associated", "with", "the", "id", "lookup", "if", "id", "has", "been", "set", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/html/Form.java#L826-L854
greenmail-mail-test/greenmail
greenmail-core/src/main/java/com/icegreen/greenmail/util/PropertiesBasedServerSetupBuilder.java
PropertiesBasedServerSetupBuilder.build
public ServerSetup[] build(Properties properties) { List<ServerSetup> serverSetups = new ArrayList<>(); String hostname = properties.getProperty("greenmail.hostname", ServerSetup.getLocalHostAddress()); long serverStartupTimeout = Long.parseLong(properties.getProperty("greenmail.startup.timeout", "-1")); // Default setups addDefaultSetups(hostname, properties, serverSetups); // Default setups for test addTestSetups(hostname, properties, serverSetups); // Default setups for (String protocol : ServerSetup.PROTOCOLS) { addSetup(hostname, protocol, properties, serverSetups); } for (ServerSetup setup : serverSetups) { if (properties.containsKey(GREENMAIL_VERBOSE)) { setup.setVerbose(true); } if (serverStartupTimeout >= 0L) { setup.setServerStartupTimeout(serverStartupTimeout); } } return serverSetups.toArray(new ServerSetup[serverSetups.size()]); }
java
public ServerSetup[] build(Properties properties) { List<ServerSetup> serverSetups = new ArrayList<>(); String hostname = properties.getProperty("greenmail.hostname", ServerSetup.getLocalHostAddress()); long serverStartupTimeout = Long.parseLong(properties.getProperty("greenmail.startup.timeout", "-1")); // Default setups addDefaultSetups(hostname, properties, serverSetups); // Default setups for test addTestSetups(hostname, properties, serverSetups); // Default setups for (String protocol : ServerSetup.PROTOCOLS) { addSetup(hostname, protocol, properties, serverSetups); } for (ServerSetup setup : serverSetups) { if (properties.containsKey(GREENMAIL_VERBOSE)) { setup.setVerbose(true); } if (serverStartupTimeout >= 0L) { setup.setServerStartupTimeout(serverStartupTimeout); } } return serverSetups.toArray(new ServerSetup[serverSetups.size()]); }
[ "public", "ServerSetup", "[", "]", "build", "(", "Properties", "properties", ")", "{", "List", "<", "ServerSetup", ">", "serverSetups", "=", "new", "ArrayList", "<>", "(", ")", ";", "String", "hostname", "=", "properties", ".", "getProperty", "(", "\"greenma...
Creates a server setup based on provided properties. @param properties the properties. @return the server setup, or an empty array.
[ "Creates", "a", "server", "setup", "based", "on", "provided", "properties", "." ]
train
https://github.com/greenmail-mail-test/greenmail/blob/6d19a62233d1ef6fedbbd1f6fdde2d28e713834a/greenmail-core/src/main/java/com/icegreen/greenmail/util/PropertiesBasedServerSetupBuilder.java#L58-L86
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/map/store/DefaultRasterLayerStore.java
DefaultRasterLayerStore.getOrientedJDiff
private int getOrientedJDiff(RasterTile tile1, RasterTile tile2) { double dy = tile2.getBounds().getY() - tile1.getBounds().getY(); int dj = tile2.getCode().getY() - tile1.getCode().getY(); return (dj * dy) > 0 ? dj : -dj; }
java
private int getOrientedJDiff(RasterTile tile1, RasterTile tile2) { double dy = tile2.getBounds().getY() - tile1.getBounds().getY(); int dj = tile2.getCode().getY() - tile1.getCode().getY(); return (dj * dy) > 0 ? dj : -dj; }
[ "private", "int", "getOrientedJDiff", "(", "RasterTile", "tile1", ",", "RasterTile", "tile2", ")", "{", "double", "dy", "=", "tile2", ".", "getBounds", "(", ")", ".", "getY", "(", ")", "-", "tile1", ".", "getBounds", "(", ")", ".", "getY", "(", ")", ...
Returns the difference in j index, taking orientation of y-axis into account. Some layers (WMS 1.8.0) have different j-index orientation than screen coordinates (lower-left = (0,0) vs upper-left = (0,0)). @param tile1 tile @param tile2 tile @return +/-(j2-j1)
[ "Returns", "the", "difference", "in", "j", "index", "taking", "orientation", "of", "y", "-", "axis", "into", "account", ".", "Some", "layers", "(", "WMS", "1", ".", "8", ".", "0", ")", "have", "different", "j", "-", "index", "orientation", "than", "scr...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/map/store/DefaultRasterLayerStore.java#L177-L181
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/Record.java
Record.addSortParams
public String addSortParams(boolean bIncludeFileName, boolean bForceUniqueKey) { String strSort = DBConstants.BLANK; KeyArea keyArea = this.getKeyArea(-1); if (keyArea != null) // Leave orderby blank if no index specified strSort = keyArea.addSortParams(bIncludeFileName, bForceUniqueKey); return strSort; }
java
public String addSortParams(boolean bIncludeFileName, boolean bForceUniqueKey) { String strSort = DBConstants.BLANK; KeyArea keyArea = this.getKeyArea(-1); if (keyArea != null) // Leave orderby blank if no index specified strSort = keyArea.addSortParams(bIncludeFileName, bForceUniqueKey); return strSort; }
[ "public", "String", "addSortParams", "(", "boolean", "bIncludeFileName", ",", "boolean", "bForceUniqueKey", ")", "{", "String", "strSort", "=", "DBConstants", ".", "BLANK", ";", "KeyArea", "keyArea", "=", "this", ".", "getKeyArea", "(", "-", "1", ")", ";", "...
Setup the SQL Sort String. (ie., (ORDER BY) 'AgencyName, AgencyNo'). @param bIncludeFileName If true, include the filename with the fieldname in the string. @param bForceUniqueKey If params must be unique, if they aren't, add the unique key to the end. @return The SQL sort string. @see KeyArea
[ "Setup", "the", "SQL", "Sort", "String", ".", "(", "ie", ".", "(", "ORDER", "BY", ")", "AgencyName", "AgencyNo", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/Record.java#L1329-L1336
undertow-io/undertow
core/src/main/java/io/undertow/Handlers.java
Handlers.virtualHost
public static NameVirtualHostHandler virtualHost(final HttpHandler defaultHandler, final HttpHandler hostHandler, String... hostnames) { return virtualHost(hostHandler, hostnames).setDefaultHandler(defaultHandler); }
java
public static NameVirtualHostHandler virtualHost(final HttpHandler defaultHandler, final HttpHandler hostHandler, String... hostnames) { return virtualHost(hostHandler, hostnames).setDefaultHandler(defaultHandler); }
[ "public", "static", "NameVirtualHostHandler", "virtualHost", "(", "final", "HttpHandler", "defaultHandler", ",", "final", "HttpHandler", "hostHandler", ",", "String", "...", "hostnames", ")", "{", "return", "virtualHost", "(", "hostHandler", ",", "hostnames", ")", "...
Creates a new virtual host handler that uses the provided handler as the root handler for the given hostnames. @param defaultHandler The default handler @param hostHandler The host handler @param hostnames The host names @return A new virtual host handler
[ "Creates", "a", "new", "virtual", "host", "handler", "that", "uses", "the", "provided", "handler", "as", "the", "root", "handler", "for", "the", "given", "hostnames", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/Handlers.java#L167-L169
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermsImpl.java
ListManagementTermsImpl.getAllTermsAsync
public Observable<Terms> getAllTermsAsync(String listId, String language, GetAllTermsOptionalParameter getAllTermsOptionalParameter) { return getAllTermsWithServiceResponseAsync(listId, language, getAllTermsOptionalParameter).map(new Func1<ServiceResponse<Terms>, Terms>() { @Override public Terms call(ServiceResponse<Terms> response) { return response.body(); } }); }
java
public Observable<Terms> getAllTermsAsync(String listId, String language, GetAllTermsOptionalParameter getAllTermsOptionalParameter) { return getAllTermsWithServiceResponseAsync(listId, language, getAllTermsOptionalParameter).map(new Func1<ServiceResponse<Terms>, Terms>() { @Override public Terms call(ServiceResponse<Terms> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Terms", ">", "getAllTermsAsync", "(", "String", "listId", ",", "String", "language", ",", "GetAllTermsOptionalParameter", "getAllTermsOptionalParameter", ")", "{", "return", "getAllTermsWithServiceResponseAsync", "(", "listId", ",", "language...
Gets all terms from the list with list Id equal to the list Id passed. @param listId List Id of the image list. @param language Language of the terms. @param getAllTermsOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the Terms object
[ "Gets", "all", "terms", "from", "the", "list", "with", "list", "Id", "equal", "to", "the", "list", "Id", "passed", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/contentmoderator/src/main/java/com/microsoft/azure/cognitiveservices/vision/contentmoderator/implementation/ListManagementTermsImpl.java#L299-L306
Steveice10/OpenNBT
src/main/java/com/github/steveice10/opennbt/tag/TagRegistry.java
TagRegistry.createInstance
public static Tag createInstance(int id, String tagName) throws TagCreateException { Class<? extends Tag> clazz = idToTag.get(id); if(clazz == null) { throw new TagCreateException("Could not find tag with ID \"" + id + "\"."); } try { Constructor<? extends Tag> constructor = clazz.getDeclaredConstructor(String.class); constructor.setAccessible(true); return constructor.newInstance(tagName); } catch(Exception e) { throw new TagCreateException("Failed to create instance of tag \"" + clazz.getSimpleName() + "\".", e); } }
java
public static Tag createInstance(int id, String tagName) throws TagCreateException { Class<? extends Tag> clazz = idToTag.get(id); if(clazz == null) { throw new TagCreateException("Could not find tag with ID \"" + id + "\"."); } try { Constructor<? extends Tag> constructor = clazz.getDeclaredConstructor(String.class); constructor.setAccessible(true); return constructor.newInstance(tagName); } catch(Exception e) { throw new TagCreateException("Failed to create instance of tag \"" + clazz.getSimpleName() + "\".", e); } }
[ "public", "static", "Tag", "createInstance", "(", "int", "id", ",", "String", "tagName", ")", "throws", "TagCreateException", "{", "Class", "<", "?", "extends", "Tag", ">", "clazz", "=", "idToTag", ".", "get", "(", "id", ")", ";", "if", "(", "clazz", "...
Creates an instance of the tag with the given id, using the String constructor. @param id Id of the tag. @param tagName Name to give the tag. @return The created tag. @throws TagCreateException If an error occurs while creating the tag.
[ "Creates", "an", "instance", "of", "the", "tag", "with", "the", "given", "id", "using", "the", "String", "constructor", "." ]
train
https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/tag/TagRegistry.java#L116-L129
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/nlp/AipNlp.java
AipNlp.simnet
public JSONObject simnet(String text1, String text2, HashMap<String, Object> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("text_1", text1); request.addBody("text_2", text2); if (options != null) { request.addBody(options); } request.setUri(NlpConsts.SIMNET); request.addHeader(Headers.CONTENT_ENCODING, HttpCharacterEncoding.ENCODE_GBK); request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
java
public JSONObject simnet(String text1, String text2, HashMap<String, Object> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("text_1", text1); request.addBody("text_2", text2); if (options != null) { request.addBody(options); } request.setUri(NlpConsts.SIMNET); request.addHeader(Headers.CONTENT_ENCODING, HttpCharacterEncoding.ENCODE_GBK); request.addHeader(Headers.CONTENT_TYPE, HttpContentType.JSON_DATA); request.setBodyFormat(EBodyFormat.RAW_JSON); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "simnet", "(", "String", "text1", ",", "String", "text2", ",", "HashMap", "<", "String", ",", "Object", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")",...
短文本相似度接口 短文本相似度接口用来判断两个文本的相似度得分。 @param text1 - 待比较文本1(GBK编码),最大512字节* @param text2 - 待比较文本2(GBK编码),最大512字节 @param options - 可选参数对象,key: value都为string类型 options - options列表: model 默认为"BOW",可选"BOW"、"CNN"与"GRNN" @return JSONObject
[ "短文本相似度接口", "短文本相似度接口用来判断两个文本的相似度得分。" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/nlp/AipNlp.java#L204-L221
google/closure-templates
java/src/com/google/template/soy/jbcsrc/restricted/Expression.java
Expression.invokeVoid
public Statement invokeVoid(MethodRef method, Expression... args) { return method.invokeVoid(ImmutableList.<Expression>builder().add(this).add(args).build()); }
java
public Statement invokeVoid(MethodRef method, Expression... args) { return method.invokeVoid(ImmutableList.<Expression>builder().add(this).add(args).build()); }
[ "public", "Statement", "invokeVoid", "(", "MethodRef", "method", ",", "Expression", "...", "args", ")", "{", "return", "method", ".", "invokeVoid", "(", "ImmutableList", ".", "<", "Expression", ">", "builder", "(", ")", ".", "add", "(", "this", ")", ".", ...
A simple helper that calls through to {@link MethodRef#invokeVoid(Expression...)}, but allows a more natural fluent call style.
[ "A", "simple", "helper", "that", "calls", "through", "to", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/restricted/Expression.java#L392-L394
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java
HtmlBuilder.tagClass
public static String tagClass(String tag, String clazz, String... content) { return openTagClass(tag, clazz, content) + closeTag(tag); }
java
public static String tagClass(String tag, String clazz, String... content) { return openTagClass(tag, clazz, content) + closeTag(tag); }
[ "public", "static", "String", "tagClass", "(", "String", "tag", ",", "String", "clazz", ",", "String", "...", "content", ")", "{", "return", "openTagClass", "(", "tag", ",", "clazz", ",", "content", ")", "+", "closeTag", "(", "tag", ")", ";", "}" ]
Build a String containing a HTML opening tag with given CSS class, content and closing tag. Content should contain no HTML, because it is prepared with {@link #htmlEncode(String)}. @param tag String name of HTML tag @param clazz CSS class of the tag @param content content string @return HTML tag element as string
[ "Build", "a", "String", "containing", "a", "HTML", "opening", "tag", "with", "given", "CSS", "class", "content", "and", "closing", "tag", ".", "Content", "should", "contain", "no", "HTML", "because", "it", "is", "prepared", "with", "{", "@link", "#htmlEncode...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L301-L303
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.setAgentNotReady
public void setAgentNotReady( String workMode, String reasonCode, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { NotReadyData data = new NotReadyData(); VoicenotreadyData notReadyData = new VoicenotreadyData(); notReadyData.setReasonCode(reasonCode); notReadyData.setReasons(Util.toKVList(reasons)); notReadyData.setExtensions(Util.toKVList(extensions)); if (workMode != null) { notReadyData.setAgentWorkMode(VoicenotreadyData.AgentWorkModeEnum.fromValue(workMode)); } data.data(notReadyData); ApiSuccessResponse response = this.voiceApi.setAgentStateNotReady(data); throwIfNotOk("setAgentNotReady", response); } catch (ApiException e) { throw new WorkspaceApiException("setAgentReady failed.", e); } }
java
public void setAgentNotReady( String workMode, String reasonCode, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { NotReadyData data = new NotReadyData(); VoicenotreadyData notReadyData = new VoicenotreadyData(); notReadyData.setReasonCode(reasonCode); notReadyData.setReasons(Util.toKVList(reasons)); notReadyData.setExtensions(Util.toKVList(extensions)); if (workMode != null) { notReadyData.setAgentWorkMode(VoicenotreadyData.AgentWorkModeEnum.fromValue(workMode)); } data.data(notReadyData); ApiSuccessResponse response = this.voiceApi.setAgentStateNotReady(data); throwIfNotOk("setAgentNotReady", response); } catch (ApiException e) { throw new WorkspaceApiException("setAgentReady failed.", e); } }
[ "public", "void", "setAgentNotReady", "(", "String", "workMode", ",", "String", "reasonCode", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensions", ")", "throws", "WorkspaceApiException", "{", "try", "{", "NotReadyData", "data", "=", "new", ...
Set the current agent's state to NotReady on the voice channel. @param workMode The agent workmode. Possible values are `AfterCallWork`, `AuxWork`, `LegalGuard`, `NoCallDisconnect`, `WalkAway`. (optional) @param reasonCode The reason code representing why the agent is not ready. These codes are a business-defined set of categories, such as "Lunch" or "Training". (optional) @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Set", "the", "current", "agent", "s", "state", "to", "NotReady", "on", "the", "voice", "channel", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L359-L384
Jasig/uPortal
uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java
AuthorizationImpl.primGetPermissionsForPrincipal
private IPermission[] primGetPermissionsForPrincipal(IAuthorizationPrincipal principal) throws AuthorizationException { if (!this.cachePermissions) { return getUncachedPermissionsForPrincipal(principal, null, null, null); } IPermissionSet ps = null; // Check the caching service for the Permissions first. ps = cacheGet(principal); if (ps == null) synchronized (principal) { ps = cacheGet(principal); if (ps == null) { IPermission[] permissions = getUncachedPermissionsForPrincipal(principal, null, null, null); ps = new PermissionSetImpl(permissions, principal); cacheAdd(ps); } } // end synchronized return ps.getPermissions(); }
java
private IPermission[] primGetPermissionsForPrincipal(IAuthorizationPrincipal principal) throws AuthorizationException { if (!this.cachePermissions) { return getUncachedPermissionsForPrincipal(principal, null, null, null); } IPermissionSet ps = null; // Check the caching service for the Permissions first. ps = cacheGet(principal); if (ps == null) synchronized (principal) { ps = cacheGet(principal); if (ps == null) { IPermission[] permissions = getUncachedPermissionsForPrincipal(principal, null, null, null); ps = new PermissionSetImpl(permissions, principal); cacheAdd(ps); } } // end synchronized return ps.getPermissions(); }
[ "private", "IPermission", "[", "]", "primGetPermissionsForPrincipal", "(", "IAuthorizationPrincipal", "principal", ")", "throws", "AuthorizationException", "{", "if", "(", "!", "this", ".", "cachePermissions", ")", "{", "return", "getUncachedPermissionsForPrincipal", "(",...
Returns permissions for a principal. First check the entity caching service, and if the permissions have not been cached, retrieve and cache them. @return IPermission[] @param principal org.apereo.portal.security.IAuthorizationPrincipal
[ "Returns", "permissions", "for", "a", "principal", ".", "First", "check", "the", "entity", "caching", "service", "and", "if", "the", "permissions", "have", "not", "been", "cached", "retrieve", "and", "cache", "them", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java#L974-L995
allure-framework/allure1
allure-java-adaptor-api/src/main/java/ru/yandex/qatools/allure/utils/AllureResultsUtils.java
AllureResultsUtils.setPropertySafely
public static void setPropertySafely(Marshaller marshaller, String name, Object value) { try { marshaller.setProperty(name, value); } catch (PropertyException e) { LOGGER.warn(String.format("Can't set \"%s\" property to given marshaller", name), e); } }
java
public static void setPropertySafely(Marshaller marshaller, String name, Object value) { try { marshaller.setProperty(name, value); } catch (PropertyException e) { LOGGER.warn(String.format("Can't set \"%s\" property to given marshaller", name), e); } }
[ "public", "static", "void", "setPropertySafely", "(", "Marshaller", "marshaller", ",", "String", "name", ",", "Object", "value", ")", "{", "try", "{", "marshaller", ".", "setProperty", "(", "name", ",", "value", ")", ";", "}", "catch", "(", "PropertyExceptio...
Try to set specified property to given marshaller @param marshaller specified marshaller @param name name of property to set @param value value of property to set
[ "Try", "to", "set", "specified", "property", "to", "given", "marshaller" ]
train
https://github.com/allure-framework/allure1/blob/9a816fa05d8b894a917b7ebb7fd1a4056dee4693/allure-java-adaptor-api/src/main/java/ru/yandex/qatools/allure/utils/AllureResultsUtils.java#L194-L200
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java
DependencyBundlingAnalyzer.cpeIdentifiersMatch
private boolean cpeIdentifiersMatch(Dependency dependency1, Dependency dependency2) { if (dependency1 == null || dependency1.getVulnerableSoftwareIdentifiers() == null || dependency2 == null || dependency2.getVulnerableSoftwareIdentifiers() == null) { return false; } boolean matches = false; final int cpeCount1 = dependency1.getVulnerableSoftwareIdentifiers().size(); final int cpeCount2 = dependency2.getVulnerableSoftwareIdentifiers().size(); if (cpeCount1 > 0 && cpeCount1 == cpeCount2) { for (Identifier i : dependency1.getVulnerableSoftwareIdentifiers()) { matches |= dependency2.getVulnerableSoftwareIdentifiers().contains(i); if (!matches) { break; } } } LOGGER.debug("IdentifiersMatch={} ({}, {})", matches, dependency1.getFileName(), dependency2.getFileName()); return matches; }
java
private boolean cpeIdentifiersMatch(Dependency dependency1, Dependency dependency2) { if (dependency1 == null || dependency1.getVulnerableSoftwareIdentifiers() == null || dependency2 == null || dependency2.getVulnerableSoftwareIdentifiers() == null) { return false; } boolean matches = false; final int cpeCount1 = dependency1.getVulnerableSoftwareIdentifiers().size(); final int cpeCount2 = dependency2.getVulnerableSoftwareIdentifiers().size(); if (cpeCount1 > 0 && cpeCount1 == cpeCount2) { for (Identifier i : dependency1.getVulnerableSoftwareIdentifiers()) { matches |= dependency2.getVulnerableSoftwareIdentifiers().contains(i); if (!matches) { break; } } } LOGGER.debug("IdentifiersMatch={} ({}, {})", matches, dependency1.getFileName(), dependency2.getFileName()); return matches; }
[ "private", "boolean", "cpeIdentifiersMatch", "(", "Dependency", "dependency1", ",", "Dependency", "dependency2", ")", "{", "if", "(", "dependency1", "==", "null", "||", "dependency1", ".", "getVulnerableSoftwareIdentifiers", "(", ")", "==", "null", "||", "dependency...
Returns true if the CPE identifiers in the two supplied dependencies are equal. @param dependency1 a dependency2 to compare @param dependency2 a dependency2 to compare @return true if the identifiers in the two supplied dependencies are equal
[ "Returns", "true", "if", "the", "CPE", "identifiers", "in", "the", "two", "supplied", "dependencies", "are", "equal", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/DependencyBundlingAnalyzer.java#L258-L276
JCTools/JCTools
jctools-core/src/main/java/org/jctools/queues/atomic/BaseSpscLinkedAtomicArrayQueue.java
BaseSpscLinkedAtomicArrayQueue.poll
@SuppressWarnings("unchecked") @Override public E poll() { // local load of field to avoid repeated loads after volatile reads final AtomicReferenceArray<E> buffer = consumerBuffer; final long index = lpConsumerIndex(); final long mask = consumerMask; final int offset = calcElementOffset(index, mask); // LoadLoad final Object e = lvElement(buffer, offset); boolean isNextBuffer = e == JUMP; if (null != e && !isNextBuffer) { // this ensures correctness on 32bit platforms soConsumerIndex(index + 1); soElement(buffer, offset, null); return (E) e; } else if (isNextBuffer) { return newBufferPoll(buffer, index); } return null; }
java
@SuppressWarnings("unchecked") @Override public E poll() { // local load of field to avoid repeated loads after volatile reads final AtomicReferenceArray<E> buffer = consumerBuffer; final long index = lpConsumerIndex(); final long mask = consumerMask; final int offset = calcElementOffset(index, mask); // LoadLoad final Object e = lvElement(buffer, offset); boolean isNextBuffer = e == JUMP; if (null != e && !isNextBuffer) { // this ensures correctness on 32bit platforms soConsumerIndex(index + 1); soElement(buffer, offset, null); return (E) e; } else if (isNextBuffer) { return newBufferPoll(buffer, index); } return null; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "public", "E", "poll", "(", ")", "{", "// local load of field to avoid repeated loads after volatile reads", "final", "AtomicReferenceArray", "<", "E", ">", "buffer", "=", "consumerBuffer", ";", "final...
{@inheritDoc} <p> This implementation is correct for single consumer thread use only.
[ "{" ]
train
https://github.com/JCTools/JCTools/blob/9250fe316ec84209cbba0a41682f341256df781e/jctools-core/src/main/java/org/jctools/queues/atomic/BaseSpscLinkedAtomicArrayQueue.java#L289-L309
kiegroup/drools
drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationUtils.java
TypeDeclarationUtils.toBuildableType
public static String toBuildableType(String className, ClassLoader loader) { int arrayDim = BuildUtils.externalArrayDimSize(className); String prefix = ""; String coreType = arrayDim == 0 ? className : className.substring(0, className.indexOf("[")); coreType = typeName2ClassName(coreType, loader); if (arrayDim > 0) { coreType = BuildUtils.getTypeDescriptor(coreType); for (int j = 0; j < arrayDim; j++) { prefix = "[" + prefix; } } else { return coreType; } return prefix + coreType; }
java
public static String toBuildableType(String className, ClassLoader loader) { int arrayDim = BuildUtils.externalArrayDimSize(className); String prefix = ""; String coreType = arrayDim == 0 ? className : className.substring(0, className.indexOf("[")); coreType = typeName2ClassName(coreType, loader); if (arrayDim > 0) { coreType = BuildUtils.getTypeDescriptor(coreType); for (int j = 0; j < arrayDim; j++) { prefix = "[" + prefix; } } else { return coreType; } return prefix + coreType; }
[ "public", "static", "String", "toBuildableType", "(", "String", "className", ",", "ClassLoader", "loader", ")", "{", "int", "arrayDim", "=", "BuildUtils", ".", "externalArrayDimSize", "(", "className", ")", ";", "String", "prefix", "=", "\"\"", ";", "String", ...
not the cleanest logic, but this is what the builders expect downstream
[ "not", "the", "cleanest", "logic", "but", "this", "is", "what", "the", "builders", "expect", "downstream" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/drools-compiler/src/main/java/org/drools/compiler/builder/impl/TypeDeclarationUtils.java#L273-L290
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/util/Memory.java
Memory.getBytes
public void getBytes(long memoryOffset, byte[] buffer, int bufferOffset, int count) { if (buffer == null) throw new NullPointerException(); else if (bufferOffset < 0 || count < 0 || count > buffer.length - bufferOffset) throw new IndexOutOfBoundsException(); else if (count == 0) return; checkBounds(memoryOffset, memoryOffset + count); FastByteOperations.UnsafeOperations.copy(null, peer + memoryOffset, buffer, bufferOffset, count); }
java
public void getBytes(long memoryOffset, byte[] buffer, int bufferOffset, int count) { if (buffer == null) throw new NullPointerException(); else if (bufferOffset < 0 || count < 0 || count > buffer.length - bufferOffset) throw new IndexOutOfBoundsException(); else if (count == 0) return; checkBounds(memoryOffset, memoryOffset + count); FastByteOperations.UnsafeOperations.copy(null, peer + memoryOffset, buffer, bufferOffset, count); }
[ "public", "void", "getBytes", "(", "long", "memoryOffset", ",", "byte", "[", "]", "buffer", ",", "int", "bufferOffset", ",", "int", "count", ")", "{", "if", "(", "buffer", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "else", ...
Transfers count bytes from Memory starting at memoryOffset to buffer starting at bufferOffset @param memoryOffset start offset in the memory @param buffer the data buffer @param bufferOffset start offset of the buffer @param count number of bytes to transfer
[ "Transfers", "count", "bytes", "from", "Memory", "starting", "at", "memoryOffset", "to", "buffer", "starting", "at", "bufferOffset" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/util/Memory.java#L311-L322
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbvserver_binding.java
lbvserver_binding.get
public static lbvserver_binding get(nitro_service service, String name) throws Exception{ lbvserver_binding obj = new lbvserver_binding(); obj.set_name(name); lbvserver_binding response = (lbvserver_binding) obj.get_resource(service); return response; }
java
public static lbvserver_binding get(nitro_service service, String name) throws Exception{ lbvserver_binding obj = new lbvserver_binding(); obj.set_name(name); lbvserver_binding response = (lbvserver_binding) obj.get_resource(service); return response; }
[ "public", "static", "lbvserver_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "lbvserver_binding", "obj", "=", "new", "lbvserver_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", ...
Use this API to fetch lbvserver_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "lbvserver_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/lb/lbvserver_binding.java#L345-L350
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/EcKey.java
EcKey.fromJsonWebKey
public static EcKey fromJsonWebKey(JsonWebKey jwk, boolean includePrivateParameters, Provider provider) { try { if (jwk.kid() != null) { return new EcKey(jwk.kid(), jwk.toEC(includePrivateParameters, provider)); } else { throw new IllegalArgumentException("Json Web Key should have a kid"); } } catch (GeneralSecurityException e) { throw new IllegalStateException(e); } }
java
public static EcKey fromJsonWebKey(JsonWebKey jwk, boolean includePrivateParameters, Provider provider) { try { if (jwk.kid() != null) { return new EcKey(jwk.kid(), jwk.toEC(includePrivateParameters, provider)); } else { throw new IllegalArgumentException("Json Web Key should have a kid"); } } catch (GeneralSecurityException e) { throw new IllegalStateException(e); } }
[ "public", "static", "EcKey", "fromJsonWebKey", "(", "JsonWebKey", "jwk", ",", "boolean", "includePrivateParameters", ",", "Provider", "provider", ")", "{", "try", "{", "if", "(", "jwk", ".", "kid", "(", ")", "!=", "null", ")", "{", "return", "new", "EcKey"...
Converts JSON web key to EC key pair and include the private key if set to true. @param jwk @param includePrivateParameters true if the EC key pair should include the private key. False otherwise. @param provider the Java Security Provider @return EcKey
[ "Converts", "JSON", "web", "key", "to", "EC", "key", "pair", "and", "include", "the", "private", "key", "if", "set", "to", "true", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault-cryptography/src/main/java/com/microsoft/azure/keyvault/cryptography/EcKey.java#L222-L232
JodaOrg/joda-time
src/main/java/org/joda/time/PeriodType.java
PeriodType.addIndexedField
boolean addIndexedField(ReadablePeriod period, int index, int[] values, int valueToAdd) { if (valueToAdd == 0) { return false; } int realIndex = iIndices[index]; if (realIndex == -1) { throw new UnsupportedOperationException("Field is not supported"); } values[realIndex] = FieldUtils.safeAdd(values[realIndex], valueToAdd); return true; }
java
boolean addIndexedField(ReadablePeriod period, int index, int[] values, int valueToAdd) { if (valueToAdd == 0) { return false; } int realIndex = iIndices[index]; if (realIndex == -1) { throw new UnsupportedOperationException("Field is not supported"); } values[realIndex] = FieldUtils.safeAdd(values[realIndex], valueToAdd); return true; }
[ "boolean", "addIndexedField", "(", "ReadablePeriod", "period", ",", "int", "index", ",", "int", "[", "]", "values", ",", "int", "valueToAdd", ")", "{", "if", "(", "valueToAdd", "==", "0", ")", "{", "return", "false", ";", "}", "int", "realIndex", "=", ...
Adds to the indexed field part of the period. @param period the period to query @param index the index to use @param values the array to populate @param valueToAdd the value to add @return true if the array is updated @throws UnsupportedOperationException if not supported
[ "Adds", "to", "the", "indexed", "field", "part", "of", "the", "period", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/PeriodType.java#L706-L716
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java
SubscriptionMessageHandler.resetCreateSubscriptionMessage
protected void resetCreateSubscriptionMessage(MESubscription subscription, boolean isLocalBus) { if (tc.isEntryEnabled()) SibTr.entry(tc, "resetCreateSubscriptionMessage", new Object[]{subscription, new Boolean(isLocalBus)}); // Reset the state reset(); // Indicate that this is a create message iSubscriptionMessage.setSubscriptionMessageType( SubscriptionMessageType.CREATE); // Add the subscription related information. iTopics.add(subscription.getTopic()); if(isLocalBus) { //see defect 267686: //local bus subscriptions expect the subscribing ME's //detination uuid to be set in the iTopicSpaces field iTopicSpaces.add(subscription.getTopicSpaceUuid().toString()); } else { //see defect 267686: //foreign bus subscriptions need to set the subscribers's topic space name. //This is because the messages sent to this topic over the link //will need to have a routing destination set, which requires //this value. iTopicSpaces.add(subscription.getTopicSpaceName().toString()); } iTopicSpaceMappings.add(subscription.getForeignTSName()); if (tc.isEntryEnabled()) SibTr.exit(tc, "resetCreateSubscriptionMessage"); }
java
protected void resetCreateSubscriptionMessage(MESubscription subscription, boolean isLocalBus) { if (tc.isEntryEnabled()) SibTr.entry(tc, "resetCreateSubscriptionMessage", new Object[]{subscription, new Boolean(isLocalBus)}); // Reset the state reset(); // Indicate that this is a create message iSubscriptionMessage.setSubscriptionMessageType( SubscriptionMessageType.CREATE); // Add the subscription related information. iTopics.add(subscription.getTopic()); if(isLocalBus) { //see defect 267686: //local bus subscriptions expect the subscribing ME's //detination uuid to be set in the iTopicSpaces field iTopicSpaces.add(subscription.getTopicSpaceUuid().toString()); } else { //see defect 267686: //foreign bus subscriptions need to set the subscribers's topic space name. //This is because the messages sent to this topic over the link //will need to have a routing destination set, which requires //this value. iTopicSpaces.add(subscription.getTopicSpaceName().toString()); } iTopicSpaceMappings.add(subscription.getForeignTSName()); if (tc.isEntryEnabled()) SibTr.exit(tc, "resetCreateSubscriptionMessage"); }
[ "protected", "void", "resetCreateSubscriptionMessage", "(", "MESubscription", "subscription", ",", "boolean", "isLocalBus", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"resetCreateSubscriptionMessage\"", ...
Method to reset the Subscription message object and reinitialise it as a create proxy subscription message @param subscription The subscription to add to the message. @param isLocalBus The subscription is being sent to a the local bus
[ "Method", "to", "reset", "the", "Subscription", "message", "object", "and", "reinitialise", "it", "as", "a", "create", "proxy", "subscription", "message" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/proxyhandler/SubscriptionMessageHandler.java#L172-L208
beihaifeiwu/dolphin
dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/formatter/StringHelper.java
StringHelper.partiallyUnqualify
public static String partiallyUnqualify(String name, String qualifierBase) { if (name == null || !name.startsWith(qualifierBase)) { return name; } return name.substring(qualifierBase.length() + 1); // +1 to start after the following '.' }
java
public static String partiallyUnqualify(String name, String qualifierBase) { if (name == null || !name.startsWith(qualifierBase)) { return name; } return name.substring(qualifierBase.length() + 1); // +1 to start after the following '.' }
[ "public", "static", "String", "partiallyUnqualify", "(", "String", "name", ",", "String", "qualifierBase", ")", "{", "if", "(", "name", "==", "null", "||", "!", "name", ".", "startsWith", "(", "qualifierBase", ")", ")", "{", "return", "name", ";", "}", "...
Partially unqualifies a qualified name. For example, with a base of 'org.hibernate' the name 'org.hibernate.internal.util.StringHelper' would become 'util.StringHelper'. @param name The (potentially) qualified name. @param qualifierBase The qualifier base. @return The name itself, or the partially unqualified form if it begins with the qualifier base.
[ "Partially", "unqualifies", "a", "qualified", "name", ".", "For", "example", "with", "a", "base", "of", "org", ".", "hibernate", "the", "name", "org", ".", "hibernate", ".", "internal", ".", "util", ".", "StringHelper", "would", "become", "util", ".", "Str...
train
https://github.com/beihaifeiwu/dolphin/blob/b100579cc6986dce5eba5593ebb5fbae7bad9d1a/dolphin-mybatis-generator/src/main/java/com/freetmp/mbg/formatter/StringHelper.java#L270-L275
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.deleteItemAsFuture
public FutureAPIResponse deleteItemAsFuture(String iid, DateTime eventTime) throws IOException { return createEventAsFuture(new Event() .event("$delete") .entityType("item") .entityId(iid) .eventTime(eventTime)); }
java
public FutureAPIResponse deleteItemAsFuture(String iid, DateTime eventTime) throws IOException { return createEventAsFuture(new Event() .event("$delete") .entityType("item") .entityId(iid) .eventTime(eventTime)); }
[ "public", "FutureAPIResponse", "deleteItemAsFuture", "(", "String", "iid", ",", "DateTime", "eventTime", ")", "throws", "IOException", "{", "return", "createEventAsFuture", "(", "new", "Event", "(", ")", ".", "event", "(", "\"$delete\"", ")", ".", "entityType", ...
Sends a delete item request. @param iid ID of the item @param eventTime timestamp of the event
[ "Sends", "a", "delete", "item", "request", "." ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L562-L569
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.putAt
public static void putAt(List self, List splice, List values) { if (splice.isEmpty()) { if ( ! values.isEmpty() ) throw new IllegalArgumentException("Trying to replace 0 elements with "+values.size()+" elements"); return; } Object first = splice.iterator().next(); if (first instanceof Integer) { if (values.size() != splice.size()) throw new IllegalArgumentException("Trying to replace "+splice.size()+" elements with "+values.size()+" elements"); Iterator<?> valuesIter = values.iterator(); for (Object index : splice) { putAt(self, (Integer) index, valuesIter.next()); } } else { throw new IllegalArgumentException("Can only index a List with another List of Integers, not a List of "+first.getClass().getName()); } }
java
public static void putAt(List self, List splice, List values) { if (splice.isEmpty()) { if ( ! values.isEmpty() ) throw new IllegalArgumentException("Trying to replace 0 elements with "+values.size()+" elements"); return; } Object first = splice.iterator().next(); if (first instanceof Integer) { if (values.size() != splice.size()) throw new IllegalArgumentException("Trying to replace "+splice.size()+" elements with "+values.size()+" elements"); Iterator<?> valuesIter = values.iterator(); for (Object index : splice) { putAt(self, (Integer) index, valuesIter.next()); } } else { throw new IllegalArgumentException("Can only index a List with another List of Integers, not a List of "+first.getClass().getName()); } }
[ "public", "static", "void", "putAt", "(", "List", "self", ",", "List", "splice", ",", "List", "values", ")", "{", "if", "(", "splice", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "!", "values", ".", "isEmpty", "(", ")", ")", "throw", "new", "I...
A helper method to allow lists to work with subscript operators. <pre class="groovyTestCase">def list = ["a", true, 42, 9.4] list[1, 4] = ["x", false] assert list == ["a", "x", 42, 9.4, false]</pre> @param self a List @param splice the subset of the list to set @param values the value to put at the given sublist @since 1.0
[ "A", "helper", "method", "to", "allow", "lists", "to", "work", "with", "subscript", "operators", ".", "<pre", "class", "=", "groovyTestCase", ">", "def", "list", "=", "[", "a", "true", "42", "9", ".", "4", "]", "list", "[", "1", "4", "]", "=", "[",...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L8081-L8098
threerings/nenya
core/src/main/java/com/threerings/miso/client/SceneObject.java
SceneObject.relocateObject
public void relocateObject (MisoSceneMetrics metrics, int tx, int ty) { // Log.info("Relocating object " + this + " to " + // StringUtil.coordsToString(tx, ty)); info.x = tx; info.y = ty; computeInfo(metrics); }
java
public void relocateObject (MisoSceneMetrics metrics, int tx, int ty) { // Log.info("Relocating object " + this + " to " + // StringUtil.coordsToString(tx, ty)); info.x = tx; info.y = ty; computeInfo(metrics); }
[ "public", "void", "relocateObject", "(", "MisoSceneMetrics", "metrics", ",", "int", "tx", ",", "int", "ty", ")", "{", "// Log.info(\"Relocating object \" + this + \" to \" +", "// StringUtil.coordsToString(tx, ty));", "info", ".", "x", "=", "tx", ";...
Updates this object's origin tile coordinate. Its bounds and other cached screen coordinate information are updated.
[ "Updates", "this", "object", "s", "origin", "tile", "coordinate", ".", "Its", "bounds", "and", "other", "cached", "screen", "coordinate", "information", "are", "updated", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/miso/client/SceneObject.java#L248-L255
jfinal/jfinal
src/main/java/com/jfinal/plugin/redis/Cache.java
Cache.pexpire
public Long pexpire(Object key, long milliseconds) { Jedis jedis = getJedis(); try { return jedis.pexpire(keyToBytes(key), milliseconds); } finally {close(jedis);} }
java
public Long pexpire(Object key, long milliseconds) { Jedis jedis = getJedis(); try { return jedis.pexpire(keyToBytes(key), milliseconds); } finally {close(jedis);} }
[ "public", "Long", "pexpire", "(", "Object", "key", ",", "long", "milliseconds", ")", "{", "Jedis", "jedis", "=", "getJedis", "(", ")", ";", "try", "{", "return", "jedis", ".", "pexpire", "(", "keyToBytes", "(", "key", ")", ",", "milliseconds", ")", ";"...
这个命令和 EXPIRE 命令的作用类似,但是它以毫秒为单位设置 key 的生存时间,而不像 EXPIRE 命令那样,以秒为单位。
[ "这个命令和", "EXPIRE", "命令的作用类似,但是它以毫秒为单位设置", "key", "的生存时间,而不像", "EXPIRE", "命令那样,以秒为单位。" ]
train
https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/redis/Cache.java#L340-L346
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/ProcessorDef.java
ProcessorDef.getRebuild
public boolean getRebuild(final ProcessorDef[] defaultProviders, final int index) { if (isReference()) { return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getRebuild(defaultProviders, index); } if (this.rebuild != null) { return this.rebuild.booleanValue(); } else { if (defaultProviders != null && index < defaultProviders.length) { return defaultProviders[index].getRebuild(defaultProviders, index + 1); } } return false; }
java
public boolean getRebuild(final ProcessorDef[] defaultProviders, final int index) { if (isReference()) { return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getRebuild(defaultProviders, index); } if (this.rebuild != null) { return this.rebuild.booleanValue(); } else { if (defaultProviders != null && index < defaultProviders.length) { return defaultProviders[index].getRebuild(defaultProviders, index + 1); } } return false; }
[ "public", "boolean", "getRebuild", "(", "final", "ProcessorDef", "[", "]", "defaultProviders", ",", "final", "int", "index", ")", "{", "if", "(", "isReference", "(", ")", ")", "{", "return", "(", "(", "ProcessorDef", ")", "getCheckedRef", "(", "ProcessorDef"...
Gets a boolean value indicating whether all targets must be rebuilt regardless of dependency analysis. @param defaultProviders array of ProcessorDef's in descending priority @param index index to first element in array that should be considered @return true if all targets should be rebuilt.
[ "Gets", "a", "boolean", "value", "indicating", "whether", "all", "targets", "must", "be", "rebuilt", "regardless", "of", "dependency", "analysis", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/ProcessorDef.java#L407-L419
alibaba/otter
node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/RowDataTransformer.java
RowDataTransformer.buildName
private void buildName(EventData data, EventData result, DataMediaPair pair) { DataMedia targetDataMedia = pair.getTarget(); DataMedia sourceDataMedia = pair.getSource(); String schemaName = buildName(data.getSchemaName(), sourceDataMedia.getNamespaceMode(), targetDataMedia.getNamespaceMode()); String tableName = buildName(data.getTableName(), sourceDataMedia.getNameMode(), targetDataMedia.getNameMode()); result.setSchemaName(schemaName); result.setTableName(tableName); }
java
private void buildName(EventData data, EventData result, DataMediaPair pair) { DataMedia targetDataMedia = pair.getTarget(); DataMedia sourceDataMedia = pair.getSource(); String schemaName = buildName(data.getSchemaName(), sourceDataMedia.getNamespaceMode(), targetDataMedia.getNamespaceMode()); String tableName = buildName(data.getTableName(), sourceDataMedia.getNameMode(), targetDataMedia.getNameMode()); result.setSchemaName(schemaName); result.setTableName(tableName); }
[ "private", "void", "buildName", "(", "EventData", "data", ",", "EventData", "result", ",", "DataMediaPair", "pair", ")", "{", "DataMedia", "targetDataMedia", "=", "pair", ".", "getTarget", "(", ")", ";", "DataMedia", "sourceDataMedia", "=", "pair", ".", "getSo...
设置对应的目标库schema.name,需要考虑mutl配置情况 <pre> case: 1. 源:offer , 目:offer 2. 源:offer[1-128] , 目:offer 3. 源:offer[1-128] , 目:offer[1-128] 4. 源:offer , 目:offer[1-128] 不支持,会报错
[ "设置对应的目标库schema", ".", "name,需要考虑mutl配置情况" ]
train
https://github.com/alibaba/otter/blob/c7b5f94a0dd162e01ddffaf3a63cade7d23fca55/node/etl/src/main/java/com/alibaba/otter/node/etl/transform/transformer/RowDataTransformer.java#L146-L155
JavaMoney/jsr354-ri
moneta-core/src/main/java/org/javamoney/moneta/Money.java
Money.ofMinor
public static Money ofMinor(CurrencyUnit currency, long amountMinor) { return ofMinor(currency, amountMinor, currency.getDefaultFractionDigits()); }
java
public static Money ofMinor(CurrencyUnit currency, long amountMinor) { return ofMinor(currency, amountMinor, currency.getDefaultFractionDigits()); }
[ "public", "static", "Money", "ofMinor", "(", "CurrencyUnit", "currency", ",", "long", "amountMinor", ")", "{", "return", "ofMinor", "(", "currency", ",", "amountMinor", ",", "currency", ".", "getDefaultFractionDigits", "(", ")", ")", ";", "}" ]
Obtains an instance of {@code Money} from an amount in minor units. For example, {@code ofMinor(USD, 1234)} creates the instance {@code USD 12.34}. @param currency the currency @param amountMinor the amount of money in the minor division of the currency @return the Money from minor units @throws NullPointerException when the currency is null @throws IllegalArgumentException when {@link CurrencyUnit#getDefaultFractionDigits()} is lesser than zero. @see CurrencyUnit#getDefaultFractionDigits() @since 1.0.1
[ "Obtains", "an", "instance", "of", "{" ]
train
https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-core/src/main/java/org/javamoney/moneta/Money.java#L814-L816
fracpete/multisearch-weka-package
src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java
AbstractSearch.logPerformances
protected void logPerformances(Space space, Vector<Performance> performances) { m_Owner.logPerformances(space, performances); }
java
protected void logPerformances(Space space, Vector<Performance> performances) { m_Owner.logPerformances(space, performances); }
[ "protected", "void", "logPerformances", "(", "Space", "space", ",", "Vector", "<", "Performance", ">", "performances", ")", "{", "m_Owner", ".", "logPerformances", "(", "space", ",", "performances", ")", ";", "}" ]
aligns all performances in the space and prints those tables to the log file. @param space the current space to align the performances to @param performances the performances to align
[ "aligns", "all", "performances", "in", "the", "space", "and", "prints", "those", "tables", "to", "the", "log", "file", "." ]
train
https://github.com/fracpete/multisearch-weka-package/blob/756fcf343e7cc9fd3844c99a0e1e828368f393d0/src/main/java/weka/classifiers/meta/multisearch/AbstractSearch.java#L273-L275
NessComputing/service-discovery
client/src/main/java/com/nesscomputing/service/discovery/client/internal/ServiceDiscoveryRunnable.java
ServiceDiscoveryRunnable.determineCurrentGeneration
@Override public long determineCurrentGeneration(final AtomicLong generation, final long tick) { // If the scan interval was reached, trigger the // run. if (tick - lastScan >= scanTicks) { lastScan = tick; return generation.incrementAndGet(); } // Otherwise, give the service discovery serviceDiscoveryVisitors a chance // to increment the generation. for (ServiceDiscoveryTask visitor : visitors) { visitor.determineGeneration(generation, tick); } return generation.get(); }
java
@Override public long determineCurrentGeneration(final AtomicLong generation, final long tick) { // If the scan interval was reached, trigger the // run. if (tick - lastScan >= scanTicks) { lastScan = tick; return generation.incrementAndGet(); } // Otherwise, give the service discovery serviceDiscoveryVisitors a chance // to increment the generation. for (ServiceDiscoveryTask visitor : visitors) { visitor.determineGeneration(generation, tick); } return generation.get(); }
[ "@", "Override", "public", "long", "determineCurrentGeneration", "(", "final", "AtomicLong", "generation", ",", "final", "long", "tick", ")", "{", "// If the scan interval was reached, trigger the", "// run.", "if", "(", "tick", "-", "lastScan", ">=", "scanTicks", ")"...
Trigger the loop every time enough ticks have been accumulated, or whenever any of the visitors requests it.
[ "Trigger", "the", "loop", "every", "time", "enough", "ticks", "have", "been", "accumulated", "or", "whenever", "any", "of", "the", "visitors", "requests", "it", "." ]
train
https://github.com/NessComputing/service-discovery/blob/5091ffdb1de6b12d216d1c238f72858037c7b765/client/src/main/java/com/nesscomputing/service/discovery/client/internal/ServiceDiscoveryRunnable.java#L68-L85
dimaki/refuel
src/main/java/de/dimaki/refuel/updater/boundary/Updater.java
Updater.getApplicationStatus
public ApplicationStatus getApplicationStatus(String localVersion, final URL updateUrl) { return getApplicationStatus(localVersion, updateUrl, null, AppcastManager.DEFAULT_CONNECT_TIMEOUT, AppcastManager.DEFAULT_READ_TIMEOUT); }
java
public ApplicationStatus getApplicationStatus(String localVersion, final URL updateUrl) { return getApplicationStatus(localVersion, updateUrl, null, AppcastManager.DEFAULT_CONNECT_TIMEOUT, AppcastManager.DEFAULT_READ_TIMEOUT); }
[ "public", "ApplicationStatus", "getApplicationStatus", "(", "String", "localVersion", ",", "final", "URL", "updateUrl", ")", "{", "return", "getApplicationStatus", "(", "localVersion", ",", "updateUrl", ",", "null", ",", "AppcastManager", ".", "DEFAULT_CONNECT_TIMEOUT",...
Get the update status of the application specified. @param localVersion The local version string, e.g. "2.0.1344" @param updateUrl The update URL (Appcast URL) @return The application status or 'null' if the status could not be evaluated
[ "Get", "the", "update", "status", "of", "the", "application", "specified", "." ]
train
https://github.com/dimaki/refuel/blob/8024ac34f52b33de291d859c3b12fc237783f873/src/main/java/de/dimaki/refuel/updater/boundary/Updater.java#L68-L70
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java
CPDefinitionLinkPersistenceImpl.findByCP_T
@Override public List<CPDefinitionLink> findByCP_T(long CProductId, String type, int start, int end) { return findByCP_T(CProductId, type, start, end, null); }
java
@Override public List<CPDefinitionLink> findByCP_T(long CProductId, String type, int start, int end) { return findByCP_T(CProductId, type, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPDefinitionLink", ">", "findByCP_T", "(", "long", "CProductId", ",", "String", "type", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCP_T", "(", "CProductId", ",", "type", ",", "start", ",", ...
Returns a range of all the cp definition links where CProductId = &#63; and type = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionLinkModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CProductId the c product ID @param type the type @param start the lower bound of the range of cp definition links @param end the upper bound of the range of cp definition links (not inclusive) @return the range of matching cp definition links
[ "Returns", "a", "range", "of", "all", "the", "cp", "definition", "links", "where", "CProductId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java#L3153-L3157
OpenLiberty/open-liberty
dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableService.java
AppBndAuthorizationTableService.establishInitialTable
private boolean establishInitialTable(String appName, Collection<SecurityRole> secRoles) { // Create and add a new table if we don't have a cached copy if (resourceToAuthzInfoMap.putIfAbsent(appName, new AuthzInfo(appName, secRoles)) == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Created initial authorization tables for " + appName); } return true; } return false; }
java
private boolean establishInitialTable(String appName, Collection<SecurityRole> secRoles) { // Create and add a new table if we don't have a cached copy if (resourceToAuthzInfoMap.putIfAbsent(appName, new AuthzInfo(appName, secRoles)) == null) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Created initial authorization tables for " + appName); } return true; } return false; }
[ "private", "boolean", "establishInitialTable", "(", "String", "appName", ",", "Collection", "<", "SecurityRole", ">", "secRoles", ")", "{", "// Create and add a new table if we don't have a cached copy", "if", "(", "resourceToAuthzInfoMap", ".", "putIfAbsent", "(", "appName...
Establishes the basic information that comprises an authorization table, but all real work is deferred until later. This has some benefits:<p> <ol> <li>Faster application deployment</li> <li>If the authorization table is not used, such as for SAF authorization, we do not incur much cost to establish the table.</li> </ol> <p> If a table already exists for the application name, issue an error. Two applications with the same name is an error, and we should not be going through appDeployed without having gone through appUndeployed. @param appName @param securityRoles @return {@code true} if the (new) table was created, {@code false} if there was an existing table.
[ "Establishes", "the", "basic", "information", "that", "comprises", "an", "authorization", "table", "but", "all", "real", "work", "is", "deferred", "until", "later", ".", "This", "has", "some", "benefits", ":", "<p", ">", "<ol", ">", "<li", ">", "Faster", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.appbnd/src/com/ibm/ws/security/appbnd/internal/authorization/AppBndAuthorizationTableService.java#L210-L219
tvesalainen/util
util/src/main/java/org/vesalainen/util/InterfaceTracer.java
InterfaceTracer.getTracer
public static <T> T getTracer(Class<T> intf, T ob) { return getTracer(intf, new InterfaceTracer(ob), ob); }
java
public static <T> T getTracer(Class<T> intf, T ob) { return getTracer(intf, new InterfaceTracer(ob), ob); }
[ "public", "static", "<", "T", ">", "T", "getTracer", "(", "Class", "<", "T", ">", "intf", ",", "T", "ob", ")", "{", "return", "getTracer", "(", "intf", ",", "new", "InterfaceTracer", "(", "ob", ")", ",", "ob", ")", ";", "}" ]
Creates a tracer for intf @param <T> @param intf Implemented interface @param ob Class instance for given interface or null @return
[ "Creates", "a", "tracer", "for", "intf" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/InterfaceTracer.java#L62-L65
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/AbstractSelectCodeGenerator.java
AbstractSelectCodeGenerator.generateSQLBuild
private static void generateSQLBuild(SQLiteModelMethod method, MethodSpec.Builder methodBuilder, SplittedSql splittedSql, boolean countQuery) { methodBuilder.addStatement("$T _sqlBuilder=sqlBuilder()", StringBuilder.class); methodBuilder.addStatement("_sqlBuilder.append($S)", splittedSql.sqlBasic.trim()); SqlModifyBuilder.generateInitForDynamicWhereVariables(method, methodBuilder, method.dynamicWhereParameterName, method.dynamicWhereArgsParameterName); if (method.jql.isOrderBy()) { methodBuilder.addStatement("String _sortOrder=$L", method.jql.paramOrderBy); } SqlBuilderHelper.generateWhereCondition(methodBuilder, method, false); SqlSelectBuilder.generateDynamicPartOfQuery(method, methodBuilder, splittedSql, countQuery); }
java
private static void generateSQLBuild(SQLiteModelMethod method, MethodSpec.Builder methodBuilder, SplittedSql splittedSql, boolean countQuery) { methodBuilder.addStatement("$T _sqlBuilder=sqlBuilder()", StringBuilder.class); methodBuilder.addStatement("_sqlBuilder.append($S)", splittedSql.sqlBasic.trim()); SqlModifyBuilder.generateInitForDynamicWhereVariables(method, methodBuilder, method.dynamicWhereParameterName, method.dynamicWhereArgsParameterName); if (method.jql.isOrderBy()) { methodBuilder.addStatement("String _sortOrder=$L", method.jql.paramOrderBy); } SqlBuilderHelper.generateWhereCondition(methodBuilder, method, false); SqlSelectBuilder.generateDynamicPartOfQuery(method, methodBuilder, splittedSql, countQuery); }
[ "private", "static", "void", "generateSQLBuild", "(", "SQLiteModelMethod", "method", ",", "MethodSpec", ".", "Builder", "methodBuilder", ",", "SplittedSql", "splittedSql", ",", "boolean", "countQuery", ")", "{", "methodBuilder", ".", "addStatement", "(", "\"$T _sqlBui...
Generate SQL build. @param method the method @param methodBuilder the method builder @param splittedSql the splitted sql @param countQuery is true, the query manage the count query for paged result
[ "Generate", "SQL", "build", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/AbstractSelectCodeGenerator.java#L825-L837
samskivert/samskivert
src/main/java/com/samskivert/util/MethodFinder.java
MethodFinder.findMemberIn
protected Member findMemberIn (List<Member> memberList, Class<?>[] parameterTypes) throws NoSuchMethodException { List<Member> matchingMembers = new ArrayList<Member>(); for (Iterator<Member> it = memberList.iterator(); it.hasNext();) { Member member = it.next(); Class<?>[] methodParamTypes = _paramMap.get(member); // check for exactly equal method signature if (Arrays.equals(methodParamTypes, parameterTypes)) { return member; } if (ClassUtil.compatibleClasses(methodParamTypes, parameterTypes)) { matchingMembers.add(member); } } if (matchingMembers.isEmpty()) { throw new NoSuchMethodException( "No member in " + _clazz.getName() + " matching given args"); } if (matchingMembers.size() == 1) { return matchingMembers.get(0); } return findMostSpecificMemberIn(matchingMembers); }
java
protected Member findMemberIn (List<Member> memberList, Class<?>[] parameterTypes) throws NoSuchMethodException { List<Member> matchingMembers = new ArrayList<Member>(); for (Iterator<Member> it = memberList.iterator(); it.hasNext();) { Member member = it.next(); Class<?>[] methodParamTypes = _paramMap.get(member); // check for exactly equal method signature if (Arrays.equals(methodParamTypes, parameterTypes)) { return member; } if (ClassUtil.compatibleClasses(methodParamTypes, parameterTypes)) { matchingMembers.add(member); } } if (matchingMembers.isEmpty()) { throw new NoSuchMethodException( "No member in " + _clazz.getName() + " matching given args"); } if (matchingMembers.size() == 1) { return matchingMembers.get(0); } return findMostSpecificMemberIn(matchingMembers); }
[ "protected", "Member", "findMemberIn", "(", "List", "<", "Member", ">", "memberList", ",", "Class", "<", "?", ">", "[", "]", "parameterTypes", ")", "throws", "NoSuchMethodException", "{", "List", "<", "Member", ">", "matchingMembers", "=", "new", "ArrayList", ...
Basis of {@link #findConstructor} and {@link #findMethod}. The member list fed to this method will be either all {@link Constructor} objects or all {@link Method} objects.
[ "Basis", "of", "{" ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/MethodFinder.java#L144-L172
google/error-prone-javac
make/src/classes/build/tools/symbolgenerator/CreateSymbols.java
CreateSymbols.createSymbols
@SuppressWarnings("unchecked") public void createSymbols(String ctDescriptionFile, String ctSymLocation, CtSymKind ctSymKind) throws IOException { ClassList classes = load(Paths.get(ctDescriptionFile)); splitHeaders(classes); for (ClassDescription classDescription : classes) { for (ClassHeaderDescription header : classDescription.header) { switch (ctSymKind) { case JOINED_VERSIONS: Set<String> jointVersions = new HashSet<>(); jointVersions.add(header.versions); limitJointVersion(jointVersions, classDescription.fields); limitJointVersion(jointVersions, classDescription.methods); writeClassesForVersions(ctSymLocation, classDescription, header, jointVersions); break; case SEPARATE: Set<String> versions = new HashSet<>(); for (char v : header.versions.toCharArray()) { versions.add("" + v); } writeClassesForVersions(ctSymLocation, classDescription, header, versions); break; } } } }
java
@SuppressWarnings("unchecked") public void createSymbols(String ctDescriptionFile, String ctSymLocation, CtSymKind ctSymKind) throws IOException { ClassList classes = load(Paths.get(ctDescriptionFile)); splitHeaders(classes); for (ClassDescription classDescription : classes) { for (ClassHeaderDescription header : classDescription.header) { switch (ctSymKind) { case JOINED_VERSIONS: Set<String> jointVersions = new HashSet<>(); jointVersions.add(header.versions); limitJointVersion(jointVersions, classDescription.fields); limitJointVersion(jointVersions, classDescription.methods); writeClassesForVersions(ctSymLocation, classDescription, header, jointVersions); break; case SEPARATE: Set<String> versions = new HashSet<>(); for (char v : header.versions.toCharArray()) { versions.add("" + v); } writeClassesForVersions(ctSymLocation, classDescription, header, versions); break; } } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "createSymbols", "(", "String", "ctDescriptionFile", ",", "String", "ctSymLocation", ",", "CtSymKind", "ctSymKind", ")", "throws", "IOException", "{", "ClassList", "classes", "=", "load", "(", "...
Create sig files for ct.sym reading the classes description from the directory that contains {@code ctDescriptionFile}, using the file as a recipe to create the sigfiles.
[ "Create", "sig", "files", "for", "ct", ".", "sym", "reading", "the", "classes", "description", "from", "the", "directory", "that", "contains", "{" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/make/src/classes/build/tools/symbolgenerator/CreateSymbols.java#L165-L191
meertensinstituut/mtas
src/main/java/mtas/codec/util/CodecInfo.java
CodecInfo.getNumberOfTokens
public Integer getNumberOfTokens(String field, int docId) { if (fieldReferences.containsKey(field)) { IndexDoc doc = getDoc(field, docId); if (doc != null) { return doc.size; } } return null; }
java
public Integer getNumberOfTokens(String field, int docId) { if (fieldReferences.containsKey(field)) { IndexDoc doc = getDoc(field, docId); if (doc != null) { return doc.size; } } return null; }
[ "public", "Integer", "getNumberOfTokens", "(", "String", "field", ",", "int", "docId", ")", "{", "if", "(", "fieldReferences", ".", "containsKey", "(", "field", ")", ")", "{", "IndexDoc", "doc", "=", "getDoc", "(", "field", ",", "docId", ")", ";", "if", ...
Gets the number of tokens. @param field the field @param docId the doc id @return the number of tokens
[ "Gets", "the", "number", "of", "tokens", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/codec/util/CodecInfo.java#L690-L698
CenturyLinkCloud/mdw
mdw-workflow/assets/com/centurylink/mdw/drools/RulesBasedStrategy.java
RulesBasedStrategy.getClassLoader
public ClassLoader getClassLoader() throws StrategyException { // Determine the package by parsing the attribute name (different name for different types of Rules based strategies) String kbAttributeName = getKnowledgeBaseAttributeName(); Object kbName = getParameter(kbAttributeName); if (kbName == null) throw new StrategyException("Missing strategy parameter: " + kbAttributeName); // Get the package Name String kbNameStr = kbName.toString(); int lastSlash = kbNameStr.lastIndexOf('/'); String pkg = lastSlash == -1 ? null : kbNameStr.substring(0, lastSlash) ; try { Package pkgVO = PackageCache.getPackage(pkg); if (pkgVO == null) throw new StrategyException("Unable to get package name from strategy: " + kbAttributeName +" value="+kbNameStr); // return the cloud class loader by default, unless the bundle spec is set return pkgVO.getClassLoader(); } catch (CachingException ex) { throw new StrategyException("Error getting strategy package: " + pkg, ex); } }
java
public ClassLoader getClassLoader() throws StrategyException { // Determine the package by parsing the attribute name (different name for different types of Rules based strategies) String kbAttributeName = getKnowledgeBaseAttributeName(); Object kbName = getParameter(kbAttributeName); if (kbName == null) throw new StrategyException("Missing strategy parameter: " + kbAttributeName); // Get the package Name String kbNameStr = kbName.toString(); int lastSlash = kbNameStr.lastIndexOf('/'); String pkg = lastSlash == -1 ? null : kbNameStr.substring(0, lastSlash) ; try { Package pkgVO = PackageCache.getPackage(pkg); if (pkgVO == null) throw new StrategyException("Unable to get package name from strategy: " + kbAttributeName +" value="+kbNameStr); // return the cloud class loader by default, unless the bundle spec is set return pkgVO.getClassLoader(); } catch (CachingException ex) { throw new StrategyException("Error getting strategy package: " + pkg, ex); } }
[ "public", "ClassLoader", "getClassLoader", "(", ")", "throws", "StrategyException", "{", "// Determine the package by parsing the attribute name (different name for different types of Rules based strategies)", "String", "kbAttributeName", "=", "getKnowledgeBaseAttributeName", "(", ")", ...
<p> By default returns the package CloudClassloader The knowledge based name is of the format "packageName/assetName", e.g "com.centurylink.mdw.test/TestDroolsRules.drl" If an application needs a different class loader for Strategies then this method should be overridden </p> @return Class Loader used for Knowledge based strategies @throws StrategyException
[ "<p", ">", "By", "default", "returns", "the", "package", "CloudClassloader", "The", "knowledge", "based", "name", "is", "of", "the", "format", "packageName", "/", "assetName", "e", ".", "g", "com", ".", "centurylink", ".", "mdw", ".", "test", "/", "TestDro...
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-workflow/assets/com/centurylink/mdw/drools/RulesBasedStrategy.java#L73-L96
bazaarvoice/ostrich
core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolBuilder.java
ServicePoolBuilder.withHostDiscoverySource
public ServicePoolBuilder<S> withHostDiscoverySource(HostDiscoverySource hostDiscoverySource) { checkNotNull(hostDiscoverySource); return withHostDiscovery(hostDiscoverySource, true); }
java
public ServicePoolBuilder<S> withHostDiscoverySource(HostDiscoverySource hostDiscoverySource) { checkNotNull(hostDiscoverySource); return withHostDiscovery(hostDiscoverySource, true); }
[ "public", "ServicePoolBuilder", "<", "S", ">", "withHostDiscoverySource", "(", "HostDiscoverySource", "hostDiscoverySource", ")", "{", "checkNotNull", "(", "hostDiscoverySource", ")", ";", "return", "withHostDiscovery", "(", "hostDiscoverySource", ",", "true", ")", ";",...
Adds a {@link HostDiscoverySource} instance to the builder. Multiple instances of {@code HostDiscoverySource} may be specified. The service pool will query the sources in the order they were registered and use the first non-null {@link HostDiscovery} returned for the service name provided by the {@link ServiceFactory#getServiceName()} method of the factory configured by {@link #withServiceFactory}. <p> Note that using this method will cause the ServicePoolBuilder to call {@link HostDiscoverySource#forService(String serviceName)} when {@link #build()} is called and pass the returned {@link HostDiscovery} to the new {@code ServicePool}. Subsequently calling {@link ServicePool#close()} will in turn call {@link HostDiscovery#close()} on the passed instance. @param hostDiscoverySource a host discovery source to use to find the {@link HostDiscovery} when constructing the {@link ServicePool} @return this
[ "Adds", "a", "{", "@link", "HostDiscoverySource", "}", "instance", "to", "the", "builder", ".", "Multiple", "instances", "of", "{", "@code", "HostDiscoverySource", "}", "may", "be", "specified", ".", "The", "service", "pool", "will", "query", "the", "sources",...
train
https://github.com/bazaarvoice/ostrich/blob/13591867870ab23445253f11fc872662a8028191/core/src/main/java/com/bazaarvoice/ostrich/pool/ServicePoolBuilder.java#L75-L78
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/html/TableForm.java
TableForm.addField
public void addField(String label,Element field) { if (label==null) label="&nbsp;"; else label="<b>"+label+":</b>"; if (extendRow) { column.add(field); extendRow=false; } else { column.newRow(); column.addCell(label); column.cell().right(); if (fieldAttributes != null) { column.addCell(field,fieldAttributes); fieldAttributes = null; } else column.addCell(field); } }
java
public void addField(String label,Element field) { if (label==null) label="&nbsp;"; else label="<b>"+label+":</b>"; if (extendRow) { column.add(field); extendRow=false; } else { column.newRow(); column.addCell(label); column.cell().right(); if (fieldAttributes != null) { column.addCell(field,fieldAttributes); fieldAttributes = null; } else column.addCell(field); } }
[ "public", "void", "addField", "(", "String", "label", ",", "Element", "field", ")", "{", "if", "(", "label", "==", "null", ")", "label", "=", "\"&nbsp;\"", ";", "else", "label", "=", "\"<b>\"", "+", "label", "+", "\":</b>\"", ";", "if", "(", "extendRow...
Add an arbitrary element to the table. @param label The label for the element in the table.
[ "Add", "an", "arbitrary", "element", "to", "the", "table", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/html/TableForm.java#L327-L353
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/TypeParameterBuilderImpl.java
TypeParameterBuilderImpl.eInit
public void eInit(EObject context, String name, IJvmTypeProvider typeContext) { setTypeResolutionContext(typeContext); this.context = context; this.parameter = this.jvmTypesFactory.createJvmTypeParameter(); this.parameter.setName(name); }
java
public void eInit(EObject context, String name, IJvmTypeProvider typeContext) { setTypeResolutionContext(typeContext); this.context = context; this.parameter = this.jvmTypesFactory.createJvmTypeParameter(); this.parameter.setName(name); }
[ "public", "void", "eInit", "(", "EObject", "context", ",", "String", "name", ",", "IJvmTypeProvider", "typeContext", ")", "{", "setTypeResolutionContext", "(", "typeContext", ")", ";", "this", ".", "context", "=", "context", ";", "this", ".", "parameter", "=",...
Initialize the type parameter. <p>Caution: This initialization function does not add the type parameter in its container. The container is responsible of adding the type parameter in its internal object. @param name the name of the type parameter. @param typeContext the provider of types or null.
[ "Initialize", "the", "type", "parameter", ".", "<p", ">", "Caution", ":", "This", "initialization", "function", "does", "not", "add", "the", "type", "parameter", "in", "its", "container", ".", "The", "container", "is", "responsible", "of", "adding", "the", "...
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/TypeParameterBuilderImpl.java#L55-L61
umeding/fuzzer
src/main/java/com/uwemeding/fuzzer/java/JavaOutputType.java
JavaOutputType.callFindAssociation
private void callFindAssociation(Java.METHOD method, String result, Variable variable, Member member) { String setName = variable.getName() + "$" + member.getName(); method.addS("Number " + result + " = findAssociation(" + variable.getName() + ", " + variable.getFrom() + ", " + variable.getTo() + ", " + variable.getStep() + ", " + setName + ")"); }
java
private void callFindAssociation(Java.METHOD method, String result, Variable variable, Member member) { String setName = variable.getName() + "$" + member.getName(); method.addS("Number " + result + " = findAssociation(" + variable.getName() + ", " + variable.getFrom() + ", " + variable.getTo() + ", " + variable.getStep() + ", " + setName + ")"); }
[ "private", "void", "callFindAssociation", "(", "Java", ".", "METHOD", "method", ",", "String", "result", ",", "Variable", "variable", ",", "Member", "member", ")", "{", "String", "setName", "=", "variable", ".", "getName", "(", ")", "+", "\"$\"", "+", "mem...
Call the find association method. <p> @param method the invoking method @param result the result variable @param variable the input variable @param member the member
[ "Call", "the", "find", "association", "method", ".", "<p", ">" ]
train
https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/java/JavaOutputType.java#L266-L275
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/FormLayoutFormBuilder.java
FormLayoutFormBuilder.addBinding
public JComponent addBinding(Binding binding, int column, int row) { return this.addBinding(binding, column, row, 1, 1); }
java
public JComponent addBinding(Binding binding, int column, int row) { return this.addBinding(binding, column, row, 1, 1); }
[ "public", "JComponent", "addBinding", "(", "Binding", "binding", ",", "int", "column", ",", "int", "row", ")", "{", "return", "this", ".", "addBinding", "(", "binding", ",", "column", ",", "row", ",", "1", ",", "1", ")", ";", "}" ]
Add a binder to a column and a row. Equals to builder.addBinding(component, column, row). @param binding The binding to add @param column The column on which the binding must be added @param column The row on which the binding must be added @return The component produced by the binding @see #addBinding(Binding, int, int, int, int)
[ "Add", "a", "binder", "to", "a", "column", "and", "a", "row", ".", "Equals", "to", "builder", ".", "addBinding", "(", "component", "column", "row", ")", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/FormLayoutFormBuilder.java#L263-L266
lightbend/config
config/src/main/java/com/typesafe/config/ConfigException.java
ConfigException.setOriginField
private static <T> void setOriginField(T hasOriginField, Class<T> clazz, ConfigOrigin origin) throws IOException { // circumvent "final" Field f; try { f = clazz.getDeclaredField("origin"); } catch (NoSuchFieldException e) { throw new IOException(clazz.getSimpleName() + " has no origin field?", e); } catch (SecurityException e) { throw new IOException("unable to fill out origin field in " + clazz.getSimpleName(), e); } f.setAccessible(true); try { f.set(hasOriginField, origin); } catch (IllegalArgumentException e) { throw new IOException("unable to set origin field", e); } catch (IllegalAccessException e) { throw new IOException("unable to set origin field", e); } }
java
private static <T> void setOriginField(T hasOriginField, Class<T> clazz, ConfigOrigin origin) throws IOException { // circumvent "final" Field f; try { f = clazz.getDeclaredField("origin"); } catch (NoSuchFieldException e) { throw new IOException(clazz.getSimpleName() + " has no origin field?", e); } catch (SecurityException e) { throw new IOException("unable to fill out origin field in " + clazz.getSimpleName(), e); } f.setAccessible(true); try { f.set(hasOriginField, origin); } catch (IllegalArgumentException e) { throw new IOException("unable to set origin field", e); } catch (IllegalAccessException e) { throw new IOException("unable to set origin field", e); } }
[ "private", "static", "<", "T", ">", "void", "setOriginField", "(", "T", "hasOriginField", ",", "Class", "<", "T", ">", "clazz", ",", "ConfigOrigin", "origin", ")", "throws", "IOException", "{", "// circumvent \"final\"", "Field", "f", ";", "try", "{", "f", ...
For deserialization - uses reflection to set the final origin field on the object
[ "For", "deserialization", "-", "uses", "reflection", "to", "set", "the", "final", "origin", "field", "on", "the", "object" ]
train
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigException.java#L62-L82
RestComm/sipunit
src/main/java/org/cafesip/sipunit/EventSubscriber.java
EventSubscriber.replyToNotify
public boolean replyToNotify(RequestEvent reqevent, Response response) { initErrorInfo(); if ((reqevent == null) || (reqevent.getRequest() == null) || (response == null)) { setErrorMessage("Cannot send reply, request or response info is null"); setReturnCode(SipSession.INVALID_ARGUMENT); return false; } try { if (reqevent.getServerTransaction() == null) { // 1st NOTIFY received before 1st response LOG.trace("Informational : no UAS transaction available for received NOTIFY"); // send response statelessly ((SipProvider) reqevent.getSource()).sendResponse(response); } else { reqevent.getServerTransaction().sendResponse(response); } } catch (Exception e) { setException(e); setErrorMessage("Exception: " + e.getClass().getName() + ": " + e.getMessage()); setReturnCode(SipSession.EXCEPTION_ENCOUNTERED); return false; } LOG.trace("Sent response message to received NOTIFY, status code : {}, reason : {}", response.getStatusCode(), response.getReasonPhrase()); return true; }
java
public boolean replyToNotify(RequestEvent reqevent, Response response) { initErrorInfo(); if ((reqevent == null) || (reqevent.getRequest() == null) || (response == null)) { setErrorMessage("Cannot send reply, request or response info is null"); setReturnCode(SipSession.INVALID_ARGUMENT); return false; } try { if (reqevent.getServerTransaction() == null) { // 1st NOTIFY received before 1st response LOG.trace("Informational : no UAS transaction available for received NOTIFY"); // send response statelessly ((SipProvider) reqevent.getSource()).sendResponse(response); } else { reqevent.getServerTransaction().sendResponse(response); } } catch (Exception e) { setException(e); setErrorMessage("Exception: " + e.getClass().getName() + ": " + e.getMessage()); setReturnCode(SipSession.EXCEPTION_ENCOUNTERED); return false; } LOG.trace("Sent response message to received NOTIFY, status code : {}, reason : {}", response.getStatusCode(), response.getReasonPhrase()); return true; }
[ "public", "boolean", "replyToNotify", "(", "RequestEvent", "reqevent", ",", "Response", "response", ")", "{", "initErrorInfo", "(", ")", ";", "if", "(", "(", "reqevent", "==", "null", ")", "||", "(", "reqevent", ".", "getRequest", "(", ")", "==", "null", ...
This method sends the given response to the network in reply to the given request that was previously received. Call this method after processNotify() has handled the received request. @param reqevent The object returned by waitNotify(). @param response The object returned by processNotify(), or a user-modified version of it. @return true if the response is successfully sent out, false otherwise.
[ "This", "method", "sends", "the", "given", "response", "to", "the", "network", "in", "reply", "to", "the", "given", "request", "that", "was", "previously", "received", ".", "Call", "this", "method", "after", "processNotify", "()", "has", "handled", "the", "r...
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/EventSubscriber.java#L992-L1022
alkacon/opencms-core
src/org/opencms/gwt/A_CmsClientMessageBundle.java
A_CmsClientMessageBundle.importMessage
public String importMessage(String key, Locale locale) { key = key.trim(); String[] tokens = key.split("#"); if (tokens.length != 2) { return null; } String className = tokens[0]; String messageName = tokens[1]; try { Method messagesGet = Class.forName(className).getMethod("get"); I_CmsMessageBundle bundle = (I_CmsMessageBundle)(messagesGet.invoke(null)); return bundle.getBundle(locale).key(messageName); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return null; } }
java
public String importMessage(String key, Locale locale) { key = key.trim(); String[] tokens = key.split("#"); if (tokens.length != 2) { return null; } String className = tokens[0]; String messageName = tokens[1]; try { Method messagesGet = Class.forName(className).getMethod("get"); I_CmsMessageBundle bundle = (I_CmsMessageBundle)(messagesGet.invoke(null)); return bundle.getBundle(locale).key(messageName); } catch (Exception e) { LOG.error(e.getLocalizedMessage(), e); return null; } }
[ "public", "String", "importMessage", "(", "String", "key", ",", "Locale", "locale", ")", "{", "key", "=", "key", ".", "trim", "(", ")", ";", "String", "[", "]", "tokens", "=", "key", ".", "split", "(", "\"#\"", ")", ";", "if", "(", "tokens", ".", ...
Imports a message from another bundle.<p> @param key a key of the form classname#MESSAGE_FIELD_NAME @param locale the locale for which to import the message @return the imported message string
[ "Imports", "a", "message", "from", "another", "bundle", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/gwt/A_CmsClientMessageBundle.java#L160-L177