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
stripe/stripe-java
src/main/java/com/stripe/model/Invoice.java
Invoice.voidInvoice
public Invoice voidInvoice(RequestOptions options) throws StripeException { """ Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to <a href="#delete_invoice">deletion</a>, however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found. """ return voidInvoice((Map<String, Object>) null, options); }
java
public Invoice voidInvoice(RequestOptions options) throws StripeException { return voidInvoice((Map<String, Object>) null, options); }
[ "public", "Invoice", "voidInvoice", "(", "RequestOptions", "options", ")", "throws", "StripeException", "{", "return", "voidInvoice", "(", "(", "Map", "<", "String", ",", "Object", ">", ")", "null", ",", "options", ")", ";", "}" ]
Mark a finalized invoice as void. This cannot be undone. Voiding an invoice is similar to <a href="#delete_invoice">deletion</a>, however it only applies to finalized invoices and maintains a papertrail where the invoice can still be found.
[ "Mark", "a", "finalized", "invoice", "as", "void", ".", "This", "cannot", "be", "undone", ".", "Voiding", "an", "invoice", "is", "similar", "to", "<a", "href", "=", "#delete_invoice", ">", "deletion<", "/", "a", ">", "however", "it", "only", "applies", "to", "finalized", "invoices", "and", "maintains", "a", "papertrail", "where", "the", "invoice", "can", "still", "be", "found", "." ]
train
https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/model/Invoice.java#L1179-L1181
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsToolbarNewButton.java
CmsToolbarNewButton.makeNewElementItem
private CmsCreatableListItem makeNewElementItem(final CmsNewResourceInfo typeInfo) { """ Create a new-element list item.<p> @param typeInfo the new-element info @return the list item """ CmsListItemWidget widget = new CmsListItemWidget(typeInfo); if ((typeInfo.getDescription() != null) && (typeInfo.getDescription().trim().length() > 0)) { widget.addAdditionalInfo( new CmsAdditionalInfoBean( Messages.get().key(Messages.GUI_LABEL_DESCRIPTION_0), typeInfo.getDescription(), null)); } if (typeInfo.getVfsPath() != null) { widget.addAdditionalInfo( new CmsAdditionalInfoBean( Messages.get().key(Messages.GUI_LABEL_VFSPATH_0), typeInfo.getVfsPath(), null)); } if (typeInfo.getDate() != null) { widget.addAdditionalInfo( new CmsAdditionalInfoBean(Messages.get().key(Messages.GUI_LABEL_DATE_0), typeInfo.getDate(), null)); } CmsCreatableListItem listItem = new CmsCreatableListItem(widget, typeInfo, NewEntryType.regular); listItem.initMoveHandle(CmsSitemapView.getInstance().getTree().getDnDHandler(), true); return listItem; }
java
private CmsCreatableListItem makeNewElementItem(final CmsNewResourceInfo typeInfo) { CmsListItemWidget widget = new CmsListItemWidget(typeInfo); if ((typeInfo.getDescription() != null) && (typeInfo.getDescription().trim().length() > 0)) { widget.addAdditionalInfo( new CmsAdditionalInfoBean( Messages.get().key(Messages.GUI_LABEL_DESCRIPTION_0), typeInfo.getDescription(), null)); } if (typeInfo.getVfsPath() != null) { widget.addAdditionalInfo( new CmsAdditionalInfoBean( Messages.get().key(Messages.GUI_LABEL_VFSPATH_0), typeInfo.getVfsPath(), null)); } if (typeInfo.getDate() != null) { widget.addAdditionalInfo( new CmsAdditionalInfoBean(Messages.get().key(Messages.GUI_LABEL_DATE_0), typeInfo.getDate(), null)); } CmsCreatableListItem listItem = new CmsCreatableListItem(widget, typeInfo, NewEntryType.regular); listItem.initMoveHandle(CmsSitemapView.getInstance().getTree().getDnDHandler(), true); return listItem; }
[ "private", "CmsCreatableListItem", "makeNewElementItem", "(", "final", "CmsNewResourceInfo", "typeInfo", ")", "{", "CmsListItemWidget", "widget", "=", "new", "CmsListItemWidget", "(", "typeInfo", ")", ";", "if", "(", "(", "typeInfo", ".", "getDescription", "(", ")", "!=", "null", ")", "&&", "(", "typeInfo", ".", "getDescription", "(", ")", ".", "trim", "(", ")", ".", "length", "(", ")", ">", "0", ")", ")", "{", "widget", ".", "addAdditionalInfo", "(", "new", "CmsAdditionalInfoBean", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_LABEL_DESCRIPTION_0", ")", ",", "typeInfo", ".", "getDescription", "(", ")", ",", "null", ")", ")", ";", "}", "if", "(", "typeInfo", ".", "getVfsPath", "(", ")", "!=", "null", ")", "{", "widget", ".", "addAdditionalInfo", "(", "new", "CmsAdditionalInfoBean", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_LABEL_VFSPATH_0", ")", ",", "typeInfo", ".", "getVfsPath", "(", ")", ",", "null", ")", ")", ";", "}", "if", "(", "typeInfo", ".", "getDate", "(", ")", "!=", "null", ")", "{", "widget", ".", "addAdditionalInfo", "(", "new", "CmsAdditionalInfoBean", "(", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_LABEL_DATE_0", ")", ",", "typeInfo", ".", "getDate", "(", ")", ",", "null", ")", ")", ";", "}", "CmsCreatableListItem", "listItem", "=", "new", "CmsCreatableListItem", "(", "widget", ",", "typeInfo", ",", "NewEntryType", ".", "regular", ")", ";", "listItem", ".", "initMoveHandle", "(", "CmsSitemapView", ".", "getInstance", "(", ")", ".", "getTree", "(", ")", ".", "getDnDHandler", "(", ")", ",", "true", ")", ";", "return", "listItem", ";", "}" ]
Create a new-element list item.<p> @param typeInfo the new-element info @return the list item
[ "Create", "a", "new", "-", "element", "list", "item", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/toolbar/CmsToolbarNewButton.java#L192-L216
atomix/atomix
cluster/src/main/java/io/atomix/cluster/protocol/SwimMembershipProtocol.java
SwimMembershipProtocol.handleProbe
private ImmutableMember handleProbe(Pair<ImmutableMember, ImmutableMember> members) { """ Handles a probe from another peer. @param members the probing member and local member info @return the current term """ ImmutableMember remoteMember = members.getLeft(); ImmutableMember localMember = members.getRight(); LOGGER.trace("{} - Received probe {} from {}", this.localMember.id(), localMember, remoteMember); // If the probe indicates a term greater than the local term, update the local term, increment and respond. if (localMember.incarnationNumber() > this.localMember.getIncarnationNumber()) { this.localMember.setIncarnationNumber(localMember.incarnationNumber() + 1); if (config.isBroadcastDisputes()) { broadcast(this.localMember.copy()); } } // If the probe indicates this member is suspect, increment the local term and respond. else if (localMember.state() == State.SUSPECT) { this.localMember.setIncarnationNumber(this.localMember.getIncarnationNumber() + 1); if (config.isBroadcastDisputes()) { broadcast(this.localMember.copy()); } } // Update the state of the probing member. updateState(remoteMember); return this.localMember.copy(); }
java
private ImmutableMember handleProbe(Pair<ImmutableMember, ImmutableMember> members) { ImmutableMember remoteMember = members.getLeft(); ImmutableMember localMember = members.getRight(); LOGGER.trace("{} - Received probe {} from {}", this.localMember.id(), localMember, remoteMember); // If the probe indicates a term greater than the local term, update the local term, increment and respond. if (localMember.incarnationNumber() > this.localMember.getIncarnationNumber()) { this.localMember.setIncarnationNumber(localMember.incarnationNumber() + 1); if (config.isBroadcastDisputes()) { broadcast(this.localMember.copy()); } } // If the probe indicates this member is suspect, increment the local term and respond. else if (localMember.state() == State.SUSPECT) { this.localMember.setIncarnationNumber(this.localMember.getIncarnationNumber() + 1); if (config.isBroadcastDisputes()) { broadcast(this.localMember.copy()); } } // Update the state of the probing member. updateState(remoteMember); return this.localMember.copy(); }
[ "private", "ImmutableMember", "handleProbe", "(", "Pair", "<", "ImmutableMember", ",", "ImmutableMember", ">", "members", ")", "{", "ImmutableMember", "remoteMember", "=", "members", ".", "getLeft", "(", ")", ";", "ImmutableMember", "localMember", "=", "members", ".", "getRight", "(", ")", ";", "LOGGER", ".", "trace", "(", "\"{} - Received probe {} from {}\"", ",", "this", ".", "localMember", ".", "id", "(", ")", ",", "localMember", ",", "remoteMember", ")", ";", "// If the probe indicates a term greater than the local term, update the local term, increment and respond.", "if", "(", "localMember", ".", "incarnationNumber", "(", ")", ">", "this", ".", "localMember", ".", "getIncarnationNumber", "(", ")", ")", "{", "this", ".", "localMember", ".", "setIncarnationNumber", "(", "localMember", ".", "incarnationNumber", "(", ")", "+", "1", ")", ";", "if", "(", "config", ".", "isBroadcastDisputes", "(", ")", ")", "{", "broadcast", "(", "this", ".", "localMember", ".", "copy", "(", ")", ")", ";", "}", "}", "// If the probe indicates this member is suspect, increment the local term and respond.", "else", "if", "(", "localMember", ".", "state", "(", ")", "==", "State", ".", "SUSPECT", ")", "{", "this", ".", "localMember", ".", "setIncarnationNumber", "(", "this", ".", "localMember", ".", "getIncarnationNumber", "(", ")", "+", "1", ")", ";", "if", "(", "config", ".", "isBroadcastDisputes", "(", ")", ")", "{", "broadcast", "(", "this", ".", "localMember", ".", "copy", "(", ")", ")", ";", "}", "}", "// Update the state of the probing member.", "updateState", "(", "remoteMember", ")", ";", "return", "this", ".", "localMember", ".", "copy", "(", ")", ";", "}" ]
Handles a probe from another peer. @param members the probing member and local member info @return the current term
[ "Handles", "a", "probe", "from", "another", "peer", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/cluster/src/main/java/io/atomix/cluster/protocol/SwimMembershipProtocol.java#L437-L461
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java
JDBCStorableGenerator.closeResultSet
private void closeResultSet (CodeBuilder b, LocalVariable rsVar, Label tryAfterRs) { """ Generates code which emulates this: ... } finally { rs.close(); } @param rsVar ResultSet variable @param tryAfterRs label right after ResultSet acquisition """ Label contLabel = b.createLabel(); Label endFinallyLabel = b.createLabel().setLocation(); b.loadLocal(rsVar); b.invokeInterface(TypeDesc.forClass(ResultSet.class), "close", null, null); b.branch(contLabel); b.exceptionHandler(tryAfterRs, endFinallyLabel, null); b.loadLocal(rsVar); b.invokeInterface(TypeDesc.forClass(ResultSet.class), "close", null, null); b.throwObject(); contLabel.setLocation(); }
java
private void closeResultSet (CodeBuilder b, LocalVariable rsVar, Label tryAfterRs) { Label contLabel = b.createLabel(); Label endFinallyLabel = b.createLabel().setLocation(); b.loadLocal(rsVar); b.invokeInterface(TypeDesc.forClass(ResultSet.class), "close", null, null); b.branch(contLabel); b.exceptionHandler(tryAfterRs, endFinallyLabel, null); b.loadLocal(rsVar); b.invokeInterface(TypeDesc.forClass(ResultSet.class), "close", null, null); b.throwObject(); contLabel.setLocation(); }
[ "private", "void", "closeResultSet", "(", "CodeBuilder", "b", ",", "LocalVariable", "rsVar", ",", "Label", "tryAfterRs", ")", "{", "Label", "contLabel", "=", "b", ".", "createLabel", "(", ")", ";", "Label", "endFinallyLabel", "=", "b", ".", "createLabel", "(", ")", ".", "setLocation", "(", ")", ";", "b", ".", "loadLocal", "(", "rsVar", ")", ";", "b", ".", "invokeInterface", "(", "TypeDesc", ".", "forClass", "(", "ResultSet", ".", "class", ")", ",", "\"close\"", ",", "null", ",", "null", ")", ";", "b", ".", "branch", "(", "contLabel", ")", ";", "b", ".", "exceptionHandler", "(", "tryAfterRs", ",", "endFinallyLabel", ",", "null", ")", ";", "b", ".", "loadLocal", "(", "rsVar", ")", ";", "b", ".", "invokeInterface", "(", "TypeDesc", ".", "forClass", "(", "ResultSet", ".", "class", ")", ",", "\"close\"", ",", "null", ",", "null", ")", ";", "b", ".", "throwObject", "(", ")", ";", "contLabel", ".", "setLocation", "(", ")", ";", "}" ]
Generates code which emulates this: ... } finally { rs.close(); } @param rsVar ResultSet variable @param tryAfterRs label right after ResultSet acquisition
[ "Generates", "code", "which", "emulates", "this", ":" ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/repo/jdbc/JDBCStorableGenerator.java#L1915-L1931
andrehertwig/admintool
admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/validation/AbstractValidator.java
AbstractValidator.validateDomainObject
protected <S extends Serializable> void validateDomainObject(S domainObject, Set<ATError> errors) { """ validates a domain object with javax.validation annotations @param domainObject @param errors """ Set<ConstraintViolation<S>> constraintViolations = validator.validate( domainObject ); if (CollectionUtils.isEmpty(constraintViolations)) { return; } for ( ConstraintViolation<S> violation : constraintViolations ) { String type = violation.getConstraintDescriptor().getAnnotation().annotationType().getSimpleName(); String attrPath = violation.getPropertyPath().toString(); String msgKey = attrPath + "." + type; if (null != violation.getMessage() && violation.getMessage().startsWith(MSG_KEY_PREFIX)) { msgKey = violation.getMessage(); } errors.add(new ATError((attrPath + "." + type), getMessage(msgKey, new Object[]{attrPath}, violation.getMessage()), attrPath)); } }
java
protected <S extends Serializable> void validateDomainObject(S domainObject, Set<ATError> errors) { Set<ConstraintViolation<S>> constraintViolations = validator.validate( domainObject ); if (CollectionUtils.isEmpty(constraintViolations)) { return; } for ( ConstraintViolation<S> violation : constraintViolations ) { String type = violation.getConstraintDescriptor().getAnnotation().annotationType().getSimpleName(); String attrPath = violation.getPropertyPath().toString(); String msgKey = attrPath + "." + type; if (null != violation.getMessage() && violation.getMessage().startsWith(MSG_KEY_PREFIX)) { msgKey = violation.getMessage(); } errors.add(new ATError((attrPath + "." + type), getMessage(msgKey, new Object[]{attrPath}, violation.getMessage()), attrPath)); } }
[ "protected", "<", "S", "extends", "Serializable", ">", "void", "validateDomainObject", "(", "S", "domainObject", ",", "Set", "<", "ATError", ">", "errors", ")", "{", "Set", "<", "ConstraintViolation", "<", "S", ">>", "constraintViolations", "=", "validator", ".", "validate", "(", "domainObject", ")", ";", "if", "(", "CollectionUtils", ".", "isEmpty", "(", "constraintViolations", ")", ")", "{", "return", ";", "}", "for", "(", "ConstraintViolation", "<", "S", ">", "violation", ":", "constraintViolations", ")", "{", "String", "type", "=", "violation", ".", "getConstraintDescriptor", "(", ")", ".", "getAnnotation", "(", ")", ".", "annotationType", "(", ")", ".", "getSimpleName", "(", ")", ";", "String", "attrPath", "=", "violation", ".", "getPropertyPath", "(", ")", ".", "toString", "(", ")", ";", "String", "msgKey", "=", "attrPath", "+", "\".\"", "+", "type", ";", "if", "(", "null", "!=", "violation", ".", "getMessage", "(", ")", "&&", "violation", ".", "getMessage", "(", ")", ".", "startsWith", "(", "MSG_KEY_PREFIX", ")", ")", "{", "msgKey", "=", "violation", ".", "getMessage", "(", ")", ";", "}", "errors", ".", "add", "(", "new", "ATError", "(", "(", "attrPath", "+", "\".\"", "+", "type", ")", ",", "getMessage", "(", "msgKey", ",", "new", "Object", "[", "]", "{", "attrPath", "}", ",", "violation", ".", "getMessage", "(", ")", ")", ",", "attrPath", ")", ")", ";", "}", "}" ]
validates a domain object with javax.validation annotations @param domainObject @param errors
[ "validates", "a", "domain", "object", "with", "javax", ".", "validation", "annotations" ]
train
https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-security/admin-tools-security-dbuser/src/main/java/de/chandre/admintool/security/dbuser/service/validation/AbstractValidator.java#L105-L119
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java
GridBagLayoutBuilder.appendRightLabel
public GridBagLayoutBuilder appendRightLabel(String labelKey, int colSpan) { """ Appends a right-justified label to the end of the given line, using the provided string as the key to look in the {@link #setComponentFactory(ComponentFactory) ComponentFactory's}message bundle for the text to use. @param labelKey the key into the message bundle; if not found the key is used as the text to display @param colSpan the number of columns to span @return "this" to make it easier to string together append calls """ final JLabel label = createLabel(labelKey); label.setHorizontalAlignment(SwingConstants.RIGHT); return appendLabel(label, colSpan); }
java
public GridBagLayoutBuilder appendRightLabel(String labelKey, int colSpan) { final JLabel label = createLabel(labelKey); label.setHorizontalAlignment(SwingConstants.RIGHT); return appendLabel(label, colSpan); }
[ "public", "GridBagLayoutBuilder", "appendRightLabel", "(", "String", "labelKey", ",", "int", "colSpan", ")", "{", "final", "JLabel", "label", "=", "createLabel", "(", "labelKey", ")", ";", "label", ".", "setHorizontalAlignment", "(", "SwingConstants", ".", "RIGHT", ")", ";", "return", "appendLabel", "(", "label", ",", "colSpan", ")", ";", "}" ]
Appends a right-justified label to the end of the given line, using the provided string as the key to look in the {@link #setComponentFactory(ComponentFactory) ComponentFactory's}message bundle for the text to use. @param labelKey the key into the message bundle; if not found the key is used as the text to display @param colSpan the number of columns to span @return "this" to make it easier to string together append calls
[ "Appends", "a", "right", "-", "justified", "label", "to", "the", "end", "of", "the", "given", "line", "using", "the", "provided", "string", "as", "the", "key", "to", "look", "in", "the", "{", "@link", "#setComponentFactory", "(", "ComponentFactory", ")", "ComponentFactory", "s", "}", "message", "bundle", "for", "the", "text", "to", "use", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/layout/GridBagLayoutBuilder.java#L502-L506
toddfast/typeconverter
src/main/java/com/toddfast/util/convert/TypeConverter.java
TypeConverter.asString
public static String asString(Object value, String nullValue) { """ Return the value converted to a string or the specified alternate value if the original value is null. Note, this method still throws {@link IllegalArgumentException} if the value is not null and could not be converted. @param value The value to be converted @param nullValue The value to be returned if {@link value} is null. Note, this value will not be returned if the conversion fails otherwise. @throws IllegalArgumentException If the value cannot be converted """ value=convert(String.class,value); return (value!=null) ? (String)value : nullValue; }
java
public static String asString(Object value, String nullValue) { value=convert(String.class,value); return (value!=null) ? (String)value : nullValue; }
[ "public", "static", "String", "asString", "(", "Object", "value", ",", "String", "nullValue", ")", "{", "value", "=", "convert", "(", "String", ".", "class", ",", "value", ")", ";", "return", "(", "value", "!=", "null", ")", "?", "(", "String", ")", "value", ":", "nullValue", ";", "}" ]
Return the value converted to a string or the specified alternate value if the original value is null. Note, this method still throws {@link IllegalArgumentException} if the value is not null and could not be converted. @param value The value to be converted @param nullValue The value to be returned if {@link value} is null. Note, this value will not be returned if the conversion fails otherwise. @throws IllegalArgumentException If the value cannot be converted
[ "Return", "the", "value", "converted", "to", "a", "string", "or", "the", "specified", "alternate", "value", "if", "the", "original", "value", "is", "null", ".", "Note", "this", "method", "still", "throws", "{", "@link", "IllegalArgumentException", "}", "if", "the", "value", "is", "not", "null", "and", "could", "not", "be", "converted", "." ]
train
https://github.com/toddfast/typeconverter/blob/44efa352254faa49edaba5c5935389705aa12b90/src/main/java/com/toddfast/util/convert/TypeConverter.java#L734-L739
google/gson
gson/src/main/java/com/google/gson/Gson.java
Gson.fromJson
@SuppressWarnings("unchecked") public <T> T fromJson(String json, Type typeOfT) throws JsonSyntaxException { """ This method deserializes the specified Json into an object of the specified type. This method is useful if the specified object is a generic type. For non-generic objects, use {@link #fromJson(String, Class)} instead. If you have the Json in a {@link Reader} instead of a String, use {@link #fromJson(Reader, Type)} instead. @param <T> the type of the desired object @param json the string from which the object is to be deserialized @param typeOfT The specific genericized type of src. You can obtain this type by using the {@link com.google.gson.reflect.TypeToken} class. For example, to get the type for {@code Collection<Foo>}, you should use: <pre> Type typeOfT = new TypeToken&lt;Collection&lt;Foo&gt;&gt;(){}.getType(); </pre> @return an object of type T from the string. Returns {@code null} if {@code json} is {@code null} or if {@code json} is empty. @throws JsonParseException if json is not a valid representation for an object of type typeOfT @throws JsonSyntaxException if json is not a valid representation for an object of type """ if (json == null) { return null; } StringReader reader = new StringReader(json); T target = (T) fromJson(reader, typeOfT); return target; }
java
@SuppressWarnings("unchecked") public <T> T fromJson(String json, Type typeOfT) throws JsonSyntaxException { if (json == null) { return null; } StringReader reader = new StringReader(json); T target = (T) fromJson(reader, typeOfT); return target; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "T", "fromJson", "(", "String", "json", ",", "Type", "typeOfT", ")", "throws", "JsonSyntaxException", "{", "if", "(", "json", "==", "null", ")", "{", "return", "null", ";", "}", "StringReader", "reader", "=", "new", "StringReader", "(", "json", ")", ";", "T", "target", "=", "(", "T", ")", "fromJson", "(", "reader", ",", "typeOfT", ")", ";", "return", "target", ";", "}" ]
This method deserializes the specified Json into an object of the specified type. This method is useful if the specified object is a generic type. For non-generic objects, use {@link #fromJson(String, Class)} instead. If you have the Json in a {@link Reader} instead of a String, use {@link #fromJson(Reader, Type)} instead. @param <T> the type of the desired object @param json the string from which the object is to be deserialized @param typeOfT The specific genericized type of src. You can obtain this type by using the {@link com.google.gson.reflect.TypeToken} class. For example, to get the type for {@code Collection<Foo>}, you should use: <pre> Type typeOfT = new TypeToken&lt;Collection&lt;Foo&gt;&gt;(){}.getType(); </pre> @return an object of type T from the string. Returns {@code null} if {@code json} is {@code null} or if {@code json} is empty. @throws JsonParseException if json is not a valid representation for an object of type typeOfT @throws JsonSyntaxException if json is not a valid representation for an object of type
[ "This", "method", "deserializes", "the", "specified", "Json", "into", "an", "object", "of", "the", "specified", "type", ".", "This", "method", "is", "useful", "if", "the", "specified", "object", "is", "a", "generic", "type", ".", "For", "non", "-", "generic", "objects", "use", "{", "@link", "#fromJson", "(", "String", "Class", ")", "}", "instead", ".", "If", "you", "have", "the", "Json", "in", "a", "{", "@link", "Reader", "}", "instead", "of", "a", "String", "use", "{", "@link", "#fromJson", "(", "Reader", "Type", ")", "}", "instead", "." ]
train
https://github.com/google/gson/blob/63ee47cb642c8018e5cddd639aa2be143220ad4b/gson/src/main/java/com/google/gson/Gson.java#L840-L848
tminglei/form-binder-java
src/main/java/com/github/tminglei/bind/Mappings.java
Mappings.intv
public static Mapping<Integer> intv(Constraint... constraints) { """ (convert to Integer) mapping @param constraints constraints @return new created mapping """ return new FieldMapping( InputMode.SINGLE, mkSimpleConverter(s -> isEmptyStr(s) ? 0 : Integer.parseInt(s) ), new MappingMeta(MAPPING_INT, Integer.class) ).constraint(checking(Integer::parseInt, "error.number", true)) .constraint(constraints); }
java
public static Mapping<Integer> intv(Constraint... constraints) { return new FieldMapping( InputMode.SINGLE, mkSimpleConverter(s -> isEmptyStr(s) ? 0 : Integer.parseInt(s) ), new MappingMeta(MAPPING_INT, Integer.class) ).constraint(checking(Integer::parseInt, "error.number", true)) .constraint(constraints); }
[ "public", "static", "Mapping", "<", "Integer", ">", "intv", "(", "Constraint", "...", "constraints", ")", "{", "return", "new", "FieldMapping", "(", "InputMode", ".", "SINGLE", ",", "mkSimpleConverter", "(", "s", "->", "isEmptyStr", "(", "s", ")", "?", "0", ":", "Integer", ".", "parseInt", "(", "s", ")", ")", ",", "new", "MappingMeta", "(", "MAPPING_INT", ",", "Integer", ".", "class", ")", ")", ".", "constraint", "(", "checking", "(", "Integer", "::", "parseInt", ",", "\"error.number\"", ",", "true", ")", ")", ".", "constraint", "(", "constraints", ")", ";", "}" ]
(convert to Integer) mapping @param constraints constraints @return new created mapping
[ "(", "convert", "to", "Integer", ")", "mapping" ]
train
https://github.com/tminglei/form-binder-java/blob/4c0bd1e8f81ae56b21142bb525ee6b4deb7f92ab/src/main/java/com/github/tminglei/bind/Mappings.java#L62-L70
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java
KeyStore.setCertificateEntry
public final void setCertificateEntry(String alias, Certificate cert) throws KeyStoreException { """ Assigns the given trusted certificate to the given alias. <p> If the given alias identifies an existing entry created by a call to <code>setCertificateEntry</code>, or created by a call to <code>setEntry</code> with a <code>TrustedCertificateEntry</code>, the trusted certificate in the existing entry is overridden by the given certificate. @param alias the alias name @param cert the certificate @exception KeyStoreException if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason. """ if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } keyStoreSpi.engineSetCertificateEntry(alias, cert); }
java
public final void setCertificateEntry(String alias, Certificate cert) throws KeyStoreException { if (!initialized) { throw new KeyStoreException("Uninitialized keystore"); } keyStoreSpi.engineSetCertificateEntry(alias, cert); }
[ "public", "final", "void", "setCertificateEntry", "(", "String", "alias", ",", "Certificate", "cert", ")", "throws", "KeyStoreException", "{", "if", "(", "!", "initialized", ")", "{", "throw", "new", "KeyStoreException", "(", "\"Uninitialized keystore\"", ")", ";", "}", "keyStoreSpi", ".", "engineSetCertificateEntry", "(", "alias", ",", "cert", ")", ";", "}" ]
Assigns the given trusted certificate to the given alias. <p> If the given alias identifies an existing entry created by a call to <code>setCertificateEntry</code>, or created by a call to <code>setEntry</code> with a <code>TrustedCertificateEntry</code>, the trusted certificate in the existing entry is overridden by the given certificate. @param alias the alias name @param cert the certificate @exception KeyStoreException if the keystore has not been initialized, or the given alias already exists and does not identify an entry containing a trusted certificate, or this operation fails for some other reason.
[ "Assigns", "the", "given", "trusted", "certificate", "to", "the", "given", "alias", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/KeyStore.java#L1006-L1013
threerings/narya
core/src/main/java/com/threerings/presents/dobj/DObject.java
DObject.requestEntryUpdate
protected <T extends DSet.Entry> void requestEntryUpdate (String name, DSet<T> set, T entry) { """ Calls by derived instances when a set updater method was called. """ requestEntryUpdate(name, set, entry, Transport.DEFAULT); }
java
protected <T extends DSet.Entry> void requestEntryUpdate (String name, DSet<T> set, T entry) { requestEntryUpdate(name, set, entry, Transport.DEFAULT); }
[ "protected", "<", "T", "extends", "DSet", ".", "Entry", ">", "void", "requestEntryUpdate", "(", "String", "name", ",", "DSet", "<", "T", ">", "set", ",", "T", "entry", ")", "{", "requestEntryUpdate", "(", "name", ",", "set", ",", "entry", ",", "Transport", ".", "DEFAULT", ")", ";", "}" ]
Calls by derived instances when a set updater method was called.
[ "Calls", "by", "derived", "instances", "when", "a", "set", "updater", "method", "was", "called", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/presents/dobj/DObject.java#L923-L926
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcActor.java
AkkaRpcActor.lookupRpcMethod
private Method lookupRpcMethod(final String methodName, final Class<?>[] parameterTypes) throws NoSuchMethodException { """ Look up the rpc method on the given {@link RpcEndpoint} instance. @param methodName Name of the method @param parameterTypes Parameter types of the method @return Method of the rpc endpoint @throws NoSuchMethodException Thrown if the method with the given name and parameter types cannot be found at the rpc endpoint """ return rpcEndpoint.getClass().getMethod(methodName, parameterTypes); }
java
private Method lookupRpcMethod(final String methodName, final Class<?>[] parameterTypes) throws NoSuchMethodException { return rpcEndpoint.getClass().getMethod(methodName, parameterTypes); }
[ "private", "Method", "lookupRpcMethod", "(", "final", "String", "methodName", ",", "final", "Class", "<", "?", ">", "[", "]", "parameterTypes", ")", "throws", "NoSuchMethodException", "{", "return", "rpcEndpoint", ".", "getClass", "(", ")", ".", "getMethod", "(", "methodName", ",", "parameterTypes", ")", ";", "}" ]
Look up the rpc method on the given {@link RpcEndpoint} instance. @param methodName Name of the method @param parameterTypes Parameter types of the method @return Method of the rpc endpoint @throws NoSuchMethodException Thrown if the method with the given name and parameter types cannot be found at the rpc endpoint
[ "Look", "up", "the", "rpc", "method", "on", "the", "given", "{", "@link", "RpcEndpoint", "}", "instance", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaRpcActor.java#L424-L426
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java
GitFlowGraphMonitor.getEdgeConfigWithOverrides
private Config getEdgeConfigWithOverrides(Config edgeConfig, Path edgeFilePath) { """ Helper that overrides the flow edge properties with name derived from the edge file path @param edgeConfig edge config @param edgeFilePath path of the edge file @return config with overridden edge properties """ String source = edgeFilePath.getParent().getParent().getName(); String destination = edgeFilePath.getParent().getName(); String edgeName = Files.getNameWithoutExtension(edgeFilePath.getName()); return edgeConfig.withValue(FlowGraphConfigurationKeys.FLOW_EDGE_SOURCE_KEY, ConfigValueFactory.fromAnyRef(source)) .withValue(FlowGraphConfigurationKeys.FLOW_EDGE_DESTINATION_KEY, ConfigValueFactory.fromAnyRef(destination)) .withValue(FlowGraphConfigurationKeys.FLOW_EDGE_ID_KEY, ConfigValueFactory.fromAnyRef(getEdgeId(source, destination, edgeName))); }
java
private Config getEdgeConfigWithOverrides(Config edgeConfig, Path edgeFilePath) { String source = edgeFilePath.getParent().getParent().getName(); String destination = edgeFilePath.getParent().getName(); String edgeName = Files.getNameWithoutExtension(edgeFilePath.getName()); return edgeConfig.withValue(FlowGraphConfigurationKeys.FLOW_EDGE_SOURCE_KEY, ConfigValueFactory.fromAnyRef(source)) .withValue(FlowGraphConfigurationKeys.FLOW_EDGE_DESTINATION_KEY, ConfigValueFactory.fromAnyRef(destination)) .withValue(FlowGraphConfigurationKeys.FLOW_EDGE_ID_KEY, ConfigValueFactory.fromAnyRef(getEdgeId(source, destination, edgeName))); }
[ "private", "Config", "getEdgeConfigWithOverrides", "(", "Config", "edgeConfig", ",", "Path", "edgeFilePath", ")", "{", "String", "source", "=", "edgeFilePath", ".", "getParent", "(", ")", ".", "getParent", "(", ")", ".", "getName", "(", ")", ";", "String", "destination", "=", "edgeFilePath", ".", "getParent", "(", ")", ".", "getName", "(", ")", ";", "String", "edgeName", "=", "Files", ".", "getNameWithoutExtension", "(", "edgeFilePath", ".", "getName", "(", ")", ")", ";", "return", "edgeConfig", ".", "withValue", "(", "FlowGraphConfigurationKeys", ".", "FLOW_EDGE_SOURCE_KEY", ",", "ConfigValueFactory", ".", "fromAnyRef", "(", "source", ")", ")", ".", "withValue", "(", "FlowGraphConfigurationKeys", ".", "FLOW_EDGE_DESTINATION_KEY", ",", "ConfigValueFactory", ".", "fromAnyRef", "(", "destination", ")", ")", ".", "withValue", "(", "FlowGraphConfigurationKeys", ".", "FLOW_EDGE_ID_KEY", ",", "ConfigValueFactory", ".", "fromAnyRef", "(", "getEdgeId", "(", "source", ",", "destination", ",", "edgeName", ")", ")", ")", ";", "}" ]
Helper that overrides the flow edge properties with name derived from the edge file path @param edgeConfig edge config @param edgeFilePath path of the edge file @return config with overridden edge properties
[ "Helper", "that", "overrides", "the", "flow", "edge", "properties", "with", "name", "derived", "from", "the", "edge", "file", "path" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java#L324-L332
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.mockStaticNice
public static synchronized void mockStaticNice(Class<?> type, Method... methods) { """ Enable nice static mocking for a class. @param type the class to enable static mocking @param methods optionally what methods to mock """ doMock(type, true, new NiceMockStrategy(), null, methods); }
java
public static synchronized void mockStaticNice(Class<?> type, Method... methods) { doMock(type, true, new NiceMockStrategy(), null, methods); }
[ "public", "static", "synchronized", "void", "mockStaticNice", "(", "Class", "<", "?", ">", "type", ",", "Method", "...", "methods", ")", "{", "doMock", "(", "type", ",", "true", ",", "new", "NiceMockStrategy", "(", ")", ",", "null", ",", "methods", ")", ";", "}" ]
Enable nice static mocking for a class. @param type the class to enable static mocking @param methods optionally what methods to mock
[ "Enable", "nice", "static", "mocking", "for", "a", "class", "." ]
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L287-L289
derari/cthul
objects/src/main/java/org/cthul/objects/reflection/Signatures.java
Signatures.candidateMatches
public static int[] candidateMatches(Class<?>[][] signatures, boolean[] varArgs, Class<?>[] argTypes) { """ Returns indices of all signatures that are a best match for the given argument types. @param signatures @param varArgs @param argTypes @return signature indices """ return candidateMatches(signatures, varArgs, new JavaSignatureComparator(argTypes)); }
java
public static int[] candidateMatches(Class<?>[][] signatures, boolean[] varArgs, Class<?>[] argTypes) { return candidateMatches(signatures, varArgs, new JavaSignatureComparator(argTypes)); }
[ "public", "static", "int", "[", "]", "candidateMatches", "(", "Class", "<", "?", ">", "[", "]", "[", "]", "signatures", ",", "boolean", "[", "]", "varArgs", ",", "Class", "<", "?", ">", "[", "]", "argTypes", ")", "{", "return", "candidateMatches", "(", "signatures", ",", "varArgs", ",", "new", "JavaSignatureComparator", "(", "argTypes", ")", ")", ";", "}" ]
Returns indices of all signatures that are a best match for the given argument types. @param signatures @param varArgs @param argTypes @return signature indices
[ "Returns", "indices", "of", "all", "signatures", "that", "are", "a", "best", "match", "for", "the", "given", "argument", "types", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/reflection/Signatures.java#L494-L496
facebookarchive/hadoop-20
src/core/org/apache/hadoop/fs/FilterFileSystem.java
FilterFileSystem.copyFromLocalFile
public void copyFromLocalFile(boolean delSrc, Path src, Path dst) throws IOException { """ The src file is on the local disk. Add it to FS at the given dst name. delSrc indicates if the source should be removed """ fs.copyFromLocalFile(delSrc, src, dst); }
java
public void copyFromLocalFile(boolean delSrc, Path src, Path dst) throws IOException { fs.copyFromLocalFile(delSrc, src, dst); }
[ "public", "void", "copyFromLocalFile", "(", "boolean", "delSrc", ",", "Path", "src", ",", "Path", "dst", ")", "throws", "IOException", "{", "fs", ".", "copyFromLocalFile", "(", "delSrc", ",", "src", ",", "dst", ")", ";", "}" ]
The src file is on the local disk. Add it to FS at the given dst name. delSrc indicates if the source should be removed
[ "The", "src", "file", "is", "on", "the", "local", "disk", ".", "Add", "it", "to", "FS", "at", "the", "given", "dst", "name", ".", "delSrc", "indicates", "if", "the", "source", "should", "be", "removed" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FilterFileSystem.java#L311-L314
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java
ImageIOGreyScale.getImageReadersBySuffix
public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) { """ Returns an <code>Iterator</code> containing all currently registered <code>ImageReader</code>s that claim to be able to decode files with the given suffix. @param fileSuffix a <code>String</code> containing a file suffix (<i>e.g.</i>, "jpg" or "tiff"). @return an <code>Iterator</code> containing <code>ImageReader</code>s. @exception IllegalArgumentException if <code>fileSuffix</code> is <code>null</code>. @see javax.imageio.spi.ImageReaderSpi#getFileSuffixes """ if (fileSuffix == null) { throw new IllegalArgumentException("fileSuffix == null!"); } // Ensure category is present Iterator iter; try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFileSuffixesMethod, fileSuffix), true); } catch (IllegalArgumentException e) { return new HashSet().iterator(); } return new ImageReaderIterator(iter); }
java
public static Iterator<ImageReader> getImageReadersBySuffix(String fileSuffix) { if (fileSuffix == null) { throw new IllegalArgumentException("fileSuffix == null!"); } // Ensure category is present Iterator iter; try { iter = theRegistry.getServiceProviders(ImageReaderSpi.class, new ContainsFilter(readerFileSuffixesMethod, fileSuffix), true); } catch (IllegalArgumentException e) { return new HashSet().iterator(); } return new ImageReaderIterator(iter); }
[ "public", "static", "Iterator", "<", "ImageReader", ">", "getImageReadersBySuffix", "(", "String", "fileSuffix", ")", "{", "if", "(", "fileSuffix", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"fileSuffix == null!\"", ")", ";", "}", "// Ensure category is present\r", "Iterator", "iter", ";", "try", "{", "iter", "=", "theRegistry", ".", "getServiceProviders", "(", "ImageReaderSpi", ".", "class", ",", "new", "ContainsFilter", "(", "readerFileSuffixesMethod", ",", "fileSuffix", ")", ",", "true", ")", ";", "}", "catch", "(", "IllegalArgumentException", "e", ")", "{", "return", "new", "HashSet", "(", ")", ".", "iterator", "(", ")", ";", "}", "return", "new", "ImageReaderIterator", "(", "iter", ")", ";", "}" ]
Returns an <code>Iterator</code> containing all currently registered <code>ImageReader</code>s that claim to be able to decode files with the given suffix. @param fileSuffix a <code>String</code> containing a file suffix (<i>e.g.</i>, "jpg" or "tiff"). @return an <code>Iterator</code> containing <code>ImageReader</code>s. @exception IllegalArgumentException if <code>fileSuffix</code> is <code>null</code>. @see javax.imageio.spi.ImageReaderSpi#getFileSuffixes
[ "Returns", "an", "<code", ">", "Iterator<", "/", "code", ">", "containing", "all", "currently", "registered", "<code", ">", "ImageReader<", "/", "code", ">", "s", "that", "claim", "to", "be", "able", "to", "decode", "files", "with", "the", "given", "suffix", "." ]
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java#L652-L664
pmwmedia/tinylog
tinylog-api/src/main/java/org/tinylog/runtime/RuntimeProvider.java
RuntimeProvider.normalizeClassName
private static StackTraceElement normalizeClassName(final StackTraceElement element) { """ Strips the the anonymous part from a class name of stack trace element. @param element Original stack trace element @return New or same stack trace element with an human-readable class name without any anonymous part """ String className = element.getClassName(); int dollarIndex = className.indexOf("$"); if (dollarIndex == -1) { return element; } else { className = stripAnonymousPart(className); return new StackTraceElement(className, element.getMethodName(), element.getFileName(), element.getLineNumber()); } }
java
private static StackTraceElement normalizeClassName(final StackTraceElement element) { String className = element.getClassName(); int dollarIndex = className.indexOf("$"); if (dollarIndex == -1) { return element; } else { className = stripAnonymousPart(className); return new StackTraceElement(className, element.getMethodName(), element.getFileName(), element.getLineNumber()); } }
[ "private", "static", "StackTraceElement", "normalizeClassName", "(", "final", "StackTraceElement", "element", ")", "{", "String", "className", "=", "element", ".", "getClassName", "(", ")", ";", "int", "dollarIndex", "=", "className", ".", "indexOf", "(", "\"$\"", ")", ";", "if", "(", "dollarIndex", "==", "-", "1", ")", "{", "return", "element", ";", "}", "else", "{", "className", "=", "stripAnonymousPart", "(", "className", ")", ";", "return", "new", "StackTraceElement", "(", "className", ",", "element", ".", "getMethodName", "(", ")", ",", "element", ".", "getFileName", "(", ")", ",", "element", ".", "getLineNumber", "(", ")", ")", ";", "}", "}" ]
Strips the the anonymous part from a class name of stack trace element. @param element Original stack trace element @return New or same stack trace element with an human-readable class name without any anonymous part
[ "Strips", "the", "the", "anonymous", "part", "from", "a", "class", "name", "of", "stack", "trace", "element", "." ]
train
https://github.com/pmwmedia/tinylog/blob/d03d4ef84a1310155037e08ca8822a91697d1086/tinylog-api/src/main/java/org/tinylog/runtime/RuntimeProvider.java#L187-L196
Backendless/Android-SDK
src/com/backendless/servercode/extension/FilesExtender.java
FilesExtender.afterMoveToRepository
@Deprecated public void afterMoveToRepository( RunnerContext context, String fileUrlLocation, ExecutionResult<String> result ) throws Exception { """ Use afterUpload method @param context @param fileUrlLocation @param result @throws Exception """ }
java
@Deprecated public void afterMoveToRepository( RunnerContext context, String fileUrlLocation, ExecutionResult<String> result ) throws Exception { }
[ "@", "Deprecated", "public", "void", "afterMoveToRepository", "(", "RunnerContext", "context", ",", "String", "fileUrlLocation", ",", "ExecutionResult", "<", "String", ">", "result", ")", "throws", "Exception", "{", "}" ]
Use afterUpload method @param context @param fileUrlLocation @param result @throws Exception
[ "Use", "afterUpload", "method" ]
train
https://github.com/Backendless/Android-SDK/blob/3af1e9a378f19d890db28a833f7fc8595b924cc3/src/com/backendless/servercode/extension/FilesExtender.java#L54-L57
box/box-java-sdk
src/main/java/com/box/sdk/BoxFile.java
BoxFile.downloadRange
public void downloadRange(OutputStream output, long rangeStart, long rangeEnd) { """ Downloads a part of this file's contents, starting at rangeStart and stopping at rangeEnd. @param output the stream to where the file will be written. @param rangeStart the byte offset at which to start the download. @param rangeEnd the byte offset at which to stop the download. """ this.downloadRange(output, rangeStart, rangeEnd, null); }
java
public void downloadRange(OutputStream output, long rangeStart, long rangeEnd) { this.downloadRange(output, rangeStart, rangeEnd, null); }
[ "public", "void", "downloadRange", "(", "OutputStream", "output", ",", "long", "rangeStart", ",", "long", "rangeEnd", ")", "{", "this", ".", "downloadRange", "(", "output", ",", "rangeStart", ",", "rangeEnd", ",", "null", ")", ";", "}" ]
Downloads a part of this file's contents, starting at rangeStart and stopping at rangeEnd. @param output the stream to where the file will be written. @param rangeStart the byte offset at which to start the download. @param rangeEnd the byte offset at which to stop the download.
[ "Downloads", "a", "part", "of", "this", "file", "s", "contents", "starting", "at", "rangeStart", "and", "stopping", "at", "rangeEnd", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFile.java#L329-L331
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/CommonSteps.java
CommonSteps.saveValueInDataOutputProvider
@Conditioned @Et("Je sauvegarde la valeur de '(.*)-(.*)' dans la colonne '(.*)' du fournisseur de données en sortie[\\.|\\?]") @And("I save the value of '(.*)-(.*)' in '(.*)' column of data output provider[\\.|\\?]") public void saveValueInDataOutputProvider(String page, String field, String targetColumn, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException { """ Save field in data output provider if all 'expected' parameters equals 'actual' parameters in conditions. The value is saved directly into the data output provider (Excel, CSV, ...). @param page The concerned page of field @param field Name of the field to save in data output provider. @param targetColumn Target column (in data output provider) to save retrieved value. @param conditions list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). @throws FailureException if the scenario encounters a functional error (with message and screenshot) @throws TechnicalException is thrown if the scenario encounters a technical error (format, configuration, data, ...) in NoraUi. Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT} or {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_RETRIEVE_VALUE} """ String value = ""; try { value = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(Page.getInstance(page).getPageElementByKey('-' + field)))).getText(); if (value == null) { value = ""; } } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, Page.getInstance(page).getCallBack()); } Context.getCurrentScenario().write(Messages.format("Value of %s is: %s\n", field, value)); for (final Integer line : Context.getDataInputProvider().getIndexData(Context.getCurrentScenarioData()).getIndexes()) { try { Context.getDataOutputProvider().writeDataResult(targetColumn, line, value); } catch (final TechnicalException e) { new Result.Warning<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_WRITE_MESSAGE_IN_RESULT_FILE), targetColumn), false, 0); } } }
java
@Conditioned @Et("Je sauvegarde la valeur de '(.*)-(.*)' dans la colonne '(.*)' du fournisseur de données en sortie[\\.|\\?]") @And("I save the value of '(.*)-(.*)' in '(.*)' column of data output provider[\\.|\\?]") public void saveValueInDataOutputProvider(String page, String field, String targetColumn, List<GherkinStepCondition> conditions) throws TechnicalException, FailureException { String value = ""; try { value = Context.waitUntil(ExpectedConditions.presenceOfElementLocated(Utilities.getLocator(Page.getInstance(page).getPageElementByKey('-' + field)))).getText(); if (value == null) { value = ""; } } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, Page.getInstance(page).getCallBack()); } Context.getCurrentScenario().write(Messages.format("Value of %s is: %s\n", field, value)); for (final Integer line : Context.getDataInputProvider().getIndexData(Context.getCurrentScenarioData()).getIndexes()) { try { Context.getDataOutputProvider().writeDataResult(targetColumn, line, value); } catch (final TechnicalException e) { new Result.Warning<>(e.getMessage(), Messages.format(Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_WRITE_MESSAGE_IN_RESULT_FILE), targetColumn), false, 0); } } }
[ "@", "Conditioned", "@", "Et", "(", "\"Je sauvegarde la valeur de '(.*)-(.*)' dans la colonne '(.*)' du fournisseur de données en sortie[\\\\.|\\\\?]\")", "\r", "@", "And", "(", "\"I save the value of '(.*)-(.*)' in '(.*)' column of data output provider[\\\\.|\\\\?]\"", ")", "public", "void", "saveValueInDataOutputProvider", "(", "String", "page", ",", "String", "field", ",", "String", "targetColumn", ",", "List", "<", "GherkinStepCondition", ">", "conditions", ")", "throws", "TechnicalException", ",", "FailureException", "{", "String", "value", "=", "\"\"", ";", "try", "{", "value", "=", "Context", ".", "waitUntil", "(", "ExpectedConditions", ".", "presenceOfElementLocated", "(", "Utilities", ".", "getLocator", "(", "Page", ".", "getInstance", "(", "page", ")", ".", "getPageElementByKey", "(", "'", "'", "+", "field", ")", ")", ")", ")", ".", "getText", "(", ")", ";", "if", "(", "value", "==", "null", ")", "{", "value", "=", "\"\"", ";", "}", "}", "catch", "(", "final", "Exception", "e", ")", "{", "new", "Result", ".", "Failure", "<>", "(", "e", ".", "getMessage", "(", ")", ",", "Messages", ".", "getMessage", "(", "Messages", ".", "FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT", ")", ",", "true", ",", "Page", ".", "getInstance", "(", "page", ")", ".", "getCallBack", "(", ")", ")", ";", "}", "Context", ".", "getCurrentScenario", "(", ")", ".", "write", "(", "Messages", ".", "format", "(", "\"Value of %s is: %s\\n\"", ",", "field", ",", "value", ")", ")", ";", "for", "(", "final", "Integer", "line", ":", "Context", ".", "getDataInputProvider", "(", ")", ".", "getIndexData", "(", "Context", ".", "getCurrentScenarioData", "(", ")", ")", ".", "getIndexes", "(", ")", ")", "{", "try", "{", "Context", ".", "getDataOutputProvider", "(", ")", ".", "writeDataResult", "(", "targetColumn", ",", "line", ",", "value", ")", ";", "}", "catch", "(", "final", "TechnicalException", "e", ")", "{", "new", "Result", ".", "Warning", "<>", "(", "e", ".", "getMessage", "(", ")", ",", "Messages", ".", "format", "(", "Messages", ".", "getMessage", "(", "Messages", ".", "FAIL_MESSAGE_UNABLE_TO_WRITE_MESSAGE_IN_RESULT_FILE", ")", ",", "targetColumn", ")", ",", "false", ",", "0", ")", ";", "}", "}", "}" ]
Save field in data output provider if all 'expected' parameters equals 'actual' parameters in conditions. The value is saved directly into the data output provider (Excel, CSV, ...). @param page The concerned page of field @param field Name of the field to save in data output provider. @param targetColumn Target column (in data output provider) to save retrieved value. @param conditions list of 'expected' values condition and 'actual' values ({@link com.github.noraui.gherkin.GherkinStepCondition}). @throws FailureException if the scenario encounters a functional error (with message and screenshot) @throws TechnicalException is thrown if the scenario encounters a technical error (format, configuration, data, ...) in NoraUi. Exception with {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT} or {@value com.github.noraui.utils.Messages#FAIL_MESSAGE_UNABLE_TO_RETRIEVE_VALUE}
[ "Save", "field", "in", "data", "output", "provider", "if", "all", "expected", "parameters", "equals", "actual", "parameters", "in", "conditions", ".", "The", "value", "is", "saved", "directly", "into", "the", "data", "output", "provider", "(", "Excel", "CSV", "...", ")", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/CommonSteps.java#L321-L342
tvesalainen/util
util/src/main/java/org/vesalainen/bean/BeanHelper.java
BeanHelper.getPattern
public static String getPattern(Object bean, Object target) { """ Returns targets pattern or null if target not found. @param bean @param target @return """ return stream(bean).filter((s)->{return target.equals(getValue(bean, s));}
java
public static String getPattern(Object bean, Object target) { return stream(bean).filter((s)->{return target.equals(getValue(bean, s));}
[ "public", "static", "String", "getPattern", "(", "Object", "bean", ",", "Object", "target", ")", "{", "return", "stream", "(", "bean", ")", ".", "filter", "(", "(", "s", ")", "-", ">", "{", "return", "target", ".", "equals", "(", "getValue", "(", "bean", ",", "s", ")", ")", "", ";", "}" ]
Returns targets pattern or null if target not found. @param bean @param target @return
[ "Returns", "targets", "pattern", "or", "null", "if", "target", "not", "found", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/bean/BeanHelper.java#L974-L976
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java
ResolvableType.forClass
public static ResolvableType forClass(Class<?> sourceClass, Class<?> implementationClass) { """ Return a {@link ResolvableType} for the specified {@link Class} with a given implementation. For example: {@code ResolvableType.forClass(List.class, MyArrayList.class)}. @param sourceClass the source class (must not be {@code null} @param implementationClass the implementation class @return a {@link ResolvableType} for the specified class backed by the given implementation class @see #forClass(Class) @see #forClassWithGenerics(Class, Class...) """ LettuceAssert.notNull(sourceClass, "Source class must not be null"); ResolvableType asType = forType(implementationClass).as(sourceClass); return (asType == NONE ? forType(sourceClass) : asType); }
java
public static ResolvableType forClass(Class<?> sourceClass, Class<?> implementationClass) { LettuceAssert.notNull(sourceClass, "Source class must not be null"); ResolvableType asType = forType(implementationClass).as(sourceClass); return (asType == NONE ? forType(sourceClass) : asType); }
[ "public", "static", "ResolvableType", "forClass", "(", "Class", "<", "?", ">", "sourceClass", ",", "Class", "<", "?", ">", "implementationClass", ")", "{", "LettuceAssert", ".", "notNull", "(", "sourceClass", ",", "\"Source class must not be null\"", ")", ";", "ResolvableType", "asType", "=", "forType", "(", "implementationClass", ")", ".", "as", "(", "sourceClass", ")", ";", "return", "(", "asType", "==", "NONE", "?", "forType", "(", "sourceClass", ")", ":", "asType", ")", ";", "}" ]
Return a {@link ResolvableType} for the specified {@link Class} with a given implementation. For example: {@code ResolvableType.forClass(List.class, MyArrayList.class)}. @param sourceClass the source class (must not be {@code null} @param implementationClass the implementation class @return a {@link ResolvableType} for the specified class backed by the given implementation class @see #forClass(Class) @see #forClassWithGenerics(Class, Class...)
[ "Return", "a", "{", "@link", "ResolvableType", "}", "for", "the", "specified", "{", "@link", "Class", "}", "with", "a", "given", "implementation", ".", "For", "example", ":", "{", "@code", "ResolvableType", ".", "forClass", "(", "List", ".", "class", "MyArrayList", ".", "class", ")", "}", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java#L863-L867
threerings/nenya
core/src/main/java/com/threerings/media/animation/ScaleAnimation.java
ScaleAnimation.getBounds
public static Rectangle getBounds (float scale, Point center, Mirage image) { """ Java wants the first call in a constructor to be super() if it exists at all, so we have to trick it with this function. Oh, and this function computes how big the bounding box needs to be to bound the inputted image scaled to the inputted size centered around the inputted center point. """ Point size = getSize(scale, image); Point corner = getCorner(center, size); return new Rectangle(corner.x, corner.y, size.x, size.y); }
java
public static Rectangle getBounds (float scale, Point center, Mirage image) { Point size = getSize(scale, image); Point corner = getCorner(center, size); return new Rectangle(corner.x, corner.y, size.x, size.y); }
[ "public", "static", "Rectangle", "getBounds", "(", "float", "scale", ",", "Point", "center", ",", "Mirage", "image", ")", "{", "Point", "size", "=", "getSize", "(", "scale", ",", "image", ")", ";", "Point", "corner", "=", "getCorner", "(", "center", ",", "size", ")", ";", "return", "new", "Rectangle", "(", "corner", ".", "x", ",", "corner", ".", "y", ",", "size", ".", "x", ",", "size", ".", "y", ")", ";", "}" ]
Java wants the first call in a constructor to be super() if it exists at all, so we have to trick it with this function. Oh, and this function computes how big the bounding box needs to be to bound the inputted image scaled to the inputted size centered around the inputted center point.
[ "Java", "wants", "the", "first", "call", "in", "a", "constructor", "to", "be", "super", "()", "if", "it", "exists", "at", "all", "so", "we", "have", "to", "trick", "it", "with", "this", "function", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/animation/ScaleAnimation.java#L80-L85
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java
AbstractQueuedSynchronizer.shouldParkAfterFailedAcquire
private static boolean shouldParkAfterFailedAcquire(Node pred, Node node) { """ Checks and updates status for a node that failed to acquire. Returns true if thread should block. This is the main signal control in all acquire loops. Requires that pred == node.prev. @param pred node's predecessor holding status @param node the node @return {@code true} if thread should block """ int ws = pred.waitStatus; if (ws == Node.SIGNAL) /* * This node has already set status asking a release * to signal it, so it can safely park. */ return true; if (ws > 0) { /* * Predecessor was cancelled. Skip over predecessors and * indicate retry. */ do { node.prev = pred = pred.prev; } while (pred.waitStatus > 0); pred.next = node; } else { /* * waitStatus must be 0 or PROPAGATE. Indicate that we * need a signal, but don't park yet. Caller will need to * retry to make sure it cannot acquire before parking. */ pred.compareAndSetWaitStatus(ws, Node.SIGNAL); } return false; }
java
private static boolean shouldParkAfterFailedAcquire(Node pred, Node node) { int ws = pred.waitStatus; if (ws == Node.SIGNAL) /* * This node has already set status asking a release * to signal it, so it can safely park. */ return true; if (ws > 0) { /* * Predecessor was cancelled. Skip over predecessors and * indicate retry. */ do { node.prev = pred = pred.prev; } while (pred.waitStatus > 0); pred.next = node; } else { /* * waitStatus must be 0 or PROPAGATE. Indicate that we * need a signal, but don't park yet. Caller will need to * retry to make sure it cannot acquire before parking. */ pred.compareAndSetWaitStatus(ws, Node.SIGNAL); } return false; }
[ "private", "static", "boolean", "shouldParkAfterFailedAcquire", "(", "Node", "pred", ",", "Node", "node", ")", "{", "int", "ws", "=", "pred", ".", "waitStatus", ";", "if", "(", "ws", "==", "Node", ".", "SIGNAL", ")", "/*\n * This node has already set status asking a release\n * to signal it, so it can safely park.\n */", "return", "true", ";", "if", "(", "ws", ">", "0", ")", "{", "/*\n * Predecessor was cancelled. Skip over predecessors and\n * indicate retry.\n */", "do", "{", "node", ".", "prev", "=", "pred", "=", "pred", ".", "prev", ";", "}", "while", "(", "pred", ".", "waitStatus", ">", "0", ")", ";", "pred", ".", "next", "=", "node", ";", "}", "else", "{", "/*\n * waitStatus must be 0 or PROPAGATE. Indicate that we\n * need a signal, but don't park yet. Caller will need to\n * retry to make sure it cannot acquire before parking.\n */", "pred", ".", "compareAndSetWaitStatus", "(", "ws", ",", "Node", ".", "SIGNAL", ")", ";", "}", "return", "false", ";", "}" ]
Checks and updates status for a node that failed to acquire. Returns true if thread should block. This is the main signal control in all acquire loops. Requires that pred == node.prev. @param pred node's predecessor holding status @param node the node @return {@code true} if thread should block
[ "Checks", "and", "updates", "status", "for", "a", "node", "that", "failed", "to", "acquire", ".", "Returns", "true", "if", "thread", "should", "block", ".", "This", "is", "the", "main", "signal", "control", "in", "all", "acquire", "loops", ".", "Requires", "that", "pred", "==", "node", ".", "prev", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedSynchronizer.java#L831-L857
sporniket/core
sporniket-core-io/src/main/java/com/sporniket/libre/io/parser/properties/LineByLinePropertyParser.java
LineByLinePropertyParser.fireSingleLinePropertyParsedEvent
private void fireSingleLinePropertyParsedEvent(String name, String value) { """ Notify listeners that a single line property has been parsed. @param name property name. @param value property value. """ SingleLinePropertyParsedEvent _event = new SingleLinePropertyParsedEvent(name, value); for (PropertiesParsingListener _listener : getListeners()) { _listener.onSingleLinePropertyParsed(_event); } }
java
private void fireSingleLinePropertyParsedEvent(String name, String value) { SingleLinePropertyParsedEvent _event = new SingleLinePropertyParsedEvent(name, value); for (PropertiesParsingListener _listener : getListeners()) { _listener.onSingleLinePropertyParsed(_event); } }
[ "private", "void", "fireSingleLinePropertyParsedEvent", "(", "String", "name", ",", "String", "value", ")", "{", "SingleLinePropertyParsedEvent", "_event", "=", "new", "SingleLinePropertyParsedEvent", "(", "name", ",", "value", ")", ";", "for", "(", "PropertiesParsingListener", "_listener", ":", "getListeners", "(", ")", ")", "{", "_listener", ".", "onSingleLinePropertyParsed", "(", "_event", ")", ";", "}", "}" ]
Notify listeners that a single line property has been parsed. @param name property name. @param value property value.
[ "Notify", "listeners", "that", "a", "single", "line", "property", "has", "been", "parsed", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-io/src/main/java/com/sporniket/libre/io/parser/properties/LineByLinePropertyParser.java#L570-L577
VoltDB/voltdb
src/frontend/org/voltcore/agreement/RestrictedPriorityQueue.java
RestrictedPriorityQueue.gotFaultForInitiator
public void gotFaultForInitiator(long initiatorId) { """ Remove all pending transactions from the specified initiator and do not require heartbeats from that initiator to proceed. @param initiatorId id of the failed initiator. """ // calculate the next minimum transaction w/o our dead friend noteTransactionRecievedAndReturnLastSeen(initiatorId, Long.MAX_VALUE, DtxnConstants.DUMMY_LAST_SEEN_TXN_ID); // remove initiator from minimum. txnid scoreboard LastInitiatorData remove = m_initiatorData.remove(initiatorId); assert(remove != null); }
java
public void gotFaultForInitiator(long initiatorId) { // calculate the next minimum transaction w/o our dead friend noteTransactionRecievedAndReturnLastSeen(initiatorId, Long.MAX_VALUE, DtxnConstants.DUMMY_LAST_SEEN_TXN_ID); // remove initiator from minimum. txnid scoreboard LastInitiatorData remove = m_initiatorData.remove(initiatorId); assert(remove != null); }
[ "public", "void", "gotFaultForInitiator", "(", "long", "initiatorId", ")", "{", "// calculate the next minimum transaction w/o our dead friend", "noteTransactionRecievedAndReturnLastSeen", "(", "initiatorId", ",", "Long", ".", "MAX_VALUE", ",", "DtxnConstants", ".", "DUMMY_LAST_SEEN_TXN_ID", ")", ";", "// remove initiator from minimum. txnid scoreboard", "LastInitiatorData", "remove", "=", "m_initiatorData", ".", "remove", "(", "initiatorId", ")", ";", "assert", "(", "remove", "!=", "null", ")", ";", "}" ]
Remove all pending transactions from the specified initiator and do not require heartbeats from that initiator to proceed. @param initiatorId id of the failed initiator.
[ "Remove", "all", "pending", "transactions", "from", "the", "specified", "initiator", "and", "do", "not", "require", "heartbeats", "from", "that", "initiator", "to", "proceed", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/RestrictedPriorityQueue.java#L195-L202
VoltDB/voltdb
src/frontend/org/voltdb/largequery/LargeBlockManager.java
LargeBlockManager.loadBlock
void loadBlock(BlockId blockId, ByteBuffer block) throws IOException { """ Read the block with the given ID into the given byte buffer. @param blockId block id of the block to load @param block The block to write the bytes to @return The original address of the block @throws IOException """ synchronized (m_accessLock) { if (! m_blockPathMap.containsKey(blockId)) { throw new IllegalArgumentException("Request to load block that is not stored: " + blockId); } int origPosition = block.position(); block.position(0); Path blockPath = m_blockPathMap.get(blockId); try (SeekableByteChannel channel = Files.newByteChannel(blockPath)) { channel.read(block); } finally { block.position(origPosition); } } }
java
void loadBlock(BlockId blockId, ByteBuffer block) throws IOException { synchronized (m_accessLock) { if (! m_blockPathMap.containsKey(blockId)) { throw new IllegalArgumentException("Request to load block that is not stored: " + blockId); } int origPosition = block.position(); block.position(0); Path blockPath = m_blockPathMap.get(blockId); try (SeekableByteChannel channel = Files.newByteChannel(blockPath)) { channel.read(block); } finally { block.position(origPosition); } } }
[ "void", "loadBlock", "(", "BlockId", "blockId", ",", "ByteBuffer", "block", ")", "throws", "IOException", "{", "synchronized", "(", "m_accessLock", ")", "{", "if", "(", "!", "m_blockPathMap", ".", "containsKey", "(", "blockId", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Request to load block that is not stored: \"", "+", "blockId", ")", ";", "}", "int", "origPosition", "=", "block", ".", "position", "(", ")", ";", "block", ".", "position", "(", "0", ")", ";", "Path", "blockPath", "=", "m_blockPathMap", ".", "get", "(", "blockId", ")", ";", "try", "(", "SeekableByteChannel", "channel", "=", "Files", ".", "newByteChannel", "(", "blockPath", ")", ")", "{", "channel", ".", "read", "(", "block", ")", ";", "}", "finally", "{", "block", ".", "position", "(", "origPosition", ")", ";", "}", "}", "}" ]
Read the block with the given ID into the given byte buffer. @param blockId block id of the block to load @param block The block to write the bytes to @return The original address of the block @throws IOException
[ "Read", "the", "block", "with", "the", "given", "ID", "into", "the", "given", "byte", "buffer", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/largequery/LargeBlockManager.java#L200-L216
buschmais/extended-objects
impl/src/main/java/com/buschmais/xo/impl/metadata/EntityTypeMetadataResolver.java
EntityTypeMetadataResolver.containsAny
public <T> boolean containsAny(Set<T> set, Collection<T> other) { """ Determines if any given element in another {@link Collection} is contained in this set. @param set The set. @param other The other {@link Collection}. @return <code>true</code> if any other element is contained. """ for (T t : other) { if (set.contains(t)) { return true; } } return false; }
java
public <T> boolean containsAny(Set<T> set, Collection<T> other) { for (T t : other) { if (set.contains(t)) { return true; } } return false; }
[ "public", "<", "T", ">", "boolean", "containsAny", "(", "Set", "<", "T", ">", "set", ",", "Collection", "<", "T", ">", "other", ")", "{", "for", "(", "T", "t", ":", "other", ")", "{", "if", "(", "set", ".", "contains", "(", "t", ")", ")", "{", "return", "true", ";", "}", "}", "return", "false", ";", "}" ]
Determines if any given element in another {@link Collection} is contained in this set. @param set The set. @param other The other {@link Collection}. @return <code>true</code> if any other element is contained.
[ "Determines", "if", "any", "given", "element", "in", "another", "{", "@link", "Collection", "}", "is", "contained", "in", "this", "set", "." ]
train
https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/metadata/EntityTypeMetadataResolver.java#L197-L204
wstrange/GoogleAuth
src/main/java/com/warrenstrange/googleauth/GoogleAuthenticatorQRGenerator.java
GoogleAuthenticatorQRGenerator.formatLabel
private static String formatLabel(String issuer, String accountName) { """ The label is used to identify which account a key is associated with. It contains an account name, which is a URI-encoded string, optionally prefixed by an issuer string identifying the provider or service managing that account. This issuer prefix can be used to prevent collisions between different accounts with different providers that might be identified using the same account name, e.g. the user's email address. The issuer prefix and account name should be separated by a literal or url-encoded colon, and optional spaces may precede the account name. Neither issuer nor account name may themselves contain a colon. Represented in ABNF according to RFC 5234: <p/> label = accountname / issuer (“:” / “%3A”) *”%20” accountname @see <a href="https://code.google.com/p/google-authenticator/wiki/KeyUriFormat">Google Authenticator - KeyUriFormat</a> """ if (accountName == null || accountName.trim().length() == 0) { throw new IllegalArgumentException("Account name must not be empty."); } StringBuilder sb = new StringBuilder(); if (issuer != null) { if (issuer.contains(":")) { throw new IllegalArgumentException("Issuer cannot contain the \':\' character."); } sb.append(issuer); sb.append(":"); } sb.append(accountName); return sb.toString(); }
java
private static String formatLabel(String issuer, String accountName) { if (accountName == null || accountName.trim().length() == 0) { throw new IllegalArgumentException("Account name must not be empty."); } StringBuilder sb = new StringBuilder(); if (issuer != null) { if (issuer.contains(":")) { throw new IllegalArgumentException("Issuer cannot contain the \':\' character."); } sb.append(issuer); sb.append(":"); } sb.append(accountName); return sb.toString(); }
[ "private", "static", "String", "formatLabel", "(", "String", "issuer", ",", "String", "accountName", ")", "{", "if", "(", "accountName", "==", "null", "||", "accountName", ".", "trim", "(", ")", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Account name must not be empty.\"", ")", ";", "}", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "issuer", "!=", "null", ")", "{", "if", "(", "issuer", ".", "contains", "(", "\":\"", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Issuer cannot contain the \\':\\' character.\"", ")", ";", "}", "sb", ".", "append", "(", "issuer", ")", ";", "sb", ".", "append", "(", "\":\"", ")", ";", "}", "sb", ".", "append", "(", "accountName", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
The label is used to identify which account a key is associated with. It contains an account name, which is a URI-encoded string, optionally prefixed by an issuer string identifying the provider or service managing that account. This issuer prefix can be used to prevent collisions between different accounts with different providers that might be identified using the same account name, e.g. the user's email address. The issuer prefix and account name should be separated by a literal or url-encoded colon, and optional spaces may precede the account name. Neither issuer nor account name may themselves contain a colon. Represented in ABNF according to RFC 5234: <p/> label = accountname / issuer (“:” / “%3A”) *”%20” accountname @see <a href="https://code.google.com/p/google-authenticator/wiki/KeyUriFormat">Google Authenticator - KeyUriFormat</a>
[ "The", "label", "is", "used", "to", "identify", "which", "account", "a", "key", "is", "associated", "with", ".", "It", "contains", "an", "account", "name", "which", "is", "a", "URI", "-", "encoded", "string", "optionally", "prefixed", "by", "an", "issuer", "string", "identifying", "the", "provider", "or", "service", "managing", "that", "account", ".", "This", "issuer", "prefix", "can", "be", "used", "to", "prevent", "collisions", "between", "different", "accounts", "with", "different", "providers", "that", "might", "be", "identified", "using", "the", "same", "account", "name", "e", ".", "g", ".", "the", "user", "s", "email", "address", ".", "The", "issuer", "prefix", "and", "account", "name", "should", "be", "separated", "by", "a", "literal", "or", "url", "-", "encoded", "colon", "and", "optional", "spaces", "may", "precede", "the", "account", "name", ".", "Neither", "issuer", "nor", "account", "name", "may", "themselves", "contain", "a", "colon", ".", "Represented", "in", "ABNF", "according", "to", "RFC", "5234", ":", "<p", "/", ">", "label", "=", "accountname", "/", "issuer", "(", "“", ":", "”", "/", "“%3A”", ")", "*", "”%20”", "accountname" ]
train
https://github.com/wstrange/GoogleAuth/blob/03f37333f8b3e411e10e63a7c85c4d2155929321/src/main/java/com/warrenstrange/googleauth/GoogleAuthenticatorQRGenerator.java#L90-L113
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java
Sort.quickSelect
public static <T extends Comparable<? super T>> void quickSelect( T[] arr, int k ) { """ quick select algorithm @param arr an array of Comparable items @param k the k-th small index """ quickSelect( arr, 0, arr.length - 1, k ); }
java
public static <T extends Comparable<? super T>> void quickSelect( T[] arr, int k ) { quickSelect( arr, 0, arr.length - 1, k ); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "void", "quickSelect", "(", "T", "[", "]", "arr", ",", "int", "k", ")", "{", "quickSelect", "(", "arr", ",", "0", ",", "arr", ".", "length", "-", "1", ",", "k", ")", ";", "}" ]
quick select algorithm @param arr an array of Comparable items @param k the k-th small index
[ "quick", "select", "algorithm" ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/util/Sort.java#L306-L310
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java
KltTracker.setImage
public void setImage(I image, D derivX, D derivY) { """ Sets the current image it should be tracking with. @param image Original input image. @param derivX Image derivative along the x-axis @param derivY Image derivative along the y-axis """ InputSanityCheck.checkSameShape(image, derivX, derivY); this.image = image; this.interpInput.setImage(image); this.derivX = derivX; this.derivY = derivY; }
java
public void setImage(I image, D derivX, D derivY) { InputSanityCheck.checkSameShape(image, derivX, derivY); this.image = image; this.interpInput.setImage(image); this.derivX = derivX; this.derivY = derivY; }
[ "public", "void", "setImage", "(", "I", "image", ",", "D", "derivX", ",", "D", "derivY", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "image", ",", "derivX", ",", "derivY", ")", ";", "this", ".", "image", "=", "image", ";", "this", ".", "interpInput", ".", "setImage", "(", "image", ")", ";", "this", ".", "derivX", "=", "derivX", ";", "this", ".", "derivY", "=", "derivY", ";", "}" ]
Sets the current image it should be tracking with. @param image Original input image. @param derivX Image derivative along the x-axis @param derivY Image derivative along the y-axis
[ "Sets", "the", "current", "image", "it", "should", "be", "tracking", "with", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/tracker/klt/KltTracker.java#L119-L127
EvidentSolutions/dalesbred
dalesbred/src/main/java/org/dalesbred/dialect/Dialect.java
Dialect.bindArgument
public void bindArgument(@NotNull PreparedStatement ps, int index, @Nullable Object value) throws SQLException { """ Bind object to {@link PreparedStatement}. Can be overridden by subclasses to implement custom argument binding. @param ps statement to bind object to @param index index of the parameter @param value to bind @throws SQLException if something fails """ ArgumentBinder.bindArgument(ps, index, value); }
java
public void bindArgument(@NotNull PreparedStatement ps, int index, @Nullable Object value) throws SQLException { ArgumentBinder.bindArgument(ps, index, value); }
[ "public", "void", "bindArgument", "(", "@", "NotNull", "PreparedStatement", "ps", ",", "int", "index", ",", "@", "Nullable", "Object", "value", ")", "throws", "SQLException", "{", "ArgumentBinder", ".", "bindArgument", "(", "ps", ",", "index", ",", "value", ")", ";", "}" ]
Bind object to {@link PreparedStatement}. Can be overridden by subclasses to implement custom argument binding. @param ps statement to bind object to @param index index of the parameter @param value to bind @throws SQLException if something fails
[ "Bind", "object", "to", "{", "@link", "PreparedStatement", "}", ".", "Can", "be", "overridden", "by", "subclasses", "to", "implement", "custom", "argument", "binding", "." ]
train
https://github.com/EvidentSolutions/dalesbred/blob/713f5b6e152d97e1672ca68b9ff9c7c6c288ceb1/dalesbred/src/main/java/org/dalesbred/dialect/Dialect.java#L155-L157
geomajas/geomajas-project-server
api/src/main/java/org/geomajas/layer/feature/attribute/ManyToOneAttribute.java
ManyToOneAttribute.setUrlAttribute
public void setUrlAttribute(String name, String value) { """ Sets the specified URL attribute to the specified value. @param name name of the attribute @param value value of the attribute @since 1.9.0 """ ensureValue(); Attribute attribute = new UrlAttribute(value); attribute.setEditable(isEditable(name)); getValue().getAllAttributes().put(name, attribute); }
java
public void setUrlAttribute(String name, String value) { ensureValue(); Attribute attribute = new UrlAttribute(value); attribute.setEditable(isEditable(name)); getValue().getAllAttributes().put(name, attribute); }
[ "public", "void", "setUrlAttribute", "(", "String", "name", ",", "String", "value", ")", "{", "ensureValue", "(", ")", ";", "Attribute", "attribute", "=", "new", "UrlAttribute", "(", "value", ")", ";", "attribute", ".", "setEditable", "(", "isEditable", "(", "name", ")", ")", ";", "getValue", "(", ")", ".", "getAllAttributes", "(", ")", ".", "put", "(", "name", ",", "attribute", ")", ";", "}" ]
Sets the specified URL attribute to the specified value. @param name name of the attribute @param value value of the attribute @since 1.9.0
[ "Sets", "the", "specified", "URL", "attribute", "to", "the", "specified", "value", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/api/src/main/java/org/geomajas/layer/feature/attribute/ManyToOneAttribute.java#L258-L263
tvesalainen/util
util/src/main/java/org/vesalainen/util/AbstractConfigFile.java
AbstractConfigFile.storeAs
public void storeAs(File file) throws IOException { """ Stores xml-content to file. This doesn't change stored url/file. @param file @throws IOException """ try (FileOutputStream fos = new FileOutputStream(file); OutputStreamWriter osw = new OutputStreamWriter(fos, UTF_8); BufferedWriter bw = new BufferedWriter(osw)) { store(bw); } }
java
public void storeAs(File file) throws IOException { try (FileOutputStream fos = new FileOutputStream(file); OutputStreamWriter osw = new OutputStreamWriter(fos, UTF_8); BufferedWriter bw = new BufferedWriter(osw)) { store(bw); } }
[ "public", "void", "storeAs", "(", "File", "file", ")", "throws", "IOException", "{", "try", "(", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "file", ")", ";", "OutputStreamWriter", "osw", "=", "new", "OutputStreamWriter", "(", "fos", ",", "UTF_8", ")", ";", "BufferedWriter", "bw", "=", "new", "BufferedWriter", "(", "osw", ")", ")", "{", "store", "(", "bw", ")", ";", "}", "}" ]
Stores xml-content to file. This doesn't change stored url/file. @param file @throws IOException
[ "Stores", "xml", "-", "content", "to", "file", ".", "This", "doesn", "t", "change", "stored", "url", "/", "file", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/AbstractConfigFile.java#L150-L158
52inc/android-52Kit
library/src/main/java/com/ftinc/kit/font/FontLoader.java
FontLoader.getTypeface
public static Typeface getTypeface(Context ctx, Face type) { """ Get a Roboto typeface for a given string type @param ctx the application context @param type the typeface type argument @return the loaded typeface, or null """ return getTypeface(ctx, "fonts/" + type.getFontFileName()); }
java
public static Typeface getTypeface(Context ctx, Face type){ return getTypeface(ctx, "fonts/" + type.getFontFileName()); }
[ "public", "static", "Typeface", "getTypeface", "(", "Context", "ctx", ",", "Face", "type", ")", "{", "return", "getTypeface", "(", "ctx", ",", "\"fonts/\"", "+", "type", ".", "getFontFileName", "(", ")", ")", ";", "}" ]
Get a Roboto typeface for a given string type @param ctx the application context @param type the typeface type argument @return the loaded typeface, or null
[ "Get", "a", "Roboto", "typeface", "for", "a", "given", "string", "type" ]
train
https://github.com/52inc/android-52Kit/blob/8644fab0f633477b1bb1dddd8147a9ef8bc03516/library/src/main/java/com/ftinc/kit/font/FontLoader.java#L104-L106
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java
AbstractMemberWriter.getSummaryTableTree
public Content getSummaryTableTree(ClassDoc classDoc, List<Content> tableContents) { """ Get the summary table tree for the given class. @param classDoc the class for which the summary table is generated @param tableContents list of contents to be displayed in the summary table @return a content tree for the summary table """ return writer.getSummaryTableTree(this, classDoc, tableContents, showTabs()); }
java
public Content getSummaryTableTree(ClassDoc classDoc, List<Content> tableContents) { return writer.getSummaryTableTree(this, classDoc, tableContents, showTabs()); }
[ "public", "Content", "getSummaryTableTree", "(", "ClassDoc", "classDoc", ",", "List", "<", "Content", ">", "tableContents", ")", "{", "return", "writer", ".", "getSummaryTableTree", "(", "this", ",", "classDoc", ",", "tableContents", ",", "showTabs", "(", ")", ")", ";", "}" ]
Get the summary table tree for the given class. @param classDoc the class for which the summary table is generated @param tableContents list of contents to be displayed in the summary table @return a content tree for the summary table
[ "Get", "the", "summary", "table", "tree", "for", "the", "given", "class", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java#L672-L674
BigBadaboom/androidsvg
androidsvg/src/main/java/com/caverock/androidsvg/SVG.java
SVG.getFromResource
@SuppressWarnings("WeakerAccess") public static SVG getFromResource(Context context, int resourceId) throws SVGParseException { """ Read and parse an SVG from the given resource location. @param context the Android context of the resource. @param resourceId the resource identifier of the SVG document. @return an SVG instance on which you can call one of the render methods. @throws SVGParseException if there is an error parsing the document. """ return getFromResource(context.getResources(), resourceId); }
java
@SuppressWarnings("WeakerAccess") public static SVG getFromResource(Context context, int resourceId) throws SVGParseException { return getFromResource(context.getResources(), resourceId); }
[ "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "static", "SVG", "getFromResource", "(", "Context", "context", ",", "int", "resourceId", ")", "throws", "SVGParseException", "{", "return", "getFromResource", "(", "context", ".", "getResources", "(", ")", ",", "resourceId", ")", ";", "}" ]
Read and parse an SVG from the given resource location. @param context the Android context of the resource. @param resourceId the resource identifier of the SVG document. @return an SVG instance on which you can call one of the render methods. @throws SVGParseException if there is an error parsing the document.
[ "Read", "and", "parse", "an", "SVG", "from", "the", "given", "resource", "location", "." ]
train
https://github.com/BigBadaboom/androidsvg/blob/0d1614dd1a4da10ea4afe3b0cea1361a4ac6b45a/androidsvg/src/main/java/com/caverock/androidsvg/SVG.java#L177-L181
apache/incubator-gobblin
gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java
GitFlowGraphMonitor.removeDataNode
private void removeDataNode(DiffEntry change) { """ Remove a {@link DataNode} from the {@link FlowGraph}. The method extracts the nodeId of the {@link DataNode} from the node config file and uses it to delete the associated {@link DataNode}. @param change """ if (checkFilePath(change.getOldPath(), NODE_FILE_DEPTH)) { Path nodeFilePath = new Path(this.repositoryDir, change.getOldPath()); Config config = getNodeConfigWithOverrides(ConfigFactory.empty(), nodeFilePath); String nodeId = config.getString(FlowGraphConfigurationKeys.DATA_NODE_ID_KEY); if (!this.flowGraph.deleteDataNode(nodeId)) { log.warn("Could not remove DataNode {} from FlowGraph; skipping", nodeId); } else { log.info("Removed DataNode {} from FlowGraph", nodeId); } } }
java
private void removeDataNode(DiffEntry change) { if (checkFilePath(change.getOldPath(), NODE_FILE_DEPTH)) { Path nodeFilePath = new Path(this.repositoryDir, change.getOldPath()); Config config = getNodeConfigWithOverrides(ConfigFactory.empty(), nodeFilePath); String nodeId = config.getString(FlowGraphConfigurationKeys.DATA_NODE_ID_KEY); if (!this.flowGraph.deleteDataNode(nodeId)) { log.warn("Could not remove DataNode {} from FlowGraph; skipping", nodeId); } else { log.info("Removed DataNode {} from FlowGraph", nodeId); } } }
[ "private", "void", "removeDataNode", "(", "DiffEntry", "change", ")", "{", "if", "(", "checkFilePath", "(", "change", ".", "getOldPath", "(", ")", ",", "NODE_FILE_DEPTH", ")", ")", "{", "Path", "nodeFilePath", "=", "new", "Path", "(", "this", ".", "repositoryDir", ",", "change", ".", "getOldPath", "(", ")", ")", ";", "Config", "config", "=", "getNodeConfigWithOverrides", "(", "ConfigFactory", ".", "empty", "(", ")", ",", "nodeFilePath", ")", ";", "String", "nodeId", "=", "config", ".", "getString", "(", "FlowGraphConfigurationKeys", ".", "DATA_NODE_ID_KEY", ")", ";", "if", "(", "!", "this", ".", "flowGraph", ".", "deleteDataNode", "(", "nodeId", ")", ")", "{", "log", ".", "warn", "(", "\"Could not remove DataNode {} from FlowGraph; skipping\"", ",", "nodeId", ")", ";", "}", "else", "{", "log", ".", "info", "(", "\"Removed DataNode {} from FlowGraph\"", ",", "nodeId", ")", ";", "}", "}", "}" ]
Remove a {@link DataNode} from the {@link FlowGraph}. The method extracts the nodeId of the {@link DataNode} from the node config file and uses it to delete the associated {@link DataNode}. @param change
[ "Remove", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/core/GitFlowGraphMonitor.java#L200-L211
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceRegionPersistenceImpl.java
CommerceRegionPersistenceImpl.removeByC_A
@Override public void removeByC_A(long commerceCountryId, boolean active) { """ Removes all the commerce regions where commerceCountryId = &#63; and active = &#63; from the database. @param commerceCountryId the commerce country ID @param active the active """ for (CommerceRegion commerceRegion : findByC_A(commerceCountryId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceRegion); } }
java
@Override public void removeByC_A(long commerceCountryId, boolean active) { for (CommerceRegion commerceRegion : findByC_A(commerceCountryId, active, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commerceRegion); } }
[ "@", "Override", "public", "void", "removeByC_A", "(", "long", "commerceCountryId", ",", "boolean", "active", ")", "{", "for", "(", "CommerceRegion", "commerceRegion", ":", "findByC_A", "(", "commerceCountryId", ",", "active", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "commerceRegion", ")", ";", "}", "}" ]
Removes all the commerce regions where commerceCountryId = &#63; and active = &#63; from the database. @param commerceCountryId the commerce country ID @param active the active
[ "Removes", "all", "the", "commerce", "regions", "where", "commerceCountryId", "=", "&#63", ";", "and", "active", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceRegionPersistenceImpl.java#L2732-L2738
ixa-ehu/ixa-pipe-ml
src/main/java/eus/ixa/ixa/pipe/ml/document/DocumentClassifierEvaluator.java
DocumentClassifierEvaluator.processSample
public DocSample processSample(DocSample sample) { """ Evaluates the given reference {@link DocSample} object. This is done by categorizing the document from the provided {@link DocSample}. The detected category is then used to calculate and update the score. @param sample the reference {@link DocSample}. """ if (sample.isClearAdaptiveDataSet()) { this.docClassifier.clearFeatureData(); } String[] document = sample.getTokens(); String cat = docClassifier.classify(document); if (sample.getLabel().equals(cat)) { accuracy.add(1); } else { accuracy.add(0); } return new DocSample(cat, sample.getTokens(), sample.isClearAdaptiveDataSet()); }
java
public DocSample processSample(DocSample sample) { if (sample.isClearAdaptiveDataSet()) { this.docClassifier.clearFeatureData(); } String[] document = sample.getTokens(); String cat = docClassifier.classify(document); if (sample.getLabel().equals(cat)) { accuracy.add(1); } else { accuracy.add(0); } return new DocSample(cat, sample.getTokens(), sample.isClearAdaptiveDataSet()); }
[ "public", "DocSample", "processSample", "(", "DocSample", "sample", ")", "{", "if", "(", "sample", ".", "isClearAdaptiveDataSet", "(", ")", ")", "{", "this", ".", "docClassifier", ".", "clearFeatureData", "(", ")", ";", "}", "String", "[", "]", "document", "=", "sample", ".", "getTokens", "(", ")", ";", "String", "cat", "=", "docClassifier", ".", "classify", "(", "document", ")", ";", "if", "(", "sample", ".", "getLabel", "(", ")", ".", "equals", "(", "cat", ")", ")", "{", "accuracy", ".", "add", "(", "1", ")", ";", "}", "else", "{", "accuracy", ".", "add", "(", "0", ")", ";", "}", "return", "new", "DocSample", "(", "cat", ",", "sample", ".", "getTokens", "(", ")", ",", "sample", ".", "isClearAdaptiveDataSet", "(", ")", ")", ";", "}" ]
Evaluates the given reference {@link DocSample} object. This is done by categorizing the document from the provided {@link DocSample}. The detected category is then used to calculate and update the score. @param sample the reference {@link DocSample}.
[ "Evaluates", "the", "given", "reference", "{", "@link", "DocSample", "}", "object", "." ]
train
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/document/DocumentClassifierEvaluator.java#L58-L73
dustin/java-memcached-client
src/main/java/net/spy/memcached/MemcachedClient.java
MemcachedClient.asyncCAS
@Override public OperationFuture<CASResponse> asyncCAS(String key, long casId, Object value) { """ Asynchronous CAS operation using the default transcoder. @param key the key @param casId the CAS identifier (from a gets operation) @param value the new value @return a future that will indicate the status of the CAS @throws IllegalStateException in the rare circumstance where queue is too full to accept any more requests """ return asyncCAS(key, casId, value, transcoder); }
java
@Override public OperationFuture<CASResponse> asyncCAS(String key, long casId, Object value) { return asyncCAS(key, casId, value, transcoder); }
[ "@", "Override", "public", "OperationFuture", "<", "CASResponse", ">", "asyncCAS", "(", "String", "key", ",", "long", "casId", ",", "Object", "value", ")", "{", "return", "asyncCAS", "(", "key", ",", "casId", ",", "value", ",", "transcoder", ")", ";", "}" ]
Asynchronous CAS operation using the default transcoder. @param key the key @param casId the CAS identifier (from a gets operation) @param value the new value @return a future that will indicate the status of the CAS @throws IllegalStateException in the rare circumstance where queue is too full to accept any more requests
[ "Asynchronous", "CAS", "operation", "using", "the", "default", "transcoder", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/MemcachedClient.java#L667-L671
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/quantiles/DoublesUnionImpl.java
DoublesUnionImpl.directInstance
static DoublesUnionImpl directInstance(final int maxK, final WritableMemory dstMem) { """ Returns a empty DoublesUnion object that refers to the given direct, off-heap Memory, which will be initialized to the empty state. @param maxK determines the accuracy and size of the union and is a maximum value. The effective <i>k</i> can be smaller due to unions with smaller <i>k</i> sketches. It is recommended that <i>maxK</i> be a power of 2 to enable unioning of sketches with different values of <i>k</i>. @param dstMem the Memory to be used by the sketch @return a DoublesUnion object """ final DirectUpdateDoublesSketch sketch = DirectUpdateDoublesSketch.newInstance(maxK, dstMem); final DoublesUnionImpl union = new DoublesUnionImpl(maxK); union.maxK_ = maxK; union.gadget_ = sketch; return union; }
java
static DoublesUnionImpl directInstance(final int maxK, final WritableMemory dstMem) { final DirectUpdateDoublesSketch sketch = DirectUpdateDoublesSketch.newInstance(maxK, dstMem); final DoublesUnionImpl union = new DoublesUnionImpl(maxK); union.maxK_ = maxK; union.gadget_ = sketch; return union; }
[ "static", "DoublesUnionImpl", "directInstance", "(", "final", "int", "maxK", ",", "final", "WritableMemory", "dstMem", ")", "{", "final", "DirectUpdateDoublesSketch", "sketch", "=", "DirectUpdateDoublesSketch", ".", "newInstance", "(", "maxK", ",", "dstMem", ")", ";", "final", "DoublesUnionImpl", "union", "=", "new", "DoublesUnionImpl", "(", "maxK", ")", ";", "union", ".", "maxK_", "=", "maxK", ";", "union", ".", "gadget_", "=", "sketch", ";", "return", "union", ";", "}" ]
Returns a empty DoublesUnion object that refers to the given direct, off-heap Memory, which will be initialized to the empty state. @param maxK determines the accuracy and size of the union and is a maximum value. The effective <i>k</i> can be smaller due to unions with smaller <i>k</i> sketches. It is recommended that <i>maxK</i> be a power of 2 to enable unioning of sketches with different values of <i>k</i>. @param dstMem the Memory to be used by the sketch @return a DoublesUnion object
[ "Returns", "a", "empty", "DoublesUnion", "object", "that", "refers", "to", "the", "given", "direct", "off", "-", "heap", "Memory", "which", "will", "be", "initialized", "to", "the", "empty", "state", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesUnionImpl.java#L48-L54
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/index/schema/mapping/Mapping.java
Mapping.addFields
public void addFields(Document document, Columns columns) { """ Adds to the specified {@link org.apache.lucene.document.Document} the Lucene fields representing the specified {@link com.stratio.cassandra.index.schema.Columns}. @param document The Lucene {@link org.apache.lucene.document.Document} where the fields are going to be added. @param columns The {@link com.stratio.cassandra.index.schema.Columns} to be added. """ for (Column column : columns) { String name = column.getName(); ColumnMapper columnMapper = getMapper(name); if (columnMapper != null) { for (IndexableField field : columnMapper.fields(column)) { document.add(field); } } } }
java
public void addFields(Document document, Columns columns) { for (Column column : columns) { String name = column.getName(); ColumnMapper columnMapper = getMapper(name); if (columnMapper != null) { for (IndexableField field : columnMapper.fields(column)) { document.add(field); } } } }
[ "public", "void", "addFields", "(", "Document", "document", ",", "Columns", "columns", ")", "{", "for", "(", "Column", "column", ":", "columns", ")", "{", "String", "name", "=", "column", ".", "getName", "(", ")", ";", "ColumnMapper", "columnMapper", "=", "getMapper", "(", "name", ")", ";", "if", "(", "columnMapper", "!=", "null", ")", "{", "for", "(", "IndexableField", "field", ":", "columnMapper", ".", "fields", "(", "column", ")", ")", "{", "document", ".", "add", "(", "field", ")", ";", "}", "}", "}", "}" ]
Adds to the specified {@link org.apache.lucene.document.Document} the Lucene fields representing the specified {@link com.stratio.cassandra.index.schema.Columns}. @param document The Lucene {@link org.apache.lucene.document.Document} where the fields are going to be added. @param columns The {@link com.stratio.cassandra.index.schema.Columns} to be added.
[ "Adds", "to", "the", "specified", "{", "@link", "org", ".", "apache", ".", "lucene", ".", "document", ".", "Document", "}", "the", "Lucene", "fields", "representing", "the", "specified", "{", "@link", "com", ".", "stratio", ".", "cassandra", ".", "index", ".", "schema", ".", "Columns", "}", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/schema/mapping/Mapping.java#L80-L90
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_domain_domainName_GET
public OvhDomain organizationName_service_exchangeService_domain_domainName_GET(String organizationName, String exchangeService, String domainName) throws IOException { """ Get this object properties REST: GET /email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName} @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param domainName [required] Domain name """ String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}"; StringBuilder sb = path(qPath, organizationName, exchangeService, domainName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDomain.class); }
java
public OvhDomain organizationName_service_exchangeService_domain_domainName_GET(String organizationName, String exchangeService, String domainName) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}"; StringBuilder sb = path(qPath, organizationName, exchangeService, domainName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDomain.class); }
[ "public", "OvhDomain", "organizationName_service_exchangeService_domain_domainName_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "domainName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "organizationName", ",", "exchangeService", ",", "domainName", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhDomain", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /email/exchange/{organizationName}/service/{exchangeService}/domain/{domainName} @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param domainName [required] Domain name
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L484-L489
MenoData/Time4J
base/src/main/java/net/time4j/calendar/astro/JulianDay.java
JulianDay.ofEphemerisTime
public static JulianDay ofEphemerisTime( CalendarDate date, PlainTime time, ZonalOffset offset ) { """ /*[deutsch] <p>Erzeugt einen julianischen Tag auf der Zeitskala {@link TimeScale#TT}, manchmal auch <em>Julian Ephemeris Day</em> genannt. </p> <p>Diese Art des julianischen Tages repr&auml;sentiert den aktuellen astronomischen Standard. Die Zeit TT-2000-01-01T12:00Z entspricht JD(TT)2451545.0 </p> @param date calendar date @param time local time @param offset timezone offset @return JulianDay @throws IllegalArgumentException if the Julian day of moment is not in supported range @since 3.36/4.31 """ long d = EpochDays.JULIAN_DAY_NUMBER.transform(date.getDaysSinceEpochUTC(), EpochDays.UTC); double tod = time.get(PlainTime.NANO_OF_DAY) / (86400.0 * 1000000000L); double jde = d - 0.5 + tod - offset.getIntegralAmount() / 86400.0; return new JulianDay(jde, TimeScale.TT); }
java
public static JulianDay ofEphemerisTime( CalendarDate date, PlainTime time, ZonalOffset offset ) { long d = EpochDays.JULIAN_DAY_NUMBER.transform(date.getDaysSinceEpochUTC(), EpochDays.UTC); double tod = time.get(PlainTime.NANO_OF_DAY) / (86400.0 * 1000000000L); double jde = d - 0.5 + tod - offset.getIntegralAmount() / 86400.0; return new JulianDay(jde, TimeScale.TT); }
[ "public", "static", "JulianDay", "ofEphemerisTime", "(", "CalendarDate", "date", ",", "PlainTime", "time", ",", "ZonalOffset", "offset", ")", "{", "long", "d", "=", "EpochDays", ".", "JULIAN_DAY_NUMBER", ".", "transform", "(", "date", ".", "getDaysSinceEpochUTC", "(", ")", ",", "EpochDays", ".", "UTC", ")", ";", "double", "tod", "=", "time", ".", "get", "(", "PlainTime", ".", "NANO_OF_DAY", ")", "/", "(", "86400.0", "*", "1000000000L", ")", ";", "double", "jde", "=", "d", "-", "0.5", "+", "tod", "-", "offset", ".", "getIntegralAmount", "(", ")", "/", "86400.0", ";", "return", "new", "JulianDay", "(", "jde", ",", "TimeScale", ".", "TT", ")", ";", "}" ]
/*[deutsch] <p>Erzeugt einen julianischen Tag auf der Zeitskala {@link TimeScale#TT}, manchmal auch <em>Julian Ephemeris Day</em> genannt. </p> <p>Diese Art des julianischen Tages repr&auml;sentiert den aktuellen astronomischen Standard. Die Zeit TT-2000-01-01T12:00Z entspricht JD(TT)2451545.0 </p> @param date calendar date @param time local time @param offset timezone offset @return JulianDay @throws IllegalArgumentException if the Julian day of moment is not in supported range @since 3.36/4.31
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Erzeugt", "einen", "julianischen", "Tag", "auf", "der", "Zeitskala", "{", "@link", "TimeScale#TT", "}", "manchmal", "auch", "<em", ">", "Julian", "Ephemeris", "Day<", "/", "em", ">", "genannt", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/calendar/astro/JulianDay.java#L219-L230
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java
CoverageUtilities.coordinateFromColRow
public static Coordinate coordinateFromColRow( int col, int row, GridGeometry2D gridGeometry ) { """ Utility method to get the coordinate of a col and row from a {@link GridGeometry2D}. @param col the col to transform. @param row the row to transform. @param gridGeometry the gridgeometry to use. @return the coordinate or <code>null</code> if something went wrong. """ try { GridCoordinates2D pos = new GridCoordinates2D(col, row); DirectPosition gridToWorld = gridGeometry.gridToWorld(pos); double[] coord = gridToWorld.getCoordinate(); return new Coordinate(coord[0], coord[1]); } catch (InvalidGridGeometryException e) { e.printStackTrace(); } catch (TransformException e) { e.printStackTrace(); } return null; }
java
public static Coordinate coordinateFromColRow( int col, int row, GridGeometry2D gridGeometry ) { try { GridCoordinates2D pos = new GridCoordinates2D(col, row); DirectPosition gridToWorld = gridGeometry.gridToWorld(pos); double[] coord = gridToWorld.getCoordinate(); return new Coordinate(coord[0], coord[1]); } catch (InvalidGridGeometryException e) { e.printStackTrace(); } catch (TransformException e) { e.printStackTrace(); } return null; }
[ "public", "static", "Coordinate", "coordinateFromColRow", "(", "int", "col", ",", "int", "row", ",", "GridGeometry2D", "gridGeometry", ")", "{", "try", "{", "GridCoordinates2D", "pos", "=", "new", "GridCoordinates2D", "(", "col", ",", "row", ")", ";", "DirectPosition", "gridToWorld", "=", "gridGeometry", ".", "gridToWorld", "(", "pos", ")", ";", "double", "[", "]", "coord", "=", "gridToWorld", ".", "getCoordinate", "(", ")", ";", "return", "new", "Coordinate", "(", "coord", "[", "0", "]", ",", "coord", "[", "1", "]", ")", ";", "}", "catch", "(", "InvalidGridGeometryException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "TransformException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}" ]
Utility method to get the coordinate of a col and row from a {@link GridGeometry2D}. @param col the col to transform. @param row the row to transform. @param gridGeometry the gridgeometry to use. @return the coordinate or <code>null</code> if something went wrong.
[ "Utility", "method", "to", "get", "the", "coordinate", "of", "a", "col", "and", "row", "from", "a", "{", "@link", "GridGeometry2D", "}", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1345-L1357
janus-project/guava.janusproject.io
guava-gwt/src-super/com/google/common/base/super/com/google/common/base/CharMatcher.java
CharMatcher.inRange
public static CharMatcher inRange(final char startInclusive, final char endInclusive) { """ Returns a {@code char} matcher that matches any character in a given range (both endpoints are inclusive). For example, to match any lowercase letter of the English alphabet, use {@code CharMatcher.inRange('a', 'z')}. @throws IllegalArgumentException if {@code endInclusive < startInclusive} """ checkArgument(endInclusive >= startInclusive); return new FastMatcher() { @Override public boolean matches(char c) { return startInclusive <= c && c <= endInclusive; } @Override public String toString() { return "CharMatcher.inRange('" + showCharacter(startInclusive) + "', '" + showCharacter(endInclusive) + "')"; } }; }
java
public static CharMatcher inRange(final char startInclusive, final char endInclusive) { checkArgument(endInclusive >= startInclusive); return new FastMatcher() { @Override public boolean matches(char c) { return startInclusive <= c && c <= endInclusive; } @Override public String toString() { return "CharMatcher.inRange('" + showCharacter(startInclusive) + "', '" + showCharacter(endInclusive) + "')"; } }; }
[ "public", "static", "CharMatcher", "inRange", "(", "final", "char", "startInclusive", ",", "final", "char", "endInclusive", ")", "{", "checkArgument", "(", "endInclusive", ">=", "startInclusive", ")", ";", "return", "new", "FastMatcher", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "char", "c", ")", "{", "return", "startInclusive", "<=", "c", "&&", "c", "<=", "endInclusive", ";", "}", "@", "Override", "public", "String", "toString", "(", ")", "{", "return", "\"CharMatcher.inRange('\"", "+", "showCharacter", "(", "startInclusive", ")", "+", "\"', '\"", "+", "showCharacter", "(", "endInclusive", ")", "+", "\"')\"", ";", "}", "}", ";", "}" ]
Returns a {@code char} matcher that matches any character in a given range (both endpoints are inclusive). For example, to match any lowercase letter of the English alphabet, use {@code CharMatcher.inRange('a', 'z')}. @throws IllegalArgumentException if {@code endInclusive < startInclusive}
[ "Returns", "a", "{", "@code", "char", "}", "matcher", "that", "matches", "any", "character", "in", "a", "given", "range", "(", "both", "endpoints", "are", "inclusive", ")", ".", "For", "example", "to", "match", "any", "lowercase", "letter", "of", "the", "English", "alphabet", "use", "{", "@code", "CharMatcher", ".", "inRange", "(", "a", "z", ")", "}", "." ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava-gwt/src-super/com/google/common/base/super/com/google/common/base/CharMatcher.java#L558-L570
ixa-ehu/ixa-pipe-ml
src/main/java/eus/ixa/ixa/pipe/ml/parse/ShiftReduceParser.java
ShiftReduceParser.buildDictionary
public static Dictionary buildDictionary(final ObjectStream<Parse> data, final HeadRules rules, final int cutoff) throws IOException { """ Creates a n-gram dictionary from the specified data stream using the specified head rule and specified cut-off. @param data The data stream of parses. @param rules The head rules for the parses. @param cutoff The minimum number of entries required for the n-gram to be saved as part of the dictionary. @throws IOException if io problems @return A dictionary object. """ final TrainingParameters params = new TrainingParameters(); params.put("dict", TrainingParameters.CUTOFF_PARAM, Integer.toString(cutoff)); return buildDictionary(data, rules, params); }
java
public static Dictionary buildDictionary(final ObjectStream<Parse> data, final HeadRules rules, final int cutoff) throws IOException { final TrainingParameters params = new TrainingParameters(); params.put("dict", TrainingParameters.CUTOFF_PARAM, Integer.toString(cutoff)); return buildDictionary(data, rules, params); }
[ "public", "static", "Dictionary", "buildDictionary", "(", "final", "ObjectStream", "<", "Parse", ">", "data", ",", "final", "HeadRules", "rules", ",", "final", "int", "cutoff", ")", "throws", "IOException", "{", "final", "TrainingParameters", "params", "=", "new", "TrainingParameters", "(", ")", ";", "params", ".", "put", "(", "\"dict\"", ",", "TrainingParameters", ".", "CUTOFF_PARAM", ",", "Integer", ".", "toString", "(", "cutoff", ")", ")", ";", "return", "buildDictionary", "(", "data", ",", "rules", ",", "params", ")", ";", "}" ]
Creates a n-gram dictionary from the specified data stream using the specified head rule and specified cut-off. @param data The data stream of parses. @param rules The head rules for the parses. @param cutoff The minimum number of entries required for the n-gram to be saved as part of the dictionary. @throws IOException if io problems @return A dictionary object.
[ "Creates", "a", "n", "-", "gram", "dictionary", "from", "the", "specified", "data", "stream", "using", "the", "specified", "head", "rule", "and", "specified", "cut", "-", "off", "." ]
train
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/parse/ShiftReduceParser.java#L902-L910
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeTree.java
InodeTree.computePathForInode
private void computePathForInode(InodeView inode, StringBuilder builder) throws FileDoesNotExistException { """ Appends components of the path from a given inode. @param inode the inode to compute the path for @param builder a {@link StringBuilder} that is updated with the path components @throws FileDoesNotExistException if an inode in the path does not exist """ long id; long parentId; String name; try (LockResource lr = mInodeLockManager.lockInode(inode, LockMode.READ)) { id = inode.getId(); parentId = inode.getParentId(); name = inode.getName(); } if (isRootId(id)) { builder.append(AlluxioURI.SEPARATOR); } else if (isRootId(parentId)) { builder.append(AlluxioURI.SEPARATOR); builder.append(name); } else { Optional<Inode> parentInode = mInodeStore.get(parentId); if (!parentInode.isPresent()) { throw new FileDoesNotExistException( ExceptionMessage.INODE_DOES_NOT_EXIST.getMessage(parentId)); } computePathForInode(parentInode.get(), builder); builder.append(AlluxioURI.SEPARATOR); builder.append(name); } }
java
private void computePathForInode(InodeView inode, StringBuilder builder) throws FileDoesNotExistException { long id; long parentId; String name; try (LockResource lr = mInodeLockManager.lockInode(inode, LockMode.READ)) { id = inode.getId(); parentId = inode.getParentId(); name = inode.getName(); } if (isRootId(id)) { builder.append(AlluxioURI.SEPARATOR); } else if (isRootId(parentId)) { builder.append(AlluxioURI.SEPARATOR); builder.append(name); } else { Optional<Inode> parentInode = mInodeStore.get(parentId); if (!parentInode.isPresent()) { throw new FileDoesNotExistException( ExceptionMessage.INODE_DOES_NOT_EXIST.getMessage(parentId)); } computePathForInode(parentInode.get(), builder); builder.append(AlluxioURI.SEPARATOR); builder.append(name); } }
[ "private", "void", "computePathForInode", "(", "InodeView", "inode", ",", "StringBuilder", "builder", ")", "throws", "FileDoesNotExistException", "{", "long", "id", ";", "long", "parentId", ";", "String", "name", ";", "try", "(", "LockResource", "lr", "=", "mInodeLockManager", ".", "lockInode", "(", "inode", ",", "LockMode", ".", "READ", ")", ")", "{", "id", "=", "inode", ".", "getId", "(", ")", ";", "parentId", "=", "inode", ".", "getParentId", "(", ")", ";", "name", "=", "inode", ".", "getName", "(", ")", ";", "}", "if", "(", "isRootId", "(", "id", ")", ")", "{", "builder", ".", "append", "(", "AlluxioURI", ".", "SEPARATOR", ")", ";", "}", "else", "if", "(", "isRootId", "(", "parentId", ")", ")", "{", "builder", ".", "append", "(", "AlluxioURI", ".", "SEPARATOR", ")", ";", "builder", ".", "append", "(", "name", ")", ";", "}", "else", "{", "Optional", "<", "Inode", ">", "parentInode", "=", "mInodeStore", ".", "get", "(", "parentId", ")", ";", "if", "(", "!", "parentInode", ".", "isPresent", "(", ")", ")", "{", "throw", "new", "FileDoesNotExistException", "(", "ExceptionMessage", ".", "INODE_DOES_NOT_EXIST", ".", "getMessage", "(", "parentId", ")", ")", ";", "}", "computePathForInode", "(", "parentInode", ".", "get", "(", ")", ",", "builder", ")", ";", "builder", ".", "append", "(", "AlluxioURI", ".", "SEPARATOR", ")", ";", "builder", ".", "append", "(", "name", ")", ";", "}", "}" ]
Appends components of the path from a given inode. @param inode the inode to compute the path for @param builder a {@link StringBuilder} that is updated with the path components @throws FileDoesNotExistException if an inode in the path does not exist
[ "Appends", "components", "of", "the", "path", "from", "a", "given", "inode", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeTree.java#L514-L541
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java
PublicanPODocBookBuilder.buildTranslatedBook
@Override public HashMap<String, byte[]> buildTranslatedBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions buildingOptions, final ZanataDetails zanataDetails) throws BuilderCreationException, BuildProcessingException { """ Builds a DocBook Formatted Book using a Content Specification to define the structure and contents of the book. @param contentSpec The content specification to build from. @param requester The user who requested the build. @param buildingOptions The options to be used when building. @param zanataDetails The Zanata server details to be used when populating links @return Returns a mapping of file names/locations to files. This HashMap can be used to build a ZIP archive. @throws BuilderCreationException Thrown if the builder is unable to start due to incorrect passed variables. @throws BuildProcessingException Any build issue that should not occur under normal circumstances. Ie a Template can't be converted to a DOM Document. """ buildingOptions.setResolveEntities(true); // Translation builds ignore the publican.cfg condition parameter if (contentSpec.getPublicanCfg() != null) { contentSpec.setPublicanCfg(contentSpec.getPublicanCfg().replaceAll("condition:\\s*.*($|\\r\\n|\\n)", "")); } // For PO builds just do a normal build initially and then add the POT/PO files later return buildBook(contentSpec, requester, buildingOptions, new HashMap<String, byte[]>()); }
java
@Override public HashMap<String, byte[]> buildTranslatedBook(final ContentSpec contentSpec, final String requester, final DocBookBuildingOptions buildingOptions, final ZanataDetails zanataDetails) throws BuilderCreationException, BuildProcessingException { buildingOptions.setResolveEntities(true); // Translation builds ignore the publican.cfg condition parameter if (contentSpec.getPublicanCfg() != null) { contentSpec.setPublicanCfg(contentSpec.getPublicanCfg().replaceAll("condition:\\s*.*($|\\r\\n|\\n)", "")); } // For PO builds just do a normal build initially and then add the POT/PO files later return buildBook(contentSpec, requester, buildingOptions, new HashMap<String, byte[]>()); }
[ "@", "Override", "public", "HashMap", "<", "String", ",", "byte", "[", "]", ">", "buildTranslatedBook", "(", "final", "ContentSpec", "contentSpec", ",", "final", "String", "requester", ",", "final", "DocBookBuildingOptions", "buildingOptions", ",", "final", "ZanataDetails", "zanataDetails", ")", "throws", "BuilderCreationException", ",", "BuildProcessingException", "{", "buildingOptions", ".", "setResolveEntities", "(", "true", ")", ";", "// Translation builds ignore the publican.cfg condition parameter", "if", "(", "contentSpec", ".", "getPublicanCfg", "(", ")", "!=", "null", ")", "{", "contentSpec", ".", "setPublicanCfg", "(", "contentSpec", ".", "getPublicanCfg", "(", ")", ".", "replaceAll", "(", "\"condition:\\\\s*.*($|\\\\r\\\\n|\\\\n)\"", ",", "\"\"", ")", ")", ";", "}", "// For PO builds just do a normal build initially and then add the POT/PO files later", "return", "buildBook", "(", "contentSpec", ",", "requester", ",", "buildingOptions", ",", "new", "HashMap", "<", "String", ",", "byte", "[", "]", ">", "(", ")", ")", ";", "}" ]
Builds a DocBook Formatted Book using a Content Specification to define the structure and contents of the book. @param contentSpec The content specification to build from. @param requester The user who requested the build. @param buildingOptions The options to be used when building. @param zanataDetails The Zanata server details to be used when populating links @return Returns a mapping of file names/locations to files. This HashMap can be used to build a ZIP archive. @throws BuilderCreationException Thrown if the builder is unable to start due to incorrect passed variables. @throws BuildProcessingException Any build issue that should not occur under normal circumstances. Ie a Template can't be converted to a DOM Document.
[ "Builds", "a", "DocBook", "Formatted", "Book", "using", "a", "Content", "Specification", "to", "define", "the", "structure", "and", "contents", "of", "the", "book", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/PublicanPODocBookBuilder.java#L106-L117
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WRadioButtonSelectExample.java
WRadioButtonSelectExample.addDisabledExamples
private void addDisabledExamples() { """ Examples of disabled state. You should use {@link WSubordinateControl} to set and manage the disabled state unless there is no facility for the user to enable a control. If you want to prevent the user enabling and interacting with a WRadioButtonSeelct then you should consider using the readOnly state instead of the disabled state. """ add(new WHeading(HeadingLevel.H2, "Disabled WRadioButtonSelect examples")); WFieldLayout layout = new WFieldLayout(); add(layout); WRadioButtonSelect select = new WRadioButtonSelect("australian_state"); select.setDisabled(true); layout.addField("Disabled with no selection", select); select = new WRadioButtonSelect("australian_state"); select.setDisabled(true); select.setFrameless(true); layout.addField("Disabled with no selection no frame", select); select = new SelectWithSelection("australian_state"); select.setDisabled(true); layout.addField("Disabled with selection", select); }
java
private void addDisabledExamples() { add(new WHeading(HeadingLevel.H2, "Disabled WRadioButtonSelect examples")); WFieldLayout layout = new WFieldLayout(); add(layout); WRadioButtonSelect select = new WRadioButtonSelect("australian_state"); select.setDisabled(true); layout.addField("Disabled with no selection", select); select = new WRadioButtonSelect("australian_state"); select.setDisabled(true); select.setFrameless(true); layout.addField("Disabled with no selection no frame", select); select = new SelectWithSelection("australian_state"); select.setDisabled(true); layout.addField("Disabled with selection", select); }
[ "private", "void", "addDisabledExamples", "(", ")", "{", "add", "(", "new", "WHeading", "(", "HeadingLevel", ".", "H2", ",", "\"Disabled WRadioButtonSelect examples\"", ")", ")", ";", "WFieldLayout", "layout", "=", "new", "WFieldLayout", "(", ")", ";", "add", "(", "layout", ")", ";", "WRadioButtonSelect", "select", "=", "new", "WRadioButtonSelect", "(", "\"australian_state\"", ")", ";", "select", ".", "setDisabled", "(", "true", ")", ";", "layout", ".", "addField", "(", "\"Disabled with no selection\"", ",", "select", ")", ";", "select", "=", "new", "WRadioButtonSelect", "(", "\"australian_state\"", ")", ";", "select", ".", "setDisabled", "(", "true", ")", ";", "select", ".", "setFrameless", "(", "true", ")", ";", "layout", ".", "addField", "(", "\"Disabled with no selection no frame\"", ",", "select", ")", ";", "select", "=", "new", "SelectWithSelection", "(", "\"australian_state\"", ")", ";", "select", ".", "setDisabled", "(", "true", ")", ";", "layout", ".", "addField", "(", "\"Disabled with selection\"", ",", "select", ")", ";", "}" ]
Examples of disabled state. You should use {@link WSubordinateControl} to set and manage the disabled state unless there is no facility for the user to enable a control. If you want to prevent the user enabling and interacting with a WRadioButtonSeelct then you should consider using the readOnly state instead of the disabled state.
[ "Examples", "of", "disabled", "state", ".", "You", "should", "use", "{", "@link", "WSubordinateControl", "}", "to", "set", "and", "manage", "the", "disabled", "state", "unless", "there", "is", "no", "facility", "for", "the", "user", "to", "enable", "a", "control", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/theme/WRadioButtonSelectExample.java#L304-L320
zaproxy/zaproxy
src/org/parosproxy/paros/view/WorkbenchPanel.java
WorkbenchPanel.getSortedPanels
public SortedSet<AbstractPanel> getSortedPanels(PanelType panelType) { """ Gets the panels, sorted by name, that were added to the workbench with the given panel type. @param panelType the type of the panel @return a {@code List} with the sorted panels of the given type @throws IllegalArgumentException if the given parameter is {@code null}. @since 2.5.0 """ validateNotNull(panelType, "panelType"); List<AbstractPanel> panels = getPanels(panelType); SortedSet<AbstractPanel> sortedPanels = new TreeSet<>(new Comparator<AbstractPanel>() { @Override public int compare(AbstractPanel abstractPanel, AbstractPanel otherAbstractPanel) { String name = abstractPanel.getName(); String otherName = otherAbstractPanel.getName(); if (name == null) { if (otherName == null) { return 0; } return -1; } else if (otherName == null) { return 1; } return name.compareTo(otherName); } }); sortedPanels.addAll(panels); return sortedPanels; }
java
public SortedSet<AbstractPanel> getSortedPanels(PanelType panelType) { validateNotNull(panelType, "panelType"); List<AbstractPanel> panels = getPanels(panelType); SortedSet<AbstractPanel> sortedPanels = new TreeSet<>(new Comparator<AbstractPanel>() { @Override public int compare(AbstractPanel abstractPanel, AbstractPanel otherAbstractPanel) { String name = abstractPanel.getName(); String otherName = otherAbstractPanel.getName(); if (name == null) { if (otherName == null) { return 0; } return -1; } else if (otherName == null) { return 1; } return name.compareTo(otherName); } }); sortedPanels.addAll(panels); return sortedPanels; }
[ "public", "SortedSet", "<", "AbstractPanel", ">", "getSortedPanels", "(", "PanelType", "panelType", ")", "{", "validateNotNull", "(", "panelType", ",", "\"panelType\"", ")", ";", "List", "<", "AbstractPanel", ">", "panels", "=", "getPanels", "(", "panelType", ")", ";", "SortedSet", "<", "AbstractPanel", ">", "sortedPanels", "=", "new", "TreeSet", "<>", "(", "new", "Comparator", "<", "AbstractPanel", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "AbstractPanel", "abstractPanel", ",", "AbstractPanel", "otherAbstractPanel", ")", "{", "String", "name", "=", "abstractPanel", ".", "getName", "(", ")", ";", "String", "otherName", "=", "otherAbstractPanel", ".", "getName", "(", ")", ";", "if", "(", "name", "==", "null", ")", "{", "if", "(", "otherName", "==", "null", ")", "{", "return", "0", ";", "}", "return", "-", "1", ";", "}", "else", "if", "(", "otherName", "==", "null", ")", "{", "return", "1", ";", "}", "return", "name", ".", "compareTo", "(", "otherName", ")", ";", "}", "}", ")", ";", "sortedPanels", ".", "addAll", "(", "panels", ")", ";", "return", "sortedPanels", ";", "}" ]
Gets the panels, sorted by name, that were added to the workbench with the given panel type. @param panelType the type of the panel @return a {@code List} with the sorted panels of the given type @throws IllegalArgumentException if the given parameter is {@code null}. @since 2.5.0
[ "Gets", "the", "panels", "sorted", "by", "name", "that", "were", "added", "to", "the", "workbench", "with", "the", "given", "panel", "type", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L1067-L1090
awslabs/jsii
packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java
JsiiEngine.invokeMethod
private Object invokeMethod(final Object obj, final Method method, final Object... args) { """ Invokes a Java method, even if the method is protected. @param obj The object @param method The method @param args Method arguments @return The return value """ // turn method to accessible. otherwise, we won't be able to callback to methods // on non-public classes. boolean accessibility = method.isAccessible(); method.setAccessible(true); try { try { return method.invoke(obj, args); } catch (Exception e) { this.log("Error while invoking %s with %s: %s", method, Arrays.toString(args), Throwables.getStackTraceAsString(e)); throw e; } } catch (InvocationTargetException e) { throw new JsiiException(e.getTargetException()); } catch (IllegalAccessException e) { throw new JsiiException(e); } finally { // revert accessibility. method.setAccessible(accessibility); } }
java
private Object invokeMethod(final Object obj, final Method method, final Object... args) { // turn method to accessible. otherwise, we won't be able to callback to methods // on non-public classes. boolean accessibility = method.isAccessible(); method.setAccessible(true); try { try { return method.invoke(obj, args); } catch (Exception e) { this.log("Error while invoking %s with %s: %s", method, Arrays.toString(args), Throwables.getStackTraceAsString(e)); throw e; } } catch (InvocationTargetException e) { throw new JsiiException(e.getTargetException()); } catch (IllegalAccessException e) { throw new JsiiException(e); } finally { // revert accessibility. method.setAccessible(accessibility); } }
[ "private", "Object", "invokeMethod", "(", "final", "Object", "obj", ",", "final", "Method", "method", ",", "final", "Object", "...", "args", ")", "{", "// turn method to accessible. otherwise, we won't be able to callback to methods", "// on non-public classes.", "boolean", "accessibility", "=", "method", ".", "isAccessible", "(", ")", ";", "method", ".", "setAccessible", "(", "true", ")", ";", "try", "{", "try", "{", "return", "method", ".", "invoke", "(", "obj", ",", "args", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "this", ".", "log", "(", "\"Error while invoking %s with %s: %s\"", ",", "method", ",", "Arrays", ".", "toString", "(", "args", ")", ",", "Throwables", ".", "getStackTraceAsString", "(", "e", ")", ")", ";", "throw", "e", ";", "}", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "throw", "new", "JsiiException", "(", "e", ".", "getTargetException", "(", ")", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "JsiiException", "(", "e", ")", ";", "}", "finally", "{", "// revert accessibility.", "method", ".", "setAccessible", "(", "accessibility", ")", ";", "}", "}" ]
Invokes a Java method, even if the method is protected. @param obj The object @param method The method @param args Method arguments @return The return value
[ "Invokes", "a", "Java", "method", "even", "if", "the", "method", "is", "protected", "." ]
train
https://github.com/awslabs/jsii/blob/6bbf743f5f65e98e5199ad31c93961533ffc40e5/packages/jsii-java-runtime/project/src/main/java/software/amazon/jsii/JsiiEngine.java#L381-L402
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRegistryAuditor.java
XDSRegistryAuditor.auditRegisterEvent
protected void auditRegisterEvent( IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, String repositoryUserId, String repositoryIpAddress, String userName, String registryEndpointUri, String submissionSetUniqueId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { """ Generically sends audit messages for XDS Document Registry Register Document Set events @param transaction The specific IHE Transaction (ITI-15 or ITI-41) @param eventOutcome The event outcome indicator @param repositoryUserId The Active Participant UserID for the repository (if using WS-Addressing) @param repositoryIpAddress The IP Address of the repository that initiated the transaction @param userName user name from XUA @param registryEndpointUri The URI of this registry's endpoint that received the transaction @param submissionSetUniqueId The UniqueID of the Submission Set provided @param patientId The Patient Id that this submission pertains to @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token) """ ImportEvent importEvent = new ImportEvent(false, eventOutcome, transaction, purposesOfUse); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(repositoryUserId, null, null, repositoryIpAddress, true); if (! EventUtils.isEmptyOrNull(userName)) { importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } importEvent.addDestinationActiveParticipant(registryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(registryEndpointUri, false), false); if (!EventUtils.isEmptyOrNull(patientId)) { importEvent.addPatientParticipantObject(patientId); } importEvent.addSubmissionSetParticipantObject(submissionSetUniqueId); audit(importEvent); }
java
protected void auditRegisterEvent( IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, String repositoryUserId, String repositoryIpAddress, String userName, String registryEndpointUri, String submissionSetUniqueId, String patientId, List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { ImportEvent importEvent = new ImportEvent(false, eventOutcome, transaction, purposesOfUse); importEvent.setAuditSourceId(getAuditSourceId(), getAuditEnterpriseSiteId()); importEvent.addSourceActiveParticipant(repositoryUserId, null, null, repositoryIpAddress, true); if (! EventUtils.isEmptyOrNull(userName)) { importEvent.addHumanRequestorActiveParticipant(userName, null, userName, userRoles); } importEvent.addDestinationActiveParticipant(registryEndpointUri, getSystemAltUserId(), null, EventUtils.getAddressForUrl(registryEndpointUri, false), false); if (!EventUtils.isEmptyOrNull(patientId)) { importEvent.addPatientParticipantObject(patientId); } importEvent.addSubmissionSetParticipantObject(submissionSetUniqueId); audit(importEvent); }
[ "protected", "void", "auditRegisterEvent", "(", "IHETransactionEventTypeCodes", "transaction", ",", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "String", "repositoryUserId", ",", "String", "repositoryIpAddress", ",", "String", "userName", ",", "String", "registryEndpointUri", ",", "String", "submissionSetUniqueId", ",", "String", "patientId", ",", "List", "<", "CodedValueType", ">", "purposesOfUse", ",", "List", "<", "CodedValueType", ">", "userRoles", ")", "{", "ImportEvent", "importEvent", "=", "new", "ImportEvent", "(", "false", ",", "eventOutcome", ",", "transaction", ",", "purposesOfUse", ")", ";", "importEvent", ".", "setAuditSourceId", "(", "getAuditSourceId", "(", ")", ",", "getAuditEnterpriseSiteId", "(", ")", ")", ";", "importEvent", ".", "addSourceActiveParticipant", "(", "repositoryUserId", ",", "null", ",", "null", ",", "repositoryIpAddress", ",", "true", ")", ";", "if", "(", "!", "EventUtils", ".", "isEmptyOrNull", "(", "userName", ")", ")", "{", "importEvent", ".", "addHumanRequestorActiveParticipant", "(", "userName", ",", "null", ",", "userName", ",", "userRoles", ")", ";", "}", "importEvent", ".", "addDestinationActiveParticipant", "(", "registryEndpointUri", ",", "getSystemAltUserId", "(", ")", ",", "null", ",", "EventUtils", ".", "getAddressForUrl", "(", "registryEndpointUri", ",", "false", ")", ",", "false", ")", ";", "if", "(", "!", "EventUtils", ".", "isEmptyOrNull", "(", "patientId", ")", ")", "{", "importEvent", ".", "addPatientParticipantObject", "(", "patientId", ")", ";", "}", "importEvent", ".", "addSubmissionSetParticipantObject", "(", "submissionSetUniqueId", ")", ";", "audit", "(", "importEvent", ")", ";", "}" ]
Generically sends audit messages for XDS Document Registry Register Document Set events @param transaction The specific IHE Transaction (ITI-15 or ITI-41) @param eventOutcome The event outcome indicator @param repositoryUserId The Active Participant UserID for the repository (if using WS-Addressing) @param repositoryIpAddress The IP Address of the repository that initiated the transaction @param userName user name from XUA @param registryEndpointUri The URI of this registry's endpoint that received the transaction @param submissionSetUniqueId The UniqueID of the Submission Set provided @param patientId The Patient Id that this submission pertains to @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token)
[ "Generically", "sends", "audit", "messages", "for", "XDS", "Document", "Registry", "Register", "Document", "Set", "events" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSRegistryAuditor.java#L215-L238
alkacon/opencms-core
src-setup/org/opencms/setup/CmsSetupBean.java
CmsSetupBean.copyFile
public void copyFile(String source, String target) { """ Copies a given file.<p> @param source the source file @param target the destination file """ try { CmsFileUtil.copy(m_configRfsPath + source, m_configRfsPath + target); } catch (IOException e) { m_errors.add("Could not copy " + source + " to " + target + " \n"); m_errors.add(e.toString() + "\n"); } }
java
public void copyFile(String source, String target) { try { CmsFileUtil.copy(m_configRfsPath + source, m_configRfsPath + target); } catch (IOException e) { m_errors.add("Could not copy " + source + " to " + target + " \n"); m_errors.add(e.toString() + "\n"); } }
[ "public", "void", "copyFile", "(", "String", "source", ",", "String", "target", ")", "{", "try", "{", "CmsFileUtil", ".", "copy", "(", "m_configRfsPath", "+", "source", ",", "m_configRfsPath", "+", "target", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "m_errors", ".", "add", "(", "\"Could not copy \"", "+", "source", "+", "\" to \"", "+", "target", "+", "\" \\n\"", ")", ";", "m_errors", ".", "add", "(", "e", ".", "toString", "(", ")", "+", "\"\\n\"", ")", ";", "}", "}" ]
Copies a given file.<p> @param source the source file @param target the destination file
[ "Copies", "a", "given", "file", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L411-L419
ops4j/org.ops4j.pax.web
pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/util/DOMJettyWebXmlParser.java
DOMJettyWebXmlParser.refObj
private Object refObj(Object obj, Element node) throws Exception { """ /* Reference an id value object. @param obj @param node @return @exception NoSuchMethodException @exception ClassNotFoundException @exception InvocationTargetException """ String id = getAttribute(node, "id"); //CHECKSTYLE:OFF obj = _idMap.get(id); //CHECKSTYLE:ON if (obj == null) { throw new IllegalStateException("No object for id=" + id); } configure(obj, node, 0); return obj; }
java
private Object refObj(Object obj, Element node) throws Exception { String id = getAttribute(node, "id"); //CHECKSTYLE:OFF obj = _idMap.get(id); //CHECKSTYLE:ON if (obj == null) { throw new IllegalStateException("No object for id=" + id); } configure(obj, node, 0); return obj; }
[ "private", "Object", "refObj", "(", "Object", "obj", ",", "Element", "node", ")", "throws", "Exception", "{", "String", "id", "=", "getAttribute", "(", "node", ",", "\"id\"", ")", ";", "//CHECKSTYLE:OFF", "obj", "=", "_idMap", ".", "get", "(", "id", ")", ";", "//CHECKSTYLE:ON", "if", "(", "obj", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"No object for id=\"", "+", "id", ")", ";", "}", "configure", "(", "obj", ",", "node", ",", "0", ")", ";", "return", "obj", ";", "}" ]
/* Reference an id value object. @param obj @param node @return @exception NoSuchMethodException @exception ClassNotFoundException @exception InvocationTargetException
[ "/", "*", "Reference", "an", "id", "value", "object", "." ]
train
https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/util/DOMJettyWebXmlParser.java#L573-L583
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/analyzer/NexusAnalyzer.java
NexusAnalyzer.prepareFileTypeAnalyzer
@Override public void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { """ Initializes the analyzer once before any analysis is performed. @param engine a reference to the dependency-check engine @throws InitializationException if there's an error during initialization """ LOGGER.debug("Initializing Nexus Analyzer"); LOGGER.debug("Nexus Analyzer enabled: {}", isEnabled()); if (isEnabled()) { final boolean useProxy = useProxy(); LOGGER.debug("Using proxy: {}", useProxy); try { searcher = new NexusSearch(getSettings(), useProxy); if (!searcher.preflightRequest()) { setEnabled(false); throw new InitializationException("There was an issue getting Nexus status. Disabling analyzer."); } } catch (MalformedURLException mue) { setEnabled(false); throw new InitializationException("Malformed URL to Nexus", mue); } } }
java
@Override public void prepareFileTypeAnalyzer(Engine engine) throws InitializationException { LOGGER.debug("Initializing Nexus Analyzer"); LOGGER.debug("Nexus Analyzer enabled: {}", isEnabled()); if (isEnabled()) { final boolean useProxy = useProxy(); LOGGER.debug("Using proxy: {}", useProxy); try { searcher = new NexusSearch(getSettings(), useProxy); if (!searcher.preflightRequest()) { setEnabled(false); throw new InitializationException("There was an issue getting Nexus status. Disabling analyzer."); } } catch (MalformedURLException mue) { setEnabled(false); throw new InitializationException("Malformed URL to Nexus", mue); } } }
[ "@", "Override", "public", "void", "prepareFileTypeAnalyzer", "(", "Engine", "engine", ")", "throws", "InitializationException", "{", "LOGGER", ".", "debug", "(", "\"Initializing Nexus Analyzer\"", ")", ";", "LOGGER", ".", "debug", "(", "\"Nexus Analyzer enabled: {}\"", ",", "isEnabled", "(", ")", ")", ";", "if", "(", "isEnabled", "(", ")", ")", "{", "final", "boolean", "useProxy", "=", "useProxy", "(", ")", ";", "LOGGER", ".", "debug", "(", "\"Using proxy: {}\"", ",", "useProxy", ")", ";", "try", "{", "searcher", "=", "new", "NexusSearch", "(", "getSettings", "(", ")", ",", "useProxy", ")", ";", "if", "(", "!", "searcher", ".", "preflightRequest", "(", ")", ")", "{", "setEnabled", "(", "false", ")", ";", "throw", "new", "InitializationException", "(", "\"There was an issue getting Nexus status. Disabling analyzer.\"", ")", ";", "}", "}", "catch", "(", "MalformedURLException", "mue", ")", "{", "setEnabled", "(", "false", ")", ";", "throw", "new", "InitializationException", "(", "\"Malformed URL to Nexus\"", ",", "mue", ")", ";", "}", "}", "}" ]
Initializes the analyzer once before any analysis is performed. @param engine a reference to the dependency-check engine @throws InitializationException if there's an error during initialization
[ "Initializes", "the", "analyzer", "once", "before", "any", "analysis", "is", "performed", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/analyzer/NexusAnalyzer.java#L162-L180
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/Preconditions.java
Preconditions.checkNotInstanceOf
public static <E> E checkNotInstanceOf(Class type, E object, String errorMessage) { """ Tests the supplied object to see if it is not a type of the supplied class. @param type the type that is not of the supplied class. @param object the object tested against the type. @param errorMessage the errorMessage @return the object argument. @throws java.lang.IllegalArgumentException if the object is an instance of the type that is not of the expected class. """ isNotNull(type, "type"); if (type.isInstance(object)) { throw new IllegalArgumentException(errorMessage); } return object; }
java
public static <E> E checkNotInstanceOf(Class type, E object, String errorMessage) { isNotNull(type, "type"); if (type.isInstance(object)) { throw new IllegalArgumentException(errorMessage); } return object; }
[ "public", "static", "<", "E", ">", "E", "checkNotInstanceOf", "(", "Class", "type", ",", "E", "object", ",", "String", "errorMessage", ")", "{", "isNotNull", "(", "type", ",", "\"type\"", ")", ";", "if", "(", "type", ".", "isInstance", "(", "object", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "errorMessage", ")", ";", "}", "return", "object", ";", "}" ]
Tests the supplied object to see if it is not a type of the supplied class. @param type the type that is not of the supplied class. @param object the object tested against the type. @param errorMessage the errorMessage @return the object argument. @throws java.lang.IllegalArgumentException if the object is an instance of the type that is not of the expected class.
[ "Tests", "the", "supplied", "object", "to", "see", "if", "it", "is", "not", "a", "type", "of", "the", "supplied", "class", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/Preconditions.java#L297-L303
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java
ChunkAnnotationUtils.fixChunkSentenceBoundaries
public static boolean fixChunkSentenceBoundaries(CoreMap docAnnotation, List<IntPair> chunkCharOffsets) { """ Give an list of character offsets for chunk, fix sentence splitting so sentences doesn't break the chunks @param docAnnotation Document with sentences @param chunkCharOffsets ordered pairs of different chunks that should appear in sentences @return true if fix was okay (chunks are in all sentences), false otherwise """ return fixChunkSentenceBoundaries(docAnnotation, chunkCharOffsets, false, false, false); }
java
public static boolean fixChunkSentenceBoundaries(CoreMap docAnnotation, List<IntPair> chunkCharOffsets) { return fixChunkSentenceBoundaries(docAnnotation, chunkCharOffsets, false, false, false); }
[ "public", "static", "boolean", "fixChunkSentenceBoundaries", "(", "CoreMap", "docAnnotation", ",", "List", "<", "IntPair", ">", "chunkCharOffsets", ")", "{", "return", "fixChunkSentenceBoundaries", "(", "docAnnotation", ",", "chunkCharOffsets", ",", "false", ",", "false", ",", "false", ")", ";", "}" ]
Give an list of character offsets for chunk, fix sentence splitting so sentences doesn't break the chunks @param docAnnotation Document with sentences @param chunkCharOffsets ordered pairs of different chunks that should appear in sentences @return true if fix was okay (chunks are in all sentences), false otherwise
[ "Give", "an", "list", "of", "character", "offsets", "for", "chunk", "fix", "sentence", "splitting", "so", "sentences", "doesn", "t", "break", "the", "chunks" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/pipeline/ChunkAnnotationUtils.java#L336-L339
nyla-solutions/nyla
nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/creational/builder/mapped/ReLookupTextMapFactory.java
ReLookupTextMapFactory.setLookupTable
public void setLookupTable(Map<String,Map<K,V>> lookupTable) { """ The key of the lookup table is a regular expression @param lookupTable the lookupTable to set """ this.lookupTable = new TreeMap<String,Map<K,V>> (lookupTable); }
java
public void setLookupTable(Map<String,Map<K,V>> lookupTable) { this.lookupTable = new TreeMap<String,Map<K,V>> (lookupTable); }
[ "public", "void", "setLookupTable", "(", "Map", "<", "String", ",", "Map", "<", "K", ",", "V", ">", ">", "lookupTable", ")", "{", "this", ".", "lookupTable", "=", "new", "TreeMap", "<", "String", ",", "Map", "<", "K", ",", "V", ">", ">", "(", "lookupTable", ")", ";", "}" ]
The key of the lookup table is a regular expression @param lookupTable the lookupTable to set
[ "The", "key", "of", "the", "lookup", "table", "is", "a", "regular", "expression" ]
train
https://github.com/nyla-solutions/nyla/blob/38d5b843c76eae9762bbca20453ed0f0ad8412a9/nyla.solutions.core/src/main/java/nyla/solutions/core/patterns/creational/builder/mapped/ReLookupTextMapFactory.java#L62-L65
mgormley/prim
src/main/java/edu/jhu/prim/arrays/DoubleArrays.java
DoubleArrays.multiply
public static void multiply(double[] array1, double[] array2) { """ Each element of the second array is multiplied with each element of the first. """ assert (array1.length == array2.length); for (int i=0; i<array1.length; i++) { array1[i] *= array2[i]; } }
java
public static void multiply(double[] array1, double[] array2) { assert (array1.length == array2.length); for (int i=0; i<array1.length; i++) { array1[i] *= array2[i]; } }
[ "public", "static", "void", "multiply", "(", "double", "[", "]", "array1", ",", "double", "[", "]", "array2", ")", "{", "assert", "(", "array1", ".", "length", "==", "array2", ".", "length", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "array1", ".", "length", ";", "i", "++", ")", "{", "array1", "[", "i", "]", "*=", "array2", "[", "i", "]", ";", "}", "}" ]
Each element of the second array is multiplied with each element of the first.
[ "Each", "element", "of", "the", "second", "array", "is", "multiplied", "with", "each", "element", "of", "the", "first", "." ]
train
https://github.com/mgormley/prim/blob/5dce5e1ae94a9ae558a6262fc246e1a24f56686c/src/main/java/edu/jhu/prim/arrays/DoubleArrays.java#L398-L403
Pi4J/pi4j
pi4j-core/src/main/java/com/pi4j/jni/Serial.java
Serial.write
public synchronized static void write(int fd, CharSequence ... data) throws IllegalStateException, IOException { """ <p>Sends one or more ASCII string objects to the serial port/device identified by the given file descriptor.</p> @param fd The file descriptor of the serial port/device. @param data One or more ASCII string objects (or an array) of data to be transmitted. (variable-length-argument) """ write(fd, StandardCharsets.US_ASCII, data); }
java
public synchronized static void write(int fd, CharSequence ... data) throws IllegalStateException, IOException { write(fd, StandardCharsets.US_ASCII, data); }
[ "public", "synchronized", "static", "void", "write", "(", "int", "fd", ",", "CharSequence", "...", "data", ")", "throws", "IllegalStateException", ",", "IOException", "{", "write", "(", "fd", ",", "StandardCharsets", ".", "US_ASCII", ",", "data", ")", ";", "}" ]
<p>Sends one or more ASCII string objects to the serial port/device identified by the given file descriptor.</p> @param fd The file descriptor of the serial port/device. @param data One or more ASCII string objects (or an array) of data to be transmitted. (variable-length-argument)
[ "<p", ">", "Sends", "one", "or", "more", "ASCII", "string", "objects", "to", "the", "serial", "port", "/", "device", "identified", "by", "the", "given", "file", "descriptor", ".", "<", "/", "p", ">" ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-core/src/main/java/com/pi4j/jni/Serial.java#L868-L870
RestComm/sip-servlets
sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionImpl.java
SipSessionImpl.setAckReceived
public void setAckReceived(long cSeq, boolean ackReceived) { """ Setting ackReceived for CSeq to specified value in second param. if the second param is true it will try to cleanup earlier cseq as well to save on memory @param cSeq cseq to set the ackReceived @param ackReceived whether or not the ack has been received for this cseq """ if(logger.isDebugEnabled()) { logger.debug("setting AckReceived to : " + ackReceived + " for CSeq " + cSeq); } acksReceived.put(cSeq, ackReceived); if(ackReceived) { cleanupAcksReceived(cSeq); } }
java
public void setAckReceived(long cSeq, boolean ackReceived) { if(logger.isDebugEnabled()) { logger.debug("setting AckReceived to : " + ackReceived + " for CSeq " + cSeq); } acksReceived.put(cSeq, ackReceived); if(ackReceived) { cleanupAcksReceived(cSeq); } }
[ "public", "void", "setAckReceived", "(", "long", "cSeq", ",", "boolean", "ackReceived", ")", "{", "if", "(", "logger", ".", "isDebugEnabled", "(", ")", ")", "{", "logger", ".", "debug", "(", "\"setting AckReceived to : \"", "+", "ackReceived", "+", "\" for CSeq \"", "+", "cSeq", ")", ";", "}", "acksReceived", ".", "put", "(", "cSeq", ",", "ackReceived", ")", ";", "if", "(", "ackReceived", ")", "{", "cleanupAcksReceived", "(", "cSeq", ")", ";", "}", "}" ]
Setting ackReceived for CSeq to specified value in second param. if the second param is true it will try to cleanup earlier cseq as well to save on memory @param cSeq cseq to set the ackReceived @param ackReceived whether or not the ack has been received for this cseq
[ "Setting", "ackReceived", "for", "CSeq", "to", "specified", "value", "in", "second", "param", ".", "if", "the", "second", "param", "is", "true", "it", "will", "try", "to", "cleanup", "earlier", "cseq", "as", "well", "to", "save", "on", "memory" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/core/session/SipSessionImpl.java#L2547-L2555
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/path/PathBuilder.java
PathBuilder.quadTo
public PathBuilder quadTo(Point2d cp, Point2d ep) { """ Make a quadratic curve in the path, with one control point. @param cp the control point of the curve @param ep the end point of the curve @return a reference to this builder """ add(new QuadTo(cp, ep)); return this; }
java
public PathBuilder quadTo(Point2d cp, Point2d ep) { add(new QuadTo(cp, ep)); return this; }
[ "public", "PathBuilder", "quadTo", "(", "Point2d", "cp", ",", "Point2d", "ep", ")", "{", "add", "(", "new", "QuadTo", "(", "cp", ",", "ep", ")", ")", ";", "return", "this", ";", "}" ]
Make a quadratic curve in the path, with one control point. @param cp the control point of the curve @param ep the end point of the curve @return a reference to this builder
[ "Make", "a", "quadratic", "curve", "in", "the", "path", "with", "one", "control", "point", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/elements/path/PathBuilder.java#L111-L114
alkacon/opencms-core
src/org/opencms/db/generic/CmsUserQueryBuilder.java
CmsUserQueryBuilder.addSearchFilterCondition
protected void addSearchFilterCondition( CmsSelectQuery select, TableAlias users, CmsUserSearchParameters searchParams) { """ Adds a search condition to a query.<p> @param select the query @param users the user table alias @param searchParams the search criteria """ String searchFilter = searchParams.getSearchFilter(); if (!CmsStringUtil.isEmptyOrWhitespaceOnly(searchFilter)) { boolean caseInsensitive = !searchParams.isCaseSensitive(); if (caseInsensitive) { searchFilter = searchFilter.toLowerCase(); } CmsCompositeQueryFragment searchCondition = new CmsCompositeQueryFragment(); searchCondition.setSeparator(" OR "); searchCondition.setPrefix("("); searchCondition.setSuffix(")"); //use coalesce in case any of the name columns are null String patternExprTemplate = generateConcat( "COALESCE(%1$s, '')", "' '", "COALESCE(%2$s, '')", "' '", "COALESCE(%3$s, '')"); patternExprTemplate = wrapLower(patternExprTemplate, caseInsensitive); String patternExpr = String.format( patternExprTemplate, users.column(colName()), users.column(colFirstName()), users.column(colLastName())); String like = " LIKE ? ESCAPE '!' "; String matchExpr = patternExpr + like; searchFilter = "%" + CmsEncoder.escapeSqlLikePattern(searchFilter, '!') + '%'; searchCondition.add(new CmsSimpleQueryFragment(matchExpr, searchFilter)); for (SearchKey key : searchParams.getSearchKeys()) { switch (key) { case email: searchCondition.add( new CmsSimpleQueryFragment( wrapLower(users.column(colEmail()), caseInsensitive) + like, searchFilter)); break; case orgUnit: searchCondition.add(new CmsSimpleQueryFragment( wrapLower(users.column(colOu()), caseInsensitive) + like, searchFilter)); break; default: break; } } select.addCondition(searchCondition); } }
java
protected void addSearchFilterCondition( CmsSelectQuery select, TableAlias users, CmsUserSearchParameters searchParams) { String searchFilter = searchParams.getSearchFilter(); if (!CmsStringUtil.isEmptyOrWhitespaceOnly(searchFilter)) { boolean caseInsensitive = !searchParams.isCaseSensitive(); if (caseInsensitive) { searchFilter = searchFilter.toLowerCase(); } CmsCompositeQueryFragment searchCondition = new CmsCompositeQueryFragment(); searchCondition.setSeparator(" OR "); searchCondition.setPrefix("("); searchCondition.setSuffix(")"); //use coalesce in case any of the name columns are null String patternExprTemplate = generateConcat( "COALESCE(%1$s, '')", "' '", "COALESCE(%2$s, '')", "' '", "COALESCE(%3$s, '')"); patternExprTemplate = wrapLower(patternExprTemplate, caseInsensitive); String patternExpr = String.format( patternExprTemplate, users.column(colName()), users.column(colFirstName()), users.column(colLastName())); String like = " LIKE ? ESCAPE '!' "; String matchExpr = patternExpr + like; searchFilter = "%" + CmsEncoder.escapeSqlLikePattern(searchFilter, '!') + '%'; searchCondition.add(new CmsSimpleQueryFragment(matchExpr, searchFilter)); for (SearchKey key : searchParams.getSearchKeys()) { switch (key) { case email: searchCondition.add( new CmsSimpleQueryFragment( wrapLower(users.column(colEmail()), caseInsensitive) + like, searchFilter)); break; case orgUnit: searchCondition.add(new CmsSimpleQueryFragment( wrapLower(users.column(colOu()), caseInsensitive) + like, searchFilter)); break; default: break; } } select.addCondition(searchCondition); } }
[ "protected", "void", "addSearchFilterCondition", "(", "CmsSelectQuery", "select", ",", "TableAlias", "users", ",", "CmsUserSearchParameters", "searchParams", ")", "{", "String", "searchFilter", "=", "searchParams", ".", "getSearchFilter", "(", ")", ";", "if", "(", "!", "CmsStringUtil", ".", "isEmptyOrWhitespaceOnly", "(", "searchFilter", ")", ")", "{", "boolean", "caseInsensitive", "=", "!", "searchParams", ".", "isCaseSensitive", "(", ")", ";", "if", "(", "caseInsensitive", ")", "{", "searchFilter", "=", "searchFilter", ".", "toLowerCase", "(", ")", ";", "}", "CmsCompositeQueryFragment", "searchCondition", "=", "new", "CmsCompositeQueryFragment", "(", ")", ";", "searchCondition", ".", "setSeparator", "(", "\" OR \"", ")", ";", "searchCondition", ".", "setPrefix", "(", "\"(\"", ")", ";", "searchCondition", ".", "setSuffix", "(", "\")\"", ")", ";", "//use coalesce in case any of the name columns are null", "String", "patternExprTemplate", "=", "generateConcat", "(", "\"COALESCE(%1$s, '')\"", ",", "\"' '\"", ",", "\"COALESCE(%2$s, '')\"", ",", "\"' '\"", ",", "\"COALESCE(%3$s, '')\"", ")", ";", "patternExprTemplate", "=", "wrapLower", "(", "patternExprTemplate", ",", "caseInsensitive", ")", ";", "String", "patternExpr", "=", "String", ".", "format", "(", "patternExprTemplate", ",", "users", ".", "column", "(", "colName", "(", ")", ")", ",", "users", ".", "column", "(", "colFirstName", "(", ")", ")", ",", "users", ".", "column", "(", "colLastName", "(", ")", ")", ")", ";", "String", "like", "=", "\" LIKE ? ESCAPE '!' \"", ";", "String", "matchExpr", "=", "patternExpr", "+", "like", ";", "searchFilter", "=", "\"%\"", "+", "CmsEncoder", ".", "escapeSqlLikePattern", "(", "searchFilter", ",", "'", "'", ")", "+", "'", "'", ";", "searchCondition", ".", "add", "(", "new", "CmsSimpleQueryFragment", "(", "matchExpr", ",", "searchFilter", ")", ")", ";", "for", "(", "SearchKey", "key", ":", "searchParams", ".", "getSearchKeys", "(", ")", ")", "{", "switch", "(", "key", ")", "{", "case", "email", ":", "searchCondition", ".", "add", "(", "new", "CmsSimpleQueryFragment", "(", "wrapLower", "(", "users", ".", "column", "(", "colEmail", "(", ")", ")", ",", "caseInsensitive", ")", "+", "like", ",", "searchFilter", ")", ")", ";", "break", ";", "case", "orgUnit", ":", "searchCondition", ".", "add", "(", "new", "CmsSimpleQueryFragment", "(", "wrapLower", "(", "users", ".", "column", "(", "colOu", "(", ")", ")", ",", "caseInsensitive", ")", "+", "like", ",", "searchFilter", ")", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}", "select", ".", "addCondition", "(", "searchCondition", ")", ";", "}", "}" ]
Adds a search condition to a query.<p> @param select the query @param users the user table alias @param searchParams the search criteria
[ "Adds", "a", "search", "condition", "to", "a", "query", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsUserQueryBuilder.java#L284-L336
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java
PriorityQueue.setElement
protected final void setElement(PriorityQueueNode node, int pos) { """ Set an element in the queue. @param node the element to place. @param pos the position of the element. """ // if (tc.isEntryEnabled()) // SibTr.entry(tc, "setElement", new Object[] { node, new Integer(pos)}); elements[pos] = node; node.pos = pos; // if (tc.isEntryEnabled()) // SibTr.exit(tc, "setElement"); }
java
protected final void setElement(PriorityQueueNode node, int pos) { // if (tc.isEntryEnabled()) // SibTr.entry(tc, "setElement", new Object[] { node, new Integer(pos)}); elements[pos] = node; node.pos = pos; // if (tc.isEntryEnabled()) // SibTr.exit(tc, "setElement"); }
[ "protected", "final", "void", "setElement", "(", "PriorityQueueNode", "node", ",", "int", "pos", ")", "{", "// if (tc.isEntryEnabled())", "// SibTr.entry(tc, \"setElement\", new Object[] { node, new Integer(pos)});", "elements", "[", "pos", "]", "=", "node", ";", "node", ".", "pos", "=", "pos", ";", "// if (tc.isEntryEnabled())", "// SibTr.exit(tc, \"setElement\");", "}" ]
Set an element in the queue. @param node the element to place. @param pos the position of the element.
[ "Set", "an", "element", "in", "the", "queue", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/utils/PriorityQueue.java#L230-L240
transloadit/java-sdk
src/main/java/com/transloadit/sdk/Transloadit.java
Transloadit.getBill
public Response getBill(int month, int year) throws RequestException, LocalOperationException { """ Returns the bill for the month specified. @param month for which bill to retrieve. @param year for which bill to retrieve. @return {@link Response} @throws RequestException if request to transloadit server fails. @throws LocalOperationException if something goes wrong while running non-http operations. """ Request request = new Request(this); return new Response(request.get("/bill/" + year + String.format("-%02d", month))); }
java
public Response getBill(int month, int year) throws RequestException, LocalOperationException { Request request = new Request(this); return new Response(request.get("/bill/" + year + String.format("-%02d", month))); }
[ "public", "Response", "getBill", "(", "int", "month", ",", "int", "year", ")", "throws", "RequestException", ",", "LocalOperationException", "{", "Request", "request", "=", "new", "Request", "(", "this", ")", ";", "return", "new", "Response", "(", "request", ".", "get", "(", "\"/bill/\"", "+", "year", "+", "String", ".", "format", "(", "\"-%02d\"", ",", "month", ")", ")", ")", ";", "}" ]
Returns the bill for the month specified. @param month for which bill to retrieve. @param year for which bill to retrieve. @return {@link Response} @throws RequestException if request to transloadit server fails. @throws LocalOperationException if something goes wrong while running non-http operations.
[ "Returns", "the", "bill", "for", "the", "month", "specified", "." ]
train
https://github.com/transloadit/java-sdk/blob/9326c540a66f77b3d907d0b2c05bff1145ca14f7/src/main/java/com/transloadit/sdk/Transloadit.java#L269-L273
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/LambdaMetaHelper.java
LambdaMetaHelper.getConstructor
public <T> Supplier<T> getConstructor(Class<? extends T> clazz) { """ Gets no-arg constructor as Supplier. @param clazz class to get constructor for. @param <T> clazz. @return supplier. """ return getConstructorAs(Supplier.class, "get", clazz); }
java
public <T> Supplier<T> getConstructor(Class<? extends T> clazz) { return getConstructorAs(Supplier.class, "get", clazz); }
[ "public", "<", "T", ">", "Supplier", "<", "T", ">", "getConstructor", "(", "Class", "<", "?", "extends", "T", ">", "clazz", ")", "{", "return", "getConstructorAs", "(", "Supplier", ".", "class", ",", "\"get\"", ",", "clazz", ")", ";", "}" ]
Gets no-arg constructor as Supplier. @param clazz class to get constructor for. @param <T> clazz. @return supplier.
[ "Gets", "no", "-", "arg", "constructor", "as", "Supplier", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/LambdaMetaHelper.java#L25-L27
litsec/eidas-opensaml
opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/attributes/AttributeUtils.java
AttributeUtils.createAttributeValueObject
public static <T extends XMLObject> T createAttributeValueObject(QName schemaType, Class<T> clazz) { """ Creates an {@code AttributeValue} object of the given class and schema type. <p> After the object has been constructed, its setter methods should be called to setup the value object before adding it to the attribute itself. </p> @param <T> the type @param schemaType the schema type that should be assigned to the attribute value, i.e., {@code xsi:type="eidas:CurrentFamilyNameType"} @param clazz the type of the attribute value @return the attribute value @see #createAttributeValueObject(Class) """ XMLObjectBuilder<?> builder = XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(schemaType); XMLObject object = builder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, schemaType); return clazz.cast(object); }
java
public static <T extends XMLObject> T createAttributeValueObject(QName schemaType, Class<T> clazz) { XMLObjectBuilder<?> builder = XMLObjectProviderRegistrySupport.getBuilderFactory().getBuilder(schemaType); XMLObject object = builder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME, schemaType); return clazz.cast(object); }
[ "public", "static", "<", "T", "extends", "XMLObject", ">", "T", "createAttributeValueObject", "(", "QName", "schemaType", ",", "Class", "<", "T", ">", "clazz", ")", "{", "XMLObjectBuilder", "<", "?", ">", "builder", "=", "XMLObjectProviderRegistrySupport", ".", "getBuilderFactory", "(", ")", ".", "getBuilder", "(", "schemaType", ")", ";", "XMLObject", "object", "=", "builder", ".", "buildObject", "(", "AttributeValue", ".", "DEFAULT_ELEMENT_NAME", ",", "schemaType", ")", ";", "return", "clazz", ".", "cast", "(", "object", ")", ";", "}" ]
Creates an {@code AttributeValue} object of the given class and schema type. <p> After the object has been constructed, its setter methods should be called to setup the value object before adding it to the attribute itself. </p> @param <T> the type @param schemaType the schema type that should be assigned to the attribute value, i.e., {@code xsi:type="eidas:CurrentFamilyNameType"} @param clazz the type of the attribute value @return the attribute value @see #createAttributeValueObject(Class)
[ "Creates", "an", "{", "@code", "AttributeValue", "}", "object", "of", "the", "given", "class", "and", "schema", "type", ".", "<p", ">", "After", "the", "object", "has", "been", "constructed", "its", "setter", "methods", "should", "be", "called", "to", "setup", "the", "value", "object", "before", "adding", "it", "to", "the", "attribute", "itself", ".", "<", "/", "p", ">" ]
train
https://github.com/litsec/eidas-opensaml/blob/522ba6dba433a9524cb8a02464cc3b087b47a2b7/opensaml3/src/main/java/se/litsec/eidas/opensaml/ext/attributes/AttributeUtils.java#L117-L121
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java
DefaultElementProducer.createListItem
public ListItem createListItem(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException { """ Create a ListItem, style it and add the data @param data @param stylers @return @throws VectorPrintException """ return initTextElementArray(styleHelper.style(new ListItem(Float.NaN), data, stylers), data, stylers); }
java
public ListItem createListItem(Object data, Collection<? extends BaseStyler> stylers) throws VectorPrintException { return initTextElementArray(styleHelper.style(new ListItem(Float.NaN), data, stylers), data, stylers); }
[ "public", "ListItem", "createListItem", "(", "Object", "data", ",", "Collection", "<", "?", "extends", "BaseStyler", ">", "stylers", ")", "throws", "VectorPrintException", "{", "return", "initTextElementArray", "(", "styleHelper", ".", "style", "(", "new", "ListItem", "(", "Float", ".", "NaN", ")", ",", "data", ",", "stylers", ")", ",", "data", ",", "stylers", ")", ";", "}" ]
Create a ListItem, style it and add the data @param data @param stylers @return @throws VectorPrintException
[ "Create", "a", "ListItem", "style", "it", "and", "add", "the", "data" ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L249-L251
JOML-CI/JOML
src/org/joml/Matrix3f.java
Matrix3f.rotateLocalX
public Matrix3f rotateLocalX(float ang, Matrix3f dest) { """ Pre-multiply a rotation around the X axis to this matrix by rotating the given amount of radians about the X axis and store the result in <code>dest</code>. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationX(float) rotationX()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotationX(float) @param ang the angle in radians to rotate about the X axis @param dest will hold the result @return dest """ float sin = (float) Math.sin(ang); float cos = (float) Math.cosFromSin(sin, ang); float nm01 = cos * m01 - sin * m02; float nm02 = sin * m01 + cos * m02; float nm11 = cos * m11 - sin * m12; float nm12 = sin * m11 + cos * m12; float nm21 = cos * m21 - sin * m22; float nm22 = sin * m21 + cos * m22; dest.m00 = m00; dest.m01 = nm01; dest.m02 = nm02; dest.m10 = m10; dest.m11 = nm11; dest.m12 = nm12; dest.m20 = m20; dest.m21 = nm21; dest.m22 = nm22; return dest; }
java
public Matrix3f rotateLocalX(float ang, Matrix3f dest) { float sin = (float) Math.sin(ang); float cos = (float) Math.cosFromSin(sin, ang); float nm01 = cos * m01 - sin * m02; float nm02 = sin * m01 + cos * m02; float nm11 = cos * m11 - sin * m12; float nm12 = sin * m11 + cos * m12; float nm21 = cos * m21 - sin * m22; float nm22 = sin * m21 + cos * m22; dest.m00 = m00; dest.m01 = nm01; dest.m02 = nm02; dest.m10 = m10; dest.m11 = nm11; dest.m12 = nm12; dest.m20 = m20; dest.m21 = nm21; dest.m22 = nm22; return dest; }
[ "public", "Matrix3f", "rotateLocalX", "(", "float", "ang", ",", "Matrix3f", "dest", ")", "{", "float", "sin", "=", "(", "float", ")", "Math", ".", "sin", "(", "ang", ")", ";", "float", "cos", "=", "(", "float", ")", "Math", ".", "cosFromSin", "(", "sin", ",", "ang", ")", ";", "float", "nm01", "=", "cos", "*", "m01", "-", "sin", "*", "m02", ";", "float", "nm02", "=", "sin", "*", "m01", "+", "cos", "*", "m02", ";", "float", "nm11", "=", "cos", "*", "m11", "-", "sin", "*", "m12", ";", "float", "nm12", "=", "sin", "*", "m11", "+", "cos", "*", "m12", ";", "float", "nm21", "=", "cos", "*", "m21", "-", "sin", "*", "m22", ";", "float", "nm22", "=", "sin", "*", "m21", "+", "cos", "*", "m22", ";", "dest", ".", "m00", "=", "m00", ";", "dest", ".", "m01", "=", "nm01", ";", "dest", ".", "m02", "=", "nm02", ";", "dest", ".", "m10", "=", "m10", ";", "dest", ".", "m11", "=", "nm11", ";", "dest", ".", "m12", "=", "nm12", ";", "dest", ".", "m20", "=", "m20", ";", "dest", ".", "m21", "=", "nm21", ";", "dest", ".", "m22", "=", "nm22", ";", "return", "dest", ";", "}" ]
Pre-multiply a rotation around the X axis to this matrix by rotating the given amount of radians about the X axis and store the result in <code>dest</code>. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> If <code>M</code> is <code>this</code> matrix and <code>R</code> the rotation matrix, then the new matrix will be <code>R * M</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>R * M * v</code>, the rotation will be applied last! <p> In order to set the matrix to a rotation matrix without pre-multiplying the rotation transformation, use {@link #rotationX(float) rotationX()}. <p> Reference: <a href="http://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle">http://en.wikipedia.org</a> @see #rotationX(float) @param ang the angle in radians to rotate about the X axis @param dest will hold the result @return dest
[ "Pre", "-", "multiply", "a", "rotation", "around", "the", "X", "axis", "to", "this", "matrix", "by", "rotating", "the", "given", "amount", "of", "radians", "about", "the", "X", "axis", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", ".", "<p", ">", "When", "used", "with", "a", "right", "-", "handed", "coordinate", "system", "the", "produced", "rotation", "will", "rotate", "a", "vector", "counter", "-", "clockwise", "around", "the", "rotation", "axis", "when", "viewing", "along", "the", "negative", "axis", "direction", "towards", "the", "origin", ".", "When", "used", "with", "a", "left", "-", "handed", "coordinate", "system", "the", "rotation", "is", "clockwise", ".", "<p", ">", "If", "<code", ">", "M<", "/", "code", ">", "is", "<code", ">", "this<", "/", "code", ">", "matrix", "and", "<code", ">", "R<", "/", "code", ">", "the", "rotation", "matrix", "then", "the", "new", "matrix", "will", "be", "<code", ">", "R", "*", "M<", "/", "code", ">", ".", "So", "when", "transforming", "a", "vector", "<code", ">", "v<", "/", "code", ">", "with", "the", "new", "matrix", "by", "using", "<code", ">", "R", "*", "M", "*", "v<", "/", "code", ">", "the", "rotation", "will", "be", "applied", "last!", "<p", ">", "In", "order", "to", "set", "the", "matrix", "to", "a", "rotation", "matrix", "without", "pre", "-", "multiplying", "the", "rotation", "transformation", "use", "{", "@link", "#rotationX", "(", "float", ")", "rotationX", "()", "}", ".", "<p", ">", "Reference", ":", "<a", "href", "=", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Rotation_matrix#Rotation_matrix_from_axis_and_angle", ">", "http", ":", "//", "en", ".", "wikipedia", ".", "org<", "/", "a", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3f.java#L2473-L2492
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java
CommonOps_DDRM.multTransA
public static void multTransA(DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { """ <p>Performs the following operation:<br> <br> c = a<sup>T</sup> * b <br> <br> c<sub>ij</sub> = &sum;<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>kj</sub>} </p> @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified. """ if( b.numCols == 1 ) { // todo check a.numCols == 1 and do inner product? // there are significantly faster algorithms when dealing with vectors if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixVectorMult_DDRM.multTransA_reorder(a,b,c); } else { MatrixVectorMult_DDRM.multTransA_small(a,b,c); } } else if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH || b.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixMatrixMult_DDRM.multTransA_reorder(a, b, c); } else { MatrixMatrixMult_DDRM.multTransA_small(a, b, c); } }
java
public static void multTransA(DMatrix1Row a , DMatrix1Row b , DMatrix1Row c ) { if( b.numCols == 1 ) { // todo check a.numCols == 1 and do inner product? // there are significantly faster algorithms when dealing with vectors if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixVectorMult_DDRM.multTransA_reorder(a,b,c); } else { MatrixVectorMult_DDRM.multTransA_small(a,b,c); } } else if( a.numCols >= EjmlParameters.MULT_COLUMN_SWITCH || b.numCols >= EjmlParameters.MULT_COLUMN_SWITCH ) { MatrixMatrixMult_DDRM.multTransA_reorder(a, b, c); } else { MatrixMatrixMult_DDRM.multTransA_small(a, b, c); } }
[ "public", "static", "void", "multTransA", "(", "DMatrix1Row", "a", ",", "DMatrix1Row", "b", ",", "DMatrix1Row", "c", ")", "{", "if", "(", "b", ".", "numCols", "==", "1", ")", "{", "// todo check a.numCols == 1 and do inner product?", "// there are significantly faster algorithms when dealing with vectors", "if", "(", "a", ".", "numCols", ">=", "EjmlParameters", ".", "MULT_COLUMN_SWITCH", ")", "{", "MatrixVectorMult_DDRM", ".", "multTransA_reorder", "(", "a", ",", "b", ",", "c", ")", ";", "}", "else", "{", "MatrixVectorMult_DDRM", ".", "multTransA_small", "(", "a", ",", "b", ",", "c", ")", ";", "}", "}", "else", "if", "(", "a", ".", "numCols", ">=", "EjmlParameters", ".", "MULT_COLUMN_SWITCH", "||", "b", ".", "numCols", ">=", "EjmlParameters", ".", "MULT_COLUMN_SWITCH", ")", "{", "MatrixMatrixMult_DDRM", ".", "multTransA_reorder", "(", "a", ",", "b", ",", "c", ")", ";", "}", "else", "{", "MatrixMatrixMult_DDRM", ".", "multTransA_small", "(", "a", ",", "b", ",", "c", ")", ";", "}", "}" ]
<p>Performs the following operation:<br> <br> c = a<sup>T</sup> * b <br> <br> c<sub>ij</sub> = &sum;<sub>k=1:n</sub> { a<sub>ki</sub> * b<sub>kj</sub>} </p> @param a The left matrix in the multiplication operation. Not modified. @param b The right matrix in the multiplication operation. Not modified. @param c Where the results of the operation are stored. Modified.
[ "<p", ">", "Performs", "the", "following", "operation", ":", "<br", ">", "<br", ">", "c", "=", "a<sup", ">", "T<", "/", "sup", ">", "*", "b", "<br", ">", "<br", ">", "c<sub", ">", "ij<", "/", "sub", ">", "=", "&sum", ";", "<sub", ">", "k", "=", "1", ":", "n<", "/", "sub", ">", "{", "a<sub", ">", "ki<", "/", "sub", ">", "*", "b<sub", ">", "kj<", "/", "sub", ">", "}", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L121-L137
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.writeProject
public void writeProject(CmsRequestContext context, CmsProject project) throws CmsRoleViolationException, CmsException { """ Writes an already existing project.<p> The project id has to be a valid OpenCms project id.<br> The project with the given id will be completely overridden by the given data.<p> @param project the project that should be written @param context the current request context @throws CmsRoleViolationException if the current user does not own the required permissions @throws CmsException if operation was not successful """ CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkManagerOfProjectRole(dbc, project); m_driverManager.writeProject(dbc, project); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_WRITE_PROJECT_1, project.getName()), e); } finally { dbc.clear(); } }
java
public void writeProject(CmsRequestContext context, CmsProject project) throws CmsRoleViolationException, CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); try { checkManagerOfProjectRole(dbc, project); m_driverManager.writeProject(dbc, project); } catch (Exception e) { dbc.report(null, Messages.get().container(Messages.ERR_WRITE_PROJECT_1, project.getName()), e); } finally { dbc.clear(); } }
[ "public", "void", "writeProject", "(", "CmsRequestContext", "context", ",", "CmsProject", "project", ")", "throws", "CmsRoleViolationException", ",", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "try", "{", "checkManagerOfProjectRole", "(", "dbc", ",", "project", ")", ";", "m_driverManager", ".", "writeProject", "(", "dbc", ",", "project", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "dbc", ".", "report", "(", "null", ",", "Messages", ".", "get", "(", ")", ".", "container", "(", "Messages", ".", "ERR_WRITE_PROJECT_1", ",", "project", ".", "getName", "(", ")", ")", ",", "e", ")", ";", "}", "finally", "{", "dbc", ".", "clear", "(", ")", ";", "}", "}" ]
Writes an already existing project.<p> The project id has to be a valid OpenCms project id.<br> The project with the given id will be completely overridden by the given data.<p> @param project the project that should be written @param context the current request context @throws CmsRoleViolationException if the current user does not own the required permissions @throws CmsException if operation was not successful
[ "Writes", "an", "already", "existing", "project", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L6775-L6787
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/media/MediaClient.java
MediaClient.createPreset
public CreatePresetResponse createPreset(String presetName, String container, Audio audio) { """ Create a preset which help to convert audio files on be played in a wide range of devices. @param presetName The name of the new preset. @param container The container type for the output file. Valid values include mp4, flv, hls, mp3, m4a. @param audio Specify the audio format of target file. """ return createPreset(presetName, null, container, false, null, audio, null, null, null); }
java
public CreatePresetResponse createPreset(String presetName, String container, Audio audio) { return createPreset(presetName, null, container, false, null, audio, null, null, null); }
[ "public", "CreatePresetResponse", "createPreset", "(", "String", "presetName", ",", "String", "container", ",", "Audio", "audio", ")", "{", "return", "createPreset", "(", "presetName", ",", "null", ",", "container", ",", "false", ",", "null", ",", "audio", ",", "null", ",", "null", ",", "null", ")", ";", "}" ]
Create a preset which help to convert audio files on be played in a wide range of devices. @param presetName The name of the new preset. @param container The container type for the output file. Valid values include mp4, flv, hls, mp3, m4a. @param audio Specify the audio format of target file.
[ "Create", "a", "preset", "which", "help", "to", "convert", "audio", "files", "on", "be", "played", "in", "a", "wide", "range", "of", "devices", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/media/MediaClient.java#L678-L680
mlhartme/sushi
src/main/java/net/oneandone/sushi/io/Buffer.java
Buffer.copy
public long copy(InputStream in, OutputStream out, long max) throws IOException { """ Copies up to max bytes. @return number of bytes actually copied """ int chunk; long all; long remaining; remaining = max; all = 0; while (remaining > 0) { // cast is save because the buffer.length is an integer chunk = in.read(buffer, 0, (int) Math.min(remaining, buffer.length)); if (chunk < 0) { break; } out.write(buffer, 0, chunk); all += chunk; remaining -= chunk; } out.flush(); return all; }
java
public long copy(InputStream in, OutputStream out, long max) throws IOException { int chunk; long all; long remaining; remaining = max; all = 0; while (remaining > 0) { // cast is save because the buffer.length is an integer chunk = in.read(buffer, 0, (int) Math.min(remaining, buffer.length)); if (chunk < 0) { break; } out.write(buffer, 0, chunk); all += chunk; remaining -= chunk; } out.flush(); return all; }
[ "public", "long", "copy", "(", "InputStream", "in", ",", "OutputStream", "out", ",", "long", "max", ")", "throws", "IOException", "{", "int", "chunk", ";", "long", "all", ";", "long", "remaining", ";", "remaining", "=", "max", ";", "all", "=", "0", ";", "while", "(", "remaining", ">", "0", ")", "{", "// cast is save because the buffer.length is an integer", "chunk", "=", "in", ".", "read", "(", "buffer", ",", "0", ",", "(", "int", ")", "Math", ".", "min", "(", "remaining", ",", "buffer", ".", "length", ")", ")", ";", "if", "(", "chunk", "<", "0", ")", "{", "break", ";", "}", "out", ".", "write", "(", "buffer", ",", "0", ",", "chunk", ")", ";", "all", "+=", "chunk", ";", "remaining", "-=", "chunk", ";", "}", "out", ".", "flush", "(", ")", ";", "return", "all", ";", "}" ]
Copies up to max bytes. @return number of bytes actually copied
[ "Copies", "up", "to", "max", "bytes", "." ]
train
https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/io/Buffer.java#L165-L184
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/config/gui/control/ConfigSettings.java
ConfigSettings.setConfigParameter
public void setConfigParameter(final ConfigurationKeys key, Object value) { """ Assigns the given value to the the given key. @param key configuration key @param value value """ // before setting parameter, check if paths have trailing File.separator if (key == ConfigurationKeys.LOGGING_PATH_DEBUG || key == ConfigurationKeys.LOGGING_PATH_DIFFTOOL || key == ConfigurationKeys.PATH_OUTPUT_SQL_FILES) { String v = (String) value; // if we do not have a trailing file separator and the current // path is compatible to the system that is running the config tool, // then add a trailing separator if (!v.endsWith(File.separator) && v.contains(File.separator)) { value = v + File.separator; } } this.parameterMap.put(key, value); }
java
public void setConfigParameter(final ConfigurationKeys key, Object value) { // before setting parameter, check if paths have trailing File.separator if (key == ConfigurationKeys.LOGGING_PATH_DEBUG || key == ConfigurationKeys.LOGGING_PATH_DIFFTOOL || key == ConfigurationKeys.PATH_OUTPUT_SQL_FILES) { String v = (String) value; // if we do not have a trailing file separator and the current // path is compatible to the system that is running the config tool, // then add a trailing separator if (!v.endsWith(File.separator) && v.contains(File.separator)) { value = v + File.separator; } } this.parameterMap.put(key, value); }
[ "public", "void", "setConfigParameter", "(", "final", "ConfigurationKeys", "key", ",", "Object", "value", ")", "{", "// before setting parameter, check if paths have trailing File.separator", "if", "(", "key", "==", "ConfigurationKeys", ".", "LOGGING_PATH_DEBUG", "||", "key", "==", "ConfigurationKeys", ".", "LOGGING_PATH_DIFFTOOL", "||", "key", "==", "ConfigurationKeys", ".", "PATH_OUTPUT_SQL_FILES", ")", "{", "String", "v", "=", "(", "String", ")", "value", ";", "// if we do not have a trailing file separator and the current", "// path is compatible to the system that is running the config tool,", "// then add a trailing separator", "if", "(", "!", "v", ".", "endsWith", "(", "File", ".", "separator", ")", "&&", "v", ".", "contains", "(", "File", ".", "separator", ")", ")", "{", "value", "=", "v", "+", "File", ".", "separator", ";", "}", "}", "this", ".", "parameterMap", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Assigns the given value to the the given key. @param key configuration key @param value value
[ "Assigns", "the", "given", "value", "to", "the", "the", "given", "key", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/difftool/config/gui/control/ConfigSettings.java#L138-L155
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/message/BasicThreadInformation.java
BasicThreadInformation.printStack
@Override public void printStack(final StringBuilder sb, final StackTraceElement[] trace) { """ Format the StackTraceElements. @param sb The StringBuilder. @param trace The stack trace element array to format. """ for (final StackTraceElement element : trace) { sb.append("\tat ").append(element).append('\n'); } }
java
@Override public void printStack(final StringBuilder sb, final StackTraceElement[] trace) { for (final StackTraceElement element : trace) { sb.append("\tat ").append(element).append('\n'); } }
[ "@", "Override", "public", "void", "printStack", "(", "final", "StringBuilder", "sb", ",", "final", "StackTraceElement", "[", "]", "trace", ")", "{", "for", "(", "final", "StackTraceElement", "element", ":", "trace", ")", "{", "sb", ".", "append", "(", "\"\\tat \"", ")", ".", "append", "(", "element", ")", ".", "append", "(", "'", "'", ")", ";", "}", "}" ]
Format the StackTraceElements. @param sb The StringBuilder. @param trace The stack trace element array to format.
[ "Format", "the", "StackTraceElements", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/BasicThreadInformation.java#L104-L109
JOML-CI/JOML
src/org/joml/FrustumIntersection.java
FrustumIntersection.intersectSphere
public int intersectSphere(Vector3fc center, float radius) { """ Determine whether the given sphere is partly or completely within or outside of the frustum defined by <code>this</code> frustum culler. <p> The algorithm implemented by this method is conservative. This means that in certain circumstances a <i>false positive</i> can occur, when the method returns <code>true</code> for spheres that are actually not visible. See <a href="http://iquilezles.org/www/articles/frustumcorrect/frustumcorrect.htm">iquilezles.org</a> for an examination of this problem. @param center the sphere's center @param radius the sphere's radius @return {@link #INSIDE} if the given sphere is completely inside the frustum, or {@link #INTERSECT} if the sphere intersects the frustum, or {@link #OUTSIDE} if the sphere is outside of the frustum """ return intersectSphere(center.x(), center.y(), center.z(), radius); }
java
public int intersectSphere(Vector3fc center, float radius) { return intersectSphere(center.x(), center.y(), center.z(), radius); }
[ "public", "int", "intersectSphere", "(", "Vector3fc", "center", ",", "float", "radius", ")", "{", "return", "intersectSphere", "(", "center", ".", "x", "(", ")", ",", "center", ".", "y", "(", ")", ",", "center", ".", "z", "(", ")", ",", "radius", ")", ";", "}" ]
Determine whether the given sphere is partly or completely within or outside of the frustum defined by <code>this</code> frustum culler. <p> The algorithm implemented by this method is conservative. This means that in certain circumstances a <i>false positive</i> can occur, when the method returns <code>true</code> for spheres that are actually not visible. See <a href="http://iquilezles.org/www/articles/frustumcorrect/frustumcorrect.htm">iquilezles.org</a> for an examination of this problem. @param center the sphere's center @param radius the sphere's radius @return {@link #INSIDE} if the given sphere is completely inside the frustum, or {@link #INTERSECT} if the sphere intersects the frustum, or {@link #OUTSIDE} if the sphere is outside of the frustum
[ "Determine", "whether", "the", "given", "sphere", "is", "partly", "or", "completely", "within", "or", "outside", "of", "the", "frustum", "defined", "by", "<code", ">", "this<", "/", "code", ">", "frustum", "culler", ".", "<p", ">", "The", "algorithm", "implemented", "by", "this", "method", "is", "conservative", ".", "This", "means", "that", "in", "certain", "circumstances", "a", "<i", ">", "false", "positive<", "/", "i", ">", "can", "occur", "when", "the", "method", "returns", "<code", ">", "true<", "/", "code", ">", "for", "spheres", "that", "are", "actually", "not", "visible", ".", "See", "<a", "href", "=", "http", ":", "//", "iquilezles", ".", "org", "/", "www", "/", "articles", "/", "frustumcorrect", "/", "frustumcorrect", ".", "htm", ">", "iquilezles", ".", "org<", "/", "a", ">", "for", "an", "examination", "of", "this", "problem", "." ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/FrustumIntersection.java#L333-L335
jtrfp/jfdt
src/main/java/org/jtrfp/jfdt/Parser.java
Parser.readToNewBean
public <CLASS extends ThirdPartyParseable> CLASS readToNewBean(EndianAwareDataInputStream is, Class <CLASS> clazz) throws IllegalAccessException, UnrecognizedFormatException { """ Read the specified EndianAwareDataInputStream, parsing it and writing its property values to a newly-created bean of the specified class.<br> When finished, the current position of the stream will be immediately after the data extracted. @param is @param clazz Class of the bean to which this data is to be parsed. Implied format description in that ThirdPartyParseable class. @return @throws IllegalAccessException @throws UnrecognizedFormatException @since Sep 17, 2012 """ CLASS result=null; try { result = (CLASS)clazz.newInstance(); //result = (CLASS)Beans.instantiate(null, clazz.getName()); ensureContextInstantiatedForReading(is,result); result.describeFormat(this); } catch(InstantiationException e) {e.printStackTrace();} finally {popBean();} return result; }
java
public <CLASS extends ThirdPartyParseable> CLASS readToNewBean(EndianAwareDataInputStream is, Class <CLASS> clazz) throws IllegalAccessException, UnrecognizedFormatException{ CLASS result=null; try { result = (CLASS)clazz.newInstance(); //result = (CLASS)Beans.instantiate(null, clazz.getName()); ensureContextInstantiatedForReading(is,result); result.describeFormat(this); } catch(InstantiationException e) {e.printStackTrace();} finally {popBean();} return result; }
[ "public", "<", "CLASS", "extends", "ThirdPartyParseable", ">", "CLASS", "readToNewBean", "(", "EndianAwareDataInputStream", "is", ",", "Class", "<", "CLASS", ">", "clazz", ")", "throws", "IllegalAccessException", ",", "UnrecognizedFormatException", "{", "CLASS", "result", "=", "null", ";", "try", "{", "result", "=", "(", "CLASS", ")", "clazz", ".", "newInstance", "(", ")", ";", "//result = (CLASS)Beans.instantiate(null, clazz.getName());", "ensureContextInstantiatedForReading", "(", "is", ",", "result", ")", ";", "result", ".", "describeFormat", "(", "this", ")", ";", "}", "catch", "(", "InstantiationException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "popBean", "(", ")", ";", "}", "return", "result", ";", "}" ]
Read the specified EndianAwareDataInputStream, parsing it and writing its property values to a newly-created bean of the specified class.<br> When finished, the current position of the stream will be immediately after the data extracted. @param is @param clazz Class of the bean to which this data is to be parsed. Implied format description in that ThirdPartyParseable class. @return @throws IllegalAccessException @throws UnrecognizedFormatException @since Sep 17, 2012
[ "Read", "the", "specified", "EndianAwareDataInputStream", "parsing", "it", "and", "writing", "its", "property", "values", "to", "a", "newly", "-", "created", "bean", "of", "the", "specified", "class", ".", "<br", ">", "When", "finished", "the", "current", "position", "of", "the", "stream", "will", "be", "immediately", "after", "the", "data", "extracted", "." ]
train
https://github.com/jtrfp/jfdt/blob/64e665669b5fcbfe96736346b4e7893e466dd8a0/src/main/java/org/jtrfp/jfdt/Parser.java#L152-L166
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalConsumer.java
JournalConsumer.getObjectXML
public InputStream getObjectXML(Context context, String pid, String encoding) throws ServerException { """ Read-only method: pass the call to the {@link ManagementDelegate}. """ return delegate.getObjectXML(context, pid, encoding); }
java
public InputStream getObjectXML(Context context, String pid, String encoding) throws ServerException { return delegate.getObjectXML(context, pid, encoding); }
[ "public", "InputStream", "getObjectXML", "(", "Context", "context", ",", "String", "pid", ",", "String", "encoding", ")", "throws", "ServerException", "{", "return", "delegate", ".", "getObjectXML", "(", "context", ",", "pid", ",", "encoding", ")", ";", "}" ]
Read-only method: pass the call to the {@link ManagementDelegate}.
[ "Read", "-", "only", "method", ":", "pass", "the", "call", "to", "the", "{" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/JournalConsumer.java#L336-L339
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/Counter.java
Counter.getPreviouslyCounted
int getPreviouslyCounted(XPathContext support, int node) { """ Try and find a node that was previously counted. If found, return a positive integer that corresponds to the count. @param support The XPath context to use @param node The node to be counted. @return The count of the node, or -1 if not found. """ int n = m_countNodes.size(); m_countResult = 0; for (int i = n - 1; i >= 0; i--) { int countedNode = m_countNodes.elementAt(i); if (node == countedNode) { // Since the list is in backwards order, the count is // how many are in the rest of the list. m_countResult = i + 1 + m_countNodesStartCount; break; } DTM dtm = support.getDTM(countedNode); // Try to see if the given node falls after the counted node... // if it does, don't keep searching backwards. if (dtm.isNodeAfter(countedNode, node)) break; } return m_countResult; }
java
int getPreviouslyCounted(XPathContext support, int node) { int n = m_countNodes.size(); m_countResult = 0; for (int i = n - 1; i >= 0; i--) { int countedNode = m_countNodes.elementAt(i); if (node == countedNode) { // Since the list is in backwards order, the count is // how many are in the rest of the list. m_countResult = i + 1 + m_countNodesStartCount; break; } DTM dtm = support.getDTM(countedNode); // Try to see if the given node falls after the counted node... // if it does, don't keep searching backwards. if (dtm.isNodeAfter(countedNode, node)) break; } return m_countResult; }
[ "int", "getPreviouslyCounted", "(", "XPathContext", "support", ",", "int", "node", ")", "{", "int", "n", "=", "m_countNodes", ".", "size", "(", ")", ";", "m_countResult", "=", "0", ";", "for", "(", "int", "i", "=", "n", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "int", "countedNode", "=", "m_countNodes", ".", "elementAt", "(", "i", ")", ";", "if", "(", "node", "==", "countedNode", ")", "{", "// Since the list is in backwards order, the count is ", "// how many are in the rest of the list.", "m_countResult", "=", "i", "+", "1", "+", "m_countNodesStartCount", ";", "break", ";", "}", "DTM", "dtm", "=", "support", ".", "getDTM", "(", "countedNode", ")", ";", "// Try to see if the given node falls after the counted node...", "// if it does, don't keep searching backwards.", "if", "(", "dtm", ".", "isNodeAfter", "(", "countedNode", ",", "node", ")", ")", "break", ";", "}", "return", "m_countResult", ";", "}" ]
Try and find a node that was previously counted. If found, return a positive integer that corresponds to the count. @param support The XPath context to use @param node The node to be counted. @return The count of the node, or -1 if not found.
[ "Try", "and", "find", "a", "node", "that", "was", "previously", "counted", ".", "If", "found", "return", "a", "positive", "integer", "that", "corresponds", "to", "the", "count", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/Counter.java#L113-L143
meltmedia/cadmium
servlets/src/main/java/com/meltmedia/cadmium/servlets/AbstractSecureRedirectStrategy.java
AbstractSecureRedirectStrategy.secureUrl
public String secureUrl(HttpServletRequest request, HttpServletResponse response) throws IOException { """ Returns the secure version of the original URL for the request. @param request the insecure request that was made. @param response the response for the request. @return the secure version of the original URL for the request. @throws IOException if the url could not be created. """ String protocol = getProtocol(request); if( protocol.equalsIgnoreCase(HTTP_PROTOCOL) ) { int port = mapPort(TO_SECURE_PORT_MAP, getPort(request)); try { URI newUri = changeProtocolAndPort(HTTPS_PROTOCOL, port == DEFAULT_HTTPS_PORT ? -1 : port, request); return newUri.toString(); } catch (URISyntaxException e) { throw new IllegalStateException("Failed to create URI.", e); } } else { throw new UnsupportedProtocolException("Cannot build secure url for "+protocol); } }
java
public String secureUrl(HttpServletRequest request, HttpServletResponse response) throws IOException { String protocol = getProtocol(request); if( protocol.equalsIgnoreCase(HTTP_PROTOCOL) ) { int port = mapPort(TO_SECURE_PORT_MAP, getPort(request)); try { URI newUri = changeProtocolAndPort(HTTPS_PROTOCOL, port == DEFAULT_HTTPS_PORT ? -1 : port, request); return newUri.toString(); } catch (URISyntaxException e) { throw new IllegalStateException("Failed to create URI.", e); } } else { throw new UnsupportedProtocolException("Cannot build secure url for "+protocol); } }
[ "public", "String", "secureUrl", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", "{", "String", "protocol", "=", "getProtocol", "(", "request", ")", ";", "if", "(", "protocol", ".", "equalsIgnoreCase", "(", "HTTP_PROTOCOL", ")", ")", "{", "int", "port", "=", "mapPort", "(", "TO_SECURE_PORT_MAP", ",", "getPort", "(", "request", ")", ")", ";", "try", "{", "URI", "newUri", "=", "changeProtocolAndPort", "(", "HTTPS_PROTOCOL", ",", "port", "==", "DEFAULT_HTTPS_PORT", "?", "-", "1", ":", "port", ",", "request", ")", ";", "return", "newUri", ".", "toString", "(", ")", ";", "}", "catch", "(", "URISyntaxException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Failed to create URI.\"", ",", "e", ")", ";", "}", "}", "else", "{", "throw", "new", "UnsupportedProtocolException", "(", "\"Cannot build secure url for \"", "+", "protocol", ")", ";", "}", "}" ]
Returns the secure version of the original URL for the request. @param request the insecure request that was made. @param response the response for the request. @return the secure version of the original URL for the request. @throws IOException if the url could not be created.
[ "Returns", "the", "secure", "version", "of", "the", "original", "URL", "for", "the", "request", "." ]
train
https://github.com/meltmedia/cadmium/blob/bca585030e141803a73b58abb128d130157b6ddf/servlets/src/main/java/com/meltmedia/cadmium/servlets/AbstractSecureRedirectStrategy.java#L109-L123
jamesagnew/hapi-fhir
hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ParametersUtil.java
ParametersUtil.addParameterToParameters
public static void addParameterToParameters(FhirContext theContext, IBaseParameters theParameters, String theName, Object theValue) { """ Add a paratemer value to a Parameters resource @param theContext The FhirContext @param theParameters The Parameters resource @param theName The parametr name @param theValue The parameter value (can be a {@link IBaseResource resource} or a {@link IBaseDatatype datatype}) """ RuntimeResourceDefinition def = theContext.getResourceDefinition(theParameters); BaseRuntimeChildDefinition paramChild = def.getChildByName("parameter"); BaseRuntimeElementCompositeDefinition<?> paramChildElem = (BaseRuntimeElementCompositeDefinition<?>) paramChild.getChildByName("parameter"); addClientParameter(theContext, theValue, theParameters, paramChild, paramChildElem, theName); }
java
public static void addParameterToParameters(FhirContext theContext, IBaseParameters theParameters, String theName, Object theValue) { RuntimeResourceDefinition def = theContext.getResourceDefinition(theParameters); BaseRuntimeChildDefinition paramChild = def.getChildByName("parameter"); BaseRuntimeElementCompositeDefinition<?> paramChildElem = (BaseRuntimeElementCompositeDefinition<?>) paramChild.getChildByName("parameter"); addClientParameter(theContext, theValue, theParameters, paramChild, paramChildElem, theName); }
[ "public", "static", "void", "addParameterToParameters", "(", "FhirContext", "theContext", ",", "IBaseParameters", "theParameters", ",", "String", "theName", ",", "Object", "theValue", ")", "{", "RuntimeResourceDefinition", "def", "=", "theContext", ".", "getResourceDefinition", "(", "theParameters", ")", ";", "BaseRuntimeChildDefinition", "paramChild", "=", "def", ".", "getChildByName", "(", "\"parameter\"", ")", ";", "BaseRuntimeElementCompositeDefinition", "<", "?", ">", "paramChildElem", "=", "(", "BaseRuntimeElementCompositeDefinition", "<", "?", ">", ")", "paramChild", ".", "getChildByName", "(", "\"parameter\"", ")", ";", "addClientParameter", "(", "theContext", ",", "theValue", ",", "theParameters", ",", "paramChild", ",", "paramChildElem", ",", "theName", ")", ";", "}" ]
Add a paratemer value to a Parameters resource @param theContext The FhirContext @param theParameters The Parameters resource @param theName The parametr name @param theValue The parameter value (can be a {@link IBaseResource resource} or a {@link IBaseDatatype datatype})
[ "Add", "a", "paratemer", "value", "to", "a", "Parameters", "resource" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ParametersUtil.java#L99-L105
reapzor/FiloFirmata
src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java
Firmata.addMessageListener
public void addMessageListener(Class<? extends Message> messageClass, MessageListener<Message> messageListener) { """ Add a generic message listener to listen for a specific type of message. Useful if you want to combine several or more message handlers into one bucket. @param messageClass Message class to listen to from the project board. @param messageListener (Generic)Listener that will fire whenever the message type is received. """ addMessageListener(messageListener.getChannelIdentifier(), messageClass, messageListener); }
java
public void addMessageListener(Class<? extends Message> messageClass, MessageListener<Message> messageListener) { addMessageListener(messageListener.getChannelIdentifier(), messageClass, messageListener); }
[ "public", "void", "addMessageListener", "(", "Class", "<", "?", "extends", "Message", ">", "messageClass", ",", "MessageListener", "<", "Message", ">", "messageListener", ")", "{", "addMessageListener", "(", "messageListener", ".", "getChannelIdentifier", "(", ")", ",", "messageClass", ",", "messageListener", ")", ";", "}" ]
Add a generic message listener to listen for a specific type of message. Useful if you want to combine several or more message handlers into one bucket. @param messageClass Message class to listen to from the project board. @param messageListener (Generic)Listener that will fire whenever the message type is received.
[ "Add", "a", "generic", "message", "listener", "to", "listen", "for", "a", "specific", "type", "of", "message", ".", "Useful", "if", "you", "want", "to", "combine", "several", "or", "more", "message", "handlers", "into", "one", "bucket", "." ]
train
https://github.com/reapzor/FiloFirmata/blob/39c26c1a577b8fff8690245e105cb62e02284f16/src/main/java/com/bortbort/arduino/FiloFirmata/Firmata.java#L195-L197
stratosphere/stratosphere
stratosphere-addons/spargel/src/main/java/eu/stratosphere/spargel/java/VertexCentricIteration.java
VertexCentricIteration.addBroadcastSetForUpdateFunction
public void addBroadcastSetForUpdateFunction(String name, DataSet<?> data) { """ Adds a data set as a broadcast set to the vertex update function. @param name The name under which the broadcast data is available in the vertex update function. @param data The data set to be broadcasted. """ this.bcVarsUpdate.add(new Tuple2<String, DataSet<?>>(name, data)); }
java
public void addBroadcastSetForUpdateFunction(String name, DataSet<?> data) { this.bcVarsUpdate.add(new Tuple2<String, DataSet<?>>(name, data)); }
[ "public", "void", "addBroadcastSetForUpdateFunction", "(", "String", "name", ",", "DataSet", "<", "?", ">", "data", ")", "{", "this", ".", "bcVarsUpdate", ".", "add", "(", "new", "Tuple2", "<", "String", ",", "DataSet", "<", "?", ">", ">", "(", "name", ",", "data", ")", ")", ";", "}" ]
Adds a data set as a broadcast set to the vertex update function. @param name The name under which the broadcast data is available in the vertex update function. @param data The data set to be broadcasted.
[ "Adds", "a", "data", "set", "as", "a", "broadcast", "set", "to", "the", "vertex", "update", "function", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-addons/spargel/src/main/java/eu/stratosphere/spargel/java/VertexCentricIteration.java#L190-L192
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java
EventHubConnectionsInner.getAsync
public Observable<EventHubConnectionInner> getAsync(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName) { """ Returns an Event Hub connection. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @param eventHubConnectionName The name of the event hub connection. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EventHubConnectionInner object """ return getWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName).map(new Func1<ServiceResponse<EventHubConnectionInner>, EventHubConnectionInner>() { @Override public EventHubConnectionInner call(ServiceResponse<EventHubConnectionInner> response) { return response.body(); } }); }
java
public Observable<EventHubConnectionInner> getAsync(String resourceGroupName, String clusterName, String databaseName, String eventHubConnectionName) { return getWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, eventHubConnectionName).map(new Func1<ServiceResponse<EventHubConnectionInner>, EventHubConnectionInner>() { @Override public EventHubConnectionInner call(ServiceResponse<EventHubConnectionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "EventHubConnectionInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "databaseName", ",", "String", "eventHubConnectionName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", ",", "databaseName", ",", "eventHubConnectionName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "EventHubConnectionInner", ">", ",", "EventHubConnectionInner", ">", "(", ")", "{", "@", "Override", "public", "EventHubConnectionInner", "call", "(", "ServiceResponse", "<", "EventHubConnectionInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Returns an Event Hub connection. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @param eventHubConnectionName The name of the event hub connection. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the EventHubConnectionInner object
[ "Returns", "an", "Event", "Hub", "connection", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/EventHubConnectionsInner.java#L341-L348
ops4j/org.ops4j.base
ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java
Resources.getShort
public short getShort( String key, short defaultValue ) throws MissingResourceException { """ Retrieve a short from bundle. @param key the key of resource @param defaultValue the default value if key is missing @return the resource short @throws MissingResourceException if the requested key is unknown """ try { return getShort( key ); } catch( MissingResourceException mre ) { return defaultValue; } }
java
public short getShort( String key, short defaultValue ) throws MissingResourceException { try { return getShort( key ); } catch( MissingResourceException mre ) { return defaultValue; } }
[ "public", "short", "getShort", "(", "String", "key", ",", "short", "defaultValue", ")", "throws", "MissingResourceException", "{", "try", "{", "return", "getShort", "(", "key", ")", ";", "}", "catch", "(", "MissingResourceException", "mre", ")", "{", "return", "defaultValue", ";", "}", "}" ]
Retrieve a short from bundle. @param key the key of resource @param defaultValue the default value if key is missing @return the resource short @throws MissingResourceException if the requested key is unknown
[ "Retrieve", "a", "short", "from", "bundle", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/Resources.java#L277-L288
cache2k/cache2k
cache2k-core/src/main/java/org/cache2k/core/WiredCache.java
WiredCache.loadAllWithAsyncLoader
private void loadAllWithAsyncLoader(final CacheOperationCompletionListener _listener, final Set<K> _keysToLoad) { """ Load the keys into the cache via the async path. The key set must always be non empty. The completion listener is called when all keys are loaded. """ final AtomicInteger _countDown = new AtomicInteger(_keysToLoad.size()); EntryAction.ActionCompletedCallback cb = new EntryAction.ActionCompletedCallback() { @Override public void entryActionCompleted(final EntryAction ea) { int v = _countDown.decrementAndGet(); if (v == 0) { _listener.onCompleted(); return; } } }; for (K k : _keysToLoad) { final K key = k; executeAsync(key, null, SPEC.GET, cb); } }
java
private void loadAllWithAsyncLoader(final CacheOperationCompletionListener _listener, final Set<K> _keysToLoad) { final AtomicInteger _countDown = new AtomicInteger(_keysToLoad.size()); EntryAction.ActionCompletedCallback cb = new EntryAction.ActionCompletedCallback() { @Override public void entryActionCompleted(final EntryAction ea) { int v = _countDown.decrementAndGet(); if (v == 0) { _listener.onCompleted(); return; } } }; for (K k : _keysToLoad) { final K key = k; executeAsync(key, null, SPEC.GET, cb); } }
[ "private", "void", "loadAllWithAsyncLoader", "(", "final", "CacheOperationCompletionListener", "_listener", ",", "final", "Set", "<", "K", ">", "_keysToLoad", ")", "{", "final", "AtomicInteger", "_countDown", "=", "new", "AtomicInteger", "(", "_keysToLoad", ".", "size", "(", ")", ")", ";", "EntryAction", ".", "ActionCompletedCallback", "cb", "=", "new", "EntryAction", ".", "ActionCompletedCallback", "(", ")", "{", "@", "Override", "public", "void", "entryActionCompleted", "(", "final", "EntryAction", "ea", ")", "{", "int", "v", "=", "_countDown", ".", "decrementAndGet", "(", ")", ";", "if", "(", "v", "==", "0", ")", "{", "_listener", ".", "onCompleted", "(", ")", ";", "return", ";", "}", "}", "}", ";", "for", "(", "K", "k", ":", "_keysToLoad", ")", "{", "final", "K", "key", "=", "k", ";", "executeAsync", "(", "key", ",", "null", ",", "SPEC", ".", "GET", ",", "cb", ")", ";", "}", "}" ]
Load the keys into the cache via the async path. The key set must always be non empty. The completion listener is called when all keys are loaded.
[ "Load", "the", "keys", "into", "the", "cache", "via", "the", "async", "path", ".", "The", "key", "set", "must", "always", "be", "non", "empty", ".", "The", "completion", "listener", "is", "called", "when", "all", "keys", "are", "loaded", "." ]
train
https://github.com/cache2k/cache2k/blob/3c9ccff12608c598c387ec50957089784cc4b618/cache2k-core/src/main/java/org/cache2k/core/WiredCache.java#L282-L298
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionRelPersistenceImpl.java
CPDefinitionOptionRelPersistenceImpl.removeByC_SC
@Override public void removeByC_SC(long CPDefinitionId, boolean skuContributor) { """ Removes all the cp definition option rels where CPDefinitionId = &#63; and skuContributor = &#63; from the database. @param CPDefinitionId the cp definition ID @param skuContributor the sku contributor """ for (CPDefinitionOptionRel cpDefinitionOptionRel : findByC_SC( CPDefinitionId, skuContributor, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDefinitionOptionRel); } }
java
@Override public void removeByC_SC(long CPDefinitionId, boolean skuContributor) { for (CPDefinitionOptionRel cpDefinitionOptionRel : findByC_SC( CPDefinitionId, skuContributor, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDefinitionOptionRel); } }
[ "@", "Override", "public", "void", "removeByC_SC", "(", "long", "CPDefinitionId", ",", "boolean", "skuContributor", ")", "{", "for", "(", "CPDefinitionOptionRel", "cpDefinitionOptionRel", ":", "findByC_SC", "(", "CPDefinitionId", ",", "skuContributor", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ")", "{", "remove", "(", "cpDefinitionOptionRel", ")", ";", "}", "}" ]
Removes all the cp definition option rels where CPDefinitionId = &#63; and skuContributor = &#63; from the database. @param CPDefinitionId the cp definition ID @param skuContributor the sku contributor
[ "Removes", "all", "the", "cp", "definition", "option", "rels", "where", "CPDefinitionId", "=", "&#63", ";", "and", "skuContributor", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionRelPersistenceImpl.java#L3752-L3759
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java
KDTree.centerInstances
public void centerInstances(Instances centers, int[] assignments, double pc) throws Exception { """ Assigns instances to centers using KDTree. @param centers the current centers @param assignments the centerindex for each instance @param pc the threshold value for pruning. @throws Exception If there is some problem assigning instances to centers. """ int[] centList = new int[centers.numInstances()]; for (int i = 0; i < centers.numInstances(); i++) centList[i] = i; determineAssignments(m_Root, centers, centList, assignments, pc); }
java
public void centerInstances(Instances centers, int[] assignments, double pc) throws Exception { int[] centList = new int[centers.numInstances()]; for (int i = 0; i < centers.numInstances(); i++) centList[i] = i; determineAssignments(m_Root, centers, centList, assignments, pc); }
[ "public", "void", "centerInstances", "(", "Instances", "centers", ",", "int", "[", "]", "assignments", ",", "double", "pc", ")", "throws", "Exception", "{", "int", "[", "]", "centList", "=", "new", "int", "[", "centers", ".", "numInstances", "(", ")", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "centers", ".", "numInstances", "(", ")", ";", "i", "++", ")", "centList", "[", "i", "]", "=", "i", ";", "determineAssignments", "(", "m_Root", ",", "centers", ",", "centList", ",", "assignments", ",", "pc", ")", ";", "}" ]
Assigns instances to centers using KDTree. @param centers the current centers @param assignments the centerindex for each instance @param pc the threshold value for pruning. @throws Exception If there is some problem assigning instances to centers.
[ "Assigns", "instances", "to", "centers", "using", "KDTree", "." ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/KDTree.java#L701-L709
bbottema/simple-java-mail
modules/core-module/src/main/java/org/simplejavamail/internal/util/MiscUtil.java
MiscUtil.readInputStreamToString
@Nonnull public static String readInputStreamToString(@Nonnull final InputStream inputStream, @Nonnull final Charset charset) throws IOException { """ Uses standard JDK java to read an inputstream to String using the given encoding (in {@link ByteArrayOutputStream#toString(String)}). """ final BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); int result = bufferedInputStream.read(); while (result != -1) { byteArrayOutputStream.write((byte) result); result = bufferedInputStream.read(); } return byteArrayOutputStream.toString(checkNonEmptyArgument(charset, "charset").name()); }
java
@Nonnull public static String readInputStreamToString(@Nonnull final InputStream inputStream, @Nonnull final Charset charset) throws IOException { final BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); int result = bufferedInputStream.read(); while (result != -1) { byteArrayOutputStream.write((byte) result); result = bufferedInputStream.read(); } return byteArrayOutputStream.toString(checkNonEmptyArgument(charset, "charset").name()); }
[ "@", "Nonnull", "public", "static", "String", "readInputStreamToString", "(", "@", "Nonnull", "final", "InputStream", "inputStream", ",", "@", "Nonnull", "final", "Charset", "charset", ")", "throws", "IOException", "{", "final", "BufferedInputStream", "bufferedInputStream", "=", "new", "BufferedInputStream", "(", "inputStream", ")", ";", "final", "ByteArrayOutputStream", "byteArrayOutputStream", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "int", "result", "=", "bufferedInputStream", ".", "read", "(", ")", ";", "while", "(", "result", "!=", "-", "1", ")", "{", "byteArrayOutputStream", ".", "write", "(", "(", "byte", ")", "result", ")", ";", "result", "=", "bufferedInputStream", ".", "read", "(", ")", ";", "}", "return", "byteArrayOutputStream", ".", "toString", "(", "checkNonEmptyArgument", "(", "charset", ",", "\"charset\"", ")", ".", "name", "(", ")", ")", ";", "}" ]
Uses standard JDK java to read an inputstream to String using the given encoding (in {@link ByteArrayOutputStream#toString(String)}).
[ "Uses", "standard", "JDK", "java", "to", "read", "an", "inputstream", "to", "String", "using", "the", "given", "encoding", "(", "in", "{" ]
train
https://github.com/bbottema/simple-java-mail/blob/b03635328aeecd525e35eddfef8f5b9a184559d8/modules/core-module/src/main/java/org/simplejavamail/internal/util/MiscUtil.java#L102-L113
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ListUtil.java
ListUtil.sortIgnoreEmpty
public static String sortIgnoreEmpty(String list, String sortType, String sortOrder, String delimiter) throws PageException { """ sorts a string list @param list list to sort @param sortType sort type (numeric,text,textnocase) @param sortOrder sort order (asc,desc) @param delimiter list delimiter @return sorted list @throws PageException """ return _sort(toStringArray(listToArrayRemoveEmpty(list, delimiter)), sortType, sortOrder, delimiter); }
java
public static String sortIgnoreEmpty(String list, String sortType, String sortOrder, String delimiter) throws PageException { return _sort(toStringArray(listToArrayRemoveEmpty(list, delimiter)), sortType, sortOrder, delimiter); }
[ "public", "static", "String", "sortIgnoreEmpty", "(", "String", "list", ",", "String", "sortType", ",", "String", "sortOrder", ",", "String", "delimiter", ")", "throws", "PageException", "{", "return", "_sort", "(", "toStringArray", "(", "listToArrayRemoveEmpty", "(", "list", ",", "delimiter", ")", ")", ",", "sortType", ",", "sortOrder", ",", "delimiter", ")", ";", "}" ]
sorts a string list @param list list to sort @param sortType sort type (numeric,text,textnocase) @param sortOrder sort order (asc,desc) @param delimiter list delimiter @return sorted list @throws PageException
[ "sorts", "a", "string", "list" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ListUtil.java#L1143-L1145
ops4j/org.ops4j.pax.logging
pax-logging-service/src/main/java/org/apache/log4j/config/PaxPropertySetter.java
PaxPropertySetter.setProperties
public static void setProperties(Object obj, Properties properties, String prefix) { """ Set the properties of an object passed as a parameter in one go. The <code>properties</code> are parsed relative to a <code>prefix</code>. @param obj The object to configure. @param properties A java.util.Properties containing keys and values. @param prefix Only keys having the specified prefix will be set. """ new PaxPropertySetter(obj).setProperties(properties, prefix); }
java
public static void setProperties(Object obj, Properties properties, String prefix) { new PaxPropertySetter(obj).setProperties(properties, prefix); }
[ "public", "static", "void", "setProperties", "(", "Object", "obj", ",", "Properties", "properties", ",", "String", "prefix", ")", "{", "new", "PaxPropertySetter", "(", "obj", ")", ".", "setProperties", "(", "properties", ",", "prefix", ")", ";", "}" ]
Set the properties of an object passed as a parameter in one go. The <code>properties</code> are parsed relative to a <code>prefix</code>. @param obj The object to configure. @param properties A java.util.Properties containing keys and values. @param prefix Only keys having the specified prefix will be set.
[ "Set", "the", "properties", "of", "an", "object", "passed", "as", "a", "parameter", "in", "one", "go", ".", "The", "<code", ">", "properties<", "/", "code", ">", "are", "parsed", "relative", "to", "a", "<code", ">", "prefix<", "/", "code", ">", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/config/PaxPropertySetter.java#L105-L109
Metatavu/edelphi
edelphi/src/main/java/fi/metatavu/edelphi/utils/QueryDataUtils.java
QueryDataUtils.getReplierExportStrategyLabel
private static String getReplierExportStrategyLabel(Locale locale, ReplierExportStrategy replierExportStrategy) { """ Returns label for given replier export strategy @param locale locale @param replierExportStrategy replier export strategy @return label """ switch (replierExportStrategy) { case NONE: break; case HASH: return Messages.getInstance().getText(locale, "panelAdmin.query.export.csvReplierIdColumn"); case NAME: return Messages.getInstance().getText(locale, "panelAdmin.query.export.csvReplierNameColumn"); case EMAIL: return Messages.getInstance().getText(locale, "panelAdmin.query.export.csvReplierEmailColumn"); } return null; }
java
private static String getReplierExportStrategyLabel(Locale locale, ReplierExportStrategy replierExportStrategy) { switch (replierExportStrategy) { case NONE: break; case HASH: return Messages.getInstance().getText(locale, "panelAdmin.query.export.csvReplierIdColumn"); case NAME: return Messages.getInstance().getText(locale, "panelAdmin.query.export.csvReplierNameColumn"); case EMAIL: return Messages.getInstance().getText(locale, "panelAdmin.query.export.csvReplierEmailColumn"); } return null; }
[ "private", "static", "String", "getReplierExportStrategyLabel", "(", "Locale", "locale", ",", "ReplierExportStrategy", "replierExportStrategy", ")", "{", "switch", "(", "replierExportStrategy", ")", "{", "case", "NONE", ":", "break", ";", "case", "HASH", ":", "return", "Messages", ".", "getInstance", "(", ")", ".", "getText", "(", "locale", ",", "\"panelAdmin.query.export.csvReplierIdColumn\"", ")", ";", "case", "NAME", ":", "return", "Messages", ".", "getInstance", "(", ")", ".", "getText", "(", "locale", ",", "\"panelAdmin.query.export.csvReplierNameColumn\"", ")", ";", "case", "EMAIL", ":", "return", "Messages", ".", "getInstance", "(", ")", ".", "getText", "(", "locale", ",", "\"panelAdmin.query.export.csvReplierEmailColumn\"", ")", ";", "}", "return", "null", ";", "}" ]
Returns label for given replier export strategy @param locale locale @param replierExportStrategy replier export strategy @return label
[ "Returns", "label", "for", "given", "replier", "export", "strategy" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/QueryDataUtils.java#L279-L292
haraldk/TwelveMonkeys
common/common-io/src/main/java/com/twelvemonkeys/io/ole2/CompoundDocument.java
CompoundDocument.getSIdChain
private SIdChain getSIdChain(final int pSId, final long pStreamSize) throws IOException { """ Gets the SIdChain for the given stream Id @param pSId the stream Id @param pStreamSize the size of the stream, or -1 for system control streams @return the SIdChain for the given stream Id @throws IOException if an I/O exception occurs """ SIdChain chain = new SIdChain(); int[] sat = isShortStream(pStreamSize) ? shortSAT : SAT; int sid = pSId; while (sid != END_OF_CHAIN_SID && sid != FREE_SID) { chain.addSID(sid); sid = sat[sid]; } return chain; }
java
private SIdChain getSIdChain(final int pSId, final long pStreamSize) throws IOException { SIdChain chain = new SIdChain(); int[] sat = isShortStream(pStreamSize) ? shortSAT : SAT; int sid = pSId; while (sid != END_OF_CHAIN_SID && sid != FREE_SID) { chain.addSID(sid); sid = sat[sid]; } return chain; }
[ "private", "SIdChain", "getSIdChain", "(", "final", "int", "pSId", ",", "final", "long", "pStreamSize", ")", "throws", "IOException", "{", "SIdChain", "chain", "=", "new", "SIdChain", "(", ")", ";", "int", "[", "]", "sat", "=", "isShortStream", "(", "pStreamSize", ")", "?", "shortSAT", ":", "SAT", ";", "int", "sid", "=", "pSId", ";", "while", "(", "sid", "!=", "END_OF_CHAIN_SID", "&&", "sid", "!=", "FREE_SID", ")", "{", "chain", ".", "addSID", "(", "sid", ")", ";", "sid", "=", "sat", "[", "sid", "]", ";", "}", "return", "chain", ";", "}" ]
Gets the SIdChain for the given stream Id @param pSId the stream Id @param pStreamSize the size of the stream, or -1 for system control streams @return the SIdChain for the given stream Id @throws IOException if an I/O exception occurs
[ "Gets", "the", "SIdChain", "for", "the", "given", "stream", "Id" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-io/src/main/java/com/twelvemonkeys/io/ole2/CompoundDocument.java#L414-L426
feroult/yawp
yawp-core/src/main/java/io/yawp/commons/utils/ResourceFinder.java
ResourceFinder.findAvailableImplementations
public List<Class> findAvailableImplementations(Class interfase) throws IOException { """ Assumes the class specified points to a file in the classpath that contains the name of a class that implements or is a subclass of the specfied class. <p/> Any class that cannot be loaded or are not assignable to the specified class will be skipped and placed in the 'resourcesNotLoaded' collection. <p/> Example classpath: <p/> META-INF/java.io.InputStream # contains the classname org.acme.AcmeInputStream META-INF/java.io.InputStream # contains the classname org.widget.NeatoInputStream META-INF/java.io.InputStream # contains the classname com.foo.BarInputStream <p/> ResourceFinder finder = new ResourceFinder("META-INF/"); List classes = finder.findAllImplementations(java.io.InputStream.class); classes.contains("org.acme.AcmeInputStream"); // true classes.contains("org.widget.NeatoInputStream"); // true classes.contains("com.foo.BarInputStream"); // true @param interfase a superclass or interface @return @throws IOException if classLoader.getResources throws an exception """ resourcesNotLoaded.clear(); List<Class> implementations = new ArrayList<>(); List<String> strings = findAvailableStrings(interfase.getName()); for (String className : strings) { try { Class impl = classLoader.loadClass(className); if (interfase.isAssignableFrom(impl)) { implementations.add(impl); } else { resourcesNotLoaded.add(className); } } catch (Exception notAvailable) { resourcesNotLoaded.add(className); } } return implementations; }
java
public List<Class> findAvailableImplementations(Class interfase) throws IOException { resourcesNotLoaded.clear(); List<Class> implementations = new ArrayList<>(); List<String> strings = findAvailableStrings(interfase.getName()); for (String className : strings) { try { Class impl = classLoader.loadClass(className); if (interfase.isAssignableFrom(impl)) { implementations.add(impl); } else { resourcesNotLoaded.add(className); } } catch (Exception notAvailable) { resourcesNotLoaded.add(className); } } return implementations; }
[ "public", "List", "<", "Class", ">", "findAvailableImplementations", "(", "Class", "interfase", ")", "throws", "IOException", "{", "resourcesNotLoaded", ".", "clear", "(", ")", ";", "List", "<", "Class", ">", "implementations", "=", "new", "ArrayList", "<>", "(", ")", ";", "List", "<", "String", ">", "strings", "=", "findAvailableStrings", "(", "interfase", ".", "getName", "(", ")", ")", ";", "for", "(", "String", "className", ":", "strings", ")", "{", "try", "{", "Class", "impl", "=", "classLoader", ".", "loadClass", "(", "className", ")", ";", "if", "(", "interfase", ".", "isAssignableFrom", "(", "impl", ")", ")", "{", "implementations", ".", "add", "(", "impl", ")", ";", "}", "else", "{", "resourcesNotLoaded", ".", "add", "(", "className", ")", ";", "}", "}", "catch", "(", "Exception", "notAvailable", ")", "{", "resourcesNotLoaded", ".", "add", "(", "className", ")", ";", "}", "}", "return", "implementations", ";", "}" ]
Assumes the class specified points to a file in the classpath that contains the name of a class that implements or is a subclass of the specfied class. <p/> Any class that cannot be loaded or are not assignable to the specified class will be skipped and placed in the 'resourcesNotLoaded' collection. <p/> Example classpath: <p/> META-INF/java.io.InputStream # contains the classname org.acme.AcmeInputStream META-INF/java.io.InputStream # contains the classname org.widget.NeatoInputStream META-INF/java.io.InputStream # contains the classname com.foo.BarInputStream <p/> ResourceFinder finder = new ResourceFinder("META-INF/"); List classes = finder.findAllImplementations(java.io.InputStream.class); classes.contains("org.acme.AcmeInputStream"); // true classes.contains("org.widget.NeatoInputStream"); // true classes.contains("com.foo.BarInputStream"); // true @param interfase a superclass or interface @return @throws IOException if classLoader.getResources throws an exception
[ "Assumes", "the", "class", "specified", "points", "to", "a", "file", "in", "the", "classpath", "that", "contains", "the", "name", "of", "a", "class", "that", "implements", "or", "is", "a", "subclass", "of", "the", "specfied", "class", ".", "<p", "/", ">", "Any", "class", "that", "cannot", "be", "loaded", "or", "are", "not", "assignable", "to", "the", "specified", "class", "will", "be", "skipped", "and", "placed", "in", "the", "resourcesNotLoaded", "collection", ".", "<p", "/", ">", "Example", "classpath", ":", "<p", "/", ">", "META", "-", "INF", "/", "java", ".", "io", ".", "InputStream", "#", "contains", "the", "classname", "org", ".", "acme", ".", "AcmeInputStream", "META", "-", "INF", "/", "java", ".", "io", ".", "InputStream", "#", "contains", "the", "classname", "org", ".", "widget", ".", "NeatoInputStream", "META", "-", "INF", "/", "java", ".", "io", ".", "InputStream", "#", "contains", "the", "classname", "com", ".", "foo", ".", "BarInputStream", "<p", "/", ">", "ResourceFinder", "finder", "=", "new", "ResourceFinder", "(", "META", "-", "INF", "/", ")", ";", "List", "classes", "=", "finder", ".", "findAllImplementations", "(", "java", ".", "io", ".", "InputStream", ".", "class", ")", ";", "classes", ".", "contains", "(", "org", ".", "acme", ".", "AcmeInputStream", ")", ";", "//", "true", "classes", ".", "contains", "(", "org", ".", "widget", ".", "NeatoInputStream", ")", ";", "//", "true", "classes", ".", "contains", "(", "com", ".", "foo", ".", "BarInputStream", ")", ";", "//", "true" ]
train
https://github.com/feroult/yawp/blob/b90deb905edd3fdb3009a5525e310cd17ead7f3d/yawp-core/src/main/java/io/yawp/commons/utils/ResourceFinder.java#L532-L549
lucee/Lucee
core/src/main/java/lucee/transformer/library/function/FunctionLibFactory.java
FunctionLibFactory.endElement
@Override public void endElement(String uri, String name, String qName) { """ Geerbte Methode von org.xml.sax.ContentHandler, wird bei durchparsen des XML, beim auftreten eines End-Tag aufgerufen. @see org.xml.sax.ContentHandler#endElement(String, String, String) """ setContent(content.toString().trim()); content = new StringBuilder(); inside = ""; if (qName.equals("function")) endFunction(); else if (qName.equals("argument")) endArg(); else if (qName.equals("return")) endReturn(); else if (qName.equals("bundle")) endBundle(); }
java
@Override public void endElement(String uri, String name, String qName) { setContent(content.toString().trim()); content = new StringBuilder(); inside = ""; if (qName.equals("function")) endFunction(); else if (qName.equals("argument")) endArg(); else if (qName.equals("return")) endReturn(); else if (qName.equals("bundle")) endBundle(); }
[ "@", "Override", "public", "void", "endElement", "(", "String", "uri", ",", "String", "name", ",", "String", "qName", ")", "{", "setContent", "(", "content", ".", "toString", "(", ")", ".", "trim", "(", ")", ")", ";", "content", "=", "new", "StringBuilder", "(", ")", ";", "inside", "=", "\"\"", ";", "if", "(", "qName", ".", "equals", "(", "\"function\"", ")", ")", "endFunction", "(", ")", ";", "else", "if", "(", "qName", ".", "equals", "(", "\"argument\"", ")", ")", "endArg", "(", ")", ";", "else", "if", "(", "qName", ".", "equals", "(", "\"return\"", ")", ")", "endReturn", "(", ")", ";", "else", "if", "(", "qName", ".", "equals", "(", "\"bundle\"", ")", ")", "endBundle", "(", ")", ";", "}" ]
Geerbte Methode von org.xml.sax.ContentHandler, wird bei durchparsen des XML, beim auftreten eines End-Tag aufgerufen. @see org.xml.sax.ContentHandler#endElement(String, String, String)
[ "Geerbte", "Methode", "von", "org", ".", "xml", ".", "sax", ".", "ContentHandler", "wird", "bei", "durchparsen", "des", "XML", "beim", "auftreten", "eines", "End", "-", "Tag", "aufgerufen", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLibFactory.java#L182-L192
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java
ReUtil.replaceAll
public static String replaceAll(CharSequence str, Pattern pattern, Func1<Matcher, String> replaceFun) { """ 替换所有正则匹配的文本,并使用自定义函数决定如何替换 @param str 要替换的字符串 @param pattern 用于匹配的正则式 @param replaceFun 决定如何替换的函数,可能被多次调用(当有多个匹配时) @return 替换后的字符串 @since 4.2.2 """ if (StrUtil.isEmpty(str)) { return StrUtil.str(str); } final Matcher matcher = pattern.matcher(str); final StringBuffer buffer = new StringBuffer(); while (matcher.find()) { try { matcher.appendReplacement(buffer, replaceFun.call(matcher)); } catch (Exception e) { throw new UtilException(e); } } matcher.appendTail(buffer); return buffer.toString(); }
java
public static String replaceAll(CharSequence str, Pattern pattern, Func1<Matcher, String> replaceFun){ if (StrUtil.isEmpty(str)) { return StrUtil.str(str); } final Matcher matcher = pattern.matcher(str); final StringBuffer buffer = new StringBuffer(); while (matcher.find()) { try { matcher.appendReplacement(buffer, replaceFun.call(matcher)); } catch (Exception e) { throw new UtilException(e); } } matcher.appendTail(buffer); return buffer.toString(); }
[ "public", "static", "String", "replaceAll", "(", "CharSequence", "str", ",", "Pattern", "pattern", ",", "Func1", "<", "Matcher", ",", "String", ">", "replaceFun", ")", "{", "if", "(", "StrUtil", ".", "isEmpty", "(", "str", ")", ")", "{", "return", "StrUtil", ".", "str", "(", "str", ")", ";", "}", "final", "Matcher", "matcher", "=", "pattern", ".", "matcher", "(", "str", ")", ";", "final", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", ")", ";", "while", "(", "matcher", ".", "find", "(", ")", ")", "{", "try", "{", "matcher", ".", "appendReplacement", "(", "buffer", ",", "replaceFun", ".", "call", "(", "matcher", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "UtilException", "(", "e", ")", ";", "}", "}", "matcher", ".", "appendTail", "(", "buffer", ")", ";", "return", "buffer", ".", "toString", "(", ")", ";", "}" ]
替换所有正则匹配的文本,并使用自定义函数决定如何替换 @param str 要替换的字符串 @param pattern 用于匹配的正则式 @param replaceFun 决定如何替换的函数,可能被多次调用(当有多个匹配时) @return 替换后的字符串 @since 4.2.2
[ "替换所有正则匹配的文本,并使用自定义函数决定如何替换" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReUtil.java#L662-L678
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java
ClassUseWriter.addPackageUse
protected void addPackageUse(PackageElement pkg, Content contentTree) { """ Add the package use information. @param pkg the package that uses the given class @param contentTree the content tree to which the package use information will be added """ Content thFirst = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, getHyperLink(getPackageAnchorName(pkg), new StringContent(utils.getPackageName(pkg)))); contentTree.addContent(thFirst); HtmlTree tdLast = new HtmlTree(HtmlTag.TD); tdLast.addStyle(HtmlStyle.colLast); addSummaryComment(pkg, tdLast); contentTree.addContent(tdLast); }
java
protected void addPackageUse(PackageElement pkg, Content contentTree) { Content thFirst = HtmlTree.TH_ROW_SCOPE(HtmlStyle.colFirst, getHyperLink(getPackageAnchorName(pkg), new StringContent(utils.getPackageName(pkg)))); contentTree.addContent(thFirst); HtmlTree tdLast = new HtmlTree(HtmlTag.TD); tdLast.addStyle(HtmlStyle.colLast); addSummaryComment(pkg, tdLast); contentTree.addContent(tdLast); }
[ "protected", "void", "addPackageUse", "(", "PackageElement", "pkg", ",", "Content", "contentTree", ")", "{", "Content", "thFirst", "=", "HtmlTree", ".", "TH_ROW_SCOPE", "(", "HtmlStyle", ".", "colFirst", ",", "getHyperLink", "(", "getPackageAnchorName", "(", "pkg", ")", ",", "new", "StringContent", "(", "utils", ".", "getPackageName", "(", "pkg", ")", ")", ")", ")", ";", "contentTree", ".", "addContent", "(", "thFirst", ")", ";", "HtmlTree", "tdLast", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "TD", ")", ";", "tdLast", ".", "addStyle", "(", "HtmlStyle", ".", "colLast", ")", ";", "addSummaryComment", "(", "pkg", ",", "tdLast", ")", ";", "contentTree", ".", "addContent", "(", "tdLast", ")", ";", "}" ]
Add the package use information. @param pkg the package that uses the given class @param contentTree the content tree to which the package use information will be added
[ "Add", "the", "package", "use", "information", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java#L383-L391