repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
defei/codelogger-utils
src/main/java/org/codelogger/utils/CollectionUtils.java
CollectionUtils.toSet
public static <T> Set<T> toSet(final Collection<T> collection) { if (isEmpty(collection)) { return new HashSet<T>(0); } else { return new HashSet<T>(collection); } }
java
public static <T> Set<T> toSet(final Collection<T> collection) { if (isEmpty(collection)) { return new HashSet<T>(0); } else { return new HashSet<T>(collection); } }
[ "public", "static", "<", "T", ">", "Set", "<", "T", ">", "toSet", "(", "final", "Collection", "<", "T", ">", "collection", ")", "{", "if", "(", "isEmpty", "(", "collection", ")", ")", "{", "return", "new", "HashSet", "<", "T", ">", "(", "0", ")",...
Convert given collection to a set. @param collection source collection. @return a set has all unique element of given collection.
[ "Convert", "given", "collection", "to", "a", "set", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/CollectionUtils.java#L126-L133
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/CollectionUtils.java
CollectionUtils.toArray
public static <T> T[] toArray(final Collection<T> collection) { T next = getFirstNotNullValue(collection); if (next != null) { Object[] objects = collection.toArray(); @SuppressWarnings("unchecked") T[] convertedObjects = (T[]) Array.newInstance(next.getClass(), objects.length); System.arraycopy(objects, 0, convertedObjects, 0, objects.length); return convertedObjects; } else { return null; } }
java
public static <T> T[] toArray(final Collection<T> collection) { T next = getFirstNotNullValue(collection); if (next != null) { Object[] objects = collection.toArray(); @SuppressWarnings("unchecked") T[] convertedObjects = (T[]) Array.newInstance(next.getClass(), objects.length); System.arraycopy(objects, 0, convertedObjects, 0, objects.length); return convertedObjects; } else { return null; } }
[ "public", "static", "<", "T", ">", "T", "[", "]", "toArray", "(", "final", "Collection", "<", "T", ">", "collection", ")", "{", "T", "next", "=", "getFirstNotNullValue", "(", "collection", ")", ";", "if", "(", "next", "!=", "null", ")", "{", "Object"...
Convert given collection to an array. @param collection source collection. @return an array has full given collection element and order by collection index.
[ "Convert", "given", "collection", "to", "an", "array", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/CollectionUtils.java#L143-L155
train
brianwhu/xillium
core/src/main/java/org/xillium/core/util/DatabaseService.java
DatabaseService.setMappings
public void setMappings(List<String> mappings) { if (mappings.size() > 0) { @SuppressWarnings("unchecked") Pair<String, String>[] renames = (Pair<String, String>[])Array.newInstance(Pair.class, mappings.size()); for (int i = 0; i < _renames.length; ++i) { String[] names = mappings.get(i).split("[ ,]+"); renames[i] = new Pair<String, String>(names[0], names[1]); } _renames = renames; } }
java
public void setMappings(List<String> mappings) { if (mappings.size() > 0) { @SuppressWarnings("unchecked") Pair<String, String>[] renames = (Pair<String, String>[])Array.newInstance(Pair.class, mappings.size()); for (int i = 0; i < _renames.length; ++i) { String[] names = mappings.get(i).split("[ ,]+"); renames[i] = new Pair<String, String>(names[0], names[1]); } _renames = renames; } }
[ "public", "void", "setMappings", "(", "List", "<", "String", ">", "mappings", ")", "{", "if", "(", "mappings", ".", "size", "(", ")", ">", "0", ")", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Pair", "<", "String", ",", "String", ">", "...
Defines parameter mappings. One parameter can be mapped to multiple new names, so a list is used instead of a map as the input to this method.
[ "Defines", "parameter", "mappings", ".", "One", "parameter", "can", "be", "mapped", "to", "multiple", "new", "names", "so", "a", "list", "is", "used", "instead", "of", "a", "map", "as", "the", "input", "to", "this", "method", "." ]
e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/core/src/main/java/org/xillium/core/util/DatabaseService.java#L55-L64
train
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/locale/ContinentHelper.java
ContinentHelper.getContinentsOfCountry
@Nullable @ReturnsMutableCopy public static ICommonsNavigableSet <EContinent> getContinentsOfCountry (@Nullable final Locale aLocale) { final Locale aCountry = CountryCache.getInstance ().getCountry (aLocale); if (aCountry != null) { final ICommonsNavigableSet <EContinent> ret = s_aMap.get (aCountry); if (ret != null) return ret.getClone (); } return null; }
java
@Nullable @ReturnsMutableCopy public static ICommonsNavigableSet <EContinent> getContinentsOfCountry (@Nullable final Locale aLocale) { final Locale aCountry = CountryCache.getInstance ().getCountry (aLocale); if (aCountry != null) { final ICommonsNavigableSet <EContinent> ret = s_aMap.get (aCountry); if (ret != null) return ret.getClone (); } return null; }
[ "@", "Nullable", "@", "ReturnsMutableCopy", "public", "static", "ICommonsNavigableSet", "<", "EContinent", ">", "getContinentsOfCountry", "(", "@", "Nullable", "final", "Locale", "aLocale", ")", "{", "final", "Locale", "aCountry", "=", "CountryCache", ".", "getInsta...
Get all continents for the specified country ID @param aLocale The locale to be used. May be <code>null</code>. @return <code>null</code> if no continent data is defined. Otherwise a non- <code>null</code> Set with all continents, without <code>null</code> elements.
[ "Get", "all", "continents", "for", "the", "specified", "country", "ID" ]
ca5e0b03c735b30b47930c018bfb5e71f00d0ff4
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/locale/ContinentHelper.java#L327-L339
train
qsardb/qsardb
model/src/main/java/org/qsardb/model/Cargo.java
Cargo.isLoadable
public boolean isLoadable() { if (getPayload() instanceof NullPayload) { return false; } try { InputStream is = getInputStream(); try { is.read(); return true; } finally { is.close(); } } catch (IOException ex) { return false; } }
java
public boolean isLoadable() { if (getPayload() instanceof NullPayload) { return false; } try { InputStream is = getInputStream(); try { is.read(); return true; } finally { is.close(); } } catch (IOException ex) { return false; } }
[ "public", "boolean", "isLoadable", "(", ")", "{", "if", "(", "getPayload", "(", ")", "instanceof", "NullPayload", ")", "{", "return", "false", ";", "}", "try", "{", "InputStream", "is", "=", "getInputStream", "(", ")", ";", "try", "{", "is", ".", "read...
Tests whether the Cargo's payload is loadable. @return returns true if cargo content is safe to load, false otherwise
[ "Tests", "whether", "the", "Cargo", "s", "payload", "is", "loadable", "." ]
9798f524abd973878b9040927aed8131885127fa
https://github.com/qsardb/qsardb/blob/9798f524abd973878b9040927aed8131885127fa/model/src/main/java/org/qsardb/model/Cargo.java#L180-L196
train
qsardb/qsardb
model/src/main/java/org/qsardb/model/Cargo.java
Cargo.loadString
public String loadString(String encoding) throws IOException { byte[] bytes = loadByteArray(); ByteOrderMask bom = ByteOrderMask.valueOf(bytes); if(bom != null){ int offset = (bom.getBytes()).length; return new String(bytes, offset, bytes.length - offset, bom.getEncoding()); } return new String(bytes, encoding); }
java
public String loadString(String encoding) throws IOException { byte[] bytes = loadByteArray(); ByteOrderMask bom = ByteOrderMask.valueOf(bytes); if(bom != null){ int offset = (bom.getBytes()).length; return new String(bytes, offset, bytes.length - offset, bom.getEncoding()); } return new String(bytes, encoding); }
[ "public", "String", "loadString", "(", "String", "encoding", ")", "throws", "IOException", "{", "byte", "[", "]", "bytes", "=", "loadByteArray", "(", ")", ";", "ByteOrderMask", "bom", "=", "ByteOrderMask", ".", "valueOf", "(", "bytes", ")", ";", "if", "(",...
Loads the string in the user specified character encoding. However, when the underlying byte array begins with a known Unicode byte order mark (BOM), then the BOM specified character encoding takes precedence over the user specified character encoding. @param encoding The user specified character encoding. @see ByteOrderMask
[ "Loads", "the", "string", "in", "the", "user", "specified", "character", "encoding", "." ]
9798f524abd973878b9040927aed8131885127fa
https://github.com/qsardb/qsardb/blob/9798f524abd973878b9040927aed8131885127fa/model/src/main/java/org/qsardb/model/Cargo.java#L272-L283
train
tomgibara/streams
src/main/java/com/tomgibara/streams/StreamTransfer.java
StreamTransfer.transfer
public Result transfer(long count) { if (count < 0L) throw new IllegalArgumentException("negative count"); return buffer == null ? transferNoBuffer(count) : transferBuffered(count); }
java
public Result transfer(long count) { if (count < 0L) throw new IllegalArgumentException("negative count"); return buffer == null ? transferNoBuffer(count) : transferBuffered(count); }
[ "public", "Result", "transfer", "(", "long", "count", ")", "{", "if", "(", "count", "<", "0L", ")", "throw", "new", "IllegalArgumentException", "(", "\"negative count\"", ")", ";", "return", "buffer", "==", "null", "?", "transferNoBuffer", "(", "count", ")",...
Transfers the specified number of bytes from the source to the target. Fewer bytes may be transferred if an end-of-stream condition occurs in either the source or the target. @param count the number of bytes to be transferred @return the result of the transfer
[ "Transfers", "the", "specified", "number", "of", "bytes", "from", "the", "source", "to", "the", "target", ".", "Fewer", "bytes", "may", "be", "transferred", "if", "an", "end", "-", "of", "-", "stream", "condition", "occurs", "in", "either", "the", "source"...
553dc97293a1f1fd2d88e08d26e19369e9ffa6d3
https://github.com/tomgibara/streams/blob/553dc97293a1f1fd2d88e08d26e19369e9ffa6d3/src/main/java/com/tomgibara/streams/StreamTransfer.java#L182-L185
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/source/util/TreePath.java
TreePath.getPath
public static TreePath getPath(TreePath path, Tree target) { path.getClass(); target.getClass(); class Result extends Error { static final long serialVersionUID = -5942088234594905625L; TreePath path; Result(TreePath path) { this.path = path; } } class PathFinder extends TreePathScanner<TreePath,Tree> { public TreePath scan(Tree tree, Tree target) { if (tree == target) { throw new Result(new TreePath(getCurrentPath(), target)); } return super.scan(tree, target); } } if (path.getLeaf() == target) { return path; } try { new PathFinder().scan(path, target); } catch (Result result) { return result.path; } return null; }
java
public static TreePath getPath(TreePath path, Tree target) { path.getClass(); target.getClass(); class Result extends Error { static final long serialVersionUID = -5942088234594905625L; TreePath path; Result(TreePath path) { this.path = path; } } class PathFinder extends TreePathScanner<TreePath,Tree> { public TreePath scan(Tree tree, Tree target) { if (tree == target) { throw new Result(new TreePath(getCurrentPath(), target)); } return super.scan(tree, target); } } if (path.getLeaf() == target) { return path; } try { new PathFinder().scan(path, target); } catch (Result result) { return result.path; } return null; }
[ "public", "static", "TreePath", "getPath", "(", "TreePath", "path", ",", "Tree", "target", ")", "{", "path", ".", "getClass", "(", ")", ";", "target", ".", "getClass", "(", ")", ";", "class", "Result", "extends", "Error", "{", "static", "final", "long", ...
Gets a tree path for a tree node within a subtree identified by a TreePath object. @return null if the node is not found
[ "Gets", "a", "tree", "path", "for", "a", "tree", "node", "within", "a", "subtree", "identified", "by", "a", "TreePath", "object", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/source/util/TreePath.java#L53-L84
train
brianwhu/xillium
data/src/main/java/org/xillium/data/validation/Reifier.java
Reifier.addTypeSet
public Reifier addTypeSet(Class<?> spec) { for (Field field: spec.getDeclaredFields()) { if (Modifier.isPublic(field.getModifiers())) { String name = field.getName(); try { _named.put(name, new Validator(name, field.getType(), field)); } catch (IllegalArgumentException x) { Trace.g.std.note(Reifier.class, "Ignored " + name + ": " + x.getMessage()); } } else { Trace.g.std.note(Reifier.class, "Ignored non-public field: " + field.getName()); } } return this; }
java
public Reifier addTypeSet(Class<?> spec) { for (Field field: spec.getDeclaredFields()) { if (Modifier.isPublic(field.getModifiers())) { String name = field.getName(); try { _named.put(name, new Validator(name, field.getType(), field)); } catch (IllegalArgumentException x) { Trace.g.std.note(Reifier.class, "Ignored " + name + ": " + x.getMessage()); } } else { Trace.g.std.note(Reifier.class, "Ignored non-public field: " + field.getName()); } } return this; }
[ "public", "Reifier", "addTypeSet", "(", "Class", "<", "?", ">", "spec", ")", "{", "for", "(", "Field", "field", ":", "spec", ".", "getDeclaredFields", "(", ")", ")", "{", "if", "(", "Modifier", ".", "isPublic", "(", "field", ".", "getModifiers", "(", ...
Adds a set of data type specifications. @param spec - a class that defines data types as member fields
[ "Adds", "a", "set", "of", "data", "type", "specifications", "." ]
e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/validation/Reifier.java#L35-L50
train
brianwhu/xillium
data/src/main/java/org/xillium/data/validation/Reifier.java
Reifier.collect
public <T extends DataObject> T collect(T data, Map<String, String> binder) throws SecurityException, DataValidationException { return collect(data, binder, null); }
java
public <T extends DataObject> T collect(T data, Map<String, String> binder) throws SecurityException, DataValidationException { return collect(data, binder, null); }
[ "public", "<", "T", "extends", "DataObject", ">", "T", "collect", "(", "T", "data", ",", "Map", "<", "String", ",", "String", ">", "binder", ")", "throws", "SecurityException", ",", "DataValidationException", "{", "return", "collect", "(", "data", ",", "bi...
Populates a data object by collecting and validating the named values from a Map&lt;String, String&gt;. @throws EmptyDataObjectException if a required member is missing and the data object is empty @throws MissingParameterException if a required member is missing but the data object has other members @throws DataValidationException if all other data validation fails @throws SecurityException if the data object is inproperly designed
[ "Populates", "a", "data", "object", "by", "collecting", "and", "validating", "the", "named", "values", "from", "a", "Map&lt", ";", "String", "String&gt", ";", "." ]
e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/validation/Reifier.java#L64-L66
train
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java
CurrencyHelper.localeSupportsCurrencyRetrieval
public static boolean localeSupportsCurrencyRetrieval (@Nullable final Locale aLocale) { return aLocale != null && aLocale.getCountry () != null && aLocale.getCountry ().length () == 2; }
java
public static boolean localeSupportsCurrencyRetrieval (@Nullable final Locale aLocale) { return aLocale != null && aLocale.getCountry () != null && aLocale.getCountry ().length () == 2; }
[ "public", "static", "boolean", "localeSupportsCurrencyRetrieval", "(", "@", "Nullable", "final", "Locale", "aLocale", ")", "{", "return", "aLocale", "!=", "null", "&&", "aLocale", ".", "getCountry", "(", ")", "!=", "null", "&&", "aLocale", ".", "getCountry", "...
Check if a currency could be available for the given locale. @param aLocale The locale to check. @return <code>true</code> if a currency is available for the given locale, <code>false</code> otherwise.
[ "Check", "if", "a", "currency", "could", "be", "available", "for", "the", "given", "locale", "." ]
ca5e0b03c735b30b47930c018bfb5e71f00d0ff4
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java#L159-L162
train
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java
CurrencyHelper.parseCurrency
@Nullable public static BigDecimal parseCurrency (@Nullable final String sStr, @Nonnull final DecimalFormat aFormat, @Nullable final BigDecimal aDefault, @Nonnull final RoundingMode eRoundingMode) { // Shortcut if (StringHelper.hasNoText (sStr)) return aDefault; // So that the call to "parse" returns a BigDecimal aFormat.setParseBigDecimal (true); aFormat.setRoundingMode (eRoundingMode); // Parse as double final BigDecimal aNum = LocaleParser.parseBigDecimal (sStr, aFormat); if (aNum == null) return aDefault; // And finally do the correct scaling, depending of the decimal format // fraction return aNum.setScale (aFormat.getMaximumFractionDigits (), eRoundingMode); }
java
@Nullable public static BigDecimal parseCurrency (@Nullable final String sStr, @Nonnull final DecimalFormat aFormat, @Nullable final BigDecimal aDefault, @Nonnull final RoundingMode eRoundingMode) { // Shortcut if (StringHelper.hasNoText (sStr)) return aDefault; // So that the call to "parse" returns a BigDecimal aFormat.setParseBigDecimal (true); aFormat.setRoundingMode (eRoundingMode); // Parse as double final BigDecimal aNum = LocaleParser.parseBigDecimal (sStr, aFormat); if (aNum == null) return aDefault; // And finally do the correct scaling, depending of the decimal format // fraction return aNum.setScale (aFormat.getMaximumFractionDigits (), eRoundingMode); }
[ "@", "Nullable", "public", "static", "BigDecimal", "parseCurrency", "(", "@", "Nullable", "final", "String", "sStr", ",", "@", "Nonnull", "final", "DecimalFormat", "aFormat", ",", "@", "Nullable", "final", "BigDecimal", "aDefault", ",", "@", "Nonnull", "final", ...
Parse a currency value from string using a custom rounding mode. @param sStr The string to be parsed. @param aFormat The formatting object to be used. May not be <code>null</code>. @param aDefault The default value to be returned, if parsing failed. @param eRoundingMode The rounding mode to be used. May not be <code>null</code>. @return Either default value or the {@link BigDecimal} value with the correct scaling.
[ "Parse", "a", "currency", "value", "from", "string", "using", "a", "custom", "rounding", "mode", "." ]
ca5e0b03c735b30b47930c018bfb5e71f00d0ff4
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java#L221-L243
train
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java
CurrencyHelper._getTextValueForDecimalSeparator
@Nullable private static String _getTextValueForDecimalSeparator (@Nullable final String sTextValue, @Nonnull final EDecimalSeparator eDecimalSep, @Nonnull final EGroupingSeparator eGroupingSep) { ValueEnforcer.notNull (eDecimalSep, "DecimalSeparator"); ValueEnforcer.notNull (eGroupingSep, "GroupingSeparator"); final String ret = StringHelper.trim (sTextValue); // Replace only, if the desired decimal separator is not present if (ret != null && ret.indexOf (eDecimalSep.getChar ()) < 0) switch (eDecimalSep) { case COMMA: { // Decimal separator is a "," if (ret.indexOf ('.') > -1 && eGroupingSep.getChar () != '.') { // Currency expects "," but user passed "." return StringHelper.replaceAll (ret, '.', eDecimalSep.getChar ()); } break; } case POINT: { // Decimal separator is a "." if (ret.indexOf (',') > -1 && eGroupingSep.getChar () != ',') { // Pattern contains no "," but value contains "," return StringHelper.replaceAll (ret, ',', eDecimalSep.getChar ()); } break; } default: throw new IllegalStateException ("Unexpected decimal separator [" + eDecimalSep + "]"); } return ret; }
java
@Nullable private static String _getTextValueForDecimalSeparator (@Nullable final String sTextValue, @Nonnull final EDecimalSeparator eDecimalSep, @Nonnull final EGroupingSeparator eGroupingSep) { ValueEnforcer.notNull (eDecimalSep, "DecimalSeparator"); ValueEnforcer.notNull (eGroupingSep, "GroupingSeparator"); final String ret = StringHelper.trim (sTextValue); // Replace only, if the desired decimal separator is not present if (ret != null && ret.indexOf (eDecimalSep.getChar ()) < 0) switch (eDecimalSep) { case COMMA: { // Decimal separator is a "," if (ret.indexOf ('.') > -1 && eGroupingSep.getChar () != '.') { // Currency expects "," but user passed "." return StringHelper.replaceAll (ret, '.', eDecimalSep.getChar ()); } break; } case POINT: { // Decimal separator is a "." if (ret.indexOf (',') > -1 && eGroupingSep.getChar () != ',') { // Pattern contains no "," but value contains "," return StringHelper.replaceAll (ret, ',', eDecimalSep.getChar ()); } break; } default: throw new IllegalStateException ("Unexpected decimal separator [" + eDecimalSep + "]"); } return ret; }
[ "@", "Nullable", "private", "static", "String", "_getTextValueForDecimalSeparator", "(", "@", "Nullable", "final", "String", "sTextValue", ",", "@", "Nonnull", "final", "EDecimalSeparator", "eDecimalSep", ",", "@", "Nonnull", "final", "EGroupingSeparator", "eGroupingSep...
Adopt the passed text value according to the requested decimal separator. @param sTextValue The text to be manipulated. May be <code>null</code>. @param eDecimalSep The decimal separator that is required. May not be <code>null</code> . @param eGroupingSep The grouping separator that is required. May not be <code>null</code> . @return The manipulated text so that it matches the required decimal separator or the original text
[ "Adopt", "the", "passed", "text", "value", "according", "to", "the", "requested", "decimal", "separator", "." ]
ca5e0b03c735b30b47930c018bfb5e71f00d0ff4
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java#L409-L447
train
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java
CurrencyHelper.setRoundingMode
public static void setRoundingMode (@Nullable final ECurrency eCurrency, @Nullable final RoundingMode eRoundingMode) { getSettings (eCurrency).setRoundingMode (eRoundingMode); }
java
public static void setRoundingMode (@Nullable final ECurrency eCurrency, @Nullable final RoundingMode eRoundingMode) { getSettings (eCurrency).setRoundingMode (eRoundingMode); }
[ "public", "static", "void", "setRoundingMode", "(", "@", "Nullable", "final", "ECurrency", "eCurrency", ",", "@", "Nullable", "final", "RoundingMode", "eRoundingMode", ")", "{", "getSettings", "(", "eCurrency", ")", ".", "setRoundingMode", "(", "eRoundingMode", ")...
Change the rounding mode of this currency. @param eCurrency The currency it is about. If <code>null</code> is provided {@link #DEFAULT_CURRENCY} is used instead. @param eRoundingMode The rounding mode to be used. May be <code>null</code>.
[ "Change", "the", "rounding", "mode", "of", "this", "currency", "." ]
ca5e0b03c735b30b47930c018bfb5e71f00d0ff4
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java#L718-L721
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Types.java
Types.functionalInterfaceBridges
public List<Symbol> functionalInterfaceBridges(TypeSymbol origin) { Assert.check(isFunctionalInterface(origin)); Symbol descSym = findDescriptorSymbol(origin); CompoundScope members = membersClosure(origin.type, false); ListBuffer<Symbol> overridden = new ListBuffer<>(); outer: for (Symbol m2 : members.getElementsByName(descSym.name, bridgeFilter)) { if (m2 == descSym) continue; else if (descSym.overrides(m2, origin, Types.this, false)) { for (Symbol m3 : overridden) { if (isSameType(m3.erasure(Types.this), m2.erasure(Types.this)) || (m3.overrides(m2, origin, Types.this, false) && (pendingBridges((ClassSymbol)origin, m3.enclClass()) || (((MethodSymbol)m2).binaryImplementation((ClassSymbol)m3.owner, Types.this) != null)))) { continue outer; } } overridden.add(m2); } } return overridden.toList(); }
java
public List<Symbol> functionalInterfaceBridges(TypeSymbol origin) { Assert.check(isFunctionalInterface(origin)); Symbol descSym = findDescriptorSymbol(origin); CompoundScope members = membersClosure(origin.type, false); ListBuffer<Symbol> overridden = new ListBuffer<>(); outer: for (Symbol m2 : members.getElementsByName(descSym.name, bridgeFilter)) { if (m2 == descSym) continue; else if (descSym.overrides(m2, origin, Types.this, false)) { for (Symbol m3 : overridden) { if (isSameType(m3.erasure(Types.this), m2.erasure(Types.this)) || (m3.overrides(m2, origin, Types.this, false) && (pendingBridges((ClassSymbol)origin, m3.enclClass()) || (((MethodSymbol)m2).binaryImplementation((ClassSymbol)m3.owner, Types.this) != null)))) { continue outer; } } overridden.add(m2); } } return overridden.toList(); }
[ "public", "List", "<", "Symbol", ">", "functionalInterfaceBridges", "(", "TypeSymbol", "origin", ")", "{", "Assert", ".", "check", "(", "isFunctionalInterface", "(", "origin", ")", ")", ";", "Symbol", "descSym", "=", "findDescriptorSymbol", "(", "origin", ")", ...
Find the minimal set of methods that are overridden by the functional descriptor in 'origin'. All returned methods are assumed to have different erased signatures.
[ "Find", "the", "minimal", "set", "of", "methods", "that", "are", "overridden", "by", "the", "functional", "descriptor", "in", "origin", ".", "All", "returned", "methods", "are", "assumed", "to", "have", "different", "erased", "signatures", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Types.java#L658-L678
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Types.java
Types.isEqualityComparable
public boolean isEqualityComparable(Type s, Type t, Warner warn) { if (t.isNumeric() && s.isNumeric()) return true; boolean tPrimitive = t.isPrimitive(); boolean sPrimitive = s.isPrimitive(); if (!tPrimitive && !sPrimitive) { return isCastable(s, t, warn) || isCastable(t, s, warn); } else { return false; } }
java
public boolean isEqualityComparable(Type s, Type t, Warner warn) { if (t.isNumeric() && s.isNumeric()) return true; boolean tPrimitive = t.isPrimitive(); boolean sPrimitive = s.isPrimitive(); if (!tPrimitive && !sPrimitive) { return isCastable(s, t, warn) || isCastable(t, s, warn); } else { return false; } }
[ "public", "boolean", "isEqualityComparable", "(", "Type", "s", ",", "Type", "t", ",", "Warner", "warn", ")", "{", "if", "(", "t", ".", "isNumeric", "(", ")", "&&", "s", ".", "isNumeric", "(", ")", ")", "return", "true", ";", "boolean", "tPrimitive", ...
Can t and s be compared for equality? Any primitive == primitive or primitive == object comparisons here are an error. Unboxing and correct primitive == primitive comparisons are already dealt with in Attr.visitBinary.
[ "Can", "t", "and", "s", "be", "compared", "for", "equality?", "Any", "primitive", "==", "primitive", "or", "primitive", "==", "object", "comparisons", "here", "are", "an", "error", ".", "Unboxing", "and", "correct", "primitive", "==", "primitive", "comparisons...
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Types.java#L1456-L1467
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Types.java
Types.elemtype
public Type elemtype(Type t) { switch (t.getTag()) { case WILDCARD: return elemtype(wildUpperBound(t)); case ARRAY: t = t.unannotatedType(); return ((ArrayType)t).elemtype; case FORALL: return elemtype(((ForAll)t).qtype); case ERROR: return t; default: return null; } }
java
public Type elemtype(Type t) { switch (t.getTag()) { case WILDCARD: return elemtype(wildUpperBound(t)); case ARRAY: t = t.unannotatedType(); return ((ArrayType)t).elemtype; case FORALL: return elemtype(((ForAll)t).qtype); case ERROR: return t; default: return null; } }
[ "public", "Type", "elemtype", "(", "Type", "t", ")", "{", "switch", "(", "t", ".", "getTag", "(", ")", ")", "{", "case", "WILDCARD", ":", "return", "elemtype", "(", "wildUpperBound", "(", "t", ")", ")", ";", "case", "ARRAY", ":", "t", "=", "t", "...
The element type of an array.
[ "The", "element", "type", "of", "an", "array", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Types.java#L1871-L1885
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Types.java
Types.rank
public int rank(Type t) { t = t.unannotatedType(); switch(t.getTag()) { case CLASS: { ClassType cls = (ClassType)t; if (cls.rank_field < 0) { Name fullname = cls.tsym.getQualifiedName(); if (fullname == names.java_lang_Object) cls.rank_field = 0; else { int r = rank(supertype(cls)); for (List<Type> l = interfaces(cls); l.nonEmpty(); l = l.tail) { if (rank(l.head) > r) r = rank(l.head); } cls.rank_field = r + 1; } } return cls.rank_field; } case TYPEVAR: { TypeVar tvar = (TypeVar)t; if (tvar.rank_field < 0) { int r = rank(supertype(tvar)); for (List<Type> l = interfaces(tvar); l.nonEmpty(); l = l.tail) { if (rank(l.head) > r) r = rank(l.head); } tvar.rank_field = r + 1; } return tvar.rank_field; } case ERROR: case NONE: return 0; default: throw new AssertionError(); } }
java
public int rank(Type t) { t = t.unannotatedType(); switch(t.getTag()) { case CLASS: { ClassType cls = (ClassType)t; if (cls.rank_field < 0) { Name fullname = cls.tsym.getQualifiedName(); if (fullname == names.java_lang_Object) cls.rank_field = 0; else { int r = rank(supertype(cls)); for (List<Type> l = interfaces(cls); l.nonEmpty(); l = l.tail) { if (rank(l.head) > r) r = rank(l.head); } cls.rank_field = r + 1; } } return cls.rank_field; } case TYPEVAR: { TypeVar tvar = (TypeVar)t; if (tvar.rank_field < 0) { int r = rank(supertype(tvar)); for (List<Type> l = interfaces(tvar); l.nonEmpty(); l = l.tail) { if (rank(l.head) > r) r = rank(l.head); } tvar.rank_field = r + 1; } return tvar.rank_field; } case ERROR: case NONE: return 0; default: throw new AssertionError(); } }
[ "public", "int", "rank", "(", "Type", "t", ")", "{", "t", "=", "t", ".", "unannotatedType", "(", ")", ";", "switch", "(", "t", ".", "getTag", "(", ")", ")", "{", "case", "CLASS", ":", "{", "ClassType", "cls", "=", "(", "ClassType", ")", "t", ";...
The rank of a class is the length of the longest path between the class and java.lang.Object in the class inheritance graph. Undefined for all but reference types.
[ "The", "rank", "of", "a", "class", "is", "the", "length", "of", "the", "longest", "path", "between", "the", "class", "and", "java", ".", "lang", ".", "Object", "in", "the", "class", "inheritance", "graph", ".", "Undefined", "for", "all", "but", "referenc...
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Types.java#L3290-L3331
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Types.java
Types.covariantReturnType
public boolean covariantReturnType(Type t, Type s, Warner warner) { return isSameType(t, s) || allowCovariantReturns && !t.isPrimitive() && !s.isPrimitive() && isAssignable(t, s, warner); }
java
public boolean covariantReturnType(Type t, Type s, Warner warner) { return isSameType(t, s) || allowCovariantReturns && !t.isPrimitive() && !s.isPrimitive() && isAssignable(t, s, warner); }
[ "public", "boolean", "covariantReturnType", "(", "Type", "t", ",", "Type", "s", ",", "Warner", "warner", ")", "{", "return", "isSameType", "(", "t", ",", "s", ")", "||", "allowCovariantReturns", "&&", "!", "t", ".", "isPrimitive", "(", ")", "&&", "!", ...
Is t an appropriate return type in an overrider for a method that returns s?
[ "Is", "t", "an", "appropriate", "return", "type", "in", "an", "overrider", "for", "a", "method", "that", "returns", "s?" ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Types.java#L3952-L3959
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Types.java
Types.boxedClass
public ClassSymbol boxedClass(Type t) { return reader.enterClass(syms.boxedName[t.getTag().ordinal()]); }
java
public ClassSymbol boxedClass(Type t) { return reader.enterClass(syms.boxedName[t.getTag().ordinal()]); }
[ "public", "ClassSymbol", "boxedClass", "(", "Type", "t", ")", "{", "return", "reader", ".", "enterClass", "(", "syms", ".", "boxedName", "[", "t", ".", "getTag", "(", ")", ".", "ordinal", "(", ")", "]", ")", ";", "}" ]
Return the class that boxes the given primitive.
[ "Return", "the", "class", "that", "boxes", "the", "given", "primitive", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Types.java#L3966-L3968
train
Indoqa/logspace
logspace-hq-rest/src/main/java/io/logspace/hq/rest/AbstractSpaceResource.java
AbstractSpaceResource.getSpace
protected String getSpace(Request req) { String spaceToken = req.headers(SPACE_TOKEN_HEADER); if (StringUtils.isBlank(spaceToken)) { throw new MissingSpaceTokenException("Missing header '" + SPACE_TOKEN_HEADER + "'."); } String space = this.spacesService.getSpaceForAuthenticationToken(spaceToken); if (space == null) { throw new InvalidSpaceTokenException(spaceToken); } return space; }
java
protected String getSpace(Request req) { String spaceToken = req.headers(SPACE_TOKEN_HEADER); if (StringUtils.isBlank(spaceToken)) { throw new MissingSpaceTokenException("Missing header '" + SPACE_TOKEN_HEADER + "'."); } String space = this.spacesService.getSpaceForAuthenticationToken(spaceToken); if (space == null) { throw new InvalidSpaceTokenException(spaceToken); } return space; }
[ "protected", "String", "getSpace", "(", "Request", "req", ")", "{", "String", "spaceToken", "=", "req", ".", "headers", "(", "SPACE_TOKEN_HEADER", ")", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "spaceToken", ")", ")", "{", "throw", "new", "Missin...
Extract spaceToken from request headers. @param req - Request to extract spaceToken from. @return Extracted spaceToken. @throws MissingSpaceTokenException If the spaceToken Header is missing in the request. @throws InvalidSpaceTokenException If no space is configured for the supplied spaceToken.
[ "Extract", "spaceToken", "from", "request", "headers", "." ]
781a3f1da0580542d7dd726cac8eafecb090663d
https://github.com/Indoqa/logspace/blob/781a3f1da0580542d7dd726cac8eafecb090663d/logspace-hq-rest/src/main/java/io/logspace/hq/rest/AbstractSpaceResource.java#L52-L64
train
brianwhu/xillium
gear/src/main/java/org/xillium/gear/util/LeastRecentlyUsedMap.java
LeastRecentlyUsedMap.getCacheState
public WithCache.CacheState getCacheState() { return new WithCache.CacheState(size(), _max, _get, _hit, _rep); }
java
public WithCache.CacheState getCacheState() { return new WithCache.CacheState(size(), _max, _get, _hit, _rep); }
[ "public", "WithCache", ".", "CacheState", "getCacheState", "(", ")", "{", "return", "new", "WithCache", ".", "CacheState", "(", "size", "(", ")", ",", "_max", ",", "_get", ",", "_hit", ",", "_rep", ")", ";", "}" ]
Reports the cumulative statistics of this cache.
[ "Reports", "the", "cumulative", "statistics", "of", "this", "cache", "." ]
e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/gear/src/main/java/org/xillium/gear/util/LeastRecentlyUsedMap.java#L34-L36
train
devnull-tools/trugger
src/main/java/tools/devnull/trugger/reflection/impl/TruggerGenericTypeResolver.java
TruggerGenericTypeResolver.resolveParameterName
static Class<?> resolveParameterName(String parameterName, Class<?> target) { Map<Type, Type> typeVariableMap = getTypeVariableMap(target); Set<Entry<Type, Type>> set = typeVariableMap.entrySet(); Type type = Object.class; for (Entry<Type, Type> entry : set) { if (entry.getKey().toString().equals(parameterName)) { type = entry.getKey(); break; } } return resolveType(type, typeVariableMap); }
java
static Class<?> resolveParameterName(String parameterName, Class<?> target) { Map<Type, Type> typeVariableMap = getTypeVariableMap(target); Set<Entry<Type, Type>> set = typeVariableMap.entrySet(); Type type = Object.class; for (Entry<Type, Type> entry : set) { if (entry.getKey().toString().equals(parameterName)) { type = entry.getKey(); break; } } return resolveType(type, typeVariableMap); }
[ "static", "Class", "<", "?", ">", "resolveParameterName", "(", "String", "parameterName", ",", "Class", "<", "?", ">", "target", ")", "{", "Map", "<", "Type", ",", "Type", ">", "typeVariableMap", "=", "getTypeVariableMap", "(", "target", ")", ";", "Set", ...
Resolves the generic parameter name of a class. @param parameterName the parameter name @param target the target class @return the parameter class.
[ "Resolves", "the", "generic", "parameter", "name", "of", "a", "class", "." ]
614d5f0b30daf82fc251a46fb436d0fc5e787627
https://github.com/devnull-tools/trugger/blob/614d5f0b30daf82fc251a46fb436d0fc5e787627/src/main/java/tools/devnull/trugger/reflection/impl/TruggerGenericTypeResolver.java#L72-L84
train
magik6k/JWWF
src/main/java/net/magik6k/jwwf/widgets/basic/panel/generic/AbstractPanel.java
AbstractPanel.putFactories
public List<Widget> putFactories(Iterable<? extends IWidgetFactory> factories) throws IndexOutOfBoundsException { List<Widget> instances = new LinkedList<Widget>(); for (IWidgetFactory factory : factories) { instances.add(put(factory)); } return instances; }
java
public List<Widget> putFactories(Iterable<? extends IWidgetFactory> factories) throws IndexOutOfBoundsException { List<Widget> instances = new LinkedList<Widget>(); for (IWidgetFactory factory : factories) { instances.add(put(factory)); } return instances; }
[ "public", "List", "<", "Widget", ">", "putFactories", "(", "Iterable", "<", "?", "extends", "IWidgetFactory", ">", "factories", ")", "throws", "IndexOutOfBoundsException", "{", "List", "<", "Widget", ">", "instances", "=", "new", "LinkedList", "<", "Widget", "...
Creates widgets instance from given iterable and adds it to this panel @param factories Iterable object containing widget factories @return List of created widgets @throws IndexOutOfBoundsException when there is no more space
[ "Creates", "widgets", "instance", "from", "given", "iterable", "and", "adds", "it", "to", "this", "panel" ]
8ba334501396c3301495da8708733f6014f20665
https://github.com/magik6k/JWWF/blob/8ba334501396c3301495da8708733f6014f20665/src/main/java/net/magik6k/jwwf/widgets/basic/panel/generic/AbstractPanel.java#L54-L60
train
pierre/serialization
writer/src/main/java/com/ning/metrics/serialization/writer/DiskSpoolEventWriter.java
DiskSpoolEventWriter.getSpooledFileList
protected List<File> getSpooledFileList() { final List<File> spooledFileList = new ArrayList<File>(); for (final File file : spoolDirectory.listFiles()) { if (file.isFile()) { spooledFileList.add(file); } } return spooledFileList; }
java
protected List<File> getSpooledFileList() { final List<File> spooledFileList = new ArrayList<File>(); for (final File file : spoolDirectory.listFiles()) { if (file.isFile()) { spooledFileList.add(file); } } return spooledFileList; }
[ "protected", "List", "<", "File", ">", "getSpooledFileList", "(", ")", "{", "final", "List", "<", "File", ">", "spooledFileList", "=", "new", "ArrayList", "<", "File", ">", "(", ")", ";", "for", "(", "final", "File", "file", ":", "spoolDirectory", ".", ...
protected for overriding during unit tests
[ "protected", "for", "overriding", "during", "unit", "tests" ]
b15b7c749ba78bfe94dce8fc22f31b30b2e6830b
https://github.com/pierre/serialization/blob/b15b7c749ba78bfe94dce8fc22f31b30b2e6830b/writer/src/main/java/com/ning/metrics/serialization/writer/DiskSpoolEventWriter.java#L193-L204
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java
ApplicationCache.add
public void add(Collection<Application> applications) { for(Application application : applications) this.applications.put(application.getId(), application); }
java
public void add(Collection<Application> applications) { for(Application application : applications) this.applications.put(application.getId(), application); }
[ "public", "void", "add", "(", "Collection", "<", "Application", ">", "applications", ")", "{", "for", "(", "Application", "application", ":", "applications", ")", "this", ".", "applications", ".", "put", "(", "application", ".", "getId", "(", ")", ",", "ap...
Adds the application list to the applications for the account. @param applications The applications to add
[ "Adds", "the", "application", "list", "to", "the", "applications", "for", "the", "account", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java#L65-L69
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java
ApplicationCache.applicationHosts
public ApplicationHostCache applicationHosts(long applicationId) { ApplicationHostCache cache = applicationHosts.get(applicationId); if(cache == null) applicationHosts.put(applicationId, cache = new ApplicationHostCache(applicationId)); return cache; }
java
public ApplicationHostCache applicationHosts(long applicationId) { ApplicationHostCache cache = applicationHosts.get(applicationId); if(cache == null) applicationHosts.put(applicationId, cache = new ApplicationHostCache(applicationId)); return cache; }
[ "public", "ApplicationHostCache", "applicationHosts", "(", "long", "applicationId", ")", "{", "ApplicationHostCache", "cache", "=", "applicationHosts", ".", "get", "(", "applicationId", ")", ";", "if", "(", "cache", "==", "null", ")", "applicationHosts", ".", "put...
Returns the cache of application hosts for the given application, creating one if it doesn't exist . @param applicationId The id of the application for the cache of application hosts @return The cache of application hosts for the given application
[ "Returns", "the", "cache", "of", "application", "hosts", "for", "the", "given", "application", "creating", "one", "if", "it", "doesn", "t", "exist", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java#L111-L117
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java
ApplicationCache.keyTransactions
public KeyTransactionCache keyTransactions(long applicationId) { KeyTransactionCache cache = keyTransactions.get(applicationId); if(cache == null) keyTransactions.put(applicationId, cache = new KeyTransactionCache(applicationId)); return cache; }
java
public KeyTransactionCache keyTransactions(long applicationId) { KeyTransactionCache cache = keyTransactions.get(applicationId); if(cache == null) keyTransactions.put(applicationId, cache = new KeyTransactionCache(applicationId)); return cache; }
[ "public", "KeyTransactionCache", "keyTransactions", "(", "long", "applicationId", ")", "{", "KeyTransactionCache", "cache", "=", "keyTransactions", ".", "get", "(", "applicationId", ")", ";", "if", "(", "cache", "==", "null", ")", "keyTransactions", ".", "put", ...
Returns the cache of key transactions for the given application, creating one if it doesn't exist . @param applicationId The id of the application for the cache of key transactions @return The cache of key transactions for the given application
[ "Returns", "the", "cache", "of", "key", "transactions", "for", "the", "given", "application", "creating", "one", "if", "it", "doesn", "t", "exist", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java#L124-L130
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java
ApplicationCache.addKeyTransactions
public void addKeyTransactions(Collection<KeyTransaction> keyTransactions) { for(KeyTransaction keyTransaction : keyTransactions) { // Add the transaction to any applications it is associated with long applicationId = keyTransaction.getLinks().getApplication(); Application application = applications.get(applicationId); if(application != null) keyTransactions(applicationId).add(keyTransaction); else logger.severe(String.format("Unable to find application for key transaction '%s': %d", keyTransaction.getName(), applicationId)); } }
java
public void addKeyTransactions(Collection<KeyTransaction> keyTransactions) { for(KeyTransaction keyTransaction : keyTransactions) { // Add the transaction to any applications it is associated with long applicationId = keyTransaction.getLinks().getApplication(); Application application = applications.get(applicationId); if(application != null) keyTransactions(applicationId).add(keyTransaction); else logger.severe(String.format("Unable to find application for key transaction '%s': %d", keyTransaction.getName(), applicationId)); } }
[ "public", "void", "addKeyTransactions", "(", "Collection", "<", "KeyTransaction", ">", "keyTransactions", ")", "{", "for", "(", "KeyTransaction", "keyTransaction", ":", "keyTransactions", ")", "{", "// Add the transaction to any applications it is associated with", "long", ...
Adds the key transactions to the applications for the account. @param keyTransactions The key transactions to add
[ "Adds", "the", "key", "transactions", "to", "the", "applications", "for", "the", "account", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java#L136-L148
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java
ApplicationCache.deployments
public DeploymentCache deployments(long applicationId) { DeploymentCache cache = deployments.get(applicationId); if(cache == null) deployments.put(applicationId, cache = new DeploymentCache(applicationId)); return cache; }
java
public DeploymentCache deployments(long applicationId) { DeploymentCache cache = deployments.get(applicationId); if(cache == null) deployments.put(applicationId, cache = new DeploymentCache(applicationId)); return cache; }
[ "public", "DeploymentCache", "deployments", "(", "long", "applicationId", ")", "{", "DeploymentCache", "cache", "=", "deployments", ".", "get", "(", "applicationId", ")", ";", "if", "(", "cache", "==", "null", ")", "deployments", ".", "put", "(", "applicationI...
Returns the cache of deployments for the given application, creating one if it doesn't exist . @param applicationId The id of the application for the cache of deployments @return The cache of deployments for the given application
[ "Returns", "the", "cache", "of", "deployments", "for", "the", "given", "application", "creating", "one", "if", "it", "doesn", "t", "exist", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java#L155-L161
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java
ApplicationCache.labels
public LabelCache labels(long applicationId) { LabelCache cache = labels.get(applicationId); if(cache == null) labels.put(applicationId, cache = new LabelCache(applicationId)); return cache; }
java
public LabelCache labels(long applicationId) { LabelCache cache = labels.get(applicationId); if(cache == null) labels.put(applicationId, cache = new LabelCache(applicationId)); return cache; }
[ "public", "LabelCache", "labels", "(", "long", "applicationId", ")", "{", "LabelCache", "cache", "=", "labels", ".", "get", "(", "applicationId", ")", ";", "if", "(", "cache", "==", "null", ")", "labels", ".", "put", "(", "applicationId", ",", "cache", "...
Returns the cache of labels for the given application, creating one if it doesn't exist . @param applicationId The id of the application for the cache of labels @return The cache of labels for the given application
[ "Returns", "the", "cache", "of", "labels", "for", "the", "given", "application", "creating", "one", "if", "it", "doesn", "t", "exist", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java#L168-L174
train
opsmatters/opsmatters-core
src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java
ApplicationCache.addLabel
public void addLabel(Label label) { // Add the label to any applications it is associated with List<Long> applicationIds = label.getLinks().getApplications(); for(long applicationId : applicationIds) { Application application = applications.get(applicationId); if(application != null) labels(applicationId).add(label); else logger.severe(String.format("Unable to find application for label '%s': %d", label.getKey(), applicationId)); } }
java
public void addLabel(Label label) { // Add the label to any applications it is associated with List<Long> applicationIds = label.getLinks().getApplications(); for(long applicationId : applicationIds) { Application application = applications.get(applicationId); if(application != null) labels(applicationId).add(label); else logger.severe(String.format("Unable to find application for label '%s': %d", label.getKey(), applicationId)); } }
[ "public", "void", "addLabel", "(", "Label", "label", ")", "{", "// Add the label to any applications it is associated with", "List", "<", "Long", ">", "applicationIds", "=", "label", ".", "getLinks", "(", ")", ".", "getApplications", "(", ")", ";", "for", "(", "...
Adds the label to the applications for the account. @param label The label to add
[ "Adds", "the", "label", "to", "the", "applications", "for", "the", "account", "." ]
c48904f7e8d029fd45357811ec38a735e261e3fd
https://github.com/opsmatters/opsmatters-core/blob/c48904f7e8d029fd45357811ec38a735e261e3fd/src/main/java/com/opsmatters/core/provider/newrelic/ApplicationCache.java#L180-L192
train
devnull-tools/trugger
src/main/java/tools/devnull/trugger/util/impl/PredicateMappingFunctionImpl.java
PredicateMappingFunctionImpl.doThrow
private static <T, R> Function<T, R> doThrow(Supplier<? extends RuntimeException> exceptionSupplier) { return t -> { throw exceptionSupplier.get(); }; }
java
private static <T, R> Function<T, R> doThrow(Supplier<? extends RuntimeException> exceptionSupplier) { return t -> { throw exceptionSupplier.get(); }; }
[ "private", "static", "<", "T", ",", "R", ">", "Function", "<", "T", ",", "R", ">", "doThrow", "(", "Supplier", "<", "?", "extends", "RuntimeException", ">", "exceptionSupplier", ")", "{", "return", "t", "->", "{", "throw", "exceptionSupplier", ".", "get"...
Returns a function that throws the exception supplied by the given supplier. @param exceptionSupplier the supplier to supply the exceptions to throw @return a function that throws exceptions regardless the input
[ "Returns", "a", "function", "that", "throws", "the", "exception", "supplied", "by", "the", "given", "supplier", "." ]
614d5f0b30daf82fc251a46fb436d0fc5e787627
https://github.com/devnull-tools/trugger/blob/614d5f0b30daf82fc251a46fb436d0fc5e787627/src/main/java/tools/devnull/trugger/util/impl/PredicateMappingFunctionImpl.java#L89-L93
train
seedstack/shed
src/main/java/org/seedstack/shed/exception/BaseException.java
BaseException.put
@SuppressWarnings("unchecked") public <E extends BaseException> E put(String name, Object value) { properties.put(name, value); return (E) this; }
java
@SuppressWarnings("unchecked") public <E extends BaseException> E put(String name, Object value) { properties.put(name, value); return (E) this; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "E", "extends", "BaseException", ">", "E", "put", "(", "String", "name", ",", "Object", "value", ")", "{", "properties", ".", "put", "(", "name", ",", "value", ")", ";", "return", "(", ...
Put a property in this exception. @param name the name of the property. @param value the value of the property. @param <E> the type fo the property. @return this exception (to chain calls).
[ "Put", "a", "property", "in", "this", "exception", "." ]
49ecb25aa3777539ab0f29f89abaae5ee93b572e
https://github.com/seedstack/shed/blob/49ecb25aa3777539ab0f29f89abaae5ee93b572e/src/main/java/org/seedstack/shed/exception/BaseException.java#L174-L178
train
Wadpam/guja
guja-contact/src/main/java/com/wadpam/guja/api/ContactResource.java
ContactResource.findByUniqueTag
@GET @PermitAll @Path("uniquetag/{uniqueTag}") public Response findByUniqueTag(@PathParam("uniqueTag") String uniqueTag) { checkNotNull(uniqueTag); DContact contact = dao.findByUniqueTag(null, uniqueTag); return null != contact ? Response.ok(contact).build() : Response.status(Response.Status.NOT_FOUND).build(); }
java
@GET @PermitAll @Path("uniquetag/{uniqueTag}") public Response findByUniqueTag(@PathParam("uniqueTag") String uniqueTag) { checkNotNull(uniqueTag); DContact contact = dao.findByUniqueTag(null, uniqueTag); return null != contact ? Response.ok(contact).build() : Response.status(Response.Status.NOT_FOUND).build(); }
[ "@", "GET", "@", "PermitAll", "@", "Path", "(", "\"uniquetag/{uniqueTag}\"", ")", "public", "Response", "findByUniqueTag", "(", "@", "PathParam", "(", "\"uniqueTag\"", ")", "String", "uniqueTag", ")", "{", "checkNotNull", "(", "uniqueTag", ")", ";", "DContact", ...
Find a contact based on its unique tag. @param uniqueTag unique contacts tag @return a contact entity
[ "Find", "a", "contact", "based", "on", "its", "unique", "tag", "." ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-contact/src/main/java/com/wadpam/guja/api/ContactResource.java#L70-L79
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java
ProfileIndexFrameWriter.generate
public static void generate(ConfigurationImpl configuration) { ProfileIndexFrameWriter profilegen; DocPath filename = DocPaths.PROFILE_OVERVIEW_FRAME; try { profilegen = new ProfileIndexFrameWriter(configuration, filename); profilegen.buildProfileIndexFile("doclet.Window_Overview", false); profilegen.close(); } catch (IOException exc) { configuration.standardmessage.error( "doclet.exception_encountered", exc.toString(), filename); throw new DocletAbortException(exc); } }
java
public static void generate(ConfigurationImpl configuration) { ProfileIndexFrameWriter profilegen; DocPath filename = DocPaths.PROFILE_OVERVIEW_FRAME; try { profilegen = new ProfileIndexFrameWriter(configuration, filename); profilegen.buildProfileIndexFile("doclet.Window_Overview", false); profilegen.close(); } catch (IOException exc) { configuration.standardmessage.error( "doclet.exception_encountered", exc.toString(), filename); throw new DocletAbortException(exc); } }
[ "public", "static", "void", "generate", "(", "ConfigurationImpl", "configuration", ")", "{", "ProfileIndexFrameWriter", "profilegen", ";", "DocPath", "filename", "=", "DocPaths", ".", "PROFILE_OVERVIEW_FRAME", ";", "try", "{", "profilegen", "=", "new", "ProfileIndexFr...
Generate the profile index file named "profile-overview-frame.html". @throws DocletAbortException @param configuration the configuration object
[ "Generate", "the", "profile", "index", "file", "named", "profile", "-", "overview", "-", "frame", ".", "html", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java#L66-L79
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java
ProfileIndexFrameWriter.getProfile
protected Content getProfile(String profileName) { Content profileLinkContent; Content profileLabel; profileLabel = new StringContent(profileName); profileLinkContent = getHyperLink(DocPaths.profileFrame(profileName), profileLabel, "", "packageListFrame"); Content li = HtmlTree.LI(profileLinkContent); return li; }
java
protected Content getProfile(String profileName) { Content profileLinkContent; Content profileLabel; profileLabel = new StringContent(profileName); profileLinkContent = getHyperLink(DocPaths.profileFrame(profileName), profileLabel, "", "packageListFrame"); Content li = HtmlTree.LI(profileLinkContent); return li; }
[ "protected", "Content", "getProfile", "(", "String", "profileName", ")", "{", "Content", "profileLinkContent", ";", "Content", "profileLabel", ";", "profileLabel", "=", "new", "StringContent", "(", "profileName", ")", ";", "profileLinkContent", "=", "getHyperLink", ...
Gets each profile name as a separate link. @param profileName the profile being documented @return content for the profile link
[ "Gets", "each", "profile", "name", "as", "a", "separate", "link", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/formats/html/ProfileIndexFrameWriter.java#L109-L117
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/processing/JavacFiler.java
JavacFiler.newRound
public void newRound(Context context) { this.context = context; this.log = Log.instance(context); clearRoundState(); }
java
public void newRound(Context context) { this.context = context; this.log = Log.instance(context); clearRoundState(); }
[ "public", "void", "newRound", "(", "Context", "context", ")", "{", "this", ".", "context", "=", "context", ";", "this", ".", "log", "=", "Log", ".", "instance", "(", "context", ")", ";", "clearRoundState", "(", ")", ";", "}" ]
Update internal state for a new round.
[ "Update", "internal", "state", "for", "a", "new", "round", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/processing/JavacFiler.java#L567-L571
train
theHilikus/JRoboCom
jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/GameSettings.java
GameSettings.getInstance
public static GameSettings getInstance() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new GamePermission("readSettings")); } return INSTANCE; }
java
public static GameSettings getInstance() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new GamePermission("readSettings")); } return INSTANCE; }
[ "public", "static", "GameSettings", "getInstance", "(", ")", "{", "SecurityManager", "sm", "=", "System", ".", "getSecurityManager", "(", ")", ";", "if", "(", "sm", "!=", "null", ")", "{", "sm", ".", "checkPermission", "(", "new", "GamePermission", "(", "\...
Checks if the caller has permission to read the game settings @return the instance with all the settings as constants
[ "Checks", "if", "the", "caller", "has", "permission", "to", "read", "the", "game", "settings" ]
0e31c1ecf1006e35f68c229ff66c37640effffac
https://github.com/theHilikus/JRoboCom/blob/0e31c1ecf1006e35f68c229ff66c37640effffac/jrobocom-core/src/main/java/com/github/thehilikus/jrobocom/GameSettings.java#L144-L150
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/jdeps/ClassFileReader.java
ClassFileReader.newInstance
public static ClassFileReader newInstance(Path path, JarFile jf) throws IOException { return new JarFileReader(path, jf); }
java
public static ClassFileReader newInstance(Path path, JarFile jf) throws IOException { return new JarFileReader(path, jf); }
[ "public", "static", "ClassFileReader", "newInstance", "(", "Path", "path", ",", "JarFile", "jf", ")", "throws", "IOException", "{", "return", "new", "JarFileReader", "(", "path", ",", "jf", ")", ";", "}" ]
Returns a ClassFileReader instance of a given JarFile.
[ "Returns", "a", "ClassFileReader", "instance", "of", "a", "given", "JarFile", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/jdeps/ClassFileReader.java#L67-L69
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.rawInstantiate
Type rawInstantiate(Env<AttrContext> env, Type site, Symbol m, ResultInfo resultInfo, List<Type> argtypes, List<Type> typeargtypes, boolean allowBoxing, boolean useVarargs, Warner warn) throws Infer.InferenceException { Type mt = types.memberType(site, m); // tvars is the list of formal type variables for which type arguments // need to inferred. List<Type> tvars = List.nil(); if (typeargtypes == null) typeargtypes = List.nil(); if (!mt.hasTag(FORALL) && typeargtypes.nonEmpty()) { // This is not a polymorphic method, but typeargs are supplied // which is fine, see JLS 15.12.2.1 } else if (mt.hasTag(FORALL) && typeargtypes.nonEmpty()) { ForAll pmt = (ForAll) mt; if (typeargtypes.length() != pmt.tvars.length()) throw inapplicableMethodException.setMessage("arg.length.mismatch"); // not enough args // Check type arguments are within bounds List<Type> formals = pmt.tvars; List<Type> actuals = typeargtypes; while (formals.nonEmpty() && actuals.nonEmpty()) { List<Type> bounds = types.subst(types.getBounds((TypeVar)formals.head), pmt.tvars, typeargtypes); for (; bounds.nonEmpty(); bounds = bounds.tail) if (!types.isSubtypeUnchecked(actuals.head, bounds.head, warn)) throw inapplicableMethodException.setMessage("explicit.param.do.not.conform.to.bounds",actuals.head, bounds); formals = formals.tail; actuals = actuals.tail; } mt = types.subst(pmt.qtype, pmt.tvars, typeargtypes); } else if (mt.hasTag(FORALL)) { ForAll pmt = (ForAll) mt; List<Type> tvars1 = types.newInstances(pmt.tvars); tvars = tvars.appendList(tvars1); mt = types.subst(pmt.qtype, pmt.tvars, tvars1); } // find out whether we need to go the slow route via infer boolean instNeeded = tvars.tail != null; /*inlined: tvars.nonEmpty()*/ for (List<Type> l = argtypes; l.tail != null/*inlined: l.nonEmpty()*/ && !instNeeded; l = l.tail) { if (l.head.hasTag(FORALL)) instNeeded = true; } if (instNeeded) return infer.instantiateMethod(env, tvars, (MethodType)mt, resultInfo, (MethodSymbol)m, argtypes, allowBoxing, useVarargs, currentResolutionContext, warn); DeferredAttr.DeferredAttrContext dc = currentResolutionContext.deferredAttrContext(m, infer.emptyContext, resultInfo, warn); currentResolutionContext.methodCheck.argumentsAcceptable(env, dc, argtypes, mt.getParameterTypes(), warn); dc.complete(); return mt; }
java
Type rawInstantiate(Env<AttrContext> env, Type site, Symbol m, ResultInfo resultInfo, List<Type> argtypes, List<Type> typeargtypes, boolean allowBoxing, boolean useVarargs, Warner warn) throws Infer.InferenceException { Type mt = types.memberType(site, m); // tvars is the list of formal type variables for which type arguments // need to inferred. List<Type> tvars = List.nil(); if (typeargtypes == null) typeargtypes = List.nil(); if (!mt.hasTag(FORALL) && typeargtypes.nonEmpty()) { // This is not a polymorphic method, but typeargs are supplied // which is fine, see JLS 15.12.2.1 } else if (mt.hasTag(FORALL) && typeargtypes.nonEmpty()) { ForAll pmt = (ForAll) mt; if (typeargtypes.length() != pmt.tvars.length()) throw inapplicableMethodException.setMessage("arg.length.mismatch"); // not enough args // Check type arguments are within bounds List<Type> formals = pmt.tvars; List<Type> actuals = typeargtypes; while (formals.nonEmpty() && actuals.nonEmpty()) { List<Type> bounds = types.subst(types.getBounds((TypeVar)formals.head), pmt.tvars, typeargtypes); for (; bounds.nonEmpty(); bounds = bounds.tail) if (!types.isSubtypeUnchecked(actuals.head, bounds.head, warn)) throw inapplicableMethodException.setMessage("explicit.param.do.not.conform.to.bounds",actuals.head, bounds); formals = formals.tail; actuals = actuals.tail; } mt = types.subst(pmt.qtype, pmt.tvars, typeargtypes); } else if (mt.hasTag(FORALL)) { ForAll pmt = (ForAll) mt; List<Type> tvars1 = types.newInstances(pmt.tvars); tvars = tvars.appendList(tvars1); mt = types.subst(pmt.qtype, pmt.tvars, tvars1); } // find out whether we need to go the slow route via infer boolean instNeeded = tvars.tail != null; /*inlined: tvars.nonEmpty()*/ for (List<Type> l = argtypes; l.tail != null/*inlined: l.nonEmpty()*/ && !instNeeded; l = l.tail) { if (l.head.hasTag(FORALL)) instNeeded = true; } if (instNeeded) return infer.instantiateMethod(env, tvars, (MethodType)mt, resultInfo, (MethodSymbol)m, argtypes, allowBoxing, useVarargs, currentResolutionContext, warn); DeferredAttr.DeferredAttrContext dc = currentResolutionContext.deferredAttrContext(m, infer.emptyContext, resultInfo, warn); currentResolutionContext.methodCheck.argumentsAcceptable(env, dc, argtypes, mt.getParameterTypes(), warn); dc.complete(); return mt; }
[ "Type", "rawInstantiate", "(", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "Symbol", "m", ",", "ResultInfo", "resultInfo", ",", "List", "<", "Type", ">", "argtypes", ",", "List", "<", "Type", ">", "typeargtypes", ",", "boolean", "all...
Try to instantiate the type of a method so that it fits given type arguments and argument types. If successful, return the method's instantiated type, else return null. The instantiation will take into account an additional leading formal parameter if the method is an instance method seen as a member of an under determined site. In this case, we treat site as an additional parameter and the parameters of the class containing the method as additional type variables that get instantiated. @param env The current environment @param site The type of which the method is a member. @param m The method symbol. @param argtypes The invocation's given value arguments. @param typeargtypes The invocation's given type arguments. @param allowBoxing Allow boxing conversions of arguments. @param useVarargs Box trailing arguments into an array for varargs.
[ "Try", "to", "instantiate", "the", "type", "of", "a", "method", "so", "that", "it", "fits", "given", "type", "arguments", "and", "argument", "types", ".", "If", "successful", "return", "the", "method", "s", "instantiated", "type", "else", "return", "null", ...
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Resolve.java#L516-L583
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.selectBest
@SuppressWarnings("fallthrough") Symbol selectBest(Env<AttrContext> env, Type site, List<Type> argtypes, List<Type> typeargtypes, Symbol sym, Symbol bestSoFar, boolean allowBoxing, boolean useVarargs, boolean operator) { if (sym.kind == ERR || !sym.isInheritedIn(site.tsym, types)) { return bestSoFar; } else if (useVarargs && (sym.flags() & VARARGS) == 0) { return bestSoFar.kind >= ERRONEOUS ? new BadVarargsMethod((ResolveError)bestSoFar.baseSymbol()) : bestSoFar; } Assert.check(sym.kind < AMBIGUOUS); try { Type mt = rawInstantiate(env, site, sym, null, argtypes, typeargtypes, allowBoxing, useVarargs, types.noWarnings); if (!operator || verboseResolutionMode.contains(VerboseResolutionMode.PREDEF)) currentResolutionContext.addApplicableCandidate(sym, mt); } catch (InapplicableMethodException ex) { if (!operator) currentResolutionContext.addInapplicableCandidate(sym, ex.getDiagnostic()); switch (bestSoFar.kind) { case ABSENT_MTH: return new InapplicableSymbolError(currentResolutionContext); case WRONG_MTH: if (operator) return bestSoFar; bestSoFar = new InapplicableSymbolsError(currentResolutionContext); default: return bestSoFar; } } if (!isAccessible(env, site, sym)) { return (bestSoFar.kind == ABSENT_MTH) ? new AccessError(env, site, sym) : bestSoFar; } return (bestSoFar.kind > AMBIGUOUS) ? sym : mostSpecific(argtypes, sym, bestSoFar, env, site, allowBoxing && operator, useVarargs); }
java
@SuppressWarnings("fallthrough") Symbol selectBest(Env<AttrContext> env, Type site, List<Type> argtypes, List<Type> typeargtypes, Symbol sym, Symbol bestSoFar, boolean allowBoxing, boolean useVarargs, boolean operator) { if (sym.kind == ERR || !sym.isInheritedIn(site.tsym, types)) { return bestSoFar; } else if (useVarargs && (sym.flags() & VARARGS) == 0) { return bestSoFar.kind >= ERRONEOUS ? new BadVarargsMethod((ResolveError)bestSoFar.baseSymbol()) : bestSoFar; } Assert.check(sym.kind < AMBIGUOUS); try { Type mt = rawInstantiate(env, site, sym, null, argtypes, typeargtypes, allowBoxing, useVarargs, types.noWarnings); if (!operator || verboseResolutionMode.contains(VerboseResolutionMode.PREDEF)) currentResolutionContext.addApplicableCandidate(sym, mt); } catch (InapplicableMethodException ex) { if (!operator) currentResolutionContext.addInapplicableCandidate(sym, ex.getDiagnostic()); switch (bestSoFar.kind) { case ABSENT_MTH: return new InapplicableSymbolError(currentResolutionContext); case WRONG_MTH: if (operator) return bestSoFar; bestSoFar = new InapplicableSymbolsError(currentResolutionContext); default: return bestSoFar; } } if (!isAccessible(env, site, sym)) { return (bestSoFar.kind == ABSENT_MTH) ? new AccessError(env, site, sym) : bestSoFar; } return (bestSoFar.kind > AMBIGUOUS) ? sym : mostSpecific(argtypes, sym, bestSoFar, env, site, allowBoxing && operator, useVarargs); }
[ "@", "SuppressWarnings", "(", "\"fallthrough\"", ")", "Symbol", "selectBest", "(", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "List", "<", "Type", ">", "argtypes", ",", "List", "<", "Type", ">", "typeargtypes", ",", "Symbol", "sym", ...
Select the best method for a call site among two choices. @param env The current environment. @param site The original type from where the selection takes place. @param argtypes The invocation's value arguments, @param typeargtypes The invocation's type arguments, @param sym Proposed new best match. @param bestSoFar Previously found best match. @param allowBoxing Allow boxing conversions of arguments. @param useVarargs Box trailing arguments into an array for varargs.
[ "Select", "the", "best", "method", "for", "a", "call", "site", "among", "two", "choices", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Resolve.java#L1426-L1472
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.findMethod
Symbol findMethod(Env<AttrContext> env, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes, boolean allowBoxing, boolean useVarargs, boolean operator) { Symbol bestSoFar = methodNotFound; bestSoFar = findMethod(env, site, name, argtypes, typeargtypes, site.tsym.type, bestSoFar, allowBoxing, useVarargs, operator); return bestSoFar; }
java
Symbol findMethod(Env<AttrContext> env, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes, boolean allowBoxing, boolean useVarargs, boolean operator) { Symbol bestSoFar = methodNotFound; bestSoFar = findMethod(env, site, name, argtypes, typeargtypes, site.tsym.type, bestSoFar, allowBoxing, useVarargs, operator); return bestSoFar; }
[ "Symbol", "findMethod", "(", "Env", "<", "AttrContext", ">", "env", ",", "Type", "site", ",", "Name", "name", ",", "List", "<", "Type", ">", "argtypes", ",", "List", "<", "Type", ">", "typeargtypes", ",", "boolean", "allowBoxing", ",", "boolean", "useVar...
Find best qualified method matching given name, type and value arguments. @param env The current environment. @param site The original type from where the selection takes place. @param name The method's name. @param argtypes The method's value arguments. @param typeargtypes The method's type arguments @param allowBoxing Allow boxing conversions of arguments. @param useVarargs Box trailing arguments into an array for varargs.
[ "Find", "best", "qualified", "method", "matching", "given", "name", "type", "and", "value", "arguments", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Resolve.java#L1668-L1688
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.printscopes
public void printscopes(Scope s) { while (s != null) { if (s.owner != null) System.err.print(s.owner + ": "); for (Scope.Entry e = s.elems; e != null; e = e.sibling) { if ((e.sym.flags() & ABSTRACT) != 0) System.err.print("abstract "); System.err.print(e.sym + " "); } System.err.println(); s = s.next; } }
java
public void printscopes(Scope s) { while (s != null) { if (s.owner != null) System.err.print(s.owner + ": "); for (Scope.Entry e = s.elems; e != null; e = e.sibling) { if ((e.sym.flags() & ABSTRACT) != 0) System.err.print("abstract "); System.err.print(e.sym + " "); } System.err.println(); s = s.next; } }
[ "public", "void", "printscopes", "(", "Scope", "s", ")", "{", "while", "(", "s", "!=", "null", ")", "{", "if", "(", "s", ".", "owner", "!=", "null", ")", "System", ".", "err", ".", "print", "(", "s", ".", "owner", "+", "\": \"", ")", ";", "for"...
print all scopes starting with scope s and proceeding outwards. used for debugging.
[ "print", "all", "scopes", "starting", "with", "scope", "s", "and", "proceeding", "outwards", ".", "used", "for", "debugging", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Resolve.java#L2340-L2352
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/Resolve.java
Resolve.resolveBinaryOperator
Symbol resolveBinaryOperator(DiagnosticPosition pos, JCTree.Tag optag, Env<AttrContext> env, Type left, Type right) { return resolveOperator(pos, optag, env, List.of(left, right)); }
java
Symbol resolveBinaryOperator(DiagnosticPosition pos, JCTree.Tag optag, Env<AttrContext> env, Type left, Type right) { return resolveOperator(pos, optag, env, List.of(left, right)); }
[ "Symbol", "resolveBinaryOperator", "(", "DiagnosticPosition", "pos", ",", "JCTree", ".", "Tag", "optag", ",", "Env", "<", "AttrContext", ">", "env", ",", "Type", "left", ",", "Type", "right", ")", "{", "return", "resolveOperator", "(", "pos", ",", "optag", ...
Resolve binary operator. @param pos The position to use for error reporting. @param optag The tag of the operation tree. @param env The environment current at the operation. @param left The types of the left operand. @param right The types of the right operand.
[ "Resolve", "binary", "operator", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/Resolve.java#L2721-L2727
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/jdeps/JdepsTask.java
JdepsTask.matches
private boolean matches(String classname, AccessFlags flags) { if (options.apiOnly && !flags.is(AccessFlags.ACC_PUBLIC)) { return false; } else if (options.includePattern != null) { return options.includePattern.matcher(classname.replace('/', '.')).matches(); } else { return true; } }
java
private boolean matches(String classname, AccessFlags flags) { if (options.apiOnly && !flags.is(AccessFlags.ACC_PUBLIC)) { return false; } else if (options.includePattern != null) { return options.includePattern.matcher(classname.replace('/', '.')).matches(); } else { return true; } }
[ "private", "boolean", "matches", "(", "String", "classname", ",", "AccessFlags", "flags", ")", "{", "if", "(", "options", ".", "apiOnly", "&&", "!", "flags", ".", "is", "(", "AccessFlags", ".", "ACC_PUBLIC", ")", ")", "{", "return", "false", ";", "}", ...
Tests if the given class matches the pattern given in the -include option or if it's a public class if -apionly option is specified
[ "Tests", "if", "the", "given", "class", "matches", "the", "pattern", "given", "in", "the", "-", "include", "option", "or", "if", "it", "s", "a", "public", "class", "if", "-", "apionly", "option", "is", "specified" ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/jdeps/JdepsTask.java#L474-L482
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/jdeps/JdepsTask.java
JdepsTask.replacementFor
private String replacementFor(String cn) { String name = cn; String value = null; while (value == null && name != null) { try { value = ResourceBundleHelper.jdkinternals.getString(name); } catch (MissingResourceException e) { // go up one subpackage level int i = name.lastIndexOf('.'); name = i > 0 ? name.substring(0, i) : null; } } return value; }
java
private String replacementFor(String cn) { String name = cn; String value = null; while (value == null && name != null) { try { value = ResourceBundleHelper.jdkinternals.getString(name); } catch (MissingResourceException e) { // go up one subpackage level int i = name.lastIndexOf('.'); name = i > 0 ? name.substring(0, i) : null; } } return value; }
[ "private", "String", "replacementFor", "(", "String", "cn", ")", "{", "String", "name", "=", "cn", ";", "String", "value", "=", "null", ";", "while", "(", "value", "==", "null", "&&", "name", "!=", "null", ")", "{", "try", "{", "value", "=", "Resourc...
Returns the recommended replacement API for the given classname; or return null if replacement API is not known.
[ "Returns", "the", "recommended", "replacement", "API", "for", "the", "given", "classname", ";", "or", "return", "null", "if", "replacement", "API", "is", "not", "known", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/jdeps/JdepsTask.java#L992-L1005
train
coopernurse/barrister-java
src/main/java/com/bitmechanic/barrister/Function.java
Function.setContract
@Override public void setContract(Contract c) { super.setContract(c); for (Field f : params) { f.setContract(c); } if (returns != null) { returns.setContract(c); } }
java
@Override public void setContract(Contract c) { super.setContract(c); for (Field f : params) { f.setContract(c); } if (returns != null) { returns.setContract(c); } }
[ "@", "Override", "public", "void", "setContract", "(", "Contract", "c", ")", "{", "super", ".", "setContract", "(", "c", ")", ";", "for", "(", "Field", "f", ":", "params", ")", "{", "f", ".", "setContract", "(", "c", ")", ";", "}", "if", "(", "re...
Sets the Contract for this Function. Propegates this down to its param and return Fields
[ "Sets", "the", "Contract", "for", "this", "Function", ".", "Propegates", "this", "down", "to", "its", "param", "and", "return", "Fields" ]
c2b639634c88a25002b66d1fb4a8f5fb51ade6a2
https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/Function.java#L72-L81
train
coopernurse/barrister-java
src/main/java/com/bitmechanic/barrister/Function.java
Function.invoke
public Object invoke(RpcRequest req, Object handler) throws RpcException, IllegalAccessException, InvocationTargetException { if (contract == null) { throw new IllegalStateException("contract cannot be null"); } if (req == null) { throw new IllegalArgumentException("req cannot be null"); } if (handler == null) { throw new IllegalArgumentException("handler cannot be null"); } Method method = getMethod(handler); Object reqParams[] = unmarshalParams(req, method); return marshalResult(method.invoke(handler, reqParams)); }
java
public Object invoke(RpcRequest req, Object handler) throws RpcException, IllegalAccessException, InvocationTargetException { if (contract == null) { throw new IllegalStateException("contract cannot be null"); } if (req == null) { throw new IllegalArgumentException("req cannot be null"); } if (handler == null) { throw new IllegalArgumentException("handler cannot be null"); } Method method = getMethod(handler); Object reqParams[] = unmarshalParams(req, method); return marshalResult(method.invoke(handler, reqParams)); }
[ "public", "Object", "invoke", "(", "RpcRequest", "req", ",", "Object", "handler", ")", "throws", "RpcException", ",", "IllegalAccessException", ",", "InvocationTargetException", "{", "if", "(", "contract", "==", "null", ")", "{", "throw", "new", "IllegalStateExcep...
Invokes this Function against the given handler Class for the given request. This is the heart of the RPC dispatch, and is where your application code gets run. @param req Request to invoke against handler. The req.params will be unmarshaled and used when calling the Java method on handler. @param handler Your application class that implements the given interface. The method on handler that matches this Function's name will be invoked. @return Result of Java method invocation, marshaled to its RPC result type @throws RpcException If the req.params do not match the parameters for this function as specified in the IDL @throws IllegalAccessException If there is a problem invoking the method on handler @throws InvocationTargetException If there is a problem invoking the method on handler
[ "Invokes", "this", "Function", "against", "the", "given", "handler", "Class", "for", "the", "given", "request", ".", "This", "is", "the", "heart", "of", "the", "RPC", "dispatch", "and", "is", "where", "your", "application", "code", "gets", "run", "." ]
c2b639634c88a25002b66d1fb4a8f5fb51ade6a2
https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/Function.java#L97-L113
train
coopernurse/barrister-java
src/main/java/com/bitmechanic/barrister/Function.java
Function.marshalParams
public Object[] marshalParams(RpcRequest req) throws RpcException { Object[] converted = new Object[params.size()]; Object[] reqParams = req.getParams(); if (reqParams.length != converted.length) { String msg = "Function '" + req.getMethod() + "' expects " + params.size() + " param(s). " + reqParams.length + " given."; throw invParams(msg); } for (int i = 0; i < converted.length; i++) { converted[i] = params.get(i).getTypeConverter().marshal(reqParams[i]); } return converted; }
java
public Object[] marshalParams(RpcRequest req) throws RpcException { Object[] converted = new Object[params.size()]; Object[] reqParams = req.getParams(); if (reqParams.length != converted.length) { String msg = "Function '" + req.getMethod() + "' expects " + params.size() + " param(s). " + reqParams.length + " given."; throw invParams(msg); } for (int i = 0; i < converted.length; i++) { converted[i] = params.get(i).getTypeConverter().marshal(reqParams[i]); } return converted; }
[ "public", "Object", "[", "]", "marshalParams", "(", "RpcRequest", "req", ")", "throws", "RpcException", "{", "Object", "[", "]", "converted", "=", "new", "Object", "[", "params", ".", "size", "(", ")", "]", ";", "Object", "[", "]", "reqParams", "=", "r...
Marshals the req.params to their RPC format equivalents. For example, a Java Struct class will be converted to a Map. @param req RpcRequest to marshal params for @return RPC representation of params in req @throws RpcException If param length differs from expected param length for this function, or if any parameters fail IDL type validation
[ "Marshals", "the", "req", ".", "params", "to", "their", "RPC", "format", "equivalents", ".", "For", "example", "a", "Java", "Struct", "class", "will", "be", "converted", "to", "a", "Map", "." ]
c2b639634c88a25002b66d1fb4a8f5fb51ade6a2
https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/Function.java#L124-L138
train
coopernurse/barrister-java
src/main/java/com/bitmechanic/barrister/Function.java
Function.unmarshalResult
public Object unmarshalResult(Object respObj) throws RpcException { if (returns == null) { if (respObj != null) { throw new IllegalArgumentException("Function " + name + " is a notification and should not have a result"); } } return returns.getTypeConverter().unmarshal(respObj); }
java
public Object unmarshalResult(Object respObj) throws RpcException { if (returns == null) { if (respObj != null) { throw new IllegalArgumentException("Function " + name + " is a notification and should not have a result"); } } return returns.getTypeConverter().unmarshal(respObj); }
[ "public", "Object", "unmarshalResult", "(", "Object", "respObj", ")", "throws", "RpcException", "{", "if", "(", "returns", "==", "null", ")", "{", "if", "(", "respObj", "!=", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Function \"", ...
Unmarshals respObj into its Java representation @throws RpcException if respObj does not match IDL type validation
[ "Unmarshals", "respObj", "into", "its", "Java", "representation" ]
c2b639634c88a25002b66d1fb4a8f5fb51ade6a2
https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/Function.java#L145-L153
train
coopernurse/barrister-java
src/main/java/com/bitmechanic/barrister/Function.java
Function.unmarshalParams
public Object[] unmarshalParams(RpcRequest req) throws RpcException { Object reqParams[] = req.getParams(); if (reqParams.length != params.size()) { String msg = "Function '" + req.getMethod() + "' expects " + params.size() + " param(s). " + reqParams.length + " given."; throw invParams(msg); } Object convParams[] = new Object[reqParams.length]; for (int i = 0; i < convParams.length; i++) { convParams[i] = params.get(i).getTypeConverter().unmarshal(reqParams[i]); } return convParams; }
java
public Object[] unmarshalParams(RpcRequest req) throws RpcException { Object reqParams[] = req.getParams(); if (reqParams.length != params.size()) { String msg = "Function '" + req.getMethod() + "' expects " + params.size() + " param(s). " + reqParams.length + " given."; throw invParams(msg); } Object convParams[] = new Object[reqParams.length]; for (int i = 0; i < convParams.length; i++) { convParams[i] = params.get(i).getTypeConverter().unmarshal(reqParams[i]); } return convParams; }
[ "public", "Object", "[", "]", "unmarshalParams", "(", "RpcRequest", "req", ")", "throws", "RpcException", "{", "Object", "reqParams", "[", "]", "=", "req", ".", "getParams", "(", ")", ";", "if", "(", "reqParams", ".", "length", "!=", "params", ".", "size...
Unmarshals req.params into their Java representations @throws RpcException if req.params length does not match this Function's expected param list length, or if any parameter fails IDL type validation
[ "Unmarshals", "req", ".", "params", "into", "their", "Java", "representations" ]
c2b639634c88a25002b66d1fb4a8f5fb51ade6a2
https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/Function.java#L174-L188
train
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/ean/UPCE.java
UPCE.getCompactMessage
@Nullable public static String getCompactMessage (final String sMsg) { UPCA.validateMessage (sMsg); final String sUPCA = UPCA.handleChecksum (sMsg, EEANChecksumMode.AUTO); final byte nNumberSystem = _extractNumberSystem (sUPCA); if (nNumberSystem != 0 && nNumberSystem != 1) return null; final byte nCheck = StringParser.parseByte (sUPCA.substring (11, 12), (byte) -1); if (nCheck == (byte) -1) return null; final StringBuilder aSB = new StringBuilder (); aSB.append (Byte.toString (nNumberSystem)); final String manufacturer = sUPCA.substring (1, 1 + 5); final String product = sUPCA.substring (6, 6 + 5); // Rule 1 String mtemp = manufacturer.substring (2, 2 + 3); String ptemp = product.substring (0, 0 + 2); if ("000|100|200".indexOf (mtemp) >= 0 && "00".equals (ptemp)) { aSB.append (manufacturer.substring (0, 2)); aSB.append (product.substring (2, 2 + 3)); aSB.append (mtemp.charAt (0)); } else { // Rule 2 ptemp = product.substring (0, 0 + 3); if ("300|400|500|600|700|800|900".indexOf (mtemp) >= 0 && "000".equals (ptemp)) { aSB.append (manufacturer.substring (0, 0 + 3)); aSB.append (product.substring (3, 3 + 2)); aSB.append ('3'); } else { // Rule 3 mtemp = manufacturer.substring (3, 3 + 2); ptemp = product.substring (0, 0 + 4); if ("10|20|30|40|50|60|70|80|90".indexOf (mtemp) >= 0 && "0000".equals (ptemp)) { aSB.append (manufacturer.substring (0, 0 + 4)); aSB.append (product.substring (4, 4 + 1)); aSB.append ('4'); } else { // Rule 4 mtemp = manufacturer.substring (4, 4 + 1); ptemp = product.substring (4, 4 + 1); if (!"0".equals (mtemp) && "5|6|7|8|9".indexOf (ptemp) >= 0) { aSB.append (manufacturer); aSB.append (ptemp); } else { return null; } } } } aSB.append (Byte.toString (nCheck)); return aSB.toString (); }
java
@Nullable public static String getCompactMessage (final String sMsg) { UPCA.validateMessage (sMsg); final String sUPCA = UPCA.handleChecksum (sMsg, EEANChecksumMode.AUTO); final byte nNumberSystem = _extractNumberSystem (sUPCA); if (nNumberSystem != 0 && nNumberSystem != 1) return null; final byte nCheck = StringParser.parseByte (sUPCA.substring (11, 12), (byte) -1); if (nCheck == (byte) -1) return null; final StringBuilder aSB = new StringBuilder (); aSB.append (Byte.toString (nNumberSystem)); final String manufacturer = sUPCA.substring (1, 1 + 5); final String product = sUPCA.substring (6, 6 + 5); // Rule 1 String mtemp = manufacturer.substring (2, 2 + 3); String ptemp = product.substring (0, 0 + 2); if ("000|100|200".indexOf (mtemp) >= 0 && "00".equals (ptemp)) { aSB.append (manufacturer.substring (0, 2)); aSB.append (product.substring (2, 2 + 3)); aSB.append (mtemp.charAt (0)); } else { // Rule 2 ptemp = product.substring (0, 0 + 3); if ("300|400|500|600|700|800|900".indexOf (mtemp) >= 0 && "000".equals (ptemp)) { aSB.append (manufacturer.substring (0, 0 + 3)); aSB.append (product.substring (3, 3 + 2)); aSB.append ('3'); } else { // Rule 3 mtemp = manufacturer.substring (3, 3 + 2); ptemp = product.substring (0, 0 + 4); if ("10|20|30|40|50|60|70|80|90".indexOf (mtemp) >= 0 && "0000".equals (ptemp)) { aSB.append (manufacturer.substring (0, 0 + 4)); aSB.append (product.substring (4, 4 + 1)); aSB.append ('4'); } else { // Rule 4 mtemp = manufacturer.substring (4, 4 + 1); ptemp = product.substring (4, 4 + 1); if (!"0".equals (mtemp) && "5|6|7|8|9".indexOf (ptemp) >= 0) { aSB.append (manufacturer); aSB.append (ptemp); } else { return null; } } } } aSB.append (Byte.toString (nCheck)); return aSB.toString (); }
[ "@", "Nullable", "public", "static", "String", "getCompactMessage", "(", "final", "String", "sMsg", ")", "{", "UPCA", ".", "validateMessage", "(", "sMsg", ")", ";", "final", "String", "sUPCA", "=", "UPCA", ".", "handleChecksum", "(", "sMsg", ",", "EEANChecks...
Compacts an UPC-A message to an UPC-E message if possible. @param sMsg an UPC-A message @return String the derived UPC-E message (with checksum), null if the message is a valid UPC-A message but no UPC-E representation is possible
[ "Compacts", "an", "UPC", "-", "A", "message", "to", "an", "UPC", "-", "E", "message", "if", "possible", "." ]
ca5e0b03c735b30b47930c018bfb5e71f00d0ff4
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/ean/UPCE.java#L74-L140
train
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/ean/UPCE.java
UPCE.getExpandedMessage
@Nonnull public static String getExpandedMessage (@Nonnull final String sMsg) { final char cCheck = sMsg.length () == 8 ? sMsg.charAt (7) : '\u0000'; final String sUpce = sMsg.substring (0, 0 + 7); final byte nNumberSystem = _extractNumberSystem (sUpce); if (nNumberSystem != 0 && nNumberSystem != 1) throw new IllegalArgumentException ("Invalid UPC-E message: " + sMsg); final StringBuilder aSB = new StringBuilder (); aSB.append (Byte.toString (nNumberSystem)); final byte nMode = StringParser.parseByte (sUpce.substring (6, 6 + 1), (byte) -1); if (nMode >= 0 && nMode <= 2) { aSB.append (sUpce.substring (1, 1 + 2)); aSB.append (Byte.toString (nMode)); aSB.append ("0000"); aSB.append (sUpce.substring (3, 3 + 3)); } else if (nMode == 3) { aSB.append (sUpce.substring (1, 1 + 3)); aSB.append ("00000"); aSB.append (sUpce.substring (4, 4 + 2)); } else if (nMode == 4) { aSB.append (sUpce.substring (1, 1 + 4)); aSB.append ("00000"); aSB.append (sUpce.substring (5, 5 + 1)); } else if (nMode >= 5 && nMode <= 9) { aSB.append (sUpce.substring (1, 1 + 5)); aSB.append ("0000"); aSB.append (Byte.toString (nMode)); } else { // Shouldn't happen throw new IllegalArgumentException ("Internal error"); } final String sUpcaFinished = aSB.toString (); final char cExpectedCheck = calcChecksumChar (sUpcaFinished, sUpcaFinished.length ()); if (cCheck != '\u0000' && cCheck != cExpectedCheck) throw new IllegalArgumentException ("Invalid checksum. Expected " + cExpectedCheck + " but was " + cCheck); return sUpcaFinished + cExpectedCheck; }
java
@Nonnull public static String getExpandedMessage (@Nonnull final String sMsg) { final char cCheck = sMsg.length () == 8 ? sMsg.charAt (7) : '\u0000'; final String sUpce = sMsg.substring (0, 0 + 7); final byte nNumberSystem = _extractNumberSystem (sUpce); if (nNumberSystem != 0 && nNumberSystem != 1) throw new IllegalArgumentException ("Invalid UPC-E message: " + sMsg); final StringBuilder aSB = new StringBuilder (); aSB.append (Byte.toString (nNumberSystem)); final byte nMode = StringParser.parseByte (sUpce.substring (6, 6 + 1), (byte) -1); if (nMode >= 0 && nMode <= 2) { aSB.append (sUpce.substring (1, 1 + 2)); aSB.append (Byte.toString (nMode)); aSB.append ("0000"); aSB.append (sUpce.substring (3, 3 + 3)); } else if (nMode == 3) { aSB.append (sUpce.substring (1, 1 + 3)); aSB.append ("00000"); aSB.append (sUpce.substring (4, 4 + 2)); } else if (nMode == 4) { aSB.append (sUpce.substring (1, 1 + 4)); aSB.append ("00000"); aSB.append (sUpce.substring (5, 5 + 1)); } else if (nMode >= 5 && nMode <= 9) { aSB.append (sUpce.substring (1, 1 + 5)); aSB.append ("0000"); aSB.append (Byte.toString (nMode)); } else { // Shouldn't happen throw new IllegalArgumentException ("Internal error"); } final String sUpcaFinished = aSB.toString (); final char cExpectedCheck = calcChecksumChar (sUpcaFinished, sUpcaFinished.length ()); if (cCheck != '\u0000' && cCheck != cExpectedCheck) throw new IllegalArgumentException ("Invalid checksum. Expected " + cExpectedCheck + " but was " + cCheck); return sUpcaFinished + cExpectedCheck; }
[ "@", "Nonnull", "public", "static", "String", "getExpandedMessage", "(", "@", "Nonnull", "final", "String", "sMsg", ")", "{", "final", "char", "cCheck", "=", "sMsg", ".", "length", "(", ")", "==", "8", "?", "sMsg", ".", "charAt", "(", "7", ")", ":", ...
Expands an UPC-E message to an UPC-A message. @param sMsg an UPC-E message (7 or 8 characters) @return String the expanded UPC-A message (with checksum, 12 characters)
[ "Expands", "an", "UPC", "-", "E", "message", "to", "an", "UPC", "-", "A", "message", "." ]
ca5e0b03c735b30b47930c018bfb5e71f00d0ff4
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/ean/UPCE.java#L149-L200
train
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/ean/UPCE.java
UPCE.validateMessage
@Nonnull public static EValidity validateMessage (@Nullable final String sMsg) { final int nLen = StringHelper.getLength (sMsg); if (nLen >= 7 && nLen <= 8) { final byte nNumberSystem = _extractNumberSystem (sMsg); if (nNumberSystem >= 0 && nNumberSystem <= 1) return EValidity.VALID; } return EValidity.INVALID; }
java
@Nonnull public static EValidity validateMessage (@Nullable final String sMsg) { final int nLen = StringHelper.getLength (sMsg); if (nLen >= 7 && nLen <= 8) { final byte nNumberSystem = _extractNumberSystem (sMsg); if (nNumberSystem >= 0 && nNumberSystem <= 1) return EValidity.VALID; } return EValidity.INVALID; }
[ "@", "Nonnull", "public", "static", "EValidity", "validateMessage", "(", "@", "Nullable", "final", "String", "sMsg", ")", "{", "final", "int", "nLen", "=", "StringHelper", ".", "getLength", "(", "sMsg", ")", ";", "if", "(", "nLen", ">=", "7", "&&", "nLen...
Validates an UPC-E message. The message can also be UPC-A in which case the message is compacted to a UPC-E message if possible. If it's not possible an IllegalArgumentException is thrown @param sMsg the message to validate @return {@link EValidity}
[ "Validates", "an", "UPC", "-", "E", "message", ".", "The", "message", "can", "also", "be", "UPC", "-", "A", "in", "which", "case", "the", "message", "is", "compacted", "to", "a", "UPC", "-", "E", "message", "if", "possible", ".", "If", "it", "s", "...
ca5e0b03c735b30b47930c018bfb5e71f00d0ff4
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/ean/UPCE.java#L217-L228
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByBirthInfo
public Iterable<DUser> queryByBirthInfo(java.lang.String birthInfo) { return queryByField(null, DUserMapper.Field.BIRTHINFO.getFieldName(), birthInfo); }
java
public Iterable<DUser> queryByBirthInfo(java.lang.String birthInfo) { return queryByField(null, DUserMapper.Field.BIRTHINFO.getFieldName(), birthInfo); }
[ "public", "Iterable", "<", "DUser", ">", "queryByBirthInfo", "(", "java", ".", "lang", ".", "String", "birthInfo", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "BIRTHINFO", ".", "getFieldName", "(", ")", ",", "bir...
query-by method for field birthInfo @param birthInfo the specified attribute @return an Iterable of DUsers for the specified birthInfo
[ "query", "-", "by", "method", "for", "field", "birthInfo" ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L88-L90
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByFriends
public Iterable<DUser> queryByFriends(java.lang.Object friends) { return queryByField(null, DUserMapper.Field.FRIENDS.getFieldName(), friends); }
java
public Iterable<DUser> queryByFriends(java.lang.Object friends) { return queryByField(null, DUserMapper.Field.FRIENDS.getFieldName(), friends); }
[ "public", "Iterable", "<", "DUser", ">", "queryByFriends", "(", "java", ".", "lang", ".", "Object", "friends", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "FRIENDS", ".", "getFieldName", "(", ")", ",", "friends",...
query-by method for field friends @param friends the specified attribute @return an Iterable of DUsers for the specified friends
[ "query", "-", "by", "method", "for", "field", "friends" ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L160-L162
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByPassword
public Iterable<DUser> queryByPassword(java.lang.String password) { return queryByField(null, DUserMapper.Field.PASSWORD.getFieldName(), password); }
java
public Iterable<DUser> queryByPassword(java.lang.String password) { return queryByField(null, DUserMapper.Field.PASSWORD.getFieldName(), password); }
[ "public", "Iterable", "<", "DUser", ">", "queryByPassword", "(", "java", ".", "lang", ".", "String", "password", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "PASSWORD", ".", "getFieldName", "(", ")", ",", "passwo...
query-by method for field password @param password the specified attribute @return an Iterable of DUsers for the specified password
[ "query", "-", "by", "method", "for", "field", "password" ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L178-L180
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByPhoneNumber1
public Iterable<DUser> queryByPhoneNumber1(java.lang.String phoneNumber1) { return queryByField(null, DUserMapper.Field.PHONENUMBER1.getFieldName(), phoneNumber1); }
java
public Iterable<DUser> queryByPhoneNumber1(java.lang.String phoneNumber1) { return queryByField(null, DUserMapper.Field.PHONENUMBER1.getFieldName(), phoneNumber1); }
[ "public", "Iterable", "<", "DUser", ">", "queryByPhoneNumber1", "(", "java", ".", "lang", ".", "String", "phoneNumber1", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "PHONENUMBER1", ".", "getFieldName", "(", ")", ",...
query-by method for field phoneNumber1 @param phoneNumber1 the specified attribute @return an Iterable of DUsers for the specified phoneNumber1
[ "query", "-", "by", "method", "for", "field", "phoneNumber1" ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L187-L189
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByPhoneNumber2
public Iterable<DUser> queryByPhoneNumber2(java.lang.String phoneNumber2) { return queryByField(null, DUserMapper.Field.PHONENUMBER2.getFieldName(), phoneNumber2); }
java
public Iterable<DUser> queryByPhoneNumber2(java.lang.String phoneNumber2) { return queryByField(null, DUserMapper.Field.PHONENUMBER2.getFieldName(), phoneNumber2); }
[ "public", "Iterable", "<", "DUser", ">", "queryByPhoneNumber2", "(", "java", ".", "lang", ".", "String", "phoneNumber2", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "PHONENUMBER2", ".", "getFieldName", "(", ")", ",...
query-by method for field phoneNumber2 @param phoneNumber2 the specified attribute @return an Iterable of DUsers for the specified phoneNumber2
[ "query", "-", "by", "method", "for", "field", "phoneNumber2" ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L196-L198
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByPreferredLanguage
public Iterable<DUser> queryByPreferredLanguage(java.lang.String preferredLanguage) { return queryByField(null, DUserMapper.Field.PREFERREDLANGUAGE.getFieldName(), preferredLanguage); }
java
public Iterable<DUser> queryByPreferredLanguage(java.lang.String preferredLanguage) { return queryByField(null, DUserMapper.Field.PREFERREDLANGUAGE.getFieldName(), preferredLanguage); }
[ "public", "Iterable", "<", "DUser", ">", "queryByPreferredLanguage", "(", "java", ".", "lang", ".", "String", "preferredLanguage", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "PREFERREDLANGUAGE", ".", "getFieldName", "...
query-by method for field preferredLanguage @param preferredLanguage the specified attribute @return an Iterable of DUsers for the specified preferredLanguage
[ "query", "-", "by", "method", "for", "field", "preferredLanguage" ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L205-L207
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByTimeZoneCanonicalId
public Iterable<DUser> queryByTimeZoneCanonicalId(java.lang.String timeZoneCanonicalId) { return queryByField(null, DUserMapper.Field.TIMEZONECANONICALID.getFieldName(), timeZoneCanonicalId); }
java
public Iterable<DUser> queryByTimeZoneCanonicalId(java.lang.String timeZoneCanonicalId) { return queryByField(null, DUserMapper.Field.TIMEZONECANONICALID.getFieldName(), timeZoneCanonicalId); }
[ "public", "Iterable", "<", "DUser", ">", "queryByTimeZoneCanonicalId", "(", "java", ".", "lang", ".", "String", "timeZoneCanonicalId", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "TIMEZONECANONICALID", ".", "getFieldName...
query-by method for field timeZoneCanonicalId @param timeZoneCanonicalId the specified attribute @return an Iterable of DUsers for the specified timeZoneCanonicalId
[ "query", "-", "by", "method", "for", "field", "timeZoneCanonicalId" ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L250-L252
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.findByUsername
public DUser findByUsername(java.lang.String username) { return queryUniqueByField(null, DUserMapper.Field.USERNAME.getFieldName(), username); }
java
public DUser findByUsername(java.lang.String username) { return queryUniqueByField(null, DUserMapper.Field.USERNAME.getFieldName(), username); }
[ "public", "DUser", "findByUsername", "(", "java", ".", "lang", ".", "String", "username", ")", "{", "return", "queryUniqueByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "USERNAME", ".", "getFieldName", "(", ")", ",", "username", ")", ";", "}...
find-by method for unique field username @param username the unique attribute @return the unique DUser for the specified username
[ "find", "-", "by", "method", "for", "unique", "field", "username" ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L277-L279
train
brianwhu/xillium
data/src/main/java/org/xillium/data/persistence/ParametricQuery.java
ParametricQuery.executeSelect
public <T> T executeSelect(Connection conn, DataObject object, ResultSetWorker<T> worker) throws Exception { PreparedStatement statement = conn.prepareStatement(_sql); try { load(statement, object); return worker.process(statement.executeQuery()); } finally { statement.close(); } }
java
public <T> T executeSelect(Connection conn, DataObject object, ResultSetWorker<T> worker) throws Exception { PreparedStatement statement = conn.prepareStatement(_sql); try { load(statement, object); return worker.process(statement.executeQuery()); } finally { statement.close(); } }
[ "public", "<", "T", ">", "T", "executeSelect", "(", "Connection", "conn", ",", "DataObject", "object", ",", "ResultSetWorker", "<", "T", ">", "worker", ")", "throws", "Exception", "{", "PreparedStatement", "statement", "=", "conn", ".", "prepareStatement", "("...
Executes the SELECT statement, passing the result set to the ResultSetWorker for processing. The ResultSetWorker must close the result set before returning.
[ "Executes", "the", "SELECT", "statement", "passing", "the", "result", "set", "to", "the", "ResultSetWorker", "for", "processing", "." ]
e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/data/src/main/java/org/xillium/data/persistence/ParametricQuery.java#L42-L50
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java
PackageDocImpl.enums
public ClassDoc[] enums() { ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>(); for (ClassDocImpl c : getClasses(true)) { if (c.isEnum()) { ret.append(c); } } return ret.toArray(new ClassDocImpl[ret.length()]); }
java
public ClassDoc[] enums() { ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>(); for (ClassDocImpl c : getClasses(true)) { if (c.isEnum()) { ret.append(c); } } return ret.toArray(new ClassDocImpl[ret.length()]); }
[ "public", "ClassDoc", "[", "]", "enums", "(", ")", "{", "ListBuffer", "<", "ClassDocImpl", ">", "ret", "=", "new", "ListBuffer", "<", "ClassDocImpl", ">", "(", ")", ";", "for", "(", "ClassDocImpl", "c", ":", "getClasses", "(", "true", ")", ")", "{", ...
Get included enum types in this package. @return included enum types in this package.
[ "Get", "included", "enum", "types", "in", "this", "package", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java#L245-L253
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java
PackageDocImpl.interfaces
public ClassDoc[] interfaces() { ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>(); for (ClassDocImpl c : getClasses(true)) { if (c.isInterface()) { ret.append(c); } } return ret.toArray(new ClassDocImpl[ret.length()]); }
java
public ClassDoc[] interfaces() { ListBuffer<ClassDocImpl> ret = new ListBuffer<ClassDocImpl>(); for (ClassDocImpl c : getClasses(true)) { if (c.isInterface()) { ret.append(c); } } return ret.toArray(new ClassDocImpl[ret.length()]); }
[ "public", "ClassDoc", "[", "]", "interfaces", "(", ")", "{", "ListBuffer", "<", "ClassDocImpl", ">", "ret", "=", "new", "ListBuffer", "<", "ClassDocImpl", ">", "(", ")", ";", "for", "(", "ClassDocImpl", "c", ":", "getClasses", "(", "true", ")", ")", "{...
Get included interfaces in this package, omitting annotation types. @return included interfaces in this package.
[ "Get", "included", "interfaces", "in", "this", "package", "omitting", "annotation", "types", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javadoc/PackageDocImpl.java#L260-L268
train
tbrooks8/Precipice
precipice-core/src/main/java/net/uncontended/precipice/GuardRail.java
GuardRail.acquirePermits
public Rejected acquirePermits(long number, long nanoTime) { for (int i = 0; i < backPressureList.size(); ++i) { BackPressure<Rejected> bp = backPressureList.get(i); Rejected rejected = bp.acquirePermit(number, nanoTime); if (rejected != null) { rejectedCounts.write(rejected, number, nanoTime); for (int j = 0; j < i; ++j) { backPressureList.get(j).releasePermit(number, nanoTime); } return rejected; } } return null; }
java
public Rejected acquirePermits(long number, long nanoTime) { for (int i = 0; i < backPressureList.size(); ++i) { BackPressure<Rejected> bp = backPressureList.get(i); Rejected rejected = bp.acquirePermit(number, nanoTime); if (rejected != null) { rejectedCounts.write(rejected, number, nanoTime); for (int j = 0; j < i; ++j) { backPressureList.get(j).releasePermit(number, nanoTime); } return rejected; } } return null; }
[ "public", "Rejected", "acquirePermits", "(", "long", "number", ",", "long", "nanoTime", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "backPressureList", ".", "size", "(", ")", ";", "++", "i", ")", "{", "BackPressure", "<", "Rejected", "...
Acquire permits for task execution. If the acquisition is rejected then a reason will be returned. If the acquisition is successful, null will be returned. @param number of permits to acquire @param nanoTime currentInterval nano time @return the rejected reason
[ "Acquire", "permits", "for", "task", "execution", ".", "If", "the", "acquisition", "is", "rejected", "then", "a", "reason", "will", "be", "returned", ".", "If", "the", "acquisition", "is", "successful", "null", "will", "be", "returned", "." ]
97fae467fd676b16a96b8d88b02569d8fc1f2681
https://github.com/tbrooks8/Precipice/blob/97fae467fd676b16a96b8d88b02569d8fc1f2681/precipice-core/src/main/java/net/uncontended/precipice/GuardRail.java#L69-L83
train
tbrooks8/Precipice
precipice-core/src/main/java/net/uncontended/precipice/GuardRail.java
GuardRail.releasePermitsWithoutResult
public void releasePermitsWithoutResult(long number, long nanoTime) { for (BackPressure<Rejected> backPressure : backPressureList) { backPressure.releasePermit(number, nanoTime); } }
java
public void releasePermitsWithoutResult(long number, long nanoTime) { for (BackPressure<Rejected> backPressure : backPressureList) { backPressure.releasePermit(number, nanoTime); } }
[ "public", "void", "releasePermitsWithoutResult", "(", "long", "number", ",", "long", "nanoTime", ")", "{", "for", "(", "BackPressure", "<", "Rejected", ">", "backPressure", ":", "backPressureList", ")", "{", "backPressure", ".", "releasePermit", "(", "number", "...
Release acquired permits without result. Since there is not a known result the result count object and latency will not be updated. @param number of permits to release @param nanoTime currentInterval nano time
[ "Release", "acquired", "permits", "without", "result", ".", "Since", "there", "is", "not", "a", "known", "result", "the", "result", "count", "object", "and", "latency", "will", "not", "be", "updated", "." ]
97fae467fd676b16a96b8d88b02569d8fc1f2681
https://github.com/tbrooks8/Precipice/blob/97fae467fd676b16a96b8d88b02569d8fc1f2681/precipice-core/src/main/java/net/uncontended/precipice/GuardRail.java#L102-L106
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/admintask/AdminTaskResource.java
AdminTaskResource.enqueueTask
@GET @Path("{taskName}") public Response enqueueTask(@PathParam("taskName") String taskName) { checkNotNull(taskName); taskQueue.enqueueTask(taskName, requestParamsProvider.get()); return Response.ok().build(); }
java
@GET @Path("{taskName}") public Response enqueueTask(@PathParam("taskName") String taskName) { checkNotNull(taskName); taskQueue.enqueueTask(taskName, requestParamsProvider.get()); return Response.ok().build(); }
[ "@", "GET", "@", "Path", "(", "\"{taskName}\"", ")", "public", "Response", "enqueueTask", "(", "@", "PathParam", "(", "\"taskName\"", ")", "String", "taskName", ")", "{", "checkNotNull", "(", "taskName", ")", ";", "taskQueue", ".", "enqueueTask", "(", "taskN...
Enqueue an admin task for processing. The request will return immediately and the task will be run in a separate thread. The execution model depending on the implementation of the queue. @param taskName task name @return
[ "Enqueue", "an", "admin", "task", "for", "processing", ".", "The", "request", "will", "return", "immediately", "and", "the", "task", "will", "be", "run", "in", "a", "separate", "thread", ".", "The", "execution", "model", "depending", "on", "the", "implementa...
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/admintask/AdminTaskResource.java#L77-L83
train
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/admintask/AdminTaskResource.java
AdminTaskResource.processTask
@POST @Path("{taskName}") public Response processTask(@PathParam("taskName") String taskName) { checkNotNull(requestParamsProvider.get()); checkNotNull(taskName); LOGGER.info("Processing task for {}...", taskName); for (AdminTask adminTask : adminTasks) { final Object body = adminTask.processTask(taskName, requestParamsProvider.get()); LOGGER.info("Processed tasks for {}: {}", taskName, body); } return Response.ok().build(); }
java
@POST @Path("{taskName}") public Response processTask(@PathParam("taskName") String taskName) { checkNotNull(requestParamsProvider.get()); checkNotNull(taskName); LOGGER.info("Processing task for {}...", taskName); for (AdminTask adminTask : adminTasks) { final Object body = adminTask.processTask(taskName, requestParamsProvider.get()); LOGGER.info("Processed tasks for {}: {}", taskName, body); } return Response.ok().build(); }
[ "@", "POST", "@", "Path", "(", "\"{taskName}\"", ")", "public", "Response", "processTask", "(", "@", "PathParam", "(", "\"taskName\"", ")", "String", "taskName", ")", "{", "checkNotNull", "(", "requestParamsProvider", ".", "get", "(", ")", ")", ";", "checkNo...
Process an admin task. The admin task will be processed on the requesting thread. @param taskName task name @return
[ "Process", "an", "admin", "task", ".", "The", "admin", "task", "will", "be", "processed", "on", "the", "requesting", "thread", "." ]
eb8ba8e6794a96ea0dd9744cada4f9ad9618f114
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/admintask/AdminTaskResource.java#L93-L106
train
base2Services/kagura
shared/reporting-core/src/main/java/com/base2/kagura/core/report/connectors/ReportConnector.java
ReportConnector.run
public void run(Map<String, Object> extra) { if (getParameterConfig() != null) { Boolean parametersRequired = false; List<String> requiredParameters = new ArrayList<String>(); for (ParamConfig paramConfig : getParameterConfig()) { if (BooleanUtils.isTrue(paramConfig.getRequired())) { try { if (StringUtils.isBlank(ObjectUtils.toString(PropertyUtils.getProperty(paramConfig, "value")))) { parametersRequired = true; requiredParameters.add(paramConfig.getName()); } } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } } } if (parametersRequired) { errors.add("Some required parameters weren't filled in: " + StringUtils.join(requiredParameters ,", ")+ "."); return; } } runReport(extra); }
java
public void run(Map<String, Object> extra) { if (getParameterConfig() != null) { Boolean parametersRequired = false; List<String> requiredParameters = new ArrayList<String>(); for (ParamConfig paramConfig : getParameterConfig()) { if (BooleanUtils.isTrue(paramConfig.getRequired())) { try { if (StringUtils.isBlank(ObjectUtils.toString(PropertyUtils.getProperty(paramConfig, "value")))) { parametersRequired = true; requiredParameters.add(paramConfig.getName()); } } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } } } if (parametersRequired) { errors.add("Some required parameters weren't filled in: " + StringUtils.join(requiredParameters ,", ")+ "."); return; } } runReport(extra); }
[ "public", "void", "run", "(", "Map", "<", "String", ",", "Object", ">", "extra", ")", "{", "if", "(", "getParameterConfig", "(", ")", "!=", "null", ")", "{", "Boolean", "parametersRequired", "=", "false", ";", "List", "<", "String", ">", "requiredParamet...
Runs the report. @param extra middleware provided values, such as date/time, system configuration, logged in user, permissions and what ever else is of value to the user.
[ "Runs", "the", "report", "." ]
5564aa71bfa2cb3baaae2eb098c6c673dd4e82ee
https://github.com/base2Services/kagura/blob/5564aa71bfa2cb3baaae2eb098c6c673dd4e82ee/shared/reporting-core/src/main/java/com/base2/kagura/core/report/connectors/ReportConnector.java#L57-L88
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.getDateFromString
public static Date getDateFromString(final String dateString, final String pattern) { try { SimpleDateFormat df = buildDateFormat(pattern); return df.parse(dateString); } catch (ParseException e) { throw new DateException(String.format("Could not parse %s with pattern %s.", dateString, pattern), e); } }
java
public static Date getDateFromString(final String dateString, final String pattern) { try { SimpleDateFormat df = buildDateFormat(pattern); return df.parse(dateString); } catch (ParseException e) { throw new DateException(String.format("Could not parse %s with pattern %s.", dateString, pattern), e); } }
[ "public", "static", "Date", "getDateFromString", "(", "final", "String", "dateString", ",", "final", "String", "pattern", ")", "{", "try", "{", "SimpleDateFormat", "df", "=", "buildDateFormat", "(", "pattern", ")", ";", "return", "df", ".", "parse", "(", "da...
Get data from data string using the given pattern and the default date format symbols for the default locale. @param dateString date string to be handled. @param pattern pattern to be formated. @return a new Date object by given date string and pattern. @throws DateException
[ "Get", "data", "from", "data", "string", "using", "the", "given", "pattern", "and", "the", "default", "date", "format", "symbols", "for", "the", "default", "locale", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L93-L102
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.getDateFormat
public static String getDateFormat(final Date date, final String pattern) { SimpleDateFormat simpleDateFormat = buildDateFormat(pattern); return simpleDateFormat.format(date); }
java
public static String getDateFormat(final Date date, final String pattern) { SimpleDateFormat simpleDateFormat = buildDateFormat(pattern); return simpleDateFormat.format(date); }
[ "public", "static", "String", "getDateFormat", "(", "final", "Date", "date", ",", "final", "String", "pattern", ")", "{", "SimpleDateFormat", "simpleDateFormat", "=", "buildDateFormat", "(", "pattern", ")", ";", "return", "simpleDateFormat", ".", "format", "(", ...
Format date by given pattern. @param date date to be handled. @param pattern pattern use to handle given date. @return a string object of format date by given pattern.
[ "Format", "date", "by", "given", "pattern", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L111-L115
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.getDateOfSecondsBack
public static Date getDateOfSecondsBack(final int secondsBack, final Date date) { return dateBack(Calendar.SECOND, secondsBack, date); }
java
public static Date getDateOfSecondsBack(final int secondsBack, final Date date) { return dateBack(Calendar.SECOND, secondsBack, date); }
[ "public", "static", "Date", "getDateOfSecondsBack", "(", "final", "int", "secondsBack", ",", "final", "Date", "date", ")", "{", "return", "dateBack", "(", "Calendar", ".", "SECOND", ",", "secondsBack", ",", "date", ")", ";", "}" ]
Get specify seconds back form given date. @param secondsBack how many second want to be back. @param date date to be handled. @return a new Date object.
[ "Get", "specify", "seconds", "back", "form", "given", "date", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L149-L152
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.getDateOfMinutesBack
public static Date getDateOfMinutesBack(final int minutesBack, final Date date) { return dateBack(Calendar.MINUTE, minutesBack, date); }
java
public static Date getDateOfMinutesBack(final int minutesBack, final Date date) { return dateBack(Calendar.MINUTE, minutesBack, date); }
[ "public", "static", "Date", "getDateOfMinutesBack", "(", "final", "int", "minutesBack", ",", "final", "Date", "date", ")", "{", "return", "dateBack", "(", "Calendar", ".", "MINUTE", ",", "minutesBack", ",", "date", ")", ";", "}" ]
Get specify minutes back form given date. @param minutesBack how many minutes want to be back. @param date date to be handled. @return a new Date object.
[ "Get", "specify", "minutes", "back", "form", "given", "date", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L161-L164
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.getDateOfHoursBack
public static Date getDateOfHoursBack(final int hoursBack, final Date date) { return dateBack(Calendar.HOUR_OF_DAY, hoursBack, date); }
java
public static Date getDateOfHoursBack(final int hoursBack, final Date date) { return dateBack(Calendar.HOUR_OF_DAY, hoursBack, date); }
[ "public", "static", "Date", "getDateOfHoursBack", "(", "final", "int", "hoursBack", ",", "final", "Date", "date", ")", "{", "return", "dateBack", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "hoursBack", ",", "date", ")", ";", "}" ]
Get specify hours back form given date. @param hoursBack how many hours want to be back. @param date date to be handled. @return a new Date object.
[ "Get", "specify", "hours", "back", "form", "given", "date", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L173-L176
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.getDateOfDaysBack
public static Date getDateOfDaysBack(final int daysBack, final Date date) { return dateBack(Calendar.DAY_OF_MONTH, daysBack, date); }
java
public static Date getDateOfDaysBack(final int daysBack, final Date date) { return dateBack(Calendar.DAY_OF_MONTH, daysBack, date); }
[ "public", "static", "Date", "getDateOfDaysBack", "(", "final", "int", "daysBack", ",", "final", "Date", "date", ")", "{", "return", "dateBack", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "daysBack", ",", "date", ")", ";", "}" ]
Get specify days back from given date. @param daysBack how many days want to be back. @param date date to be handled. @return a new Date object.
[ "Get", "specify", "days", "back", "from", "given", "date", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L185-L188
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.getDateOfWeeksBack
public static Date getDateOfWeeksBack(final int weeksBack, final Date date) { return dateBack(Calendar.WEEK_OF_MONTH, weeksBack, date); }
java
public static Date getDateOfWeeksBack(final int weeksBack, final Date date) { return dateBack(Calendar.WEEK_OF_MONTH, weeksBack, date); }
[ "public", "static", "Date", "getDateOfWeeksBack", "(", "final", "int", "weeksBack", ",", "final", "Date", "date", ")", "{", "return", "dateBack", "(", "Calendar", ".", "WEEK_OF_MONTH", ",", "weeksBack", ",", "date", ")", ";", "}" ]
Get specify weeks back from given date. @param weeksBack how many weeks want to be back. @param date date to be handled. @return a new Date object.
[ "Get", "specify", "weeks", "back", "from", "given", "date", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L197-L200
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.getDateOfMonthsBack
public static Date getDateOfMonthsBack(final int monthsBack, final Date date) { return dateBack(Calendar.MONTH, monthsBack, date); }
java
public static Date getDateOfMonthsBack(final int monthsBack, final Date date) { return dateBack(Calendar.MONTH, monthsBack, date); }
[ "public", "static", "Date", "getDateOfMonthsBack", "(", "final", "int", "monthsBack", ",", "final", "Date", "date", ")", "{", "return", "dateBack", "(", "Calendar", ".", "MONTH", ",", "monthsBack", ",", "date", ")", ";", "}" ]
Get specify months back from given date. @param monthsBack how many months want to be back. @param date date to be handled. @return a new Date object.
[ "Get", "specify", "months", "back", "from", "given", "date", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L209-L212
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.getDateOfYearsBack
public static Date getDateOfYearsBack(final int yearsBack, final Date date) { return dateBack(Calendar.YEAR, yearsBack, date); }
java
public static Date getDateOfYearsBack(final int yearsBack, final Date date) { return dateBack(Calendar.YEAR, yearsBack, date); }
[ "public", "static", "Date", "getDateOfYearsBack", "(", "final", "int", "yearsBack", ",", "final", "Date", "date", ")", "{", "return", "dateBack", "(", "Calendar", ".", "YEAR", ",", "yearsBack", ",", "date", ")", ";", "}" ]
Get specify years back from given date. @param yearsBack how many years want to be back. @param date date to be handled. @return a new Date object.
[ "Get", "specify", "years", "back", "from", "given", "date", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L221-L224
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.isLastDayOfTheMonth
public static boolean isLastDayOfTheMonth(final Date date) { Date dateOfMonthsBack = getDateOfMonthsBack(-1, date); int dayOfMonth = getDayOfMonth(dateOfMonthsBack); Date dateOfDaysBack = getDateOfDaysBack(dayOfMonth, dateOfMonthsBack); return dateOfDaysBack.equals(date); }
java
public static boolean isLastDayOfTheMonth(final Date date) { Date dateOfMonthsBack = getDateOfMonthsBack(-1, date); int dayOfMonth = getDayOfMonth(dateOfMonthsBack); Date dateOfDaysBack = getDateOfDaysBack(dayOfMonth, dateOfMonthsBack); return dateOfDaysBack.equals(date); }
[ "public", "static", "boolean", "isLastDayOfTheMonth", "(", "final", "Date", "date", ")", "{", "Date", "dateOfMonthsBack", "=", "getDateOfMonthsBack", "(", "-", "1", ",", "date", ")", ";", "int", "dayOfMonth", "=", "getDayOfMonth", "(", "dateOfMonthsBack", ")", ...
Return true if the given date is the last day of the month; false otherwise. @param date date to be tested. @return true if the given date is the last day of the month; false otherwise.
[ "Return", "true", "if", "the", "given", "date", "is", "the", "last", "day", "of", "the", "month", ";", "false", "otherwise", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L371-L377
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.subSeconds
public static long subSeconds(final Date date1, final Date date2) { return subTime(date1, date2, DatePeriod.SECOND); }
java
public static long subSeconds(final Date date1, final Date date2) { return subTime(date1, date2, DatePeriod.SECOND); }
[ "public", "static", "long", "subSeconds", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "return", "subTime", "(", "date1", ",", "date2", ",", "DatePeriod", ".", "SECOND", ")", ";", "}" ]
Get how many seconds between two date. @param date1 date to be tested. @param date2 date to be tested. @return how many seconds between two date.
[ "Get", "how", "many", "seconds", "between", "two", "date", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L411-L414
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.subMinutes
public static long subMinutes(final Date date1, final Date date2) { return subTime(date1, date2, DatePeriod.MINUTE); }
java
public static long subMinutes(final Date date1, final Date date2) { return subTime(date1, date2, DatePeriod.MINUTE); }
[ "public", "static", "long", "subMinutes", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "return", "subTime", "(", "date1", ",", "date2", ",", "DatePeriod", ".", "MINUTE", ")", ";", "}" ]
Get how many minutes between two date. @param date1 date to be tested. @param date2 date to be tested. @return how many minutes between two date.
[ "Get", "how", "many", "minutes", "between", "two", "date", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L423-L426
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.subHours
public static long subHours(final Date date1, final Date date2) { return subTime(date1, date2, DatePeriod.HOUR); }
java
public static long subHours(final Date date1, final Date date2) { return subTime(date1, date2, DatePeriod.HOUR); }
[ "public", "static", "long", "subHours", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "return", "subTime", "(", "date1", ",", "date2", ",", "DatePeriod", ".", "HOUR", ")", ";", "}" ]
Get how many hours between two date. @param date1 date to be tested. @param date2 date to be tested. @return how many hours between two date.
[ "Get", "how", "many", "hours", "between", "two", "date", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L435-L438
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.subDays
public static long subDays(final Date date1, final Date date2) { return subTime(date1, date2, DatePeriod.DAY); }
java
public static long subDays(final Date date1, final Date date2) { return subTime(date1, date2, DatePeriod.DAY); }
[ "public", "static", "long", "subDays", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "return", "subTime", "(", "date1", ",", "date2", ",", "DatePeriod", ".", "DAY", ")", ";", "}" ]
Get how many days between two date. @param date1 date to be tested. @param date2 date to be tested. @return how many days between two date.
[ "Get", "how", "many", "days", "between", "two", "date", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L462-L465
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.subMonths
public static long subMonths(final String dateString1, final String dateString2) { Date date1 = getDateFromString(dateString1, DEFAULT_DATE_SIMPLE_PATTERN); Date date2 = getDateFromString(dateString2, DEFAULT_DATE_SIMPLE_PATTERN); return subMonths(date1, date2); }
java
public static long subMonths(final String dateString1, final String dateString2) { Date date1 = getDateFromString(dateString1, DEFAULT_DATE_SIMPLE_PATTERN); Date date2 = getDateFromString(dateString2, DEFAULT_DATE_SIMPLE_PATTERN); return subMonths(date1, date2); }
[ "public", "static", "long", "subMonths", "(", "final", "String", "dateString1", ",", "final", "String", "dateString2", ")", "{", "Date", "date1", "=", "getDateFromString", "(", "dateString1", ",", "DEFAULT_DATE_SIMPLE_PATTERN", ")", ";", "Date", "date2", "=", "g...
Get how many months between two date, the date pattern is 'yyyy-MM-dd'. @param dateString1 date string to be tested. @param dateString2 date string to be tested. @return how many months between two date. @throws DateException
[ "Get", "how", "many", "months", "between", "two", "date", "the", "date", "pattern", "is", "yyyy", "-", "MM", "-", "dd", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L475-L480
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.subMonths
public static long subMonths(final Date date1, final Date date2) { Calendar calendar1 = buildCalendar(date1); int monthOfDate1 = calendar1.get(Calendar.MONTH); int yearOfDate1 = calendar1.get(Calendar.YEAR); Calendar calendar2 = buildCalendar(date2); int monthOfDate2 = calendar2.get(Calendar.MONTH); int yearOfDate2 = calendar2.get(Calendar.YEAR); int subMonth = Math.abs(monthOfDate1 - monthOfDate2); int subYear = Math.abs(yearOfDate1 - yearOfDate2); return subYear * 12 + subMonth; }
java
public static long subMonths(final Date date1, final Date date2) { Calendar calendar1 = buildCalendar(date1); int monthOfDate1 = calendar1.get(Calendar.MONTH); int yearOfDate1 = calendar1.get(Calendar.YEAR); Calendar calendar2 = buildCalendar(date2); int monthOfDate2 = calendar2.get(Calendar.MONTH); int yearOfDate2 = calendar2.get(Calendar.YEAR); int subMonth = Math.abs(monthOfDate1 - monthOfDate2); int subYear = Math.abs(yearOfDate1 - yearOfDate2); return subYear * 12 + subMonth; }
[ "public", "static", "long", "subMonths", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "Calendar", "calendar1", "=", "buildCalendar", "(", "date1", ")", ";", "int", "monthOfDate1", "=", "calendar1", ".", "get", "(", "Calendar", "....
Get how many months between two date. @param date1 date to be tested. @param date2 date to be tested. @return how many months between two date.
[ "Get", "how", "many", "months", "between", "two", "date", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L489-L500
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.subYears
public static long subYears(final Date date1, final Date date2) { return Math.abs(getYear(date1) - getYear(date2)); }
java
public static long subYears(final Date date1, final Date date2) { return Math.abs(getYear(date1) - getYear(date2)); }
[ "public", "static", "long", "subYears", "(", "final", "Date", "date1", ",", "final", "Date", "date2", ")", "{", "return", "Math", ".", "abs", "(", "getYear", "(", "date1", ")", "-", "getYear", "(", "date2", ")", ")", ";", "}" ]
Get how many years between two date. @param date1 date to be tested. @param date2 date to be tested. @return how many years between two date.
[ "Get", "how", "many", "years", "between", "two", "date", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L524-L527
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/DateUtils.java
DateUtils.buildDateFormat
private static SimpleDateFormat buildDateFormat(final String pattern) { SimpleDateFormat simpleDateFormat = simpleDateFormatCache.get(); if (simpleDateFormat == null) { simpleDateFormat = new SimpleDateFormat(); simpleDateFormatCache.set(simpleDateFormat); } simpleDateFormat.applyPattern(pattern); return simpleDateFormat; }
java
private static SimpleDateFormat buildDateFormat(final String pattern) { SimpleDateFormat simpleDateFormat = simpleDateFormatCache.get(); if (simpleDateFormat == null) { simpleDateFormat = new SimpleDateFormat(); simpleDateFormatCache.set(simpleDateFormat); } simpleDateFormat.applyPattern(pattern); return simpleDateFormat; }
[ "private", "static", "SimpleDateFormat", "buildDateFormat", "(", "final", "String", "pattern", ")", "{", "SimpleDateFormat", "simpleDateFormat", "=", "simpleDateFormatCache", ".", "get", "(", ")", ";", "if", "(", "simpleDateFormat", "==", "null", ")", "{", "simple...
Get a SimpleDateFormat object by given pattern. @param pattern date format pattern. @return a SimpleDateFormat object by given pattern.
[ "Get", "a", "SimpleDateFormat", "object", "by", "given", "pattern", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/DateUtils.java#L567-L576
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/ConstFold.java
ConstFold.fold1
Type fold1(int opcode, Type operand) { try { Object od = operand.constValue(); switch (opcode) { case nop: return operand; case ineg: // unary - return syms.intType.constType(-intValue(od)); case ixor: // ~ return syms.intType.constType(~intValue(od)); case bool_not: // ! return syms.booleanType.constType(b2i(intValue(od) == 0)); case ifeq: return syms.booleanType.constType(b2i(intValue(od) == 0)); case ifne: return syms.booleanType.constType(b2i(intValue(od) != 0)); case iflt: return syms.booleanType.constType(b2i(intValue(od) < 0)); case ifgt: return syms.booleanType.constType(b2i(intValue(od) > 0)); case ifle: return syms.booleanType.constType(b2i(intValue(od) <= 0)); case ifge: return syms.booleanType.constType(b2i(intValue(od) >= 0)); case lneg: // unary - return syms.longType.constType(new Long(-longValue(od))); case lxor: // ~ return syms.longType.constType(new Long(~longValue(od))); case fneg: // unary - return syms.floatType.constType(new Float(-floatValue(od))); case dneg: // ~ return syms.doubleType.constType(new Double(-doubleValue(od))); default: return null; } } catch (ArithmeticException e) { return null; } }
java
Type fold1(int opcode, Type operand) { try { Object od = operand.constValue(); switch (opcode) { case nop: return operand; case ineg: // unary - return syms.intType.constType(-intValue(od)); case ixor: // ~ return syms.intType.constType(~intValue(od)); case bool_not: // ! return syms.booleanType.constType(b2i(intValue(od) == 0)); case ifeq: return syms.booleanType.constType(b2i(intValue(od) == 0)); case ifne: return syms.booleanType.constType(b2i(intValue(od) != 0)); case iflt: return syms.booleanType.constType(b2i(intValue(od) < 0)); case ifgt: return syms.booleanType.constType(b2i(intValue(od) > 0)); case ifle: return syms.booleanType.constType(b2i(intValue(od) <= 0)); case ifge: return syms.booleanType.constType(b2i(intValue(od) >= 0)); case lneg: // unary - return syms.longType.constType(new Long(-longValue(od))); case lxor: // ~ return syms.longType.constType(new Long(~longValue(od))); case fneg: // unary - return syms.floatType.constType(new Float(-floatValue(od))); case dneg: // ~ return syms.doubleType.constType(new Double(-doubleValue(od))); default: return null; } } catch (ArithmeticException e) { return null; } }
[ "Type", "fold1", "(", "int", "opcode", ",", "Type", "operand", ")", "{", "try", "{", "Object", "od", "=", "operand", ".", "constValue", "(", ")", ";", "switch", "(", "opcode", ")", "{", "case", "nop", ":", "return", "operand", ";", "case", "ineg", ...
Fold unary operation. @param opcode The operation's opcode instruction (usually a byte code), as entered by class Symtab. opcode's ifeq to ifge are for postprocessing xcmp; ifxx pairs of instructions. @param operand The operation's operand type. Argument types are assumed to have non-null constValue's.
[ "Fold", "unary", "operation", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/ConstFold.java#L103-L145
train
coopernurse/barrister-java
src/main/java/com/bitmechanic/barrister/Server.java
Server.addHandler
public synchronized void addHandler(Class iface, Object handler) { try { iface.cast(handler); } catch (Exception e) { throw new IllegalArgumentException("Handler: " + handler.getClass().getName() + " does not implement: " + iface.getName()); } if (contract.getInterfaces().get(iface.getSimpleName()) == null) { throw new IllegalArgumentException("Interface: " + iface.getName() + " is not a part of this Contract"); } if (contract.getPackage() == null) { setContractPackage(iface); } handlers.put(iface.getSimpleName(), handler); }
java
public synchronized void addHandler(Class iface, Object handler) { try { iface.cast(handler); } catch (Exception e) { throw new IllegalArgumentException("Handler: " + handler.getClass().getName() + " does not implement: " + iface.getName()); } if (contract.getInterfaces().get(iface.getSimpleName()) == null) { throw new IllegalArgumentException("Interface: " + iface.getName() + " is not a part of this Contract"); } if (contract.getPackage() == null) { setContractPackage(iface); } handlers.put(iface.getSimpleName(), handler); }
[ "public", "synchronized", "void", "addHandler", "(", "Class", "iface", ",", "Object", "handler", ")", "{", "try", "{", "iface", ".", "cast", "(", "handler", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "IllegalArgumentException"...
Associates the handler instance with the given IDL interface. Replaces an existing handler for this iface if one was previously registered. @param iface Interface class that this handler implements. This is usually an Idl2Java generated interface Class @param handler Object that implements iface. Generally one of your application classes @throws IllegalArgumentException if iface is not an interface on this Server's Contract or if handler cannot be cast to iface
[ "Associates", "the", "handler", "instance", "with", "the", "given", "IDL", "interface", ".", "Replaces", "an", "existing", "handler", "for", "this", "iface", "if", "one", "was", "previously", "registered", "." ]
c2b639634c88a25002b66d1fb4a8f5fb51ade6a2
https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/Server.java#L76-L95
train
coopernurse/barrister-java
src/main/java/com/bitmechanic/barrister/Server.java
Server.call
@SuppressWarnings("unchecked") public void call(Serializer ser, InputStream is, OutputStream os) throws IOException { Object obj = null; try { obj = ser.readMapOrList(is); } catch (Exception e) { String msg = "Unable to deserialize request: " + e.getMessage(); ser.write(new RpcResponse(null, RpcException.Error.PARSE.exc(msg)).marshal(), os); return; } if (obj instanceof List) { List list = (List)obj; List respList = new ArrayList(); for (Object o : list) { RpcRequest rpcReq = new RpcRequest((Map)o); respList.add(call(rpcReq).marshal()); } ser.write(respList, os); } else if (obj instanceof Map) { RpcRequest rpcReq = new RpcRequest((Map)obj); ser.write(call(rpcReq).marshal(), os); } else { ser.write(new RpcResponse(null, RpcException.Error.INVALID_REQ.exc("Invalid Request")).marshal(), os); } }
java
@SuppressWarnings("unchecked") public void call(Serializer ser, InputStream is, OutputStream os) throws IOException { Object obj = null; try { obj = ser.readMapOrList(is); } catch (Exception e) { String msg = "Unable to deserialize request: " + e.getMessage(); ser.write(new RpcResponse(null, RpcException.Error.PARSE.exc(msg)).marshal(), os); return; } if (obj instanceof List) { List list = (List)obj; List respList = new ArrayList(); for (Object o : list) { RpcRequest rpcReq = new RpcRequest((Map)o); respList.add(call(rpcReq).marshal()); } ser.write(respList, os); } else if (obj instanceof Map) { RpcRequest rpcReq = new RpcRequest((Map)obj); ser.write(call(rpcReq).marshal(), os); } else { ser.write(new RpcResponse(null, RpcException.Error.INVALID_REQ.exc("Invalid Request")).marshal(), os); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "call", "(", "Serializer", "ser", ",", "InputStream", "is", ",", "OutputStream", "os", ")", "throws", "IOException", "{", "Object", "obj", "=", "null", ";", "try", "{", "obj", "=", "ser"...
Reads a RpcRequest from the input stream, deserializes it, invokes the matching handler method, serializes the result, and writes it to the output stream. @param ser Serializer to use to decode the request from the input stream, and serialize the result to the the output stream @param is InputStream to read the request from @param os OutputStream to write the response to @throws IOException If there is a problem reading or writing to either stream, or if the request cannot be deserialized.
[ "Reads", "a", "RpcRequest", "from", "the", "input", "stream", "deserializes", "it", "invokes", "the", "matching", "handler", "method", "serializes", "the", "result", "and", "writes", "it", "to", "the", "output", "stream", "." ]
c2b639634c88a25002b66d1fb4a8f5fb51ade6a2
https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/Server.java#L121-L151
train
coopernurse/barrister-java
src/main/java/com/bitmechanic/barrister/Server.java
Server.call
public RpcResponse call(RpcRequest req) { for (Filter filter : filters) { RpcRequest tmp = filter.alterRequest(req); if (tmp != null) { req = tmp; } } RpcResponse resp = null; for (Filter filter : filters) { resp = filter.preInvoke(req); if (resp != null) { break; } } if (resp == null) { resp = callInternal(req); } for (int i = filters.size() - 1; i >= 0; i--) { RpcResponse tmp = filters.get(i).postInvoke(req, resp); if (tmp != null) { resp = tmp; } } return resp; }
java
public RpcResponse call(RpcRequest req) { for (Filter filter : filters) { RpcRequest tmp = filter.alterRequest(req); if (tmp != null) { req = tmp; } } RpcResponse resp = null; for (Filter filter : filters) { resp = filter.preInvoke(req); if (resp != null) { break; } } if (resp == null) { resp = callInternal(req); } for (int i = filters.size() - 1; i >= 0; i--) { RpcResponse tmp = filters.get(i).postInvoke(req, resp); if (tmp != null) { resp = tmp; } } return resp; }
[ "public", "RpcResponse", "call", "(", "RpcRequest", "req", ")", "{", "for", "(", "Filter", "filter", ":", "filters", ")", "{", "RpcRequest", "tmp", "=", "filter", ".", "alterRequest", "(", "req", ")", ";", "if", "(", "tmp", "!=", "null", ")", "{", "r...
Calls the method associated with the RpcRequest and wraps the result as a RpcResponse. Filters are executed in 3 batches. * For each filter (in order registered): filter.alterRequest() * For each filter (in order registered): filter.preInvoke(). If any filter returns a non-null RpcResponse, the loop is terminated and invoke on the handler skipped. postInvoke() loop below still runs. * If no filter returns a non-null RpcResponse, then the handler is invoked based on the method in the RpcRequest (this is the common case) * For each filter (reverse order registered): filter.postInvoke() is executed. All filters are executed in this loop. * Last RpcResponse is returned @param req Request to process @return RpcResponse that pairs with this request. May contain a result or an error
[ "Calls", "the", "method", "associated", "with", "the", "RpcRequest", "and", "wraps", "the", "result", "as", "a", "RpcResponse", "." ]
c2b639634c88a25002b66d1fb4a8f5fb51ade6a2
https://github.com/coopernurse/barrister-java/blob/c2b639634c88a25002b66d1fb4a8f5fb51ade6a2/src/main/java/com/bitmechanic/barrister/Server.java#L170-L199
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/HttpUtils.java
HttpUtils.doGet
public static String doGet(final String url, final int retryTimes) { try { return doGetByLoop(url, retryTimes); } catch (HttpException e) { throw new HttpException(format("Failed to download content for url: '%s'. Tried '%s' times", url, Math.max(retryTimes + 1, 1))); } }
java
public static String doGet(final String url, final int retryTimes) { try { return doGetByLoop(url, retryTimes); } catch (HttpException e) { throw new HttpException(format("Failed to download content for url: '%s'. Tried '%s' times", url, Math.max(retryTimes + 1, 1))); } }
[ "public", "static", "String", "doGet", "(", "final", "String", "url", ",", "final", "int", "retryTimes", ")", "{", "try", "{", "return", "doGetByLoop", "(", "url", ",", "retryTimes", ")", ";", "}", "catch", "(", "HttpException", "e", ")", "{", "throw", ...
access given url by get request, if get exception, will retry by given retryTimes. @param url url to access @param retryTimes retry times when get exception. @return response content of target url.
[ "access", "given", "url", "by", "get", "request", "if", "get", "exception", "will", "retry", "by", "given", "retryTimes", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/HttpUtils.java#L66-L74
train
defei/codelogger-utils
src/main/java/org/codelogger/utils/HttpUtils.java
HttpUtils.doPost
public static String doPost(final String action, final Map<String, String> parameters, final int retryTimes) { try { return doPostByLoop(action, parameters, retryTimes); } catch (HttpException e) { throw new HttpException(format( "Failed to download content for action url: '%s' with parameters. Tried '%s' times", action, parameters, Math.max(retryTimes + 1, 1))); } }
java
public static String doPost(final String action, final Map<String, String> parameters, final int retryTimes) { try { return doPostByLoop(action, parameters, retryTimes); } catch (HttpException e) { throw new HttpException(format( "Failed to download content for action url: '%s' with parameters. Tried '%s' times", action, parameters, Math.max(retryTimes + 1, 1))); } }
[ "public", "static", "String", "doPost", "(", "final", "String", "action", ",", "final", "Map", "<", "String", ",", "String", ">", "parameters", ",", "final", "int", "retryTimes", ")", "{", "try", "{", "return", "doPostByLoop", "(", "action", ",", "paramete...
access given action with given parameters by post, if get exception, will retry by given retryTimes. @param action action url to access @param parameters parameters to post @param retryTimes retry times when get exception. @return response content of target action url.
[ "access", "given", "action", "with", "given", "parameters", "by", "post", "if", "get", "exception", "will", "retry", "by", "given", "retryTimes", "." ]
d906f5d217b783c7ae3e53442cd6fb87b20ecc0a
https://github.com/defei/codelogger-utils/blob/d906f5d217b783c7ae3e53442cd6fb87b20ecc0a/src/main/java/org/codelogger/utils/HttpUtils.java#L143-L153
train
brianwhu/xillium
base/src/main/java/org/xillium/base/util/Options.java
Options.document
public <A extends Appendable> A document(A output) throws IOException { StringBuilder line = new StringBuilder(); for (Field field: Beans.getKnownInstanceFields(_prototype)) { description d = field.getAnnotation(description.class); if (d == null) continue; placeholder p = field.getAnnotation(placeholder.class); String n = Strings.splitCamelCase(field.getName(), "-").toLowerCase(); char key = getShortOptionKey(field); if ((field.getType() == Boolean.class || field.getType() == Boolean.TYPE) && _booleans.containsKey(key)) { line.append(" -").append(key).append(", --").append(n); } else { line.append(" --").append(n).append('=').append(p != null ? p.value() : "value"); } if (line.length() < 16) { for (int i = line.length(); i < 16; ++i) line.append(' '); line.append(d.value()); } else { line.append("\n\t\t").append(d.value()); } output.append(line.toString()).append('\n'); line.setLength(0); } return output; }
java
public <A extends Appendable> A document(A output) throws IOException { StringBuilder line = new StringBuilder(); for (Field field: Beans.getKnownInstanceFields(_prototype)) { description d = field.getAnnotation(description.class); if (d == null) continue; placeholder p = field.getAnnotation(placeholder.class); String n = Strings.splitCamelCase(field.getName(), "-").toLowerCase(); char key = getShortOptionKey(field); if ((field.getType() == Boolean.class || field.getType() == Boolean.TYPE) && _booleans.containsKey(key)) { line.append(" -").append(key).append(", --").append(n); } else { line.append(" --").append(n).append('=').append(p != null ? p.value() : "value"); } if (line.length() < 16) { for (int i = line.length(); i < 16; ++i) line.append(' '); line.append(d.value()); } else { line.append("\n\t\t").append(d.value()); } output.append(line.toString()).append('\n'); line.setLength(0); } return output; }
[ "public", "<", "A", "extends", "Appendable", ">", "A", "document", "(", "A", "output", ")", "throws", "IOException", "{", "StringBuilder", "line", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Field", "field", ":", "Beans", ".", "getKnownInstanc...
Writes usage documentation to an Appendable. @param output an Appendable to write the usage to @return the same Appendable
[ "Writes", "usage", "documentation", "to", "an", "Appendable", "." ]
e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/util/Options.java#L100-L125
train
koendeschacht/bow-utils
src/main/java/be/bagofwords/http/ExtraDNSCache.java
ExtraDNSCache.getAddress
public static InetAddress getAddress(String host) throws UnknownHostException { if (timeToClean()) { synchronized (storedAddresses) { if (timeToClean()) { cleanOldAddresses(); } } } Pair<InetAddress, Long> cachedAddress; synchronized (storedAddresses) { cachedAddress = storedAddresses.get(host); } if (cachedAddress != null) { //host DNS entry was cached InetAddress address = cachedAddress.getFirst(); if (address == null) { throw new UnknownHostException("Could not find host " + host + " (cached response)"); } else { return address; } } else { //host DNS entry was not cached fetchDnsAddressLock.acquireUninterruptibly(); try { InetAddress addr = InetAddress.getByName(host); synchronized (storedAddresses) { storedAddresses.put(host, new Pair<>(addr, System.currentTimeMillis())); } return addr; } catch (UnknownHostException exp) { synchronized (storedAddresses) { storedAddresses.put(host, new Pair<InetAddress, Long>(null, System.currentTimeMillis())); } Log.i("[Dns lookup] " + host + " --> not found"); throw exp; } finally { fetchDnsAddressLock.release(); } } }
java
public static InetAddress getAddress(String host) throws UnknownHostException { if (timeToClean()) { synchronized (storedAddresses) { if (timeToClean()) { cleanOldAddresses(); } } } Pair<InetAddress, Long> cachedAddress; synchronized (storedAddresses) { cachedAddress = storedAddresses.get(host); } if (cachedAddress != null) { //host DNS entry was cached InetAddress address = cachedAddress.getFirst(); if (address == null) { throw new UnknownHostException("Could not find host " + host + " (cached response)"); } else { return address; } } else { //host DNS entry was not cached fetchDnsAddressLock.acquireUninterruptibly(); try { InetAddress addr = InetAddress.getByName(host); synchronized (storedAddresses) { storedAddresses.put(host, new Pair<>(addr, System.currentTimeMillis())); } return addr; } catch (UnknownHostException exp) { synchronized (storedAddresses) { storedAddresses.put(host, new Pair<InetAddress, Long>(null, System.currentTimeMillis())); } Log.i("[Dns lookup] " + host + " --> not found"); throw exp; } finally { fetchDnsAddressLock.release(); } } }
[ "public", "static", "InetAddress", "getAddress", "(", "String", "host", ")", "throws", "UnknownHostException", "{", "if", "(", "timeToClean", "(", ")", ")", "{", "synchronized", "(", "storedAddresses", ")", "{", "if", "(", "timeToClean", "(", ")", ")", "{", ...
only allow 5 simultaneous DNS requests
[ "only", "allow", "5", "simultaneous", "DNS", "requests" ]
f599da17cb7a40b8ffc5610a9761fa922e99d7cb
https://github.com/koendeschacht/bow-utils/blob/f599da17cb7a40b8ffc5610a9761fa922e99d7cb/src/main/java/be/bagofwords/http/ExtraDNSCache.java#L29-L69
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Symtab.java
Symtab.enterConstant
private VarSymbol enterConstant(String name, Type type) { VarSymbol c = new VarSymbol( PUBLIC | STATIC | FINAL, names.fromString(name), type, predefClass); c.setData(type.constValue()); predefClass.members().enter(c); return c; }
java
private VarSymbol enterConstant(String name, Type type) { VarSymbol c = new VarSymbol( PUBLIC | STATIC | FINAL, names.fromString(name), type, predefClass); c.setData(type.constValue()); predefClass.members().enter(c); return c; }
[ "private", "VarSymbol", "enterConstant", "(", "String", "name", ",", "Type", "type", ")", "{", "VarSymbol", "c", "=", "new", "VarSymbol", "(", "PUBLIC", "|", "STATIC", "|", "FINAL", ",", "names", ".", "fromString", "(", "name", ")", ",", "type", ",", "...
Enter a constant into symbol table. @param name The constant's name. @param type The constant's type.
[ "Enter", "a", "constant", "into", "symbol", "table", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Symtab.java#L233-L242
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Symtab.java
Symtab.enterBinop
private void enterBinop(String name, Type left, Type right, Type res, int opcode) { predefClass.members().enter( new OperatorSymbol( makeOperatorName(name), new MethodType(List.of(left, right), res, List.<Type>nil(), methodClass), opcode, predefClass)); }
java
private void enterBinop(String name, Type left, Type right, Type res, int opcode) { predefClass.members().enter( new OperatorSymbol( makeOperatorName(name), new MethodType(List.of(left, right), res, List.<Type>nil(), methodClass), opcode, predefClass)); }
[ "private", "void", "enterBinop", "(", "String", "name", ",", "Type", "left", ",", "Type", "right", ",", "Type", "res", ",", "int", "opcode", ")", "{", "predefClass", ".", "members", "(", ")", ".", "enter", "(", "new", "OperatorSymbol", "(", "makeOperator...
Enter a binary operation into symbol table. @param name The name of the operator. @param left The type of the left operand. @param right The type of the left operand. @param res The operation's result type. @param opcode The operation's bytecode instruction.
[ "Enter", "a", "binary", "operation", "into", "symbol", "table", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Symtab.java#L251-L261
train
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Symtab.java
Symtab.enterUnop
private OperatorSymbol enterUnop(String name, Type arg, Type res, int opcode) { OperatorSymbol sym = new OperatorSymbol(makeOperatorName(name), new MethodType(List.of(arg), res, List.<Type>nil(), methodClass), opcode, predefClass); predefClass.members().enter(sym); return sym; }
java
private OperatorSymbol enterUnop(String name, Type arg, Type res, int opcode) { OperatorSymbol sym = new OperatorSymbol(makeOperatorName(name), new MethodType(List.of(arg), res, List.<Type>nil(), methodClass), opcode, predefClass); predefClass.members().enter(sym); return sym; }
[ "private", "OperatorSymbol", "enterUnop", "(", "String", "name", ",", "Type", "arg", ",", "Type", "res", ",", "int", "opcode", ")", "{", "OperatorSymbol", "sym", "=", "new", "OperatorSymbol", "(", "makeOperatorName", "(", "name", ")", ",", "new", "MethodType...
Enter a unary operation into symbol table. @param name The name of the operator. @param arg The type of the operand. @param res The operation's result type. @param opcode The operation's bytecode instruction.
[ "Enter", "a", "unary", "operation", "into", "symbol", "table", "." ]
8812d28c20f4de070a0dd6de1b45602431379834
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Symtab.java#L282-L296
train