repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/StatusApi.java | StatusApi.getStatus | public StatusResponse getStatus(String datasource, String ifNoneMatch) throws ApiException {
ApiResponse<StatusResponse> resp = getStatusWithHttpInfo(datasource, ifNoneMatch);
return resp.getData();
} | java | public StatusResponse getStatus(String datasource, String ifNoneMatch) throws ApiException {
ApiResponse<StatusResponse> resp = getStatusWithHttpInfo(datasource, ifNoneMatch);
return resp.getData();
} | [
"public",
"StatusResponse",
"getStatus",
"(",
"String",
"datasource",
",",
"String",
"ifNoneMatch",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"StatusResponse",
">",
"resp",
"=",
"getStatusWithHttpInfo",
"(",
"datasource",
",",
"ifNoneMatch",
")",
";",
... | Retrieve the uptime and player counts EVE Server status --- This route is
cached for up to 30 seconds
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param ifNoneMatch
ETag from a previous request. A 304 will be returned if this
matches the current ETag (optional)
@return StatusResponse
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body | [
"Retrieve",
"the",
"uptime",
"and",
"player",
"counts",
"EVE",
"Server",
"status",
"---",
"This",
"route",
"is",
"cached",
"for",
"up",
"to",
"30",
"seconds"
] | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/StatusApi.java#L129-L132 |
RobotiumTech/robotium | robotium-solo/src/main/java/com/robotium/solo/ViewFetcher.java | ViewFetcher.getRecyclerView | public View getRecyclerView(boolean shouldSleep, int recyclerViewIndex){
Set<View> uniqueViews = new HashSet<View>();
if(shouldSleep){
sleeper.sleep();
}
@SuppressWarnings("unchecked")
ArrayList<View> views = RobotiumUtils.filterViewsToSet(new Class[] {ViewGroup.class}, getAllViews(false));
views = RobotiumUtils.removeInvisibleViews(views);
for(View view : views){
if(isViewType(view.getClass(), "widget.RecyclerView")){
uniqueViews.add(view);
}
if(uniqueViews.size() > recyclerViewIndex) {
return (ViewGroup) view;
}
}
return null;
} | java | public View getRecyclerView(boolean shouldSleep, int recyclerViewIndex){
Set<View> uniqueViews = new HashSet<View>();
if(shouldSleep){
sleeper.sleep();
}
@SuppressWarnings("unchecked")
ArrayList<View> views = RobotiumUtils.filterViewsToSet(new Class[] {ViewGroup.class}, getAllViews(false));
views = RobotiumUtils.removeInvisibleViews(views);
for(View view : views){
if(isViewType(view.getClass(), "widget.RecyclerView")){
uniqueViews.add(view);
}
if(uniqueViews.size() > recyclerViewIndex) {
return (ViewGroup) view;
}
}
return null;
} | [
"public",
"View",
"getRecyclerView",
"(",
"boolean",
"shouldSleep",
",",
"int",
"recyclerViewIndex",
")",
"{",
"Set",
"<",
"View",
">",
"uniqueViews",
"=",
"new",
"HashSet",
"<",
"View",
">",
"(",
")",
";",
"if",
"(",
"shouldSleep",
")",
"{",
"sleeper",
... | Returns a RecyclerView or null if none is found
@param viewList the list to check in
@return a RecyclerView | [
"Returns",
"a",
"RecyclerView",
"or",
"null",
"if",
"none",
"is",
"found"
] | train | https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/ViewFetcher.java#L438-L459 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/configuration/impl/ConfigurationAbstractImpl.java | ConfigurationAbstractImpl.getBoolean | public boolean getBoolean(String key, boolean defaultValue)
{
String tmp = properties.getProperty(key);
if (tmp == null)
{
logger.debug("No value for key \"" + key + "\", using default "
+ defaultValue + ".");
properties.put(key, String.valueOf(defaultValue));
return defaultValue;
}
for (int i = 0; i < trueValues.length; i++)
{
if (tmp.equalsIgnoreCase(trueValues[i]))
{
return true;
}
}
for (int i = 0; i < falseValues.length; i++)
{
if (tmp.equalsIgnoreCase(falseValues[i]))
{
return false;
}
}
logger.warn(
"Value \""
+ tmp
+ "\" is illegal for key \""
+ key
+ "\" (should be a boolean, using default value "
+ defaultValue
+ ")");
return defaultValue;
} | java | public boolean getBoolean(String key, boolean defaultValue)
{
String tmp = properties.getProperty(key);
if (tmp == null)
{
logger.debug("No value for key \"" + key + "\", using default "
+ defaultValue + ".");
properties.put(key, String.valueOf(defaultValue));
return defaultValue;
}
for (int i = 0; i < trueValues.length; i++)
{
if (tmp.equalsIgnoreCase(trueValues[i]))
{
return true;
}
}
for (int i = 0; i < falseValues.length; i++)
{
if (tmp.equalsIgnoreCase(falseValues[i]))
{
return false;
}
}
logger.warn(
"Value \""
+ tmp
+ "\" is illegal for key \""
+ key
+ "\" (should be a boolean, using default value "
+ defaultValue
+ ")");
return defaultValue;
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"tmp",
"=",
"properties",
".",
"getProperty",
"(",
"key",
")",
";",
"if",
"(",
"tmp",
"==",
"null",
")",
"{",
"logger",
".",
"debug",
"(",
"\"N... | Returns the boolean value for the specified key. If no value for this key
is found in the configuration or the value is not an legal boolean
<code>defaultValue</code> is returned.
@see #trueValues
@see #falseValues
@param key the key
@param defaultValue the default Value
@return the value for the key, or <code>defaultValue</code> | [
"Returns",
"the",
"boolean",
"value",
"for",
"the",
"specified",
"key",
".",
"If",
"no",
"value",
"for",
"this",
"key",
"is",
"found",
"in",
"the",
"configuration",
"or",
"the",
"value",
"is",
"not",
"an",
"legal",
"boolean",
"<code",
">",
"defaultValue<",... | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/configuration/impl/ConfigurationAbstractImpl.java#L251-L288 |
tvesalainen/util | util/src/main/java/org/vesalainen/util/InterfaceTracer.java | InterfaceTracer.getTracer | protected static <T> T getTracer(Class<T> intf, InterfaceTracer tracer, T ob)
{
tracer.setAppendable(System.err);
tracer.setObj(ob);
return (T) Proxy.newProxyInstance(
intf.getClassLoader(),
new Class<?>[] {intf},
tracer);
} | java | protected static <T> T getTracer(Class<T> intf, InterfaceTracer tracer, T ob)
{
tracer.setAppendable(System.err);
tracer.setObj(ob);
return (T) Proxy.newProxyInstance(
intf.getClassLoader(),
new Class<?>[] {intf},
tracer);
} | [
"protected",
"static",
"<",
"T",
">",
"T",
"getTracer",
"(",
"Class",
"<",
"T",
">",
"intf",
",",
"InterfaceTracer",
"tracer",
",",
"T",
"ob",
")",
"{",
"tracer",
".",
"setAppendable",
"(",
"System",
".",
"err",
")",
";",
"tracer",
".",
"setObj",
"("... | Creates a tracer for intf. This is meant to be used by subclass.
@param <T>
@param intf Implemented interface
@param ob Class instance for given interface or null
@return | [
"Creates",
"a",
"tracer",
"for",
"intf",
".",
"This",
"is",
"meant",
"to",
"be",
"used",
"by",
"subclass",
"."
] | train | https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/InterfaceTracer.java#L73-L81 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/AddBrownPtoN_F64.java | AddBrownPtoN_F64.setDistortion | public AddBrownPtoN_F64 setDistortion( /**/double[] radial, /**/double t1, /**/double t2) {
params = new RadialTangential_F64(radial, t1, t2);
return this;
} | java | public AddBrownPtoN_F64 setDistortion( /**/double[] radial, /**/double t1, /**/double t2) {
params = new RadialTangential_F64(radial, t1, t2);
return this;
} | [
"public",
"AddBrownPtoN_F64",
"setDistortion",
"(",
"/**/",
"double",
"[",
"]",
"radial",
",",
"/**/",
"double",
"t1",
",",
"/**/",
"double",
"t2",
")",
"{",
"params",
"=",
"new",
"RadialTangential_F64",
"(",
"radial",
",",
"t1",
",",
"t2",
")",
";",
"re... | Specify intrinsic camera parameters
@param radial Radial distortion parameters | [
"Specify",
"intrinsic",
"camera",
"parameters"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/distort/brown/AddBrownPtoN_F64.java#L67-L70 |
bazaarvoice/emodb | common/stash/src/main/java/com/bazaarvoice/emodb/common/stash/StashReader.java | StashReader.getSplits | public List<StashSplit> getSplits(String table)
throws StashNotAvailableException, TableNotStashedException {
ImmutableList.Builder<StashSplit> splitsBuilder = ImmutableList.builder();
Iterator<S3ObjectSummary> objectSummaries = getS3ObjectSummariesForTable(table);
while (objectSummaries.hasNext()) {
S3ObjectSummary objectSummary = objectSummaries.next();
String key = objectSummary.getKey();
// Strip the common root path prefix from the split since it is constant.
splitsBuilder.add(new StashSplit(table, key.substring(_rootPath.length() + 1), objectSummary.getSize()));
}
return splitsBuilder.build();
} | java | public List<StashSplit> getSplits(String table)
throws StashNotAvailableException, TableNotStashedException {
ImmutableList.Builder<StashSplit> splitsBuilder = ImmutableList.builder();
Iterator<S3ObjectSummary> objectSummaries = getS3ObjectSummariesForTable(table);
while (objectSummaries.hasNext()) {
S3ObjectSummary objectSummary = objectSummaries.next();
String key = objectSummary.getKey();
// Strip the common root path prefix from the split since it is constant.
splitsBuilder.add(new StashSplit(table, key.substring(_rootPath.length() + 1), objectSummary.getSize()));
}
return splitsBuilder.build();
} | [
"public",
"List",
"<",
"StashSplit",
">",
"getSplits",
"(",
"String",
"table",
")",
"throws",
"StashNotAvailableException",
",",
"TableNotStashedException",
"{",
"ImmutableList",
".",
"Builder",
"<",
"StashSplit",
">",
"splitsBuilder",
"=",
"ImmutableList",
".",
"bu... | Get the splits for a record stored in stash. Each split corresponds to a file in the Stash table's directory. | [
"Get",
"the",
"splits",
"for",
"a",
"record",
"stored",
"in",
"stash",
".",
"Each",
"split",
"corresponds",
"to",
"a",
"file",
"in",
"the",
"Stash",
"table",
"s",
"directory",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/stash/src/main/java/com/bazaarvoice/emodb/common/stash/StashReader.java#L306-L319 |
netty/netty | common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java | SystemPropertyUtil.getInt | public static int getInt(String key, int def) {
String value = get(key);
if (value == null) {
return def;
}
value = value.trim();
try {
return Integer.parseInt(value);
} catch (Exception e) {
// Ignore
}
logger.warn(
"Unable to parse the integer system property '{}':{} - using the default value: {}",
key, value, def
);
return def;
} | java | public static int getInt(String key, int def) {
String value = get(key);
if (value == null) {
return def;
}
value = value.trim();
try {
return Integer.parseInt(value);
} catch (Exception e) {
// Ignore
}
logger.warn(
"Unable to parse the integer system property '{}':{} - using the default value: {}",
key, value, def
);
return def;
} | [
"public",
"static",
"int",
"getInt",
"(",
"String",
"key",
",",
"int",
"def",
")",
"{",
"String",
"value",
"=",
"get",
"(",
"key",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"def",
";",
"}",
"value",
"=",
"value",
".",
"trim"... | Returns the value of the Java system property with the specified
{@code key}, while falling back to the specified default value if
the property access fails.
@return the property value.
{@code def} if there's no such property or if an access to the
specified property is not allowed. | [
"Returns",
"the",
"value",
"of",
"the",
"Java",
"system",
"property",
"with",
"the",
"specified",
"{",
"@code",
"key",
"}",
"while",
"falling",
"back",
"to",
"the",
"specified",
"default",
"value",
"if",
"the",
"property",
"access",
"fails",
"."
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/SystemPropertyUtil.java#L134-L153 |
google/closure-compiler | src/com/google/javascript/jscomp/graph/Graph.java | Graph.pushAnnotations | private static void pushAnnotations(
Deque<GraphAnnotationState> stack,
Collection<? extends Annotatable> haveAnnotations) {
stack.push(new GraphAnnotationState(haveAnnotations.size()));
for (Annotatable h : haveAnnotations) {
stack.peek().add(new AnnotationState(h, h.getAnnotation()));
h.setAnnotation(null);
}
} | java | private static void pushAnnotations(
Deque<GraphAnnotationState> stack,
Collection<? extends Annotatable> haveAnnotations) {
stack.push(new GraphAnnotationState(haveAnnotations.size()));
for (Annotatable h : haveAnnotations) {
stack.peek().add(new AnnotationState(h, h.getAnnotation()));
h.setAnnotation(null);
}
} | [
"private",
"static",
"void",
"pushAnnotations",
"(",
"Deque",
"<",
"GraphAnnotationState",
">",
"stack",
",",
"Collection",
"<",
"?",
"extends",
"Annotatable",
">",
"haveAnnotations",
")",
"{",
"stack",
".",
"push",
"(",
"new",
"GraphAnnotationState",
"(",
"have... | Pushes a new list on stack and stores nodes annotations in the new list.
Clears objects' annotations as well. | [
"Pushes",
"a",
"new",
"list",
"on",
"stack",
"and",
"stores",
"nodes",
"annotations",
"in",
"the",
"new",
"list",
".",
"Clears",
"objects",
"annotations",
"as",
"well",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/graph/Graph.java#L333-L341 |
betfair/cougar | cougar-framework/cougar-util/src/main/java/com/betfair/cougar/util/configuration/Sets.java | Sets.fromMap | public static final Set fromMap(Map map, Object... keys) {
if (keys != null && map != null) {
Set answer = new HashSet();
for (Object key : keys) {
if (map.containsKey(key)) {
answer.add(map.get(key));
}
}
return Collections.unmodifiableSet(answer);
}
return Collections.EMPTY_SET;
} | java | public static final Set fromMap(Map map, Object... keys) {
if (keys != null && map != null) {
Set answer = new HashSet();
for (Object key : keys) {
if (map.containsKey(key)) {
answer.add(map.get(key));
}
}
return Collections.unmodifiableSet(answer);
}
return Collections.EMPTY_SET;
} | [
"public",
"static",
"final",
"Set",
"fromMap",
"(",
"Map",
"map",
",",
"Object",
"...",
"keys",
")",
"{",
"if",
"(",
"keys",
"!=",
"null",
"&&",
"map",
"!=",
"null",
")",
"{",
"Set",
"answer",
"=",
"new",
"HashSet",
"(",
")",
";",
"for",
"(",
"Ob... | Given a map and a set of keys, return a set containing the values referred-to by the keys.
If the map is null or the keys are null, the EMPTY_SET is returned.
If a passed key does not exist in the map, nothing is added to the set.
However, if the key is present and maps to null, null is added to the set. | [
"Given",
"a",
"map",
"and",
"a",
"set",
"of",
"keys",
"return",
"a",
"set",
"containing",
"the",
"values",
"referred",
"-",
"to",
"by",
"the",
"keys",
".",
"If",
"the",
"map",
"is",
"null",
"or",
"the",
"keys",
"are",
"null",
"the",
"EMPTY_SET",
"is"... | train | https://github.com/betfair/cougar/blob/08d1fe338fbd0e8572a9c2305bb5796402d5b1f5/cougar-framework/cougar-util/src/main/java/com/betfair/cougar/util/configuration/Sets.java#L29-L40 |
lessthanoptimal/BoofCV | main/boofcv-sfm/src/main/java/boofcv/alg/sfm/DepthSparse3D.java | DepthSparse3D.process | public boolean process( int x , int y ) {
visualToDepth.compute(x, y,distorted);
int depthX = (int)distorted.x;
int depthY = (int)distorted.y;
if( depthImage.isInBounds(depthX,depthY) ) {
// get the depth at the specified location
double value = lookupDepth(depthX, depthY);
// see if its an invalid value
if( value == 0 )
return false;
// convert visual pixel into normalized image coordinate
p2n.compute(x,y,norm);
// project into 3D space
worldPt.z = value*depthScale;
worldPt.x = worldPt.z*norm.x;
worldPt.y = worldPt.z*norm.y;
return true;
} else {
return false;
}
} | java | public boolean process( int x , int y ) {
visualToDepth.compute(x, y,distorted);
int depthX = (int)distorted.x;
int depthY = (int)distorted.y;
if( depthImage.isInBounds(depthX,depthY) ) {
// get the depth at the specified location
double value = lookupDepth(depthX, depthY);
// see if its an invalid value
if( value == 0 )
return false;
// convert visual pixel into normalized image coordinate
p2n.compute(x,y,norm);
// project into 3D space
worldPt.z = value*depthScale;
worldPt.x = worldPt.z*norm.x;
worldPt.y = worldPt.z*norm.y;
return true;
} else {
return false;
}
} | [
"public",
"boolean",
"process",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"visualToDepth",
".",
"compute",
"(",
"x",
",",
"y",
",",
"distorted",
")",
";",
"int",
"depthX",
"=",
"(",
"int",
")",
"distorted",
".",
"x",
";",
"int",
"depthY",
"=",
... | Given a pixel coordinate in the visual camera, compute the 3D coordinate of that point.
@param x x-coordinate of point in visual camera
@param y y-coordinate of point in visual camera
@return true if a 3D point could be computed and false if not | [
"Given",
"a",
"pixel",
"coordinate",
"in",
"the",
"visual",
"camera",
"compute",
"the",
"3D",
"coordinate",
"of",
"that",
"point",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/DepthSparse3D.java#L101-L127 |
code4everything/util | src/main/java/com/zhazhapan/util/Calculator.java | Calculator.calculate | public static BigDecimal calculate(String formula) throws Exception {
formula = formula.replaceAll("\\s", "");
if (isFormula(formula)) {
return doCalculate(formula);
} else {
throw new Exception("calculation formula is not valid, please check up on it carefully.");
}
} | java | public static BigDecimal calculate(String formula) throws Exception {
formula = formula.replaceAll("\\s", "");
if (isFormula(formula)) {
return doCalculate(formula);
} else {
throw new Exception("calculation formula is not valid, please check up on it carefully.");
}
} | [
"public",
"static",
"BigDecimal",
"calculate",
"(",
"String",
"formula",
")",
"throws",
"Exception",
"{",
"formula",
"=",
"formula",
".",
"replaceAll",
"(",
"\"\\\\s\"",
",",
"\"\"",
")",
";",
"if",
"(",
"isFormula",
"(",
"formula",
")",
")",
"{",
"return"... | 连续计算,使用默认精度(100)
@param formula 表达式
@return {@link BigDecimal}
@throws Exception 异常 | [
"连续计算,使用默认精度(100)"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Calculator.java#L40-L47 |
dbracewell/mango | src/main/java/com/davidbracewell/json/JsonReader.java | JsonReader.beginArray | public String beginArray() throws IOException {
String name = null;
if (currentValue.getKey() == NAME) {
name = currentValue.getValue().asString();
consume();
}
if (currentValue.getKey() == BEGIN_ARRAY) {
consume();
} else if (readStack.peek() != BEGIN_ARRAY) {
throw new IOException("Expecting BEGIN_ARRAY, but found " + jsonTokenToStructuredElement(null));
}
return name;
} | java | public String beginArray() throws IOException {
String name = null;
if (currentValue.getKey() == NAME) {
name = currentValue.getValue().asString();
consume();
}
if (currentValue.getKey() == BEGIN_ARRAY) {
consume();
} else if (readStack.peek() != BEGIN_ARRAY) {
throw new IOException("Expecting BEGIN_ARRAY, but found " + jsonTokenToStructuredElement(null));
}
return name;
} | [
"public",
"String",
"beginArray",
"(",
")",
"throws",
"IOException",
"{",
"String",
"name",
"=",
"null",
";",
"if",
"(",
"currentValue",
".",
"getKey",
"(",
")",
"==",
"NAME",
")",
"{",
"name",
"=",
"currentValue",
".",
"getValue",
"(",
")",
".",
"asSt... | Begins an Array
@return This array's name
@throws IOException Something went wrong reading | [
"Begins",
"an",
"Array"
] | train | https://github.com/dbracewell/mango/blob/2cec08826f1fccd658694dd03abce10fc97618ec/src/main/java/com/davidbracewell/json/JsonReader.java#L89-L101 |
pip-services3-java/pip-services3-commons-java | src/org/pipservices3/commons/validate/Schema.java | Schema.validateAndThrowException | public void validateAndThrowException(String correlationId, Object value) throws ValidationException {
validateAndThrowException(correlationId, value, false);
} | java | public void validateAndThrowException(String correlationId, Object value) throws ValidationException {
validateAndThrowException(correlationId, value, false);
} | [
"public",
"void",
"validateAndThrowException",
"(",
"String",
"correlationId",
",",
"Object",
"value",
")",
"throws",
"ValidationException",
"{",
"validateAndThrowException",
"(",
"correlationId",
",",
"value",
",",
"false",
")",
";",
"}"
] | Validates the given value and throws a ValidationException if errors were
found.
@param correlationId (optional) transaction id to trace execution through
call chain.
@param value a value to be validated.
@throws ValidationException when errors occured in validation
@see ValidationException#throwExceptionIfNeeded(String, List, boolean) | [
"Validates",
"the",
"given",
"value",
"and",
"throws",
"a",
"ValidationException",
"if",
"errors",
"were",
"found",
"."
] | train | https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/validate/Schema.java#L232-L234 |
authlete/authlete-java-common | src/main/java/com/authlete/common/util/TypedProperties.java | TypedProperties.getEnum | public <TEnum extends Enum<TEnum>> TEnum getEnum(Enum<?> key, Class<TEnum> enumClass, TEnum defaultValue)
{
if (key == null)
{
return defaultValue;
}
return getEnum(key.name(), enumClass, defaultValue);
} | java | public <TEnum extends Enum<TEnum>> TEnum getEnum(Enum<?> key, Class<TEnum> enumClass, TEnum defaultValue)
{
if (key == null)
{
return defaultValue;
}
return getEnum(key.name(), enumClass, defaultValue);
} | [
"public",
"<",
"TEnum",
"extends",
"Enum",
"<",
"TEnum",
">",
">",
"TEnum",
"getEnum",
"(",
"Enum",
"<",
"?",
">",
"key",
",",
"Class",
"<",
"TEnum",
">",
"enumClass",
",",
"TEnum",
"defaultValue",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"{"... | Equivalent to {@link #getEnum(String, Class, Enum)
getEnum}{@code (key.name(), enumClass, defaultValue)}.
If {@code key} is null, {@code defaultValue} is returned. | [
"Equivalent",
"to",
"{"
] | train | https://github.com/authlete/authlete-java-common/blob/49c94c483713cbf5a04d805ff7dbd83766c9c964/src/main/java/com/authlete/common/util/TypedProperties.java#L424-L432 |
playn/playn | core/src/playn/core/json/JsonObject.java | JsonObject.getBoolean | public boolean getBoolean(String key, boolean default_) {
Object o = get(key);
return o instanceof Boolean ? (Boolean) o : default_;
} | java | public boolean getBoolean(String key, boolean default_) {
Object o = get(key);
return o instanceof Boolean ? (Boolean) o : default_;
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"key",
",",
"boolean",
"default_",
")",
"{",
"Object",
"o",
"=",
"get",
"(",
"key",
")",
";",
"return",
"o",
"instanceof",
"Boolean",
"?",
"(",
"Boolean",
")",
"o",
":",
"default_",
";",
"}"
] | Returns the {@link Boolean} at the given key, or the default if it does not exist or is the
wrong type. | [
"Returns",
"the",
"{"
] | train | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonObject.java#L75-L78 |
opentok/Opentok-Java-SDK | src/main/java/com/opentok/OpenTok.java | OpenTok.getStream | public Stream getStream(String sessionId, String streamId) throws OpenTokException {
String stream = this.client.getStream(sessionId, streamId);
try {
return streamReader.readValue(stream);
} catch (Exception e) {
throw new RequestException("Exception mapping json: " + e.getMessage());
}
} | java | public Stream getStream(String sessionId, String streamId) throws OpenTokException {
String stream = this.client.getStream(sessionId, streamId);
try {
return streamReader.readValue(stream);
} catch (Exception e) {
throw new RequestException("Exception mapping json: " + e.getMessage());
}
} | [
"public",
"Stream",
"getStream",
"(",
"String",
"sessionId",
",",
"String",
"streamId",
")",
"throws",
"OpenTokException",
"{",
"String",
"stream",
"=",
"this",
".",
"client",
".",
"getStream",
"(",
"sessionId",
",",
"streamId",
")",
";",
"try",
"{",
"return... | Gets an {@link Stream} object for the given sessionId and streamId.
@param sessionId The session ID.
@param streamId The stream ID.
@return The {@link Stream} object. | [
"Gets",
"an",
"{",
"@link",
"Stream",
"}",
"object",
"for",
"the",
"given",
"sessionId",
"and",
"streamId",
"."
] | train | https://github.com/opentok/Opentok-Java-SDK/blob/d71b7999facc3131c415aebea874ea55776d477f/src/main/java/com/opentok/OpenTok.java#L654-L661 |
likethecolor/Alchemy-API | src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java | AbstractParser.hasKey | protected boolean hasKey(final String key, final JSONObject jsonObject) {
return jsonObject != null
&& jsonObject.has(key);
} | java | protected boolean hasKey(final String key, final JSONObject jsonObject) {
return jsonObject != null
&& jsonObject.has(key);
} | [
"protected",
"boolean",
"hasKey",
"(",
"final",
"String",
"key",
",",
"final",
"JSONObject",
"jsonObject",
")",
"{",
"return",
"jsonObject",
"!=",
"null",
"&&",
"jsonObject",
".",
"has",
"(",
"key",
")",
";",
"}"
] | Does the JSONObject have a specified key?
@param key key to check
@param jsonObject object to check
@return true if the key exists | [
"Does",
"the",
"JSONObject",
"have",
"a",
"specified",
"key?"
] | train | https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/parser/json/AbstractParser.java#L340-L343 |
cloudendpoints/endpoints-management-java | endpoints-control/src/main/java/com/google/api/control/model/ResourceName.java | ResourceName.createFromFullName | @Nullable
public static ResourceName createFromFullName(PathTemplate template, String path) {
ImmutableMap<String, String> values = template.matchFromFullName(path);
if (values == null) {
return null;
}
return new ResourceName(template, values, null);
} | java | @Nullable
public static ResourceName createFromFullName(PathTemplate template, String path) {
ImmutableMap<String, String> values = template.matchFromFullName(path);
if (values == null) {
return null;
}
return new ResourceName(template, values, null);
} | [
"@",
"Nullable",
"public",
"static",
"ResourceName",
"createFromFullName",
"(",
"PathTemplate",
"template",
",",
"String",
"path",
")",
"{",
"ImmutableMap",
"<",
"String",
",",
"String",
">",
"values",
"=",
"template",
".",
"matchFromFullName",
"(",
"path",
")",... | Creates a new resource name based on given template and path, where the path contains an
endpoint. If the path does not match, null is returned. | [
"Creates",
"a",
"new",
"resource",
"name",
"based",
"on",
"given",
"template",
"and",
"path",
"where",
"the",
"path",
"contains",
"an",
"endpoint",
".",
"If",
"the",
"path",
"does",
"not",
"match",
"null",
"is",
"returned",
"."
] | train | https://github.com/cloudendpoints/endpoints-management-java/blob/5bbf20ddadbbd51b890049e3c338c28abe2c9f94/endpoints-control/src/main/java/com/google/api/control/model/ResourceName.java#L123-L130 |
apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java | Calcites.jodaToCalciteDate | public static int jodaToCalciteDate(final DateTime dateTime, final DateTimeZone timeZone)
{
final DateTime date = dateTime.withZone(timeZone).dayOfMonth().roundFloorCopy();
return Days.daysBetween(DateTimes.EPOCH, date.withZoneRetainFields(DateTimeZone.UTC)).getDays();
} | java | public static int jodaToCalciteDate(final DateTime dateTime, final DateTimeZone timeZone)
{
final DateTime date = dateTime.withZone(timeZone).dayOfMonth().roundFloorCopy();
return Days.daysBetween(DateTimes.EPOCH, date.withZoneRetainFields(DateTimeZone.UTC)).getDays();
} | [
"public",
"static",
"int",
"jodaToCalciteDate",
"(",
"final",
"DateTime",
"dateTime",
",",
"final",
"DateTimeZone",
"timeZone",
")",
"{",
"final",
"DateTime",
"date",
"=",
"dateTime",
".",
"withZone",
"(",
"timeZone",
")",
".",
"dayOfMonth",
"(",
")",
".",
"... | Calcite expects "DATE" types to be number of days from the epoch to the UTC date matching the local time fields.
@param dateTime joda timestamp
@param timeZone session time zone
@return Calcite style date | [
"Calcite",
"expects",
"DATE",
"types",
"to",
"be",
"number",
"of",
"days",
"from",
"the",
"epoch",
"to",
"the",
"UTC",
"date",
"matching",
"the",
"local",
"time",
"fields",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java#L237-L241 |
gmessner/gitlab4j-api | src/main/java/org/gitlab4j/api/NotesApi.java | NotesApi.createIssueNote | public Note createIssueNote(Object projectIdOrPath, Integer issueIid, String body) throws GitLabApiException {
return (createIssueNote(projectIdOrPath, issueIid, body, null));
} | java | public Note createIssueNote(Object projectIdOrPath, Integer issueIid, String body) throws GitLabApiException {
return (createIssueNote(projectIdOrPath, issueIid, body, null));
} | [
"public",
"Note",
"createIssueNote",
"(",
"Object",
"projectIdOrPath",
",",
"Integer",
"issueIid",
",",
"String",
"body",
")",
"throws",
"GitLabApiException",
"{",
"return",
"(",
"createIssueNote",
"(",
"projectIdOrPath",
",",
"issueIid",
",",
"body",
",",
"null",... | Create a issues's note.
@param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param projectIdOrPath the project ID to create the issues for
@param issueIid the issue IID to create the notes for
@param body the content of note
@return the created Note instance
@throws GitLabApiException if any exception occurs | [
"Create",
"a",
"issues",
"s",
"note",
"."
] | train | https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L154-L156 |
davidmoten/grumpy | grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java | Position.getLatitudeOnGreatCircle | public Double getLatitudeOnGreatCircle(Position position, double longitudeDegrees) {
double lonR = toRadians(longitudeDegrees);
double lat1R = toRadians(lat);
double lon1R = toRadians(lon);
double lat2R = toRadians(position.getLat());
double lon2R = toRadians(position.getLon());
double sinDiffLon1RLon2R = sin(lon1R - lon2R);
if (abs(sinDiffLon1RLon2R) < 0.00000001) {
return null;
} else {
double cosLat1R = cos(lat1R);
double cosLat2R = cos(lat2R);
double numerator = sin(lat1R) * cosLat2R * sin(lonR - lon2R) - sin(lat2R) * cosLat1R
* sin(lonR - lon1R);
double denominator = cosLat1R * cosLat2R * sinDiffLon1RLon2R;
double radians = atan(numerator / denominator);
return FastMath.toDegrees(radians);
}
} | java | public Double getLatitudeOnGreatCircle(Position position, double longitudeDegrees) {
double lonR = toRadians(longitudeDegrees);
double lat1R = toRadians(lat);
double lon1R = toRadians(lon);
double lat2R = toRadians(position.getLat());
double lon2R = toRadians(position.getLon());
double sinDiffLon1RLon2R = sin(lon1R - lon2R);
if (abs(sinDiffLon1RLon2R) < 0.00000001) {
return null;
} else {
double cosLat1R = cos(lat1R);
double cosLat2R = cos(lat2R);
double numerator = sin(lat1R) * cosLat2R * sin(lonR - lon2R) - sin(lat2R) * cosLat1R
* sin(lonR - lon1R);
double denominator = cosLat1R * cosLat2R * sinDiffLon1RLon2R;
double radians = atan(numerator / denominator);
return FastMath.toDegrees(radians);
}
} | [
"public",
"Double",
"getLatitudeOnGreatCircle",
"(",
"Position",
"position",
",",
"double",
"longitudeDegrees",
")",
"{",
"double",
"lonR",
"=",
"toRadians",
"(",
"longitudeDegrees",
")",
";",
"double",
"lat1R",
"=",
"toRadians",
"(",
"lat",
")",
";",
"double",
... | From http://williams.best.vwh.net/avform.htm (Latitude of point on GC).
@param position
@param longitudeDegrees
@return | [
"From",
"http",
":",
"//",
"williams",
".",
"best",
".",
"vwh",
".",
"net",
"/",
"avform",
".",
"htm",
"(",
"Latitude",
"of",
"point",
"on",
"GC",
")",
"."
] | train | https://github.com/davidmoten/grumpy/blob/f2d03e6b9771f15425fb3f76314837efc08c1233/grumpy-core/src/main/java/com/github/davidmoten/grumpy/core/Position.java#L128-L147 |
infinispan/infinispan | core/src/main/java/org/infinispan/affinity/KeyAffinityServiceFactory.java | KeyAffinityServiceFactory.newLocalKeyAffinityService | public static <K, V> KeyAffinityService<K> newLocalKeyAffinityService(Cache<K, V> cache, KeyGenerator<K> keyGenerator, Executor ex, int keyBufferSize, boolean start) {
Address localAddress = cache.getAdvancedCache().getRpcManager().getTransport().getAddress();
Collection<Address> forAddresses = Collections.singletonList(localAddress);
return newKeyAffinityService(cache, forAddresses, keyGenerator, ex, keyBufferSize, start);
} | java | public static <K, V> KeyAffinityService<K> newLocalKeyAffinityService(Cache<K, V> cache, KeyGenerator<K> keyGenerator, Executor ex, int keyBufferSize, boolean start) {
Address localAddress = cache.getAdvancedCache().getRpcManager().getTransport().getAddress();
Collection<Address> forAddresses = Collections.singletonList(localAddress);
return newKeyAffinityService(cache, forAddresses, keyGenerator, ex, keyBufferSize, start);
} | [
"public",
"static",
"<",
"K",
",",
"V",
">",
"KeyAffinityService",
"<",
"K",
">",
"newLocalKeyAffinityService",
"(",
"Cache",
"<",
"K",
",",
"V",
">",
"cache",
",",
"KeyGenerator",
"<",
"K",
">",
"keyGenerator",
",",
"Executor",
"ex",
",",
"int",
"keyBuf... | Created an service that only generates keys for the local address. | [
"Created",
"an",
"service",
"that",
"only",
"generates",
"keys",
"for",
"the",
"local",
"address",
"."
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/affinity/KeyAffinityServiceFactory.java#L73-L77 |
OpenLiberty/open-liberty | dev/com.ibm.websphere.javaee.jsf.2.3/src/javax/faces/application/Application.java | Application.evaluateExpressionGet | public <T> T evaluateExpressionGet(FacesContext context, String expression, Class<? extends T> expectedType)
throws ELException
{
Application application = getMyfacesApplicationInstance(context);
if (application != null)
{
return application.evaluateExpressionGet(context, expression, expectedType);
}
throw new UnsupportedOperationException();
} | java | public <T> T evaluateExpressionGet(FacesContext context, String expression, Class<? extends T> expectedType)
throws ELException
{
Application application = getMyfacesApplicationInstance(context);
if (application != null)
{
return application.evaluateExpressionGet(context, expression, expectedType);
}
throw new UnsupportedOperationException();
} | [
"public",
"<",
"T",
">",
"T",
"evaluateExpressionGet",
"(",
"FacesContext",
"context",
",",
"String",
"expression",
",",
"Class",
"<",
"?",
"extends",
"T",
">",
"expectedType",
")",
"throws",
"ELException",
"{",
"Application",
"application",
"=",
"getMyfacesAppl... | <p>
Get a value by evaluating an expression.
</p>
<p>
Call <code>{@link #getExpressionFactory()}</code> then call
<code>ExpressionFactory.createValueExpression(javax.el.ELContext, java.lang.String, java.lang.Class)</code>
passing the argument <code>expression</code> and <code>expectedType</code>. Call
<code>{@link FacesContext#getELContext()}</code> and pass it to
<code>ValueExpression.getValue(javax.el.ELContext)</code>, returning the result.
</p>
<p>
An implementation is provided that throws <code>UnsupportedOperationException</code> so that users that decorate
the <code>Application</code> continue to work.
<p>
@throws javax.el.ELException | [
"<p",
">",
"Get",
"a",
"value",
"by",
"evaluating",
"an",
"expression",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.3/src/javax/faces/application/Application.java#L531-L540 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WImageEditorRenderer.java | WImageEditorRenderer.doRender | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WImageEditor editorComponent = (WImageEditor) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("wc-imageedit");
xml.appendAttribute("id", editorComponent.getId());
xml.appendOptionalAttribute("class", editorComponent.getHtmlClass());
xml.appendOptionalUrlAttribute("overlay", editorComponent.getOverlayUrl());
xml.appendOptionalAttribute("camera", editorComponent.getUseCamera());
xml.appendOptionalAttribute("face", editorComponent.getIsFace());
xml.appendOptionalAttribute("inline", editorComponent.getRenderInline());
// Check for size information on the image
Dimension size = editorComponent.getSize();
if (size != null) {
if (size.getHeight() >= 0) {
xml.appendAttribute("height", size.height);
}
if (size.getWidth() >= 0) {
xml.appendAttribute("width", size.width);
}
}
xml.appendEnd();
} | java | @Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WImageEditor editorComponent = (WImageEditor) component;
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("wc-imageedit");
xml.appendAttribute("id", editorComponent.getId());
xml.appendOptionalAttribute("class", editorComponent.getHtmlClass());
xml.appendOptionalUrlAttribute("overlay", editorComponent.getOverlayUrl());
xml.appendOptionalAttribute("camera", editorComponent.getUseCamera());
xml.appendOptionalAttribute("face", editorComponent.getIsFace());
xml.appendOptionalAttribute("inline", editorComponent.getRenderInline());
// Check for size information on the image
Dimension size = editorComponent.getSize();
if (size != null) {
if (size.getHeight() >= 0) {
xml.appendAttribute("height", size.height);
}
if (size.getWidth() >= 0) {
xml.appendAttribute("width", size.width);
}
}
xml.appendEnd();
} | [
"@",
"Override",
"public",
"void",
"doRender",
"(",
"final",
"WComponent",
"component",
",",
"final",
"WebXmlRenderContext",
"renderContext",
")",
"{",
"WImageEditor",
"editorComponent",
"=",
"(",
"WImageEditor",
")",
"component",
";",
"XmlStringBuilder",
"xml",
"="... | Paints the given {@link WImageEditor}.
@param component the WImageEditor to paint.
@param renderContext the RenderContext to paint to. | [
"Paints",
"the",
"given",
"{",
"@link",
"WImageEditor",
"}",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WImageEditorRenderer.java#L24-L50 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java | ModelsImpl.deletePatternAnyEntityRoleAsync | public Observable<OperationStatus> deletePatternAnyEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) {
return deletePatternAnyEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | java | public Observable<OperationStatus> deletePatternAnyEntityRoleAsync(UUID appId, String versionId, UUID entityId, UUID roleId) {
return deletePatternAnyEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).map(new Func1<ServiceResponse<OperationStatus>, OperationStatus>() {
@Override
public OperationStatus call(ServiceResponse<OperationStatus> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatus",
">",
"deletePatternAnyEntityRoleAsync",
"(",
"UUID",
"appId",
",",
"String",
"versionId",
",",
"UUID",
"entityId",
",",
"UUID",
"roleId",
")",
"{",
"return",
"deletePatternAnyEntityRoleWithServiceResponseAsync",
"(",
"appI... | Delete an entity role.
@param appId The application ID.
@param versionId The version ID.
@param entityId The entity ID.
@param roleId The entity role Id.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatus object | [
"Delete",
"an",
"entity",
"role",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L13091-L13098 |
khuxtable/seaglass | src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java | TabbedPaneTabCloseButtonPainter.drawOverlayGraphic | private void drawOverlayGraphic(Graphics2D g, int width, int height) {
Shape s = shapeGenerator.createTabCloseIcon(2, 2, width - 4, height - 4);
g.setPaint(graphicBase);
g.fill(s);
s = shapeGenerator.createTabCloseIcon(2, 3, width - 4, height - 4);
g.setPaint(createGraphicDropShadowGradient(s));
Shape oldClip = g.getClip();
g.setClip(2, 3, width - 4, height - 4);
g.fill(s);
g.setClip(oldClip);
} | java | private void drawOverlayGraphic(Graphics2D g, int width, int height) {
Shape s = shapeGenerator.createTabCloseIcon(2, 2, width - 4, height - 4);
g.setPaint(graphicBase);
g.fill(s);
s = shapeGenerator.createTabCloseIcon(2, 3, width - 4, height - 4);
g.setPaint(createGraphicDropShadowGradient(s));
Shape oldClip = g.getClip();
g.setClip(2, 3, width - 4, height - 4);
g.fill(s);
g.setClip(oldClip);
} | [
"private",
"void",
"drawOverlayGraphic",
"(",
"Graphics2D",
"g",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"Shape",
"s",
"=",
"shapeGenerator",
".",
"createTabCloseIcon",
"(",
"2",
",",
"2",
",",
"width",
"-",
"4",
",",
"height",
"-",
"4",
"... | Draw the "close" graphic for a state where it overlays a border.
@param g the Graphic context.
@param width the width of the graphic.
@param height the height of the graphic. | [
"Draw",
"the",
"close",
"graphic",
"for",
"a",
"state",
"where",
"it",
"overlays",
"a",
"border",
"."
] | train | https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/TabbedPaneTabCloseButtonPainter.java#L154-L167 |
Minecrell/TerminalConsoleAppender | src/main/java/net/minecrell/terminalconsole/TerminalConsoleAppender.java | TerminalConsoleAppender.createAppender | @PluginFactory
public static TerminalConsoleAppender createAppender(
@Required(message = "No name provided for TerminalConsoleAppender") @PluginAttribute("name") String name,
@PluginElement("Filter") Filter filter,
@PluginElement("Layout") @Nullable Layout<? extends Serializable> layout,
@PluginAttribute(value = "ignoreExceptions", defaultBoolean = true) boolean ignoreExceptions) {
if (layout == null) {
layout = PatternLayout.createDefaultLayout();
}
return new TerminalConsoleAppender(name, filter, layout, ignoreExceptions);
} | java | @PluginFactory
public static TerminalConsoleAppender createAppender(
@Required(message = "No name provided for TerminalConsoleAppender") @PluginAttribute("name") String name,
@PluginElement("Filter") Filter filter,
@PluginElement("Layout") @Nullable Layout<? extends Serializable> layout,
@PluginAttribute(value = "ignoreExceptions", defaultBoolean = true) boolean ignoreExceptions) {
if (layout == null) {
layout = PatternLayout.createDefaultLayout();
}
return new TerminalConsoleAppender(name, filter, layout, ignoreExceptions);
} | [
"@",
"PluginFactory",
"public",
"static",
"TerminalConsoleAppender",
"createAppender",
"(",
"@",
"Required",
"(",
"message",
"=",
"\"No name provided for TerminalConsoleAppender\"",
")",
"@",
"PluginAttribute",
"(",
"\"name\"",
")",
"String",
"name",
",",
"@",
"PluginEl... | Creates a new {@link TerminalConsoleAppender}.
@param name The name of the appender
@param filter The filter, can be {@code null}
@param layout The layout, can be {@code null}
@param ignoreExceptions If {@code true} exceptions encountered when
appending events are logged, otherwise they are propagated to the
caller
@return The new appender | [
"Creates",
"a",
"new",
"{",
"@link",
"TerminalConsoleAppender",
"}",
"."
] | train | https://github.com/Minecrell/TerminalConsoleAppender/blob/a540454b397ee488993019fbcacc49b2d88f1752/src/main/java/net/minecrell/terminalconsole/TerminalConsoleAppender.java#L304-L316 |
baratine/baratine | web/src/main/java/com/caucho/v5/http/protocol2/OutResponseHttp2.java | OutResponseHttp2.flush | @Override
protected void flush(Buffer data, boolean isEnd)
{
if (isClosed()) {
throw new IllegalStateException();
}
_request.outProxy().write(_request, data, isEnd);
/*
boolean isHeader = ! isCommitted();
toCommitted();
MessageResponseHttp2 message;
TempBuffer next = head;
TempBuffer tBuf = null;
if (head != null) {
int headLength = head.length();
if (headLength > 0) {
tBuf = head;
next = TempBuffer.allocate();
}
}
message = new MessageResponseHttp2(_request, tBuf, isHeader, isEnd);
_request.getOutHttp().offer(message);
return next;
*/
} | java | @Override
protected void flush(Buffer data, boolean isEnd)
{
if (isClosed()) {
throw new IllegalStateException();
}
_request.outProxy().write(_request, data, isEnd);
/*
boolean isHeader = ! isCommitted();
toCommitted();
MessageResponseHttp2 message;
TempBuffer next = head;
TempBuffer tBuf = null;
if (head != null) {
int headLength = head.length();
if (headLength > 0) {
tBuf = head;
next = TempBuffer.allocate();
}
}
message = new MessageResponseHttp2(_request, tBuf, isHeader, isEnd);
_request.getOutHttp().offer(message);
return next;
*/
} | [
"@",
"Override",
"protected",
"void",
"flush",
"(",
"Buffer",
"data",
",",
"boolean",
"isEnd",
")",
"{",
"if",
"(",
"isClosed",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"_request",
".",
"outProxy",
"(",
")",
".",... | Writes data to the output. If the headers have not been written,
they should be written. | [
"Writes",
"data",
"to",
"the",
"output",
".",
"If",
"the",
"headers",
"have",
"not",
"been",
"written",
"they",
"should",
"be",
"written",
"."
] | train | https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol2/OutResponseHttp2.java#L79-L112 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceClient.java | OsLoginServiceClient.updateSshPublicKey | public final SshPublicKey updateSshPublicKey(String name, SshPublicKey sshPublicKey) {
UpdateSshPublicKeyRequest request =
UpdateSshPublicKeyRequest.newBuilder().setName(name).setSshPublicKey(sshPublicKey).build();
return updateSshPublicKey(request);
} | java | public final SshPublicKey updateSshPublicKey(String name, SshPublicKey sshPublicKey) {
UpdateSshPublicKeyRequest request =
UpdateSshPublicKeyRequest.newBuilder().setName(name).setSshPublicKey(sshPublicKey).build();
return updateSshPublicKey(request);
} | [
"public",
"final",
"SshPublicKey",
"updateSshPublicKey",
"(",
"String",
"name",
",",
"SshPublicKey",
"sshPublicKey",
")",
"{",
"UpdateSshPublicKeyRequest",
"request",
"=",
"UpdateSshPublicKeyRequest",
".",
"newBuilder",
"(",
")",
".",
"setName",
"(",
"name",
")",
".... | Updates an SSH public key and returns the profile information. This method supports patch
semantics.
<p>Sample code:
<pre><code>
try (OsLoginServiceClient osLoginServiceClient = OsLoginServiceClient.create()) {
FingerprintName name = FingerprintName.of("[USER]", "[FINGERPRINT]");
SshPublicKey sshPublicKey = SshPublicKey.newBuilder().build();
SshPublicKey response = osLoginServiceClient.updateSshPublicKey(name.toString(), sshPublicKey);
}
</code></pre>
@param name The fingerprint of the public key to update. Public keys are identified by their
SHA-256 fingerprint. The fingerprint of the public key is in format
`users/{user}/sshPublicKeys/{fingerprint}`.
@param sshPublicKey The SSH public key and expiration time.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Updates",
"an",
"SSH",
"public",
"key",
"and",
"returns",
"the",
"profile",
"information",
".",
"This",
"method",
"supports",
"patch",
"semantics",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-os-login/src/main/java/com/google/cloud/oslogin/v1/OsLoginServiceClient.java#L765-L770 |
lessthanoptimal/ejml | main/ejml-dsparse/src/org/ejml/sparse/csc/RandomMatrices_DSCC.java | RandomMatrices_DSCC.symmetricPosDef | public static DMatrixSparseCSC symmetricPosDef( int width , int nz_total , Random rand ) {
DMatrixSparseCSC A = rectangle(width,width,nz_total,rand);
// to ensure it's SPD assign non-zero values to all the diagonal elements
for (int i = 0; i < width; i++) {
A.set(i,i,Math.max(0.5,rand.nextDouble()));
}
DMatrixSparseCSC spd = new DMatrixSparseCSC(width,width,0);
CommonOps_DSCC.multTransB(A,A,spd,null,null);
return spd;
} | java | public static DMatrixSparseCSC symmetricPosDef( int width , int nz_total , Random rand ) {
DMatrixSparseCSC A = rectangle(width,width,nz_total,rand);
// to ensure it's SPD assign non-zero values to all the diagonal elements
for (int i = 0; i < width; i++) {
A.set(i,i,Math.max(0.5,rand.nextDouble()));
}
DMatrixSparseCSC spd = new DMatrixSparseCSC(width,width,0);
CommonOps_DSCC.multTransB(A,A,spd,null,null);
return spd;
} | [
"public",
"static",
"DMatrixSparseCSC",
"symmetricPosDef",
"(",
"int",
"width",
",",
"int",
"nz_total",
",",
"Random",
"rand",
")",
"{",
"DMatrixSparseCSC",
"A",
"=",
"rectangle",
"(",
"width",
",",
"width",
",",
"nz_total",
",",
"rand",
")",
";",
"// to ens... | Creates a random symmetric positive definite matrix.
@param width number of columns and rows
@param nz_total Used to adjust number of non-zero values. Exact amount in final matrix will be more than this.
@param rand random number generator
@return Random matrix | [
"Creates",
"a",
"random",
"symmetric",
"positive",
"definite",
"matrix",
"."
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/RandomMatrices_DSCC.java#L253-L266 |
zutnop/telekom-workflow-engine | telekom-workflow-engine/src/main/java/ee/telekom/workflow/graph/el/ElUtil.java | ElUtil.initNewELProcessor | public static ELProcessor initNewELProcessor( Environment environment, Long externalInstanceId ){
ELProcessor processor = new ELProcessor();
processor.getELManager().addBeanNameResolver( new EnvironmentBeanNameResolver( environment ) );
processor.setValue( ReservedVariables.NOW, new Date() );
processor.setValue( ReservedVariables.WORKFLOW_INSTANCE_ID, externalInstanceId );
return processor;
} | java | public static ELProcessor initNewELProcessor( Environment environment, Long externalInstanceId ){
ELProcessor processor = new ELProcessor();
processor.getELManager().addBeanNameResolver( new EnvironmentBeanNameResolver( environment ) );
processor.setValue( ReservedVariables.NOW, new Date() );
processor.setValue( ReservedVariables.WORKFLOW_INSTANCE_ID, externalInstanceId );
return processor;
} | [
"public",
"static",
"ELProcessor",
"initNewELProcessor",
"(",
"Environment",
"environment",
",",
"Long",
"externalInstanceId",
")",
"{",
"ELProcessor",
"processor",
"=",
"new",
"ELProcessor",
"(",
")",
";",
"processor",
".",
"getELManager",
"(",
")",
".",
"addBean... | Creates and prepares a new ELProcessor instance with workflow engine configuration to evaluate expressions on
workflow instance environment together with some additional features (NOW variable, WORKFLOW_INSTANCE_ID variable).
The ELProcessor instance is meant to be used "quickly" only for current task execution/evaluation and should be discarded after that. | [
"Creates",
"and",
"prepares",
"a",
"new",
"ELProcessor",
"instance",
"with",
"workflow",
"engine",
"configuration",
"to",
"evaluate",
"expressions",
"on",
"workflow",
"instance",
"environment",
"together",
"with",
"some",
"additional",
"features",
"(",
"NOW",
"varia... | train | https://github.com/zutnop/telekom-workflow-engine/blob/f471f1f94013b3e2d56b4c9380e86e3a92c2ee29/telekom-workflow-engine/src/main/java/ee/telekom/workflow/graph/el/ElUtil.java#L43-L49 |
couchbase/CouchbaseMock | src/main/java/com/couchbase/mock/JsonUtils.java | JsonUtils.decodeAsMap | @SuppressWarnings("unchecked")
public static Map<String,Object> decodeAsMap(String json) {
return decode(json, HashMap.class);
} | java | @SuppressWarnings("unchecked")
public static Map<String,Object> decodeAsMap(String json) {
return decode(json, HashMap.class);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"decodeAsMap",
"(",
"String",
"json",
")",
"{",
"return",
"decode",
"(",
"json",
",",
"HashMap",
".",
"class",
")",
";",
"}"
] | Decode a JSON string as Java map. The string must represent a JSON Object
@param json The JSON to decode
@return a map representing the JSON Object | [
"Decode",
"a",
"JSON",
"string",
"as",
"Java",
"map",
".",
"The",
"string",
"must",
"represent",
"a",
"JSON",
"Object"
] | train | https://github.com/couchbase/CouchbaseMock/blob/2085bbebade1d5b6356480e7bf335139d08383da/src/main/java/com/couchbase/mock/JsonUtils.java#L64-L67 |
google/closure-compiler | src/com/google/javascript/rhino/jstype/JSTypeRegistry.java | JSTypeRegistry.createOptionalType | public JSType createOptionalType(JSType type) {
if (type instanceof UnknownType || type.isAllType()) {
return type;
} else {
return createUnionType(type, getNativeType(JSTypeNative.VOID_TYPE));
}
} | java | public JSType createOptionalType(JSType type) {
if (type instanceof UnknownType || type.isAllType()) {
return type;
} else {
return createUnionType(type, getNativeType(JSTypeNative.VOID_TYPE));
}
} | [
"public",
"JSType",
"createOptionalType",
"(",
"JSType",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"UnknownType",
"||",
"type",
".",
"isAllType",
"(",
")",
")",
"{",
"return",
"type",
";",
"}",
"else",
"{",
"return",
"createUnionType",
"(",
"type"... | Creates a type representing optional values of the given type.
@return the union of the type and the void type | [
"Creates",
"a",
"type",
"representing",
"optional",
"values",
"of",
"the",
"given",
"type",
"."
] | train | https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/JSTypeRegistry.java#L1476-L1482 |
lastaflute/lastaflute | src/main/java/org/lastaflute/web/UrlChain.java | UrlChain.assertArgumentNotNull | protected void assertArgumentNotNull(String argumentName, Object value) {
if (argumentName == null) {
String msg = "The argument name should not be null: argName=null value=" + value;
throw new IllegalArgumentException(msg);
}
if (value == null) {
String msg = "The value should not be null: argName=" + argumentName;
throw new IllegalArgumentException(msg);
}
} | java | protected void assertArgumentNotNull(String argumentName, Object value) {
if (argumentName == null) {
String msg = "The argument name should not be null: argName=null value=" + value;
throw new IllegalArgumentException(msg);
}
if (value == null) {
String msg = "The value should not be null: argName=" + argumentName;
throw new IllegalArgumentException(msg);
}
} | [
"protected",
"void",
"assertArgumentNotNull",
"(",
"String",
"argumentName",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"argumentName",
"==",
"null",
")",
"{",
"String",
"msg",
"=",
"\"The argument name should not be null: argName=null value=\"",
"+",
"value",
";",
... | Assert that the argument is not null.
@param argumentName The name of assert-target argument. (NotNull)
@param value The value of argument. (NotNull)
@throws IllegalArgumentException When the value is null. | [
"Assert",
"that",
"the",
"argument",
"is",
"not",
"null",
"."
] | train | https://github.com/lastaflute/lastaflute/blob/17b56dda8322e4c6d79043532c1dda917d6b60a8/src/main/java/org/lastaflute/web/UrlChain.java#L134-L143 |
finmath/finmath-lib | src/main/java/net/finmath/montecarlo/assetderivativevaluation/products/LocalRiskMinimizingHedgePortfolio.java | LocalRiskMinimizingHedgePortfolio.getBasisFunctions | private RandomVariable[] getBasisFunctions(RandomVariable underlying) {
double min = underlying.getMin();
double max = underlying.getMax();
ArrayList<RandomVariable> basisFunctionList = new ArrayList<>();
double[] discretization = (new TimeDiscretizationFromArray(min, numberOfBins, (max-min)/numberOfBins)).getAsDoubleArray();
for(double discretizationStep : discretization) {
RandomVariable indicator = underlying.sub(discretizationStep).choose(new RandomVariableFromDoubleArray(1.0), new RandomVariableFromDoubleArray(0.0));
basisFunctionList.add(indicator);
}
return basisFunctionList.toArray(new RandomVariable[0]);
} | java | private RandomVariable[] getBasisFunctions(RandomVariable underlying) {
double min = underlying.getMin();
double max = underlying.getMax();
ArrayList<RandomVariable> basisFunctionList = new ArrayList<>();
double[] discretization = (new TimeDiscretizationFromArray(min, numberOfBins, (max-min)/numberOfBins)).getAsDoubleArray();
for(double discretizationStep : discretization) {
RandomVariable indicator = underlying.sub(discretizationStep).choose(new RandomVariableFromDoubleArray(1.0), new RandomVariableFromDoubleArray(0.0));
basisFunctionList.add(indicator);
}
return basisFunctionList.toArray(new RandomVariable[0]);
} | [
"private",
"RandomVariable",
"[",
"]",
"getBasisFunctions",
"(",
"RandomVariable",
"underlying",
")",
"{",
"double",
"min",
"=",
"underlying",
".",
"getMin",
"(",
")",
";",
"double",
"max",
"=",
"underlying",
".",
"getMax",
"(",
")",
";",
"ArrayList",
"<",
... | Create basis functions for a binning.
@param underlying
@return | [
"Create",
"basis",
"functions",
"for",
"a",
"binning",
"."
] | train | https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/assetderivativevaluation/products/LocalRiskMinimizingHedgePortfolio.java#L155-L167 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/externallink/CmsEditExternalLinkDialog.java | CmsEditExternalLinkDialog.showNewLinkDialog | public static CmsEditExternalLinkDialog showNewLinkDialog(CmsListInfoBean typeInfo, String parentFolderPath) {
CmsEditExternalLinkDialog dialog = new CmsEditExternalLinkDialog(typeInfo, parentFolderPath);
dialog.center();
return dialog;
} | java | public static CmsEditExternalLinkDialog showNewLinkDialog(CmsListInfoBean typeInfo, String parentFolderPath) {
CmsEditExternalLinkDialog dialog = new CmsEditExternalLinkDialog(typeInfo, parentFolderPath);
dialog.center();
return dialog;
} | [
"public",
"static",
"CmsEditExternalLinkDialog",
"showNewLinkDialog",
"(",
"CmsListInfoBean",
"typeInfo",
",",
"String",
"parentFolderPath",
")",
"{",
"CmsEditExternalLinkDialog",
"dialog",
"=",
"new",
"CmsEditExternalLinkDialog",
"(",
"typeInfo",
",",
"parentFolderPath",
"... | Shows the create new link dialog.<p>
@param typeInfo the 'pointer' type info
@param parentFolderPath the parent folder site path
@return the dialog object | [
"Shows",
"the",
"create",
"new",
"link",
"dialog",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/externallink/CmsEditExternalLinkDialog.java#L185-L190 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/util/CmsEmbeddedDialogHandler.java | CmsEmbeddedDialogHandler.openDialog | public void openDialog(
String dialogId,
String contextType,
List<CmsUUID> resources,
Map<String, String> rawParams) {
String resourceIds = "";
if (resources != null) {
for (CmsUUID id : resources) {
resourceIds += id.toString() + ";";
}
}
String url = CmsCoreProvider.get().getEmbeddedDialogsUrl()
+ dialogId
+ "?resources="
+ resourceIds
+ "&contextType="
+ contextType;
if ((rawParams != null) && !rawParams.isEmpty()) {
List<String> params = new ArrayList<String>();
for (Map.Entry<String, String> entry : rawParams.entrySet()) {
params.add(entry.getKey() + "=" + entry.getValue());
}
url = url + "&" + CmsStringUtil.listAsString(params, "&");
}
m_frame = new CmsIFrame("embeddedDialogFrame", url);
m_frame.setStyleName(I_CmsLayoutBundle.INSTANCE.dialogCss().embeddedDialogFrame());
RootPanel.get().add(m_frame);
initIFrame();
} | java | public void openDialog(
String dialogId,
String contextType,
List<CmsUUID> resources,
Map<String, String> rawParams) {
String resourceIds = "";
if (resources != null) {
for (CmsUUID id : resources) {
resourceIds += id.toString() + ";";
}
}
String url = CmsCoreProvider.get().getEmbeddedDialogsUrl()
+ dialogId
+ "?resources="
+ resourceIds
+ "&contextType="
+ contextType;
if ((rawParams != null) && !rawParams.isEmpty()) {
List<String> params = new ArrayList<String>();
for (Map.Entry<String, String> entry : rawParams.entrySet()) {
params.add(entry.getKey() + "=" + entry.getValue());
}
url = url + "&" + CmsStringUtil.listAsString(params, "&");
}
m_frame = new CmsIFrame("embeddedDialogFrame", url);
m_frame.setStyleName(I_CmsLayoutBundle.INSTANCE.dialogCss().embeddedDialogFrame());
RootPanel.get().add(m_frame);
initIFrame();
} | [
"public",
"void",
"openDialog",
"(",
"String",
"dialogId",
",",
"String",
"contextType",
",",
"List",
"<",
"CmsUUID",
">",
"resources",
",",
"Map",
"<",
"String",
",",
"String",
">",
"rawParams",
")",
"{",
"String",
"resourceIds",
"=",
"\"\"",
";",
"if",
... | Opens the dialog with the given id.<p>
@param dialogId the dialog id
@param contextType the context type, used to check the action visibility
@param resources the resource to handle
@param rawParams additional set of parameters to append to the query string (will not be escaped, therefore 'raw') | [
"Opens",
"the",
"dialog",
"with",
"the",
"given",
"id",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/util/CmsEmbeddedDialogHandler.java#L172-L202 |
RoaringBitmap/RoaringBitmap | roaringbitmap/src/main/java/org/roaringbitmap/buffer/ImmutableRoaringBitmap.java | ImmutableRoaringBitmap.andNot | public static MutableRoaringBitmap andNot(final ImmutableRoaringBitmap x1,
final ImmutableRoaringBitmap x2, long rangeStart, long rangeEnd) {
MutableRoaringBitmap.rangeSanityCheck(rangeStart,rangeEnd);
MutableRoaringBitmap rb1 = selectRangeWithoutCopy(x1, rangeStart, rangeEnd);
MutableRoaringBitmap rb2 = selectRangeWithoutCopy(x2, rangeStart, rangeEnd);
return andNot(rb1, rb2);
} | java | public static MutableRoaringBitmap andNot(final ImmutableRoaringBitmap x1,
final ImmutableRoaringBitmap x2, long rangeStart, long rangeEnd) {
MutableRoaringBitmap.rangeSanityCheck(rangeStart,rangeEnd);
MutableRoaringBitmap rb1 = selectRangeWithoutCopy(x1, rangeStart, rangeEnd);
MutableRoaringBitmap rb2 = selectRangeWithoutCopy(x2, rangeStart, rangeEnd);
return andNot(rb1, rb2);
} | [
"public",
"static",
"MutableRoaringBitmap",
"andNot",
"(",
"final",
"ImmutableRoaringBitmap",
"x1",
",",
"final",
"ImmutableRoaringBitmap",
"x2",
",",
"long",
"rangeStart",
",",
"long",
"rangeEnd",
")",
"{",
"MutableRoaringBitmap",
".",
"rangeSanityCheck",
"(",
"range... | Bitwise ANDNOT (difference) operation for the given range, rangeStart (inclusive) and rangeEnd
(exclusive). The provided bitmaps are *not* modified. This operation is thread-safe as long as
the provided bitmaps remain unchanged.
@param x1 first bitmap
@param x2 other bitmap
@param rangeStart beginning of the range (inclusive)
@param rangeEnd end of range (exclusive)
@return result of the operation | [
"Bitwise",
"ANDNOT",
"(",
"difference",
")",
"operation",
"for",
"the",
"given",
"range",
"rangeStart",
"(",
"inclusive",
")",
"and",
"rangeEnd",
"(",
"exclusive",
")",
".",
"The",
"provided",
"bitmaps",
"are",
"*",
"not",
"*",
"modified",
".",
"This",
"op... | train | https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/buffer/ImmutableRoaringBitmap.java#L360-L366 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/GeneralDataset.java | GeneralDataset.addAll | public void addAll(Iterable<? extends Datum<L,F>> data) {
for (Datum<L, F> d : data) {
add(d);
}
} | java | public void addAll(Iterable<? extends Datum<L,F>> data) {
for (Datum<L, F> d : data) {
add(d);
}
} | [
"public",
"void",
"addAll",
"(",
"Iterable",
"<",
"?",
"extends",
"Datum",
"<",
"L",
",",
"F",
">",
">",
"data",
")",
"{",
"for",
"(",
"Datum",
"<",
"L",
",",
"F",
">",
"d",
":",
"data",
")",
"{",
"add",
"(",
"d",
")",
";",
"}",
"}"
] | Adds all Datums in the given collection of data to this dataset
@param data collection of datums you would like to add to the dataset | [
"Adds",
"all",
"Datums",
"in",
"the",
"given",
"collection",
"of",
"data",
"to",
"this",
"dataset"
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/GeneralDataset.java#L214-L218 |
kubernetes-client/java | util/src/main/java/io/kubernetes/client/informer/cache/Cache.java | Cache.indexKeys | @Override
public List<String> indexKeys(String indexName, String indexKey) {
lock.lock();
try {
if (!this.indexers.containsKey(indexName)) {
throw new IllegalArgumentException(String.format("index %s doesn't exist!", indexName));
}
Map<String, Set<String>> index = this.indices.get(indexName);
Set<String> set = index.get(indexKey);
List<String> keys = new ArrayList<>(set.size());
for (String key : set) {
keys.add(key);
}
return keys;
} finally {
lock.unlock();
}
} | java | @Override
public List<String> indexKeys(String indexName, String indexKey) {
lock.lock();
try {
if (!this.indexers.containsKey(indexName)) {
throw new IllegalArgumentException(String.format("index %s doesn't exist!", indexName));
}
Map<String, Set<String>> index = this.indices.get(indexName);
Set<String> set = index.get(indexKey);
List<String> keys = new ArrayList<>(set.size());
for (String key : set) {
keys.add(key);
}
return keys;
} finally {
lock.unlock();
}
} | [
"@",
"Override",
"public",
"List",
"<",
"String",
">",
"indexKeys",
"(",
"String",
"indexName",
",",
"String",
"indexKey",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",
"(",
"!",
"this",
".",
"indexers",
".",
"containsKey",
"(",
"in... | Index keys list.
@param indexName the index name
@param indexKey the index key
@return the list | [
"Index",
"keys",
"list",
"."
] | train | https://github.com/kubernetes-client/java/blob/7413e98bd904f09d1ad00fb60e8c6ff787f3f560/util/src/main/java/io/kubernetes/client/informer/cache/Cache.java#L268-L285 |
Chorus-bdd/Chorus | interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/StepMacro.java | StepMacro.processStep | public boolean processStep(StepToken scenarioStep, List<StepMacro> macros, boolean alreadymatched) {
boolean stepMacroMatched = doProcessStep(scenarioStep, macros, 0, alreadymatched);
return stepMacroMatched;
} | java | public boolean processStep(StepToken scenarioStep, List<StepMacro> macros, boolean alreadymatched) {
boolean stepMacroMatched = doProcessStep(scenarioStep, macros, 0, alreadymatched);
return stepMacroMatched;
} | [
"public",
"boolean",
"processStep",
"(",
"StepToken",
"scenarioStep",
",",
"List",
"<",
"StepMacro",
">",
"macros",
",",
"boolean",
"alreadymatched",
")",
"{",
"boolean",
"stepMacroMatched",
"=",
"doProcessStep",
"(",
"scenarioStep",
",",
"macros",
",",
"0",
","... | Process a scenario step, adding child steps if it matches this StepMacro
@param scenarioStep the step to match to this StepMacro's pattern
@param macros the dictionary of macros against which to recursively match child steps | [
"Process",
"a",
"scenario",
"step",
"adding",
"child",
"steps",
"if",
"it",
"matches",
"this",
"StepMacro"
] | train | https://github.com/Chorus-bdd/Chorus/blob/1eea7ca858876bce821bb49b43fd5b6ba1737997/interpreter/chorus-parser/src/main/java/org/chorusbdd/chorus/parser/StepMacro.java#L128-L131 |
JDBDT/jdbdt | src/main/java/org/jdbdt/JDBDT.java | JDBDT.assertEmpty | public static void assertEmpty(String message, DataSource dataSource) throws DBAssertionError {
DBAssert.stateAssertion(CallInfo.create(message), empty(dataSource));
} | java | public static void assertEmpty(String message, DataSource dataSource) throws DBAssertionError {
DBAssert.stateAssertion(CallInfo.create(message), empty(dataSource));
} | [
"public",
"static",
"void",
"assertEmpty",
"(",
"String",
"message",
",",
"DataSource",
"dataSource",
")",
"throws",
"DBAssertionError",
"{",
"DBAssert",
".",
"stateAssertion",
"(",
"CallInfo",
".",
"create",
"(",
"message",
")",
",",
"empty",
"(",
"dataSource",... | Assert that the given data source has no rows (error message variant).
<p>A call to this method is equivalent to
<code>assertState(message, empty(dataSource))</code>.
@param message Assertion error message.
@param dataSource Data source.
@throws DBAssertionError if the assertion fails.
@see #assertState(String,DataSet)
@see #empty(DataSource) | [
"Assert",
"that",
"the",
"given",
"data",
"source",
"has",
"no",
"rows",
"(",
"error",
"message",
"variant",
")",
"."
] | train | https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/JDBDT.java#L672-L674 |
h2oai/h2o-3 | h2o-core/src/main/java/jsr166y/Phaser.java | Phaser.awaitAdvanceInterruptibly | public int awaitAdvanceInterruptibly(int phase,
long timeout, TimeUnit unit)
throws InterruptedException, TimeoutException {
long nanos = unit.toNanos(timeout);
final Phaser root = this.root;
long s = (root == this) ? state : reconcileState();
int p = (int)(s >>> PHASE_SHIFT);
if (phase < 0)
return phase;
if (p == phase) {
QNode node = new QNode(this, phase, true, true, nanos);
p = root.internalAwaitAdvance(phase, node);
if (node.wasInterrupted)
throw new InterruptedException();
else if (p == phase)
throw new TimeoutException();
}
return p;
} | java | public int awaitAdvanceInterruptibly(int phase,
long timeout, TimeUnit unit)
throws InterruptedException, TimeoutException {
long nanos = unit.toNanos(timeout);
final Phaser root = this.root;
long s = (root == this) ? state : reconcileState();
int p = (int)(s >>> PHASE_SHIFT);
if (phase < 0)
return phase;
if (p == phase) {
QNode node = new QNode(this, phase, true, true, nanos);
p = root.internalAwaitAdvance(phase, node);
if (node.wasInterrupted)
throw new InterruptedException();
else if (p == phase)
throw new TimeoutException();
}
return p;
} | [
"public",
"int",
"awaitAdvanceInterruptibly",
"(",
"int",
"phase",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"throws",
"InterruptedException",
",",
"TimeoutException",
"{",
"long",
"nanos",
"=",
"unit",
".",
"toNanos",
"(",
"timeout",
")",
";",
"fi... | Awaits the phase of this phaser to advance from the given phase
value or the given timeout to elapse, throwing {@code
InterruptedException} if interrupted while waiting, or
returning immediately if the current phase is not equal to the
given phase value or this phaser is terminated.
@param phase an arrival phase number, or negative value if
terminated; this argument is normally the value returned by a
previous call to {@code arrive} or {@code arriveAndDeregister}.
@param timeout how long to wait before giving up, in units of
{@code unit}
@param unit a {@code TimeUnit} determining how to interpret the
{@code timeout} parameter
@return the next arrival phase number, or the argument if it is
negative, or the (negative) {@linkplain #getPhase() current phase}
if terminated
@throws InterruptedException if thread interrupted while waiting
@throws TimeoutException if timed out while waiting | [
"Awaits",
"the",
"phase",
"of",
"this",
"phaser",
"to",
"advance",
"from",
"the",
"given",
"phase",
"value",
"or",
"the",
"given",
"timeout",
"to",
"elapse",
"throwing",
"{",
"@code",
"InterruptedException",
"}",
"if",
"interrupted",
"while",
"waiting",
"or",
... | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/jsr166y/Phaser.java#L756-L774 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java | NetworkInterfacesInner.beginListEffectiveNetworkSecurityGroups | public EffectiveNetworkSecurityGroupListResultInner beginListEffectiveNetworkSecurityGroups(String resourceGroupName, String networkInterfaceName) {
return beginListEffectiveNetworkSecurityGroupsWithServiceResponseAsync(resourceGroupName, networkInterfaceName).toBlocking().single().body();
} | java | public EffectiveNetworkSecurityGroupListResultInner beginListEffectiveNetworkSecurityGroups(String resourceGroupName, String networkInterfaceName) {
return beginListEffectiveNetworkSecurityGroupsWithServiceResponseAsync(resourceGroupName, networkInterfaceName).toBlocking().single().body();
} | [
"public",
"EffectiveNetworkSecurityGroupListResultInner",
"beginListEffectiveNetworkSecurityGroups",
"(",
"String",
"resourceGroupName",
",",
"String",
"networkInterfaceName",
")",
"{",
"return",
"beginListEffectiveNetworkSecurityGroupsWithServiceResponseAsync",
"(",
"resourceGroupName",... | Gets all network security groups applied to a network interface.
@param resourceGroupName The name of the resource group.
@param networkInterfaceName The name of the network interface.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the EffectiveNetworkSecurityGroupListResultInner object if successful. | [
"Gets",
"all",
"network",
"security",
"groups",
"applied",
"to",
"a",
"network",
"interface",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/NetworkInterfacesInner.java#L1411-L1413 |
JM-Lab/utils-java8 | src/main/java/kr/jm/utils/helper/JMPath.java | JMPath.getSubPathList | public static List<Path> getSubPathList(Path startDirectoryPath,
Predicate<Path> filter) {
return getSubPathList(startDirectoryPath, Integer.MAX_VALUE, filter);
} | java | public static List<Path> getSubPathList(Path startDirectoryPath,
Predicate<Path> filter) {
return getSubPathList(startDirectoryPath, Integer.MAX_VALUE, filter);
} | [
"public",
"static",
"List",
"<",
"Path",
">",
"getSubPathList",
"(",
"Path",
"startDirectoryPath",
",",
"Predicate",
"<",
"Path",
">",
"filter",
")",
"{",
"return",
"getSubPathList",
"(",
"startDirectoryPath",
",",
"Integer",
".",
"MAX_VALUE",
",",
"filter",
"... | Gets sub path list.
@param startDirectoryPath the start directory path
@param filter the filter
@return the sub path list | [
"Gets",
"sub",
"path",
"list",
"."
] | train | https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMPath.java#L496-L499 |
haraldk/TwelveMonkeys | sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/Log.java | Log.logDebug | public void logDebug(String message, Exception exception) {
if (!(logDebug || globalLog.logDebug))
return;
if (debugLog != null)
log(debugLog, "DEBUG", owner, message, exception);
else
log(globalLog.debugLog, "DEBUG", owner, message, exception);
} | java | public void logDebug(String message, Exception exception) {
if (!(logDebug || globalLog.logDebug))
return;
if (debugLog != null)
log(debugLog, "DEBUG", owner, message, exception);
else
log(globalLog.debugLog, "DEBUG", owner, message, exception);
} | [
"public",
"void",
"logDebug",
"(",
"String",
"message",
",",
"Exception",
"exception",
")",
"{",
"if",
"(",
"!",
"(",
"logDebug",
"||",
"globalLog",
".",
"logDebug",
")",
")",
"return",
";",
"if",
"(",
"debugLog",
"!=",
"null",
")",
"log",
"(",
"debugL... | Prints debug info to the current debugLog
@param message The message to log
@param exception An Exception | [
"Prints",
"debug",
"info",
"to",
"the",
"current",
"debugLog"
] | train | https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/sql/Log.java#L281-L289 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/feature/dense/DescribeDenseSiftAlg.java | DescribeDenseSiftAlg.computeDescriptor | public void computeDescriptor( int cx , int cy , TupleDesc_F64 desc ) {
desc.fill(0);
int widthPixels = widthSubregion*widthGrid;
int radius = widthPixels/2;
for (int i = 0; i < widthPixels; i++) {
int angleIndex = (cy-radius+i)*savedAngle.width + (cx-radius);
float subY = i/(float)widthSubregion;
for (int j = 0; j < widthPixels; j++, angleIndex++ ) {
float subX = j/(float)widthSubregion;
double angle = savedAngle.data[angleIndex];
float weightGaussian = gaussianWeight[i*widthPixels+j];
float weightGradient = savedMagnitude.data[angleIndex];
// trilinear interpolation intro descriptor
trilinearInterpolation(weightGaussian*weightGradient,subX,subY,angle,desc);
}
}
normalizeDescriptor(desc,maxDescriptorElementValue);
} | java | public void computeDescriptor( int cx , int cy , TupleDesc_F64 desc ) {
desc.fill(0);
int widthPixels = widthSubregion*widthGrid;
int radius = widthPixels/2;
for (int i = 0; i < widthPixels; i++) {
int angleIndex = (cy-radius+i)*savedAngle.width + (cx-radius);
float subY = i/(float)widthSubregion;
for (int j = 0; j < widthPixels; j++, angleIndex++ ) {
float subX = j/(float)widthSubregion;
double angle = savedAngle.data[angleIndex];
float weightGaussian = gaussianWeight[i*widthPixels+j];
float weightGradient = savedMagnitude.data[angleIndex];
// trilinear interpolation intro descriptor
trilinearInterpolation(weightGaussian*weightGradient,subX,subY,angle,desc);
}
}
normalizeDescriptor(desc,maxDescriptorElementValue);
} | [
"public",
"void",
"computeDescriptor",
"(",
"int",
"cx",
",",
"int",
"cy",
",",
"TupleDesc_F64",
"desc",
")",
"{",
"desc",
".",
"fill",
"(",
"0",
")",
";",
"int",
"widthPixels",
"=",
"widthSubregion",
"*",
"widthGrid",
";",
"int",
"radius",
"=",
"widthPi... | Computes the descriptor centered at the specified coordinate
@param cx center of region x-axis
@param cy center of region y-axis
@param desc The descriptor | [
"Computes",
"the",
"descriptor",
"centered",
"at",
"the",
"specified",
"coordinate"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/dense/DescribeDenseSiftAlg.java#L172-L198 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.refund_refundId_details_refundDetailId_GET | public OvhRefundDetail refund_refundId_details_refundDetailId_GET(String refundId, String refundDetailId) throws IOException {
String qPath = "/me/refund/{refundId}/details/{refundDetailId}";
StringBuilder sb = path(qPath, refundId, refundDetailId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRefundDetail.class);
} | java | public OvhRefundDetail refund_refundId_details_refundDetailId_GET(String refundId, String refundDetailId) throws IOException {
String qPath = "/me/refund/{refundId}/details/{refundDetailId}";
StringBuilder sb = path(qPath, refundId, refundDetailId);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhRefundDetail.class);
} | [
"public",
"OvhRefundDetail",
"refund_refundId_details_refundDetailId_GET",
"(",
"String",
"refundId",
",",
"String",
"refundDetailId",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/refund/{refundId}/details/{refundDetailId}\"",
";",
"StringBuilder",
"sb",
... | Get this object properties
REST: GET /me/refund/{refundId}/details/{refundDetailId}
@param refundId [required]
@param refundDetailId [required] | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1397-L1402 |
ngageoint/geopackage-core-java | src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java | GeoPackageCoreConnection.querySingleResult | public Object querySingleResult(String sql, String[] args, int column) {
return querySingleResult(sql, args, column, null);
} | java | public Object querySingleResult(String sql, String[] args, int column) {
return querySingleResult(sql, args, column, null);
} | [
"public",
"Object",
"querySingleResult",
"(",
"String",
"sql",
",",
"String",
"[",
"]",
"args",
",",
"int",
"column",
")",
"{",
"return",
"querySingleResult",
"(",
"sql",
",",
"args",
",",
"column",
",",
"null",
")",
";",
"}"
] | Query the SQL for a single result object
@param sql
sql statement
@param args
arguments
@param column
column index
@return result, null if no result
@since 3.1.0 | [
"Query",
"the",
"SQL",
"for",
"a",
"single",
"result",
"object"
] | train | https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/db/GeoPackageCoreConnection.java#L248-L250 |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterReader.java | GrassRasterReader.readCompressedFPRowByNumber | private void readCompressedFPRowByNumber( ByteBuffer rowdata, int rn, long[] adrows, RandomAccessFile thefile, int typeBytes )
throws DataFormatException, IOException {
int offset = (int) (adrows[rn + 1] - adrows[rn]);
/*
* The fact that the file is compressed does not mean that the row is compressed. If the
* first byte is 0 (49), then the row is compressed, otherwise (first byte = 48) the row has
* to be read in simple XDR uncompressed format.
*/
byte[] tmp = new byte[offset - 1];
thefile.seek(adrows[rn]);
int firstbyte = (thefile.read() & 0xff);
if (firstbyte == 49) {
/* The row is compressed. */
// thefile.seek((long) adrows[rn] + 1);
thefile.read(tmp, 0, offset - 1);
Inflater decompresser = new Inflater();
decompresser.setInput(tmp, 0, tmp.length);
decompresser.inflate(rowdata.array());
decompresser.end();
} else if (firstbyte == 48) {
/* The row is NOT compressed */
// thefile.seek((long) (adrows[rn]));
// if (thefile.read() == 48)
// {
// thefile.seek((long) (adrows[rn] + 1));
thefile.read(rowdata.array(), 0, offset - 1);
// }
}
} | java | private void readCompressedFPRowByNumber( ByteBuffer rowdata, int rn, long[] adrows, RandomAccessFile thefile, int typeBytes )
throws DataFormatException, IOException {
int offset = (int) (adrows[rn + 1] - adrows[rn]);
/*
* The fact that the file is compressed does not mean that the row is compressed. If the
* first byte is 0 (49), then the row is compressed, otherwise (first byte = 48) the row has
* to be read in simple XDR uncompressed format.
*/
byte[] tmp = new byte[offset - 1];
thefile.seek(adrows[rn]);
int firstbyte = (thefile.read() & 0xff);
if (firstbyte == 49) {
/* The row is compressed. */
// thefile.seek((long) adrows[rn] + 1);
thefile.read(tmp, 0, offset - 1);
Inflater decompresser = new Inflater();
decompresser.setInput(tmp, 0, tmp.length);
decompresser.inflate(rowdata.array());
decompresser.end();
} else if (firstbyte == 48) {
/* The row is NOT compressed */
// thefile.seek((long) (adrows[rn]));
// if (thefile.read() == 48)
// {
// thefile.seek((long) (adrows[rn] + 1));
thefile.read(rowdata.array(), 0, offset - 1);
// }
}
} | [
"private",
"void",
"readCompressedFPRowByNumber",
"(",
"ByteBuffer",
"rowdata",
",",
"int",
"rn",
",",
"long",
"[",
"]",
"adrows",
",",
"RandomAccessFile",
"thefile",
",",
"int",
"typeBytes",
")",
"throws",
"DataFormatException",
",",
"IOException",
"{",
"int",
... | read a row of data from a compressed floating point map
@param rn
@param adrows
@param outFile
@param typeBytes
@return the ByteBuffer containing the data
@throws IOException
@throws DataFormatException | [
"read",
"a",
"row",
"of",
"data",
"from",
"a",
"compressed",
"floating",
"point",
"map"
] | train | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/io/GrassRasterReader.java#L1064-L1092 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java | SimpleDateFormat.setNumberFormat | public void setNumberFormat(String fields, NumberFormat overrideNF) {
overrideNF.setGroupingUsed(false);
String nsName = "$" + UUID.randomUUID().toString();
// initialize mapping if not there
if (numberFormatters == null) {
numberFormatters = new HashMap<String, NumberFormat>();
}
if (overrideMap == null) {
overrideMap = new HashMap<Character, String>();
}
// separate string into char and add to maps
for (int i = 0; i < fields.length(); i++) {
char field = fields.charAt(i);
if (DateFormatSymbols.patternChars.indexOf(field) == -1) {
throw new IllegalArgumentException("Illegal field character " + "'" + field + "' in setNumberFormat.");
}
overrideMap.put(field, nsName);
numberFormatters.put(nsName, overrideNF);
}
// Since one or more of the override number formatters might be complex,
// we can't rely on the fast numfmt where we have a partial field override.
useLocalZeroPaddingNumberFormat = false;
} | java | public void setNumberFormat(String fields, NumberFormat overrideNF) {
overrideNF.setGroupingUsed(false);
String nsName = "$" + UUID.randomUUID().toString();
// initialize mapping if not there
if (numberFormatters == null) {
numberFormatters = new HashMap<String, NumberFormat>();
}
if (overrideMap == null) {
overrideMap = new HashMap<Character, String>();
}
// separate string into char and add to maps
for (int i = 0; i < fields.length(); i++) {
char field = fields.charAt(i);
if (DateFormatSymbols.patternChars.indexOf(field) == -1) {
throw new IllegalArgumentException("Illegal field character " + "'" + field + "' in setNumberFormat.");
}
overrideMap.put(field, nsName);
numberFormatters.put(nsName, overrideNF);
}
// Since one or more of the override number formatters might be complex,
// we can't rely on the fast numfmt where we have a partial field override.
useLocalZeroPaddingNumberFormat = false;
} | [
"public",
"void",
"setNumberFormat",
"(",
"String",
"fields",
",",
"NumberFormat",
"overrideNF",
")",
"{",
"overrideNF",
".",
"setGroupingUsed",
"(",
"false",
")",
";",
"String",
"nsName",
"=",
"\"$\"",
"+",
"UUID",
".",
"randomUUID",
"(",
")",
".",
"toStrin... | allow the user to set the NumberFormat for several fields
It can be a single field like: "y"(year) or "M"(month)
It can be several field combined together: "yMd"(year, month and date)
Note:
1 symbol field is enough for multiple symbol fields (so "y" will override "yy", "yyy")
If the field is not numeric, then override has no effect (like "MMM" will use abbreviation, not numerical field)
@param fields the fields to override
@param overrideNF the NumbeferFormat used
@exception IllegalArgumentException when the fields contain invalid field | [
"allow",
"the",
"user",
"to",
"set",
"the",
"NumberFormat",
"for",
"several",
"fields",
"It",
"can",
"be",
"a",
"single",
"field",
"like",
":",
"y",
"(",
"year",
")",
"or",
"M",
"(",
"month",
")",
"It",
"can",
"be",
"several",
"field",
"combined",
"t... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/SimpleDateFormat.java#L4373-L4398 |
structr/structr | structr-core/src/main/java/org/structr/common/MailHelper.java | MailHelper.replacePlaceHoldersInTemplate | public static String replacePlaceHoldersInTemplate(final String template, final Map<String, String> replacementMap) {
List<String> toReplace = new ArrayList<>();
List<String> replaceBy = new ArrayList<>();
for (Entry<String, String> property : replacementMap.entrySet()) {
toReplace.add(property.getKey());
replaceBy.add(property.getValue());
}
return StringUtils.replaceEachRepeatedly(template, toReplace.toArray(new String[toReplace.size()]), replaceBy.toArray(new String[replaceBy.size()]));
} | java | public static String replacePlaceHoldersInTemplate(final String template, final Map<String, String> replacementMap) {
List<String> toReplace = new ArrayList<>();
List<String> replaceBy = new ArrayList<>();
for (Entry<String, String> property : replacementMap.entrySet()) {
toReplace.add(property.getKey());
replaceBy.add(property.getValue());
}
return StringUtils.replaceEachRepeatedly(template, toReplace.toArray(new String[toReplace.size()]), replaceBy.toArray(new String[replaceBy.size()]));
} | [
"public",
"static",
"String",
"replacePlaceHoldersInTemplate",
"(",
"final",
"String",
"template",
",",
"final",
"Map",
"<",
"String",
",",
"String",
">",
"replacementMap",
")",
"{",
"List",
"<",
"String",
">",
"toReplace",
"=",
"new",
"ArrayList",
"<>",
"(",
... | Parse the template and replace any of the keys in the replacement map by
the given values
@param template
@param replacementMap
@return template string with included replacements | [
"Parse",
"the",
"template",
"and",
"replace",
"any",
"of",
"the",
"keys",
"in",
"the",
"replacement",
"map",
"by",
"the",
"given",
"values"
] | train | https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/org/structr/common/MailHelper.java#L208-L222 |
gocd/gocd | server/src/main/java/com/thoughtworks/go/server/service/StageService.java | StageService.resolveStageOrder | private Integer resolveStageOrder(long pipelineId, String stageName) {
Integer order = getStageOrderInPipeline(pipelineId, stageName);
if (order == null) {
order = getMaxStageOrderInPipeline(pipelineId) + 1;
}
return order;
} | java | private Integer resolveStageOrder(long pipelineId, String stageName) {
Integer order = getStageOrderInPipeline(pipelineId, stageName);
if (order == null) {
order = getMaxStageOrderInPipeline(pipelineId) + 1;
}
return order;
} | [
"private",
"Integer",
"resolveStageOrder",
"(",
"long",
"pipelineId",
",",
"String",
"stageName",
")",
"{",
"Integer",
"order",
"=",
"getStageOrderInPipeline",
"(",
"pipelineId",
",",
"stageName",
")",
";",
"if",
"(",
"order",
"==",
"null",
")",
"{",
"order",
... | stage order in current pipeline by 1, as current stage's order | [
"stage",
"order",
"in",
"current",
"pipeline",
"by",
"1",
"as",
"current",
"stage",
"s",
"order"
] | train | https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/server/src/main/java/com/thoughtworks/go/server/service/StageService.java#L279-L285 |
cdk/cdk | base/standard/src/main/java/org/openscience/cdk/stereo/FischerRecognition.java | FischerRecognition.isTerminal | private boolean isTerminal(IAtom atom, Map<IAtom, Integer> atomToIndex) {
return graph[atomToIndex.get(atom)].length == 1;
} | java | private boolean isTerminal(IAtom atom, Map<IAtom, Integer> atomToIndex) {
return graph[atomToIndex.get(atom)].length == 1;
} | [
"private",
"boolean",
"isTerminal",
"(",
"IAtom",
"atom",
",",
"Map",
"<",
"IAtom",
",",
"Integer",
">",
"atomToIndex",
")",
"{",
"return",
"graph",
"[",
"atomToIndex",
".",
"get",
"(",
"atom",
")",
"]",
".",
"length",
"==",
"1",
";",
"}"
] | Is the atom terminal having only one connection.
@param atom an atom
@param atomToIndex a map of atoms to index
@return the atom is terminal | [
"Is",
"the",
"atom",
"terminal",
"having",
"only",
"one",
"connection",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/stereo/FischerRecognition.java#L288-L290 |
netty/netty | buffer/src/main/java/io/netty/buffer/ByteBufUtil.java | ByteBufUtil.readBytes | static void readBytes(ByteBufAllocator allocator, ByteBuffer buffer, int position, int length, OutputStream out)
throws IOException {
if (buffer.hasArray()) {
out.write(buffer.array(), position + buffer.arrayOffset(), length);
} else {
int chunkLen = Math.min(length, WRITE_CHUNK_SIZE);
buffer.clear().position(position);
if (length <= MAX_TL_ARRAY_LEN || !allocator.isDirectBufferPooled()) {
getBytes(buffer, threadLocalTempArray(chunkLen), 0, chunkLen, out, length);
} else {
// if direct buffers are pooled chances are good that heap buffers are pooled as well.
ByteBuf tmpBuf = allocator.heapBuffer(chunkLen);
try {
byte[] tmp = tmpBuf.array();
int offset = tmpBuf.arrayOffset();
getBytes(buffer, tmp, offset, chunkLen, out, length);
} finally {
tmpBuf.release();
}
}
}
} | java | static void readBytes(ByteBufAllocator allocator, ByteBuffer buffer, int position, int length, OutputStream out)
throws IOException {
if (buffer.hasArray()) {
out.write(buffer.array(), position + buffer.arrayOffset(), length);
} else {
int chunkLen = Math.min(length, WRITE_CHUNK_SIZE);
buffer.clear().position(position);
if (length <= MAX_TL_ARRAY_LEN || !allocator.isDirectBufferPooled()) {
getBytes(buffer, threadLocalTempArray(chunkLen), 0, chunkLen, out, length);
} else {
// if direct buffers are pooled chances are good that heap buffers are pooled as well.
ByteBuf tmpBuf = allocator.heapBuffer(chunkLen);
try {
byte[] tmp = tmpBuf.array();
int offset = tmpBuf.arrayOffset();
getBytes(buffer, tmp, offset, chunkLen, out, length);
} finally {
tmpBuf.release();
}
}
}
} | [
"static",
"void",
"readBytes",
"(",
"ByteBufAllocator",
"allocator",
",",
"ByteBuffer",
"buffer",
",",
"int",
"position",
",",
"int",
"length",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
".",
"hasArray",
"(",
")",
")"... | Read bytes from the given {@link ByteBuffer} into the given {@link OutputStream} using the {@code position} and
{@code length}. The position and limit of the given {@link ByteBuffer} may be adjusted. | [
"Read",
"bytes",
"from",
"the",
"given",
"{"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L1398-L1420 |
radkovo/CSSBox | src/main/java/org/fit/cssbox/layout/BlockBox.java | BlockBox.initFirstLine | public void initFirstLine(ElementBox box)
{
if (firstLine == null)
firstLine = new LineBox(this, 0, 0);
firstLine.considerBoxProperties(box);
//recursively apply to the first in-flow box, when it is a block box
for (int i = startChild; i < endChild; i++)
{
Box child = getSubBox(i);
if (child.isInFlow())
{
if (child.isBlock())
((BlockBox) child).initFirstLine(box);
break;
}
}
} | java | public void initFirstLine(ElementBox box)
{
if (firstLine == null)
firstLine = new LineBox(this, 0, 0);
firstLine.considerBoxProperties(box);
//recursively apply to the first in-flow box, when it is a block box
for (int i = startChild; i < endChild; i++)
{
Box child = getSubBox(i);
if (child.isInFlow())
{
if (child.isBlock())
((BlockBox) child).initFirstLine(box);
break;
}
}
} | [
"public",
"void",
"initFirstLine",
"(",
"ElementBox",
"box",
")",
"{",
"if",
"(",
"firstLine",
"==",
"null",
")",
"firstLine",
"=",
"new",
"LineBox",
"(",
"this",
",",
"0",
",",
"0",
")",
";",
"firstLine",
".",
"considerBoxProperties",
"(",
"box",
")",
... | Initializes the first line box with the box properties. This may be used for considering special content
such as list item markers.
@param box the box that should be used for the initialization | [
"Initializes",
"the",
"first",
"line",
"box",
"with",
"the",
"box",
"properties",
".",
"This",
"may",
"be",
"used",
"for",
"considering",
"special",
"content",
"such",
"as",
"list",
"item",
"markers",
"."
] | train | https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/BlockBox.java#L1356-L1372 |
voldemort/voldemort | src/java/voldemort/rest/RestErrorHandler.java | RestErrorHandler.handleExceptions | protected void handleExceptions(MessageEvent messageEvent, Exception exception) {
logger.error("Unknown exception. Internal Server Error.", exception);
writeErrorResponse(messageEvent,
HttpResponseStatus.INTERNAL_SERVER_ERROR,
"Internal Server Error");
} | java | protected void handleExceptions(MessageEvent messageEvent, Exception exception) {
logger.error("Unknown exception. Internal Server Error.", exception);
writeErrorResponse(messageEvent,
HttpResponseStatus.INTERNAL_SERVER_ERROR,
"Internal Server Error");
} | [
"protected",
"void",
"handleExceptions",
"(",
"MessageEvent",
"messageEvent",
",",
"Exception",
"exception",
")",
"{",
"logger",
".",
"error",
"(",
"\"Unknown exception. Internal Server Error.\"",
",",
"exception",
")",
";",
"writeErrorResponse",
"(",
"messageEvent",
",... | Exceptions specific to each operation is handled in the corresponding
subclass. At this point we don't know the reason behind this exception.
@param exception | [
"Exceptions",
"specific",
"to",
"each",
"operation",
"is",
"handled",
"in",
"the",
"corresponding",
"subclass",
".",
"At",
"this",
"point",
"we",
"don",
"t",
"know",
"the",
"reason",
"behind",
"this",
"exception",
"."
] | train | https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/rest/RestErrorHandler.java#L25-L30 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMultiFileWidgetRenderer.java | WMultiFileWidgetRenderer.handleFileUploadRequest | protected void handleFileUploadRequest(final WMultiFileWidget widget, final XmlStringBuilder xml, final String uploadId) {
FileWidgetUpload file = widget.getFile(uploadId);
if (file == null) {
throw new SystemException("Invalid file id [" + uploadId + "] to render uploaded response.");
}
int idx = widget.getFiles().indexOf(file);
FileWidgetRendererUtil.renderFileElement(widget, xml, file, idx);
} | java | protected void handleFileUploadRequest(final WMultiFileWidget widget, final XmlStringBuilder xml, final String uploadId) {
FileWidgetUpload file = widget.getFile(uploadId);
if (file == null) {
throw new SystemException("Invalid file id [" + uploadId + "] to render uploaded response.");
}
int idx = widget.getFiles().indexOf(file);
FileWidgetRendererUtil.renderFileElement(widget, xml, file, idx);
} | [
"protected",
"void",
"handleFileUploadRequest",
"(",
"final",
"WMultiFileWidget",
"widget",
",",
"final",
"XmlStringBuilder",
"xml",
",",
"final",
"String",
"uploadId",
")",
"{",
"FileWidgetUpload",
"file",
"=",
"widget",
".",
"getFile",
"(",
"uploadId",
")",
";",... | Paint the response for the file uploaded in this request.
@param widget the file widget to render
@param xml the XML string builder
@param uploadId the file id uploaded in this request | [
"Paint",
"the",
"response",
"for",
"the",
"file",
"uploaded",
"in",
"this",
"request",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WMultiFileWidgetRenderer.java#L112-L120 |
michael-rapp/AndroidUtil | library/src/main/java/de/mrapp/android/util/ThemeUtil.java | ThemeUtil.getResId | public static int getResId(@NonNull final Context context, @AttrRes final int resourceId,
final int defaultValue) {
return getResId(context, -1, resourceId, defaultValue);
} | java | public static int getResId(@NonNull final Context context, @AttrRes final int resourceId,
final int defaultValue) {
return getResId(context, -1, resourceId, defaultValue);
} | [
"public",
"static",
"int",
"getResId",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"AttrRes",
"final",
"int",
"resourceId",
",",
"final",
"int",
"defaultValue",
")",
"{",
"return",
"getResId",
"(",
"context",
",",
"-",
"1",
",",
"resource... | Obtains the resource id, which corresponds to a specific resource id, from a context's
theme.
@param context
The context, which should be used, as an instance of the class {@link Context}. The
context may not be null
@param resourceId
The resource id of the attribute, which should be obtained, as an {@link Integer}
value. The resource id must corresponds to a valid theme attribute
@param defaultValue
The default value, which should be returned, if the given resource id is invalid, as
an {@link Integer} value
@return The resource id, which has been obtained, as an {@link Integer} value or 0, if the
given resource id is invalid | [
"Obtains",
"the",
"resource",
"id",
"which",
"corresponds",
"to",
"a",
"specific",
"resource",
"id",
"from",
"a",
"context",
"s",
"theme",
"."
] | train | https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/ThemeUtil.java#L867-L870 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.readProject | public CmsProject readProject(CmsDbContext dbc, String name) throws CmsException {
CmsProject project = null;
project = m_monitor.getCachedProject(name);
if (project == null) {
project = getProjectDriver(dbc).readProject(dbc, name);
m_monitor.cacheProject(project);
}
return project;
} | java | public CmsProject readProject(CmsDbContext dbc, String name) throws CmsException {
CmsProject project = null;
project = m_monitor.getCachedProject(name);
if (project == null) {
project = getProjectDriver(dbc).readProject(dbc, name);
m_monitor.cacheProject(project);
}
return project;
} | [
"public",
"CmsProject",
"readProject",
"(",
"CmsDbContext",
"dbc",
",",
"String",
"name",
")",
"throws",
"CmsException",
"{",
"CmsProject",
"project",
"=",
"null",
";",
"project",
"=",
"m_monitor",
".",
"getCachedProject",
"(",
"name",
")",
";",
"if",
"(",
"... | Reads a project.<p>
Important: Since a project name can be used multiple times, this is NOT the most efficient
way to read the project. This is only a convenience for front end developing.
Reading a project by name will return the first project with that name.
All core classes must use the id version {@link #readProject(CmsDbContext, CmsUUID)} to ensure the right project is read.<p>
@param dbc the current database context
@param name the name of the project
@return the project read
@throws CmsException if something goes wrong | [
"Reads",
"a",
"project",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L7281-L7290 |
Erudika/para | para-core/src/main/java/com/erudika/para/core/App.java | App.addValidationConstraint | public boolean addValidationConstraint(String type, String field, Constraint c) {
if (!StringUtils.isBlank(type) && !StringUtils.isBlank(field) &&
c != null && !c.getPayload().isEmpty() &&
Constraint.isValidConstraintName(c.getName())) {
Map<String, Map<String, Map<String, ?>>> fieldMap = getValidationConstraints().get(type);
Map<String, Map<String, ?>> consMap;
if (fieldMap != null) {
consMap = fieldMap.get(field);
if (consMap == null) {
consMap = new LinkedHashMap<>();
}
} else {
fieldMap = new LinkedHashMap<>();
consMap = new LinkedHashMap<>();
}
consMap.put(c.getName(), c.getPayload());
fieldMap.put(field, consMap);
getValidationConstraints().put(type, fieldMap);
return true;
}
return false;
} | java | public boolean addValidationConstraint(String type, String field, Constraint c) {
if (!StringUtils.isBlank(type) && !StringUtils.isBlank(field) &&
c != null && !c.getPayload().isEmpty() &&
Constraint.isValidConstraintName(c.getName())) {
Map<String, Map<String, Map<String, ?>>> fieldMap = getValidationConstraints().get(type);
Map<String, Map<String, ?>> consMap;
if (fieldMap != null) {
consMap = fieldMap.get(field);
if (consMap == null) {
consMap = new LinkedHashMap<>();
}
} else {
fieldMap = new LinkedHashMap<>();
consMap = new LinkedHashMap<>();
}
consMap.put(c.getName(), c.getPayload());
fieldMap.put(field, consMap);
getValidationConstraints().put(type, fieldMap);
return true;
}
return false;
} | [
"public",
"boolean",
"addValidationConstraint",
"(",
"String",
"type",
",",
"String",
"field",
",",
"Constraint",
"c",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"isBlank",
"(",
"type",
")",
"&&",
"!",
"StringUtils",
".",
"isBlank",
"(",
"field",
")",
... | Adds a new constraint to the list of constraints for a given field and type.
@param type the type
@param field the field
@param c the constraint
@return true if successful | [
"Adds",
"a",
"new",
"constraint",
"to",
"the",
"list",
"of",
"constraints",
"for",
"a",
"given",
"field",
"and",
"type",
"."
] | train | https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/App.java#L519-L540 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/overlay/OverlayItem.java | OverlayItem.setState | public static void setState(final Drawable drawable, final int stateBitset) {
final int[] states = new int[3];
int index = 0;
if ((stateBitset & ITEM_STATE_PRESSED_MASK) > 0)
states[index++] = android.R.attr.state_pressed;
if ((stateBitset & ITEM_STATE_SELECTED_MASK) > 0)
states[index++] = android.R.attr.state_selected;
if ((stateBitset & ITEM_STATE_FOCUSED_MASK) > 0)
states[index++] = android.R.attr.state_focused;
drawable.setState(states);
} | java | public static void setState(final Drawable drawable, final int stateBitset) {
final int[] states = new int[3];
int index = 0;
if ((stateBitset & ITEM_STATE_PRESSED_MASK) > 0)
states[index++] = android.R.attr.state_pressed;
if ((stateBitset & ITEM_STATE_SELECTED_MASK) > 0)
states[index++] = android.R.attr.state_selected;
if ((stateBitset & ITEM_STATE_FOCUSED_MASK) > 0)
states[index++] = android.R.attr.state_focused;
drawable.setState(states);
} | [
"public",
"static",
"void",
"setState",
"(",
"final",
"Drawable",
"drawable",
",",
"final",
"int",
"stateBitset",
")",
"{",
"final",
"int",
"[",
"]",
"states",
"=",
"new",
"int",
"[",
"3",
"]",
";",
"int",
"index",
"=",
"0",
";",
"if",
"(",
"(",
"s... | /*
(copied from the Google API docs) Sets the state of a drawable to match a given state bitset.
This is done by converting the state bitset bits into a state set of R.attr.state_pressed,
R.attr.state_selected and R.attr.state_focused attributes, and then calling {@link
Drawable.setState(int[])}. | [
"/",
"*",
"(",
"copied",
"from",
"the",
"Google",
"API",
"docs",
")",
"Sets",
"the",
"state",
"of",
"a",
"drawable",
"to",
"match",
"a",
"given",
"state",
"bitset",
".",
"This",
"is",
"done",
"by",
"converting",
"the",
"state",
"bitset",
"bits",
"into"... | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/OverlayItem.java#L140-L151 |
vznet/mongo-jackson-mapper | src/main/java/net/vz/mongodb/jackson/DBUpdate.java | DBUpdate.addToSet | public static Builder addToSet(String field, List<?> values) {
return new Builder().addToSet(field, values);
} | java | public static Builder addToSet(String field, List<?> values) {
return new Builder().addToSet(field, values);
} | [
"public",
"static",
"Builder",
"addToSet",
"(",
"String",
"field",
",",
"List",
"<",
"?",
">",
"values",
")",
"{",
"return",
"new",
"Builder",
"(",
")",
".",
"addToSet",
"(",
"field",
",",
"values",
")",
";",
"}"
] | Add the given values to the array value if they don't already exist in the specified field atomically
@param field The field to add the values to
@param values The values to add
@return this object | [
"Add",
"the",
"given",
"values",
"to",
"the",
"array",
"value",
"if",
"they",
"don",
"t",
"already",
"exist",
"in",
"the",
"specified",
"field",
"atomically"
] | train | https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/DBUpdate.java#L145-L147 |
code4everything/util | src/main/java/com/zhazhapan/util/AopLogUtils.java | AopLogUtils.getDescription | public static String getDescription(String className, String methodName, Object[] args) throws ClassNotFoundException {
Class targetClass = Class.forName(className);
Method[] methods = targetClass.getMethods();
for (Method method : methods) {
if (method.getName().equals(methodName)) {
Class[] clazz = method.getParameterTypes();
if (clazz.length == args.length) {
return method.getAnnotation(AopLog.class).value();
}
}
}
return "";
} | java | public static String getDescription(String className, String methodName, Object[] args) throws ClassNotFoundException {
Class targetClass = Class.forName(className);
Method[] methods = targetClass.getMethods();
for (Method method : methods) {
if (method.getName().equals(methodName)) {
Class[] clazz = method.getParameterTypes();
if (clazz.length == args.length) {
return method.getAnnotation(AopLog.class).value();
}
}
}
return "";
} | [
"public",
"static",
"String",
"getDescription",
"(",
"String",
"className",
",",
"String",
"methodName",
",",
"Object",
"[",
"]",
"args",
")",
"throws",
"ClassNotFoundException",
"{",
"Class",
"targetClass",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
... | 获取 {@link AopLog}注解中的描述
@param className 类名:joinPoint#getTarget#getClass#getName
@param methodName 方法名:joinPoint#getSignature#getName
@param args 参数数组:joinPoint#getArgs
@return 描述
@throws ClassNotFoundException 异常
@since 1.1.0 | [
"获取",
"{",
"@link",
"AopLog",
"}",
"注解中的描述"
] | train | https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/AopLogUtils.java#L27-L39 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/decomposition/qr/QRDecompositionHouseholderColumn_DDRM.java | QRDecompositionHouseholderColumn_DDRM.getQ | @Override
public DMatrixRMaj getQ(DMatrixRMaj Q , boolean compact ) {
if( compact ) {
Q = UtilDecompositons_DDRM.checkIdentity(Q,numRows,minLength);
} else {
Q = UtilDecompositons_DDRM.checkIdentity(Q,numRows,numRows);
}
for( int j = minLength-1; j >= 0; j-- ) {
double u[] = dataQR[j];
double vv = u[j];
u[j] = 1;
QrHelperFunctions_DDRM.rank1UpdateMultR(Q, u, gammas[j], j, j, numRows, v);
u[j] = vv;
}
return Q;
} | java | @Override
public DMatrixRMaj getQ(DMatrixRMaj Q , boolean compact ) {
if( compact ) {
Q = UtilDecompositons_DDRM.checkIdentity(Q,numRows,minLength);
} else {
Q = UtilDecompositons_DDRM.checkIdentity(Q,numRows,numRows);
}
for( int j = minLength-1; j >= 0; j-- ) {
double u[] = dataQR[j];
double vv = u[j];
u[j] = 1;
QrHelperFunctions_DDRM.rank1UpdateMultR(Q, u, gammas[j], j, j, numRows, v);
u[j] = vv;
}
return Q;
} | [
"@",
"Override",
"public",
"DMatrixRMaj",
"getQ",
"(",
"DMatrixRMaj",
"Q",
",",
"boolean",
"compact",
")",
"{",
"if",
"(",
"compact",
")",
"{",
"Q",
"=",
"UtilDecompositons_DDRM",
".",
"checkIdentity",
"(",
"Q",
",",
"numRows",
",",
"minLength",
")",
";",
... | Computes the Q matrix from the imformation stored in the QR matrix. This
operation requires about 4(m<sup>2</sup>n-mn<sup>2</sup>+n<sup>3</sup>/3) flops.
@param Q The orthogonal Q matrix. | [
"Computes",
"the",
"Q",
"matrix",
"from",
"the",
"imformation",
"stored",
"in",
"the",
"QR",
"matrix",
".",
"This",
"operation",
"requires",
"about",
"4",
"(",
"m<sup",
">",
"2<",
"/",
"sup",
">",
"n",
"-",
"mn<sup",
">",
"2<",
"/",
"sup",
">",
"+",
... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/decomposition/qr/QRDecompositionHouseholderColumn_DDRM.java#L98-L116 |
nats-io/java-nats-streaming | src/main/java/io/nats/streaming/StreamingConnectionFactory.java | StreamingConnectionFactory.setAckTimeout | public void setAckTimeout(long ackTimeout, TimeUnit unit) {
this.ackTimeout = Duration.ofMillis(unit.toMillis(ackTimeout));
} | java | public void setAckTimeout(long ackTimeout, TimeUnit unit) {
this.ackTimeout = Duration.ofMillis(unit.toMillis(ackTimeout));
} | [
"public",
"void",
"setAckTimeout",
"(",
"long",
"ackTimeout",
",",
"TimeUnit",
"unit",
")",
"{",
"this",
".",
"ackTimeout",
"=",
"Duration",
".",
"ofMillis",
"(",
"unit",
".",
"toMillis",
"(",
"ackTimeout",
")",
")",
";",
"}"
] | Sets the ACK timeout in the specified time unit.
@param ackTimeout the pubAckWait to set
@param unit the time unit to set | [
"Sets",
"the",
"ACK",
"timeout",
"in",
"the",
"specified",
"time",
"unit",
"."
] | train | https://github.com/nats-io/java-nats-streaming/blob/72f964e9093622875d7f1c85ce60820e028863e7/src/main/java/io/nats/streaming/StreamingConnectionFactory.java#L97-L99 |
apache/flink | flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java | TypeExtractor.createTypeInfo | @SuppressWarnings("unchecked")
@PublicEvolving
public static <OUT> TypeInformation<OUT> createTypeInfo(Object instance, Class<?> baseClass, Class<?> clazz, int returnParamPos) {
if (instance instanceof ResultTypeQueryable) {
return ((ResultTypeQueryable<OUT>) instance).getProducedType();
} else {
return createTypeInfo(baseClass, clazz, returnParamPos, null, null);
}
} | java | @SuppressWarnings("unchecked")
@PublicEvolving
public static <OUT> TypeInformation<OUT> createTypeInfo(Object instance, Class<?> baseClass, Class<?> clazz, int returnParamPos) {
if (instance instanceof ResultTypeQueryable) {
return ((ResultTypeQueryable<OUT>) instance).getProducedType();
} else {
return createTypeInfo(baseClass, clazz, returnParamPos, null, null);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"PublicEvolving",
"public",
"static",
"<",
"OUT",
">",
"TypeInformation",
"<",
"OUT",
">",
"createTypeInfo",
"(",
"Object",
"instance",
",",
"Class",
"<",
"?",
">",
"baseClass",
",",
"Class",
"<",
"?",... | Creates a {@link TypeInformation} from the given parameters.
If the given {@code instance} implements {@link ResultTypeQueryable}, its information
is used to determine the type information. Otherwise, the type information is derived
based on the given class information.
@param instance instance to determine type information for
@param baseClass base class of {@code instance}
@param clazz class of {@code instance}
@param returnParamPos index of the return type in the type arguments of {@code clazz}
@param <OUT> output type
@return type information | [
"Creates",
"a",
"{",
"@link",
"TypeInformation",
"}",
"from",
"the",
"given",
"parameters",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractor.java#L756-L764 |
google/closure-templates | java/src/com/google/template/soy/jssrc/internal/NullSafeAccumulator.java | NullSafeAccumulator.dotAccess | NullSafeAccumulator dotAccess(FieldAccess access, boolean nullSafe) {
if (access instanceof ProtoCall) {
ProtoCall protoCall = (ProtoCall) access;
Expression maybeUnpack = protoCall.unpackFunction();
if (maybeUnpack != null) {
Preconditions.checkState(
unpackFunction == null, "this chain will already unpack with %s", unpackFunction);
unpackFunction = maybeUnpack;
accessType = protoCall.accessType();
}
}
chain.add(access.toChainAccess(nullSafe));
return this;
} | java | NullSafeAccumulator dotAccess(FieldAccess access, boolean nullSafe) {
if (access instanceof ProtoCall) {
ProtoCall protoCall = (ProtoCall) access;
Expression maybeUnpack = protoCall.unpackFunction();
if (maybeUnpack != null) {
Preconditions.checkState(
unpackFunction == null, "this chain will already unpack with %s", unpackFunction);
unpackFunction = maybeUnpack;
accessType = protoCall.accessType();
}
}
chain.add(access.toChainAccess(nullSafe));
return this;
} | [
"NullSafeAccumulator",
"dotAccess",
"(",
"FieldAccess",
"access",
",",
"boolean",
"nullSafe",
")",
"{",
"if",
"(",
"access",
"instanceof",
"ProtoCall",
")",
"{",
"ProtoCall",
"protoCall",
"=",
"(",
"ProtoCall",
")",
"access",
";",
"Expression",
"maybeUnpack",
"=... | Extends the access chain with a dot access to the given value.
@param nullSafe If true, code will be generated to ensure the chain is non-null before
dereferencing {@code access}. | [
"Extends",
"the",
"access",
"chain",
"with",
"a",
"dot",
"access",
"to",
"the",
"given",
"value",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/NullSafeAccumulator.java#L85-L98 |
js-lib-com/transaction.hibernate | src/main/java/js/transaction/hibernate/HibernateAdapter.java | HibernateAdapter.createTransaction | public TransactionImpl createTransaction(boolean readOnly)
{
TransactionImpl transaction = transactionsCache.get();
if(transaction != null) {
transaction.incrementTransactionNestingLevel();
}
else {
transaction = new TransactionImpl(this, transactionTimeout, readOnly);
transactionsCache.set(transaction);
}
return transaction;
} | java | public TransactionImpl createTransaction(boolean readOnly)
{
TransactionImpl transaction = transactionsCache.get();
if(transaction != null) {
transaction.incrementTransactionNestingLevel();
}
else {
transaction = new TransactionImpl(this, transactionTimeout, readOnly);
transactionsCache.set(transaction);
}
return transaction;
} | [
"public",
"TransactionImpl",
"createTransaction",
"(",
"boolean",
"readOnly",
")",
"{",
"TransactionImpl",
"transaction",
"=",
"transactionsCache",
".",
"get",
"(",
")",
";",
"if",
"(",
"transaction",
"!=",
"null",
")",
"{",
"transaction",
".",
"incrementTransacti... | Create a database handler. Create a new {@link TransactionImpl} and store it on current thread so that it can be
retrieved by application code. This method is invoked by {@link TransactionManagerImpl} when start a new
transaction. Note that created handler is valid only on current transaction boundaries.
@param readOnly if this flag is true create a read-only transaction, supporting only database select operations.
@return newly created database handler. | [
"Create",
"a",
"database",
"handler",
".",
"Create",
"a",
"new",
"{",
"@link",
"TransactionImpl",
"}",
"and",
"store",
"it",
"on",
"current",
"thread",
"so",
"that",
"it",
"can",
"be",
"retrieved",
"by",
"application",
"code",
".",
"This",
"method",
"is",
... | train | https://github.com/js-lib-com/transaction.hibernate/blob/3aaafa6fa573f27733e6edaef3a4b2cf97cf67d6/src/main/java/js/transaction/hibernate/HibernateAdapter.java#L200-L211 |
Stratio/stratio-cassandra | src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java | CQLSSTableWriter.rawAddRow | public CQLSSTableWriter rawAddRow(Map<String, ByteBuffer> values)
throws InvalidRequestException, IOException
{
int size = Math.min(values.size(), boundNames.size());
List<ByteBuffer> rawValues = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
ColumnSpecification spec = boundNames.get(i);
rawValues.add(values.get(spec.name.toString()));
}
return rawAddRow(rawValues);
} | java | public CQLSSTableWriter rawAddRow(Map<String, ByteBuffer> values)
throws InvalidRequestException, IOException
{
int size = Math.min(values.size(), boundNames.size());
List<ByteBuffer> rawValues = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
ColumnSpecification spec = boundNames.get(i);
rawValues.add(values.get(spec.name.toString()));
}
return rawAddRow(rawValues);
} | [
"public",
"CQLSSTableWriter",
"rawAddRow",
"(",
"Map",
"<",
"String",
",",
"ByteBuffer",
">",
"values",
")",
"throws",
"InvalidRequestException",
",",
"IOException",
"{",
"int",
"size",
"=",
"Math",
".",
"min",
"(",
"values",
".",
"size",
"(",
")",
",",
"b... | Adds a new row to the writer given already serialized values.
<p>
This is equivalent to the other rawAddRow methods, but takes a map whose
keys are the names of the columns to add instead of taking a list of the
values in the order of the insert statement used during construction of
this write.
@param values a map of colum name to column values representing the new
row to add. Note that if a column is not part of the map, it's value will
be {@code null}. If the map contains keys that does not correspond to one
of the column of the insert statement used when creating this writer, the
the corresponding value is ignored.
@return this writer. | [
"Adds",
"a",
"new",
"row",
"to",
"the",
"writer",
"given",
"already",
"serialized",
"values",
".",
"<p",
">",
"This",
"is",
"equivalent",
"to",
"the",
"other",
"rawAddRow",
"methods",
"but",
"takes",
"a",
"map",
"whose",
"keys",
"are",
"the",
"names",
"o... | train | https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/CQLSSTableWriter.java#L251-L261 |
ops4j/org.ops4j.pax.web | pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/HttpServiceRequestWrapper.java | HttpServiceRequestWrapper.setAttribute | @Override
public void setAttribute(final String name, Object value) {
if (HttpContext.AUTHENTICATION_TYPE.equals(name)) {
handleAuthenticationType(value);
} else if (HttpContext.REMOTE_USER.equals(name)) {
handleRemoteUser(value);
}
super.setAttribute(name, value);
} | java | @Override
public void setAttribute(final String name, Object value) {
if (HttpContext.AUTHENTICATION_TYPE.equals(name)) {
handleAuthenticationType(value);
} else if (HttpContext.REMOTE_USER.equals(name)) {
handleRemoteUser(value);
}
super.setAttribute(name, value);
} | [
"@",
"Override",
"public",
"void",
"setAttribute",
"(",
"final",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"HttpContext",
".",
"AUTHENTICATION_TYPE",
".",
"equals",
"(",
"name",
")",
")",
"{",
"handleAuthenticationType",
"(",
"value",
")... | Filter the setting of authentication related attributes. If one of
HttpContext.AUTHENTICATION_TYPE or HTTPContext.REMOTE_USER set the
corresponding values in original request.
@see javax.servlet.http.HttpServletRequest#setAttribute(String, Object) | [
"Filter",
"the",
"setting",
"of",
"authentication",
"related",
"attributes",
".",
"If",
"one",
"of",
"HttpContext",
".",
"AUTHENTICATION_TYPE",
"or",
"HTTPContext",
".",
"REMOTE_USER",
"set",
"the",
"corresponding",
"values",
"in",
"original",
"request",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.web/blob/9ecf3676c1d316be0d43ea7fcfdc8f0defffc2a2/pax-web-jetty/src/main/java/org/ops4j/pax/web/service/jetty/internal/HttpServiceRequestWrapper.java#L98-L106 |
ThreeTen/threeten-extra | src/main/java/org/threeten/extra/scale/UtcRules.java | UtcRules.validateModifiedJulianDay | public void validateModifiedJulianDay(long mjDay, long nanoOfDay) {
long leapSecs = getLeapSecondAdjustment(mjDay);
long maxNanos = (SECS_PER_DAY + leapSecs) * NANOS_PER_SECOND;
if (nanoOfDay < 0 || nanoOfDay >= maxNanos) {
throw new DateTimeException("Nanosecond-of-day must be between 0 and " + maxNanos + " on date " + mjDay);
}
} | java | public void validateModifiedJulianDay(long mjDay, long nanoOfDay) {
long leapSecs = getLeapSecondAdjustment(mjDay);
long maxNanos = (SECS_PER_DAY + leapSecs) * NANOS_PER_SECOND;
if (nanoOfDay < 0 || nanoOfDay >= maxNanos) {
throw new DateTimeException("Nanosecond-of-day must be between 0 and " + maxNanos + " on date " + mjDay);
}
} | [
"public",
"void",
"validateModifiedJulianDay",
"(",
"long",
"mjDay",
",",
"long",
"nanoOfDay",
")",
"{",
"long",
"leapSecs",
"=",
"getLeapSecondAdjustment",
"(",
"mjDay",
")",
";",
"long",
"maxNanos",
"=",
"(",
"SECS_PER_DAY",
"+",
"leapSecs",
")",
"*",
"NANOS... | Validates combination of Modified Julian Day and nanosecond-of-day.
<p>
Modified Julian Day is a simple incrementing count of days where day 0 is 1858-11-17.
Nanosecond-of-day is a simple count of nanoseconds from the start of the day
including any additional leap-second.
This method validates the nanosecond-of-day value against the Modified Julian Day.
<p>
The nanosecond-of-day value has a valid range from {@code 0} to
{@code 86,400,000,000,000 - 1} on most days, and a larger or smaller range
on leap-second days.
@param mjDay the date as a Modified Julian Day (number of days from the epoch of 1858-11-17)
@param nanoOfDay the nanoseconds within the day, including leap seconds
@throws DateTimeException if nanoOfDay is out of range | [
"Validates",
"combination",
"of",
"Modified",
"Julian",
"Day",
"and",
"nanosecond",
"-",
"of",
"-",
"day",
".",
"<p",
">",
"Modified",
"Julian",
"Day",
"is",
"a",
"simple",
"incrementing",
"count",
"of",
"days",
"where",
"day",
"0",
"is",
"1858",
"-",
"1... | train | https://github.com/ThreeTen/threeten-extra/blob/e94ecd3592ef70e54d6eea21095239ea9ffbab78/src/main/java/org/threeten/extra/scale/UtcRules.java#L187-L193 |
languagetool-org/languagetool | languagetool-core/src/main/java/org/languagetool/tools/RuleMatchAsXmlSerializer.java | RuleMatchAsXmlSerializer.ruleMatchesToXml | public String ruleMatchesToXml(List<RuleMatch> ruleMatches, String text, int contextSize, ApiPrintMode xmlMode, Language lang, List<String> unknownWords) {
String xmlSnippet = ruleMatchesToXmlSnippet(ruleMatches, text, contextSize);
switch (xmlMode) {
case START_API:
return getXmlStart(lang, null) + xmlSnippet;
case CONTINUE_API:
return xmlSnippet;
case END_API:
return xmlSnippet + getXmlUnknownWords(unknownWords) + getXmlEnd();
case NORMAL_API:
return getXmlStart(lang, null) + xmlSnippet + getXmlUnknownWords(unknownWords) + getXmlEnd();
}
throw new IllegalArgumentException("Unknown XML mode: " + xmlMode);
} | java | public String ruleMatchesToXml(List<RuleMatch> ruleMatches, String text, int contextSize, ApiPrintMode xmlMode, Language lang, List<String> unknownWords) {
String xmlSnippet = ruleMatchesToXmlSnippet(ruleMatches, text, contextSize);
switch (xmlMode) {
case START_API:
return getXmlStart(lang, null) + xmlSnippet;
case CONTINUE_API:
return xmlSnippet;
case END_API:
return xmlSnippet + getXmlUnknownWords(unknownWords) + getXmlEnd();
case NORMAL_API:
return getXmlStart(lang, null) + xmlSnippet + getXmlUnknownWords(unknownWords) + getXmlEnd();
}
throw new IllegalArgumentException("Unknown XML mode: " + xmlMode);
} | [
"public",
"String",
"ruleMatchesToXml",
"(",
"List",
"<",
"RuleMatch",
">",
"ruleMatches",
",",
"String",
"text",
",",
"int",
"contextSize",
",",
"ApiPrintMode",
"xmlMode",
",",
"Language",
"lang",
",",
"List",
"<",
"String",
">",
"unknownWords",
")",
"{",
"... | Get an XML representation of the given rule matches.
@param text the original text that was checked, used to get the context of the matches
@param contextSize the desired context size in characters
@param unknownWords unknown words to be printed in a separated list
@since 3.0 | [
"Get",
"an",
"XML",
"representation",
"of",
"the",
"given",
"rule",
"matches",
"."
] | train | https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-core/src/main/java/org/languagetool/tools/RuleMatchAsXmlSerializer.java#L174-L187 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskId.java | DiskId.of | public static DiskId of(String project, String zone, String disk) {
return new DiskId(project, zone, disk);
} | java | public static DiskId of(String project, String zone, String disk) {
return new DiskId(project, zone, disk);
} | [
"public",
"static",
"DiskId",
"of",
"(",
"String",
"project",
",",
"String",
"zone",
",",
"String",
"disk",
")",
"{",
"return",
"new",
"DiskId",
"(",
"project",
",",
"zone",
",",
"disk",
")",
";",
"}"
] | Returns a disk identity given project, zone and disks names. The disk name must be 1-63
characters long and comply with RFC1035. Specifically, the name must match the regular
expression {@code [a-z]([-a-z0-9]*[a-z0-9])?} which means the first character must be a
lowercase letter, and all following characters must be a dash, lowercase letter, or digit,
except the last character, which cannot be a dash.
@see <a href="https://www.ietf.org/rfc/rfc1035.txt">RFC1035</a> | [
"Returns",
"a",
"disk",
"identity",
"given",
"project",
"zone",
"and",
"disks",
"names",
".",
"The",
"disk",
"name",
"must",
"be",
"1",
"-",
"63",
"characters",
"long",
"and",
"comply",
"with",
"RFC1035",
".",
"Specifically",
"the",
"name",
"must",
"match"... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/DiskId.java#L136-L138 |
apache/incubator-druid | sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java | Calcites.calciteTimestampToJoda | public static DateTime calciteTimestampToJoda(final long timestamp, final DateTimeZone timeZone)
{
return new DateTime(timestamp, DateTimeZone.UTC).withZoneRetainFields(timeZone);
} | java | public static DateTime calciteTimestampToJoda(final long timestamp, final DateTimeZone timeZone)
{
return new DateTime(timestamp, DateTimeZone.UTC).withZoneRetainFields(timeZone);
} | [
"public",
"static",
"DateTime",
"calciteTimestampToJoda",
"(",
"final",
"long",
"timestamp",
",",
"final",
"DateTimeZone",
"timeZone",
")",
"{",
"return",
"new",
"DateTime",
"(",
"timestamp",
",",
"DateTimeZone",
".",
"UTC",
")",
".",
"withZoneRetainFields",
"(",
... | The inverse of {@link #jodaToCalciteTimestamp(DateTime, DateTimeZone)}.
@param timestamp Calcite style timestamp
@param timeZone session time zone
@return joda timestamp, with time zone set to the session time zone | [
"The",
"inverse",
"of",
"{",
"@link",
"#jodaToCalciteTimestamp",
"(",
"DateTime",
"DateTimeZone",
")",
"}",
"."
] | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/planner/Calcites.java#L325-L328 |
eurekaclinical/protempa | protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java | ConstraintNetwork.removeRelation | synchronized boolean removeRelation(Interval i1, Interval i2) {
if (i1 == i2 || !containsInterval(i1) || !containsInterval(i2)) {
return false;
}
Object i1Start = i1.getStart();
Object i1Finish = i1.getFinish();
Object i2Start = i2.getStart();
Object i2Finish = i2.getFinish();
directedGraph.setEdge(i1Start, i2Start, null);
directedGraph.setEdge(i1Start, i2Finish, null);
directedGraph.setEdge(i2Start, i1Start, null);
directedGraph.setEdge(i2Start, i1Finish, null);
directedGraph.setEdge(i1Finish, i2Start, null);
directedGraph.setEdge(i1Finish, i2Finish, null);
directedGraph.setEdge(i2Finish, i1Start, null);
directedGraph.setEdge(i2Finish, i1Finish, null);
calcMinDuration = null;
calcMaxDuration = null;
calcMinFinish = null;
calcMaxFinish = null;
calcMinStart = null;
calcMaxStart = null;
shortestDistancesFromTimeZeroSource = null;
shortestDistancesFromTimeZeroDestination = null;
return true;
} | java | synchronized boolean removeRelation(Interval i1, Interval i2) {
if (i1 == i2 || !containsInterval(i1) || !containsInterval(i2)) {
return false;
}
Object i1Start = i1.getStart();
Object i1Finish = i1.getFinish();
Object i2Start = i2.getStart();
Object i2Finish = i2.getFinish();
directedGraph.setEdge(i1Start, i2Start, null);
directedGraph.setEdge(i1Start, i2Finish, null);
directedGraph.setEdge(i2Start, i1Start, null);
directedGraph.setEdge(i2Start, i1Finish, null);
directedGraph.setEdge(i1Finish, i2Start, null);
directedGraph.setEdge(i1Finish, i2Finish, null);
directedGraph.setEdge(i2Finish, i1Start, null);
directedGraph.setEdge(i2Finish, i1Finish, null);
calcMinDuration = null;
calcMaxDuration = null;
calcMinFinish = null;
calcMaxFinish = null;
calcMinStart = null;
calcMaxStart = null;
shortestDistancesFromTimeZeroSource = null;
shortestDistancesFromTimeZeroDestination = null;
return true;
} | [
"synchronized",
"boolean",
"removeRelation",
"(",
"Interval",
"i1",
",",
"Interval",
"i2",
")",
"{",
"if",
"(",
"i1",
"==",
"i2",
"||",
"!",
"containsInterval",
"(",
"i1",
")",
"||",
"!",
"containsInterval",
"(",
"i2",
")",
")",
"{",
"return",
"false",
... | Remove the distance relation between two intervals, if such a relation
exists.
@param i1
an interval.
@param i2
another interval.
@return true if the graph changed as a result of this operation, false
otherwise. | [
"Remove",
"the",
"distance",
"relation",
"between",
"two",
"intervals",
"if",
"such",
"a",
"relation",
"exists",
"."
] | train | https://github.com/eurekaclinical/protempa/blob/5a620d1a407c7a5426d1cf17d47b97717cf71634/protempa-framework/src/main/java/org/protempa/proposition/interval/ConstraintNetwork.java#L99-L128 |
katharsis-project/katharsis-framework | katharsis-core/src/main/java/io/katharsis/core/internal/dispatcher/ControllerRegistry.java | ControllerRegistry.getController | public BaseController getController(JsonPath jsonPath, String requestType) {
for (BaseController controller : controllers) {
if (controller.isAcceptable(jsonPath, requestType)) {
return controller;
}
}
throw new MethodNotFoundException(PathBuilder.buildPath(jsonPath), requestType);
} | java | public BaseController getController(JsonPath jsonPath, String requestType) {
for (BaseController controller : controllers) {
if (controller.isAcceptable(jsonPath, requestType)) {
return controller;
}
}
throw new MethodNotFoundException(PathBuilder.buildPath(jsonPath), requestType);
} | [
"public",
"BaseController",
"getController",
"(",
"JsonPath",
"jsonPath",
",",
"String",
"requestType",
")",
"{",
"for",
"(",
"BaseController",
"controller",
":",
"controllers",
")",
"{",
"if",
"(",
"controller",
".",
"isAcceptable",
"(",
"jsonPath",
",",
"reque... | Iterate over all registered controllers to get the first suitable one.
@param jsonPath built JsonPath object mad from request path
@param requestType type of a HTTP request
@return suitable controller | [
"Iterate",
"over",
"all",
"registered",
"controllers",
"to",
"get",
"the",
"first",
"suitable",
"one",
"."
] | train | https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/dispatcher/ControllerRegistry.java#L41-L48 |
monitorjbl/excel-streaming-reader | src/main/java/com/monitorjbl/xlsx/sst/BufferedStringsTable.java | BufferedStringsTable.parseCT_Rst | private String parseCT_Rst(XMLEventReader xmlEventReader) throws XMLStreamException {
// Precondition: pointing to <si>; Post condition: pointing to </si>
StringBuilder buf = new StringBuilder();
XMLEvent xmlEvent;
while((xmlEvent = xmlEventReader.nextTag()).isStartElement()) {
switch(xmlEvent.asStartElement().getName().getLocalPart()) {
case "t": // Text
buf.append(xmlEventReader.getElementText());
break;
case "r": // Rich Text Run
parseCT_RElt(xmlEventReader, buf);
break;
case "rPh": // Phonetic Run
case "phoneticPr": // Phonetic Properties
skipElement(xmlEventReader);
break;
default:
throw new IllegalArgumentException(xmlEvent.asStartElement().getName().getLocalPart());
}
}
return buf.length() > 0 ? buf.toString() : null;
} | java | private String parseCT_Rst(XMLEventReader xmlEventReader) throws XMLStreamException {
// Precondition: pointing to <si>; Post condition: pointing to </si>
StringBuilder buf = new StringBuilder();
XMLEvent xmlEvent;
while((xmlEvent = xmlEventReader.nextTag()).isStartElement()) {
switch(xmlEvent.asStartElement().getName().getLocalPart()) {
case "t": // Text
buf.append(xmlEventReader.getElementText());
break;
case "r": // Rich Text Run
parseCT_RElt(xmlEventReader, buf);
break;
case "rPh": // Phonetic Run
case "phoneticPr": // Phonetic Properties
skipElement(xmlEventReader);
break;
default:
throw new IllegalArgumentException(xmlEvent.asStartElement().getName().getLocalPart());
}
}
return buf.length() > 0 ? buf.toString() : null;
} | [
"private",
"String",
"parseCT_Rst",
"(",
"XMLEventReader",
"xmlEventReader",
")",
"throws",
"XMLStreamException",
"{",
"// Precondition: pointing to <si>; Post condition: pointing to </si>",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"XMLEvent",
"xml... | Parses a {@code <si>} String Item. Returns just the text and drops the formatting. See <a
href="https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.sharedstringitem.aspx">xmlschema
type {@code CT_Rst}</a>. | [
"Parses",
"a",
"{"
] | train | https://github.com/monitorjbl/excel-streaming-reader/blob/4e95c9aaaecf33685a09f8c267af3a578ba5e070/src/main/java/com/monitorjbl/xlsx/sst/BufferedStringsTable.java#L56-L77 |
Azure/azure-sdk-for-java | batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java | ComputeNodeOperations.reimageComputeNode | public void reimageComputeNode(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption) throws BatchErrorException, IOException {
reimageComputeNode(poolId, nodeId, nodeReimageOption, null);
} | java | public void reimageComputeNode(String poolId, String nodeId, ComputeNodeReimageOption nodeReimageOption) throws BatchErrorException, IOException {
reimageComputeNode(poolId, nodeId, nodeReimageOption, null);
} | [
"public",
"void",
"reimageComputeNode",
"(",
"String",
"poolId",
",",
"String",
"nodeId",
",",
"ComputeNodeReimageOption",
"nodeReimageOption",
")",
"throws",
"BatchErrorException",
",",
"IOException",
"{",
"reimageComputeNode",
"(",
"poolId",
",",
"nodeId",
",",
"nod... | Reinstalls the operating system on the specified compute node.
<p>You can reimage a compute node only when it is in the {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#IDLE Idle} or {@link com.microsoft.azure.batch.protocol.models.ComputeNodeState#RUNNING Running} state.</p>
@param poolId The ID of the pool that contains the compute node.
@param nodeId The ID of the compute node to reimage.
@param nodeReimageOption Specifies when to reimage the node and what to do with currently running tasks.
@throws BatchErrorException Exception thrown when an error response is received from the Batch service.
@throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. | [
"Reinstalls",
"the",
"operating",
"system",
"on",
"the",
"specified",
"compute",
"node",
".",
"<p",
">",
"You",
"can",
"reimage",
"a",
"compute",
"node",
"only",
"when",
"it",
"is",
"in",
"the",
"{",
"@link",
"com",
".",
"microsoft",
".",
"azure",
".",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java#L337-L339 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/script/el/tokens/ExpressionToken.java | ExpressionToken.mapUpdate | protected final void mapUpdate(Map map, Object key, Object value) {
Object o = map.get(key);
/*
If a value exists in map.get(key), convert the "value" parameter into
the type of map.get(key). It's a best guess as to what the type of the
Map _should_ be without any further reflective information about the
types contained in the map.
*/
if(o != null) {
Class type = o.getClass();
value = ParseUtils.convertType(value, type);
}
map.put(key, value);
} | java | protected final void mapUpdate(Map map, Object key, Object value) {
Object o = map.get(key);
/*
If a value exists in map.get(key), convert the "value" parameter into
the type of map.get(key). It's a best guess as to what the type of the
Map _should_ be without any further reflective information about the
types contained in the map.
*/
if(o != null) {
Class type = o.getClass();
value = ParseUtils.convertType(value, type);
}
map.put(key, value);
} | [
"protected",
"final",
"void",
"mapUpdate",
"(",
"Map",
"map",
",",
"Object",
"key",
",",
"Object",
"value",
")",
"{",
"Object",
"o",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"/*\n If a value exists in map.get(key), convert the \"value\" parameter into\... | Update the value of <code>key</code> in <code>map</code>
@param map the map
@param key the key
@param value the value | [
"Update",
"the",
"value",
"of",
"<code",
">",
"key<",
"/",
"code",
">",
"in",
"<code",
">",
"map<",
"/",
"code",
">"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/el/tokens/ExpressionToken.java#L94-L108 |
QSFT/Doradus | doradus-server/src/main/java/com/dell/doradus/service/db/DBTransaction.java | DBTransaction.deleteColumn | public void deleteColumn(String storeName, String rowKey, String columnName) {
m_columnDeletes.add(new ColumnDelete(storeName, rowKey, columnName));
} | java | public void deleteColumn(String storeName, String rowKey, String columnName) {
m_columnDeletes.add(new ColumnDelete(storeName, rowKey, columnName));
} | [
"public",
"void",
"deleteColumn",
"(",
"String",
"storeName",
",",
"String",
"rowKey",
",",
"String",
"columnName",
")",
"{",
"m_columnDeletes",
".",
"add",
"(",
"new",
"ColumnDelete",
"(",
"storeName",
",",
"rowKey",
",",
"columnName",
")",
")",
";",
"}"
] | Add an update that will delete the column for the given store, row key, and column
name. If a column update exists for the same store/row/column, the results are
undefined when the transaction is committed.
@param storeName Name of store that owns row.
@param rowKey Row key in string form.
@param colName Column name in string form. | [
"Add",
"an",
"update",
"that",
"will",
"delete",
"the",
"column",
"for",
"the",
"given",
"store",
"row",
"key",
"and",
"column",
"name",
".",
"If",
"a",
"column",
"update",
"exists",
"for",
"the",
"same",
"store",
"/",
"row",
"/",
"column",
"the",
"res... | train | https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/DBTransaction.java#L243-L245 |
cogroo/cogroo4 | cogroo-eval/BaselineCogrooAE/src/main/java/cogroo/uima/ae/UimaMultiWordExp.java | UimaMultiWordExp.mergeTokens | private static void mergeTokens(List<Token> grouped, List<Integer> toMerge) {
if (toMerge.size() > 0) {
StringBuilder sb = new StringBuilder();
int s = grouped.get(toMerge.get(0)).getSpan().getStart();
int e = grouped.get(toMerge.get(toMerge.size() - 1)).getSpan().getEnd();
for (int i = 0; i < toMerge.size(); i++) {
int index = toMerge.get(i);
sb.append(grouped.get(index).getLexeme() + "_");
}
String lexeme = sb.substring(0, sb.length() - 1);
for (int i = toMerge.size() - 1; i > 0; i--) {
grouped.remove(toMerge.get(i).intValue());
}
grouped.set(toMerge.get(0).intValue(), new TokenCogroo(lexeme, new Span(
s, e)));
}
} | java | private static void mergeTokens(List<Token> grouped, List<Integer> toMerge) {
if (toMerge.size() > 0) {
StringBuilder sb = new StringBuilder();
int s = grouped.get(toMerge.get(0)).getSpan().getStart();
int e = grouped.get(toMerge.get(toMerge.size() - 1)).getSpan().getEnd();
for (int i = 0; i < toMerge.size(); i++) {
int index = toMerge.get(i);
sb.append(grouped.get(index).getLexeme() + "_");
}
String lexeme = sb.substring(0, sb.length() - 1);
for (int i = toMerge.size() - 1; i > 0; i--) {
grouped.remove(toMerge.get(i).intValue());
}
grouped.set(toMerge.get(0).intValue(), new TokenCogroo(lexeme, new Span(
s, e)));
}
} | [
"private",
"static",
"void",
"mergeTokens",
"(",
"List",
"<",
"Token",
">",
"grouped",
",",
"List",
"<",
"Integer",
">",
"toMerge",
")",
"{",
"if",
"(",
"toMerge",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringB... | /* private static List<Token> groupTokens(List<Token> toks, List<Span> spans) {
if (spans == null || spans.size() == 0) {
return toks;
}
List<Token> grouped = new ArrayList<Token>(toks);
int lastTokVisited = 0;
List<Integer> toMerge = new ArrayList<Integer>();
for (int i = 0; i < spans.size(); i++) {
Span s = spans.get(i);
boolean canStop = false;
for (int j = lastTokVisited; j < toks.size(); j++) {
Token t = toks.get(j);
if (s.intersects(t.getSpan())) {
toMerge.add(j);
canStop = true;
} else if (canStop) {
lastTokVisited = j;
break;
}
}
}
mergeTokens(grouped, toMerge);
return grouped;
} | [
"/",
"*",
"private",
"static",
"List<Token",
">",
"groupTokens",
"(",
"List<Token",
">",
"toks",
"List<Span",
">",
"spans",
")",
"{",
"if",
"(",
"spans",
"==",
"null",
"||",
"spans",
".",
"size",
"()",
"==",
"0",
")",
"{",
"return",
"toks",
";",
"}",... | train | https://github.com/cogroo/cogroo4/blob/b6228900c20c6b37eac10a03708a9669dd562f52/cogroo-eval/BaselineCogrooAE/src/main/java/cogroo/uima/ae/UimaMultiWordExp.java#L151-L167 |
smartsheet-platform/smartsheet-java-sdk | src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java | PassthroughResourcesImpl.putRequest | public String putRequest(String endpoint, String payload, HashMap<String, Object> parameters) throws SmartsheetException {
Util.throwIfNull(payload);
return passthroughRequest(HttpMethod.PUT, endpoint, payload, parameters);
} | java | public String putRequest(String endpoint, String payload, HashMap<String, Object> parameters) throws SmartsheetException {
Util.throwIfNull(payload);
return passthroughRequest(HttpMethod.PUT, endpoint, payload, parameters);
} | [
"public",
"String",
"putRequest",
"(",
"String",
"endpoint",
",",
"String",
"payload",
",",
"HashMap",
"<",
"String",
",",
"Object",
">",
"parameters",
")",
"throws",
"SmartsheetException",
"{",
"Util",
".",
"throwIfNull",
"(",
"payload",
")",
";",
"return",
... | Issue an HTTP PUT request.
@param endpoint the API endpoint
@param payload a JSON payload string
@param parameters optional list of resource parameters
@return a JSON response string
@throws IllegalArgumentException if any argument is null or empty string
@throws InvalidRequestException if there is any problem with the REST API request
@throws AuthorizationException if there is any problem with the REST API authorization (access token)
@throws ResourceNotFoundException if the resource cannot be found
@throws ServiceUnavailableException if the REST API service is not available (possibly due to rate limiting)
@throws SmartsheetException if there is any other error during the operation | [
"Issue",
"an",
"HTTP",
"PUT",
"request",
"."
] | train | https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/PassthroughResourcesImpl.java#L97-L100 |
pravega/pravega | segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/AsyncTableEntryReader.java | AsyncTableEntryReader.readKey | static AsyncTableEntryReader<TableKey> readKey(long keyVersion, EntrySerializer serializer, TimeoutTimer timer) {
return new KeyReader(keyVersion, serializer, timer);
} | java | static AsyncTableEntryReader<TableKey> readKey(long keyVersion, EntrySerializer serializer, TimeoutTimer timer) {
return new KeyReader(keyVersion, serializer, timer);
} | [
"static",
"AsyncTableEntryReader",
"<",
"TableKey",
">",
"readKey",
"(",
"long",
"keyVersion",
",",
"EntrySerializer",
"serializer",
",",
"TimeoutTimer",
"timer",
")",
"{",
"return",
"new",
"KeyReader",
"(",
"keyVersion",
",",
"serializer",
",",
"timer",
")",
";... | Creates a new {@link AsyncTableEntryReader} that can be used to read a key.
@param keyVersion The version of the {@link TableKey} that is located at this position. This will be used for
constructing the result and has no bearing on the reading/matching logic.
@param serializer The {@link EntrySerializer} to use for deserializing the Keys.
@param timer Timer for the whole operation.
@return A new instance of the {@link AsyncTableEntryReader} class. The {@link #getResult()} will be completed with
an {@link TableKey} instance once a key is read. | [
"Creates",
"a",
"new",
"{",
"@link",
"AsyncTableEntryReader",
"}",
"that",
"can",
"be",
"used",
"to",
"read",
"a",
"key",
"."
] | train | https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/AsyncTableEntryReader.java#L105-L107 |
Faylixe/googlecodejam-client | src/main/java/fr/faylixe/googlecodejam/client/Round.java | Round.fromIdentifier | public static Round fromIdentifier(final String identifier, final String cookie) throws GeneralSecurityException, IOException {
final StringBuilder builder = new StringBuilder();
builder
.append(CODEJAM_PATH)
.append(identifier)
.append(ROUND_PREFIX);
return fromURL(builder.toString(), cookie);
} | java | public static Round fromIdentifier(final String identifier, final String cookie) throws GeneralSecurityException, IOException {
final StringBuilder builder = new StringBuilder();
builder
.append(CODEJAM_PATH)
.append(identifier)
.append(ROUND_PREFIX);
return fromURL(builder.toString(), cookie);
} | [
"public",
"static",
"Round",
"fromIdentifier",
"(",
"final",
"String",
"identifier",
",",
"final",
"String",
"cookie",
")",
"throws",
"GeneralSecurityException",
",",
"IOException",
"{",
"final",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
"... | <p>Static factory method that creates a round from the
given <tt>identifier</tt>.</p>
@param identifier Round id to use.
@param cookie Cookie value to use for retrieving contest.
@return Created round.
@throws IOException If any error occurs while retrieving round information.
@throws GeneralSecurityException If any error occurs while creating {@link HttpRequestExecutor} instance. | [
"<p",
">",
"Static",
"factory",
"method",
"that",
"creates",
"a",
"round",
"from",
"the",
"given",
"<tt",
">",
"identifier<",
"/",
"tt",
">",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/Faylixe/googlecodejam-client/blob/84a5fed4e049dca48994dc3f70213976aaff4bd3/src/main/java/fr/faylixe/googlecodejam/client/Round.java#L101-L108 |
j-a-w-r/jawr-main-repo | jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/css/CssImageUrlRewriter.java | CssImageUrlRewriter.getRewrittenImagePath | protected String getRewrittenImagePath(String originalCssPath, String newCssPath, String url) throws IOException {
String imgUrl = null;
// Retrieve the current CSS file from which the CSS image is referenced
boolean generatedImg = false;
if (binaryRsHandler != null) {
GeneratorRegistry imgRsGeneratorRegistry = binaryRsHandler.getConfig().getGeneratorRegistry();
generatedImg = imgRsGeneratorRegistry.isGeneratedBinaryResource(url);
}
String fullImgPath = PathNormalizer.concatWebPath(originalCssPath, url);
if (!generatedImg) {
// Add image servlet path in the URL, if it's defined
if (StringUtils.isNotEmpty(binaryServletPath)) {
fullImgPath = binaryServletPath + JawrConstant.URL_SEPARATOR + fullImgPath;
}
imgUrl = PathNormalizer.getRelativeWebPath(PathNormalizer.getParentPath(newCssPath), fullImgPath);
} else {
imgUrl = url;
}
return imgUrl;
} | java | protected String getRewrittenImagePath(String originalCssPath, String newCssPath, String url) throws IOException {
String imgUrl = null;
// Retrieve the current CSS file from which the CSS image is referenced
boolean generatedImg = false;
if (binaryRsHandler != null) {
GeneratorRegistry imgRsGeneratorRegistry = binaryRsHandler.getConfig().getGeneratorRegistry();
generatedImg = imgRsGeneratorRegistry.isGeneratedBinaryResource(url);
}
String fullImgPath = PathNormalizer.concatWebPath(originalCssPath, url);
if (!generatedImg) {
// Add image servlet path in the URL, if it's defined
if (StringUtils.isNotEmpty(binaryServletPath)) {
fullImgPath = binaryServletPath + JawrConstant.URL_SEPARATOR + fullImgPath;
}
imgUrl = PathNormalizer.getRelativeWebPath(PathNormalizer.getParentPath(newCssPath), fullImgPath);
} else {
imgUrl = url;
}
return imgUrl;
} | [
"protected",
"String",
"getRewrittenImagePath",
"(",
"String",
"originalCssPath",
",",
"String",
"newCssPath",
",",
"String",
"url",
")",
"throws",
"IOException",
"{",
"String",
"imgUrl",
"=",
"null",
";",
"// Retrieve the current CSS file from which the CSS image is refere... | Returns the rewritten image path
@param originalCssPath
the original Css path
@param newCssPath
the new Css path
@param url
the image URL
@return the rewritten image path
@throws IOException
if an IOException occurs | [
"Returns",
"the",
"rewritten",
"image",
"path"
] | train | https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/css/CssImageUrlRewriter.java#L257-L282 |
mlhartme/sushi | src/main/java/net/oneandone/sushi/fs/World.java | World.locateClasspathEntry | public FileNode locateClasspathEntry(Class<?> c) {
return locateEntry(c, Reflect.resourceName(c), false);
} | java | public FileNode locateClasspathEntry(Class<?> c) {
return locateEntry(c, Reflect.resourceName(c), false);
} | [
"public",
"FileNode",
"locateClasspathEntry",
"(",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"return",
"locateEntry",
"(",
"c",
",",
"Reflect",
".",
"resourceName",
"(",
"c",
")",
",",
"false",
")",
";",
"}"
] | Returns the file or directory containing the specified class. Does not search modules
@param c the source class
@return the physical file defining the class | [
"Returns",
"the",
"file",
"or",
"directory",
"containing",
"the",
"specified",
"class",
".",
"Does",
"not",
"search",
"modules"
] | train | https://github.com/mlhartme/sushi/blob/4af33414b04bd58584d4febe5cc63ef6c7346a75/src/main/java/net/oneandone/sushi/fs/World.java#L539-L541 |
lessthanoptimal/BoofCV | main/boofcv-recognition/src/main/java/boofcv/alg/tracker/circulant/CirculantTracker.java | CirculantTracker.elementMultConjB | public static void elementMultConjB( InterleavedF64 a , InterleavedF64 b , InterleavedF64 output ) {
for( int y = 0; y < a.height; y++ ) {
int index = a.startIndex + y*a.stride;
for( int x = 0; x < a.width; x++, index += 2 ) {
double realA = a.data[index];
double imgA = a.data[index+1];
double realB = b.data[index];
double imgB = b.data[index+1];
output.data[index] = realA*realB + imgA*imgB;
output.data[index+1] = -realA*imgB + imgA*realB;
}
}
} | java | public static void elementMultConjB( InterleavedF64 a , InterleavedF64 b , InterleavedF64 output ) {
for( int y = 0; y < a.height; y++ ) {
int index = a.startIndex + y*a.stride;
for( int x = 0; x < a.width; x++, index += 2 ) {
double realA = a.data[index];
double imgA = a.data[index+1];
double realB = b.data[index];
double imgB = b.data[index+1];
output.data[index] = realA*realB + imgA*imgB;
output.data[index+1] = -realA*imgB + imgA*realB;
}
}
} | [
"public",
"static",
"void",
"elementMultConjB",
"(",
"InterleavedF64",
"a",
",",
"InterleavedF64",
"b",
",",
"InterleavedF64",
"output",
")",
"{",
"for",
"(",
"int",
"y",
"=",
"0",
";",
"y",
"<",
"a",
".",
"height",
";",
"y",
"++",
")",
"{",
"int",
"... | Element-wise multiplication of 'a' and the complex conjugate of 'b' | [
"Element",
"-",
"wise",
"multiplication",
"of",
"a",
"and",
"the",
"complex",
"conjugate",
"of",
"b"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/circulant/CirculantTracker.java#L504-L520 |
marklogic/java-client-api | marklogic-client-api/src/main/java/com/marklogic/client/datamovement/ProgressListener.java | ProgressListener.invokeConsumer | protected void invokeConsumer(Consumer<ProgressUpdate> consumer, ProgressUpdate progressUpdate) {
try {
consumer.accept(progressUpdate);
} catch (Throwable t) {
logger.error("Exception thrown by a Consumer<ProgressUpdate> consumer: " + consumer + "; progressUpdate: " + progressUpdate, t);
}
} | java | protected void invokeConsumer(Consumer<ProgressUpdate> consumer, ProgressUpdate progressUpdate) {
try {
consumer.accept(progressUpdate);
} catch (Throwable t) {
logger.error("Exception thrown by a Consumer<ProgressUpdate> consumer: " + consumer + "; progressUpdate: " + progressUpdate, t);
}
} | [
"protected",
"void",
"invokeConsumer",
"(",
"Consumer",
"<",
"ProgressUpdate",
">",
"consumer",
",",
"ProgressUpdate",
"progressUpdate",
")",
"{",
"try",
"{",
"consumer",
".",
"accept",
"(",
"progressUpdate",
")",
";",
"}",
"catch",
"(",
"Throwable",
"t",
")",... | Protected so that a subclass can override how a consumer is invoked, particularly how an exception is handled.
@param consumer
@param progressUpdate | [
"Protected",
"so",
"that",
"a",
"subclass",
"can",
"override",
"how",
"a",
"consumer",
"is",
"invoked",
"particularly",
"how",
"an",
"exception",
"is",
"handled",
"."
] | train | https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/datamovement/ProgressListener.java#L164-L170 |
Samsung/GearVRf | GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRWorld.java | GVRWorld.startDrag | public boolean startDrag(final GVRSceneObject sceneObject,
final float hitX, final float hitY, final float hitZ) {
final GVRRigidBody dragMe = (GVRRigidBody)sceneObject.getComponent(GVRRigidBody.getComponentType());
if (dragMe == null || dragMe.getSimulationType() != GVRRigidBody.DYNAMIC || !contains(dragMe))
return false;
GVRTransform t = sceneObject.getTransform();
final Vector3f relPos = new Vector3f(hitX, hitY, hitZ);
relPos.mul(t.getScaleX(), t.getScaleY(), t.getScaleZ());
relPos.rotate(new Quaternionf(t.getRotationX(), t.getRotationY(), t.getRotationZ(), t.getRotationW()));
final GVRSceneObject pivotObject = mPhysicsDragger.startDrag(sceneObject,
relPos.x, relPos.y, relPos.z);
if (pivotObject == null)
return false;
mPhysicsContext.runOnPhysicsThread(new Runnable() {
@Override
public void run() {
mRigidBodyDragMe = dragMe;
NativePhysics3DWorld.startDrag(getNative(), pivotObject.getNative(), dragMe.getNative(),
hitX, hitY, hitZ);
}
});
return true;
} | java | public boolean startDrag(final GVRSceneObject sceneObject,
final float hitX, final float hitY, final float hitZ) {
final GVRRigidBody dragMe = (GVRRigidBody)sceneObject.getComponent(GVRRigidBody.getComponentType());
if (dragMe == null || dragMe.getSimulationType() != GVRRigidBody.DYNAMIC || !contains(dragMe))
return false;
GVRTransform t = sceneObject.getTransform();
final Vector3f relPos = new Vector3f(hitX, hitY, hitZ);
relPos.mul(t.getScaleX(), t.getScaleY(), t.getScaleZ());
relPos.rotate(new Quaternionf(t.getRotationX(), t.getRotationY(), t.getRotationZ(), t.getRotationW()));
final GVRSceneObject pivotObject = mPhysicsDragger.startDrag(sceneObject,
relPos.x, relPos.y, relPos.z);
if (pivotObject == null)
return false;
mPhysicsContext.runOnPhysicsThread(new Runnable() {
@Override
public void run() {
mRigidBodyDragMe = dragMe;
NativePhysics3DWorld.startDrag(getNative(), pivotObject.getNative(), dragMe.getNative(),
hitX, hitY, hitZ);
}
});
return true;
} | [
"public",
"boolean",
"startDrag",
"(",
"final",
"GVRSceneObject",
"sceneObject",
",",
"final",
"float",
"hitX",
",",
"final",
"float",
"hitY",
",",
"final",
"float",
"hitZ",
")",
"{",
"final",
"GVRRigidBody",
"dragMe",
"=",
"(",
"GVRRigidBody",
")",
"sceneObje... | Start the drag operation of a scene object with a rigid body.
@param sceneObject Scene object with a rigid body attached to it.
@param hitX rel position in x-axis.
@param hitY rel position in y-axis.
@param hitZ rel position in z-axis.
@return true if success, otherwise returns false. | [
"Start",
"the",
"drag",
"operation",
"of",
"a",
"scene",
"object",
"with",
"a",
"rigid",
"body",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/gvrf-physics/src/main/java/org/gearvrf/physics/GVRWorld.java#L190-L217 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_serviceMonitoring_monitoringId_alert_sms_alertId_PUT | public void serviceName_serviceMonitoring_monitoringId_alert_sms_alertId_PUT(String serviceName, Long monitoringId, Long alertId, OvhSmsAlert body) throws IOException {
String qPath = "/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/sms/{alertId}";
StringBuilder sb = path(qPath, serviceName, monitoringId, alertId);
exec(qPath, "PUT", sb.toString(), body);
} | java | public void serviceName_serviceMonitoring_monitoringId_alert_sms_alertId_PUT(String serviceName, Long monitoringId, Long alertId, OvhSmsAlert body) throws IOException {
String qPath = "/dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/sms/{alertId}";
StringBuilder sb = path(qPath, serviceName, monitoringId, alertId);
exec(qPath, "PUT", sb.toString(), body);
} | [
"public",
"void",
"serviceName_serviceMonitoring_monitoringId_alert_sms_alertId_PUT",
"(",
"String",
"serviceName",
",",
"Long",
"monitoringId",
",",
"Long",
"alertId",
",",
"OvhSmsAlert",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/dedicated/se... | Alter this object properties
REST: PUT /dedicated/server/{serviceName}/serviceMonitoring/{monitoringId}/alert/sms/{alertId}
@param body [required] New object properties
@param serviceName [required] The internal name of your dedicated server
@param monitoringId [required] This monitoring id
@param alertId [required] Id of this alert | [
"Alter",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L2164-L2168 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java | VirtualNetworkGatewaysInner.getVpnProfilePackageUrl | public String getVpnProfilePackageUrl(String resourceGroupName, String virtualNetworkGatewayName) {
return getVpnProfilePackageUrlWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().last().body();
} | java | public String getVpnProfilePackageUrl(String resourceGroupName, String virtualNetworkGatewayName) {
return getVpnProfilePackageUrlWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName).toBlocking().last().body();
} | [
"public",
"String",
"getVpnProfilePackageUrl",
"(",
"String",
"resourceGroupName",
",",
"String",
"virtualNetworkGatewayName",
")",
"{",
"return",
"getVpnProfilePackageUrlWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"virtualNetworkGatewayName",
")",
".",
"toBlockin... | Gets pre-generated VPN profile for P2S client of the virtual network gateway in the specified resource group. The profile needs to be generated first using generateVpnProfile.
@param resourceGroupName The name of the resource group.
@param virtualNetworkGatewayName The name of the virtual network gateway.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the String object if successful. | [
"Gets",
"pre",
"-",
"generated",
"VPN",
"profile",
"for",
"P2S",
"client",
"of",
"the",
"virtual",
"network",
"gateway",
"in",
"the",
"specified",
"resource",
"group",
".",
"The",
"profile",
"needs",
"to",
"be",
"generated",
"first",
"using",
"generateVpnProfi... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/VirtualNetworkGatewaysInner.java#L1799-L1801 |
jhunters/jprotobuf | v3/src/main/java/com/baidu/bjf/remoting/protobuf/MapEntryLite.java | MapEntryLite.computeSerializedSize | static <K, V> int computeSerializedSize(Metadata<K, V> metadata, K key, V value) {
return CodedConstant.computeElementSize(metadata.keyType, KEY_FIELD_NUMBER, key)
+ CodedConstant.computeElementSize(metadata.valueType, VALUE_FIELD_NUMBER, value);
} | java | static <K, V> int computeSerializedSize(Metadata<K, V> metadata, K key, V value) {
return CodedConstant.computeElementSize(metadata.keyType, KEY_FIELD_NUMBER, key)
+ CodedConstant.computeElementSize(metadata.valueType, VALUE_FIELD_NUMBER, value);
} | [
"static",
"<",
"K",
",",
"V",
">",
"int",
"computeSerializedSize",
"(",
"Metadata",
"<",
"K",
",",
"V",
">",
"metadata",
",",
"K",
"key",
",",
"V",
"value",
")",
"{",
"return",
"CodedConstant",
".",
"computeElementSize",
"(",
"metadata",
".",
"keyType",
... | Compute serialized size.
@param <K> the key type
@param <V> the value type
@param metadata the metadata
@param key the key
@param value the value
@return the int | [
"Compute",
"serialized",
"size",
"."
] | train | https://github.com/jhunters/jprotobuf/blob/55832c9b4792afb128e5b35139d8a3891561d8a3/v3/src/main/java/com/baidu/bjf/remoting/protobuf/MapEntryLite.java#L185-L188 |
Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java | CompletableFuture.bipush | final void bipush(CompletableFuture<?> b, BiCompletion<?, ?, ?> c) {
if (c != null) {
while (result == null) {
if (tryPushStack(c)) {
if (b.result == null)
b.unipush(new CoCompletion(c));
else if (result != null)
c.tryFire(SYNC);
return;
}
}
b.unipush(c);
}
} | java | final void bipush(CompletableFuture<?> b, BiCompletion<?, ?, ?> c) {
if (c != null) {
while (result == null) {
if (tryPushStack(c)) {
if (b.result == null)
b.unipush(new CoCompletion(c));
else if (result != null)
c.tryFire(SYNC);
return;
}
}
b.unipush(c);
}
} | [
"final",
"void",
"bipush",
"(",
"CompletableFuture",
"<",
"?",
">",
"b",
",",
"BiCompletion",
"<",
"?",
",",
"?",
",",
"?",
">",
"c",
")",
"{",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"while",
"(",
"result",
"==",
"null",
")",
"{",
"if",
"(",
... | Pushes completion to this and b unless both done. Caller should first check that either result
or b.result is null. | [
"Pushes",
"completion",
"to",
"this",
"and",
"b",
"unless",
"both",
"done",
".",
"Caller",
"should",
"first",
"check",
"that",
"either",
"result",
"or",
"b",
".",
"result",
"is",
"null",
"."
] | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java#L1006-L1019 |
palatable/lambda | src/main/java/com/jnape/palatable/lambda/optics/lenses/HListLens.java | HListLens.elementAt | public static <E, List extends HCons<?, ?>> Lens.Simple<List, E> elementAt(Index<E, List> index) {
return simpleLens(index::get, (l, e) -> index.set(e, l));
} | java | public static <E, List extends HCons<?, ?>> Lens.Simple<List, E> elementAt(Index<E, List> index) {
return simpleLens(index::get, (l, e) -> index.set(e, l));
} | [
"public",
"static",
"<",
"E",
",",
"List",
"extends",
"HCons",
"<",
"?",
",",
"?",
">",
">",
"Lens",
".",
"Simple",
"<",
"List",
",",
"E",
">",
"elementAt",
"(",
"Index",
"<",
"E",
",",
"List",
">",
"index",
")",
"{",
"return",
"simpleLens",
"(",... | Focus invariantly on the element at the specified {@link Index} in an {@link HList}.
@param index the index of the element to focus on
@param <E> the element type
@param <List> the HList under focus
@return a lens focusing on the element at index | [
"Focus",
"invariantly",
"on",
"the",
"element",
"at",
"the",
"specified",
"{",
"@link",
"Index",
"}",
"in",
"an",
"{",
"@link",
"HList",
"}",
"."
] | train | https://github.com/palatable/lambda/blob/b643ba836c5916d1d8193822e5efb4e7b40c489a/src/main/java/com/jnape/palatable/lambda/optics/lenses/HListLens.java#L24-L26 |
actframework/actframework | src/main/java/act/event/EventBus.java | EventBus.bindSync | public synchronized EventBus bindSync(SysEventId sysEventId, SysEventListener sysEventListener) {
return _bind(sysEventListeners, sysEventId, sysEventListener);
} | java | public synchronized EventBus bindSync(SysEventId sysEventId, SysEventListener sysEventListener) {
return _bind(sysEventListeners, sysEventId, sysEventListener);
} | [
"public",
"synchronized",
"EventBus",
"bindSync",
"(",
"SysEventId",
"sysEventId",
",",
"SysEventListener",
"sysEventListener",
")",
"{",
"return",
"_bind",
"(",
"sysEventListeners",
",",
"sysEventId",
",",
"sysEventListener",
")",
";",
"}"
] | Bind an {@link SysEventListener} to a {@link SysEventId} synchronously.
**Note** this method is not supposed to be called by user application
directly.
@param sysEventId
the {@link SysEventId system event ID}
@param sysEventListener
an instance of {@link SysEventListener}
@return this event bus instance
@see #bind(SysEventId, SysEventListener) | [
"Bind",
"an",
"{",
"@link",
"SysEventListener",
"}",
"to",
"a",
"{",
"@link",
"SysEventId",
"}",
"synchronously",
"."
] | train | https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/event/EventBus.java#L751-L753 |
VoltDB/voltdb | src/frontend/org/voltdb/StatsAgent.java | StatsAgent.getStatsAggregate | public VoltTable getStatsAggregate(
final StatsSelector selector,
final boolean interval,
final Long now) {
return getStatsAggregateInternal(selector, interval, now);
} | java | public VoltTable getStatsAggregate(
final StatsSelector selector,
final boolean interval,
final Long now) {
return getStatsAggregateInternal(selector, interval, now);
} | [
"public",
"VoltTable",
"getStatsAggregate",
"(",
"final",
"StatsSelector",
"selector",
",",
"final",
"boolean",
"interval",
",",
"final",
"Long",
"now",
")",
"{",
"return",
"getStatsAggregateInternal",
"(",
"selector",
",",
"interval",
",",
"now",
")",
";",
"}"
... | Get aggregate statistics on this node for the given selector.
If you need both site-wise and node-wise stats, register the appropriate StatsSources for that
selector with each siteId and then some other value for the node-level stats (PLANNER stats uses -1).
This call will automatically aggregate every StatsSource registered for every 'site'ID for that selector.
@param selector @Statistics selector keyword
@param interval true if processing a reporting interval
@param now current timestamp
@return statistics VoltTable results | [
"Get",
"aggregate",
"statistics",
"on",
"this",
"node",
"for",
"the",
"given",
"selector",
".",
"If",
"you",
"need",
"both",
"site",
"-",
"wise",
"and",
"node",
"-",
"wise",
"stats",
"register",
"the",
"appropriate",
"StatsSources",
"for",
"that",
"selector"... | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/StatsAgent.java#L724-L729 |
datasift/datasift-java | src/main/java/com/datasift/client/managedsource/DataSiftManagedSource.java | DataSiftManagedSource.get | public FutureData<ManagedSource> get(String id) {
FutureData<ManagedSource> future = new FutureData<>();
URI uri = newParams().put("id", id).forURL(config.newAPIEndpointURI(GET));
Request request = config.http().
GET(uri, new PageReader(newRequestCallback(future, new ManagedSource(), config)));
performRequest(future, request);
return future;
} | java | public FutureData<ManagedSource> get(String id) {
FutureData<ManagedSource> future = new FutureData<>();
URI uri = newParams().put("id", id).forURL(config.newAPIEndpointURI(GET));
Request request = config.http().
GET(uri, new PageReader(newRequestCallback(future, new ManagedSource(), config)));
performRequest(future, request);
return future;
} | [
"public",
"FutureData",
"<",
"ManagedSource",
">",
"get",
"(",
"String",
"id",
")",
"{",
"FutureData",
"<",
"ManagedSource",
">",
"future",
"=",
"new",
"FutureData",
"<>",
"(",
")",
";",
"URI",
"uri",
"=",
"newParams",
"(",
")",
".",
"put",
"(",
"\"id\... | /*
@param id the ID of the managed source to fetch
@return the managed source for the ID provided | [
"/",
"*"
] | train | https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/managedsource/DataSiftManagedSource.java#L313-L320 |
alkacon/opencms-core | src/org/opencms/main/CmsShellCommands.java | CmsShellCommands.exportResources | public void exportResources(String exportFile, String pathList, boolean isReducedExportMode) throws Exception {
StringTokenizer tok = new StringTokenizer(pathList, ";");
List<String> exportPaths = new ArrayList<String>();
while (tok.hasMoreTokens()) {
exportPaths.add(tok.nextToken());
}
boolean includeSystem = false;
if (pathList.startsWith(CmsWorkplace.VFS_PATH_SYSTEM)
|| (pathList.indexOf(";" + CmsWorkplace.VFS_PATH_SYSTEM) > -1)) {
includeSystem = true;
}
CmsVfsImportExportHandler vfsExportHandler = new CmsVfsImportExportHandler();
CmsExportParameters params = new CmsExportParameters(
exportFile,
null,
true,
false,
false,
exportPaths,
includeSystem,
true,
0,
true,
false,
isReducedExportMode ? ExportMode.REDUCED : ExportMode.DEFAULT);
vfsExportHandler.setExportParams(params);
OpenCms.getImportExportManager().exportData(
m_cms,
vfsExportHandler,
new CmsShellReport(m_cms.getRequestContext().getLocale()));
} | java | public void exportResources(String exportFile, String pathList, boolean isReducedExportMode) throws Exception {
StringTokenizer tok = new StringTokenizer(pathList, ";");
List<String> exportPaths = new ArrayList<String>();
while (tok.hasMoreTokens()) {
exportPaths.add(tok.nextToken());
}
boolean includeSystem = false;
if (pathList.startsWith(CmsWorkplace.VFS_PATH_SYSTEM)
|| (pathList.indexOf(";" + CmsWorkplace.VFS_PATH_SYSTEM) > -1)) {
includeSystem = true;
}
CmsVfsImportExportHandler vfsExportHandler = new CmsVfsImportExportHandler();
CmsExportParameters params = new CmsExportParameters(
exportFile,
null,
true,
false,
false,
exportPaths,
includeSystem,
true,
0,
true,
false,
isReducedExportMode ? ExportMode.REDUCED : ExportMode.DEFAULT);
vfsExportHandler.setExportParams(params);
OpenCms.getImportExportManager().exportData(
m_cms,
vfsExportHandler,
new CmsShellReport(m_cms.getRequestContext().getLocale()));
} | [
"public",
"void",
"exportResources",
"(",
"String",
"exportFile",
",",
"String",
"pathList",
",",
"boolean",
"isReducedExportMode",
")",
"throws",
"Exception",
"{",
"StringTokenizer",
"tok",
"=",
"new",
"StringTokenizer",
"(",
"pathList",
",",
"\";\"",
")",
";",
... | Exports a list of resources from the current site root to a ZIP file.<p>
The resource names in the list must be separated with a ";".<p>
@param exportFile the name (absolute path) of the ZIP file to export to
@param pathList the list of resource to export, separated with a ";"
@param isReducedExportMode flag, indicating if the reduced export mode should be used
@throws Exception if something goes wrong | [
"Exports",
"a",
"list",
"of",
"resources",
"from",
"the",
"current",
"site",
"root",
"to",
"a",
"ZIP",
"file",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsShellCommands.java#L679-L712 |
google/closure-templates | java/src/com/google/template/soy/basetree/CopyState.java | CopyState.updateRefs | public <T> void updateRefs(T oldObject, T newObject) {
checkNotNull(oldObject);
checkNotNull(newObject);
checkArgument(!(newObject instanceof Listener));
Object previousMapping = mappings.put(oldObject, newObject);
if (previousMapping != null) {
if (previousMapping instanceof Listener) {
@SuppressWarnings("unchecked") // Listener<T> can only be registered with a T
Listener<T> listener = (Listener<T>) previousMapping;
listener.newVersion(newObject);
} else {
throw new IllegalStateException("found multiple remappings for " + oldObject);
}
}
} | java | public <T> void updateRefs(T oldObject, T newObject) {
checkNotNull(oldObject);
checkNotNull(newObject);
checkArgument(!(newObject instanceof Listener));
Object previousMapping = mappings.put(oldObject, newObject);
if (previousMapping != null) {
if (previousMapping instanceof Listener) {
@SuppressWarnings("unchecked") // Listener<T> can only be registered with a T
Listener<T> listener = (Listener<T>) previousMapping;
listener.newVersion(newObject);
} else {
throw new IllegalStateException("found multiple remappings for " + oldObject);
}
}
} | [
"public",
"<",
"T",
">",
"void",
"updateRefs",
"(",
"T",
"oldObject",
",",
"T",
"newObject",
")",
"{",
"checkNotNull",
"(",
"oldObject",
")",
";",
"checkNotNull",
"(",
"newObject",
")",
";",
"checkArgument",
"(",
"!",
"(",
"newObject",
"instanceof",
"Liste... | Registers that the old object has been remapped to the new object.
<p>This is useful for auxiliary AST datastructures which may contain back-edges in the AST.
When being copied, the auxiliary data structure is registered with this method then AST nodes
which have references to the old copy can register via {@link #registerRefListener} so that
they can get a reference to the new copy as well. | [
"Registers",
"that",
"the",
"old",
"object",
"has",
"been",
"remapped",
"to",
"the",
"new",
"object",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/basetree/CopyState.java#L54-L68 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.