repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
broadinstitute/barclay
src/main/java/org/broadinstitute/barclay/argparser/CommandLineArgumentParser.java
CommandLineArgumentParser.isSpecialFlagSet
private boolean isSpecialFlagSet(final OptionSet parsedArguments, final String flagName){ if (parsedArguments.has(flagName)){ Object value = parsedArguments.valueOf(flagName); return (value == null || !value.equals("false")); } else{ return false; } }
java
private boolean isSpecialFlagSet(final OptionSet parsedArguments, final String flagName){ if (parsedArguments.has(flagName)){ Object value = parsedArguments.valueOf(flagName); return (value == null || !value.equals("false")); } else{ return false; } }
[ "private", "boolean", "isSpecialFlagSet", "(", "final", "OptionSet", "parsedArguments", ",", "final", "String", "flagName", ")", "{", "if", "(", "parsedArguments", ".", "has", "(", "flagName", ")", ")", "{", "Object", "value", "=", "parsedArguments", ".", "val...
helper to deal with the case of special flags that are evaluated before the options are properly set
[ "helper", "to", "deal", "with", "the", "case", "of", "special", "flags", "that", "are", "evaluated", "before", "the", "options", "are", "properly", "set" ]
train
https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/argparser/CommandLineArgumentParser.java#L541-L548
jcuda/jcuda
JCudaJava/src/main/java/jcuda/Pointer.java
Pointer.getByteBuffer
public ByteBuffer getByteBuffer(long byteOffset, long byteSize) { if (buffer == null) { return null; } if (!(buffer instanceof ByteBuffer)) { return null; } ByteBuffer internalByteBuffer = (ByteBuffer)buffer; ByteBuffer byteBuffer = internalByteBuffer.slice(); byteBuffer.limit(Math.toIntExact(byteOffset + byteSize)); byteBuffer.position(Math.toIntExact(byteOffset)); return byteBuffer.slice().order(ByteOrder.nativeOrder()); }
java
public ByteBuffer getByteBuffer(long byteOffset, long byteSize) { if (buffer == null) { return null; } if (!(buffer instanceof ByteBuffer)) { return null; } ByteBuffer internalByteBuffer = (ByteBuffer)buffer; ByteBuffer byteBuffer = internalByteBuffer.slice(); byteBuffer.limit(Math.toIntExact(byteOffset + byteSize)); byteBuffer.position(Math.toIntExact(byteOffset)); return byteBuffer.slice().order(ByteOrder.nativeOrder()); }
[ "public", "ByteBuffer", "getByteBuffer", "(", "long", "byteOffset", ",", "long", "byteSize", ")", "{", "if", "(", "buffer", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "!", "(", "buffer", "instanceof", "ByteBuffer", ")", ")", "{", "r...
Returns a ByteBuffer that corresponds to the specified segment of the memory that this pointer points to.<br> <br> The returned byte buffer will have the byte order that is implied by <code>ByteOrder#nativeOrder()</code>. It will be a slice of the buffer that is stored internally. So it will share the same memory, but its position and limit will be independent of the internal buffer. <br> This function may only be applied to pointers that have been set to point to a region of host- or unified memory using one of these methods: <ul> <li>{@link jcuda.driver.JCudaDriver#cuMemAllocHost}</li> <li>{@link jcuda.driver.JCudaDriver#cuMemHostAlloc}</li> <li>{@link jcuda.driver.JCudaDriver#cuMemAllocManaged}</li> <li>{@link jcuda.runtime.JCuda#cudaMallocHost}</li> <li>{@link jcuda.runtime.JCuda#cudaHostAlloc}</li> <li>{@link jcuda.runtime.JCuda#cudaMallocManaged}</li> <li>{@link Pointer#to(byte[])}</li> </ul> <br> For other pointer types, <code>null</code> is returned. @param byteOffset The offset in bytes @param byteSize The size of the byte buffer, in bytes @return The byte buffer @throws IllegalArgumentException If the <code>byteOffset</code> and <code>byteSize</code> describe an invalid memory range (for example, when the <code>byteOffset</code> is negative) @throws ArithmeticException If the <code>byteOffset</code> or <code>byteOffset + byteSize</code> overflows an <code>int</code>.
[ "Returns", "a", "ByteBuffer", "that", "corresponds", "to", "the", "specified", "segment", "of", "the", "memory", "that", "this", "pointer", "points", "to", ".", "<br", ">", "<br", ">", "The", "returned", "byte", "buffer", "will", "have", "the", "byte", "or...
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/Pointer.java#L553-L568
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/equals/EqualsHelper.java
EqualsHelper.equalsIgnoreCase
@SuppressFBWarnings ({ "ES_COMPARING_PARAMETER_STRING_WITH_EQ" }) public static boolean equalsIgnoreCase (@Nullable final String sObj1, @Nullable final String sObj2) { return sObj1 == null ? sObj2 == null : sObj1.equalsIgnoreCase (sObj2); }
java
@SuppressFBWarnings ({ "ES_COMPARING_PARAMETER_STRING_WITH_EQ" }) public static boolean equalsIgnoreCase (@Nullable final String sObj1, @Nullable final String sObj2) { return sObj1 == null ? sObj2 == null : sObj1.equalsIgnoreCase (sObj2); }
[ "@", "SuppressFBWarnings", "(", "{", "\"ES_COMPARING_PARAMETER_STRING_WITH_EQ\"", "}", ")", "public", "static", "boolean", "equalsIgnoreCase", "(", "@", "Nullable", "final", "String", "sObj1", ",", "@", "Nullable", "final", "String", "sObj2", ")", "{", "return", "...
Check if the passed strings are equals case insensitive handling <code>null</code> appropriately. @param sObj1 First object to compare @param sObj2 Second object to compare @return <code>true</code> if they are equal case insensitive, <code>false</code> otherwise.
[ "Check", "if", "the", "passed", "strings", "are", "equals", "case", "insensitive", "handling", "<code", ">", "null<", "/", "code", ">", "appropriately", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/equals/EqualsHelper.java#L218-L222
citrusframework/citrus
modules/citrus-mail/src/main/java/com/consol/citrus/mail/message/MailMessageConverter.java
MailMessageConverter.handleTextPart
protected BodyPart handleTextPart(MimePart textPart, String contentType) throws IOException, MessagingException { String content; if (textPart.getContent() instanceof String) { content = (String) textPart.getContent(); } else if (textPart.getContent() instanceof InputStream) { content = FileUtils.readToString((InputStream) textPart.getContent(), Charset.forName(parseCharsetFromContentType(contentType))); } else { throw new CitrusRuntimeException("Cannot handle text content of type: " + textPart.getContent().getClass().toString()); } return new BodyPart(stripMailBodyEnding(content), contentType); }
java
protected BodyPart handleTextPart(MimePart textPart, String contentType) throws IOException, MessagingException { String content; if (textPart.getContent() instanceof String) { content = (String) textPart.getContent(); } else if (textPart.getContent() instanceof InputStream) { content = FileUtils.readToString((InputStream) textPart.getContent(), Charset.forName(parseCharsetFromContentType(contentType))); } else { throw new CitrusRuntimeException("Cannot handle text content of type: " + textPart.getContent().getClass().toString()); } return new BodyPart(stripMailBodyEnding(content), contentType); }
[ "protected", "BodyPart", "handleTextPart", "(", "MimePart", "textPart", ",", "String", "contentType", ")", "throws", "IOException", ",", "MessagingException", "{", "String", "content", ";", "if", "(", "textPart", ".", "getContent", "(", ")", "instanceof", "String"...
Construct simple binary body part with base64 data. @param textPart @param contentType @return @throws IOException
[ "Construct", "simple", "binary", "body", "part", "with", "base64", "data", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-mail/src/main/java/com/consol/citrus/mail/message/MailMessageConverter.java#L262-L274
VoltDB/voltdb
src/frontend/org/voltdb/export/ExportDataSource.java
ExportDataSource.handleQueryMessage
public void handleQueryMessage(final long senderHSId, long requestId, long gapStart) { m_es.execute(new Runnable() { @Override public void run() { long lastSeq = Long.MIN_VALUE; Pair<Long, Long> range = m_gapTracker.getRangeContaining(gapStart); if (range != null) { lastSeq = range.getSecond(); } sendQueryResponse(senderHSId, requestId, lastSeq); } }); }
java
public void handleQueryMessage(final long senderHSId, long requestId, long gapStart) { m_es.execute(new Runnable() { @Override public void run() { long lastSeq = Long.MIN_VALUE; Pair<Long, Long> range = m_gapTracker.getRangeContaining(gapStart); if (range != null) { lastSeq = range.getSecond(); } sendQueryResponse(senderHSId, requestId, lastSeq); } }); }
[ "public", "void", "handleQueryMessage", "(", "final", "long", "senderHSId", ",", "long", "requestId", ",", "long", "gapStart", ")", "{", "m_es", ".", "execute", "(", "new", "Runnable", "(", ")", "{", "@", "Override", "public", "void", "run", "(", ")", "{...
Query whether a master exists for the given partition, if not try to promote the local data source.
[ "Query", "whether", "a", "master", "exists", "for", "the", "given", "partition", "if", "not", "try", "to", "promote", "the", "local", "data", "source", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/export/ExportDataSource.java#L1781-L1793
mongodb/stitch-android-sdk
core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java
CoreRemoteMongoCollectionImpl.findOneAndUpdate
public DocumentT findOneAndUpdate(final Bson filter, final Bson update) { return operations.findOneAndModify( "findOneAndUpdate", filter, update, new RemoteFindOneAndModifyOptions(), documentClass).execute(service); }
java
public DocumentT findOneAndUpdate(final Bson filter, final Bson update) { return operations.findOneAndModify( "findOneAndUpdate", filter, update, new RemoteFindOneAndModifyOptions(), documentClass).execute(service); }
[ "public", "DocumentT", "findOneAndUpdate", "(", "final", "Bson", "filter", ",", "final", "Bson", "update", ")", "{", "return", "operations", ".", "findOneAndModify", "(", "\"findOneAndUpdate\"", ",", "filter", ",", "update", ",", "new", "RemoteFindOneAndModifyOption...
Finds a document in the collection and performs the given update. @param filter the query filter @param update the update document @return the resulting document
[ "Finds", "a", "document", "in", "the", "collection", "and", "performs", "the", "given", "update", "." ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/internal/CoreRemoteMongoCollectionImpl.java#L463-L470
b3dgs/lionengine
lionengine-network/src/main/java/com/b3dgs/lionengine/network/message/NetworkMessageEntity.java
NetworkMessageEntity.addAction
public void addAction(M element, short value) { actions.put(element, Short.valueOf(value)); }
java
public void addAction(M element, short value) { actions.put(element, Short.valueOf(value)); }
[ "public", "void", "addAction", "(", "M", "element", ",", "short", "value", ")", "{", "actions", ".", "put", "(", "element", ",", "Short", ".", "valueOf", "(", "value", ")", ")", ";", "}" ]
Add an action. @param element The action type. @param value The action value.
[ "Add", "an", "action", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-network/src/main/java/com/b3dgs/lionengine/network/message/NetworkMessageEntity.java#L144-L147
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/J2CSecurityHelper.java
J2CSecurityHelper.getCacheKey
public static String getCacheKey(String uniqueId, String appRealm) { StringBuilder cacheKey = new StringBuilder(); if (uniqueId == null || appRealm == null) { cacheKey.append(CACHE_KEY_PREFIX); } else { cacheKey.append(CACHE_KEY_PREFIX).append(uniqueId).append(CACHE_KEY_SEPARATOR).append(appRealm); } return cacheKey.toString(); }
java
public static String getCacheKey(String uniqueId, String appRealm) { StringBuilder cacheKey = new StringBuilder(); if (uniqueId == null || appRealm == null) { cacheKey.append(CACHE_KEY_PREFIX); } else { cacheKey.append(CACHE_KEY_PREFIX).append(uniqueId).append(CACHE_KEY_SEPARATOR).append(appRealm); } return cacheKey.toString(); }
[ "public", "static", "String", "getCacheKey", "(", "String", "uniqueId", ",", "String", "appRealm", ")", "{", "StringBuilder", "cacheKey", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "uniqueId", "==", "null", "||", "appRealm", "==", "null", ")", ...
This method constructs the cache key that is required by security for caching the Subject. @param uniqueId The unique Id of the user @param appRealm The application realm that the user belongs to @return the cache key
[ "This", "method", "constructs", "the", "cache", "key", "that", "is", "required", "by", "security", "for", "caching", "the", "Subject", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.inbound.security/src/com/ibm/ws/jca/security/internal/J2CSecurityHelper.java#L622-L630
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.read
public static String read(InputStream in, Charset charset) throws IORuntimeException { FastByteArrayOutputStream out = read(in); return null == charset ? out.toString() : out.toString(charset); }
java
public static String read(InputStream in, Charset charset) throws IORuntimeException { FastByteArrayOutputStream out = read(in); return null == charset ? out.toString() : out.toString(charset); }
[ "public", "static", "String", "read", "(", "InputStream", "in", ",", "Charset", "charset", ")", "throws", "IORuntimeException", "{", "FastByteArrayOutputStream", "out", "=", "read", "(", "in", ")", ";", "return", "null", "==", "charset", "?", "out", ".", "to...
从流中读取内容,读取完毕后并不关闭流 @param in 输入流,读取完毕后并不关闭流 @param charset 字符集 @return 内容 @throws IORuntimeException IO异常
[ "从流中读取内容,读取完毕后并不关闭流" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L409-L412
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/Zealot.java
Zealot.buildNewSqlInfo
private static SqlInfo buildNewSqlInfo(String nameSpace, Node node, Object paramObj) { return buildSqlInfo(nameSpace, SqlInfo.newInstance(), node, paramObj); }
java
private static SqlInfo buildNewSqlInfo(String nameSpace, Node node, Object paramObj) { return buildSqlInfo(nameSpace, SqlInfo.newInstance(), node, paramObj); }
[ "private", "static", "SqlInfo", "buildNewSqlInfo", "(", "String", "nameSpace", ",", "Node", "node", ",", "Object", "paramObj", ")", "{", "return", "buildSqlInfo", "(", "nameSpace", ",", "SqlInfo", ".", "newInstance", "(", ")", ",", "node", ",", "paramObj", "...
构建新的、完整的SqlInfo对象. @param nameSpace xml命名空间 @param node dom4j对象节点 @param paramObj 参数对象 @return 返回SqlInfo对象
[ "构建新的、完整的SqlInfo对象", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/Zealot.java#L132-L134
elki-project/elki
elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java
DBIDUtil.randomSample
public static DBIDs randomSample(DBIDs ids, double rate, Random random) { return rate <= 0 ? ids : // Magic for "no sampling" randomSample(ids, Math.min(ids.size(), // (int) (rate <= 1 ? rate * ids.size() : rate)), random); }
java
public static DBIDs randomSample(DBIDs ids, double rate, Random random) { return rate <= 0 ? ids : // Magic for "no sampling" randomSample(ids, Math.min(ids.size(), // (int) (rate <= 1 ? rate * ids.size() : rate)), random); }
[ "public", "static", "DBIDs", "randomSample", "(", "DBIDs", "ids", ",", "double", "rate", ",", "Random", "random", ")", "{", "return", "rate", "<=", "0", "?", "ids", ":", "// Magic for \"no sampling\"", "randomSample", "(", "ids", ",", "Math", ".", "min", "...
Produce a random sample of the given DBIDs. <ul> <li>values less or equal 0 mean no sampling. <li>values larger than 0, but at most 1, are relative rates. <li>values larger than 1 are supposed to be integer counts. </ul> @param ids Original ids, no duplicates allowed @param rate Sampling rate @param random Random generator @return Sample
[ "Produce", "a", "random", "sample", "of", "the", "given", "DBIDs", ".", "<ul", ">", "<li", ">", "values", "less", "or", "equal", "0", "mean", "no", "sampling", ".", "<li", ">", "values", "larger", "than", "0", "but", "at", "most", "1", "are", "relati...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java#L701-L705
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/AssertSoapFaultBuilder.java
AssertSoapFaultBuilder.faultDetailResource
public AssertSoapFaultBuilder faultDetailResource(Resource resource, Charset charset) { try { action.getFaultDetails().add(FileUtils.readToString(resource, charset)); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read fault detail resource", e); } return this; }
java
public AssertSoapFaultBuilder faultDetailResource(Resource resource, Charset charset) { try { action.getFaultDetails().add(FileUtils.readToString(resource, charset)); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read fault detail resource", e); } return this; }
[ "public", "AssertSoapFaultBuilder", "faultDetailResource", "(", "Resource", "resource", ",", "Charset", "charset", ")", "{", "try", "{", "action", ".", "getFaultDetails", "(", ")", ".", "add", "(", "FileUtils", ".", "readToString", "(", "resource", ",", "charset...
Expect fault detail from file resource. @param resource @param charset @return
[ "Expect", "fault", "detail", "from", "file", "resource", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/AssertSoapFaultBuilder.java#L140-L147
johnkil/Android-ProgressFragment
progressfragment-native/src/com/devspark/progressfragment/ProgressGridFragment.java
ProgressGridFragment.onViewCreated
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ensureList(); }
java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ensureList(); }
[ "@", "Override", "public", "void", "onViewCreated", "(", "View", "view", ",", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onViewCreated", "(", "view", ",", "savedInstanceState", ")", ";", "ensureList", "(", ")", ";", "}" ]
Attach to grid view once the view hierarchy has been created.
[ "Attach", "to", "grid", "view", "once", "the", "view", "hierarchy", "has", "been", "created", "." ]
train
https://github.com/johnkil/Android-ProgressFragment/blob/f4b3b969f36f3ac9598c662722630f9ffb151bd6/progressfragment-native/src/com/devspark/progressfragment/ProgressGridFragment.java#L85-L89
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java
MailUtil.send
public static void send(MailAccount mailAccount, Collection<String> tos, String subject, String content, boolean isHtml, File... files) { Mail.create(mailAccount)// .setTos(tos.toArray(new String[tos.size()]))// .setTitle(subject)// .setContent(content)// .setHtml(isHtml)// .setFiles(files)// .send(); }
java
public static void send(MailAccount mailAccount, Collection<String> tos, String subject, String content, boolean isHtml, File... files) { Mail.create(mailAccount)// .setTos(tos.toArray(new String[tos.size()]))// .setTitle(subject)// .setContent(content)// .setHtml(isHtml)// .setFiles(files)// .send(); }
[ "public", "static", "void", "send", "(", "MailAccount", "mailAccount", ",", "Collection", "<", "String", ">", "tos", ",", "String", "subject", ",", "String", "content", ",", "boolean", "isHtml", ",", "File", "...", "files", ")", "{", "Mail", ".", "create",...
发送邮件给多人 @param mailAccount 邮件认证对象 @param tos 收件人列表 @param subject 标题 @param content 正文 @param isHtml 是否为HTML格式 @param files 附件列表
[ "发送邮件给多人" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/mail/MailUtil.java#L157-L165
TheHortonMachine/hortonmachine
hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/OmsEpanetParametersTime.java
OmsEpanetParametersTime.createFromMap
public static OmsEpanetParametersTime createFromMap( HashMap<TimeParameterCodes, String> options ) throws Exception { OmsEpanetParametersTime epTime = new OmsEpanetParametersTime(); String duration = options.get(TimeParameterCodes.DURATION); epTime.duration = NumericsUtilities.isNumber(duration, Double.class); String hydrTiStep = options.get(TimeParameterCodes.HYDSTEP); epTime.hydraulicTimestep = NumericsUtilities.isNumber(hydrTiStep, Double.class); String pattTimeStep = options.get(TimeParameterCodes.PATTERNSTEP); epTime.patternTimestep = NumericsUtilities.isNumber(pattTimeStep, Double.class); String patternStart = options.get(TimeParameterCodes.PATTERNSTART); epTime.patternStart = NumericsUtilities.isNumber(patternStart, Double.class); String reportTimeStep = options.get(TimeParameterCodes.REPORTSTEP); epTime.reportTimestep = NumericsUtilities.isNumber(reportTimeStep, Double.class); String reportStart = options.get(TimeParameterCodes.REPORTSTART); epTime.reportStart = NumericsUtilities.isNumber(reportStart, Double.class); String startClockTime = options.get(TimeParameterCodes.STARTCLOCKTIME); epTime.startClockTime = startClockTime; String statistic = options.get(TimeParameterCodes.STATISTIC); epTime.statistic = statistic; epTime.process(); return epTime; }
java
public static OmsEpanetParametersTime createFromMap( HashMap<TimeParameterCodes, String> options ) throws Exception { OmsEpanetParametersTime epTime = new OmsEpanetParametersTime(); String duration = options.get(TimeParameterCodes.DURATION); epTime.duration = NumericsUtilities.isNumber(duration, Double.class); String hydrTiStep = options.get(TimeParameterCodes.HYDSTEP); epTime.hydraulicTimestep = NumericsUtilities.isNumber(hydrTiStep, Double.class); String pattTimeStep = options.get(TimeParameterCodes.PATTERNSTEP); epTime.patternTimestep = NumericsUtilities.isNumber(pattTimeStep, Double.class); String patternStart = options.get(TimeParameterCodes.PATTERNSTART); epTime.patternStart = NumericsUtilities.isNumber(patternStart, Double.class); String reportTimeStep = options.get(TimeParameterCodes.REPORTSTEP); epTime.reportTimestep = NumericsUtilities.isNumber(reportTimeStep, Double.class); String reportStart = options.get(TimeParameterCodes.REPORTSTART); epTime.reportStart = NumericsUtilities.isNumber(reportStart, Double.class); String startClockTime = options.get(TimeParameterCodes.STARTCLOCKTIME); epTime.startClockTime = startClockTime; String statistic = options.get(TimeParameterCodes.STATISTIC); epTime.statistic = statistic; epTime.process(); return epTime; }
[ "public", "static", "OmsEpanetParametersTime", "createFromMap", "(", "HashMap", "<", "TimeParameterCodes", ",", "String", ">", "options", ")", "throws", "Exception", "{", "OmsEpanetParametersTime", "epTime", "=", "new", "OmsEpanetParametersTime", "(", ")", ";", "Strin...
Create a {@link OmsEpanetParametersTime} from a {@link HashMap} of values. @param options the {@link HashMap} of values. The keys have to be from {@link TimeParameterCodes}. @return the created {@link OmsEpanetParametersTime}. @throws Exception
[ "Create", "a", "{", "@link", "OmsEpanetParametersTime", "}", "from", "a", "{", "@link", "HashMap", "}", "of", "values", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/epanet/OmsEpanetParametersTime.java#L158-L178
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/BoardsApi.java
BoardsApi.deleteBoard
public void deleteBoard(Object projectIdOrPath, Integer boardId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId); }
java
public void deleteBoard(Object projectIdOrPath, Integer boardId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "boards", boardId); }
[ "public", "void", "deleteBoard", "(", "Object", "projectIdOrPath", ",", "Integer", "boardId", ")", "throws", "GitLabApiException", "{", "delete", "(", "Response", ".", "Status", ".", "NO_CONTENT", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", ...
Soft deletes an existing Issue Board. <p>NOTE: This is only available in GitLab EE</p> <pre><code>GitLab Endpoint: DELETE /projects/:id/boards/:board_id</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param boardId the ID of the board @throws GitLabApiException if any exception occurs
[ "Soft", "deletes", "an", "existing", "Issue", "Board", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/BoardsApi.java#L177-L179
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/Grid.java
Grid.getGridCellsOn
protected Iterable<GridCell<P>> getGridCellsOn(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds, boolean createCells) { if (bounds.intersects(this.bounds)) { final int c1 = getColumnFor(bounds.getMinX()); final int r1 = getRowFor(bounds.getMinY()); final int c2 = getColumnFor(bounds.getMaxX()); final int r2 = getRowFor(bounds.getMaxY()); return new CellIterable(r1, c1, r2, c2, createCells); } return Collections.emptyList(); }
java
protected Iterable<GridCell<P>> getGridCellsOn(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds, boolean createCells) { if (bounds.intersects(this.bounds)) { final int c1 = getColumnFor(bounds.getMinX()); final int r1 = getRowFor(bounds.getMinY()); final int c2 = getColumnFor(bounds.getMaxX()); final int r2 = getRowFor(bounds.getMaxY()); return new CellIterable(r1, c1, r2, c2, createCells); } return Collections.emptyList(); }
[ "protected", "Iterable", "<", "GridCell", "<", "P", ">", ">", "getGridCellsOn", "(", "Rectangle2afp", "<", "?", ",", "?", ",", "?", ",", "?", ",", "?", ",", "?", ">", "bounds", ",", "boolean", "createCells", ")", "{", "if", "(", "bounds", ".", "int...
Replies the grid cells that are intersecting the specified bounds. @param bounds the bounds @param createCells indicates if the not already created cells should be created. @return the grid cells.
[ "Replies", "the", "grid", "cells", "that", "are", "intersecting", "the", "specified", "bounds", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/Grid.java#L289-L298
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.backupStorageAccountAsync
public Observable<BackupStorageResult> backupStorageAccountAsync(String vaultBaseUrl, String storageAccountName) { return backupStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<BackupStorageResult>, BackupStorageResult>() { @Override public BackupStorageResult call(ServiceResponse<BackupStorageResult> response) { return response.body(); } }); }
java
public Observable<BackupStorageResult> backupStorageAccountAsync(String vaultBaseUrl, String storageAccountName) { return backupStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName).map(new Func1<ServiceResponse<BackupStorageResult>, BackupStorageResult>() { @Override public BackupStorageResult call(ServiceResponse<BackupStorageResult> response) { return response.body(); } }); }
[ "public", "Observable", "<", "BackupStorageResult", ">", "backupStorageAccountAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ")", "{", "return", "backupStorageAccountWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "storageAccountName", ")", ...
Backs up the specified storage account. Requests that a backup of the specified storage account be downloaded to the client. This operation requires the storage/backup permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the BackupStorageResult object
[ "Backs", "up", "the", "specified", "storage", "account", ".", "Requests", "that", "a", "backup", "of", "the", "specified", "storage", "account", "be", "downloaded", "to", "the", "client", ".", "This", "operation", "requires", "the", "storage", "/", "backup", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L9547-L9554
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataPng.java
CoverageDataPng.getUnsignedPixelValue
public int getUnsignedPixelValue(BufferedImage image, int x, int y) { short pixelValue = getPixelValue(image, x, y); int unsignedPixelValue = getUnsignedPixelValue(pixelValue); return unsignedPixelValue; }
java
public int getUnsignedPixelValue(BufferedImage image, int x, int y) { short pixelValue = getPixelValue(image, x, y); int unsignedPixelValue = getUnsignedPixelValue(pixelValue); return unsignedPixelValue; }
[ "public", "int", "getUnsignedPixelValue", "(", "BufferedImage", "image", ",", "int", "x", ",", "int", "y", ")", "{", "short", "pixelValue", "=", "getPixelValue", "(", "image", ",", "x", ",", "y", ")", ";", "int", "unsignedPixelValue", "=", "getUnsignedPixelV...
Get the pixel value as a 16 bit unsigned integer value @param image tile image @param x x coordinate @param y y coordinate @return unsigned integer pixel value
[ "Get", "the", "pixel", "value", "as", "a", "16", "bit", "unsigned", "integer", "value" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataPng.java#L136-L140
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java
DateTimeFormatter.withDecimalStyle
public DateTimeFormatter withDecimalStyle(DecimalStyle decimalStyle) { if (this.decimalStyle.equals(decimalStyle)) { return this; } return new DateTimeFormatter(printerParser, locale, decimalStyle, resolverStyle, resolverFields, chrono, zone); }
java
public DateTimeFormatter withDecimalStyle(DecimalStyle decimalStyle) { if (this.decimalStyle.equals(decimalStyle)) { return this; } return new DateTimeFormatter(printerParser, locale, decimalStyle, resolverStyle, resolverFields, chrono, zone); }
[ "public", "DateTimeFormatter", "withDecimalStyle", "(", "DecimalStyle", "decimalStyle", ")", "{", "if", "(", "this", ".", "decimalStyle", ".", "equals", "(", "decimalStyle", ")", ")", "{", "return", "this", ";", "}", "return", "new", "DateTimeFormatter", "(", ...
Returns a copy of this formatter with a new DecimalStyle. <p> This instance is immutable and unaffected by this method call. @param decimalStyle the new DecimalStyle, not null @return a formatter based on this formatter with the requested DecimalStyle, not null
[ "Returns", "a", "copy", "of", "this", "formatter", "with", "a", "new", "DecimalStyle", ".", "<p", ">", "This", "instance", "is", "immutable", "and", "unaffected", "by", "this", "method", "call", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java#L1434-L1439
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-default/src/main/java/org/xwiki/component/annotation/ComponentDescriptorFactory.java
ComponentDescriptorFactory.createComponentDescriptors
@Deprecated public List<ComponentDescriptor> createComponentDescriptors(Class<?> componentClass, Class<?> componentRoleClass) { return createComponentDescriptors(componentClass, (Type) componentRoleClass); }
java
@Deprecated public List<ComponentDescriptor> createComponentDescriptors(Class<?> componentClass, Class<?> componentRoleClass) { return createComponentDescriptors(componentClass, (Type) componentRoleClass); }
[ "@", "Deprecated", "public", "List", "<", "ComponentDescriptor", ">", "createComponentDescriptors", "(", "Class", "<", "?", ">", "componentClass", ",", "Class", "<", "?", ">", "componentRoleClass", ")", "{", "return", "createComponentDescriptors", "(", "componentCla...
Create component descriptors for the passed component implementation class and component role class. There can be more than one descriptor if the component class has specified several hints. @param componentClass the component implementation class @param componentRoleClass the component role class @return the component descriptors with resolved component dependencies @deprecated since 4.0M1 use {@link #createComponentDescriptors(Class, Type)} instead
[ "Create", "component", "descriptors", "for", "the", "passed", "component", "implementation", "class", "and", "component", "role", "class", ".", "There", "can", "be", "more", "than", "one", "descriptor", "if", "the", "component", "class", "has", "specified", "sev...
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-default/src/main/java/org/xwiki/component/annotation/ComponentDescriptorFactory.java#L63-L68
rzwitserloot/lombok
src/core/lombok/javac/handlers/JavacHandlerUtil.java
JavacHandlerUtil.chainDotsString
public static JCExpression chainDotsString(JavacNode node, String elems) { return chainDots(node, null, null, elems.split("\\.")); }
java
public static JCExpression chainDotsString(JavacNode node, String elems) { return chainDots(node, null, null, elems.split("\\.")); }
[ "public", "static", "JCExpression", "chainDotsString", "(", "JavacNode", "node", ",", "String", "elems", ")", "{", "return", "chainDots", "(", "node", ",", "null", ",", "null", ",", "elems", ".", "split", "(", "\"\\\\.\"", ")", ")", ";", "}" ]
In javac, dotted access of any kind, from {@code java.lang.String} to {@code var.methodName} is represented by a fold-left of {@code Select} nodes with the leftmost string represented by a {@code Ident} node. This method generates such an expression. For example, maker.Select(maker.Select(maker.Ident(NAME[java]), NAME[lang]), NAME[String]). @see com.sun.tools.javac.tree.JCTree.JCIdent @see com.sun.tools.javac.tree.JCTree.JCFieldAccess
[ "In", "javac", "dotted", "access", "of", "any", "kind", "from", "{", "@code", "java", ".", "lang", ".", "String", "}", "to", "{", "@code", "var", ".", "methodName", "}", "is", "represented", "by", "a", "fold", "-", "left", "of", "{", "@code", "Select...
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L1385-L1387
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java
FormLayout.getLayoutInfo
public LayoutInfo getLayoutInfo(Container parent) { synchronized (parent.getTreeLock()) { initializeColAndRowComponentLists(); Dimension size = parent.getSize(); Insets insets = parent.getInsets(); int totalWidth = size.width - insets.left - insets.right; int totalHeight = size.height - insets.top - insets.bottom; int[] x = computeGridOrigins(parent, totalWidth, insets.left, colSpecs, colComponents, colGroupIndices, minimumWidthMeasure, preferredWidthMeasure ); int[] y = computeGridOrigins(parent, totalHeight, insets.top, rowSpecs, rowComponents, rowGroupIndices, minimumHeightMeasure, preferredHeightMeasure ); return new LayoutInfo(x, y); } }
java
public LayoutInfo getLayoutInfo(Container parent) { synchronized (parent.getTreeLock()) { initializeColAndRowComponentLists(); Dimension size = parent.getSize(); Insets insets = parent.getInsets(); int totalWidth = size.width - insets.left - insets.right; int totalHeight = size.height - insets.top - insets.bottom; int[] x = computeGridOrigins(parent, totalWidth, insets.left, colSpecs, colComponents, colGroupIndices, minimumWidthMeasure, preferredWidthMeasure ); int[] y = computeGridOrigins(parent, totalHeight, insets.top, rowSpecs, rowComponents, rowGroupIndices, minimumHeightMeasure, preferredHeightMeasure ); return new LayoutInfo(x, y); } }
[ "public", "LayoutInfo", "getLayoutInfo", "(", "Container", "parent", ")", "{", "synchronized", "(", "parent", ".", "getTreeLock", "(", ")", ")", "{", "initializeColAndRowComponentLists", "(", ")", ";", "Dimension", "size", "=", "parent", ".", "getSize", "(", "...
Computes and returns the horizontal and vertical grid origins. Performs the same layout process as {@code #layoutContainer} but does not layout the components.<p> This method has been added only to make it easier to debug the form layout. <strong>You must not call this method directly; It may be removed in a future release or the visibility may be reduced.</strong> @param parent the {@code Container} to inspect @return an object that comprises the grid x and y origins
[ "Computes", "and", "returns", "the", "horizontal", "and", "vertical", "grid", "origins", ".", "Performs", "the", "same", "layout", "process", "as", "{", "@code", "#layoutContainer", "}", "but", "does", "not", "layout", "the", "components", ".", "<p", ">" ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java#L1851-L1878
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionFactory.java
ExtensionFactory.getExtensionRepositoryDescriptor
public ExtensionRepositoryDescriptor getExtensionRepositoryDescriptor(String id, String type, URI uri) { return getExtensionRepositoryDescriptor(new DefaultExtensionRepositoryDescriptor(id, type, uri)); }
java
public ExtensionRepositoryDescriptor getExtensionRepositoryDescriptor(String id, String type, URI uri) { return getExtensionRepositoryDescriptor(new DefaultExtensionRepositoryDescriptor(id, type, uri)); }
[ "public", "ExtensionRepositoryDescriptor", "getExtensionRepositoryDescriptor", "(", "String", "id", ",", "String", "type", ",", "URI", "uri", ")", "{", "return", "getExtensionRepositoryDescriptor", "(", "new", "DefaultExtensionRepositoryDescriptor", "(", "id", ",", "type"...
Store and return a weak reference equals to the passed {@link ExtensionRepositoryDescriptor} elements. @param id the unique identifier @param type the repository type (maven, xwiki, etc.) @param uri the repository address @return unique instance of {@link ExtensionRepositoryDescriptor} equals to the passed one
[ "Store", "and", "return", "a", "weak", "reference", "equals", "to", "the", "passed", "{", "@link", "ExtensionRepositoryDescriptor", "}", "elements", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionFactory.java#L134-L137
lightblueseas/email-tails
src/main/java/de/alpharogroup/email/utils/EmailExtensions.java
EmailExtensions.newAddress
public static Address newAddress(final String address, String personal, final String charset) throws AddressException, UnsupportedEncodingException { if (personal.isNullOrEmpty()) { personal = address; } final InternetAddress internetAdress = new InternetAddress(address); if (charset.isNullOrEmpty()) { internetAdress.setPersonal(personal); } else { internetAdress.setPersonal(personal, charset); } return internetAdress; }
java
public static Address newAddress(final String address, String personal, final String charset) throws AddressException, UnsupportedEncodingException { if (personal.isNullOrEmpty()) { personal = address; } final InternetAddress internetAdress = new InternetAddress(address); if (charset.isNullOrEmpty()) { internetAdress.setPersonal(personal); } else { internetAdress.setPersonal(personal, charset); } return internetAdress; }
[ "public", "static", "Address", "newAddress", "(", "final", "String", "address", ",", "String", "personal", ",", "final", "String", "charset", ")", "throws", "AddressException", ",", "UnsupportedEncodingException", "{", "if", "(", "personal", ".", "isNullOrEmpty", ...
Creates an Address from the given the address and personal name. @param address The address in RFC822 format. @param personal The personal name. @param charset MIME charset to be used to encode the name as per RFC 2047. @return The created InternetAddress-object from the given address and personal name. @throws AddressException is thrown if the parse failed @throws UnsupportedEncodingException is thrown if the encoding not supported
[ "Creates", "an", "Address", "from", "the", "given", "the", "address", "and", "personal", "name", "." ]
train
https://github.com/lightblueseas/email-tails/blob/7be6fee3548e61e697cc8e64e90603cb1f505be2/src/main/java/de/alpharogroup/email/utils/EmailExtensions.java#L219-L236
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java
StructuredQueryBuilder.containerConstraint
public StructuredQueryDefinition containerConstraint(String constraintName, StructuredQueryDefinition query) { checkQuery(query); return new ContainerConstraintQuery(constraintName, query); }
java
public StructuredQueryDefinition containerConstraint(String constraintName, StructuredQueryDefinition query) { checkQuery(query); return new ContainerConstraintQuery(constraintName, query); }
[ "public", "StructuredQueryDefinition", "containerConstraint", "(", "String", "constraintName", ",", "StructuredQueryDefinition", "query", ")", "{", "checkQuery", "(", "query", ")", ";", "return", "new", "ContainerConstraintQuery", "(", "constraintName", ",", "query", ")...
Matches a query within the substructure of the container specified by the constraint. @param constraintName the constraint definition @param query the query definition @return the StructuredQueryDefinition for the element constraint query
[ "Matches", "a", "query", "within", "the", "substructure", "of", "the", "container", "specified", "by", "the", "constraint", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L997-L1000
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java
ColumnNameHelper.maxComponents
public static List<ByteBuffer> maxComponents(List<ByteBuffer> maxSeen, Composite candidate, CellNameType comparator) { // For a cell name, no reason to look more than the clustering prefix // (and comparing the collection element would actually crash) int size = Math.min(candidate.size(), comparator.clusteringPrefixSize()); if (maxSeen.isEmpty()) return getComponents(candidate, size); // In most case maxSeen is big enough to hold the result so update it in place in those cases maxSeen = maybeGrow(maxSeen, size); for (int i = 0; i < size; i++) maxSeen.set(i, max(maxSeen.get(i), candidate.get(i), comparator.subtype(i))); return maxSeen; }
java
public static List<ByteBuffer> maxComponents(List<ByteBuffer> maxSeen, Composite candidate, CellNameType comparator) { // For a cell name, no reason to look more than the clustering prefix // (and comparing the collection element would actually crash) int size = Math.min(candidate.size(), comparator.clusteringPrefixSize()); if (maxSeen.isEmpty()) return getComponents(candidate, size); // In most case maxSeen is big enough to hold the result so update it in place in those cases maxSeen = maybeGrow(maxSeen, size); for (int i = 0; i < size; i++) maxSeen.set(i, max(maxSeen.get(i), candidate.get(i), comparator.subtype(i))); return maxSeen; }
[ "public", "static", "List", "<", "ByteBuffer", ">", "maxComponents", "(", "List", "<", "ByteBuffer", ">", "maxSeen", ",", "Composite", "candidate", ",", "CellNameType", "comparator", ")", "{", "// For a cell name, no reason to look more than the clustering prefix", "// (a...
finds the max cell name component(s) Note that this method *can modify maxSeen*. @param maxSeen the max columns seen so far @param candidate the candidate column(s) @param comparator the comparator to use @return a list with the max column(s)
[ "finds", "the", "max", "cell", "name", "component", "(", "s", ")" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java#L63-L79
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/disktree/DiskTreeReader.java
DiskTreeReader.readIndex
public STRtree readIndex() throws Exception { File file = new File(path); raf = new RandomAccessFile(file, "r"); raf.seek(6L); checkVersions(); long position = INDEX_ADDRESS_POSITION; raf.seek(position); long indexAddress = raf.readLong(); position = INDEX_ADDRESS_POSITION + INDEX_ADDRESS_SIZE; raf.seek(position); long indexSize = raf.readLong(); raf.seek(indexAddress); byte[] indexBytes = new byte[(int) indexSize]; int read = raf.read(indexBytes); if (read != indexSize) { throw new IOException(); } ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(indexBytes)); indexObj = (STRtree) in.readObject(); return indexObj; }
java
public STRtree readIndex() throws Exception { File file = new File(path); raf = new RandomAccessFile(file, "r"); raf.seek(6L); checkVersions(); long position = INDEX_ADDRESS_POSITION; raf.seek(position); long indexAddress = raf.readLong(); position = INDEX_ADDRESS_POSITION + INDEX_ADDRESS_SIZE; raf.seek(position); long indexSize = raf.readLong(); raf.seek(indexAddress); byte[] indexBytes = new byte[(int) indexSize]; int read = raf.read(indexBytes); if (read != indexSize) { throw new IOException(); } ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(indexBytes)); indexObj = (STRtree) in.readObject(); return indexObj; }
[ "public", "STRtree", "readIndex", "(", ")", "throws", "Exception", "{", "File", "file", "=", "new", "File", "(", "path", ")", ";", "raf", "=", "new", "RandomAccessFile", "(", "file", ",", "\"r\"", ")", ";", "raf", ".", "seek", "(", "6L", ")", ";", ...
Reads the {@link STRtree} object from the file. @return the quadtree, holding envelops and geometry positions in the file. @throws Exception
[ "Reads", "the", "{", "@link", "STRtree", "}", "object", "from", "the", "file", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/disktree/DiskTreeReader.java#L59-L84
vlingo/vlingo-actors
src/main/java/io/vlingo/actors/Actor.java
Actor.childActorFor
protected Protocols childActorFor(final Class<?>[] protocols, final Definition definition) { if (definition.supervisor() != null) { return lifeCycle.environment.stage.actorFor(protocols, definition, this, definition.supervisor(), logger()); } else { if (this instanceof Supervisor) { return lifeCycle.environment.stage.actorFor(protocols, definition, this, lifeCycle.lookUpProxy(Supervisor.class), logger()); } else { return lifeCycle.environment.stage.actorFor(protocols, definition, this, null, logger()); } } }
java
protected Protocols childActorFor(final Class<?>[] protocols, final Definition definition) { if (definition.supervisor() != null) { return lifeCycle.environment.stage.actorFor(protocols, definition, this, definition.supervisor(), logger()); } else { if (this instanceof Supervisor) { return lifeCycle.environment.stage.actorFor(protocols, definition, this, lifeCycle.lookUpProxy(Supervisor.class), logger()); } else { return lifeCycle.environment.stage.actorFor(protocols, definition, this, null, logger()); } } }
[ "protected", "Protocols", "childActorFor", "(", "final", "Class", "<", "?", ">", "[", "]", "protocols", ",", "final", "Definition", "definition", ")", "{", "if", "(", "definition", ".", "supervisor", "(", ")", "!=", "null", ")", "{", "return", "lifeCycle",...
Answers the {@code Protocols} for the child {@code Actor} to be created by this parent {@code Actor}. @param protocols the {@code Class<T>[]} protocols of the child {@code Actor} @param definition the {@code Definition} of the child {@code Actor} to be created by this parent {@code Actor} @return Protocols
[ "Answers", "the", "{" ]
train
https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/Actor.java#L181-L191
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUESubspace.java
CLIQUESubspace.dfs
public void dfs(CLIQUEUnit unit, ModifiableDBIDs cluster, CLIQUESubspace model) { cluster.addDBIDs(unit.getIds()); unit.markAsAssigned(); model.addDenseUnit(unit); final long[] dims = getDimensions(); for(int dim = BitsUtil.nextSetBit(dims, 0); dim >= 0; dim = BitsUtil.nextSetBit(dims, dim + 1)) { CLIQUEUnit left = leftNeighbor(unit, dim); if(left != null && !left.isAssigned()) { dfs(left, cluster, model); } CLIQUEUnit right = rightNeighbor(unit, dim); if(right != null && !right.isAssigned()) { dfs(right, cluster, model); } } }
java
public void dfs(CLIQUEUnit unit, ModifiableDBIDs cluster, CLIQUESubspace model) { cluster.addDBIDs(unit.getIds()); unit.markAsAssigned(); model.addDenseUnit(unit); final long[] dims = getDimensions(); for(int dim = BitsUtil.nextSetBit(dims, 0); dim >= 0; dim = BitsUtil.nextSetBit(dims, dim + 1)) { CLIQUEUnit left = leftNeighbor(unit, dim); if(left != null && !left.isAssigned()) { dfs(left, cluster, model); } CLIQUEUnit right = rightNeighbor(unit, dim); if(right != null && !right.isAssigned()) { dfs(right, cluster, model); } } }
[ "public", "void", "dfs", "(", "CLIQUEUnit", "unit", ",", "ModifiableDBIDs", "cluster", ",", "CLIQUESubspace", "model", ")", "{", "cluster", ".", "addDBIDs", "(", "unit", ".", "getIds", "(", ")", ")", ";", "unit", ".", "markAsAssigned", "(", ")", ";", "mo...
Depth-first search algorithm to find connected dense units in this subspace that build a cluster. It starts with a unit, assigns it to a cluster and finds all units it is connected to. @param unit the unit @param cluster the IDs of the feature vectors of the current cluster @param model the model of the cluster
[ "Depth", "-", "first", "search", "algorithm", "to", "find", "connected", "dense", "units", "in", "this", "subspace", "that", "build", "a", "cluster", ".", "It", "starts", "with", "a", "unit", "assigns", "it", "to", "a", "cluster", "and", "finds", "all", ...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUESubspace.java#L120-L137
ThreeTen/threetenbp
src/main/java/org/threeten/bp/chrono/Chronology.java
Chronology.updateResolveMap
void updateResolveMap(Map<TemporalField, Long> fieldValues, ChronoField field, long value) { Long current = fieldValues.get(field); if (current != null && current.longValue() != value) { throw new DateTimeException("Invalid state, field: " + field + " " + current + " conflicts with " + field + " " + value); } fieldValues.put(field, value); }
java
void updateResolveMap(Map<TemporalField, Long> fieldValues, ChronoField field, long value) { Long current = fieldValues.get(field); if (current != null && current.longValue() != value) { throw new DateTimeException("Invalid state, field: " + field + " " + current + " conflicts with " + field + " " + value); } fieldValues.put(field, value); }
[ "void", "updateResolveMap", "(", "Map", "<", "TemporalField", ",", "Long", ">", "fieldValues", ",", "ChronoField", "field", ",", "long", "value", ")", "{", "Long", "current", "=", "fieldValues", ".", "get", "(", "field", ")", ";", "if", "(", "current", "...
Updates the map of field-values during resolution. @param field the field to update, not null @param value the value to update, not null @throws DateTimeException if a conflict occurs
[ "Updates", "the", "map", "of", "field", "-", "values", "during", "resolution", "." ]
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/chrono/Chronology.java#L802-L808
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/jackson/JsonMapper.java
JsonMapper.addClassSerializer
public <T> void addClassSerializer(Class<? extends T> classToMap, JsonSerializer<T> classSerializer) { setNewObjectMapper(); // Is this right, setting a new object mapper on each add operation? SimpleModule mod = new SimpleModule("GeolatteCommonModule-" + classSerializer.getClass().getSimpleName()); mod.addSerializer(classToMap, classSerializer); mapper.registerModule(mod); }
java
public <T> void addClassSerializer(Class<? extends T> classToMap, JsonSerializer<T> classSerializer) { setNewObjectMapper(); // Is this right, setting a new object mapper on each add operation? SimpleModule mod = new SimpleModule("GeolatteCommonModule-" + classSerializer.getClass().getSimpleName()); mod.addSerializer(classToMap, classSerializer); mapper.registerModule(mod); }
[ "public", "<", "T", ">", "void", "addClassSerializer", "(", "Class", "<", "?", "extends", "T", ">", "classToMap", ",", "JsonSerializer", "<", "T", ">", "classSerializer", ")", "{", "setNewObjectMapper", "(", ")", ";", "// Is this right, setting a new object mapper...
Adds a serializer to this mapper. Allows a user to alter the serialization behavior for a certain type. @param classToMap the class to map @param classSerializer the serializer @param <T> the type of objects that will be serialized by the given serializer
[ "Adds", "a", "serializer", "to", "this", "mapper", ".", "Allows", "a", "user", "to", "alter", "the", "serialization", "behavior", "for", "a", "certain", "type", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/JsonMapper.java#L234-L239
vdmeer/skb-java-base
src/main/java/de/vandermeer/skb/base/info/AbstractFileInfo.java
AbstractFileInfo.tryResource
protected final boolean tryResource(String directory, String fileName){ String path = directory + "/" + fileName; if(directory==null){ path = fileName; } URL url; ClassLoader loader = Thread.currentThread().getContextClassLoader(); url = loader.getResource(path); if(url==null){ loader = AbstractFileInfo.class.getClassLoader(); url = loader.getResource(path); } if(url==null){ this.errors.addError("could not get Resource URL"); return false; } this.url = url; this.fullFileName = FilenameUtils.getName(fileName); if(directory!=null){ this.setRootPath = directory; } return true; }
java
protected final boolean tryResource(String directory, String fileName){ String path = directory + "/" + fileName; if(directory==null){ path = fileName; } URL url; ClassLoader loader = Thread.currentThread().getContextClassLoader(); url = loader.getResource(path); if(url==null){ loader = AbstractFileInfo.class.getClassLoader(); url = loader.getResource(path); } if(url==null){ this.errors.addError("could not get Resource URL"); return false; } this.url = url; this.fullFileName = FilenameUtils.getName(fileName); if(directory!=null){ this.setRootPath = directory; } return true; }
[ "protected", "final", "boolean", "tryResource", "(", "String", "directory", ",", "String", "fileName", ")", "{", "String", "path", "=", "directory", "+", "\"/\"", "+", "fileName", ";", "if", "(", "directory", "==", "null", ")", "{", "path", "=", "fileName"...
Try to locate a file as resource. @param directory a directory to locate the file in @param fileName a file name with optional path information @return true if the file was found, false otherwise
[ "Try", "to", "locate", "a", "file", "as", "resource", "." ]
train
https://github.com/vdmeer/skb-java-base/blob/6d845bcc482aa9344d016e80c0c3455aeae13a13/src/main/java/de/vandermeer/skb/base/info/AbstractFileInfo.java#L357-L383
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java
HystrixMetricsPublisherFactory.createOrRetrievePublisherForThreadPool
public static HystrixMetricsPublisherThreadPool createOrRetrievePublisherForThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties) { return SINGLETON.getPublisherForThreadPool(threadPoolKey, metrics, properties); }
java
public static HystrixMetricsPublisherThreadPool createOrRetrievePublisherForThreadPool(HystrixThreadPoolKey threadPoolKey, HystrixThreadPoolMetrics metrics, HystrixThreadPoolProperties properties) { return SINGLETON.getPublisherForThreadPool(threadPoolKey, metrics, properties); }
[ "public", "static", "HystrixMetricsPublisherThreadPool", "createOrRetrievePublisherForThreadPool", "(", "HystrixThreadPoolKey", "threadPoolKey", ",", "HystrixThreadPoolMetrics", "metrics", ",", "HystrixThreadPoolProperties", "properties", ")", "{", "return", "SINGLETON", ".", "ge...
Get an instance of {@link HystrixMetricsPublisherThreadPool} with the given factory {@link HystrixMetricsPublisher} implementation for each {@link HystrixThreadPool} instance. @param threadPoolKey Pass-thru to {@link HystrixMetricsPublisher#getMetricsPublisherForThreadPool} implementation @param metrics Pass-thru to {@link HystrixMetricsPublisher#getMetricsPublisherForThreadPool} implementation @param properties Pass-thru to {@link HystrixMetricsPublisher#getMetricsPublisherForThreadPool} implementation @return {@link HystrixMetricsPublisherThreadPool} instance
[ "Get", "an", "instance", "of", "{", "@link", "HystrixMetricsPublisherThreadPool", "}", "with", "the", "given", "factory", "{", "@link", "HystrixMetricsPublisher", "}", "implementation", "for", "each", "{", "@link", "HystrixThreadPool", "}", "instance", "." ]
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/strategy/metrics/HystrixMetricsPublisherFactory.java#L63-L65
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/render/AbstractRenderer.java
AbstractRenderer.createLabel
public Label createLabel(BaseComponent parent, Object value) { return createLabel(parent, value, null, null); }
java
public Label createLabel(BaseComponent parent, Object value) { return createLabel(parent, value, null, null); }
[ "public", "Label", "createLabel", "(", "BaseComponent", "parent", ",", "Object", "value", ")", "{", "return", "createLabel", "(", "parent", ",", "value", ",", "null", ",", "null", ")", ";", "}" ]
Creates a label for a string value. @param parent BaseComponent that will be the parent of the label. @param value Value to be used as label text. @return The newly created label.
[ "Creates", "a", "label", "for", "a", "string", "value", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/render/AbstractRenderer.java#L75-L77
lightblue-platform/lightblue-client
hystrix/src/main/java/com/redhat/lightblue/client/hystrix/graphite/ServoGraphiteSetup.java
ServoGraphiteSetup.registerStatsdMetricObserver
protected static void registerStatsdMetricObserver(List<MetricObserver> observers, String prefix, String host, String port) { // verify at least hostname is set, else cannot configure this observer if (null == host || host.trim().isEmpty()) { LOGGER.info("StatdsMetricObserver not configured, missing environment variable: {}", ENV_STATSD_HOSTNAME); return; } LOGGER.debug("{} environment variable is: {}", ENV_STATSD_PREFIX, prefix); LOGGER.debug("{} environment variable is: {}", ENV_STATSD_HOSTNAME, host); LOGGER.debug("{} environment variable is: {}", ENV_STATSD_PORT, port); int iport = -1; if (port != null && !port.isEmpty()) { try { iport = Integer.valueOf(port); } catch (NumberFormatException e) { iport = -1; LOGGER.warn("Configured port is not an integer. Falling back to default"); } } if (iport < 0) { iport = 8125; //default statsd port LOGGER.debug("Using default port: " + port); } LOGGER.debug("StatsdMetricObserver prefix: " + prefix); LOGGER.debug("StatsdMetricObserver host: " + host); LOGGER.debug("StatsdMetricObserver port: " + iport); observers.add(new StatsdMetricObserver(prefix, host, iport)); }
java
protected static void registerStatsdMetricObserver(List<MetricObserver> observers, String prefix, String host, String port) { // verify at least hostname is set, else cannot configure this observer if (null == host || host.trim().isEmpty()) { LOGGER.info("StatdsMetricObserver not configured, missing environment variable: {}", ENV_STATSD_HOSTNAME); return; } LOGGER.debug("{} environment variable is: {}", ENV_STATSD_PREFIX, prefix); LOGGER.debug("{} environment variable is: {}", ENV_STATSD_HOSTNAME, host); LOGGER.debug("{} environment variable is: {}", ENV_STATSD_PORT, port); int iport = -1; if (port != null && !port.isEmpty()) { try { iport = Integer.valueOf(port); } catch (NumberFormatException e) { iport = -1; LOGGER.warn("Configured port is not an integer. Falling back to default"); } } if (iport < 0) { iport = 8125; //default statsd port LOGGER.debug("Using default port: " + port); } LOGGER.debug("StatsdMetricObserver prefix: " + prefix); LOGGER.debug("StatsdMetricObserver host: " + host); LOGGER.debug("StatsdMetricObserver port: " + iport); observers.add(new StatsdMetricObserver(prefix, host, iport)); }
[ "protected", "static", "void", "registerStatsdMetricObserver", "(", "List", "<", "MetricObserver", ">", "observers", ",", "String", "prefix", ",", "String", "host", ",", "String", "port", ")", "{", "// verify at least hostname is set, else cannot configure this observer", ...
If there is sufficient configuration, register a StatsD metric observer to publish metrics. Requires at a minimum a host. Optionally can set prefix as well as port. The prefix defaults to an empty string and port defaults to '8125'.
[ "If", "there", "is", "sufficient", "configuration", "register", "a", "StatsD", "metric", "observer", "to", "publish", "metrics", ".", "Requires", "at", "a", "minimum", "a", "host", ".", "Optionally", "can", "set", "prefix", "as", "well", "as", "port", ".", ...
train
https://github.com/lightblue-platform/lightblue-client/blob/03790aff34e90d3889f60fd6c603c21a21dc1a40/hystrix/src/main/java/com/redhat/lightblue/client/hystrix/graphite/ServoGraphiteSetup.java#L159-L190
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/bytebuffer/WsByteBufferUtils.java
WsByteBufferUtils.asString
public static final String asString(WsByteBuffer buff, int position, int limit) { byte[] data = asByteArray(buff, position, limit); return (null != data) ? new String(data) : null; }
java
public static final String asString(WsByteBuffer buff, int position, int limit) { byte[] data = asByteArray(buff, position, limit); return (null != data) ? new String(data) : null; }
[ "public", "static", "final", "String", "asString", "(", "WsByteBuffer", "buff", ",", "int", "position", ",", "int", "limit", ")", "{", "byte", "[", "]", "data", "=", "asByteArray", "(", "buff", ",", "position", ",", "limit", ")", ";", "return", "(", "n...
Convert a buffer to a string using the input starting position and ending limit. @param buff @param position @param limit @return String
[ "Convert", "a", "buffer", "to", "a", "string", "using", "the", "input", "starting", "position", "and", "ending", "limit", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/wsspi/bytebuffer/WsByteBufferUtils.java#L131-L134
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java
CheckArg.isNotEquals
public static <T> void isNotEquals( final T argument, String argumentName, final T object, String objectName ) { if (argument == null) { if (object != null) return; // fall through ... both are null } else { if (!argument.equals(object)) return; // handles object==null // fall through ... they are equal } if (objectName == null) objectName = getObjectName(object); throw new IllegalArgumentException(CommonI18n.argumentMustNotBeEquals.text(argumentName, objectName)); }
java
public static <T> void isNotEquals( final T argument, String argumentName, final T object, String objectName ) { if (argument == null) { if (object != null) return; // fall through ... both are null } else { if (!argument.equals(object)) return; // handles object==null // fall through ... they are equal } if (objectName == null) objectName = getObjectName(object); throw new IllegalArgumentException(CommonI18n.argumentMustNotBeEquals.text(argumentName, objectName)); }
[ "public", "static", "<", "T", ">", "void", "isNotEquals", "(", "final", "T", "argument", ",", "String", "argumentName", ",", "final", "T", "object", ",", "String", "objectName", ")", "{", "if", "(", "argument", "==", "null", ")", "{", "if", "(", "objec...
Asserts that the specified first object is not {@link Object#equals(Object) equal to} the specified second object. This method does take null references into consideration. @param <T> @param argument The argument to assert equal to <code>object</code>. @param argumentName The name that will be used within the exception message for the argument should an exception be thrown @param object The object to assert as equal to <code>argument</code>. @param objectName The name that will be used within the exception message for <code>object</code> should an exception be thrown; if <code>null</code> and <code>object</code> is not <code>null</code>, <code>object.toString()</code> will be used. @throws IllegalArgumentException If the specified objects are equals.
[ "Asserts", "that", "the", "specified", "first", "object", "is", "not", "{", "@link", "Object#equals", "(", "Object", ")", "equal", "to", "}", "the", "specified", "second", "object", ".", "This", "method", "does", "take", "null", "references", "into", "consid...
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/CheckArg.java#L545-L558
d-tarasov/android-intents
library/src/com/dmitriy/tarasov/android/intents/IntentUtils.java
IntentUtils.pickContact
public static Intent pickContact(String scope) { Intent intent; if (isSupportsContactsV2()) { intent = new Intent(Intent.ACTION_PICK, Uri.parse("content://com.android.contacts/contacts")); } else { intent = new Intent(Intent.ACTION_PICK, Contacts.People.CONTENT_URI); } if (!TextUtils.isEmpty(scope)) { intent.setType(scope); } return intent; }
java
public static Intent pickContact(String scope) { Intent intent; if (isSupportsContactsV2()) { intent = new Intent(Intent.ACTION_PICK, Uri.parse("content://com.android.contacts/contacts")); } else { intent = new Intent(Intent.ACTION_PICK, Contacts.People.CONTENT_URI); } if (!TextUtils.isEmpty(scope)) { intent.setType(scope); } return intent; }
[ "public", "static", "Intent", "pickContact", "(", "String", "scope", ")", "{", "Intent", "intent", ";", "if", "(", "isSupportsContactsV2", "(", ")", ")", "{", "intent", "=", "new", "Intent", "(", "Intent", ".", "ACTION_PICK", ",", "Uri", ".", "parse", "(...
Pick contact from phone book @param scope You can restrict selection by passing required content type. Examples: <p/> <code><pre> // Select only from users with emails IntentUtils.pickContact(ContactsContract.CommonDataKinds.Email.CONTENT_TYPE); <p/> // Select only from users with phone numbers on pre Eclair devices IntentUtils.pickContact(Contacts.Phones.CONTENT_TYPE); <p/> // Select only from users with phone numbers on devices with Eclair and higher IntentUtils.pickContact(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE); </pre></code>
[ "Pick", "contact", "from", "phone", "book" ]
train
https://github.com/d-tarasov/android-intents/blob/ac3c6e2fd88057708988a96eda6240c29efe1b9a/library/src/com/dmitriy/tarasov/android/intents/IntentUtils.java#L397-L409
helun/Ektorp
org.ektorp/src/main/java/org/ektorp/util/Documents.java
Documents.registerAccessor
public static void registerAccessor(Class<?> documentType, DocumentAccessor accessor) { Assert.notNull(documentType, "documentType may not be null"); Assert.notNull(accessor, "accessor may not be null"); if (accessors.containsKey(documentType)) { DocumentAccessor existing = getAccessor(documentType); LOG.warn(String.format("DocumentAccessor for class %s already exists: %s will be overridden by %s", documentType, existing.getClass(), accessor.getClass())); } putAccessor(documentType, accessor); LOG.debug("Registered document accessor: {} for class: {}", accessor.getClass(), documentType); }
java
public static void registerAccessor(Class<?> documentType, DocumentAccessor accessor) { Assert.notNull(documentType, "documentType may not be null"); Assert.notNull(accessor, "accessor may not be null"); if (accessors.containsKey(documentType)) { DocumentAccessor existing = getAccessor(documentType); LOG.warn(String.format("DocumentAccessor for class %s already exists: %s will be overridden by %s", documentType, existing.getClass(), accessor.getClass())); } putAccessor(documentType, accessor); LOG.debug("Registered document accessor: {} for class: {}", accessor.getClass(), documentType); }
[ "public", "static", "void", "registerAccessor", "(", "Class", "<", "?", ">", "documentType", ",", "DocumentAccessor", "accessor", ")", "{", "Assert", ".", "notNull", "(", "documentType", ",", "\"documentType may not be null\"", ")", ";", "Assert", ".", "notNull", ...
Used to register a custom DocumentAccessor for a particular class. Any existing accessor for the class will be overridden. @param documentType @param accessor
[ "Used", "to", "register", "a", "custom", "DocumentAccessor", "for", "a", "particular", "class", ".", "Any", "existing", "accessor", "for", "the", "class", "will", "be", "overridden", "." ]
train
https://github.com/helun/Ektorp/blob/b822c0d656aefb90a5e0cb5ec2de3daa969e3eaa/org.ektorp/src/main/java/org/ektorp/util/Documents.java#L47-L56
googleads/googleads-java-lib
modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Maps.java
Maps.toArray
public static <K, V, T> T[] toArray(Map<K, V> map, T[] entryArray) { return toList(map, entryArray.getClass().getComponentType()).toArray(entryArray); }
java
public static <K, V, T> T[] toArray(Map<K, V> map, T[] entryArray) { return toList(map, entryArray.getClass().getComponentType()).toArray(entryArray); }
[ "public", "static", "<", "K", ",", "V", ",", "T", ">", "T", "[", "]", "toArray", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "T", "[", "]", "entryArray", ")", "{", "return", "toList", "(", "map", ",", "entryArray", ".", "getClass", "(", ...
Generates an array of entries from a map. Entries are defined in the API as a class which consists of a {@code key} and {@code value} with a name typically in the form of {@code Key_ValueMapEntry}, represented here as {@code T}. The generated array can be used in objects where {@code List<Key_ValueMapEntry>} is taken as a value. The input map must have same type {@code K} as the {@code key} within {@code Key_ValueMapEntry}. The same applies for {@code V} and {@code value} within {@code Key_ValueMapEntry}. @param <K> the type of the entry key @param <V> the type of the entry value @param <T> the map entry type @param map a map of type {@code K} and {@code V} representing the entry array @param entryArray the entry array that entries will be added into @return an array all map entries contained within the map parameter into the provided array or a new array if there was not enough room
[ "Generates", "an", "array", "of", "entries", "from", "a", "map", ".", "Entries", "are", "defined", "in", "the", "API", "as", "a", "class", "which", "consists", "of", "a", "{", "@code", "key", "}", "and", "{", "@code", "value", "}", "with", "a", "name...
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Maps.java#L123-L125
primefaces/primefaces
src/main/java/org/primefaces/renderkit/InputRenderer.java
InputRenderer.renderARIARequired
protected void renderARIARequired(FacesContext context, UIInput component) throws IOException { if (component.isRequired()) { ResponseWriter writer = context.getResponseWriter(); writer.writeAttribute(HTML.ARIA_REQUIRED, "true", null); } }
java
protected void renderARIARequired(FacesContext context, UIInput component) throws IOException { if (component.isRequired()) { ResponseWriter writer = context.getResponseWriter(); writer.writeAttribute(HTML.ARIA_REQUIRED, "true", null); } }
[ "protected", "void", "renderARIARequired", "(", "FacesContext", "context", ",", "UIInput", "component", ")", "throws", "IOException", "{", "if", "(", "component", ".", "isRequired", "(", ")", ")", "{", "ResponseWriter", "writer", "=", "context", ".", "getRespons...
Adds "aria-required" if the component is required. @param context the {@link FacesContext} @param component the {@link UIInput} component to add attributes for @throws IOException if any error occurs writing the response
[ "Adds", "aria", "-", "required", "if", "the", "component", "is", "required", "." ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/renderkit/InputRenderer.java#L81-L86
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java
CPDefinitionOptionValueRelPersistenceImpl.findByCompanyId
@Override public List<CPDefinitionOptionValueRel> findByCompanyId(long companyId, int start, int end) { return findByCompanyId(companyId, start, end, null); }
java
@Override public List<CPDefinitionOptionValueRel> findByCompanyId(long companyId, int start, int end) { return findByCompanyId(companyId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPDefinitionOptionValueRel", ">", "findByCompanyId", "(", "long", "companyId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCompanyId", "(", "companyId", ",", "start", ",", "end", ",", "null", ")...
Returns a range of all the cp definition option value rels where companyId = &#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 CPDefinitionOptionValueRelModelImpl}. 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 companyId the company ID @param start the lower bound of the range of cp definition option value rels @param end the upper bound of the range of cp definition option value rels (not inclusive) @return the range of matching cp definition option value rels
[ "Returns", "a", "range", "of", "all", "the", "cp", "definition", "option", "value", "rels", "where", "companyId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java#L2069-L2073
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SecretKeyFactory.java
SecretKeyFactory.translateKey
public final SecretKey translateKey(SecretKey key) throws InvalidKeyException { if (serviceIterator == null) { return spi.engineTranslateKey(key); } Exception failure = null; SecretKeyFactorySpi mySpi = spi; do { try { return mySpi.engineTranslateKey(key); } catch (Exception e) { if (failure == null) { failure = e; } mySpi = nextSpi(mySpi); } } while (mySpi != null); if (failure instanceof InvalidKeyException) { throw (InvalidKeyException)failure; } throw new InvalidKeyException ("Could not translate key", failure); }
java
public final SecretKey translateKey(SecretKey key) throws InvalidKeyException { if (serviceIterator == null) { return spi.engineTranslateKey(key); } Exception failure = null; SecretKeyFactorySpi mySpi = spi; do { try { return mySpi.engineTranslateKey(key); } catch (Exception e) { if (failure == null) { failure = e; } mySpi = nextSpi(mySpi); } } while (mySpi != null); if (failure instanceof InvalidKeyException) { throw (InvalidKeyException)failure; } throw new InvalidKeyException ("Could not translate key", failure); }
[ "public", "final", "SecretKey", "translateKey", "(", "SecretKey", "key", ")", "throws", "InvalidKeyException", "{", "if", "(", "serviceIterator", "==", "null", ")", "{", "return", "spi", ".", "engineTranslateKey", "(", "key", ")", ";", "}", "Exception", "failu...
Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this secret-key factory. @param key the key whose provider is unknown or untrusted @return the translated key @exception InvalidKeyException if the given key cannot be processed by this secret-key factory.
[ "Translates", "a", "key", "object", "whose", "provider", "may", "be", "unknown", "or", "potentially", "untrusted", "into", "a", "corresponding", "key", "object", "of", "this", "secret", "-", "key", "factory", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SecretKeyFactory.java#L590-L612
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/DeepEquals.java
DeepEquals.compareOrdered
private static boolean compareOrdered(DualKey dualKey, LinkedList<DualKey> stack, Collection visited) { Collection col1 = (Collection) dualKey._key1; Collection col2 = (Collection) dualKey._key2; if (ProxyHelper.isProxyCollection(col1) || ProxyHelper.isProxyCollection(col2)) { return false; } if (col1.size() != col2.size()) { return false; } Iterator i1 = col1.iterator(); Iterator i2 = col2.iterator(); while (i1.hasNext()) { DualKey dk = new DualKey(i1.next(), i2.next()); if (!visited.contains(dk)) { stack.addFirst(dk); } } return true; }
java
private static boolean compareOrdered(DualKey dualKey, LinkedList<DualKey> stack, Collection visited) { Collection col1 = (Collection) dualKey._key1; Collection col2 = (Collection) dualKey._key2; if (ProxyHelper.isProxyCollection(col1) || ProxyHelper.isProxyCollection(col2)) { return false; } if (col1.size() != col2.size()) { return false; } Iterator i1 = col1.iterator(); Iterator i2 = col2.iterator(); while (i1.hasNext()) { DualKey dk = new DualKey(i1.next(), i2.next()); if (!visited.contains(dk)) { stack.addFirst(dk); } } return true; }
[ "private", "static", "boolean", "compareOrdered", "(", "DualKey", "dualKey", ",", "LinkedList", "<", "DualKey", ">", "stack", ",", "Collection", "visited", ")", "{", "Collection", "col1", "=", "(", "Collection", ")", "dualKey", ".", "_key1", ";", "Collection",...
Compare two Collections that must be same length and in same order. @param dualKey DualKey represents the two Collections to compare @param visited Collection of objects already compared (prevents cycles) @param stack add items to compare to the Stack (Stack versus recursion) @return boolean false if the Collections are not the same length, otherwise place collection items on Stack to be further compared.
[ "Compare", "two", "Collections", "that", "must", "be", "same", "length", "and", "in", "same", "order", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/DeepEquals.java#L348-L375
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
Main.processJarFile
boolean processJarFile(String jarname, Collection<String> classNames) throws IOException { classPath.add(0, new File(jarname)); if (classNames.isEmpty()) { return doJarFile(jarname); } else { return doClassNames(classNames); } }
java
boolean processJarFile(String jarname, Collection<String> classNames) throws IOException { classPath.add(0, new File(jarname)); if (classNames.isEmpty()) { return doJarFile(jarname); } else { return doClassNames(classNames); } }
[ "boolean", "processJarFile", "(", "String", "jarname", ",", "Collection", "<", "String", ">", "classNames", ")", "throws", "IOException", "{", "classPath", ".", "add", "(", "0", ",", "new", "File", "(", "jarname", ")", ")", ";", "if", "(", "classNames", ...
Processes named class files from the given jar file, or all classes if classNames is empty. @param jarname the name of the jar file to process @param classNames the names of classes to process @return true for success, false for failure @throws IOException if an I/O error occurs
[ "Processes", "named", "class", "files", "from", "the", "given", "jar", "file", "or", "all", "classes", "if", "classNames", "is", "empty", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java#L281-L289
apollographql/apollo-android
apollo-runtime/src/main/java/com/apollographql/apollo/internal/ApolloCallTracker.java
ApolloCallTracker.activeQueryWatchers
@NotNull Set<ApolloQueryWatcher> activeQueryWatchers(@NotNull OperationName operationName) { return activeCalls(activeQueryWatchers, operationName); }
java
@NotNull Set<ApolloQueryWatcher> activeQueryWatchers(@NotNull OperationName operationName) { return activeCalls(activeQueryWatchers, operationName); }
[ "@", "NotNull", "Set", "<", "ApolloQueryWatcher", ">", "activeQueryWatchers", "(", "@", "NotNull", "OperationName", "operationName", ")", "{", "return", "activeCalls", "(", "activeQueryWatchers", ",", "operationName", ")", ";", "}" ]
Returns currently active {@link ApolloQueryWatcher} query watchers by operation name. @param operationName query watcher operation name @return set of active query watchers
[ "Returns", "currently", "active", "{", "@link", "ApolloQueryWatcher", "}", "query", "watchers", "by", "operation", "name", "." ]
train
https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-runtime/src/main/java/com/apollographql/apollo/internal/ApolloCallTracker.java#L225-L227
apache/groovy
src/main/groovy/groovy/util/FactoryBuilderSupport.java
FactoryBuilderSupport.nodeCompleted
protected void nodeCompleted(Object parent, Object node) { getProxyBuilder().getCurrentFactory().onNodeCompleted(getProxyBuilder().getChildBuilder(), parent, node); }
java
protected void nodeCompleted(Object parent, Object node) { getProxyBuilder().getCurrentFactory().onNodeCompleted(getProxyBuilder().getChildBuilder(), parent, node); }
[ "protected", "void", "nodeCompleted", "(", "Object", "parent", ",", "Object", "node", ")", "{", "getProxyBuilder", "(", ")", ".", "getCurrentFactory", "(", ")", ".", "onNodeCompleted", "(", "getProxyBuilder", "(", ")", ".", "getChildBuilder", "(", ")", ",", ...
A hook to allow nodes to be processed once they have had all of their children applied. @param node the current node being processed @param parent the parent of the node being processed
[ "A", "hook", "to", "allow", "nodes", "to", "be", "processed", "once", "they", "have", "had", "all", "of", "their", "children", "applied", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/FactoryBuilderSupport.java#L1004-L1006
fabric8io/fabric8-forge
addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCatalogHelper.java
CamelCatalogHelper.getPrefix
public static String getPrefix(CamelCatalog camelCatalog, String scheme, String key) { // use the camel catalog String json = camelCatalog.componentJSonSchema(scheme); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true); if (data != null) { for (Map<String, String> propertyMap : data) { String name = propertyMap.get("name"); String prefix = propertyMap.get("prefix"); if (key.equals(name)) { return prefix; } } } return null; }
java
public static String getPrefix(CamelCatalog camelCatalog, String scheme, String key) { // use the camel catalog String json = camelCatalog.componentJSonSchema(scheme); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true); if (data != null) { for (Map<String, String> propertyMap : data) { String name = propertyMap.get("name"); String prefix = propertyMap.get("prefix"); if (key.equals(name)) { return prefix; } } } return null; }
[ "public", "static", "String", "getPrefix", "(", "CamelCatalog", "camelCatalog", ",", "String", "scheme", ",", "String", "key", ")", "{", "// use the camel catalog", "String", "json", "=", "camelCatalog", ".", "componentJSonSchema", "(", "scheme", ")", ";", "if", ...
Checks whether the given key is a multi valued option @param scheme the component name @param key the option key @return <tt>true</tt> if the key is multi valued, <tt>false</tt> otherwise
[ "Checks", "whether", "the", "given", "key", "is", "a", "multi", "valued", "option" ]
train
https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCatalogHelper.java#L234-L252
app55/app55-java
src/support/java/com/googlecode/openbeans/beancontext/BeanContextServicesSupport.java
BeanContextServicesSupport.addService
@SuppressWarnings("unchecked") protected boolean addService(Class serviceClass, BeanContextServiceProvider provider, boolean fireEvent) { if (serviceClass == null || provider == null) { throw new NullPointerException(); } synchronized (globalHierarchyLock) { synchronized (services) { if (services.containsKey(serviceClass)) { return false; } // add to services services.put(serviceClass, createBCSSServiceProvider(serviceClass, provider)); // count Serializable if (provider instanceof Serializable) { serializable++; } } } if (fireEvent) { // notify all listeners and BeanContextServices children notifyServiceAvailable(new BeanContextServiceAvailableEvent(this, serviceClass)); } return true; }
java
@SuppressWarnings("unchecked") protected boolean addService(Class serviceClass, BeanContextServiceProvider provider, boolean fireEvent) { if (serviceClass == null || provider == null) { throw new NullPointerException(); } synchronized (globalHierarchyLock) { synchronized (services) { if (services.containsKey(serviceClass)) { return false; } // add to services services.put(serviceClass, createBCSSServiceProvider(serviceClass, provider)); // count Serializable if (provider instanceof Serializable) { serializable++; } } } if (fireEvent) { // notify all listeners and BeanContextServices children notifyServiceAvailable(new BeanContextServiceAvailableEvent(this, serviceClass)); } return true; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "boolean", "addService", "(", "Class", "serviceClass", ",", "BeanContextServiceProvider", "provider", ",", "boolean", "fireEvent", ")", "{", "if", "(", "serviceClass", "==", "null", "||", "provider", ...
Add a service to this context. <p> If the service already exists in the context, simply return false. Otherwise, the service is added and event is fired if required. </p> @param serviceClass the service class @param provider the provider of the service @param fireEvent the flag indicating to fire event or not @return true if the service is added; or false if the context already has this service
[ "Add", "a", "service", "to", "this", "context", ".", "<p", ">", "If", "the", "service", "already", "exists", "in", "the", "context", "simply", "return", "false", ".", "Otherwise", "the", "service", "is", "added", "and", "event", "is", "fired", "if", "req...
train
https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/beancontext/BeanContextServicesSupport.java#L342-L374
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/appdev/AppPackageUrl.java
AppPackageUrl.createPackageUrl
public static MozuUrl createPackageUrl(Integer projectId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/appdev/apppackages/project/?projectId={projectId}&responseFields={responseFields}"); formatter.formatUrl("projectId", projectId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl createPackageUrl(Integer projectId, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/appdev/apppackages/project/?projectId={projectId}&responseFields={responseFields}"); formatter.formatUrl("projectId", projectId); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "createPackageUrl", "(", "Integer", "projectId", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/platform/appdev/apppackages/project/?projectId={projectId}&responseFields={responseFiel...
Get Resource Url for CreatePackage @param projectId @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "CreatePackage" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/appdev/AppPackageUrl.java#L142-L148
alkacon/opencms-core
src/org/opencms/util/CmsHtmlExtractor.java
CmsHtmlExtractor.extractText
public static String extractText(InputStream in, String encoding) throws ParserException, UnsupportedEncodingException { Parser parser = new Parser(); Lexer lexer = new Lexer(); Page page = new Page(in, encoding); lexer.setPage(page); parser.setLexer(lexer); StringBean stringBean = new StringBean(); parser.visitAllNodesWith(stringBean); String result = stringBean.getStrings(); return result == null ? "" : result; }
java
public static String extractText(InputStream in, String encoding) throws ParserException, UnsupportedEncodingException { Parser parser = new Parser(); Lexer lexer = new Lexer(); Page page = new Page(in, encoding); lexer.setPage(page); parser.setLexer(lexer); StringBean stringBean = new StringBean(); parser.visitAllNodesWith(stringBean); String result = stringBean.getStrings(); return result == null ? "" : result; }
[ "public", "static", "String", "extractText", "(", "InputStream", "in", ",", "String", "encoding", ")", "throws", "ParserException", ",", "UnsupportedEncodingException", "{", "Parser", "parser", "=", "new", "Parser", "(", ")", ";", "Lexer", "lexer", "=", "new", ...
Extract the text from a HTML page.<p> @param in the html content input stream @param encoding the encoding of the content @return the extracted text from the page @throws ParserException if the parsing of the HTML failed @throws UnsupportedEncodingException if the given encoding is not supported
[ "Extract", "the", "text", "from", "a", "HTML", "page", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsHtmlExtractor.java#L67-L81
vlingo/vlingo-actors
src/main/java/io/vlingo/actors/Stage.java
Stage.actorFor
public Protocols actorFor(final Class<?>[] protocols, final Definition definition, final Actor parent, final Supervisor maybeSupervisor, final Logger logger) { final ActorProtocolActor<Object>[] all = actorProtocolFor( protocols, definition, parent, maybeSupervisor, logger); return new Protocols(ActorProtocolActor.toActors(all)); }
java
public Protocols actorFor(final Class<?>[] protocols, final Definition definition, final Actor parent, final Supervisor maybeSupervisor, final Logger logger) { final ActorProtocolActor<Object>[] all = actorProtocolFor( protocols, definition, parent, maybeSupervisor, logger); return new Protocols(ActorProtocolActor.toActors(all)); }
[ "public", "Protocols", "actorFor", "(", "final", "Class", "<", "?", ">", "[", "]", "protocols", ",", "final", "Definition", "definition", ",", "final", "Actor", "parent", ",", "final", "Supervisor", "maybeSupervisor", ",", "final", "Logger", "logger", ")", "...
Answers a {@code Protocols} that provides one or more supported {@code protocols} for the newly created {@code Actor} according to {@code definition}. @param protocols the {@code Class<?>}[] array of protocols that the {@code Actor} supports @param definition the {@code Definition} providing parameters to the {@code Actor} @param parent the Actor that is this actor's parent @param maybeSupervisor the possible Supervisor of this actor @param logger the Logger of this actor @return Protocols
[ "Answers", "a", "{" ]
train
https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/Stage.java#L167-L177
ag-gipp/MathMLTools
mathml-similarity/src/main/java/com/formulasearchengine/mathmltools/similarity/node/MathNodeGenerator.java
MathNodeGenerator.generateMathNode
public static MathNode generateMathNode(CMMLInfo cmmlInfo) throws MathNodeException { Objects.requireNonNull(cmmlInfo, "cmml document is null"); try { return generateMathNode(CMMLHelper.getFirstApplyNode(cmmlInfo)); } catch (XPathExpressionException e) { logger.error("could not generate math node tree", e); throw new MathNodeException("could not generate math node tree", e); } }
java
public static MathNode generateMathNode(CMMLInfo cmmlInfo) throws MathNodeException { Objects.requireNonNull(cmmlInfo, "cmml document is null"); try { return generateMathNode(CMMLHelper.getFirstApplyNode(cmmlInfo)); } catch (XPathExpressionException e) { logger.error("could not generate math node tree", e); throw new MathNodeException("could not generate math node tree", e); } }
[ "public", "static", "MathNode", "generateMathNode", "(", "CMMLInfo", "cmmlInfo", ")", "throws", "MathNodeException", "{", "Objects", ".", "requireNonNull", "(", "cmmlInfo", ",", "\"cmml document is null\"", ")", ";", "try", "{", "return", "generateMathNode", "(", "C...
Create a math expression tree (MEXT) starting from an CMMLInfo document. @param cmmlInfo CMMLInfo document @return first MathNode representing the root of the MEXT, or null
[ "Create", "a", "math", "expression", "tree", "(", "MEXT", ")", "starting", "from", "an", "CMMLInfo", "document", "." ]
train
https://github.com/ag-gipp/MathMLTools/blob/77c69b6366a5b8720796d1cd9d155ba26c2f1b20/mathml-similarity/src/main/java/com/formulasearchengine/mathmltools/similarity/node/MathNodeGenerator.java#L37-L45
skyscreamer/JSONassert
src/main/java/org/skyscreamer/jsonassert/JSONAssert.java
JSONAssert.assertNotEquals
public static void assertNotEquals(String message, String expectedStr, String actualStr, JSONCompareMode compareMode) throws JSONException { JSONCompareResult result = JSONCompare.compareJSON(expectedStr, actualStr, compareMode); if (result.passed()) { throw new AssertionError(getCombinedMessage(message, result.getMessage())); } }
java
public static void assertNotEquals(String message, String expectedStr, String actualStr, JSONCompareMode compareMode) throws JSONException { JSONCompareResult result = JSONCompare.compareJSON(expectedStr, actualStr, compareMode); if (result.passed()) { throw new AssertionError(getCombinedMessage(message, result.getMessage())); } }
[ "public", "static", "void", "assertNotEquals", "(", "String", "message", ",", "String", "expectedStr", ",", "String", "actualStr", ",", "JSONCompareMode", "compareMode", ")", "throws", "JSONException", "{", "JSONCompareResult", "result", "=", "JSONCompare", ".", "co...
Asserts that the JSONArray provided does not match the expected string. If it is it throws an {@link AssertionError}. @param message Error message to be displayed in case of assertion failure @param expectedStr Expected JSON string @param actualStr String to compare @param compareMode Specifies which comparison mode to use @throws JSONException JSON parsing error
[ "Asserts", "that", "the", "JSONArray", "provided", "does", "not", "match", "the", "expected", "string", ".", "If", "it", "is", "it", "throws", "an", "{", "@link", "AssertionError", "}", "." ]
train
https://github.com/skyscreamer/JSONassert/blob/830efcf546d07f955d8a213cc5c8a1db34d78f04/src/main/java/org/skyscreamer/jsonassert/JSONAssert.java#L445-L451
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/factory/transform/pyramid/FactoryPyramid.java
FactoryPyramid.scaleSpacePyramid
public static <T extends ImageGray<T>> PyramidFloat<T> scaleSpacePyramid( double scaleSpace[], Class<T> imageType ) { double[] sigmas = new double[ scaleSpace.length ]; sigmas[0] = scaleSpace[0]; for( int i = 1; i < scaleSpace.length; i++ ) { // the desired amount of blur double c = scaleSpace[i]; // the effective amount of blur applied to the last level double b = scaleSpace[i-1]; // the amount of additional blur which is needed sigmas[i] = Math.sqrt(c*c-b*b); // take in account the change in image scale sigmas[i] /= scaleSpace[i-1]; } return floatGaussian(scaleSpace,sigmas,imageType); }
java
public static <T extends ImageGray<T>> PyramidFloat<T> scaleSpacePyramid( double scaleSpace[], Class<T> imageType ) { double[] sigmas = new double[ scaleSpace.length ]; sigmas[0] = scaleSpace[0]; for( int i = 1; i < scaleSpace.length; i++ ) { // the desired amount of blur double c = scaleSpace[i]; // the effective amount of blur applied to the last level double b = scaleSpace[i-1]; // the amount of additional blur which is needed sigmas[i] = Math.sqrt(c*c-b*b); // take in account the change in image scale sigmas[i] /= scaleSpace[i-1]; } return floatGaussian(scaleSpace,sigmas,imageType); }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ">", "PyramidFloat", "<", "T", ">", "scaleSpacePyramid", "(", "double", "scaleSpace", "[", "]", ",", "Class", "<", "T", ">", "imageType", ")", "{", "double", "[", "]", "sigmas", "=", ...
Constructs an image pyramid which is designed to mimic a {@link boofcv.struct.gss.GaussianScaleSpace}. Each layer in the pyramid should have the equivalent amount of blur that a space-space constructed with the same parameters would have. @param scaleSpace The scale of each layer and the desired amount of blur relative to the original image @param imageType Type of image @return PyramidFloat
[ "Constructs", "an", "image", "pyramid", "which", "is", "designed", "to", "mimic", "a", "{", "@link", "boofcv", ".", "struct", ".", "gss", ".", "GaussianScaleSpace", "}", ".", "Each", "layer", "in", "the", "pyramid", "should", "have", "the", "equivalent", "...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/transform/pyramid/FactoryPyramid.java#L89-L107
aol/cyclops
cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Singles.java
Singles.firstSuccess
@SafeVarargs public static <T> Single<T> firstSuccess(Single<T>... fts) { return Single.fromPublisher(Future.firstSuccess(futures(fts))); }
java
@SafeVarargs public static <T> Single<T> firstSuccess(Single<T>... fts) { return Single.fromPublisher(Future.firstSuccess(futures(fts))); }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "Single", "<", "T", ">", "firstSuccess", "(", "Single", "<", "T", ">", "...", "fts", ")", "{", "return", "Single", ".", "fromPublisher", "(", "Future", ".", "firstSuccess", "(", "futures", "(", "ft...
Select the first Future to return with a successful result <pre> {@code Single<Integer> ft = Single.empty(); Single<Integer> result = Singles.firstSuccess(Single.deferred(()->1),ft); ft.complete(10); result.get() //1 } </pre> @param fts Singles to race @return First Single to return with a result
[ "Select", "the", "first", "Future", "to", "return", "with", "a", "successful", "result" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops-rxjava2-integration/src/main/java/cyclops/companion/rx2/Singles.java#L190-L194
fcrepo3/fcrepo
fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/batch/AutoModify.java
AutoModify.openLog
private static void openLog(String outFile, String rootName) throws Exception { s_rootName = rootName; s_log = new PrintStream(new FileOutputStream(outFile), true, "UTF-8"); s_log.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); s_log.println("<" + s_rootName + ">"); }
java
private static void openLog(String outFile, String rootName) throws Exception { s_rootName = rootName; s_log = new PrintStream(new FileOutputStream(outFile), true, "UTF-8"); s_log.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); s_log.println("<" + s_rootName + ">"); }
[ "private", "static", "void", "openLog", "(", "String", "outFile", ",", "String", "rootName", ")", "throws", "Exception", "{", "s_rootName", "=", "rootName", ";", "s_log", "=", "new", "PrintStream", "(", "new", "FileOutputStream", "(", "outFile", ")", ",", "t...
<p> Initializes the log file for writing. </p> @param outFile - The absolute file path of the log file. @param rootName - The name of the root element for the xml log file. @throws Exception - If any type of error occurs in trying to open the log file for writing.
[ "<p", ">", "Initializes", "the", "log", "file", "for", "writing", ".", "<", "/", "p", ">" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/batch/AutoModify.java#L348-L354
alkacon/opencms-core
src/org/opencms/configuration/CmsSystemConfiguration.java
CmsSystemConfiguration.setShellServerOptions
public void setShellServerOptions(String enabled, String portStr) { int port; try { port = Integer.parseInt(portStr); } catch (NumberFormatException e) { port = CmsRemoteShellConstants.DEFAULT_PORT; } m_shellServerOptions = new CmsRemoteShellConfiguration(Boolean.parseBoolean(enabled), port); }
java
public void setShellServerOptions(String enabled, String portStr) { int port; try { port = Integer.parseInt(portStr); } catch (NumberFormatException e) { port = CmsRemoteShellConstants.DEFAULT_PORT; } m_shellServerOptions = new CmsRemoteShellConfiguration(Boolean.parseBoolean(enabled), port); }
[ "public", "void", "setShellServerOptions", "(", "String", "enabled", ",", "String", "portStr", ")", "{", "int", "port", ";", "try", "{", "port", "=", "Integer", ".", "parseInt", "(", "portStr", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")"...
Sets the shell server options from the confriguration.<p> @param enabled the value of the 'enabled' attribute @param portStr the value of the 'port' attribute
[ "Sets", "the", "shell", "server", "options", "from", "the", "confriguration", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsSystemConfiguration.java#L2396-L2406
vvakame/JsonPullParser
jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java
JsonUtil.putFloatList
public static void putFloatList(Writer writer, List<Float> values) throws IOException { if (values == null) { writer.write("null"); } else { startArray(writer); for (int i = 0; i < values.size(); i++) { put(writer, values.get(i)); if (i != values.size() - 1) { addSeparator(writer); } } endArray(writer); } }
java
public static void putFloatList(Writer writer, List<Float> values) throws IOException { if (values == null) { writer.write("null"); } else { startArray(writer); for (int i = 0; i < values.size(); i++) { put(writer, values.get(i)); if (i != values.size() - 1) { addSeparator(writer); } } endArray(writer); } }
[ "public", "static", "void", "putFloatList", "(", "Writer", "writer", ",", "List", "<", "Float", ">", "values", ")", "throws", "IOException", "{", "if", "(", "values", "==", "null", ")", "{", "writer", ".", "write", "(", "\"null\"", ")", ";", "}", "else...
Writes the given value with the given writer. @param writer @param values @throws IOException @author vvakame
[ "Writes", "the", "given", "value", "with", "the", "given", "writer", "." ]
train
https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/util/JsonUtil.java#L452-L465
javamelody/javamelody
javamelody-core/src/main/java/net/bull/javamelody/JspWrapper.java
JspWrapper.invoke
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { final String methodName = method.getName(); // != for perf (strings interned: != is ok) if ("include" != methodName && "forward" != methodName) { // NOPMD return method.invoke(requestDispatcher, args); } boolean systemError = false; try { final String pathWithoutParameters; final int indexOf = path.indexOf('?'); if (indexOf != -1) { pathWithoutParameters = path.substring(0, indexOf); } else { pathWithoutParameters = path; } JSP_COUNTER.bindContextIncludingCpu(pathWithoutParameters); return method.invoke(requestDispatcher, args); } catch (final InvocationTargetException e) { if (e.getCause() instanceof Error) { // on catche Error pour avoir les erreurs systèmes // mais pas Exception qui sont fonctionnelles en général systemError = true; } throw e; } finally { // on enregistre la requête dans les statistiques JSP_COUNTER.addRequestForCurrentContext(systemError); } }
java
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { final String methodName = method.getName(); // != for perf (strings interned: != is ok) if ("include" != methodName && "forward" != methodName) { // NOPMD return method.invoke(requestDispatcher, args); } boolean systemError = false; try { final String pathWithoutParameters; final int indexOf = path.indexOf('?'); if (indexOf != -1) { pathWithoutParameters = path.substring(0, indexOf); } else { pathWithoutParameters = path; } JSP_COUNTER.bindContextIncludingCpu(pathWithoutParameters); return method.invoke(requestDispatcher, args); } catch (final InvocationTargetException e) { if (e.getCause() instanceof Error) { // on catche Error pour avoir les erreurs systèmes // mais pas Exception qui sont fonctionnelles en général systemError = true; } throw e; } finally { // on enregistre la requête dans les statistiques JSP_COUNTER.addRequestForCurrentContext(systemError); } }
[ "@", "Override", "public", "Object", "invoke", "(", "Object", "proxy", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "Throwable", "{", "final", "String", "methodName", "=", "method", ".", "getName", "(", ")", ";", "// != for perf...
Intercepte une exécution de méthode sur une façade. @param proxy Object @param method Method @param args Object[] @return Object @throws Throwable t
[ "Intercepte", "une", "exécution", "de", "méthode", "sur", "une", "façade", "." ]
train
https://github.com/javamelody/javamelody/blob/18ad583ddeb5dcadd797dfda295409c6983ffd71/javamelody-core/src/main/java/net/bull/javamelody/JspWrapper.java#L135-L164
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.createEventHubConsumerGroupAsync
public Observable<EventHubConsumerGroupInfoInner> createEventHubConsumerGroupAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { return createEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).map(new Func1<ServiceResponse<EventHubConsumerGroupInfoInner>, EventHubConsumerGroupInfoInner>() { @Override public EventHubConsumerGroupInfoInner call(ServiceResponse<EventHubConsumerGroupInfoInner> response) { return response.body(); } }); }
java
public Observable<EventHubConsumerGroupInfoInner> createEventHubConsumerGroupAsync(String resourceGroupName, String resourceName, String eventHubEndpointName, String name) { return createEventHubConsumerGroupWithServiceResponseAsync(resourceGroupName, resourceName, eventHubEndpointName, name).map(new Func1<ServiceResponse<EventHubConsumerGroupInfoInner>, EventHubConsumerGroupInfoInner>() { @Override public EventHubConsumerGroupInfoInner call(ServiceResponse<EventHubConsumerGroupInfoInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EventHubConsumerGroupInfoInner", ">", "createEventHubConsumerGroupAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "String", "eventHubEndpointName", ",", "String", "name", ")", "{", "return", "createEventHubConsum...
Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. Add a consumer group to an Event Hub-compatible endpoint in an IoT hub. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param eventHubEndpointName The name of the Event Hub-compatible endpoint in the IoT hub. @param name The name of the consumer group to add. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EventHubConsumerGroupInfoInner object
[ "Add", "a", "consumer", "group", "to", "an", "Event", "Hub", "-", "compatible", "endpoint", "in", "an", "IoT", "hub", ".", "Add", "a", "consumer", "group", "to", "an", "Event", "Hub", "-", "compatible", "endpoint", "in", "an", "IoT", "hub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L1905-L1912
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/config/JawrConfig.java
JawrConfig.getBooleanProperty
public boolean getBooleanProperty(String propertyName, boolean defaultValue) { return Boolean.valueOf(getProperty(propertyName, Boolean.toString(defaultValue))); }
java
public boolean getBooleanProperty(String propertyName, boolean defaultValue) { return Boolean.valueOf(getProperty(propertyName, Boolean.toString(defaultValue))); }
[ "public", "boolean", "getBooleanProperty", "(", "String", "propertyName", ",", "boolean", "defaultValue", ")", "{", "return", "Boolean", ".", "valueOf", "(", "getProperty", "(", "propertyName", ",", "Boolean", ".", "toString", "(", "defaultValue", ")", ")", ")",...
Returns the boolean property value @param propertyName the property name @param defaultValue the default value @return the boolean property value
[ "Returns", "the", "boolean", "property", "value" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/JawrConfig.java#L1330-L1333
mabe02/lanterna
src/main/java/com/googlecode/lanterna/terminal/ansi/UnixLikeTerminal.java
UnixLikeTerminal.acquire
protected void acquire() throws IOException { //Make sure to set an initial size onResized(80, 24); saveTerminalSettings(); canonicalMode(false); keyEchoEnabled(false); if(catchSpecialCharacters) { keyStrokeSignalsEnabled(false); } registerTerminalResizeListener(new Runnable() { @Override public void run() { // This will trigger a resize notification as the size will be different than before try { getTerminalSize(); } catch(IOException ignore) { // Not much to do here, we can't re-throw it } } }); Runtime.getRuntime().addShutdownHook(shutdownHook); acquired = true; }
java
protected void acquire() throws IOException { //Make sure to set an initial size onResized(80, 24); saveTerminalSettings(); canonicalMode(false); keyEchoEnabled(false); if(catchSpecialCharacters) { keyStrokeSignalsEnabled(false); } registerTerminalResizeListener(new Runnable() { @Override public void run() { // This will trigger a resize notification as the size will be different than before try { getTerminalSize(); } catch(IOException ignore) { // Not much to do here, we can't re-throw it } } }); Runtime.getRuntime().addShutdownHook(shutdownHook); acquired = true; }
[ "protected", "void", "acquire", "(", ")", "throws", "IOException", "{", "//Make sure to set an initial size", "onResized", "(", "80", ",", "24", ")", ";", "saveTerminalSettings", "(", ")", ";", "canonicalMode", "(", "false", ")", ";", "keyEchoEnabled", "(", "fal...
Effectively taking over the terminal and enabling it for Lanterna to use, by turning off echo and canonical mode, adding resize listeners and optionally trap unix signals. This should be called automatically by the constructor of any end-user class extending from {@link UnixLikeTerminal} @throws IOException If there was an I/O error
[ "Effectively", "taking", "over", "the", "terminal", "and", "enabling", "it", "for", "Lanterna", "to", "use", "by", "turning", "off", "echo", "and", "canonical", "mode", "adding", "resize", "listeners", "and", "optionally", "trap", "unix", "signals", ".", "This...
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/terminal/ansi/UnixLikeTerminal.java#L82-L106
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java
JDBCDriverService.classNotFound
private SQLException classNotFound(Object interfaceNames, Set<String> packagesSearched, String dsId, Throwable cause) { if (cause instanceof SQLException) return (SQLException) cause; // TODO need an appropriate message when sharedLib is null and classes are loaded from the application String sharedLibId = sharedLib.id(); // Determine the list of folders that should contain the JDBC driver files. Collection<String> driverJARs = getClasspath(sharedLib, false); String message = sharedLibId.startsWith("com.ibm.ws.jdbc.jdbcDriver-") ? AdapterUtil.getNLSMessage("DSRA4001.no.suitable.driver.nested", interfaceNames, dsId, driverJARs, packagesSearched) : AdapterUtil.getNLSMessage("DSRA4000.no.suitable.driver", interfaceNames, dsId, sharedLibId, driverJARs, packagesSearched); return new SQLNonTransientException(message, cause); }
java
private SQLException classNotFound(Object interfaceNames, Set<String> packagesSearched, String dsId, Throwable cause) { if (cause instanceof SQLException) return (SQLException) cause; // TODO need an appropriate message when sharedLib is null and classes are loaded from the application String sharedLibId = sharedLib.id(); // Determine the list of folders that should contain the JDBC driver files. Collection<String> driverJARs = getClasspath(sharedLib, false); String message = sharedLibId.startsWith("com.ibm.ws.jdbc.jdbcDriver-") ? AdapterUtil.getNLSMessage("DSRA4001.no.suitable.driver.nested", interfaceNames, dsId, driverJARs, packagesSearched) : AdapterUtil.getNLSMessage("DSRA4000.no.suitable.driver", interfaceNames, dsId, sharedLibId, driverJARs, packagesSearched); return new SQLNonTransientException(message, cause); }
[ "private", "SQLException", "classNotFound", "(", "Object", "interfaceNames", ",", "Set", "<", "String", ">", "packagesSearched", ",", "String", "dsId", ",", "Throwable", "cause", ")", "{", "if", "(", "cause", "instanceof", "SQLException", ")", "return", "(", "...
Returns an exception to raise when the data source class is not found. @param interfaceNames names of data source interface(s) or java.sql.Driver for which we could not find an implementation class. @param packagesSearched packages in or beneath which we have searched for data source implementation classes. @param dsId identifier for the data source that is using this JDBC driver. @param cause error that already occurred. Null if not applicable. @return an exception to raise when the data source class is not found.
[ "Returns", "an", "exception", "to", "raise", "when", "the", "data", "source", "class", "is", "not", "found", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/jdbc/internal/JDBCDriverService.java#L206-L221
rythmengine/rythmengine
src/main/java/org/rythmengine/template/TemplateBase.java
TemplateBase.__addLayoutSection
private void __addLayoutSection(String name, String section, boolean def) { Map<String, String> m = def ? layoutSections0 : layoutSections; if (m.containsKey(name)) return; m.put(name, section); }
java
private void __addLayoutSection(String name, String section, boolean def) { Map<String, String> m = def ? layoutSections0 : layoutSections; if (m.containsKey(name)) return; m.put(name, section); }
[ "private", "void", "__addLayoutSection", "(", "String", "name", ",", "String", "section", ",", "boolean", "def", ")", "{", "Map", "<", "String", ",", "String", ">", "m", "=", "def", "?", "layoutSections0", ":", "layoutSections", ";", "if", "(", "m", ".",...
Add layout section. Should not be used in user application or template @param name @param section
[ "Add", "layout", "section", ".", "Should", "not", "be", "used", "in", "user", "application", "or", "template" ]
train
https://github.com/rythmengine/rythmengine/blob/064b565f08d9da07378bf77a9dd856ea5831cc92/src/main/java/org/rythmengine/template/TemplateBase.java#L313-L317
ThreeTen/threeten-extra
src/main/java/org/threeten/extra/YearWeek.java
YearWeek.withYear
public YearWeek withYear(int weekBasedYear) { if (week == 53 && weekRange(weekBasedYear) < 53) { return YearWeek.of(weekBasedYear, 52); } return with(weekBasedYear, week); }
java
public YearWeek withYear(int weekBasedYear) { if (week == 53 && weekRange(weekBasedYear) < 53) { return YearWeek.of(weekBasedYear, 52); } return with(weekBasedYear, week); }
[ "public", "YearWeek", "withYear", "(", "int", "weekBasedYear", ")", "{", "if", "(", "week", "==", "53", "&&", "weekRange", "(", "weekBasedYear", ")", "<", "53", ")", "{", "return", "YearWeek", ".", "of", "(", "weekBasedYear", ",", "52", ")", ";", "}", ...
Returns a copy of this {@code YearWeek} with the week-based-year altered. <p> This returns a year-week with the specified week-based-year. If the week of this instance is 53 and the new year does not have 53 weeks, the week will be adjusted to be 52. <p> This instance is immutable and unaffected by this method call. @param weekBasedYear the week-based-year to set in the returned year-week @return a {@code YearWeek} based on this year-week with the requested year, not null @throws DateTimeException if the week-based-year value is invalid
[ "Returns", "a", "copy", "of", "this", "{", "@code", "YearWeek", "}", "with", "the", "week", "-", "based", "-", "year", "altered", ".", "<p", ">", "This", "returns", "a", "year", "-", "week", "with", "the", "specified", "week", "-", "based", "-", "yea...
train
https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/YearWeek.java#L498-L503
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java
LayoutRefiner.backupCoords
private void backupCoords(Point2d[] dest, IntStack stack) { for (int i = 0; i < stack.len; i++) { int v = stack.xs[i]; dest[v].x = atoms[v].getPoint2d().x; dest[v].y = atoms[v].getPoint2d().y; } }
java
private void backupCoords(Point2d[] dest, IntStack stack) { for (int i = 0; i < stack.len; i++) { int v = stack.xs[i]; dest[v].x = atoms[v].getPoint2d().x; dest[v].y = atoms[v].getPoint2d().y; } }
[ "private", "void", "backupCoords", "(", "Point2d", "[", "]", "dest", ",", "IntStack", "stack", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "stack", ".", "len", ";", "i", "++", ")", "{", "int", "v", "=", "stack", ".", "xs", "[", ...
Backup the coordinates of atoms (idxs) in the stack to the provided destination. @param dest destination @param stack atom indexes to backup
[ "Backup", "the", "coordinates", "of", "atoms", "(", "idxs", ")", "in", "the", "stack", "to", "the", "provided", "destination", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/LayoutRefiner.java#L835-L841
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/AccountsApi.java
AccountsApi.deleteCustomField
public void deleteCustomField(String accountId, String customFieldId) throws ApiException { deleteCustomField(accountId, customFieldId, null); }
java
public void deleteCustomField(String accountId, String customFieldId) throws ApiException { deleteCustomField(accountId, customFieldId, null); }
[ "public", "void", "deleteCustomField", "(", "String", "accountId", ",", "String", "customFieldId", ")", "throws", "ApiException", "{", "deleteCustomField", "(", "accountId", ",", "customFieldId", ",", "null", ")", ";", "}" ]
Delete an existing account custom field. @param accountId The external account number (int) or account ID Guid. (required) @param customFieldId (required) @return void
[ "Delete", "an", "existing", "account", "custom", "field", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L591-L593
elki-project/elki
elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/FastMultidimensionalScalingTransform.java
FastMultidimensionalScalingTransform.estimateEigenvalue
protected double estimateEigenvalue(double[][] mat, double[] in) { double de = 0., di = 0.; // Matrix multiplication: for(int d1 = 0; d1 < in.length; d1++) { final double[] row = mat[d1]; double t = 0.; for(int d2 = 0; d2 < in.length; d2++) { t += row[d2] * in[d2]; } final double s = in[d1]; de += t * s; di += s * s; } return de / di; }
java
protected double estimateEigenvalue(double[][] mat, double[] in) { double de = 0., di = 0.; // Matrix multiplication: for(int d1 = 0; d1 < in.length; d1++) { final double[] row = mat[d1]; double t = 0.; for(int d2 = 0; d2 < in.length; d2++) { t += row[d2] * in[d2]; } final double s = in[d1]; de += t * s; di += s * s; } return de / di; }
[ "protected", "double", "estimateEigenvalue", "(", "double", "[", "]", "[", "]", "mat", ",", "double", "[", "]", "in", ")", "{", "double", "de", "=", "0.", ",", "di", "=", "0.", ";", "// Matrix multiplication:", "for", "(", "int", "d1", "=", "0", ";",...
Estimate the (singed!) Eigenvalue for a particular vector. @param mat Matrix. @param in Input vector. @return Estimated eigenvalue
[ "Estimate", "the", "(", "singed!", ")", "Eigenvalue", "for", "a", "particular", "vector", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-input/src/main/java/de/lmu/ifi/dbs/elki/datasource/filter/transform/FastMultidimensionalScalingTransform.java#L281-L295
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readProjectProperties
private void readProjectProperties(Settings phoenixSettings, Storepoint storepoint) { ProjectProperties mpxjProperties = m_projectFile.getProjectProperties(); mpxjProperties.setName(phoenixSettings.getTitle()); mpxjProperties.setDefaultDurationUnits(phoenixSettings.getBaseunit()); mpxjProperties.setStatusDate(storepoint.getDataDate()); }
java
private void readProjectProperties(Settings phoenixSettings, Storepoint storepoint) { ProjectProperties mpxjProperties = m_projectFile.getProjectProperties(); mpxjProperties.setName(phoenixSettings.getTitle()); mpxjProperties.setDefaultDurationUnits(phoenixSettings.getBaseunit()); mpxjProperties.setStatusDate(storepoint.getDataDate()); }
[ "private", "void", "readProjectProperties", "(", "Settings", "phoenixSettings", ",", "Storepoint", "storepoint", ")", "{", "ProjectProperties", "mpxjProperties", "=", "m_projectFile", ".", "getProjectProperties", "(", ")", ";", "mpxjProperties", ".", "setName", "(", "...
This method extracts project properties from a Phoenix file. @param phoenixSettings Phoenix settings @param storepoint Current storepoint
[ "This", "method", "extracts", "project", "properties", "from", "a", "Phoenix", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L193-L199
census-instrumentation/opencensus-java
contrib/agent/src/main/java/io/opencensus/contrib/agent/bootstrap/TraceTrampoline.java
TraceTrampoline.endScope
public static void endScope(Closeable scope, @Nullable Throwable throwable) { traceStrategy.endScope(scope, throwable); }
java
public static void endScope(Closeable scope, @Nullable Throwable throwable) { traceStrategy.endScope(scope, throwable); }
[ "public", "static", "void", "endScope", "(", "Closeable", "scope", ",", "@", "Nullable", "Throwable", "throwable", ")", "{", "traceStrategy", ".", "endScope", "(", "scope", ",", "throwable", ")", ";", "}" ]
Ends the current span with a status derived from the given (optional) Throwable, and closes the given scope. @param scope an object representing the scope @param throwable an optional Throwable @since 0.9
[ "Ends", "the", "current", "span", "with", "a", "status", "derived", "from", "the", "given", "(", "optional", ")", "Throwable", "and", "closes", "the", "given", "scope", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/agent/src/main/java/io/opencensus/contrib/agent/bootstrap/TraceTrampoline.java#L108-L110
groves/yarrgs
src/main/java/com/bungleton/yarrgs/parser/ParseRunner.java
ParseRunner.handleOption
protected boolean handleOption (String arg, String nextArg, OptionArgument handler) throws YarrgParseException { checkState(handler != null, "No such option '" + arg + "'"); if (handler instanceof ValueOptionArgument) { checkState(nextArg != null, "'" + arg + "' requires a value following it"); parse(nextArg, handler); return true; } else if (handler instanceof HelpArgument) { throw new YarrgHelpException(_usage, _detail); } else { parse("true", handler); return false; } }
java
protected boolean handleOption (String arg, String nextArg, OptionArgument handler) throws YarrgParseException { checkState(handler != null, "No such option '" + arg + "'"); if (handler instanceof ValueOptionArgument) { checkState(nextArg != null, "'" + arg + "' requires a value following it"); parse(nextArg, handler); return true; } else if (handler instanceof HelpArgument) { throw new YarrgHelpException(_usage, _detail); } else { parse("true", handler); return false; } }
[ "protected", "boolean", "handleOption", "(", "String", "arg", ",", "String", "nextArg", ",", "OptionArgument", "handler", ")", "throws", "YarrgParseException", "{", "checkState", "(", "handler", "!=", "null", ",", "\"No such option '\"", "+", "arg", "+", "\"'\"", ...
Adds the value of arg and possibly nextArg to the parser for handler. @param nextArg - The argument following this one, or null if there isn't one. @return if nextArg was consumed by handling this option.
[ "Adds", "the", "value", "of", "arg", "and", "possibly", "nextArg", "to", "the", "parser", "for", "handler", "." ]
train
https://github.com/groves/yarrgs/blob/5599e82b63db56db3b0c2f7668d9a535cde456e1/src/main/java/com/bungleton/yarrgs/parser/ParseRunner.java#L96-L110
keenlabs/KeenClient-Java
core/src/main/java/io/keen/client/java/FileEventStore.java
FileEventStore.getFileForEvent
private File getFileForEvent(File collectionDir, Calendar timestamp) throws IOException { int counter = 0; File eventFile = getNextFileForEvent(collectionDir, timestamp, counter); while (eventFile.exists()) { eventFile = getNextFileForEvent(collectionDir, timestamp, counter); counter++; } return eventFile; }
java
private File getFileForEvent(File collectionDir, Calendar timestamp) throws IOException { int counter = 0; File eventFile = getNextFileForEvent(collectionDir, timestamp, counter); while (eventFile.exists()) { eventFile = getNextFileForEvent(collectionDir, timestamp, counter); counter++; } return eventFile; }
[ "private", "File", "getFileForEvent", "(", "File", "collectionDir", ",", "Calendar", "timestamp", ")", "throws", "IOException", "{", "int", "counter", "=", "0", ";", "File", "eventFile", "=", "getNextFileForEvent", "(", "collectionDir", ",", "timestamp", ",", "c...
Gets the file to use for a new event in the given collection with the given timestamp. If there are multiple events with identical timestamps, this method will use a counter to create a unique file name for each. @param collectionDir The cache directory for the event collection. @param timestamp The timestamp of the event. @return The file to use for the new event.
[ "Gets", "the", "file", "to", "use", "for", "a", "new", "event", "in", "the", "given", "collection", "with", "the", "given", "timestamp", ".", "If", "there", "are", "multiple", "events", "with", "identical", "timestamps", "this", "method", "will", "use", "a...
train
https://github.com/keenlabs/KeenClient-Java/blob/2ea021547b5338257c951a2596bd49749038d018/core/src/main/java/io/keen/client/java/FileEventStore.java#L318-L326
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/SegmentManager.java
SegmentManager.replaceSegments
public synchronized void replaceSegments(Collection<Segment> segments, Segment segment) { // Update the segment descriptor and lock the segment. segment.descriptor().update(System.currentTimeMillis()); segment.descriptor().lock(); // Iterate through old segments and remove them from the segments list. for (Segment oldSegment : segments) { if (!this.segments.containsKey(oldSegment.index())) { throw new IllegalArgumentException("unknown segment at index: " + oldSegment.index()); } this.segments.remove(oldSegment.index()); } // Put the new segment in the segments list. this.segments.put(segment.index(), segment); resetCurrentSegment(); }
java
public synchronized void replaceSegments(Collection<Segment> segments, Segment segment) { // Update the segment descriptor and lock the segment. segment.descriptor().update(System.currentTimeMillis()); segment.descriptor().lock(); // Iterate through old segments and remove them from the segments list. for (Segment oldSegment : segments) { if (!this.segments.containsKey(oldSegment.index())) { throw new IllegalArgumentException("unknown segment at index: " + oldSegment.index()); } this.segments.remove(oldSegment.index()); } // Put the new segment in the segments list. this.segments.put(segment.index(), segment); resetCurrentSegment(); }
[ "public", "synchronized", "void", "replaceSegments", "(", "Collection", "<", "Segment", ">", "segments", ",", "Segment", "segment", ")", "{", "// Update the segment descriptor and lock the segment.", "segment", ".", "descriptor", "(", ")", ".", "update", "(", "System"...
Inserts a segment. @param segment The segment to insert. @throws IllegalStateException if the segment is unknown
[ "Inserts", "a", "segment", "." ]
train
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/SegmentManager.java#L264-L281
opendatatrentino/s-match
src/main/java/it/unitn/disi/smatch/matchers/element/gloss/BasicGlossMatcher.java
BasicGlossMatcher.getExtendedGloss
public String getExtendedGloss(ISense original, int intSource, char Rel) throws LinguisticOracleException { List<ISense> children = new ArrayList<ISense>(); StringBuilder result = new StringBuilder(); if (Rel == IMappingElement.LESS_GENERAL) { children = original.getChildren(intSource); } else if (Rel == IMappingElement.MORE_GENERAL) { children = original.getParents(intSource); } for (ISense ISense : children) { String gloss = ISense.getGloss(); result.append(gloss).append("."); } return result.toString(); }
java
public String getExtendedGloss(ISense original, int intSource, char Rel) throws LinguisticOracleException { List<ISense> children = new ArrayList<ISense>(); StringBuilder result = new StringBuilder(); if (Rel == IMappingElement.LESS_GENERAL) { children = original.getChildren(intSource); } else if (Rel == IMappingElement.MORE_GENERAL) { children = original.getParents(intSource); } for (ISense ISense : children) { String gloss = ISense.getGloss(); result.append(gloss).append("."); } return result.toString(); }
[ "public", "String", "getExtendedGloss", "(", "ISense", "original", ",", "int", "intSource", ",", "char", "Rel", ")", "throws", "LinguisticOracleException", "{", "List", "<", "ISense", ">", "children", "=", "new", "ArrayList", "<", "ISense", ">", "(", ")", ";...
Gets extended gloss i.e. the gloss of parents or children. <br> The direction and depth is according to requirement. @param original the original gloss of input string @param intSource how much depth the gloss should be taken @param Rel for less than relation get child gloss and vice versa @return the extended gloss @throws LinguisticOracleException LinguisticOracleException
[ "Gets", "extended", "gloss", "i", ".", "e", ".", "the", "gloss", "of", "parents", "or", "children", ".", "<br", ">", "The", "direction", "and", "depth", "is", "according", "to", "requirement", "." ]
train
https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/gloss/BasicGlossMatcher.java#L194-L207
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java
CmsGalleryControllerHandler.onReceiveVfsPreloadData
public void onReceiveVfsPreloadData(CmsVfsEntryBean vfsPreloadData, Set<String> folders) { CmsVfsTab vfsTab = m_galleryDialog.getVfsTab(); if (vfsTab != null) { vfsTab.onReceiveVfsPreloadData(vfsPreloadData); if (folders != null) { vfsTab.checkFolders(folders); } } }
java
public void onReceiveVfsPreloadData(CmsVfsEntryBean vfsPreloadData, Set<String> folders) { CmsVfsTab vfsTab = m_galleryDialog.getVfsTab(); if (vfsTab != null) { vfsTab.onReceiveVfsPreloadData(vfsPreloadData); if (folders != null) { vfsTab.checkFolders(folders); } } }
[ "public", "void", "onReceiveVfsPreloadData", "(", "CmsVfsEntryBean", "vfsPreloadData", ",", "Set", "<", "String", ">", "folders", ")", "{", "CmsVfsTab", "vfsTab", "=", "m_galleryDialog", ".", "getVfsTab", "(", ")", ";", "if", "(", "vfsTab", "!=", "null", ")", ...
This method is called when preloaded VFS tree state data is loaded.<p> @param vfsPreloadData the preload data @param folders the set of selected folders
[ "This", "method", "is", "called", "when", "preloaded", "VFS", "tree", "state", "data", "is", "loaded", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/CmsGalleryControllerHandler.java#L318-L327
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/data/AnyValueMap.java
AnyValueMap.getAsArrayWithDefault
public AnyValueArray getAsArrayWithDefault(String key, AnyValueArray defaultValue) { AnyValueArray result = getAsNullableArray(key); return result != null ? result : defaultValue; }
java
public AnyValueArray getAsArrayWithDefault(String key, AnyValueArray defaultValue) { AnyValueArray result = getAsNullableArray(key); return result != null ? result : defaultValue; }
[ "public", "AnyValueArray", "getAsArrayWithDefault", "(", "String", "key", ",", "AnyValueArray", "defaultValue", ")", "{", "AnyValueArray", "result", "=", "getAsNullableArray", "(", "key", ")", ";", "return", "result", "!=", "null", "?", "result", ":", "defaultValu...
Converts map element into an AnyValueArray or returns default value if conversion is not possible. @param key a key of element to get. @param defaultValue the default value @return AnyValueArray value of the element or default value if conversion is not supported. @see AnyValueArray @see #getAsNullableArray(String)
[ "Converts", "map", "element", "into", "an", "AnyValueArray", "or", "returns", "default", "value", "if", "conversion", "is", "not", "possible", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/data/AnyValueMap.java#L560-L563
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/Assert.java
Assert.holdsLock
public static void holdsLock(Object lock, String message, Object... arguments) { holdsLock(lock, new IllegalMonitorStateException(format(message, arguments))); }
java
public static void holdsLock(Object lock, String message, Object... arguments) { holdsLock(lock, new IllegalMonitorStateException(format(message, arguments))); }
[ "public", "static", "void", "holdsLock", "(", "Object", "lock", ",", "String", "message", ",", "Object", "...", "arguments", ")", "{", "holdsLock", "(", "lock", ",", "new", "IllegalMonitorStateException", "(", "format", "(", "message", ",", "arguments", ")", ...
Asserts that the {@link Thread#currentThread() current Thread} holds the specified {@link Object lock}. The assertion holds if and only if the {@link Object lock} is not {@literal null} and the {@link Thread#currentThread() current Thread} holds the given {@link Object lock}. @param lock {@link Object} used as the lock, monitor or mutex in the synchronization. @param message {@link String} containing the message used in the {@link IllegalMonitorStateException} thrown if the assertion fails. @param arguments array of {@link Object arguments} used as placeholder values when formatting the {@link String message}. @throws java.lang.IllegalMonitorStateException if the {@link Thread#currentThread() current Thread} does not hold the {@link Object lock} or the {@link Object lock} is {@literal null}. @see #holdsLock(Object, RuntimeException) @see java.lang.Thread#holdsLock(Object)
[ "Asserts", "that", "the", "{", "@link", "Thread#currentThread", "()", "current", "Thread", "}", "holds", "the", "specified", "{", "@link", "Object", "lock", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/Assert.java#L449-L451
liferay/com-liferay-commerce
commerce-currency-api/src/main/java/com/liferay/commerce/currency/model/CommerceCurrencyWrapper.java
CommerceCurrencyWrapper.getFormatPattern
@Override public String getFormatPattern(String languageId, boolean useDefault) { return _commerceCurrency.getFormatPattern(languageId, useDefault); }
java
@Override public String getFormatPattern(String languageId, boolean useDefault) { return _commerceCurrency.getFormatPattern(languageId, useDefault); }
[ "@", "Override", "public", "String", "getFormatPattern", "(", "String", "languageId", ",", "boolean", "useDefault", ")", "{", "return", "_commerceCurrency", ".", "getFormatPattern", "(", "languageId", ",", "useDefault", ")", ";", "}" ]
Returns the localized format pattern of this commerce currency in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized format pattern of this commerce currency
[ "Returns", "the", "localized", "format", "pattern", "of", "this", "commerce", "currency", "in", "the", "language", "optionally", "using", "the", "default", "language", "if", "no", "localization", "exists", "for", "the", "requested", "language", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-api/src/main/java/com/liferay/commerce/currency/model/CommerceCurrencyWrapper.java#L331-L334
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/util/UriResourcePathUtils.java
UriResourcePathUtils.updateUriHost
public static URI updateUriHost(URI uri, String newHostPrefix) { try { return new URI(uri.getScheme(), uri.getUserInfo(), newHostPrefix + uri.getHost(), uri.getPort(), uri.getPath(), uri.getQuery(), uri.getFragment()); } catch (URISyntaxException e) { throw new RuntimeException(e); } }
java
public static URI updateUriHost(URI uri, String newHostPrefix) { try { return new URI(uri.getScheme(), uri.getUserInfo(), newHostPrefix + uri.getHost(), uri.getPort(), uri.getPath(), uri.getQuery(), uri.getFragment()); } catch (URISyntaxException e) { throw new RuntimeException(e); } }
[ "public", "static", "URI", "updateUriHost", "(", "URI", "uri", ",", "String", "newHostPrefix", ")", "{", "try", "{", "return", "new", "URI", "(", "uri", ".", "getScheme", "(", ")", ",", "uri", ".", "getUserInfo", "(", ")", ",", "newHostPrefix", "+", "u...
Creates a new {@link URI} from the given URI by replacing the host value. @param uri Original URI @param newHostPrefix New host for the uri
[ "Creates", "a", "new", "{" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/util/UriResourcePathUtils.java#L60-L67
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201902/premiumrateservice/GetAllPremiumRates.java
GetAllPremiumRates.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the PremiumRateService. PremiumRateServiceInterface premiumRateService = adManagerServices.get(session, PremiumRateServiceInterface.class); // Create a statement to get all premium rates. StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Default for total result set size. int totalResultSetSize = 0; do { // Get premium rates by statement. PremiumRatePage page = premiumRateService.getPremiumRatesByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (PremiumRate premiumRate : page.getResults()) { System.out.printf( "%d) Premium rate with ID %d of type '%s' assigned to rate card with ID %d " + "was found.%n", i++, premiumRate.getId(), premiumRate.getPremiumFeature().getClass().getSimpleName(), premiumRate.getRateCardId()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the PremiumRateService. PremiumRateServiceInterface premiumRateService = adManagerServices.get(session, PremiumRateServiceInterface.class); // Create a statement to get all premium rates. StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Default for total result set size. int totalResultSetSize = 0; do { // Get premium rates by statement. PremiumRatePage page = premiumRateService.getPremiumRatesByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (PremiumRate premiumRate : page.getResults()) { System.out.printf( "%d) Premium rate with ID %d of type '%s' assigned to rate card with ID %d " + "was found.%n", i++, premiumRate.getId(), premiumRate.getPremiumFeature().getClass().getSimpleName(), premiumRate.getRateCardId()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "// Get the PremiumRateService.", "PremiumRateServiceInterface", "premiumRateService", "=", "adManagerServices", "...
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/premiumrateservice/GetAllPremiumRates.java#L51-L87
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/basic/servicegroup_stats.java
servicegroup_stats.get
public static servicegroup_stats get(nitro_service service, String servicegroupname) throws Exception{ servicegroup_stats obj = new servicegroup_stats(); obj.set_servicegroupname(servicegroupname); servicegroup_stats response = (servicegroup_stats) obj.stat_resource(service); return response; }
java
public static servicegroup_stats get(nitro_service service, String servicegroupname) throws Exception{ servicegroup_stats obj = new servicegroup_stats(); obj.set_servicegroupname(servicegroupname); servicegroup_stats response = (servicegroup_stats) obj.stat_resource(service); return response; }
[ "public", "static", "servicegroup_stats", "get", "(", "nitro_service", "service", ",", "String", "servicegroupname", ")", "throws", "Exception", "{", "servicegroup_stats", "obj", "=", "new", "servicegroup_stats", "(", ")", ";", "obj", ".", "set_servicegroupname", "(...
Use this API to fetch statistics of servicegroup_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "servicegroup_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/basic/servicegroup_stats.java#L149-L154
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/FloatField.java
FloatField.getSQLFromField
public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException { if (this.isNull()) { if ((this.isNullable()) && (iType != DBConstants.SQL_SELECT_TYPE)) statement.setNull(iParamColumn, Types.FLOAT); else statement.setFloat(iParamColumn, Float.NaN); } else { if (DBConstants.FALSE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.FLOAT_XFER_SUPPORTED))) // HACK for Access super.getSQLFromField(statement, iType, iParamColumn); else statement.setFloat(iParamColumn, (float)this.getValue()); } }
java
public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException { if (this.isNull()) { if ((this.isNullable()) && (iType != DBConstants.SQL_SELECT_TYPE)) statement.setNull(iParamColumn, Types.FLOAT); else statement.setFloat(iParamColumn, Float.NaN); } else { if (DBConstants.FALSE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.FLOAT_XFER_SUPPORTED))) // HACK for Access super.getSQLFromField(statement, iType, iParamColumn); else statement.setFloat(iParamColumn, (float)this.getValue()); } }
[ "public", "void", "getSQLFromField", "(", "PreparedStatement", "statement", ",", "int", "iType", ",", "int", "iParamColumn", ")", "throws", "SQLException", "{", "if", "(", "this", ".", "isNull", "(", ")", ")", "{", "if", "(", "(", "this", ".", "isNullable"...
Move the physical binary data to this SQL parameter row. @param statement The SQL prepare statement. @param iType the type of SQL statement. @param iParamColumn The column in the prepared statement to set the data. @exception SQLException From SQL calls.
[ "Move", "the", "physical", "binary", "data", "to", "this", "SQL", "parameter", "row", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/FloatField.java#L147-L163
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/privatejgoodies/forms/layout/FormSpec.java
FormSpec.parseSize
private Size parseSize(String token) { if (token.startsWith("[") && token.endsWith("]")) { return parseBoundedSize(token); } if (token.startsWith("max(") && token.endsWith(")")) { return parseOldBoundedSize(token, false); } if (token.startsWith("min(") && token.endsWith(")")) { return parseOldBoundedSize(token, true); } return parseAtomicSize(token); }
java
private Size parseSize(String token) { if (token.startsWith("[") && token.endsWith("]")) { return parseBoundedSize(token); } if (token.startsWith("max(") && token.endsWith(")")) { return parseOldBoundedSize(token, false); } if (token.startsWith("min(") && token.endsWith(")")) { return parseOldBoundedSize(token, true); } return parseAtomicSize(token); }
[ "private", "Size", "parseSize", "(", "String", "token", ")", "{", "if", "(", "token", ".", "startsWith", "(", "\"[\"", ")", "&&", "token", ".", "endsWith", "(", "\"]\"", ")", ")", "{", "return", "parseBoundedSize", "(", "token", ")", ";", "}", "if", ...
Parses an encoded size spec and returns the size. @param token a token that represents a size, either bounded or plain @return the decoded Size
[ "Parses", "an", "encoded", "size", "spec", "and", "returns", "the", "size", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormSpec.java#L267-L278
OpenLiberty/open-liberty
dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java
ShutdownHook.getPID
private String getPID(String dir, String serverName) { String pid = null; if (platformType == SelfExtractUtils.PlatformType_CYGWIN) { String pidFile = dir + File.separator + "wlp" + File.separator + "usr" + File.separator + "servers" + File.separator + ".pid" + File.separator + serverName + ".pid"; try { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(pidFile), "UTF-8")); try { return br.readLine(); } finally { br.close(); } } catch (IOException e) { pid = null; } if (pid == null) { Object[] substitution = { dir }; System.out.println(MessageFormat.format(resourceBundle.getString("UNABLE_TO_FIND_PID"), substitution)); } } return pid; }
java
private String getPID(String dir, String serverName) { String pid = null; if (platformType == SelfExtractUtils.PlatformType_CYGWIN) { String pidFile = dir + File.separator + "wlp" + File.separator + "usr" + File.separator + "servers" + File.separator + ".pid" + File.separator + serverName + ".pid"; try { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(pidFile), "UTF-8")); try { return br.readLine(); } finally { br.close(); } } catch (IOException e) { pid = null; } if (pid == null) { Object[] substitution = { dir }; System.out.println(MessageFormat.format(resourceBundle.getString("UNABLE_TO_FIND_PID"), substitution)); } } return pid; }
[ "private", "String", "getPID", "(", "String", "dir", ",", "String", "serverName", ")", "{", "String", "pid", "=", "null", ";", "if", "(", "platformType", "==", "SelfExtractUtils", ".", "PlatformType_CYGWIN", ")", "{", "String", "pidFile", "=", "dir", "+", ...
Return PID from server directory for cygwin environment only. @return PID string or null if not cygwin environment or exception occurs @throws IOException, FileNotFoundException if anything goes wrong
[ "Return", "PID", "from", "server", "directory", "for", "cygwin", "environment", "only", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/wlp.lib.extract/src/wlp/lib/extract/ShutdownHook.java#L72-L95
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/GGradientToEdgeFeatures.java
GGradientToEdgeFeatures.nonMaxSuppressionCrude4
static public <D extends ImageGray<D>> void nonMaxSuppressionCrude4(GrayF32 intensity , D derivX , D derivY , GrayF32 output ) { if( derivX instanceof GrayF32) { GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayF32) derivX, (GrayF32) derivY,output); } else if( derivX instanceof GrayS16) { GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayS16) derivX, (GrayS16) derivY,output); } else if( derivX instanceof GrayS32) { GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayS32) derivX, (GrayS32) derivY,output); } else { throw new IllegalArgumentException("Unknown input type"); } }
java
static public <D extends ImageGray<D>> void nonMaxSuppressionCrude4(GrayF32 intensity , D derivX , D derivY , GrayF32 output ) { if( derivX instanceof GrayF32) { GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayF32) derivX, (GrayF32) derivY,output); } else if( derivX instanceof GrayS16) { GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayS16) derivX, (GrayS16) derivY,output); } else if( derivX instanceof GrayS32) { GradientToEdgeFeatures.nonMaxSuppressionCrude4(intensity, (GrayS32) derivX, (GrayS32) derivY,output); } else { throw new IllegalArgumentException("Unknown input type"); } }
[ "static", "public", "<", "D", "extends", "ImageGray", "<", "D", ">", ">", "void", "nonMaxSuppressionCrude4", "(", "GrayF32", "intensity", ",", "D", "derivX", ",", "D", "derivY", ",", "GrayF32", "output", ")", "{", "if", "(", "derivX", "instanceof", "GrayF3...
<p> Sets edge intensities to zero if the pixel has an intensity which is less than any of the two adjacent pixels. Pixel adjacency is determined based upon the sign of the image gradient. Less precise than other methods, but faster. </p> @param intensity Edge intensities. Not modified. @param derivX Image derivative along x-axis. @param derivY Image derivative along y-axis. @param output Filtered intensity. Modified.
[ "<p", ">", "Sets", "edge", "intensities", "to", "zero", "if", "the", "pixel", "has", "an", "intensity", "which", "is", "less", "than", "any", "of", "the", "two", "adjacent", "pixels", ".", "Pixel", "adjacency", "is", "determined", "based", "upon", "the", ...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/edge/GGradientToEdgeFeatures.java#L130-L142
twitter/hraven
hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserBase.java
JobHistoryFileParserBase.getHadoopVersionPut
public Put getHadoopVersionPut(HadoopVersion historyFileVersion, byte[] jobKeyBytes) { Put pVersion = new Put(jobKeyBytes); byte[] valueBytes = null; valueBytes = Bytes.toBytes(historyFileVersion.toString()); byte[] qualifier = Bytes.toBytes(JobHistoryKeys.hadoopversion.toString().toLowerCase()); pVersion.add(Constants.INFO_FAM_BYTES, qualifier, valueBytes); return pVersion; }
java
public Put getHadoopVersionPut(HadoopVersion historyFileVersion, byte[] jobKeyBytes) { Put pVersion = new Put(jobKeyBytes); byte[] valueBytes = null; valueBytes = Bytes.toBytes(historyFileVersion.toString()); byte[] qualifier = Bytes.toBytes(JobHistoryKeys.hadoopversion.toString().toLowerCase()); pVersion.add(Constants.INFO_FAM_BYTES, qualifier, valueBytes); return pVersion; }
[ "public", "Put", "getHadoopVersionPut", "(", "HadoopVersion", "historyFileVersion", ",", "byte", "[", "]", "jobKeyBytes", ")", "{", "Put", "pVersion", "=", "new", "Put", "(", "jobKeyBytes", ")", ";", "byte", "[", "]", "valueBytes", "=", "null", ";", "valueBy...
generates a put that sets the hadoop version for a record @param historyFileVersion @param jobKeyBytes @return Put
[ "generates", "a", "put", "that", "sets", "the", "hadoop", "version", "for", "a", "record" ]
train
https://github.com/twitter/hraven/blob/e35996b6e2f016bcd18db0bad320be7c93d95208/hraven-etl/src/main/java/com/twitter/hraven/etl/JobHistoryFileParserBase.java#L57-L64
carewebframework/carewebframework-vista
org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigList.java
ESigList.add
public ESigItem add(IESigType eSigType, String id, String text, String subGroupName, SignState signState, String data, String session) { ESigItem item = new ESigItem(eSigType, id); item.setText(text); item.setSubGroupName(subGroupName); item.setSignState(signState); item.setData(data); item.setSession(session); return add(item); }
java
public ESigItem add(IESigType eSigType, String id, String text, String subGroupName, SignState signState, String data, String session) { ESigItem item = new ESigItem(eSigType, id); item.setText(text); item.setSubGroupName(subGroupName); item.setSignState(signState); item.setData(data); item.setSession(session); return add(item); }
[ "public", "ESigItem", "add", "(", "IESigType", "eSigType", ",", "String", "id", ",", "String", "text", ",", "String", "subGroupName", ",", "SignState", "signState", ",", "String", "data", ",", "String", "session", ")", "{", "ESigItem", "item", "=", "new", ...
Ads a new sig item to the list, given the required elements. @param eSigType The esignature type. @param id The item id. @param text The description text. @param subGroupName The sub group name. @param signState The signature state. @param data The data object. @param session The session id. @return New sig item.
[ "Ads", "a", "new", "sig", "item", "to", "the", "list", "given", "the", "required", "elements", "." ]
train
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.api-parent/org.carewebframework.vista.api.esig/src/main/java/org/carewebframework/vista/esig/ESigList.java#L171-L180
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.write
public static void write(Image image, String imageType, OutputStream out) throws IORuntimeException { write(image, imageType, getImageOutputStream(out)); }
java
public static void write(Image image, String imageType, OutputStream out) throws IORuntimeException { write(image, imageType, getImageOutputStream(out)); }
[ "public", "static", "void", "write", "(", "Image", "image", ",", "String", "imageType", ",", "OutputStream", "out", ")", "throws", "IORuntimeException", "{", "write", "(", "image", ",", "imageType", ",", "getImageOutputStream", "(", "out", ")", ")", ";", "}"...
写出图像 @param image {@link Image} @param imageType 图片类型(图片扩展名) @param out 写出到的目标流 @throws IORuntimeException IO异常 @since 3.1.2
[ "写出图像" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1402-L1404
google/closure-compiler
src/com/google/javascript/jscomp/NodeUtil.java
NodeUtil.getEnclosingType
public static Node getEnclosingType(Node n, final Token type) { return getEnclosingNode( n, new Predicate<Node>() { @Override public boolean apply(Node n) { return n.getToken() == type; } }); }
java
public static Node getEnclosingType(Node n, final Token type) { return getEnclosingNode( n, new Predicate<Node>() { @Override public boolean apply(Node n) { return n.getToken() == type; } }); }
[ "public", "static", "Node", "getEnclosingType", "(", "Node", "n", ",", "final", "Token", "type", ")", "{", "return", "getEnclosingNode", "(", "n", ",", "new", "Predicate", "<", "Node", ">", "(", ")", "{", "@", "Override", "public", "boolean", "apply", "(...
Gets the closest ancestor to the given node of the provided type.
[ "Gets", "the", "closest", "ancestor", "to", "the", "given", "node", "of", "the", "provided", "type", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L2230-L2239
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildDeprecatedMethodInfo
public void buildDeprecatedMethodInfo(XMLNode node, Content methodsContentTree) { methodWriter.addDeprecatedMemberInfo((ExecutableElement)currentMember, methodsContentTree); }
java
public void buildDeprecatedMethodInfo(XMLNode node, Content methodsContentTree) { methodWriter.addDeprecatedMemberInfo((ExecutableElement)currentMember, methodsContentTree); }
[ "public", "void", "buildDeprecatedMethodInfo", "(", "XMLNode", "node", ",", "Content", "methodsContentTree", ")", "{", "methodWriter", ".", "addDeprecatedMemberInfo", "(", "(", "ExecutableElement", ")", "currentMember", ",", "methodsContentTree", ")", ";", "}" ]
Build the deprecated method description. @param node the XML element that specifies which components to document @param methodsContentTree content tree to which the documentation will be added
[ "Build", "the", "deprecated", "method", "description", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/SerializedFormBuilder.java#L332-L334
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/AccountsApi.java
AccountsApi.createCustomField
public CustomFields createCustomField(String accountId, CustomField customField) throws ApiException { return createCustomField(accountId, customField, null); }
java
public CustomFields createCustomField(String accountId, CustomField customField) throws ApiException { return createCustomField(accountId, customField, null); }
[ "public", "CustomFields", "createCustomField", "(", "String", "accountId", ",", "CustomField", "customField", ")", "throws", "ApiException", "{", "return", "createCustomField", "(", "accountId", ",", "customField", ",", "null", ")", ";", "}" ]
Creates an acount custom field. @param accountId The external account number (int) or account ID Guid. (required) @param customField (optional) @return CustomFields
[ "Creates", "an", "acount", "custom", "field", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L199-L201
EdwardRaff/JSAT
JSAT/src/jsat/math/Complex.java
Complex.cDiv
public static void cDiv(double a, double b, double c, double d, double[] results) { /** * Douglas M. Priest. Efficient scaling for complex division. ACM Trans. * Math. Softw., 30(4):389–401, 2004 */ long aa, bb, cc, dd, ss; double t; int ha, hb, hc, hd, hz, hw, hs; /*extract high-order 32 bits to estimate |z| and |w| */ aa = Double.doubleToRawLongBits(a); bb = Double.doubleToRawLongBits(b); ha = (int) ((aa >> 32) & 0x7fffffff); hb = (int) ((bb >> 32) & 0x7fffffff); hz = (ha > hb)? ha : hb; cc = Double.doubleToRawLongBits(c); dd = Double.doubleToRawLongBits(d); hc = (int) ((cc >> 32) & 0x7fffffff); hd = (int) ((dd >> 32) & 0x7fffffff); hw = (hc > hd)? hc : hd; /* compute the scale factor */ if (hz < 0x07200000 && hw >= 0x32800000 && hw < 0x47100000) { /* |z| < 2^-909 and 2^-215 <= |w| < 2^114 */ hs = (((0x47100000 - hw) >> 1) & 0xfff00000) + 0x3ff00000; } else hs = (((hw >> 2) - hw) + 0x6fd7ffff) & 0xfff00000; ss = ((long) hs) << 32; /* scale c and d, and compute the quotient */ double ssd = Double.longBitsToDouble(ss); c *= ssd; d *= ssd; t = 1.0 / (c * c + d * d); c *= ssd; d *= ssd; results[0] = (a * c + b * d) * t; results[1] = (b * c - a * d) * t; }
java
public static void cDiv(double a, double b, double c, double d, double[] results) { /** * Douglas M. Priest. Efficient scaling for complex division. ACM Trans. * Math. Softw., 30(4):389–401, 2004 */ long aa, bb, cc, dd, ss; double t; int ha, hb, hc, hd, hz, hw, hs; /*extract high-order 32 bits to estimate |z| and |w| */ aa = Double.doubleToRawLongBits(a); bb = Double.doubleToRawLongBits(b); ha = (int) ((aa >> 32) & 0x7fffffff); hb = (int) ((bb >> 32) & 0x7fffffff); hz = (ha > hb)? ha : hb; cc = Double.doubleToRawLongBits(c); dd = Double.doubleToRawLongBits(d); hc = (int) ((cc >> 32) & 0x7fffffff); hd = (int) ((dd >> 32) & 0x7fffffff); hw = (hc > hd)? hc : hd; /* compute the scale factor */ if (hz < 0x07200000 && hw >= 0x32800000 && hw < 0x47100000) { /* |z| < 2^-909 and 2^-215 <= |w| < 2^114 */ hs = (((0x47100000 - hw) >> 1) & 0xfff00000) + 0x3ff00000; } else hs = (((hw >> 2) - hw) + 0x6fd7ffff) & 0xfff00000; ss = ((long) hs) << 32; /* scale c and d, and compute the quotient */ double ssd = Double.longBitsToDouble(ss); c *= ssd; d *= ssd; t = 1.0 / (c * c + d * d); c *= ssd; d *= ssd; results[0] = (a * c + b * d) * t; results[1] = (b * c - a * d) * t; }
[ "public", "static", "void", "cDiv", "(", "double", "a", ",", "double", "b", ",", "double", "c", ",", "double", "d", ",", "double", "[", "]", "results", ")", "{", "/**\n * Douglas M. Priest. Efficient scaling for complex division. ACM Trans. \n * Math. So...
Performs a complex division operation. <br> The standard complex division performs a set of operations that is suseptible to both overflow and underflow. This method is more numerically stable while still being relatively fast to execute. @param a the real part of the first number @param b the imaginary part of the first number @param c the real part of the second number @param d the imaginary part of the second number @param results an array to store the real and imaginary results in. First index is the real, 2nd is the imaginary.
[ "Performs", "a", "complex", "division", "operation", ".", "<br", ">", "The", "standard", "complex", "division", "performs", "a", "set", "of", "operations", "that", "is", "suseptible", "to", "both", "overflow", "and", "underflow", ".", "This", "method", "is", ...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/math/Complex.java#L198-L242
symphonyoss/messageml-utils
src/main/java/org/symphonyoss/symphony/entityjson/EntityJsonParser.java
EntityJsonParser.parseStructuredObject
public StructuredObject parseStructuredObject(URL instanceUrl) throws SchemaValidationException, InvalidInstanceException { try { return new StructuredObject(validate(STRUCTURED_OBJECT_SCHEMA_URL, instanceUrl)); } catch (NoSchemaException | InvalidSchemaException e) { // In theory this cannot happen throw new RuntimeException(e); } }
java
public StructuredObject parseStructuredObject(URL instanceUrl) throws SchemaValidationException, InvalidInstanceException { try { return new StructuredObject(validate(STRUCTURED_OBJECT_SCHEMA_URL, instanceUrl)); } catch (NoSchemaException | InvalidSchemaException e) { // In theory this cannot happen throw new RuntimeException(e); } }
[ "public", "StructuredObject", "parseStructuredObject", "(", "URL", "instanceUrl", ")", "throws", "SchemaValidationException", ",", "InvalidInstanceException", "{", "try", "{", "return", "new", "StructuredObject", "(", "validate", "(", "STRUCTURED_OBJECT_SCHEMA_URL", ",", ...
Parse a single StructuredObject instance from the given URL. Callers may prefer to catch EntityJSONException and treat all failures in the same way. @param instanceUrl A URL pointing to the JSON representation of a StructuredObject instance. @return A StructuredObject instance. @throws SchemaValidationException If the given instance does not meet the general EntityJSON schema. @throws InvalidInstanceException If the given instance is structurally invalid.
[ "Parse", "a", "single", "StructuredObject", "instance", "from", "the", "given", "URL", "." ]
train
https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/entityjson/EntityJsonParser.java#L187-L198
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java
ParserDDL.compileCreateIndex
StatementSchema compileCreateIndex(boolean unique, boolean assumeUnique, boolean migrating) { /* disable 1 line ... StatementSchema compileCreateIndex(boolean unique) { ... disabled 1 line */ // End of VoltDB extension Table table; HsqlName indexHsqlName; read(); indexHsqlName = readNewSchemaObjectName(SchemaObject.INDEX); readThis(Tokens.ON); table = readTableName(); HsqlName tableSchema = table.getSchemaName(); indexHsqlName.setSchemaIfNull(tableSchema); indexHsqlName.parent = table.getName(); if (indexHsqlName.schema != tableSchema) { throw Error.error(ErrorCode.X_42505); } indexHsqlName.schema = table.getSchemaName(); // A VoltDB extension to support indexed expressions and the assume unique attribute java.util.List<Boolean> ascDesc = new java.util.ArrayList<Boolean>(); // A VoltDB extension to "readColumnList(table, true)" to support indexed expressions. java.util.List<Expression> indexExprs = XreadExpressions(ascDesc, migrating); OrderedHashSet set = getSimpleColumnNames(indexExprs); int[] indexColumns = null; if (set == null) { // A VoltDB extension to support indexed expressions. // Not just indexing columns. // The meaning of set and indexColumns shifts here to be // the set of unique base columns for the indexed expressions. set = getBaseColumnNames(indexExprs); } else { // Just indexing columns -- by-pass extended support for generalized index expressions. indexExprs = null; } // A VoltDB extension to support partial index Expression predicate = null; if (readIfThis(Tokens.WHERE)) { predicate = XreadBooleanValueExpression(); } indexColumns = getColumnList(set, table); String sql = getLastPart(); Object[] args = new Object[] { table, indexColumns, indexHsqlName, unique, migrating, indexExprs, assumeUnique, predicate /* disable 4 lines ... int[] indexColumns = readColumnList(table, true); String sql = getLastPart(); Object[] args = new Object[] { table, indexColumns, indexHsqlName, Boolean.valueOf(unique) ... disabled 4 lines */ // End of VoltDB extension }; return new StatementSchema(sql, StatementTypes.CREATE_INDEX, args, null, table.getName()); }
java
StatementSchema compileCreateIndex(boolean unique, boolean assumeUnique, boolean migrating) { /* disable 1 line ... StatementSchema compileCreateIndex(boolean unique) { ... disabled 1 line */ // End of VoltDB extension Table table; HsqlName indexHsqlName; read(); indexHsqlName = readNewSchemaObjectName(SchemaObject.INDEX); readThis(Tokens.ON); table = readTableName(); HsqlName tableSchema = table.getSchemaName(); indexHsqlName.setSchemaIfNull(tableSchema); indexHsqlName.parent = table.getName(); if (indexHsqlName.schema != tableSchema) { throw Error.error(ErrorCode.X_42505); } indexHsqlName.schema = table.getSchemaName(); // A VoltDB extension to support indexed expressions and the assume unique attribute java.util.List<Boolean> ascDesc = new java.util.ArrayList<Boolean>(); // A VoltDB extension to "readColumnList(table, true)" to support indexed expressions. java.util.List<Expression> indexExprs = XreadExpressions(ascDesc, migrating); OrderedHashSet set = getSimpleColumnNames(indexExprs); int[] indexColumns = null; if (set == null) { // A VoltDB extension to support indexed expressions. // Not just indexing columns. // The meaning of set and indexColumns shifts here to be // the set of unique base columns for the indexed expressions. set = getBaseColumnNames(indexExprs); } else { // Just indexing columns -- by-pass extended support for generalized index expressions. indexExprs = null; } // A VoltDB extension to support partial index Expression predicate = null; if (readIfThis(Tokens.WHERE)) { predicate = XreadBooleanValueExpression(); } indexColumns = getColumnList(set, table); String sql = getLastPart(); Object[] args = new Object[] { table, indexColumns, indexHsqlName, unique, migrating, indexExprs, assumeUnique, predicate /* disable 4 lines ... int[] indexColumns = readColumnList(table, true); String sql = getLastPart(); Object[] args = new Object[] { table, indexColumns, indexHsqlName, Boolean.valueOf(unique) ... disabled 4 lines */ // End of VoltDB extension }; return new StatementSchema(sql, StatementTypes.CREATE_INDEX, args, null, table.getName()); }
[ "StatementSchema", "compileCreateIndex", "(", "boolean", "unique", ",", "boolean", "assumeUnique", ",", "boolean", "migrating", ")", "{", "/* disable 1 line ...\n StatementSchema compileCreateIndex(boolean unique) {\n ... disabled 1 line */", "// End of VoltDB extension", "Table"...
A VoltDB extension to support indexed expressions and the assume unique attribute
[ "A", "VoltDB", "extension", "to", "support", "indexed", "expressions", "and", "the", "assume", "unique", "attribute" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDDL.java#L3511-L3578
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java
DatePicker.initComponents
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents dateTextField = new JTextField(); toggleCalendarButton = new JButton(); //======== this ======== setLayout(new FormLayout( "pref:grow, [3px,pref], [26px,pref]", "fill:pref:grow")); //---- dateTextField ---- dateTextField.setMargin(new Insets(1, 3, 2, 2)); dateTextField.setBorder(new CompoundBorder( new MatteBorder(1, 1, 1, 1, new Color(122, 138, 153)), new EmptyBorder(1, 3, 2, 2))); dateTextField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { setTextFieldToValidStateIfNeeded(); } }); add(dateTextField, CC.xy(1, 1)); //---- toggleCalendarButton ---- toggleCalendarButton.setText("..."); toggleCalendarButton.setFocusPainted(false); toggleCalendarButton.setFocusable(false); toggleCalendarButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { zEventToggleCalendarButtonMousePressed(e); } }); add(toggleCalendarButton, CC.xy(3, 1)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents dateTextField = new JTextField(); toggleCalendarButton = new JButton(); //======== this ======== setLayout(new FormLayout( "pref:grow, [3px,pref], [26px,pref]", "fill:pref:grow")); //---- dateTextField ---- dateTextField.setMargin(new Insets(1, 3, 2, 2)); dateTextField.setBorder(new CompoundBorder( new MatteBorder(1, 1, 1, 1, new Color(122, 138, 153)), new EmptyBorder(1, 3, 2, 2))); dateTextField.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { setTextFieldToValidStateIfNeeded(); } }); add(dateTextField, CC.xy(1, 1)); //---- toggleCalendarButton ---- toggleCalendarButton.setText("..."); toggleCalendarButton.setFocusPainted(false); toggleCalendarButton.setFocusable(false); toggleCalendarButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { zEventToggleCalendarButtonMousePressed(e); } }); add(toggleCalendarButton, CC.xy(3, 1)); // JFormDesigner - End of component initialization //GEN-END:initComponents }
[ "private", "void", "initComponents", "(", ")", "{", "// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents", "dateTextField", "=", "new", "JTextField", "(", ")", ";", "toggleCalendarButton", "=", "new", "JButton", "(", ")", ";", "//========...
initComponents, This initializes the components of the JFormDesigner panel. This function is automatically generated by JFormDesigner from the JFD form design file, and should not be modified by hand. This function can be modified, if needed, by using JFormDesigner. Implementation notes regarding JTextField: This class uses a JTextField instead of a JFormattedTextField as its text input component, because a date-formatted JFormattedTextField stores its value as a java.util.Date (Date) object, which is not ideal for this project. Date objects represent a specific instant in time instead of a "local date" value. Date objects also require time zone calculations to convert them to a java.time.LocalDate. This class displays and stores "local dates" only, and is designed to function independently of any time zone differences. See java.time.LocalDate for details on the meaning of a LocalDate. To gain the validation functionality of a JFormattedTextField, this class implements a similar "commit" and "revert" capability as the JFormattedTextField class.
[ "initComponents", "This", "initializes", "the", "components", "of", "the", "JFormDesigner", "panel", ".", "This", "function", "is", "automatically", "generated", "by", "JFormDesigner", "from", "the", "JFD", "form", "design", "file", "and", "should", "not", "be", ...
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/DatePicker.java#L919-L954
dwdyer/watchmaker
framework/src/java/main/org/uncommons/util/concurrent/ConfigurableThreadFactory.java
ConfigurableThreadFactory.newThread
public Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable, nameGenerator.nextID()); thread.setPriority(priority); thread.setDaemon(daemon); thread.setUncaughtExceptionHandler(uncaughtExceptionHandler); return thread; }
java
public Thread newThread(Runnable runnable) { Thread thread = new Thread(runnable, nameGenerator.nextID()); thread.setPriority(priority); thread.setDaemon(daemon); thread.setUncaughtExceptionHandler(uncaughtExceptionHandler); return thread; }
[ "public", "Thread", "newThread", "(", "Runnable", "runnable", ")", "{", "Thread", "thread", "=", "new", "Thread", "(", "runnable", ",", "nameGenerator", ".", "nextID", "(", ")", ")", ";", "thread", ".", "setPriority", "(", "priority", ")", ";", "thread", ...
Creates a new thread configured according to this factory's parameters. @param runnable The runnable to be executed by the new thread. @return The created thread.
[ "Creates", "a", "new", "thread", "configured", "according", "to", "this", "factory", "s", "parameters", "." ]
train
https://github.com/dwdyer/watchmaker/blob/33d942350e6bf7d9a17b9262a4f898158530247e/framework/src/java/main/org/uncommons/util/concurrent/ConfigurableThreadFactory.java#L89-L96
fcrepo4/fcrepo4
fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java
ViewHelpers.getNumChildren
public int getNumChildren(final Graph graph, final Node subject) { LOGGER.trace("Getting number of children: s:{}, g:{}", subject, graph); return (int) asStream(listObjects(graph, subject, CONTAINS.asNode())).count(); }
java
public int getNumChildren(final Graph graph, final Node subject) { LOGGER.trace("Getting number of children: s:{}, g:{}", subject, graph); return (int) asStream(listObjects(graph, subject, CONTAINS.asNode())).count(); }
[ "public", "int", "getNumChildren", "(", "final", "Graph", "graph", ",", "final", "Node", "subject", ")", "{", "LOGGER", ".", "trace", "(", "\"Getting number of children: s:{}, g:{}\"", ",", "subject", ",", "graph", ")", ";", "return", "(", "int", ")", "asStrea...
Get the number of child resources associated with the arg 'subject' as specified by the triple found in the arg 'graph' with the predicate RdfLexicon.HAS_CHILD_COUNT. @param graph of triples @param subject for which child resources is sought @return number of child resources
[ "Get", "the", "number", "of", "child", "resources", "associated", "with", "the", "arg", "subject", "as", "specified", "by", "the", "triple", "found", "in", "the", "arg", "graph", "with", "the", "predicate", "RdfLexicon", ".", "HAS_CHILD_COUNT", "." ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-http-commons/src/main/java/org/fcrepo/http/commons/responses/ViewHelpers.java#L282-L285
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/Session.java
Session.executeCompiledStatement
private Result executeCompiledStatement(Result cmd) { Statement cs = cmd.getStatement(); if (!cs.isValid()) { long csid = cmd.getStatementID(); cs = database.compiledStatementManager.getStatement(this, csid); if (cs == null) { // invalid sql has been removed already return Result.newErrorResult(Error.error(ErrorCode.X_07502)); } } Object[] pvals = cmd.getParameterData(); return executeCompiledStatement(cs, pvals); }
java
private Result executeCompiledStatement(Result cmd) { Statement cs = cmd.getStatement(); if (!cs.isValid()) { long csid = cmd.getStatementID(); cs = database.compiledStatementManager.getStatement(this, csid); if (cs == null) { // invalid sql has been removed already return Result.newErrorResult(Error.error(ErrorCode.X_07502)); } } Object[] pvals = cmd.getParameterData(); return executeCompiledStatement(cs, pvals); }
[ "private", "Result", "executeCompiledStatement", "(", "Result", "cmd", ")", "{", "Statement", "cs", "=", "cmd", ".", "getStatement", "(", ")", ";", "if", "(", "!", "cs", ".", "isValid", "(", ")", ")", "{", "long", "csid", "=", "cmd", ".", "getStatement...
Retrieves the result of executing the prepared statement whose csid and parameter values/types are encapsulated by the cmd argument. @return the result of executing the statement
[ "Retrieves", "the", "result", "of", "executing", "the", "prepared", "statement", "whose", "csid", "and", "parameter", "values", "/", "types", "are", "encapsulated", "by", "the", "cmd", "argument", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/Session.java#L1392-L1411