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
apache/flink
flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
Configuration.setDouble
@PublicEvolving public void setDouble(ConfigOption<Double> key, double value) { """ Adds the given value to the configuration object. The main key of the config option will be used to map the value. @param key the option specifying the key to be added @param value the value of the key/value pair to be added """ setValueInternal(key.key(), value); }
java
@PublicEvolving public void setDouble(ConfigOption<Double> key, double value) { setValueInternal(key.key(), value); }
[ "@", "PublicEvolving", "public", "void", "setDouble", "(", "ConfigOption", "<", "Double", ">", "key", ",", "double", "value", ")", "{", "setValueInternal", "(", "key", ".", "key", "(", ")", ",", "value", ")", ";", "}" ]
Adds the given value to the configuration object. The main key of the config option will be used to map the value. @param key the option specifying the key to be added @param value the value of the key/value pair to be added
[ "Adds", "the", "given", "value", "to", "the", "configuration", "object", ".", "The", "main", "key", "of", "the", "config", "option", "will", "be", "used", "to", "map", "the", "value", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L560-L563
autermann/yaml
src/main/java/com/github/autermann/yaml/Yaml.java
Yaml.dumpAll
public void dumpAll(Iterator<? extends YamlNode> data, OutputStream output) { """ Dumps {@code data} into a {@code OutputStream} using a {@code UTF-8} encoding. @param data the data @param output the output stream """ getDelegate().dumpAll(data, new OutputStreamWriter(output, Charset .forName("UTF-8"))); }
java
public void dumpAll(Iterator<? extends YamlNode> data, OutputStream output) { getDelegate().dumpAll(data, new OutputStreamWriter(output, Charset .forName("UTF-8"))); }
[ "public", "void", "dumpAll", "(", "Iterator", "<", "?", "extends", "YamlNode", ">", "data", ",", "OutputStream", "output", ")", "{", "getDelegate", "(", ")", ".", "dumpAll", "(", "data", ",", "new", "OutputStreamWriter", "(", "output", ",", "Charset", ".", "forName", "(", "\"UTF-8\"", ")", ")", ")", ";", "}" ]
Dumps {@code data} into a {@code OutputStream} using a {@code UTF-8} encoding. @param data the data @param output the output stream
[ "Dumps", "{", "@code", "data", "}", "into", "a", "{", "@code", "OutputStream", "}", "using", "a", "{", "@code", "UTF", "-", "8", "}", "encoding", "." ]
train
https://github.com/autermann/yaml/blob/5f8ab03e4fec3a2abe72c03561cdaa3a3936634d/src/main/java/com/github/autermann/yaml/Yaml.java#L160-L163
knowm/XChange
xchange-bitflyer/src/main/java/org/knowm/xchange/bitflyer/BitflyerAdapters.java
BitflyerAdapters.adaptTicker
public static Ticker adaptTicker(BitflyerTicker ticker, CurrencyPair currencyPair) { """ Adapts a BitflyerTicker to a Ticker Object @param ticker The exchange specific ticker @param currencyPair (e.g. BTC/USD) @return The ticker """ BigDecimal bid = ticker.getBestBid(); BigDecimal ask = ticker.getBestAsk(); BigDecimal volume = ticker.getVolume(); BigDecimal last = ticker.getLtp(); Date timestamp = ticker.getTimestamp() != null ? BitflyerUtils.parseDate(ticker.getTimestamp()) : null; return new Ticker.Builder() .currencyPair(currencyPair) .bid(bid) .ask(ask) .last(ask) .volume(volume) .timestamp(timestamp) .build(); }
java
public static Ticker adaptTicker(BitflyerTicker ticker, CurrencyPair currencyPair) { BigDecimal bid = ticker.getBestBid(); BigDecimal ask = ticker.getBestAsk(); BigDecimal volume = ticker.getVolume(); BigDecimal last = ticker.getLtp(); Date timestamp = ticker.getTimestamp() != null ? BitflyerUtils.parseDate(ticker.getTimestamp()) : null; return new Ticker.Builder() .currencyPair(currencyPair) .bid(bid) .ask(ask) .last(ask) .volume(volume) .timestamp(timestamp) .build(); }
[ "public", "static", "Ticker", "adaptTicker", "(", "BitflyerTicker", "ticker", ",", "CurrencyPair", "currencyPair", ")", "{", "BigDecimal", "bid", "=", "ticker", ".", "getBestBid", "(", ")", ";", "BigDecimal", "ask", "=", "ticker", ".", "getBestAsk", "(", ")", ";", "BigDecimal", "volume", "=", "ticker", ".", "getVolume", "(", ")", ";", "BigDecimal", "last", "=", "ticker", ".", "getLtp", "(", ")", ";", "Date", "timestamp", "=", "ticker", ".", "getTimestamp", "(", ")", "!=", "null", "?", "BitflyerUtils", ".", "parseDate", "(", "ticker", ".", "getTimestamp", "(", ")", ")", ":", "null", ";", "return", "new", "Ticker", ".", "Builder", "(", ")", ".", "currencyPair", "(", "currencyPair", ")", ".", "bid", "(", "bid", ")", ".", "ask", "(", "ask", ")", ".", "last", "(", "ask", ")", ".", "volume", "(", "volume", ")", ".", "timestamp", "(", "timestamp", ")", ".", "build", "(", ")", ";", "}" ]
Adapts a BitflyerTicker to a Ticker Object @param ticker The exchange specific ticker @param currencyPair (e.g. BTC/USD) @return The ticker
[ "Adapts", "a", "BitflyerTicker", "to", "a", "Ticker", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-bitflyer/src/main/java/org/knowm/xchange/bitflyer/BitflyerAdapters.java#L85-L102
finmath/finmath-lib
src/main/java/net/finmath/time/FloatingpointDate.java
FloatingpointDate.getDateFromFloatingPointDate
public static LocalDateTime getDateFromFloatingPointDate(LocalDateTime referenceDate, double floatingPointDate) { """ Convert a floating point date to a LocalDateTime. Note: This method currently performs a rounding to the next second. If referenceDate is null, the method returns null. @param referenceDate The reference date associated with \( t=0 \). @param floatingPointDate The value to the time offset \( t \). @return The date resulting from adding Math.round(fixingTime*SECONDS_PER_DAY) seconds to referenceDate, where one day has SECONDS_PER_DAY seconds and SECONDS_PER_DAY is a constant 365*24*60*60 """ if(referenceDate == null) { return null; } Duration duration = Duration.ofSeconds(Math.round(floatingPointDate * SECONDS_PER_DAY)); return referenceDate.plus(duration); }
java
public static LocalDateTime getDateFromFloatingPointDate(LocalDateTime referenceDate, double floatingPointDate) { if(referenceDate == null) { return null; } Duration duration = Duration.ofSeconds(Math.round(floatingPointDate * SECONDS_PER_DAY)); return referenceDate.plus(duration); }
[ "public", "static", "LocalDateTime", "getDateFromFloatingPointDate", "(", "LocalDateTime", "referenceDate", ",", "double", "floatingPointDate", ")", "{", "if", "(", "referenceDate", "==", "null", ")", "{", "return", "null", ";", "}", "Duration", "duration", "=", "Duration", ".", "ofSeconds", "(", "Math", ".", "round", "(", "floatingPointDate", "*", "SECONDS_PER_DAY", ")", ")", ";", "return", "referenceDate", ".", "plus", "(", "duration", ")", ";", "}" ]
Convert a floating point date to a LocalDateTime. Note: This method currently performs a rounding to the next second. If referenceDate is null, the method returns null. @param referenceDate The reference date associated with \( t=0 \). @param floatingPointDate The value to the time offset \( t \). @return The date resulting from adding Math.round(fixingTime*SECONDS_PER_DAY) seconds to referenceDate, where one day has SECONDS_PER_DAY seconds and SECONDS_PER_DAY is a constant 365*24*60*60
[ "Convert", "a", "floating", "point", "date", "to", "a", "LocalDateTime", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/time/FloatingpointDate.java#L67-L74
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/style/stylers/AbstractFieldStyler.java
AbstractFieldStyler.makeField
@Override public PdfFormField makeField() throws IOException, DocumentException, VectorPrintException { """ Create the PdfFormField that will be used to add a form field to the pdf. @return @throws IOException @throws DocumentException @throws VectorPrintException """ switch (getFieldtype()) { case TEXT: return ((TextField) bf).getTextField(); case COMBO: return ((TextField) bf).getComboField(); case LIST: return ((TextField) bf).getListField(); case BUTTON: return ((PushbuttonField) bf).getField(); case CHECKBOX: return ((RadioCheckField) bf).getCheckField(); case RADIO: return ((RadioCheckField) bf).getRadioField(); } throw new VectorPrintException(String.format("cannot create pdfformfield from %s and %s", (bf != null) ? bf.getClass() : null, String.valueOf(getFieldtype()))); }
java
@Override public PdfFormField makeField() throws IOException, DocumentException, VectorPrintException { switch (getFieldtype()) { case TEXT: return ((TextField) bf).getTextField(); case COMBO: return ((TextField) bf).getComboField(); case LIST: return ((TextField) bf).getListField(); case BUTTON: return ((PushbuttonField) bf).getField(); case CHECKBOX: return ((RadioCheckField) bf).getCheckField(); case RADIO: return ((RadioCheckField) bf).getRadioField(); } throw new VectorPrintException(String.format("cannot create pdfformfield from %s and %s", (bf != null) ? bf.getClass() : null, String.valueOf(getFieldtype()))); }
[ "@", "Override", "public", "PdfFormField", "makeField", "(", ")", "throws", "IOException", ",", "DocumentException", ",", "VectorPrintException", "{", "switch", "(", "getFieldtype", "(", ")", ")", "{", "case", "TEXT", ":", "return", "(", "(", "TextField", ")", "bf", ")", ".", "getTextField", "(", ")", ";", "case", "COMBO", ":", "return", "(", "(", "TextField", ")", "bf", ")", ".", "getComboField", "(", ")", ";", "case", "LIST", ":", "return", "(", "(", "TextField", ")", "bf", ")", ".", "getListField", "(", ")", ";", "case", "BUTTON", ":", "return", "(", "(", "PushbuttonField", ")", "bf", ")", ".", "getField", "(", ")", ";", "case", "CHECKBOX", ":", "return", "(", "(", "RadioCheckField", ")", "bf", ")", ".", "getCheckField", "(", ")", ";", "case", "RADIO", ":", "return", "(", "(", "RadioCheckField", ")", "bf", ")", ".", "getRadioField", "(", ")", ";", "}", "throw", "new", "VectorPrintException", "(", "String", ".", "format", "(", "\"cannot create pdfformfield from %s and %s\"", ",", "(", "bf", "!=", "null", ")", "?", "bf", ".", "getClass", "(", ")", ":", "null", ",", "String", ".", "valueOf", "(", "getFieldtype", "(", ")", ")", ")", ")", ";", "}" ]
Create the PdfFormField that will be used to add a form field to the pdf. @return @throws IOException @throws DocumentException @throws VectorPrintException
[ "Create", "the", "PdfFormField", "that", "will", "be", "used", "to", "add", "a", "form", "field", "to", "the", "pdf", "." ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/style/stylers/AbstractFieldStyler.java#L222-L240
h2oai/h2o-3
h2o-core/src/main/java/water/rapids/vals/ValRow.java
ValRow.slice
public ValRow slice(int[] cols) { """ Creates a new ValRow by selecting elements at the specified indices. @param cols array of indices to select. We do not check for AIOOB errors. @return new ValRow object """ double[] ds = new double[cols.length]; String[] ns = new String[cols.length]; for (int i = 0; i < cols.length; ++i) { ds[i] = _ds[cols[i]]; ns[i] = _names[cols[i]]; } return new ValRow(ds, ns); }
java
public ValRow slice(int[] cols) { double[] ds = new double[cols.length]; String[] ns = new String[cols.length]; for (int i = 0; i < cols.length; ++i) { ds[i] = _ds[cols[i]]; ns[i] = _names[cols[i]]; } return new ValRow(ds, ns); }
[ "public", "ValRow", "slice", "(", "int", "[", "]", "cols", ")", "{", "double", "[", "]", "ds", "=", "new", "double", "[", "cols", ".", "length", "]", ";", "String", "[", "]", "ns", "=", "new", "String", "[", "cols", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cols", ".", "length", ";", "++", "i", ")", "{", "ds", "[", "i", "]", "=", "_ds", "[", "cols", "[", "i", "]", "]", ";", "ns", "[", "i", "]", "=", "_names", "[", "cols", "[", "i", "]", "]", ";", "}", "return", "new", "ValRow", "(", "ds", ",", "ns", ")", ";", "}" ]
Creates a new ValRow by selecting elements at the specified indices. @param cols array of indices to select. We do not check for AIOOB errors. @return new ValRow object
[ "Creates", "a", "new", "ValRow", "by", "selecting", "elements", "at", "the", "specified", "indices", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/rapids/vals/ValRow.java#L37-L45
pip-services3-java/pip-services3-components-java
src/org/pipservices3/components/config/JsonConfigReader.java
JsonConfigReader.readObject
public Object readObject(String correlationId, ConfigParams parameters) throws ApplicationException { """ Reads configuration file, parameterizes its content and converts it into JSON object. @param correlationId (optional) transaction id to trace execution through call chain. @param parameters values to parameters the configuration. @return a JSON object with configuration. @throws ApplicationException when error occured. """ if (_path == null) throw new ConfigException(correlationId, "NO_PATH", "Missing config file path"); try { Path path = Paths.get(_path); String json = new String(Files.readAllBytes(path)); json = parameterize(json, parameters); return jsonMapper.readValue(json, typeRef); } catch (Exception ex) { throw new FileException(correlationId, "READ_FAILED", "Failed reading configuration " + _path + ": " + ex) .withDetails("path", _path).withCause(ex); } }
java
public Object readObject(String correlationId, ConfigParams parameters) throws ApplicationException { if (_path == null) throw new ConfigException(correlationId, "NO_PATH", "Missing config file path"); try { Path path = Paths.get(_path); String json = new String(Files.readAllBytes(path)); json = parameterize(json, parameters); return jsonMapper.readValue(json, typeRef); } catch (Exception ex) { throw new FileException(correlationId, "READ_FAILED", "Failed reading configuration " + _path + ": " + ex) .withDetails("path", _path).withCause(ex); } }
[ "public", "Object", "readObject", "(", "String", "correlationId", ",", "ConfigParams", "parameters", ")", "throws", "ApplicationException", "{", "if", "(", "_path", "==", "null", ")", "throw", "new", "ConfigException", "(", "correlationId", ",", "\"NO_PATH\"", ",", "\"Missing config file path\"", ")", ";", "try", "{", "Path", "path", "=", "Paths", ".", "get", "(", "_path", ")", ";", "String", "json", "=", "new", "String", "(", "Files", ".", "readAllBytes", "(", "path", ")", ")", ";", "json", "=", "parameterize", "(", "json", ",", "parameters", ")", ";", "return", "jsonMapper", ".", "readValue", "(", "json", ",", "typeRef", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "FileException", "(", "correlationId", ",", "\"READ_FAILED\"", ",", "\"Failed reading configuration \"", "+", "_path", "+", "\": \"", "+", "ex", ")", ".", "withDetails", "(", "\"path\"", ",", "_path", ")", ".", "withCause", "(", "ex", ")", ";", "}", "}" ]
Reads configuration file, parameterizes its content and converts it into JSON object. @param correlationId (optional) transaction id to trace execution through call chain. @param parameters values to parameters the configuration. @return a JSON object with configuration. @throws ApplicationException when error occured.
[ "Reads", "configuration", "file", "parameterizes", "its", "content", "and", "converts", "it", "into", "JSON", "object", "." ]
train
https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/config/JsonConfigReader.java#L72-L87
datoin/http-requests
src/main/java/org/datoin/net/http/Request.java
Request.authorize
public Request authorize(String name, String password) { """ method to set authorization header after computing digest from user and pasword @param name : username @param password : password @return : Request Object with authorization header value set """ String authString = name + ":" + password; System.out.println("auth string: " + authString); byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); String authStringEnc = new String(authEncBytes); System.out.println("Base64 encoded auth string: " + authStringEnc); return this.authorization("Basic " + authStringEnc); }
java
public Request authorize(String name, String password){ String authString = name + ":" + password; System.out.println("auth string: " + authString); byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); String authStringEnc = new String(authEncBytes); System.out.println("Base64 encoded auth string: " + authStringEnc); return this.authorization("Basic " + authStringEnc); }
[ "public", "Request", "authorize", "(", "String", "name", ",", "String", "password", ")", "{", "String", "authString", "=", "name", "+", "\":\"", "+", "password", ";", "System", ".", "out", ".", "println", "(", "\"auth string: \"", "+", "authString", ")", ";", "byte", "[", "]", "authEncBytes", "=", "Base64", ".", "encodeBase64", "(", "authString", ".", "getBytes", "(", ")", ")", ";", "String", "authStringEnc", "=", "new", "String", "(", "authEncBytes", ")", ";", "System", ".", "out", ".", "println", "(", "\"Base64 encoded auth string: \"", "+", "authStringEnc", ")", ";", "return", "this", ".", "authorization", "(", "\"Basic \"", "+", "authStringEnc", ")", ";", "}" ]
method to set authorization header after computing digest from user and pasword @param name : username @param password : password @return : Request Object with authorization header value set
[ "method", "to", "set", "authorization", "header", "after", "computing", "digest", "from", "user", "and", "pasword" ]
train
https://github.com/datoin/http-requests/blob/660a4bc516c594f321019df94451fead4dea19b6/src/main/java/org/datoin/net/http/Request.java#L278-L286
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/hints/HintParser.java
HintParser.parseHints
public void parseHints(InputStream inputStream) throws HintParseException, SAXException { """ Parses the given XML stream and returns a list of the hint rules contained. @param inputStream an InputStream containing hint rules @throws HintParseException thrown if the XML cannot be parsed @throws SAXException thrown if the XML cannot be parsed """ try ( InputStream schemaStream13 = FileUtils.getResourceAsStream(HINT_SCHEMA_1_3); InputStream schemaStream12 = FileUtils.getResourceAsStream(HINT_SCHEMA_1_2); InputStream schemaStream11 = FileUtils.getResourceAsStream(HINT_SCHEMA_1_1);) { final HintHandler handler = new HintHandler(); final SAXParser saxParser = XmlUtils.buildSecureSaxParser(schemaStream13, schemaStream12, schemaStream11); final XMLReader xmlReader = saxParser.getXMLReader(); xmlReader.setErrorHandler(new HintErrorHandler()); xmlReader.setContentHandler(handler); try (Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { final InputSource in = new InputSource(reader); xmlReader.parse(in); this.hintRules = handler.getHintRules(); this.vendorDuplicatingHintRules = handler.getVendorDuplicatingHintRules(); } } catch (ParserConfigurationException | FileNotFoundException ex) { LOGGER.debug("", ex); throw new HintParseException(ex); } catch (SAXException ex) { if (ex.getMessage().contains("Cannot find the declaration of element 'hints'.")) { throw ex; } else { LOGGER.debug("", ex); throw new HintParseException(ex); } } catch (IOException ex) { LOGGER.debug("", ex); throw new HintParseException(ex); } }
java
public void parseHints(InputStream inputStream) throws HintParseException, SAXException { try ( InputStream schemaStream13 = FileUtils.getResourceAsStream(HINT_SCHEMA_1_3); InputStream schemaStream12 = FileUtils.getResourceAsStream(HINT_SCHEMA_1_2); InputStream schemaStream11 = FileUtils.getResourceAsStream(HINT_SCHEMA_1_1);) { final HintHandler handler = new HintHandler(); final SAXParser saxParser = XmlUtils.buildSecureSaxParser(schemaStream13, schemaStream12, schemaStream11); final XMLReader xmlReader = saxParser.getXMLReader(); xmlReader.setErrorHandler(new HintErrorHandler()); xmlReader.setContentHandler(handler); try (Reader reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8)) { final InputSource in = new InputSource(reader); xmlReader.parse(in); this.hintRules = handler.getHintRules(); this.vendorDuplicatingHintRules = handler.getVendorDuplicatingHintRules(); } } catch (ParserConfigurationException | FileNotFoundException ex) { LOGGER.debug("", ex); throw new HintParseException(ex); } catch (SAXException ex) { if (ex.getMessage().contains("Cannot find the declaration of element 'hints'.")) { throw ex; } else { LOGGER.debug("", ex); throw new HintParseException(ex); } } catch (IOException ex) { LOGGER.debug("", ex); throw new HintParseException(ex); } }
[ "public", "void", "parseHints", "(", "InputStream", "inputStream", ")", "throws", "HintParseException", ",", "SAXException", "{", "try", "(", "InputStream", "schemaStream13", "=", "FileUtils", ".", "getResourceAsStream", "(", "HINT_SCHEMA_1_3", ")", ";", "InputStream", "schemaStream12", "=", "FileUtils", ".", "getResourceAsStream", "(", "HINT_SCHEMA_1_2", ")", ";", "InputStream", "schemaStream11", "=", "FileUtils", ".", "getResourceAsStream", "(", "HINT_SCHEMA_1_1", ")", ";", ")", "{", "final", "HintHandler", "handler", "=", "new", "HintHandler", "(", ")", ";", "final", "SAXParser", "saxParser", "=", "XmlUtils", ".", "buildSecureSaxParser", "(", "schemaStream13", ",", "schemaStream12", ",", "schemaStream11", ")", ";", "final", "XMLReader", "xmlReader", "=", "saxParser", ".", "getXMLReader", "(", ")", ";", "xmlReader", ".", "setErrorHandler", "(", "new", "HintErrorHandler", "(", ")", ")", ";", "xmlReader", ".", "setContentHandler", "(", "handler", ")", ";", "try", "(", "Reader", "reader", "=", "new", "InputStreamReader", "(", "inputStream", ",", "StandardCharsets", ".", "UTF_8", ")", ")", "{", "final", "InputSource", "in", "=", "new", "InputSource", "(", "reader", ")", ";", "xmlReader", ".", "parse", "(", "in", ")", ";", "this", ".", "hintRules", "=", "handler", ".", "getHintRules", "(", ")", ";", "this", ".", "vendorDuplicatingHintRules", "=", "handler", ".", "getVendorDuplicatingHintRules", "(", ")", ";", "}", "}", "catch", "(", "ParserConfigurationException", "|", "FileNotFoundException", "ex", ")", "{", "LOGGER", ".", "debug", "(", "\"\"", ",", "ex", ")", ";", "throw", "new", "HintParseException", "(", "ex", ")", ";", "}", "catch", "(", "SAXException", "ex", ")", "{", "if", "(", "ex", ".", "getMessage", "(", ")", ".", "contains", "(", "\"Cannot find the declaration of element 'hints'.\"", ")", ")", "{", "throw", "ex", ";", "}", "else", "{", "LOGGER", ".", "debug", "(", "\"\"", ",", "ex", ")", ";", "throw", "new", "HintParseException", "(", "ex", ")", ";", "}", "}", "catch", "(", "IOException", "ex", ")", "{", "LOGGER", ".", "debug", "(", "\"\"", ",", "ex", ")", ";", "throw", "new", "HintParseException", "(", "ex", ")", ";", "}", "}" ]
Parses the given XML stream and returns a list of the hint rules contained. @param inputStream an InputStream containing hint rules @throws HintParseException thrown if the XML cannot be parsed @throws SAXException thrown if the XML cannot be parsed
[ "Parses", "the", "given", "XML", "stream", "and", "returns", "a", "list", "of", "the", "hint", "rules", "contained", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/hints/HintParser.java#L138-L168
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/InheritDocTaglet.java
InheritDocTaglet.getTagletOutput
public Content getTagletOutput(Tag tag, TagletWriter tagletWriter) { """ Given the <code>Tag</code> representation of this custom tag, return its string representation, which is output to the generated page. @param tag the <code>Tag</code> representation of this custom tag. @param tagletWriter the taglet writer for output. @return the Content representation of this <code>Tag</code>. """ if (! (tag.holder() instanceof ProgramElementDoc)) { return tagletWriter.getOutputInstance(); } return tag.name().equals("@inheritDoc") ? retrieveInheritedDocumentation(tagletWriter, (ProgramElementDoc) tag.holder(), null, tagletWriter.isFirstSentence) : retrieveInheritedDocumentation(tagletWriter, (ProgramElementDoc) tag.holder(), tag, tagletWriter.isFirstSentence); }
java
public Content getTagletOutput(Tag tag, TagletWriter tagletWriter) { if (! (tag.holder() instanceof ProgramElementDoc)) { return tagletWriter.getOutputInstance(); } return tag.name().equals("@inheritDoc") ? retrieveInheritedDocumentation(tagletWriter, (ProgramElementDoc) tag.holder(), null, tagletWriter.isFirstSentence) : retrieveInheritedDocumentation(tagletWriter, (ProgramElementDoc) tag.holder(), tag, tagletWriter.isFirstSentence); }
[ "public", "Content", "getTagletOutput", "(", "Tag", "tag", ",", "TagletWriter", "tagletWriter", ")", "{", "if", "(", "!", "(", "tag", ".", "holder", "(", ")", "instanceof", "ProgramElementDoc", ")", ")", "{", "return", "tagletWriter", ".", "getOutputInstance", "(", ")", ";", "}", "return", "tag", ".", "name", "(", ")", ".", "equals", "(", "\"@inheritDoc\"", ")", "?", "retrieveInheritedDocumentation", "(", "tagletWriter", ",", "(", "ProgramElementDoc", ")", "tag", ".", "holder", "(", ")", ",", "null", ",", "tagletWriter", ".", "isFirstSentence", ")", ":", "retrieveInheritedDocumentation", "(", "tagletWriter", ",", "(", "ProgramElementDoc", ")", "tag", ".", "holder", "(", ")", ",", "tag", ",", "tagletWriter", ".", "isFirstSentence", ")", ";", "}" ]
Given the <code>Tag</code> representation of this custom tag, return its string representation, which is output to the generated page. @param tag the <code>Tag</code> representation of this custom tag. @param tagletWriter the taglet writer for output. @return the Content representation of this <code>Tag</code>.
[ "Given", "the", "<code", ">", "Tag<", "/", "code", ">", "representation", "of", "this", "custom", "tag", "return", "its", "string", "representation", "which", "is", "output", "to", "the", "generated", "page", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/InheritDocTaglet.java#L163-L170
OpenLiberty/open-liberty
dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java
Util.decodeLTPAToken
@Sensitive public static byte[] decodeLTPAToken(Codec codec, @Sensitive byte[] token_arr) throws SASException { """ WAS classic encodes the GSSToken containing the encoded LTPA token inside another GSSToken. This code detects if there is another GSSToken inside the GSSToken, obtains the internal LTPA token bytes, and decodes them. @param codec The codec to do the encoding of the Any. @param token_arr the bytes of the GSS token to decode. @return the LTPA token bytes. """ byte[] ltpaTokenBytes = null; try { byte[] data = readGSSTokenData(LTPAMech.LTPA_OID.substring(4), token_arr); if (data != null) { // Check if it is double-encoded WAS classic token and get the encoded ltpa token bytes if (isGSSToken(LTPAMech.LTPA_OID.substring(4), data)) { data = readGSSTokenData(LTPAMech.LTPA_OID.substring(4), data); } Any any = codec.decode_value(data, org.omg.Security.OpaqueHelper.type()); ltpaTokenBytes = org.omg.Security.OpaqueHelper.extract(any); } } catch (Exception ex) { // TODO: Modify SASException to take a message? throw new SASException(2, ex); } if (ltpaTokenBytes == null || ltpaTokenBytes.length == 0) { throw new SASException(2); } return ltpaTokenBytes; }
java
@Sensitive public static byte[] decodeLTPAToken(Codec codec, @Sensitive byte[] token_arr) throws SASException { byte[] ltpaTokenBytes = null; try { byte[] data = readGSSTokenData(LTPAMech.LTPA_OID.substring(4), token_arr); if (data != null) { // Check if it is double-encoded WAS classic token and get the encoded ltpa token bytes if (isGSSToken(LTPAMech.LTPA_OID.substring(4), data)) { data = readGSSTokenData(LTPAMech.LTPA_OID.substring(4), data); } Any any = codec.decode_value(data, org.omg.Security.OpaqueHelper.type()); ltpaTokenBytes = org.omg.Security.OpaqueHelper.extract(any); } } catch (Exception ex) { // TODO: Modify SASException to take a message? throw new SASException(2, ex); } if (ltpaTokenBytes == null || ltpaTokenBytes.length == 0) { throw new SASException(2); } return ltpaTokenBytes; }
[ "@", "Sensitive", "public", "static", "byte", "[", "]", "decodeLTPAToken", "(", "Codec", "codec", ",", "@", "Sensitive", "byte", "[", "]", "token_arr", ")", "throws", "SASException", "{", "byte", "[", "]", "ltpaTokenBytes", "=", "null", ";", "try", "{", "byte", "[", "]", "data", "=", "readGSSTokenData", "(", "LTPAMech", ".", "LTPA_OID", ".", "substring", "(", "4", ")", ",", "token_arr", ")", ";", "if", "(", "data", "!=", "null", ")", "{", "// Check if it is double-encoded WAS classic token and get the encoded ltpa token bytes", "if", "(", "isGSSToken", "(", "LTPAMech", ".", "LTPA_OID", ".", "substring", "(", "4", ")", ",", "data", ")", ")", "{", "data", "=", "readGSSTokenData", "(", "LTPAMech", ".", "LTPA_OID", ".", "substring", "(", "4", ")", ",", "data", ")", ";", "}", "Any", "any", "=", "codec", ".", "decode_value", "(", "data", ",", "org", ".", "omg", ".", "Security", ".", "OpaqueHelper", ".", "type", "(", ")", ")", ";", "ltpaTokenBytes", "=", "org", ".", "omg", ".", "Security", ".", "OpaqueHelper", ".", "extract", "(", "any", ")", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "// TODO: Modify SASException to take a message?", "throw", "new", "SASException", "(", "2", ",", "ex", ")", ";", "}", "if", "(", "ltpaTokenBytes", "==", "null", "||", "ltpaTokenBytes", ".", "length", "==", "0", ")", "{", "throw", "new", "SASException", "(", "2", ")", ";", "}", "return", "ltpaTokenBytes", ";", "}" ]
WAS classic encodes the GSSToken containing the encoded LTPA token inside another GSSToken. This code detects if there is another GSSToken inside the GSSToken, obtains the internal LTPA token bytes, and decodes them. @param codec The codec to do the encoding of the Any. @param token_arr the bytes of the GSS token to decode. @return the LTPA token bytes.
[ "WAS", "classic", "encodes", "the", "GSSToken", "containing", "the", "encoded", "LTPA", "token", "inside", "another", "GSSToken", ".", "This", "code", "detects", "if", "there", "is", "another", "GSSToken", "inside", "the", "GSSToken", "obtains", "the", "internal", "LTPA", "token", "bytes", "and", "decodes", "them", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.csiv2.common/src/com/ibm/ws/transport/iiop/security/util/Util.java#L556-L579
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/ItemRule.java
ItemRule.setValue
public void setValue(Set<Token[]> tokensSet) { """ Sets a value to this Set type item. @param tokensSet the tokens set """ if (tokensSet == null) { throw new IllegalArgumentException("tokensSet must not be null"); } if (type == null) { type = ItemType.SET; } if (!isListableType()) { throw new IllegalArgumentException("The type of this item must be 'set', 'array' or 'list'"); } tokensList = new ArrayList<>(tokensSet); }
java
public void setValue(Set<Token[]> tokensSet) { if (tokensSet == null) { throw new IllegalArgumentException("tokensSet must not be null"); } if (type == null) { type = ItemType.SET; } if (!isListableType()) { throw new IllegalArgumentException("The type of this item must be 'set', 'array' or 'list'"); } tokensList = new ArrayList<>(tokensSet); }
[ "public", "void", "setValue", "(", "Set", "<", "Token", "[", "]", ">", "tokensSet", ")", "{", "if", "(", "tokensSet", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"tokensSet must not be null\"", ")", ";", "}", "if", "(", "type", "==", "null", ")", "{", "type", "=", "ItemType", ".", "SET", ";", "}", "if", "(", "!", "isListableType", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The type of this item must be 'set', 'array' or 'list'\"", ")", ";", "}", "tokensList", "=", "new", "ArrayList", "<>", "(", "tokensSet", ")", ";", "}" ]
Sets a value to this Set type item. @param tokensSet the tokens set
[ "Sets", "a", "value", "to", "this", "Set", "type", "item", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/ItemRule.java#L357-L368
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java
GVRPicker.setPickRay
public void setPickRay(float ox, float oy, float oz, float dx, float dy, float dz) { """ Sets the origin and direction of the pick ray. @param ox X coordinate of origin. @param oy Y coordinate of origin. @param oz Z coordinate of origin. @param dx X coordinate of ray direction. @param dy Y coordinate of ray direction. @param dz Z coordinate of ray direction. The coordinate system of the ray depends on the whether the picker is attached to a scene object or not. When attached to a scene object, the ray is in the coordinate system of that object where (0, 0, 0) is the center of the scene object and (0, 0, 1) is it's positive Z axis. If not attached to an object, the ray is in the coordinate system of the scene's main camera with (0, 0, 0) at the viewer and (0, 0, -1) where the viewer is looking. @see #doPick() @see #getPickRay() @see #getWorldPickRay(Vector3f, Vector3f) """ synchronized (this) { mRayOrigin.x = ox; mRayOrigin.y = oy; mRayOrigin.z = oz; mRayDirection.x = dx; mRayDirection.y = dy; mRayDirection.z = dz; } }
java
public void setPickRay(float ox, float oy, float oz, float dx, float dy, float dz) { synchronized (this) { mRayOrigin.x = ox; mRayOrigin.y = oy; mRayOrigin.z = oz; mRayDirection.x = dx; mRayDirection.y = dy; mRayDirection.z = dz; } }
[ "public", "void", "setPickRay", "(", "float", "ox", ",", "float", "oy", ",", "float", "oz", ",", "float", "dx", ",", "float", "dy", ",", "float", "dz", ")", "{", "synchronized", "(", "this", ")", "{", "mRayOrigin", ".", "x", "=", "ox", ";", "mRayOrigin", ".", "y", "=", "oy", ";", "mRayOrigin", ".", "z", "=", "oz", ";", "mRayDirection", ".", "x", "=", "dx", ";", "mRayDirection", ".", "y", "=", "dy", ";", "mRayDirection", ".", "z", "=", "dz", ";", "}", "}" ]
Sets the origin and direction of the pick ray. @param ox X coordinate of origin. @param oy Y coordinate of origin. @param oz Z coordinate of origin. @param dx X coordinate of ray direction. @param dy Y coordinate of ray direction. @param dz Z coordinate of ray direction. The coordinate system of the ray depends on the whether the picker is attached to a scene object or not. When attached to a scene object, the ray is in the coordinate system of that object where (0, 0, 0) is the center of the scene object and (0, 0, 1) is it's positive Z axis. If not attached to an object, the ray is in the coordinate system of the scene's main camera with (0, 0, 0) at the viewer and (0, 0, -1) where the viewer is looking. @see #doPick() @see #getPickRay() @see #getWorldPickRay(Vector3f, Vector3f)
[ "Sets", "the", "origin", "and", "direction", "of", "the", "pick", "ray", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPicker.java#L418-L429
cdk/cdk
descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/Tanimoto.java
Tanimoto.calculate
public static float calculate(BitSet bitset1, BitSet bitset2) throws CDKException { """ Evaluates Tanimoto coefficient for two bit sets. <p> @param bitset1 A bitset (such as a fingerprint) for the first molecule @param bitset2 A bitset (such as a fingerprint) for the second molecule @return The Tanimoto coefficient @throws org.openscience.cdk.exception.CDKException if bitsets are not of the same length """ float _bitset1_cardinality = bitset1.cardinality(); float _bitset2_cardinality = bitset2.cardinality(); if (bitset1.size() != bitset2.size()) { throw new CDKException("Bitsets must have the same bit length"); } BitSet one_and_two = (BitSet) bitset1.clone(); one_and_two.and(bitset2); float _common_bit_count = one_and_two.cardinality(); return _common_bit_count / (_bitset1_cardinality + _bitset2_cardinality - _common_bit_count); }
java
public static float calculate(BitSet bitset1, BitSet bitset2) throws CDKException { float _bitset1_cardinality = bitset1.cardinality(); float _bitset2_cardinality = bitset2.cardinality(); if (bitset1.size() != bitset2.size()) { throw new CDKException("Bitsets must have the same bit length"); } BitSet one_and_two = (BitSet) bitset1.clone(); one_and_two.and(bitset2); float _common_bit_count = one_and_two.cardinality(); return _common_bit_count / (_bitset1_cardinality + _bitset2_cardinality - _common_bit_count); }
[ "public", "static", "float", "calculate", "(", "BitSet", "bitset1", ",", "BitSet", "bitset2", ")", "throws", "CDKException", "{", "float", "_bitset1_cardinality", "=", "bitset1", ".", "cardinality", "(", ")", ";", "float", "_bitset2_cardinality", "=", "bitset2", ".", "cardinality", "(", ")", ";", "if", "(", "bitset1", ".", "size", "(", ")", "!=", "bitset2", ".", "size", "(", ")", ")", "{", "throw", "new", "CDKException", "(", "\"Bitsets must have the same bit length\"", ")", ";", "}", "BitSet", "one_and_two", "=", "(", "BitSet", ")", "bitset1", ".", "clone", "(", ")", ";", "one_and_two", ".", "and", "(", "bitset2", ")", ";", "float", "_common_bit_count", "=", "one_and_two", ".", "cardinality", "(", ")", ";", "return", "_common_bit_count", "/", "(", "_bitset1_cardinality", "+", "_bitset2_cardinality", "-", "_common_bit_count", ")", ";", "}" ]
Evaluates Tanimoto coefficient for two bit sets. <p> @param bitset1 A bitset (such as a fingerprint) for the first molecule @param bitset2 A bitset (such as a fingerprint) for the second molecule @return The Tanimoto coefficient @throws org.openscience.cdk.exception.CDKException if bitsets are not of the same length
[ "Evaluates", "Tanimoto", "coefficient", "for", "two", "bit", "sets", ".", "<p", ">" ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/fingerprint/src/main/java/org/openscience/cdk/similarity/Tanimoto.java#L78-L88
openbase/jul
visual/javafx/src/main/java/org/openbase/jul/visual/javafx/fxml/FXMLProcessor.java
FXMLProcessor.loadFxmlPaneAndControllerPair
public static <CONTROLLER extends AbstractFXController> Pair<Pane, CONTROLLER> loadFxmlPaneAndControllerPair(final String fxmlFileUri, final Class<CONTROLLER> controllerClass, final Class clazz) throws CouldNotPerformException { """ Method load the pane and controller of the given fxml file. @param fxmlFileUri the uri pointing to the fxml file within the classpath. @param controllerClass the class of the controller. @param clazz the responsible class which is used for class path resolution. @param <CONTROLLER> the type of controller which is controlling the new pane. @return an pair of the pane and its controller. @throws CouldNotPerformException is thrown if something went wrong like for example the fxml file does not exist. """ return loadFxmlPaneAndControllerPair(fxmlFileUri, controllerClass, clazz, null); }
java
public static <CONTROLLER extends AbstractFXController> Pair<Pane, CONTROLLER> loadFxmlPaneAndControllerPair(final String fxmlFileUri, final Class<CONTROLLER> controllerClass, final Class clazz) throws CouldNotPerformException { return loadFxmlPaneAndControllerPair(fxmlFileUri, controllerClass, clazz, null); }
[ "public", "static", "<", "CONTROLLER", "extends", "AbstractFXController", ">", "Pair", "<", "Pane", ",", "CONTROLLER", ">", "loadFxmlPaneAndControllerPair", "(", "final", "String", "fxmlFileUri", ",", "final", "Class", "<", "CONTROLLER", ">", "controllerClass", ",", "final", "Class", "clazz", ")", "throws", "CouldNotPerformException", "{", "return", "loadFxmlPaneAndControllerPair", "(", "fxmlFileUri", ",", "controllerClass", ",", "clazz", ",", "null", ")", ";", "}" ]
Method load the pane and controller of the given fxml file. @param fxmlFileUri the uri pointing to the fxml file within the classpath. @param controllerClass the class of the controller. @param clazz the responsible class which is used for class path resolution. @param <CONTROLLER> the type of controller which is controlling the new pane. @return an pair of the pane and its controller. @throws CouldNotPerformException is thrown if something went wrong like for example the fxml file does not exist.
[ "Method", "load", "the", "pane", "and", "controller", "of", "the", "given", "fxml", "file", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/fxml/FXMLProcessor.java#L152-L154
infinispan/infinispan
server/hotrod/src/main/java/org/infinispan/server/hotrod/TransactionRequestProcessor.java
TransactionRequestProcessor.validateConfiguration
private void validateConfiguration(AdvancedCache<byte[], byte[]> cache) { """ Checks if the configuration (and the transaction manager) is able to handle client transactions. """ Configuration configuration = cache.getCacheConfiguration(); if (!configuration.transaction().transactionMode().isTransactional()) { throw log.expectedTransactionalCache(cache.getName()); } if (configuration.locking().isolationLevel() != IsolationLevel.REPEATABLE_READ) { throw log.unexpectedIsolationLevel(cache.getName()); } //TODO because of ISPN-7672, optimistic and total order transactions needs versions. however, versioning is currently broken if (configuration.transaction().lockingMode() == LockingMode.OPTIMISTIC || configuration.transaction().transactionProtocol() == TransactionProtocol.TOTAL_ORDER) { //no Log. see comment above throw new IllegalStateException( String.format("Cache '%s' cannot use Optimistic neither Total Order transactions.", cache.getName())); } }
java
private void validateConfiguration(AdvancedCache<byte[], byte[]> cache) { Configuration configuration = cache.getCacheConfiguration(); if (!configuration.transaction().transactionMode().isTransactional()) { throw log.expectedTransactionalCache(cache.getName()); } if (configuration.locking().isolationLevel() != IsolationLevel.REPEATABLE_READ) { throw log.unexpectedIsolationLevel(cache.getName()); } //TODO because of ISPN-7672, optimistic and total order transactions needs versions. however, versioning is currently broken if (configuration.transaction().lockingMode() == LockingMode.OPTIMISTIC || configuration.transaction().transactionProtocol() == TransactionProtocol.TOTAL_ORDER) { //no Log. see comment above throw new IllegalStateException( String.format("Cache '%s' cannot use Optimistic neither Total Order transactions.", cache.getName())); } }
[ "private", "void", "validateConfiguration", "(", "AdvancedCache", "<", "byte", "[", "]", ",", "byte", "[", "]", ">", "cache", ")", "{", "Configuration", "configuration", "=", "cache", ".", "getCacheConfiguration", "(", ")", ";", "if", "(", "!", "configuration", ".", "transaction", "(", ")", ".", "transactionMode", "(", ")", ".", "isTransactional", "(", ")", ")", "{", "throw", "log", ".", "expectedTransactionalCache", "(", "cache", ".", "getName", "(", ")", ")", ";", "}", "if", "(", "configuration", ".", "locking", "(", ")", ".", "isolationLevel", "(", ")", "!=", "IsolationLevel", ".", "REPEATABLE_READ", ")", "{", "throw", "log", ".", "unexpectedIsolationLevel", "(", "cache", ".", "getName", "(", ")", ")", ";", "}", "//TODO because of ISPN-7672, optimistic and total order transactions needs versions. however, versioning is currently broken", "if", "(", "configuration", ".", "transaction", "(", ")", ".", "lockingMode", "(", ")", "==", "LockingMode", ".", "OPTIMISTIC", "||", "configuration", ".", "transaction", "(", ")", ".", "transactionProtocol", "(", ")", "==", "TransactionProtocol", ".", "TOTAL_ORDER", ")", "{", "//no Log. see comment above", "throw", "new", "IllegalStateException", "(", "String", ".", "format", "(", "\"Cache '%s' cannot use Optimistic neither Total Order transactions.\"", ",", "cache", ".", "getName", "(", ")", ")", ")", ";", "}", "}" ]
Checks if the configuration (and the transaction manager) is able to handle client transactions.
[ "Checks", "if", "the", "configuration", "(", "and", "the", "transaction", "manager", ")", "is", "able", "to", "handle", "client", "transactions", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/TransactionRequestProcessor.java#L172-L188
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/EntityUtils.java
EntityUtils.isEquipped
public static boolean isEquipped(EntityPlayer player, ItemStack itemStack, EnumHand hand) { """ Checks if is the {@link Item} contained in the {@link ItemStack} is equipped for the player. @param player the player @param itemStack the item stack @return true, if is equipped """ return isEquipped(player, itemStack != null ? itemStack.getItem() : null, hand); }
java
public static boolean isEquipped(EntityPlayer player, ItemStack itemStack, EnumHand hand) { return isEquipped(player, itemStack != null ? itemStack.getItem() : null, hand); }
[ "public", "static", "boolean", "isEquipped", "(", "EntityPlayer", "player", ",", "ItemStack", "itemStack", ",", "EnumHand", "hand", ")", "{", "return", "isEquipped", "(", "player", ",", "itemStack", "!=", "null", "?", "itemStack", ".", "getItem", "(", ")", ":", "null", ",", "hand", ")", ";", "}" ]
Checks if is the {@link Item} contained in the {@link ItemStack} is equipped for the player. @param player the player @param itemStack the item stack @return true, if is equipped
[ "Checks", "if", "is", "the", "{", "@link", "Item", "}", "contained", "in", "the", "{", "@link", "ItemStack", "}", "is", "equipped", "for", "the", "player", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/EntityUtils.java#L213-L216
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/searchindex/CmsSearchResultView.java
CmsSearchResultView.getSearchPageLink
private String getSearchPageLink(String link, CmsSearch search) { """ Returns the resource uri to the search page with respect to the optionally configured value <code>{@link #setSearchRessourceUrl(String)}</code> with the request parameters of the given argument.<p> This is a workaround for Tomcat bug 35775 (http://issues.apache.org/bugzilla/show_bug.cgi?id=35775). After it has been fixed the version 1.1 should be restored (or at least this codepath should be switched back.<p> @param link the suggestion of the search result bean ( a previous, next or page number url) @param search the search bean @return the resource uri to the search page with respect to the optionally configured value <code>{@link #setSearchRessourceUrl(String)}</code> with the request parameters of the given argument """ if (m_searchRessourceUrl != null) { // for the form to generate we need params. String pageParams = ""; int paramIndex = link.indexOf('?'); if (paramIndex > 0) { pageParams = link.substring(paramIndex); } StringBuffer formurl = new StringBuffer(m_searchRessourceUrl); if (m_searchRessourceUrl.indexOf('?') != -1) { // the search page url already has a query string, don't start params of search-generated link // with '?' pageParams = new StringBuffer("&").append(pageParams.substring(1)).toString(); } formurl.append(pageParams).toString(); String formname = toPostParameters(formurl.toString(), search); link = new StringBuffer("javascript:document.forms['").append(formname).append("'].submit()").toString(); } return link; }
java
private String getSearchPageLink(String link, CmsSearch search) { if (m_searchRessourceUrl != null) { // for the form to generate we need params. String pageParams = ""; int paramIndex = link.indexOf('?'); if (paramIndex > 0) { pageParams = link.substring(paramIndex); } StringBuffer formurl = new StringBuffer(m_searchRessourceUrl); if (m_searchRessourceUrl.indexOf('?') != -1) { // the search page url already has a query string, don't start params of search-generated link // with '?' pageParams = new StringBuffer("&").append(pageParams.substring(1)).toString(); } formurl.append(pageParams).toString(); String formname = toPostParameters(formurl.toString(), search); link = new StringBuffer("javascript:document.forms['").append(formname).append("'].submit()").toString(); } return link; }
[ "private", "String", "getSearchPageLink", "(", "String", "link", ",", "CmsSearch", "search", ")", "{", "if", "(", "m_searchRessourceUrl", "!=", "null", ")", "{", "// for the form to generate we need params.", "String", "pageParams", "=", "\"\"", ";", "int", "paramIndex", "=", "link", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "paramIndex", ">", "0", ")", "{", "pageParams", "=", "link", ".", "substring", "(", "paramIndex", ")", ";", "}", "StringBuffer", "formurl", "=", "new", "StringBuffer", "(", "m_searchRessourceUrl", ")", ";", "if", "(", "m_searchRessourceUrl", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "{", "// the search page url already has a query string, don't start params of search-generated link", "// with '?'", "pageParams", "=", "new", "StringBuffer", "(", "\"&\"", ")", ".", "append", "(", "pageParams", ".", "substring", "(", "1", ")", ")", ".", "toString", "(", ")", ";", "}", "formurl", ".", "append", "(", "pageParams", ")", ".", "toString", "(", ")", ";", "String", "formname", "=", "toPostParameters", "(", "formurl", ".", "toString", "(", ")", ",", "search", ")", ";", "link", "=", "new", "StringBuffer", "(", "\"javascript:document.forms['\"", ")", ".", "append", "(", "formname", ")", ".", "append", "(", "\"'].submit()\"", ")", ".", "toString", "(", ")", ";", "}", "return", "link", ";", "}" ]
Returns the resource uri to the search page with respect to the optionally configured value <code>{@link #setSearchRessourceUrl(String)}</code> with the request parameters of the given argument.<p> This is a workaround for Tomcat bug 35775 (http://issues.apache.org/bugzilla/show_bug.cgi?id=35775). After it has been fixed the version 1.1 should be restored (or at least this codepath should be switched back.<p> @param link the suggestion of the search result bean ( a previous, next or page number url) @param search the search bean @return the resource uri to the search page with respect to the optionally configured value <code>{@link #setSearchRessourceUrl(String)}</code> with the request parameters of the given argument
[ "Returns", "the", "resource", "uri", "to", "the", "search", "page", "with", "respect", "to", "the", "optionally", "configured", "value", "<code", ">", "{", "@link", "#setSearchRessourceUrl", "(", "String", ")", "}", "<", "/", "code", ">", "with", "the", "request", "parameters", "of", "the", "given", "argument", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/searchindex/CmsSearchResultView.java#L378-L399
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CredentialsInner.java
CredentialsInner.get
public CredentialInner get(String resourceGroupName, String automationAccountName, String credentialName) { """ Retrieve the credential identified by credential name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param credentialName The name of credential. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the CredentialInner object if successful. """ return getWithServiceResponseAsync(resourceGroupName, automationAccountName, credentialName).toBlocking().single().body(); }
java
public CredentialInner get(String resourceGroupName, String automationAccountName, String credentialName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, credentialName).toBlocking().single().body(); }
[ "public", "CredentialInner", "get", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "credentialName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "credentialName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Retrieve the credential identified by credential name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param credentialName The name of credential. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the CredentialInner object if successful.
[ "Retrieve", "the", "credential", "identified", "by", "credential", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CredentialsInner.java#L195-L197
CenturyLinkCloud/mdw
mdw-services/src/com/centurylink/mdw/services/rest/JsonXmlRestService.java
JsonXmlRestService.getXml
@Override public String getXml(XmlObject xml, Map<String, String> metaInfo) throws ServiceException { """ If the expected response back from the getJson() method is not null, then need to override getXml() in concrete service class to convert to XML response. Steps would include calling super.getXml(), then creating new JSON object specific to the expected Jsonable class for the response, and then calling JaxbTranslator.realToString(JsonableObject) to marshall it and get the XML string back to return. Here's an example @Override public String getXml(XmlObject xml, Map<String, String> metaInfo) throws ServiceException { String response = super.getXml(xml, metaInfo); if (response != null) { try { response = getJaxbTranslator(getPkg(metaInfo)).realToString(new Employee(new JSONObject(response))); } catch (Exception e) { throw new ServiceException(e.getMessage()); } } return response; """ try { Package pkg = getPkg(metaInfo); JSONObject jsonObj = null; if (xml != null) jsonObj = ((Jsonable)getJaxbTranslator(pkg).realToObject(xml.xmlText())).getJson(); return getJson(jsonObj, metaInfo); } catch (Exception e) { throw new ServiceException(e.getMessage()); } }
java
@Override public String getXml(XmlObject xml, Map<String, String> metaInfo) throws ServiceException { try { Package pkg = getPkg(metaInfo); JSONObject jsonObj = null; if (xml != null) jsonObj = ((Jsonable)getJaxbTranslator(pkg).realToObject(xml.xmlText())).getJson(); return getJson(jsonObj, metaInfo); } catch (Exception e) { throw new ServiceException(e.getMessage()); } }
[ "@", "Override", "public", "String", "getXml", "(", "XmlObject", "xml", ",", "Map", "<", "String", ",", "String", ">", "metaInfo", ")", "throws", "ServiceException", "{", "try", "{", "Package", "pkg", "=", "getPkg", "(", "metaInfo", ")", ";", "JSONObject", "jsonObj", "=", "null", ";", "if", "(", "xml", "!=", "null", ")", "jsonObj", "=", "(", "(", "Jsonable", ")", "getJaxbTranslator", "(", "pkg", ")", ".", "realToObject", "(", "xml", ".", "xmlText", "(", ")", ")", ")", ".", "getJson", "(", ")", ";", "return", "getJson", "(", "jsonObj", ",", "metaInfo", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "ServiceException", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
If the expected response back from the getJson() method is not null, then need to override getXml() in concrete service class to convert to XML response. Steps would include calling super.getXml(), then creating new JSON object specific to the expected Jsonable class for the response, and then calling JaxbTranslator.realToString(JsonableObject) to marshall it and get the XML string back to return. Here's an example @Override public String getXml(XmlObject xml, Map<String, String> metaInfo) throws ServiceException { String response = super.getXml(xml, metaInfo); if (response != null) { try { response = getJaxbTranslator(getPkg(metaInfo)).realToString(new Employee(new JSONObject(response))); } catch (Exception e) { throw new ServiceException(e.getMessage()); } } return response;
[ "If", "the", "expected", "response", "back", "from", "the", "getJson", "()", "method", "is", "not", "null", "then", "need", "to", "override", "getXml", "()", "in", "concrete", "service", "class", "to", "convert", "to", "XML", "response", ".", "Steps", "would", "include", "calling", "super", ".", "getXml", "()", "then", "creating", "new", "JSON", "object", "specific", "to", "the", "expected", "Jsonable", "class", "for", "the", "response", "and", "then", "calling", "JaxbTranslator", ".", "realToString", "(", "JsonableObject", ")", "to", "marshall", "it", "and", "get", "the", "XML", "string", "back", "to", "return", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/rest/JsonXmlRestService.java#L55-L68
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MultipleIdsMessageAcknowledgingSourceBase.java
MultipleIdsMessageAcknowledgingSourceBase.acknowledgeIDs
@Override protected final void acknowledgeIDs(long checkpointId, Set<UId> uniqueIds) { """ Acknowledges the session ids. @param checkpointId The id of the current checkout to acknowledge ids for. @param uniqueIds The checkpointed unique ids which are ignored here. They only serve as a means of de-duplicating messages when the acknowledgment after a checkpoint fails. """ LOG.debug("Acknowledging ids for checkpoint {}", checkpointId); Iterator<Tuple2<Long, List<SessionId>>> iterator = sessionIdsPerSnapshot.iterator(); while (iterator.hasNext()) { final Tuple2<Long, List<SessionId>> next = iterator.next(); long id = next.f0; if (id <= checkpointId) { acknowledgeSessionIDs(next.f1); // remove ids for this session iterator.remove(); } } }
java
@Override protected final void acknowledgeIDs(long checkpointId, Set<UId> uniqueIds) { LOG.debug("Acknowledging ids for checkpoint {}", checkpointId); Iterator<Tuple2<Long, List<SessionId>>> iterator = sessionIdsPerSnapshot.iterator(); while (iterator.hasNext()) { final Tuple2<Long, List<SessionId>> next = iterator.next(); long id = next.f0; if (id <= checkpointId) { acknowledgeSessionIDs(next.f1); // remove ids for this session iterator.remove(); } } }
[ "@", "Override", "protected", "final", "void", "acknowledgeIDs", "(", "long", "checkpointId", ",", "Set", "<", "UId", ">", "uniqueIds", ")", "{", "LOG", ".", "debug", "(", "\"Acknowledging ids for checkpoint {}\"", ",", "checkpointId", ")", ";", "Iterator", "<", "Tuple2", "<", "Long", ",", "List", "<", "SessionId", ">", ">", ">", "iterator", "=", "sessionIdsPerSnapshot", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "final", "Tuple2", "<", "Long", ",", "List", "<", "SessionId", ">", ">", "next", "=", "iterator", ".", "next", "(", ")", ";", "long", "id", "=", "next", ".", "f0", ";", "if", "(", "id", "<=", "checkpointId", ")", "{", "acknowledgeSessionIDs", "(", "next", ".", "f1", ")", ";", "// remove ids for this session", "iterator", ".", "remove", "(", ")", ";", "}", "}", "}" ]
Acknowledges the session ids. @param checkpointId The id of the current checkout to acknowledge ids for. @param uniqueIds The checkpointed unique ids which are ignored here. They only serve as a means of de-duplicating messages when the acknowledgment after a checkpoint fails.
[ "Acknowledges", "the", "session", "ids", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/MultipleIdsMessageAcknowledgingSourceBase.java#L114-L127
apache/groovy
src/main/java/org/codehaus/groovy/classgen/asm/InvocationWriter.java
InvocationWriter.castToNonPrimitiveIfNecessary
public void castToNonPrimitiveIfNecessary(final ClassNode sourceType, final ClassNode targetType) { """ This converts sourceType to a non primitive by using Groovy casting. sourceType might be a primitive This might be done using SBA#castToType """ OperandStack os = controller.getOperandStack(); ClassNode boxedType = os.box(); if (WideningCategories.implementsInterfaceOrSubclassOf(boxedType, targetType)) return; MethodVisitor mv = controller.getMethodVisitor(); if (ClassHelper.CLASS_Type.equals(targetType)) { castToClassMethod.call(mv); } else if (ClassHelper.STRING_TYPE.equals(targetType)) { castToStringMethod.call(mv); } else if (targetType.isDerivedFrom(ClassHelper.Enum_Type)) { (new ClassExpression(targetType)).visit(controller.getAcg()); os.remove(1); castToEnumMethod.call(mv); BytecodeHelper.doCast(mv, targetType); } else { (new ClassExpression(targetType)).visit(controller.getAcg()); os.remove(1); castToTypeMethod.call(mv); } }
java
public void castToNonPrimitiveIfNecessary(final ClassNode sourceType, final ClassNode targetType) { OperandStack os = controller.getOperandStack(); ClassNode boxedType = os.box(); if (WideningCategories.implementsInterfaceOrSubclassOf(boxedType, targetType)) return; MethodVisitor mv = controller.getMethodVisitor(); if (ClassHelper.CLASS_Type.equals(targetType)) { castToClassMethod.call(mv); } else if (ClassHelper.STRING_TYPE.equals(targetType)) { castToStringMethod.call(mv); } else if (targetType.isDerivedFrom(ClassHelper.Enum_Type)) { (new ClassExpression(targetType)).visit(controller.getAcg()); os.remove(1); castToEnumMethod.call(mv); BytecodeHelper.doCast(mv, targetType); } else { (new ClassExpression(targetType)).visit(controller.getAcg()); os.remove(1); castToTypeMethod.call(mv); } }
[ "public", "void", "castToNonPrimitiveIfNecessary", "(", "final", "ClassNode", "sourceType", ",", "final", "ClassNode", "targetType", ")", "{", "OperandStack", "os", "=", "controller", ".", "getOperandStack", "(", ")", ";", "ClassNode", "boxedType", "=", "os", ".", "box", "(", ")", ";", "if", "(", "WideningCategories", ".", "implementsInterfaceOrSubclassOf", "(", "boxedType", ",", "targetType", ")", ")", "return", ";", "MethodVisitor", "mv", "=", "controller", ".", "getMethodVisitor", "(", ")", ";", "if", "(", "ClassHelper", ".", "CLASS_Type", ".", "equals", "(", "targetType", ")", ")", "{", "castToClassMethod", ".", "call", "(", "mv", ")", ";", "}", "else", "if", "(", "ClassHelper", ".", "STRING_TYPE", ".", "equals", "(", "targetType", ")", ")", "{", "castToStringMethod", ".", "call", "(", "mv", ")", ";", "}", "else", "if", "(", "targetType", ".", "isDerivedFrom", "(", "ClassHelper", ".", "Enum_Type", ")", ")", "{", "(", "new", "ClassExpression", "(", "targetType", ")", ")", ".", "visit", "(", "controller", ".", "getAcg", "(", ")", ")", ";", "os", ".", "remove", "(", "1", ")", ";", "castToEnumMethod", ".", "call", "(", "mv", ")", ";", "BytecodeHelper", ".", "doCast", "(", "mv", ",", "targetType", ")", ";", "}", "else", "{", "(", "new", "ClassExpression", "(", "targetType", ")", ")", ".", "visit", "(", "controller", ".", "getAcg", "(", ")", ")", ";", "os", ".", "remove", "(", "1", ")", ";", "castToTypeMethod", ".", "call", "(", "mv", ")", ";", "}", "}" ]
This converts sourceType to a non primitive by using Groovy casting. sourceType might be a primitive This might be done using SBA#castToType
[ "This", "converts", "sourceType", "to", "a", "non", "primitive", "by", "using", "Groovy", "casting", ".", "sourceType", "might", "be", "a", "primitive", "This", "might", "be", "done", "using", "SBA#castToType" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/InvocationWriter.java#L932-L951
Inbot/inbot-utils
src/main/java/io/inbot/utils/Math.java
Math.normalize
public static double normalize(double i, double factor) { """ Useful for normalizing integer or double values to a number between 0 and 1. This uses a simple logistic function: https://en.wikipedia.org/wiki/Logistic_function with some small adaptations: <pre> (1 / (1 + java.lang.Math.exp(-1 * (factor * i))) - 0.5) * 2 </pre> @param i any positive long @param factor allows you to control how quickly things converge on 1. For values that range between 0 and the low hundreds, something like 0.05 is a good starting point. @return a double between 0 and 1. """ Validate.isTrue(i >= 0, "should be positive value"); return (1 / (1 + java.lang.Math.exp(-1 * (factor * i))) - 0.5) * 2; }
java
public static double normalize(double i, double factor) { Validate.isTrue(i >= 0, "should be positive value"); return (1 / (1 + java.lang.Math.exp(-1 * (factor * i))) - 0.5) * 2; }
[ "public", "static", "double", "normalize", "(", "double", "i", ",", "double", "factor", ")", "{", "Validate", ".", "isTrue", "(", "i", ">=", "0", ",", "\"should be positive value\"", ")", ";", "return", "(", "1", "/", "(", "1", "+", "java", ".", "lang", ".", "Math", ".", "exp", "(", "-", "1", "*", "(", "factor", "*", "i", ")", ")", ")", "-", "0.5", ")", "*", "2", ";", "}" ]
Useful for normalizing integer or double values to a number between 0 and 1. This uses a simple logistic function: https://en.wikipedia.org/wiki/Logistic_function with some small adaptations: <pre> (1 / (1 + java.lang.Math.exp(-1 * (factor * i))) - 0.5) * 2 </pre> @param i any positive long @param factor allows you to control how quickly things converge on 1. For values that range between 0 and the low hundreds, something like 0.05 is a good starting point. @return a double between 0 and 1.
[ "Useful", "for", "normalizing", "integer", "or", "double", "values", "to", "a", "number", "between", "0", "and", "1", ".", "This", "uses", "a", "simple", "logistic", "function", ":", "https", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Logistic_function", "with", "some", "small", "adaptations", ":", "<pre", ">", "(", "1", "/", "(", "1", "+", "java", ".", "lang", ".", "Math", ".", "exp", "(", "-", "1", "*", "(", "factor", "*", "i", ")))", "-", "0", ".", "5", ")", "*", "2", "<", "/", "pre", ">" ]
train
https://github.com/Inbot/inbot-utils/blob/3112bc08d4237e95fe0f8a219a5bbceb390d0505/src/main/java/io/inbot/utils/Math.java#L75-L78
sagiegurari/fax4j
src/main/java/org/fax4j/spi/LogFaxClientSpiInterceptor.java
LogFaxClientSpiInterceptor.preMethodInvocation
public final void preMethodInvocation(Method method,Object[] arguments) { """ This function is invoked by the fax client SPI proxy before invoking the method in the fax client SPI itself. @param method The method invoked @param arguments The method arguments """ this.logEvent(FaxClientSpiProxyEventType.PRE_EVENT_TYPE,method,arguments,null,null); }
java
public final void preMethodInvocation(Method method,Object[] arguments) { this.logEvent(FaxClientSpiProxyEventType.PRE_EVENT_TYPE,method,arguments,null,null); }
[ "public", "final", "void", "preMethodInvocation", "(", "Method", "method", ",", "Object", "[", "]", "arguments", ")", "{", "this", ".", "logEvent", "(", "FaxClientSpiProxyEventType", ".", "PRE_EVENT_TYPE", ",", "method", ",", "arguments", ",", "null", ",", "null", ")", ";", "}" ]
This function is invoked by the fax client SPI proxy before invoking the method in the fax client SPI itself. @param method The method invoked @param arguments The method arguments
[ "This", "function", "is", "invoked", "by", "the", "fax", "client", "SPI", "proxy", "before", "invoking", "the", "method", "in", "the", "fax", "client", "SPI", "itself", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/LogFaxClientSpiInterceptor.java#L159-L162
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.updateCertificateOperation
public CertificateOperation updateCertificateOperation(String vaultBaseUrl, String certificateName, boolean cancellationRequested) { """ Updates a certificate operation. Updates a certificate creation operation that is already in progress. This operation requires the certificates/update permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param cancellationRequested Indicates if cancellation was requested on the certificate operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the CertificateOperation object if successful. """ return updateCertificateOperationWithServiceResponseAsync(vaultBaseUrl, certificateName, cancellationRequested).toBlocking().single().body(); }
java
public CertificateOperation updateCertificateOperation(String vaultBaseUrl, String certificateName, boolean cancellationRequested) { return updateCertificateOperationWithServiceResponseAsync(vaultBaseUrl, certificateName, cancellationRequested).toBlocking().single().body(); }
[ "public", "CertificateOperation", "updateCertificateOperation", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "boolean", "cancellationRequested", ")", "{", "return", "updateCertificateOperationWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "certificateName", ",", "cancellationRequested", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates a certificate operation. Updates a certificate creation operation that is already in progress. This operation requires the certificates/update permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param cancellationRequested Indicates if cancellation was requested on the certificate operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the CertificateOperation object if successful.
[ "Updates", "a", "certificate", "operation", ".", "Updates", "a", "certificate", "creation", "operation", "that", "is", "already", "in", "progress", ".", "This", "operation", "requires", "the", "certificates", "/", "update", "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#L7641-L7643
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java
Parameters.getStringList
public List<String> getStringList(final String param) { """ Gets a parameter whose value is a (possibly empty) comma-separated list of Strings. """ return get(param, new StringToStringList(","), new AlwaysValid<List<String>>(), "comma-separated list of strings"); }
java
public List<String> getStringList(final String param) { return get(param, new StringToStringList(","), new AlwaysValid<List<String>>(), "comma-separated list of strings"); }
[ "public", "List", "<", "String", ">", "getStringList", "(", "final", "String", "param", ")", "{", "return", "get", "(", "param", ",", "new", "StringToStringList", "(", "\",\"", ")", ",", "new", "AlwaysValid", "<", "List", "<", "String", ">", ">", "(", ")", ",", "\"comma-separated list of strings\"", ")", ";", "}" ]
Gets a parameter whose value is a (possibly empty) comma-separated list of Strings.
[ "Gets", "a", "parameter", "whose", "value", "is", "a", "(", "possibly", "empty", ")", "comma", "-", "separated", "list", "of", "Strings", "." ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L884-L888
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/PagedWidget.java
PagedWidget.displayPage
public void displayPage (final int page, boolean forceRefresh) { """ Displays the specified page. Does nothing if we are already displaying that page unless forceRefresh is true. """ if (_page == page && !forceRefresh) { return; // NOOP! } // Display the now loading widget, if necessary. configureLoadingNavi(_controls, 0, _infoCol); _page = Math.max(page, 0); final boolean overQuery = (_model.getItemCount() < 0); final int count = _resultsPerPage; final int start = _resultsPerPage * page; _model.doFetchRows(start, overQuery ? (count + 1) : count, new AsyncCallback<List<T>>() { public void onSuccess (List<T> result) { if (overQuery) { // if we requested 1 item too many, see if we got it if (result.size() < (count + 1)) { // no: this is the last batch of items, woohoo _lastItem = start + result.size(); } else { // yes: strip it before anybody else gets to see it result.remove(count); _lastItem = -1; } } else { // a valid item count should be available at this point _lastItem = _model.getItemCount(); } displayResults(start, count, result); } public void onFailure (Throwable caught) { reportFailure(caught); } }); }
java
public void displayPage (final int page, boolean forceRefresh) { if (_page == page && !forceRefresh) { return; // NOOP! } // Display the now loading widget, if necessary. configureLoadingNavi(_controls, 0, _infoCol); _page = Math.max(page, 0); final boolean overQuery = (_model.getItemCount() < 0); final int count = _resultsPerPage; final int start = _resultsPerPage * page; _model.doFetchRows(start, overQuery ? (count + 1) : count, new AsyncCallback<List<T>>() { public void onSuccess (List<T> result) { if (overQuery) { // if we requested 1 item too many, see if we got it if (result.size() < (count + 1)) { // no: this is the last batch of items, woohoo _lastItem = start + result.size(); } else { // yes: strip it before anybody else gets to see it result.remove(count); _lastItem = -1; } } else { // a valid item count should be available at this point _lastItem = _model.getItemCount(); } displayResults(start, count, result); } public void onFailure (Throwable caught) { reportFailure(caught); } }); }
[ "public", "void", "displayPage", "(", "final", "int", "page", ",", "boolean", "forceRefresh", ")", "{", "if", "(", "_page", "==", "page", "&&", "!", "forceRefresh", ")", "{", "return", ";", "// NOOP!", "}", "// Display the now loading widget, if necessary.", "configureLoadingNavi", "(", "_controls", ",", "0", ",", "_infoCol", ")", ";", "_page", "=", "Math", ".", "max", "(", "page", ",", "0", ")", ";", "final", "boolean", "overQuery", "=", "(", "_model", ".", "getItemCount", "(", ")", "<", "0", ")", ";", "final", "int", "count", "=", "_resultsPerPage", ";", "final", "int", "start", "=", "_resultsPerPage", "*", "page", ";", "_model", ".", "doFetchRows", "(", "start", ",", "overQuery", "?", "(", "count", "+", "1", ")", ":", "count", ",", "new", "AsyncCallback", "<", "List", "<", "T", ">", ">", "(", ")", "{", "public", "void", "onSuccess", "(", "List", "<", "T", ">", "result", ")", "{", "if", "(", "overQuery", ")", "{", "// if we requested 1 item too many, see if we got it", "if", "(", "result", ".", "size", "(", ")", "<", "(", "count", "+", "1", ")", ")", "{", "// no: this is the last batch of items, woohoo", "_lastItem", "=", "start", "+", "result", ".", "size", "(", ")", ";", "}", "else", "{", "// yes: strip it before anybody else gets to see it", "result", ".", "remove", "(", "count", ")", ";", "_lastItem", "=", "-", "1", ";", "}", "}", "else", "{", "// a valid item count should be available at this point", "_lastItem", "=", "_model", ".", "getItemCount", "(", ")", ";", "}", "displayResults", "(", "start", ",", "count", ",", "result", ")", ";", "}", "public", "void", "onFailure", "(", "Throwable", "caught", ")", "{", "reportFailure", "(", "caught", ")", ";", "}", "}", ")", ";", "}" ]
Displays the specified page. Does nothing if we are already displaying that page unless forceRefresh is true.
[ "Displays", "the", "specified", "page", ".", "Does", "nothing", "if", "we", "are", "already", "displaying", "that", "page", "unless", "forceRefresh", "is", "true", "." ]
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/PagedWidget.java#L160-L196
m-m-m/util
text/src/main/java/net/sf/mmm/util/text/base/HyphenationState.java
HyphenationState.apply
private void apply(HyphenationPattern pattern, int pos) { """ This method applies the {@link HyphenationPattern pattern} matching at the given {@code offset}. @param pattern is the matching {@link HyphenationPattern pattern}. @param pos is the offset in the word to hyphenate. """ int internalOffset = pos - 2; HyphenationPatternPosition[] positions = pattern.getHyphenationPositions(); for (HyphenationPatternPosition hyphenationPosition : positions) { int i = hyphenationPosition.index + internalOffset; if ((i >= 0) && (i < this.rankings.length) && (hyphenationPosition.ranking > this.rankings[i])) { this.rankings[i] = hyphenationPosition.ranking; } } }
java
private void apply(HyphenationPattern pattern, int pos) { int internalOffset = pos - 2; HyphenationPatternPosition[] positions = pattern.getHyphenationPositions(); for (HyphenationPatternPosition hyphenationPosition : positions) { int i = hyphenationPosition.index + internalOffset; if ((i >= 0) && (i < this.rankings.length) && (hyphenationPosition.ranking > this.rankings[i])) { this.rankings[i] = hyphenationPosition.ranking; } } }
[ "private", "void", "apply", "(", "HyphenationPattern", "pattern", ",", "int", "pos", ")", "{", "int", "internalOffset", "=", "pos", "-", "2", ";", "HyphenationPatternPosition", "[", "]", "positions", "=", "pattern", ".", "getHyphenationPositions", "(", ")", ";", "for", "(", "HyphenationPatternPosition", "hyphenationPosition", ":", "positions", ")", "{", "int", "i", "=", "hyphenationPosition", ".", "index", "+", "internalOffset", ";", "if", "(", "(", "i", ">=", "0", ")", "&&", "(", "i", "<", "this", ".", "rankings", ".", "length", ")", "&&", "(", "hyphenationPosition", ".", "ranking", ">", "this", ".", "rankings", "[", "i", "]", ")", ")", "{", "this", ".", "rankings", "[", "i", "]", "=", "hyphenationPosition", ".", "ranking", ";", "}", "}", "}" ]
This method applies the {@link HyphenationPattern pattern} matching at the given {@code offset}. @param pattern is the matching {@link HyphenationPattern pattern}. @param pos is the offset in the word to hyphenate.
[ "This", "method", "applies", "the", "{", "@link", "HyphenationPattern", "pattern", "}", "matching", "at", "the", "given", "{", "@code", "offset", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/text/src/main/java/net/sf/mmm/util/text/base/HyphenationState.java#L146-L156
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java
Settings.getTempFile
public File getTempFile(@NotNull final String prefix, @NotNull final String extension) throws IOException { """ Generates a new temporary file name that is guaranteed to be unique. @param prefix the prefix for the file name to generate @param extension the extension of the generated file name @return a temporary File @throws java.io.IOException if any. """ final File dir = getTempDirectory(); final String tempFileName = String.format("%s%s.%s", prefix, UUID.randomUUID().toString(), extension); final File tempFile = new File(dir, tempFileName); if (tempFile.exists()) { return getTempFile(prefix, extension); } return tempFile; }
java
public File getTempFile(@NotNull final String prefix, @NotNull final String extension) throws IOException { final File dir = getTempDirectory(); final String tempFileName = String.format("%s%s.%s", prefix, UUID.randomUUID().toString(), extension); final File tempFile = new File(dir, tempFileName); if (tempFile.exists()) { return getTempFile(prefix, extension); } return tempFile; }
[ "public", "File", "getTempFile", "(", "@", "NotNull", "final", "String", "prefix", ",", "@", "NotNull", "final", "String", "extension", ")", "throws", "IOException", "{", "final", "File", "dir", "=", "getTempDirectory", "(", ")", ";", "final", "String", "tempFileName", "=", "String", ".", "format", "(", "\"%s%s.%s\"", ",", "prefix", ",", "UUID", ".", "randomUUID", "(", ")", ".", "toString", "(", ")", ",", "extension", ")", ";", "final", "File", "tempFile", "=", "new", "File", "(", "dir", ",", "tempFileName", ")", ";", "if", "(", "tempFile", ".", "exists", "(", ")", ")", "{", "return", "getTempFile", "(", "prefix", ",", "extension", ")", ";", "}", "return", "tempFile", ";", "}" ]
Generates a new temporary file name that is guaranteed to be unique. @param prefix the prefix for the file name to generate @param extension the extension of the generated file name @return a temporary File @throws java.io.IOException if any.
[ "Generates", "a", "new", "temporary", "file", "name", "that", "is", "guaranteed", "to", "be", "unique", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/Settings.java#L1174-L1182
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java
RedisJobStore.storeTrigger
@Override public void storeTrigger(final OperableTrigger newTrigger, final boolean replaceExisting) throws ObjectAlreadyExistsException, JobPersistenceException { """ Store the given <code>{@link org.quartz.Trigger}</code>. @param newTrigger The <code>Trigger</code> to be stored. @param replaceExisting If <code>true</code>, any <code>Trigger</code> existing in the <code>JobStore</code> with the same name & group should be over-written. @throws org.quartz.ObjectAlreadyExistsException if a <code>Trigger</code> with the same name/group already exists, and replaceExisting is set to false. @see #pauseTriggers(org.quartz.impl.matchers.GroupMatcher) """ doWithLock(new LockCallbackWithoutResult() { @Override public Void doWithLock(JedisCommands jedis) throws JobPersistenceException { storage.storeTrigger(newTrigger, replaceExisting, jedis); return null; } }, "Could not store trigger."); }
java
@Override public void storeTrigger(final OperableTrigger newTrigger, final boolean replaceExisting) throws ObjectAlreadyExistsException, JobPersistenceException { doWithLock(new LockCallbackWithoutResult() { @Override public Void doWithLock(JedisCommands jedis) throws JobPersistenceException { storage.storeTrigger(newTrigger, replaceExisting, jedis); return null; } }, "Could not store trigger."); }
[ "@", "Override", "public", "void", "storeTrigger", "(", "final", "OperableTrigger", "newTrigger", ",", "final", "boolean", "replaceExisting", ")", "throws", "ObjectAlreadyExistsException", ",", "JobPersistenceException", "{", "doWithLock", "(", "new", "LockCallbackWithoutResult", "(", ")", "{", "@", "Override", "public", "Void", "doWithLock", "(", "JedisCommands", "jedis", ")", "throws", "JobPersistenceException", "{", "storage", ".", "storeTrigger", "(", "newTrigger", ",", "replaceExisting", ",", "jedis", ")", ";", "return", "null", ";", "}", "}", ",", "\"Could not store trigger.\"", ")", ";", "}" ]
Store the given <code>{@link org.quartz.Trigger}</code>. @param newTrigger The <code>Trigger</code> to be stored. @param replaceExisting If <code>true</code>, any <code>Trigger</code> existing in the <code>JobStore</code> with the same name & group should be over-written. @throws org.quartz.ObjectAlreadyExistsException if a <code>Trigger</code> with the same name/group already exists, and replaceExisting is set to false. @see #pauseTriggers(org.quartz.impl.matchers.GroupMatcher)
[ "Store", "the", "given", "<code", ">", "{", "@link", "org", ".", "quartz", ".", "Trigger", "}", "<", "/", "code", ">", "." ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java#L393-L402
joniles/mpxj
src/main/java/net/sf/mpxj/planner/PlannerReader.java
PlannerReader.setWorkingDay
private void setWorkingDay(ProjectCalendar mpxjCalendar, Day mpxjDay, String plannerDay) { """ Set the working/non-working status of a weekday. @param mpxjCalendar MPXJ calendar @param mpxjDay day of the week @param plannerDay planner day type """ DayType dayType = DayType.DEFAULT; if (plannerDay != null) { switch (getInt(plannerDay)) { case 0: { dayType = DayType.WORKING; break; } case 1: { dayType = DayType.NON_WORKING; break; } } } mpxjCalendar.setWorkingDay(mpxjDay, dayType); }
java
private void setWorkingDay(ProjectCalendar mpxjCalendar, Day mpxjDay, String plannerDay) { DayType dayType = DayType.DEFAULT; if (plannerDay != null) { switch (getInt(plannerDay)) { case 0: { dayType = DayType.WORKING; break; } case 1: { dayType = DayType.NON_WORKING; break; } } } mpxjCalendar.setWorkingDay(mpxjDay, dayType); }
[ "private", "void", "setWorkingDay", "(", "ProjectCalendar", "mpxjCalendar", ",", "Day", "mpxjDay", ",", "String", "plannerDay", ")", "{", "DayType", "dayType", "=", "DayType", ".", "DEFAULT", ";", "if", "(", "plannerDay", "!=", "null", ")", "{", "switch", "(", "getInt", "(", "plannerDay", ")", ")", "{", "case", "0", ":", "{", "dayType", "=", "DayType", ".", "WORKING", ";", "break", ";", "}", "case", "1", ":", "{", "dayType", "=", "DayType", ".", "NON_WORKING", ";", "break", ";", "}", "}", "}", "mpxjCalendar", ".", "setWorkingDay", "(", "mpxjDay", ",", "dayType", ")", ";", "}" ]
Set the working/non-working status of a weekday. @param mpxjCalendar MPXJ calendar @param mpxjDay day of the week @param plannerDay planner day type
[ "Set", "the", "working", "/", "non", "-", "working", "status", "of", "a", "weekday", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/planner/PlannerReader.java#L284-L307
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java
PhotosApi.setMeta
public Response setMeta(String photoId, String title, String description) throws JinxException { """ Set the meta information for a photo. <br> This method requires authentication with 'write' permission. @param photoId Required. The id of the photo to set metadata for. @param title Required. Title for the photo. @param description Required. Description for the photo. @return response object with the result of the requested operation. @throws JinxException if required parameters are null or empty, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.setMeta.html">flickr.photos.setMeta</a> """ JinxUtils.validateParams(photoId, title, description); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.setMeta"); params.put("photo_id", photoId); params.put("title", title); params.put("description", description); return jinx.flickrPost(params, Response.class); }
java
public Response setMeta(String photoId, String title, String description) throws JinxException { JinxUtils.validateParams(photoId, title, description); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.setMeta"); params.put("photo_id", photoId); params.put("title", title); params.put("description", description); return jinx.flickrPost(params, Response.class); }
[ "public", "Response", "setMeta", "(", "String", "photoId", ",", "String", "title", ",", "String", "description", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "photoId", ",", "title", ",", "description", ")", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap", "<>", "(", ")", ";", "params", ".", "put", "(", "\"method\"", ",", "\"flickr.photos.setMeta\"", ")", ";", "params", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "params", ".", "put", "(", "\"title\"", ",", "title", ")", ";", "params", ".", "put", "(", "\"description\"", ",", "description", ")", ";", "return", "jinx", ".", "flickrPost", "(", "params", ",", "Response", ".", "class", ")", ";", "}" ]
Set the meta information for a photo. <br> This method requires authentication with 'write' permission. @param photoId Required. The id of the photo to set metadata for. @param title Required. Title for the photo. @param description Required. Description for the photo. @return response object with the result of the requested operation. @throws JinxException if required parameters are null or empty, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.setMeta.html">flickr.photos.setMeta</a>
[ "Set", "the", "meta", "information", "for", "a", "photo", ".", "<br", ">", "This", "method", "requires", "authentication", "with", "write", "permission", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java#L948-L956
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java
CpeMemoryIndex.parseQuery
public synchronized Query parseQuery(String searchString) throws ParseException, IndexException { """ Parses the given string into a Lucene Query. @param searchString the search text @return the Query object @throws ParseException thrown if the search text cannot be parsed @throws IndexException thrown if there is an error resetting the analyzers """ if (searchString == null || searchString.trim().isEmpty()) { throw new ParseException("Query is null or empty"); } LOGGER.debug(searchString); final Query query = queryParser.parse(searchString); try { resetAnalyzers(); } catch (IOException ex) { throw new IndexException("Unable to reset the analyzer after parsing", ex); } return query; }
java
public synchronized Query parseQuery(String searchString) throws ParseException, IndexException { if (searchString == null || searchString.trim().isEmpty()) { throw new ParseException("Query is null or empty"); } LOGGER.debug(searchString); final Query query = queryParser.parse(searchString); try { resetAnalyzers(); } catch (IOException ex) { throw new IndexException("Unable to reset the analyzer after parsing", ex); } return query; }
[ "public", "synchronized", "Query", "parseQuery", "(", "String", "searchString", ")", "throws", "ParseException", ",", "IndexException", "{", "if", "(", "searchString", "==", "null", "||", "searchString", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "ParseException", "(", "\"Query is null or empty\"", ")", ";", "}", "LOGGER", ".", "debug", "(", "searchString", ")", ";", "final", "Query", "query", "=", "queryParser", ".", "parse", "(", "searchString", ")", ";", "try", "{", "resetAnalyzers", "(", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "IndexException", "(", "\"Unable to reset the analyzer after parsing\"", ",", "ex", ")", ";", "}", "return", "query", ";", "}" ]
Parses the given string into a Lucene Query. @param searchString the search text @return the Query object @throws ParseException thrown if the search text cannot be parsed @throws IndexException thrown if there is an error resetting the analyzers
[ "Parses", "the", "given", "string", "into", "a", "Lucene", "Query", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/data/cpe/CpeMemoryIndex.java#L280-L293
basho/riak-java-client
src/main/java/com/basho/riak/client/api/convert/Converter.java
Converter.toDomain
public T toDomain(RiakObject obj, Location location) { """ Converts from a RiakObject to a domain object. @param obj the RiakObject to be converted @param location The location of this RiakObject in Riak @return an instance of the domain type T """ T domainObject; if (obj.isDeleted()) { domainObject = newDomainInstance(); } else { domainObject = toDomain(obj.getValue(), obj.getContentType()); AnnotationUtil.populateIndexes(obj.getIndexes(), domainObject); AnnotationUtil.populateLinks(obj.getLinks(), domainObject); AnnotationUtil.populateUsermeta(obj.getUserMeta(), domainObject); AnnotationUtil.setContentType(domainObject, obj.getContentType()); AnnotationUtil.setVTag(domainObject, obj.getVTag()); } AnnotationUtil.setKey(domainObject, location.getKey()); AnnotationUtil.setBucketName(domainObject, location.getNamespace().getBucketName()); AnnotationUtil.setBucketType(domainObject, location.getNamespace().getBucketType()); AnnotationUtil.setVClock(domainObject, obj.getVClock()); AnnotationUtil.setTombstone(domainObject, obj.isDeleted()); AnnotationUtil.setLastModified(domainObject, obj.getLastModified()); return domainObject; }
java
public T toDomain(RiakObject obj, Location location) { T domainObject; if (obj.isDeleted()) { domainObject = newDomainInstance(); } else { domainObject = toDomain(obj.getValue(), obj.getContentType()); AnnotationUtil.populateIndexes(obj.getIndexes(), domainObject); AnnotationUtil.populateLinks(obj.getLinks(), domainObject); AnnotationUtil.populateUsermeta(obj.getUserMeta(), domainObject); AnnotationUtil.setContentType(domainObject, obj.getContentType()); AnnotationUtil.setVTag(domainObject, obj.getVTag()); } AnnotationUtil.setKey(domainObject, location.getKey()); AnnotationUtil.setBucketName(domainObject, location.getNamespace().getBucketName()); AnnotationUtil.setBucketType(domainObject, location.getNamespace().getBucketType()); AnnotationUtil.setVClock(domainObject, obj.getVClock()); AnnotationUtil.setTombstone(domainObject, obj.isDeleted()); AnnotationUtil.setLastModified(domainObject, obj.getLastModified()); return domainObject; }
[ "public", "T", "toDomain", "(", "RiakObject", "obj", ",", "Location", "location", ")", "{", "T", "domainObject", ";", "if", "(", "obj", ".", "isDeleted", "(", ")", ")", "{", "domainObject", "=", "newDomainInstance", "(", ")", ";", "}", "else", "{", "domainObject", "=", "toDomain", "(", "obj", ".", "getValue", "(", ")", ",", "obj", ".", "getContentType", "(", ")", ")", ";", "AnnotationUtil", ".", "populateIndexes", "(", "obj", ".", "getIndexes", "(", ")", ",", "domainObject", ")", ";", "AnnotationUtil", ".", "populateLinks", "(", "obj", ".", "getLinks", "(", ")", ",", "domainObject", ")", ";", "AnnotationUtil", ".", "populateUsermeta", "(", "obj", ".", "getUserMeta", "(", ")", ",", "domainObject", ")", ";", "AnnotationUtil", ".", "setContentType", "(", "domainObject", ",", "obj", ".", "getContentType", "(", ")", ")", ";", "AnnotationUtil", ".", "setVTag", "(", "domainObject", ",", "obj", ".", "getVTag", "(", ")", ")", ";", "}", "AnnotationUtil", ".", "setKey", "(", "domainObject", ",", "location", ".", "getKey", "(", ")", ")", ";", "AnnotationUtil", ".", "setBucketName", "(", "domainObject", ",", "location", ".", "getNamespace", "(", ")", ".", "getBucketName", "(", ")", ")", ";", "AnnotationUtil", ".", "setBucketType", "(", "domainObject", ",", "location", ".", "getNamespace", "(", ")", ".", "getBucketType", "(", ")", ")", ";", "AnnotationUtil", ".", "setVClock", "(", "domainObject", ",", "obj", ".", "getVClock", "(", ")", ")", ";", "AnnotationUtil", ".", "setTombstone", "(", "domainObject", ",", "obj", ".", "isDeleted", "(", ")", ")", ";", "AnnotationUtil", ".", "setLastModified", "(", "domainObject", ",", "obj", ".", "getLastModified", "(", ")", ")", ";", "return", "domainObject", ";", "}" ]
Converts from a RiakObject to a domain object. @param obj the RiakObject to be converted @param location The location of this RiakObject in Riak @return an instance of the domain type T
[ "Converts", "from", "a", "RiakObject", "to", "a", "domain", "object", "." ]
train
https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/api/convert/Converter.java#L74-L101
wildfly/wildfly-core
server/src/main/java/org/jboss/as/server/parsing/CommonXml.java
CommonXml.writeInterfaces
protected void writeInterfaces(final XMLExtendedStreamWriter writer, final ModelNode modelNode) throws XMLStreamException { """ Write the interfaces including the criteria elements. @param writer the xml stream writer @param modelNode the model @throws XMLStreamException """ interfacesXml.writeInterfaces(writer, modelNode); }
java
protected void writeInterfaces(final XMLExtendedStreamWriter writer, final ModelNode modelNode) throws XMLStreamException { interfacesXml.writeInterfaces(writer, modelNode); }
[ "protected", "void", "writeInterfaces", "(", "final", "XMLExtendedStreamWriter", "writer", ",", "final", "ModelNode", "modelNode", ")", "throws", "XMLStreamException", "{", "interfacesXml", ".", "writeInterfaces", "(", "writer", ",", "modelNode", ")", ";", "}" ]
Write the interfaces including the criteria elements. @param writer the xml stream writer @param modelNode the model @throws XMLStreamException
[ "Write", "the", "interfaces", "including", "the", "criteria", "elements", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/server/src/main/java/org/jboss/as/server/parsing/CommonXml.java#L245-L247
liferay/com-liferay-commerce
commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java
CommerceNotificationTemplatePersistenceImpl.findByUUID_G
@Override public CommerceNotificationTemplate findByUUID_G(String uuid, long groupId) throws NoSuchNotificationTemplateException { """ Returns the commerce notification template where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchNotificationTemplateException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce notification template @throws NoSuchNotificationTemplateException if a matching commerce notification template could not be found """ CommerceNotificationTemplate commerceNotificationTemplate = fetchByUUID_G(uuid, groupId); if (commerceNotificationTemplate == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchNotificationTemplateException(msg.toString()); } return commerceNotificationTemplate; }
java
@Override public CommerceNotificationTemplate findByUUID_G(String uuid, long groupId) throws NoSuchNotificationTemplateException { CommerceNotificationTemplate commerceNotificationTemplate = fetchByUUID_G(uuid, groupId); if (commerceNotificationTemplate == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchNotificationTemplateException(msg.toString()); } return commerceNotificationTemplate; }
[ "@", "Override", "public", "CommerceNotificationTemplate", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchNotificationTemplateException", "{", "CommerceNotificationTemplate", "commerceNotificationTemplate", "=", "fetchByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "if", "(", "commerceNotificationTemplate", "==", "null", ")", "{", "StringBundler", "msg", "=", "new", "StringBundler", "(", "6", ")", ";", "msg", ".", "append", "(", "_NO_SUCH_ENTITY_WITH_KEY", ")", ";", "msg", ".", "append", "(", "\"uuid=\"", ")", ";", "msg", ".", "append", "(", "uuid", ")", ";", "msg", ".", "append", "(", "\", groupId=\"", ")", ";", "msg", ".", "append", "(", "groupId", ")", ";", "msg", ".", "append", "(", "\"}\"", ")", ";", "if", "(", "_log", ".", "isDebugEnabled", "(", ")", ")", "{", "_log", ".", "debug", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "throw", "new", "NoSuchNotificationTemplateException", "(", "msg", ".", "toString", "(", ")", ")", ";", "}", "return", "commerceNotificationTemplate", ";", "}" ]
Returns the commerce notification template where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchNotificationTemplateException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce notification template @throws NoSuchNotificationTemplateException if a matching commerce notification template could not be found
[ "Returns", "the", "commerce", "notification", "template", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchNotificationTemplateException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-notification-service/src/main/java/com/liferay/commerce/notification/service/persistence/impl/CommerceNotificationTemplatePersistenceImpl.java#L680-L707
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java
CachedRemoteTable.remove
public void remove(Object data, int iOpenMode) throws DBException, RemoteException { """ Delete the current record. @param - This is a dummy param, because this call conflicts with a call in EJBHome. @exception Exception File exception. """ this.checkCurrentCacheIsPhysical(null); m_tableRemote.remove(data, iOpenMode); if (m_objCurrentCacheRecord != null) { if (m_mapCache != null) m_mapCache.set(((Integer)m_objCurrentCacheRecord).intValue(), NONE); else if (m_htCache != null) m_htCache.remove(m_objCurrentCacheRecord); } m_objCurrentPhysicalRecord = NONE; m_objCurrentLockedRecord = NONE; m_objCurrentCacheRecord = NONE; }
java
public void remove(Object data, int iOpenMode) throws DBException, RemoteException { this.checkCurrentCacheIsPhysical(null); m_tableRemote.remove(data, iOpenMode); if (m_objCurrentCacheRecord != null) { if (m_mapCache != null) m_mapCache.set(((Integer)m_objCurrentCacheRecord).intValue(), NONE); else if (m_htCache != null) m_htCache.remove(m_objCurrentCacheRecord); } m_objCurrentPhysicalRecord = NONE; m_objCurrentLockedRecord = NONE; m_objCurrentCacheRecord = NONE; }
[ "public", "void", "remove", "(", "Object", "data", ",", "int", "iOpenMode", ")", "throws", "DBException", ",", "RemoteException", "{", "this", ".", "checkCurrentCacheIsPhysical", "(", "null", ")", ";", "m_tableRemote", ".", "remove", "(", "data", ",", "iOpenMode", ")", ";", "if", "(", "m_objCurrentCacheRecord", "!=", "null", ")", "{", "if", "(", "m_mapCache", "!=", "null", ")", "m_mapCache", ".", "set", "(", "(", "(", "Integer", ")", "m_objCurrentCacheRecord", ")", ".", "intValue", "(", ")", ",", "NONE", ")", ";", "else", "if", "(", "m_htCache", "!=", "null", ")", "m_htCache", ".", "remove", "(", "m_objCurrentCacheRecord", ")", ";", "}", "m_objCurrentPhysicalRecord", "=", "NONE", ";", "m_objCurrentLockedRecord", "=", "NONE", ";", "m_objCurrentCacheRecord", "=", "NONE", ";", "}" ]
Delete the current record. @param - This is a dummy param, because this call conflicts with a call in EJBHome. @exception Exception File exception.
[ "Delete", "the", "current", "record", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/CachedRemoteTable.java#L265-L279
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/model/beans/Application.java
Application.bindWithApplication
public void bindWithApplication( String externalExportPrefix, String applicationName ) { """ Binds an external export prefix with an application name. <p> No error is thrown if the bound already existed. </p> @param externalExportPrefix an external export prefix (not null) @param applicationName an application name (not null) """ Set<String> bounds = this.applicationBindings.get( externalExportPrefix ); if( bounds == null ) { bounds = new LinkedHashSet<> (); this.applicationBindings.put( externalExportPrefix, bounds ); } bounds.add( applicationName ); }
java
public void bindWithApplication( String externalExportPrefix, String applicationName ) { Set<String> bounds = this.applicationBindings.get( externalExportPrefix ); if( bounds == null ) { bounds = new LinkedHashSet<> (); this.applicationBindings.put( externalExportPrefix, bounds ); } bounds.add( applicationName ); }
[ "public", "void", "bindWithApplication", "(", "String", "externalExportPrefix", ",", "String", "applicationName", ")", "{", "Set", "<", "String", ">", "bounds", "=", "this", ".", "applicationBindings", ".", "get", "(", "externalExportPrefix", ")", ";", "if", "(", "bounds", "==", "null", ")", "{", "bounds", "=", "new", "LinkedHashSet", "<>", "(", ")", ";", "this", ".", "applicationBindings", ".", "put", "(", "externalExportPrefix", ",", "bounds", ")", ";", "}", "bounds", ".", "add", "(", "applicationName", ")", ";", "}" ]
Binds an external export prefix with an application name. <p> No error is thrown if the bound already existed. </p> @param externalExportPrefix an external export prefix (not null) @param applicationName an application name (not null)
[ "Binds", "an", "external", "export", "prefix", "with", "an", "application", "name", ".", "<p", ">", "No", "error", "is", "thrown", "if", "the", "bound", "already", "existed", ".", "<", "/", "p", ">" ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/model/beans/Application.java#L150-L159
OpenLiberty/open-liberty
dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java
HttpChannelConfig.parseRequestSmugglingProtection
private void parseRequestSmugglingProtection(Map<Object, Object> props) { """ Check whether or not the request smuggling protection has been changed. @param props """ // PK53193 - allow this to be disabled Object value = props.get(HttpConfigConstants.PROPNAME_ENABLE_SMUGGLING_PROTECTION); if (null != value) { this.bEnableSmugglingProtection = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Config: request smuggling protection is " + this.bEnableSmugglingProtection); } } }
java
private void parseRequestSmugglingProtection(Map<Object, Object> props) { // PK53193 - allow this to be disabled Object value = props.get(HttpConfigConstants.PROPNAME_ENABLE_SMUGGLING_PROTECTION); if (null != value) { this.bEnableSmugglingProtection = convertBoolean(value); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Config: request smuggling protection is " + this.bEnableSmugglingProtection); } } }
[ "private", "void", "parseRequestSmugglingProtection", "(", "Map", "<", "Object", ",", "Object", ">", "props", ")", "{", "// PK53193 - allow this to be disabled", "Object", "value", "=", "props", ".", "get", "(", "HttpConfigConstants", ".", "PROPNAME_ENABLE_SMUGGLING_PROTECTION", ")", ";", "if", "(", "null", "!=", "value", ")", "{", "this", ".", "bEnableSmugglingProtection", "=", "convertBoolean", "(", "value", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"Config: request smuggling protection is \"", "+", "this", ".", "bEnableSmugglingProtection", ")", ";", "}", "}", "}" ]
Check whether or not the request smuggling protection has been changed. @param props
[ "Check", "whether", "or", "not", "the", "request", "smuggling", "protection", "has", "been", "changed", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.transport.http/src/com/ibm/ws/http/channel/internal/HttpChannelConfig.java#L1169-L1178
twilio/twilio-java
src/main/java/com/twilio/rest/authy/v1/service/entity/FactorReader.java
FactorReader.nextPage
@Override public Page<Factor> nextPage(final Page<Factor> 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.AUTHY.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
java
@Override public Page<Factor> nextPage(final Page<Factor> page, final TwilioRestClient client) { Request request = new Request( HttpMethod.GET, page.getNextPageUrl( Domains.AUTHY.toString(), client.getRegion() ) ); return pageForRequest(client, request); }
[ "@", "Override", "public", "Page", "<", "Factor", ">", "nextPage", "(", "final", "Page", "<", "Factor", ">", "page", ",", "final", "TwilioRestClient", "client", ")", "{", "Request", "request", "=", "new", "Request", "(", "HttpMethod", ".", "GET", ",", "page", ".", "getNextPageUrl", "(", "Domains", ".", "AUTHY", ".", "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/authy/v1/service/entity/FactorReader.java#L99-L110
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java
SpecializedOps_DDRM.createReflector
public static DMatrixRMaj createReflector(DMatrixRMaj u , double gamma) { """ <p> Creates a reflector from the provided vector and gamma.<br> <br> Q = I - &gamma; u u<sup>T</sup><br> </p> <p> In practice {@link VectorVectorMult_DDRM#householder(double, DMatrixD1, DMatrixD1, DMatrixD1)} multHouseholder} should be used for performance reasons since there is no need to calculate Q explicitly. </p> @param u A vector. Not modified. @param gamma To produce a reflector gamma needs to be equal to 2/||u||. @return An orthogonal reflector. """ if( !MatrixFeatures_DDRM.isVector(u)) throw new IllegalArgumentException("u must be a vector"); DMatrixRMaj Q = CommonOps_DDRM.identity(u.getNumElements()); CommonOps_DDRM.multAddTransB(-gamma,u,u,Q); return Q; }
java
public static DMatrixRMaj createReflector(DMatrixRMaj u , double gamma) { if( !MatrixFeatures_DDRM.isVector(u)) throw new IllegalArgumentException("u must be a vector"); DMatrixRMaj Q = CommonOps_DDRM.identity(u.getNumElements()); CommonOps_DDRM.multAddTransB(-gamma,u,u,Q); return Q; }
[ "public", "static", "DMatrixRMaj", "createReflector", "(", "DMatrixRMaj", "u", ",", "double", "gamma", ")", "{", "if", "(", "!", "MatrixFeatures_DDRM", ".", "isVector", "(", "u", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"u must be a vector\"", ")", ";", "DMatrixRMaj", "Q", "=", "CommonOps_DDRM", ".", "identity", "(", "u", ".", "getNumElements", "(", ")", ")", ";", "CommonOps_DDRM", ".", "multAddTransB", "(", "-", "gamma", ",", "u", ",", "u", ",", "Q", ")", ";", "return", "Q", ";", "}" ]
<p> Creates a reflector from the provided vector and gamma.<br> <br> Q = I - &gamma; u u<sup>T</sup><br> </p> <p> In practice {@link VectorVectorMult_DDRM#householder(double, DMatrixD1, DMatrixD1, DMatrixD1)} multHouseholder} should be used for performance reasons since there is no need to calculate Q explicitly. </p> @param u A vector. Not modified. @param gamma To produce a reflector gamma needs to be equal to 2/||u||. @return An orthogonal reflector.
[ "<p", ">", "Creates", "a", "reflector", "from", "the", "provided", "vector", "and", "gamma", ".", "<br", ">", "<br", ">", "Q", "=", "I", "-", "&gamma", ";", "u", "u<sup", ">", "T<", "/", "sup", ">", "<br", ">", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/SpecializedOps_DDRM.java#L80-L88
jclawson/hazeltask
hazeltask-core/src/main/java/com/hazeltask/executor/HazelcastExecutorTopologyService.java
HazelcastExecutorTopologyService.addPendingTask
public boolean addPendingTask(HazeltaskTask<GROUP> task, boolean replaceIfExists) { """ Add to the write ahead log (hazelcast IMap) that tracks all the outstanding tasks """ if(!replaceIfExists) return pendingTask.putIfAbsent(task.getId(), task) == null; pendingTask.put(task.getId(), task); return true; }
java
public boolean addPendingTask(HazeltaskTask<GROUP> task, boolean replaceIfExists) { if(!replaceIfExists) return pendingTask.putIfAbsent(task.getId(), task) == null; pendingTask.put(task.getId(), task); return true; }
[ "public", "boolean", "addPendingTask", "(", "HazeltaskTask", "<", "GROUP", ">", "task", ",", "boolean", "replaceIfExists", ")", "{", "if", "(", "!", "replaceIfExists", ")", "return", "pendingTask", ".", "putIfAbsent", "(", "task", ".", "getId", "(", ")", ",", "task", ")", "==", "null", ";", "pendingTask", ".", "put", "(", "task", ".", "getId", "(", ")", ",", "task", ")", ";", "return", "true", ";", "}" ]
Add to the write ahead log (hazelcast IMap) that tracks all the outstanding tasks
[ "Add", "to", "the", "write", "ahead", "log", "(", "hazelcast", "IMap", ")", "that", "tracks", "all", "the", "outstanding", "tasks" ]
train
https://github.com/jclawson/hazeltask/blob/801162bc54c5f1d5744a28a2844b24289d9495d7/hazeltask-core/src/main/java/com/hazeltask/executor/HazelcastExecutorTopologyService.java#L140-L146
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/referral/AnimatedDialog.java
AnimatedDialog.slideOpen
private void slideOpen() { """ </p> Opens the dialog with a translation animation to the content view </p> """ TranslateAnimation slideUp = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0f); slideUp.setDuration(500); slideUp.setInterpolator(new AccelerateInterpolator()); ((ViewGroup) getWindow().getDecorView()).getChildAt(0).startAnimation(slideUp); super.show(); }
java
private void slideOpen() { TranslateAnimation slideUp = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 0f); slideUp.setDuration(500); slideUp.setInterpolator(new AccelerateInterpolator()); ((ViewGroup) getWindow().getDecorView()).getChildAt(0).startAnimation(slideUp); super.show(); }
[ "private", "void", "slideOpen", "(", ")", "{", "TranslateAnimation", "slideUp", "=", "new", "TranslateAnimation", "(", "Animation", ".", "RELATIVE_TO_SELF", ",", "0", ",", "Animation", ".", "RELATIVE_TO_SELF", ",", "0", ",", "Animation", ".", "RELATIVE_TO_SELF", ",", "1.0f", ",", "Animation", ".", "RELATIVE_TO_SELF", ",", "0f", ")", ";", "slideUp", ".", "setDuration", "(", "500", ")", ";", "slideUp", ".", "setInterpolator", "(", "new", "AccelerateInterpolator", "(", ")", ")", ";", "(", "(", "ViewGroup", ")", "getWindow", "(", ")", ".", "getDecorView", "(", ")", ")", ".", "getChildAt", "(", "0", ")", ".", "startAnimation", "(", "slideUp", ")", ";", "super", ".", "show", "(", ")", ";", "}" ]
</p> Opens the dialog with a translation animation to the content view </p>
[ "<", "/", "p", ">", "Opens", "the", "dialog", "with", "a", "translation", "animation", "to", "the", "content", "view", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/referral/AnimatedDialog.java#L111-L117
aspectran/aspectran
core/src/main/java/com/aspectran/core/context/rule/IncludeActionRule.java
IncludeActionRule.newInstance
public static IncludeActionRule newInstance(String id, String transletName, String method, Boolean hidden) throws IllegalRuleException { """ Returns a new instance of IncludeActionRule. @param id the action id @param transletName the translet name @param method the request method type @param hidden whether to hide result of the action @return the include action rule @throws IllegalRuleException if an illegal rule is found """ if (transletName == null) { throw new IllegalRuleException("The 'include' element requires a 'translet' attribute"); } MethodType methodType = MethodType.resolve(method); if (method != null && methodType == null) { throw new IllegalRuleException("No request method type for '" + method + "'"); } IncludeActionRule includeActionRule = new IncludeActionRule(); includeActionRule.setActionId(id); includeActionRule.setTransletName(transletName); includeActionRule.setMethodType(methodType); includeActionRule.setHidden(hidden); return includeActionRule; }
java
public static IncludeActionRule newInstance(String id, String transletName, String method, Boolean hidden) throws IllegalRuleException { if (transletName == null) { throw new IllegalRuleException("The 'include' element requires a 'translet' attribute"); } MethodType methodType = MethodType.resolve(method); if (method != null && methodType == null) { throw new IllegalRuleException("No request method type for '" + method + "'"); } IncludeActionRule includeActionRule = new IncludeActionRule(); includeActionRule.setActionId(id); includeActionRule.setTransletName(transletName); includeActionRule.setMethodType(methodType); includeActionRule.setHidden(hidden); return includeActionRule; }
[ "public", "static", "IncludeActionRule", "newInstance", "(", "String", "id", ",", "String", "transletName", ",", "String", "method", ",", "Boolean", "hidden", ")", "throws", "IllegalRuleException", "{", "if", "(", "transletName", "==", "null", ")", "{", "throw", "new", "IllegalRuleException", "(", "\"The 'include' element requires a 'translet' attribute\"", ")", ";", "}", "MethodType", "methodType", "=", "MethodType", ".", "resolve", "(", "method", ")", ";", "if", "(", "method", "!=", "null", "&&", "methodType", "==", "null", ")", "{", "throw", "new", "IllegalRuleException", "(", "\"No request method type for '\"", "+", "method", "+", "\"'\"", ")", ";", "}", "IncludeActionRule", "includeActionRule", "=", "new", "IncludeActionRule", "(", ")", ";", "includeActionRule", ".", "setActionId", "(", "id", ")", ";", "includeActionRule", ".", "setTransletName", "(", "transletName", ")", ";", "includeActionRule", ".", "setMethodType", "(", "methodType", ")", ";", "includeActionRule", ".", "setHidden", "(", "hidden", ")", ";", "return", "includeActionRule", ";", "}" ]
Returns a new instance of IncludeActionRule. @param id the action id @param transletName the translet name @param method the request method type @param hidden whether to hide result of the action @return the include action rule @throws IllegalRuleException if an illegal rule is found
[ "Returns", "a", "new", "instance", "of", "IncludeActionRule", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/context/rule/IncludeActionRule.java#L223-L240
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/SecurityPINsInner.java
SecurityPINsInner.getAsync
public Observable<TokenInformationInner> getAsync(String vaultName, String resourceGroupName) { """ Get the security PIN. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TokenInformationInner object """ return getWithServiceResponseAsync(vaultName, resourceGroupName).map(new Func1<ServiceResponse<TokenInformationInner>, TokenInformationInner>() { @Override public TokenInformationInner call(ServiceResponse<TokenInformationInner> response) { return response.body(); } }); }
java
public Observable<TokenInformationInner> getAsync(String vaultName, String resourceGroupName) { return getWithServiceResponseAsync(vaultName, resourceGroupName).map(new Func1<ServiceResponse<TokenInformationInner>, TokenInformationInner>() { @Override public TokenInformationInner call(ServiceResponse<TokenInformationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TokenInformationInner", ">", "getAsync", "(", "String", "vaultName", ",", "String", "resourceGroupName", ")", "{", "return", "getWithServiceResponseAsync", "(", "vaultName", ",", "resourceGroupName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "TokenInformationInner", ">", ",", "TokenInformationInner", ">", "(", ")", "{", "@", "Override", "public", "TokenInformationInner", "call", "(", "ServiceResponse", "<", "TokenInformationInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get the security PIN. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TokenInformationInner object
[ "Get", "the", "security", "PIN", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/SecurityPINsInner.java#L95-L102
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetInfo.java
DatasetInfo.newBuilder
public static Builder newBuilder(String projectId, String datasetId) { """ Returns a builder for the DatasetInfo object given it's user-defined project and dataset ids. """ return newBuilder(DatasetId.of(projectId, datasetId)); }
java
public static Builder newBuilder(String projectId, String datasetId) { return newBuilder(DatasetId.of(projectId, datasetId)); }
[ "public", "static", "Builder", "newBuilder", "(", "String", "projectId", ",", "String", "datasetId", ")", "{", "return", "newBuilder", "(", "DatasetId", ".", "of", "(", "projectId", ",", "datasetId", ")", ")", ";", "}" ]
Returns a builder for the DatasetInfo object given it's user-defined project and dataset ids.
[ "Returns", "a", "builder", "for", "the", "DatasetInfo", "object", "given", "it", "s", "user", "-", "defined", "project", "and", "dataset", "ids", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/DatasetInfo.java#L502-L504
aol/cyclops
cyclops/src/main/java/cyclops/control/Future.java
Future.fold
public <R> R fold(Function<? super T,? extends R> success, Function<? super Throwable,? extends R> failure) { """ Blocking analogue to visitAsync. Visit the state of this Future, block until ready. <pre> {@code Future.ofResult(10) .visit(i->i*2, e->-1); 20 Future.<Integer>ofError(new RuntimeException()) .visit(i->i*2, e->-1) [-1] } </pre> @param success Function to execute if the previous stage completes successfully @param failure Function to execute if this Future fails @return Result of the executed Function """ try { return success.apply(future.join()); }catch(Throwable t){ return failure.apply(t); } }
java
public <R> R fold(Function<? super T,? extends R> success, Function<? super Throwable,? extends R> failure){ try { return success.apply(future.join()); }catch(Throwable t){ return failure.apply(t); } }
[ "public", "<", "R", ">", "R", "fold", "(", "Function", "<", "?", "super", "T", ",", "?", "extends", "R", ">", "success", ",", "Function", "<", "?", "super", "Throwable", ",", "?", "extends", "R", ">", "failure", ")", "{", "try", "{", "return", "success", ".", "apply", "(", "future", ".", "join", "(", ")", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "return", "failure", ".", "apply", "(", "t", ")", ";", "}", "}" ]
Blocking analogue to visitAsync. Visit the state of this Future, block until ready. <pre> {@code Future.ofResult(10) .visit(i->i*2, e->-1); 20 Future.<Integer>ofError(new RuntimeException()) .visit(i->i*2, e->-1) [-1] } </pre> @param success Function to execute if the previous stage completes successfully @param failure Function to execute if this Future fails @return Result of the executed Function
[ "Blocking", "analogue", "to", "visitAsync", ".", "Visit", "the", "state", "of", "this", "Future", "block", "until", "ready", "." ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/control/Future.java#L788-L795
grpc/grpc-java
api/src/main/java/io/grpc/ConnectivityStateInfo.java
ConnectivityStateInfo.forNonError
public static ConnectivityStateInfo forNonError(ConnectivityState state) { """ Returns an instance for a state that is not {@code TRANSIENT_FAILURE}. @throws IllegalArgumentException if {@code state} is {@code TRANSIENT_FAILURE}. """ Preconditions.checkArgument( state != TRANSIENT_FAILURE, "state is TRANSIENT_ERROR. Use forError() instead"); return new ConnectivityStateInfo(state, Status.OK); }
java
public static ConnectivityStateInfo forNonError(ConnectivityState state) { Preconditions.checkArgument( state != TRANSIENT_FAILURE, "state is TRANSIENT_ERROR. Use forError() instead"); return new ConnectivityStateInfo(state, Status.OK); }
[ "public", "static", "ConnectivityStateInfo", "forNonError", "(", "ConnectivityState", "state", ")", "{", "Preconditions", ".", "checkArgument", "(", "state", "!=", "TRANSIENT_FAILURE", ",", "\"state is TRANSIENT_ERROR. Use forError() instead\"", ")", ";", "return", "new", "ConnectivityStateInfo", "(", "state", ",", "Status", ".", "OK", ")", ";", "}" ]
Returns an instance for a state that is not {@code TRANSIENT_FAILURE}. @throws IllegalArgumentException if {@code state} is {@code TRANSIENT_FAILURE}.
[ "Returns", "an", "instance", "for", "a", "state", "that", "is", "not", "{", "@code", "TRANSIENT_FAILURE", "}", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/api/src/main/java/io/grpc/ConnectivityStateInfo.java#L39-L44
apache/incubator-gobblin
gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/context/filter/ContextFilterFactory.java
ContextFilterFactory.setContextFilterClass
public static Config setContextFilterClass(Config config, Class<? extends ContextFilter> klazz) { """ Modify the configuration to set the {@link ContextFilter} class. @param config Input {@link Config}. @param klazz Class of desired {@link ContextFilter}. @return Modified {@link Config}. """ return config.withValue(CONTEXT_FILTER_CLASS, ConfigValueFactory.fromAnyRef(klazz.getCanonicalName())); }
java
public static Config setContextFilterClass(Config config, Class<? extends ContextFilter> klazz) { return config.withValue(CONTEXT_FILTER_CLASS, ConfigValueFactory.fromAnyRef(klazz.getCanonicalName())); }
[ "public", "static", "Config", "setContextFilterClass", "(", "Config", "config", ",", "Class", "<", "?", "extends", "ContextFilter", ">", "klazz", ")", "{", "return", "config", ".", "withValue", "(", "CONTEXT_FILTER_CLASS", ",", "ConfigValueFactory", ".", "fromAnyRef", "(", "klazz", ".", "getCanonicalName", "(", ")", ")", ")", ";", "}" ]
Modify the configuration to set the {@link ContextFilter} class. @param config Input {@link Config}. @param klazz Class of desired {@link ContextFilter}. @return Modified {@link Config}.
[ "Modify", "the", "configuration", "to", "set", "the", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-metrics-libs/gobblin-metrics-base/src/main/java/org/apache/gobblin/metrics/context/filter/ContextFilterFactory.java#L42-L44
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java
DirectoryServiceClient.createUser
public void createUser(User user, String password) { """ Create a User. @param user the User. @param password the user password. """ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.CreateUser); byte[] secret = null; if(password != null && ! password.isEmpty()){ secret = ObfuscatUtil.base64Encode(password.getBytes()); } CreateUserProtocol p = new CreateUserProtocol(user, secret); connection.submitRequest(header, p, null); }
java
public void createUser(User user, String password){ ProtocolHeader header = new ProtocolHeader(); header.setType(ProtocolType.CreateUser); byte[] secret = null; if(password != null && ! password.isEmpty()){ secret = ObfuscatUtil.base64Encode(password.getBytes()); } CreateUserProtocol p = new CreateUserProtocol(user, secret); connection.submitRequest(header, p, null); }
[ "public", "void", "createUser", "(", "User", "user", ",", "String", "password", ")", "{", "ProtocolHeader", "header", "=", "new", "ProtocolHeader", "(", ")", ";", "header", ".", "setType", "(", "ProtocolType", ".", "CreateUser", ")", ";", "byte", "[", "]", "secret", "=", "null", ";", "if", "(", "password", "!=", "null", "&&", "!", "password", ".", "isEmpty", "(", ")", ")", "{", "secret", "=", "ObfuscatUtil", ".", "base64Encode", "(", "password", ".", "getBytes", "(", ")", ")", ";", "}", "CreateUserProtocol", "p", "=", "new", "CreateUserProtocol", "(", "user", ",", "secret", ")", ";", "connection", ".", "submitRequest", "(", "header", ",", "p", ",", "null", ")", ";", "}" ]
Create a User. @param user the User. @param password the user password.
[ "Create", "a", "User", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L212-L222
classgraph/classgraph
src/main/java/io/github/classgraph/ResourceList.java
ResourceList.forEachInputStream
public void forEachInputStream(final InputStreamConsumer inputStreamConsumer, final boolean ignoreIOExceptions) { """ Fetch an {@link InputStream} for each {@link Resource} in this {@link ResourceList}, pass the {@link InputStream} to the given {@link InputStreamConsumer}, then close the {@link InputStream} after the {@link InputStreamConsumer} returns, by calling {@link Resource#close()}. @param inputStreamConsumer The {@link InputStreamConsumer}. @param ignoreIOExceptions if true, any {@link IOException} thrown while trying to load any of the resources will be silently ignored. @throws IllegalArgumentException if ignoreExceptions is false, and an {@link IOException} is thrown while trying to open any of the resources. """ for (final Resource resource : this) { try { inputStreamConsumer.accept(resource, resource.open()); } catch (final IOException e) { if (!ignoreIOExceptions) { throw new IllegalArgumentException("Could not load resource " + resource, e); } } finally { resource.close(); } } }
java
public void forEachInputStream(final InputStreamConsumer inputStreamConsumer, final boolean ignoreIOExceptions) { for (final Resource resource : this) { try { inputStreamConsumer.accept(resource, resource.open()); } catch (final IOException e) { if (!ignoreIOExceptions) { throw new IllegalArgumentException("Could not load resource " + resource, e); } } finally { resource.close(); } } }
[ "public", "void", "forEachInputStream", "(", "final", "InputStreamConsumer", "inputStreamConsumer", ",", "final", "boolean", "ignoreIOExceptions", ")", "{", "for", "(", "final", "Resource", "resource", ":", "this", ")", "{", "try", "{", "inputStreamConsumer", ".", "accept", "(", "resource", ",", "resource", ".", "open", "(", ")", ")", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "if", "(", "!", "ignoreIOExceptions", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Could not load resource \"", "+", "resource", ",", "e", ")", ";", "}", "}", "finally", "{", "resource", ".", "close", "(", ")", ";", "}", "}", "}" ]
Fetch an {@link InputStream} for each {@link Resource} in this {@link ResourceList}, pass the {@link InputStream} to the given {@link InputStreamConsumer}, then close the {@link InputStream} after the {@link InputStreamConsumer} returns, by calling {@link Resource#close()}. @param inputStreamConsumer The {@link InputStreamConsumer}. @param ignoreIOExceptions if true, any {@link IOException} thrown while trying to load any of the resources will be silently ignored. @throws IllegalArgumentException if ignoreExceptions is false, and an {@link IOException} is thrown while trying to open any of the resources.
[ "Fetch", "an", "{", "@link", "InputStream", "}", "for", "each", "{", "@link", "Resource", "}", "in", "this", "{", "@link", "ResourceList", "}", "pass", "the", "{", "@link", "InputStream", "}", "to", "the", "given", "{", "@link", "InputStreamConsumer", "}", "then", "close", "the", "{", "@link", "InputStream", "}", "after", "the", "{", "@link", "InputStreamConsumer", "}", "returns", "by", "calling", "{", "@link", "Resource#close", "()", "}", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/ResourceList.java#L388-L401
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/manager/ChallengeInfo.java
ChallengeInfo.applyParams
public void applyParams(AbstractHBCIJob task, AbstractHBCIJob hktan, HBCITwoStepMechanism hbciTwoStepMechanism) { """ Uebernimmt die Challenge-Parameter in den HKTAN-Geschaeftsvorfall. @param task der Job, zu dem die Challenge-Parameter ermittelt werden sollen. @param hktan der HKTAN-Geschaeftsvorfall, in dem die Parameter gesetzt werden sollen. @param hbciTwoStepMechanism die BPD-Informationen zum TAN-Verfahren. """ String code = task.getHBCICode(); // Code des Geschaeftsvorfalls // Job-Parameter holen Job job = this.getData(code); // Den Geschaeftsvorfall kennen wir nicht. Dann brauchen wir // auch keine Challenge-Parameter setzen if (job == null) { log.info("have no challenge data for " + code + ", will not apply challenge params"); return; } HHDVersion version = HHDVersion.find(hbciTwoStepMechanism); log.debug("using hhd version " + version); // Parameter fuer die passende HHD-Version holen HhdVersion hhd = job.getVersion(version.getChallengeVersion()); // Wir haben keine Parameter fuer diese HHD-Version if (hhd == null) { log.info("have no challenge data for " + code + " in " + version + ", will not apply challenge params"); return; } // Schritt 1: Challenge-Klasse uebernehmen String klass = hhd.getKlass(); log.debug("using challenge klass " + klass); hktan.setParam("challengeklass", klass); // Schritt 2: Challenge-Parameter uebernehmen List<Param> params = hhd.getParams(); for (int i = 0; i < params.size(); ++i) { int num = i + 1; // Die Job-Parameter beginnen bei 1 Param param = params.get(i); // Checken, ob der Parameter angewendet werden soll. if (!param.isComplied(hbciTwoStepMechanism)) { log.debug("skipping challenge parameter " + num + " (" + param.path + "), condition " + param.conditionName + "=" + param.conditionValue + " not complied"); continue; } // Parameter uebernehmen. Aber nur wenn er auch einen Wert hat. // Seit HHD 1.4 duerfen Parameter mittendrin optional sein, sie // werden dann freigelassen String value = param.getValue(task); if (value == null || value.length() == 0) { log.debug("challenge parameter " + num + " (" + param.path + ") is empty"); continue; } log.debug("adding challenge parameter " + num + " " + param.path + "=" + value); hktan.setParam("ChallengeKlassParam" + num, value); } }
java
public void applyParams(AbstractHBCIJob task, AbstractHBCIJob hktan, HBCITwoStepMechanism hbciTwoStepMechanism) { String code = task.getHBCICode(); // Code des Geschaeftsvorfalls // Job-Parameter holen Job job = this.getData(code); // Den Geschaeftsvorfall kennen wir nicht. Dann brauchen wir // auch keine Challenge-Parameter setzen if (job == null) { log.info("have no challenge data for " + code + ", will not apply challenge params"); return; } HHDVersion version = HHDVersion.find(hbciTwoStepMechanism); log.debug("using hhd version " + version); // Parameter fuer die passende HHD-Version holen HhdVersion hhd = job.getVersion(version.getChallengeVersion()); // Wir haben keine Parameter fuer diese HHD-Version if (hhd == null) { log.info("have no challenge data for " + code + " in " + version + ", will not apply challenge params"); return; } // Schritt 1: Challenge-Klasse uebernehmen String klass = hhd.getKlass(); log.debug("using challenge klass " + klass); hktan.setParam("challengeklass", klass); // Schritt 2: Challenge-Parameter uebernehmen List<Param> params = hhd.getParams(); for (int i = 0; i < params.size(); ++i) { int num = i + 1; // Die Job-Parameter beginnen bei 1 Param param = params.get(i); // Checken, ob der Parameter angewendet werden soll. if (!param.isComplied(hbciTwoStepMechanism)) { log.debug("skipping challenge parameter " + num + " (" + param.path + "), condition " + param.conditionName + "=" + param.conditionValue + " not complied"); continue; } // Parameter uebernehmen. Aber nur wenn er auch einen Wert hat. // Seit HHD 1.4 duerfen Parameter mittendrin optional sein, sie // werden dann freigelassen String value = param.getValue(task); if (value == null || value.length() == 0) { log.debug("challenge parameter " + num + " (" + param.path + ") is empty"); continue; } log.debug("adding challenge parameter " + num + " " + param.path + "=" + value); hktan.setParam("ChallengeKlassParam" + num, value); } }
[ "public", "void", "applyParams", "(", "AbstractHBCIJob", "task", ",", "AbstractHBCIJob", "hktan", ",", "HBCITwoStepMechanism", "hbciTwoStepMechanism", ")", "{", "String", "code", "=", "task", ".", "getHBCICode", "(", ")", ";", "// Code des Geschaeftsvorfalls", "// Job-Parameter holen", "Job", "job", "=", "this", ".", "getData", "(", "code", ")", ";", "// Den Geschaeftsvorfall kennen wir nicht. Dann brauchen wir", "// auch keine Challenge-Parameter setzen", "if", "(", "job", "==", "null", ")", "{", "log", ".", "info", "(", "\"have no challenge data for \"", "+", "code", "+", "\", will not apply challenge params\"", ")", ";", "return", ";", "}", "HHDVersion", "version", "=", "HHDVersion", ".", "find", "(", "hbciTwoStepMechanism", ")", ";", "log", ".", "debug", "(", "\"using hhd version \"", "+", "version", ")", ";", "// Parameter fuer die passende HHD-Version holen", "HhdVersion", "hhd", "=", "job", ".", "getVersion", "(", "version", ".", "getChallengeVersion", "(", ")", ")", ";", "// Wir haben keine Parameter fuer diese HHD-Version", "if", "(", "hhd", "==", "null", ")", "{", "log", ".", "info", "(", "\"have no challenge data for \"", "+", "code", "+", "\" in \"", "+", "version", "+", "\", will not apply challenge params\"", ")", ";", "return", ";", "}", "// Schritt 1: Challenge-Klasse uebernehmen", "String", "klass", "=", "hhd", ".", "getKlass", "(", ")", ";", "log", ".", "debug", "(", "\"using challenge klass \"", "+", "klass", ")", ";", "hktan", ".", "setParam", "(", "\"challengeklass\"", ",", "klass", ")", ";", "// Schritt 2: Challenge-Parameter uebernehmen", "List", "<", "Param", ">", "params", "=", "hhd", ".", "getParams", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "params", ".", "size", "(", ")", ";", "++", "i", ")", "{", "int", "num", "=", "i", "+", "1", ";", "// Die Job-Parameter beginnen bei 1", "Param", "param", "=", "params", ".", "get", "(", "i", ")", ";", "// Checken, ob der Parameter angewendet werden soll.", "if", "(", "!", "param", ".", "isComplied", "(", "hbciTwoStepMechanism", ")", ")", "{", "log", ".", "debug", "(", "\"skipping challenge parameter \"", "+", "num", "+", "\" (\"", "+", "param", ".", "path", "+", "\"), condition \"", "+", "param", ".", "conditionName", "+", "\"=\"", "+", "param", ".", "conditionValue", "+", "\" not complied\"", ")", ";", "continue", ";", "}", "// Parameter uebernehmen. Aber nur wenn er auch einen Wert hat.", "// Seit HHD 1.4 duerfen Parameter mittendrin optional sein, sie", "// werden dann freigelassen", "String", "value", "=", "param", ".", "getValue", "(", "task", ")", ";", "if", "(", "value", "==", "null", "||", "value", ".", "length", "(", ")", "==", "0", ")", "{", "log", ".", "debug", "(", "\"challenge parameter \"", "+", "num", "+", "\" (\"", "+", "param", ".", "path", "+", "\") is empty\"", ")", ";", "continue", ";", "}", "log", ".", "debug", "(", "\"adding challenge parameter \"", "+", "num", "+", "\" \"", "+", "param", ".", "path", "+", "\"=\"", "+", "value", ")", ";", "hktan", ".", "setParam", "(", "\"ChallengeKlassParam\"", "+", "num", ",", "value", ")", ";", "}", "}" ]
Uebernimmt die Challenge-Parameter in den HKTAN-Geschaeftsvorfall. @param task der Job, zu dem die Challenge-Parameter ermittelt werden sollen. @param hktan der HKTAN-Geschaeftsvorfall, in dem die Parameter gesetzt werden sollen. @param hbciTwoStepMechanism die BPD-Informationen zum TAN-Verfahren.
[ "Uebernimmt", "die", "Challenge", "-", "Parameter", "in", "den", "HKTAN", "-", "Geschaeftsvorfall", "." ]
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/ChallengeInfo.java#L131-L185
Stratio/stratio-cassandra
src/java/org/apache/cassandra/service/pager/QueryPagers.java
QueryPagers.countPaged
public static int countPaged(String keyspace, String columnFamily, ByteBuffer key, SliceQueryFilter filter, ConsistencyLevel consistencyLevel, ClientState cState, final int pageSize, long now) throws RequestValidationException, RequestExecutionException { """ Convenience method that count (live) cells/rows for a given slice of a row, but page underneath. """ SliceFromReadCommand command = new SliceFromReadCommand(keyspace, key, columnFamily, now, filter); final SliceQueryPager pager = new SliceQueryPager(command, consistencyLevel, cState, false); ColumnCounter counter = filter.columnCounter(Schema.instance.getCFMetaData(keyspace, columnFamily).comparator, now); while (!pager.isExhausted()) { List<Row> next = pager.fetchPage(pageSize); if (!next.isEmpty()) counter.countAll(next.get(0).cf); } return counter.live(); }
java
public static int countPaged(String keyspace, String columnFamily, ByteBuffer key, SliceQueryFilter filter, ConsistencyLevel consistencyLevel, ClientState cState, final int pageSize, long now) throws RequestValidationException, RequestExecutionException { SliceFromReadCommand command = new SliceFromReadCommand(keyspace, key, columnFamily, now, filter); final SliceQueryPager pager = new SliceQueryPager(command, consistencyLevel, cState, false); ColumnCounter counter = filter.columnCounter(Schema.instance.getCFMetaData(keyspace, columnFamily).comparator, now); while (!pager.isExhausted()) { List<Row> next = pager.fetchPage(pageSize); if (!next.isEmpty()) counter.countAll(next.get(0).cf); } return counter.live(); }
[ "public", "static", "int", "countPaged", "(", "String", "keyspace", ",", "String", "columnFamily", ",", "ByteBuffer", "key", ",", "SliceQueryFilter", "filter", ",", "ConsistencyLevel", "consistencyLevel", ",", "ClientState", "cState", ",", "final", "int", "pageSize", ",", "long", "now", ")", "throws", "RequestValidationException", ",", "RequestExecutionException", "{", "SliceFromReadCommand", "command", "=", "new", "SliceFromReadCommand", "(", "keyspace", ",", "key", ",", "columnFamily", ",", "now", ",", "filter", ")", ";", "final", "SliceQueryPager", "pager", "=", "new", "SliceQueryPager", "(", "command", ",", "consistencyLevel", ",", "cState", ",", "false", ")", ";", "ColumnCounter", "counter", "=", "filter", ".", "columnCounter", "(", "Schema", ".", "instance", ".", "getCFMetaData", "(", "keyspace", ",", "columnFamily", ")", ".", "comparator", ",", "now", ")", ";", "while", "(", "!", "pager", ".", "isExhausted", "(", ")", ")", "{", "List", "<", "Row", ">", "next", "=", "pager", ".", "fetchPage", "(", "pageSize", ")", ";", "if", "(", "!", "next", ".", "isEmpty", "(", ")", ")", "counter", ".", "countAll", "(", "next", ".", "get", "(", "0", ")", ".", "cf", ")", ";", "}", "return", "counter", ".", "live", "(", ")", ";", "}" ]
Convenience method that count (live) cells/rows for a given slice of a row, but page underneath.
[ "Convenience", "method", "that", "count", "(", "live", ")", "cells", "/", "rows", "for", "a", "given", "slice", "of", "a", "row", "but", "page", "underneath", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/service/pager/QueryPagers.java#L175-L195
shrinkwrap/resolver
maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/SettingsManager.java
SettingsManager.configureSettingsFromFile
public void configureSettingsFromFile(File globalSettings, File userSettings) throws InvalidConfigurationFileException { """ Crates an instance of {@link Settings} and configures it from the given file. @param globalSettings path to global settings file @param userSettings path to user settings file """ SettingsBuildingRequest request = new DefaultSettingsBuildingRequest(); if (globalSettings != null) { request.setGlobalSettingsFile(globalSettings); } if (userSettings != null) { request.setUserSettingsFile(userSettings); } request.setSystemProperties(SecurityActions.getProperties()); MavenSettingsBuilder builder = new MavenSettingsBuilder(); this.settings = builder.buildSettings(request); // ensure we keep offline(boolean) if previously set propagateProgrammaticOfflineIntoSettings(); }
java
public void configureSettingsFromFile(File globalSettings, File userSettings) throws InvalidConfigurationFileException { SettingsBuildingRequest request = new DefaultSettingsBuildingRequest(); if (globalSettings != null) { request.setGlobalSettingsFile(globalSettings); } if (userSettings != null) { request.setUserSettingsFile(userSettings); } request.setSystemProperties(SecurityActions.getProperties()); MavenSettingsBuilder builder = new MavenSettingsBuilder(); this.settings = builder.buildSettings(request); // ensure we keep offline(boolean) if previously set propagateProgrammaticOfflineIntoSettings(); }
[ "public", "void", "configureSettingsFromFile", "(", "File", "globalSettings", ",", "File", "userSettings", ")", "throws", "InvalidConfigurationFileException", "{", "SettingsBuildingRequest", "request", "=", "new", "DefaultSettingsBuildingRequest", "(", ")", ";", "if", "(", "globalSettings", "!=", "null", ")", "{", "request", ".", "setGlobalSettingsFile", "(", "globalSettings", ")", ";", "}", "if", "(", "userSettings", "!=", "null", ")", "{", "request", ".", "setUserSettingsFile", "(", "userSettings", ")", ";", "}", "request", ".", "setSystemProperties", "(", "SecurityActions", ".", "getProperties", "(", ")", ")", ";", "MavenSettingsBuilder", "builder", "=", "new", "MavenSettingsBuilder", "(", ")", ";", "this", ".", "settings", "=", "builder", ".", "buildSettings", "(", "request", ")", ";", "// ensure we keep offline(boolean) if previously set", "propagateProgrammaticOfflineIntoSettings", "(", ")", ";", "}" ]
Crates an instance of {@link Settings} and configures it from the given file. @param globalSettings path to global settings file @param userSettings path to user settings file
[ "Crates", "an", "instance", "of", "{", "@link", "Settings", "}", "and", "configures", "it", "from", "the", "given", "file", "." ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/SettingsManager.java#L49-L66
dropwizard/dropwizard
dropwizard-auth/src/main/java/io/dropwizard/auth/basic/BasicCredentialAuthFilter.java
BasicCredentialAuthFilter.getCredentials
@Nullable private BasicCredentials getCredentials(String header) { """ Parses a Base64-encoded value of the `Authorization` header in the form of `Basic dXNlcm5hbWU6cGFzc3dvcmQ=`. @param header the value of the `Authorization` header @return a username and a password as {@link BasicCredentials} """ if (header == null) { return null; } final int space = header.indexOf(' '); if (space <= 0) { return null; } final String method = header.substring(0, space); if (!prefix.equalsIgnoreCase(method)) { return null; } final String decoded; try { decoded = new String(Base64.getDecoder().decode(header.substring(space + 1)), StandardCharsets.UTF_8); } catch (IllegalArgumentException e) { logger.warn("Error decoding credentials", e); return null; } // Decoded credentials is 'username:password' final int i = decoded.indexOf(':'); if (i <= 0) { return null; } final String username = decoded.substring(0, i); final String password = decoded.substring(i + 1); return new BasicCredentials(username, password); }
java
@Nullable private BasicCredentials getCredentials(String header) { if (header == null) { return null; } final int space = header.indexOf(' '); if (space <= 0) { return null; } final String method = header.substring(0, space); if (!prefix.equalsIgnoreCase(method)) { return null; } final String decoded; try { decoded = new String(Base64.getDecoder().decode(header.substring(space + 1)), StandardCharsets.UTF_8); } catch (IllegalArgumentException e) { logger.warn("Error decoding credentials", e); return null; } // Decoded credentials is 'username:password' final int i = decoded.indexOf(':'); if (i <= 0) { return null; } final String username = decoded.substring(0, i); final String password = decoded.substring(i + 1); return new BasicCredentials(username, password); }
[ "@", "Nullable", "private", "BasicCredentials", "getCredentials", "(", "String", "header", ")", "{", "if", "(", "header", "==", "null", ")", "{", "return", "null", ";", "}", "final", "int", "space", "=", "header", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "space", "<=", "0", ")", "{", "return", "null", ";", "}", "final", "String", "method", "=", "header", ".", "substring", "(", "0", ",", "space", ")", ";", "if", "(", "!", "prefix", ".", "equalsIgnoreCase", "(", "method", ")", ")", "{", "return", "null", ";", "}", "final", "String", "decoded", ";", "try", "{", "decoded", "=", "new", "String", "(", "Base64", ".", "getDecoder", "(", ")", ".", "decode", "(", "header", ".", "substring", "(", "space", "+", "1", ")", ")", ",", "StandardCharsets", ".", "UTF_8", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "logger", ".", "warn", "(", "\"Error decoding credentials\"", ",", "e", ")", ";", "return", "null", ";", "}", "// Decoded credentials is 'username:password'", "final", "int", "i", "=", "decoded", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "i", "<=", "0", ")", "{", "return", "null", ";", "}", "final", "String", "username", "=", "decoded", ".", "substring", "(", "0", ",", "i", ")", ";", "final", "String", "password", "=", "decoded", ".", "substring", "(", "i", "+", "1", ")", ";", "return", "new", "BasicCredentials", "(", "username", ",", "password", ")", ";", "}" ]
Parses a Base64-encoded value of the `Authorization` header in the form of `Basic dXNlcm5hbWU6cGFzc3dvcmQ=`. @param header the value of the `Authorization` header @return a username and a password as {@link BasicCredentials}
[ "Parses", "a", "Base64", "-", "encoded", "value", "of", "the", "Authorization", "header", "in", "the", "form", "of", "Basic", "dXNlcm5hbWU6cGFzc3dvcmQ", "=", "." ]
train
https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-auth/src/main/java/io/dropwizard/auth/basic/BasicCredentialAuthFilter.java#L40-L73
TheHortonMachine/hortonmachine
dbs/src/main/java/org/hortonmachine/dbs/utils/DbsUtilities.java
DbsUtilities.createPolygonFromEnvelope
public static Polygon createPolygonFromEnvelope( Envelope env ) { """ Create a polygon using an envelope. @param env the envelope to use. @return the created geomerty. """ double minX = env.getMinX(); double minY = env.getMinY(); double maxY = env.getMaxY(); double maxX = env.getMaxX(); Coordinate[] c = new Coordinate[]{new Coordinate(minX, minY), new Coordinate(minX, maxY), new Coordinate(maxX, maxY), new Coordinate(maxX, minY), new Coordinate(minX, minY)}; return gf().createPolygon(c); }
java
public static Polygon createPolygonFromEnvelope( Envelope env ) { double minX = env.getMinX(); double minY = env.getMinY(); double maxY = env.getMaxY(); double maxX = env.getMaxX(); Coordinate[] c = new Coordinate[]{new Coordinate(minX, minY), new Coordinate(minX, maxY), new Coordinate(maxX, maxY), new Coordinate(maxX, minY), new Coordinate(minX, minY)}; return gf().createPolygon(c); }
[ "public", "static", "Polygon", "createPolygonFromEnvelope", "(", "Envelope", "env", ")", "{", "double", "minX", "=", "env", ".", "getMinX", "(", ")", ";", "double", "minY", "=", "env", ".", "getMinY", "(", ")", ";", "double", "maxY", "=", "env", ".", "getMaxY", "(", ")", ";", "double", "maxX", "=", "env", ".", "getMaxX", "(", ")", ";", "Coordinate", "[", "]", "c", "=", "new", "Coordinate", "[", "]", "{", "new", "Coordinate", "(", "minX", ",", "minY", ")", ",", "new", "Coordinate", "(", "minX", ",", "maxY", ")", ",", "new", "Coordinate", "(", "maxX", ",", "maxY", ")", ",", "new", "Coordinate", "(", "maxX", ",", "minY", ")", ",", "new", "Coordinate", "(", "minX", ",", "minY", ")", "}", ";", "return", "gf", "(", ")", ".", "createPolygon", "(", "c", ")", ";", "}" ]
Create a polygon using an envelope. @param env the envelope to use. @return the created geomerty.
[ "Create", "a", "polygon", "using", "an", "envelope", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/utils/DbsUtilities.java#L117-L125
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java
CertificatesImpl.listNext
public PagedList<Certificate> listNext(final String nextPageLink) { """ Lists all of the certificates that have been added to the specified account. @param nextPageLink The NextLink from the previous successful call to List operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;Certificate&gt; object if successful. """ ServiceResponseWithHeaders<Page<Certificate>, CertificateListHeaders> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<Certificate>(response.body()) { @Override public Page<Certificate> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); } }; }
java
public PagedList<Certificate> listNext(final String nextPageLink) { ServiceResponseWithHeaders<Page<Certificate>, CertificateListHeaders> response = listNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<Certificate>(response.body()) { @Override public Page<Certificate> nextPage(String nextPageLink) { return listNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "Certificate", ">", "listNext", "(", "final", "String", "nextPageLink", ")", "{", "ServiceResponseWithHeaders", "<", "Page", "<", "Certificate", ">", ",", "CertificateListHeaders", ">", "response", "=", "listNextSinglePageAsync", "(", "nextPageLink", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ";", "return", "new", "PagedList", "<", "Certificate", ">", "(", "response", ".", "body", "(", ")", ")", "{", "@", "Override", "public", "Page", "<", "Certificate", ">", "nextPage", "(", "String", "nextPageLink", ")", "{", "return", "listNextSinglePageAsync", "(", "nextPageLink", ",", "null", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}", "}", ";", "}" ]
Lists all of the certificates that have been added to the specified account. @param nextPageLink The NextLink from the previous successful call to List operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;Certificate&gt; object if successful.
[ "Lists", "all", "of", "the", "certificates", "that", "have", "been", "added", "to", "the", "specified", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/CertificatesImpl.java#L1201-L1209
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java
EncryptionProtectorsInner.getAsync
public Observable<EncryptionProtectorInner> getAsync(String resourceGroupName, String serverName) { """ Gets a server encryption protector. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EncryptionProtectorInner object """ return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<EncryptionProtectorInner>, EncryptionProtectorInner>() { @Override public EncryptionProtectorInner call(ServiceResponse<EncryptionProtectorInner> response) { return response.body(); } }); }
java
public Observable<EncryptionProtectorInner> getAsync(String resourceGroupName, String serverName) { return getWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<EncryptionProtectorInner>, EncryptionProtectorInner>() { @Override public EncryptionProtectorInner call(ServiceResponse<EncryptionProtectorInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EncryptionProtectorInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "EncryptionProtectorInner", ">", ",", "EncryptionProtectorInner", ">", "(", ")", "{", "@", "Override", "public", "EncryptionProtectorInner", "call", "(", "ServiceResponse", "<", "EncryptionProtectorInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets a server encryption protector. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EncryptionProtectorInner object
[ "Gets", "a", "server", "encryption", "protector", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/EncryptionProtectorsInner.java#L243-L250
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/swift/Swift.java
Swift.getMultiTagValue
public static String getMultiTagValue(String st, String tag) { """ /* Gets a value from the "multi-tag". Codes look like ?20 - a value goes until the next value-code or until end of data """ String ret = null; int pos = st.indexOf("?" + tag); if (pos != -1) { // first possible endpos int searchpos = pos + 3; int endpos = -1; while (true) { // search for start of next value-code endpos = st.indexOf("?", searchpos); // check if this is REALLY a value-code if (endpos != -1 && endpos + 2 < st.length()) { /* "?" is far enough before end to make it possible * to be followed by two digits */ if (st.charAt(endpos + 1) >= '0' && st.charAt(endpos + 1) <= '9' && st.charAt(endpos + 2) >= '0' && st.charAt(endpos + 2) <= '9') { /* the "?" must be followed by two digits, a single "?" * does NOT mark the end of value */ break; } } else { /* the "?" is near the end of the string, so we break out * here und use the complete string as value */ endpos = -1; break; } // start search for the next "?" after the current, wrong one searchpos = endpos + 1; } if (endpos == -1) endpos = st.length(); ret = st.substring(pos + 3, endpos); } return ret; }
java
public static String getMultiTagValue(String st, String tag) { String ret = null; int pos = st.indexOf("?" + tag); if (pos != -1) { // first possible endpos int searchpos = pos + 3; int endpos = -1; while (true) { // search for start of next value-code endpos = st.indexOf("?", searchpos); // check if this is REALLY a value-code if (endpos != -1 && endpos + 2 < st.length()) { /* "?" is far enough before end to make it possible * to be followed by two digits */ if (st.charAt(endpos + 1) >= '0' && st.charAt(endpos + 1) <= '9' && st.charAt(endpos + 2) >= '0' && st.charAt(endpos + 2) <= '9') { /* the "?" must be followed by two digits, a single "?" * does NOT mark the end of value */ break; } } else { /* the "?" is near the end of the string, so we break out * here und use the complete string as value */ endpos = -1; break; } // start search for the next "?" after the current, wrong one searchpos = endpos + 1; } if (endpos == -1) endpos = st.length(); ret = st.substring(pos + 3, endpos); } return ret; }
[ "public", "static", "String", "getMultiTagValue", "(", "String", "st", ",", "String", "tag", ")", "{", "String", "ret", "=", "null", ";", "int", "pos", "=", "st", ".", "indexOf", "(", "\"?\"", "+", "tag", ")", ";", "if", "(", "pos", "!=", "-", "1", ")", "{", "// first possible endpos", "int", "searchpos", "=", "pos", "+", "3", ";", "int", "endpos", "=", "-", "1", ";", "while", "(", "true", ")", "{", "// search for start of next value-code", "endpos", "=", "st", ".", "indexOf", "(", "\"?\"", ",", "searchpos", ")", ";", "// check if this is REALLY a value-code", "if", "(", "endpos", "!=", "-", "1", "&&", "endpos", "+", "2", "<", "st", ".", "length", "(", ")", ")", "{", "/* \"?\" is far enough before end to make it possible\n * to be followed by two digits */", "if", "(", "st", ".", "charAt", "(", "endpos", "+", "1", ")", ">=", "'", "'", "&&", "st", ".", "charAt", "(", "endpos", "+", "1", ")", "<=", "'", "'", "&&", "st", ".", "charAt", "(", "endpos", "+", "2", ")", ">=", "'", "'", "&&", "st", ".", "charAt", "(", "endpos", "+", "2", ")", "<=", "'", "'", ")", "{", "/* the \"?\" must be followed by two digits, a single \"?\"\n * does NOT mark the end of value */", "break", ";", "}", "}", "else", "{", "/* the \"?\" is near the end of the string, so we break out\n * here und use the complete string as value */", "endpos", "=", "-", "1", ";", "break", ";", "}", "// start search for the next \"?\" after the current, wrong one", "searchpos", "=", "endpos", "+", "1", ";", "}", "if", "(", "endpos", "==", "-", "1", ")", "endpos", "=", "st", ".", "length", "(", ")", ";", "ret", "=", "st", ".", "substring", "(", "pos", "+", "3", ",", "endpos", ")", ";", "}", "return", "ret", ";", "}" ]
/* Gets a value from the "multi-tag". Codes look like ?20 - a value goes until the next value-code or until end of data
[ "/", "*", "Gets", "a", "value", "from", "the", "multi", "-", "tag", ".", "Codes", "look", "like", "?20", "-", "a", "value", "goes", "until", "the", "next", "value", "-", "code", "or", "until", "end", "of", "data" ]
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/swift/Swift.java#L95-L137
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java
FastaAFPChainConverter.buildAlignment
private static AFPChain buildAlignment(Atom[] ca1, Atom[] ca2, ResidueNumber[] residues1, ResidueNumber[] residues2) throws StructureException { """ Builds an {@link AFPChain} from already-matched arrays of atoms and residues. @param ca1 An array of atoms in the first structure @param ca2 An array of atoms in the second structure @param residues1 An array of {@link ResidueNumber ResidueNumbers} in the first structure that are aligned. Only null ResidueNumbers are considered to be unaligned @param residues2 An array of {@link ResidueNumber ResidueNumbers} in the second structure that are aligned. Only null ResidueNumbers are considered to be unaligned @throws StructureException """ // remove any gap // this includes the ones introduced by the nullifying above List<ResidueNumber> alignedResiduesList1 = new ArrayList<ResidueNumber>(); List<ResidueNumber> alignedResiduesList2 = new ArrayList<ResidueNumber>(); for (int i = 0; i < residues1.length; i++) { if (residues1[i] != null && residues2[i] != null) { alignedResiduesList1.add(residues1[i]); alignedResiduesList2.add(residues2[i]); } } ResidueNumber[] alignedResidues1 = alignedResiduesList1.toArray(new ResidueNumber[alignedResiduesList1.size()]); ResidueNumber[] alignedResidues2 = alignedResiduesList2.toArray(new ResidueNumber[alignedResiduesList2.size()]); AFPChain afpChain = AlignmentTools.createAFPChain(ca1, ca2, alignedResidues1, alignedResidues2); afpChain.setAlgorithmName("unknown"); AlignmentTools.updateSuperposition(afpChain, ca1, ca2); afpChain.setBlockSize(new int[] {afpChain.getNrEQR()}); afpChain.setBlockRmsd(new double[] {afpChain.getTotalRmsdOpt()}); afpChain.setBlockGap(new int[] {afpChain.getGapLen()}); return afpChain; }
java
private static AFPChain buildAlignment(Atom[] ca1, Atom[] ca2, ResidueNumber[] residues1, ResidueNumber[] residues2) throws StructureException { // remove any gap // this includes the ones introduced by the nullifying above List<ResidueNumber> alignedResiduesList1 = new ArrayList<ResidueNumber>(); List<ResidueNumber> alignedResiduesList2 = new ArrayList<ResidueNumber>(); for (int i = 0; i < residues1.length; i++) { if (residues1[i] != null && residues2[i] != null) { alignedResiduesList1.add(residues1[i]); alignedResiduesList2.add(residues2[i]); } } ResidueNumber[] alignedResidues1 = alignedResiduesList1.toArray(new ResidueNumber[alignedResiduesList1.size()]); ResidueNumber[] alignedResidues2 = alignedResiduesList2.toArray(new ResidueNumber[alignedResiduesList2.size()]); AFPChain afpChain = AlignmentTools.createAFPChain(ca1, ca2, alignedResidues1, alignedResidues2); afpChain.setAlgorithmName("unknown"); AlignmentTools.updateSuperposition(afpChain, ca1, ca2); afpChain.setBlockSize(new int[] {afpChain.getNrEQR()}); afpChain.setBlockRmsd(new double[] {afpChain.getTotalRmsdOpt()}); afpChain.setBlockGap(new int[] {afpChain.getGapLen()}); return afpChain; }
[ "private", "static", "AFPChain", "buildAlignment", "(", "Atom", "[", "]", "ca1", ",", "Atom", "[", "]", "ca2", ",", "ResidueNumber", "[", "]", "residues1", ",", "ResidueNumber", "[", "]", "residues2", ")", "throws", "StructureException", "{", "// remove any gap", "// this includes the ones introduced by the nullifying above", "List", "<", "ResidueNumber", ">", "alignedResiduesList1", "=", "new", "ArrayList", "<", "ResidueNumber", ">", "(", ")", ";", "List", "<", "ResidueNumber", ">", "alignedResiduesList2", "=", "new", "ArrayList", "<", "ResidueNumber", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "residues1", ".", "length", ";", "i", "++", ")", "{", "if", "(", "residues1", "[", "i", "]", "!=", "null", "&&", "residues2", "[", "i", "]", "!=", "null", ")", "{", "alignedResiduesList1", ".", "add", "(", "residues1", "[", "i", "]", ")", ";", "alignedResiduesList2", ".", "add", "(", "residues2", "[", "i", "]", ")", ";", "}", "}", "ResidueNumber", "[", "]", "alignedResidues1", "=", "alignedResiduesList1", ".", "toArray", "(", "new", "ResidueNumber", "[", "alignedResiduesList1", ".", "size", "(", ")", "]", ")", ";", "ResidueNumber", "[", "]", "alignedResidues2", "=", "alignedResiduesList2", ".", "toArray", "(", "new", "ResidueNumber", "[", "alignedResiduesList2", ".", "size", "(", ")", "]", ")", ";", "AFPChain", "afpChain", "=", "AlignmentTools", ".", "createAFPChain", "(", "ca1", ",", "ca2", ",", "alignedResidues1", ",", "alignedResidues2", ")", ";", "afpChain", ".", "setAlgorithmName", "(", "\"unknown\"", ")", ";", "AlignmentTools", ".", "updateSuperposition", "(", "afpChain", ",", "ca1", ",", "ca2", ")", ";", "afpChain", ".", "setBlockSize", "(", "new", "int", "[", "]", "{", "afpChain", ".", "getNrEQR", "(", ")", "}", ")", ";", "afpChain", ".", "setBlockRmsd", "(", "new", "double", "[", "]", "{", "afpChain", ".", "getTotalRmsdOpt", "(", ")", "}", ")", ";", "afpChain", ".", "setBlockGap", "(", "new", "int", "[", "]", "{", "afpChain", ".", "getGapLen", "(", ")", "}", ")", ";", "return", "afpChain", ";", "}" ]
Builds an {@link AFPChain} from already-matched arrays of atoms and residues. @param ca1 An array of atoms in the first structure @param ca2 An array of atoms in the second structure @param residues1 An array of {@link ResidueNumber ResidueNumbers} in the first structure that are aligned. Only null ResidueNumbers are considered to be unaligned @param residues2 An array of {@link ResidueNumber ResidueNumbers} in the second structure that are aligned. Only null ResidueNumbers are considered to be unaligned @throws StructureException
[ "Builds", "an", "{", "@link", "AFPChain", "}", "from", "already", "-", "matched", "arrays", "of", "atoms", "and", "residues", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/FastaAFPChainConverter.java#L347-L375
BlueBrain/bluima
modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/maxent/FileEventStream.java
FileEventStream.main
public static void main(String[] args) throws IOException { """ Trains and writes a model based on the events in the specified event file. the name of the model created is based on the event file name. @param args eventfile [iterations cuttoff] @throws IOException when the eventfile can not be read or the model file can not be written. """ if (args.length == 0) { System.err.println("Usage: FileEventStream eventfile [iterations cutoff]"); System.exit(1); } int ai=0; String eventFile = args[ai++]; EventStream es = new FileEventStream(eventFile); int iterations = 100; int cutoff = 5; if (ai < args.length) { iterations = Integer.parseInt(args[ai++]); cutoff = Integer.parseInt(args[ai++]); } GISModel model = GIS.trainModel(es,iterations,cutoff); new SuffixSensitiveGISModelWriter(model, new File(eventFile+".bin.gz")).persist(); }
java
public static void main(String[] args) throws IOException { if (args.length == 0) { System.err.println("Usage: FileEventStream eventfile [iterations cutoff]"); System.exit(1); } int ai=0; String eventFile = args[ai++]; EventStream es = new FileEventStream(eventFile); int iterations = 100; int cutoff = 5; if (ai < args.length) { iterations = Integer.parseInt(args[ai++]); cutoff = Integer.parseInt(args[ai++]); } GISModel model = GIS.trainModel(es,iterations,cutoff); new SuffixSensitiveGISModelWriter(model, new File(eventFile+".bin.gz")).persist(); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "if", "(", "args", ".", "length", "==", "0", ")", "{", "System", ".", "err", ".", "println", "(", "\"Usage: FileEventStream eventfile [iterations cutoff]\"", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "int", "ai", "=", "0", ";", "String", "eventFile", "=", "args", "[", "ai", "++", "]", ";", "EventStream", "es", "=", "new", "FileEventStream", "(", "eventFile", ")", ";", "int", "iterations", "=", "100", ";", "int", "cutoff", "=", "5", ";", "if", "(", "ai", "<", "args", ".", "length", ")", "{", "iterations", "=", "Integer", ".", "parseInt", "(", "args", "[", "ai", "++", "]", ")", ";", "cutoff", "=", "Integer", ".", "parseInt", "(", "args", "[", "ai", "++", "]", ")", ";", "}", "GISModel", "model", "=", "GIS", ".", "trainModel", "(", "es", ",", "iterations", ",", "cutoff", ")", ";", "new", "SuffixSensitiveGISModelWriter", "(", "model", ",", "new", "File", "(", "eventFile", "+", "\".bin.gz\"", ")", ")", ".", "persist", "(", ")", ";", "}" ]
Trains and writes a model based on the events in the specified event file. the name of the model created is based on the event file name. @param args eventfile [iterations cuttoff] @throws IOException when the eventfile can not be read or the model file can not be written.
[ "Trains", "and", "writes", "a", "model", "based", "on", "the", "events", "in", "the", "specified", "event", "file", ".", "the", "name", "of", "the", "model", "created", "is", "based", "on", "the", "event", "file", "name", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_opennlp/src/main/java/ch/epfl/bbp/shaded/opennlp/maxent/FileEventStream.java#L101-L117
grails/grails-core
grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java
GrailsASTUtils.isSubclassOf
public static boolean isSubclassOf(ClassNode classNode, String parentClassName) { """ Returns true if the given class name is a parent class of the given class @param classNode The class node @param parentClassName the parent class name @return True if it is a subclass """ ClassNode currentSuper = classNode.getSuperClass(); while (currentSuper != null && !currentSuper.getName().equals(OBJECT_CLASS)) { if (currentSuper.getName().equals(parentClassName)) return true; currentSuper = currentSuper.getSuperClass(); } return false; }
java
public static boolean isSubclassOf(ClassNode classNode, String parentClassName) { ClassNode currentSuper = classNode.getSuperClass(); while (currentSuper != null && !currentSuper.getName().equals(OBJECT_CLASS)) { if (currentSuper.getName().equals(parentClassName)) return true; currentSuper = currentSuper.getSuperClass(); } return false; }
[ "public", "static", "boolean", "isSubclassOf", "(", "ClassNode", "classNode", ",", "String", "parentClassName", ")", "{", "ClassNode", "currentSuper", "=", "classNode", ".", "getSuperClass", "(", ")", ";", "while", "(", "currentSuper", "!=", "null", "&&", "!", "currentSuper", ".", "getName", "(", ")", ".", "equals", "(", "OBJECT_CLASS", ")", ")", "{", "if", "(", "currentSuper", ".", "getName", "(", ")", ".", "equals", "(", "parentClassName", ")", ")", "return", "true", ";", "currentSuper", "=", "currentSuper", ".", "getSuperClass", "(", ")", ";", "}", "return", "false", ";", "}" ]
Returns true if the given class name is a parent class of the given class @param classNode The class node @param parentClassName the parent class name @return True if it is a subclass
[ "Returns", "true", "if", "the", "given", "class", "name", "is", "a", "parent", "class", "of", "the", "given", "class" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/org/grails/compiler/injection/GrailsASTUtils.java#L1148-L1155
pravega/pravega
common/src/main/java/io/pravega/common/util/BitConverter.java
BitConverter.writeUnsignedLong
public static int writeUnsignedLong(byte[] target, int offset, long value) { """ Writes the given 64-bit Unsigned Long to the given byte array at the given offset. This value can then be deserialized using {@link #readUnsignedLong}. This method is not interoperable with {@link #readLong}. The advantage of serializing as Unsigned Long (vs. a normal Signed Long) is that the serialization will have the same natural order as the input value type (i.e., if compared using a lexicographic bitwise comparator such as ByteArrayComparator, it will have the same ordering as the typical Long type). @param target The byte array to write to. @param offset The offset within the byte array to write at. @param value The (signed) value to write. The value will be converted into the range [0, 2^64-1] before serialization by flipping the high order bit (so positive values will begin with 1 and negative values will begin with 0). @return The number of bytes written. """ return writeLong(target, offset, value ^ Long.MIN_VALUE); }
java
public static int writeUnsignedLong(byte[] target, int offset, long value) { return writeLong(target, offset, value ^ Long.MIN_VALUE); }
[ "public", "static", "int", "writeUnsignedLong", "(", "byte", "[", "]", "target", ",", "int", "offset", ",", "long", "value", ")", "{", "return", "writeLong", "(", "target", ",", "offset", ",", "value", "^", "Long", ".", "MIN_VALUE", ")", ";", "}" ]
Writes the given 64-bit Unsigned Long to the given byte array at the given offset. This value can then be deserialized using {@link #readUnsignedLong}. This method is not interoperable with {@link #readLong}. The advantage of serializing as Unsigned Long (vs. a normal Signed Long) is that the serialization will have the same natural order as the input value type (i.e., if compared using a lexicographic bitwise comparator such as ByteArrayComparator, it will have the same ordering as the typical Long type). @param target The byte array to write to. @param offset The offset within the byte array to write at. @param value The (signed) value to write. The value will be converted into the range [0, 2^64-1] before serialization by flipping the high order bit (so positive values will begin with 1 and negative values will begin with 0). @return The number of bytes written.
[ "Writes", "the", "given", "64", "-", "bit", "Unsigned", "Long", "to", "the", "given", "byte", "array", "at", "the", "given", "offset", ".", "This", "value", "can", "then", "be", "deserialized", "using", "{", "@link", "#readUnsignedLong", "}", ".", "This", "method", "is", "not", "interoperable", "with", "{", "@link", "#readLong", "}", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L316-L318
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/geom/MorphShape.java
MorphShape.equalShapes
private boolean equalShapes(Shape a, Shape b) { """ Check if the shape's points are all equal @param a The first shape to compare @param b The second shape to compare @return True if the shapes are equal """ a.checkPoints(); b.checkPoints(); for (int i=0;i<a.points.length;i++) { if (a.points[i] != b.points[i]) { return false; } } return true; }
java
private boolean equalShapes(Shape a, Shape b) { a.checkPoints(); b.checkPoints(); for (int i=0;i<a.points.length;i++) { if (a.points[i] != b.points[i]) { return false; } } return true; }
[ "private", "boolean", "equalShapes", "(", "Shape", "a", ",", "Shape", "b", ")", "{", "a", ".", "checkPoints", "(", ")", ";", "b", ".", "checkPoints", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "points", ".", "length", ";", "i", "++", ")", "{", "if", "(", "a", ".", "points", "[", "i", "]", "!=", "b", ".", "points", "[", "i", "]", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Check if the shape's points are all equal @param a The first shape to compare @param b The second shape to compare @return True if the shapes are equal
[ "Check", "if", "the", "shape", "s", "points", "are", "all", "equal" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/geom/MorphShape.java#L64-L75
rhuss/jolokia
agent/jvm/src/main/java/org/jolokia/jvmagent/JolokiaServer.java
JolokiaServer.createHttpServer
private HttpServer createHttpServer(JolokiaServerConfig pConfig) throws IOException { """ Create the HttpServer to use. Can be overridden if a custom or already existing HttpServer should be used @return HttpServer to use @throws IOException if something fails during the initialisation """ int port = pConfig.getPort(); InetAddress address = pConfig.getAddress(); InetSocketAddress socketAddress = new InetSocketAddress(address,port); HttpServer server = pConfig.useHttps() ? createHttpsServer(socketAddress, pConfig) : HttpServer.create(socketAddress, pConfig.getBacklog()); // Thread factory which creates only daemon threads ThreadFactory daemonThreadFactory = new DaemonThreadFactory(pConfig.getThreadNamePrefix()); // Prepare executor pool Executor executor; String mode = pConfig.getExecutor(); if ("fixed".equalsIgnoreCase(mode)) { executor = Executors.newFixedThreadPool(pConfig.getThreadNr(), daemonThreadFactory); } else if ("cached".equalsIgnoreCase(mode)) { executor = Executors.newCachedThreadPool(daemonThreadFactory); } else { executor = Executors.newSingleThreadExecutor(daemonThreadFactory); } server.setExecutor(executor); return server; }
java
private HttpServer createHttpServer(JolokiaServerConfig pConfig) throws IOException { int port = pConfig.getPort(); InetAddress address = pConfig.getAddress(); InetSocketAddress socketAddress = new InetSocketAddress(address,port); HttpServer server = pConfig.useHttps() ? createHttpsServer(socketAddress, pConfig) : HttpServer.create(socketAddress, pConfig.getBacklog()); // Thread factory which creates only daemon threads ThreadFactory daemonThreadFactory = new DaemonThreadFactory(pConfig.getThreadNamePrefix()); // Prepare executor pool Executor executor; String mode = pConfig.getExecutor(); if ("fixed".equalsIgnoreCase(mode)) { executor = Executors.newFixedThreadPool(pConfig.getThreadNr(), daemonThreadFactory); } else if ("cached".equalsIgnoreCase(mode)) { executor = Executors.newCachedThreadPool(daemonThreadFactory); } else { executor = Executors.newSingleThreadExecutor(daemonThreadFactory); } server.setExecutor(executor); return server; }
[ "private", "HttpServer", "createHttpServer", "(", "JolokiaServerConfig", "pConfig", ")", "throws", "IOException", "{", "int", "port", "=", "pConfig", ".", "getPort", "(", ")", ";", "InetAddress", "address", "=", "pConfig", ".", "getAddress", "(", ")", ";", "InetSocketAddress", "socketAddress", "=", "new", "InetSocketAddress", "(", "address", ",", "port", ")", ";", "HttpServer", "server", "=", "pConfig", ".", "useHttps", "(", ")", "?", "createHttpsServer", "(", "socketAddress", ",", "pConfig", ")", ":", "HttpServer", ".", "create", "(", "socketAddress", ",", "pConfig", ".", "getBacklog", "(", ")", ")", ";", "// Thread factory which creates only daemon threads", "ThreadFactory", "daemonThreadFactory", "=", "new", "DaemonThreadFactory", "(", "pConfig", ".", "getThreadNamePrefix", "(", ")", ")", ";", "// Prepare executor pool", "Executor", "executor", ";", "String", "mode", "=", "pConfig", ".", "getExecutor", "(", ")", ";", "if", "(", "\"fixed\"", ".", "equalsIgnoreCase", "(", "mode", ")", ")", "{", "executor", "=", "Executors", ".", "newFixedThreadPool", "(", "pConfig", ".", "getThreadNr", "(", ")", ",", "daemonThreadFactory", ")", ";", "}", "else", "if", "(", "\"cached\"", ".", "equalsIgnoreCase", "(", "mode", ")", ")", "{", "executor", "=", "Executors", ".", "newCachedThreadPool", "(", "daemonThreadFactory", ")", ";", "}", "else", "{", "executor", "=", "Executors", ".", "newSingleThreadExecutor", "(", "daemonThreadFactory", ")", ";", "}", "server", ".", "setExecutor", "(", "executor", ")", ";", "return", "server", ";", "}" ]
Create the HttpServer to use. Can be overridden if a custom or already existing HttpServer should be used @return HttpServer to use @throws IOException if something fails during the initialisation
[ "Create", "the", "HttpServer", "to", "use", ".", "Can", "be", "overridden", "if", "a", "custom", "or", "already", "existing", "HttpServer", "should", "be", "used" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/jvm/src/main/java/org/jolokia/jvmagent/JolokiaServer.java#L231-L255
ops4j/org.ops4j.pax.logging
pax-logging-service/src/main/java/org/apache/log4j/rule/InequalityRule.java
InequalityRule.getRule
public static Rule getRule(final String inequalitySymbol, final String field, final String value) { """ Create new instance from top two elements on stack. @param inequalitySymbol inequality symbol. @param field field. @param value comparison value. @return rule. """ if (field.equalsIgnoreCase(LoggingEventFieldResolver.LEVEL_FIELD)) { //push the value back on the stack and // allow the level-specific rule pop values return LevelInequalityRule.getRule(inequalitySymbol, value); } else if ( field.equalsIgnoreCase(LoggingEventFieldResolver.TIMESTAMP_FIELD)) { return TimestampInequalityRule.getRule(inequalitySymbol, value); } else { return new InequalityRule(inequalitySymbol, field, value); } }
java
public static Rule getRule(final String inequalitySymbol, final String field, final String value) { if (field.equalsIgnoreCase(LoggingEventFieldResolver.LEVEL_FIELD)) { //push the value back on the stack and // allow the level-specific rule pop values return LevelInequalityRule.getRule(inequalitySymbol, value); } else if ( field.equalsIgnoreCase(LoggingEventFieldResolver.TIMESTAMP_FIELD)) { return TimestampInequalityRule.getRule(inequalitySymbol, value); } else { return new InequalityRule(inequalitySymbol, field, value); } }
[ "public", "static", "Rule", "getRule", "(", "final", "String", "inequalitySymbol", ",", "final", "String", "field", ",", "final", "String", "value", ")", "{", "if", "(", "field", ".", "equalsIgnoreCase", "(", "LoggingEventFieldResolver", ".", "LEVEL_FIELD", ")", ")", "{", "//push the value back on the stack and", "// allow the level-specific rule pop values", "return", "LevelInequalityRule", ".", "getRule", "(", "inequalitySymbol", ",", "value", ")", ";", "}", "else", "if", "(", "field", ".", "equalsIgnoreCase", "(", "LoggingEventFieldResolver", ".", "TIMESTAMP_FIELD", ")", ")", "{", "return", "TimestampInequalityRule", ".", "getRule", "(", "inequalitySymbol", ",", "value", ")", ";", "}", "else", "{", "return", "new", "InequalityRule", "(", "inequalitySymbol", ",", "field", ",", "value", ")", ";", "}", "}" ]
Create new instance from top two elements on stack. @param inequalitySymbol inequality symbol. @param field field. @param value comparison value. @return rule.
[ "Create", "new", "instance", "from", "top", "two", "elements", "on", "stack", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/rule/InequalityRule.java#L109-L122
minio/minio-java
api/src/main/java/io/minio/ServerSideEncryption.java
ServerSideEncryption.copyWithCustomerKey
public static ServerSideEncryption copyWithCustomerKey(SecretKey key) throws InvalidKeyException, NoSuchAlgorithmException { """ Create a new server-side-encryption object for encryption with customer provided keys (a.k.a. SSE-C). @param key The secret AES-256 key. @return An instance of ServerSideEncryption implementing SSE-C. @throws InvalidKeyException if the provided secret key is not a 256 bit AES key. @throws NoSuchAlgorithmException if the crypto provider does not implement MD5. """ if (!isCustomerKeyValid(key)) { throw new InvalidKeyException("The secret key is not a 256 bit AES key"); } return new ServerSideEncryptionCopyWithCustomerKey(key, MessageDigest.getInstance(("MD5"))); }
java
public static ServerSideEncryption copyWithCustomerKey(SecretKey key) throws InvalidKeyException, NoSuchAlgorithmException { if (!isCustomerKeyValid(key)) { throw new InvalidKeyException("The secret key is not a 256 bit AES key"); } return new ServerSideEncryptionCopyWithCustomerKey(key, MessageDigest.getInstance(("MD5"))); }
[ "public", "static", "ServerSideEncryption", "copyWithCustomerKey", "(", "SecretKey", "key", ")", "throws", "InvalidKeyException", ",", "NoSuchAlgorithmException", "{", "if", "(", "!", "isCustomerKeyValid", "(", "key", ")", ")", "{", "throw", "new", "InvalidKeyException", "(", "\"The secret key is not a 256 bit AES key\"", ")", ";", "}", "return", "new", "ServerSideEncryptionCopyWithCustomerKey", "(", "key", ",", "MessageDigest", ".", "getInstance", "(", "(", "\"MD5\"", ")", ")", ")", ";", "}" ]
Create a new server-side-encryption object for encryption with customer provided keys (a.k.a. SSE-C). @param key The secret AES-256 key. @return An instance of ServerSideEncryption implementing SSE-C. @throws InvalidKeyException if the provided secret key is not a 256 bit AES key. @throws NoSuchAlgorithmException if the crypto provider does not implement MD5.
[ "Create", "a", "new", "server", "-", "side", "-", "encryption", "object", "for", "encryption", "with", "customer", "provided", "keys", "(", "a", ".", "k", ".", "a", ".", "SSE", "-", "C", ")", "." ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/ServerSideEncryption.java#L117-L123
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java
MappingUtils.invokeStaticFunction
public static Object invokeStaticFunction(Class clazz, String functionName, Class[] parameters, Object[] values) throws MjdbcException { """ Invokes class function using Reflection @param clazz Class which function would be invoked @param functionName function name @param parameters function parameters (array of Class) @param values function values (array of Object) @return function return @throws org.midao.jdbc.core.exception.MjdbcException in case function doesn't exists """ Object result = null; try { Method method = clazz.getMethod(functionName, parameters); method.setAccessible(true); result = method.invoke(null, values); } catch (Exception ex) { throw new MjdbcException(ex); } return result; }
java
public static Object invokeStaticFunction(Class clazz, String functionName, Class[] parameters, Object[] values) throws MjdbcException { Object result = null; try { Method method = clazz.getMethod(functionName, parameters); method.setAccessible(true); result = method.invoke(null, values); } catch (Exception ex) { throw new MjdbcException(ex); } return result; }
[ "public", "static", "Object", "invokeStaticFunction", "(", "Class", "clazz", ",", "String", "functionName", ",", "Class", "[", "]", "parameters", ",", "Object", "[", "]", "values", ")", "throws", "MjdbcException", "{", "Object", "result", "=", "null", ";", "try", "{", "Method", "method", "=", "clazz", ".", "getMethod", "(", "functionName", ",", "parameters", ")", ";", "method", ".", "setAccessible", "(", "true", ")", ";", "result", "=", "method", ".", "invoke", "(", "null", ",", "values", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "MjdbcException", "(", "ex", ")", ";", "}", "return", "result", ";", "}" ]
Invokes class function using Reflection @param clazz Class which function would be invoked @param functionName function name @param parameters function parameters (array of Class) @param values function values (array of Object) @return function return @throws org.midao.jdbc.core.exception.MjdbcException in case function doesn't exists
[ "Invokes", "class", "function", "using", "Reflection" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java#L285-L297
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/IoTProvisioningManager.java
IoTProvisioningManager.isFriend
public boolean isFriend(Jid provisioningServer, BareJid friendInQuestion) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { """ As the given provisioning server is the given JID is a friend. @param provisioningServer the provisioning server to ask. @param friendInQuestion the JID to ask about. @return <code>true</code> if the JID is a friend, <code>false</code> otherwise. @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException """ LruCache<BareJid, Void> cache = negativeFriendshipRequestCache.lookup(provisioningServer); if (cache != null && cache.containsKey(friendInQuestion)) { // We hit a cached negative isFriend response for this provisioning server. return false; } IoTIsFriend iotIsFriend = new IoTIsFriend(friendInQuestion); iotIsFriend.setTo(provisioningServer); IoTIsFriendResponse response = connection().createStanzaCollectorAndSend(iotIsFriend).nextResultOrThrow(); assert (response.getJid().equals(friendInQuestion)); boolean isFriend = response.getIsFriendResult(); if (!isFriend) { // Cache the negative is friend response. if (cache == null) { cache = new LruCache<>(1024); negativeFriendshipRequestCache.put(provisioningServer, cache); } cache.put(friendInQuestion, null); } return isFriend; }
java
public boolean isFriend(Jid provisioningServer, BareJid friendInQuestion) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { LruCache<BareJid, Void> cache = negativeFriendshipRequestCache.lookup(provisioningServer); if (cache != null && cache.containsKey(friendInQuestion)) { // We hit a cached negative isFriend response for this provisioning server. return false; } IoTIsFriend iotIsFriend = new IoTIsFriend(friendInQuestion); iotIsFriend.setTo(provisioningServer); IoTIsFriendResponse response = connection().createStanzaCollectorAndSend(iotIsFriend).nextResultOrThrow(); assert (response.getJid().equals(friendInQuestion)); boolean isFriend = response.getIsFriendResult(); if (!isFriend) { // Cache the negative is friend response. if (cache == null) { cache = new LruCache<>(1024); negativeFriendshipRequestCache.put(provisioningServer, cache); } cache.put(friendInQuestion, null); } return isFriend; }
[ "public", "boolean", "isFriend", "(", "Jid", "provisioningServer", ",", "BareJid", "friendInQuestion", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "LruCache", "<", "BareJid", ",", "Void", ">", "cache", "=", "negativeFriendshipRequestCache", ".", "lookup", "(", "provisioningServer", ")", ";", "if", "(", "cache", "!=", "null", "&&", "cache", ".", "containsKey", "(", "friendInQuestion", ")", ")", "{", "// We hit a cached negative isFriend response for this provisioning server.", "return", "false", ";", "}", "IoTIsFriend", "iotIsFriend", "=", "new", "IoTIsFriend", "(", "friendInQuestion", ")", ";", "iotIsFriend", ".", "setTo", "(", "provisioningServer", ")", ";", "IoTIsFriendResponse", "response", "=", "connection", "(", ")", ".", "createStanzaCollectorAndSend", "(", "iotIsFriend", ")", ".", "nextResultOrThrow", "(", ")", ";", "assert", "(", "response", ".", "getJid", "(", ")", ".", "equals", "(", "friendInQuestion", ")", ")", ";", "boolean", "isFriend", "=", "response", ".", "getIsFriendResult", "(", ")", ";", "if", "(", "!", "isFriend", ")", "{", "// Cache the negative is friend response.", "if", "(", "cache", "==", "null", ")", "{", "cache", "=", "new", "LruCache", "<>", "(", "1024", ")", ";", "negativeFriendshipRequestCache", ".", "put", "(", "provisioningServer", ",", "cache", ")", ";", "}", "cache", ".", "put", "(", "friendInQuestion", ",", "null", ")", ";", "}", "return", "isFriend", ";", "}" ]
As the given provisioning server is the given JID is a friend. @param provisioningServer the provisioning server to ask. @param friendInQuestion the JID to ask about. @return <code>true</code> if the JID is a friend, <code>false</code> otherwise. @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException
[ "As", "the", "given", "provisioning", "server", "is", "the", "given", "JID", "is", "a", "friend", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/provisioning/IoTProvisioningManager.java#L334-L355
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.hosting_privateDatabase_new_GET
public ArrayList<String> hosting_privateDatabase_new_GET(OvhDatacenterEnum datacenter, net.minidev.ovh.api.hosting.privatedatabase.OvhOfferEnum offer, OvhAvailableRamSizeEnum ram, OvhOrderableVersionEnum version) throws IOException { """ Get allowed durations for 'new' option REST: GET /order/hosting/privateDatabase/new @param version [required] Private database available versions @param datacenter [required] Datacenter to deploy this new private database @param ram [required] Private database ram size @param offer [required] Type of offer to deploy this new private database """ String qPath = "/order/hosting/privateDatabase/new"; StringBuilder sb = path(qPath); query(sb, "datacenter", datacenter); query(sb, "offer", offer); query(sb, "ram", ram); query(sb, "version", version); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> hosting_privateDatabase_new_GET(OvhDatacenterEnum datacenter, net.minidev.ovh.api.hosting.privatedatabase.OvhOfferEnum offer, OvhAvailableRamSizeEnum ram, OvhOrderableVersionEnum version) throws IOException { String qPath = "/order/hosting/privateDatabase/new"; StringBuilder sb = path(qPath); query(sb, "datacenter", datacenter); query(sb, "offer", offer); query(sb, "ram", ram); query(sb, "version", version); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "hosting_privateDatabase_new_GET", "(", "OvhDatacenterEnum", "datacenter", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "hosting", ".", "privatedatabase", ".", "OvhOfferEnum", "offer", ",", "OvhAvailableRamSizeEnum", "ram", ",", "OvhOrderableVersionEnum", "version", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/hosting/privateDatabase/new\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\"datacenter\"", ",", "datacenter", ")", ";", "query", "(", "sb", ",", "\"offer\"", ",", "offer", ")", ";", "query", "(", "sb", ",", "\"ram\"", ",", "ram", ")", ";", "query", "(", "sb", ",", "\"version\"", ",", "version", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t1", ")", ";", "}" ]
Get allowed durations for 'new' option REST: GET /order/hosting/privateDatabase/new @param version [required] Private database available versions @param datacenter [required] Datacenter to deploy this new private database @param ram [required] Private database ram size @param offer [required] Type of offer to deploy this new private database
[ "Get", "allowed", "durations", "for", "new", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5094-L5103
javagl/ND
nd-distance/src/main/java/de/javagl/nd/distance/tuples/d/DoubleTupleDistanceFunctions.java
DoubleTupleDistanceFunctions.byDistanceComparator
public static Comparator<DoubleTuple> byDistanceComparator( DoubleTuple reference, final ToDoubleBiFunction<? super DoubleTuple, ? super DoubleTuple> distanceFunction) { """ Returns a new comparator that compares {@link DoubleTuple} instances by their distance to the given reference, according to the given distance function. A copy of the given reference point will be stored, so that changes in the given point will not affect the returned comparator. @param reference The reference point @param distanceFunction The distance function @return The comparator """ final DoubleTuple fReference = DoubleTuples.copy(reference); return new Comparator<DoubleTuple>() { @Override public int compare(DoubleTuple t0, DoubleTuple t1) { double d0 = distanceFunction.applyAsDouble(fReference, t0); double d1 = distanceFunction.applyAsDouble(fReference, t1); return Double.compare(d0, d1); } }; }
java
public static Comparator<DoubleTuple> byDistanceComparator( DoubleTuple reference, final ToDoubleBiFunction<? super DoubleTuple, ? super DoubleTuple> distanceFunction) { final DoubleTuple fReference = DoubleTuples.copy(reference); return new Comparator<DoubleTuple>() { @Override public int compare(DoubleTuple t0, DoubleTuple t1) { double d0 = distanceFunction.applyAsDouble(fReference, t0); double d1 = distanceFunction.applyAsDouble(fReference, t1); return Double.compare(d0, d1); } }; }
[ "public", "static", "Comparator", "<", "DoubleTuple", ">", "byDistanceComparator", "(", "DoubleTuple", "reference", ",", "final", "ToDoubleBiFunction", "<", "?", "super", "DoubleTuple", ",", "?", "super", "DoubleTuple", ">", "distanceFunction", ")", "{", "final", "DoubleTuple", "fReference", "=", "DoubleTuples", ".", "copy", "(", "reference", ")", ";", "return", "new", "Comparator", "<", "DoubleTuple", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "DoubleTuple", "t0", ",", "DoubleTuple", "t1", ")", "{", "double", "d0", "=", "distanceFunction", ".", "applyAsDouble", "(", "fReference", ",", "t0", ")", ";", "double", "d1", "=", "distanceFunction", ".", "applyAsDouble", "(", "fReference", ",", "t1", ")", ";", "return", "Double", ".", "compare", "(", "d0", ",", "d1", ")", ";", "}", "}", ";", "}" ]
Returns a new comparator that compares {@link DoubleTuple} instances by their distance to the given reference, according to the given distance function. A copy of the given reference point will be stored, so that changes in the given point will not affect the returned comparator. @param reference The reference point @param distanceFunction The distance function @return The comparator
[ "Returns", "a", "new", "comparator", "that", "compares", "{", "@link", "DoubleTuple", "}", "instances", "by", "their", "distance", "to", "the", "given", "reference", "according", "to", "the", "given", "distance", "function", ".", "A", "copy", "of", "the", "given", "reference", "point", "will", "be", "stored", "so", "that", "changes", "in", "the", "given", "point", "will", "not", "affect", "the", "returned", "comparator", "." ]
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-distance/src/main/java/de/javagl/nd/distance/tuples/d/DoubleTupleDistanceFunctions.java#L55-L71
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.updateKeyAsync
public Observable<KeyBundle> updateKeyAsync(String vaultBaseUrl, String keyName, String keyVersion) { """ The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a key itself cannot be changed. This operation requires the keys/update permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of key to update. @param keyVersion The version of the key to update. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the KeyBundle object """ return updateKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() { @Override public KeyBundle call(ServiceResponse<KeyBundle> response) { return response.body(); } }); }
java
public Observable<KeyBundle> updateKeyAsync(String vaultBaseUrl, String keyName, String keyVersion) { return updateKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion).map(new Func1<ServiceResponse<KeyBundle>, KeyBundle>() { @Override public KeyBundle call(ServiceResponse<KeyBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "KeyBundle", ">", "updateKeyAsync", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "String", "keyVersion", ")", "{", "return", "updateKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyName", ",", "keyVersion", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "KeyBundle", ">", ",", "KeyBundle", ">", "(", ")", "{", "@", "Override", "public", "KeyBundle", "call", "(", "ServiceResponse", "<", "KeyBundle", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
The update key operation changes specified attributes of a stored key and can be applied to any key type and key version stored in Azure Key Vault. In order to perform this operation, the key must already exist in the Key Vault. Note: The cryptographic material of a key itself cannot be changed. This operation requires the keys/update permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of key to update. @param keyVersion The version of the key to update. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the KeyBundle object
[ "The", "update", "key", "operation", "changes", "specified", "attributes", "of", "a", "stored", "key", "and", "can", "be", "applied", "to", "any", "key", "type", "and", "key", "version", "stored", "in", "Azure", "Key", "Vault", ".", "In", "order", "to", "perform", "this", "operation", "the", "key", "must", "already", "exist", "in", "the", "Key", "Vault", ".", "Note", ":", "The", "cryptographic", "material", "of", "a", "key", "itself", "cannot", "be", "changed", ".", "This", "operation", "requires", "the", "keys", "/", "update", "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#L1205-L1212
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.order_GET
public ArrayList<Long> order_GET(Date date_from, Date date_to) throws IOException { """ List of all the orders the logged account has REST: GET /me/order @param date_to [required] Filter the value of date property (<=) @param date_from [required] Filter the value of date property (>=) """ String qPath = "/me/order"; StringBuilder sb = path(qPath); query(sb, "date.from", date_from); query(sb, "date.to", date_to); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> order_GET(Date date_from, Date date_to) throws IOException { String qPath = "/me/order"; StringBuilder sb = path(qPath); query(sb, "date.from", date_from); query(sb, "date.to", date_to); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "order_GET", "(", "Date", "date_from", ",", "Date", "date_to", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/order\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\"date.from\"", ",", "date_from", ")", ";", "query", "(", "sb", ",", "\"date.to\"", ",", "date_to", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t2", ")", ";", "}" ]
List of all the orders the logged account has REST: GET /me/order @param date_to [required] Filter the value of date property (<=) @param date_from [required] Filter the value of date property (>=)
[ "List", "of", "all", "the", "orders", "the", "logged", "account", "has" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L2112-L2119
line/armeria
core/src/main/java/com/linecorp/armeria/client/ClientOptions.java
ClientOptions.getOrElse
public <T> T getOrElse(ClientOption<T> option, T defaultValue) { """ Returns the value of the specified {@link ClientOption}. @return the value of the {@link ClientOption}, or {@code defaultValue} if the specified {@link ClientOption} is not set. """ return getOrElse0(option, defaultValue); }
java
public <T> T getOrElse(ClientOption<T> option, T defaultValue) { return getOrElse0(option, defaultValue); }
[ "public", "<", "T", ">", "T", "getOrElse", "(", "ClientOption", "<", "T", ">", "option", ",", "T", "defaultValue", ")", "{", "return", "getOrElse0", "(", "option", ",", "defaultValue", ")", ";", "}" ]
Returns the value of the specified {@link ClientOption}. @return the value of the {@link ClientOption}, or {@code defaultValue} if the specified {@link ClientOption} is not set.
[ "Returns", "the", "value", "of", "the", "specified", "{", "@link", "ClientOption", "}", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/ClientOptions.java#L205-L207
milaboratory/milib
src/main/java/com/milaboratory/core/motif/BitapPattern.java
BitapPattern.substitutionOnlyMatcherFirst
public BitapMatcher substitutionOnlyMatcherFirst(int substitutions, final Sequence sequence) { """ Returns a BitapMatcher preforming a fuzzy search in a whole {@code sequence}. Search allows no more than {@code substitutions} number of substitutions. Matcher will return positions of first matched letter in the motif in ascending order. @param substitutions maximal number of allowed substitutions @param sequence target sequence @return matcher which will return positions of first matched letter in the motif in ascending order """ return substitutionOnlyMatcherFirst(substitutions, sequence, 0, sequence.size()); }
java
public BitapMatcher substitutionOnlyMatcherFirst(int substitutions, final Sequence sequence) { return substitutionOnlyMatcherFirst(substitutions, sequence, 0, sequence.size()); }
[ "public", "BitapMatcher", "substitutionOnlyMatcherFirst", "(", "int", "substitutions", ",", "final", "Sequence", "sequence", ")", "{", "return", "substitutionOnlyMatcherFirst", "(", "substitutions", ",", "sequence", ",", "0", ",", "sequence", ".", "size", "(", ")", ")", ";", "}" ]
Returns a BitapMatcher preforming a fuzzy search in a whole {@code sequence}. Search allows no more than {@code substitutions} number of substitutions. Matcher will return positions of first matched letter in the motif in ascending order. @param substitutions maximal number of allowed substitutions @param sequence target sequence @return matcher which will return positions of first matched letter in the motif in ascending order
[ "Returns", "a", "BitapMatcher", "preforming", "a", "fuzzy", "search", "in", "a", "whole", "{", "@code", "sequence", "}", ".", "Search", "allows", "no", "more", "than", "{", "@code", "substitutions", "}", "number", "of", "substitutions", ".", "Matcher", "will", "return", "positions", "of", "first", "matched", "letter", "in", "the", "motif", "in", "ascending", "order", "." ]
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/motif/BitapPattern.java#L100-L102
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.packEntries
public static void packEntries(File[] filesToPack, File destZipFile) { """ Compresses the given files into a ZIP file. <p> The ZIP file must not be a directory and its parent directory must exist. @param filesToPack files that needs to be zipped. @param destZipFile ZIP file that will be created or overwritten. """ packEntries(filesToPack, destZipFile, IdentityNameMapper.INSTANCE); }
java
public static void packEntries(File[] filesToPack, File destZipFile) { packEntries(filesToPack, destZipFile, IdentityNameMapper.INSTANCE); }
[ "public", "static", "void", "packEntries", "(", "File", "[", "]", "filesToPack", ",", "File", "destZipFile", ")", "{", "packEntries", "(", "filesToPack", ",", "destZipFile", ",", "IdentityNameMapper", ".", "INSTANCE", ")", ";", "}" ]
Compresses the given files into a ZIP file. <p> The ZIP file must not be a directory and its parent directory must exist. @param filesToPack files that needs to be zipped. @param destZipFile ZIP file that will be created or overwritten.
[ "Compresses", "the", "given", "files", "into", "a", "ZIP", "file", ".", "<p", ">", "The", "ZIP", "file", "must", "not", "be", "a", "directory", "and", "its", "parent", "directory", "must", "exist", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L1493-L1495
apache/incubator-druid
extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java
ApproximateHistogram.fromBytesDense
public static ApproximateHistogram fromBytesDense(ByteBuffer buf) { """ Constructs an ApproximateHistogram object from the given dense byte-buffer representation @param buf ByteBuffer to construct an ApproximateHistogram from @return ApproximateHistogram constructed from the given ByteBuffer """ int size = buf.getInt(); int binCount = buf.getInt(); float[] positions = new float[size]; long[] bins = new long[size]; buf.asFloatBuffer().get(positions); buf.position(buf.position() + Float.BYTES * positions.length); buf.asLongBuffer().get(bins); buf.position(buf.position() + Long.BYTES * bins.length); float min = buf.getFloat(); float max = buf.getFloat(); return new ApproximateHistogram(binCount, positions, bins, min, max); }
java
public static ApproximateHistogram fromBytesDense(ByteBuffer buf) { int size = buf.getInt(); int binCount = buf.getInt(); float[] positions = new float[size]; long[] bins = new long[size]; buf.asFloatBuffer().get(positions); buf.position(buf.position() + Float.BYTES * positions.length); buf.asLongBuffer().get(bins); buf.position(buf.position() + Long.BYTES * bins.length); float min = buf.getFloat(); float max = buf.getFloat(); return new ApproximateHistogram(binCount, positions, bins, min, max); }
[ "public", "static", "ApproximateHistogram", "fromBytesDense", "(", "ByteBuffer", "buf", ")", "{", "int", "size", "=", "buf", ".", "getInt", "(", ")", ";", "int", "binCount", "=", "buf", ".", "getInt", "(", ")", ";", "float", "[", "]", "positions", "=", "new", "float", "[", "size", "]", ";", "long", "[", "]", "bins", "=", "new", "long", "[", "size", "]", ";", "buf", ".", "asFloatBuffer", "(", ")", ".", "get", "(", "positions", ")", ";", "buf", ".", "position", "(", "buf", ".", "position", "(", ")", "+", "Float", ".", "BYTES", "*", "positions", ".", "length", ")", ";", "buf", ".", "asLongBuffer", "(", ")", ".", "get", "(", "bins", ")", ";", "buf", ".", "position", "(", "buf", ".", "position", "(", ")", "+", "Long", ".", "BYTES", "*", "bins", ".", "length", ")", ";", "float", "min", "=", "buf", ".", "getFloat", "(", ")", ";", "float", "max", "=", "buf", ".", "getFloat", "(", ")", ";", "return", "new", "ApproximateHistogram", "(", "binCount", ",", "positions", ",", "bins", ",", "min", ",", "max", ")", ";", "}" ]
Constructs an ApproximateHistogram object from the given dense byte-buffer representation @param buf ByteBuffer to construct an ApproximateHistogram from @return ApproximateHistogram constructed from the given ByteBuffer
[ "Constructs", "an", "ApproximateHistogram", "object", "from", "the", "given", "dense", "byte", "-", "buffer", "representation" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/extensions-core/histogram/src/main/java/org/apache/druid/query/aggregation/histogram/ApproximateHistogram.java#L1310-L1327
Azure/azure-sdk-for-java
eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java
TopicsInner.listSharedAccessKeysAsync
public Observable<TopicSharedAccessKeysInner> listSharedAccessKeysAsync(String resourceGroupName, String topicName) { """ List keys for a topic. List the two keys used to publish to a topic. @param resourceGroupName The name of the resource group within the user's subscription. @param topicName Name of the topic @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TopicSharedAccessKeysInner object """ return listSharedAccessKeysWithServiceResponseAsync(resourceGroupName, topicName).map(new Func1<ServiceResponse<TopicSharedAccessKeysInner>, TopicSharedAccessKeysInner>() { @Override public TopicSharedAccessKeysInner call(ServiceResponse<TopicSharedAccessKeysInner> response) { return response.body(); } }); }
java
public Observable<TopicSharedAccessKeysInner> listSharedAccessKeysAsync(String resourceGroupName, String topicName) { return listSharedAccessKeysWithServiceResponseAsync(resourceGroupName, topicName).map(new Func1<ServiceResponse<TopicSharedAccessKeysInner>, TopicSharedAccessKeysInner>() { @Override public TopicSharedAccessKeysInner call(ServiceResponse<TopicSharedAccessKeysInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TopicSharedAccessKeysInner", ">", "listSharedAccessKeysAsync", "(", "String", "resourceGroupName", ",", "String", "topicName", ")", "{", "return", "listSharedAccessKeysWithServiceResponseAsync", "(", "resourceGroupName", ",", "topicName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "TopicSharedAccessKeysInner", ">", ",", "TopicSharedAccessKeysInner", ">", "(", ")", "{", "@", "Override", "public", "TopicSharedAccessKeysInner", "call", "(", "ServiceResponse", "<", "TopicSharedAccessKeysInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
List keys for a topic. List the two keys used to publish to a topic. @param resourceGroupName The name of the resource group within the user's subscription. @param topicName Name of the topic @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TopicSharedAccessKeysInner object
[ "List", "keys", "for", "a", "topic", ".", "List", "the", "two", "keys", "used", "to", "publish", "to", "a", "topic", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventgrid/resource-manager/v2019_01_01/src/main/java/com/microsoft/azure/management/eventgrid/v2019_01_01/implementation/TopicsInner.java#L1103-L1110
BoltsFramework/Bolts-Android
bolts-tasks/src/main/java/bolts/Task.java
Task.onSuccessTask
public <TContinuationResult> Task<TContinuationResult> onSuccessTask( final Continuation<TResult, Task<TContinuationResult>> continuation) { """ Runs a continuation when a task completes successfully, forwarding along {@link java.lang.Exception}s or cancellation. """ return onSuccessTask(continuation, IMMEDIATE_EXECUTOR); }
java
public <TContinuationResult> Task<TContinuationResult> onSuccessTask( final Continuation<TResult, Task<TContinuationResult>> continuation) { return onSuccessTask(continuation, IMMEDIATE_EXECUTOR); }
[ "public", "<", "TContinuationResult", ">", "Task", "<", "TContinuationResult", ">", "onSuccessTask", "(", "final", "Continuation", "<", "TResult", ",", "Task", "<", "TContinuationResult", ">", ">", "continuation", ")", "{", "return", "onSuccessTask", "(", "continuation", ",", "IMMEDIATE_EXECUTOR", ")", ";", "}" ]
Runs a continuation when a task completes successfully, forwarding along {@link java.lang.Exception}s or cancellation.
[ "Runs", "a", "continuation", "when", "a", "task", "completes", "successfully", "forwarding", "along", "{" ]
train
https://github.com/BoltsFramework/Bolts-Android/blob/54e9cb8bdd4950aa4d418dcbc0ea65414762aef5/bolts-tasks/src/main/java/bolts/Task.java#L825-L828
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/source/SourceService.java
SourceService.getLinesAsRawText
public Optional<Iterable<String>> getLinesAsRawText(DbSession dbSession, String fileUuid, int from, int toInclusive) { """ Returns a range of lines as raw text. @see #getLines(DbSession, String, int, int) """ return getLines(dbSession, fileUuid, from, toInclusive, DbFileSources.Line::getSource); }
java
public Optional<Iterable<String>> getLinesAsRawText(DbSession dbSession, String fileUuid, int from, int toInclusive) { return getLines(dbSession, fileUuid, from, toInclusive, DbFileSources.Line::getSource); }
[ "public", "Optional", "<", "Iterable", "<", "String", ">", ">", "getLinesAsRawText", "(", "DbSession", "dbSession", ",", "String", "fileUuid", ",", "int", "from", ",", "int", "toInclusive", ")", "{", "return", "getLines", "(", "dbSession", ",", "fileUuid", ",", "from", ",", "toInclusive", ",", "DbFileSources", ".", "Line", "::", "getSource", ")", ";", "}" ]
Returns a range of lines as raw text. @see #getLines(DbSession, String, int, int)
[ "Returns", "a", "range", "of", "lines", "as", "raw", "text", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/source/SourceService.java#L57-L59
Netflix/netflix-graph
src/main/java/com/netflix/nfgraph/NFGraph.java
NFGraph.getConnectionSet
public OrdinalSet getConnectionSet(String connectionModel, String nodeType, int ordinal, String propertyName) { """ Retrieve an {@link OrdinalSet} over all connected ordinals in a given connection model, given the type and ordinal of the originating node, and the property by which this node is connected. @return an {@link OrdinalSet} over all connected ordinals """ int connectionModelIndex = modelHolder.getModelIndex(connectionModel); return getConnectionSet(connectionModelIndex, nodeType, ordinal, propertyName); }
java
public OrdinalSet getConnectionSet(String connectionModel, String nodeType, int ordinal, String propertyName) { int connectionModelIndex = modelHolder.getModelIndex(connectionModel); return getConnectionSet(connectionModelIndex, nodeType, ordinal, propertyName); }
[ "public", "OrdinalSet", "getConnectionSet", "(", "String", "connectionModel", ",", "String", "nodeType", ",", "int", "ordinal", ",", "String", "propertyName", ")", "{", "int", "connectionModelIndex", "=", "modelHolder", ".", "getModelIndex", "(", "connectionModel", ")", ";", "return", "getConnectionSet", "(", "connectionModelIndex", ",", "nodeType", ",", "ordinal", ",", "propertyName", ")", ";", "}" ]
Retrieve an {@link OrdinalSet} over all connected ordinals in a given connection model, given the type and ordinal of the originating node, and the property by which this node is connected. @return an {@link OrdinalSet} over all connected ordinals
[ "Retrieve", "an", "{", "@link", "OrdinalSet", "}", "over", "all", "connected", "ordinals", "in", "a", "given", "connection", "model", "given", "the", "type", "and", "ordinal", "of", "the", "originating", "node", "and", "the", "property", "by", "which", "this", "node", "is", "connected", "." ]
train
https://github.com/Netflix/netflix-graph/blob/ee129252a08a9f51dd296d6fca2f0b28b7be284e/src/main/java/com/netflix/nfgraph/NFGraph.java#L153-L156
avast/syringe
src/main/java/com/avast/syringe/aop/AroundInterceptor.java
AroundInterceptor.handleException
public Throwable handleException(T proxy, Method method, Object[] args, Throwable cause, Map<String, Object> context) { """ Handle exception caused by: <ul> <li>Target method code itself.</li> <li>Invocation of the original method. These exceptions won't be wrapped into {@link java.lang.reflect.InvocationTargetException}.</li> </ul> <p> The implementation is not allowed to throw a checked exception. Exceptional behavior should be expressed by returning a result. </p> @param proxy The proxied instance. @param method Intercepted method. @param args Array of arguments, primitive types are boxed. @param cause The original exception (throwable). @param context @return The resulting exception to be thrown. """ //Just return the cause return cause; }
java
public Throwable handleException(T proxy, Method method, Object[] args, Throwable cause, Map<String, Object> context) { //Just return the cause return cause; }
[ "public", "Throwable", "handleException", "(", "T", "proxy", ",", "Method", "method", ",", "Object", "[", "]", "args", ",", "Throwable", "cause", ",", "Map", "<", "String", ",", "Object", ">", "context", ")", "{", "//Just return the cause", "return", "cause", ";", "}" ]
Handle exception caused by: <ul> <li>Target method code itself.</li> <li>Invocation of the original method. These exceptions won't be wrapped into {@link java.lang.reflect.InvocationTargetException}.</li> </ul> <p> The implementation is not allowed to throw a checked exception. Exceptional behavior should be expressed by returning a result. </p> @param proxy The proxied instance. @param method Intercepted method. @param args Array of arguments, primitive types are boxed. @param cause The original exception (throwable). @param context @return The resulting exception to be thrown.
[ "Handle", "exception", "caused", "by", ":", "<ul", ">", "<li", ">", "Target", "method", "code", "itself", ".", "<", "/", "li", ">", "<li", ">", "Invocation", "of", "the", "original", "method", ".", "These", "exceptions", "won", "t", "be", "wrapped", "into", "{", "@link", "java", ".", "lang", ".", "reflect", ".", "InvocationTargetException", "}", ".", "<", "/", "li", ">", "<", "/", "ul", ">", "<p", ">", "The", "implementation", "is", "not", "allowed", "to", "throw", "a", "checked", "exception", ".", "Exceptional", "behavior", "should", "be", "expressed", "by", "returning", "a", "result", ".", "<", "/", "p", ">" ]
train
https://github.com/avast/syringe/blob/762da5e50776f2bc028e0cf17eac9bd09b5b6aab/src/main/java/com/avast/syringe/aop/AroundInterceptor.java#L93-L96
OpenLiberty/open-liberty
dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/RangeStatisticImpl.java
RangeStatisticImpl.setWaterMark
public void setWaterMark(long curTime, long val) { """ /* Non-Synchronizable: counter is "replaced" with the input value. Caller should synchronize. """ lastSampleTime = curTime; if (!initWaterMark) { lowWaterMark = highWaterMark = val; initWaterMark = true; } else { if (val < lowWaterMark) lowWaterMark = val; if (val > highWaterMark) highWaterMark = val; } /* * if(val < lowWaterMark || lowWaterMark < 0) * lowWaterMark = val; * * if(val > highWaterMark) * highWaterMark = val; */ current = val; }
java
public void setWaterMark(long curTime, long val) { lastSampleTime = curTime; if (!initWaterMark) { lowWaterMark = highWaterMark = val; initWaterMark = true; } else { if (val < lowWaterMark) lowWaterMark = val; if (val > highWaterMark) highWaterMark = val; } /* * if(val < lowWaterMark || lowWaterMark < 0) * lowWaterMark = val; * * if(val > highWaterMark) * highWaterMark = val; */ current = val; }
[ "public", "void", "setWaterMark", "(", "long", "curTime", ",", "long", "val", ")", "{", "lastSampleTime", "=", "curTime", ";", "if", "(", "!", "initWaterMark", ")", "{", "lowWaterMark", "=", "highWaterMark", "=", "val", ";", "initWaterMark", "=", "true", ";", "}", "else", "{", "if", "(", "val", "<", "lowWaterMark", ")", "lowWaterMark", "=", "val", ";", "if", "(", "val", ">", "highWaterMark", ")", "highWaterMark", "=", "val", ";", "}", "/*\n * if(val < lowWaterMark || lowWaterMark < 0)\n * lowWaterMark = val;\n * \n * if(val > highWaterMark)\n * highWaterMark = val;\n */", "current", "=", "val", ";", "}" ]
/* Non-Synchronizable: counter is "replaced" with the input value. Caller should synchronize.
[ "/", "*", "Non", "-", "Synchronizable", ":", "counter", "is", "replaced", "with", "the", "input", "value", ".", "Caller", "should", "synchronize", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.monitor/src/com/ibm/ws/pmi/stat/RangeStatisticImpl.java#L117-L138
javagl/CommonUI
src/main/java/de/javagl/common/ui/JTrees.java
JTrees.findNode
public static DefaultMutableTreeNode findNode( TreeModel treeModel, Object userObject) { """ Returns the first node with the given user object in the tree with the given model. This assumes that the user object is stored in a DefaultMutableTreeNode. Returns <code>null</code> if no matching node is found. @param treeModel The tree model @param userObject The user object @return The node with the given user object, or <code>null</code> """ return findNode(treeModel, treeModel.getRoot(), userObject); }
java
public static DefaultMutableTreeNode findNode( TreeModel treeModel, Object userObject) { return findNode(treeModel, treeModel.getRoot(), userObject); }
[ "public", "static", "DefaultMutableTreeNode", "findNode", "(", "TreeModel", "treeModel", ",", "Object", "userObject", ")", "{", "return", "findNode", "(", "treeModel", ",", "treeModel", ".", "getRoot", "(", ")", ",", "userObject", ")", ";", "}" ]
Returns the first node with the given user object in the tree with the given model. This assumes that the user object is stored in a DefaultMutableTreeNode. Returns <code>null</code> if no matching node is found. @param treeModel The tree model @param userObject The user object @return The node with the given user object, or <code>null</code>
[ "Returns", "the", "first", "node", "with", "the", "given", "user", "object", "in", "the", "tree", "with", "the", "given", "model", ".", "This", "assumes", "that", "the", "user", "object", "is", "stored", "in", "a", "DefaultMutableTreeNode", ".", "Returns", "<code", ">", "null<", "/", "code", ">", "if", "no", "matching", "node", "is", "found", "." ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/JTrees.java#L214-L218
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java
EnvironmentSettingsInner.listAsync
public Observable<Page<EnvironmentSettingInner>> listAsync(final String resourceGroupName, final String labAccountName, final String labName) { """ List environment setting in a given lab. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;EnvironmentSettingInner&gt; object """ return listWithServiceResponseAsync(resourceGroupName, labAccountName, labName) .map(new Func1<ServiceResponse<Page<EnvironmentSettingInner>>, Page<EnvironmentSettingInner>>() { @Override public Page<EnvironmentSettingInner> call(ServiceResponse<Page<EnvironmentSettingInner>> response) { return response.body(); } }); }
java
public Observable<Page<EnvironmentSettingInner>> listAsync(final String resourceGroupName, final String labAccountName, final String labName) { return listWithServiceResponseAsync(resourceGroupName, labAccountName, labName) .map(new Func1<ServiceResponse<Page<EnvironmentSettingInner>>, Page<EnvironmentSettingInner>>() { @Override public Page<EnvironmentSettingInner> call(ServiceResponse<Page<EnvironmentSettingInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "EnvironmentSettingInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "labAccountName", ",", "final", "String", "labName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "labAccountName", ",", "labName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "EnvironmentSettingInner", ">", ">", ",", "Page", "<", "EnvironmentSettingInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "EnvironmentSettingInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "EnvironmentSettingInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
List environment setting in a given lab. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;EnvironmentSettingInner&gt; object
[ "List", "environment", "setting", "in", "a", "given", "lab", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/EnvironmentSettingsInner.java#L178-L186
JOML-CI/JOML
src/org/joml/Matrix4f.java
Matrix4f.orthoSymmetricLH
public Matrix4f orthoSymmetricLH(float width, float height, float zNear, float zFar, boolean zZeroToOne) { """ Apply a symmetric orthographic projection transformation for a left-handed coordinate system using the given NDC z range to this matrix. <p> This method is equivalent to calling {@link #orthoLH(float, float, float, float, float, float, boolean) orthoLH()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetricLH(float, float, float, float, boolean) setOrthoSymmetricLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrthoSymmetricLH(float, float, float, float, boolean) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return a matrix holding the result """ return orthoSymmetricLH(width, height, zNear, zFar, zZeroToOne, thisOrNew()); }
java
public Matrix4f orthoSymmetricLH(float width, float height, float zNear, float zFar, boolean zZeroToOne) { return orthoSymmetricLH(width, height, zNear, zFar, zZeroToOne, thisOrNew()); }
[ "public", "Matrix4f", "orthoSymmetricLH", "(", "float", "width", ",", "float", "height", ",", "float", "zNear", ",", "float", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "return", "orthoSymmetricLH", "(", "width", ",", "height", ",", "zNear", ",", "zFar", ",", "zZeroToOne", ",", "thisOrNew", "(", ")", ")", ";", "}" ]
Apply a symmetric orthographic projection transformation for a left-handed coordinate system using the given NDC z range to this matrix. <p> This method is equivalent to calling {@link #orthoLH(float, float, float, float, float, float, boolean) orthoLH()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to a symmetric orthographic projection without post-multiplying it, use {@link #setOrthoSymmetricLH(float, float, float, float, boolean) setOrthoSymmetricLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #setOrthoSymmetricLH(float, float, float, float, boolean) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return a matrix holding the result
[ "Apply", "a", "symmetric", "orthographic", "projection", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", "to", "this", "matrix", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", "{", "@link", "#orthoLH", "(", "float", "float", "float", "float", "float", "float", "boolean", ")", "orthoLH", "()", "}", "with", "<code", ">", "left", "=", "-", "width", "/", "2<", "/", "code", ">", "<code", ">", "right", "=", "+", "width", "/", "2<", "/", "code", ">", "<code", ">", "bottom", "=", "-", "height", "/", "2<", "/", "code", ">", "and", "<code", ">", "top", "=", "+", "height", "/", "2<", "/", "code", ">", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "O<", "/", "code", ">", "the", "orthographic", "projection", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "M", "*", "O<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "M", "*", "O", "*", "v<", "/", "code", ">", "the", "orthographic", "projection", "transformation", "will", "be", "applied", "first!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "symmetric", "orthographic", "projection", "without", "post", "-", "multiplying", "it", "use", "{", "@link", "#setOrthoSymmetricLH", "(", "float", "float", "float", "float", "boolean", ")", "setOrthoSymmetricLH", "()", "}", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "www", ".", "songho", ".", "ca", "/", "opengl", "/", "gl_projectionmatrix", ".", "html#ortho", ">", "http", ":", "//", "www", ".", "songho", ".", "ca<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4f.java#L7605-L7607
JOML-CI/JOML
src/org/joml/Matrix4x3d.java
Matrix4x3d.setOrthoSymmetric
public Matrix4x3d setOrthoSymmetric(double width, double height, double zNear, double zFar, boolean zZeroToOne) { """ Set this matrix to be a symmetric orthographic projection transformation for a right-handed coordinate system using the given NDC z range. <p> This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double, boolean) setOrtho()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> In order to apply the symmetric orthographic projection to an already existing transformation, use {@link #orthoSymmetric(double, double, double, double, boolean) orthoSymmetric()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #orthoSymmetric(double, double, double, double, boolean) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this """ m00 = 2.0 / width; m01 = 0.0; m02 = 0.0; m10 = 0.0; m11 = 2.0 / height; m12 = 0.0; m20 = 0.0; m21 = 0.0; m22 = (zZeroToOne ? 1.0 : 2.0) / (zNear - zFar); m30 = 0.0; m31 = 0.0; m32 = (zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar); properties = 0; return this; }
java
public Matrix4x3d setOrthoSymmetric(double width, double height, double zNear, double zFar, boolean zZeroToOne) { m00 = 2.0 / width; m01 = 0.0; m02 = 0.0; m10 = 0.0; m11 = 2.0 / height; m12 = 0.0; m20 = 0.0; m21 = 0.0; m22 = (zZeroToOne ? 1.0 : 2.0) / (zNear - zFar); m30 = 0.0; m31 = 0.0; m32 = (zZeroToOne ? zNear : (zFar + zNear)) / (zNear - zFar); properties = 0; return this; }
[ "public", "Matrix4x3d", "setOrthoSymmetric", "(", "double", "width", ",", "double", "height", ",", "double", "zNear", ",", "double", "zFar", ",", "boolean", "zZeroToOne", ")", "{", "m00", "=", "2.0", "/", "width", ";", "m01", "=", "0.0", ";", "m02", "=", "0.0", ";", "m10", "=", "0.0", ";", "m11", "=", "2.0", "/", "height", ";", "m12", "=", "0.0", ";", "m20", "=", "0.0", ";", "m21", "=", "0.0", ";", "m22", "=", "(", "zZeroToOne", "?", "1.0", ":", "2.0", ")", "/", "(", "zNear", "-", "zFar", ")", ";", "m30", "=", "0.0", ";", "m31", "=", "0.0", ";", "m32", "=", "(", "zZeroToOne", "?", "zNear", ":", "(", "zFar", "+", "zNear", ")", ")", "/", "(", "zNear", "-", "zFar", ")", ";", "properties", "=", "0", ";", "return", "this", ";", "}" ]
Set this matrix to be a symmetric orthographic projection transformation for a right-handed coordinate system using the given NDC z range. <p> This method is equivalent to calling {@link #setOrtho(double, double, double, double, double, double, boolean) setOrtho()} with <code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>. <p> In order to apply the symmetric orthographic projection to an already existing transformation, use {@link #orthoSymmetric(double, double, double, double, boolean) orthoSymmetric()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #orthoSymmetric(double, double, double, double, boolean) @param width the distance between the right and left frustum edges @param height the distance between the top and bottom frustum edges @param zNear near clipping plane distance @param zFar far clipping plane distance @param zZeroToOne whether to use Vulkan's and Direct3D's NDC z range of <code>[0..+1]</code> when <code>true</code> or whether to use OpenGL's NDC z range of <code>[-1..+1]</code> when <code>false</code> @return this
[ "Set", "this", "matrix", "to", "be", "a", "symmetric", "orthographic", "projection", "transformation", "for", "a", "right", "-", "handed", "coordinate", "system", "using", "the", "given", "NDC", "z", "range", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", "{", "@link", "#setOrtho", "(", "double", "double", "double", "double", "double", "double", "boolean", ")", "setOrtho", "()", "}", "with", "<code", ">", "left", "=", "-", "width", "/", "2<", "/", "code", ">", "<code", ">", "right", "=", "+", "width", "/", "2<", "/", "code", ">", "<code", ">", "bottom", "=", "-", "height", "/", "2<", "/", "code", ">", "and", "<code", ">", "top", "=", "+", "height", "/", "2<", "/", "code", ">", ".", "<p", ">", "In", "order", "to", "apply", "the", "symmetric", "orthographic", "projection", "to", "an", "already", "existing", "transformation", "use", "{", "@link", "#orthoSymmetric", "(", "double", "double", "double", "double", "boolean", ")", "orthoSymmetric", "()", "}", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "www", ".", "songho", ".", "ca", "/", "opengl", "/", "gl_projectionmatrix", ".", "html#ortho", ">", "http", ":", "//", "www", ".", "songho", ".", "ca<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L7391-L7406
joestelmach/natty
src/main/java/com/joestelmach/natty/Parser.java
Parser.addGroup
private void addGroup(List<Token> group, List<List<Token>> groups) { """ Cleans up the given group and adds it to the list of groups if still valid @param group @param groups """ if(group.isEmpty()) return; // remove trailing tokens that should be ignored while(!group.isEmpty() && IGNORED_TRAILING_TOKENS.contains( group.get(group.size() - 1).getType())) { group.remove(group.size() - 1); } // if the group still has some tokens left, we'll add it to our list of groups if(!group.isEmpty()) { groups.add(group); } }
java
private void addGroup(List<Token> group, List<List<Token>> groups) { if(group.isEmpty()) return; // remove trailing tokens that should be ignored while(!group.isEmpty() && IGNORED_TRAILING_TOKENS.contains( group.get(group.size() - 1).getType())) { group.remove(group.size() - 1); } // if the group still has some tokens left, we'll add it to our list of groups if(!group.isEmpty()) { groups.add(group); } }
[ "private", "void", "addGroup", "(", "List", "<", "Token", ">", "group", ",", "List", "<", "List", "<", "Token", ">", ">", "groups", ")", "{", "if", "(", "group", ".", "isEmpty", "(", ")", ")", "return", ";", "// remove trailing tokens that should be ignored", "while", "(", "!", "group", ".", "isEmpty", "(", ")", "&&", "IGNORED_TRAILING_TOKENS", ".", "contains", "(", "group", ".", "get", "(", "group", ".", "size", "(", ")", "-", "1", ")", ".", "getType", "(", ")", ")", ")", "{", "group", ".", "remove", "(", "group", ".", "size", "(", ")", "-", "1", ")", ";", "}", "// if the group still has some tokens left, we'll add it to our list of groups", "if", "(", "!", "group", ".", "isEmpty", "(", ")", ")", "{", "groups", ".", "add", "(", "group", ")", ";", "}", "}" ]
Cleans up the given group and adds it to the list of groups if still valid @param group @param groups
[ "Cleans", "up", "the", "given", "group", "and", "adds", "it", "to", "the", "list", "of", "groups", "if", "still", "valid" ]
train
https://github.com/joestelmach/natty/blob/74389feb4c9372e51cd51eb0800a0177fec3e5a0/src/main/java/com/joestelmach/natty/Parser.java#L333-L347
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/Validate.java
Validate.isFalse
public static void isFalse(final boolean expression, final String message, final long value) { """ <p>Validate that the argument condition is {@code false}; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean expression, such as validating a primitive number or using your own custom validation expression.</p> <pre> Validate.isFalse(age &lt;= 20, "The age must be greater than 20: &#37;d", age); </pre> <p>For performance reasons, the long value is passed as a separate parameter and appended to the exception message only in the case of an error.</p> @param expression the boolean expression to check @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param value the value to append to the message when invalid @throws IllegalArgumentValidationException if expression is {@code true} @see #isFalse(boolean) @see #isFalse(boolean, String, double) @see #isFalse(boolean, String, Object...) """ INSTANCE.isFalse(expression, message, value); }
java
public static void isFalse(final boolean expression, final String message, final long value) { INSTANCE.isFalse(expression, message, value); }
[ "public", "static", "void", "isFalse", "(", "final", "boolean", "expression", ",", "final", "String", "message", ",", "final", "long", "value", ")", "{", "INSTANCE", ".", "isFalse", "(", "expression", ",", "message", ",", "value", ")", ";", "}" ]
<p>Validate that the argument condition is {@code false}; otherwise throwing an exception with the specified message. This method is useful when validating according to an arbitrary boolean expression, such as validating a primitive number or using your own custom validation expression.</p> <pre> Validate.isFalse(age &lt;= 20, "The age must be greater than 20: &#37;d", age); </pre> <p>For performance reasons, the long value is passed as a separate parameter and appended to the exception message only in the case of an error.</p> @param expression the boolean expression to check @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param value the value to append to the message when invalid @throws IllegalArgumentValidationException if expression is {@code true} @see #isFalse(boolean) @see #isFalse(boolean, String, double) @see #isFalse(boolean, String, Object...)
[ "<p", ">", "Validate", "that", "the", "argument", "condition", "is", "{", "@code", "false", "}", ";", "otherwise", "throwing", "an", "exception", "with", "the", "specified", "message", ".", "This", "method", "is", "useful", "when", "validating", "according", "to", "an", "arbitrary", "boolean", "expression", "such", "as", "validating", "a", "primitive", "number", "or", "using", "your", "own", "custom", "validation", "expression", ".", "<", "/", "p", ">", "<pre", ">", "Validate", ".", "isFalse", "(", "age", "&lt", ";", "=", "20", "The", "age", "must", "be", "greater", "than", "20", ":", "&#37", ";", "d", "age", ")", ";", "<", "/", "pre", ">", "<p", ">", "For", "performance", "reasons", "the", "long", "value", "is", "passed", "as", "a", "separate", "parameter", "and", "appended", "to", "the", "exception", "message", "only", "in", "the", "case", "of", "an", "error", ".", "<", "/", "p", ">" ]
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/Validate.java#L561-L563
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnGatewaysInner.java
P2sVpnGatewaysInner.createOrUpdateAsync
public Observable<P2SVpnGatewayInner> createOrUpdateAsync(String resourceGroupName, String gatewayName, P2SVpnGatewayInner p2SVpnGatewayParameters) { """ Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. @param resourceGroupName The resource group name of the P2SVpnGateway. @param gatewayName The name of the gateway. @param p2SVpnGatewayParameters Parameters supplied to create or Update a virtual wan p2s vpn gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, p2SVpnGatewayParameters).map(new Func1<ServiceResponse<P2SVpnGatewayInner>, P2SVpnGatewayInner>() { @Override public P2SVpnGatewayInner call(ServiceResponse<P2SVpnGatewayInner> response) { return response.body(); } }); }
java
public Observable<P2SVpnGatewayInner> createOrUpdateAsync(String resourceGroupName, String gatewayName, P2SVpnGatewayInner p2SVpnGatewayParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, gatewayName, p2SVpnGatewayParameters).map(new Func1<ServiceResponse<P2SVpnGatewayInner>, P2SVpnGatewayInner>() { @Override public P2SVpnGatewayInner call(ServiceResponse<P2SVpnGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "P2SVpnGatewayInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "gatewayName", ",", "P2SVpnGatewayInner", "p2SVpnGatewayParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "gatewayName", ",", "p2SVpnGatewayParameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "P2SVpnGatewayInner", ">", ",", "P2SVpnGatewayInner", ">", "(", ")", "{", "@", "Override", "public", "P2SVpnGatewayInner", "call", "(", "ServiceResponse", "<", "P2SVpnGatewayInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. @param resourceGroupName The resource group name of the P2SVpnGateway. @param gatewayName The name of the gateway. @param p2SVpnGatewayParameters Parameters supplied to create or Update a virtual wan p2s vpn gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "a", "virtual", "wan", "p2s", "vpn", "gateway", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "gateway", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnGatewaysInner.java#L250-L257
couchbase/couchbase-lite-java-core
src/main/java/com/couchbase/lite/UnsavedRevision.java
UnsavedRevision.setAttachment
@InterfaceAudience.Public public void setAttachment(String name, String contentType, URL contentStreamURL) { """ Sets the attachment with the given name. The Attachment data will be written to the Database when the Revision is saved. @param name The name of the Attachment to set. @param contentType The content-type of the Attachment. @param contentStreamURL The URL that contains the Attachment content. """ try { InputStream inputStream = contentStreamURL.openStream(); setAttachment(name, contentType, inputStream); } catch (IOException e) { Log.e(Database.TAG, "Error opening stream for url: %s", contentStreamURL); throw new RuntimeException(e); } }
java
@InterfaceAudience.Public public void setAttachment(String name, String contentType, URL contentStreamURL) { try { InputStream inputStream = contentStreamURL.openStream(); setAttachment(name, contentType, inputStream); } catch (IOException e) { Log.e(Database.TAG, "Error opening stream for url: %s", contentStreamURL); throw new RuntimeException(e); } }
[ "@", "InterfaceAudience", ".", "Public", "public", "void", "setAttachment", "(", "String", "name", ",", "String", "contentType", ",", "URL", "contentStreamURL", ")", "{", "try", "{", "InputStream", "inputStream", "=", "contentStreamURL", ".", "openStream", "(", ")", ";", "setAttachment", "(", "name", ",", "contentType", ",", "inputStream", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "Log", ".", "e", "(", "Database", ".", "TAG", ",", "\"Error opening stream for url: %s\"", ",", "contentStreamURL", ")", ";", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Sets the attachment with the given name. The Attachment data will be written to the Database when the Revision is saved. @param name The name of the Attachment to set. @param contentType The content-type of the Attachment. @param contentStreamURL The URL that contains the Attachment content.
[ "Sets", "the", "attachment", "with", "the", "given", "name", ".", "The", "Attachment", "data", "will", "be", "written", "to", "the", "Database", "when", "the", "Revision", "is", "saved", "." ]
train
https://github.com/couchbase/couchbase-lite-java-core/blob/3b275642e2d2f231fd155ad9def9c5e9eff3118e/src/main/java/com/couchbase/lite/UnsavedRevision.java#L183-L192
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObjectRef.java
JsiiObjectRef.fromObjId
public static JsiiObjectRef fromObjId(final String objId) { """ Creates an object ref from an object ID. @param objId Object ID. @return The new object ref. """ ObjectNode node = JsonNodeFactory.instance.objectNode(); node.put(TOKEN_REF, objId); return new JsiiObjectRef(objId, node); }
java
public static JsiiObjectRef fromObjId(final String objId) { ObjectNode node = JsonNodeFactory.instance.objectNode(); node.put(TOKEN_REF, objId); return new JsiiObjectRef(objId, node); }
[ "public", "static", "JsiiObjectRef", "fromObjId", "(", "final", "String", "objId", ")", "{", "ObjectNode", "node", "=", "JsonNodeFactory", ".", "instance", ".", "objectNode", "(", ")", ";", "node", ".", "put", "(", "TOKEN_REF", ",", "objId", ")", ";", "return", "new", "JsiiObjectRef", "(", "objId", ",", "node", ")", ";", "}" ]
Creates an object ref from an object ID. @param objId Object ID. @return The new object ref.
[ "Creates", "an", "object", "ref", "from", "an", "object", "ID", "." ]
train
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiObjectRef.java#L63-L67
Whiley/WhileyCompiler
src/main/java/wyil/transform/VerificationConditionGenerator.java
VerificationConditionGenerator.translateConstantDeclaration
private void translateConstantDeclaration(WyilFile.Decl.StaticVariable decl) { """ Translate a constant declaration into WyAL. At the moment, this does nothing because constant declarations are not supported in WyAL files. @param declaration The type declaration being translated. @param wyalFile The WyAL file being constructed """ if (decl.hasInitialiser()) { // The environments are needed to prevent clashes between variable // versions across verification conditions, and also to type variables // used in verification conditions. GlobalEnvironment globalEnvironment = new GlobalEnvironment(decl); LocalEnvironment localEnvironment = new LocalEnvironment(globalEnvironment); List<VerificationCondition> vcs = new ArrayList<>(); Context context = new Context(wyalFile, AssumptionSet.ROOT, localEnvironment, localEnvironment, null, vcs); // Pair<Expr, Context> rp = translateExpressionWithChecks(decl.getInitialiser(), null, context); generateTypeInvariantCheck(decl.getType(), rp.first(), context); // Translate each generated verification condition into an assertion in // the underlying WyalFile. createAssertions(decl, vcs, globalEnvironment); } }
java
private void translateConstantDeclaration(WyilFile.Decl.StaticVariable decl) { if (decl.hasInitialiser()) { // The environments are needed to prevent clashes between variable // versions across verification conditions, and also to type variables // used in verification conditions. GlobalEnvironment globalEnvironment = new GlobalEnvironment(decl); LocalEnvironment localEnvironment = new LocalEnvironment(globalEnvironment); List<VerificationCondition> vcs = new ArrayList<>(); Context context = new Context(wyalFile, AssumptionSet.ROOT, localEnvironment, localEnvironment, null, vcs); // Pair<Expr, Context> rp = translateExpressionWithChecks(decl.getInitialiser(), null, context); generateTypeInvariantCheck(decl.getType(), rp.first(), context); // Translate each generated verification condition into an assertion in // the underlying WyalFile. createAssertions(decl, vcs, globalEnvironment); } }
[ "private", "void", "translateConstantDeclaration", "(", "WyilFile", ".", "Decl", ".", "StaticVariable", "decl", ")", "{", "if", "(", "decl", ".", "hasInitialiser", "(", ")", ")", "{", "// The environments are needed to prevent clashes between variable", "// versions across verification conditions, and also to type variables", "// used in verification conditions.", "GlobalEnvironment", "globalEnvironment", "=", "new", "GlobalEnvironment", "(", "decl", ")", ";", "LocalEnvironment", "localEnvironment", "=", "new", "LocalEnvironment", "(", "globalEnvironment", ")", ";", "List", "<", "VerificationCondition", ">", "vcs", "=", "new", "ArrayList", "<>", "(", ")", ";", "Context", "context", "=", "new", "Context", "(", "wyalFile", ",", "AssumptionSet", ".", "ROOT", ",", "localEnvironment", ",", "localEnvironment", ",", "null", ",", "vcs", ")", ";", "//", "Pair", "<", "Expr", ",", "Context", ">", "rp", "=", "translateExpressionWithChecks", "(", "decl", ".", "getInitialiser", "(", ")", ",", "null", ",", "context", ")", ";", "generateTypeInvariantCheck", "(", "decl", ".", "getType", "(", ")", ",", "rp", ".", "first", "(", ")", ",", "context", ")", ";", "// Translate each generated verification condition into an assertion in", "// the underlying WyalFile.", "createAssertions", "(", "decl", ",", "vcs", ",", "globalEnvironment", ")", ";", "}", "}" ]
Translate a constant declaration into WyAL. At the moment, this does nothing because constant declarations are not supported in WyAL files. @param declaration The type declaration being translated. @param wyalFile The WyAL file being constructed
[ "Translate", "a", "constant", "declaration", "into", "WyAL", ".", "At", "the", "moment", "this", "does", "nothing", "because", "constant", "declarations", "are", "not", "supported", "in", "WyAL", "files", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L164-L180
nguyenq/tess4j
src/main/java/net/sourceforge/tess4j/util/PdfUtilities.java
PdfUtilities.mergePdf
public static void mergePdf(File[] inputPdfFiles, File outputPdfFile) { """ Merges PDF files. @param inputPdfFiles array of input files @param outputPdfFile output file """ if (PDFBOX.equals(System.getProperty(PDF_LIBRARY))) { PdfBoxUtilities.mergePdf(inputPdfFiles, outputPdfFile); } else { try { PdfGsUtilities.mergePdf(inputPdfFiles, outputPdfFile); } catch (Exception e) { System.setProperty(PDF_LIBRARY, PDFBOX); mergePdf(inputPdfFiles, outputPdfFile); } } }
java
public static void mergePdf(File[] inputPdfFiles, File outputPdfFile) { if (PDFBOX.equals(System.getProperty(PDF_LIBRARY))) { PdfBoxUtilities.mergePdf(inputPdfFiles, outputPdfFile); } else { try { PdfGsUtilities.mergePdf(inputPdfFiles, outputPdfFile); } catch (Exception e) { System.setProperty(PDF_LIBRARY, PDFBOX); mergePdf(inputPdfFiles, outputPdfFile); } } }
[ "public", "static", "void", "mergePdf", "(", "File", "[", "]", "inputPdfFiles", ",", "File", "outputPdfFile", ")", "{", "if", "(", "PDFBOX", ".", "equals", "(", "System", ".", "getProperty", "(", "PDF_LIBRARY", ")", ")", ")", "{", "PdfBoxUtilities", ".", "mergePdf", "(", "inputPdfFiles", ",", "outputPdfFile", ")", ";", "}", "else", "{", "try", "{", "PdfGsUtilities", ".", "mergePdf", "(", "inputPdfFiles", ",", "outputPdfFile", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "System", ".", "setProperty", "(", "PDF_LIBRARY", ",", "PDFBOX", ")", ";", "mergePdf", "(", "inputPdfFiles", ",", "outputPdfFile", ")", ";", "}", "}", "}" ]
Merges PDF files. @param inputPdfFiles array of input files @param outputPdfFile output file
[ "Merges", "PDF", "files", "." ]
train
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/PdfUtilities.java#L151-L162
PistoiaHELM/HELM2NotationToolkit
src/main/java/org/helm/notation2/tools/RNAUtils.java
RNAUtils.getMaxMatchFragment
public static String getMaxMatchFragment(String seq1, String seq2) throws NotationException { """ method to get the largest matched fragment between two sequences, replace T with U before Match @param seq1 single letter, all upper case nucleotide sequence @param seq2 single letter, all upper case nucleotide sequence @return maximal match fragment of seq1 and seq2 @throws NotationException if the notation is not valid """ return getMaxMatchFragment(seq1, seq2, MINUMUM_MATCH_FRAGMENT_LENGTH); }
java
public static String getMaxMatchFragment(String seq1, String seq2) throws NotationException { return getMaxMatchFragment(seq1, seq2, MINUMUM_MATCH_FRAGMENT_LENGTH); }
[ "public", "static", "String", "getMaxMatchFragment", "(", "String", "seq1", ",", "String", "seq2", ")", "throws", "NotationException", "{", "return", "getMaxMatchFragment", "(", "seq1", ",", "seq2", ",", "MINUMUM_MATCH_FRAGMENT_LENGTH", ")", ";", "}" ]
method to get the largest matched fragment between two sequences, replace T with U before Match @param seq1 single letter, all upper case nucleotide sequence @param seq2 single letter, all upper case nucleotide sequence @return maximal match fragment of seq1 and seq2 @throws NotationException if the notation is not valid
[ "method", "to", "get", "the", "largest", "matched", "fragment", "between", "two", "sequences", "replace", "T", "with", "U", "before", "Match" ]
train
https://github.com/PistoiaHELM/HELM2NotationToolkit/blob/ac5bb01fd5b4082134a8ef226bbe2ff0f60fcd38/src/main/java/org/helm/notation2/tools/RNAUtils.java#L171-L173
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/EpicsApi.java
EpicsApi.deleteEpic
public void deleteEpic(Object groupIdOrPath, Integer epicIid) throws GitLabApiException { """ Deletes an epic. <pre><code>GitLab Endpoint: DELETE /groups/:id/epics/:epic_iid</code></pre> @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path @param epicIid the IID of the epic to delete @throws GitLabApiException if any exception occurs """ delete(Response.Status.NO_CONTENT, null, "groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid); }
java
public void deleteEpic(Object groupIdOrPath, Integer epicIid) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid); }
[ "public", "void", "deleteEpic", "(", "Object", "groupIdOrPath", ",", "Integer", "epicIid", ")", "throws", "GitLabApiException", "{", "delete", "(", "Response", ".", "Status", ".", "NO_CONTENT", ",", "null", ",", "\"groups\"", ",", "getGroupIdOrPath", "(", "groupIdOrPath", ")", ",", "\"epics\"", ",", "epicIid", ")", ";", "}" ]
Deletes an epic. <pre><code>GitLab Endpoint: DELETE /groups/:id/epics/:epic_iid</code></pre> @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path @param epicIid the IID of the epic to delete @throws GitLabApiException if any exception occurs
[ "Deletes", "an", "epic", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/EpicsApi.java#L339-L341
line/armeria
core/src/main/java/com/linecorp/armeria/server/cors/CorsService.java
CorsService.handleCorsPreflight
private HttpResponse handleCorsPreflight(ServiceRequestContext ctx, HttpRequest req) { """ Handles CORS preflight by setting the appropriate headers. @param req the decoded HTTP request """ final HttpHeaders headers = HttpHeaders.of(HttpStatus.OK); final CorsPolicy policy = setCorsOrigin(ctx, req, headers); if (policy != null) { policy.setCorsAllowMethods(headers); policy.setCorsAllowHeaders(headers); policy.setCorsAllowCredentials(headers); policy.setCorsMaxAge(headers); policy.setCorsPreflightResponseHeaders(headers); } return HttpResponse.of(headers); }
java
private HttpResponse handleCorsPreflight(ServiceRequestContext ctx, HttpRequest req) { final HttpHeaders headers = HttpHeaders.of(HttpStatus.OK); final CorsPolicy policy = setCorsOrigin(ctx, req, headers); if (policy != null) { policy.setCorsAllowMethods(headers); policy.setCorsAllowHeaders(headers); policy.setCorsAllowCredentials(headers); policy.setCorsMaxAge(headers); policy.setCorsPreflightResponseHeaders(headers); } return HttpResponse.of(headers); }
[ "private", "HttpResponse", "handleCorsPreflight", "(", "ServiceRequestContext", "ctx", ",", "HttpRequest", "req", ")", "{", "final", "HttpHeaders", "headers", "=", "HttpHeaders", ".", "of", "(", "HttpStatus", ".", "OK", ")", ";", "final", "CorsPolicy", "policy", "=", "setCorsOrigin", "(", "ctx", ",", "req", ",", "headers", ")", ";", "if", "(", "policy", "!=", "null", ")", "{", "policy", ".", "setCorsAllowMethods", "(", "headers", ")", ";", "policy", ".", "setCorsAllowHeaders", "(", "headers", ")", ";", "policy", ".", "setCorsAllowCredentials", "(", "headers", ")", ";", "policy", ".", "setCorsMaxAge", "(", "headers", ")", ";", "policy", ".", "setCorsPreflightResponseHeaders", "(", "headers", ")", ";", "}", "return", "HttpResponse", ".", "of", "(", "headers", ")", ";", "}" ]
Handles CORS preflight by setting the appropriate headers. @param req the decoded HTTP request
[ "Handles", "CORS", "preflight", "by", "setting", "the", "appropriate", "headers", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/cors/CorsService.java#L109-L121
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/CmsSitemapTreeItem.java
CmsSitemapTreeItem.addInfo
protected static void addInfo(List<CmsAdditionalInfoBean> infos, String label, String value) { """ Helper method to add an additional info bean to a list.<p> @param infos the list of additional info beans @param label the label for the new bean @param value the value for the new bean """ infos.add(new CmsAdditionalInfoBean(label, value, null)); }
java
protected static void addInfo(List<CmsAdditionalInfoBean> infos, String label, String value) { infos.add(new CmsAdditionalInfoBean(label, value, null)); }
[ "protected", "static", "void", "addInfo", "(", "List", "<", "CmsAdditionalInfoBean", ">", "infos", ",", "String", "label", ",", "String", "value", ")", "{", "infos", ".", "add", "(", "new", "CmsAdditionalInfoBean", "(", "label", ",", "value", ",", "null", ")", ")", ";", "}" ]
Helper method to add an additional info bean to a list.<p> @param infos the list of additional info beans @param label the label for the new bean @param value the value for the new bean
[ "Helper", "method", "to", "add", "an", "additional", "info", "bean", "to", "a", "list", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/CmsSitemapTreeItem.java#L280-L283
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java
ArrayFunctions.arrayPrepend
public static Expression arrayPrepend(Expression expression, Expression value) { """ Returned expression results in the new array with value pre-pended. """ return x("ARRAY_PREPEND(" + value.toString() + ", " + expression.toString() + ")"); }
java
public static Expression arrayPrepend(Expression expression, Expression value) { return x("ARRAY_PREPEND(" + value.toString() + ", " + expression.toString() + ")"); }
[ "public", "static", "Expression", "arrayPrepend", "(", "Expression", "expression", ",", "Expression", "value", ")", "{", "return", "x", "(", "\"ARRAY_PREPEND(\"", "+", "value", ".", "toString", "(", ")", "+", "\", \"", "+", "expression", ".", "toString", "(", ")", "+", "\")\"", ")", ";", "}" ]
Returned expression results in the new array with value pre-pended.
[ "Returned", "expression", "results", "in", "the", "new", "array", "with", "value", "pre", "-", "pended", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/dsl/functions/ArrayFunctions.java#L282-L284
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/QueryParserBase.java
QueryParserBase.appendProjectionOnFields
protected void appendProjectionOnFields(SolrQuery solrQuery, List<Field> fields, @Nullable Class<?> domainType) { """ Append field list to {@link SolrQuery} @param solrQuery @param fields """ if (CollectionUtils.isEmpty(fields)) { return; } List<String> solrReadableFields = new ArrayList<>(); for (Field field : fields) { if (field instanceof CalculatedField) { solrReadableFields.add(createCalculatedFieldFragment((CalculatedField) field, domainType)); } else { solrReadableFields.add(getMappedFieldName(field, domainType)); } } solrQuery.setParam(CommonParams.FL, StringUtils.join(solrReadableFields, ",")); }
java
protected void appendProjectionOnFields(SolrQuery solrQuery, List<Field> fields, @Nullable Class<?> domainType) { if (CollectionUtils.isEmpty(fields)) { return; } List<String> solrReadableFields = new ArrayList<>(); for (Field field : fields) { if (field instanceof CalculatedField) { solrReadableFields.add(createCalculatedFieldFragment((CalculatedField) field, domainType)); } else { solrReadableFields.add(getMappedFieldName(field, domainType)); } } solrQuery.setParam(CommonParams.FL, StringUtils.join(solrReadableFields, ",")); }
[ "protected", "void", "appendProjectionOnFields", "(", "SolrQuery", "solrQuery", ",", "List", "<", "Field", ">", "fields", ",", "@", "Nullable", "Class", "<", "?", ">", "domainType", ")", "{", "if", "(", "CollectionUtils", ".", "isEmpty", "(", "fields", ")", ")", "{", "return", ";", "}", "List", "<", "String", ">", "solrReadableFields", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "Field", "field", ":", "fields", ")", "{", "if", "(", "field", "instanceof", "CalculatedField", ")", "{", "solrReadableFields", ".", "add", "(", "createCalculatedFieldFragment", "(", "(", "CalculatedField", ")", "field", ",", "domainType", ")", ")", ";", "}", "else", "{", "solrReadableFields", ".", "add", "(", "getMappedFieldName", "(", "field", ",", "domainType", ")", ")", ";", "}", "}", "solrQuery", ".", "setParam", "(", "CommonParams", ".", "FL", ",", "StringUtils", ".", "join", "(", "solrReadableFields", ",", "\",\"", ")", ")", ";", "}" ]
Append field list to {@link SolrQuery} @param solrQuery @param fields
[ "Append", "field", "list", "to", "{", "@link", "SolrQuery", "}" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/QueryParserBase.java#L441-L455