repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
EdwardRaff/JSAT
JSAT/src/jsat/linear/RowColumnOps.java
RowColumnOps.divRow
public static void divRow(Matrix A, int i, int start, int to, double c) { """ Updates the values of row <tt>i</tt> in the given matrix to be A[i,:] = A[i,:] / c @param A the matrix to perform he update on @param i the row to update @param start the first index of the row to update from (inclusive) @param to the last index of the row to update (exclusive) @param c the constant to divide each element by """ for(int j = start; j < to; j++) A.set(i, j, A.get(i, j)/c); }
java
public static void divRow(Matrix A, int i, int start, int to, double c) { for(int j = start; j < to; j++) A.set(i, j, A.get(i, j)/c); }
[ "public", "static", "void", "divRow", "(", "Matrix", "A", ",", "int", "i", ",", "int", "start", ",", "int", "to", ",", "double", "c", ")", "{", "for", "(", "int", "j", "=", "start", ";", "j", "<", "to", ";", "j", "++", ")", "A", ".", "set", "(", "i", ",", "j", ",", ".", "get", "(", "i", ",", "j", ")", "/", ")", ";", "}" ]
Updates the values of row <tt>i</tt> in the given matrix to be A[i,:] = A[i,:] / c @param A the matrix to perform he update on @param i the row to update @param start the first index of the row to update from (inclusive) @param to the last index of the row to update (exclusive) @param c the constant to divide each element by
[ "Updates", "the", "values", "of", "row", "<tt", ">", "i<", "/", "tt", ">", "in", "the", "given", "matrix", "to", "be", "A", "[", "i", ":", "]", "=", "A", "[", "i", ":", "]", "/", "c" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L150-L154
alkacon/opencms-core
src/org/opencms/importexport/CmsImportVersion7.java
CmsImportVersion7.addAccountsGroupRules
protected void addAccountsGroupRules(Digester digester, String xpath) { """ Adds the XML digester rules for groups.<p> @param digester the digester to add the rules to @param xpath the base xpath for the rules """ String xp_group = xpath + N_GROUPS + "/" + N_GROUP; digester.addCallMethod(xp_group, "importGroup"); xp_group += "/"; digester.addCallMethod(xp_group + N_NAME, "setGroupName", 0); digester.addCallMethod(xp_group + N_DESCRIPTION, "setGroupDescription", 0); digester.addCallMethod(xp_group + N_FLAGS, "setGroupFlags", 0); digester.addCallMethod(xp_group + N_PARENTGROUP, "setGroupParent", 0); }
java
protected void addAccountsGroupRules(Digester digester, String xpath) { String xp_group = xpath + N_GROUPS + "/" + N_GROUP; digester.addCallMethod(xp_group, "importGroup"); xp_group += "/"; digester.addCallMethod(xp_group + N_NAME, "setGroupName", 0); digester.addCallMethod(xp_group + N_DESCRIPTION, "setGroupDescription", 0); digester.addCallMethod(xp_group + N_FLAGS, "setGroupFlags", 0); digester.addCallMethod(xp_group + N_PARENTGROUP, "setGroupParent", 0); }
[ "protected", "void", "addAccountsGroupRules", "(", "Digester", "digester", ",", "String", "xpath", ")", "{", "String", "xp_group", "=", "xpath", "+", "N_GROUPS", "+", "\"/\"", "+", "N_GROUP", ";", "digester", ".", "addCallMethod", "(", "xp_group", ",", "\"importGroup\"", ")", ";", "xp_group", "+=", "\"/\"", ";", "digester", ".", "addCallMethod", "(", "xp_group", "+", "N_NAME", ",", "\"setGroupName\"", ",", "0", ")", ";", "digester", ".", "addCallMethod", "(", "xp_group", "+", "N_DESCRIPTION", ",", "\"setGroupDescription\"", ",", "0", ")", ";", "digester", ".", "addCallMethod", "(", "xp_group", "+", "N_FLAGS", ",", "\"setGroupFlags\"", ",", "0", ")", ";", "digester", ".", "addCallMethod", "(", "xp_group", "+", "N_PARENTGROUP", ",", "\"setGroupParent\"", ",", "0", ")", ";", "}" ]
Adds the XML digester rules for groups.<p> @param digester the digester to add the rules to @param xpath the base xpath for the rules
[ "Adds", "the", "XML", "digester", "rules", "for", "groups", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportVersion7.java#L2976-L2985
iipc/webarchive-commons
src/main/java/org/archive/util/DevUtils.java
DevUtils.warnHandle
public static void warnHandle(Throwable ex, String note) { """ Log a warning message to the logger 'org.archive.util.DevUtils' made of the passed 'note' and a stack trace based off passed exception. @param ex Exception we print a stacktrace on. @param note Message to print ahead of the stacktrace. """ logger.warning(TextUtils.exceptionToString(note, ex)); }
java
public static void warnHandle(Throwable ex, String note) { logger.warning(TextUtils.exceptionToString(note, ex)); }
[ "public", "static", "void", "warnHandle", "(", "Throwable", "ex", ",", "String", "note", ")", "{", "logger", ".", "warning", "(", "TextUtils", ".", "exceptionToString", "(", "note", ",", "ex", ")", ")", ";", "}" ]
Log a warning message to the logger 'org.archive.util.DevUtils' made of the passed 'note' and a stack trace based off passed exception. @param ex Exception we print a stacktrace on. @param note Message to print ahead of the stacktrace.
[ "Log", "a", "warning", "message", "to", "the", "logger", "org", ".", "archive", ".", "util", ".", "DevUtils", "made", "of", "the", "passed", "note", "and", "a", "stack", "trace", "based", "off", "passed", "exception", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/DevUtils.java#L46-L48
netty/netty
codec/src/main/java/io/netty/handler/codec/HeadersUtils.java
HeadersUtils.getAsString
public static <K, V> String getAsString(Headers<K, V, ?> headers, K name) { """ {@link Headers#get(Object)} and convert the result to a {@link String}. @param headers the headers to get the {@code name} from @param name the name of the header to retrieve @return the first header value if the header is found. {@code null} if there's no such entry. """ V orig = headers.get(name); return orig != null ? orig.toString() : null; }
java
public static <K, V> String getAsString(Headers<K, V, ?> headers, K name) { V orig = headers.get(name); return orig != null ? orig.toString() : null; }
[ "public", "static", "<", "K", ",", "V", ">", "String", "getAsString", "(", "Headers", "<", "K", ",", "V", ",", "?", ">", "headers", ",", "K", "name", ")", "{", "V", "orig", "=", "headers", ".", "get", "(", "name", ")", ";", "return", "orig", "!=", "null", "?", "orig", ".", "toString", "(", ")", ":", "null", ";", "}" ]
{@link Headers#get(Object)} and convert the result to a {@link String}. @param headers the headers to get the {@code name} from @param name the name of the header to retrieve @return the first header value if the header is found. {@code null} if there's no such entry.
[ "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/HeadersUtils.java#L63-L66
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/util/hashslot/impl/HashSlotArrayBase.java
HashSlotArrayBase.move
private long move(long fromBaseAddress, long capacity, MemoryAllocator fromMalloc, MemoryAllocator toMalloc) { """ Copies a block from one allocator to another, then frees the source block. """ final long allocatedSize = HEADER_SIZE + capacity * slotLength; final long toBaseAddress = toMalloc.allocate(allocatedSize) + HEADER_SIZE; mem.copyMemory(fromBaseAddress - HEADER_SIZE, toBaseAddress - HEADER_SIZE, allocatedSize); fromMalloc.free(fromBaseAddress - HEADER_SIZE, allocatedSize); return toBaseAddress; }
java
private long move(long fromBaseAddress, long capacity, MemoryAllocator fromMalloc, MemoryAllocator toMalloc) { final long allocatedSize = HEADER_SIZE + capacity * slotLength; final long toBaseAddress = toMalloc.allocate(allocatedSize) + HEADER_SIZE; mem.copyMemory(fromBaseAddress - HEADER_SIZE, toBaseAddress - HEADER_SIZE, allocatedSize); fromMalloc.free(fromBaseAddress - HEADER_SIZE, allocatedSize); return toBaseAddress; }
[ "private", "long", "move", "(", "long", "fromBaseAddress", ",", "long", "capacity", ",", "MemoryAllocator", "fromMalloc", ",", "MemoryAllocator", "toMalloc", ")", "{", "final", "long", "allocatedSize", "=", "HEADER_SIZE", "+", "capacity", "*", "slotLength", ";", "final", "long", "toBaseAddress", "=", "toMalloc", ".", "allocate", "(", "allocatedSize", ")", "+", "HEADER_SIZE", ";", "mem", ".", "copyMemory", "(", "fromBaseAddress", "-", "HEADER_SIZE", ",", "toBaseAddress", "-", "HEADER_SIZE", ",", "allocatedSize", ")", ";", "fromMalloc", ".", "free", "(", "fromBaseAddress", "-", "HEADER_SIZE", ",", "allocatedSize", ")", ";", "return", "toBaseAddress", ";", "}" ]
Copies a block from one allocator to another, then frees the source block.
[ "Copies", "a", "block", "from", "one", "allocator", "to", "another", "then", "frees", "the", "source", "block", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/util/hashslot/impl/HashSlotArrayBase.java#L473-L479
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java
CmsXmlContentPropertyHelper.saveProperties
public static void saveProperties( CmsObject cms, Element parentElement, Map<String, String> properties, Map<String, CmsXmlContentProperty> propertiesConf) { """ Saves the given properties to the given xml element.<p> @param cms the current CMS context @param parentElement the parent xml element @param properties the properties to save, if there is a list of resources, every entry can be a site path or a UUID @param propertiesConf the configuration of the properties """ // remove old entries for (Object propElement : parentElement.elements(CmsXmlContentProperty.XmlNode.Properties.name())) { parentElement.remove((Element)propElement); } // use a sorted map to force a defined order SortedMap<String, String> props = new TreeMap<String, String>(properties); // create new entries for (Map.Entry<String, String> property : props.entrySet()) { String propName = property.getKey(); String propValue = property.getValue(); if ((propValue == null) || (propValue.length() == 0)) { continue; } // only if the property is configured in the schema we will save it Element propElement = parentElement.addElement(CmsXmlContentProperty.XmlNode.Properties.name()); // the property name propElement.addElement(CmsXmlContentProperty.XmlNode.Name.name()).addCDATA(propName); Element valueElement = propElement.addElement(CmsXmlContentProperty.XmlNode.Value.name()); boolean isVfs = false; CmsXmlContentProperty propDef = propertiesConf.get(propName); if (propDef != null) { isVfs = CmsXmlContentProperty.PropType.isVfsList(propDef.getType()); } if (!isVfs) { // string value valueElement.addElement(CmsXmlContentProperty.XmlNode.String.name()).addCDATA(propValue); } else { addFileListPropertyValue(cms, valueElement, propValue); } } }
java
public static void saveProperties( CmsObject cms, Element parentElement, Map<String, String> properties, Map<String, CmsXmlContentProperty> propertiesConf) { // remove old entries for (Object propElement : parentElement.elements(CmsXmlContentProperty.XmlNode.Properties.name())) { parentElement.remove((Element)propElement); } // use a sorted map to force a defined order SortedMap<String, String> props = new TreeMap<String, String>(properties); // create new entries for (Map.Entry<String, String> property : props.entrySet()) { String propName = property.getKey(); String propValue = property.getValue(); if ((propValue == null) || (propValue.length() == 0)) { continue; } // only if the property is configured in the schema we will save it Element propElement = parentElement.addElement(CmsXmlContentProperty.XmlNode.Properties.name()); // the property name propElement.addElement(CmsXmlContentProperty.XmlNode.Name.name()).addCDATA(propName); Element valueElement = propElement.addElement(CmsXmlContentProperty.XmlNode.Value.name()); boolean isVfs = false; CmsXmlContentProperty propDef = propertiesConf.get(propName); if (propDef != null) { isVfs = CmsXmlContentProperty.PropType.isVfsList(propDef.getType()); } if (!isVfs) { // string value valueElement.addElement(CmsXmlContentProperty.XmlNode.String.name()).addCDATA(propValue); } else { addFileListPropertyValue(cms, valueElement, propValue); } } }
[ "public", "static", "void", "saveProperties", "(", "CmsObject", "cms", ",", "Element", "parentElement", ",", "Map", "<", "String", ",", "String", ">", "properties", ",", "Map", "<", "String", ",", "CmsXmlContentProperty", ">", "propertiesConf", ")", "{", "// remove old entries", "for", "(", "Object", "propElement", ":", "parentElement", ".", "elements", "(", "CmsXmlContentProperty", ".", "XmlNode", ".", "Properties", ".", "name", "(", ")", ")", ")", "{", "parentElement", ".", "remove", "(", "(", "Element", ")", "propElement", ")", ";", "}", "// use a sorted map to force a defined order", "SortedMap", "<", "String", ",", "String", ">", "props", "=", "new", "TreeMap", "<", "String", ",", "String", ">", "(", "properties", ")", ";", "// create new entries", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "property", ":", "props", ".", "entrySet", "(", ")", ")", "{", "String", "propName", "=", "property", ".", "getKey", "(", ")", ";", "String", "propValue", "=", "property", ".", "getValue", "(", ")", ";", "if", "(", "(", "propValue", "==", "null", ")", "||", "(", "propValue", ".", "length", "(", ")", "==", "0", ")", ")", "{", "continue", ";", "}", "// only if the property is configured in the schema we will save it", "Element", "propElement", "=", "parentElement", ".", "addElement", "(", "CmsXmlContentProperty", ".", "XmlNode", ".", "Properties", ".", "name", "(", ")", ")", ";", "// the property name", "propElement", ".", "addElement", "(", "CmsXmlContentProperty", ".", "XmlNode", ".", "Name", ".", "name", "(", ")", ")", ".", "addCDATA", "(", "propName", ")", ";", "Element", "valueElement", "=", "propElement", ".", "addElement", "(", "CmsXmlContentProperty", ".", "XmlNode", ".", "Value", ".", "name", "(", ")", ")", ";", "boolean", "isVfs", "=", "false", ";", "CmsXmlContentProperty", "propDef", "=", "propertiesConf", ".", "get", "(", "propName", ")", ";", "if", "(", "propDef", "!=", "null", ")", "{", "isVfs", "=", "CmsXmlContentProperty", ".", "PropType", ".", "isVfsList", "(", "propDef", ".", "getType", "(", ")", ")", ";", "}", "if", "(", "!", "isVfs", ")", "{", "// string value", "valueElement", ".", "addElement", "(", "CmsXmlContentProperty", ".", "XmlNode", ".", "String", ".", "name", "(", ")", ")", ".", "addCDATA", "(", "propValue", ")", ";", "}", "else", "{", "addFileListPropertyValue", "(", "cms", ",", "valueElement", ",", "propValue", ")", ";", "}", "}", "}" ]
Saves the given properties to the given xml element.<p> @param cms the current CMS context @param parentElement the parent xml element @param properties the properties to save, if there is a list of resources, every entry can be a site path or a UUID @param propertiesConf the configuration of the properties
[ "Saves", "the", "given", "properties", "to", "the", "given", "xml", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java#L724-L763
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
Instance.setMetadata
public Operation setMetadata(Map<String, String> metadata, OperationOption... options) { """ Sets the metadata for this instance, fingerprint value is taken from this instance's {@code tags().fingerprint()}. @return a zone operation if the set request was issued correctly, {@code null} if the instance was not found @throws ComputeException upon failure """ return setMetadata(getMetadata().toBuilder().setValues(metadata).build(), options); }
java
public Operation setMetadata(Map<String, String> metadata, OperationOption... options) { return setMetadata(getMetadata().toBuilder().setValues(metadata).build(), options); }
[ "public", "Operation", "setMetadata", "(", "Map", "<", "String", ",", "String", ">", "metadata", ",", "OperationOption", "...", "options", ")", "{", "return", "setMetadata", "(", "getMetadata", "(", ")", ".", "toBuilder", "(", ")", ".", "setValues", "(", "metadata", ")", ".", "build", "(", ")", ",", "options", ")", ";", "}" ]
Sets the metadata for this instance, fingerprint value is taken from this instance's {@code tags().fingerprint()}. @return a zone operation if the set request was issued correctly, {@code null} if the instance was not found @throws ComputeException upon failure
[ "Sets", "the", "metadata", "for", "this", "instance", "fingerprint", "value", "is", "taken", "from", "this", "instance", "s", "{", "@code", "tags", "()", ".", "fingerprint", "()", "}", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L371-L373
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/EnvelopesApi.java
EnvelopesApi.getEnvelope
public Envelope getEnvelope(String accountId, String envelopeId) throws ApiException { """ Gets the status of a envelope. Retrieves the overall status for the specified envelope. @param accountId The external account number (int) or account ID Guid. (required) @param envelopeId The envelopeId Guid of the envelope being accessed. (required) @return Envelope """ return getEnvelope(accountId, envelopeId, null); }
java
public Envelope getEnvelope(String accountId, String envelopeId) throws ApiException { return getEnvelope(accountId, envelopeId, null); }
[ "public", "Envelope", "getEnvelope", "(", "String", "accountId", ",", "String", "envelopeId", ")", "throws", "ApiException", "{", "return", "getEnvelope", "(", "accountId", ",", "envelopeId", ",", "null", ")", ";", "}" ]
Gets the status of a envelope. Retrieves the overall status for the specified envelope. @param accountId The external account number (int) or account ID Guid. (required) @param envelopeId The envelopeId Guid of the envelope being accessed. (required) @return Envelope
[ "Gets", "the", "status", "of", "a", "envelope", ".", "Retrieves", "the", "overall", "status", "for", "the", "specified", "envelope", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L2594-L2596
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/PortableNavigatorContext.java
PortableNavigatorContext.initFinalPositionAndOffset
private void initFinalPositionAndOffset(BufferObjectDataInput in, ClassDefinition cd) { """ Initialises the finalPosition and offset and validates the fieldCount against the given class definition """ int fieldCount; try { // final position after portable is read finalPosition = in.readInt(); fieldCount = in.readInt(); } catch (IOException e) { throw new HazelcastSerializationException(e); } if (fieldCount != cd.getFieldCount()) { throw new IllegalStateException("Field count[" + fieldCount + "] in stream does not match " + cd); } offset = in.position(); }
java
private void initFinalPositionAndOffset(BufferObjectDataInput in, ClassDefinition cd) { int fieldCount; try { // final position after portable is read finalPosition = in.readInt(); fieldCount = in.readInt(); } catch (IOException e) { throw new HazelcastSerializationException(e); } if (fieldCount != cd.getFieldCount()) { throw new IllegalStateException("Field count[" + fieldCount + "] in stream does not match " + cd); } offset = in.position(); }
[ "private", "void", "initFinalPositionAndOffset", "(", "BufferObjectDataInput", "in", ",", "ClassDefinition", "cd", ")", "{", "int", "fieldCount", ";", "try", "{", "// final position after portable is read", "finalPosition", "=", "in", ".", "readInt", "(", ")", ";", "fieldCount", "=", "in", ".", "readInt", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "HazelcastSerializationException", "(", "e", ")", ";", "}", "if", "(", "fieldCount", "!=", "cd", ".", "getFieldCount", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Field count[\"", "+", "fieldCount", "+", "\"] in stream does not match \"", "+", "cd", ")", ";", "}", "offset", "=", "in", ".", "position", "(", ")", ";", "}" ]
Initialises the finalPosition and offset and validates the fieldCount against the given class definition
[ "Initialises", "the", "finalPosition", "and", "offset", "and", "validates", "the", "fieldCount", "against", "the", "given", "class", "definition" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/internal/serialization/impl/PortableNavigatorContext.java#L72-L85
RestComm/media-core
rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTCPCryptoContext.java
SRTCPCryptoContext.processPacketAESF8
public void processPacketAESF8(RawPacket pkt, int index) { """ Perform F8 Mode AES encryption / decryption @param pkt the RTP packet to be encrypted / decrypted """ // byte[] iv = new byte[16]; // 4 bytes of the iv are zero // the first byte of the RTP header is not used. ivStore[0] = 0; ivStore[1] = 0; ivStore[2] = 0; ivStore[3] = 0; // Need the encryption flag index = index | 0x80000000; // set the index and the encrypt flag in network order into IV ivStore[4] = (byte) (index >> 24); ivStore[5] = (byte) (index >> 16); ivStore[6] = (byte) (index >> 8); ivStore[7] = (byte) index; // The fixed header follows and fills the rest of the IV ByteBuffer buf = pkt.getBuffer(); buf.rewind(); buf.get(ivStore, 8, 8); // Encrypted part excludes fixed header (8 bytes), index (4 bytes), and // authentication tag (variable according to policy) final int payloadOffset = 8; final int payloadLength = pkt.getLength() - (4 + policy.getAuthTagLength()); SRTPCipherF8.process(cipher, pkt.getBuffer(), payloadOffset, payloadLength, ivStore, cipherF8); }
java
public void processPacketAESF8(RawPacket pkt, int index) { // byte[] iv = new byte[16]; // 4 bytes of the iv are zero // the first byte of the RTP header is not used. ivStore[0] = 0; ivStore[1] = 0; ivStore[2] = 0; ivStore[3] = 0; // Need the encryption flag index = index | 0x80000000; // set the index and the encrypt flag in network order into IV ivStore[4] = (byte) (index >> 24); ivStore[5] = (byte) (index >> 16); ivStore[6] = (byte) (index >> 8); ivStore[7] = (byte) index; // The fixed header follows and fills the rest of the IV ByteBuffer buf = pkt.getBuffer(); buf.rewind(); buf.get(ivStore, 8, 8); // Encrypted part excludes fixed header (8 bytes), index (4 bytes), and // authentication tag (variable according to policy) final int payloadOffset = 8; final int payloadLength = pkt.getLength() - (4 + policy.getAuthTagLength()); SRTPCipherF8.process(cipher, pkt.getBuffer(), payloadOffset, payloadLength, ivStore, cipherF8); }
[ "public", "void", "processPacketAESF8", "(", "RawPacket", "pkt", ",", "int", "index", ")", "{", "// byte[] iv = new byte[16];\r", "// 4 bytes of the iv are zero\r", "// the first byte of the RTP header is not used.\r", "ivStore", "[", "0", "]", "=", "0", ";", "ivStore", "[", "1", "]", "=", "0", ";", "ivStore", "[", "2", "]", "=", "0", ";", "ivStore", "[", "3", "]", "=", "0", ";", "// Need the encryption flag\r", "index", "=", "index", "|", "0x80000000", ";", "// set the index and the encrypt flag in network order into IV\r", "ivStore", "[", "4", "]", "=", "(", "byte", ")", "(", "index", ">>", "24", ")", ";", "ivStore", "[", "5", "]", "=", "(", "byte", ")", "(", "index", ">>", "16", ")", ";", "ivStore", "[", "6", "]", "=", "(", "byte", ")", "(", "index", ">>", "8", ")", ";", "ivStore", "[", "7", "]", "=", "(", "byte", ")", "index", ";", "// The fixed header follows and fills the rest of the IV\r", "ByteBuffer", "buf", "=", "pkt", ".", "getBuffer", "(", ")", ";", "buf", ".", "rewind", "(", ")", ";", "buf", ".", "get", "(", "ivStore", ",", "8", ",", "8", ")", ";", "// Encrypted part excludes fixed header (8 bytes), index (4 bytes), and\r", "// authentication tag (variable according to policy) \r", "final", "int", "payloadOffset", "=", "8", ";", "final", "int", "payloadLength", "=", "pkt", ".", "getLength", "(", ")", "-", "(", "4", "+", "policy", ".", "getAuthTagLength", "(", ")", ")", ";", "SRTPCipherF8", ".", "process", "(", "cipher", ",", "pkt", ".", "getBuffer", "(", ")", ",", "payloadOffset", ",", "payloadLength", ",", "ivStore", ",", "cipherF8", ")", ";", "}" ]
Perform F8 Mode AES encryption / decryption @param pkt the RTP packet to be encrypted / decrypted
[ "Perform", "F8", "Mode", "AES", "encryption", "/", "decryption" ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTCPCryptoContext.java#L416-L445
lawloretienne/ImageGallery
library/src/main/java/com/etiennelawlor/imagegallery/library/ui/TouchImageView.java
TouchImageView.translateMatrixAfterRotate
private void translateMatrixAfterRotate(int axis, float trans, float prevImageSize, float imageSize, int prevViewSize, int viewSize, int drawableSize) { """ After rotating, the matrix needs to be translated. This function finds the area of image which was previously centered and adjusts translations so that is again the center, post-rotation. @param axis Matrix.MTRANS_X or Matrix.MTRANS_Y @param trans the value of trans in that axis before the rotation @param prevImageSize the width/height of the image before the rotation @param imageSize width/height of the image after rotation @param prevViewSize width/height of view before rotation @param viewSize width/height of view after rotation @param drawableSize width/height of drawable """ if (imageSize < viewSize) { // // The width/height of image is less than the view's width/height. Center it. // m[axis] = (viewSize - (drawableSize * m[Matrix.MSCALE_X])) * 0.5f; } else if (trans > 0) { // // The image is larger than the view, but was not before rotation. Center it. // m[axis] = -((imageSize - viewSize) * 0.5f); } else { // // Find the area of the image which was previously centered in the view. Determine its distance // from the left/top side of the view as a fraction of the entire image's width/height. Use that percentage // to calculate the trans in the new view width/height. // float percentage = (Math.abs(trans) + (0.5f * prevViewSize)) / prevImageSize; m[axis] = -((percentage * imageSize) - (viewSize * 0.5f)); } }
java
private void translateMatrixAfterRotate(int axis, float trans, float prevImageSize, float imageSize, int prevViewSize, int viewSize, int drawableSize) { if (imageSize < viewSize) { // // The width/height of image is less than the view's width/height. Center it. // m[axis] = (viewSize - (drawableSize * m[Matrix.MSCALE_X])) * 0.5f; } else if (trans > 0) { // // The image is larger than the view, but was not before rotation. Center it. // m[axis] = -((imageSize - viewSize) * 0.5f); } else { // // Find the area of the image which was previously centered in the view. Determine its distance // from the left/top side of the view as a fraction of the entire image's width/height. Use that percentage // to calculate the trans in the new view width/height. // float percentage = (Math.abs(trans) + (0.5f * prevViewSize)) / prevImageSize; m[axis] = -((percentage * imageSize) - (viewSize * 0.5f)); } }
[ "private", "void", "translateMatrixAfterRotate", "(", "int", "axis", ",", "float", "trans", ",", "float", "prevImageSize", ",", "float", "imageSize", ",", "int", "prevViewSize", ",", "int", "viewSize", ",", "int", "drawableSize", ")", "{", "if", "(", "imageSize", "<", "viewSize", ")", "{", "//", "// The width/height of image is less than the view's width/height. Center it.", "//", "m", "[", "axis", "]", "=", "(", "viewSize", "-", "(", "drawableSize", "*", "m", "[", "Matrix", ".", "MSCALE_X", "]", ")", ")", "*", "0.5f", ";", "}", "else", "if", "(", "trans", ">", "0", ")", "{", "//", "// The image is larger than the view, but was not before rotation. Center it.", "//", "m", "[", "axis", "]", "=", "-", "(", "(", "imageSize", "-", "viewSize", ")", "*", "0.5f", ")", ";", "}", "else", "{", "//", "// Find the area of the image which was previously centered in the view. Determine its distance", "// from the left/top side of the view as a fraction of the entire image's width/height. Use that percentage", "// to calculate the trans in the new view width/height.", "//", "float", "percentage", "=", "(", "Math", ".", "abs", "(", "trans", ")", "+", "(", "0.5f", "*", "prevViewSize", ")", ")", "/", "prevImageSize", ";", "m", "[", "axis", "]", "=", "-", "(", "(", "percentage", "*", "imageSize", ")", "-", "(", "viewSize", "*", "0.5f", ")", ")", ";", "}", "}" ]
After rotating, the matrix needs to be translated. This function finds the area of image which was previously centered and adjusts translations so that is again the center, post-rotation. @param axis Matrix.MTRANS_X or Matrix.MTRANS_Y @param trans the value of trans in that axis before the rotation @param prevImageSize the width/height of the image before the rotation @param imageSize width/height of the image after rotation @param prevViewSize width/height of view before rotation @param viewSize width/height of view after rotation @param drawableSize width/height of drawable
[ "After", "rotating", "the", "matrix", "needs", "to", "be", "translated", ".", "This", "function", "finds", "the", "area", "of", "image", "which", "was", "previously", "centered", "and", "adjusts", "translations", "so", "that", "is", "again", "the", "center", "post", "-", "rotation", "." ]
train
https://github.com/lawloretienne/ImageGallery/blob/960d68dfb2b81d05322a576723ac4f090e10eda7/library/src/main/java/com/etiennelawlor/imagegallery/library/ui/TouchImageView.java#L710-L732
twilio/twilio-java
src/main/java/com/twilio/rest/messaging/v1/SessionReader.java
SessionReader.nextPage
@Override public Page<Session> nextPage(final Page<Session> page, final TwilioRestClient client) { """ Retrieve the next page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Next Page """ Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.MESSAGING.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
java
@Override public Page<Session> nextPage(final Page<Session> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.MESSAGING.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
[ "@", "Override", "public", "Page", "<", "Session", ">", "nextPage", "(", "final", "Page", "<", "Session", ">", "page", ",", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET", ",", "page", ".", "getNextPageUrl", "(", "Domains", ".", "MESSAGING", ".", "toString", "(", ")", ",", "client", ".", "getRegion", "(", ")", ")", ")", ";", "return", "pageForRequest", "(", "client", ",", "request", ")", ";", "}" ]
Retrieve the next page from the Twilio API. @param page current page @param client TwilioRestClient with which to make the request @return Next Page
[ "Retrieve", "the", "next", "page", "from", "the", "Twilio", "API", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/rest/messaging/v1/SessionReader.java#L84-L95
sundrio/sundrio
components/swagger/src/main/java/io/sundr/swagger/language/JavaFluentCodegen.java
JavaFluentCodegen.addOperationToGroup
@SuppressWarnings("static-method") public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) { """ Add operation to group @param tag name of the tag @param resourcePath path of the resource @param operation Swagger Operation object @param co Codegen Operation object @param operations map of Codegen operations """ String prefix = co.returnBaseType != null && co.returnBaseType.contains(".") ? co.returnBaseType.substring(0, co.returnBaseType.lastIndexOf(".")) : ""; String newTag = !prefix.isEmpty() ? prefix + "." + tag : tag; super.addOperationToGroup(newTag, resourcePath, operation, co, operations); }
java
@SuppressWarnings("static-method") public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) { String prefix = co.returnBaseType != null && co.returnBaseType.contains(".") ? co.returnBaseType.substring(0, co.returnBaseType.lastIndexOf(".")) : ""; String newTag = !prefix.isEmpty() ? prefix + "." + tag : tag; super.addOperationToGroup(newTag, resourcePath, operation, co, operations); }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "public", "void", "addOperationToGroup", "(", "String", "tag", ",", "String", "resourcePath", ",", "Operation", "operation", ",", "CodegenOperation", "co", ",", "Map", "<", "String", ",", "List", "<", "CodegenOperation", ">", ">", "operations", ")", "{", "String", "prefix", "=", "co", ".", "returnBaseType", "!=", "null", "&&", "co", ".", "returnBaseType", ".", "contains", "(", "\".\"", ")", "?", "co", ".", "returnBaseType", ".", "substring", "(", "0", ",", "co", ".", "returnBaseType", ".", "lastIndexOf", "(", "\".\"", ")", ")", ":", "\"\"", ";", "String", "newTag", "=", "!", "prefix", ".", "isEmpty", "(", ")", "?", "prefix", "+", "\".\"", "+", "tag", ":", "tag", ";", "super", ".", "addOperationToGroup", "(", "newTag", ",", "resourcePath", ",", "operation", ",", "co", ",", "operations", ")", ";", "}" ]
Add operation to group @param tag name of the tag @param resourcePath path of the resource @param operation Swagger Operation object @param co Codegen Operation object @param operations map of Codegen operations
[ "Add", "operation", "to", "group" ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/components/swagger/src/main/java/io/sundr/swagger/language/JavaFluentCodegen.java#L349-L360
alkacon/opencms-core
src-modules/org/opencms/workplace/explorer/CmsTree.java
CmsTree.getNode
private String getNode(String path, String title, int type, boolean folder, CmsResourceState state, boolean grey) { """ Creates the output for a tree node.<p> @param path the path of the resource represented by this tree node @param title the resource name @param type the resource type @param folder if the resource is a folder @param state the resource state @param grey if true, the node is displayed in grey @return the output for a tree node """ StringBuffer result = new StringBuffer(64); String parent = CmsResource.getParentFolder(path); result.append("parent.aC(\""); // name result.append(title); result.append("\","); // type result.append(type); result.append(","); // folder if (folder) { result.append(1); } else { result.append(0); } result.append(","); // hashcode of path result.append(path.hashCode()); result.append(","); // hashcode of parent path result.append((parent != null) ? parent.hashCode() : 0); result.append(","); // resource state result.append(state); result.append(","); // project status if (grey) { result.append(1); } else { result.append(0); } result.append(");\n"); return result.toString(); }
java
private String getNode(String path, String title, int type, boolean folder, CmsResourceState state, boolean grey) { StringBuffer result = new StringBuffer(64); String parent = CmsResource.getParentFolder(path); result.append("parent.aC(\""); // name result.append(title); result.append("\","); // type result.append(type); result.append(","); // folder if (folder) { result.append(1); } else { result.append(0); } result.append(","); // hashcode of path result.append(path.hashCode()); result.append(","); // hashcode of parent path result.append((parent != null) ? parent.hashCode() : 0); result.append(","); // resource state result.append(state); result.append(","); // project status if (grey) { result.append(1); } else { result.append(0); } result.append(");\n"); return result.toString(); }
[ "private", "String", "getNode", "(", "String", "path", ",", "String", "title", ",", "int", "type", ",", "boolean", "folder", ",", "CmsResourceState", "state", ",", "boolean", "grey", ")", "{", "StringBuffer", "result", "=", "new", "StringBuffer", "(", "64", ")", ";", "String", "parent", "=", "CmsResource", ".", "getParentFolder", "(", "path", ")", ";", "result", ".", "append", "(", "\"parent.aC(\\\"\"", ")", ";", "// name", "result", ".", "append", "(", "title", ")", ";", "result", ".", "append", "(", "\"\\\",\"", ")", ";", "// type", "result", ".", "append", "(", "type", ")", ";", "result", ".", "append", "(", "\",\"", ")", ";", "// folder", "if", "(", "folder", ")", "{", "result", ".", "append", "(", "1", ")", ";", "}", "else", "{", "result", ".", "append", "(", "0", ")", ";", "}", "result", ".", "append", "(", "\",\"", ")", ";", "// hashcode of path", "result", ".", "append", "(", "path", ".", "hashCode", "(", ")", ")", ";", "result", ".", "append", "(", "\",\"", ")", ";", "// hashcode of parent path", "result", ".", "append", "(", "(", "parent", "!=", "null", ")", "?", "parent", ".", "hashCode", "(", ")", ":", "0", ")", ";", "result", ".", "append", "(", "\",\"", ")", ";", "// resource state", "result", ".", "append", "(", "state", ")", ";", "result", ".", "append", "(", "\",\"", ")", ";", "// project status", "if", "(", "grey", ")", "{", "result", ".", "append", "(", "1", ")", ";", "}", "else", "{", "result", ".", "append", "(", "0", ")", ";", "}", "result", ".", "append", "(", "\");\\n\"", ")", ";", "return", "result", ".", "toString", "(", ")", ";", "}" ]
Creates the output for a tree node.<p> @param path the path of the resource represented by this tree node @param title the resource name @param type the resource type @param folder if the resource is a folder @param state the resource state @param grey if true, the node is displayed in grey @return the output for a tree node
[ "Creates", "the", "output", "for", "a", "tree", "node", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/explorer/CmsTree.java#L691-L726
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLUpdateClause.java
AbstractSQLUpdateClause.addBatch
@WithBridgeMethods(value = SQLUpdateClause.class, castRequired = true) public C addBatch() { """ Add the current state of bindings as a batch item @return the current object """ batches.add(new SQLUpdateBatch(metadata, updates)); updates = Maps.newLinkedHashMap(); metadata = new DefaultQueryMetadata(); metadata.addJoin(JoinType.DEFAULT, entity); return (C) this; }
java
@WithBridgeMethods(value = SQLUpdateClause.class, castRequired = true) public C addBatch() { batches.add(new SQLUpdateBatch(metadata, updates)); updates = Maps.newLinkedHashMap(); metadata = new DefaultQueryMetadata(); metadata.addJoin(JoinType.DEFAULT, entity); return (C) this; }
[ "@", "WithBridgeMethods", "(", "value", "=", "SQLUpdateClause", ".", "class", ",", "castRequired", "=", "true", ")", "public", "C", "addBatch", "(", ")", "{", "batches", ".", "add", "(", "new", "SQLUpdateBatch", "(", "metadata", ",", "updates", ")", ")", ";", "updates", "=", "Maps", ".", "newLinkedHashMap", "(", ")", ";", "metadata", "=", "new", "DefaultQueryMetadata", "(", ")", ";", "metadata", ".", "addJoin", "(", "JoinType", ".", "DEFAULT", ",", "entity", ")", ";", "return", "(", "C", ")", "this", ";", "}" ]
Add the current state of bindings as a batch item @return the current object
[ "Add", "the", "current", "state", "of", "bindings", "as", "a", "batch", "item" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/dml/AbstractSQLUpdateClause.java#L109-L116
forge/core
facets/api/src/main/java/org/jboss/forge/addon/facets/constraints/FacetInspector.java
FacetInspector.getOptionalFacets
public static <FACETTYPE extends Facet<?>> Set<Class<FACETTYPE>> getOptionalFacets(final Class<?> inspectedType) { """ Inspect the given {@link Class} for any {@link FacetConstraintType#OPTIONAL} dependency {@link Facet} types. """ return getRelatedFacets(inspectedType, FacetConstraintType.OPTIONAL); }
java
public static <FACETTYPE extends Facet<?>> Set<Class<FACETTYPE>> getOptionalFacets(final Class<?> inspectedType) { return getRelatedFacets(inspectedType, FacetConstraintType.OPTIONAL); }
[ "public", "static", "<", "FACETTYPE", "extends", "Facet", "<", "?", ">", ">", "Set", "<", "Class", "<", "FACETTYPE", ">", ">", "getOptionalFacets", "(", "final", "Class", "<", "?", ">", "inspectedType", ")", "{", "return", "getRelatedFacets", "(", "inspectedType", ",", "FacetConstraintType", ".", "OPTIONAL", ")", ";", "}" ]
Inspect the given {@link Class} for any {@link FacetConstraintType#OPTIONAL} dependency {@link Facet} types.
[ "Inspect", "the", "given", "{" ]
train
https://github.com/forge/core/blob/e140eb03bbe2b3409478ad70c86c3edbef6d9a0c/facets/api/src/main/java/org/jboss/forge/addon/facets/constraints/FacetInspector.java#L63-L66
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.createFundamental
public static DMatrixRMaj createFundamental(DMatrixRMaj E, DMatrixRMaj K) { """ Computes a Fundamental matrix given an Essential matrix and the camera calibration matrix. F = (K<sup>-1</sup>)<sup>T</sup>*E*K<sup>-1</sup> @param E Essential matrix @param K Intrinsic camera calibration matrix @return Fundamental matrix """ DMatrixRMaj K_inv = new DMatrixRMaj(3,3); CommonOps_DDRM.invert(K,K_inv); DMatrixRMaj F = new DMatrixRMaj(3,3); PerspectiveOps.multTranA(K_inv,E,K_inv,F); return F; }
java
public static DMatrixRMaj createFundamental(DMatrixRMaj E, DMatrixRMaj K) { DMatrixRMaj K_inv = new DMatrixRMaj(3,3); CommonOps_DDRM.invert(K,K_inv); DMatrixRMaj F = new DMatrixRMaj(3,3); PerspectiveOps.multTranA(K_inv,E,K_inv,F); return F; }
[ "public", "static", "DMatrixRMaj", "createFundamental", "(", "DMatrixRMaj", "E", ",", "DMatrixRMaj", "K", ")", "{", "DMatrixRMaj", "K_inv", "=", "new", "DMatrixRMaj", "(", "3", ",", "3", ")", ";", "CommonOps_DDRM", ".", "invert", "(", "K", ",", "K_inv", ")", ";", "DMatrixRMaj", "F", "=", "new", "DMatrixRMaj", "(", "3", ",", "3", ")", ";", "PerspectiveOps", ".", "multTranA", "(", "K_inv", ",", "E", ",", "K_inv", ",", "F", ")", ";", "return", "F", ";", "}" ]
Computes a Fundamental matrix given an Essential matrix and the camera calibration matrix. F = (K<sup>-1</sup>)<sup>T</sup>*E*K<sup>-1</sup> @param E Essential matrix @param K Intrinsic camera calibration matrix @return Fundamental matrix
[ "Computes", "a", "Fundamental", "matrix", "given", "an", "Essential", "matrix", "and", "the", "camera", "calibration", "matrix", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L687-L695
webdriverextensions/webdriverextensions
src/main/java/com/github/webdriverextensions/internal/junitrunner/AnnotationUtils.java
AnnotationUtils.getDefaultValue
public static Object getDefaultValue(Class<? extends Annotation> annotationType, String attributeName) { """ Retrieve the <em>default value</em> of a named Annotation attribute, given the {@link Class annotation type}. @param annotationType the <em>annotation type</em> for which the default value should be retrieved @param attributeName the name of the attribute value to retrieve. @return the default value of the named attribute, or <code>null</code> if not found @see #getDefaultValue(Annotation, String) """ try { Method method = annotationType.getDeclaredMethod(attributeName, new Class[0]); return method.getDefaultValue(); } catch (Exception ex) { return null; } }
java
public static Object getDefaultValue(Class<? extends Annotation> annotationType, String attributeName) { try { Method method = annotationType.getDeclaredMethod(attributeName, new Class[0]); return method.getDefaultValue(); } catch (Exception ex) { return null; } }
[ "public", "static", "Object", "getDefaultValue", "(", "Class", "<", "?", "extends", "Annotation", ">", "annotationType", ",", "String", "attributeName", ")", "{", "try", "{", "Method", "method", "=", "annotationType", ".", "getDeclaredMethod", "(", "attributeName", ",", "new", "Class", "[", "0", "]", ")", ";", "return", "method", ".", "getDefaultValue", "(", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "return", "null", ";", "}", "}" ]
Retrieve the <em>default value</em> of a named Annotation attribute, given the {@link Class annotation type}. @param annotationType the <em>annotation type</em> for which the default value should be retrieved @param attributeName the name of the attribute value to retrieve. @return the default value of the named attribute, or <code>null</code> if not found @see #getDefaultValue(Annotation, String)
[ "Retrieve", "the", "<em", ">", "default", "value<", "/", "em", ">", "of", "a", "named", "Annotation", "attribute", "given", "the", "{" ]
train
https://github.com/webdriverextensions/webdriverextensions/blob/80151a2bb4fe92b093e60b1e628b8c3d73fb1cc1/src/main/java/com/github/webdriverextensions/internal/junitrunner/AnnotationUtils.java#L179-L187
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java
PhysicalEntityChain.intersects
public boolean intersects(PhysicalEntityChain rpeh, boolean ignoreEndPoints) { """ Checks if two chains intersect. @param rpeh second chain @param ignoreEndPoints flag to ignore intersections at the endpoints of the chains @return true if they intersect """ for (PhysicalEntity pe1 : pes) { for (PhysicalEntity pe2 : rpeh.pes) { if (pe1 == pe2) { if (ignoreEndPoints) { if ((pes[0] == pe1 || pes[pes.length-1] == pe1) && (rpeh.pes[0] == pe2 || rpeh.pes[rpeh.pes.length-1] == pe2)) { continue; } } return true; } } } return false; }
java
public boolean intersects(PhysicalEntityChain rpeh, boolean ignoreEndPoints) { for (PhysicalEntity pe1 : pes) { for (PhysicalEntity pe2 : rpeh.pes) { if (pe1 == pe2) { if (ignoreEndPoints) { if ((pes[0] == pe1 || pes[pes.length-1] == pe1) && (rpeh.pes[0] == pe2 || rpeh.pes[rpeh.pes.length-1] == pe2)) { continue; } } return true; } } } return false; }
[ "public", "boolean", "intersects", "(", "PhysicalEntityChain", "rpeh", ",", "boolean", "ignoreEndPoints", ")", "{", "for", "(", "PhysicalEntity", "pe1", ":", "pes", ")", "{", "for", "(", "PhysicalEntity", "pe2", ":", "rpeh", ".", "pes", ")", "{", "if", "(", "pe1", "==", "pe2", ")", "{", "if", "(", "ignoreEndPoints", ")", "{", "if", "(", "(", "pes", "[", "0", "]", "==", "pe1", "||", "pes", "[", "pes", ".", "length", "-", "1", "]", "==", "pe1", ")", "&&", "(", "rpeh", ".", "pes", "[", "0", "]", "==", "pe2", "||", "rpeh", ".", "pes", "[", "rpeh", ".", "pes", ".", "length", "-", "1", "]", "==", "pe2", ")", ")", "{", "continue", ";", "}", "}", "return", "true", ";", "}", "}", "}", "return", "false", ";", "}" ]
Checks if two chains intersect. @param rpeh second chain @param ignoreEndPoints flag to ignore intersections at the endpoints of the chains @return true if they intersect
[ "Checks", "if", "two", "chains", "intersect", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/util/PhysicalEntityChain.java#L162-L184
apache/incubator-druid
processing/src/main/java/org/apache/druid/segment/VirtualColumns.java
VirtualColumns.makeColumnValueSelector
public ColumnValueSelector<?> makeColumnValueSelector(String columnName, ColumnSelectorFactory factory) { """ Create a column value selector. @param columnName column mame @param factory base column selector factory @return selector @throws IllegalArgumentException if the virtual column does not exist (see {@link #exists(String)} """ final VirtualColumn virtualColumn = getVirtualColumn(columnName); if (virtualColumn == null) { throw new IAE("No such virtual column[%s]", columnName); } else { final ColumnValueSelector<?> selector = virtualColumn.makeColumnValueSelector(columnName, factory); Preconditions.checkNotNull(selector, "selector"); return selector; } }
java
public ColumnValueSelector<?> makeColumnValueSelector(String columnName, ColumnSelectorFactory factory) { final VirtualColumn virtualColumn = getVirtualColumn(columnName); if (virtualColumn == null) { throw new IAE("No such virtual column[%s]", columnName); } else { final ColumnValueSelector<?> selector = virtualColumn.makeColumnValueSelector(columnName, factory); Preconditions.checkNotNull(selector, "selector"); return selector; } }
[ "public", "ColumnValueSelector", "<", "?", ">", "makeColumnValueSelector", "(", "String", "columnName", ",", "ColumnSelectorFactory", "factory", ")", "{", "final", "VirtualColumn", "virtualColumn", "=", "getVirtualColumn", "(", "columnName", ")", ";", "if", "(", "virtualColumn", "==", "null", ")", "{", "throw", "new", "IAE", "(", "\"No such virtual column[%s]\"", ",", "columnName", ")", ";", "}", "else", "{", "final", "ColumnValueSelector", "<", "?", ">", "selector", "=", "virtualColumn", ".", "makeColumnValueSelector", "(", "columnName", ",", "factory", ")", ";", "Preconditions", ".", "checkNotNull", "(", "selector", ",", "\"selector\"", ")", ";", "return", "selector", ";", "}", "}" ]
Create a column value selector. @param columnName column mame @param factory base column selector factory @return selector @throws IllegalArgumentException if the virtual column does not exist (see {@link #exists(String)}
[ "Create", "a", "column", "value", "selector", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/segment/VirtualColumns.java#L184-L194
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java
InstanceFailoverGroupsInner.listByLocationAsync
public Observable<Page<InstanceFailoverGroupInner>> listByLocationAsync(final String resourceGroupName, final String locationName) { """ Lists the failover groups in a location. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param locationName The name of the region where the resource is located. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;InstanceFailoverGroupInner&gt; object """ return listByLocationWithServiceResponseAsync(resourceGroupName, locationName) .map(new Func1<ServiceResponse<Page<InstanceFailoverGroupInner>>, Page<InstanceFailoverGroupInner>>() { @Override public Page<InstanceFailoverGroupInner> call(ServiceResponse<Page<InstanceFailoverGroupInner>> response) { return response.body(); } }); }
java
public Observable<Page<InstanceFailoverGroupInner>> listByLocationAsync(final String resourceGroupName, final String locationName) { return listByLocationWithServiceResponseAsync(resourceGroupName, locationName) .map(new Func1<ServiceResponse<Page<InstanceFailoverGroupInner>>, Page<InstanceFailoverGroupInner>>() { @Override public Page<InstanceFailoverGroupInner> call(ServiceResponse<Page<InstanceFailoverGroupInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "InstanceFailoverGroupInner", ">", ">", "listByLocationAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "locationName", ")", "{", "return", "listByLocationWithServiceResponseAsync", "(", "resourceGroupName", ",", "locationName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "InstanceFailoverGroupInner", ">", ">", ",", "Page", "<", "InstanceFailoverGroupInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "InstanceFailoverGroupInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "InstanceFailoverGroupInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Lists the failover groups in a location. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param locationName The name of the region where the resource is located. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;InstanceFailoverGroupInner&gt; object
[ "Lists", "the", "failover", "groups", "in", "a", "location", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java#L609-L617
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFunctionConfig.java
CollisionFunctionConfig.exports
public static void exports(Xml root, CollisionFunction function) { """ Export the collision function data as a node. @param root The node root (must not be <code>null</code>). @param function The collision function to export (must not be <code>null</code>). @throws LionEngineException If error on writing. """ Check.notNull(root); Check.notNull(function); final Xml node = root.createChild(FUNCTION); if (function instanceof CollisionFunctionLinear) { final CollisionFunctionLinear linear = (CollisionFunctionLinear) function; node.writeString(TYPE, CollisionFunctionType.LINEAR.name()); node.writeDouble(A, linear.getA()); node.writeDouble(B, linear.getB()); } else { node.writeString(TYPE, String.valueOf(function.getType())); } }
java
public static void exports(Xml root, CollisionFunction function) { Check.notNull(root); Check.notNull(function); final Xml node = root.createChild(FUNCTION); if (function instanceof CollisionFunctionLinear) { final CollisionFunctionLinear linear = (CollisionFunctionLinear) function; node.writeString(TYPE, CollisionFunctionType.LINEAR.name()); node.writeDouble(A, linear.getA()); node.writeDouble(B, linear.getB()); } else { node.writeString(TYPE, String.valueOf(function.getType())); } }
[ "public", "static", "void", "exports", "(", "Xml", "root", ",", "CollisionFunction", "function", ")", "{", "Check", ".", "notNull", "(", "root", ")", ";", "Check", ".", "notNull", "(", "function", ")", ";", "final", "Xml", "node", "=", "root", ".", "createChild", "(", "FUNCTION", ")", ";", "if", "(", "function", "instanceof", "CollisionFunctionLinear", ")", "{", "final", "CollisionFunctionLinear", "linear", "=", "(", "CollisionFunctionLinear", ")", "function", ";", "node", ".", "writeString", "(", "TYPE", ",", "CollisionFunctionType", ".", "LINEAR", ".", "name", "(", ")", ")", ";", "node", ".", "writeDouble", "(", "A", ",", "linear", ".", "getA", "(", ")", ")", ";", "node", ".", "writeDouble", "(", "B", ",", "linear", ".", "getB", "(", ")", ")", ";", "}", "else", "{", "node", ".", "writeString", "(", "TYPE", ",", "String", ".", "valueOf", "(", "function", ".", "getType", "(", ")", ")", ")", ";", "}", "}" ]
Export the collision function data as a node. @param root The node root (must not be <code>null</code>). @param function The collision function to export (must not be <code>null</code>). @throws LionEngineException If error on writing.
[ "Export", "the", "collision", "function", "data", "as", "a", "node", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionFunctionConfig.java#L83-L100
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.reverseKeyBuffer
public void reverseKeyBuffer(BaseBuffer bufferSource, int iAreaDesc) // Move these keys back to the record { """ Move the key area to the record. <pre> Remember to do the following: (before calling this method!) if (bufferSource != null) bufferSource.resetPosition(); </pre> @param destBuffer A BaseBuffer to fill with data (ignore if null). @param iAreaDesc The (optional) temporary area to copy the current fields to. """ boolean bForceUniqueKey = true; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false); for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); BaseField field = keyField.getField(DBConstants.FILE_KEY_AREA); BaseField paramField = keyField.getField(iAreaDesc); if (iAreaDesc != DBConstants.FILE_KEY_AREA) field.moveFieldToThis(paramField, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE); // Copy the value if (bufferSource != null) { bufferSource.getNextField(field, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE); // Read move ignores most behaviors } } }
java
public void reverseKeyBuffer(BaseBuffer bufferSource, int iAreaDesc) // Move these keys back to the record { boolean bForceUniqueKey = true; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false); for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); BaseField field = keyField.getField(DBConstants.FILE_KEY_AREA); BaseField paramField = keyField.getField(iAreaDesc); if (iAreaDesc != DBConstants.FILE_KEY_AREA) field.moveFieldToThis(paramField, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE); // Copy the value if (bufferSource != null) { bufferSource.getNextField(field, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE); // Read move ignores most behaviors } } }
[ "public", "void", "reverseKeyBuffer", "(", "BaseBuffer", "bufferSource", ",", "int", "iAreaDesc", ")", "// Move these keys back to the record", "{", "boolean", "bForceUniqueKey", "=", "true", ";", "int", "iKeyFieldCount", "=", "this", ".", "getKeyFields", "(", "bForceUniqueKey", ",", "false", ")", ";", "for", "(", "int", "iKeyFieldSeq", "=", "DBConstants", ".", "MAIN_KEY_FIELD", ";", "iKeyFieldSeq", "<", "iKeyFieldCount", ";", "iKeyFieldSeq", "++", ")", "{", "KeyField", "keyField", "=", "this", ".", "getKeyField", "(", "iKeyFieldSeq", ",", "bForceUniqueKey", ")", ";", "BaseField", "field", "=", "keyField", ".", "getField", "(", "DBConstants", ".", "FILE_KEY_AREA", ")", ";", "BaseField", "paramField", "=", "keyField", ".", "getField", "(", "iAreaDesc", ")", ";", "if", "(", "iAreaDesc", "!=", "DBConstants", ".", "FILE_KEY_AREA", ")", "field", ".", "moveFieldToThis", "(", "paramField", ",", "DBConstants", ".", "DONT_DISPLAY", ",", "DBConstants", ".", "READ_MOVE", ")", ";", "// Copy the value", "if", "(", "bufferSource", "!=", "null", ")", "{", "bufferSource", ".", "getNextField", "(", "field", ",", "DBConstants", ".", "DONT_DISPLAY", ",", "DBConstants", ".", "READ_MOVE", ")", ";", "// Read move ignores most behaviors", "}", "}", "}" ]
Move the key area to the record. <pre> Remember to do the following: (before calling this method!) if (bufferSource != null) bufferSource.resetPosition(); </pre> @param destBuffer A BaseBuffer to fill with data (ignore if null). @param iAreaDesc The (optional) temporary area to copy the current fields to.
[ "Move", "the", "key", "area", "to", "the", "record", ".", "<pre", ">", "Remember", "to", "do", "the", "following", ":", "(", "before", "calling", "this", "method!", ")", "if", "(", "bufferSource", "!", "=", "null", ")", "bufferSource", ".", "resetPosition", "()", ";", "<", "/", "pre", ">" ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L447-L463
vvakame/JsonPullParser
jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java
JsonModelCoder.encodeListNullToNull
public void encodeListNullToNull(Writer writer, List<? extends T> list) throws IOException { """ Encodes the given {@link List} of values into the JSON format, and writes it using the given writer.<br> Writes "null" if null is given. @param writer {@link Writer} to be used for writing value @param list {@link List} of values to be encoded @throws IOException """ if (list == null) { writer.write("null"); writer.flush(); return; } JsonUtil.startArray(writer); int size = list.size(); for (int i = 0; i < size; i++) { encodeNullToNull(writer, list.get(i)); if (i + 1 < size) { JsonUtil.addSeparator(writer); } } JsonUtil.endArray(writer); writer.flush(); }
java
public void encodeListNullToNull(Writer writer, List<? extends T> list) throws IOException { if (list == null) { writer.write("null"); writer.flush(); return; } JsonUtil.startArray(writer); int size = list.size(); for (int i = 0; i < size; i++) { encodeNullToNull(writer, list.get(i)); if (i + 1 < size) { JsonUtil.addSeparator(writer); } } JsonUtil.endArray(writer); writer.flush(); }
[ "public", "void", "encodeListNullToNull", "(", "Writer", "writer", ",", "List", "<", "?", "extends", "T", ">", "list", ")", "throws", "IOException", "{", "if", "(", "list", "==", "null", ")", "{", "writer", ".", "write", "(", "\"null\"", ")", ";", "writer", ".", "flush", "(", ")", ";", "return", ";", "}", "JsonUtil", ".", "startArray", "(", "writer", ")", ";", "int", "size", "=", "list", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "encodeNullToNull", "(", "writer", ",", "list", ".", "get", "(", "i", ")", ")", ";", "if", "(", "i", "+", "1", "<", "size", ")", "{", "JsonUtil", ".", "addSeparator", "(", "writer", ")", ";", "}", "}", "JsonUtil", ".", "endArray", "(", "writer", ")", ";", "writer", ".", "flush", "(", ")", ";", "}" ]
Encodes the given {@link List} of values into the JSON format, and writes it using the given writer.<br> Writes "null" if null is given. @param writer {@link Writer} to be used for writing value @param list {@link List} of values to be encoded @throws IOException
[ "Encodes", "the", "given", "{", "@link", "List", "}", "of", "values", "into", "the", "JSON", "format", "and", "writes", "it", "using", "the", "given", "writer", ".", "<br", ">", "Writes", "null", "if", "null", "is", "given", "." ]
train
https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java#L355-L376
spotify/helios
helios-services/src/main/java/com/spotify/helios/agent/ZooKeeperAgentModel.java
ZooKeeperAgentModel.getTaskStatus
@Override public TaskStatus getTaskStatus(final JobId jobId) { """ Get the {@link TaskStatus} for the job identified by {@code jobId}. """ final byte[] data = taskStatuses.get(jobId.toString()); if (data == null) { return null; } try { return parse(data, TaskStatus.class); } catch (IOException e) { throw new RuntimeException(e); } }
java
@Override public TaskStatus getTaskStatus(final JobId jobId) { final byte[] data = taskStatuses.get(jobId.toString()); if (data == null) { return null; } try { return parse(data, TaskStatus.class); } catch (IOException e) { throw new RuntimeException(e); } }
[ "@", "Override", "public", "TaskStatus", "getTaskStatus", "(", "final", "JobId", "jobId", ")", "{", "final", "byte", "[", "]", "data", "=", "taskStatuses", ".", "get", "(", "jobId", ".", "toString", "(", ")", ")", ";", "if", "(", "data", "==", "null", ")", "{", "return", "null", ";", "}", "try", "{", "return", "parse", "(", "data", ",", "TaskStatus", ".", "class", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Get the {@link TaskStatus} for the job identified by {@code jobId}.
[ "Get", "the", "{" ]
train
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/agent/ZooKeeperAgentModel.java#L180-L191
visallo/vertexium
security/src/main/java/org/vertexium/security/ByteSequence.java
ByteSequence.compareBytes
public static int compareBytes(ByteSequence bs1, ByteSequence bs2) { """ Compares the two given byte sequences, byte by byte, returning a negative, zero, or positive result if the first sequence is less than, equal to, or greater than the second. The comparison is performed starting with the first byte of each sequence, and proceeds until a pair of bytes differs, or one sequence runs out of byte (is shorter). A shorter sequence is considered less than a longer one. @param bs1 first byte sequence to compare @param bs2 second byte sequence to compare @return comparison result """ int minLen = Math.min(bs1.length(), bs2.length()); for (int i = 0; i < minLen; i++) { int a = (bs1.byteAt(i) & 0xff); int b = (bs2.byteAt(i) & 0xff); if (a != b) { return a - b; } } return bs1.length() - bs2.length(); }
java
public static int compareBytes(ByteSequence bs1, ByteSequence bs2) { int minLen = Math.min(bs1.length(), bs2.length()); for (int i = 0; i < minLen; i++) { int a = (bs1.byteAt(i) & 0xff); int b = (bs2.byteAt(i) & 0xff); if (a != b) { return a - b; } } return bs1.length() - bs2.length(); }
[ "public", "static", "int", "compareBytes", "(", "ByteSequence", "bs1", ",", "ByteSequence", "bs2", ")", "{", "int", "minLen", "=", "Math", ".", "min", "(", "bs1", ".", "length", "(", ")", ",", "bs2", ".", "length", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "minLen", ";", "i", "++", ")", "{", "int", "a", "=", "(", "bs1", ".", "byteAt", "(", "i", ")", "&", "0xff", ")", ";", "int", "b", "=", "(", "bs2", ".", "byteAt", "(", "i", ")", "&", "0xff", ")", ";", "if", "(", "a", "!=", "b", ")", "{", "return", "a", "-", "b", ";", "}", "}", "return", "bs1", ".", "length", "(", ")", "-", "bs2", ".", "length", "(", ")", ";", "}" ]
Compares the two given byte sequences, byte by byte, returning a negative, zero, or positive result if the first sequence is less than, equal to, or greater than the second. The comparison is performed starting with the first byte of each sequence, and proceeds until a pair of bytes differs, or one sequence runs out of byte (is shorter). A shorter sequence is considered less than a longer one. @param bs1 first byte sequence to compare @param bs2 second byte sequence to compare @return comparison result
[ "Compares", "the", "two", "given", "byte", "sequences", "byte", "by", "byte", "returning", "a", "negative", "zero", "or", "positive", "result", "if", "the", "first", "sequence", "is", "less", "than", "equal", "to", "or", "greater", "than", "the", "second", ".", "The", "comparison", "is", "performed", "starting", "with", "the", "first", "byte", "of", "each", "sequence", "and", "proceeds", "until", "a", "pair", "of", "bytes", "differs", "or", "one", "sequence", "runs", "out", "of", "byte", "(", "is", "shorter", ")", ".", "A", "shorter", "sequence", "is", "considered", "less", "than", "a", "longer", "one", "." ]
train
https://github.com/visallo/vertexium/blob/bb132b5425ac168957667164e1409b78adbea769/security/src/main/java/org/vertexium/security/ByteSequence.java#L90-L104
asterisk-java/asterisk-java
src/main/java/org/asteriskjava/fastagi/AbstractAgiServer.java
AbstractAgiServer.createPool
protected ThreadPoolExecutor createPool() { """ Creates a new ThreadPoolExecutor to serve the AGI requests. The nature of this pool defines how many concurrent requests can be handled. The default implementation returns a dynamic thread pool defined by the poolSize and maximumPoolSize properties. <p> You can override this method to change this behavior. For example you can use a cached pool with <pre> return Executors.newCachedThreadPool(new DaemonThreadFactory()); </pre> @return the ThreadPoolExecutor to use for serving AGI requests. @see #setPoolSize(int) @see #setMaximumPoolSize(int) """ return new ThreadPoolExecutor(poolSize, (maximumPoolSize < poolSize) ? poolSize : maximumPoolSize, 50000L, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>(), new DaemonThreadFactory()); }
java
protected ThreadPoolExecutor createPool() { return new ThreadPoolExecutor(poolSize, (maximumPoolSize < poolSize) ? poolSize : maximumPoolSize, 50000L, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>(), new DaemonThreadFactory()); }
[ "protected", "ThreadPoolExecutor", "createPool", "(", ")", "{", "return", "new", "ThreadPoolExecutor", "(", "poolSize", ",", "(", "maximumPoolSize", "<", "poolSize", ")", "?", "poolSize", ":", "maximumPoolSize", ",", "50000L", ",", "TimeUnit", ".", "MILLISECONDS", ",", "new", "SynchronousQueue", "<", "Runnable", ">", "(", ")", ",", "new", "DaemonThreadFactory", "(", ")", ")", ";", "}" ]
Creates a new ThreadPoolExecutor to serve the AGI requests. The nature of this pool defines how many concurrent requests can be handled. The default implementation returns a dynamic thread pool defined by the poolSize and maximumPoolSize properties. <p> You can override this method to change this behavior. For example you can use a cached pool with <pre> return Executors.newCachedThreadPool(new DaemonThreadFactory()); </pre> @return the ThreadPoolExecutor to use for serving AGI requests. @see #setPoolSize(int) @see #setMaximumPoolSize(int)
[ "Creates", "a", "new", "ThreadPoolExecutor", "to", "serve", "the", "AGI", "requests", ".", "The", "nature", "of", "this", "pool", "defines", "how", "many", "concurrent", "requests", "can", "be", "handled", ".", "The", "default", "implementation", "returns", "a", "dynamic", "thread", "pool", "defined", "by", "the", "poolSize", "and", "maximumPoolSize", "properties", ".", "<p", ">", "You", "can", "override", "this", "method", "to", "change", "this", "behavior", ".", "For", "example", "you", "can", "use", "a", "cached", "pool", "with" ]
train
https://github.com/asterisk-java/asterisk-java/blob/cdc9849270d97ef75afa447a02c5194ed29121eb/src/main/java/org/asteriskjava/fastagi/AbstractAgiServer.java#L293-L297
Mangopay/mangopay2-java-sdk
src/main/java/com/mangopay/core/APIs/ApiBase.java
ApiBase.createObject
protected <T extends Dto> T createObject(Class<T> classOfT, String idempotencyKey, String methodKey, T entity) throws Exception { """ Creates the Dto instance. @param <T> Type on behalf of which the request is being called. @param classOfT Type on behalf of which the request is being called. @param idempotencyKey idempotency key for this request. @param methodKey Relevant method key. @param entity Dto instance that is going to be sent. @return The Dto instance returned from API. @throws Exception """ return createObject(classOfT, idempotencyKey, methodKey, entity, ""); }
java
protected <T extends Dto> T createObject(Class<T> classOfT, String idempotencyKey, String methodKey, T entity) throws Exception { return createObject(classOfT, idempotencyKey, methodKey, entity, ""); }
[ "protected", "<", "T", "extends", "Dto", ">", "T", "createObject", "(", "Class", "<", "T", ">", "classOfT", ",", "String", "idempotencyKey", ",", "String", "methodKey", ",", "T", "entity", ")", "throws", "Exception", "{", "return", "createObject", "(", "classOfT", ",", "idempotencyKey", ",", "methodKey", ",", "entity", ",", "\"\"", ")", ";", "}" ]
Creates the Dto instance. @param <T> Type on behalf of which the request is being called. @param classOfT Type on behalf of which the request is being called. @param idempotencyKey idempotency key for this request. @param methodKey Relevant method key. @param entity Dto instance that is going to be sent. @return The Dto instance returned from API. @throws Exception
[ "Creates", "the", "Dto", "instance", "." ]
train
https://github.com/Mangopay/mangopay2-java-sdk/blob/037cecb44ea62def63b507817fd9961649151157/src/main/java/com/mangopay/core/APIs/ApiBase.java#L273-L275
citrusframework/citrus
modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/data/DataSetCreator.java
DataSetCreator.createDataSet
public DataSet createDataSet(final Message response, final MessageType messageType) { """ Converts Citrus result set representation to db driver model result set. @param response The result set to convert @return A DataSet the jdbc driver can understand """ try { if (response.getPayload() instanceof DataSet) { return response.getPayload(DataSet.class); } else if (isReadyToMarshal(response, messageType)) { return marshalResponse(response, messageType); } else { return new DataSet(); } } catch (final SQLException e) { throw new CitrusRuntimeException("Failed to read dataSet from response message", e); } }
java
public DataSet createDataSet(final Message response, final MessageType messageType) { try { if (response.getPayload() instanceof DataSet) { return response.getPayload(DataSet.class); } else if (isReadyToMarshal(response, messageType)) { return marshalResponse(response, messageType); } else { return new DataSet(); } } catch (final SQLException e) { throw new CitrusRuntimeException("Failed to read dataSet from response message", e); } }
[ "public", "DataSet", "createDataSet", "(", "final", "Message", "response", ",", "final", "MessageType", "messageType", ")", "{", "try", "{", "if", "(", "response", ".", "getPayload", "(", ")", "instanceof", "DataSet", ")", "{", "return", "response", ".", "getPayload", "(", "DataSet", ".", "class", ")", ";", "}", "else", "if", "(", "isReadyToMarshal", "(", "response", ",", "messageType", ")", ")", "{", "return", "marshalResponse", "(", "response", ",", "messageType", ")", ";", "}", "else", "{", "return", "new", "DataSet", "(", ")", ";", "}", "}", "catch", "(", "final", "SQLException", "e", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Failed to read dataSet from response message\"", ",", "e", ")", ";", "}", "}" ]
Converts Citrus result set representation to db driver model result set. @param response The result set to convert @return A DataSet the jdbc driver can understand
[ "Converts", "Citrus", "result", "set", "representation", "to", "db", "driver", "model", "result", "set", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-jdbc/src/main/java/com/consol/citrus/jdbc/data/DataSetCreator.java#L42-L54
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/execution/librarycache/LibraryCacheManager.java
LibraryCacheManager.writeLibraryToStream
public static void writeLibraryToStream(final String libraryFileName, final DataOutput out) throws IOException { """ Writes data from the library with the given file name to the specified stream. @param libraryFileName the name of the library @param out the stream to write the data to @throws IOException thrown if an error occurs while writing the data """ final LibraryCacheManager lib = get(); lib.writeLibraryToStreamInternal(libraryFileName, out); }
java
public static void writeLibraryToStream(final String libraryFileName, final DataOutput out) throws IOException { final LibraryCacheManager lib = get(); lib.writeLibraryToStreamInternal(libraryFileName, out); }
[ "public", "static", "void", "writeLibraryToStream", "(", "final", "String", "libraryFileName", ",", "final", "DataOutput", "out", ")", "throws", "IOException", "{", "final", "LibraryCacheManager", "lib", "=", "get", "(", ")", ";", "lib", ".", "writeLibraryToStreamInternal", "(", "libraryFileName", ",", "out", ")", ";", "}" ]
Writes data from the library with the given file name to the specified stream. @param libraryFileName the name of the library @param out the stream to write the data to @throws IOException thrown if an error occurs while writing the data
[ "Writes", "data", "from", "the", "library", "with", "the", "given", "file", "name", "to", "the", "specified", "stream", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/execution/librarycache/LibraryCacheManager.java#L497-L502
airomem/airomem
airomem-core/src/main/java/pl/setblack/airomem/core/impl/PersistenceControllerImpl.java
PersistenceControllerImpl.executeAndQuery
@Override public <R> R executeAndQuery(Command<ROOT, R> cmd) { """ Perform command on system. <p> Inside command can be any code doing any changes. Such changes are guaranteed to be preserved (if only command ended without exception). @param cmd """ return this.executeAndQuery((ContextCommand<ROOT, R>) cmd); }
java
@Override public <R> R executeAndQuery(Command<ROOT, R> cmd) { return this.executeAndQuery((ContextCommand<ROOT, R>) cmd); }
[ "@", "Override", "public", "<", "R", ">", "R", "executeAndQuery", "(", "Command", "<", "ROOT", ",", "R", ">", "cmd", ")", "{", "return", "this", ".", "executeAndQuery", "(", "(", "ContextCommand", "<", "ROOT", ",", "R", ">", ")", "cmd", ")", ";", "}" ]
Perform command on system. <p> Inside command can be any code doing any changes. Such changes are guaranteed to be preserved (if only command ended without exception). @param cmd
[ "Perform", "command", "on", "system", ".", "<p", ">", "Inside", "command", "can", "be", "any", "code", "doing", "any", "changes", ".", "Such", "changes", "are", "guaranteed", "to", "be", "preserved", "(", "if", "only", "command", "ended", "without", "exception", ")", "." ]
train
https://github.com/airomem/airomem/blob/281ce18ff64836fccfb0edab18b8d677f1101a32/airomem-core/src/main/java/pl/setblack/airomem/core/impl/PersistenceControllerImpl.java#L108-L111
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.getAsync
public CompletableFuture<Object> getAsync(final Consumer<HttpConfig> configuration) { """ Executes an asynchronous GET request on the configured URI (asynchronous alias to `get(Consumer)`), with additional configuration provided by the configuration function. This method is generally used for Java-specific configuration. [source,java] ---- HttpBuilder http = HttpBuilder.configure(config -> { config.getRequest().setUri("http://localhost:10101"); }); CompletableFuture<Object> future = http.getAsync(config -> { config.getRequest().getUri().setPath("/foo"); }); Object result = future.get(); ---- The `configuration` function allows additional configuration for this request based on the {@link HttpConfig} interface. @param configuration the additional configuration closure (delegated to {@link HttpConfig}) @return the resulting content wrapped in a {@link CompletableFuture} """ return CompletableFuture.supplyAsync(() -> get(configuration), getExecutor()); }
java
public CompletableFuture<Object> getAsync(final Consumer<HttpConfig> configuration) { return CompletableFuture.supplyAsync(() -> get(configuration), getExecutor()); }
[ "public", "CompletableFuture", "<", "Object", ">", "getAsync", "(", "final", "Consumer", "<", "HttpConfig", ">", "configuration", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(", ")", "->", "get", "(", "configuration", ")", ",", "getExecutor", "(", ")", ")", ";", "}" ]
Executes an asynchronous GET request on the configured URI (asynchronous alias to `get(Consumer)`), with additional configuration provided by the configuration function. This method is generally used for Java-specific configuration. [source,java] ---- HttpBuilder http = HttpBuilder.configure(config -> { config.getRequest().setUri("http://localhost:10101"); }); CompletableFuture<Object> future = http.getAsync(config -> { config.getRequest().getUri().setPath("/foo"); }); Object result = future.get(); ---- The `configuration` function allows additional configuration for this request based on the {@link HttpConfig} interface. @param configuration the additional configuration closure (delegated to {@link HttpConfig}) @return the resulting content wrapped in a {@link CompletableFuture}
[ "Executes", "an", "asynchronous", "GET", "request", "on", "the", "configured", "URI", "(", "asynchronous", "alias", "to", "get", "(", "Consumer", ")", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "function", "." ]
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L440-L442
line/centraldogma
server/src/main/java/com/linecorp/centraldogma/server/internal/api/ContentServiceV1.java
ContentServiceV1.getFiles
@Get("regex:/projects/(?<projectName>[^/]+)/repos/(?<repoName>[^/]+)/contents(?<path>(|/.*))$") public CompletableFuture<?> getFiles( @Param("path") String path, @Param("revision") @Default("-1") String revision, Repository repository, @RequestConverter(WatchRequestConverter.class) Optional<WatchRequest> watchRequest, @RequestConverter(QueryRequestConverter.class) Optional<Query<?>> query) { """ GET /projects/{projectName}/repos/{repoName}/contents{path}?revision={revision}&amp; jsonpath={jsonpath} <p>Returns the entry of files in the path. This is same with {@link #listFiles(String, String, Repository)} except that containing the content of the files. Note that if the {@link HttpHeaderNames#IF_NONE_MATCH} in which has a revision is sent with, this will await for the time specified in {@link HttpHeaderNames#PREFER}. During the time if the specified revision becomes different with the latest revision, this will response back right away to the client. {@link HttpStatus#NOT_MODIFIED} otherwise. """ final String normalizedPath = normalizePath(path); // watch repository or a file if (watchRequest.isPresent()) { final Revision lastKnownRevision = watchRequest.get().lastKnownRevision(); final long timeOutMillis = watchRequest.get().timeoutMillis(); if (query.isPresent()) { return watchFile(repository, lastKnownRevision, query.get(), timeOutMillis); } return watchRepository(repository, lastKnownRevision, normalizedPath, timeOutMillis); } final Revision normalizedRev = repository.normalizeNow(new Revision(revision)); if (query.isPresent()) { // get a file return repository.get(normalizedRev, query.get()) .handle(returnOrThrow((Entry<?> result) -> convert(repository, normalizedRev, result, true))); } // get files final CompletableFuture<List<EntryDto<?>>> future = new CompletableFuture<>(); listFiles(repository, normalizedPath, normalizedRev, true, future); return future; }
java
@Get("regex:/projects/(?<projectName>[^/]+)/repos/(?<repoName>[^/]+)/contents(?<path>(|/.*))$") public CompletableFuture<?> getFiles( @Param("path") String path, @Param("revision") @Default("-1") String revision, Repository repository, @RequestConverter(WatchRequestConverter.class) Optional<WatchRequest> watchRequest, @RequestConverter(QueryRequestConverter.class) Optional<Query<?>> query) { final String normalizedPath = normalizePath(path); // watch repository or a file if (watchRequest.isPresent()) { final Revision lastKnownRevision = watchRequest.get().lastKnownRevision(); final long timeOutMillis = watchRequest.get().timeoutMillis(); if (query.isPresent()) { return watchFile(repository, lastKnownRevision, query.get(), timeOutMillis); } return watchRepository(repository, lastKnownRevision, normalizedPath, timeOutMillis); } final Revision normalizedRev = repository.normalizeNow(new Revision(revision)); if (query.isPresent()) { // get a file return repository.get(normalizedRev, query.get()) .handle(returnOrThrow((Entry<?> result) -> convert(repository, normalizedRev, result, true))); } // get files final CompletableFuture<List<EntryDto<?>>> future = new CompletableFuture<>(); listFiles(repository, normalizedPath, normalizedRev, true, future); return future; }
[ "@", "Get", "(", "\"regex:/projects/(?<projectName>[^/]+)/repos/(?<repoName>[^/]+)/contents(?<path>(|/.*))$\"", ")", "public", "CompletableFuture", "<", "?", ">", "getFiles", "(", "@", "Param", "(", "\"path\"", ")", "String", "path", ",", "@", "Param", "(", "\"revision\"", ")", "@", "Default", "(", "\"-1\"", ")", "String", "revision", ",", "Repository", "repository", ",", "@", "RequestConverter", "(", "WatchRequestConverter", ".", "class", ")", "Optional", "<", "WatchRequest", ">", "watchRequest", ",", "@", "RequestConverter", "(", "QueryRequestConverter", ".", "class", ")", "Optional", "<", "Query", "<", "?", ">", ">", "query", ")", "{", "final", "String", "normalizedPath", "=", "normalizePath", "(", "path", ")", ";", "// watch repository or a file", "if", "(", "watchRequest", ".", "isPresent", "(", ")", ")", "{", "final", "Revision", "lastKnownRevision", "=", "watchRequest", ".", "get", "(", ")", ".", "lastKnownRevision", "(", ")", ";", "final", "long", "timeOutMillis", "=", "watchRequest", ".", "get", "(", ")", ".", "timeoutMillis", "(", ")", ";", "if", "(", "query", ".", "isPresent", "(", ")", ")", "{", "return", "watchFile", "(", "repository", ",", "lastKnownRevision", ",", "query", ".", "get", "(", ")", ",", "timeOutMillis", ")", ";", "}", "return", "watchRepository", "(", "repository", ",", "lastKnownRevision", ",", "normalizedPath", ",", "timeOutMillis", ")", ";", "}", "final", "Revision", "normalizedRev", "=", "repository", ".", "normalizeNow", "(", "new", "Revision", "(", "revision", ")", ")", ";", "if", "(", "query", ".", "isPresent", "(", ")", ")", "{", "// get a file", "return", "repository", ".", "get", "(", "normalizedRev", ",", "query", ".", "get", "(", ")", ")", ".", "handle", "(", "returnOrThrow", "(", "(", "Entry", "<", "?", ">", "result", ")", "->", "convert", "(", "repository", ",", "normalizedRev", ",", "result", ",", "true", ")", ")", ")", ";", "}", "// get files", "final", "CompletableFuture", "<", "List", "<", "EntryDto", "<", "?", ">", ">", ">", "future", "=", "new", "CompletableFuture", "<>", "(", ")", ";", "listFiles", "(", "repository", ",", "normalizedPath", ",", "normalizedRev", ",", "true", ",", "future", ")", ";", "return", "future", ";", "}" ]
GET /projects/{projectName}/repos/{repoName}/contents{path}?revision={revision}&amp; jsonpath={jsonpath} <p>Returns the entry of files in the path. This is same with {@link #listFiles(String, String, Repository)} except that containing the content of the files. Note that if the {@link HttpHeaderNames#IF_NONE_MATCH} in which has a revision is sent with, this will await for the time specified in {@link HttpHeaderNames#PREFER}. During the time if the specified revision becomes different with the latest revision, this will response back right away to the client. {@link HttpStatus#NOT_MODIFIED} otherwise.
[ "GET", "/", "projects", "/", "{", "projectName", "}", "/", "repos", "/", "{", "repoName", "}", "/", "contents", "{", "path", "}", "?revision", "=", "{", "revision", "}", "&amp", ";", "jsonpath", "=", "{", "jsonpath", "}" ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/server/src/main/java/com/linecorp/centraldogma/server/internal/api/ContentServiceV1.java#L223-L254
aws/aws-sdk-java
aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/util/StepFactory.java
StepFactory.newScriptRunnerStep
public HadoopJarStepConfig newScriptRunnerStep(String script, String... args) { """ Runs a specified script on the master node of your cluster. @param script The script to run. @param args Arguments that get passed to the script. @return HadoopJarStepConfig that can be passed to your job flow. """ List<String> argsList = new ArrayList<String>(); argsList.add(script); for (String arg : args) { argsList.add(arg); } return new HadoopJarStepConfig() .withJar("s3://" + bucket + "/libs/script-runner/script-runner.jar") .withArgs(argsList); }
java
public HadoopJarStepConfig newScriptRunnerStep(String script, String... args) { List<String> argsList = new ArrayList<String>(); argsList.add(script); for (String arg : args) { argsList.add(arg); } return new HadoopJarStepConfig() .withJar("s3://" + bucket + "/libs/script-runner/script-runner.jar") .withArgs(argsList); }
[ "public", "HadoopJarStepConfig", "newScriptRunnerStep", "(", "String", "script", ",", "String", "...", "args", ")", "{", "List", "<", "String", ">", "argsList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "argsList", ".", "add", "(", "script", ")", ";", "for", "(", "String", "arg", ":", "args", ")", "{", "argsList", ".", "add", "(", "arg", ")", ";", "}", "return", "new", "HadoopJarStepConfig", "(", ")", ".", "withJar", "(", "\"s3://\"", "+", "bucket", "+", "\"/libs/script-runner/script-runner.jar\"", ")", ".", "withArgs", "(", "argsList", ")", ";", "}" ]
Runs a specified script on the master node of your cluster. @param script The script to run. @param args Arguments that get passed to the script. @return HadoopJarStepConfig that can be passed to your job flow.
[ "Runs", "a", "specified", "script", "on", "the", "master", "node", "of", "your", "cluster", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/util/StepFactory.java#L132-L141
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java
DomHelper.createOrUpdateGroup
public Element createOrUpdateGroup(Object parent, Object object, Matrix transformation, Style style) { """ Creates a group element in the technology (SVG/VML/...) of this context. A group is meant to group other elements together. Also this method gives you the opportunity to specify a specific width and height. @param parent parent group object @param object group object @param transformation On each group, it is possible to apply a matrix transformation (currently translation only). This is the real strength of a group element. Never apply transformations on any other kind of element. @param style Add a style to a group. @return the group element """ switch (namespace) { case SVG: return createSvgGroup(parent, object, transformation, style); case VML: return createVmlGroup(parent, object, transformation); case HTML: default: return createHtmlGroup(parent, object, transformation, style); } }
java
public Element createOrUpdateGroup(Object parent, Object object, Matrix transformation, Style style) { switch (namespace) { case SVG: return createSvgGroup(parent, object, transformation, style); case VML: return createVmlGroup(parent, object, transformation); case HTML: default: return createHtmlGroup(parent, object, transformation, style); } }
[ "public", "Element", "createOrUpdateGroup", "(", "Object", "parent", ",", "Object", "object", ",", "Matrix", "transformation", ",", "Style", "style", ")", "{", "switch", "(", "namespace", ")", "{", "case", "SVG", ":", "return", "createSvgGroup", "(", "parent", ",", "object", ",", "transformation", ",", "style", ")", ";", "case", "VML", ":", "return", "createVmlGroup", "(", "parent", ",", "object", ",", "transformation", ")", ";", "case", "HTML", ":", "default", ":", "return", "createHtmlGroup", "(", "parent", ",", "object", ",", "transformation", ",", "style", ")", ";", "}", "}" ]
Creates a group element in the technology (SVG/VML/...) of this context. A group is meant to group other elements together. Also this method gives you the opportunity to specify a specific width and height. @param parent parent group object @param object group object @param transformation On each group, it is possible to apply a matrix transformation (currently translation only). This is the real strength of a group element. Never apply transformations on any other kind of element. @param style Add a style to a group. @return the group element
[ "Creates", "a", "group", "element", "in", "the", "technology", "(", "SVG", "/", "VML", "/", "...", ")", "of", "this", "context", ".", "A", "group", "is", "meant", "to", "group", "other", "elements", "together", ".", "Also", "this", "method", "gives", "you", "the", "opportunity", "to", "specify", "a", "specific", "width", "and", "height", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/context/DomHelper.java#L336-L346
pushbit/sprockets
src/main/java/net/sf/sprockets/sql/Statements.java
Statements.setLongs
public static PreparedStatement setLongs(int index, PreparedStatement stmt, long... params) throws SQLException { """ Set the statement parameters, starting at the index, in the order of the params. @since 3.0.0 """ return set(index, stmt, null, params, null); }
java
public static PreparedStatement setLongs(int index, PreparedStatement stmt, long... params) throws SQLException { return set(index, stmt, null, params, null); }
[ "public", "static", "PreparedStatement", "setLongs", "(", "int", "index", ",", "PreparedStatement", "stmt", ",", "long", "...", "params", ")", "throws", "SQLException", "{", "return", "set", "(", "index", ",", "stmt", ",", "null", ",", "params", ",", "null", ")", ";", "}" ]
Set the statement parameters, starting at the index, in the order of the params. @since 3.0.0
[ "Set", "the", "statement", "parameters", "starting", "at", "the", "index", "in", "the", "order", "of", "the", "params", "." ]
train
https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/Statements.java#L80-L83
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ColumnList.java
ColumnList.getAlias
private String getAlias(String schema, String table, String column, int stepDepth) { """ get an alias if the column is already in the list @param schema @param table @param column @return """ //PropertyType is not part of equals or hashCode so not needed for the lookup. Column c = new Column(schema, table, column, null, stepDepth); return columns.get(c); }
java
private String getAlias(String schema, String table, String column, int stepDepth) { //PropertyType is not part of equals or hashCode so not needed for the lookup. Column c = new Column(schema, table, column, null, stepDepth); return columns.get(c); }
[ "private", "String", "getAlias", "(", "String", "schema", ",", "String", "table", ",", "String", "column", ",", "int", "stepDepth", ")", "{", "//PropertyType is not part of equals or hashCode so not needed for the lookup.", "Column", "c", "=", "new", "Column", "(", "schema", ",", "table", ",", "column", ",", "null", ",", "stepDepth", ")", ";", "return", "columns", ".", "get", "(", "c", ")", ";", "}" ]
get an alias if the column is already in the list @param schema @param table @param column @return
[ "get", "an", "alias", "if", "the", "column", "is", "already", "in", "the", "list" ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/sql/parse/ColumnList.java#L152-L156
att/AAF
authz/authz-cass/src/main/java/com/att/dao/aaf/cass/HistoryDAO.java
HistoryDAO.readByUser
public Result<List<Data>> readByUser(AuthzTrans trans, String user, int ... yyyymm) { """ Gets the history for a user in the specified year and month year - the year in yyyy format month - the month in a year ...values 1 - 12 """ if(yyyymm.length==0) { return Result.err(Status.ERR_BadData, "No or invalid yyyymm specified"); } Result<ResultSet> rs = readByUser.exec(trans, "user", user); if(rs.notOK()) { return Result.err(rs); } return extract(defLoader,rs.value,null,yyyymm.length>0?new YYYYMM(yyyymm):dflt); }
java
public Result<List<Data>> readByUser(AuthzTrans trans, String user, int ... yyyymm) { if(yyyymm.length==0) { return Result.err(Status.ERR_BadData, "No or invalid yyyymm specified"); } Result<ResultSet> rs = readByUser.exec(trans, "user", user); if(rs.notOK()) { return Result.err(rs); } return extract(defLoader,rs.value,null,yyyymm.length>0?new YYYYMM(yyyymm):dflt); }
[ "public", "Result", "<", "List", "<", "Data", ">", ">", "readByUser", "(", "AuthzTrans", "trans", ",", "String", "user", ",", "int", "...", "yyyymm", ")", "{", "if", "(", "yyyymm", ".", "length", "==", "0", ")", "{", "return", "Result", ".", "err", "(", "Status", ".", "ERR_BadData", ",", "\"No or invalid yyyymm specified\"", ")", ";", "}", "Result", "<", "ResultSet", ">", "rs", "=", "readByUser", ".", "exec", "(", "trans", ",", "\"user\"", ",", "user", ")", ";", "if", "(", "rs", ".", "notOK", "(", ")", ")", "{", "return", "Result", ".", "err", "(", "rs", ")", ";", "}", "return", "extract", "(", "defLoader", ",", "rs", ".", "value", ",", "null", ",", "yyyymm", ".", "length", ">", "0", "?", "new", "YYYYMM", "(", "yyyymm", ")", ":", "dflt", ")", ";", "}" ]
Gets the history for a user in the specified year and month year - the year in yyyy format month - the month in a year ...values 1 - 12
[ "Gets", "the", "history", "for", "a", "user", "in", "the", "specified", "year", "and", "month", "year", "-", "the", "year", "in", "yyyy", "format", "month", "-", "the", "month", "in", "a", "year", "...", "values", "1", "-", "12" ]
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/aaf/cass/HistoryDAO.java#L177-L186
spring-cloud/spring-cloud-aws
spring-cloud-aws-messaging/src/main/java/org/springframework/cloud/aws/messaging/core/NotificationMessagingTemplate.java
NotificationMessagingTemplate.sendNotification
public void sendNotification(Object message, String subject) { """ Convenience method that sends a notification with the given {@literal message} and {@literal subject} to the {@literal destination}. The {@literal subject} is sent as header as defined in the <a href="https://docs.aws.amazon.com/sns/latest/dg/json-formats.html">SNS message JSON formats</a>. The configured default destination will be used. @param message The message to send @param subject The subject to send """ this.convertAndSend(getRequiredDefaultDestination(), message, Collections .singletonMap(TopicMessageChannel.NOTIFICATION_SUBJECT_HEADER, subject)); }
java
public void sendNotification(Object message, String subject) { this.convertAndSend(getRequiredDefaultDestination(), message, Collections .singletonMap(TopicMessageChannel.NOTIFICATION_SUBJECT_HEADER, subject)); }
[ "public", "void", "sendNotification", "(", "Object", "message", ",", "String", "subject", ")", "{", "this", ".", "convertAndSend", "(", "getRequiredDefaultDestination", "(", ")", ",", "message", ",", "Collections", ".", "singletonMap", "(", "TopicMessageChannel", ".", "NOTIFICATION_SUBJECT_HEADER", ",", "subject", ")", ")", ";", "}" ]
Convenience method that sends a notification with the given {@literal message} and {@literal subject} to the {@literal destination}. The {@literal subject} is sent as header as defined in the <a href="https://docs.aws.amazon.com/sns/latest/dg/json-formats.html">SNS message JSON formats</a>. The configured default destination will be used. @param message The message to send @param subject The subject to send
[ "Convenience", "method", "that", "sends", "a", "notification", "with", "the", "given", "{" ]
train
https://github.com/spring-cloud/spring-cloud-aws/blob/26f7ca6c29ac66922f64b37c2bc5ce6f842462ee/spring-cloud-aws-messaging/src/main/java/org/springframework/cloud/aws/messaging/core/NotificationMessagingTemplate.java#L92-L95
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java
EmulatedFields.get
public int get(String name, int defaultValue) throws IllegalArgumentException { """ Finds and returns the int value of a given field named {@code name} in the receiver. If the field has not been assigned any value yet, the default value {@code defaultValue} is returned instead. @param name the name of the field to find. @param defaultValue return value in case the field has not been assigned to yet. @return the value of the given field if it has been assigned, the default value otherwise. @throws IllegalArgumentException if the corresponding field can not be found. """ ObjectSlot slot = findMandatorySlot(name, int.class); return slot.defaulted ? defaultValue : ((Integer) slot.fieldValue).intValue(); }
java
public int get(String name, int defaultValue) throws IllegalArgumentException { ObjectSlot slot = findMandatorySlot(name, int.class); return slot.defaulted ? defaultValue : ((Integer) slot.fieldValue).intValue(); }
[ "public", "int", "get", "(", "String", "name", ",", "int", "defaultValue", ")", "throws", "IllegalArgumentException", "{", "ObjectSlot", "slot", "=", "findMandatorySlot", "(", "name", ",", "int", ".", "class", ")", ";", "return", "slot", ".", "defaulted", "?", "defaultValue", ":", "(", "(", "Integer", ")", "slot", ".", "fieldValue", ")", ".", "intValue", "(", ")", ";", "}" ]
Finds and returns the int value of a given field named {@code name} in the receiver. If the field has not been assigned any value yet, the default value {@code defaultValue} is returned instead. @param name the name of the field to find. @param defaultValue return value in case the field has not been assigned to yet. @return the value of the given field if it has been assigned, the default value otherwise. @throws IllegalArgumentException if the corresponding field can not be found.
[ "Finds", "and", "returns", "the", "int", "value", "of", "a", "given", "field", "named", "{", "@code", "name", "}", "in", "the", "receiver", ".", "If", "the", "field", "has", "not", "been", "assigned", "any", "value", "yet", "the", "default", "value", "{", "@code", "defaultValue", "}", "is", "returned", "instead", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFields.java#L288-L291
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureParser.java
SignatureParser.getNumParametersForInvocation
public static int getNumParametersForInvocation(InvokeInstruction inv, ConstantPoolGen cpg) { """ Get the number of parameters passed to method invocation. @param inv @param cpg @return int number of parameters """ SignatureParser sigParser = new SignatureParser(inv.getSignature(cpg)); return sigParser.getNumParameters(); }
java
public static int getNumParametersForInvocation(InvokeInstruction inv, ConstantPoolGen cpg) { SignatureParser sigParser = new SignatureParser(inv.getSignature(cpg)); return sigParser.getNumParameters(); }
[ "public", "static", "int", "getNumParametersForInvocation", "(", "InvokeInstruction", "inv", ",", "ConstantPoolGen", "cpg", ")", "{", "SignatureParser", "sigParser", "=", "new", "SignatureParser", "(", "inv", ".", "getSignature", "(", "cpg", ")", ")", ";", "return", "sigParser", ".", "getNumParameters", "(", ")", ";", "}" ]
Get the number of parameters passed to method invocation. @param inv @param cpg @return int number of parameters
[ "Get", "the", "number", "of", "parameters", "passed", "to", "method", "invocation", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureParser.java#L249-L252
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/GrowingSparseMatrix.java
GrowingSparseMatrix.set
public void set(int row, int col, double val) { """ {@inheritDoc} <p>The size of the matrix will be expanded if either row or col is larger than the largest previously seen row or column value. When the matrix is expanded by either dimension, the values for the new row/column will all be assumed to be zero. """ checkIndices(row, col); // Check whether the dimensions need to be updated if (row + 1 > rows) rows = row + 1; if (col + 1 > cols) cols = col + 1; updateRow(row).set(col, val); }
java
public void set(int row, int col, double val) { checkIndices(row, col); // Check whether the dimensions need to be updated if (row + 1 > rows) rows = row + 1; if (col + 1 > cols) cols = col + 1; updateRow(row).set(col, val); }
[ "public", "void", "set", "(", "int", "row", ",", "int", "col", ",", "double", "val", ")", "{", "checkIndices", "(", "row", ",", "col", ")", ";", "// Check whether the dimensions need to be updated", "if", "(", "row", "+", "1", ">", "rows", ")", "rows", "=", "row", "+", "1", ";", "if", "(", "col", "+", "1", ">", "cols", ")", "cols", "=", "col", "+", "1", ";", "updateRow", "(", "row", ")", ".", "set", "(", "col", ",", "val", ")", ";", "}" ]
{@inheritDoc} <p>The size of the matrix will be expanded if either row or col is larger than the largest previously seen row or column value. When the matrix is expanded by either dimension, the values for the new row/column will all be assumed to be zero.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/GrowingSparseMatrix.java#L200-L210
alkacon/opencms-core
src-modules/org/opencms/workplace/CmsWidgetDialog.java
CmsWidgetDialog.buildRemoveElement
public String buildRemoveElement(String elementName, int index, boolean enabled) { """ Returns the html for a button to remove an optional element.<p> @param elementName name of the element @param index the element index of the element to remove @param enabled if true, the button to remove an element is shown, otherwise a spacer is returned @return the html for a button to remove an optional element """ if (enabled) { StringBuffer href = new StringBuffer(4); href.append("javascript:removeElement('"); href.append(elementName); href.append("', "); href.append(index); href.append(");"); return button(href.toString(), null, "deletecontent.png", Messages.GUI_DIALOG_BUTTON_DELETE_0, 0); } else { return ""; } }
java
public String buildRemoveElement(String elementName, int index, boolean enabled) { if (enabled) { StringBuffer href = new StringBuffer(4); href.append("javascript:removeElement('"); href.append(elementName); href.append("', "); href.append(index); href.append(");"); return button(href.toString(), null, "deletecontent.png", Messages.GUI_DIALOG_BUTTON_DELETE_0, 0); } else { return ""; } }
[ "public", "String", "buildRemoveElement", "(", "String", "elementName", ",", "int", "index", ",", "boolean", "enabled", ")", "{", "if", "(", "enabled", ")", "{", "StringBuffer", "href", "=", "new", "StringBuffer", "(", "4", ")", ";", "href", ".", "append", "(", "\"javascript:removeElement('\"", ")", ";", "href", ".", "append", "(", "elementName", ")", ";", "href", ".", "append", "(", "\"', \"", ")", ";", "href", ".", "append", "(", "index", ")", ";", "href", ".", "append", "(", "\");\"", ")", ";", "return", "button", "(", "href", ".", "toString", "(", ")", ",", "null", ",", "\"deletecontent.png\"", ",", "Messages", ".", "GUI_DIALOG_BUTTON_DELETE_0", ",", "0", ")", ";", "}", "else", "{", "return", "\"\"", ";", "}", "}" ]
Returns the html for a button to remove an optional element.<p> @param elementName name of the element @param index the element index of the element to remove @param enabled if true, the button to remove an element is shown, otherwise a spacer is returned @return the html for a button to remove an optional element
[ "Returns", "the", "html", "for", "a", "button", "to", "remove", "an", "optional", "element", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/CmsWidgetDialog.java#L259-L272
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.delegatedAccount_email_responder_GET
public OvhResponderAccount delegatedAccount_email_responder_GET(String email) throws IOException { """ Get this object properties REST: GET /email/domain/delegatedAccount/{email}/responder @param email [required] Email """ String qPath = "/email/domain/delegatedAccount/{email}/responder"; StringBuilder sb = path(qPath, email); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhResponderAccount.class); }
java
public OvhResponderAccount delegatedAccount_email_responder_GET(String email) throws IOException { String qPath = "/email/domain/delegatedAccount/{email}/responder"; StringBuilder sb = path(qPath, email); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhResponderAccount.class); }
[ "public", "OvhResponderAccount", "delegatedAccount_email_responder_GET", "(", "String", "email", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/delegatedAccount/{email}/responder\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "email", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhResponderAccount", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /email/domain/delegatedAccount/{email}/responder @param email [required] Email
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L297-L302
mbenson/therian
core/src/main/java/therian/operator/convert/Converter.java
Converter.supports
@Override public boolean supports(TherianContext context, Convert<? extends SOURCE, ? super TARGET> convert) { """ {@inheritDoc} @return {@code true} if the source value is an instance of our SOURCE bound and the target type is assignable from our TARGET bound. If, the source value is an instance of the target type, returns ! {@link #isRejectNoop()}. """ return !(isNoop(convert) && isRejectNoop()) && TypeUtils.isAssignable(convert.getSourceType().getType(), getSourceBound()) && TypeUtils.isAssignable(getTargetBound(), convert.getTargetType().getType()); }
java
@Override public boolean supports(TherianContext context, Convert<? extends SOURCE, ? super TARGET> convert) { return !(isNoop(convert) && isRejectNoop()) && TypeUtils.isAssignable(convert.getSourceType().getType(), getSourceBound()) && TypeUtils.isAssignable(getTargetBound(), convert.getTargetType().getType()); }
[ "@", "Override", "public", "boolean", "supports", "(", "TherianContext", "context", ",", "Convert", "<", "?", "extends", "SOURCE", ",", "?", "super", "TARGET", ">", "convert", ")", "{", "return", "!", "(", "isNoop", "(", "convert", ")", "&&", "isRejectNoop", "(", ")", ")", "&&", "TypeUtils", ".", "isAssignable", "(", "convert", ".", "getSourceType", "(", ")", ".", "getType", "(", ")", ",", "getSourceBound", "(", ")", ")", "&&", "TypeUtils", ".", "isAssignable", "(", "getTargetBound", "(", ")", ",", "convert", ".", "getTargetType", "(", ")", ".", "getType", "(", ")", ")", ";", "}" ]
{@inheritDoc} @return {@code true} if the source value is an instance of our SOURCE bound and the target type is assignable from our TARGET bound. If, the source value is an instance of the target type, returns ! {@link #isRejectNoop()}.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/core/src/main/java/therian/operator/convert/Converter.java#L95-L100
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java
Strs.before
public static Betner before(String target, String separator) { """ Returns a {@code String} between matcher that matches any character in the beginning and given right @param target @param separator @return """ return betn(target).before(separator); }
java
public static Betner before(String target, String separator) { return betn(target).before(separator); }
[ "public", "static", "Betner", "before", "(", "String", "target", ",", "String", "separator", ")", "{", "return", "betn", "(", "target", ")", ".", "before", "(", "separator", ")", ";", "}" ]
Returns a {@code String} between matcher that matches any character in the beginning and given right @param target @param separator @return
[ "Returns", "a", "{", "@code", "String", "}", "between", "matcher", "that", "matches", "any", "character", "in", "the", "beginning", "and", "given", "right" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Strs.java#L477-L479
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/RaftLock.java
RaftLock.acquire
AcquireResult acquire(LockInvocationKey key, boolean wait) { """ Assigns the lock to the endpoint, if the lock is not held. Lock count is incremented if the endpoint already holds the lock. If some other endpoint holds the lock and the second argument is true, a wait key is created and added to the wait queue. Lock count is not incremented if the lock request is a retry of the lock holder. If the lock request is a retry of a lock endpoint that resides in the wait queue with the same invocation uid, a retry wait key wait key is attached to the original wait key. If the lock request is a new request of a lock endpoint that resides in the wait queue with a different invocation uid, the existing wait key is cancelled because it means the caller has stopped waiting for response of the previous invocation. If the invocation uid is same with one of the previous invocations of the current lock owner, memorized result of the previous invocation is returned. """ LockEndpoint endpoint = key.endpoint(); UUID invocationUid = key.invocationUid(); RaftLockOwnershipState memorized = ownerInvocationRefUids.get(Tuple2.of(endpoint, invocationUid)); if (memorized != null) { AcquireStatus status = memorized.isLocked() ? SUCCESSFUL : FAILED; return new AcquireResult(status, memorized.getFence(), Collections.<LockInvocationKey>emptyList()); } if (owner == null) { owner = key; } if (endpoint.equals(owner.endpoint())) { if (lockCount == lockCountLimit) { ownerInvocationRefUids.put(Tuple2.of(endpoint, invocationUid), NOT_LOCKED); return AcquireResult.failed(Collections.<LockInvocationKey>emptyList()); } lockCount++; ownerInvocationRefUids.put(Tuple2.of(endpoint, invocationUid), lockOwnershipState()); return AcquireResult.acquired(owner.commitIndex()); } // we must cancel waits keys of previous invocation of the endpoint // before adding a new wait key or even if we will not wait Collection<LockInvocationKey> cancelledWaitKeys = cancelWaitKeys(endpoint, invocationUid); if (wait) { addWaitKey(endpoint, key); return AcquireResult.waitKeyAdded(cancelledWaitKeys); } return AcquireResult.failed(cancelledWaitKeys); }
java
AcquireResult acquire(LockInvocationKey key, boolean wait) { LockEndpoint endpoint = key.endpoint(); UUID invocationUid = key.invocationUid(); RaftLockOwnershipState memorized = ownerInvocationRefUids.get(Tuple2.of(endpoint, invocationUid)); if (memorized != null) { AcquireStatus status = memorized.isLocked() ? SUCCESSFUL : FAILED; return new AcquireResult(status, memorized.getFence(), Collections.<LockInvocationKey>emptyList()); } if (owner == null) { owner = key; } if (endpoint.equals(owner.endpoint())) { if (lockCount == lockCountLimit) { ownerInvocationRefUids.put(Tuple2.of(endpoint, invocationUid), NOT_LOCKED); return AcquireResult.failed(Collections.<LockInvocationKey>emptyList()); } lockCount++; ownerInvocationRefUids.put(Tuple2.of(endpoint, invocationUid), lockOwnershipState()); return AcquireResult.acquired(owner.commitIndex()); } // we must cancel waits keys of previous invocation of the endpoint // before adding a new wait key or even if we will not wait Collection<LockInvocationKey> cancelledWaitKeys = cancelWaitKeys(endpoint, invocationUid); if (wait) { addWaitKey(endpoint, key); return AcquireResult.waitKeyAdded(cancelledWaitKeys); } return AcquireResult.failed(cancelledWaitKeys); }
[ "AcquireResult", "acquire", "(", "LockInvocationKey", "key", ",", "boolean", "wait", ")", "{", "LockEndpoint", "endpoint", "=", "key", ".", "endpoint", "(", ")", ";", "UUID", "invocationUid", "=", "key", ".", "invocationUid", "(", ")", ";", "RaftLockOwnershipState", "memorized", "=", "ownerInvocationRefUids", ".", "get", "(", "Tuple2", ".", "of", "(", "endpoint", ",", "invocationUid", ")", ")", ";", "if", "(", "memorized", "!=", "null", ")", "{", "AcquireStatus", "status", "=", "memorized", ".", "isLocked", "(", ")", "?", "SUCCESSFUL", ":", "FAILED", ";", "return", "new", "AcquireResult", "(", "status", ",", "memorized", ".", "getFence", "(", ")", ",", "Collections", ".", "<", "LockInvocationKey", ">", "emptyList", "(", ")", ")", ";", "}", "if", "(", "owner", "==", "null", ")", "{", "owner", "=", "key", ";", "}", "if", "(", "endpoint", ".", "equals", "(", "owner", ".", "endpoint", "(", ")", ")", ")", "{", "if", "(", "lockCount", "==", "lockCountLimit", ")", "{", "ownerInvocationRefUids", ".", "put", "(", "Tuple2", ".", "of", "(", "endpoint", ",", "invocationUid", ")", ",", "NOT_LOCKED", ")", ";", "return", "AcquireResult", ".", "failed", "(", "Collections", ".", "<", "LockInvocationKey", ">", "emptyList", "(", ")", ")", ";", "}", "lockCount", "++", ";", "ownerInvocationRefUids", ".", "put", "(", "Tuple2", ".", "of", "(", "endpoint", ",", "invocationUid", ")", ",", "lockOwnershipState", "(", ")", ")", ";", "return", "AcquireResult", ".", "acquired", "(", "owner", ".", "commitIndex", "(", ")", ")", ";", "}", "// we must cancel waits keys of previous invocation of the endpoint", "// before adding a new wait key or even if we will not wait", "Collection", "<", "LockInvocationKey", ">", "cancelledWaitKeys", "=", "cancelWaitKeys", "(", "endpoint", ",", "invocationUid", ")", ";", "if", "(", "wait", ")", "{", "addWaitKey", "(", "endpoint", ",", "key", ")", ";", "return", "AcquireResult", ".", "waitKeyAdded", "(", "cancelledWaitKeys", ")", ";", "}", "return", "AcquireResult", ".", "failed", "(", "cancelledWaitKeys", ")", ";", "}" ]
Assigns the lock to the endpoint, if the lock is not held. Lock count is incremented if the endpoint already holds the lock. If some other endpoint holds the lock and the second argument is true, a wait key is created and added to the wait queue. Lock count is not incremented if the lock request is a retry of the lock holder. If the lock request is a retry of a lock endpoint that resides in the wait queue with the same invocation uid, a retry wait key wait key is attached to the original wait key. If the lock request is a new request of a lock endpoint that resides in the wait queue with a different invocation uid, the existing wait key is cancelled because it means the caller has stopped waiting for response of the previous invocation. If the invocation uid is same with one of the previous invocations of the current lock owner, memorized result of the previous invocation is returned.
[ "Assigns", "the", "lock", "to", "the", "endpoint", "if", "the", "lock", "is", "not", "held", ".", "Lock", "count", "is", "incremented", "if", "the", "endpoint", "already", "holds", "the", "lock", ".", "If", "some", "other", "endpoint", "holds", "the", "lock", "and", "the", "second", "argument", "is", "true", "a", "wait", "key", "is", "created", "and", "added", "to", "the", "wait", "queue", ".", "Lock", "count", "is", "not", "incremented", "if", "the", "lock", "request", "is", "a", "retry", "of", "the", "lock", "holder", ".", "If", "the", "lock", "request", "is", "a", "retry", "of", "a", "lock", "endpoint", "that", "resides", "in", "the", "wait", "queue", "with", "the", "same", "invocation", "uid", "a", "retry", "wait", "key", "wait", "key", "is", "attached", "to", "the", "original", "wait", "key", ".", "If", "the", "lock", "request", "is", "a", "new", "request", "of", "a", "lock", "endpoint", "that", "resides", "in", "the", "wait", "queue", "with", "a", "different", "invocation", "uid", "the", "existing", "wait", "key", "is", "cancelled", "because", "it", "means", "the", "caller", "has", "stopped", "waiting", "for", "response", "of", "the", "previous", "invocation", ".", "If", "the", "invocation", "uid", "is", "same", "with", "one", "of", "the", "previous", "invocations", "of", "the", "current", "lock", "owner", "memorized", "result", "of", "the", "previous", "invocation", "is", "returned", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/datastructures/lock/RaftLock.java#L95-L129
ixa-ehu/kaflib
src/main/java/ixa/kaflib/KAFDocument.java
KAFDocument.addLinguisticProcessor
public LinguisticProcessor addLinguisticProcessor(String layer, String name) { """ Adds a linguistic processor to the document header. The timestamp is added implicitly. """ LinguisticProcessor lp = new LinguisticProcessor(name, layer); //lp.setBeginTimestamp(timestamp); // no default timestamp List<LinguisticProcessor> layerLps = lps.get(layer); if (layerLps == null) { layerLps = new ArrayList<LinguisticProcessor>(); lps.put(layer, layerLps); } layerLps.add(lp); return lp; }
java
public LinguisticProcessor addLinguisticProcessor(String layer, String name) { LinguisticProcessor lp = new LinguisticProcessor(name, layer); //lp.setBeginTimestamp(timestamp); // no default timestamp List<LinguisticProcessor> layerLps = lps.get(layer); if (layerLps == null) { layerLps = new ArrayList<LinguisticProcessor>(); lps.put(layer, layerLps); } layerLps.add(lp); return lp; }
[ "public", "LinguisticProcessor", "addLinguisticProcessor", "(", "String", "layer", ",", "String", "name", ")", "{", "LinguisticProcessor", "lp", "=", "new", "LinguisticProcessor", "(", "name", ",", "layer", ")", ";", "//lp.setBeginTimestamp(timestamp); // no default timestamp", "List", "<", "LinguisticProcessor", ">", "layerLps", "=", "lps", ".", "get", "(", "layer", ")", ";", "if", "(", "layerLps", "==", "null", ")", "{", "layerLps", "=", "new", "ArrayList", "<", "LinguisticProcessor", ">", "(", ")", ";", "lps", ".", "put", "(", "layer", ",", "layerLps", ")", ";", "}", "layerLps", ".", "add", "(", "lp", ")", ";", "return", "lp", ";", "}" ]
Adds a linguistic processor to the document header. The timestamp is added implicitly.
[ "Adds", "a", "linguistic", "processor", "to", "the", "document", "header", ".", "The", "timestamp", "is", "added", "implicitly", "." ]
train
https://github.com/ixa-ehu/kaflib/blob/3921f55d9ae4621736a329418f6334fb721834b8/src/main/java/ixa/kaflib/KAFDocument.java#L436-L446
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getSasDefinitionsWithServiceResponseAsync
public Observable<ServiceResponse<Page<SasDefinitionItem>>> getSasDefinitionsWithServiceResponseAsync(final String vaultBaseUrl, final String storageAccountName, final Integer maxresults) { """ List storage SAS definitions for the given storage account. This operation requires the storage/listsas permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SasDefinitionItem&gt; object """ return getSasDefinitionsSinglePageAsync(vaultBaseUrl, storageAccountName, maxresults) .concatMap(new Func1<ServiceResponse<Page<SasDefinitionItem>>, Observable<ServiceResponse<Page<SasDefinitionItem>>>>() { @Override public Observable<ServiceResponse<Page<SasDefinitionItem>>> call(ServiceResponse<Page<SasDefinitionItem>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(getSasDefinitionsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<SasDefinitionItem>>> getSasDefinitionsWithServiceResponseAsync(final String vaultBaseUrl, final String storageAccountName, final Integer maxresults) { return getSasDefinitionsSinglePageAsync(vaultBaseUrl, storageAccountName, maxresults) .concatMap(new Func1<ServiceResponse<Page<SasDefinitionItem>>, Observable<ServiceResponse<Page<SasDefinitionItem>>>>() { @Override public Observable<ServiceResponse<Page<SasDefinitionItem>>> call(ServiceResponse<Page<SasDefinitionItem>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(getSasDefinitionsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SasDefinitionItem", ">", ">", ">", "getSasDefinitionsWithServiceResponseAsync", "(", "final", "String", "vaultBaseUrl", ",", "final", "String", "storageAccountName", ",", "final", "Integer", "maxresults", ")", "{", "return", "getSasDefinitionsSinglePageAsync", "(", "vaultBaseUrl", ",", "storageAccountName", ",", "maxresults", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "SasDefinitionItem", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SasDefinitionItem", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SasDefinitionItem", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "SasDefinitionItem", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "getSasDefinitionsNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
List storage SAS definitions for the given storage account. This operation requires the storage/listsas permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SasDefinitionItem&gt; object
[ "List", "storage", "SAS", "definitions", "for", "the", "given", "storage", "account", ".", "This", "operation", "requires", "the", "storage", "/", "listsas", "permission", "." ]
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#L10562-L10574
facebookarchive/hadoop-20
src/core/org/apache/hadoop/http/HtmlQuoting.java
HtmlQuoting.quoteOutputStream
public static OutputStream quoteOutputStream(final OutputStream out ) throws IOException { """ Return an output stream that quotes all of the output. @param out the stream to write the quoted output to @return a new stream that the application show write to @throws IOException if the underlying output fails """ return new OutputStream() { private byte[] data = new byte[1]; @Override public void write(byte[] data, int off, int len) throws IOException { quoteHtmlChars(out, data, off, len); } @Override public void write(int b) throws IOException { data[0] = (byte) b; quoteHtmlChars(out, data, 0, 1); } @Override public void flush() throws IOException { out.flush(); } @Override public void close() throws IOException { out.close(); } }; }
java
public static OutputStream quoteOutputStream(final OutputStream out ) throws IOException { return new OutputStream() { private byte[] data = new byte[1]; @Override public void write(byte[] data, int off, int len) throws IOException { quoteHtmlChars(out, data, off, len); } @Override public void write(int b) throws IOException { data[0] = (byte) b; quoteHtmlChars(out, data, 0, 1); } @Override public void flush() throws IOException { out.flush(); } @Override public void close() throws IOException { out.close(); } }; }
[ "public", "static", "OutputStream", "quoteOutputStream", "(", "final", "OutputStream", "out", ")", "throws", "IOException", "{", "return", "new", "OutputStream", "(", ")", "{", "private", "byte", "[", "]", "data", "=", "new", "byte", "[", "1", "]", ";", "@", "Override", "public", "void", "write", "(", "byte", "[", "]", "data", ",", "int", "off", ",", "int", "len", ")", "throws", "IOException", "{", "quoteHtmlChars", "(", "out", ",", "data", ",", "off", ",", "len", ")", ";", "}", "@", "Override", "public", "void", "write", "(", "int", "b", ")", "throws", "IOException", "{", "data", "[", "0", "]", "=", "(", "byte", ")", "b", ";", "quoteHtmlChars", "(", "out", ",", "data", ",", "0", ",", "1", ")", ";", "}", "@", "Override", "public", "void", "flush", "(", ")", "throws", "IOException", "{", "out", ".", "flush", "(", ")", ";", "}", "@", "Override", "public", "void", "close", "(", ")", "throws", "IOException", "{", "out", ".", "close", "(", ")", ";", "}", "}", ";", "}" ]
Return an output stream that quotes all of the output. @param out the stream to write the quoted output to @return a new stream that the application show write to @throws IOException if the underlying output fails
[ "Return", "an", "output", "stream", "that", "quotes", "all", "of", "the", "output", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HtmlQuoting.java#L121-L146
reactor/reactor-netty
src/main/java/reactor/netty/http/client/HttpClient.java
HttpClient.doOnResponse
public final HttpClient doOnResponse(BiConsumer<? super HttpClientResponse, ? super Connection> doOnResponse) { """ Setup a callback called after {@link HttpClientResponse} headers have been received @param doOnResponse a consumer observing connected events @return a new {@link HttpClient} """ Objects.requireNonNull(doOnResponse, "doOnResponse"); return new HttpClientDoOn(this, null, null, doOnResponse, null); }
java
public final HttpClient doOnResponse(BiConsumer<? super HttpClientResponse, ? super Connection> doOnResponse) { Objects.requireNonNull(doOnResponse, "doOnResponse"); return new HttpClientDoOn(this, null, null, doOnResponse, null); }
[ "public", "final", "HttpClient", "doOnResponse", "(", "BiConsumer", "<", "?", "super", "HttpClientResponse", ",", "?", "super", "Connection", ">", "doOnResponse", ")", "{", "Objects", ".", "requireNonNull", "(", "doOnResponse", ",", "\"doOnResponse\"", ")", ";", "return", "new", "HttpClientDoOn", "(", "this", ",", "null", ",", "null", ",", "doOnResponse", ",", "null", ")", ";", "}" ]
Setup a callback called after {@link HttpClientResponse} headers have been received @param doOnResponse a consumer observing connected events @return a new {@link HttpClient}
[ "Setup", "a", "callback", "called", "after", "{", "@link", "HttpClientResponse", "}", "headers", "have", "been", "received" ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/http/client/HttpClient.java#L556-L559
Tourenathan-G5organisation/SiliCompressor
silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java
SiliCompressor.compressVideo
public String compressVideo(String videoFilePath, String destinationDir) throws URISyntaxException { """ Perform background video compression. Make sure the videofileUri and destinationUri are valid resources because this method does not account for missing directories hence your converted file could be in an unknown location This uses default values for the converted videos @param videoFilePath source path for the video file @param destinationDir destination directory where converted file should be saved @return The Path of the compressed video file """ return compressVideo(videoFilePath, destinationDir, 0, 0, 0); }
java
public String compressVideo(String videoFilePath, String destinationDir) throws URISyntaxException { return compressVideo(videoFilePath, destinationDir, 0, 0, 0); }
[ "public", "String", "compressVideo", "(", "String", "videoFilePath", ",", "String", "destinationDir", ")", "throws", "URISyntaxException", "{", "return", "compressVideo", "(", "videoFilePath", ",", "destinationDir", ",", "0", ",", "0", ",", "0", ")", ";", "}" ]
Perform background video compression. Make sure the videofileUri and destinationUri are valid resources because this method does not account for missing directories hence your converted file could be in an unknown location This uses default values for the converted videos @param videoFilePath source path for the video file @param destinationDir destination directory where converted file should be saved @return The Path of the compressed video file
[ "Perform", "background", "video", "compression", ".", "Make", "sure", "the", "videofileUri", "and", "destinationUri", "are", "valid", "resources", "because", "this", "method", "does", "not", "account", "for", "missing", "directories", "hence", "your", "converted", "file", "could", "be", "in", "an", "unknown", "location", "This", "uses", "default", "values", "for", "the", "converted", "videos" ]
train
https://github.com/Tourenathan-G5organisation/SiliCompressor/blob/546f6cd7b2a7a783e1122df46c1e237f8938fe72/silicompressor/src/main/java/com/iceteck/silicompressorr/SiliCompressor.java#L315-L317
hexagonframework/spring-data-ebean
src/main/java/org/springframework/data/ebean/repository/support/EbeanRepositoryFactory.java
EbeanRepositoryFactory.getTargetRepository
protected <T extends Persistable, ID extends Serializable> SimpleEbeanRepository<T, ID> getTargetRepository( RepositoryInformation information, EbeanServer ebeanServer) { """ Callback to create a {@link EbeanRepository} instance with the given {@link EbeanServer} @param <T> @param <ID> @param ebeanServer @return """ return getTargetRepositoryViaReflection(information, information.getDomainType(), ebeanServer); }
java
protected <T extends Persistable, ID extends Serializable> SimpleEbeanRepository<T, ID> getTargetRepository( RepositoryInformation information, EbeanServer ebeanServer) { return getTargetRepositoryViaReflection(information, information.getDomainType(), ebeanServer); }
[ "protected", "<", "T", "extends", "Persistable", ",", "ID", "extends", "Serializable", ">", "SimpleEbeanRepository", "<", "T", ",", "ID", ">", "getTargetRepository", "(", "RepositoryInformation", "information", ",", "EbeanServer", "ebeanServer", ")", "{", "return", "getTargetRepositoryViaReflection", "(", "information", ",", "information", ".", "getDomainType", "(", ")", ",", "ebeanServer", ")", ";", "}" ]
Callback to create a {@link EbeanRepository} instance with the given {@link EbeanServer} @param <T> @param <ID> @param ebeanServer @return
[ "Callback", "to", "create", "a", "{", "@link", "EbeanRepository", "}", "instance", "with", "the", "given", "{", "@link", "EbeanServer", "}" ]
train
https://github.com/hexagonframework/spring-data-ebean/blob/dd11b97654982403b50dd1d5369cadad71fce410/src/main/java/org/springframework/data/ebean/repository/support/EbeanRepositoryFactory.java#L85-L89
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.enterOfflinePayment
public Transaction enterOfflinePayment(final String invoiceId, final Transaction payment) { """ Enter an offline payment for a manual invoice (beta) - Recurly Enterprise Feature @param invoiceId String Recurly Invoice ID @param payment The external payment """ return doPOST(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/transactions", payment, Transaction.class); }
java
public Transaction enterOfflinePayment(final String invoiceId, final Transaction payment) { return doPOST(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/transactions", payment, Transaction.class); }
[ "public", "Transaction", "enterOfflinePayment", "(", "final", "String", "invoiceId", ",", "final", "Transaction", "payment", ")", "{", "return", "doPOST", "(", "Invoices", ".", "INVOICES_RESOURCE", "+", "\"/\"", "+", "invoiceId", "+", "\"/transactions\"", ",", "payment", ",", "Transaction", ".", "class", ")", ";", "}" ]
Enter an offline payment for a manual invoice (beta) - Recurly Enterprise Feature @param invoiceId String Recurly Invoice ID @param payment The external payment
[ "Enter", "an", "offline", "payment", "for", "a", "manual", "invoice", "(", "beta", ")", "-", "Recurly", "Enterprise", "Feature" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1342-L1344
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/MapsInner.java
MapsInner.createOrUpdateAsync
public Observable<IntegrationAccountMapInner> createOrUpdateAsync(String resourceGroupName, String integrationAccountName, String mapName, IntegrationAccountMapInner map) { """ Creates or updates an integration account map. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param mapName The integration account map name. @param map The integration account map. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IntegrationAccountMapInner object """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, mapName, map).map(new Func1<ServiceResponse<IntegrationAccountMapInner>, IntegrationAccountMapInner>() { @Override public IntegrationAccountMapInner call(ServiceResponse<IntegrationAccountMapInner> response) { return response.body(); } }); }
java
public Observable<IntegrationAccountMapInner> createOrUpdateAsync(String resourceGroupName, String integrationAccountName, String mapName, IntegrationAccountMapInner map) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, integrationAccountName, mapName, map).map(new Func1<ServiceResponse<IntegrationAccountMapInner>, IntegrationAccountMapInner>() { @Override public IntegrationAccountMapInner call(ServiceResponse<IntegrationAccountMapInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "IntegrationAccountMapInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "String", "mapName", ",", "IntegrationAccountMapInner", "map", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "integrationAccountName", ",", "mapName", ",", "map", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "IntegrationAccountMapInner", ">", ",", "IntegrationAccountMapInner", ">", "(", ")", "{", "@", "Override", "public", "IntegrationAccountMapInner", "call", "(", "ServiceResponse", "<", "IntegrationAccountMapInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates an integration account map. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param mapName The integration account map name. @param map The integration account map. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the IntegrationAccountMapInner object
[ "Creates", "or", "updates", "an", "integration", "account", "map", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/MapsInner.java#L477-L484
VoltDB/voltdb
src/frontend/org/voltdb/expressions/ComparisonExpression.java
ComparisonExpression.rangeFilterFromPrefixLike
static private ComparisonExpression rangeFilterFromPrefixLike(AbstractExpression leftExpr, ExpressionType rangeComparator, String comparand) { """ Construct the upper or lower bound expression that is implied by a prefix LIKE operator, given its required elements. @param leftExpr - the LIKE operator's (and the result's) lhs expression @param rangeComparator - a GTE or LT operator to indicate lower or upper bound, respectively, @param comparand - a string operand value derived from the LIKE operator's rhs pattern A helper for getGteFilterFromPrefixLike/getLtFilterFromPrefixLike """ ConstantValueExpression cve = new ConstantValueExpression(); cve.setValueType(VoltType.STRING); cve.setValue(comparand); cve.setValueSize(comparand.length()); ComparisonExpression rangeFilter = new ComparisonExpression(rangeComparator, leftExpr, cve); return rangeFilter; }
java
static private ComparisonExpression rangeFilterFromPrefixLike(AbstractExpression leftExpr, ExpressionType rangeComparator, String comparand) { ConstantValueExpression cve = new ConstantValueExpression(); cve.setValueType(VoltType.STRING); cve.setValue(comparand); cve.setValueSize(comparand.length()); ComparisonExpression rangeFilter = new ComparisonExpression(rangeComparator, leftExpr, cve); return rangeFilter; }
[ "static", "private", "ComparisonExpression", "rangeFilterFromPrefixLike", "(", "AbstractExpression", "leftExpr", ",", "ExpressionType", "rangeComparator", ",", "String", "comparand", ")", "{", "ConstantValueExpression", "cve", "=", "new", "ConstantValueExpression", "(", ")", ";", "cve", ".", "setValueType", "(", "VoltType", ".", "STRING", ")", ";", "cve", ".", "setValue", "(", "comparand", ")", ";", "cve", ".", "setValueSize", "(", "comparand", ".", "length", "(", ")", ")", ";", "ComparisonExpression", "rangeFilter", "=", "new", "ComparisonExpression", "(", "rangeComparator", ",", "leftExpr", ",", "cve", ")", ";", "return", "rangeFilter", ";", "}" ]
Construct the upper or lower bound expression that is implied by a prefix LIKE operator, given its required elements. @param leftExpr - the LIKE operator's (and the result's) lhs expression @param rangeComparator - a GTE or LT operator to indicate lower or upper bound, respectively, @param comparand - a string operand value derived from the LIKE operator's rhs pattern A helper for getGteFilterFromPrefixLike/getLtFilterFromPrefixLike
[ "Construct", "the", "upper", "or", "lower", "bound", "expression", "that", "is", "implied", "by", "a", "prefix", "LIKE", "operator", "given", "its", "required", "elements", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/ComparisonExpression.java#L144-L151
jMotif/SAX
src/main/java/net/seninp/util/UCRUtils.java
UCRUtils.datasetStats
public static String datasetStats(Map<String, List<double[]>> data, String name) { """ Prints the dataset statistics. @param data the UCRdataset. @param name the dataset name to use. @return stats. """ int globalMinLength = Integer.MAX_VALUE; int globalMaxLength = Integer.MIN_VALUE; double globalMinValue = Double.MAX_VALUE; double globalMaxValue = Double.MIN_VALUE; for (Entry<String, List<double[]>> e : data.entrySet()) { for (double[] dataEntry : e.getValue()) { globalMaxLength = (dataEntry.length > globalMaxLength) ? dataEntry.length : globalMaxLength; globalMinLength = (dataEntry.length < globalMinLength) ? dataEntry.length : globalMinLength; for (double value : dataEntry) { globalMaxValue = (value > globalMaxValue) ? value : globalMaxValue; globalMinValue = (value < globalMinValue) ? value : globalMinValue; } } } StringBuffer sb = new StringBuffer(); sb.append(name).append("classes: ").append(data.size()); sb.append(", series length min: ").append(globalMinLength); sb.append(", max: ").append(globalMaxLength); sb.append(", min value: ").append(globalMinValue); sb.append(", max value: ").append(globalMaxValue).append(";"); for (Entry<String, List<double[]>> e : data.entrySet()) { sb.append(name).append(" class: ").append(e.getKey()); sb.append(" series: ").append(e.getValue().size()).append(";"); } return sb.delete(sb.length() - 1, sb.length()).toString(); }
java
public static String datasetStats(Map<String, List<double[]>> data, String name) { int globalMinLength = Integer.MAX_VALUE; int globalMaxLength = Integer.MIN_VALUE; double globalMinValue = Double.MAX_VALUE; double globalMaxValue = Double.MIN_VALUE; for (Entry<String, List<double[]>> e : data.entrySet()) { for (double[] dataEntry : e.getValue()) { globalMaxLength = (dataEntry.length > globalMaxLength) ? dataEntry.length : globalMaxLength; globalMinLength = (dataEntry.length < globalMinLength) ? dataEntry.length : globalMinLength; for (double value : dataEntry) { globalMaxValue = (value > globalMaxValue) ? value : globalMaxValue; globalMinValue = (value < globalMinValue) ? value : globalMinValue; } } } StringBuffer sb = new StringBuffer(); sb.append(name).append("classes: ").append(data.size()); sb.append(", series length min: ").append(globalMinLength); sb.append(", max: ").append(globalMaxLength); sb.append(", min value: ").append(globalMinValue); sb.append(", max value: ").append(globalMaxValue).append(";"); for (Entry<String, List<double[]>> e : data.entrySet()) { sb.append(name).append(" class: ").append(e.getKey()); sb.append(" series: ").append(e.getValue().size()).append(";"); } return sb.delete(sb.length() - 1, sb.length()).toString(); }
[ "public", "static", "String", "datasetStats", "(", "Map", "<", "String", ",", "List", "<", "double", "[", "]", ">", ">", "data", ",", "String", "name", ")", "{", "int", "globalMinLength", "=", "Integer", ".", "MAX_VALUE", ";", "int", "globalMaxLength", "=", "Integer", ".", "MIN_VALUE", ";", "double", "globalMinValue", "=", "Double", ".", "MAX_VALUE", ";", "double", "globalMaxValue", "=", "Double", ".", "MIN_VALUE", ";", "for", "(", "Entry", "<", "String", ",", "List", "<", "double", "[", "]", ">", ">", "e", ":", "data", ".", "entrySet", "(", ")", ")", "{", "for", "(", "double", "[", "]", "dataEntry", ":", "e", ".", "getValue", "(", ")", ")", "{", "globalMaxLength", "=", "(", "dataEntry", ".", "length", ">", "globalMaxLength", ")", "?", "dataEntry", ".", "length", ":", "globalMaxLength", ";", "globalMinLength", "=", "(", "dataEntry", ".", "length", "<", "globalMinLength", ")", "?", "dataEntry", ".", "length", ":", "globalMinLength", ";", "for", "(", "double", "value", ":", "dataEntry", ")", "{", "globalMaxValue", "=", "(", "value", ">", "globalMaxValue", ")", "?", "value", ":", "globalMaxValue", ";", "globalMinValue", "=", "(", "value", "<", "globalMinValue", ")", "?", "value", ":", "globalMinValue", ";", "}", "}", "}", "StringBuffer", "sb", "=", "new", "StringBuffer", "(", ")", ";", "sb", ".", "append", "(", "name", ")", ".", "append", "(", "\"classes: \"", ")", ".", "append", "(", "data", ".", "size", "(", ")", ")", ";", "sb", ".", "append", "(", "\", series length min: \"", ")", ".", "append", "(", "globalMinLength", ")", ";", "sb", ".", "append", "(", "\", max: \"", ")", ".", "append", "(", "globalMaxLength", ")", ";", "sb", ".", "append", "(", "\", min value: \"", ")", ".", "append", "(", "globalMinValue", ")", ";", "sb", ".", "append", "(", "\", max value: \"", ")", ".", "append", "(", "globalMaxValue", ")", ".", "append", "(", "\";\"", ")", ";", "for", "(", "Entry", "<", "String", ",", "List", "<", "double", "[", "]", ">", ">", "e", ":", "data", ".", "entrySet", "(", ")", ")", "{", "sb", ".", "append", "(", "name", ")", ".", "append", "(", "\" class: \"", ")", ".", "append", "(", "e", ".", "getKey", "(", ")", ")", ";", "sb", ".", "append", "(", "\" series: \"", ")", ".", "append", "(", "e", ".", "getValue", "(", ")", ".", "size", "(", ")", ")", ".", "append", "(", "\";\"", ")", ";", "}", "return", "sb", ".", "delete", "(", "sb", ".", "length", "(", ")", "-", "1", ",", "sb", ".", "length", "(", ")", ")", ".", "toString", "(", ")", ";", "}" ]
Prints the dataset statistics. @param data the UCRdataset. @param name the dataset name to use. @return stats.
[ "Prints", "the", "dataset", "statistics", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/UCRUtils.java#L78-L112
liferay/com-liferay-commerce
commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountUserRelPersistenceImpl.java
CommerceAccountUserRelPersistenceImpl.findAll
@Override public List<CommerceAccountUserRel> findAll() { """ Returns all the commerce account user rels. @return the commerce account user rels """ return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceAccountUserRel> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceAccountUserRel", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce account user rels. @return the commerce account user rels
[ "Returns", "all", "the", "commerce", "account", "user", "rels", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountUserRelPersistenceImpl.java#L1618-L1621
meltmedia/cadmium
core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java
Jsr250Utils.findInstancesInScopes
public static Set<Object> findInstancesInScopes(Injector injector, Class<? extends Annotation>... scopeAnnotations) { """ Finds all of the instances in the specified scopes. <p> Returns a list of the objects from the specified scope, sorted by their class name. </p> @param injector the injector to search. @param scopeAnnotations the scopes to search for. @return the objects bound in the injector. """ Set<Object> objects = new TreeSet<Object>(new Comparator<Object>() { @Override public int compare(Object o0, Object o1) { return o0.getClass().getName().compareTo(o1.getClass().getName()); } }); for( Map.Entry<Key<?>, Binding<?>> entry : findBindingsInScope(injector, scopeAnnotations).entrySet()) { Object object = injector.getInstance(entry.getKey()); objects.add(object); } return objects; }
java
public static Set<Object> findInstancesInScopes(Injector injector, Class<? extends Annotation>... scopeAnnotations) { Set<Object> objects = new TreeSet<Object>(new Comparator<Object>() { @Override public int compare(Object o0, Object o1) { return o0.getClass().getName().compareTo(o1.getClass().getName()); } }); for( Map.Entry<Key<?>, Binding<?>> entry : findBindingsInScope(injector, scopeAnnotations).entrySet()) { Object object = injector.getInstance(entry.getKey()); objects.add(object); } return objects; }
[ "public", "static", "Set", "<", "Object", ">", "findInstancesInScopes", "(", "Injector", "injector", ",", "Class", "<", "?", "extends", "Annotation", ">", "...", "scopeAnnotations", ")", "{", "Set", "<", "Object", ">", "objects", "=", "new", "TreeSet", "<", "Object", ">", "(", "new", "Comparator", "<", "Object", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "Object", "o0", ",", "Object", "o1", ")", "{", "return", "o0", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "compareTo", "(", "o1", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "}", ")", ";", "for", "(", "Map", ".", "Entry", "<", "Key", "<", "?", ">", ",", "Binding", "<", "?", ">", ">", "entry", ":", "findBindingsInScope", "(", "injector", ",", "scopeAnnotations", ")", ".", "entrySet", "(", ")", ")", "{", "Object", "object", "=", "injector", ".", "getInstance", "(", "entry", ".", "getKey", "(", ")", ")", ";", "objects", ".", "add", "(", "object", ")", ";", "}", "return", "objects", ";", "}" ]
Finds all of the instances in the specified scopes. <p> Returns a list of the objects from the specified scope, sorted by their class name. </p> @param injector the injector to search. @param scopeAnnotations the scopes to search for. @return the objects bound in the injector.
[ "Finds", "all", "of", "the", "instances", "in", "the", "specified", "scopes", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/core/src/main/java/com/meltmedia/cadmium/core/util/Jsr250Utils.java#L276-L290
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java
MFPPush.getTags
public void getTags(final MFPPushResponseListener<List<String>> listener) { """ Get the list of tags @param listener Mandatory listener class. When the list of tags are successfully retrieved the {@link MFPPushResponseListener} .onSuccess method is called with the list of tagNames {@link MFPPushResponseListener}.onFailure method is called otherwise """ MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getTagsUrl(); MFPPushInvoker invoker = MFPPushInvoker.newInstance(appContext, path, Request.GET, clientSecret); invoker.setResponseListener(new ResponseListener() { @Override public void onSuccess(Response response) { logger.info("MFPPush:getTags() - Successfully retreived tags. The response is: " + response.toString()); List<String> tagNames = new ArrayList<String>(); try { String responseText = response.getResponseText(); JSONArray tags = (JSONArray) (new JSONObject(responseText)).get(TAGS); Log.d("JSONArray of tags is: ", tags.toString()); int tagsCnt = tags.length(); for (int tagsIdx = 0; tagsIdx < tagsCnt; tagsIdx++) { Log.d("Adding tag: ", tags.getJSONObject(tagsIdx).toString()); tagNames.add(tags.getJSONObject(tagsIdx) .getString(NAME)); } listener.onSuccess(tagNames); } catch (JSONException e) { logger.error("MFPPush: getTags() - Error while retrieving tags. Error is: " + e.getMessage()); listener.onFailure(new MFPPushException(e)); } } @Override public void onFailure(Response response, Throwable throwable, JSONObject jsonObject) { //Error while getting tags. logger.error("MFPPush: Error while getting tags"); listener.onFailure(getException(response,throwable,jsonObject)); } }); invoker.execute(); }
java
public void getTags(final MFPPushResponseListener<List<String>> listener) { MFPPushUrlBuilder builder = new MFPPushUrlBuilder(applicationId); String path = builder.getTagsUrl(); MFPPushInvoker invoker = MFPPushInvoker.newInstance(appContext, path, Request.GET, clientSecret); invoker.setResponseListener(new ResponseListener() { @Override public void onSuccess(Response response) { logger.info("MFPPush:getTags() - Successfully retreived tags. The response is: " + response.toString()); List<String> tagNames = new ArrayList<String>(); try { String responseText = response.getResponseText(); JSONArray tags = (JSONArray) (new JSONObject(responseText)).get(TAGS); Log.d("JSONArray of tags is: ", tags.toString()); int tagsCnt = tags.length(); for (int tagsIdx = 0; tagsIdx < tagsCnt; tagsIdx++) { Log.d("Adding tag: ", tags.getJSONObject(tagsIdx).toString()); tagNames.add(tags.getJSONObject(tagsIdx) .getString(NAME)); } listener.onSuccess(tagNames); } catch (JSONException e) { logger.error("MFPPush: getTags() - Error while retrieving tags. Error is: " + e.getMessage()); listener.onFailure(new MFPPushException(e)); } } @Override public void onFailure(Response response, Throwable throwable, JSONObject jsonObject) { //Error while getting tags. logger.error("MFPPush: Error while getting tags"); listener.onFailure(getException(response,throwable,jsonObject)); } }); invoker.execute(); }
[ "public", "void", "getTags", "(", "final", "MFPPushResponseListener", "<", "List", "<", "String", ">", ">", "listener", ")", "{", "MFPPushUrlBuilder", "builder", "=", "new", "MFPPushUrlBuilder", "(", "applicationId", ")", ";", "String", "path", "=", "builder", ".", "getTagsUrl", "(", ")", ";", "MFPPushInvoker", "invoker", "=", "MFPPushInvoker", ".", "newInstance", "(", "appContext", ",", "path", ",", "Request", ".", "GET", ",", "clientSecret", ")", ";", "invoker", ".", "setResponseListener", "(", "new", "ResponseListener", "(", ")", "{", "@", "Override", "public", "void", "onSuccess", "(", "Response", "response", ")", "{", "logger", ".", "info", "(", "\"MFPPush:getTags() - Successfully retreived tags. The response is: \"", "+", "response", ".", "toString", "(", ")", ")", ";", "List", "<", "String", ">", "tagNames", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "try", "{", "String", "responseText", "=", "response", ".", "getResponseText", "(", ")", ";", "JSONArray", "tags", "=", "(", "JSONArray", ")", "(", "new", "JSONObject", "(", "responseText", ")", ")", ".", "get", "(", "TAGS", ")", ";", "Log", ".", "d", "(", "\"JSONArray of tags is: \"", ",", "tags", ".", "toString", "(", ")", ")", ";", "int", "tagsCnt", "=", "tags", ".", "length", "(", ")", ";", "for", "(", "int", "tagsIdx", "=", "0", ";", "tagsIdx", "<", "tagsCnt", ";", "tagsIdx", "++", ")", "{", "Log", ".", "d", "(", "\"Adding tag: \"", ",", "tags", ".", "getJSONObject", "(", "tagsIdx", ")", ".", "toString", "(", ")", ")", ";", "tagNames", ".", "add", "(", "tags", ".", "getJSONObject", "(", "tagsIdx", ")", ".", "getString", "(", "NAME", ")", ")", ";", "}", "listener", ".", "onSuccess", "(", "tagNames", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "logger", ".", "error", "(", "\"MFPPush: getTags() - Error while retrieving tags. Error is: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "listener", ".", "onFailure", "(", "new", "MFPPushException", "(", "e", ")", ")", ";", "}", "}", "@", "Override", "public", "void", "onFailure", "(", "Response", "response", ",", "Throwable", "throwable", ",", "JSONObject", "jsonObject", ")", "{", "//Error while getting tags.", "logger", ".", "error", "(", "\"MFPPush: Error while getting tags\"", ")", ";", "listener", ".", "onFailure", "(", "getException", "(", "response", ",", "throwable", ",", "jsonObject", ")", ")", ";", "}", "}", ")", ";", "invoker", ".", "execute", "(", ")", ";", "}" ]
Get the list of tags @param listener Mandatory listener class. When the list of tags are successfully retrieved the {@link MFPPushResponseListener} .onSuccess method is called with the list of tagNames {@link MFPPushResponseListener}.onFailure method is called otherwise
[ "Get", "the", "list", "of", "tags" ]
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L549-L585
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_service_serviceName_faxConsumption_consumptionId_GET
public OvhFaxConsumption billingAccount_service_serviceName_faxConsumption_consumptionId_GET(String billingAccount, String serviceName, Long consumptionId) throws IOException { """ Get this object properties REST: GET /telephony/{billingAccount}/service/{serviceName}/faxConsumption/{consumptionId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param consumptionId [required] """ String qPath = "/telephony/{billingAccount}/service/{serviceName}/faxConsumption/{consumptionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, consumptionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhFaxConsumption.class); }
java
public OvhFaxConsumption billingAccount_service_serviceName_faxConsumption_consumptionId_GET(String billingAccount, String serviceName, Long consumptionId) throws IOException { String qPath = "/telephony/{billingAccount}/service/{serviceName}/faxConsumption/{consumptionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, consumptionId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhFaxConsumption.class); }
[ "public", "OvhFaxConsumption", "billingAccount_service_serviceName_faxConsumption_consumptionId_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "consumptionId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/service/{serviceName}/faxConsumption/{consumptionId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ",", "consumptionId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhFaxConsumption", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /telephony/{billingAccount}/service/{serviceName}/faxConsumption/{consumptionId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param consumptionId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L4053-L4058
pressgang-ccms/PressGangCCMSContentSpec
src/main/java/org/jboss/pressgang/ccms/contentspec/ContentSpec.java
ContentSpec.appendChild
protected void appendChild(final Node child, boolean checkForType) { """ Adds a Child node to the Content Spec. If the Child node already has a parent, then it is removed from that parent and added to this content spec. @param child A Child Node to be added to the ContentSpec. @param checkForType If the method should check the type of the child, and use a type specific method instead. """ if (checkForType && child instanceof KeyValueNode) { appendKeyValueNode((KeyValueNode<?>) child); } else if (checkForType && child instanceof Level) { getBaseLevel().appendChild(child); } else if (checkForType && child instanceof SpecTopic) { getBaseLevel().appendChild(child); } else { nodes.add(child); if (child.getParent() != null) { child.removeParent(); } child.setParent(this); } }
java
protected void appendChild(final Node child, boolean checkForType) { if (checkForType && child instanceof KeyValueNode) { appendKeyValueNode((KeyValueNode<?>) child); } else if (checkForType && child instanceof Level) { getBaseLevel().appendChild(child); } else if (checkForType && child instanceof SpecTopic) { getBaseLevel().appendChild(child); } else { nodes.add(child); if (child.getParent() != null) { child.removeParent(); } child.setParent(this); } }
[ "protected", "void", "appendChild", "(", "final", "Node", "child", ",", "boolean", "checkForType", ")", "{", "if", "(", "checkForType", "&&", "child", "instanceof", "KeyValueNode", ")", "{", "appendKeyValueNode", "(", "(", "KeyValueNode", "<", "?", ">", ")", "child", ")", ";", "}", "else", "if", "(", "checkForType", "&&", "child", "instanceof", "Level", ")", "{", "getBaseLevel", "(", ")", ".", "appendChild", "(", "child", ")", ";", "}", "else", "if", "(", "checkForType", "&&", "child", "instanceof", "SpecTopic", ")", "{", "getBaseLevel", "(", ")", ".", "appendChild", "(", "child", ")", ";", "}", "else", "{", "nodes", ".", "add", "(", "child", ")", ";", "if", "(", "child", ".", "getParent", "(", ")", "!=", "null", ")", "{", "child", ".", "removeParent", "(", ")", ";", "}", "child", ".", "setParent", "(", "this", ")", ";", "}", "}" ]
Adds a Child node to the Content Spec. If the Child node already has a parent, then it is removed from that parent and added to this content spec. @param child A Child Node to be added to the ContentSpec. @param checkForType If the method should check the type of the child, and use a type specific method instead.
[ "Adds", "a", "Child", "node", "to", "the", "Content", "Spec", ".", "If", "the", "Child", "node", "already", "has", "a", "parent", "then", "it", "is", "removed", "from", "that", "parent", "and", "added", "to", "this", "content", "spec", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/ContentSpec.java#L2214-L2228
HotelsDotCom/corc
corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java
CorcInputFormat.setTypeInfo
public static void setTypeInfo(Configuration conf, StructTypeInfo typeInfo) { """ Sets the StructTypeInfo that declares the columns to be read in the configuration """ conf.set(INPUT_TYPE_INFO, typeInfo.getTypeName()); LOG.debug("Set input typeInfo on conf: {}", typeInfo); }
java
public static void setTypeInfo(Configuration conf, StructTypeInfo typeInfo) { conf.set(INPUT_TYPE_INFO, typeInfo.getTypeName()); LOG.debug("Set input typeInfo on conf: {}", typeInfo); }
[ "public", "static", "void", "setTypeInfo", "(", "Configuration", "conf", ",", "StructTypeInfo", "typeInfo", ")", "{", "conf", ".", "set", "(", "INPUT_TYPE_INFO", ",", "typeInfo", ".", "getTypeName", "(", ")", ")", ";", "LOG", ".", "debug", "(", "\"Set input typeInfo on conf: {}\"", ",", "typeInfo", ")", ";", "}" ]
Sets the StructTypeInfo that declares the columns to be read in the configuration
[ "Sets", "the", "StructTypeInfo", "that", "declares", "the", "columns", "to", "be", "read", "in", "the", "configuration" ]
train
https://github.com/HotelsDotCom/corc/blob/37ecb5966315e4cf630a878ffcbada61c50bdcd3/corc-core/src/main/java/com/hotels/corc/mapred/CorcInputFormat.java#L113-L116
motown-io/motown
utils/rest/src/main/java/io/motown/utils/rest/response/ResponseBuilder.java
ResponseBuilder.buildResponse
public static <T> Response<T> buildResponse(final HttpServletRequest request, final int offset, final int limit, final long total, final List<T> elements) { """ Build a {@link Response} from the request, offset, limit, total and list of elements. @param request The {@link javax.servlet.http.HttpServletRequest} which was executed. @param offset The offset of the results. @param limit The maximum number of results. @param total The total number of elements. @param elements The list of elements. @param <T> The type of elements in the list. This can be {@link io.motown.chargingstationconfiguration.viewmodel.persistence.entities.ChargingStationType} or {@link io.motown.chargingstationconfiguration.viewmodel.persistence.entities.Manufacturer}. @return A Configuration Api response with the correct metadata. @throws IllegalArgumentException when the {@code offset} is negative, the {@code limit} is lesser than or equal to 0, the {@code total} is negative and when {@code offset} is lesser than the {@code total} (only if {@code total} is greater than 0. """ checkArgument(offset >= 0); checkArgument(limit >= 1); checkArgument(total >= 0); checkArgument(total == 0 || offset < total); String requestUri = request.getRequestURI(); String queryString = request.getQueryString(); String href = requestUri + (!Strings.isNullOrEmpty(queryString) ? "?" + queryString : ""); NavigationItem previous = new NavigationItem(hasPreviousPage(offset) ? requestUri + String.format(QUERY_STRING_FORMAT, getPreviousPageOffset(offset, limit), limit) : ""); NavigationItem next = new NavigationItem(hasNextPage(offset, limit, total) ? requestUri + String.format(QUERY_STRING_FORMAT, getNextPageOffset(offset, limit, total), limit) : ""); NavigationItem first = new NavigationItem(requestUri + String.format(QUERY_STRING_FORMAT, getFirstPageOffset(), limit)); NavigationItem last = new NavigationItem(requestUri + String.format(QUERY_STRING_FORMAT, getLastPageOffset(total, limit), limit)); return new Response<>(href, previous, next, first, last, elements); }
java
public static <T> Response<T> buildResponse(final HttpServletRequest request, final int offset, final int limit, final long total, final List<T> elements) { checkArgument(offset >= 0); checkArgument(limit >= 1); checkArgument(total >= 0); checkArgument(total == 0 || offset < total); String requestUri = request.getRequestURI(); String queryString = request.getQueryString(); String href = requestUri + (!Strings.isNullOrEmpty(queryString) ? "?" + queryString : ""); NavigationItem previous = new NavigationItem(hasPreviousPage(offset) ? requestUri + String.format(QUERY_STRING_FORMAT, getPreviousPageOffset(offset, limit), limit) : ""); NavigationItem next = new NavigationItem(hasNextPage(offset, limit, total) ? requestUri + String.format(QUERY_STRING_FORMAT, getNextPageOffset(offset, limit, total), limit) : ""); NavigationItem first = new NavigationItem(requestUri + String.format(QUERY_STRING_FORMAT, getFirstPageOffset(), limit)); NavigationItem last = new NavigationItem(requestUri + String.format(QUERY_STRING_FORMAT, getLastPageOffset(total, limit), limit)); return new Response<>(href, previous, next, first, last, elements); }
[ "public", "static", "<", "T", ">", "Response", "<", "T", ">", "buildResponse", "(", "final", "HttpServletRequest", "request", ",", "final", "int", "offset", ",", "final", "int", "limit", ",", "final", "long", "total", ",", "final", "List", "<", "T", ">", "elements", ")", "{", "checkArgument", "(", "offset", ">=", "0", ")", ";", "checkArgument", "(", "limit", ">=", "1", ")", ";", "checkArgument", "(", "total", ">=", "0", ")", ";", "checkArgument", "(", "total", "==", "0", "||", "offset", "<", "total", ")", ";", "String", "requestUri", "=", "request", ".", "getRequestURI", "(", ")", ";", "String", "queryString", "=", "request", ".", "getQueryString", "(", ")", ";", "String", "href", "=", "requestUri", "+", "(", "!", "Strings", ".", "isNullOrEmpty", "(", "queryString", ")", "?", "\"?\"", "+", "queryString", ":", "\"\"", ")", ";", "NavigationItem", "previous", "=", "new", "NavigationItem", "(", "hasPreviousPage", "(", "offset", ")", "?", "requestUri", "+", "String", ".", "format", "(", "QUERY_STRING_FORMAT", ",", "getPreviousPageOffset", "(", "offset", ",", "limit", ")", ",", "limit", ")", ":", "\"\"", ")", ";", "NavigationItem", "next", "=", "new", "NavigationItem", "(", "hasNextPage", "(", "offset", ",", "limit", ",", "total", ")", "?", "requestUri", "+", "String", ".", "format", "(", "QUERY_STRING_FORMAT", ",", "getNextPageOffset", "(", "offset", ",", "limit", ",", "total", ")", ",", "limit", ")", ":", "\"\"", ")", ";", "NavigationItem", "first", "=", "new", "NavigationItem", "(", "requestUri", "+", "String", ".", "format", "(", "QUERY_STRING_FORMAT", ",", "getFirstPageOffset", "(", ")", ",", "limit", ")", ")", ";", "NavigationItem", "last", "=", "new", "NavigationItem", "(", "requestUri", "+", "String", ".", "format", "(", "QUERY_STRING_FORMAT", ",", "getLastPageOffset", "(", "total", ",", "limit", ")", ",", "limit", ")", ")", ";", "return", "new", "Response", "<>", "(", "href", ",", "previous", ",", "next", ",", "first", ",", "last", ",", "elements", ")", ";", "}" ]
Build a {@link Response} from the request, offset, limit, total and list of elements. @param request The {@link javax.servlet.http.HttpServletRequest} which was executed. @param offset The offset of the results. @param limit The maximum number of results. @param total The total number of elements. @param elements The list of elements. @param <T> The type of elements in the list. This can be {@link io.motown.chargingstationconfiguration.viewmodel.persistence.entities.ChargingStationType} or {@link io.motown.chargingstationconfiguration.viewmodel.persistence.entities.Manufacturer}. @return A Configuration Api response with the correct metadata. @throws IllegalArgumentException when the {@code offset} is negative, the {@code limit} is lesser than or equal to 0, the {@code total} is negative and when {@code offset} is lesser than the {@code total} (only if {@code total} is greater than 0.
[ "Build", "a", "{", "@link", "Response", "}", "from", "the", "request", "offset", "limit", "total", "and", "list", "of", "elements", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/utils/rest/src/main/java/io/motown/utils/rest/response/ResponseBuilder.java#L45-L61
JoeKerouac/utils
src/main/java/com/joe/utils/common/DateUtil.java
DateUtil.convert
public static String convert(String date, String format, String newFormat) { """ 将一种格式的日期转换为另一种格式 @param date 日期字符串 @param format 日期对应的格式 @param newFormat 要转换的新格式 @return 新格式的日期 """ return getFormatDate(newFormat, parse(date, format)); }
java
public static String convert(String date, String format, String newFormat) { return getFormatDate(newFormat, parse(date, format)); }
[ "public", "static", "String", "convert", "(", "String", "date", ",", "String", "format", ",", "String", "newFormat", ")", "{", "return", "getFormatDate", "(", "newFormat", ",", "parse", "(", "date", ",", "format", ")", ")", ";", "}" ]
将一种格式的日期转换为另一种格式 @param date 日期字符串 @param format 日期对应的格式 @param newFormat 要转换的新格式 @return 新格式的日期
[ "将一种格式的日期转换为另一种格式" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/common/DateUtil.java#L54-L56
xcesco/kripton
kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java
StringUtils.bytesToHex
public static String bytesToHex(byte[] bytes, int size) { """ Bytes to hex. @param bytes the bytes @param size the size @return the string """ size=Math.min(bytes.length, size); char[] hexChars = new char[size * 2]; for ( int j = 0; j < size; j++ ) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars); }
java
public static String bytesToHex(byte[] bytes, int size) { size=Math.min(bytes.length, size); char[] hexChars = new char[size * 2]; for ( int j = 0; j < size; j++ ) { int v = bytes[j] & 0xFF; hexChars[j * 2] = hexArray[v >>> 4]; hexChars[j * 2 + 1] = hexArray[v & 0x0F]; } return new String(hexChars); }
[ "public", "static", "String", "bytesToHex", "(", "byte", "[", "]", "bytes", ",", "int", "size", ")", "{", "size", "=", "Math", ".", "min", "(", "bytes", ".", "length", ",", "size", ")", ";", "char", "[", "]", "hexChars", "=", "new", "char", "[", "size", "*", "2", "]", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "size", ";", "j", "++", ")", "{", "int", "v", "=", "bytes", "[", "j", "]", "&", "0xFF", ";", "hexChars", "[", "j", "*", "2", "]", "=", "hexArray", "[", "v", ">>>", "4", "]", ";", "hexChars", "[", "j", "*", "2", "+", "1", "]", "=", "hexArray", "[", "v", "&", "0x0F", "]", ";", "}", "return", "new", "String", "(", "hexChars", ")", ";", "}" ]
Bytes to hex. @param bytes the bytes @param size the size @return the string
[ "Bytes", "to", "hex", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/StringUtils.java#L102-L111
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/script/Script.java
Script.getSigOpCount
private static int getSigOpCount(List<ScriptChunk> chunks, boolean accurate) throws ScriptException { """ //////////////////// Interface used during verification of transactions/blocks //////////////////////////////// """ int sigOps = 0; int lastOpCode = OP_INVALIDOPCODE; for (ScriptChunk chunk : chunks) { if (chunk.isOpCode()) { switch (chunk.opcode) { case OP_CHECKSIG: case OP_CHECKSIGVERIFY: sigOps++; break; case OP_CHECKMULTISIG: case OP_CHECKMULTISIGVERIFY: if (accurate && lastOpCode >= OP_1 && lastOpCode <= OP_16) sigOps += decodeFromOpN(lastOpCode); else sigOps += 20; break; default: break; } lastOpCode = chunk.opcode; } } return sigOps; }
java
private static int getSigOpCount(List<ScriptChunk> chunks, boolean accurate) throws ScriptException { int sigOps = 0; int lastOpCode = OP_INVALIDOPCODE; for (ScriptChunk chunk : chunks) { if (chunk.isOpCode()) { switch (chunk.opcode) { case OP_CHECKSIG: case OP_CHECKSIGVERIFY: sigOps++; break; case OP_CHECKMULTISIG: case OP_CHECKMULTISIGVERIFY: if (accurate && lastOpCode >= OP_1 && lastOpCode <= OP_16) sigOps += decodeFromOpN(lastOpCode); else sigOps += 20; break; default: break; } lastOpCode = chunk.opcode; } } return sigOps; }
[ "private", "static", "int", "getSigOpCount", "(", "List", "<", "ScriptChunk", ">", "chunks", ",", "boolean", "accurate", ")", "throws", "ScriptException", "{", "int", "sigOps", "=", "0", ";", "int", "lastOpCode", "=", "OP_INVALIDOPCODE", ";", "for", "(", "ScriptChunk", "chunk", ":", "chunks", ")", "{", "if", "(", "chunk", ".", "isOpCode", "(", ")", ")", "{", "switch", "(", "chunk", ".", "opcode", ")", "{", "case", "OP_CHECKSIG", ":", "case", "OP_CHECKSIGVERIFY", ":", "sigOps", "++", ";", "break", ";", "case", "OP_CHECKMULTISIG", ":", "case", "OP_CHECKMULTISIGVERIFY", ":", "if", "(", "accurate", "&&", "lastOpCode", ">=", "OP_1", "&&", "lastOpCode", "<=", "OP_16", ")", "sigOps", "+=", "decodeFromOpN", "(", "lastOpCode", ")", ";", "else", "sigOps", "+=", "20", ";", "break", ";", "default", ":", "break", ";", "}", "lastOpCode", "=", "chunk", ".", "opcode", ";", "}", "}", "return", "sigOps", ";", "}" ]
//////////////////// Interface used during verification of transactions/blocks ////////////////////////////////
[ "////////////////////", "Interface", "used", "during", "verification", "of", "transactions", "/", "blocks", "////////////////////////////////" ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/script/Script.java#L510-L534
neo4j-contrib/neo4j-apoc-procedures
src/main/java/apoc/algo/algorithms/Chunks.java
Chunks.sumUp
public void sumUp() { """ special operation implemented inline to compute and store sum up until here """ int offset=0; int tmp=0; for (int i = 0; i < numChunks; i++) { int[] chunk = chunks[i]; if (chunk==null) throw new IllegalStateException("Chunks are not continous, null fragement at offset "+i); for (int j = 0; j < chunkSize; j++) { tmp = chunk[j]; chunk[j] = offset; offset += tmp; } } }
java
public void sumUp() { int offset=0; int tmp=0; for (int i = 0; i < numChunks; i++) { int[] chunk = chunks[i]; if (chunk==null) throw new IllegalStateException("Chunks are not continous, null fragement at offset "+i); for (int j = 0; j < chunkSize; j++) { tmp = chunk[j]; chunk[j] = offset; offset += tmp; } } }
[ "public", "void", "sumUp", "(", ")", "{", "int", "offset", "=", "0", ";", "int", "tmp", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numChunks", ";", "i", "++", ")", "{", "int", "[", "]", "chunk", "=", "chunks", "[", "i", "]", ";", "if", "(", "chunk", "==", "null", ")", "throw", "new", "IllegalStateException", "(", "\"Chunks are not continous, null fragement at offset \"", "+", "i", ")", ";", "for", "(", "int", "j", "=", "0", ";", "j", "<", "chunkSize", ";", "j", "++", ")", "{", "tmp", "=", "chunk", "[", "j", "]", ";", "chunk", "[", "j", "]", "=", "offset", ";", "offset", "+=", "tmp", ";", "}", "}", "}" ]
special operation implemented inline to compute and store sum up until here
[ "special", "operation", "implemented", "inline", "to", "compute", "and", "store", "sum", "up", "until", "here" ]
train
https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/e8386975d1c512c0e4388a1a61f5496121c04f86/src/main/java/apoc/algo/algorithms/Chunks.java#L135-L147
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java
CertificatesImpl.cancelDeletionAsync
public Observable<Void> cancelDeletionAsync(String thumbprintAlgorithm, String thumbprint) { """ Cancels a failed deletion of a certificate from the specified account. If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. @param thumbprint The thumbprint of the certificate being deleted. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful. """ return cancelDeletionWithServiceResponseAsync(thumbprintAlgorithm, thumbprint).map(new Func1<ServiceResponseWithHeaders<Void, CertificateCancelDeletionHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, CertificateCancelDeletionHeaders> response) { return response.body(); } }); }
java
public Observable<Void> cancelDeletionAsync(String thumbprintAlgorithm, String thumbprint) { return cancelDeletionWithServiceResponseAsync(thumbprintAlgorithm, thumbprint).map(new Func1<ServiceResponseWithHeaders<Void, CertificateCancelDeletionHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, CertificateCancelDeletionHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "cancelDeletionAsync", "(", "String", "thumbprintAlgorithm", ",", "String", "thumbprint", ")", "{", "return", "cancelDeletionWithServiceResponseAsync", "(", "thumbprintAlgorithm", ",", "thumbprint", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "Void", ",", "CertificateCancelDeletionHeaders", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponseWithHeaders", "<", "Void", ",", "CertificateCancelDeletionHeaders", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Cancels a failed deletion of a certificate from the specified account. If you try to delete a certificate that is being used by a pool or compute node, the status of the certificate changes to deleteFailed. If you decide that you want to continue using the certificate, you can use this operation to set the status of the certificate back to active. If you intend to delete the certificate, you do not need to run this operation after the deletion failed. You must make sure that the certificate is not being used by any resources, and then you can try again to delete the certificate. @param thumbprintAlgorithm The algorithm used to derive the thumbprint parameter. This must be sha1. @param thumbprint The thumbprint of the certificate being deleted. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Cancels", "a", "failed", "deletion", "of", "a", "certificate", "from", "the", "specified", "account", ".", "If", "you", "try", "to", "delete", "a", "certificate", "that", "is", "being", "used", "by", "a", "pool", "or", "compute", "node", "the", "status", "of", "the", "certificate", "changes", "to", "deleteFailed", ".", "If", "you", "decide", "that", "you", "want", "to", "continue", "using", "the", "certificate", "you", "can", "use", "this", "operation", "to", "set", "the", "status", "of", "the", "certificate", "back", "to", "active", ".", "If", "you", "intend", "to", "delete", "the", "certificate", "you", "do", "not", "need", "to", "run", "this", "operation", "after", "the", "deletion", "failed", ".", "You", "must", "make", "sure", "that", "the", "certificate", "is", "not", "being", "used", "by", "any", "resources", "and", "then", "you", "can", "try", "again", "to", "delete", "the", "certificate", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java#L609-L616
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java
GVRScriptManager.loadScriptBundle
@Override public IScriptBundle loadScriptBundle(String filePath, GVRResourceVolume volume) throws IOException { """ Load a script bundle file. It defines bindings between scripts and GVRf objects (e.g., scene objects and the {@link GVRMain} object). @param filePath The path and filename of the script bundle. @param volume The {@link GVRResourceVolume} from which to load the bundle file and scripts. @return The loaded {@linkplain GVRScriptBundle script bundle}. @throws IOException if script bundle file cannot be read. """ GVRScriptBundle bundle = GVRScriptBundle.loadFromFile(mGvrContext, filePath, volume); return bundle; }
java
@Override public IScriptBundle loadScriptBundle(String filePath, GVRResourceVolume volume) throws IOException { GVRScriptBundle bundle = GVRScriptBundle.loadFromFile(mGvrContext, filePath, volume); return bundle; }
[ "@", "Override", "public", "IScriptBundle", "loadScriptBundle", "(", "String", "filePath", ",", "GVRResourceVolume", "volume", ")", "throws", "IOException", "{", "GVRScriptBundle", "bundle", "=", "GVRScriptBundle", ".", "loadFromFile", "(", "mGvrContext", ",", "filePath", ",", "volume", ")", ";", "return", "bundle", ";", "}" ]
Load a script bundle file. It defines bindings between scripts and GVRf objects (e.g., scene objects and the {@link GVRMain} object). @param filePath The path and filename of the script bundle. @param volume The {@link GVRResourceVolume} from which to load the bundle file and scripts. @return The loaded {@linkplain GVRScriptBundle script bundle}. @throws IOException if script bundle file cannot be read.
[ "Load", "a", "script", "bundle", "file", ".", "It", "defines", "bindings", "between", "scripts", "and", "GVRf", "objects", "(", "e", ".", "g", ".", "scene", "objects", "and", "the", "{", "@link", "GVRMain", "}", "object", ")", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptManager.java#L251-L255
calimero-project/calimero-core
src/tuwien/auto/calimero/knxnetip/ConnectionBase.java
ConnectionBase.fireFrameReceived
protected void fireFrameReceived(final CEMI frame) { """ Fires a frame received event ({@link KNXListener#frameReceived(FrameEvent)}) for the supplied cEMI <code>frame</code>. @param frame the cEMI to generate the event for """ final FrameEvent fe = new FrameEvent(this, frame); listeners.fire(l -> l.frameReceived(fe)); }
java
protected void fireFrameReceived(final CEMI frame) { final FrameEvent fe = new FrameEvent(this, frame); listeners.fire(l -> l.frameReceived(fe)); }
[ "protected", "void", "fireFrameReceived", "(", "final", "CEMI", "frame", ")", "{", "final", "FrameEvent", "fe", "=", "new", "FrameEvent", "(", "this", ",", "frame", ")", ";", "listeners", ".", "fire", "(", "l", "->", "l", ".", "frameReceived", "(", "fe", ")", ")", ";", "}" ]
Fires a frame received event ({@link KNXListener#frameReceived(FrameEvent)}) for the supplied cEMI <code>frame</code>. @param frame the cEMI to generate the event for
[ "Fires", "a", "frame", "received", "event", "(", "{", "@link", "KNXListener#frameReceived", "(", "FrameEvent", ")", "}", ")", "for", "the", "supplied", "cEMI", "<code", ">", "frame<", "/", "code", ">", "." ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/knxnetip/ConnectionBase.java#L355-L359
gallandarakhneorg/afc
advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileField.java
DBaseFileField.updateSizes
@SuppressWarnings("checkstyle:cyclomaticcomplexity") void updateSizes(int fieldLength, int decimalPointPosition) { """ Update the sizes with the given ones if and only if they are greater than the existing ones. This test is done according to the type of the field. @param fieldLength is the size of this field @param decimalPointPosition is the position of the decimal point. """ switch (this.type) { case STRING: if (fieldLength > this.length) { this.length = fieldLength; } break; case FLOATING_NUMBER: case NUMBER: if (decimalPointPosition > this.decimal) { final int intPart = this.length - this.decimal; this.decimal = decimalPointPosition; this.length = intPart + this.decimal; } if (fieldLength > this.length) { this.length = fieldLength; } break; //$CASES-OMITTED$ default: // Do nothing } }
java
@SuppressWarnings("checkstyle:cyclomaticcomplexity") void updateSizes(int fieldLength, int decimalPointPosition) { switch (this.type) { case STRING: if (fieldLength > this.length) { this.length = fieldLength; } break; case FLOATING_NUMBER: case NUMBER: if (decimalPointPosition > this.decimal) { final int intPart = this.length - this.decimal; this.decimal = decimalPointPosition; this.length = intPart + this.decimal; } if (fieldLength > this.length) { this.length = fieldLength; } break; //$CASES-OMITTED$ default: // Do nothing } }
[ "@", "SuppressWarnings", "(", "\"checkstyle:cyclomaticcomplexity\"", ")", "void", "updateSizes", "(", "int", "fieldLength", ",", "int", "decimalPointPosition", ")", "{", "switch", "(", "this", ".", "type", ")", "{", "case", "STRING", ":", "if", "(", "fieldLength", ">", "this", ".", "length", ")", "{", "this", ".", "length", "=", "fieldLength", ";", "}", "break", ";", "case", "FLOATING_NUMBER", ":", "case", "NUMBER", ":", "if", "(", "decimalPointPosition", ">", "this", ".", "decimal", ")", "{", "final", "int", "intPart", "=", "this", ".", "length", "-", "this", ".", "decimal", ";", "this", ".", "decimal", "=", "decimalPointPosition", ";", "this", ".", "length", "=", "intPart", "+", "this", ".", "decimal", ";", "}", "if", "(", "fieldLength", ">", "this", ".", "length", ")", "{", "this", ".", "length", "=", "fieldLength", ";", "}", "break", ";", "//$CASES-OMITTED$", "default", ":", "// Do nothing", "}", "}" ]
Update the sizes with the given ones if and only if they are greater than the existing ones. This test is done according to the type of the field. @param fieldLength is the size of this field @param decimalPointPosition is the position of the decimal point.
[ "Update", "the", "sizes", "with", "the", "given", "ones", "if", "and", "only", "if", "they", "are", "greater", "than", "the", "existing", "ones", ".", "This", "test", "is", "done", "according", "to", "the", "type", "of", "the", "field", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileField.java#L254-L277
NLPchina/elasticsearch-sql
src/main/java/org/nlpcn/es4sql/query/maker/AggMaker.java
AggMaker.makeFieldAgg
public AggregationBuilder makeFieldAgg(MethodField field, AggregationBuilder parent) throws SqlParseException { """ Create aggregation according to the SQL function. zhongshu-comment 根据sql中的函数来生成一些agg,例如sql中的count()、sum()函数,这是agg链中最里边的那个agg了,eg: select a,b,count(c),sum(d) from tbl group by a,b @param field SQL function @param parent parentAggregation @return AggregationBuilder represents the SQL function @throws SqlParseException in case of unrecognized function """ //question 加到groupMap里是为了什么 groupMap.put(field.getAlias(), new KVValue("FIELD", parent)); ValuesSourceAggregationBuilder builder; field.setAlias(fixAlias(field.getAlias())); switch (field.getName().toUpperCase()) { case "SUM": builder = AggregationBuilders.sum(field.getAlias()); return addFieldToAgg(field, builder); case "MAX": builder = AggregationBuilders.max(field.getAlias()); return addFieldToAgg(field, builder); case "MIN": builder = AggregationBuilders.min(field.getAlias()); return addFieldToAgg(field, builder); case "AVG": builder = AggregationBuilders.avg(field.getAlias()); return addFieldToAgg(field, builder); case "STATS": builder = AggregationBuilders.stats(field.getAlias()); return addFieldToAgg(field, builder); case "EXTENDED_STATS": builder = AggregationBuilders.extendedStats(field.getAlias()); return addFieldToAgg(field, builder); case "PERCENTILES": builder = AggregationBuilders.percentiles(field.getAlias()); addSpecificPercentiles((PercentilesAggregationBuilder) builder, field.getParams()); return addFieldToAgg(field, builder); case "TOPHITS": return makeTopHitsAgg(field); case "SCRIPTED_METRIC": return scriptedMetric(field); case "COUNT": groupMap.put(field.getAlias(), new KVValue("COUNT", parent)); return addFieldToAgg(field, makeCountAgg(field)); default: throw new SqlParseException("the agg function not to define !"); } }
java
public AggregationBuilder makeFieldAgg(MethodField field, AggregationBuilder parent) throws SqlParseException { //question 加到groupMap里是为了什么 groupMap.put(field.getAlias(), new KVValue("FIELD", parent)); ValuesSourceAggregationBuilder builder; field.setAlias(fixAlias(field.getAlias())); switch (field.getName().toUpperCase()) { case "SUM": builder = AggregationBuilders.sum(field.getAlias()); return addFieldToAgg(field, builder); case "MAX": builder = AggregationBuilders.max(field.getAlias()); return addFieldToAgg(field, builder); case "MIN": builder = AggregationBuilders.min(field.getAlias()); return addFieldToAgg(field, builder); case "AVG": builder = AggregationBuilders.avg(field.getAlias()); return addFieldToAgg(field, builder); case "STATS": builder = AggregationBuilders.stats(field.getAlias()); return addFieldToAgg(field, builder); case "EXTENDED_STATS": builder = AggregationBuilders.extendedStats(field.getAlias()); return addFieldToAgg(field, builder); case "PERCENTILES": builder = AggregationBuilders.percentiles(field.getAlias()); addSpecificPercentiles((PercentilesAggregationBuilder) builder, field.getParams()); return addFieldToAgg(field, builder); case "TOPHITS": return makeTopHitsAgg(field); case "SCRIPTED_METRIC": return scriptedMetric(field); case "COUNT": groupMap.put(field.getAlias(), new KVValue("COUNT", parent)); return addFieldToAgg(field, makeCountAgg(field)); default: throw new SqlParseException("the agg function not to define !"); } }
[ "public", "AggregationBuilder", "makeFieldAgg", "(", "MethodField", "field", ",", "AggregationBuilder", "parent", ")", "throws", "SqlParseException", "{", "//question 加到groupMap里是为了什么", "groupMap", ".", "put", "(", "field", ".", "getAlias", "(", ")", ",", "new", "KVValue", "(", "\"FIELD\"", ",", "parent", ")", ")", ";", "ValuesSourceAggregationBuilder", "builder", ";", "field", ".", "setAlias", "(", "fixAlias", "(", "field", ".", "getAlias", "(", ")", ")", ")", ";", "switch", "(", "field", ".", "getName", "(", ")", ".", "toUpperCase", "(", ")", ")", "{", "case", "\"SUM\"", ":", "builder", "=", "AggregationBuilders", ".", "sum", "(", "field", ".", "getAlias", "(", ")", ")", ";", "return", "addFieldToAgg", "(", "field", ",", "builder", ")", ";", "case", "\"MAX\"", ":", "builder", "=", "AggregationBuilders", ".", "max", "(", "field", ".", "getAlias", "(", ")", ")", ";", "return", "addFieldToAgg", "(", "field", ",", "builder", ")", ";", "case", "\"MIN\"", ":", "builder", "=", "AggregationBuilders", ".", "min", "(", "field", ".", "getAlias", "(", ")", ")", ";", "return", "addFieldToAgg", "(", "field", ",", "builder", ")", ";", "case", "\"AVG\"", ":", "builder", "=", "AggregationBuilders", ".", "avg", "(", "field", ".", "getAlias", "(", ")", ")", ";", "return", "addFieldToAgg", "(", "field", ",", "builder", ")", ";", "case", "\"STATS\"", ":", "builder", "=", "AggregationBuilders", ".", "stats", "(", "field", ".", "getAlias", "(", ")", ")", ";", "return", "addFieldToAgg", "(", "field", ",", "builder", ")", ";", "case", "\"EXTENDED_STATS\"", ":", "builder", "=", "AggregationBuilders", ".", "extendedStats", "(", "field", ".", "getAlias", "(", ")", ")", ";", "return", "addFieldToAgg", "(", "field", ",", "builder", ")", ";", "case", "\"PERCENTILES\"", ":", "builder", "=", "AggregationBuilders", ".", "percentiles", "(", "field", ".", "getAlias", "(", ")", ")", ";", "addSpecificPercentiles", "(", "(", "PercentilesAggregationBuilder", ")", "builder", ",", "field", ".", "getParams", "(", ")", ")", ";", "return", "addFieldToAgg", "(", "field", ",", "builder", ")", ";", "case", "\"TOPHITS\"", ":", "return", "makeTopHitsAgg", "(", "field", ")", ";", "case", "\"SCRIPTED_METRIC\"", ":", "return", "scriptedMetric", "(", "field", ")", ";", "case", "\"COUNT\"", ":", "groupMap", ".", "put", "(", "field", ".", "getAlias", "(", ")", ",", "new", "KVValue", "(", "\"COUNT\"", ",", "parent", ")", ")", ";", "return", "addFieldToAgg", "(", "field", ",", "makeCountAgg", "(", "field", ")", ")", ";", "default", ":", "throw", "new", "SqlParseException", "(", "\"the agg function not to define !\"", ")", ";", "}", "}" ]
Create aggregation according to the SQL function. zhongshu-comment 根据sql中的函数来生成一些agg,例如sql中的count()、sum()函数,这是agg链中最里边的那个agg了,eg: select a,b,count(c),sum(d) from tbl group by a,b @param field SQL function @param parent parentAggregation @return AggregationBuilder represents the SQL function @throws SqlParseException in case of unrecognized function
[ "Create", "aggregation", "according", "to", "the", "SQL", "function", ".", "zhongshu", "-", "comment", "根据sql中的函数来生成一些agg,例如sql中的count", "()", "、sum", "()", "函数,这是agg链中最里边的那个agg了,eg:", "select", "a", "b", "count", "(", "c", ")", "sum", "(", "d", ")", "from", "tbl", "group", "by", "a", "b" ]
train
https://github.com/NLPchina/elasticsearch-sql/blob/eaab70b4bf1729978911b83eb96e816ebcfe6e7f/src/main/java/org/nlpcn/es4sql/query/maker/AggMaker.java#L128-L167
wdtinc/mapbox-vector-tile-java
src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/JtsAdapter.java
JtsAdapter.moveCursor
private static void moveCursor(Vec2d cursor, List<Integer> geomCmds, Vec2d mvtPos) { """ <p>Appends {@link ZigZag#encode(int)} of delta in x,y from {@code cursor} to {@code mvtPos} into the {@code geomCmds} buffer.</p> <p>Afterwards, the {@code cursor} values are changed to match the {@code mvtPos} values.</p> @param cursor MVT cursor position @param geomCmds geometry command list @param mvtPos next MVT cursor position """ // Delta, then zigzag geomCmds.add(ZigZag.encode((int)mvtPos.x - (int)cursor.x)); geomCmds.add(ZigZag.encode((int)mvtPos.y - (int)cursor.y)); cursor.set(mvtPos); }
java
private static void moveCursor(Vec2d cursor, List<Integer> geomCmds, Vec2d mvtPos) { // Delta, then zigzag geomCmds.add(ZigZag.encode((int)mvtPos.x - (int)cursor.x)); geomCmds.add(ZigZag.encode((int)mvtPos.y - (int)cursor.y)); cursor.set(mvtPos); }
[ "private", "static", "void", "moveCursor", "(", "Vec2d", "cursor", ",", "List", "<", "Integer", ">", "geomCmds", ",", "Vec2d", "mvtPos", ")", "{", "// Delta, then zigzag", "geomCmds", ".", "add", "(", "ZigZag", ".", "encode", "(", "(", "int", ")", "mvtPos", ".", "x", "-", "(", "int", ")", "cursor", ".", "x", ")", ")", ";", "geomCmds", ".", "add", "(", "ZigZag", ".", "encode", "(", "(", "int", ")", "mvtPos", ".", "y", "-", "(", "int", ")", "cursor", ".", "y", ")", ")", ";", "cursor", ".", "set", "(", "mvtPos", ")", ";", "}" ]
<p>Appends {@link ZigZag#encode(int)} of delta in x,y from {@code cursor} to {@code mvtPos} into the {@code geomCmds} buffer.</p> <p>Afterwards, the {@code cursor} values are changed to match the {@code mvtPos} values.</p> @param cursor MVT cursor position @param geomCmds geometry command list @param mvtPos next MVT cursor position
[ "<p", ">", "Appends", "{", "@link", "ZigZag#encode", "(", "int", ")", "}", "of", "delta", "in", "x", "y", "from", "{", "@code", "cursor", "}", "to", "{", "@code", "mvtPos", "}", "into", "the", "{", "@code", "geomCmds", "}", "buffer", ".", "<", "/", "p", ">" ]
train
https://github.com/wdtinc/mapbox-vector-tile-java/blob/e5e3df3fc2260709e289f972a1348c0a1ea30339/src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/JtsAdapter.java#L600-L607
primefaces-extensions/core
src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java
SheetRenderer.decodeSelection
private void decodeSelection(final FacesContext context, final Sheet sheet, final String jsonSelection) { """ Decodes the user Selection JSON data @param context @param sheet @param jsonSelection """ if (LangUtils.isValueBlank(jsonSelection)) { return; } try { // data comes in: [ [row, col, oldValue, newValue] ... ] final JSONArray array = new JSONArray(jsonSelection); sheet.setSelectedRow(array.getInt(0)); sheet.setSelectedColumn(sheet.getMappedColumn(array.getInt(1))); sheet.setSelectedLastRow(array.getInt(2)); sheet.setSelectedLastColumn(array.getInt(3)); sheet.setSelection(jsonSelection); } catch (final JSONException e) { throw new FacesException("Failed parsing Ajax JSON message for cell selection event:" + e.getMessage(), e); } }
java
private void decodeSelection(final FacesContext context, final Sheet sheet, final String jsonSelection) { if (LangUtils.isValueBlank(jsonSelection)) { return; } try { // data comes in: [ [row, col, oldValue, newValue] ... ] final JSONArray array = new JSONArray(jsonSelection); sheet.setSelectedRow(array.getInt(0)); sheet.setSelectedColumn(sheet.getMappedColumn(array.getInt(1))); sheet.setSelectedLastRow(array.getInt(2)); sheet.setSelectedLastColumn(array.getInt(3)); sheet.setSelection(jsonSelection); } catch (final JSONException e) { throw new FacesException("Failed parsing Ajax JSON message for cell selection event:" + e.getMessage(), e); } }
[ "private", "void", "decodeSelection", "(", "final", "FacesContext", "context", ",", "final", "Sheet", "sheet", ",", "final", "String", "jsonSelection", ")", "{", "if", "(", "LangUtils", ".", "isValueBlank", "(", "jsonSelection", ")", ")", "{", "return", ";", "}", "try", "{", "// data comes in: [ [row, col, oldValue, newValue] ... ]", "final", "JSONArray", "array", "=", "new", "JSONArray", "(", "jsonSelection", ")", ";", "sheet", ".", "setSelectedRow", "(", "array", ".", "getInt", "(", "0", ")", ")", ";", "sheet", ".", "setSelectedColumn", "(", "sheet", ".", "getMappedColumn", "(", "array", ".", "getInt", "(", "1", ")", ")", ")", ";", "sheet", ".", "setSelectedLastRow", "(", "array", ".", "getInt", "(", "2", ")", ")", ";", "sheet", ".", "setSelectedLastColumn", "(", "array", ".", "getInt", "(", "3", ")", ")", ";", "sheet", ".", "setSelection", "(", "jsonSelection", ")", ";", "}", "catch", "(", "final", "JSONException", "e", ")", "{", "throw", "new", "FacesException", "(", "\"Failed parsing Ajax JSON message for cell selection event:\"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "}" ]
Decodes the user Selection JSON data @param context @param sheet @param jsonSelection
[ "Decodes", "the", "user", "Selection", "JSON", "data" ]
train
https://github.com/primefaces-extensions/core/blob/afdbca591f60f47898e3517e1e939bc2f63d5355/src/main/java/org/primefaces/extensions/component/sheet/SheetRenderer.java#L935-L952
aws/aws-sdk-java
aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchv2/model/ListDomainNamesResult.java
ListDomainNamesResult.withDomainNames
public ListDomainNamesResult withDomainNames(java.util.Map<String, String> domainNames) { """ <p> The names of the search domains owned by an account. </p> @param domainNames The names of the search domains owned by an account. @return Returns a reference to this object so that method calls can be chained together. """ setDomainNames(domainNames); return this; }
java
public ListDomainNamesResult withDomainNames(java.util.Map<String, String> domainNames) { setDomainNames(domainNames); return this; }
[ "public", "ListDomainNamesResult", "withDomainNames", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "domainNames", ")", "{", "setDomainNames", "(", "domainNames", ")", ";", "return", "this", ";", "}" ]
<p> The names of the search domains owned by an account. </p> @param domainNames The names of the search domains owned by an account. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "names", "of", "the", "search", "domains", "owned", "by", "an", "account", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cloudsearch/src/main/java/com/amazonaws/services/cloudsearchv2/model/ListDomainNamesResult.java#L71-L74
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java
MapDotApi.dotGetNullableOptional
public static <T> Optional<T> dotGetNullableOptional( final Map map, final String pathString, final Class<T> clazz ) { """ Get optional value by path. @param <T> optional value type @param clazz type of value @param map subject @param pathString nodes to walk in map @return value """ return dotGetNullable(map, Optional.class, pathString); }
java
public static <T> Optional<T> dotGetNullableOptional( final Map map, final String pathString, final Class<T> clazz ) { return dotGetNullable(map, Optional.class, pathString); }
[ "public", "static", "<", "T", ">", "Optional", "<", "T", ">", "dotGetNullableOptional", "(", "final", "Map", "map", ",", "final", "String", "pathString", ",", "final", "Class", "<", "T", ">", "clazz", ")", "{", "return", "dotGetNullable", "(", "map", ",", "Optional", ".", "class", ",", "pathString", ")", ";", "}" ]
Get optional value by path. @param <T> optional value type @param clazz type of value @param map subject @param pathString nodes to walk in map @return value
[ "Get", "optional", "value", "by", "path", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java#L254-L258
beanshell/beanshell
src/main/java/bsh/engine/ScriptContextEngineView.java
ScriptContextEngineView.putAll
@Override public void putAll(Map<? extends String, ? extends Object> t) { """ Put the bindings into the ENGINE_SCOPE of the context. @param t Mappings to be stored in this map. @throws UnsupportedOperationException if the <tt>putAll</tt> method is not supported by this map. @throws ClassCastException if the class of a key or value in the specified map prevents it from being stored in this map. @throws IllegalArgumentException some aspect of a key or value in the specified map prevents it from being stored in this map. @throws NullPointerException if the specified map is <tt>null</tt>, or if this map does not permit <tt>null</tt> keys or values, and the specified map contains <tt>null</tt> keys or values. """ context.getBindings(ENGINE_SCOPE).putAll(t); }
java
@Override public void putAll(Map<? extends String, ? extends Object> t) { context.getBindings(ENGINE_SCOPE).putAll(t); }
[ "@", "Override", "public", "void", "putAll", "(", "Map", "<", "?", "extends", "String", ",", "?", "extends", "Object", ">", "t", ")", "{", "context", ".", "getBindings", "(", "ENGINE_SCOPE", ")", ".", "putAll", "(", "t", ")", ";", "}" ]
Put the bindings into the ENGINE_SCOPE of the context. @param t Mappings to be stored in this map. @throws UnsupportedOperationException if the <tt>putAll</tt> method is not supported by this map. @throws ClassCastException if the class of a key or value in the specified map prevents it from being stored in this map. @throws IllegalArgumentException some aspect of a key or value in the specified map prevents it from being stored in this map. @throws NullPointerException if the specified map is <tt>null</tt>, or if this map does not permit <tt>null</tt> keys or values, and the specified map contains <tt>null</tt> keys or values.
[ "Put", "the", "bindings", "into", "the", "ENGINE_SCOPE", "of", "the", "context", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/engine/ScriptContextEngineView.java#L153-L156
groupon/odo
proxyui/src/main/java/com/groupon/odo/controllers/ControllerUtils.java
ControllerUtils.convertProfileAndPathIdentifier
public static Identifiers convertProfileAndPathIdentifier(String profileIdentifier, String pathIdentifier) throws Exception { """ Obtain the IDs of profile and path as Identifiers @param profileIdentifier actual ID or friendly name of profile @param pathIdentifier actual ID or friendly name of path @return @throws Exception """ Identifiers id = new Identifiers(); Integer profileId = null; try { profileId = ControllerUtils.convertProfileIdentifier(profileIdentifier); } catch (Exception e) { // this is OK for this since it isn't always needed } Integer pathId = convertPathIdentifier(pathIdentifier, profileId); id.setProfileId(profileId); id.setPathId(pathId); return id; }
java
public static Identifiers convertProfileAndPathIdentifier(String profileIdentifier, String pathIdentifier) throws Exception { Identifiers id = new Identifiers(); Integer profileId = null; try { profileId = ControllerUtils.convertProfileIdentifier(profileIdentifier); } catch (Exception e) { // this is OK for this since it isn't always needed } Integer pathId = convertPathIdentifier(pathIdentifier, profileId); id.setProfileId(profileId); id.setPathId(pathId); return id; }
[ "public", "static", "Identifiers", "convertProfileAndPathIdentifier", "(", "String", "profileIdentifier", ",", "String", "pathIdentifier", ")", "throws", "Exception", "{", "Identifiers", "id", "=", "new", "Identifiers", "(", ")", ";", "Integer", "profileId", "=", "null", ";", "try", "{", "profileId", "=", "ControllerUtils", ".", "convertProfileIdentifier", "(", "profileIdentifier", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// this is OK for this since it isn't always needed", "}", "Integer", "pathId", "=", "convertPathIdentifier", "(", "pathIdentifier", ",", "profileId", ")", ";", "id", ".", "setProfileId", "(", "profileId", ")", ";", "id", ".", "setPathId", "(", "pathId", ")", ";", "return", "id", ";", "}" ]
Obtain the IDs of profile and path as Identifiers @param profileIdentifier actual ID or friendly name of profile @param pathIdentifier actual ID or friendly name of path @return @throws Exception
[ "Obtain", "the", "IDs", "of", "profile", "and", "path", "as", "Identifiers" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyui/src/main/java/com/groupon/odo/controllers/ControllerUtils.java#L122-L137
devnied/EMV-NFC-Paycard-Enrollment
library/src/main/java/com/github/devnied/emvnfccard/parser/impl/AbstractParser.java
AbstractParser.getLogFormat
protected List<TagAndLength> getLogFormat() throws CommunicationException { """ Method used to get log format @return list of tag and length for the log format @throws CommunicationException communication error """ List<TagAndLength> ret = new ArrayList<TagAndLength>(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("GET log format"); } // Get log format byte[] data = template.get().getProvider().transceive(new CommandApdu(CommandEnum.GET_DATA, 0x9F, 0x4F, 0).toBytes()); if (ResponseUtils.isSucceed(data)) { ret = TlvUtil.parseTagAndLength(TlvUtil.getValue(data, EmvTags.LOG_FORMAT)); } else { LOGGER.warn("No Log format found"); } return ret; }
java
protected List<TagAndLength> getLogFormat() throws CommunicationException { List<TagAndLength> ret = new ArrayList<TagAndLength>(); if (LOGGER.isDebugEnabled()) { LOGGER.debug("GET log format"); } // Get log format byte[] data = template.get().getProvider().transceive(new CommandApdu(CommandEnum.GET_DATA, 0x9F, 0x4F, 0).toBytes()); if (ResponseUtils.isSucceed(data)) { ret = TlvUtil.parseTagAndLength(TlvUtil.getValue(data, EmvTags.LOG_FORMAT)); } else { LOGGER.warn("No Log format found"); } return ret; }
[ "protected", "List", "<", "TagAndLength", ">", "getLogFormat", "(", ")", "throws", "CommunicationException", "{", "List", "<", "TagAndLength", ">", "ret", "=", "new", "ArrayList", "<", "TagAndLength", ">", "(", ")", ";", "if", "(", "LOGGER", ".", "isDebugEnabled", "(", ")", ")", "{", "LOGGER", ".", "debug", "(", "\"GET log format\"", ")", ";", "}", "// Get log format", "byte", "[", "]", "data", "=", "template", ".", "get", "(", ")", ".", "getProvider", "(", ")", ".", "transceive", "(", "new", "CommandApdu", "(", "CommandEnum", ".", "GET_DATA", ",", "0x9F", ",", "0x4F", ",", "0", ")", ".", "toBytes", "(", ")", ")", ";", "if", "(", "ResponseUtils", ".", "isSucceed", "(", "data", ")", ")", "{", "ret", "=", "TlvUtil", ".", "parseTagAndLength", "(", "TlvUtil", ".", "getValue", "(", "data", ",", "EmvTags", ".", "LOG_FORMAT", ")", ")", ";", "}", "else", "{", "LOGGER", ".", "warn", "(", "\"No Log format found\"", ")", ";", "}", "return", "ret", ";", "}" ]
Method used to get log format @return list of tag and length for the log format @throws CommunicationException communication error
[ "Method", "used", "to", "get", "log", "format" ]
train
https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/parser/impl/AbstractParser.java#L214-L227
payneteasy/superfly
superfly-service/src/main/java/com/payneteasy/superfly/spring/velocity/VelocityEngineFactory.java
VelocityEngineFactory.initSpringResourceLoader
protected void initSpringResourceLoader(VelocityEngine velocityEngine, String resourceLoaderPath) { """ Initialize a SpringResourceLoader for the given VelocityEngine. <p>Called by {@code initVelocityResourceLoader}. @param velocityEngine the VelocityEngine to configure @param resourceLoaderPath the path to load Velocity resources from @see SpringResourceLoader @see #initVelocityResourceLoader """ velocityEngine.setProperty( RuntimeConstants.RESOURCE_LOADER, SpringResourceLoader.NAME); velocityEngine.setProperty( SpringResourceLoader.SPRING_RESOURCE_LOADER_CLASS, SpringResourceLoader.class.getName()); velocityEngine.setProperty( SpringResourceLoader.SPRING_RESOURCE_LOADER_CACHE, "true"); velocityEngine.setApplicationAttribute( SpringResourceLoader.SPRING_RESOURCE_LOADER, getResourceLoader()); velocityEngine.setApplicationAttribute( SpringResourceLoader.SPRING_RESOURCE_LOADER_PATH, resourceLoaderPath); }
java
protected void initSpringResourceLoader(VelocityEngine velocityEngine, String resourceLoaderPath) { velocityEngine.setProperty( RuntimeConstants.RESOURCE_LOADER, SpringResourceLoader.NAME); velocityEngine.setProperty( SpringResourceLoader.SPRING_RESOURCE_LOADER_CLASS, SpringResourceLoader.class.getName()); velocityEngine.setProperty( SpringResourceLoader.SPRING_RESOURCE_LOADER_CACHE, "true"); velocityEngine.setApplicationAttribute( SpringResourceLoader.SPRING_RESOURCE_LOADER, getResourceLoader()); velocityEngine.setApplicationAttribute( SpringResourceLoader.SPRING_RESOURCE_LOADER_PATH, resourceLoaderPath); }
[ "protected", "void", "initSpringResourceLoader", "(", "VelocityEngine", "velocityEngine", ",", "String", "resourceLoaderPath", ")", "{", "velocityEngine", ".", "setProperty", "(", "RuntimeConstants", ".", "RESOURCE_LOADER", ",", "SpringResourceLoader", ".", "NAME", ")", ";", "velocityEngine", ".", "setProperty", "(", "SpringResourceLoader", ".", "SPRING_RESOURCE_LOADER_CLASS", ",", "SpringResourceLoader", ".", "class", ".", "getName", "(", ")", ")", ";", "velocityEngine", ".", "setProperty", "(", "SpringResourceLoader", ".", "SPRING_RESOURCE_LOADER_CACHE", ",", "\"true\"", ")", ";", "velocityEngine", ".", "setApplicationAttribute", "(", "SpringResourceLoader", ".", "SPRING_RESOURCE_LOADER", ",", "getResourceLoader", "(", ")", ")", ";", "velocityEngine", ".", "setApplicationAttribute", "(", "SpringResourceLoader", ".", "SPRING_RESOURCE_LOADER_PATH", ",", "resourceLoaderPath", ")", ";", "}" ]
Initialize a SpringResourceLoader for the given VelocityEngine. <p>Called by {@code initVelocityResourceLoader}. @param velocityEngine the VelocityEngine to configure @param resourceLoaderPath the path to load Velocity resources from @see SpringResourceLoader @see #initVelocityResourceLoader
[ "Initialize", "a", "SpringResourceLoader", "for", "the", "given", "VelocityEngine", ".", "<p", ">", "Called", "by", "{" ]
train
https://github.com/payneteasy/superfly/blob/4cad6d0f8e951a61f3c302c49b13a51d179076f8/superfly-service/src/main/java/com/payneteasy/superfly/spring/velocity/VelocityEngineFactory.java#L329-L340
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyJs.java
RecurlyJs.getRecurlySignature
public static String getRecurlySignature(String privateJsKey, Long unixTime, String nonce, List<String> extraParams) { """ Get Recurly.js Signature with extra parameter strings in the format "[param]=[value]" See spec here: https://docs.recurly.com/deprecated-api-docs/recurlyjs/signatures <p> Returns a signature key for use with recurly.js BuildSubscriptionForm. @param privateJsKey recurly.js private key @param unixTime Unix timestamp, i.e. elapsed seconds since Midnight, Jan 1st 1970, UTC @param nonce A randomly generated string (number used only once) @param extraParams extra parameters to include in the signature @return signature string on success, null otherwise """ // Mandatory parameters shared by all signatures (as per spec) extraParams = (extraParams == null) ? new ArrayList<String>() : extraParams; extraParams.add(String.format(PARAMETER_FORMAT, TIMESTAMP_PARAMETER, unixTime)); extraParams.add(String.format(PARAMETER_FORMAT, NONCE_PARAMETER, nonce)); String protectedParams = Joiner.on(PARAMETER_SEPARATOR).join(extraParams); return generateRecurlyHMAC(privateJsKey, protectedParams) + "|" + protectedParams; }
java
public static String getRecurlySignature(String privateJsKey, Long unixTime, String nonce, List<String> extraParams) { // Mandatory parameters shared by all signatures (as per spec) extraParams = (extraParams == null) ? new ArrayList<String>() : extraParams; extraParams.add(String.format(PARAMETER_FORMAT, TIMESTAMP_PARAMETER, unixTime)); extraParams.add(String.format(PARAMETER_FORMAT, NONCE_PARAMETER, nonce)); String protectedParams = Joiner.on(PARAMETER_SEPARATOR).join(extraParams); return generateRecurlyHMAC(privateJsKey, protectedParams) + "|" + protectedParams; }
[ "public", "static", "String", "getRecurlySignature", "(", "String", "privateJsKey", ",", "Long", "unixTime", ",", "String", "nonce", ",", "List", "<", "String", ">", "extraParams", ")", "{", "// Mandatory parameters shared by all signatures (as per spec)", "extraParams", "=", "(", "extraParams", "==", "null", ")", "?", "new", "ArrayList", "<", "String", ">", "(", ")", ":", "extraParams", ";", "extraParams", ".", "add", "(", "String", ".", "format", "(", "PARAMETER_FORMAT", ",", "TIMESTAMP_PARAMETER", ",", "unixTime", ")", ")", ";", "extraParams", ".", "add", "(", "String", ".", "format", "(", "PARAMETER_FORMAT", ",", "NONCE_PARAMETER", ",", "nonce", ")", ")", ";", "String", "protectedParams", "=", "Joiner", ".", "on", "(", "PARAMETER_SEPARATOR", ")", ".", "join", "(", "extraParams", ")", ";", "return", "generateRecurlyHMAC", "(", "privateJsKey", ",", "protectedParams", ")", "+", "\"|\"", "+", "protectedParams", ";", "}" ]
Get Recurly.js Signature with extra parameter strings in the format "[param]=[value]" See spec here: https://docs.recurly.com/deprecated-api-docs/recurlyjs/signatures <p> Returns a signature key for use with recurly.js BuildSubscriptionForm. @param privateJsKey recurly.js private key @param unixTime Unix timestamp, i.e. elapsed seconds since Midnight, Jan 1st 1970, UTC @param nonce A randomly generated string (number used only once) @param extraParams extra parameters to include in the signature @return signature string on success, null otherwise
[ "Get", "Recurly", ".", "js", "Signature", "with", "extra", "parameter", "strings", "in", "the", "format", "[", "param", "]", "=", "[", "value", "]", "See", "spec", "here", ":", "https", ":", "//", "docs", ".", "recurly", ".", "com", "/", "deprecated", "-", "api", "-", "docs", "/", "recurlyjs", "/", "signatures", "<p", ">", "Returns", "a", "signature", "key", "for", "use", "with", "recurly", ".", "js", "BuildSubscriptionForm", "." ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyJs.java#L83-L91
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java
WatchMonitor.createAll
public static WatchMonitor createAll(Path path, Watcher watcher) { """ 创建并初始化监听,监听所有事件 @param path 路径 @param watcher {@link Watcher} @return {@link WatchMonitor} """ final WatchMonitor watchMonitor = create(path, EVENTS_ALL); watchMonitor.setWatcher(watcher); return watchMonitor; }
java
public static WatchMonitor createAll(Path path, Watcher watcher){ final WatchMonitor watchMonitor = create(path, EVENTS_ALL); watchMonitor.setWatcher(watcher); return watchMonitor; }
[ "public", "static", "WatchMonitor", "createAll", "(", "Path", "path", ",", "Watcher", "watcher", ")", "{", "final", "WatchMonitor", "watchMonitor", "=", "create", "(", "path", ",", "EVENTS_ALL", ")", ";", "watchMonitor", ".", "setWatcher", "(", "watcher", ")", ";", "return", "watchMonitor", ";", "}" ]
创建并初始化监听,监听所有事件 @param path 路径 @param watcher {@link Watcher} @return {@link WatchMonitor}
[ "创建并初始化监听,监听所有事件" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/watch/WatchMonitor.java#L238-L242
wildfly/wildfly-core
patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java
IdentityPatchContext.createRollbackPatch
protected RollbackPatch createRollbackPatch(final String patchId, final Patch.PatchType patchType) { """ Create a rollback patch based on the recorded actions. @param patchId the new patch id, depending on release or one-off @param patchType the current patch identity @return the rollback patch """ // Process elements final List<PatchElement> elements = new ArrayList<PatchElement>(); // Process layers for (final PatchEntry entry : getLayers()) { final PatchElement element = createRollbackElement(entry); elements.add(element); } // Process add-ons for (final PatchEntry entry : getAddOns()) { final PatchElement element = createRollbackElement(entry); elements.add(element); } final InstalledIdentity installedIdentity = modification.getUnmodifiedInstallationState(); final String name = installedIdentity.getIdentity().getName(); final IdentityImpl identity = new IdentityImpl(name, modification.getVersion()); if (patchType == Patch.PatchType.CUMULATIVE) { identity.setPatchType(Patch.PatchType.CUMULATIVE); identity.setResultingVersion(installedIdentity.getIdentity().getVersion()); } else if (patchType == Patch.PatchType.ONE_OFF) { identity.setPatchType(Patch.PatchType.ONE_OFF); } final List<ContentModification> modifications = identityEntry.rollbackActions; final Patch delegate = new PatchImpl(patchId, "rollback patch", identity, elements, modifications); return new PatchImpl.RollbackPatchImpl(delegate, installedIdentity); }
java
protected RollbackPatch createRollbackPatch(final String patchId, final Patch.PatchType patchType) { // Process elements final List<PatchElement> elements = new ArrayList<PatchElement>(); // Process layers for (final PatchEntry entry : getLayers()) { final PatchElement element = createRollbackElement(entry); elements.add(element); } // Process add-ons for (final PatchEntry entry : getAddOns()) { final PatchElement element = createRollbackElement(entry); elements.add(element); } final InstalledIdentity installedIdentity = modification.getUnmodifiedInstallationState(); final String name = installedIdentity.getIdentity().getName(); final IdentityImpl identity = new IdentityImpl(name, modification.getVersion()); if (patchType == Patch.PatchType.CUMULATIVE) { identity.setPatchType(Patch.PatchType.CUMULATIVE); identity.setResultingVersion(installedIdentity.getIdentity().getVersion()); } else if (patchType == Patch.PatchType.ONE_OFF) { identity.setPatchType(Patch.PatchType.ONE_OFF); } final List<ContentModification> modifications = identityEntry.rollbackActions; final Patch delegate = new PatchImpl(patchId, "rollback patch", identity, elements, modifications); return new PatchImpl.RollbackPatchImpl(delegate, installedIdentity); }
[ "protected", "RollbackPatch", "createRollbackPatch", "(", "final", "String", "patchId", ",", "final", "Patch", ".", "PatchType", "patchType", ")", "{", "// Process elements", "final", "List", "<", "PatchElement", ">", "elements", "=", "new", "ArrayList", "<", "PatchElement", ">", "(", ")", ";", "// Process layers", "for", "(", "final", "PatchEntry", "entry", ":", "getLayers", "(", ")", ")", "{", "final", "PatchElement", "element", "=", "createRollbackElement", "(", "entry", ")", ";", "elements", ".", "add", "(", "element", ")", ";", "}", "// Process add-ons", "for", "(", "final", "PatchEntry", "entry", ":", "getAddOns", "(", ")", ")", "{", "final", "PatchElement", "element", "=", "createRollbackElement", "(", "entry", ")", ";", "elements", ".", "add", "(", "element", ")", ";", "}", "final", "InstalledIdentity", "installedIdentity", "=", "modification", ".", "getUnmodifiedInstallationState", "(", ")", ";", "final", "String", "name", "=", "installedIdentity", ".", "getIdentity", "(", ")", ".", "getName", "(", ")", ";", "final", "IdentityImpl", "identity", "=", "new", "IdentityImpl", "(", "name", ",", "modification", ".", "getVersion", "(", ")", ")", ";", "if", "(", "patchType", "==", "Patch", ".", "PatchType", ".", "CUMULATIVE", ")", "{", "identity", ".", "setPatchType", "(", "Patch", ".", "PatchType", ".", "CUMULATIVE", ")", ";", "identity", ".", "setResultingVersion", "(", "installedIdentity", ".", "getIdentity", "(", ")", ".", "getVersion", "(", ")", ")", ";", "}", "else", "if", "(", "patchType", "==", "Patch", ".", "PatchType", ".", "ONE_OFF", ")", "{", "identity", ".", "setPatchType", "(", "Patch", ".", "PatchType", ".", "ONE_OFF", ")", ";", "}", "final", "List", "<", "ContentModification", ">", "modifications", "=", "identityEntry", ".", "rollbackActions", ";", "final", "Patch", "delegate", "=", "new", "PatchImpl", "(", "patchId", ",", "\"rollback patch\"", ",", "identity", ",", "elements", ",", "modifications", ")", ";", "return", "new", "PatchImpl", ".", "RollbackPatchImpl", "(", "delegate", ",", "installedIdentity", ")", ";", "}" ]
Create a rollback patch based on the recorded actions. @param patchId the new patch id, depending on release or one-off @param patchType the current patch identity @return the rollback patch
[ "Create", "a", "rollback", "patch", "based", "on", "the", "recorded", "actions", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/patching/src/main/java/org/jboss/as/patching/runner/IdentityPatchContext.java#L608-L634
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java
StructuredDataMessage.asString
public final String asString(final Format format, final StructuredDataId structuredDataId) { """ Formats the structured data as described in RFC 5424. @param format "full" will include the type and message. null will return only the STRUCTURED-DATA as described in RFC 5424 @param structuredDataId The SD-ID as described in RFC 5424. If null the value in the StructuredData will be used. @return The formatted String. """ final StringBuilder sb = new StringBuilder(); asString(format, structuredDataId, sb); return sb.toString(); }
java
public final String asString(final Format format, final StructuredDataId structuredDataId) { final StringBuilder sb = new StringBuilder(); asString(format, structuredDataId, sb); return sb.toString(); }
[ "public", "final", "String", "asString", "(", "final", "Format", "format", ",", "final", "StructuredDataId", "structuredDataId", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "asString", "(", "format", ",", "structuredDataId", ",", "sb", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Formats the structured data as described in RFC 5424. @param format "full" will include the type and message. null will return only the STRUCTURED-DATA as described in RFC 5424 @param structuredDataId The SD-ID as described in RFC 5424. If null the value in the StructuredData will be used. @return The formatted String.
[ "Formats", "the", "structured", "data", "as", "described", "in", "RFC", "5424", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/StructuredDataMessage.java#L304-L308
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/util/dialog/Dialogs.java
Dialogs.showOKDialog
public static VisDialog showOKDialog (Stage stage, String title, String text) { """ Dialog with given text and single OK button. @param title dialog title """ final VisDialog dialog = new VisDialog(title); dialog.closeOnEscape(); dialog.text(text); dialog.button(ButtonType.OK.getText()).padBottom(3); dialog.pack(); dialog.centerWindow(); dialog.addListener(new InputListener() { @Override public boolean keyDown (InputEvent event, int keycode) { if (keycode == Keys.ENTER) { dialog.fadeOut(); return true; } return false; } }); stage.addActor(dialog.fadeIn()); return dialog; }
java
public static VisDialog showOKDialog (Stage stage, String title, String text) { final VisDialog dialog = new VisDialog(title); dialog.closeOnEscape(); dialog.text(text); dialog.button(ButtonType.OK.getText()).padBottom(3); dialog.pack(); dialog.centerWindow(); dialog.addListener(new InputListener() { @Override public boolean keyDown (InputEvent event, int keycode) { if (keycode == Keys.ENTER) { dialog.fadeOut(); return true; } return false; } }); stage.addActor(dialog.fadeIn()); return dialog; }
[ "public", "static", "VisDialog", "showOKDialog", "(", "Stage", "stage", ",", "String", "title", ",", "String", "text", ")", "{", "final", "VisDialog", "dialog", "=", "new", "VisDialog", "(", "title", ")", ";", "dialog", ".", "closeOnEscape", "(", ")", ";", "dialog", ".", "text", "(", "text", ")", ";", "dialog", ".", "button", "(", "ButtonType", ".", "OK", ".", "getText", "(", ")", ")", ".", "padBottom", "(", "3", ")", ";", "dialog", ".", "pack", "(", ")", ";", "dialog", ".", "centerWindow", "(", ")", ";", "dialog", ".", "addListener", "(", "new", "InputListener", "(", ")", "{", "@", "Override", "public", "boolean", "keyDown", "(", "InputEvent", "event", ",", "int", "keycode", ")", "{", "if", "(", "keycode", "==", "Keys", ".", "ENTER", ")", "{", "dialog", ".", "fadeOut", "(", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}", "}", ")", ";", "stage", ".", "addActor", "(", "dialog", ".", "fadeIn", "(", ")", ")", ";", "return", "dialog", ";", "}" ]
Dialog with given text and single OK button. @param title dialog title
[ "Dialog", "with", "given", "text", "and", "single", "OK", "button", "." ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/dialog/Dialogs.java#L53-L72
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCSSGenerator.java
AbstractCSSGenerator.generateResourceForDebug
protected Reader generateResourceForDebug(Reader rd, GeneratorContext context) { """ Returns the resource in debug mode. Here an extra step is used to rewrite the URL in debug mode @param reader the reader @param context the generator context @return the reader """ // Rewrite the image URL StringWriter writer = new StringWriter(); try { IOUtils.copy(rd, writer); String content = rewriteUrl(context, writer.toString()); rd = new StringReader(content); } catch (IOException e) { throw new BundlingProcessException(e); } return rd; }
java
protected Reader generateResourceForDebug(Reader rd, GeneratorContext context) { // Rewrite the image URL StringWriter writer = new StringWriter(); try { IOUtils.copy(rd, writer); String content = rewriteUrl(context, writer.toString()); rd = new StringReader(content); } catch (IOException e) { throw new BundlingProcessException(e); } return rd; }
[ "protected", "Reader", "generateResourceForDebug", "(", "Reader", "rd", ",", "GeneratorContext", "context", ")", "{", "// Rewrite the image URL", "StringWriter", "writer", "=", "new", "StringWriter", "(", ")", ";", "try", "{", "IOUtils", ".", "copy", "(", "rd", ",", "writer", ")", ";", "String", "content", "=", "rewriteUrl", "(", "context", ",", "writer", ".", "toString", "(", ")", ")", ";", "rd", "=", "new", "StringReader", "(", "content", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "BundlingProcessException", "(", "e", ")", ";", "}", "return", "rd", ";", "}" ]
Returns the resource in debug mode. Here an extra step is used to rewrite the URL in debug mode @param reader the reader @param context the generator context @return the reader
[ "Returns", "the", "resource", "in", "debug", "mode", ".", "Here", "an", "extra", "step", "is", "used", "to", "rewrite", "the", "URL", "in", "debug", "mode" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/generator/AbstractCSSGenerator.java#L76-L89
baratine/baratine
framework/src/main/java/com/caucho/v5/vfs/PathImpl.java
PathImpl.sendfile
public void sendfile(OutputStream os, long offset, long length) throws IOException { """ Utility to write the contents of this path to the destination stream. @param os destination stream. """ if (os instanceof OutputStreamWithBuffer) { writeToStream((OutputStreamWithBuffer) os); } else { writeToStream(os); } }
java
public void sendfile(OutputStream os, long offset, long length) throws IOException { if (os instanceof OutputStreamWithBuffer) { writeToStream((OutputStreamWithBuffer) os); } else { writeToStream(os); } }
[ "public", "void", "sendfile", "(", "OutputStream", "os", ",", "long", "offset", ",", "long", "length", ")", "throws", "IOException", "{", "if", "(", "os", "instanceof", "OutputStreamWithBuffer", ")", "{", "writeToStream", "(", "(", "OutputStreamWithBuffer", ")", "os", ")", ";", "}", "else", "{", "writeToStream", "(", "os", ")", ";", "}", "}" ]
Utility to write the contents of this path to the destination stream. @param os destination stream.
[ "Utility", "to", "write", "the", "contents", "of", "this", "path", "to", "the", "destination", "stream", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/framework/src/main/java/com/caucho/v5/vfs/PathImpl.java#L1469-L1478
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/util/bdb/BDBMap.java
BDBMap.addTimestampForId
public static void addTimestampForId(String context, String ip, String time) { """ associate timestamp time with idenfier ip persistantly @param context @param ip @param time """ BDBMap bdbMap = getContextMap(context); bdbMap.put(ip, time); }
java
public static void addTimestampForId(String context, String ip, String time) { BDBMap bdbMap = getContextMap(context); bdbMap.put(ip, time); }
[ "public", "static", "void", "addTimestampForId", "(", "String", "context", ",", "String", "ip", ",", "String", "time", ")", "{", "BDBMap", "bdbMap", "=", "getContextMap", "(", "context", ")", ";", "bdbMap", ".", "put", "(", "ip", ",", "time", ")", ";", "}" ]
associate timestamp time with idenfier ip persistantly @param context @param ip @param time
[ "associate", "timestamp", "time", "with", "idenfier", "ip", "persistantly" ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/bdb/BDBMap.java#L167-L170
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/ViewFetcher.java
ViewFetcher.getCurrentViews
public <T extends View> ArrayList<T> getCurrentViews(Class<T> classToFilterBy, boolean includeSubclasses) { """ Returns an {@code ArrayList} of {@code View}s of the specified {@code Class} located in the current {@code Activity}. @param classToFilterBy return all instances of this class, e.g. {@code Button.class} or {@code GridView.class} @param includeSubclasses include instances of the subclasses in the {@code ArrayList} that will be returned @return an {@code ArrayList} of {@code View}s of the specified {@code Class} located in the current {@code Activity} """ return getCurrentViews(classToFilterBy, includeSubclasses, null); }
java
public <T extends View> ArrayList<T> getCurrentViews(Class<T> classToFilterBy, boolean includeSubclasses) { return getCurrentViews(classToFilterBy, includeSubclasses, null); }
[ "public", "<", "T", "extends", "View", ">", "ArrayList", "<", "T", ">", "getCurrentViews", "(", "Class", "<", "T", ">", "classToFilterBy", ",", "boolean", "includeSubclasses", ")", "{", "return", "getCurrentViews", "(", "classToFilterBy", ",", "includeSubclasses", ",", "null", ")", ";", "}" ]
Returns an {@code ArrayList} of {@code View}s of the specified {@code Class} located in the current {@code Activity}. @param classToFilterBy return all instances of this class, e.g. {@code Button.class} or {@code GridView.class} @param includeSubclasses include instances of the subclasses in the {@code ArrayList} that will be returned @return an {@code ArrayList} of {@code View}s of the specified {@code Class} located in the current {@code Activity}
[ "Returns", "an", "{", "@code", "ArrayList", "}", "of", "{", "@code", "View", "}", "s", "of", "the", "specified", "{", "@code", "Class", "}", "located", "in", "the", "current", "{", "@code", "Activity", "}", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/ViewFetcher.java#L335-L337
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassRootPaneUI.java
SeaGlassRootPaneUI.installBorder
public void installBorder(JRootPane root) { """ Installs the appropriate <code>Border</code> onto the <code> JRootPane</code>. @param root the root pane. """ int style = root.getWindowDecorationStyle(); if (style == JRootPane.NONE) { LookAndFeel.uninstallBorder(root); } else { root.setBorder(new SeaGlassBorder(this, new Insets(0, 1, 1, 1))); } }
java
public void installBorder(JRootPane root) { int style = root.getWindowDecorationStyle(); if (style == JRootPane.NONE) { LookAndFeel.uninstallBorder(root); } else { root.setBorder(new SeaGlassBorder(this, new Insets(0, 1, 1, 1))); } }
[ "public", "void", "installBorder", "(", "JRootPane", "root", ")", "{", "int", "style", "=", "root", ".", "getWindowDecorationStyle", "(", ")", ";", "if", "(", "style", "==", "JRootPane", ".", "NONE", ")", "{", "LookAndFeel", ".", "uninstallBorder", "(", "root", ")", ";", "}", "else", "{", "root", ".", "setBorder", "(", "new", "SeaGlassBorder", "(", "this", ",", "new", "Insets", "(", "0", ",", "1", ",", "1", ",", "1", ")", ")", ")", ";", "}", "}" ]
Installs the appropriate <code>Border</code> onto the <code> JRootPane</code>. @param root the root pane.
[ "Installs", "the", "appropriate", "<code", ">", "Border<", "/", "code", ">", "onto", "the", "<code", ">", "JRootPane<", "/", "code", ">", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassRootPaneUI.java#L318-L326
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ReferenceField.java
ReferenceField.getReferenceRecordName
public String getReferenceRecordName() { """ Get the record name that this field references. @return String Name of the record. """ if (m_recordReference != null) return this.getReferenceRecord().getTableNames(false); else { // This code just takes a guess if (this.getClass().getName().indexOf("Field") != -1) return this.getClass().getName().substring(Math.max(0, this.getClass().getName().lastIndexOf('.') + 1), this.getClass().getName().indexOf("Field")); else if (this.getFieldName(false, false).indexOf("ID") != -1) return this.getFieldName(false, false).substring(0, this.getFieldName(false, false).indexOf("ID")); else this.getFieldName(false, false); } return Constants.BLANK; // Never }
java
public String getReferenceRecordName() { if (m_recordReference != null) return this.getReferenceRecord().getTableNames(false); else { // This code just takes a guess if (this.getClass().getName().indexOf("Field") != -1) return this.getClass().getName().substring(Math.max(0, this.getClass().getName().lastIndexOf('.') + 1), this.getClass().getName().indexOf("Field")); else if (this.getFieldName(false, false).indexOf("ID") != -1) return this.getFieldName(false, false).substring(0, this.getFieldName(false, false).indexOf("ID")); else this.getFieldName(false, false); } return Constants.BLANK; // Never }
[ "public", "String", "getReferenceRecordName", "(", ")", "{", "if", "(", "m_recordReference", "!=", "null", ")", "return", "this", ".", "getReferenceRecord", "(", ")", ".", "getTableNames", "(", "false", ")", ";", "else", "{", "// This code just takes a guess", "if", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "indexOf", "(", "\"Field\"", ")", "!=", "-", "1", ")", "return", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "substring", "(", "Math", ".", "max", "(", "0", ",", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ")", ",", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "indexOf", "(", "\"Field\"", ")", ")", ";", "else", "if", "(", "this", ".", "getFieldName", "(", "false", ",", "false", ")", ".", "indexOf", "(", "\"ID\"", ")", "!=", "-", "1", ")", "return", "this", ".", "getFieldName", "(", "false", ",", "false", ")", ".", "substring", "(", "0", ",", "this", ".", "getFieldName", "(", "false", ",", "false", ")", ".", "indexOf", "(", "\"ID\"", ")", ")", ";", "else", "this", ".", "getFieldName", "(", "false", ",", "false", ")", ";", "}", "return", "Constants", ".", "BLANK", ";", "// Never", "}" ]
Get the record name that this field references. @return String Name of the record.
[ "Get", "the", "record", "name", "that", "this", "field", "references", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ReferenceField.java#L136-L150
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java
DefaultApplicationObjectConfigurer.configureCommandLabel
protected void configureCommandLabel(CommandLabelConfigurable configurable, String objectName) { """ Sets the {@link CommandButtonLabelInfo} of the given object. The label info is created after loading the encoded label string from this instance's {@link MessageSource} using a message code in the format <pre> &lt;objectName&gt;.label </pre> @param configurable The object to be configured. Must not be null. @param objectName The name of the configurable object, unique within the application. Must not be null. @throws IllegalArgumentException if either argument is null. """ Assert.notNull(configurable, "configurable"); Assert.notNull(objectName, "objectName"); String labelStr = loadMessage(objectName + "." + LABEL_KEY); if (StringUtils.hasText(labelStr)) { CommandButtonLabelInfo labelInfo = CommandButtonLabelInfo.valueOf(labelStr); configurable.setLabelInfo(labelInfo); } }
java
protected void configureCommandLabel(CommandLabelConfigurable configurable, String objectName) { Assert.notNull(configurable, "configurable"); Assert.notNull(objectName, "objectName"); String labelStr = loadMessage(objectName + "." + LABEL_KEY); if (StringUtils.hasText(labelStr)) { CommandButtonLabelInfo labelInfo = CommandButtonLabelInfo.valueOf(labelStr); configurable.setLabelInfo(labelInfo); } }
[ "protected", "void", "configureCommandLabel", "(", "CommandLabelConfigurable", "configurable", ",", "String", "objectName", ")", "{", "Assert", ".", "notNull", "(", "configurable", ",", "\"configurable\"", ")", ";", "Assert", ".", "notNull", "(", "objectName", ",", "\"objectName\"", ")", ";", "String", "labelStr", "=", "loadMessage", "(", "objectName", "+", "\".\"", "+", "LABEL_KEY", ")", ";", "if", "(", "StringUtils", ".", "hasText", "(", "labelStr", ")", ")", "{", "CommandButtonLabelInfo", "labelInfo", "=", "CommandButtonLabelInfo", ".", "valueOf", "(", "labelStr", ")", ";", "configurable", ".", "setLabelInfo", "(", "labelInfo", ")", ";", "}", "}" ]
Sets the {@link CommandButtonLabelInfo} of the given object. The label info is created after loading the encoded label string from this instance's {@link MessageSource} using a message code in the format <pre> &lt;objectName&gt;.label </pre> @param configurable The object to be configured. Must not be null. @param objectName The name of the configurable object, unique within the application. Must not be null. @throws IllegalArgumentException if either argument is null.
[ "Sets", "the", "{", "@link", "CommandButtonLabelInfo", "}", "of", "the", "given", "object", ".", "The", "label", "info", "is", "created", "after", "loading", "the", "encoded", "label", "string", "from", "this", "instance", "s", "{", "@link", "MessageSource", "}", "using", "a", "message", "code", "in", "the", "format" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java#L427-L437
mailin-api/sendinblue-java-mvn
src/main/java/com/sendinblue/Sendinblue.java
Sendinblue.get_webhooks
public String get_webhooks(Map<String, String> data) { """ /* To retrieve details of all webhooks. @param {Object} data contains json objects as a key value pair from HashMap. @options data {String} is_plat: Flag to get webhooks. Possible values – 0 & 1. Example: to get Transactional webhooks, use $is_plat=0, to get Marketing webhooks, use $is_plat=1, & to get all webhooks, use $is_plat="" [Optional] """ String is_plat = data.get("is_plat"); String url; if (EMPTY_STRING.equals(is_plat)) { url = "webhook/"; } else { url = "webhook/is_plat/" + is_plat + "/"; } return get(url, EMPTY_STRING); }
java
public String get_webhooks(Map<String, String> data) { String is_plat = data.get("is_plat"); String url; if (EMPTY_STRING.equals(is_plat)) { url = "webhook/"; } else { url = "webhook/is_plat/" + is_plat + "/"; } return get(url, EMPTY_STRING); }
[ "public", "String", "get_webhooks", "(", "Map", "<", "String", ",", "String", ">", "data", ")", "{", "String", "is_plat", "=", "data", ".", "get", "(", "\"is_plat\"", ")", ";", "String", "url", ";", "if", "(", "EMPTY_STRING", ".", "equals", "(", "is_plat", ")", ")", "{", "url", "=", "\"webhook/\"", ";", "}", "else", "{", "url", "=", "\"webhook/is_plat/\"", "+", "is_plat", "+", "\"/\"", ";", "}", "return", "get", "(", "url", ",", "EMPTY_STRING", ")", ";", "}" ]
/* To retrieve details of all webhooks. @param {Object} data contains json objects as a key value pair from HashMap. @options data {String} is_plat: Flag to get webhooks. Possible values – 0 & 1. Example: to get Transactional webhooks, use $is_plat=0, to get Marketing webhooks, use $is_plat=1, & to get all webhooks, use $is_plat="" [Optional]
[ "/", "*", "To", "retrieve", "details", "of", "all", "webhooks", "." ]
train
https://github.com/mailin-api/sendinblue-java-mvn/blob/3a186b004003450f18d619aa084adc8d75086183/src/main/java/com/sendinblue/Sendinblue.java#L699-L709
Netflix/governator
governator-legacy/src/main/java/com/netflix/governator/guice/ModulesEx.java
ModulesEx.fromClass
public static Module fromClass(final Class<?> cls, final boolean override) { """ Create a single module that derived from all bootstrap annotations on a class, where that class itself is a module. For example, <pre> {@code public class MainApplicationModule extends AbstractModule { @Override public void configure() { // Application specific bindings here } public static void main(String[] args) { Guice.createInjector(ModulesEx.fromClass(MainApplicationModule.class)); } } } </pre> @author elandau """ List<Module> modules = new ArrayList<>(); // Iterate through all annotations of the main class, create a binding for the annotation // and add the module to the list of modules to install for (final Annotation annot : cls.getDeclaredAnnotations()) { final Class<? extends Annotation> type = annot.annotationType(); Bootstrap bootstrap = type.getAnnotation(Bootstrap.class); if (bootstrap != null) { LOG.info("Adding Module {}", bootstrap.module()); try { modules.add(bootstrap.module().getConstructor(type).newInstance(annot)); } catch (Exception e) { throw new RuntimeException(e); } } } try { if (override) { return Modules.override(combineAndOverride(modules)).with((Module)cls.newInstance()); } else { return Modules.combine(Modules.combine(modules), (Module)cls.newInstance()); } } catch (Exception e) { throw new RuntimeException(e); } }
java
public static Module fromClass(final Class<?> cls, final boolean override) { List<Module> modules = new ArrayList<>(); // Iterate through all annotations of the main class, create a binding for the annotation // and add the module to the list of modules to install for (final Annotation annot : cls.getDeclaredAnnotations()) { final Class<? extends Annotation> type = annot.annotationType(); Bootstrap bootstrap = type.getAnnotation(Bootstrap.class); if (bootstrap != null) { LOG.info("Adding Module {}", bootstrap.module()); try { modules.add(bootstrap.module().getConstructor(type).newInstance(annot)); } catch (Exception e) { throw new RuntimeException(e); } } } try { if (override) { return Modules.override(combineAndOverride(modules)).with((Module)cls.newInstance()); } else { return Modules.combine(Modules.combine(modules), (Module)cls.newInstance()); } } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "Module", "fromClass", "(", "final", "Class", "<", "?", ">", "cls", ",", "final", "boolean", "override", ")", "{", "List", "<", "Module", ">", "modules", "=", "new", "ArrayList", "<>", "(", ")", ";", "// Iterate through all annotations of the main class, create a binding for the annotation", "// and add the module to the list of modules to install", "for", "(", "final", "Annotation", "annot", ":", "cls", ".", "getDeclaredAnnotations", "(", ")", ")", "{", "final", "Class", "<", "?", "extends", "Annotation", ">", "type", "=", "annot", ".", "annotationType", "(", ")", ";", "Bootstrap", "bootstrap", "=", "type", ".", "getAnnotation", "(", "Bootstrap", ".", "class", ")", ";", "if", "(", "bootstrap", "!=", "null", ")", "{", "LOG", ".", "info", "(", "\"Adding Module {}\"", ",", "bootstrap", ".", "module", "(", ")", ")", ";", "try", "{", "modules", ".", "add", "(", "bootstrap", ".", "module", "(", ")", ".", "getConstructor", "(", "type", ")", ".", "newInstance", "(", "annot", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "}", "try", "{", "if", "(", "override", ")", "{", "return", "Modules", ".", "override", "(", "combineAndOverride", "(", "modules", ")", ")", ".", "with", "(", "(", "Module", ")", "cls", ".", "newInstance", "(", ")", ")", ";", "}", "else", "{", "return", "Modules", ".", "combine", "(", "Modules", ".", "combine", "(", "modules", ")", ",", "(", "Module", ")", "cls", ".", "newInstance", "(", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Create a single module that derived from all bootstrap annotations on a class, where that class itself is a module. For example, <pre> {@code public class MainApplicationModule extends AbstractModule { @Override public void configure() { // Application specific bindings here } public static void main(String[] args) { Guice.createInjector(ModulesEx.fromClass(MainApplicationModule.class)); } } } </pre> @author elandau
[ "Create", "a", "single", "module", "that", "derived", "from", "all", "bootstrap", "annotations", "on", "a", "class", "where", "that", "class", "itself", "is", "a", "module", "." ]
train
https://github.com/Netflix/governator/blob/c1f4bb1518e759c61f2e9cad8a896ec6beba0294/governator-legacy/src/main/java/com/netflix/governator/guice/ModulesEx.java#L81-L109
netty/netty
buffer/src/main/java/io/netty/buffer/Unpooled.java
Unpooled.wrappedBuffer
public static ByteBuf wrappedBuffer(int maxNumComponents, ByteBuf... buffers) { """ Creates a new big-endian composite buffer which wraps the readable bytes of the specified buffers without copying them. A modification on the content of the specified buffers will be visible to the returned buffer. @param maxNumComponents Advisement as to how many independent buffers are allowed to exist before consolidation occurs. @param buffers The buffers to wrap. Reference count ownership of all variables is transferred to this method. @return The readable portion of the {@code buffers}. The caller is responsible for releasing this buffer. """ switch (buffers.length) { case 0: break; case 1: ByteBuf buffer = buffers[0]; if (buffer.isReadable()) { return wrappedBuffer(buffer.order(BIG_ENDIAN)); } else { buffer.release(); } break; default: for (int i = 0; i < buffers.length; i++) { ByteBuf buf = buffers[i]; if (buf.isReadable()) { return new CompositeByteBuf(ALLOC, false, maxNumComponents, buffers, i); } buf.release(); } break; } return EMPTY_BUFFER; }
java
public static ByteBuf wrappedBuffer(int maxNumComponents, ByteBuf... buffers) { switch (buffers.length) { case 0: break; case 1: ByteBuf buffer = buffers[0]; if (buffer.isReadable()) { return wrappedBuffer(buffer.order(BIG_ENDIAN)); } else { buffer.release(); } break; default: for (int i = 0; i < buffers.length; i++) { ByteBuf buf = buffers[i]; if (buf.isReadable()) { return new CompositeByteBuf(ALLOC, false, maxNumComponents, buffers, i); } buf.release(); } break; } return EMPTY_BUFFER; }
[ "public", "static", "ByteBuf", "wrappedBuffer", "(", "int", "maxNumComponents", ",", "ByteBuf", "...", "buffers", ")", "{", "switch", "(", "buffers", ".", "length", ")", "{", "case", "0", ":", "break", ";", "case", "1", ":", "ByteBuf", "buffer", "=", "buffers", "[", "0", "]", ";", "if", "(", "buffer", ".", "isReadable", "(", ")", ")", "{", "return", "wrappedBuffer", "(", "buffer", ".", "order", "(", "BIG_ENDIAN", ")", ")", ";", "}", "else", "{", "buffer", ".", "release", "(", ")", ";", "}", "break", ";", "default", ":", "for", "(", "int", "i", "=", "0", ";", "i", "<", "buffers", ".", "length", ";", "i", "++", ")", "{", "ByteBuf", "buf", "=", "buffers", "[", "i", "]", ";", "if", "(", "buf", ".", "isReadable", "(", ")", ")", "{", "return", "new", "CompositeByteBuf", "(", "ALLOC", ",", "false", ",", "maxNumComponents", ",", "buffers", ",", "i", ")", ";", "}", "buf", ".", "release", "(", ")", ";", "}", "break", ";", "}", "return", "EMPTY_BUFFER", ";", "}" ]
Creates a new big-endian composite buffer which wraps the readable bytes of the specified buffers without copying them. A modification on the content of the specified buffers will be visible to the returned buffer. @param maxNumComponents Advisement as to how many independent buffers are allowed to exist before consolidation occurs. @param buffers The buffers to wrap. Reference count ownership of all variables is transferred to this method. @return The readable portion of the {@code buffers}. The caller is responsible for releasing this buffer.
[ "Creates", "a", "new", "big", "-", "endian", "composite", "buffer", "which", "wraps", "the", "readable", "bytes", "of", "the", "specified", "buffers", "without", "copying", "them", ".", "A", "modification", "on", "the", "content", "of", "the", "specified", "buffers", "will", "be", "visible", "to", "the", "returned", "buffer", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/Unpooled.java#L306-L329
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_PUT
public OvhOperation serviceName_PUT(String serviceName, String displayName, Boolean isCapped) throws IOException { """ Update the service properties REST: PUT /dbaas/logs/{serviceName} @param serviceName [required] Service name @param displayName [required] Service custom name @param isCapped [required] If set, block indexation when plan's limit is reached """ String qPath = "/dbaas/logs/{serviceName}"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "displayName", displayName); addBody(o, "isCapped", isCapped); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
java
public OvhOperation serviceName_PUT(String serviceName, String displayName, Boolean isCapped) throws IOException { String qPath = "/dbaas/logs/{serviceName}"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "displayName", displayName); addBody(o, "isCapped", isCapped); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
[ "public", "OvhOperation", "serviceName_PUT", "(", "String", "serviceName", ",", "String", "displayName", ",", "Boolean", "isCapped", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/{serviceName}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"displayName\"", ",", "displayName", ")", ";", "addBody", "(", "o", ",", "\"isCapped\"", ",", "isCapped", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"PUT\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOperation", ".", "class", ")", ";", "}" ]
Update the service properties REST: PUT /dbaas/logs/{serviceName} @param serviceName [required] Service name @param displayName [required] Service custom name @param isCapped [required] If set, block indexation when plan's limit is reached
[ "Update", "the", "service", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1011-L1019
ogaclejapan/SmartTabLayout
utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java
Bundler.putString
public Bundler putString(String key, String value) { """ Inserts a String value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a String, or null @return this """ bundle.putString(key, value); return this; }
java
public Bundler putString(String key, String value) { bundle.putString(key, value); return this; }
[ "public", "Bundler", "putString", "(", "String", "key", ",", "String", "value", ")", "{", "bundle", ".", "putString", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Inserts a String value into the mapping of this Bundle, replacing any existing value for the given key. Either key or value may be null. @param key a String, or null @param value a String, or null @return this
[ "Inserts", "a", "String", "value", "into", "the", "mapping", "of", "this", "Bundle", "replacing", "any", "existing", "value", "for", "the", "given", "key", ".", "Either", "key", "or", "value", "may", "be", "null", "." ]
train
https://github.com/ogaclejapan/SmartTabLayout/blob/712e81a92f1e12a3c33dcbda03d813e0162e8589/utils-v4/src/main/java/com/ogaclejapan/smarttablayout/utils/v4/Bundler.java#L430-L433
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/checksum/ChecksumExtensions.java
ChecksumExtensions.getChecksum
public static String getChecksum(final Byte[] bytes, final String algorithm) throws NoSuchAlgorithmException { """ Gets the checksum from the given byte array with an instance of. @param bytes the Byte object array. @param algorithm the algorithm to get the checksum. This could be for instance "MD4", "MD5", "SHA-1", "SHA-256", "SHA-384" or "SHA-512". @return The checksum from the file as a String object. @throws NoSuchAlgorithmException Is thrown if the algorithm is not supported or does not exists. {@link java.security.MessageDigest} object. """ return getChecksum(ArrayUtils.toPrimitive(bytes), algorithm); }
java
public static String getChecksum(final Byte[] bytes, final String algorithm) throws NoSuchAlgorithmException { return getChecksum(ArrayUtils.toPrimitive(bytes), algorithm); }
[ "public", "static", "String", "getChecksum", "(", "final", "Byte", "[", "]", "bytes", ",", "final", "String", "algorithm", ")", "throws", "NoSuchAlgorithmException", "{", "return", "getChecksum", "(", "ArrayUtils", ".", "toPrimitive", "(", "bytes", ")", ",", "algorithm", ")", ";", "}" ]
Gets the checksum from the given byte array with an instance of. @param bytes the Byte object array. @param algorithm the algorithm to get the checksum. This could be for instance "MD4", "MD5", "SHA-1", "SHA-256", "SHA-384" or "SHA-512". @return The checksum from the file as a String object. @throws NoSuchAlgorithmException Is thrown if the algorithm is not supported or does not exists. {@link java.security.MessageDigest} object.
[ "Gets", "the", "checksum", "from", "the", "given", "byte", "array", "with", "an", "instance", "of", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/checksum/ChecksumExtensions.java#L175-L179
yavijava/yavijava
src/main/java/com/vmware/vim25/mo/GuestWindowsRegistryManager.java
GuestWindowsRegistryManager.deleteRegistryValueInGuest
public void deleteRegistryValueInGuest(VirtualMachine vm, GuestAuthentication auth, GuestRegValueNameSpec valueName) throws GuestComponentsOutOfDate, GuestOperationsFault, GuestOperationsUnavailable, GuestPermissionDenied, GuestRegistryKeyInvalid, GuestRegistryValueNotFound, InvalidGuestLogin, InvalidPowerState, InvalidState, OperationDisabledByGuest, OperationNotSupportedByGuest, RuntimeFault, TaskInProgress, RemoteException { """ Delete a registry value. @param vm Virtual machine to perform the operation on. @param auth The guest authentication data. @param valueName The registry value name to be deleted. The Value "name" (specified in {@link com.vmware.vim25.GuestRegValueNameSpec GuestRegValueNameSpec}) can be empty. If "name" is empty, it deletes the value for the unnamed or default value of the given key. @throws GuestComponentsOutOfDate @throws GuestOperationsFault @throws GuestOperationsUnavailable @throws GuestPermissionDenied @throws GuestRegistryKeyInvalid @throws GuestRegistryValueNotFound @throws InvalidGuestLogin @throws InvalidPowerState @throws InvalidState @throws OperationDisabledByGuest @throws OperationNotSupportedByGuest @throws RuntimeFault @throws TaskInProgress @throws RemoteException """ getVimService().deleteRegistryValueInGuest(getMOR(), vm.getMOR(), auth, valueName); }
java
public void deleteRegistryValueInGuest(VirtualMachine vm, GuestAuthentication auth, GuestRegValueNameSpec valueName) throws GuestComponentsOutOfDate, GuestOperationsFault, GuestOperationsUnavailable, GuestPermissionDenied, GuestRegistryKeyInvalid, GuestRegistryValueNotFound, InvalidGuestLogin, InvalidPowerState, InvalidState, OperationDisabledByGuest, OperationNotSupportedByGuest, RuntimeFault, TaskInProgress, RemoteException { getVimService().deleteRegistryValueInGuest(getMOR(), vm.getMOR(), auth, valueName); }
[ "public", "void", "deleteRegistryValueInGuest", "(", "VirtualMachine", "vm", ",", "GuestAuthentication", "auth", ",", "GuestRegValueNameSpec", "valueName", ")", "throws", "GuestComponentsOutOfDate", ",", "GuestOperationsFault", ",", "GuestOperationsUnavailable", ",", "GuestPermissionDenied", ",", "GuestRegistryKeyInvalid", ",", "GuestRegistryValueNotFound", ",", "InvalidGuestLogin", ",", "InvalidPowerState", ",", "InvalidState", ",", "OperationDisabledByGuest", ",", "OperationNotSupportedByGuest", ",", "RuntimeFault", ",", "TaskInProgress", ",", "RemoteException", "{", "getVimService", "(", ")", ".", "deleteRegistryValueInGuest", "(", "getMOR", "(", ")", ",", "vm", ".", "getMOR", "(", ")", ",", "auth", ",", "valueName", ")", ";", "}" ]
Delete a registry value. @param vm Virtual machine to perform the operation on. @param auth The guest authentication data. @param valueName The registry value name to be deleted. The Value "name" (specified in {@link com.vmware.vim25.GuestRegValueNameSpec GuestRegValueNameSpec}) can be empty. If "name" is empty, it deletes the value for the unnamed or default value of the given key. @throws GuestComponentsOutOfDate @throws GuestOperationsFault @throws GuestOperationsUnavailable @throws GuestPermissionDenied @throws GuestRegistryKeyInvalid @throws GuestRegistryValueNotFound @throws InvalidGuestLogin @throws InvalidPowerState @throws InvalidState @throws OperationDisabledByGuest @throws OperationNotSupportedByGuest @throws RuntimeFault @throws TaskInProgress @throws RemoteException
[ "Delete", "a", "registry", "value", "." ]
train
https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/GuestWindowsRegistryManager.java#L119-L123