code stringlengths 63 466k | code_sememe stringlengths 141 3.79M | token_type stringlengths 274 1.23M |
|---|---|---|
public static int getMaxSerializedSizeBytes(final int k, final long n) {
final int numLevels = KllHelper.ubOnNumLevels(n);
final int maxNumItems = KllHelper.computeTotalCapacity(k, DEFAULT_M, numLevels);
return getSerializedSizeBytes(numLevels, maxNumItems);
} | class class_name[name] begin[{]
method[getMaxSerializedSizeBytes, return_type[type[int]], modifier[public static], parameter[k, n]] begin[{]
local_variable[type[int], numLevels]
local_variable[type[int], maxNumItems]
return[call[.getSerializedSizeBytes, parameter[member[.numLevels], member[.maxNumItems]]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[getMaxSerializedSizeBytes] operator[SEP] Keyword[final] Keyword[int] identifier[k] , Keyword[final] Keyword[long] identifier[n] operator[SEP] {
Keyword[final] Keyword[int] identifier[numLevels] operator[=] identifier[KllHelper] operator[SEP] identifier[ubOnNumLevels] operator[SEP] identifier[n] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[maxNumItems] operator[=] identifier[KllHelper] operator[SEP] identifier[computeTotalCapacity] operator[SEP] identifier[k] , identifier[DEFAULT_M] , identifier[numLevels] operator[SEP] operator[SEP] Keyword[return] identifier[getSerializedSizeBytes] operator[SEP] identifier[numLevels] , identifier[maxNumItems] operator[SEP] operator[SEP]
}
|
public LineString fromTransferObject(LineStringTo input, CrsId crsId) {
if (input == null) { return null; }
crsId = getCrsId(input, crsId);
isValid(input);
return new LineString(createPointSequence(input.getCoordinates(), crsId));
} | class class_name[name] begin[{]
method[fromTransferObject, return_type[type[LineString]], modifier[public], parameter[input, crsId]] begin[{]
if[binary_operation[member[.input], ==, literal[null]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
assign[member[.crsId], call[.getCrsId, parameter[member[.input], member[.crsId]]]]
call[.isValid, parameter[member[.input]]]
return[ClassCreator(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCoordinates, postfix_operators=[], prefix_operators=[], qualifier=input, selectors=[], type_arguments=None), MemberReference(member=crsId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createPointSequence, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LineString, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[LineString] identifier[fromTransferObject] operator[SEP] identifier[LineStringTo] identifier[input] , identifier[CrsId] identifier[crsId] operator[SEP] {
Keyword[if] operator[SEP] identifier[input] operator[==] Other[null] operator[SEP] {
Keyword[return] Other[null] operator[SEP]
}
identifier[crsId] operator[=] identifier[getCrsId] operator[SEP] identifier[input] , identifier[crsId] operator[SEP] operator[SEP] identifier[isValid] operator[SEP] identifier[input] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[LineString] operator[SEP] identifier[createPointSequence] operator[SEP] identifier[input] operator[SEP] identifier[getCoordinates] operator[SEP] operator[SEP] , identifier[crsId] operator[SEP] operator[SEP] operator[SEP]
}
|
public Date getLastIndexed(FeatureIndexType type) {
Date lastIndexed = null;
if (type == null) {
lastIndexed = getLastIndexed();
} else {
switch (type) {
case GEOPACKAGE:
lastIndexed = featureTableIndex.getLastIndexed();
break;
case RTREE:
if (rTreeIndexTableDao.has()) {
// Updated by triggers, assume up to date
lastIndexed = new Date();
}
break;
default:
throw new GeoPackageException("Unsupported FeatureIndexType: "
+ type);
}
}
return lastIndexed;
} | class class_name[name] begin[{]
method[getLastIndexed, return_type[type[Date]], modifier[public], parameter[type]] begin[{]
local_variable[type[Date], lastIndexed]
if[binary_operation[member[.type], ==, literal[null]]] begin[{]
assign[member[.lastIndexed], call[.getLastIndexed, parameter[]]]
else begin[{]
SwitchStatement(cases=[SwitchStatementCase(case=['GEOPACKAGE'], statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastIndexed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=getLastIndexed, postfix_operators=[], prefix_operators=[], qualifier=featureTableIndex, selectors=[], type_arguments=None)), label=None), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=['RTREE'], statements=[IfStatement(condition=MethodInvocation(arguments=[], member=has, postfix_operators=[], prefix_operators=[], qualifier=rTreeIndexTableDao, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=lastIndexed, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Date, sub_type=None))), label=None)])), BreakStatement(goto=None, label=None)]), SwitchStatementCase(case=[], statements=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unsupported FeatureIndexType: "), operandr=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GeoPackageException, sub_type=None)), label=None)])], expression=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)
end[}]
return[member[.lastIndexed]]
end[}]
END[}] | Keyword[public] identifier[Date] identifier[getLastIndexed] operator[SEP] identifier[FeatureIndexType] identifier[type] operator[SEP] {
identifier[Date] identifier[lastIndexed] operator[=] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] Other[null] operator[SEP] {
identifier[lastIndexed] operator[=] identifier[getLastIndexed] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[switch] operator[SEP] identifier[type] operator[SEP] {
Keyword[case] identifier[GEOPACKAGE] operator[:] identifier[lastIndexed] operator[=] identifier[featureTableIndex] operator[SEP] identifier[getLastIndexed] operator[SEP] operator[SEP] operator[SEP] Keyword[break] operator[SEP] Keyword[case] identifier[RTREE] operator[:] Keyword[if] operator[SEP] identifier[rTreeIndexTableDao] operator[SEP] identifier[has] operator[SEP] operator[SEP] operator[SEP] {
identifier[lastIndexed] operator[=] Keyword[new] identifier[Date] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[break] operator[SEP] Keyword[default] operator[:] Keyword[throw] Keyword[new] identifier[GeoPackageException] operator[SEP] literal[String] operator[+] identifier[type] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[lastIndexed] operator[SEP]
}
|
public static EnumDyeColor getColor(IBlockState state)
{
ColorComponent cc = IComponent.getComponent(ColorComponent.class, state.getBlock());
if (cc == null)
return EnumDyeColor.WHITE;
PropertyEnum<EnumDyeColor> property = cc.getProperty();
if (property == null || !state.getProperties().containsKey(property))
return EnumDyeColor.WHITE;
return state.getValue(property);
} | class class_name[name] begin[{]
method[getColor, return_type[type[EnumDyeColor]], modifier[public static], parameter[state]] begin[{]
local_variable[type[ColorComponent], cc]
if[binary_operation[member[.cc], ==, literal[null]]] begin[{]
return[member[EnumDyeColor.WHITE]]
else begin[{]
None
end[}]
local_variable[type[PropertyEnum], property]
if[binary_operation[binary_operation[member[.property], ==, literal[null]], ||, call[state.getProperties, parameter[]]]] begin[{]
return[member[EnumDyeColor.WHITE]]
else begin[{]
None
end[}]
return[call[state.getValue, parameter[member[.property]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[EnumDyeColor] identifier[getColor] operator[SEP] identifier[IBlockState] identifier[state] operator[SEP] {
identifier[ColorComponent] identifier[cc] operator[=] identifier[IComponent] operator[SEP] identifier[getComponent] operator[SEP] identifier[ColorComponent] operator[SEP] Keyword[class] , identifier[state] operator[SEP] identifier[getBlock] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cc] operator[==] Other[null] operator[SEP] Keyword[return] identifier[EnumDyeColor] operator[SEP] identifier[WHITE] operator[SEP] identifier[PropertyEnum] operator[<] identifier[EnumDyeColor] operator[>] identifier[property] operator[=] identifier[cc] operator[SEP] identifier[getProperty] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[property] operator[==] Other[null] operator[||] operator[!] identifier[state] operator[SEP] identifier[getProperties] operator[SEP] operator[SEP] operator[SEP] identifier[containsKey] operator[SEP] identifier[property] operator[SEP] operator[SEP] Keyword[return] identifier[EnumDyeColor] operator[SEP] identifier[WHITE] operator[SEP] Keyword[return] identifier[state] operator[SEP] identifier[getValue] operator[SEP] identifier[property] operator[SEP] operator[SEP]
}
|
public static String getRelativeURI( HttpServletRequest request, String uri, PageFlowController relativeTo )
{
String contextPath = request.getContextPath();
if ( relativeTo != null ) contextPath += relativeTo.getModulePath();
int overlap = uri.indexOf( contextPath + '/' );
if ( overlap == -1 ) return null;
return uri.substring( overlap + contextPath.length() );
} | class class_name[name] begin[{]
method[getRelativeURI, return_type[type[String]], modifier[public static], parameter[request, uri, relativeTo]] begin[{]
local_variable[type[String], contextPath]
if[binary_operation[member[.relativeTo], !=, literal[null]]] begin[{]
assign[member[.contextPath], call[relativeTo.getModulePath, parameter[]]]
else begin[{]
None
end[}]
local_variable[type[int], overlap]
if[binary_operation[member[.overlap], ==, literal[1]]] begin[{]
return[literal[null]]
else begin[{]
None
end[}]
return[call[uri.substring, parameter[binary_operation[member[.overlap], +, call[contextPath.length, parameter[]]]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[getRelativeURI] operator[SEP] identifier[HttpServletRequest] identifier[request] , identifier[String] identifier[uri] , identifier[PageFlowController] identifier[relativeTo] operator[SEP] {
identifier[String] identifier[contextPath] operator[=] identifier[request] operator[SEP] identifier[getContextPath] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[relativeTo] operator[!=] Other[null] operator[SEP] identifier[contextPath] operator[+=] identifier[relativeTo] operator[SEP] identifier[getModulePath] operator[SEP] operator[SEP] operator[SEP] Keyword[int] identifier[overlap] operator[=] identifier[uri] operator[SEP] identifier[indexOf] operator[SEP] identifier[contextPath] operator[+] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[overlap] operator[==] operator[-] Other[1] operator[SEP] Keyword[return] Other[null] operator[SEP] Keyword[return] identifier[uri] operator[SEP] identifier[substring] operator[SEP] identifier[overlap] operator[+] identifier[contextPath] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
protected StringBuffer getHeaderSection(HttpServletRequest request){
StringBuffer sb = super.getHeaderSection(request);
if(null != this.config.getDwrMapping()){
sb.append(DWRParamWriter.buildDWRJSParams(request.getContextPath(),PathNormalizer.joinPaths(request.getContextPath(),
this.config.getDwrMapping())));
sb.append("if(!window.DWR)window.DWR={};\nDWR.loader = JAWR.loader;\n");
}
return sb;
} | class class_name[name] begin[{]
method[getHeaderSection, return_type[type[StringBuffer]], modifier[protected], parameter[request]] begin[{]
local_variable[type[StringBuffer], sb]
if[binary_operation[literal[null], !=, THIS[member[None.config]call[None.getDwrMapping, parameter[]]]]] begin[{]
call[sb.append, parameter[call[DWRParamWriter.buildDWRJSParams, parameter[call[request.getContextPath, parameter[]], call[PathNormalizer.joinPaths, parameter[call[request.getContextPath, parameter[]], THIS[member[None.config]call[None.getDwrMapping, parameter[]]]]]]]]]
call[sb.append, parameter[literal["if(!window.DWR)window.DWR={};\nDWR.loader = JAWR.loader;\n"]]]
else begin[{]
None
end[}]
return[member[.sb]]
end[}]
END[}] | Keyword[protected] identifier[StringBuffer] identifier[getHeaderSection] operator[SEP] identifier[HttpServletRequest] identifier[request] operator[SEP] {
identifier[StringBuffer] identifier[sb] operator[=] Keyword[super] operator[SEP] identifier[getHeaderSection] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[if] operator[SEP] Other[null] operator[!=] Keyword[this] operator[SEP] identifier[config] operator[SEP] identifier[getDwrMapping] operator[SEP] operator[SEP] operator[SEP] {
identifier[sb] operator[SEP] identifier[append] operator[SEP] identifier[DWRParamWriter] operator[SEP] identifier[buildDWRJSParams] operator[SEP] identifier[request] operator[SEP] identifier[getContextPath] operator[SEP] operator[SEP] , identifier[PathNormalizer] operator[SEP] identifier[joinPaths] operator[SEP] identifier[request] operator[SEP] identifier[getContextPath] operator[SEP] operator[SEP] , Keyword[this] operator[SEP] identifier[config] operator[SEP] identifier[getDwrMapping] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[sb] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[sb] operator[SEP]
}
|
private static OwnerAndPermission addExecutePermissionsIfRequired(FileStatus file,
OwnerAndPermission ownerAndPermission) {
if (ownerAndPermission.getFsPermission() == null) {
return ownerAndPermission;
}
if (!file.isDir()) {
return ownerAndPermission;
}
return new OwnerAndPermission(ownerAndPermission.getOwner(), ownerAndPermission.getGroup(),
addExecutePermissionToOwner(ownerAndPermission.getFsPermission()));
} | class class_name[name] begin[{]
method[addExecutePermissionsIfRequired, return_type[type[OwnerAndPermission]], modifier[private static], parameter[file, ownerAndPermission]] begin[{]
if[binary_operation[call[ownerAndPermission.getFsPermission, parameter[]], ==, literal[null]]] begin[{]
return[member[.ownerAndPermission]]
else begin[{]
None
end[}]
if[call[file.isDir, parameter[]]] begin[{]
return[member[.ownerAndPermission]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getOwner, postfix_operators=[], prefix_operators=[], qualifier=ownerAndPermission, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getGroup, postfix_operators=[], prefix_operators=[], qualifier=ownerAndPermission, selectors=[], type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getFsPermission, postfix_operators=[], prefix_operators=[], qualifier=ownerAndPermission, selectors=[], type_arguments=None)], member=addExecutePermissionToOwner, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=OwnerAndPermission, sub_type=None))]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[OwnerAndPermission] identifier[addExecutePermissionsIfRequired] operator[SEP] identifier[FileStatus] identifier[file] , identifier[OwnerAndPermission] identifier[ownerAndPermission] operator[SEP] {
Keyword[if] operator[SEP] identifier[ownerAndPermission] operator[SEP] identifier[getFsPermission] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[ownerAndPermission] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[file] operator[SEP] identifier[isDir] operator[SEP] operator[SEP] operator[SEP] {
Keyword[return] identifier[ownerAndPermission] operator[SEP]
}
Keyword[return] Keyword[new] identifier[OwnerAndPermission] operator[SEP] identifier[ownerAndPermission] operator[SEP] identifier[getOwner] operator[SEP] operator[SEP] , identifier[ownerAndPermission] operator[SEP] identifier[getGroup] operator[SEP] operator[SEP] , identifier[addExecutePermissionToOwner] operator[SEP] identifier[ownerAndPermission] operator[SEP] identifier[getFsPermission] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
private Marker requestMarker(Http.Request request) {
return append("host", request.host()).and(append("path", request.path()));
} | class class_name[name] begin[{]
method[requestMarker, return_type[type[Marker]], modifier[private], parameter[request]] begin[{]
return[call[.append, parameter[literal["host"], call[request.host, parameter[]]]]]
end[}]
END[}] | Keyword[private] identifier[Marker] identifier[requestMarker] operator[SEP] identifier[Http] operator[SEP] identifier[Request] identifier[request] operator[SEP] {
Keyword[return] identifier[append] operator[SEP] literal[String] , identifier[request] operator[SEP] identifier[host] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[and] operator[SEP] identifier[append] operator[SEP] literal[String] , identifier[request] operator[SEP] identifier[path] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static double kthSmallestValue(int[] array, int k) {
int[] index = new int[array.length];
for (int i = 0; i < index.length; i++) {
index[i] = i;
}
return array[index[select(array, index, 0, array.length - 1, k)]];
} | class class_name[name] begin[{]
method[kthSmallestValue, return_type[type[double]], modifier[public static], parameter[array, k]] begin[{]
local_variable[type[int], index]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), type==, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=index, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[member[.array]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[double] identifier[kthSmallestValue] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[array] , Keyword[int] identifier[k] operator[SEP] {
Keyword[int] operator[SEP] operator[SEP] identifier[index] operator[=] Keyword[new] Keyword[int] operator[SEP] identifier[array] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[index] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[index] operator[SEP] identifier[i] operator[SEP] operator[=] identifier[i] operator[SEP]
}
Keyword[return] identifier[array] operator[SEP] identifier[index] operator[SEP] identifier[select] operator[SEP] identifier[array] , identifier[index] , Other[0] , identifier[array] operator[SEP] identifier[length] operator[-] Other[1] , identifier[k] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public static String toJsonString(Object value) {
if (value == null) {
return "null";
}
else if (value.getClass().equals(String.class)) {
return "\"" + StringUtils.jsonEncoding(value.toString()) + "\"";
}
// else it's a RawJson, Boolean or Number so no escaping or quotes
else {
return value.toString();
}
} | class class_name[name] begin[{]
method[toJsonString, return_type[type[String]], modifier[public static], parameter[value]] begin[{]
if[binary_operation[member[.value], ==, literal[null]]] begin[{]
return[literal["null"]]
else begin[{]
if[call[value.getClass, parameter[]]] begin[{]
return[binary_operation[binary_operation[literal["\""], +, call[StringUtils.jsonEncoding, parameter[call[value.toString, parameter[]]]]], +, literal["\""]]]
else begin[{]
return[call[value.toString, parameter[]]]
end[}]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[toJsonString] operator[SEP] identifier[Object] identifier[value] operator[SEP] {
Keyword[if] operator[SEP] identifier[value] operator[==] Other[null] operator[SEP] {
Keyword[return] literal[String] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[value] operator[SEP] identifier[getClass] operator[SEP] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[String] operator[SEP] Keyword[class] operator[SEP] operator[SEP] {
Keyword[return] literal[String] operator[+] identifier[StringUtils] operator[SEP] identifier[jsonEncoding] operator[SEP] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[value] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void render() throws IOException {
if (isDisposed()) {
LOG.debug("Skipping render phase.");
return;
}
try {
// Check user context has been prepared
if (getNewConversation() == null) {
throw new IllegalStateException(
"User context has not been prepared before the render phase");
}
prepareRender();
UIContext uic = getUIContext();
if (uic == null) {
throw new IllegalStateException("No user context set for the render phase.");
}
UIContextHolder.pushContext(uic);
prepareRequest();
// Handle errors from the action phase now.
if (havePropogatedError()) {
handleError(getPropogatedError());
return;
}
WComponent uiComponent = getUI();
if (uiComponent == null) {
throw new SystemException("No UI Component exists.");
}
Environment environment = uiComponent.getEnvironment();
if (environment == null) {
throw new SystemException("No WEnvironment exists.");
}
getInterceptor().attachResponse(getResponse());
getInterceptor().preparePaint(getRequest());
String contentType = getUI().getHeaders().getContentType();
Response response = getResponse();
response.setContentType(contentType);
addGenericHeaders(uic, getUI());
PrintWriter writer = getPrintWriter();
getInterceptor().paint(new WebXmlRenderContext(writer, uic.getLocale()));
// The following only matters for a Portal context
String title = uiComponent instanceof WApplication ? ((WApplication) uiComponent).
getTitle() : null;
if (title != null) {
setTitle(title);
}
} catch (Escape esc) {
LOG.debug("Escape performed during render phase.");
handleEscape(esc);
} catch (Throwable t) {
// We try not to let any exception propagate to container.
String message = "Caught exception during render phase.";
LOG.error(message, t);
handleError(t);
} finally {
UIContextHolder.reset();
dispose();
}
} | class class_name[name] begin[{]
method[render, return_type[void], modifier[public], parameter[]] begin[{]
if[call[.isDisposed, parameter[]]] begin[{]
call[LOG.debug, parameter[literal["Skipping render phase."]]]
return[None]
else begin[{]
None
end[}]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getNewConversation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="User context has not been prepared before the render phase")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=prepareRender, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getUIContext, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=uic)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=UIContext, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=uic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No user context set for the render phase.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=uic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=pushContext, postfix_operators=[], prefix_operators=[], qualifier=UIContextHolder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=prepareRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=MethodInvocation(arguments=[], member=havePropogatedError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getPropogatedError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=handleError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), ReturnStatement(expression=None, label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getUI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=uiComponent)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=WComponent, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=uiComponent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No UI Component exists.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SystemException, sub_type=None)), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getEnvironment, postfix_operators=[], prefix_operators=[], qualifier=uiComponent, selectors=[], type_arguments=None), name=environment)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Environment, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=environment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No WEnvironment exists.")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SystemException, sub_type=None)), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[], member=getInterceptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=attachResponse, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=getInterceptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getRequest, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=preparePaint, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getUI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[], member=getHeaders, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[], member=getContentType, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=contentType)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getResponse, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=response)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Response, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=contentType, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setContentType, postfix_operators=[], prefix_operators=[], qualifier=response, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=uic, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getUI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=addGenericHeaders, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=getPrintWriter, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=writer)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PrintWriter, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[], member=getInterceptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=writer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getLocale, postfix_operators=[], prefix_operators=[], qualifier=uic, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=WebXmlRenderContext, sub_type=None))], member=paint, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=uiComponent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=WApplication, sub_type=None), operator=instanceof), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=Cast(expression=MemberReference(member=uiComponent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=WApplication, sub_type=None))), name=title)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=title, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=title, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setTitle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Escape performed during render phase.")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=esc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleEscape, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=esc, types=['Escape'])), CatchClause(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Caught exception during render phase."), name=message)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=message, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=t, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=handleError, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=t, types=['Throwable']))], finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=reset, postfix_operators=[], prefix_operators=[], qualifier=UIContextHolder, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=dispose, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[render] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[isDisposed] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[try] {
Keyword[if] operator[SEP] identifier[getNewConversation] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[prepareRender] operator[SEP] operator[SEP] operator[SEP] identifier[UIContext] identifier[uic] operator[=] identifier[getUIContext] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[uic] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[UIContextHolder] operator[SEP] identifier[pushContext] operator[SEP] identifier[uic] operator[SEP] operator[SEP] identifier[prepareRequest] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[havePropogatedError] operator[SEP] operator[SEP] operator[SEP] {
identifier[handleError] operator[SEP] identifier[getPropogatedError] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[WComponent] identifier[uiComponent] operator[=] identifier[getUI] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[uiComponent] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SystemException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[Environment] identifier[environment] operator[=] identifier[uiComponent] operator[SEP] identifier[getEnvironment] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[environment] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SystemException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[getInterceptor] operator[SEP] operator[SEP] operator[SEP] identifier[attachResponse] operator[SEP] identifier[getResponse] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[getInterceptor] operator[SEP] operator[SEP] operator[SEP] identifier[preparePaint] operator[SEP] identifier[getRequest] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[contentType] operator[=] identifier[getUI] operator[SEP] operator[SEP] operator[SEP] identifier[getHeaders] operator[SEP] operator[SEP] operator[SEP] identifier[getContentType] operator[SEP] operator[SEP] operator[SEP] identifier[Response] identifier[response] operator[=] identifier[getResponse] operator[SEP] operator[SEP] operator[SEP] identifier[response] operator[SEP] identifier[setContentType] operator[SEP] identifier[contentType] operator[SEP] operator[SEP] identifier[addGenericHeaders] operator[SEP] identifier[uic] , identifier[getUI] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[PrintWriter] identifier[writer] operator[=] identifier[getPrintWriter] operator[SEP] operator[SEP] operator[SEP] identifier[getInterceptor] operator[SEP] operator[SEP] operator[SEP] identifier[paint] operator[SEP] Keyword[new] identifier[WebXmlRenderContext] operator[SEP] identifier[writer] , identifier[uic] operator[SEP] identifier[getLocale] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[String] identifier[title] operator[=] identifier[uiComponent] Keyword[instanceof] identifier[WApplication] operator[?] operator[SEP] operator[SEP] identifier[WApplication] operator[SEP] identifier[uiComponent] operator[SEP] operator[SEP] identifier[getTitle] operator[SEP] operator[SEP] operator[:] Other[null] operator[SEP] Keyword[if] operator[SEP] identifier[title] operator[!=] Other[null] operator[SEP] {
identifier[setTitle] operator[SEP] identifier[title] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Escape] identifier[esc] operator[SEP] {
identifier[LOG] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[handleEscape] operator[SEP] identifier[esc] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[t] operator[SEP] {
identifier[String] identifier[message] operator[=] literal[String] operator[SEP] identifier[LOG] operator[SEP] identifier[error] operator[SEP] identifier[message] , identifier[t] operator[SEP] operator[SEP] identifier[handleError] operator[SEP] identifier[t] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[UIContextHolder] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] identifier[dispose] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public SegmentedJournalReader<E> openReader(long index, SegmentedJournalReader.Mode mode) {
SegmentedJournalReader<E> reader = new SegmentedJournalReader<>(this, index, mode);
readers.add(reader);
return reader;
} | class class_name[name] begin[{]
method[openReader, return_type[type[SegmentedJournalReader]], modifier[public], parameter[index, mode]] begin[{]
local_variable[type[SegmentedJournalReader], reader]
call[readers.add, parameter[member[.reader]]]
return[member[.reader]]
end[}]
END[}] | Keyword[public] identifier[SegmentedJournalReader] operator[<] identifier[E] operator[>] identifier[openReader] operator[SEP] Keyword[long] identifier[index] , identifier[SegmentedJournalReader] operator[SEP] identifier[Mode] identifier[mode] operator[SEP] {
identifier[SegmentedJournalReader] operator[<] identifier[E] operator[>] identifier[reader] operator[=] Keyword[new] identifier[SegmentedJournalReader] operator[<] operator[>] operator[SEP] Keyword[this] , identifier[index] , identifier[mode] operator[SEP] operator[SEP] identifier[readers] operator[SEP] identifier[add] operator[SEP] identifier[reader] operator[SEP] operator[SEP] Keyword[return] identifier[reader] operator[SEP]
}
|
public static ImmutableList<File> loadFileListRelativeTo(File fileList, File basePath)
throws IOException {
checkNotNull(basePath);
final ImmutableList.Builder<File> ret = ImmutableList.builder();
for (final String filename : Files.readLines(fileList, Charsets.UTF_8)) {
if (!filename.isEmpty() && !isCommentLine(filename)) {
ret.add(new File(basePath, filename.trim()));
}
}
return ret.build();
} | class class_name[name] begin[{]
method[loadFileListRelativeTo, return_type[type[ImmutableList]], modifier[public static], parameter[fileList, basePath]] begin[{]
call[.checkNotNull, parameter[member[.basePath]]]
local_variable[type[ImmutableList], ret]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=filename, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=filename, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isCommentLine, postfix_operators=[], prefix_operators=['!'], qualifier=, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=basePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=trim, postfix_operators=[], prefix_operators=[], qualifier=filename, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=File, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=ret, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[MemberReference(member=fileList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=UTF_8, postfix_operators=[], prefix_operators=[], qualifier=Charsets, selectors=[])], member=readLines, postfix_operators=[], prefix_operators=[], qualifier=Files, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=filename)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
return[call[ret.build, parameter[]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[ImmutableList] operator[<] identifier[File] operator[>] identifier[loadFileListRelativeTo] operator[SEP] identifier[File] identifier[fileList] , identifier[File] identifier[basePath] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[checkNotNull] operator[SEP] identifier[basePath] operator[SEP] operator[SEP] Keyword[final] identifier[ImmutableList] operator[SEP] identifier[Builder] operator[<] identifier[File] operator[>] identifier[ret] operator[=] identifier[ImmutableList] operator[SEP] identifier[builder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[String] identifier[filename] operator[:] identifier[Files] operator[SEP] identifier[readLines] operator[SEP] identifier[fileList] , identifier[Charsets] operator[SEP] identifier[UTF_8] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[filename] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[&&] operator[!] identifier[isCommentLine] operator[SEP] identifier[filename] operator[SEP] operator[SEP] {
identifier[ret] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[File] operator[SEP] identifier[basePath] , identifier[filename] operator[SEP] identifier[trim] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[return] identifier[ret] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public <T> T getObject(String path, TypeRef<T> typeRef) {
AssertParameter.notNull("objectType", "Type ref");
return getObject(path, typeRef.getTypeAsClass());
} | class class_name[name] begin[{]
method[getObject, return_type[type[T]], modifier[public], parameter[path, typeRef]] begin[{]
call[AssertParameter.notNull, parameter[literal["objectType"], literal["Type ref"]]]
return[call[.getObject, parameter[member[.path], call[typeRef.getTypeAsClass, parameter[]]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[getObject] operator[SEP] identifier[String] identifier[path] , identifier[TypeRef] operator[<] identifier[T] operator[>] identifier[typeRef] operator[SEP] {
identifier[AssertParameter] operator[SEP] identifier[notNull] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[getObject] operator[SEP] identifier[path] , identifier[typeRef] operator[SEP] identifier[getTypeAsClass] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Duration toDurationTo(ReadableInstant endInstant) {
long endMillis = DateTimeUtils.getInstantMillis(endInstant);
Chronology chrono = DateTimeUtils.getInstantChronology(endInstant);
long startMillis = chrono.add(this, endMillis, -1);
return new Duration(startMillis, endMillis);
} | class class_name[name] begin[{]
method[toDurationTo, return_type[type[Duration]], modifier[public], parameter[endInstant]] begin[{]
local_variable[type[long], endMillis]
local_variable[type[Chronology], chrono]
local_variable[type[long], startMillis]
return[ClassCreator(arguments=[MemberReference(member=startMillis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=endMillis, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Duration, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Duration] identifier[toDurationTo] operator[SEP] identifier[ReadableInstant] identifier[endInstant] operator[SEP] {
Keyword[long] identifier[endMillis] operator[=] identifier[DateTimeUtils] operator[SEP] identifier[getInstantMillis] operator[SEP] identifier[endInstant] operator[SEP] operator[SEP] identifier[Chronology] identifier[chrono] operator[=] identifier[DateTimeUtils] operator[SEP] identifier[getInstantChronology] operator[SEP] identifier[endInstant] operator[SEP] operator[SEP] Keyword[long] identifier[startMillis] operator[=] identifier[chrono] operator[SEP] identifier[add] operator[SEP] Keyword[this] , identifier[endMillis] , operator[-] Other[1] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[Duration] operator[SEP] identifier[startMillis] , identifier[endMillis] operator[SEP] operator[SEP]
}
|
public void removeDatanode(DatanodeID nodeID)
throws IOException {
writeLock();
try {
DatanodeDescriptor nodeInfo = getDatanode(nodeID);
if (nodeInfo != null) {
removeDatanode(nodeInfo);
} else {
NameNode.stateChangeLog.warn("BLOCK* NameSystem.removeDatanode: "
+ nodeID.getName() + " does not exist");
}
} finally {
writeUnlock();
}
} | class class_name[name] begin[{]
method[removeDatanode, return_type[void], modifier[public], parameter[nodeID]] begin[{]
call[.writeLock, parameter[]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=nodeID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getDatanode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=nodeInfo)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=DatanodeDescriptor, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=nodeInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="BLOCK* NameSystem.removeDatanode: "), operandr=MethodInvocation(arguments=[], member=getName, postfix_operators=[], prefix_operators=[], qualifier=nodeID, selectors=[], type_arguments=None), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" does not exist"), operator=+)], member=warn, postfix_operators=[], prefix_operators=[], qualifier=NameNode.stateChangeLog, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=nodeInfo, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=removeDatanode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=None, finally_block=[StatementExpression(expression=MethodInvocation(arguments=[], member=writeUnlock, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[removeDatanode] operator[SEP] identifier[DatanodeID] identifier[nodeID] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[writeLock] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[DatanodeDescriptor] identifier[nodeInfo] operator[=] identifier[getDatanode] operator[SEP] identifier[nodeID] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nodeInfo] operator[!=] Other[null] operator[SEP] {
identifier[removeDatanode] operator[SEP] identifier[nodeInfo] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[NameNode] operator[SEP] identifier[stateChangeLog] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[nodeID] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
Keyword[finally] {
identifier[writeUnlock] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public BoxRequestsShare.GetPendingCollaborations getPendingCollaborationsRequest() {
BoxRequestsShare.GetPendingCollaborations request = new BoxRequestsShare.GetPendingCollaborations(getCollaborationsUrl(), mSession);
return request;
} | class class_name[name] begin[{]
method[getPendingCollaborationsRequest, return_type[type[BoxRequestsShare]], modifier[public], parameter[]] begin[{]
local_variable[type[BoxRequestsShare], request]
return[member[.request]]
end[}]
END[}] | Keyword[public] identifier[BoxRequestsShare] operator[SEP] identifier[GetPendingCollaborations] identifier[getPendingCollaborationsRequest] operator[SEP] operator[SEP] {
identifier[BoxRequestsShare] operator[SEP] identifier[GetPendingCollaborations] identifier[request] operator[=] Keyword[new] identifier[BoxRequestsShare] operator[SEP] identifier[GetPendingCollaborations] operator[SEP] identifier[getCollaborationsUrl] operator[SEP] operator[SEP] , identifier[mSession] operator[SEP] operator[SEP] Keyword[return] identifier[request] operator[SEP]
}
|
public void printStackTrace(java.io.PrintStream ps) {
if ( exception != null ) {
String superString = getLocalMessage();
synchronized ( ps ) {
ps.print(superString);
ps.print((superString.endsWith(".") ?
" Caused by " : ". Caused by "));
exception.printStackTrace( ps );
}
} else {
super.printStackTrace( ps );
}
} | class class_name[name] begin[{]
method[printStackTrace, return_type[void], modifier[public], parameter[ps]] begin[{]
if[binary_operation[member[.exception], !=, literal[null]]] begin[{]
local_variable[type[String], superString]
SYNCHRONIZED[member[.ps]] BEGIN[{]
call[ps.print, parameter[member[.superString]]]
call[ps.print, parameter[TernaryExpression(condition=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=".")], member=endsWith, postfix_operators=[], prefix_operators=[], qualifier=superString, selectors=[], type_arguments=None), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=". Caused by "), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" Caused by "))]]
call[exception.printStackTrace, parameter[member[.ps]]]
END[}]
else begin[{]
SuperMethodInvocation(arguments=[MemberReference(member=ps, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type_arguments=None)
end[}]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[printStackTrace] operator[SEP] identifier[java] operator[SEP] identifier[io] operator[SEP] identifier[PrintStream] identifier[ps] operator[SEP] {
Keyword[if] operator[SEP] identifier[exception] operator[!=] Other[null] operator[SEP] {
identifier[String] identifier[superString] operator[=] identifier[getLocalMessage] operator[SEP] operator[SEP] operator[SEP] Keyword[synchronized] operator[SEP] identifier[ps] operator[SEP] {
identifier[ps] operator[SEP] identifier[print] operator[SEP] identifier[superString] operator[SEP] operator[SEP] identifier[ps] operator[SEP] identifier[print] operator[SEP] operator[SEP] identifier[superString] operator[SEP] identifier[endsWith] operator[SEP] literal[String] operator[SEP] operator[?] literal[String] operator[:] literal[String] operator[SEP] operator[SEP] operator[SEP] identifier[exception] operator[SEP] identifier[printStackTrace] operator[SEP] identifier[ps] operator[SEP] operator[SEP]
}
}
Keyword[else] {
Keyword[super] operator[SEP] identifier[printStackTrace] operator[SEP] identifier[ps] operator[SEP] operator[SEP]
}
}
|
@SuppressWarnings("restriction")
public final void putChar(int index, char value) {
final long pos = address + index;
if (index >= 0 && pos <= addressLimit - 2) {
UNSAFE.putChar(heapMemory, pos, value);
}
else if (address > addressLimit) {
throw new IllegalStateException("segment has been freed");
}
else {
// index is in fact invalid
throw new IndexOutOfBoundsException();
}
} | class class_name[name] begin[{]
method[putChar, return_type[void], modifier[final public], parameter[index, value]] begin[{]
local_variable[type[long], pos]
if[binary_operation[binary_operation[member[.index], >=, literal[0]], &&, binary_operation[member[.pos], <=, binary_operation[member[.addressLimit], -, literal[2]]]]] begin[{]
call[UNSAFE.putChar, parameter[member[.heapMemory], member[.pos], member[.value]]]
else begin[{]
if[binary_operation[member[.address], >, member[.addressLimit]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="segment has been freed")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
ThrowStatement(expression=ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IndexOutOfBoundsException, sub_type=None)), label=None)
end[}]
end[}]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[public] Keyword[final] Keyword[void] identifier[putChar] operator[SEP] Keyword[int] identifier[index] , Keyword[char] identifier[value] operator[SEP] {
Keyword[final] Keyword[long] identifier[pos] operator[=] identifier[address] operator[+] identifier[index] operator[SEP] Keyword[if] operator[SEP] identifier[index] operator[>=] Other[0] operator[&&] identifier[pos] operator[<=] identifier[addressLimit] operator[-] Other[2] operator[SEP] {
identifier[UNSAFE] operator[SEP] identifier[putChar] operator[SEP] identifier[heapMemory] , identifier[pos] , identifier[value] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[address] operator[>] identifier[addressLimit] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[throw] Keyword[new] identifier[IndexOutOfBoundsException] operator[SEP] operator[SEP] operator[SEP]
}
}
|
@Pure
public static int toBEInt(int b1, int b2, int b3, int b4) {
return ((b1 & 0xFF) << 24) + ((b2 & 0xFF) << 16) + ((b3 & 0xFF) << 8) + (b4 & 0xFF);
} | class class_name[name] begin[{]
method[toBEInt, return_type[type[int]], modifier[public static], parameter[b1, b2, b3, b4]] begin[{]
return[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[member[.b1], &, literal[0xFF]], <<, literal[24]], +, binary_operation[binary_operation[member[.b2], &, literal[0xFF]], <<, literal[16]]], +, binary_operation[binary_operation[member[.b3], &, literal[0xFF]], <<, literal[8]]], +, binary_operation[member[.b4], &, literal[0xFF]]]]
end[}]
END[}] | annotation[@] identifier[Pure] Keyword[public] Keyword[static] Keyword[int] identifier[toBEInt] operator[SEP] Keyword[int] identifier[b1] , Keyword[int] identifier[b2] , Keyword[int] identifier[b3] , Keyword[int] identifier[b4] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[b1] operator[&] literal[Integer] operator[SEP] operator[<<] Other[24] operator[SEP] operator[+] operator[SEP] operator[SEP] identifier[b2] operator[&] literal[Integer] operator[SEP] operator[<<] Other[16] operator[SEP] operator[+] operator[SEP] operator[SEP] identifier[b3] operator[&] literal[Integer] operator[SEP] operator[<<] Other[8] operator[SEP] operator[+] operator[SEP] identifier[b4] operator[&] literal[Integer] operator[SEP] operator[SEP]
}
|
private String displayable(String query) {
if (query == null ||
query.length() == 0) {
return query;
}
StringBuilder buff = new StringBuilder(query);
// handle two character transforms first
subst(buff, SQL_NE, NOT_EQUAL__);
subst(buff, NE_BANG, BANG_NOT_EQUAL__);
subst(buff, NE_HAT, HAT_NOT_EQUAL__);
subst(buff, LE, LESS_THAN_EQUAL__);
subst(buff, GE, GREATER_THAN_EQUAL__);
subst(buff, CONCAT, CONCAT__);
subst(buff, LT, LESS_THAN__);
subst(buff, EQ, EQUAL__);
subst(buff, GT, GREATER__);
subst(buff, OPEN, LEFT_PAREN__);
subst(buff, CLOSE, RIGHT_PAREN__);
subst(buff, OPEN_BRACKET, LEFT_BRACKET__);
subst(buff, CLOSE_BRACKET, RIGHT_BRACKET__);
subst(buff, PLUS, PLUS__);
subst(buff, MINUS, MINUS__);
subst(buff, STAR, STAR__);
subst(buff, DIV, DIVIDE__);
subst(buff, MOD, MODULUS__);
subst(buff, COLON, COLON__);
subst(buff, PARAM, PARAM__);
subst(buff, COMMA, COMMA__);
subst(buff, SPACE, SPACE__);
subst(buff, TAB, TAB__);
subst(buff, NEWLINE, NEWLINE__);
subst(buff, LINEFEED, LINEFEED__);
subst(buff, QUOTE, QUOTE__);
subst(buff, DQUOTE, DQUOTE__);
subst(buff, TICK, TICK__);
subst(buff, OPEN_BRACE, OPEN_BRACE__);
subst(buff, CLOSE_BRACE, CLOSE_BRACE__);
subst(buff, HAT, HAT__);
subst(buff, AMPERSAND, AMPERSAND__);
return buff.toString();
} | class class_name[name] begin[{]
method[displayable, return_type[type[String]], modifier[private], parameter[query]] begin[{]
if[binary_operation[binary_operation[member[.query], ==, literal[null]], ||, binary_operation[call[query.length, parameter[]], ==, literal[0]]]] begin[{]
return[member[.query]]
else begin[{]
None
end[}]
local_variable[type[StringBuilder], buff]
call[.subst, parameter[member[.buff], member[.SQL_NE], member[.NOT_EQUAL__]]]
call[.subst, parameter[member[.buff], member[.NE_BANG], member[.BANG_NOT_EQUAL__]]]
call[.subst, parameter[member[.buff], member[.NE_HAT], member[.HAT_NOT_EQUAL__]]]
call[.subst, parameter[member[.buff], member[.LE], member[.LESS_THAN_EQUAL__]]]
call[.subst, parameter[member[.buff], member[.GE], member[.GREATER_THAN_EQUAL__]]]
call[.subst, parameter[member[.buff], member[.CONCAT], member[.CONCAT__]]]
call[.subst, parameter[member[.buff], member[.LT], member[.LESS_THAN__]]]
call[.subst, parameter[member[.buff], member[.EQ], member[.EQUAL__]]]
call[.subst, parameter[member[.buff], member[.GT], member[.GREATER__]]]
call[.subst, parameter[member[.buff], member[.OPEN], member[.LEFT_PAREN__]]]
call[.subst, parameter[member[.buff], member[.CLOSE], member[.RIGHT_PAREN__]]]
call[.subst, parameter[member[.buff], member[.OPEN_BRACKET], member[.LEFT_BRACKET__]]]
call[.subst, parameter[member[.buff], member[.CLOSE_BRACKET], member[.RIGHT_BRACKET__]]]
call[.subst, parameter[member[.buff], member[.PLUS], member[.PLUS__]]]
call[.subst, parameter[member[.buff], member[.MINUS], member[.MINUS__]]]
call[.subst, parameter[member[.buff], member[.STAR], member[.STAR__]]]
call[.subst, parameter[member[.buff], member[.DIV], member[.DIVIDE__]]]
call[.subst, parameter[member[.buff], member[.MOD], member[.MODULUS__]]]
call[.subst, parameter[member[.buff], member[.COLON], member[.COLON__]]]
call[.subst, parameter[member[.buff], member[.PARAM], member[.PARAM__]]]
call[.subst, parameter[member[.buff], member[.COMMA], member[.COMMA__]]]
call[.subst, parameter[member[.buff], member[.SPACE], member[.SPACE__]]]
call[.subst, parameter[member[.buff], member[.TAB], member[.TAB__]]]
call[.subst, parameter[member[.buff], member[.NEWLINE], member[.NEWLINE__]]]
call[.subst, parameter[member[.buff], member[.LINEFEED], member[.LINEFEED__]]]
call[.subst, parameter[member[.buff], member[.QUOTE], member[.QUOTE__]]]
call[.subst, parameter[member[.buff], member[.DQUOTE], member[.DQUOTE__]]]
call[.subst, parameter[member[.buff], member[.TICK], member[.TICK__]]]
call[.subst, parameter[member[.buff], member[.OPEN_BRACE], member[.OPEN_BRACE__]]]
call[.subst, parameter[member[.buff], member[.CLOSE_BRACE], member[.CLOSE_BRACE__]]]
call[.subst, parameter[member[.buff], member[.HAT], member[.HAT__]]]
call[.subst, parameter[member[.buff], member[.AMPERSAND], member[.AMPERSAND__]]]
return[call[buff.toString, parameter[]]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[displayable] operator[SEP] identifier[String] identifier[query] operator[SEP] {
Keyword[if] operator[SEP] identifier[query] operator[==] Other[null] operator[||] identifier[query] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
Keyword[return] identifier[query] operator[SEP]
}
identifier[StringBuilder] identifier[buff] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] identifier[query] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[SQL_NE] , identifier[NOT_EQUAL__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[NE_BANG] , identifier[BANG_NOT_EQUAL__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[NE_HAT] , identifier[HAT_NOT_EQUAL__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[LE] , identifier[LESS_THAN_EQUAL__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[GE] , identifier[GREATER_THAN_EQUAL__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[CONCAT] , identifier[CONCAT__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[LT] , identifier[LESS_THAN__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[EQ] , identifier[EQUAL__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[GT] , identifier[GREATER__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[OPEN] , identifier[LEFT_PAREN__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[CLOSE] , identifier[RIGHT_PAREN__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[OPEN_BRACKET] , identifier[LEFT_BRACKET__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[CLOSE_BRACKET] , identifier[RIGHT_BRACKET__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[PLUS] , identifier[PLUS__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[MINUS] , identifier[MINUS__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[STAR] , identifier[STAR__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[DIV] , identifier[DIVIDE__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[MOD] , identifier[MODULUS__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[COLON] , identifier[COLON__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[PARAM] , identifier[PARAM__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[COMMA] , identifier[COMMA__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[SPACE] , identifier[SPACE__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[TAB] , identifier[TAB__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[NEWLINE] , identifier[NEWLINE__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[LINEFEED] , identifier[LINEFEED__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[QUOTE] , identifier[QUOTE__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[DQUOTE] , identifier[DQUOTE__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[TICK] , identifier[TICK__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[OPEN_BRACE] , identifier[OPEN_BRACE__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[CLOSE_BRACE] , identifier[CLOSE_BRACE__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[HAT] , identifier[HAT__] operator[SEP] operator[SEP] identifier[subst] operator[SEP] identifier[buff] , identifier[AMPERSAND] , identifier[AMPERSAND__] operator[SEP] operator[SEP] Keyword[return] identifier[buff] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
private static String getSlingHome(Map<String, String> commandLine) {
String source = null;
String slingHome = commandLine.get("c");
if (slingHome != null) {
source = "command line";
} else {
slingHome = System.getProperty(SharedConstants.SLING_HOME);
if (slingHome != null) {
source = "system property sling.home";
} else {
slingHome = System.getenv(ENV_SLING_HOME);
if (slingHome != null) {
source = "environment variable SLING_HOME";
} else {
source = "default";
slingHome = SharedConstants.SLING_HOME_DEFAULT;
}
}
}
System.setProperty(SharedConstants.SLING_HOME, slingHome);
info("Setting sling.home=" + slingHome + " (" + source + ")", null);
return slingHome;
} | class class_name[name] begin[{]
method[getSlingHome, return_type[type[String]], modifier[private static], parameter[commandLine]] begin[{]
local_variable[type[String], source]
local_variable[type[String], slingHome]
if[binary_operation[member[.slingHome], !=, literal[null]]] begin[{]
assign[member[.source], literal["command line"]]
else begin[{]
assign[member[.slingHome], call[System.getProperty, parameter[member[SharedConstants.SLING_HOME]]]]
if[binary_operation[member[.slingHome], !=, literal[null]]] begin[{]
assign[member[.source], literal["system property sling.home"]]
else begin[{]
assign[member[.slingHome], call[System.getenv, parameter[member[.ENV_SLING_HOME]]]]
if[binary_operation[member[.slingHome], !=, literal[null]]] begin[{]
assign[member[.source], literal["environment variable SLING_HOME"]]
else begin[{]
assign[member[.source], literal["default"]]
assign[member[.slingHome], member[SharedConstants.SLING_HOME_DEFAULT]]
end[}]
end[}]
end[}]
call[System.setProperty, parameter[member[SharedConstants.SLING_HOME], member[.slingHome]]]
call[.info, parameter[binary_operation[binary_operation[binary_operation[binary_operation[literal["Setting sling.home="], +, member[.slingHome]], +, literal[" ("]], +, member[.source]], +, literal[")"]], literal[null]]]
return[member[.slingHome]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[getSlingHome] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[commandLine] operator[SEP] {
identifier[String] identifier[source] operator[=] Other[null] operator[SEP] identifier[String] identifier[slingHome] operator[=] identifier[commandLine] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[slingHome] operator[!=] Other[null] operator[SEP] {
identifier[source] operator[=] literal[String] operator[SEP]
}
Keyword[else] {
identifier[slingHome] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[SharedConstants] operator[SEP] identifier[SLING_HOME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[slingHome] operator[!=] Other[null] operator[SEP] {
identifier[source] operator[=] literal[String] operator[SEP]
}
Keyword[else] {
identifier[slingHome] operator[=] identifier[System] operator[SEP] identifier[getenv] operator[SEP] identifier[ENV_SLING_HOME] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[slingHome] operator[!=] Other[null] operator[SEP] {
identifier[source] operator[=] literal[String] operator[SEP]
}
Keyword[else] {
identifier[source] operator[=] literal[String] operator[SEP] identifier[slingHome] operator[=] identifier[SharedConstants] operator[SEP] identifier[SLING_HOME_DEFAULT] operator[SEP]
}
}
}
identifier[System] operator[SEP] identifier[setProperty] operator[SEP] identifier[SharedConstants] operator[SEP] identifier[SLING_HOME] , identifier[slingHome] operator[SEP] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] identifier[slingHome] operator[+] literal[String] operator[+] identifier[source] operator[+] literal[String] , Other[null] operator[SEP] operator[SEP] Keyword[return] identifier[slingHome] operator[SEP]
}
|
public com.google.api.ads.admanager.axis.v201808.DateTime getLicenseWindowStartDateTime() {
return licenseWindowStartDateTime;
} | class class_name[name] begin[{]
method[getLicenseWindowStartDateTime, return_type[type[com]], modifier[public], parameter[]] begin[{]
return[member[.licenseWindowStartDateTime]]
end[}]
END[}] | Keyword[public] identifier[com] operator[SEP] identifier[google] operator[SEP] identifier[api] operator[SEP] identifier[ads] operator[SEP] identifier[admanager] operator[SEP] identifier[axis] operator[SEP] identifier[v201808] operator[SEP] identifier[DateTime] identifier[getLicenseWindowStartDateTime] operator[SEP] operator[SEP] {
Keyword[return] identifier[licenseWindowStartDateTime] operator[SEP]
}
|
@SuppressWarnings("unchecked")
protected static GroupMembershipProtocol buildMembershipProtocol(ClusterConfig config) {
return config.getProtocolConfig().getType().newProtocol(config.getProtocolConfig());
} | class class_name[name] begin[{]
method[buildMembershipProtocol, return_type[type[GroupMembershipProtocol]], modifier[static protected], parameter[config]] begin[{]
return[call[config.getProtocolConfig, parameter[]]]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] literal[String] operator[SEP] Keyword[protected] Keyword[static] identifier[GroupMembershipProtocol] identifier[buildMembershipProtocol] operator[SEP] identifier[ClusterConfig] identifier[config] operator[SEP] {
Keyword[return] identifier[config] operator[SEP] identifier[getProtocolConfig] operator[SEP] operator[SEP] operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] identifier[newProtocol] operator[SEP] identifier[config] operator[SEP] identifier[getProtocolConfig] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public void execute()
throws MojoExecutionException, MojoFailureException
{
if ( isSkip() )
{
getLog().info( "skipping execute as per configuraion" );
return;
}
if ( killAfter != -1 )
{
getLog().warn( "Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6." );
}
arguments = new String[] {outputParentDirectory.getAbsolutePath(), outputDirectory.getAbsolutePath(), filterClassPackage};
if ( getLog().isDebugEnabled() )
{
StringBuffer msg = new StringBuffer( "Invoking : " );
msg.append( mainClass );
msg.append( ".main(" );
for ( int i = 0; i < arguments.length; i++ )
{
if ( i > 0 )
{
msg.append( ", " );
}
msg.append( arguments[i] );
}
msg.append( ")" );
getLog().debug( msg );
}
final Log log = getLog();
IsolatedThreadGroup threadGroup = new IsolatedThreadGroup( mainClass /* name */);
Thread bootstrapThread = new Thread( threadGroup, new Runnable()
{
public void run()
{
long current = System.currentTimeMillis();
try
{
Method main =
Thread.currentThread().getContextClassLoader().loadClass( mainClass ).getMethod( "main",
new Class[] { String[].class } );
if ( !main.isAccessible() )
{
getLog().debug( "Setting accessibility to true in order to invoke main()." );
main.setAccessible( true );
}
if ( !Modifier.isStatic( main.getModifiers() ) )
{
throw new MojoExecutionException( "Can't call main(String[])-method because it is not static." );
}
main.invoke( null, new Object[] { arguments } );
}
catch ( NoSuchMethodException e )
{ // just pass it on
Thread.currentThread().getThreadGroup().uncaughtException( Thread.currentThread(),
new Exception(
"The specified mainClass doesn't contain a main method with appropriate signature.",
e ) );
}
catch ( Exception e )
{ // just pass it on
Thread.currentThread().getThreadGroup().uncaughtException( Thread.currentThread(), e );
} finally {
log.info("JProtobuf pre compile done time took: " + (System.currentTimeMillis() - current) + "ms");
}
}
}, mainClass + ".main()" );
bootstrapThread.setContextClassLoader( getClassLoader() );
setSystemProperties();
bootstrapThread.start();
joinNonDaemonThreads( threadGroup );
// It's plausible that spontaneously a non-daemon thread might be created as we try and shut down,
// but it's too late since the termination condition (only daemon threads) has been triggered.
if ( keepAlive )
{
getLog().warn( "Warning: keepAlive is now deprecated and obsolete. Do you need it? Please comment on MEXEC-6." );
waitFor( 0 );
}
if ( cleanupDaemonThreads )
{
terminateThreads( threadGroup );
try
{
threadGroup.destroy();
}
catch ( IllegalThreadStateException e )
{
getLog().warn( "Couldn't destroy threadgroup " + threadGroup, e );
}
}
if ( originalSystemProperties != null )
{
System.setProperties( originalSystemProperties );
}
synchronized ( threadGroup )
{
if ( threadGroup.uncaughtException != null )
{
throw new MojoExecutionException( "An exception occured while executing the Java class. "
+ threadGroup.uncaughtException.getMessage(), threadGroup.uncaughtException );
}
}
registerSourceRoots();
} | class class_name[name] begin[{]
method[execute, return_type[void], modifier[public], parameter[]] begin[{]
if[call[.isSkip, parameter[]]] begin[{]
call[.getLog, parameter[]]
return[None]
else begin[{]
None
end[}]
if[binary_operation[member[.killAfter], !=, literal[1]]] begin[{]
call[.getLog, parameter[]]
else begin[{]
None
end[}]
assign[member[.arguments], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=outputParentDirectory, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getAbsolutePath, postfix_operators=[], prefix_operators=[], qualifier=outputDirectory, selectors=[], type_arguments=None), MemberReference(member=filterClassPackage, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
if[call[.getLog, parameter[]]] begin[{]
local_variable[type[StringBuffer], msg]
call[msg.append, parameter[member[.mainClass]]]
call[msg.append, parameter[literal[".main("]]]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", ")], member=append, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=arguments, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))])], member=append, postfix_operators=[], prefix_operators=[], qualifier=msg, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=arguments, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[msg.append, parameter[literal[")"]]]
call[.getLog, parameter[]]
else begin[{]
None
end[}]
local_variable[type[Log], log]
local_variable[type[IsolatedThreadGroup], threadGroup]
local_variable[type[Thread], bootstrapThread]
call[bootstrapThread.setContextClassLoader, parameter[call[.getClassLoader, parameter[]]]]
call[.setSystemProperties, parameter[]]
call[bootstrapThread.start, parameter[]]
call[.joinNonDaemonThreads, parameter[member[.threadGroup]]]
if[member[.keepAlive]] begin[{]
call[.getLog, parameter[]]
call[.waitFor, parameter[literal[0]]]
else begin[{]
None
end[}]
if[member[.cleanupDaemonThreads]] begin[{]
call[.terminateThreads, parameter[member[.threadGroup]]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=destroy, postfix_operators=[], prefix_operators=[], qualifier=threadGroup, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=getLog, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Couldn't destroy threadgroup "), operandr=MemberReference(member=threadGroup, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=warn, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IllegalThreadStateException']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
if[binary_operation[member[.originalSystemProperties], !=, literal[null]]] begin[{]
call[System.setProperties, parameter[member[.originalSystemProperties]]]
else begin[{]
None
end[}]
SYNCHRONIZED[member[.threadGroup]] BEGIN[{]
if[binary_operation[member[threadGroup.uncaughtException], !=, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="An exception occured while executing the Java class. "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=threadGroup.uncaughtException, selectors=[], type_arguments=None), operator=+), MemberReference(member=uncaughtException, postfix_operators=[], prefix_operators=[], qualifier=threadGroup, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MojoExecutionException, sub_type=None)), label=None)
else begin[{]
None
end[}]
END[}]
call[.registerSourceRoots, parameter[]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[execute] operator[SEP] operator[SEP] Keyword[throws] identifier[MojoExecutionException] , identifier[MojoFailureException] {
Keyword[if] operator[SEP] identifier[isSkip] operator[SEP] operator[SEP] operator[SEP] {
identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
Keyword[if] operator[SEP] identifier[killAfter] operator[!=] operator[-] Other[1] operator[SEP] {
identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[arguments] operator[=] Keyword[new] identifier[String] operator[SEP] operator[SEP] {
identifier[outputParentDirectory] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] , identifier[outputDirectory] operator[SEP] identifier[getAbsolutePath] operator[SEP] operator[SEP] , identifier[filterClassPackage]
} operator[SEP] Keyword[if] operator[SEP] identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[StringBuffer] identifier[msg] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] identifier[mainClass] operator[SEP] operator[SEP] identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[arguments] operator[SEP] identifier[length] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[if] operator[SEP] identifier[i] operator[>] Other[0] operator[SEP] {
identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[msg] operator[SEP] identifier[append] operator[SEP] identifier[arguments] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
identifier[msg] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[debug] operator[SEP] identifier[msg] operator[SEP] operator[SEP]
}
Keyword[final] identifier[Log] identifier[log] operator[=] identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[IsolatedThreadGroup] identifier[threadGroup] operator[=] Keyword[new] identifier[IsolatedThreadGroup] operator[SEP] identifier[mainClass] operator[SEP] operator[SEP] identifier[Thread] identifier[bootstrapThread] operator[=] Keyword[new] identifier[Thread] operator[SEP] identifier[threadGroup] , Keyword[new] identifier[Runnable] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[long] identifier[current] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[Method] identifier[main] operator[=] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[getContextClassLoader] operator[SEP] operator[SEP] operator[SEP] identifier[loadClass] operator[SEP] identifier[mainClass] operator[SEP] operator[SEP] identifier[getMethod] operator[SEP] literal[String] , Keyword[new] identifier[Class] operator[SEP] operator[SEP] {
identifier[String] operator[SEP] operator[SEP] operator[SEP] Keyword[class]
} operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[main] operator[SEP] identifier[isAccessible] operator[SEP] operator[SEP] operator[SEP] {
identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[main] operator[SEP] identifier[setAccessible] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] operator[!] identifier[Modifier] operator[SEP] identifier[isStatic] operator[SEP] identifier[main] operator[SEP] identifier[getModifiers] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MojoExecutionException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[main] operator[SEP] identifier[invoke] operator[SEP] Other[null] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[arguments]
} operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[NoSuchMethodException] identifier[e] operator[SEP] {
identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[getThreadGroup] operator[SEP] operator[SEP] operator[SEP] identifier[uncaughtException] operator[SEP] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] , Keyword[new] identifier[Exception] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] operator[SEP] identifier[getThreadGroup] operator[SEP] operator[SEP] operator[SEP] identifier[uncaughtException] operator[SEP] identifier[Thread] operator[SEP] identifier[currentThread] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
identifier[log] operator[SEP] identifier[info] operator[SEP] literal[String] operator[+] operator[SEP] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[-] identifier[current] operator[SEP] operator[+] literal[String] operator[SEP] operator[SEP]
}
}
} , identifier[mainClass] operator[+] literal[String] operator[SEP] operator[SEP] identifier[bootstrapThread] operator[SEP] identifier[setContextClassLoader] operator[SEP] identifier[getClassLoader] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setSystemProperties] operator[SEP] operator[SEP] operator[SEP] identifier[bootstrapThread] operator[SEP] identifier[start] operator[SEP] operator[SEP] operator[SEP] identifier[joinNonDaemonThreads] operator[SEP] identifier[threadGroup] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[keepAlive] operator[SEP] {
identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[waitFor] operator[SEP] Other[0] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[cleanupDaemonThreads] operator[SEP] {
identifier[terminateThreads] operator[SEP] identifier[threadGroup] operator[SEP] operator[SEP] Keyword[try] {
identifier[threadGroup] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IllegalThreadStateException] identifier[e] operator[SEP] {
identifier[getLog] operator[SEP] operator[SEP] operator[SEP] identifier[warn] operator[SEP] literal[String] operator[+] identifier[threadGroup] , identifier[e] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[originalSystemProperties] operator[!=] Other[null] operator[SEP] {
identifier[System] operator[SEP] identifier[setProperties] operator[SEP] identifier[originalSystemProperties] operator[SEP] operator[SEP]
}
Keyword[synchronized] operator[SEP] identifier[threadGroup] operator[SEP] {
Keyword[if] operator[SEP] identifier[threadGroup] operator[SEP] identifier[uncaughtException] operator[!=] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MojoExecutionException] operator[SEP] literal[String] operator[+] identifier[threadGroup] operator[SEP] identifier[uncaughtException] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[threadGroup] operator[SEP] identifier[uncaughtException] operator[SEP] operator[SEP]
}
}
identifier[registerSourceRoots] operator[SEP] operator[SEP] operator[SEP]
}
|
public void marshall(ExportServerEngineAttributeRequest exportServerEngineAttributeRequest, ProtocolMarshaller protocolMarshaller) {
if (exportServerEngineAttributeRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(exportServerEngineAttributeRequest.getExportAttributeName(), EXPORTATTRIBUTENAME_BINDING);
protocolMarshaller.marshall(exportServerEngineAttributeRequest.getServerName(), SERVERNAME_BINDING);
protocolMarshaller.marshall(exportServerEngineAttributeRequest.getInputAttributes(), INPUTATTRIBUTES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[exportServerEngineAttributeRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.exportServerEngineAttributeRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getExportAttributeName, postfix_operators=[], prefix_operators=[], qualifier=exportServerEngineAttributeRequest, selectors=[], type_arguments=None), MemberReference(member=EXPORTATTRIBUTENAME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getServerName, postfix_operators=[], prefix_operators=[], qualifier=exportServerEngineAttributeRequest, selectors=[], type_arguments=None), MemberReference(member=SERVERNAME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getInputAttributes, postfix_operators=[], prefix_operators=[], qualifier=exportServerEngineAttributeRequest, selectors=[], type_arguments=None), MemberReference(member=INPUTATTRIBUTES_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[ExportServerEngineAttributeRequest] identifier[exportServerEngineAttributeRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[exportServerEngineAttributeRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[exportServerEngineAttributeRequest] operator[SEP] identifier[getExportAttributeName] operator[SEP] operator[SEP] , identifier[EXPORTATTRIBUTENAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[exportServerEngineAttributeRequest] operator[SEP] identifier[getServerName] operator[SEP] operator[SEP] , identifier[SERVERNAME_BINDING] operator[SEP] operator[SEP] identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[exportServerEngineAttributeRequest] operator[SEP] identifier[getInputAttributes] operator[SEP] operator[SEP] , identifier[INPUTATTRIBUTES_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
@Override
public void confirmationMatches(String expectedConfirmationPattern) {
String confirmation = checkConfirmationMatches(expectedConfirmationPattern, 0, 0);
assertTrue("Confirmation Text Mismatch: confirmation text of '" + confirmation + DOES_NOT_MATCH_PATTERN + expectedConfirmationPattern + "'", confirmation.matches(expectedConfirmationPattern));
} | class class_name[name] begin[{]
method[confirmationMatches, return_type[void], modifier[public], parameter[expectedConfirmationPattern]] begin[{]
local_variable[type[String], confirmation]
call[.assertTrue, parameter[binary_operation[binary_operation[binary_operation[binary_operation[literal["Confirmation Text Mismatch: confirmation text of '"], +, member[.confirmation]], +, member[.DOES_NOT_MATCH_PATTERN]], +, member[.expectedConfirmationPattern]], +, literal["'"]], call[confirmation.matches, parameter[member[.expectedConfirmationPattern]]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[confirmationMatches] operator[SEP] identifier[String] identifier[expectedConfirmationPattern] operator[SEP] {
identifier[String] identifier[confirmation] operator[=] identifier[checkConfirmationMatches] operator[SEP] identifier[expectedConfirmationPattern] , Other[0] , Other[0] operator[SEP] operator[SEP] identifier[assertTrue] operator[SEP] literal[String] operator[+] identifier[confirmation] operator[+] identifier[DOES_NOT_MATCH_PATTERN] operator[+] identifier[expectedConfirmationPattern] operator[+] literal[String] , identifier[confirmation] operator[SEP] identifier[matches] operator[SEP] identifier[expectedConfirmationPattern] operator[SEP] operator[SEP] operator[SEP]
}
|
public PropertyBuilder renderingAsTextarea() {
if (this.type != Property.Type.String) {
throw new IllegalStateException("stringRenderingTextarea can only be applied to a String property");
}
return renderingOption(StringRenderingConstants.DISPLAY_TYPE_KEY, StringRenderingConstants.DisplayType
.MULTI_LINE);
} | class class_name[name] begin[{]
method[renderingAsTextarea, return_type[type[PropertyBuilder]], modifier[public], parameter[]] begin[{]
if[binary_operation[THIS[member[None.type]], !=, member[Property.Type.String]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="stringRenderingTextarea can only be applied to a String property")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalStateException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.renderingOption, parameter[member[StringRenderingConstants.DISPLAY_TYPE_KEY], member[StringRenderingConstants.DisplayType.MULTI_LINE]]]]
end[}]
END[}] | Keyword[public] identifier[PropertyBuilder] identifier[renderingAsTextarea] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[type] operator[!=] identifier[Property] operator[SEP] identifier[Type] operator[SEP] identifier[String] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalStateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[renderingOption] operator[SEP] identifier[StringRenderingConstants] operator[SEP] identifier[DISPLAY_TYPE_KEY] , identifier[StringRenderingConstants] operator[SEP] identifier[DisplayType] operator[SEP] identifier[MULTI_LINE] operator[SEP] operator[SEP]
}
|
public static HttpURLConnection abortCopy(final URI uri, final FileRequestOptions fileOptions,
final OperationContext opContext, final AccessCondition accessCondition, final String copyId)
throws StorageException, IOException, URISyntaxException {
final UriQueryBuilder builder = new UriQueryBuilder();
builder.add(Constants.QueryConstants.COMPONENT, Constants.QueryConstants.COPY);
builder.add(Constants.QueryConstants.COPY_ID, copyId);
final HttpURLConnection request = BaseRequest.createURLConnection(uri, fileOptions, builder, opContext);
request.setFixedLengthStreamingMode(0);
request.setDoOutput(true);
request.setRequestMethod(Constants.HTTP_PUT);
request.setRequestProperty(Constants.HeaderConstants.COPY_ACTION_HEADER,
Constants.HeaderConstants.COPY_ACTION_ABORT);
if (accessCondition != null) {
accessCondition.applyConditionToRequest(request);
}
return request;
} | class class_name[name] begin[{]
method[abortCopy, return_type[type[HttpURLConnection]], modifier[public static], parameter[uri, fileOptions, opContext, accessCondition, copyId]] begin[{]
local_variable[type[UriQueryBuilder], builder]
call[builder.add, parameter[member[Constants.QueryConstants.COMPONENT], member[Constants.QueryConstants.COPY]]]
call[builder.add, parameter[member[Constants.QueryConstants.COPY_ID], member[.copyId]]]
local_variable[type[HttpURLConnection], request]
call[request.setFixedLengthStreamingMode, parameter[literal[0]]]
call[request.setDoOutput, parameter[literal[true]]]
call[request.setRequestMethod, parameter[member[Constants.HTTP_PUT]]]
call[request.setRequestProperty, parameter[member[Constants.HeaderConstants.COPY_ACTION_HEADER], member[Constants.HeaderConstants.COPY_ACTION_ABORT]]]
if[binary_operation[member[.accessCondition], !=, literal[null]]] begin[{]
call[accessCondition.applyConditionToRequest, parameter[member[.request]]]
else begin[{]
None
end[}]
return[member[.request]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[HttpURLConnection] identifier[abortCopy] operator[SEP] Keyword[final] identifier[URI] identifier[uri] , Keyword[final] identifier[FileRequestOptions] identifier[fileOptions] , Keyword[final] identifier[OperationContext] identifier[opContext] , Keyword[final] identifier[AccessCondition] identifier[accessCondition] , Keyword[final] identifier[String] identifier[copyId] operator[SEP] Keyword[throws] identifier[StorageException] , identifier[IOException] , identifier[URISyntaxException] {
Keyword[final] identifier[UriQueryBuilder] identifier[builder] operator[=] Keyword[new] identifier[UriQueryBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[add] operator[SEP] identifier[Constants] operator[SEP] identifier[QueryConstants] operator[SEP] identifier[COMPONENT] , identifier[Constants] operator[SEP] identifier[QueryConstants] operator[SEP] identifier[COPY] operator[SEP] operator[SEP] identifier[builder] operator[SEP] identifier[add] operator[SEP] identifier[Constants] operator[SEP] identifier[QueryConstants] operator[SEP] identifier[COPY_ID] , identifier[copyId] operator[SEP] operator[SEP] Keyword[final] identifier[HttpURLConnection] identifier[request] operator[=] identifier[BaseRequest] operator[SEP] identifier[createURLConnection] operator[SEP] identifier[uri] , identifier[fileOptions] , identifier[builder] , identifier[opContext] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setFixedLengthStreamingMode] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setDoOutput] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setRequestMethod] operator[SEP] identifier[Constants] operator[SEP] identifier[HTTP_PUT] operator[SEP] operator[SEP] identifier[request] operator[SEP] identifier[setRequestProperty] operator[SEP] identifier[Constants] operator[SEP] identifier[HeaderConstants] operator[SEP] identifier[COPY_ACTION_HEADER] , identifier[Constants] operator[SEP] identifier[HeaderConstants] operator[SEP] identifier[COPY_ACTION_ABORT] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[accessCondition] operator[!=] Other[null] operator[SEP] {
identifier[accessCondition] operator[SEP] identifier[applyConditionToRequest] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
Keyword[return] identifier[request] operator[SEP]
}
|
@Override
public EClass getIfcMedicalDeviceType() {
if (ifcMedicalDeviceTypeEClass == null) {
ifcMedicalDeviceTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(379);
}
return ifcMedicalDeviceTypeEClass;
} | class class_name[name] begin[{]
method[getIfcMedicalDeviceType, return_type[type[EClass]], modifier[public], parameter[]] begin[{]
if[binary_operation[member[.ifcMedicalDeviceTypeEClass], ==, literal[null]]] begin[{]
assign[member[.ifcMedicalDeviceTypeEClass], Cast(expression=MethodInvocation(arguments=[MemberReference(member=eNS_URI, postfix_operators=[], prefix_operators=[], qualifier=Ifc4Package, selectors=[])], member=getEPackage, postfix_operators=[], prefix_operators=[], qualifier=EPackage.Registry.INSTANCE, selectors=[MethodInvocation(arguments=[], member=getEClassifiers, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=379)], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=EClass, sub_type=None))]
else begin[{]
None
end[}]
return[member[.ifcMedicalDeviceTypeEClass]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[EClass] identifier[getIfcMedicalDeviceType] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[ifcMedicalDeviceTypeEClass] operator[==] Other[null] operator[SEP] {
identifier[ifcMedicalDeviceTypeEClass] operator[=] operator[SEP] identifier[EClass] operator[SEP] identifier[EPackage] operator[SEP] identifier[Registry] operator[SEP] identifier[INSTANCE] operator[SEP] identifier[getEPackage] operator[SEP] identifier[Ifc4Package] operator[SEP] identifier[eNS_URI] operator[SEP] operator[SEP] identifier[getEClassifiers] operator[SEP] operator[SEP] operator[SEP] identifier[get] operator[SEP] Other[379] operator[SEP] operator[SEP]
}
Keyword[return] identifier[ifcMedicalDeviceTypeEClass] operator[SEP]
}
|
static long checkPreambleSize(final Memory mem) {
final long cap = mem.getCapacity();
if (cap < 8) { throwNotBigEnough(cap, 8); }
final long pre0 = mem.getLong(0);
final int preLongs = (int) (pre0 & 0X3FL); //lower 6 bits
final int required = Math.max(preLongs << 3, 8);
if (cap < required) { throwNotBigEnough(cap, required); }
return pre0;
} | class class_name[name] begin[{]
method[checkPreambleSize, return_type[type[long]], modifier[static], parameter[mem]] begin[{]
local_variable[type[long], cap]
if[binary_operation[member[.cap], <, literal[8]]] begin[{]
call[.throwNotBigEnough, parameter[member[.cap], literal[8]]]
else begin[{]
None
end[}]
local_variable[type[long], pre0]
local_variable[type[int], preLongs]
local_variable[type[int], required]
if[binary_operation[member[.cap], <, member[.required]]] begin[{]
call[.throwNotBigEnough, parameter[member[.cap], member[.required]]]
else begin[{]
None
end[}]
return[member[.pre0]]
end[}]
END[}] | Keyword[static] Keyword[long] identifier[checkPreambleSize] operator[SEP] Keyword[final] identifier[Memory] identifier[mem] operator[SEP] {
Keyword[final] Keyword[long] identifier[cap] operator[=] identifier[mem] operator[SEP] identifier[getCapacity] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cap] operator[<] Other[8] operator[SEP] {
identifier[throwNotBigEnough] operator[SEP] identifier[cap] , Other[8] operator[SEP] operator[SEP]
}
Keyword[final] Keyword[long] identifier[pre0] operator[=] identifier[mem] operator[SEP] identifier[getLong] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[preLongs] operator[=] operator[SEP] Keyword[int] operator[SEP] operator[SEP] identifier[pre0] operator[&] literal[Integer] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[required] operator[=] identifier[Math] operator[SEP] identifier[max] operator[SEP] identifier[preLongs] operator[<<] Other[3] , Other[8] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cap] operator[<] identifier[required] operator[SEP] {
identifier[throwNotBigEnough] operator[SEP] identifier[cap] , identifier[required] operator[SEP] operator[SEP]
}
Keyword[return] identifier[pre0] operator[SEP]
}
|
int computeMethodInfoSize() {
// If this method_info must be copied from an existing one, the size computation is trivial.
if (sourceOffset != 0) {
// sourceLength excludes the first 6 bytes for access_flags, name_index and descriptor_index.
return 6 + sourceLength;
}
// 2 bytes each for access_flags, name_index, descriptor_index and attributes_count.
int size = 8;
// For ease of reference, we use here the same attribute order as in Section 4.7 of the JVMS.
if (code.length > 0) {
if (code.length > 65535) {
throw new MethodTooLargeException(
symbolTable.getClassName(), name, descriptor, code.length);
}
symbolTable.addConstantUtf8(Constants.CODE);
// The Code attribute has 6 header bytes, plus 2, 2, 4 and 2 bytes respectively for max_stack,
// max_locals, code_length and attributes_count, plus the bytecode and the exception table.
size += 16 + code.length + Handler.getExceptionTableSize(firstHandler);
if (stackMapTableEntries != null) {
boolean useStackMapTable = symbolTable.getMajorVersion() >= Opcodes.V1_6;
symbolTable.addConstantUtf8(useStackMapTable ? Constants.STACK_MAP_TABLE : "StackMap");
// 6 header bytes and 2 bytes for number_of_entries.
size += 8 + stackMapTableEntries.length;
}
if (lineNumberTable != null) {
symbolTable.addConstantUtf8(Constants.LINE_NUMBER_TABLE);
// 6 header bytes and 2 bytes for line_number_table_length.
size += 8 + lineNumberTable.length;
}
if (localVariableTable != null) {
symbolTable.addConstantUtf8(Constants.LOCAL_VARIABLE_TABLE);
// 6 header bytes and 2 bytes for local_variable_table_length.
size += 8 + localVariableTable.length;
}
if (localVariableTypeTable != null) {
symbolTable.addConstantUtf8(Constants.LOCAL_VARIABLE_TYPE_TABLE);
// 6 header bytes and 2 bytes for local_variable_type_table_length.
size += 8 + localVariableTypeTable.length;
}
if (lastCodeRuntimeVisibleTypeAnnotation != null) {
size +=
lastCodeRuntimeVisibleTypeAnnotation.computeAnnotationsSize(
Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS);
}
if (lastCodeRuntimeInvisibleTypeAnnotation != null) {
size +=
lastCodeRuntimeInvisibleTypeAnnotation.computeAnnotationsSize(
Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS);
}
if (firstCodeAttribute != null) {
size +=
firstCodeAttribute.computeAttributesSize(
symbolTable, code.data, code.length, maxStack, maxLocals);
}
}
if (numberOfExceptions > 0) {
symbolTable.addConstantUtf8(Constants.EXCEPTIONS);
size += 8 + 2 * numberOfExceptions;
}
boolean useSyntheticAttribute = symbolTable.getMajorVersion() < Opcodes.V1_5;
if ((accessFlags & Opcodes.ACC_SYNTHETIC) != 0 && useSyntheticAttribute) {
symbolTable.addConstantUtf8(Constants.SYNTHETIC);
size += 6;
}
if (signatureIndex != 0) {
symbolTable.addConstantUtf8(Constants.SIGNATURE);
size += 8;
}
if ((accessFlags & Opcodes.ACC_DEPRECATED) != 0) {
symbolTable.addConstantUtf8(Constants.DEPRECATED);
size += 6;
}
if (lastRuntimeVisibleAnnotation != null) {
size +=
lastRuntimeVisibleAnnotation.computeAnnotationsSize(
Constants.RUNTIME_VISIBLE_ANNOTATIONS);
}
if (lastRuntimeInvisibleAnnotation != null) {
size +=
lastRuntimeInvisibleAnnotation.computeAnnotationsSize(
Constants.RUNTIME_INVISIBLE_ANNOTATIONS);
}
if (lastRuntimeVisibleParameterAnnotations != null) {
size +=
AnnotationWriter.computeParameterAnnotationsSize(
Constants.RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS,
lastRuntimeVisibleParameterAnnotations,
visibleAnnotableParameterCount == 0
? lastRuntimeVisibleParameterAnnotations.length
: visibleAnnotableParameterCount);
}
if (lastRuntimeInvisibleParameterAnnotations != null) {
size +=
AnnotationWriter.computeParameterAnnotationsSize(
Constants.RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS,
lastRuntimeInvisibleParameterAnnotations,
invisibleAnnotableParameterCount == 0
? lastRuntimeInvisibleParameterAnnotations.length
: invisibleAnnotableParameterCount);
}
if (lastRuntimeVisibleTypeAnnotation != null) {
size +=
lastRuntimeVisibleTypeAnnotation.computeAnnotationsSize(
Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS);
}
if (lastRuntimeInvisibleTypeAnnotation != null) {
size +=
lastRuntimeInvisibleTypeAnnotation.computeAnnotationsSize(
Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS);
}
if (defaultValue != null) {
symbolTable.addConstantUtf8(Constants.ANNOTATION_DEFAULT);
size += 6 + defaultValue.length;
}
if (parameters != null) {
symbolTable.addConstantUtf8(Constants.METHOD_PARAMETERS);
// 6 header bytes and 1 byte for parameters_count.
size += 7 + parameters.length;
}
if (firstAttribute != null) {
size += firstAttribute.computeAttributesSize(symbolTable);
}
return size;
} | class class_name[name] begin[{]
method[computeMethodInfoSize, return_type[type[int]], modifier[default], parameter[]] begin[{]
if[binary_operation[member[.sourceOffset], !=, literal[0]]] begin[{]
return[binary_operation[literal[6], +, member[.sourceLength]]]
else begin[{]
None
end[}]
local_variable[type[int], size]
if[binary_operation[member[code.length], >, literal[0]]] begin[{]
if[binary_operation[member[code.length], >, literal[65535]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[MethodInvocation(arguments=[], member=getClassName, postfix_operators=[], prefix_operators=[], qualifier=symbolTable, selectors=[], type_arguments=None), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=descriptor, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=code, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=MethodTooLargeException, sub_type=None)), label=None)
else begin[{]
None
end[}]
call[symbolTable.addConstantUtf8, parameter[member[Constants.CODE]]]
assign[member[.size], binary_operation[binary_operation[literal[16], +, member[code.length]], +, call[Handler.getExceptionTableSize, parameter[member[.firstHandler]]]]]
if[binary_operation[member[.stackMapTableEntries], !=, literal[null]]] begin[{]
local_variable[type[boolean], useStackMapTable]
call[symbolTable.addConstantUtf8, parameter[TernaryExpression(condition=MemberReference(member=useStackMapTable, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="StackMap"), if_true=MemberReference(member=STACK_MAP_TABLE, postfix_operators=[], prefix_operators=[], qualifier=Constants, selectors=[]))]]
assign[member[.size], binary_operation[literal[8], +, member[stackMapTableEntries.length]]]
else begin[{]
None
end[}]
if[binary_operation[member[.lineNumberTable], !=, literal[null]]] begin[{]
call[symbolTable.addConstantUtf8, parameter[member[Constants.LINE_NUMBER_TABLE]]]
assign[member[.size], binary_operation[literal[8], +, member[lineNumberTable.length]]]
else begin[{]
None
end[}]
if[binary_operation[member[.localVariableTable], !=, literal[null]]] begin[{]
call[symbolTable.addConstantUtf8, parameter[member[Constants.LOCAL_VARIABLE_TABLE]]]
assign[member[.size], binary_operation[literal[8], +, member[localVariableTable.length]]]
else begin[{]
None
end[}]
if[binary_operation[member[.localVariableTypeTable], !=, literal[null]]] begin[{]
call[symbolTable.addConstantUtf8, parameter[member[Constants.LOCAL_VARIABLE_TYPE_TABLE]]]
assign[member[.size], binary_operation[literal[8], +, member[localVariableTypeTable.length]]]
else begin[{]
None
end[}]
if[binary_operation[member[.lastCodeRuntimeVisibleTypeAnnotation], !=, literal[null]]] begin[{]
assign[member[.size], call[lastCodeRuntimeVisibleTypeAnnotation.computeAnnotationsSize, parameter[member[Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.lastCodeRuntimeInvisibleTypeAnnotation], !=, literal[null]]] begin[{]
assign[member[.size], call[lastCodeRuntimeInvisibleTypeAnnotation.computeAnnotationsSize, parameter[member[Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.firstCodeAttribute], !=, literal[null]]] begin[{]
assign[member[.size], call[firstCodeAttribute.computeAttributesSize, parameter[member[.symbolTable], member[code.data], member[code.length], member[.maxStack], member[.maxLocals]]]]
else begin[{]
None
end[}]
else begin[{]
None
end[}]
if[binary_operation[member[.numberOfExceptions], >, literal[0]]] begin[{]
call[symbolTable.addConstantUtf8, parameter[member[Constants.EXCEPTIONS]]]
assign[member[.size], binary_operation[literal[8], +, binary_operation[literal[2], *, member[.numberOfExceptions]]]]
else begin[{]
None
end[}]
local_variable[type[boolean], useSyntheticAttribute]
if[binary_operation[binary_operation[binary_operation[member[.accessFlags], &, member[Opcodes.ACC_SYNTHETIC]], !=, literal[0]], &&, member[.useSyntheticAttribute]]] begin[{]
call[symbolTable.addConstantUtf8, parameter[member[Constants.SYNTHETIC]]]
assign[member[.size], literal[6]]
else begin[{]
None
end[}]
if[binary_operation[member[.signatureIndex], !=, literal[0]]] begin[{]
call[symbolTable.addConstantUtf8, parameter[member[Constants.SIGNATURE]]]
assign[member[.size], literal[8]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.accessFlags], &, member[Opcodes.ACC_DEPRECATED]], !=, literal[0]]] begin[{]
call[symbolTable.addConstantUtf8, parameter[member[Constants.DEPRECATED]]]
assign[member[.size], literal[6]]
else begin[{]
None
end[}]
if[binary_operation[member[.lastRuntimeVisibleAnnotation], !=, literal[null]]] begin[{]
assign[member[.size], call[lastRuntimeVisibleAnnotation.computeAnnotationsSize, parameter[member[Constants.RUNTIME_VISIBLE_ANNOTATIONS]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.lastRuntimeInvisibleAnnotation], !=, literal[null]]] begin[{]
assign[member[.size], call[lastRuntimeInvisibleAnnotation.computeAnnotationsSize, parameter[member[Constants.RUNTIME_INVISIBLE_ANNOTATIONS]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.lastRuntimeVisibleParameterAnnotations], !=, literal[null]]] begin[{]
assign[member[.size], call[AnnotationWriter.computeParameterAnnotationsSize, parameter[member[Constants.RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS], member[.lastRuntimeVisibleParameterAnnotations], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=visibleAnnotableParameterCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), if_false=MemberReference(member=visibleAnnotableParameterCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=lastRuntimeVisibleParameterAnnotations, selectors=[]))]]]
else begin[{]
None
end[}]
if[binary_operation[member[.lastRuntimeInvisibleParameterAnnotations], !=, literal[null]]] begin[{]
assign[member[.size], call[AnnotationWriter.computeParameterAnnotationsSize, parameter[member[Constants.RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS], member[.lastRuntimeInvisibleParameterAnnotations], TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=invisibleAnnotableParameterCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator===), if_false=MemberReference(member=invisibleAnnotableParameterCount, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), if_true=MemberReference(member=length, postfix_operators=[], prefix_operators=[], qualifier=lastRuntimeInvisibleParameterAnnotations, selectors=[]))]]]
else begin[{]
None
end[}]
if[binary_operation[member[.lastRuntimeVisibleTypeAnnotation], !=, literal[null]]] begin[{]
assign[member[.size], call[lastRuntimeVisibleTypeAnnotation.computeAnnotationsSize, parameter[member[Constants.RUNTIME_VISIBLE_TYPE_ANNOTATIONS]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.lastRuntimeInvisibleTypeAnnotation], !=, literal[null]]] begin[{]
assign[member[.size], call[lastRuntimeInvisibleTypeAnnotation.computeAnnotationsSize, parameter[member[Constants.RUNTIME_INVISIBLE_TYPE_ANNOTATIONS]]]]
else begin[{]
None
end[}]
if[binary_operation[member[.defaultValue], !=, literal[null]]] begin[{]
call[symbolTable.addConstantUtf8, parameter[member[Constants.ANNOTATION_DEFAULT]]]
assign[member[.size], binary_operation[literal[6], +, member[defaultValue.length]]]
else begin[{]
None
end[}]
if[binary_operation[member[.parameters], !=, literal[null]]] begin[{]
call[symbolTable.addConstantUtf8, parameter[member[Constants.METHOD_PARAMETERS]]]
assign[member[.size], binary_operation[literal[7], +, member[parameters.length]]]
else begin[{]
None
end[}]
if[binary_operation[member[.firstAttribute], !=, literal[null]]] begin[{]
assign[member[.size], call[firstAttribute.computeAttributesSize, parameter[member[.symbolTable]]]]
else begin[{]
None
end[}]
return[member[.size]]
end[}]
END[}] | Keyword[int] identifier[computeMethodInfoSize] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[sourceOffset] operator[!=] Other[0] operator[SEP] {
Keyword[return] Other[6] operator[+] identifier[sourceLength] operator[SEP]
}
Keyword[int] identifier[size] operator[=] Other[8] operator[SEP] Keyword[if] operator[SEP] identifier[code] operator[SEP] identifier[length] operator[>] Other[0] operator[SEP] {
Keyword[if] operator[SEP] identifier[code] operator[SEP] identifier[length] operator[>] Other[65535] operator[SEP] {
Keyword[throw] Keyword[new] identifier[MethodTooLargeException] operator[SEP] identifier[symbolTable] operator[SEP] identifier[getClassName] operator[SEP] operator[SEP] , identifier[name] , identifier[descriptor] , identifier[code] operator[SEP] identifier[length] operator[SEP] operator[SEP]
}
identifier[symbolTable] operator[SEP] identifier[addConstantUtf8] operator[SEP] identifier[Constants] operator[SEP] identifier[CODE] operator[SEP] operator[SEP] identifier[size] operator[+=] Other[16] operator[+] identifier[code] operator[SEP] identifier[length] operator[+] identifier[Handler] operator[SEP] identifier[getExceptionTableSize] operator[SEP] identifier[firstHandler] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[stackMapTableEntries] operator[!=] Other[null] operator[SEP] {
Keyword[boolean] identifier[useStackMapTable] operator[=] identifier[symbolTable] operator[SEP] identifier[getMajorVersion] operator[SEP] operator[SEP] operator[>=] identifier[Opcodes] operator[SEP] identifier[V1_6] operator[SEP] identifier[symbolTable] operator[SEP] identifier[addConstantUtf8] operator[SEP] identifier[useStackMapTable] operator[?] identifier[Constants] operator[SEP] identifier[STACK_MAP_TABLE] operator[:] literal[String] operator[SEP] operator[SEP] identifier[size] operator[+=] Other[8] operator[+] identifier[stackMapTableEntries] operator[SEP] identifier[length] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lineNumberTable] operator[!=] Other[null] operator[SEP] {
identifier[symbolTable] operator[SEP] identifier[addConstantUtf8] operator[SEP] identifier[Constants] operator[SEP] identifier[LINE_NUMBER_TABLE] operator[SEP] operator[SEP] identifier[size] operator[+=] Other[8] operator[+] identifier[lineNumberTable] operator[SEP] identifier[length] operator[SEP]
}
Keyword[if] operator[SEP] identifier[localVariableTable] operator[!=] Other[null] operator[SEP] {
identifier[symbolTable] operator[SEP] identifier[addConstantUtf8] operator[SEP] identifier[Constants] operator[SEP] identifier[LOCAL_VARIABLE_TABLE] operator[SEP] operator[SEP] identifier[size] operator[+=] Other[8] operator[+] identifier[localVariableTable] operator[SEP] identifier[length] operator[SEP]
}
Keyword[if] operator[SEP] identifier[localVariableTypeTable] operator[!=] Other[null] operator[SEP] {
identifier[symbolTable] operator[SEP] identifier[addConstantUtf8] operator[SEP] identifier[Constants] operator[SEP] identifier[LOCAL_VARIABLE_TYPE_TABLE] operator[SEP] operator[SEP] identifier[size] operator[+=] Other[8] operator[+] identifier[localVariableTypeTable] operator[SEP] identifier[length] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lastCodeRuntimeVisibleTypeAnnotation] operator[!=] Other[null] operator[SEP] {
identifier[size] operator[+=] identifier[lastCodeRuntimeVisibleTypeAnnotation] operator[SEP] identifier[computeAnnotationsSize] operator[SEP] identifier[Constants] operator[SEP] identifier[RUNTIME_VISIBLE_TYPE_ANNOTATIONS] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lastCodeRuntimeInvisibleTypeAnnotation] operator[!=] Other[null] operator[SEP] {
identifier[size] operator[+=] identifier[lastCodeRuntimeInvisibleTypeAnnotation] operator[SEP] identifier[computeAnnotationsSize] operator[SEP] identifier[Constants] operator[SEP] identifier[RUNTIME_INVISIBLE_TYPE_ANNOTATIONS] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[firstCodeAttribute] operator[!=] Other[null] operator[SEP] {
identifier[size] operator[+=] identifier[firstCodeAttribute] operator[SEP] identifier[computeAttributesSize] operator[SEP] identifier[symbolTable] , identifier[code] operator[SEP] identifier[data] , identifier[code] operator[SEP] identifier[length] , identifier[maxStack] , identifier[maxLocals] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[numberOfExceptions] operator[>] Other[0] operator[SEP] {
identifier[symbolTable] operator[SEP] identifier[addConstantUtf8] operator[SEP] identifier[Constants] operator[SEP] identifier[EXCEPTIONS] operator[SEP] operator[SEP] identifier[size] operator[+=] Other[8] operator[+] Other[2] operator[*] identifier[numberOfExceptions] operator[SEP]
}
Keyword[boolean] identifier[useSyntheticAttribute] operator[=] identifier[symbolTable] operator[SEP] identifier[getMajorVersion] operator[SEP] operator[SEP] operator[<] identifier[Opcodes] operator[SEP] identifier[V1_5] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[accessFlags] operator[&] identifier[Opcodes] operator[SEP] identifier[ACC_SYNTHETIC] operator[SEP] operator[!=] Other[0] operator[&&] identifier[useSyntheticAttribute] operator[SEP] {
identifier[symbolTable] operator[SEP] identifier[addConstantUtf8] operator[SEP] identifier[Constants] operator[SEP] identifier[SYNTHETIC] operator[SEP] operator[SEP] identifier[size] operator[+=] Other[6] operator[SEP]
}
Keyword[if] operator[SEP] identifier[signatureIndex] operator[!=] Other[0] operator[SEP] {
identifier[symbolTable] operator[SEP] identifier[addConstantUtf8] operator[SEP] identifier[Constants] operator[SEP] identifier[SIGNATURE] operator[SEP] operator[SEP] identifier[size] operator[+=] Other[8] operator[SEP]
}
Keyword[if] operator[SEP] operator[SEP] identifier[accessFlags] operator[&] identifier[Opcodes] operator[SEP] identifier[ACC_DEPRECATED] operator[SEP] operator[!=] Other[0] operator[SEP] {
identifier[symbolTable] operator[SEP] identifier[addConstantUtf8] operator[SEP] identifier[Constants] operator[SEP] identifier[DEPRECATED] operator[SEP] operator[SEP] identifier[size] operator[+=] Other[6] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lastRuntimeVisibleAnnotation] operator[!=] Other[null] operator[SEP] {
identifier[size] operator[+=] identifier[lastRuntimeVisibleAnnotation] operator[SEP] identifier[computeAnnotationsSize] operator[SEP] identifier[Constants] operator[SEP] identifier[RUNTIME_VISIBLE_ANNOTATIONS] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lastRuntimeInvisibleAnnotation] operator[!=] Other[null] operator[SEP] {
identifier[size] operator[+=] identifier[lastRuntimeInvisibleAnnotation] operator[SEP] identifier[computeAnnotationsSize] operator[SEP] identifier[Constants] operator[SEP] identifier[RUNTIME_INVISIBLE_ANNOTATIONS] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lastRuntimeVisibleParameterAnnotations] operator[!=] Other[null] operator[SEP] {
identifier[size] operator[+=] identifier[AnnotationWriter] operator[SEP] identifier[computeParameterAnnotationsSize] operator[SEP] identifier[Constants] operator[SEP] identifier[RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS] , identifier[lastRuntimeVisibleParameterAnnotations] , identifier[visibleAnnotableParameterCount] operator[==] Other[0] operator[?] identifier[lastRuntimeVisibleParameterAnnotations] operator[SEP] identifier[length] operator[:] identifier[visibleAnnotableParameterCount] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lastRuntimeInvisibleParameterAnnotations] operator[!=] Other[null] operator[SEP] {
identifier[size] operator[+=] identifier[AnnotationWriter] operator[SEP] identifier[computeParameterAnnotationsSize] operator[SEP] identifier[Constants] operator[SEP] identifier[RUNTIME_INVISIBLE_PARAMETER_ANNOTATIONS] , identifier[lastRuntimeInvisibleParameterAnnotations] , identifier[invisibleAnnotableParameterCount] operator[==] Other[0] operator[?] identifier[lastRuntimeInvisibleParameterAnnotations] operator[SEP] identifier[length] operator[:] identifier[invisibleAnnotableParameterCount] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lastRuntimeVisibleTypeAnnotation] operator[!=] Other[null] operator[SEP] {
identifier[size] operator[+=] identifier[lastRuntimeVisibleTypeAnnotation] operator[SEP] identifier[computeAnnotationsSize] operator[SEP] identifier[Constants] operator[SEP] identifier[RUNTIME_VISIBLE_TYPE_ANNOTATIONS] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[lastRuntimeInvisibleTypeAnnotation] operator[!=] Other[null] operator[SEP] {
identifier[size] operator[+=] identifier[lastRuntimeInvisibleTypeAnnotation] operator[SEP] identifier[computeAnnotationsSize] operator[SEP] identifier[Constants] operator[SEP] identifier[RUNTIME_INVISIBLE_TYPE_ANNOTATIONS] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[defaultValue] operator[!=] Other[null] operator[SEP] {
identifier[symbolTable] operator[SEP] identifier[addConstantUtf8] operator[SEP] identifier[Constants] operator[SEP] identifier[ANNOTATION_DEFAULT] operator[SEP] operator[SEP] identifier[size] operator[+=] Other[6] operator[+] identifier[defaultValue] operator[SEP] identifier[length] operator[SEP]
}
Keyword[if] operator[SEP] identifier[parameters] operator[!=] Other[null] operator[SEP] {
identifier[symbolTable] operator[SEP] identifier[addConstantUtf8] operator[SEP] identifier[Constants] operator[SEP] identifier[METHOD_PARAMETERS] operator[SEP] operator[SEP] identifier[size] operator[+=] Other[7] operator[+] identifier[parameters] operator[SEP] identifier[length] operator[SEP]
}
Keyword[if] operator[SEP] identifier[firstAttribute] operator[!=] Other[null] operator[SEP] {
identifier[size] operator[+=] identifier[firstAttribute] operator[SEP] identifier[computeAttributesSize] operator[SEP] identifier[symbolTable] operator[SEP] operator[SEP]
}
Keyword[return] identifier[size] operator[SEP]
}
|
public SDVariable conv2d(SDVariable[] inputs, Conv2DConfig conv2DConfig) {
return conv2d(null, inputs, conv2DConfig);
} | class class_name[name] begin[{]
method[conv2d, return_type[type[SDVariable]], modifier[public], parameter[inputs, conv2DConfig]] begin[{]
return[call[.conv2d, parameter[literal[null], member[.inputs], member[.conv2DConfig]]]]
end[}]
END[}] | Keyword[public] identifier[SDVariable] identifier[conv2d] operator[SEP] identifier[SDVariable] operator[SEP] operator[SEP] identifier[inputs] , identifier[Conv2DConfig] identifier[conv2DConfig] operator[SEP] {
Keyword[return] identifier[conv2d] operator[SEP] Other[null] , identifier[inputs] , identifier[conv2DConfig] operator[SEP] operator[SEP]
}
|
public static SslContext forKeystore(String keystorePath, String keystorePassword, String keyManagerAlgorithm)
throws SecurityContextException {
try {
return forKeystore(new FileInputStream(keystorePath), keystorePassword, keyManagerAlgorithm);
} catch (Exception e) {
throw new SecurityContextException(e);
}
} | class class_name[name] begin[{]
method[forKeystore, return_type[type[SslContext]], modifier[public static], parameter[keystorePath, keystorePassword, keyManagerAlgorithm]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=keystorePath, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=FileInputStream, sub_type=None)), MemberReference(member=keystorePassword, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=keyManagerAlgorithm, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=forKeystore, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SecurityContextException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[static] identifier[SslContext] identifier[forKeystore] operator[SEP] identifier[String] identifier[keystorePath] , identifier[String] identifier[keystorePassword] , identifier[String] identifier[keyManagerAlgorithm] operator[SEP] Keyword[throws] identifier[SecurityContextException] {
Keyword[try] {
Keyword[return] identifier[forKeystore] operator[SEP] Keyword[new] identifier[FileInputStream] operator[SEP] identifier[keystorePath] operator[SEP] , identifier[keystorePassword] , identifier[keyManagerAlgorithm] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SecurityContextException] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
|
private void clear(Object caller, int version) {
assert mutation_in_progress(caller, version);
_buf_limit = 0;
for (int ii=0; ii<_blocks.size(); ii++) {
_blocks.get(ii).clearBlock();
// _blocks.get(ii)._idx = -1; this is done in clearBlock()
}
bbBlock first = _blocks.get(0);
first._idx = 0; // cas: 26 dec 2008
first._offset = 0;
first._limit = 0;
_next_block_position = 1;
return;
} | class class_name[name] begin[{]
method[clear, return_type[void], modifier[private], parameter[caller, version]] begin[{]
AssertStatement(condition=MethodInvocation(arguments=[MemberReference(member=caller, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=version, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=mutation_in_progress, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None, value=None)
assign[member[._buf_limit], literal[0]]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=_blocks, selectors=[MethodInvocation(arguments=[], member=clearBlock, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=ii, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=_blocks, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=ii)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=ii, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
local_variable[type[bbBlock], first]
assign[member[first._idx], literal[0]]
assign[member[first._offset], literal[0]]
assign[member[first._limit], literal[0]]
assign[member[._next_block_position], literal[1]]
return[None]
end[}]
END[}] | Keyword[private] Keyword[void] identifier[clear] operator[SEP] identifier[Object] identifier[caller] , Keyword[int] identifier[version] operator[SEP] {
Keyword[assert] identifier[mutation_in_progress] operator[SEP] identifier[caller] , identifier[version] operator[SEP] operator[SEP] identifier[_buf_limit] operator[=] Other[0] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[ii] operator[=] Other[0] operator[SEP] identifier[ii] operator[<] identifier[_blocks] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[ii] operator[++] operator[SEP] {
identifier[_blocks] operator[SEP] identifier[get] operator[SEP] identifier[ii] operator[SEP] operator[SEP] identifier[clearBlock] operator[SEP] operator[SEP] operator[SEP]
}
identifier[bbBlock] identifier[first] operator[=] identifier[_blocks] operator[SEP] identifier[get] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[first] operator[SEP] identifier[_idx] operator[=] Other[0] operator[SEP] identifier[first] operator[SEP] identifier[_offset] operator[=] Other[0] operator[SEP] identifier[first] operator[SEP] identifier[_limit] operator[=] Other[0] operator[SEP] identifier[_next_block_position] operator[=] Other[1] operator[SEP] Keyword[return] operator[SEP]
}
|
public SpannableStringBuilder replace(int start, int end, CharSequence tb) {
return replace(start, end, tb, 0, tb.length());
} | class class_name[name] begin[{]
method[replace, return_type[type[SpannableStringBuilder]], modifier[public], parameter[start, end, tb]] begin[{]
return[call[.replace, parameter[member[.start], member[.end], member[.tb], literal[0], call[tb.length, parameter[]]]]]
end[}]
END[}] | Keyword[public] identifier[SpannableStringBuilder] identifier[replace] operator[SEP] Keyword[int] identifier[start] , Keyword[int] identifier[end] , identifier[CharSequence] identifier[tb] operator[SEP] {
Keyword[return] identifier[replace] operator[SEP] identifier[start] , identifier[end] , identifier[tb] , Other[0] , identifier[tb] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public Form createFormDefinition(Form formDefinitionParam)
{
if(formDefinitionParam != null && this.serviceTicket != null)
{
formDefinitionParam.setServiceTicket(this.serviceTicket);
}
return new Form(this.putJson(
formDefinitionParam, WS.Path.FormDefinition.Version1.formDefinitionCreate()));
} | class class_name[name] begin[{]
method[createFormDefinition, return_type[type[Form]], modifier[public], parameter[formDefinitionParam]] begin[{]
if[binary_operation[binary_operation[member[.formDefinitionParam], !=, literal[null]], &&, binary_operation[THIS[member[None.serviceTicket]], !=, literal[null]]]] begin[{]
call[formDefinitionParam.setServiceTicket, parameter[THIS[member[None.serviceTicket]]]]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=formDefinitionParam, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=formDefinitionCreate, postfix_operators=[], prefix_operators=[], qualifier=WS.Path.FormDefinition.Version1, selectors=[], type_arguments=None)], member=putJson, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Form, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Form] identifier[createFormDefinition] operator[SEP] identifier[Form] identifier[formDefinitionParam] operator[SEP] {
Keyword[if] operator[SEP] identifier[formDefinitionParam] operator[!=] Other[null] operator[&&] Keyword[this] operator[SEP] identifier[serviceTicket] operator[!=] Other[null] operator[SEP] {
identifier[formDefinitionParam] operator[SEP] identifier[setServiceTicket] operator[SEP] Keyword[this] operator[SEP] identifier[serviceTicket] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[Form] operator[SEP] Keyword[this] operator[SEP] identifier[putJson] operator[SEP] identifier[formDefinitionParam] , identifier[WS] operator[SEP] identifier[Path] operator[SEP] identifier[FormDefinition] operator[SEP] identifier[Version1] operator[SEP] identifier[formDefinitionCreate] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public List<ModuleType<ApplicationType<T>>> getAllModule()
{
List<ModuleType<ApplicationType<T>>> list = new ArrayList<ModuleType<ApplicationType<T>>>();
List<Node> nodeList = childNode.get("module");
for(Node node: nodeList)
{
ModuleType<ApplicationType<T>> type = new ModuleTypeImpl<ApplicationType<T>>(this, "module", childNode, node);
list.add(type);
}
return list;
} | class class_name[name] begin[{]
method[getAllModule, return_type[type[List]], modifier[public], parameter[]] begin[{]
local_variable[type[List], list]
local_variable[type[List], nodeList]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="module"), MemberReference(member=childNode, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=node, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=ApplicationType, sub_type=None))], dimensions=None, name=ModuleTypeImpl, sub_type=None)), name=type)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=ApplicationType, sub_type=None))], dimensions=[], name=ModuleType, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=add, postfix_operators=[], prefix_operators=[], qualifier=list, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=nodeList, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=node)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Node, sub_type=None))), label=None)
return[member[.list]]
end[}]
END[}] | Keyword[public] identifier[List] operator[<] identifier[ModuleType] operator[<] identifier[ApplicationType] operator[<] identifier[T] operator[>] operator[>] operator[>] identifier[getAllModule] operator[SEP] operator[SEP] {
identifier[List] operator[<] identifier[ModuleType] operator[<] identifier[ApplicationType] operator[<] identifier[T] operator[>] operator[>] operator[>] identifier[list] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[ModuleType] operator[<] identifier[ApplicationType] operator[<] identifier[T] operator[>] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[Node] operator[>] identifier[nodeList] operator[=] identifier[childNode] operator[SEP] identifier[get] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[Node] identifier[node] operator[:] identifier[nodeList] operator[SEP] {
identifier[ModuleType] operator[<] identifier[ApplicationType] operator[<] identifier[T] operator[>] operator[>] identifier[type] operator[=] Keyword[new] identifier[ModuleTypeImpl] operator[<] identifier[ApplicationType] operator[<] identifier[T] operator[>] operator[>] operator[SEP] Keyword[this] , literal[String] , identifier[childNode] , identifier[node] operator[SEP] operator[SEP] identifier[list] operator[SEP] identifier[add] operator[SEP] identifier[type] operator[SEP] operator[SEP]
}
Keyword[return] identifier[list] operator[SEP]
}
|
public static <T, R, C, V, I extends Table<R, C, V>> Collector<T, ?, I> toTable(
java.util.function.Function<? super T, ? extends R> rowFunction,
java.util.function.Function<? super T, ? extends C> columnFunction,
java.util.function.Function<? super T, ? extends V> valueFunction,
BinaryOperator<V> mergeFunction,
java.util.function.Supplier<I> tableSupplier) {
checkNotNull(rowFunction);
checkNotNull(columnFunction);
checkNotNull(valueFunction);
checkNotNull(mergeFunction);
checkNotNull(tableSupplier);
return Collector.of(
tableSupplier,
(table, input) ->
merge(
table,
rowFunction.apply(input),
columnFunction.apply(input),
valueFunction.apply(input),
mergeFunction),
(table1, table2) -> {
for (Table.Cell<R, C, V> cell2 : table2.cellSet()) {
merge(table1, cell2.getRowKey(), cell2.getColumnKey(), cell2.getValue(), mergeFunction);
}
return table1;
});
} | class class_name[name] begin[{]
method[toTable, return_type[type[Collector]], modifier[public static], parameter[rowFunction, columnFunction, valueFunction, mergeFunction, tableSupplier]] begin[{]
call[.checkNotNull, parameter[member[.rowFunction]]]
call[.checkNotNull, parameter[member[.columnFunction]]]
call[.checkNotNull, parameter[member[.valueFunction]]]
call[.checkNotNull, parameter[member[.mergeFunction]]]
call[.checkNotNull, parameter[member[.tableSupplier]]]
return[call[Collector.of, parameter[member[.tableSupplier], LambdaExpression(body=MethodInvocation(arguments=[MemberReference(member=table, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=apply, postfix_operators=[], prefix_operators=[], qualifier=rowFunction, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=apply, postfix_operators=[], prefix_operators=[], qualifier=columnFunction, selectors=[], type_arguments=None), MethodInvocation(arguments=[MemberReference(member=input, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=apply, postfix_operators=[], prefix_operators=[], qualifier=valueFunction, selectors=[], type_arguments=None), MemberReference(member=mergeFunction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=merge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), parameters=[InferredFormalParameter(name=table), InferredFormalParameter(name=input)]), LambdaExpression(body=[ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=table1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getRowKey, postfix_operators=[], prefix_operators=[], qualifier=cell2, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getColumnKey, postfix_operators=[], prefix_operators=[], qualifier=cell2, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getValue, postfix_operators=[], prefix_operators=[], qualifier=cell2, selectors=[], type_arguments=None), MemberReference(member=mergeFunction, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=merge, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=cellSet, postfix_operators=[], prefix_operators=[], qualifier=table2, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=cell2)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Table, sub_type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=R, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=C, sub_type=None)), TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=V, sub_type=None))], dimensions=None, name=Cell, sub_type=None)))), label=None), ReturnStatement(expression=MemberReference(member=table1, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], parameters=[InferredFormalParameter(name=table1), InferredFormalParameter(name=table2)])]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] , identifier[R] , identifier[C] , identifier[V] , identifier[I] Keyword[extends] identifier[Table] operator[<] identifier[R] , identifier[C] , identifier[V] operator[>] operator[>] identifier[Collector] operator[<] identifier[T] , operator[?] , identifier[I] operator[>] identifier[toTable] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[function] operator[SEP] identifier[Function] operator[<] operator[?] Keyword[super] identifier[T] , operator[?] Keyword[extends] identifier[R] operator[>] identifier[rowFunction] , identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[function] operator[SEP] identifier[Function] operator[<] operator[?] Keyword[super] identifier[T] , operator[?] Keyword[extends] identifier[C] operator[>] identifier[columnFunction] , identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[function] operator[SEP] identifier[Function] operator[<] operator[?] Keyword[super] identifier[T] , operator[?] Keyword[extends] identifier[V] operator[>] identifier[valueFunction] , identifier[BinaryOperator] operator[<] identifier[V] operator[>] identifier[mergeFunction] , identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[function] operator[SEP] identifier[Supplier] operator[<] identifier[I] operator[>] identifier[tableSupplier] operator[SEP] {
identifier[checkNotNull] operator[SEP] identifier[rowFunction] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[columnFunction] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[valueFunction] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[mergeFunction] operator[SEP] operator[SEP] identifier[checkNotNull] operator[SEP] identifier[tableSupplier] operator[SEP] operator[SEP] Keyword[return] identifier[Collector] operator[SEP] identifier[of] operator[SEP] identifier[tableSupplier] , operator[SEP] identifier[table] , identifier[input] operator[SEP] operator[->] identifier[merge] operator[SEP] identifier[table] , identifier[rowFunction] operator[SEP] identifier[apply] operator[SEP] identifier[input] operator[SEP] , identifier[columnFunction] operator[SEP] identifier[apply] operator[SEP] identifier[input] operator[SEP] , identifier[valueFunction] operator[SEP] identifier[apply] operator[SEP] identifier[input] operator[SEP] , identifier[mergeFunction] operator[SEP] , operator[SEP] identifier[table1] , identifier[table2] operator[SEP] operator[->] {
Keyword[for] operator[SEP] identifier[Table] operator[SEP] identifier[Cell] operator[<] identifier[R] , identifier[C] , identifier[V] operator[>] identifier[cell2] operator[:] identifier[table2] operator[SEP] identifier[cellSet] operator[SEP] operator[SEP] operator[SEP] {
identifier[merge] operator[SEP] identifier[table1] , identifier[cell2] operator[SEP] identifier[getRowKey] operator[SEP] operator[SEP] , identifier[cell2] operator[SEP] identifier[getColumnKey] operator[SEP] operator[SEP] , identifier[cell2] operator[SEP] identifier[getValue] operator[SEP] operator[SEP] , identifier[mergeFunction] operator[SEP] operator[SEP]
}
Keyword[return] identifier[table1] operator[SEP]
} operator[SEP] operator[SEP]
}
|
public final DeviceRegistry createDeviceRegistry(
LocationName parent, DeviceRegistry deviceRegistry) {
CreateDeviceRegistryRequest request =
CreateDeviceRegistryRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setDeviceRegistry(deviceRegistry)
.build();
return createDeviceRegistry(request);
} | class class_name[name] begin[{]
method[createDeviceRegistry, return_type[type[DeviceRegistry]], modifier[final public], parameter[parent, deviceRegistry]] begin[{]
local_variable[type[CreateDeviceRegistryRequest], request]
return[call[.createDeviceRegistry, parameter[member[.request]]]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[DeviceRegistry] identifier[createDeviceRegistry] operator[SEP] identifier[LocationName] identifier[parent] , identifier[DeviceRegistry] identifier[deviceRegistry] operator[SEP] {
identifier[CreateDeviceRegistryRequest] identifier[request] operator[=] identifier[CreateDeviceRegistryRequest] operator[SEP] identifier[newBuilder] operator[SEP] operator[SEP] operator[SEP] identifier[setParent] operator[SEP] identifier[parent] operator[==] Other[null] operator[?] Other[null] operator[:] identifier[parent] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[setDeviceRegistry] operator[SEP] identifier[deviceRegistry] operator[SEP] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[createDeviceRegistry] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
private String getTypes(int flags) {
String types = "";
if ((flags & CRT_STATEMENT) != 0) types += " CRT_STATEMENT";
if ((flags & CRT_BLOCK) != 0) types += " CRT_BLOCK";
if ((flags & CRT_ASSIGNMENT) != 0) types += " CRT_ASSIGNMENT";
if ((flags & CRT_FLOW_CONTROLLER) != 0) types += " CRT_FLOW_CONTROLLER";
if ((flags & CRT_FLOW_TARGET) != 0) types += " CRT_FLOW_TARGET";
if ((flags & CRT_INVOKE) != 0) types += " CRT_INVOKE";
if ((flags & CRT_CREATE) != 0) types += " CRT_CREATE";
if ((flags & CRT_BRANCH_TRUE) != 0) types += " CRT_BRANCH_TRUE";
if ((flags & CRT_BRANCH_FALSE) != 0) types += " CRT_BRANCH_FALSE";
return types;
} | class class_name[name] begin[{]
method[getTypes, return_type[type[String]], modifier[private], parameter[flags]] begin[{]
local_variable[type[String], types]
if[binary_operation[binary_operation[member[.flags], &, member[.CRT_STATEMENT]], !=, literal[0]]] begin[{]
assign[member[.types], literal[" CRT_STATEMENT"]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.flags], &, member[.CRT_BLOCK]], !=, literal[0]]] begin[{]
assign[member[.types], literal[" CRT_BLOCK"]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.flags], &, member[.CRT_ASSIGNMENT]], !=, literal[0]]] begin[{]
assign[member[.types], literal[" CRT_ASSIGNMENT"]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.flags], &, member[.CRT_FLOW_CONTROLLER]], !=, literal[0]]] begin[{]
assign[member[.types], literal[" CRT_FLOW_CONTROLLER"]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.flags], &, member[.CRT_FLOW_TARGET]], !=, literal[0]]] begin[{]
assign[member[.types], literal[" CRT_FLOW_TARGET"]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.flags], &, member[.CRT_INVOKE]], !=, literal[0]]] begin[{]
assign[member[.types], literal[" CRT_INVOKE"]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.flags], &, member[.CRT_CREATE]], !=, literal[0]]] begin[{]
assign[member[.types], literal[" CRT_CREATE"]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.flags], &, member[.CRT_BRANCH_TRUE]], !=, literal[0]]] begin[{]
assign[member[.types], literal[" CRT_BRANCH_TRUE"]]
else begin[{]
None
end[}]
if[binary_operation[binary_operation[member[.flags], &, member[.CRT_BRANCH_FALSE]], !=, literal[0]]] begin[{]
assign[member[.types], literal[" CRT_BRANCH_FALSE"]]
else begin[{]
None
end[}]
return[member[.types]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[getTypes] operator[SEP] Keyword[int] identifier[flags] operator[SEP] {
identifier[String] identifier[types] operator[=] literal[String] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[flags] operator[&] identifier[CRT_STATEMENT] operator[SEP] operator[!=] Other[0] operator[SEP] identifier[types] operator[+=] literal[String] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[flags] operator[&] identifier[CRT_BLOCK] operator[SEP] operator[!=] Other[0] operator[SEP] identifier[types] operator[+=] literal[String] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[flags] operator[&] identifier[CRT_ASSIGNMENT] operator[SEP] operator[!=] Other[0] operator[SEP] identifier[types] operator[+=] literal[String] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[flags] operator[&] identifier[CRT_FLOW_CONTROLLER] operator[SEP] operator[!=] Other[0] operator[SEP] identifier[types] operator[+=] literal[String] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[flags] operator[&] identifier[CRT_FLOW_TARGET] operator[SEP] operator[!=] Other[0] operator[SEP] identifier[types] operator[+=] literal[String] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[flags] operator[&] identifier[CRT_INVOKE] operator[SEP] operator[!=] Other[0] operator[SEP] identifier[types] operator[+=] literal[String] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[flags] operator[&] identifier[CRT_CREATE] operator[SEP] operator[!=] Other[0] operator[SEP] identifier[types] operator[+=] literal[String] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[flags] operator[&] identifier[CRT_BRANCH_TRUE] operator[SEP] operator[!=] Other[0] operator[SEP] identifier[types] operator[+=] literal[String] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[flags] operator[&] identifier[CRT_BRANCH_FALSE] operator[SEP] operator[!=] Other[0] operator[SEP] identifier[types] operator[+=] literal[String] operator[SEP] Keyword[return] identifier[types] operator[SEP]
}
|
public ByteArrayQueue readFrom(InputStream in) throws IOException {
byte[] buffer = new byte[BUFFER_SIZE];
int bytesRead;
while ((bytesRead = in.read(buffer)) > 0) {
add(buffer, 0, bytesRead);
}
return this;
} | class class_name[name] begin[{]
method[readFrom, return_type[type[ByteArrayQueue]], modifier[public], parameter[in]] begin[{]
local_variable[type[byte], buffer]
local_variable[type[int], bytesRead]
while[binary_operation[assign[member[.bytesRead], call[in.read, parameter[member[.buffer]]]], >, literal[0]]] begin[{]
call[.add, parameter[member[.buffer], literal[0], member[.bytesRead]]]
end[}]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[ByteArrayQueue] identifier[readFrom] operator[SEP] identifier[InputStream] identifier[in] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[byte] operator[SEP] operator[SEP] identifier[buffer] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[BUFFER_SIZE] operator[SEP] operator[SEP] Keyword[int] identifier[bytesRead] operator[SEP] Keyword[while] operator[SEP] operator[SEP] identifier[bytesRead] operator[=] identifier[in] operator[SEP] identifier[read] operator[SEP] identifier[buffer] operator[SEP] operator[SEP] operator[>] Other[0] operator[SEP] {
identifier[add] operator[SEP] identifier[buffer] , Other[0] , identifier[bytesRead] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[this] operator[SEP]
}
|
public static base_response update(nitro_service client, cacheselector resource) throws Exception {
cacheselector updateresource = new cacheselector();
updateresource.selectorname = resource.selectorname;
updateresource.rule = resource.rule;
return updateresource.update_resource(client);
} | class class_name[name] begin[{]
method[update, return_type[type[base_response]], modifier[public static], parameter[client, resource]] begin[{]
local_variable[type[cacheselector], updateresource]
assign[member[updateresource.selectorname], member[resource.selectorname]]
assign[member[updateresource.rule], member[resource.rule]]
return[call[updateresource.update_resource, parameter[member[.client]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[base_response] identifier[update] operator[SEP] identifier[nitro_service] identifier[client] , identifier[cacheselector] identifier[resource] operator[SEP] Keyword[throws] identifier[Exception] {
identifier[cacheselector] identifier[updateresource] operator[=] Keyword[new] identifier[cacheselector] operator[SEP] operator[SEP] operator[SEP] identifier[updateresource] operator[SEP] identifier[selectorname] operator[=] identifier[resource] operator[SEP] identifier[selectorname] operator[SEP] identifier[updateresource] operator[SEP] identifier[rule] operator[=] identifier[resource] operator[SEP] identifier[rule] operator[SEP] Keyword[return] identifier[updateresource] operator[SEP] identifier[update_resource] operator[SEP] identifier[client] operator[SEP] operator[SEP]
}
|
public String rewriteName(String name, Tag currentTag)
throws ExpressionEvaluationException
{
ExpressionEvaluator eval = ExpressionEvaluatorFactory.getInstance();
try {
if (!eval.isExpression(name))
return eval.qualify("actionForm", name);
return name;
}
catch (Exception e) {
if (logger.isErrorEnabled())
logger.error("Could not qualify name \"" + name + "\" into the actionForm binding context.", e);
// return the Struts name. This should cause regular Struts databinding to execute so this property will
// be updated anyway.
return name;
}
} | class class_name[name] begin[{]
method[rewriteName, return_type[type[String]], modifier[public], parameter[name, currentTag]] begin[{]
local_variable[type[ExpressionEvaluator], eval]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isExpression, postfix_operators=[], prefix_operators=['!'], qualifier=eval, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=ReturnStatement(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="actionForm"), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=qualify, postfix_operators=[], prefix_operators=[], qualifier=eval, selectors=[], type_arguments=None), label=None)), ReturnStatement(expression=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isErrorEnabled, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Could not qualify name \""), operandr=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\" into the actionForm binding context."), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)), ReturnStatement(expression=MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] identifier[String] identifier[rewriteName] operator[SEP] identifier[String] identifier[name] , identifier[Tag] identifier[currentTag] operator[SEP] Keyword[throws] identifier[ExpressionEvaluationException] {
identifier[ExpressionEvaluator] identifier[eval] operator[=] identifier[ExpressionEvaluatorFactory] operator[SEP] identifier[getInstance] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[if] operator[SEP] operator[!] identifier[eval] operator[SEP] identifier[isExpression] operator[SEP] identifier[name] operator[SEP] operator[SEP] Keyword[return] identifier[eval] operator[SEP] identifier[qualify] operator[SEP] literal[String] , identifier[name] operator[SEP] operator[SEP] Keyword[return] identifier[name] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[logger] operator[SEP] identifier[isErrorEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[name] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[return] identifier[name] operator[SEP]
}
}
|
protected MetaMatcher createMetaMatcher(String filterAsString, Map<String, MetaMatcher> metaMatchers) {
for ( String key : metaMatchers.keySet() ){
if ( filterAsString.startsWith(key)){
return metaMatchers.get(key);
}
}
if (filterAsString.startsWith(GROOVY)) {
return new GroovyMetaMatcher();
}
return new DefaultMetaMatcher();
} | class class_name[name] begin[{]
method[createMetaMatcher, return_type[type[MetaMatcher]], modifier[protected], parameter[filterAsString, metaMatchers]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=startsWith, postfix_operators=[], prefix_operators=[], qualifier=filterAsString, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=metaMatchers, selectors=[], type_arguments=None), label=None)]))]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=keySet, postfix_operators=[], prefix_operators=[], qualifier=metaMatchers, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
if[call[filterAsString.startsWith, parameter[member[.GROOVY]]]] begin[{]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GroovyMetaMatcher, sub_type=None))]
else begin[{]
None
end[}]
return[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=DefaultMetaMatcher, sub_type=None))]
end[}]
END[}] | Keyword[protected] identifier[MetaMatcher] identifier[createMetaMatcher] operator[SEP] identifier[String] identifier[filterAsString] , identifier[Map] operator[<] identifier[String] , identifier[MetaMatcher] operator[>] identifier[metaMatchers] operator[SEP] {
Keyword[for] operator[SEP] identifier[String] identifier[key] operator[:] identifier[metaMatchers] operator[SEP] identifier[keySet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[filterAsString] operator[SEP] identifier[startsWith] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
Keyword[return] identifier[metaMatchers] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[filterAsString] operator[SEP] identifier[startsWith] operator[SEP] identifier[GROOVY] operator[SEP] operator[SEP] {
Keyword[return] Keyword[new] identifier[GroovyMetaMatcher] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] Keyword[new] identifier[DefaultMetaMatcher] operator[SEP] operator[SEP] operator[SEP]
}
|
public ServiceFuture<Project> createProjectAsync(String name, CreateProjectOptionalParameter createProjectOptionalParameter, final ServiceCallback<Project> serviceCallback) {
return ServiceFuture.fromResponse(createProjectWithServiceResponseAsync(name, createProjectOptionalParameter), serviceCallback);
} | class class_name[name] begin[{]
method[createProjectAsync, return_type[type[ServiceFuture]], modifier[public], parameter[name, createProjectOptionalParameter, serviceCallback]] begin[{]
return[call[ServiceFuture.fromResponse, parameter[call[.createProjectWithServiceResponseAsync, parameter[member[.name], member[.createProjectOptionalParameter]]], member[.serviceCallback]]]]
end[}]
END[}] | Keyword[public] identifier[ServiceFuture] operator[<] identifier[Project] operator[>] identifier[createProjectAsync] operator[SEP] identifier[String] identifier[name] , identifier[CreateProjectOptionalParameter] identifier[createProjectOptionalParameter] , Keyword[final] identifier[ServiceCallback] operator[<] identifier[Project] operator[>] identifier[serviceCallback] operator[SEP] {
Keyword[return] identifier[ServiceFuture] operator[SEP] identifier[fromResponse] operator[SEP] identifier[createProjectWithServiceResponseAsync] operator[SEP] identifier[name] , identifier[createProjectOptionalParameter] operator[SEP] , identifier[serviceCallback] operator[SEP] operator[SEP]
}
|
@Override
protected TileColumn createColumn(TileCursor cursor, int index, String name,
String type, Long max, boolean notNull, int defaultValueIndex,
boolean primaryKey) {
GeoPackageDataType dataType = getDataType(type);
Object defaultValue = cursor.getValue(
defaultValueIndex, dataType);
TileColumn column = new TileColumn(index, name, dataType, max, notNull,
defaultValue, primaryKey);
return column;
} | class class_name[name] begin[{]
method[createColumn, return_type[type[TileColumn]], modifier[protected], parameter[cursor, index, name, type, max, notNull, defaultValueIndex, primaryKey]] begin[{]
local_variable[type[GeoPackageDataType], dataType]
local_variable[type[Object], defaultValue]
local_variable[type[TileColumn], column]
return[member[.column]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[protected] identifier[TileColumn] identifier[createColumn] operator[SEP] identifier[TileCursor] identifier[cursor] , Keyword[int] identifier[index] , identifier[String] identifier[name] , identifier[String] identifier[type] , identifier[Long] identifier[max] , Keyword[boolean] identifier[notNull] , Keyword[int] identifier[defaultValueIndex] , Keyword[boolean] identifier[primaryKey] operator[SEP] {
identifier[GeoPackageDataType] identifier[dataType] operator[=] identifier[getDataType] operator[SEP] identifier[type] operator[SEP] operator[SEP] identifier[Object] identifier[defaultValue] operator[=] identifier[cursor] operator[SEP] identifier[getValue] operator[SEP] identifier[defaultValueIndex] , identifier[dataType] operator[SEP] operator[SEP] identifier[TileColumn] identifier[column] operator[=] Keyword[new] identifier[TileColumn] operator[SEP] identifier[index] , identifier[name] , identifier[dataType] , identifier[max] , identifier[notNull] , identifier[defaultValue] , identifier[primaryKey] operator[SEP] operator[SEP] Keyword[return] identifier[column] operator[SEP]
}
|
public void setState(TransferState state) {
synchronized (this) {
this.state = state;
}
for ( TransferStateChangeListener listener : stateChangeListeners ) {
listener.transferStateChanged(this, state);
}
} | class class_name[name] begin[{]
method[setState, return_type[void], modifier[public], parameter[state]] begin[{]
SYNCHRONIZED[THIS[]] BEGIN[{]
assign[THIS[member[None.state]], member[.state]]
END[}]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=state, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=transferStateChanged, postfix_operators=[], prefix_operators=[], qualifier=listener, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=stateChangeListeners, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=listener)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=TransferStateChangeListener, sub_type=None))), label=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setState] operator[SEP] identifier[TransferState] identifier[state] operator[SEP] {
Keyword[synchronized] operator[SEP] Keyword[this] operator[SEP] {
Keyword[this] operator[SEP] identifier[state] operator[=] identifier[state] operator[SEP]
}
Keyword[for] operator[SEP] identifier[TransferStateChangeListener] identifier[listener] operator[:] identifier[stateChangeListeners] operator[SEP] {
identifier[listener] operator[SEP] identifier[transferStateChanged] operator[SEP] Keyword[this] , identifier[state] operator[SEP] operator[SEP]
}
}
|
@Override
public CompletableFuture<Void> append(String streamSegmentName, byte[] data, Collection<AttributeUpdate> attributeUpdates, Duration timeout) {
ensureRunning();
TimeoutTimer timer = new TimeoutTimer(timeout);
logRequest("append", streamSegmentName, data.length);
this.metrics.append();
return this.metadataStore.getOrAssignSegmentId(streamSegmentName, timer.getRemaining(),
streamSegmentId -> {
StreamSegmentAppendOperation operation = new StreamSegmentAppendOperation(streamSegmentId, data, attributeUpdates);
return processAttributeUpdaterOperation(operation, timer);
});
} | class class_name[name] begin[{]
method[append, return_type[type[CompletableFuture]], modifier[public], parameter[streamSegmentName, data, attributeUpdates, timeout]] begin[{]
call[.ensureRunning, parameter[]]
local_variable[type[TimeoutTimer], timer]
call[.logRequest, parameter[literal["append"], member[.streamSegmentName], member[data.length]]]
THIS[member[None.metrics]call[None.append, parameter[]]]
return[THIS[member[None.metadataStore]call[None.getOrAssignSegmentId, parameter[member[.streamSegmentName], call[timer.getRemaining, parameter[]], LambdaExpression(body=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=streamSegmentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=data, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=attributeUpdates, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StreamSegmentAppendOperation, sub_type=None)), name=operation)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=StreamSegmentAppendOperation, sub_type=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=operation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=timer, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=processAttributeUpdaterOperation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)], parameters=[MemberReference(member=streamSegmentId, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])])]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[CompletableFuture] operator[<] identifier[Void] operator[>] identifier[append] operator[SEP] identifier[String] identifier[streamSegmentName] , Keyword[byte] operator[SEP] operator[SEP] identifier[data] , identifier[Collection] operator[<] identifier[AttributeUpdate] operator[>] identifier[attributeUpdates] , identifier[Duration] identifier[timeout] operator[SEP] {
identifier[ensureRunning] operator[SEP] operator[SEP] operator[SEP] identifier[TimeoutTimer] identifier[timer] operator[=] Keyword[new] identifier[TimeoutTimer] operator[SEP] identifier[timeout] operator[SEP] operator[SEP] identifier[logRequest] operator[SEP] literal[String] , identifier[streamSegmentName] , identifier[data] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[metrics] operator[SEP] identifier[append] operator[SEP] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP] identifier[metadataStore] operator[SEP] identifier[getOrAssignSegmentId] operator[SEP] identifier[streamSegmentName] , identifier[timer] operator[SEP] identifier[getRemaining] operator[SEP] operator[SEP] , identifier[streamSegmentId] operator[->] {
identifier[StreamSegmentAppendOperation] identifier[operation] operator[=] Keyword[new] identifier[StreamSegmentAppendOperation] operator[SEP] identifier[streamSegmentId] , identifier[data] , identifier[attributeUpdates] operator[SEP] operator[SEP] Keyword[return] identifier[processAttributeUpdaterOperation] operator[SEP] identifier[operation] , identifier[timer] operator[SEP] operator[SEP]
} operator[SEP] operator[SEP]
}
|
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String PID = null;
Date asOfDateTime = null;
Date versDateTime = null;
boolean xml = false;
requestURI =
request.getRequestURL().toString() + "?"
+ request.getQueryString();
// Parse servlet URL.
String[] URIArray = request.getRequestURL().toString().split("/");
if (URIArray.length == 6 || URIArray.length == 7) {
// Request is either unversioned or versioned listMethods request
try {
PID = Server.getPID(URIArray[5]).toString(); // normalize PID
} catch (Throwable th) {
logger.error("Bad pid syntax in request", th);
throw new BadRequest400Exception(request,
ACTION_LABEL,
"",
EMPTY_STRING_ARRAY);
}
if (URIArray.length == 7) {
// Request is a versioned listMethods request
try {
versDateTime = DateUtility.parseDateStrict(URIArray[6]);
} catch(ParseException e) {
logger.error("Bad date format in request");
throw new BadRequest400Exception(request,
ACTION_LABEL,
"",
EMPTY_STRING_ARRAY);
}
asOfDateTime = versDateTime;
}
logger.debug("Listing methods (PID={}, asOfDate={})",
PID, versDateTime);
} else {
logger.error("Bad syntax (expected 6 or 7 parts) in request");
throw new BadRequest400Exception(request,
ACTION_LABEL,
"",
EMPTY_STRING_ARRAY);
}
if (request.getParameter("xml") != null) {
xml = Boolean.parseBoolean(request.getParameter("xml"));
}
try {
Context context =
ReadOnlyContext.getContext(HTTP_REQUEST.REST.uri, request);
listMethods(context, PID, asOfDateTime, xml, request, response);
logger.debug("Finished listing methods");
} catch (ObjectNotFoundException e) {
logger.error("Object not found for request: " + requestURI
+ " (actionLabel=" + ACTION_LABEL + ")", e);
throw new NotFound404Exception(request,
ACTION_LABEL,
"",
EMPTY_STRING_ARRAY);
} catch (DisseminationException e) {
logger.error("Error Listing Methods: " + requestURI + " (actionLabel="
+ ACTION_LABEL + ")", e);
throw new NotFound404Exception("Error Listing Methods",
e,
request,
ACTION_LABEL,
"",
EMPTY_STRING_ARRAY);
} catch (ObjectNotInLowlevelStorageException e) {
logger.error("Object not found for request: " + requestURI
+ " (actionLabel=" + ACTION_LABEL + ")", e);
throw new NotFound404Exception(request,
ACTION_LABEL,
"",
EMPTY_STRING_ARRAY);
} catch (AuthzException ae) {
logger.error("Authorization error listing methods", ae);
throw RootException.getServletException(ae,
request,
ACTION_LABEL,
EMPTY_STRING_ARRAY);
} catch (Throwable th) {
logger.error("Error listing methods", th);
throw new InternalError500Exception("Error listing methods",
th,
request,
ACTION_LABEL,
"",
EMPTY_STRING_ARRAY);
}
} | class class_name[name] begin[{]
method[doGet, return_type[void], modifier[public], parameter[request, response]] begin[{]
local_variable[type[String], PID]
local_variable[type[Date], asOfDateTime]
local_variable[type[Date], versDateTime]
local_variable[type[boolean], xml]
assign[member[.requestURI], binary_operation[binary_operation[call[request.getRequestURL, parameter[]], +, literal["?"]], +, call[request.getQueryString, parameter[]]]]
local_variable[type[String], URIArray]
if[binary_operation[binary_operation[member[URIArray.length], ==, literal[6]], ||, binary_operation[member[URIArray.length], ==, literal[7]]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=PID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=URIArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=5))])], member=getPID, postfix_operators=[], prefix_operators=[], qualifier=Server, selectors=[MethodInvocation(arguments=[], member=toString, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Bad pid syntax in request"), MemberReference(member=th, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ACTION_LABEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=EMPTY_STRING_ARRAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BadRequest400Exception, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=th, types=['Throwable']))], finally_block=None, label=None, resources=None)
if[binary_operation[member[URIArray.length], ==, literal[7]]] begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=versDateTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=URIArray, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=6))])], member=parseDateStrict, postfix_operators=[], prefix_operators=[], qualifier=DateUtility, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Bad date format in request")], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ACTION_LABEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=EMPTY_STRING_ARRAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BadRequest400Exception, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ParseException']))], finally_block=None, label=None, resources=None)
assign[member[.asOfDateTime], member[.versDateTime]]
else begin[{]
None
end[}]
call[logger.debug, parameter[literal["Listing methods (PID={}, asOfDate={})"], member[.PID], member[.versDateTime]]]
else begin[{]
call[logger.error, parameter[literal["Bad syntax (expected 6 or 7 parts) in request"]]]
ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ACTION_LABEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=EMPTY_STRING_ARRAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=BadRequest400Exception, sub_type=None)), label=None)
end[}]
if[binary_operation[call[request.getParameter, parameter[literal["xml"]]], !=, literal[null]]] begin[{]
assign[member[.xml], call[Boolean.parseBoolean, parameter[call[request.getParameter, parameter[literal["xml"]]]]]]
else begin[{]
None
end[}]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=uri, postfix_operators=[], prefix_operators=[], qualifier=HTTP_REQUEST.REST, selectors=[]), MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getContext, postfix_operators=[], prefix_operators=[], qualifier=ReadOnlyContext, selectors=[], type_arguments=None), name=context)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Context, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=context, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=PID, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=asOfDateTime, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=xml, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=response, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=listMethods, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Finished listing methods")], member=debug, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Object not found for request: "), operandr=MemberReference(member=requestURI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" (actionLabel="), operator=+), operandr=MemberReference(member=ACTION_LABEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")"), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ACTION_LABEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=EMPTY_STRING_ARRAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NotFound404Exception, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ObjectNotFoundException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error Listing Methods: "), operandr=MemberReference(member=requestURI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" (actionLabel="), operator=+), operandr=MemberReference(member=ACTION_LABEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")"), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error Listing Methods"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ACTION_LABEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=EMPTY_STRING_ARRAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NotFound404Exception, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['DisseminationException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Object not found for request: "), operandr=MemberReference(member=requestURI, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" (actionLabel="), operator=+), operandr=MemberReference(member=ACTION_LABEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=")"), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ACTION_LABEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=EMPTY_STRING_ARRAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NotFound404Exception, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ObjectNotInLowlevelStorageException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Authorization error listing methods"), MemberReference(member=ae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=ae, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ACTION_LABEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=EMPTY_STRING_ARRAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getServletException, postfix_operators=[], prefix_operators=[], qualifier=RootException, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ae, types=['AuthzException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error listing methods"), MemberReference(member=th, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Error listing methods"), MemberReference(member=th, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=request, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ACTION_LABEL, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=EMPTY_STRING_ARRAY, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=InternalError500Exception, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=th, types=['Throwable']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[doGet] operator[SEP] identifier[HttpServletRequest] identifier[request] , identifier[HttpServletResponse] identifier[response] operator[SEP] Keyword[throws] identifier[ServletException] , identifier[IOException] {
identifier[String] identifier[PID] operator[=] Other[null] operator[SEP] identifier[Date] identifier[asOfDateTime] operator[=] Other[null] operator[SEP] identifier[Date] identifier[versDateTime] operator[=] Other[null] operator[SEP] Keyword[boolean] identifier[xml] operator[=] literal[boolean] operator[SEP] identifier[requestURI] operator[=] identifier[request] operator[SEP] identifier[getRequestURL] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[request] operator[SEP] identifier[getQueryString] operator[SEP] operator[SEP] operator[SEP] identifier[String] operator[SEP] operator[SEP] identifier[URIArray] operator[=] identifier[request] operator[SEP] identifier[getRequestURL] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[URIArray] operator[SEP] identifier[length] operator[==] Other[6] operator[||] identifier[URIArray] operator[SEP] identifier[length] operator[==] Other[7] operator[SEP] {
Keyword[try] {
identifier[PID] operator[=] identifier[Server] operator[SEP] identifier[getPID] operator[SEP] identifier[URIArray] operator[SEP] Other[5] operator[SEP] operator[SEP] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[th] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[th] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[BadRequest400Exception] operator[SEP] identifier[request] , identifier[ACTION_LABEL] , literal[String] , identifier[EMPTY_STRING_ARRAY] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[URIArray] operator[SEP] identifier[length] operator[==] Other[7] operator[SEP] {
Keyword[try] {
identifier[versDateTime] operator[=] identifier[DateUtility] operator[SEP] identifier[parseDateStrict] operator[SEP] identifier[URIArray] operator[SEP] Other[6] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ParseException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[BadRequest400Exception] operator[SEP] identifier[request] , identifier[ACTION_LABEL] , literal[String] , identifier[EMPTY_STRING_ARRAY] operator[SEP] operator[SEP]
}
identifier[asOfDateTime] operator[=] identifier[versDateTime] operator[SEP]
}
identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] , identifier[PID] , identifier[versDateTime] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[BadRequest400Exception] operator[SEP] identifier[request] , identifier[ACTION_LABEL] , literal[String] , identifier[EMPTY_STRING_ARRAY] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] literal[String] operator[SEP] operator[!=] Other[null] operator[SEP] {
identifier[xml] operator[=] identifier[Boolean] operator[SEP] identifier[parseBoolean] operator[SEP] identifier[request] operator[SEP] identifier[getParameter] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[Context] identifier[context] operator[=] identifier[ReadOnlyContext] operator[SEP] identifier[getContext] operator[SEP] identifier[HTTP_REQUEST] operator[SEP] identifier[REST] operator[SEP] identifier[uri] , identifier[request] operator[SEP] operator[SEP] identifier[listMethods] operator[SEP] identifier[context] , identifier[PID] , identifier[asOfDateTime] , identifier[xml] , identifier[request] , identifier[response] operator[SEP] operator[SEP] identifier[logger] operator[SEP] identifier[debug] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ObjectNotFoundException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[requestURI] operator[+] literal[String] operator[+] identifier[ACTION_LABEL] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[NotFound404Exception] operator[SEP] identifier[request] , identifier[ACTION_LABEL] , literal[String] , identifier[EMPTY_STRING_ARRAY] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[DisseminationException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[requestURI] operator[+] literal[String] operator[+] identifier[ACTION_LABEL] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[NotFound404Exception] operator[SEP] literal[String] , identifier[e] , identifier[request] , identifier[ACTION_LABEL] , literal[String] , identifier[EMPTY_STRING_ARRAY] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ObjectNotInLowlevelStorageException] identifier[e] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] operator[+] identifier[requestURI] operator[+] literal[String] operator[+] identifier[ACTION_LABEL] operator[+] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[NotFound404Exception] operator[SEP] identifier[request] , identifier[ACTION_LABEL] , literal[String] , identifier[EMPTY_STRING_ARRAY] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[AuthzException] identifier[ae] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[ae] operator[SEP] operator[SEP] Keyword[throw] identifier[RootException] operator[SEP] identifier[getServletException] operator[SEP] identifier[ae] , identifier[request] , identifier[ACTION_LABEL] , identifier[EMPTY_STRING_ARRAY] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[th] operator[SEP] {
identifier[logger] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[th] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[InternalError500Exception] operator[SEP] literal[String] , identifier[th] , identifier[request] , identifier[ACTION_LABEL] , literal[String] , identifier[EMPTY_STRING_ARRAY] operator[SEP] operator[SEP]
}
}
|
private static boolean verifyChecksum(final String hrp, final byte[] values) {
byte[] hrpExpanded = expandHrp(hrp);
byte[] combined = new byte[hrpExpanded.length + values.length];
System.arraycopy(hrpExpanded, 0, combined, 0, hrpExpanded.length);
System.arraycopy(values, 0, combined, hrpExpanded.length, values.length);
return polymod(combined) == 1;
} | class class_name[name] begin[{]
method[verifyChecksum, return_type[type[boolean]], modifier[private static], parameter[hrp, values]] begin[{]
local_variable[type[byte], hrpExpanded]
local_variable[type[byte], combined]
call[System.arraycopy, parameter[member[.hrpExpanded], literal[0], member[.combined], literal[0], member[hrpExpanded.length]]]
call[System.arraycopy, parameter[member[.values], literal[0], member[.combined], member[hrpExpanded.length], member[values.length]]]
return[binary_operation[call[.polymod, parameter[member[.combined]]], ==, literal[1]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[boolean] identifier[verifyChecksum] operator[SEP] Keyword[final] identifier[String] identifier[hrp] , Keyword[final] Keyword[byte] operator[SEP] operator[SEP] identifier[values] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[hrpExpanded] operator[=] identifier[expandHrp] operator[SEP] identifier[hrp] operator[SEP] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[combined] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[hrpExpanded] operator[SEP] identifier[length] operator[+] identifier[values] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[hrpExpanded] , Other[0] , identifier[combined] , Other[0] , identifier[hrpExpanded] operator[SEP] identifier[length] operator[SEP] operator[SEP] identifier[System] operator[SEP] identifier[arraycopy] operator[SEP] identifier[values] , Other[0] , identifier[combined] , identifier[hrpExpanded] operator[SEP] identifier[length] , identifier[values] operator[SEP] identifier[length] operator[SEP] operator[SEP] Keyword[return] identifier[polymod] operator[SEP] identifier[combined] operator[SEP] operator[==] Other[1] operator[SEP]
}
|
public Iterator<String> getUrlNameSequence(String baseName) {
String translatedTitle = OpenCms.getResourceManager().getFileTranslator().translateResource(baseName).replace(
"/",
"-");
return new CmsNumberSuffixNameSequence(translatedTitle);
} | class class_name[name] begin[{]
method[getUrlNameSequence, return_type[type[Iterator]], modifier[public], parameter[baseName]] begin[{]
local_variable[type[String], translatedTitle]
return[ClassCreator(arguments=[MemberReference(member=translatedTitle, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CmsNumberSuffixNameSequence, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[Iterator] operator[<] identifier[String] operator[>] identifier[getUrlNameSequence] operator[SEP] identifier[String] identifier[baseName] operator[SEP] {
identifier[String] identifier[translatedTitle] operator[=] identifier[OpenCms] operator[SEP] identifier[getResourceManager] operator[SEP] operator[SEP] operator[SEP] identifier[getFileTranslator] operator[SEP] operator[SEP] operator[SEP] identifier[translateResource] operator[SEP] identifier[baseName] operator[SEP] operator[SEP] identifier[replace] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[CmsNumberSuffixNameSequence] operator[SEP] identifier[translatedTitle] operator[SEP] operator[SEP]
}
|
public void setTagId(String tagId)
throws JspException
{
// JSP 2.0 EL will convert a null into a empty string "".
// If we get a "" we will display an error.
AbstractHtmlState tsh = getState();
tsh.id = setRequiredValueAttribute(tagId, "tagId");
} | class class_name[name] begin[{]
method[setTagId, return_type[void], modifier[public], parameter[tagId]] begin[{]
local_variable[type[AbstractHtmlState], tsh]
assign[member[tsh.id], call[.setRequiredValueAttribute, parameter[member[.tagId], literal["tagId"]]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[setTagId] operator[SEP] identifier[String] identifier[tagId] operator[SEP] Keyword[throws] identifier[JspException] {
identifier[AbstractHtmlState] identifier[tsh] operator[=] identifier[getState] operator[SEP] operator[SEP] operator[SEP] identifier[tsh] operator[SEP] identifier[id] operator[=] identifier[setRequiredValueAttribute] operator[SEP] identifier[tagId] , literal[String] operator[SEP] operator[SEP]
}
|
public void close() throws IOException
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
{ // 306998.15
Tr.debug(tc, "close");
}
// Were we requested to close the underlying stream ?
finish();
try
{
// 104771 - alert the observer that the underlying stream is being closed
obs.alertClose();
// don't close the underlying stream...we want to reuse it
// out.close();
}
catch (Exception ex)
{
com.ibm.wsspi.webcontainer.util.FFDCWrapper.processException(ex, "com.ibm.ws.webcontainer.srt.BufferedWriter.close", "397", this);
}
} | class class_name[name] begin[{]
method[close, return_type[void], modifier[public], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isDebugEnabled, parameter[]]]] begin[{]
call[Tr.debug, parameter[member[.tc], literal["close"]]]
else begin[{]
None
end[}]
call[.finish, parameter[]]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=alertClose, postfix_operators=[], prefix_operators=[], qualifier=obs, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="com.ibm.ws.webcontainer.srt.BufferedWriter.close"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="397"), This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[])], member=processException, postfix_operators=[], prefix_operators=[], qualifier=com.ibm.wsspi.webcontainer.util.FFDCWrapper, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[close] operator[SEP] operator[SEP] Keyword[throws] identifier[IOException] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isDebugEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[Tr] operator[SEP] identifier[debug] operator[SEP] identifier[tc] , literal[String] operator[SEP] operator[SEP]
}
identifier[finish] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
identifier[obs] operator[SEP] identifier[alertClose] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[wsspi] operator[SEP] identifier[webcontainer] operator[SEP] identifier[util] operator[SEP] identifier[FFDCWrapper] operator[SEP] identifier[processException] operator[SEP] identifier[ex] , literal[String] , literal[String] , Keyword[this] operator[SEP] operator[SEP]
}
}
|
public static Boolean readBoolean(String value, Boolean defaultValue) {
if (!StringUtils.hasText(value)) return defaultValue;
return Boolean.valueOf(value);
} | class class_name[name] begin[{]
method[readBoolean, return_type[type[Boolean]], modifier[public static], parameter[value, defaultValue]] begin[{]
if[call[StringUtils.hasText, parameter[member[.value]]]] begin[{]
return[member[.defaultValue]]
else begin[{]
None
end[}]
return[call[Boolean.valueOf, parameter[member[.value]]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[Boolean] identifier[readBoolean] operator[SEP] identifier[String] identifier[value] , identifier[Boolean] identifier[defaultValue] operator[SEP] {
Keyword[if] operator[SEP] operator[!] identifier[StringUtils] operator[SEP] identifier[hasText] operator[SEP] identifier[value] operator[SEP] operator[SEP] Keyword[return] identifier[defaultValue] operator[SEP] Keyword[return] identifier[Boolean] operator[SEP] identifier[valueOf] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
|
@Override
public LazyData createGenotypeMap(String str, List<Allele> alleles, String chr, int pos) {
if (genotypeParts == null) {
genotypeParts = new String[header.getColumnCount() - NUM_STANDARD_FIELDS];
}
int nParts = ParsingUtils.split(str, genotypeParts, VCFConstants.FIELD_SEPARATOR_CHAR);
if (nParts != genotypeParts.length) {
generateException("there are " + (nParts - 1)
+ " genotypes while the header requires that " + (genotypeParts.length - 1)
+ " genotypes be present for all records at " + chr + ":" + pos, lineNo);
}
ArrayList<Genotype> genotypes = new ArrayList<>(nParts);
// get the format keys
List<String> genotypeKeys = ParsingUtils.split(genotypeParts[0], VCFConstants.GENOTYPE_FIELD_SEPARATOR_CHAR);
// cycle through the sample names
Iterator<String> sampleNameIterator = header.getGenotypeSamples().iterator();
// clear out our allele mapping
alleleMap.clear();
// cycle through the genotype strings
for (int genotypeOffset = 1; genotypeOffset < nParts; genotypeOffset++) {
List<String> genotypeValues = ParsingUtils.split(genotypeParts[genotypeOffset], VCFConstants.GENOTYPE_FIELD_SEPARATOR_CHAR);
final String sampleName = sampleNameIterator.next();
final GenotypeBuilder gb = new GenotypeBuilder(sampleName);
// check to see if the value list is longer than the key list, which is a problem
if (genotypeKeys.size() < genotypeValues.size()) {
generateException("There are too many keys for the sample " + sampleName + ", "
+ "keys = " + parts[8] + ", "
+ "values = " + parts[genotypeOffset]);
}
int genotypeAlleleLocation = -1;
if (!genotypeKeys.isEmpty()) {
gb.maxAttributes(genotypeKeys.size() - 1);
for (int i = 0; i < genotypeKeys.size(); i++) {
final String gtKey = genotypeKeys.get(i);
boolean missing = i >= genotypeValues.size();
// todo -- all of these on the fly parsing of the missing value should be static constants
if (gtKey.equals(VCFConstants.GENOTYPE_KEY)) {
genotypeAlleleLocation = i;
// opencb modification: add ALL the fields to the attributes. null for missing values!
gb.attribute(gtKey, genotypeValues.get(i));
} else if (missing) {
// if its truly missing (there no provided value) skip adding it to the attributes
// opencb modification: add ALL the fields to the attributes. null for missing values!
gb.attribute(gtKey, null);
} else if (gtKey.equals(VCFConstants.GENOTYPE_FILTER_KEY)) {
final List<String> filters = parseFilters(getCachedString(genotypeValues.get(i)));
if (filters != null) {
gb.filters(filters);
}
// opencb modification: add ALL the fields to the attributes. null for missing values!
gb.attribute(gtKey, filters);
} else if (genotypeValues.get(i).equals(VCFConstants.MISSING_VALUE_v4)) {
// don't add missing values to the map
// opencb modification: add ALL the fields to the attributes. null for missing values!
gb.attribute(gtKey, null);
} else {
if (gtKey.equals(VCFConstants.GENOTYPE_QUALITY_KEY)) {
if (genotypeValues.get(i).equals(VCFConstants.MISSING_GENOTYPE_QUALITY_v3)) {
gb.noGQ();
} else {
gb.GQ((int)Math.round(Double.valueOf(genotypeValues.get(i))));
}
} else if (gtKey.equals(VCFConstants.GENOTYPE_ALLELE_DEPTHS)) {
gb.AD(decodeInts(genotypeValues.get(i)));
} else if (gtKey.equals(VCFConstants.GENOTYPE_PL_KEY)) {
gb.PL(decodeInts(genotypeValues.get(i)));
} else if (gtKey.equals(VCFConstants.GENOTYPE_LIKELIHOODS_KEY)) {
gb.PL(GenotypeLikelihoods.fromGLField(genotypeValues.get(i)).getAsPLs());
} else if (gtKey.equals(VCFConstants.DEPTH_KEY)) {
gb.DP(Integer.valueOf(genotypeValues.get(i)));
}
// opencb modification: add ALL the fields to the attributes. null for missing values!
gb.attribute(gtKey, genotypeValues.get(i));
}
}
}
// check to make sure we found a genotype field if our version is less than 4.1 file
if (!version.isAtLeastAsRecentAs(VCFHeaderVersion.VCF4_1) && genotypeAlleleLocation == -1) {
generateException("Unable to find the GT field for the record; the GT field is required before VCF4.1");
}
if (genotypeAlleleLocation > 0) {
generateException("Saw GT field at position "
+ genotypeAlleleLocation + ", but it must be at the first position for genotypes when present");
}
final List<Allele> gTalleles = (genotypeAlleleLocation == -1
? new ArrayList<>(0)
: parseGenotypeAlleles(genotypeValues.get(genotypeAlleleLocation), alleles, alleleMap));
gb.alleles(gTalleles);
gb.phased(genotypeAlleleLocation != -1
&& genotypeValues.get(genotypeAlleleLocation).indexOf(VCFConstants.PHASED) != -1);
// add it to the list
try {
genotypes.add(gb.make());
} catch (TribbleException e) {
throw new TribbleException.InternalCodecException(e.getMessage() + ", at position " + chr + ":" + pos);
}
}
return new LazyGenotypesContext.LazyData(genotypes, header.getSampleNamesInOrder(), header.getSampleNameToOffset());
} | class class_name[name] begin[{]
method[createGenotypeMap, return_type[type[LazyData]], modifier[public], parameter[str, alleles, chr, pos]] begin[{]
if[binary_operation[member[.genotypeParts], ==, literal[null]]] begin[{]
assign[member[.genotypeParts], ArrayCreator(dimensions=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=getColumnCount, postfix_operators=[], prefix_operators=[], qualifier=header, selectors=[], type_arguments=None), operandr=MemberReference(member=NUM_STANDARD_FIELDS, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=-)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=String, sub_type=None))]
else begin[{]
None
end[}]
local_variable[type[int], nParts]
if[binary_operation[member[.nParts], !=, member[genotypeParts.length]]] begin[{]
call[.generateException, parameter[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[binary_operation[literal["there are "], +, binary_operation[member[.nParts], -, literal[1]]], +, literal[" genotypes while the header requires that "]], +, binary_operation[member[genotypeParts.length], -, literal[1]]], +, literal[" genotypes be present for all records at "]], +, member[.chr]], +, literal[":"]], +, member[.pos]], member[.lineNo]]]
else begin[{]
None
end[}]
local_variable[type[ArrayList], genotypes]
local_variable[type[List], genotypeKeys]
local_variable[type[Iterator], sampleNameIterator]
call[alleleMap.clear, parameter[]]
ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=genotypeParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=genotypeOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), MemberReference(member=GENOTYPE_FIELD_SEPARATOR_CHAR, postfix_operators=[], prefix_operators=[], qualifier=VCFConstants, selectors=[])], member=split, postfix_operators=[], prefix_operators=[], qualifier=ParsingUtils, selectors=[], type_arguments=None), name=genotypeValues)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=sampleNameIterator, selectors=[], type_arguments=None), name=sampleName)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MemberReference(member=sampleName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=GenotypeBuilder, sub_type=None)), name=gb)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=GenotypeBuilder, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=genotypeKeys, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[], type_arguments=None), operator=<), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="There are too many keys for the sample "), operandr=MemberReference(member=sampleName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="keys = "), operator=+), operandr=MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8))]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", "), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="values = "), operator=+), operandr=MemberReference(member=parts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[ArraySelector(index=MemberReference(member=genotypeOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]))]), operator=+)], member=generateException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), name=genotypeAlleleLocation)], modifiers=set(), type=BasicType(dimensions=[], name=int)), IfStatement(condition=MethodInvocation(arguments=[], member=isEmpty, postfix_operators=[], prefix_operators=['!'], qualifier=genotypeKeys, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=genotypeKeys, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=maxAttributes, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=genotypeKeys, selectors=[], type_arguments=None), name=gtKey)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[], type_arguments=None), operator=>=), name=missing)], modifiers=set(), type=BasicType(dimensions=[], name=boolean)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=GENOTYPE_KEY, postfix_operators=[], prefix_operators=[], qualifier=VCFConstants, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=gtKey, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MemberReference(member=missing, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=GENOTYPE_FILTER_KEY, postfix_operators=[], prefix_operators=[], qualifier=VCFConstants, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=gtKey, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[MethodInvocation(arguments=[MemberReference(member=MISSING_VALUE_v4, postfix_operators=[], prefix_operators=[], qualifier=VCFConstants, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=GENOTYPE_QUALITY_KEY, postfix_operators=[], prefix_operators=[], qualifier=VCFConstants, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=gtKey, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=GENOTYPE_ALLELE_DEPTHS, postfix_operators=[], prefix_operators=[], qualifier=VCFConstants, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=gtKey, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=GENOTYPE_PL_KEY, postfix_operators=[], prefix_operators=[], qualifier=VCFConstants, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=gtKey, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=GENOTYPE_LIKELIHOODS_KEY, postfix_operators=[], prefix_operators=[], qualifier=VCFConstants, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=gtKey, selectors=[], type_arguments=None), else_statement=IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=DEPTH_KEY, postfix_operators=[], prefix_operators=[], qualifier=VCFConstants, selectors=[])], member=equals, postfix_operators=[], prefix_operators=[], qualifier=gtKey, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None)], member=DP, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[], type_arguments=None)], member=fromGLField, postfix_operators=[], prefix_operators=[], qualifier=GenotypeLikelihoods, selectors=[MethodInvocation(arguments=[], member=getAsPLs, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=PL, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[], type_arguments=None)], member=decodeInts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=PL, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[], type_arguments=None)], member=decodeInts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=AD, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[MethodInvocation(arguments=[MemberReference(member=MISSING_GENOTYPE_QUALITY_v3, postfix_operators=[], prefix_operators=[], qualifier=VCFConstants, selectors=[])], member=equals, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Cast(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[], type_arguments=None)], member=valueOf, postfix_operators=[], prefix_operators=[], qualifier=Double, selectors=[], type_arguments=None)], member=round, postfix_operators=[], prefix_operators=[], qualifier=Math, selectors=[], type_arguments=None), type=BasicType(dimensions=[], name=int))], member=GQ, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=noGQ, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None)]))])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=gtKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[], type_arguments=None)], member=attribute, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=gtKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=attribute, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[], type_arguments=None)], member=getCachedString, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=parseFilters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), name=filters)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=List, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=filters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=filters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=filters, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=gtKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=filters, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=attribute, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=gtKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=attribute, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None)])), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=genotypeAlleleLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=gtKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[], type_arguments=None)], member=attribute, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=genotypeKeys, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)])), IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=VCF4_1, postfix_operators=[], prefix_operators=[], qualifier=VCFHeaderVersion, selectors=[])], member=isAtLeastAsRecentAs, postfix_operators=[], prefix_operators=['!'], qualifier=version, selectors=[], type_arguments=None), operandr=BinaryOperation(operandl=MemberReference(member=genotypeAlleleLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to find the GT field for the record; the GT field is required before VCF4.1")], member=generateException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=genotypeAlleleLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Saw GT field at position "), operandr=MemberReference(member=genotypeAlleleLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", but it must be at the first position for genotypes when present"), operator=+)], member=generateException, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=genotypeAlleleLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator===), if_false=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=genotypeAlleleLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[], type_arguments=None), MemberReference(member=alleles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=alleleMap, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=parseGenotypeAlleles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), if_true=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ArrayList, sub_type=None))), name=gTalleles)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Allele, sub_type=None))], dimensions=[], name=List, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=gTalleles, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=alleles, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=genotypeAlleleLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[MemberReference(member=genotypeAlleleLocation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=genotypeValues, selectors=[MethodInvocation(arguments=[MemberReference(member=PHASED, postfix_operators=[], prefix_operators=[], qualifier=VCFConstants, selectors=[])], member=indexOf, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=['-'], qualifier=None, selectors=[], value=1), operator=!=), operator=&&)], member=phased, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None), label=None), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=make, postfix_operators=[], prefix_operators=[], qualifier=gb, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=genotypes, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=", at position "), operator=+), operandr=MemberReference(member=chr, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=":"), operator=+), operandr=MemberReference(member=pos, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=TribbleException, sub_type=ReferenceType(arguments=None, dimensions=None, name=InternalCodecException, sub_type=None))), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['TribbleException']))], finally_block=None, label=None, resources=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=genotypeOffset, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=nParts, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), name=genotypeOffset)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=genotypeOffset, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
return[ClassCreator(arguments=[MemberReference(member=genotypes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getSampleNamesInOrder, postfix_operators=[], prefix_operators=[], qualifier=header, selectors=[], type_arguments=None), MethodInvocation(arguments=[], member=getSampleNameToOffset, postfix_operators=[], prefix_operators=[], qualifier=header, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=LazyGenotypesContext, sub_type=ReferenceType(arguments=None, dimensions=None, name=LazyData, sub_type=None)))]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[LazyData] identifier[createGenotypeMap] operator[SEP] identifier[String] identifier[str] , identifier[List] operator[<] identifier[Allele] operator[>] identifier[alleles] , identifier[String] identifier[chr] , Keyword[int] identifier[pos] operator[SEP] {
Keyword[if] operator[SEP] identifier[genotypeParts] operator[==] Other[null] operator[SEP] {
identifier[genotypeParts] operator[=] Keyword[new] identifier[String] operator[SEP] identifier[header] operator[SEP] identifier[getColumnCount] operator[SEP] operator[SEP] operator[-] identifier[NUM_STANDARD_FIELDS] operator[SEP] operator[SEP]
}
Keyword[int] identifier[nParts] operator[=] identifier[ParsingUtils] operator[SEP] identifier[split] operator[SEP] identifier[str] , identifier[genotypeParts] , identifier[VCFConstants] operator[SEP] identifier[FIELD_SEPARATOR_CHAR] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[nParts] operator[!=] identifier[genotypeParts] operator[SEP] identifier[length] operator[SEP] {
identifier[generateException] operator[SEP] literal[String] operator[+] operator[SEP] identifier[nParts] operator[-] Other[1] operator[SEP] operator[+] literal[String] operator[+] operator[SEP] identifier[genotypeParts] operator[SEP] identifier[length] operator[-] Other[1] operator[SEP] operator[+] literal[String] operator[+] identifier[chr] operator[+] literal[String] operator[+] identifier[pos] , identifier[lineNo] operator[SEP] operator[SEP]
}
identifier[ArrayList] operator[<] identifier[Genotype] operator[>] identifier[genotypes] operator[=] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] identifier[nParts] operator[SEP] operator[SEP] identifier[List] operator[<] identifier[String] operator[>] identifier[genotypeKeys] operator[=] identifier[ParsingUtils] operator[SEP] identifier[split] operator[SEP] identifier[genotypeParts] operator[SEP] Other[0] operator[SEP] , identifier[VCFConstants] operator[SEP] identifier[GENOTYPE_FIELD_SEPARATOR_CHAR] operator[SEP] operator[SEP] identifier[Iterator] operator[<] identifier[String] operator[>] identifier[sampleNameIterator] operator[=] identifier[header] operator[SEP] identifier[getGenotypeSamples] operator[SEP] operator[SEP] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[alleleMap] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[genotypeOffset] operator[=] Other[1] operator[SEP] identifier[genotypeOffset] operator[<] identifier[nParts] operator[SEP] identifier[genotypeOffset] operator[++] operator[SEP] {
identifier[List] operator[<] identifier[String] operator[>] identifier[genotypeValues] operator[=] identifier[ParsingUtils] operator[SEP] identifier[split] operator[SEP] identifier[genotypeParts] operator[SEP] identifier[genotypeOffset] operator[SEP] , identifier[VCFConstants] operator[SEP] identifier[GENOTYPE_FIELD_SEPARATOR_CHAR] operator[SEP] operator[SEP] Keyword[final] identifier[String] identifier[sampleName] operator[=] identifier[sampleNameIterator] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[GenotypeBuilder] identifier[gb] operator[=] Keyword[new] identifier[GenotypeBuilder] operator[SEP] identifier[sampleName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[genotypeKeys] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[<] identifier[genotypeValues] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] {
identifier[generateException] operator[SEP] literal[String] operator[+] identifier[sampleName] operator[+] literal[String] operator[+] literal[String] operator[+] identifier[parts] operator[SEP] Other[8] operator[SEP] operator[+] literal[String] operator[+] literal[String] operator[+] identifier[parts] operator[SEP] identifier[genotypeOffset] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[int] identifier[genotypeAlleleLocation] operator[=] operator[-] Other[1] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[genotypeKeys] operator[SEP] identifier[isEmpty] operator[SEP] operator[SEP] operator[SEP] {
identifier[gb] operator[SEP] identifier[maxAttributes] operator[SEP] identifier[genotypeKeys] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[genotypeKeys] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
Keyword[final] identifier[String] identifier[gtKey] operator[=] identifier[genotypeKeys] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] Keyword[boolean] identifier[missing] operator[=] identifier[i] operator[>=] identifier[genotypeValues] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[gtKey] operator[SEP] identifier[equals] operator[SEP] identifier[VCFConstants] operator[SEP] identifier[GENOTYPE_KEY] operator[SEP] operator[SEP] {
identifier[genotypeAlleleLocation] operator[=] identifier[i] operator[SEP] identifier[gb] operator[SEP] identifier[attribute] operator[SEP] identifier[gtKey] , identifier[genotypeValues] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[missing] operator[SEP] {
identifier[gb] operator[SEP] identifier[attribute] operator[SEP] identifier[gtKey] , Other[null] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[gtKey] operator[SEP] identifier[equals] operator[SEP] identifier[VCFConstants] operator[SEP] identifier[GENOTYPE_FILTER_KEY] operator[SEP] operator[SEP] {
Keyword[final] identifier[List] operator[<] identifier[String] operator[>] identifier[filters] operator[=] identifier[parseFilters] operator[SEP] identifier[getCachedString] operator[SEP] identifier[genotypeValues] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[filters] operator[!=] Other[null] operator[SEP] {
identifier[gb] operator[SEP] identifier[filters] operator[SEP] identifier[filters] operator[SEP] operator[SEP]
}
identifier[gb] operator[SEP] identifier[attribute] operator[SEP] identifier[gtKey] , identifier[filters] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[genotypeValues] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[VCFConstants] operator[SEP] identifier[MISSING_VALUE_v4] operator[SEP] operator[SEP] {
identifier[gb] operator[SEP] identifier[attribute] operator[SEP] identifier[gtKey] , Other[null] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[if] operator[SEP] identifier[gtKey] operator[SEP] identifier[equals] operator[SEP] identifier[VCFConstants] operator[SEP] identifier[GENOTYPE_QUALITY_KEY] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[genotypeValues] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[equals] operator[SEP] identifier[VCFConstants] operator[SEP] identifier[MISSING_GENOTYPE_QUALITY_v3] operator[SEP] operator[SEP] {
identifier[gb] operator[SEP] identifier[noGQ] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[gb] operator[SEP] identifier[GQ] operator[SEP] operator[SEP] Keyword[int] operator[SEP] identifier[Math] operator[SEP] identifier[round] operator[SEP] identifier[Double] operator[SEP] identifier[valueOf] operator[SEP] identifier[genotypeValues] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[else] Keyword[if] operator[SEP] identifier[gtKey] operator[SEP] identifier[equals] operator[SEP] identifier[VCFConstants] operator[SEP] identifier[GENOTYPE_ALLELE_DEPTHS] operator[SEP] operator[SEP] {
identifier[gb] operator[SEP] identifier[AD] operator[SEP] identifier[decodeInts] operator[SEP] identifier[genotypeValues] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[gtKey] operator[SEP] identifier[equals] operator[SEP] identifier[VCFConstants] operator[SEP] identifier[GENOTYPE_PL_KEY] operator[SEP] operator[SEP] {
identifier[gb] operator[SEP] identifier[PL] operator[SEP] identifier[decodeInts] operator[SEP] identifier[genotypeValues] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[gtKey] operator[SEP] identifier[equals] operator[SEP] identifier[VCFConstants] operator[SEP] identifier[GENOTYPE_LIKELIHOODS_KEY] operator[SEP] operator[SEP] {
identifier[gb] operator[SEP] identifier[PL] operator[SEP] identifier[GenotypeLikelihoods] operator[SEP] identifier[fromGLField] operator[SEP] identifier[genotypeValues] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[getAsPLs] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] Keyword[if] operator[SEP] identifier[gtKey] operator[SEP] identifier[equals] operator[SEP] identifier[VCFConstants] operator[SEP] identifier[DEPTH_KEY] operator[SEP] operator[SEP] {
identifier[gb] operator[SEP] identifier[DP] operator[SEP] identifier[Integer] operator[SEP] identifier[valueOf] operator[SEP] identifier[genotypeValues] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[gb] operator[SEP] identifier[attribute] operator[SEP] identifier[gtKey] , identifier[genotypeValues] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP]
}
}
}
Keyword[if] operator[SEP] operator[!] identifier[version] operator[SEP] identifier[isAtLeastAsRecentAs] operator[SEP] identifier[VCFHeaderVersion] operator[SEP] identifier[VCF4_1] operator[SEP] operator[&&] identifier[genotypeAlleleLocation] operator[==] operator[-] Other[1] operator[SEP] {
identifier[generateException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[genotypeAlleleLocation] operator[>] Other[0] operator[SEP] {
identifier[generateException] operator[SEP] literal[String] operator[+] identifier[genotypeAlleleLocation] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[final] identifier[List] operator[<] identifier[Allele] operator[>] identifier[gTalleles] operator[=] operator[SEP] identifier[genotypeAlleleLocation] operator[==] operator[-] Other[1] operator[?] Keyword[new] identifier[ArrayList] operator[<] operator[>] operator[SEP] Other[0] operator[SEP] operator[:] identifier[parseGenotypeAlleles] operator[SEP] identifier[genotypeValues] operator[SEP] identifier[get] operator[SEP] identifier[genotypeAlleleLocation] operator[SEP] , identifier[alleles] , identifier[alleleMap] operator[SEP] operator[SEP] operator[SEP] identifier[gb] operator[SEP] identifier[alleles] operator[SEP] identifier[gTalleles] operator[SEP] operator[SEP] identifier[gb] operator[SEP] identifier[phased] operator[SEP] identifier[genotypeAlleleLocation] operator[!=] operator[-] Other[1] operator[&&] identifier[genotypeValues] operator[SEP] identifier[get] operator[SEP] identifier[genotypeAlleleLocation] operator[SEP] operator[SEP] identifier[indexOf] operator[SEP] identifier[VCFConstants] operator[SEP] identifier[PHASED] operator[SEP] operator[!=] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[try] {
identifier[genotypes] operator[SEP] identifier[add] operator[SEP] identifier[gb] operator[SEP] identifier[make] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[TribbleException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[TribbleException] operator[SEP] identifier[InternalCodecException] operator[SEP] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[+] literal[String] operator[+] identifier[chr] operator[+] literal[String] operator[+] identifier[pos] operator[SEP] operator[SEP]
}
}
Keyword[return] Keyword[new] identifier[LazyGenotypesContext] operator[SEP] identifier[LazyData] operator[SEP] identifier[genotypes] , identifier[header] operator[SEP] identifier[getSampleNamesInOrder] operator[SEP] operator[SEP] , identifier[header] operator[SEP] identifier[getSampleNameToOffset] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public ApiResponse<AggregatesResponse> getMessageAggregatesWithHttpInfo(String sdid, String field, Long startDate, Long endDate) throws ApiException {
com.squareup.okhttp.Call call = getMessageAggregatesValidateBeforeCall(sdid, field, startDate, endDate, null, null);
Type localVarReturnType = new TypeToken<AggregatesResponse>(){}.getType();
return apiClient.execute(call, localVarReturnType);
} | class class_name[name] begin[{]
method[getMessageAggregatesWithHttpInfo, return_type[type[ApiResponse]], modifier[public], parameter[sdid, field, startDate, endDate]] begin[{]
local_variable[type[com], call]
local_variable[type[Type], localVarReturnType]
return[call[apiClient.execute, parameter[member[.call], member[.localVarReturnType]]]]
end[}]
END[}] | Keyword[public] identifier[ApiResponse] operator[<] identifier[AggregatesResponse] operator[>] identifier[getMessageAggregatesWithHttpInfo] operator[SEP] identifier[String] identifier[sdid] , identifier[String] identifier[field] , identifier[Long] identifier[startDate] , identifier[Long] identifier[endDate] operator[SEP] Keyword[throws] identifier[ApiException] {
identifier[com] operator[SEP] identifier[squareup] operator[SEP] identifier[okhttp] operator[SEP] identifier[Call] identifier[call] operator[=] identifier[getMessageAggregatesValidateBeforeCall] operator[SEP] identifier[sdid] , identifier[field] , identifier[startDate] , identifier[endDate] , Other[null] , Other[null] operator[SEP] operator[SEP] identifier[Type] identifier[localVarReturnType] operator[=] Keyword[new] identifier[TypeToken] operator[<] identifier[AggregatesResponse] operator[>] operator[SEP] operator[SEP] {
} operator[SEP] identifier[getType] operator[SEP] operator[SEP] operator[SEP] Keyword[return] identifier[apiClient] operator[SEP] identifier[execute] operator[SEP] identifier[call] , identifier[localVarReturnType] operator[SEP] operator[SEP]
}
|
public JSONObject optJSONObject(int index) {
Object object = opt(index);
return object instanceof JSONObject ? (JSONObject) object : null;
} | class class_name[name] begin[{]
method[optJSONObject, return_type[type[JSONObject]], modifier[public], parameter[index]] begin[{]
local_variable[type[Object], object]
return[TernaryExpression(condition=BinaryOperation(operandl=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=ReferenceType(arguments=None, dimensions=[], name=JSONObject, sub_type=None), operator=instanceof), if_false=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), if_true=Cast(expression=MemberReference(member=object, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=JSONObject, sub_type=None)))]
end[}]
END[}] | Keyword[public] identifier[JSONObject] identifier[optJSONObject] operator[SEP] Keyword[int] identifier[index] operator[SEP] {
identifier[Object] identifier[object] operator[=] identifier[opt] operator[SEP] identifier[index] operator[SEP] operator[SEP] Keyword[return] identifier[object] Keyword[instanceof] identifier[JSONObject] operator[?] operator[SEP] identifier[JSONObject] operator[SEP] identifier[object] operator[:] Other[null] operator[SEP]
}
|
private byte[] replicas( ) {
byte[] r = _replicas;
if( r != null ) return r;
byte[] nr = new byte[H2O.CLOUD.size()+1/*1-based numbering*/+10/*limit of 10 clients*/];
if( REPLICAS_UPDATER.compareAndSet(this,null,nr) ) return nr;
r = _replicas/*read again, since CAS failed must be set now*/;
assert r!= null;
return r;
} | class class_name[name] begin[{]
method[replicas, return_type[type[byte]], modifier[private], parameter[]] begin[{]
local_variable[type[byte], r]
if[binary_operation[member[.r], !=, literal[null]]] begin[{]
return[member[.r]]
else begin[{]
None
end[}]
local_variable[type[byte], nr]
if[call[REPLICAS_UPDATER.compareAndSet, parameter[THIS[], literal[null], member[.nr]]]] begin[{]
return[member[.nr]]
else begin[{]
None
end[}]
assign[member[.r], member[._replicas]]
AssertStatement(condition=BinaryOperation(operandl=MemberReference(member=r, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), label=None, value=None)
return[member[.r]]
end[}]
END[}] | Keyword[private] Keyword[byte] operator[SEP] operator[SEP] identifier[replicas] operator[SEP] operator[SEP] {
Keyword[byte] operator[SEP] operator[SEP] identifier[r] operator[=] identifier[_replicas] operator[SEP] Keyword[if] operator[SEP] identifier[r] operator[!=] Other[null] operator[SEP] Keyword[return] identifier[r] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[nr] operator[=] Keyword[new] Keyword[byte] operator[SEP] identifier[H2O] operator[SEP] identifier[CLOUD] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[+] Other[1] operator[+] Other[10] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[REPLICAS_UPDATER] operator[SEP] identifier[compareAndSet] operator[SEP] Keyword[this] , Other[null] , identifier[nr] operator[SEP] operator[SEP] Keyword[return] identifier[nr] operator[SEP] identifier[r] operator[=] identifier[_replicas] operator[SEP] Keyword[assert] identifier[r] operator[!=] Other[null] operator[SEP] Keyword[return] identifier[r] operator[SEP]
}
|
List<Key> subrecordKeys(long lowTime, long highTime) {
List<Key> keys = new ArrayList<Key>();
long lowBucketNumber = bucketNumber(lowTime);
long highBucketNumber = bucketNumber(highTime);
for (long index = lowBucketNumber; index <= highBucketNumber; index += this.bucketSize) {
keys.add(formSubrecordKey(index));
}
return keys;
} | class class_name[name] begin[{]
method[subrecordKeys, return_type[type[List]], modifier[default], parameter[lowTime, highTime]] begin[{]
local_variable[type[List], keys]
local_variable[type[long], lowBucketNumber]
local_variable[type[long], highBucketNumber]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=formSubrecordKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=keys, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=highBucketNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<=), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MemberReference(member=lowBucketNumber, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), name=index)], modifiers=set(), type=BasicType(dimensions=[], name=long)), update=[Assignment(expressionl=MemberReference(member=index, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=bucketSize, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]))]), label=None)
return[member[.keys]]
end[}]
END[}] | identifier[List] operator[<] identifier[Key] operator[>] identifier[subrecordKeys] operator[SEP] Keyword[long] identifier[lowTime] , Keyword[long] identifier[highTime] operator[SEP] {
identifier[List] operator[<] identifier[Key] operator[>] identifier[keys] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[Key] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[long] identifier[lowBucketNumber] operator[=] identifier[bucketNumber] operator[SEP] identifier[lowTime] operator[SEP] operator[SEP] Keyword[long] identifier[highBucketNumber] operator[=] identifier[bucketNumber] operator[SEP] identifier[highTime] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[long] identifier[index] operator[=] identifier[lowBucketNumber] operator[SEP] identifier[index] operator[<=] identifier[highBucketNumber] operator[SEP] identifier[index] operator[+=] Keyword[this] operator[SEP] identifier[bucketSize] operator[SEP] {
identifier[keys] operator[SEP] identifier[add] operator[SEP] identifier[formSubrecordKey] operator[SEP] identifier[index] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[keys] operator[SEP]
}
|
@Override
public void run() {
try {
VoltTable partitionKeys = null;
partitionKeys = m_client.callProcedure("@GetPartitionKeys", "INTEGER").getResults()[0];
while (partitionKeys.advanceRow()) {
m_client.callProcedure(new NullCallback(), "DeleteOldAdRequests",
partitionKeys.getLong("PARTITION_KEY"),
m_expiredAgeInSeconds);
}
m_client.callProcedure(new NullCallback(), "DeleteExpiredBids");
}
catch (IOException | ProcCallException ex) {
ex.printStackTrace();
}
} | class class_name[name] begin[{]
method[run, return_type[void], modifier[public], parameter[]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), name=partitionKeys)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VoltTable, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=partitionKeys, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="@GetPartitionKeys"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="INTEGER")], member=callProcedure, postfix_operators=[], prefix_operators=[], qualifier=m_client, selectors=[MethodInvocation(arguments=[], member=getResults, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), ArraySelector(index=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0))], type_arguments=None)), label=None), WhileStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullCallback, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DeleteOldAdRequests"), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="PARTITION_KEY")], member=getLong, postfix_operators=[], prefix_operators=[], qualifier=partitionKeys, selectors=[], type_arguments=None), MemberReference(member=m_expiredAgeInSeconds, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=callProcedure, postfix_operators=[], prefix_operators=[], qualifier=m_client, selectors=[], type_arguments=None), label=None)]), condition=MethodInvocation(arguments=[], member=advanceRow, postfix_operators=[], prefix_operators=[], qualifier=partitionKeys, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=NullCallback, sub_type=None)), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="DeleteExpiredBids")], member=callProcedure, postfix_operators=[], prefix_operators=[], qualifier=m_client, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[], member=printStackTrace, postfix_operators=[], prefix_operators=[], qualifier=ex, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['IOException', 'ProcCallException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] Keyword[void] identifier[run] operator[SEP] operator[SEP] {
Keyword[try] {
identifier[VoltTable] identifier[partitionKeys] operator[=] Other[null] operator[SEP] identifier[partitionKeys] operator[=] identifier[m_client] operator[SEP] identifier[callProcedure] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[getResults] operator[SEP] operator[SEP] operator[SEP] Other[0] operator[SEP] operator[SEP] Keyword[while] operator[SEP] identifier[partitionKeys] operator[SEP] identifier[advanceRow] operator[SEP] operator[SEP] operator[SEP] {
identifier[m_client] operator[SEP] identifier[callProcedure] operator[SEP] Keyword[new] identifier[NullCallback] operator[SEP] operator[SEP] , literal[String] , identifier[partitionKeys] operator[SEP] identifier[getLong] operator[SEP] literal[String] operator[SEP] , identifier[m_expiredAgeInSeconds] operator[SEP] operator[SEP]
}
identifier[m_client] operator[SEP] identifier[callProcedure] operator[SEP] Keyword[new] identifier[NullCallback] operator[SEP] operator[SEP] , literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] operator[|] identifier[ProcCallException] identifier[ex] operator[SEP] {
identifier[ex] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public void addNamedEvent (String shortName, Class<? extends ComponentSystemEvent> cls)
{
String key = shortName;
Collection<Class<? extends ComponentSystemEvent>> eventList;
// Per the spec, if the short name is missing, generate one.
if (shortName == null)
{
key = getFixedName (cls);
}
eventList = events.get (key);
if (eventList == null)
{
// First event registered to this short name.
eventList = new LinkedList<Class<? extends ComponentSystemEvent>>();
events.put (key, eventList);
}
eventList.add (cls);
} | class class_name[name] begin[{]
method[addNamedEvent, return_type[void], modifier[public], parameter[shortName, cls]] begin[{]
local_variable[type[String], key]
local_variable[type[Collection], eventList]
if[binary_operation[member[.shortName], ==, literal[null]]] begin[{]
assign[member[.key], call[.getFixedName, parameter[member[.cls]]]]
else begin[{]
None
end[}]
assign[member[.eventList], call[events.get, parameter[member[.key]]]]
if[binary_operation[member[.eventList], ==, literal[null]]] begin[{]
assign[member[.eventList], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=[TypeArgument(pattern_type=extends, type=ReferenceType(arguments=None, dimensions=[], name=ComponentSystemEvent, sub_type=None))], dimensions=[], name=Class, sub_type=None))], dimensions=None, name=LinkedList, sub_type=None))]
call[events.put, parameter[member[.key], member[.eventList]]]
else begin[{]
None
end[}]
call[eventList.add, parameter[member[.cls]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[addNamedEvent] operator[SEP] identifier[String] identifier[shortName] , identifier[Class] operator[<] operator[?] Keyword[extends] identifier[ComponentSystemEvent] operator[>] identifier[cls] operator[SEP] {
identifier[String] identifier[key] operator[=] identifier[shortName] operator[SEP] identifier[Collection] operator[<] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[ComponentSystemEvent] operator[>] operator[>] identifier[eventList] operator[SEP] Keyword[if] operator[SEP] identifier[shortName] operator[==] Other[null] operator[SEP] {
identifier[key] operator[=] identifier[getFixedName] operator[SEP] identifier[cls] operator[SEP] operator[SEP]
}
identifier[eventList] operator[=] identifier[events] operator[SEP] identifier[get] operator[SEP] identifier[key] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[eventList] operator[==] Other[null] operator[SEP] {
identifier[eventList] operator[=] Keyword[new] identifier[LinkedList] operator[<] identifier[Class] operator[<] operator[?] Keyword[extends] identifier[ComponentSystemEvent] operator[>] operator[>] operator[SEP] operator[SEP] operator[SEP] identifier[events] operator[SEP] identifier[put] operator[SEP] identifier[key] , identifier[eventList] operator[SEP] operator[SEP]
}
identifier[eventList] operator[SEP] identifier[add] operator[SEP] identifier[cls] operator[SEP] operator[SEP]
}
|
public static boolean hasNature(List<Term> sentence, Nature nature)
{
for (Term term : sentence)
{
if (term.nature == nature)
{
return true;
}
}
return false;
} | class class_name[name] begin[{]
method[hasNature, return_type[type[boolean]], modifier[public static], parameter[sentence, nature]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=nature, postfix_operators=[], prefix_operators=[], qualifier=term, selectors=[]), operandr=MemberReference(member=nature, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator===), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=true), label=None)]))]), control=EnhancedForControl(iterable=MemberReference(member=sentence, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=term)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Term, sub_type=None))), label=None)
return[literal[false]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[hasNature] operator[SEP] identifier[List] operator[<] identifier[Term] operator[>] identifier[sentence] , identifier[Nature] identifier[nature] operator[SEP] {
Keyword[for] operator[SEP] identifier[Term] identifier[term] operator[:] identifier[sentence] operator[SEP] {
Keyword[if] operator[SEP] identifier[term] operator[SEP] identifier[nature] operator[==] identifier[nature] operator[SEP] {
Keyword[return] literal[boolean] operator[SEP]
}
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public final String getApiMessageId() {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(this, tc, "getApiMessageId");
String value = null;
/* The ApiMessageId is held as hexBinary & so we need to convert to an */
/* ID:xxxx format. */
byte[] binValue = (byte[]) getApi().getField(JsApiAccess.MESSAGEID);
if (binValue != null) {
/* It'll be more economical to get the length right immediately */
StringBuffer sbuf = new StringBuffer((binValue.length * 2) + 3);
/* Insert the ID: then add on the binary value as a hex string */
sbuf.append(ID_STRING);
HexString.binToHex(binValue, 0, binValue.length, sbuf);
/* Return the String representation */
value = sbuf.toString();
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(this, tc, "getApiMessageId", value);
return value;
} | class class_name[name] begin[{]
method[getApiMessageId, return_type[type[String]], modifier[final public], parameter[]] begin[{]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.entry, parameter[THIS[], member[.tc], literal["getApiMessageId"]]]
else begin[{]
None
end[}]
local_variable[type[String], value]
local_variable[type[byte], binValue]
if[binary_operation[member[.binValue], !=, literal[null]]] begin[{]
local_variable[type[StringBuffer], sbuf]
call[sbuf.append, parameter[member[.ID_STRING]]]
call[HexString.binToHex, parameter[member[.binValue], literal[0], member[binValue.length], member[.sbuf]]]
assign[member[.value], call[sbuf.toString, parameter[]]]
else begin[{]
None
end[}]
if[binary_operation[call[TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[tc.isEntryEnabled, parameter[]]]] begin[{]
call[SibTr.exit, parameter[THIS[], member[.tc], literal["getApiMessageId"], member[.value]]]
else begin[{]
None
end[}]
return[member[.value]]
end[}]
END[}] | Keyword[public] Keyword[final] identifier[String] identifier[getApiMessageId] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[tc] , literal[String] operator[SEP] operator[SEP] identifier[String] identifier[value] operator[=] Other[null] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[binValue] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] operator[SEP] identifier[getApi] operator[SEP] operator[SEP] operator[SEP] identifier[getField] operator[SEP] identifier[JsApiAccess] operator[SEP] identifier[MESSAGEID] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[binValue] operator[!=] Other[null] operator[SEP] {
identifier[StringBuffer] identifier[sbuf] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] identifier[binValue] operator[SEP] identifier[length] operator[*] Other[2] operator[SEP] operator[+] Other[3] operator[SEP] operator[SEP] identifier[sbuf] operator[SEP] identifier[append] operator[SEP] identifier[ID_STRING] operator[SEP] operator[SEP] identifier[HexString] operator[SEP] identifier[binToHex] operator[SEP] identifier[binValue] , Other[0] , identifier[binValue] operator[SEP] identifier[length] , identifier[sbuf] operator[SEP] operator[SEP] identifier[value] operator[=] identifier[sbuf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[if] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[tc] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[SibTr] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[tc] , literal[String] , identifier[value] operator[SEP] operator[SEP] Keyword[return] identifier[value] operator[SEP]
}
|
public JSON with(PrettyPrinter pp)
{
if (_prettyPrinter == pp) {
return this;
}
return _with(_features, _streamFactory, _treeCodec,
_reader, _writer, pp);
} | class class_name[name] begin[{]
method[with, return_type[type[JSON]], modifier[public], parameter[pp]] begin[{]
if[binary_operation[member[._prettyPrinter], ==, member[.pp]]] begin[{]
return[THIS[]]
else begin[{]
None
end[}]
return[call[._with, parameter[member[._features], member[._streamFactory], member[._treeCodec], member[._reader], member[._writer], member[.pp]]]]
end[}]
END[}] | Keyword[public] identifier[JSON] identifier[with] operator[SEP] identifier[PrettyPrinter] identifier[pp] operator[SEP] {
Keyword[if] operator[SEP] identifier[_prettyPrinter] operator[==] identifier[pp] operator[SEP] {
Keyword[return] Keyword[this] operator[SEP]
}
Keyword[return] identifier[_with] operator[SEP] identifier[_features] , identifier[_streamFactory] , identifier[_treeCodec] , identifier[_reader] , identifier[_writer] , identifier[pp] operator[SEP] operator[SEP]
}
|
public static CellPosition of(final String address) {
ArgUtils.notEmpty(address, "address");
if(!matchedCellAddress(address)) {
throw new IllegalArgumentException(address + " is wrong cell address pattern.");
}
return of(new CellReference(address));
} | class class_name[name] begin[{]
method[of, return_type[type[CellPosition]], modifier[public static], parameter[address]] begin[{]
call[ArgUtils.notEmpty, parameter[member[.address], literal["address"]]]
if[call[.matchedCellAddress, parameter[member[.address]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" is wrong cell address pattern."), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=IllegalArgumentException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[call[.of, parameter[ClassCreator(arguments=[MemberReference(member=address, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=CellReference, sub_type=None))]]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[CellPosition] identifier[of] operator[SEP] Keyword[final] identifier[String] identifier[address] operator[SEP] {
identifier[ArgUtils] operator[SEP] identifier[notEmpty] operator[SEP] identifier[address] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[!] identifier[matchedCellAddress] operator[SEP] identifier[address] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[IllegalArgumentException] operator[SEP] identifier[address] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[of] operator[SEP] Keyword[new] identifier[CellReference] operator[SEP] identifier[address] operator[SEP] operator[SEP] operator[SEP]
}
|
public SearchTracksRequest.Builder searchTracks(String q) {
return new SearchTracksRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.q(q);
} | class class_name[name] begin[{]
method[searchTracks, return_type[type[SearchTracksRequest]], modifier[public], parameter[q]] begin[{]
return[ClassCreator(arguments=[MemberReference(member=accessToken, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=httpManager, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=scheme, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=host, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=port, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=setDefaults, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=q, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=q, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=SearchTracksRequest, sub_type=ReferenceType(arguments=None, dimensions=None, name=Builder, sub_type=None)))]
end[}]
END[}] | Keyword[public] identifier[SearchTracksRequest] operator[SEP] identifier[Builder] identifier[searchTracks] operator[SEP] identifier[String] identifier[q] operator[SEP] {
Keyword[return] Keyword[new] identifier[SearchTracksRequest] operator[SEP] identifier[Builder] operator[SEP] identifier[accessToken] operator[SEP] operator[SEP] identifier[setDefaults] operator[SEP] identifier[httpManager] , identifier[scheme] , identifier[host] , identifier[port] operator[SEP] operator[SEP] identifier[q] operator[SEP] identifier[q] operator[SEP] operator[SEP]
}
|
private String attemptDecryption(String key, String property) {
try {
if (StringUtils.endsWithIgnoreCase(key, ENCRYPTED_SUFFIX)) {
if (encryptionProvider == null)
throw new RuntimeCryptoException(
"No encryption provider configured");
return encryptionProvider.decrypt(property);
} else {
return property;
}
} catch (MissingParameterException e) {
throw new RuntimeCryptoException("No value to encrypt specified");
}
} | class class_name[name] begin[{]
method[attemptDecryption, return_type[type[String]], modifier[private], parameter[key, property]] begin[{]
TryStatement(block=[IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=ENCRYPTED_SUFFIX, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=endsWithIgnoreCase, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=property, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MemberReference(member=encryptionProvider, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No encryption provider configured")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeCryptoException, sub_type=None)), label=None)), ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=property, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decrypt, postfix_operators=[], prefix_operators=[], qualifier=encryptionProvider, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="No value to encrypt specified")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeCryptoException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['MissingParameterException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] identifier[String] identifier[attemptDecryption] operator[SEP] identifier[String] identifier[key] , identifier[String] identifier[property] operator[SEP] {
Keyword[try] {
Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[endsWithIgnoreCase] operator[SEP] identifier[key] , identifier[ENCRYPTED_SUFFIX] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[encryptionProvider] operator[==] Other[null] operator[SEP] Keyword[throw] Keyword[new] identifier[RuntimeCryptoException] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[encryptionProvider] operator[SEP] identifier[decrypt] operator[SEP] identifier[property] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] identifier[property] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[MissingParameterException] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeCryptoException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
protected synchronized void connect_event_channel(ConnectionStructure cs) throws DevFailed {
// Get a reference to an EventChannel for
// this device server from the tango database
DeviceProxy adminDevice = DeviceProxyFactory.get(
cs.channelName, cs.database.getUrl().getTangoHost());
DbEventImportInfo received = getEventImportInfo(cs.channelName, cs.database, adminDevice);
// Keep host name without Fully Qualify Domain Name
int idx = received.host.indexOf('.');
if (idx > 0)
received.host = received.host.substring(0, idx);
// Connect the notify daemon
connectToNotificationDaemon(received);
StructuredProxyPushSupplier
structuredProxyPushSupplier = getStructuredProxyPushSupplier(cs.channelName);
if (cs.reconnect) {
EventChannelStruct eventChannelStruct = channel_map.get(cs.channelName);
eventChannelStruct.eventChannel = eventChannel;
eventChannelStruct.structuredProxyPushSupplier = structuredProxyPushSupplier;
eventChannelStruct.last_heartbeat = System.currentTimeMillis();
eventChannelStruct.heartbeat_skipped = false;
eventChannelStruct.host = received.host;
eventChannelStruct.has_notifd_closed_the_connection = 0;
try {
int filter_id = eventChannelStruct.heartbeat_filter_id;
Filter filter = eventChannelStruct.structuredProxyPushSupplier.get_filter(filter_id);
eventChannelStruct.structuredProxyPushSupplier.remove_filter(filter_id);
filter.destroy();
} catch (FilterNotFound e) {
// Do Nothing
}
// Add filter for heartbeat events on channelName
String constraint_expr = "$event_name == \'heartbeat\'";
eventChannelStruct.heartbeat_filter_id = add_filter_for_channel(eventChannelStruct, constraint_expr);
setEventChannelTimeoutMillis(eventChannelStruct.eventChannel, 3000);
} else {
EventChannelStruct newEventChannelStruct = new EventChannelStruct();
newEventChannelStruct.eventChannel = eventChannel;
newEventChannelStruct.structuredProxyPushSupplier = structuredProxyPushSupplier;
newEventChannelStruct.last_heartbeat = System.currentTimeMillis();
newEventChannelStruct.heartbeat_skipped = false;
newEventChannelStruct.adm_device_proxy = adminDevice;
newEventChannelStruct.host = received.host;
newEventChannelStruct.has_notifd_closed_the_connection = 0;
newEventChannelStruct.consumer = this;
// Add filter for heartbeat events on channelName
String constraint_expr = "$event_name == \'heartbeat\'";
newEventChannelStruct.heartbeat_filter_id = add_filter_for_channel(newEventChannelStruct, constraint_expr);
channel_map.put(cs.channelName, newEventChannelStruct);
setEventChannelTimeoutMillis(newEventChannelStruct.eventChannel, 3000);
}
} | class class_name[name] begin[{]
method[connect_event_channel, return_type[void], modifier[synchronized protected], parameter[cs]] begin[{]
local_variable[type[DeviceProxy], adminDevice]
local_variable[type[DbEventImportInfo], received]
local_variable[type[int], idx]
if[binary_operation[member[.idx], >, literal[0]]] begin[{]
assign[member[received.host], call[received.host.substring, parameter[literal[0], member[.idx]]]]
else begin[{]
None
end[}]
call[.connectToNotificationDaemon, parameter[member[.received]]]
local_variable[type[StructuredProxyPushSupplier], structuredProxyPushSupplier]
if[member[cs.reconnect]] begin[{]
local_variable[type[EventChannelStruct], eventChannelStruct]
assign[member[eventChannelStruct.eventChannel], member[.eventChannel]]
assign[member[eventChannelStruct.structuredProxyPushSupplier], member[.structuredProxyPushSupplier]]
assign[member[eventChannelStruct.last_heartbeat], call[System.currentTimeMillis, parameter[]]]
assign[member[eventChannelStruct.heartbeat_skipped], literal[false]]
assign[member[eventChannelStruct.host], member[received.host]]
assign[member[eventChannelStruct.has_notifd_closed_the_connection], literal[0]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MemberReference(member=heartbeat_filter_id, postfix_operators=[], prefix_operators=[], qualifier=eventChannelStruct, selectors=[]), name=filter_id)], modifiers=set(), type=BasicType(dimensions=[], name=int)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=filter_id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get_filter, postfix_operators=[], prefix_operators=[], qualifier=eventChannelStruct.structuredProxyPushSupplier, selectors=[], type_arguments=None), name=filter)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Filter, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=filter_id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=remove_filter, postfix_operators=[], prefix_operators=[], qualifier=eventChannelStruct.structuredProxyPushSupplier, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[], member=destroy, postfix_operators=[], prefix_operators=[], qualifier=filter, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['FilterNotFound']))], finally_block=None, label=None, resources=None)
local_variable[type[String], constraint_expr]
assign[member[eventChannelStruct.heartbeat_filter_id], call[.add_filter_for_channel, parameter[member[.eventChannelStruct], member[.constraint_expr]]]]
call[.setEventChannelTimeoutMillis, parameter[member[eventChannelStruct.eventChannel], literal[3000]]]
else begin[{]
local_variable[type[EventChannelStruct], newEventChannelStruct]
assign[member[newEventChannelStruct.eventChannel], member[.eventChannel]]
assign[member[newEventChannelStruct.structuredProxyPushSupplier], member[.structuredProxyPushSupplier]]
assign[member[newEventChannelStruct.last_heartbeat], call[System.currentTimeMillis, parameter[]]]
assign[member[newEventChannelStruct.heartbeat_skipped], literal[false]]
assign[member[newEventChannelStruct.adm_device_proxy], member[.adminDevice]]
assign[member[newEventChannelStruct.host], member[received.host]]
assign[member[newEventChannelStruct.has_notifd_closed_the_connection], literal[0]]
assign[member[newEventChannelStruct.consumer], THIS[]]
local_variable[type[String], constraint_expr]
assign[member[newEventChannelStruct.heartbeat_filter_id], call[.add_filter_for_channel, parameter[member[.newEventChannelStruct], member[.constraint_expr]]]]
call[channel_map.put, parameter[member[cs.channelName], member[.newEventChannelStruct]]]
call[.setEventChannelTimeoutMillis, parameter[member[newEventChannelStruct.eventChannel], literal[3000]]]
end[}]
end[}]
END[}] | Keyword[protected] Keyword[synchronized] Keyword[void] identifier[connect_event_channel] operator[SEP] identifier[ConnectionStructure] identifier[cs] operator[SEP] Keyword[throws] identifier[DevFailed] {
identifier[DeviceProxy] identifier[adminDevice] operator[=] identifier[DeviceProxyFactory] operator[SEP] identifier[get] operator[SEP] identifier[cs] operator[SEP] identifier[channelName] , identifier[cs] operator[SEP] identifier[database] operator[SEP] identifier[getUrl] operator[SEP] operator[SEP] operator[SEP] identifier[getTangoHost] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[DbEventImportInfo] identifier[received] operator[=] identifier[getEventImportInfo] operator[SEP] identifier[cs] operator[SEP] identifier[channelName] , identifier[cs] operator[SEP] identifier[database] , identifier[adminDevice] operator[SEP] operator[SEP] Keyword[int] identifier[idx] operator[=] identifier[received] operator[SEP] identifier[host] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[idx] operator[>] Other[0] operator[SEP] identifier[received] operator[SEP] identifier[host] operator[=] identifier[received] operator[SEP] identifier[host] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[idx] operator[SEP] operator[SEP] identifier[connectToNotificationDaemon] operator[SEP] identifier[received] operator[SEP] operator[SEP] identifier[StructuredProxyPushSupplier] identifier[structuredProxyPushSupplier] operator[=] identifier[getStructuredProxyPushSupplier] operator[SEP] identifier[cs] operator[SEP] identifier[channelName] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[cs] operator[SEP] identifier[reconnect] operator[SEP] {
identifier[EventChannelStruct] identifier[eventChannelStruct] operator[=] identifier[channel_map] operator[SEP] identifier[get] operator[SEP] identifier[cs] operator[SEP] identifier[channelName] operator[SEP] operator[SEP] identifier[eventChannelStruct] operator[SEP] identifier[eventChannel] operator[=] identifier[eventChannel] operator[SEP] identifier[eventChannelStruct] operator[SEP] identifier[structuredProxyPushSupplier] operator[=] identifier[structuredProxyPushSupplier] operator[SEP] identifier[eventChannelStruct] operator[SEP] identifier[last_heartbeat] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[eventChannelStruct] operator[SEP] identifier[heartbeat_skipped] operator[=] literal[boolean] operator[SEP] identifier[eventChannelStruct] operator[SEP] identifier[host] operator[=] identifier[received] operator[SEP] identifier[host] operator[SEP] identifier[eventChannelStruct] operator[SEP] identifier[has_notifd_closed_the_connection] operator[=] Other[0] operator[SEP] Keyword[try] {
Keyword[int] identifier[filter_id] operator[=] identifier[eventChannelStruct] operator[SEP] identifier[heartbeat_filter_id] operator[SEP] identifier[Filter] identifier[filter] operator[=] identifier[eventChannelStruct] operator[SEP] identifier[structuredProxyPushSupplier] operator[SEP] identifier[get_filter] operator[SEP] identifier[filter_id] operator[SEP] operator[SEP] identifier[eventChannelStruct] operator[SEP] identifier[structuredProxyPushSupplier] operator[SEP] identifier[remove_filter] operator[SEP] identifier[filter_id] operator[SEP] operator[SEP] identifier[filter] operator[SEP] identifier[destroy] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[FilterNotFound] identifier[e] operator[SEP] {
}
identifier[String] identifier[constraint_expr] operator[=] literal[String] operator[SEP] identifier[eventChannelStruct] operator[SEP] identifier[heartbeat_filter_id] operator[=] identifier[add_filter_for_channel] operator[SEP] identifier[eventChannelStruct] , identifier[constraint_expr] operator[SEP] operator[SEP] identifier[setEventChannelTimeoutMillis] operator[SEP] identifier[eventChannelStruct] operator[SEP] identifier[eventChannel] , Other[3000] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[EventChannelStruct] identifier[newEventChannelStruct] operator[=] Keyword[new] identifier[EventChannelStruct] operator[SEP] operator[SEP] operator[SEP] identifier[newEventChannelStruct] operator[SEP] identifier[eventChannel] operator[=] identifier[eventChannel] operator[SEP] identifier[newEventChannelStruct] operator[SEP] identifier[structuredProxyPushSupplier] operator[=] identifier[structuredProxyPushSupplier] operator[SEP] identifier[newEventChannelStruct] operator[SEP] identifier[last_heartbeat] operator[=] identifier[System] operator[SEP] identifier[currentTimeMillis] operator[SEP] operator[SEP] operator[SEP] identifier[newEventChannelStruct] operator[SEP] identifier[heartbeat_skipped] operator[=] literal[boolean] operator[SEP] identifier[newEventChannelStruct] operator[SEP] identifier[adm_device_proxy] operator[=] identifier[adminDevice] operator[SEP] identifier[newEventChannelStruct] operator[SEP] identifier[host] operator[=] identifier[received] operator[SEP] identifier[host] operator[SEP] identifier[newEventChannelStruct] operator[SEP] identifier[has_notifd_closed_the_connection] operator[=] Other[0] operator[SEP] identifier[newEventChannelStruct] operator[SEP] identifier[consumer] operator[=] Keyword[this] operator[SEP] identifier[String] identifier[constraint_expr] operator[=] literal[String] operator[SEP] identifier[newEventChannelStruct] operator[SEP] identifier[heartbeat_filter_id] operator[=] identifier[add_filter_for_channel] operator[SEP] identifier[newEventChannelStruct] , identifier[constraint_expr] operator[SEP] operator[SEP] identifier[channel_map] operator[SEP] identifier[put] operator[SEP] identifier[cs] operator[SEP] identifier[channelName] , identifier[newEventChannelStruct] operator[SEP] operator[SEP] identifier[setEventChannelTimeoutMillis] operator[SEP] identifier[newEventChannelStruct] operator[SEP] identifier[eventChannel] , Other[3000] operator[SEP] operator[SEP]
}
}
|
private void writeJsonForJobs(PrintWriter wrt, List<RecentJobEvent> jobs) {
try {
wrt.write("[");
// Loop Jobs
for (int i = 0; i < jobs.size(); i++) {
RecentJobEvent jobEvent = jobs.get(i);
writeJsonForJob(wrt, jobEvent);
//Write seperator between json objects
if(i != jobs.size() - 1) {
wrt.write(",");
}
}
wrt.write("]");
} catch (EofException eof) { // Connection closed by client
LOG.info("Info server for jobmanager: Connection closed by client, EofException");
} catch (IOException ioe) { // Connection closed by client
LOG.info("Info server for jobmanager: Connection closed by client, IOException");
}
} | class class_name[name] begin[{]
method[writeJsonForJobs, return_type[void], modifier[private], parameter[wrt, jobs]] begin[{]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="[")], member=write, postfix_operators=[], prefix_operators=[], qualifier=wrt, selectors=[], type_arguments=None), label=None), ForStatement(body=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=jobs, selectors=[], type_arguments=None), name=jobEvent)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=RecentJobEvent, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=wrt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jobEvent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=writeJsonForJob, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=BinaryOperation(operandl=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=jobs, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=",")], member=write, postfix_operators=[], prefix_operators=[], qualifier=wrt, selectors=[], type_arguments=None), label=None)]))]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MethodInvocation(arguments=[], member=size, postfix_operators=[], prefix_operators=[], qualifier=jobs, selectors=[], type_arguments=None), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None), StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="]")], member=write, postfix_operators=[], prefix_operators=[], qualifier=wrt, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Info server for jobmanager: Connection closed by client, EofException")], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=eof, types=['EofException'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Info server for jobmanager: Connection closed by client, IOException")], member=info, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ioe, types=['IOException']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[private] Keyword[void] identifier[writeJsonForJobs] operator[SEP] identifier[PrintWriter] identifier[wrt] , identifier[List] operator[<] identifier[RecentJobEvent] operator[>] identifier[jobs] operator[SEP] {
Keyword[try] {
identifier[wrt] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[jobs] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[RecentJobEvent] identifier[jobEvent] operator[=] identifier[jobs] operator[SEP] identifier[get] operator[SEP] identifier[i] operator[SEP] operator[SEP] identifier[writeJsonForJob] operator[SEP] identifier[wrt] , identifier[jobEvent] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[i] operator[!=] identifier[jobs] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[-] Other[1] operator[SEP] {
identifier[wrt] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
identifier[wrt] operator[SEP] identifier[write] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[EofException] identifier[eof] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[IOException] identifier[ioe] operator[SEP] {
identifier[LOG] operator[SEP] identifier[info] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
}
|
public Object getObjectInstance(final Object ref, final Name name, final Context nameCtx, final Hashtable<?, ?> environment) throws Exception {
final ClassLoader classLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
if (classLoader == null) {
return ref;
}
final String factoriesProp = (String) environment.get(Context.OBJECT_FACTORIES);
if (factoriesProp != null) {
final String[] classes = factoriesProp.split(":");
for (String className : classes) {
try {
final Class<?> factoryClass = classLoader.loadClass(className);
final ObjectFactory objectFactory = ObjectFactory.class.cast(factoryClass.newInstance());
final Object result = objectFactory.getObjectInstance(ref, name, nameCtx, environment);
if (result != null) {
return result;
}
} catch (Throwable ignored) {
}
}
}
return ref;
} | class class_name[name] begin[{]
method[getObjectInstance, return_type[type[Object]], modifier[public], parameter[ref, name, nameCtx, environment]] begin[{]
local_variable[type[ClassLoader], classLoader]
if[binary_operation[member[.classLoader], ==, literal[null]]] begin[{]
return[member[.ref]]
else begin[{]
None
end[}]
local_variable[type[String], factoriesProp]
if[binary_operation[member[.factoriesProp], !=, literal[null]]] begin[{]
local_variable[type[String], classes]
ForStatement(body=BlockStatement(label=None, statements=[TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=className, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=loadClass, postfix_operators=[], prefix_operators=[], qualifier=classLoader, selectors=[], type_arguments=None), name=factoryClass)], modifiers={'final'}, type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=Class, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassReference(postfix_operators=[], prefix_operators=[], qualifier=, selectors=[MethodInvocation(arguments=[MethodInvocation(arguments=[], member=newInstance, postfix_operators=[], prefix_operators=[], qualifier=factoryClass, selectors=[], type_arguments=None)], member=cast, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=ObjectFactory, sub_type=None)), name=objectFactory)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=ObjectFactory, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=ref, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=name, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nameCtx, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=environment, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getObjectInstance, postfix_operators=[], prefix_operators=[], qualifier=objectFactory, selectors=[], type_arguments=None), name=result)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=Object, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MemberReference(member=result, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), label=None)]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ignored, types=['Throwable']))], finally_block=None, label=None, resources=None)]), control=EnhancedForControl(iterable=MemberReference(member=classes, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=className)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))), label=None)
else begin[{]
None
end[}]
return[member[.ref]]
end[}]
END[}] | Keyword[public] identifier[Object] identifier[getObjectInstance] operator[SEP] Keyword[final] identifier[Object] identifier[ref] , Keyword[final] identifier[Name] identifier[name] , Keyword[final] identifier[Context] identifier[nameCtx] , Keyword[final] identifier[Hashtable] operator[<] operator[?] , operator[?] operator[>] identifier[environment] operator[SEP] Keyword[throws] identifier[Exception] {
Keyword[final] identifier[ClassLoader] identifier[classLoader] operator[=] identifier[WildFlySecurityManager] operator[SEP] identifier[getCurrentContextClassLoaderPrivileged] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[classLoader] operator[==] Other[null] operator[SEP] {
Keyword[return] identifier[ref] operator[SEP]
}
Keyword[final] identifier[String] identifier[factoriesProp] operator[=] operator[SEP] identifier[String] operator[SEP] identifier[environment] operator[SEP] identifier[get] operator[SEP] identifier[Context] operator[SEP] identifier[OBJECT_FACTORIES] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[factoriesProp] operator[!=] Other[null] operator[SEP] {
Keyword[final] identifier[String] operator[SEP] operator[SEP] identifier[classes] operator[=] identifier[factoriesProp] operator[SEP] identifier[split] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[String] identifier[className] operator[:] identifier[classes] operator[SEP] {
Keyword[try] {
Keyword[final] identifier[Class] operator[<] operator[?] operator[>] identifier[factoryClass] operator[=] identifier[classLoader] operator[SEP] identifier[loadClass] operator[SEP] identifier[className] operator[SEP] operator[SEP] Keyword[final] identifier[ObjectFactory] identifier[objectFactory] operator[=] identifier[ObjectFactory] operator[SEP] Keyword[class] operator[SEP] identifier[cast] operator[SEP] identifier[factoryClass] operator[SEP] identifier[newInstance] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Object] identifier[result] operator[=] identifier[objectFactory] operator[SEP] identifier[getObjectInstance] operator[SEP] identifier[ref] , identifier[name] , identifier[nameCtx] , identifier[environment] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[result] operator[!=] Other[null] operator[SEP] {
Keyword[return] identifier[result] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Throwable] identifier[ignored] operator[SEP] {
}
}
}
Keyword[return] identifier[ref] operator[SEP]
}
|
private String decrypt(String value) {
Crypto crypto = new Crypto(this);
String keyFile = System.getProperty(Key.APPLICATION_PRIVATEKEY.toString());
if (StringUtils.isNotBlank(keyFile)) {
try (Stream<String> lines = Files.lines(Paths.get(keyFile))) { //NOSONAR KeyFile can intentionally come from user input
String key = lines.findFirst().orElse(null);
if (StringUtils.isNotBlank(key)) {
PrivateKey privateKey = crypto.getPrivateKeyFromString(key);
String cryptex = StringUtils.substringBetween(value, CRYPTEX_TAG, "}");
if (privateKey != null && StringUtils.isNotBlank(cryptex)) {
return crypto.decrypt(cryptex, privateKey);
} else {
LOG.error("Failed to decrypt an encrypted config value");
this.decrypted = false;
}
}
} catch (IOException | SecurityException | MangooEncryptionException e) {
LOG.error("Failed to decrypt an encrypted config value", e);
this.decrypted = false;
}
} else {
LOG.error("Found an encrypted value in config file but private key for decryption is missing");
this.decrypted = false;
}
return "";
} | class class_name[name] begin[{]
method[decrypt, return_type[type[String]], modifier[private], parameter[value]] begin[{]
local_variable[type[Crypto], crypto]
local_variable[type[String], keyFile]
if[call[StringUtils.isNotBlank, parameter[member[.keyFile]]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[], member=findFirst, postfix_operators=[], prefix_operators=[], qualifier=lines, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=orElse, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), name=key)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNotBlank, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=key, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getPrivateKeyFromString, postfix_operators=[], prefix_operators=[], qualifier=crypto, selectors=[], type_arguments=None), name=privateKey)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PrivateKey, sub_type=None)), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[MemberReference(member=value, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=CRYPTEX_TAG, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="}")], member=substringBetween, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), name=cryptex)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=BinaryOperation(operandl=MemberReference(member=privateKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), operandr=MethodInvocation(arguments=[MemberReference(member=cryptex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=isNotBlank, postfix_operators=[], prefix_operators=[], qualifier=StringUtils, selectors=[], type_arguments=None), operator=&&), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to decrypt an encrypted config value")], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=decrypted, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=cryptex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=privateKey, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=decrypt, postfix_operators=[], prefix_operators=[], qualifier=crypto, selectors=[], type_arguments=None), label=None)]))]))], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Failed to decrypt an encrypted config value"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None), StatementExpression(expression=Assignment(expressionl=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=decrypted, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None)]), type==, value=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['IOException', 'SecurityException', 'MangooEncryptionException']))], finally_block=None, label=None, resources=[TryResource(annotations=[], modifiers=set(), name=lines, type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=String, sub_type=None))], dimensions=[], name=Stream, sub_type=None), value=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=keyFile, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=Paths, selectors=[], type_arguments=None)], member=lines, postfix_operators=[], prefix_operators=[], qualifier=Files, selectors=[], type_arguments=None))])
else begin[{]
call[LOG.error, parameter[literal["Found an encrypted value in config file but private key for decryption is missing"]]]
assign[THIS[member[None.decrypted]], literal[false]]
end[}]
return[literal[""]]
end[}]
END[}] | Keyword[private] identifier[String] identifier[decrypt] operator[SEP] identifier[String] identifier[value] operator[SEP] {
identifier[Crypto] identifier[crypto] operator[=] Keyword[new] identifier[Crypto] operator[SEP] Keyword[this] operator[SEP] operator[SEP] identifier[String] identifier[keyFile] operator[=] identifier[System] operator[SEP] identifier[getProperty] operator[SEP] identifier[Key] operator[SEP] identifier[APPLICATION_PRIVATEKEY] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[keyFile] operator[SEP] operator[SEP] {
Keyword[try] operator[SEP] identifier[Stream] operator[<] identifier[String] operator[>] identifier[lines] operator[=] identifier[Files] operator[SEP] identifier[lines] operator[SEP] identifier[Paths] operator[SEP] identifier[get] operator[SEP] identifier[keyFile] operator[SEP] operator[SEP] operator[SEP] {
identifier[String] identifier[key] operator[=] identifier[lines] operator[SEP] identifier[findFirst] operator[SEP] operator[SEP] operator[SEP] identifier[orElse] operator[SEP] Other[null] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[key] operator[SEP] operator[SEP] {
identifier[PrivateKey] identifier[privateKey] operator[=] identifier[crypto] operator[SEP] identifier[getPrivateKeyFromString] operator[SEP] identifier[key] operator[SEP] operator[SEP] identifier[String] identifier[cryptex] operator[=] identifier[StringUtils] operator[SEP] identifier[substringBetween] operator[SEP] identifier[value] , identifier[CRYPTEX_TAG] , literal[String] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[privateKey] operator[!=] Other[null] operator[&&] identifier[StringUtils] operator[SEP] identifier[isNotBlank] operator[SEP] identifier[cryptex] operator[SEP] operator[SEP] {
Keyword[return] identifier[crypto] operator[SEP] identifier[decrypt] operator[SEP] identifier[cryptex] , identifier[privateKey] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[decrypted] operator[=] literal[boolean] operator[SEP]
}
}
}
Keyword[catch] operator[SEP] identifier[IOException] operator[|] identifier[SecurityException] operator[|] identifier[MangooEncryptionException] identifier[e] operator[SEP] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[decrypted] operator[=] literal[boolean] operator[SEP]
}
}
Keyword[else] {
identifier[LOG] operator[SEP] identifier[error] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[this] operator[SEP] identifier[decrypted] operator[=] literal[boolean] operator[SEP]
}
Keyword[return] literal[String] operator[SEP]
}
|
public static <T> ValueSourceFuture<T> createValueSourceFuture(ListenableFuture<T> listenableFuture) {
if (listenableFuture instanceof ValueSourceFutureBackedListenableFuture) {
return ((ValueSourceFutureBackedListenableFuture<T>) listenableFuture).getWrappedFuture();
} else {
return new ListenableFutureBackedValueSourceFuture<>(listenableFuture);
}
} | class class_name[name] begin[{]
method[createValueSourceFuture, return_type[type[ValueSourceFuture]], modifier[public static], parameter[listenableFuture]] begin[{]
if[binary_operation[member[.listenableFuture], instanceof, type[ValueSourceFutureBackedListenableFuture]]] begin[{]
return[Cast(expression=MemberReference(member=listenableFuture, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=T, sub_type=None))], dimensions=[], name=ValueSourceFutureBackedListenableFuture, sub_type=None))]
else begin[{]
return[ClassCreator(arguments=[MemberReference(member=listenableFuture, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=[], dimensions=None, name=ListenableFutureBackedValueSourceFuture, sub_type=None))]
end[}]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[ValueSourceFuture] operator[<] identifier[T] operator[>] identifier[createValueSourceFuture] operator[SEP] identifier[ListenableFuture] operator[<] identifier[T] operator[>] identifier[listenableFuture] operator[SEP] {
Keyword[if] operator[SEP] identifier[listenableFuture] Keyword[instanceof] identifier[ValueSourceFutureBackedListenableFuture] operator[SEP] {
Keyword[return] operator[SEP] operator[SEP] identifier[ValueSourceFutureBackedListenableFuture] operator[<] identifier[T] operator[>] operator[SEP] identifier[listenableFuture] operator[SEP] operator[SEP] identifier[getWrappedFuture] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[return] Keyword[new] identifier[ListenableFutureBackedValueSourceFuture] operator[<] operator[>] operator[SEP] identifier[listenableFuture] operator[SEP] operator[SEP]
}
}
|
private static void editColumns(final JFrame frm, final Vector<String> colNames, final Vector<ColumnType> colTypes, final UnaryFunction<ImmutablePair<Vector<String>,Vector<ColumnType>>,Void> cf) {
// Prepares UI components
final JLabel dialogLabel =
new JLabel("<html><b>Column mappings as CSV</b></html>");
dialogLabel.setHorizontalTextPosition(SwingConstants.LEFT);
final JLabel useLabel = new JLabel("<html>Simplified CSV syntax, with no quoting required.<br />For each line: <tt>type;name</tt> (e.g. <tt>string;Column name</tt>)</html>");
useLabel.setHorizontalTextPosition(SwingConstants.LEFT);
final JEditorPane csvArea = new JEditorPane();
csvArea.setEditable(false);
dialogLabel.setLabelFor(csvArea);
final JScrollPane csvPanel =
new JScrollPane(csvArea,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
csvPanel.setBorder(BorderFactory.createLoweredBevelBorder());
csvArea.setContentType("text/csv");
final Document doc = csvArea.getDocument();
final JDialog dlg = new JDialog(frm, "Edit columns");
final Container content = dlg.getContentPane();
final GroupLayout layout = new GroupLayout(content);
final AbstractAction update = new AbstractAction() {
public void actionPerformed(final ActionEvent evt) {
BufferedReader r = null;
final Vector<String> ns = new Vector<String>();
final Vector<ColumnType> ts = new Vector<ColumnType>();
try {
final StringReader sr =
new StringReader(csvArea.getText());
r = new BufferedReader(sr);
String line, n;
ColumnType t;
for (int i = 1, o = 0, l = 0, x = -1;
(line = r.readLine()) != null; i++) {
l = line.length();
if ((x = line.indexOf(";")) == -1) {
JOptionPane.showMessageDialog(dlg, "Invalid CSV line #" + i, "Invalid line", JOptionPane.ERROR_MESSAGE);
csvArea.select(o, o+l);
return;
} // end of if
// ---
t = ColumnType.typeFor(line.substring(0, x));
if (t == null) {
JOptionPane.showMessageDialog(dlg, "Invalid column type at line #" + i + ": " + line.substring(0, x), "Invalid type", JOptionPane.ERROR_MESSAGE);
csvArea.select(o, o+x);
return;
} // end of if
n = line.substring(x+1);
if (n.length() == 0) {
JOptionPane.showMessageDialog(dlg, "Invalid column name at line #" + i, "Invalid name", JOptionPane.ERROR_MESSAGE);
csvArea.setCaretPosition(o+x+1);
return;
} // end of if
ns.add(n);
ts.add(t);
o += l + 1;
}
} catch (Exception e) {
throw new RuntimeException("Fails to update", e);
} finally {
if (r != null) {
try {
r.close();
} catch (Exception e) {
e.printStackTrace();
} // end of catch
} // end of if
} // end of finally
cf.apply(ImmutablePair.of(ns, ts));
dlg.dispose();
}
};
update.putValue(Action.NAME, "Update");
update.putValue(Action.SHORT_DESCRIPTION, "Update column mappings");
update.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_U);
update.setEnabled(false);
final JButton updateBut = new JButton(update);
Binder.bind("text", csvArea, "enabled", update,
new BindingOptionMap().
add(BindingKey.INPUT_TRANSFORMER,
StringLengthToBooleanTransformer.
getTrimmingInstance()).
add(TextBindingKey.CONTINUOUSLY_UPDATE_VALUE));
// Lays out UI component
content.setLayout(layout);
layout.setAutoCreateGaps(true);
layout.setAutoCreateContainerGaps(true);
final GroupLayout.SequentialGroup vgroup =
layout.createSequentialGroup().
addComponent(dialogLabel).
addComponent(useLabel).
addComponent(csvPanel,
GroupLayout.PREFERRED_SIZE,
GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE).
addComponent(updateBut);
final GroupLayout.ParallelGroup hgroup =
layout.createParallelGroup(Alignment.LEADING).
addComponent(dialogLabel).
addComponent(useLabel).
addComponent(csvPanel).
addGroup(layout.createSequentialGroup().
addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,
GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).
addComponent(updateBut));
layout.setVerticalGroup(vgroup);
layout.setHorizontalGroup(hgroup);
dlg.setModal(true);
dlg.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
dlg.setMinimumSize(new Dimension(frm.getWidth(), frm.getHeight()/3));
final KeyAdapter kl = new KeyAdapter() {
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) dlg.dispose();
}
};
dlg.addKeyListener(kl);
content.addKeyListener(kl);
csvArea.addKeyListener(kl);
final KeyAdapter editKeys = new KeyAdapter() {
public void keyReleased(final KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_U && e.isControlDown())
updateBut.doClick();
}
};
content.addKeyListener(editKeys);
csvArea.addKeyListener(editKeys);
csvArea.grabFocus();
// Load as CSV
final int len = colNames.size();
StringBuffer line = new StringBuffer();
for (int i = 0, o = 0; i < len; i++) {
line.setLength(0);
line.append(colTypes.elementAt(i)).
append(';').append(colNames.elementAt(i)).
append("\n");
try {
doc.insertString(o, line.toString(), null);
} catch (Exception e) {
throw new RuntimeException("Fails to append CSV line", e);
}
o += line.length();
}
csvArea.setEditable(true);
dlg.pack();
dlg.setLocationRelativeTo(null);
dlg.setVisible(true);
} | class class_name[name] begin[{]
method[editColumns, return_type[void], modifier[private static], parameter[frm, colNames, colTypes, cf]] begin[{]
local_variable[type[JLabel], dialogLabel]
call[dialogLabel.setHorizontalTextPosition, parameter[member[SwingConstants.LEFT]]]
local_variable[type[JLabel], useLabel]
call[useLabel.setHorizontalTextPosition, parameter[member[SwingConstants.LEFT]]]
local_variable[type[JEditorPane], csvArea]
call[csvArea.setEditable, parameter[literal[false]]]
call[dialogLabel.setLabelFor, parameter[member[.csvArea]]]
local_variable[type[JScrollPane], csvPanel]
call[csvPanel.setBorder, parameter[call[BorderFactory.createLoweredBevelBorder, parameter[]]]]
call[csvArea.setContentType, parameter[literal["text/csv"]]]
local_variable[type[Document], doc]
local_variable[type[JDialog], dlg]
local_variable[type[Container], content]
local_variable[type[GroupLayout], layout]
local_variable[type[AbstractAction], update]
call[update.putValue, parameter[member[Action.NAME], literal["Update"]]]
call[update.putValue, parameter[member[Action.SHORT_DESCRIPTION], literal["Update column mappings"]]]
call[update.putValue, parameter[member[Action.MNEMONIC_KEY], member[KeyEvent.VK_U]]]
call[update.setEnabled, parameter[literal[false]]]
local_variable[type[JButton], updateBut]
call[Binder.bind, parameter[literal["text"], member[.csvArea], literal["enabled"], member[.update], ClassCreator(arguments=[], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=INPUT_TRANSFORMER, postfix_operators=[], prefix_operators=[], qualifier=BindingKey, selectors=[]), MethodInvocation(arguments=[], member=getTrimmingInstance, postfix_operators=[], prefix_operators=[], qualifier=StringLengthToBooleanTransformer, selectors=[], type_arguments=None)], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MemberReference(member=CONTINUOUSLY_UPDATE_VALUE, postfix_operators=[], prefix_operators=[], qualifier=TextBindingKey, selectors=[])], member=add, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=BindingOptionMap, sub_type=None))]]
call[content.setLayout, parameter[member[.layout]]]
call[layout.setAutoCreateGaps, parameter[literal[true]]]
call[layout.setAutoCreateContainerGaps, parameter[literal[true]]]
local_variable[type[GroupLayout], vgroup]
local_variable[type[GroupLayout], hgroup]
call[layout.setVerticalGroup, parameter[member[.vgroup]]]
call[layout.setHorizontalGroup, parameter[member[.hgroup]]]
call[dlg.setModal, parameter[literal[true]]]
call[dlg.setDefaultCloseOperation, parameter[member[JDialog.DISPOSE_ON_CLOSE]]]
call[dlg.setMinimumSize, parameter[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getWidth, postfix_operators=[], prefix_operators=[], qualifier=frm, selectors=[], type_arguments=None), BinaryOperation(operandl=MethodInvocation(arguments=[], member=getHeight, postfix_operators=[], prefix_operators=[], qualifier=frm, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=3), operator=/)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Dimension, sub_type=None))]]
local_variable[type[KeyAdapter], kl]
call[dlg.addKeyListener, parameter[member[.kl]]]
call[content.addKeyListener, parameter[member[.kl]]]
call[csvArea.addKeyListener, parameter[member[.kl]]]
local_variable[type[KeyAdapter], editKeys]
call[content.addKeyListener, parameter[member[.editKeys]]]
call[csvArea.addKeyListener, parameter[member[.editKeys]]]
call[csvArea.grabFocus, parameter[]]
local_variable[type[int], len]
local_variable[type[StringBuffer], line]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], member=setLength, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=elementAt, postfix_operators=[], prefix_operators=[], qualifier=colTypes, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=';')], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=elementAt, postfix_operators=[], prefix_operators=[], qualifier=colNames, selectors=[], type_arguments=None)], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None), MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None), TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null)], member=insertString, postfix_operators=[], prefix_operators=[], qualifier=doc, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Fails to append CSV line"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=RuntimeException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None), StatementExpression(expression=Assignment(expressionl=MemberReference(member=o, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=+=, value=MethodInvocation(arguments=[], member=length, postfix_operators=[], prefix_operators=[], qualifier=line, selectors=[], type_arguments=None)), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=len, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i), VariableDeclarator(dimensions=[], initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=o)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=['++'], prefix_operators=[], qualifier=, selectors=[])]), label=None)
call[csvArea.setEditable, parameter[literal[true]]]
call[dlg.pack, parameter[]]
call[dlg.setLocationRelativeTo, parameter[literal[null]]]
call[dlg.setVisible, parameter[literal[true]]]
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[editColumns] operator[SEP] Keyword[final] identifier[JFrame] identifier[frm] , Keyword[final] identifier[Vector] operator[<] identifier[String] operator[>] identifier[colNames] , Keyword[final] identifier[Vector] operator[<] identifier[ColumnType] operator[>] identifier[colTypes] , Keyword[final] identifier[UnaryFunction] operator[<] identifier[ImmutablePair] operator[<] identifier[Vector] operator[<] identifier[String] operator[>] , identifier[Vector] operator[<] identifier[ColumnType] operator[>] operator[>] , identifier[Void] operator[>] identifier[cf] operator[SEP] {
Keyword[final] identifier[JLabel] identifier[dialogLabel] operator[=] Keyword[new] identifier[JLabel] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[dialogLabel] operator[SEP] identifier[setHorizontalTextPosition] operator[SEP] identifier[SwingConstants] operator[SEP] identifier[LEFT] operator[SEP] operator[SEP] Keyword[final] identifier[JLabel] identifier[useLabel] operator[=] Keyword[new] identifier[JLabel] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[useLabel] operator[SEP] identifier[setHorizontalTextPosition] operator[SEP] identifier[SwingConstants] operator[SEP] identifier[LEFT] operator[SEP] operator[SEP] Keyword[final] identifier[JEditorPane] identifier[csvArea] operator[=] Keyword[new] identifier[JEditorPane] operator[SEP] operator[SEP] operator[SEP] identifier[csvArea] operator[SEP] identifier[setEditable] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[dialogLabel] operator[SEP] identifier[setLabelFor] operator[SEP] identifier[csvArea] operator[SEP] operator[SEP] Keyword[final] identifier[JScrollPane] identifier[csvPanel] operator[=] Keyword[new] identifier[JScrollPane] operator[SEP] identifier[csvArea] , identifier[JScrollPane] operator[SEP] identifier[VERTICAL_SCROLLBAR_ALWAYS] , identifier[JScrollPane] operator[SEP] identifier[HORIZONTAL_SCROLLBAR_AS_NEEDED] operator[SEP] operator[SEP] identifier[csvPanel] operator[SEP] identifier[setBorder] operator[SEP] identifier[BorderFactory] operator[SEP] identifier[createLoweredBevelBorder] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[csvArea] operator[SEP] identifier[setContentType] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[Document] identifier[doc] operator[=] identifier[csvArea] operator[SEP] identifier[getDocument] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[JDialog] identifier[dlg] operator[=] Keyword[new] identifier[JDialog] operator[SEP] identifier[frm] , literal[String] operator[SEP] operator[SEP] Keyword[final] identifier[Container] identifier[content] operator[=] identifier[dlg] operator[SEP] identifier[getContentPane] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[GroupLayout] identifier[layout] operator[=] Keyword[new] identifier[GroupLayout] operator[SEP] identifier[content] operator[SEP] operator[SEP] Keyword[final] identifier[AbstractAction] identifier[update] operator[=] Keyword[new] identifier[AbstractAction] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[actionPerformed] operator[SEP] Keyword[final] identifier[ActionEvent] identifier[evt] operator[SEP] {
identifier[BufferedReader] identifier[r] operator[=] Other[null] operator[SEP] Keyword[final] identifier[Vector] operator[<] identifier[String] operator[>] identifier[ns] operator[=] Keyword[new] identifier[Vector] operator[<] identifier[String] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Vector] operator[<] identifier[ColumnType] operator[>] identifier[ts] operator[=] Keyword[new] identifier[Vector] operator[<] identifier[ColumnType] operator[>] operator[SEP] operator[SEP] operator[SEP] Keyword[try] {
Keyword[final] identifier[StringReader] identifier[sr] operator[=] Keyword[new] identifier[StringReader] operator[SEP] identifier[csvArea] operator[SEP] identifier[getText] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[r] operator[=] Keyword[new] identifier[BufferedReader] operator[SEP] identifier[sr] operator[SEP] operator[SEP] identifier[String] identifier[line] , identifier[n] operator[SEP] identifier[ColumnType] identifier[t] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[1] , identifier[o] operator[=] Other[0] , identifier[l] operator[=] Other[0] , identifier[x] operator[=] operator[-] Other[1] operator[SEP] operator[SEP] identifier[line] operator[=] identifier[r] operator[SEP] identifier[readLine] operator[SEP] operator[SEP] operator[SEP] operator[!=] Other[null] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[l] operator[=] identifier[line] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] operator[SEP] identifier[x] operator[=] identifier[line] operator[SEP] identifier[indexOf] operator[SEP] literal[String] operator[SEP] operator[SEP] operator[==] operator[-] Other[1] operator[SEP] {
identifier[JOptionPane] operator[SEP] identifier[showMessageDialog] operator[SEP] identifier[dlg] , literal[String] operator[+] identifier[i] , literal[String] , identifier[JOptionPane] operator[SEP] identifier[ERROR_MESSAGE] operator[SEP] operator[SEP] identifier[csvArea] operator[SEP] identifier[select] operator[SEP] identifier[o] , identifier[o] operator[+] identifier[l] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[t] operator[=] identifier[ColumnType] operator[SEP] identifier[typeFor] operator[SEP] identifier[line] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[x] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[t] operator[==] Other[null] operator[SEP] {
identifier[JOptionPane] operator[SEP] identifier[showMessageDialog] operator[SEP] identifier[dlg] , literal[String] operator[+] identifier[i] operator[+] literal[String] operator[+] identifier[line] operator[SEP] identifier[substring] operator[SEP] Other[0] , identifier[x] operator[SEP] , literal[String] , identifier[JOptionPane] operator[SEP] identifier[ERROR_MESSAGE] operator[SEP] operator[SEP] identifier[csvArea] operator[SEP] identifier[select] operator[SEP] identifier[o] , identifier[o] operator[+] identifier[x] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[n] operator[=] identifier[line] operator[SEP] identifier[substring] operator[SEP] identifier[x] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[n] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[==] Other[0] operator[SEP] {
identifier[JOptionPane] operator[SEP] identifier[showMessageDialog] operator[SEP] identifier[dlg] , literal[String] operator[+] identifier[i] , literal[String] , identifier[JOptionPane] operator[SEP] identifier[ERROR_MESSAGE] operator[SEP] operator[SEP] identifier[csvArea] operator[SEP] identifier[setCaretPosition] operator[SEP] identifier[o] operator[+] identifier[x] operator[+] Other[1] operator[SEP] operator[SEP] Keyword[return] operator[SEP]
}
identifier[ns] operator[SEP] identifier[add] operator[SEP] identifier[n] operator[SEP] operator[SEP] identifier[ts] operator[SEP] identifier[add] operator[SEP] identifier[t] operator[SEP] operator[SEP] identifier[o] operator[+=] identifier[l] operator[+] Other[1] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[finally] {
Keyword[if] operator[SEP] identifier[r] operator[!=] Other[null] operator[SEP] {
Keyword[try] {
identifier[r] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[e] operator[SEP] identifier[printStackTrace] operator[SEP] operator[SEP] operator[SEP]
}
}
}
identifier[cf] operator[SEP] identifier[apply] operator[SEP] identifier[ImmutablePair] operator[SEP] identifier[of] operator[SEP] identifier[ns] , identifier[ts] operator[SEP] operator[SEP] operator[SEP] identifier[dlg] operator[SEP] identifier[dispose] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[update] operator[SEP] identifier[putValue] operator[SEP] identifier[Action] operator[SEP] identifier[NAME] , literal[String] operator[SEP] operator[SEP] identifier[update] operator[SEP] identifier[putValue] operator[SEP] identifier[Action] operator[SEP] identifier[SHORT_DESCRIPTION] , literal[String] operator[SEP] operator[SEP] identifier[update] operator[SEP] identifier[putValue] operator[SEP] identifier[Action] operator[SEP] identifier[MNEMONIC_KEY] , identifier[KeyEvent] operator[SEP] identifier[VK_U] operator[SEP] operator[SEP] identifier[update] operator[SEP] identifier[setEnabled] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[final] identifier[JButton] identifier[updateBut] operator[=] Keyword[new] identifier[JButton] operator[SEP] identifier[update] operator[SEP] operator[SEP] identifier[Binder] operator[SEP] identifier[bind] operator[SEP] literal[String] , identifier[csvArea] , literal[String] , identifier[update] , Keyword[new] identifier[BindingOptionMap] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[BindingKey] operator[SEP] identifier[INPUT_TRANSFORMER] , identifier[StringLengthToBooleanTransformer] operator[SEP] identifier[getTrimmingInstance] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[add] operator[SEP] identifier[TextBindingKey] operator[SEP] identifier[CONTINUOUSLY_UPDATE_VALUE] operator[SEP] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[setLayout] operator[SEP] identifier[layout] operator[SEP] operator[SEP] identifier[layout] operator[SEP] identifier[setAutoCreateGaps] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[layout] operator[SEP] identifier[setAutoCreateContainerGaps] operator[SEP] literal[boolean] operator[SEP] operator[SEP] Keyword[final] identifier[GroupLayout] operator[SEP] identifier[SequentialGroup] identifier[vgroup] operator[=] identifier[layout] operator[SEP] identifier[createSequentialGroup] operator[SEP] operator[SEP] operator[SEP] identifier[addComponent] operator[SEP] identifier[dialogLabel] operator[SEP] operator[SEP] identifier[addComponent] operator[SEP] identifier[useLabel] operator[SEP] operator[SEP] identifier[addComponent] operator[SEP] identifier[csvPanel] , identifier[GroupLayout] operator[SEP] identifier[PREFERRED_SIZE] , identifier[GroupLayout] operator[SEP] identifier[DEFAULT_SIZE] , identifier[Short] operator[SEP] identifier[MAX_VALUE] operator[SEP] operator[SEP] identifier[addComponent] operator[SEP] identifier[updateBut] operator[SEP] operator[SEP] Keyword[final] identifier[GroupLayout] operator[SEP] identifier[ParallelGroup] identifier[hgroup] operator[=] identifier[layout] operator[SEP] identifier[createParallelGroup] operator[SEP] identifier[Alignment] operator[SEP] identifier[LEADING] operator[SEP] operator[SEP] identifier[addComponent] operator[SEP] identifier[dialogLabel] operator[SEP] operator[SEP] identifier[addComponent] operator[SEP] identifier[useLabel] operator[SEP] operator[SEP] identifier[addComponent] operator[SEP] identifier[csvPanel] operator[SEP] operator[SEP] identifier[addGroup] operator[SEP] identifier[layout] operator[SEP] identifier[createSequentialGroup] operator[SEP] operator[SEP] operator[SEP] identifier[addPreferredGap] operator[SEP] identifier[LayoutStyle] operator[SEP] identifier[ComponentPlacement] operator[SEP] identifier[RELATED] , identifier[GroupLayout] operator[SEP] identifier[DEFAULT_SIZE] , identifier[Short] operator[SEP] identifier[MAX_VALUE] operator[SEP] operator[SEP] identifier[addComponent] operator[SEP] identifier[updateBut] operator[SEP] operator[SEP] operator[SEP] identifier[layout] operator[SEP] identifier[setVerticalGroup] operator[SEP] identifier[vgroup] operator[SEP] operator[SEP] identifier[layout] operator[SEP] identifier[setHorizontalGroup] operator[SEP] identifier[hgroup] operator[SEP] operator[SEP] identifier[dlg] operator[SEP] identifier[setModal] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[dlg] operator[SEP] identifier[setDefaultCloseOperation] operator[SEP] identifier[JDialog] operator[SEP] identifier[DISPOSE_ON_CLOSE] operator[SEP] operator[SEP] identifier[dlg] operator[SEP] identifier[setMinimumSize] operator[SEP] Keyword[new] identifier[Dimension] operator[SEP] identifier[frm] operator[SEP] identifier[getWidth] operator[SEP] operator[SEP] , identifier[frm] operator[SEP] identifier[getHeight] operator[SEP] operator[SEP] operator[/] Other[3] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[KeyAdapter] identifier[kl] operator[=] Keyword[new] identifier[KeyAdapter] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[keyReleased] operator[SEP] identifier[KeyEvent] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getKeyCode] operator[SEP] operator[SEP] operator[==] identifier[KeyEvent] operator[SEP] identifier[VK_ESCAPE] operator[SEP] identifier[dlg] operator[SEP] identifier[dispose] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[dlg] operator[SEP] identifier[addKeyListener] operator[SEP] identifier[kl] operator[SEP] operator[SEP] identifier[content] operator[SEP] identifier[addKeyListener] operator[SEP] identifier[kl] operator[SEP] operator[SEP] identifier[csvArea] operator[SEP] identifier[addKeyListener] operator[SEP] identifier[kl] operator[SEP] operator[SEP] Keyword[final] identifier[KeyAdapter] identifier[editKeys] operator[=] Keyword[new] identifier[KeyAdapter] operator[SEP] operator[SEP] {
Keyword[public] Keyword[void] identifier[keyReleased] operator[SEP] Keyword[final] identifier[KeyEvent] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[e] operator[SEP] identifier[getKeyCode] operator[SEP] operator[SEP] operator[==] identifier[KeyEvent] operator[SEP] identifier[VK_U] operator[&&] identifier[e] operator[SEP] identifier[isControlDown] operator[SEP] operator[SEP] operator[SEP] identifier[updateBut] operator[SEP] identifier[doClick] operator[SEP] operator[SEP] operator[SEP]
}
} operator[SEP] identifier[content] operator[SEP] identifier[addKeyListener] operator[SEP] identifier[editKeys] operator[SEP] operator[SEP] identifier[csvArea] operator[SEP] identifier[addKeyListener] operator[SEP] identifier[editKeys] operator[SEP] operator[SEP] identifier[csvArea] operator[SEP] identifier[grabFocus] operator[SEP] operator[SEP] operator[SEP] Keyword[final] Keyword[int] identifier[len] operator[=] identifier[colNames] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuffer] identifier[line] operator[=] Keyword[new] identifier[StringBuffer] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] , identifier[o] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[len] operator[SEP] identifier[i] operator[++] operator[SEP] {
identifier[line] operator[SEP] identifier[setLength] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[line] operator[SEP] identifier[append] operator[SEP] identifier[colTypes] operator[SEP] identifier[elementAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[colNames] operator[SEP] identifier[elementAt] operator[SEP] identifier[i] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] Keyword[try] {
identifier[doc] operator[SEP] identifier[insertString] operator[SEP] identifier[o] , identifier[line] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , Other[null] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[RuntimeException] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP]
}
identifier[o] operator[+=] identifier[line] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP]
}
identifier[csvArea] operator[SEP] identifier[setEditable] operator[SEP] literal[boolean] operator[SEP] operator[SEP] identifier[dlg] operator[SEP] identifier[pack] operator[SEP] operator[SEP] operator[SEP] identifier[dlg] operator[SEP] identifier[setLocationRelativeTo] operator[SEP] Other[null] operator[SEP] operator[SEP] identifier[dlg] operator[SEP] identifier[setVisible] operator[SEP] literal[boolean] operator[SEP] operator[SEP]
}
|
public boolean isCharCommand(final ICmdLineArg<?> argDef)
{
return argDef.getKeychar() != null && isCharCommand() && (charCommand() == argDef.getKeychar().charValue());
} | class class_name[name] begin[{]
method[isCharCommand, return_type[type[boolean]], modifier[public], parameter[argDef]] begin[{]
return[binary_operation[binary_operation[binary_operation[call[argDef.getKeychar, parameter[]], !=, literal[null]], &&, call[.isCharCommand, parameter[]]], &&, binary_operation[call[.charCommand, parameter[]], ==, call[argDef.getKeychar, parameter[]]]]]
end[}]
END[}] | Keyword[public] Keyword[boolean] identifier[isCharCommand] operator[SEP] Keyword[final] identifier[ICmdLineArg] operator[<] operator[?] operator[>] identifier[argDef] operator[SEP] {
Keyword[return] identifier[argDef] operator[SEP] identifier[getKeychar] operator[SEP] operator[SEP] operator[!=] Other[null] operator[&&] identifier[isCharCommand] operator[SEP] operator[SEP] operator[&&] operator[SEP] identifier[charCommand] operator[SEP] operator[SEP] operator[==] identifier[argDef] operator[SEP] identifier[getKeychar] operator[SEP] operator[SEP] operator[SEP] identifier[charValue] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
|
public long getId(final String agent) {
try {
return worker.getId(agent);
} catch (final InvalidUserAgentError e) {
LOGGER.error("Invalid user agent ({})", agent);
throw new SnowizardException(Response.Status.BAD_REQUEST,
"Invalid User-Agent header", e);
} catch (final InvalidSystemClock e) {
LOGGER.error("Invalid system clock", e);
throw new SnowizardException(Response.Status.INTERNAL_SERVER_ERROR,
e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[getId, return_type[type[long]], modifier[public], parameter[agent]] begin[{]
TryStatement(block=[ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=agent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getId, postfix_operators=[], prefix_operators=[], qualifier=worker, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid user agent ({})"), MemberReference(member=agent, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=BAD_REQUEST, postfix_operators=[], prefix_operators=[], qualifier=Response.Status, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid User-Agent header"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SnowizardException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvalidUserAgentError'])), CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid system clock"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=LOGGER, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=ClassCreator(arguments=[MemberReference(member=INTERNAL_SERVER_ERROR, postfix_operators=[], prefix_operators=[], qualifier=Response.Status, selectors=[]), MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SnowizardException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['InvalidSystemClock']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[long] identifier[getId] operator[SEP] Keyword[final] identifier[String] identifier[agent] operator[SEP] {
Keyword[try] {
Keyword[return] identifier[worker] operator[SEP] identifier[getId] operator[SEP] identifier[agent] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[InvalidUserAgentError] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[agent] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SnowizardException] operator[SEP] identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[BAD_REQUEST] , literal[String] , identifier[e] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] Keyword[final] identifier[InvalidSystemClock] identifier[e] operator[SEP] {
identifier[LOGGER] operator[SEP] identifier[error] operator[SEP] literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] Keyword[new] identifier[SnowizardException] operator[SEP] identifier[Response] operator[SEP] identifier[Status] operator[SEP] identifier[INTERNAL_SERVER_ERROR] , identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public String decryptValue(final String symmetricKey,final String value) {
return getEncryptor(symmetricKey).decrypt(value);
} | class class_name[name] begin[{]
method[decryptValue, return_type[type[String]], modifier[public], parameter[symmetricKey, value]] begin[{]
return[call[.getEncryptor, parameter[member[.symmetricKey]]]]
end[}]
END[}] | Keyword[public] identifier[String] identifier[decryptValue] operator[SEP] Keyword[final] identifier[String] identifier[symmetricKey] , Keyword[final] identifier[String] identifier[value] operator[SEP] {
Keyword[return] identifier[getEncryptor] operator[SEP] identifier[symmetricKey] operator[SEP] operator[SEP] identifier[decrypt] operator[SEP] identifier[value] operator[SEP] operator[SEP]
}
|
public static boolean validateIntegerParam(final Map<String, String> params,
final String paramName) throws ExecutorManagerException {
if (params != null && params.containsKey(paramName)
&& !StringUtils.isNumeric(params.get(paramName))) {
throw new ExecutorManagerException(paramName + " should be an integer");
}
return true;
} | class class_name[name] begin[{]
method[validateIntegerParam, return_type[type[boolean]], modifier[public static], parameter[params, paramName]] begin[{]
if[binary_operation[binary_operation[binary_operation[member[.params], !=, literal[null]], &&, call[params.containsKey, parameter[member[.paramName]]]], &&, call[StringUtils.isNumeric, parameter[call[params.get, parameter[member[.paramName]]]]]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=MemberReference(member=paramName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=" should be an integer"), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExecutorManagerException, sub_type=None)), label=None)
else begin[{]
None
end[}]
return[literal[true]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[boolean] identifier[validateIntegerParam] operator[SEP] Keyword[final] identifier[Map] operator[<] identifier[String] , identifier[String] operator[>] identifier[params] , Keyword[final] identifier[String] identifier[paramName] operator[SEP] Keyword[throws] identifier[ExecutorManagerException] {
Keyword[if] operator[SEP] identifier[params] operator[!=] Other[null] operator[&&] identifier[params] operator[SEP] identifier[containsKey] operator[SEP] identifier[paramName] operator[SEP] operator[&&] operator[!] identifier[StringUtils] operator[SEP] identifier[isNumeric] operator[SEP] identifier[params] operator[SEP] identifier[get] operator[SEP] identifier[paramName] operator[SEP] operator[SEP] operator[SEP] {
Keyword[throw] Keyword[new] identifier[ExecutorManagerException] operator[SEP] identifier[paramName] operator[+] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] literal[boolean] operator[SEP]
}
|
public static String toSingleLineWKT(CoordinateReferenceSystem crs) {
String wkt = null;
try {
// this is a lenient transformation, works with polar stereographics too
Formattable formattable = (Formattable) crs;
wkt = formattable.toWKT(0, false);
} catch (ClassCastException e) {
wkt = crs.toWKT();
}
wkt = wkt.replaceAll("\n", "").replaceAll(" ", "");
return wkt;
} | class class_name[name] begin[{]
method[toSingleLineWKT, return_type[type[String]], modifier[public static], parameter[crs]] begin[{]
local_variable[type[String], wkt]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=Cast(expression=MemberReference(member=crs, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type=ReferenceType(arguments=None, dimensions=[], name=Formattable, sub_type=None)), name=formattable)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Formattable, sub_type=None)), StatementExpression(expression=Assignment(expressionl=MemberReference(member=wkt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=false)], member=toWKT, postfix_operators=[], prefix_operators=[], qualifier=formattable, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=wkt, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[], member=toWKT, postfix_operators=[], prefix_operators=[], qualifier=crs, selectors=[], type_arguments=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['ClassCastException']))], finally_block=None, label=None, resources=None)
assign[member[.wkt], call[wkt.replaceAll, parameter[literal["\n"], literal[""]]]]
return[member[.wkt]]
end[}]
END[}] | Keyword[public] Keyword[static] identifier[String] identifier[toSingleLineWKT] operator[SEP] identifier[CoordinateReferenceSystem] identifier[crs] operator[SEP] {
identifier[String] identifier[wkt] operator[=] Other[null] operator[SEP] Keyword[try] {
identifier[Formattable] identifier[formattable] operator[=] operator[SEP] identifier[Formattable] operator[SEP] identifier[crs] operator[SEP] identifier[wkt] operator[=] identifier[formattable] operator[SEP] identifier[toWKT] operator[SEP] Other[0] , literal[boolean] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[ClassCastException] identifier[e] operator[SEP] {
identifier[wkt] operator[=] identifier[crs] operator[SEP] identifier[toWKT] operator[SEP] operator[SEP] operator[SEP]
}
identifier[wkt] operator[=] identifier[wkt] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] identifier[replaceAll] operator[SEP] literal[String] , literal[String] operator[SEP] operator[SEP] Keyword[return] identifier[wkt] operator[SEP]
}
|
@Override
public com.liferay.commerce.product.model.CPOptionValue fetchCPOptionValueByUuidAndGroupId(
String uuid, long groupId) {
return _cpOptionValueLocalService.fetchCPOptionValueByUuidAndGroupId(uuid,
groupId);
} | class class_name[name] begin[{]
method[fetchCPOptionValueByUuidAndGroupId, return_type[type[com]], modifier[public], parameter[uuid, groupId]] begin[{]
return[call[_cpOptionValueLocalService.fetchCPOptionValueByUuidAndGroupId, parameter[member[.uuid], member[.groupId]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[com] operator[SEP] identifier[liferay] operator[SEP] identifier[commerce] operator[SEP] identifier[product] operator[SEP] identifier[model] operator[SEP] identifier[CPOptionValue] identifier[fetchCPOptionValueByUuidAndGroupId] operator[SEP] identifier[String] identifier[uuid] , Keyword[long] identifier[groupId] operator[SEP] {
Keyword[return] identifier[_cpOptionValueLocalService] operator[SEP] identifier[fetchCPOptionValueByUuidAndGroupId] operator[SEP] identifier[uuid] , identifier[groupId] operator[SEP] operator[SEP]
}
|
@SuppressWarnings({ "unchecked", "rawtypes" })
void startPreTouch(final PrepareJspHelperFactory prepareJspHelperFactory) {
// @BLB Begin Pretouch
if (this.jspOptions.isPrepareJSPsSet()) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "JSPExtensionProcessor", "PrepareJSPs attribute is: " + this.jspOptions.getPrepareJSPs());
}
try {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "JSPExtensionProcessor", "Starting the Pretouch Thread ");
}
PreTouchThreadStarter preTouchThread =
new PreTouchThreadStarter(prepareJspHelperFactory.createPrepareJspHelper(this, webapp, jspOptions));
AccessController.doPrivileged(preTouchThread);
} catch (Exception ex) {
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, "JSPExtensionProcessor", "Pretouch threw an unexpected exception: ", ex);
}
}
}
// @BLB End Pretouch
} | class class_name[name] begin[{]
method[startPreTouch, return_type[void], modifier[default], parameter[prepareJspHelperFactory]] begin[{]
if[THIS[member[None.jspOptions]call[None.isPrepareJSPsSet, parameter[]]]] begin[{]
if[binary_operation[call[com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled, parameter[]], &&, call[logger.isLoggable, parameter[member[Level.FINE]]]]] begin[{]
call[logger.logp, parameter[member[Level.FINE], member[.CLASS_NAME], literal["JSPExtensionProcessor"], binary_operation[literal["PrepareJSPs attribute is: "], +, THIS[member[None.jspOptions]call[None.getPrepareJSPs, parameter[]]]]]]
else begin[{]
None
end[}]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=com.ibm.ejs.ras.TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], member=isLoggable, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="JSPExtensionProcessor"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Starting the Pretouch Thread ")], member=logp, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)])), LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=ClassCreator(arguments=[MethodInvocation(arguments=[This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[]), MemberReference(member=webapp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=jspOptions, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createPrepareJspHelper, postfix_operators=[], prefix_operators=[], qualifier=prepareJspHelperFactory, selectors=[], type_arguments=None)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=PreTouchThreadStarter, sub_type=None)), name=preTouchThread)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=PreTouchThreadStarter, sub_type=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=preTouchThread, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=doPrivileged, postfix_operators=[], prefix_operators=[], qualifier=AccessController, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=isAnyTracingEnabled, postfix_operators=[], prefix_operators=[], qualifier=com.ibm.ejs.ras.TraceComponent, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[])], member=isLoggable, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), operator=&&), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=FINE, postfix_operators=[], prefix_operators=[], qualifier=Level, selectors=[]), MemberReference(member=CLASS_NAME, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="JSPExtensionProcessor"), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Pretouch threw an unexpected exception: "), MemberReference(member=ex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=logp, postfix_operators=[], prefix_operators=[], qualifier=logger, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=ex, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | annotation[@] identifier[SuppressWarnings] operator[SEP] {
literal[String] , literal[String]
} operator[SEP] Keyword[void] identifier[startPreTouch] operator[SEP] Keyword[final] identifier[PrepareJspHelperFactory] identifier[prepareJspHelperFactory] operator[SEP] {
Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[jspOptions] operator[SEP] identifier[isPrepareJSPsSet] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[CLASS_NAME] , literal[String] , literal[String] operator[+] Keyword[this] operator[SEP] identifier[jspOptions] operator[SEP] identifier[getPrepareJSPs] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[try] {
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[CLASS_NAME] , literal[String] , literal[String] operator[SEP] operator[SEP]
}
identifier[PreTouchThreadStarter] identifier[preTouchThread] operator[=] Keyword[new] identifier[PreTouchThreadStarter] operator[SEP] identifier[prepareJspHelperFactory] operator[SEP] identifier[createPrepareJspHelper] operator[SEP] Keyword[this] , identifier[webapp] , identifier[jspOptions] operator[SEP] operator[SEP] operator[SEP] identifier[AccessController] operator[SEP] identifier[doPrivileged] operator[SEP] identifier[preTouchThread] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[ex] operator[SEP] {
Keyword[if] operator[SEP] identifier[com] operator[SEP] identifier[ibm] operator[SEP] identifier[ejs] operator[SEP] identifier[ras] operator[SEP] identifier[TraceComponent] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[logger] operator[SEP] identifier[isLoggable] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] operator[SEP] operator[SEP] {
identifier[logger] operator[SEP] identifier[logp] operator[SEP] identifier[Level] operator[SEP] identifier[FINE] , identifier[CLASS_NAME] , literal[String] , literal[String] , identifier[ex] operator[SEP] operator[SEP]
}
}
}
}
|
@Override
public Object getObject(int columnIndex) throws SQLException {
checkColumnBounds(columnIndex);
try {
VoltType type = table.getColumnType(columnIndex - 1);
if (type == VoltType.TIMESTAMP)
return getTimestamp(columnIndex);
else
return table.get(columnIndex - 1, type);
} catch (Exception x) {
throw SQLError.get(x);
}
} | class class_name[name] begin[{]
method[getObject, return_type[type[Object]], modifier[public], parameter[columnIndex]] begin[{]
call[.checkColumnBounds, parameter[member[.columnIndex]]]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=columnIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-)], member=getColumnType, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None), name=type)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=VoltType, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=TIMESTAMP, postfix_operators=[], prefix_operators=[], qualifier=VoltType, selectors=[]), operator===), else_statement=ReturnStatement(expression=MethodInvocation(arguments=[BinaryOperation(operandl=MemberReference(member=columnIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=1), operator=-), MemberReference(member=type, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=table, selectors=[], type_arguments=None), label=None), label=None, then_statement=ReturnStatement(expression=MethodInvocation(arguments=[MemberReference(member=columnIndex, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=getTimestamp, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None))], catches=[CatchClause(block=[ThrowStatement(expression=MethodInvocation(arguments=[MemberReference(member=x, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=get, postfix_operators=[], prefix_operators=[], qualifier=SQLError, selectors=[], type_arguments=None), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=x, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[Object] identifier[getObject] operator[SEP] Keyword[int] identifier[columnIndex] operator[SEP] Keyword[throws] identifier[SQLException] {
identifier[checkColumnBounds] operator[SEP] identifier[columnIndex] operator[SEP] operator[SEP] Keyword[try] {
identifier[VoltType] identifier[type] operator[=] identifier[table] operator[SEP] identifier[getColumnType] operator[SEP] identifier[columnIndex] operator[-] Other[1] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[type] operator[==] identifier[VoltType] operator[SEP] identifier[TIMESTAMP] operator[SEP] Keyword[return] identifier[getTimestamp] operator[SEP] identifier[columnIndex] operator[SEP] operator[SEP] Keyword[else] Keyword[return] identifier[table] operator[SEP] identifier[get] operator[SEP] identifier[columnIndex] operator[-] Other[1] , identifier[type] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[x] operator[SEP] {
Keyword[throw] identifier[SQLError] operator[SEP] identifier[get] operator[SEP] identifier[x] operator[SEP] operator[SEP]
}
}
|
private SSLSocketFactory getSocketFactory(String id) throws IOException {
// first use?
SSLSocketFactory socketFactory = socketFactoryMap.get(id);
if (socketFactory == null) {
// the SSLConfig is optional, so if it's not there, use the default SSLSocketFactory.
if (id == null) {
socketFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
} else {
// ask the SSLConfig bean to create a factory for us.
try {
socketFactory = sslConfig.createSSLFactory(id);
} catch (Exception e) {
Tr.error(tc, "Unable to create client SSL socket factory", e);
throw (IOException) new IOException("Unable to create client SSL socket factory: " + e.getMessage()).initCause(e);
}
}
socketFactoryMap.put(id, socketFactory);
}
return socketFactory;
} | class class_name[name] begin[{]
method[getSocketFactory, return_type[type[SSLSocketFactory]], modifier[private], parameter[id]] begin[{]
local_variable[type[SSLSocketFactory], socketFactory]
if[binary_operation[member[.socketFactory], ==, literal[null]]] begin[{]
if[binary_operation[member[.id], ==, literal[null]]] begin[{]
assign[member[.socketFactory], Cast(expression=MethodInvocation(arguments=[], member=getDefault, postfix_operators=[], prefix_operators=[], qualifier=SSLSocketFactory, selectors=[], type_arguments=None), type=ReferenceType(arguments=None, dimensions=[], name=SSLSocketFactory, sub_type=None))]
else begin[{]
TryStatement(block=[StatementExpression(expression=Assignment(expressionl=MemberReference(member=socketFactory, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), type==, value=MethodInvocation(arguments=[MemberReference(member=id, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createSSLFactory, postfix_operators=[], prefix_operators=[], qualifier=sslConfig, selectors=[], type_arguments=None)), label=None)], catches=[CatchClause(block=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=tc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to create client SSL socket factory"), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=error, postfix_operators=[], prefix_operators=[], qualifier=Tr, selectors=[], type_arguments=None), label=None), ThrowStatement(expression=Cast(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to create client SSL socket factory: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MethodInvocation(arguments=[MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=initCause, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type=ReferenceType(arguments=None, dimensions=None, name=IOException, sub_type=None)), type=ReferenceType(arguments=None, dimensions=[], name=IOException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
call[socketFactoryMap.put, parameter[member[.id], member[.socketFactory]]]
else begin[{]
None
end[}]
return[member[.socketFactory]]
end[}]
END[}] | Keyword[private] identifier[SSLSocketFactory] identifier[getSocketFactory] operator[SEP] identifier[String] identifier[id] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[SSLSocketFactory] identifier[socketFactory] operator[=] identifier[socketFactoryMap] operator[SEP] identifier[get] operator[SEP] identifier[id] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[socketFactory] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[id] operator[==] Other[null] operator[SEP] {
identifier[socketFactory] operator[=] operator[SEP] identifier[SSLSocketFactory] operator[SEP] identifier[SSLSocketFactory] operator[SEP] identifier[getDefault] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[else] {
Keyword[try] {
identifier[socketFactory] operator[=] identifier[sslConfig] operator[SEP] identifier[createSSLFactory] operator[SEP] identifier[id] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
identifier[Tr] operator[SEP] identifier[error] operator[SEP] identifier[tc] , literal[String] , identifier[e] operator[SEP] operator[SEP] Keyword[throw] operator[SEP] identifier[IOException] operator[SEP] Keyword[new] identifier[IOException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[initCause] operator[SEP] identifier[e] operator[SEP] operator[SEP]
}
}
identifier[socketFactoryMap] operator[SEP] identifier[put] operator[SEP] identifier[id] , identifier[socketFactory] operator[SEP] operator[SEP]
}
Keyword[return] identifier[socketFactory] operator[SEP]
}
|
public SourceSnippet createFieldInjections(Iterable<FieldLiteral<?>> fields, String injecteeName,
NameGenerator nameGenerator, List<InjectorMethod> methodsOutput)
throws NoSourceNameException {
SourceSnippetBuilder methodInvocations = new SourceSnippetBuilder();
for (FieldLiteral<?> field : fields) {
methodInvocations
.append(createFieldInjection(field, injecteeName, nameGenerator, methodsOutput))
.append("\n");
}
return methodInvocations.build();
} | class class_name[name] begin[{]
method[createFieldInjections, return_type[type[SourceSnippet]], modifier[public], parameter[fields, injecteeName, nameGenerator, methodsOutput]] begin[{]
local_variable[type[SourceSnippetBuilder], methodInvocations]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[MemberReference(member=field, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=injecteeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=nameGenerator, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=methodsOutput, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=createFieldInjection, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None)], member=append, postfix_operators=[], prefix_operators=[], qualifier=methodInvocations, selectors=[MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="\n")], member=append, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=fields, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=field)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=?, type=None)], dimensions=[], name=FieldLiteral, sub_type=None))), label=None)
return[call[methodInvocations.build, parameter[]]]
end[}]
END[}] | Keyword[public] identifier[SourceSnippet] identifier[createFieldInjections] operator[SEP] identifier[Iterable] operator[<] identifier[FieldLiteral] operator[<] operator[?] operator[>] operator[>] identifier[fields] , identifier[String] identifier[injecteeName] , identifier[NameGenerator] identifier[nameGenerator] , identifier[List] operator[<] identifier[InjectorMethod] operator[>] identifier[methodsOutput] operator[SEP] Keyword[throws] identifier[NoSourceNameException] {
identifier[SourceSnippetBuilder] identifier[methodInvocations] operator[=] Keyword[new] identifier[SourceSnippetBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] identifier[FieldLiteral] operator[<] operator[?] operator[>] identifier[field] operator[:] identifier[fields] operator[SEP] {
identifier[methodInvocations] operator[SEP] identifier[append] operator[SEP] identifier[createFieldInjection] operator[SEP] identifier[field] , identifier[injecteeName] , identifier[nameGenerator] , identifier[methodsOutput] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[return] identifier[methodInvocations] operator[SEP] identifier[build] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void downloadAsync(String url, String file, HttpCallback<File> callback) {
downloadAsync(url, file, null, callback, new StrParam[0]);
} | class class_name[name] begin[{]
method[downloadAsync, return_type[void], modifier[public static], parameter[url, file, callback]] begin[{]
call[.downloadAsync, parameter[member[.url], member[.file], literal[null], member[.callback], ArrayCreator(dimensions=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], initializer=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=StrParam, sub_type=None))]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[downloadAsync] operator[SEP] identifier[String] identifier[url] , identifier[String] identifier[file] , identifier[HttpCallback] operator[<] identifier[File] operator[>] identifier[callback] operator[SEP] {
identifier[downloadAsync] operator[SEP] identifier[url] , identifier[file] , Other[null] , identifier[callback] , Keyword[new] identifier[StrParam] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP]
}
|
public static void escapeHtml5(final String text, final Writer writer)
throws IOException {
escapeHtml(text, writer, HtmlEscapeType.HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL,
HtmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT);
} | class class_name[name] begin[{]
method[escapeHtml5, return_type[void], modifier[public static], parameter[text, writer]] begin[{]
call[.escapeHtml, parameter[member[.text], member[.writer], member[HtmlEscapeType.HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL], member[HtmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT]]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[void] identifier[escapeHtml5] operator[SEP] Keyword[final] identifier[String] identifier[text] , Keyword[final] identifier[Writer] identifier[writer] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[escapeHtml] operator[SEP] identifier[text] , identifier[writer] , identifier[HtmlEscapeType] operator[SEP] identifier[HTML5_NAMED_REFERENCES_DEFAULT_TO_DECIMAL] , identifier[HtmlEscapeLevel] operator[SEP] identifier[LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT] operator[SEP] operator[SEP]
}
|
public void marshall(ImportCatalogToGlueRequest importCatalogToGlueRequest, ProtocolMarshaller protocolMarshaller) {
if (importCatalogToGlueRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(importCatalogToGlueRequest.getCatalogId(), CATALOGID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[importCatalogToGlueRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.importCatalogToGlueRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getCatalogId, postfix_operators=[], prefix_operators=[], qualifier=importCatalogToGlueRequest, selectors=[], type_arguments=None), MemberReference(member=CATALOGID_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[ImportCatalogToGlueRequest] identifier[importCatalogToGlueRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[importCatalogToGlueRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[importCatalogToGlueRequest] operator[SEP] identifier[getCatalogId] operator[SEP] operator[SEP] , identifier[CATALOGID_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
public void getAPIInfo(String API, Callback<TokenInfo> callback) throws GuildWars2Exception, NullPointerException {
isParamValid(new ParamChecker(ParamType.API, API));
gw2API.getAPIInfo(API).enqueue(callback);
} | class class_name[name] begin[{]
method[getAPIInfo, return_type[void], modifier[public], parameter[API, callback]] begin[{]
call[.isParamValid, parameter[ClassCreator(arguments=[MemberReference(member=API, postfix_operators=[], prefix_operators=[], qualifier=ParamType, selectors=[]), MemberReference(member=API, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ParamChecker, sub_type=None))]]
call[gw2API.getAPIInfo, parameter[member[.API]]]
end[}]
END[}] | Keyword[public] Keyword[void] identifier[getAPIInfo] operator[SEP] identifier[String] identifier[API] , identifier[Callback] operator[<] identifier[TokenInfo] operator[>] identifier[callback] operator[SEP] Keyword[throws] identifier[GuildWars2Exception] , identifier[NullPointerException] {
identifier[isParamValid] operator[SEP] Keyword[new] identifier[ParamChecker] operator[SEP] identifier[ParamType] operator[SEP] identifier[API] , identifier[API] operator[SEP] operator[SEP] operator[SEP] identifier[gw2API] operator[SEP] identifier[getAPIInfo] operator[SEP] identifier[API] operator[SEP] operator[SEP] identifier[enqueue] operator[SEP] identifier[callback] operator[SEP] operator[SEP]
}
|
protected synchronized void dispose() {
this.users--;
if (this.users == 0) {
try {
Client currentClient = this.client.get();
if (currentClient != null) {
currentClient.close();
}
} catch (Exception x) {
// ignore
}
}
} | class class_name[name] begin[{]
method[dispose, return_type[void], modifier[synchronized protected], parameter[]] begin[{]
THIS[member[None.users]]
if[binary_operation[THIS[member[None.users]], ==, literal[0]]] begin[{]
TryStatement(block=[LocalVariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=[], initializer=This(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[MemberReference(member=client, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None), MethodInvocation(arguments=[], member=get, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)]), name=currentClient)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Client, sub_type=None)), IfStatement(condition=BinaryOperation(operandl=MemberReference(member=currentClient, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator=!=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[], member=close, postfix_operators=[], prefix_operators=[], qualifier=currentClient, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=x, types=['Exception']))], finally_block=None, label=None, resources=None)
else begin[{]
None
end[}]
end[}]
END[}] | Keyword[protected] Keyword[synchronized] Keyword[void] identifier[dispose] operator[SEP] operator[SEP] {
Keyword[this] operator[SEP] identifier[users] operator[--] operator[SEP] Keyword[if] operator[SEP] Keyword[this] operator[SEP] identifier[users] operator[==] Other[0] operator[SEP] {
Keyword[try] {
identifier[Client] identifier[currentClient] operator[=] Keyword[this] operator[SEP] identifier[client] operator[SEP] identifier[get] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[currentClient] operator[!=] Other[null] operator[SEP] {
identifier[currentClient] operator[SEP] identifier[close] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[x] operator[SEP] {
}
}
}
|
private static String hexFormat(int trgt) {
String s = Integer.toHexString(trgt);
int sz = s.length();
if (sz == 8) {
return s;
}
int fill = 8 - sz;
StringBuilder buf = new StringBuilder();
for (int i = 0; i < fill; ++i) {
// add leading zeros
buf.append('0');
}
buf.append(s);
return buf.toString();
} | class class_name[name] begin[{]
method[hexFormat, return_type[type[String]], modifier[private static], parameter[trgt]] begin[{]
local_variable[type[String], s]
local_variable[type[int], sz]
if[binary_operation[member[.sz], ==, literal[8]]] begin[{]
return[member[.s]]
else begin[{]
None
end[}]
local_variable[type[int], fill]
local_variable[type[StringBuilder], buf]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value='0')], member=append, postfix_operators=[], prefix_operators=[], qualifier=buf, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=BinaryOperation(operandl=MemberReference(member=i, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=MemberReference(member=fill, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operator=<), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), name=i)], modifiers=set(), type=BasicType(dimensions=[], name=int)), update=[MemberReference(member=i, postfix_operators=[], prefix_operators=['++'], qualifier=, selectors=[])]), label=None)
call[buf.append, parameter[member[.s]]]
return[call[buf.toString, parameter[]]]
end[}]
END[}] | Keyword[private] Keyword[static] identifier[String] identifier[hexFormat] operator[SEP] Keyword[int] identifier[trgt] operator[SEP] {
identifier[String] identifier[s] operator[=] identifier[Integer] operator[SEP] identifier[toHexString] operator[SEP] identifier[trgt] operator[SEP] operator[SEP] Keyword[int] identifier[sz] operator[=] identifier[s] operator[SEP] identifier[length] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[sz] operator[==] Other[8] operator[SEP] {
Keyword[return] identifier[s] operator[SEP]
}
Keyword[int] identifier[fill] operator[=] Other[8] operator[-] identifier[sz] operator[SEP] identifier[StringBuilder] identifier[buf] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[int] identifier[i] operator[=] Other[0] operator[SEP] identifier[i] operator[<] identifier[fill] operator[SEP] operator[++] identifier[i] operator[SEP] {
identifier[buf] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
identifier[buf] operator[SEP] identifier[append] operator[SEP] identifier[s] operator[SEP] operator[SEP] Keyword[return] identifier[buf] operator[SEP] identifier[toString] operator[SEP] operator[SEP] operator[SEP]
}
|
@Override
public DescribeAccountResult describeAccount(DescribeAccountRequest request) {
request = beforeClientExecution(request);
return executeDescribeAccount(request);
} | class class_name[name] begin[{]
method[describeAccount, return_type[type[DescribeAccountResult]], modifier[public], parameter[request]] begin[{]
assign[member[.request], call[.beforeClientExecution, parameter[member[.request]]]]
return[call[.executeDescribeAccount, parameter[member[.request]]]]
end[}]
END[}] | annotation[@] identifier[Override] Keyword[public] identifier[DescribeAccountResult] identifier[describeAccount] operator[SEP] identifier[DescribeAccountRequest] identifier[request] operator[SEP] {
identifier[request] operator[=] identifier[beforeClientExecution] operator[SEP] identifier[request] operator[SEP] operator[SEP] Keyword[return] identifier[executeDescribeAccount] operator[SEP] identifier[request] operator[SEP] operator[SEP]
}
|
public ObjectManagerByteArrayOutputStream[] getBuffers(ObjectManagerByteArrayOutputStream byteArrayOutputStream)
throws ObjectManagerException
{
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.entry(this,
cclass,
"getBuffers",
new Object[] { byteArrayOutputStream });
ObjectManagerByteArrayOutputStream[] buffers = new ObjectManagerByteArrayOutputStream[1];
// Create the buffer to contain the header for this log record.
byteArrayOutputStream.reset();
buffers[0] = byteArrayOutputStream;
buffers[0].writeInt(LogRecord.TYPE_PREPARE);
logicalUnitOfWork.writeSerializedBytes(buffers[0]);
if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
trace.exit(this,
cclass,
"getBuffers",
buffers);
return buffers;
} | class class_name[name] begin[{]
method[getBuffers, return_type[type[ObjectManagerByteArrayOutputStream]], modifier[public], parameter[byteArrayOutputStream]] begin[{]
if[binary_operation[call[Tracing.isAnyTracingEnabled, parameter[]], &&, call[trace.isEntryEnabled, parameter[]]]] begin[{]
call[trace.entry, parameter[THIS[], member[.cclass], literal["getBuffers"], ArrayCreator(dimensions=[None], initializer=ArrayInitializer(initializers=[MemberReference(member=byteArrayOutputStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])]), postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Object, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[ObjectManagerByteArrayOutputStream], buffers]
call[byteArrayOutputStream.reset, parameter[]]
assign[member[.buffers], member[.byteArrayOutputStream]]
member[.buffers]
call[logicalUnitOfWork.writeSerializedBytes, parameter[member[.buffers]]]
if[binary_operation[call[Tracing.isAnyTracingEnabled, parameter[]], &&, call[trace.isEntryEnabled, parameter[]]]] begin[{]
call[trace.exit, parameter[THIS[], member[.cclass], literal["getBuffers"], member[.buffers]]]
else begin[{]
None
end[}]
return[member[.buffers]]
end[}]
END[}] | Keyword[public] identifier[ObjectManagerByteArrayOutputStream] operator[SEP] operator[SEP] identifier[getBuffers] operator[SEP] identifier[ObjectManagerByteArrayOutputStream] identifier[byteArrayOutputStream] operator[SEP] Keyword[throws] identifier[ObjectManagerException] {
Keyword[if] operator[SEP] identifier[Tracing] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[trace] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[trace] operator[SEP] identifier[entry] operator[SEP] Keyword[this] , identifier[cclass] , literal[String] , Keyword[new] identifier[Object] operator[SEP] operator[SEP] {
identifier[byteArrayOutputStream]
} operator[SEP] operator[SEP] identifier[ObjectManagerByteArrayOutputStream] operator[SEP] operator[SEP] identifier[buffers] operator[=] Keyword[new] identifier[ObjectManagerByteArrayOutputStream] operator[SEP] Other[1] operator[SEP] operator[SEP] identifier[byteArrayOutputStream] operator[SEP] identifier[reset] operator[SEP] operator[SEP] operator[SEP] identifier[buffers] operator[SEP] Other[0] operator[SEP] operator[=] identifier[byteArrayOutputStream] operator[SEP] identifier[buffers] operator[SEP] Other[0] operator[SEP] operator[SEP] identifier[writeInt] operator[SEP] identifier[LogRecord] operator[SEP] identifier[TYPE_PREPARE] operator[SEP] operator[SEP] identifier[logicalUnitOfWork] operator[SEP] identifier[writeSerializedBytes] operator[SEP] identifier[buffers] operator[SEP] Other[0] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[Tracing] operator[SEP] identifier[isAnyTracingEnabled] operator[SEP] operator[SEP] operator[&&] identifier[trace] operator[SEP] identifier[isEntryEnabled] operator[SEP] operator[SEP] operator[SEP] identifier[trace] operator[SEP] identifier[exit] operator[SEP] Keyword[this] , identifier[cclass] , literal[String] , identifier[buffers] operator[SEP] operator[SEP] Keyword[return] identifier[buffers] operator[SEP]
}
|
public ReadWritePair openReadWrite(boolean isAutoFlush) throws IOException
{
clearStatusCache();
StreamImpl impl = openReadWriteImpl();
//impl.setPath(this);
WriteStreamOld writeStream = new WriteStreamOld(impl);
ReadStreamOld readStream;
if (isAutoFlush)
readStream = new ReadStreamOld(impl);
else
readStream = new ReadStreamOld(impl);
return new ReadWritePair(readStream, writeStream);
} | class class_name[name] begin[{]
method[openReadWrite, return_type[type[ReadWritePair]], modifier[public], parameter[isAutoFlush]] begin[{]
call[.clearStatusCache, parameter[]]
local_variable[type[StreamImpl], impl]
local_variable[type[WriteStreamOld], writeStream]
local_variable[type[ReadStreamOld], readStream]
if[member[.isAutoFlush]] begin[{]
assign[member[.readStream], ClassCreator(arguments=[MemberReference(member=impl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ReadStreamOld, sub_type=None))]
else begin[{]
assign[member[.readStream], ClassCreator(arguments=[MemberReference(member=impl, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ReadStreamOld, sub_type=None))]
end[}]
return[ClassCreator(arguments=[MemberReference(member=readStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=writeStream, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ReadWritePair, sub_type=None))]
end[}]
END[}] | Keyword[public] identifier[ReadWritePair] identifier[openReadWrite] operator[SEP] Keyword[boolean] identifier[isAutoFlush] operator[SEP] Keyword[throws] identifier[IOException] {
identifier[clearStatusCache] operator[SEP] operator[SEP] operator[SEP] identifier[StreamImpl] identifier[impl] operator[=] identifier[openReadWriteImpl] operator[SEP] operator[SEP] operator[SEP] identifier[WriteStreamOld] identifier[writeStream] operator[=] Keyword[new] identifier[WriteStreamOld] operator[SEP] identifier[impl] operator[SEP] operator[SEP] identifier[ReadStreamOld] identifier[readStream] operator[SEP] Keyword[if] operator[SEP] identifier[isAutoFlush] operator[SEP] identifier[readStream] operator[=] Keyword[new] identifier[ReadStreamOld] operator[SEP] identifier[impl] operator[SEP] operator[SEP] Keyword[else] identifier[readStream] operator[=] Keyword[new] identifier[ReadStreamOld] operator[SEP] identifier[impl] operator[SEP] operator[SEP] Keyword[return] Keyword[new] identifier[ReadWritePair] operator[SEP] identifier[readStream] , identifier[writeStream] operator[SEP] operator[SEP]
}
|
public static int writeShort(byte[] array, int offset, int v) {
array[offset + 0] = (byte) (v >>> 8);
array[offset + 1] = (byte) (v >>> 0);
return SIZE_SHORT;
} | class class_name[name] begin[{]
method[writeShort, return_type[type[int]], modifier[public static], parameter[array, offset, v]] begin[{]
assign[member[.array], Cast(expression=BinaryOperation(operandl=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=8), operator=>>>), type=BasicType(dimensions=[], name=byte))]
assign[member[.array], Cast(expression=BinaryOperation(operandl=MemberReference(member=v, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0), operator=>>>), type=BasicType(dimensions=[], name=byte))]
return[member[.SIZE_SHORT]]
end[}]
END[}] | Keyword[public] Keyword[static] Keyword[int] identifier[writeShort] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[array] , Keyword[int] identifier[offset] , Keyword[int] identifier[v] operator[SEP] {
identifier[array] operator[SEP] identifier[offset] operator[+] Other[0] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[v] operator[>] operator[>] operator[>] Other[8] operator[SEP] operator[SEP] identifier[array] operator[SEP] identifier[offset] operator[+] Other[1] operator[SEP] operator[=] operator[SEP] Keyword[byte] operator[SEP] operator[SEP] identifier[v] operator[>] operator[>] operator[>] Other[0] operator[SEP] operator[SEP] Keyword[return] identifier[SIZE_SHORT] operator[SEP]
}
|
private static void setChainIdsInResidueNumbers(Chain c, String newChainName) {
for (Group g:c.getAtomGroups()) {
g.setResidueNumber(newChainName, g.getResidueNumber().getSeqNum(), g.getResidueNumber().getInsCode());
}
for (Group g:c.getSeqResGroups()) {
if (g.getResidueNumber()==null) continue;
g.setResidueNumber(newChainName, g.getResidueNumber().getSeqNum(), g.getResidueNumber().getInsCode());
}
} | class class_name[name] begin[{]
method[setChainIdsInResidueNumbers, return_type[void], modifier[private static], parameter[c, newChainName]] begin[{]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=newChainName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getResidueNumber, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[MethodInvocation(arguments=[], member=getSeqNum, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getResidueNumber, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[MethodInvocation(arguments=[], member=getInsCode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setResidueNumber, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getAtomGroups, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=g)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Group, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getResidueNumber, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=None, label=None, then_statement=ContinueStatement(goto=None, label=None)), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=newChainName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getResidueNumber, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[MethodInvocation(arguments=[], member=getSeqNum, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), MethodInvocation(arguments=[], member=getResidueNumber, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[MethodInvocation(arguments=[], member=getInsCode, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=setResidueNumber, postfix_operators=[], prefix_operators=[], qualifier=g, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MethodInvocation(arguments=[], member=getSeqResGroups, postfix_operators=[], prefix_operators=[], qualifier=c, selectors=[], type_arguments=None), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=g)], modifiers=set(), type=ReferenceType(arguments=None, dimensions=[], name=Group, sub_type=None))), label=None)
end[}]
END[}] | Keyword[private] Keyword[static] Keyword[void] identifier[setChainIdsInResidueNumbers] operator[SEP] identifier[Chain] identifier[c] , identifier[String] identifier[newChainName] operator[SEP] {
Keyword[for] operator[SEP] identifier[Group] identifier[g] operator[:] identifier[c] operator[SEP] identifier[getAtomGroups] operator[SEP] operator[SEP] operator[SEP] {
identifier[g] operator[SEP] identifier[setResidueNumber] operator[SEP] identifier[newChainName] , identifier[g] operator[SEP] identifier[getResidueNumber] operator[SEP] operator[SEP] operator[SEP] identifier[getSeqNum] operator[SEP] operator[SEP] , identifier[g] operator[SEP] identifier[getResidueNumber] operator[SEP] operator[SEP] operator[SEP] identifier[getInsCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Group] identifier[g] operator[:] identifier[c] operator[SEP] identifier[getSeqResGroups] operator[SEP] operator[SEP] operator[SEP] {
Keyword[if] operator[SEP] identifier[g] operator[SEP] identifier[getResidueNumber] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] Keyword[continue] operator[SEP] identifier[g] operator[SEP] identifier[setResidueNumber] operator[SEP] identifier[newChainName] , identifier[g] operator[SEP] identifier[getResidueNumber] operator[SEP] operator[SEP] operator[SEP] identifier[getSeqNum] operator[SEP] operator[SEP] , identifier[g] operator[SEP] identifier[getResidueNumber] operator[SEP] operator[SEP] operator[SEP] identifier[getInsCode] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
|
public static <T> T ensure(T reference, Predicate<T> predicate) {
return ensure(reference, predicate, "Expected to fulfill the ensurement, got '%s'", reference);
} | class class_name[name] begin[{]
method[ensure, return_type[type[T]], modifier[public static], parameter[reference, predicate]] begin[{]
return[call[.ensure, parameter[member[.reference], member[.predicate], literal["Expected to fulfill the ensurement, got '%s'"], member[.reference]]]]
end[}]
END[}] | Keyword[public] Keyword[static] operator[<] identifier[T] operator[>] identifier[T] identifier[ensure] operator[SEP] identifier[T] identifier[reference] , identifier[Predicate] operator[<] identifier[T] operator[>] identifier[predicate] operator[SEP] {
Keyword[return] identifier[ensure] operator[SEP] identifier[reference] , identifier[predicate] , literal[String] , identifier[reference] operator[SEP] operator[SEP]
}
|
public void marshall(DescribeEndpointRequest describeEndpointRequest, ProtocolMarshaller protocolMarshaller) {
if (describeEndpointRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeEndpointRequest.getEndpointName(), ENDPOINTNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} | class class_name[name] begin[{]
method[marshall, return_type[void], modifier[public], parameter[describeEndpointRequest, protocolMarshaller]] begin[{]
if[binary_operation[member[.describeEndpointRequest], ==, literal[null]]] begin[{]
ThrowStatement(expression=ClassCreator(arguments=[Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Invalid argument passed to marshall(...)")], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)
else begin[{]
None
end[}]
TryStatement(block=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getEndpointName, postfix_operators=[], prefix_operators=[], qualifier=describeEndpointRequest, selectors=[], type_arguments=None), MemberReference(member=ENDPOINTNAME_BINDING, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=marshall, postfix_operators=[], prefix_operators=[], qualifier=protocolMarshaller, selectors=[], type_arguments=None), label=None)], catches=[CatchClause(block=[ThrowStatement(expression=ClassCreator(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="Unable to marshall request to JSON: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+), MemberReference(member=e, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=SdkClientException, sub_type=None)), label=None)], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['Exception']))], finally_block=None, label=None, resources=None)
end[}]
END[}] | Keyword[public] Keyword[void] identifier[marshall] operator[SEP] identifier[DescribeEndpointRequest] identifier[describeEndpointRequest] , identifier[ProtocolMarshaller] identifier[protocolMarshaller] operator[SEP] {
Keyword[if] operator[SEP] identifier[describeEndpointRequest] operator[==] Other[null] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[SEP] operator[SEP]
}
Keyword[try] {
identifier[protocolMarshaller] operator[SEP] identifier[marshall] operator[SEP] identifier[describeEndpointRequest] operator[SEP] identifier[getEndpointName] operator[SEP] operator[SEP] , identifier[ENDPOINTNAME_BINDING] operator[SEP] operator[SEP]
}
Keyword[catch] operator[SEP] identifier[Exception] identifier[e] operator[SEP] {
Keyword[throw] Keyword[new] identifier[SdkClientException] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] , identifier[e] operator[SEP] operator[SEP]
}
}
|
protected Document createDoc() throws RepositoryException
{
doNotUseInExcerpt.clear();
final Document doc = new Document();
doc.setBoost(getNodeBoost());
// special fields
// UUID
doc.add(new Field(FieldNames.UUID, node.getIdentifier(), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
if (indexingConfig != null && indexingConfig.isExcluded(node))
{
return doc;
}
try
{
if (node.getParentIdentifier() == null)
{
// root node
doc.add(new Field(FieldNames.PARENT, "", Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS));
addNodeName(doc, "", "");
}
else
{
addParentChildRelation(doc, node.getParentIdentifier());
}
}
catch (NamespaceException e)
{
// will never happen, because this.mappings will dynamically add
// unknown uri<->prefix mappings
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
if (indexFormatVersion.getVersion() >= IndexFormatVersion.V4.getVersion())
{
doc.add(new Field(FieldNames.INDEX, Integer.toString(node.getQPath().getIndex()), Field.Store.YES,
Field.Index.NOT_ANALYZED_NO_NORMS));
StringBuilder path = new StringBuilder(256);
path.append(node.getParentIdentifier() == null ? "" : node.getParentIdentifier()).append('/')
.append(node.getQPath().getName().getAsString());
doc.add(new Field(FieldNames.PATH, path.toString(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
}
Collection<PropertyData> props = node.getChildPropertiesData();
if (props == null)
{
if (loadAllProperties)
{
props = stateProvider.getChildPropertiesData(node);
}
else
{
props = stateProvider.listChildPropertiesData(node);
if (loadBatchingThreshold > -1 && props.size() > loadBatchingThreshold)
{
// The limit of properties to load individually has been reached so we perform
// a batch loading
List<QPathEntryFilter> filters = new ArrayList<QPathEntryFilter>(props.size());
for (final PropertyData prop : props)
{
filters.add(new ExactQPathEntryFilter(new QPathEntry(prop.getQPath().getName(), 0)));
}
// We use stateProvider.getChildPropertiesData(node, filters) instead of stateProvider.getChildPropertiesData(node)
// because we want to get the properties from the cache if they are available
props = stateProvider.getChildPropertiesData(node, filters);
}
}
}
for (final PropertyData prop : props)
{
// add each property to the _PROPERTIES_SET for searching
// beginning with V2
if (indexFormatVersion.getVersion() >= IndexFormatVersion.V2.getVersion())
{
addPropertyName(doc, prop.getQPath().getName());
}
addValues(doc, prop);
}
// now add fields that are not used in excerpt (must go at the end)
for (Iterator<Fieldable> it = doNotUseInExcerpt.iterator(); it.hasNext();)
{
doc.add(it.next());
}
return doc;
} | class class_name[name] begin[{]
method[createDoc, return_type[type[Document]], modifier[protected], parameter[]] begin[{]
call[doNotUseInExcerpt.clear, parameter[]]
local_variable[type[Document], doc]
call[doc.setBoost, parameter[call[.getNodeBoost, parameter[]]]]
call[doc.add, parameter[ClassCreator(arguments=[MemberReference(member=UUID, postfix_operators=[], prefix_operators=[], qualifier=FieldNames, selectors=[]), MethodInvocation(arguments=[], member=getIdentifier, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), MemberReference(member=YES, postfix_operators=[], prefix_operators=[], qualifier=Field.Store, selectors=[]), MemberReference(member=NOT_ANALYZED_NO_NORMS, postfix_operators=[], prefix_operators=[], qualifier=Field.Index, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Field, sub_type=None))]]
if[binary_operation[binary_operation[member[.indexingConfig], !=, literal[null]], &&, call[indexingConfig.isExcluded, parameter[member[.node]]]]] begin[{]
return[member[.doc]]
else begin[{]
None
end[}]
TryStatement(block=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getParentIdentifier, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), else_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getParentIdentifier, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None)], member=addParentChildRelation, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[MemberReference(member=PARENT, postfix_operators=[], prefix_operators=[], qualifier=FieldNames, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), MemberReference(member=YES, postfix_operators=[], prefix_operators=[], qualifier=Field.Store, selectors=[]), MemberReference(member=NOT_ANALYZED_NO_NORMS, postfix_operators=[], prefix_operators=[], qualifier=Field.Index, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Field, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=doc, selectors=[], type_arguments=None), label=None), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="")], member=addNodeName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]))], catches=[CatchClause(block=[IfStatement(condition=MethodInvocation(arguments=[], member=isTraceEnabled, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[BinaryOperation(operandl=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value="An exception occurred: "), operandr=MethodInvocation(arguments=[], member=getMessage, postfix_operators=[], prefix_operators=[], qualifier=e, selectors=[], type_arguments=None), operator=+)], member=trace, postfix_operators=[], prefix_operators=[], qualifier=LOG, selectors=[], type_arguments=None), label=None)]))], label=None, parameter=CatchClauseParameter(annotations=None, modifiers=None, name=e, types=['NamespaceException']))], finally_block=None, label=None, resources=None)
if[binary_operation[call[indexFormatVersion.getVersion, parameter[]], >=, call[IndexFormatVersion.V4.getVersion, parameter[]]]] begin[{]
call[doc.add, parameter[ClassCreator(arguments=[MemberReference(member=INDEX, postfix_operators=[], prefix_operators=[], qualifier=FieldNames, selectors=[]), MethodInvocation(arguments=[MethodInvocation(arguments=[], member=getQPath, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[MethodInvocation(arguments=[], member=getIndex, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=toString, postfix_operators=[], prefix_operators=[], qualifier=Integer, selectors=[], type_arguments=None), MemberReference(member=YES, postfix_operators=[], prefix_operators=[], qualifier=Field.Store, selectors=[]), MemberReference(member=NOT_ANALYZED_NO_NORMS, postfix_operators=[], prefix_operators=[], qualifier=Field.Index, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Field, sub_type=None))]]
local_variable[type[StringBuilder], path]
call[path.append, parameter[TernaryExpression(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getParentIdentifier, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), operandr=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=null), operator===), if_false=MethodInvocation(arguments=[], member=getParentIdentifier, postfix_operators=[], prefix_operators=[], qualifier=node, selectors=[], type_arguments=None), if_true=Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=""))]]
call[doc.add, parameter[ClassCreator(arguments=[MemberReference(member=PATH, postfix_operators=[], prefix_operators=[], qualifier=FieldNames, selectors=[]), MethodInvocation(arguments=[], member=toString, postfix_operators=[], prefix_operators=[], qualifier=path, selectors=[], type_arguments=None), MemberReference(member=NO, postfix_operators=[], prefix_operators=[], qualifier=Field.Store, selectors=[]), MemberReference(member=NOT_ANALYZED_NO_NORMS, postfix_operators=[], prefix_operators=[], qualifier=Field.Index, selectors=[])], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=Field, sub_type=None))]]
else begin[{]
None
end[}]
local_variable[type[Collection], props]
if[binary_operation[member[.props], ==, literal[null]]] begin[{]
if[member[.loadAllProperties]] begin[{]
assign[member[.props], call[stateProvider.getChildPropertiesData, parameter[member[.node]]]]
else begin[{]
assign[member[.props], call[stateProvider.listChildPropertiesData, parameter[member[.node]]]]
if[binary_operation[binary_operation[member[.loadBatchingThreshold], >, literal[1]], &&, binary_operation[call[props.size, parameter[]], >, member[.loadBatchingThreshold]]]] begin[{]
local_variable[type[List], filters]
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[ClassCreator(arguments=[ClassCreator(arguments=[MethodInvocation(arguments=[], member=getQPath, postfix_operators=[], prefix_operators=[], qualifier=prop, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None), Literal(postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], value=0)], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=QPathEntry, sub_type=None))], body=None, constructor_type_arguments=None, postfix_operators=[], prefix_operators=[], qualifier=None, selectors=[], type=ReferenceType(arguments=None, dimensions=None, name=ExactQPathEntryFilter, sub_type=None))], member=add, postfix_operators=[], prefix_operators=[], qualifier=filters, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=props, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=prop)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=PropertyData, sub_type=None))), label=None)
assign[member[.props], call[stateProvider.getChildPropertiesData, parameter[member[.node], member[.filters]]]]
else begin[{]
None
end[}]
end[}]
else begin[{]
None
end[}]
ForStatement(body=BlockStatement(label=None, statements=[IfStatement(condition=BinaryOperation(operandl=MethodInvocation(arguments=[], member=getVersion, postfix_operators=[], prefix_operators=[], qualifier=indexFormatVersion, selectors=[], type_arguments=None), operandr=MethodInvocation(arguments=[], member=getVersion, postfix_operators=[], prefix_operators=[], qualifier=IndexFormatVersion.V2, selectors=[], type_arguments=None), operator=>=), else_statement=None, label=None, then_statement=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MethodInvocation(arguments=[], member=getQPath, postfix_operators=[], prefix_operators=[], qualifier=prop, selectors=[MethodInvocation(arguments=[], member=getName, postfix_operators=None, prefix_operators=None, qualifier=None, selectors=None, type_arguments=None)], type_arguments=None)], member=addPropertyName, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)])), StatementExpression(expression=MethodInvocation(arguments=[MemberReference(member=doc, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), MemberReference(member=prop, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[])], member=addValues, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[], type_arguments=None), label=None)]), control=EnhancedForControl(iterable=MemberReference(member=props, postfix_operators=[], prefix_operators=[], qualifier=, selectors=[]), var=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=None, name=prop)], modifiers={'final'}, type=ReferenceType(arguments=None, dimensions=[], name=PropertyData, sub_type=None))), label=None)
ForStatement(body=BlockStatement(label=None, statements=[StatementExpression(expression=MethodInvocation(arguments=[MethodInvocation(arguments=[], member=next, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None)], member=add, postfix_operators=[], prefix_operators=[], qualifier=doc, selectors=[], type_arguments=None), label=None)]), control=ForControl(condition=MethodInvocation(arguments=[], member=hasNext, postfix_operators=[], prefix_operators=[], qualifier=it, selectors=[], type_arguments=None), init=VariableDeclaration(annotations=[], declarators=[VariableDeclarator(dimensions=None, initializer=MethodInvocation(arguments=[], member=iterator, postfix_operators=[], prefix_operators=[], qualifier=doNotUseInExcerpt, selectors=[], type_arguments=None), name=it)], modifiers=set(), type=ReferenceType(arguments=[TypeArgument(pattern_type=None, type=ReferenceType(arguments=None, dimensions=[], name=Fieldable, sub_type=None))], dimensions=[], name=Iterator, sub_type=None)), update=None), label=None)
return[member[.doc]]
end[}]
END[}] | Keyword[protected] identifier[Document] identifier[createDoc] operator[SEP] operator[SEP] Keyword[throws] identifier[RepositoryException] {
identifier[doNotUseInExcerpt] operator[SEP] identifier[clear] operator[SEP] operator[SEP] operator[SEP] Keyword[final] identifier[Document] identifier[doc] operator[=] Keyword[new] identifier[Document] operator[SEP] operator[SEP] operator[SEP] identifier[doc] operator[SEP] identifier[setBoost] operator[SEP] identifier[getNodeBoost] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[doc] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Field] operator[SEP] identifier[FieldNames] operator[SEP] identifier[UUID] , identifier[node] operator[SEP] identifier[getIdentifier] operator[SEP] operator[SEP] , identifier[Field] operator[SEP] identifier[Store] operator[SEP] identifier[YES] , identifier[Field] operator[SEP] identifier[Index] operator[SEP] identifier[NOT_ANALYZED_NO_NORMS] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[indexingConfig] operator[!=] Other[null] operator[&&] identifier[indexingConfig] operator[SEP] identifier[isExcluded] operator[SEP] identifier[node] operator[SEP] operator[SEP] {
Keyword[return] identifier[doc] operator[SEP]
}
Keyword[try] {
Keyword[if] operator[SEP] identifier[node] operator[SEP] identifier[getParentIdentifier] operator[SEP] operator[SEP] operator[==] Other[null] operator[SEP] {
identifier[doc] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Field] operator[SEP] identifier[FieldNames] operator[SEP] identifier[PARENT] , literal[String] , identifier[Field] operator[SEP] identifier[Store] operator[SEP] identifier[YES] , identifier[Field] operator[SEP] identifier[Index] operator[SEP] identifier[NOT_ANALYZED_NO_NORMS] operator[SEP] operator[SEP] operator[SEP] identifier[addNodeName] operator[SEP] identifier[doc] , literal[String] , literal[String] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[addParentChildRelation] operator[SEP] identifier[doc] , identifier[node] operator[SEP] identifier[getParentIdentifier] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[catch] operator[SEP] identifier[NamespaceException] identifier[e] operator[SEP] {
Keyword[if] operator[SEP] identifier[LOG] operator[SEP] identifier[isTraceEnabled] operator[SEP] operator[SEP] operator[SEP] {
identifier[LOG] operator[SEP] identifier[trace] operator[SEP] literal[String] operator[+] identifier[e] operator[SEP] identifier[getMessage] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
}
Keyword[if] operator[SEP] identifier[indexFormatVersion] operator[SEP] identifier[getVersion] operator[SEP] operator[SEP] operator[>=] identifier[IndexFormatVersion] operator[SEP] identifier[V4] operator[SEP] identifier[getVersion] operator[SEP] operator[SEP] operator[SEP] {
identifier[doc] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Field] operator[SEP] identifier[FieldNames] operator[SEP] identifier[INDEX] , identifier[Integer] operator[SEP] identifier[toString] operator[SEP] identifier[node] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] operator[SEP] identifier[getIndex] operator[SEP] operator[SEP] operator[SEP] , identifier[Field] operator[SEP] identifier[Store] operator[SEP] identifier[YES] , identifier[Field] operator[SEP] identifier[Index] operator[SEP] identifier[NOT_ANALYZED_NO_NORMS] operator[SEP] operator[SEP] operator[SEP] identifier[StringBuilder] identifier[path] operator[=] Keyword[new] identifier[StringBuilder] operator[SEP] Other[256] operator[SEP] operator[SEP] identifier[path] operator[SEP] identifier[append] operator[SEP] identifier[node] operator[SEP] identifier[getParentIdentifier] operator[SEP] operator[SEP] operator[==] Other[null] operator[?] literal[String] operator[:] identifier[node] operator[SEP] identifier[getParentIdentifier] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[append] operator[SEP] literal[String] operator[SEP] operator[SEP] identifier[append] operator[SEP] identifier[node] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] identifier[getAsString] operator[SEP] operator[SEP] operator[SEP] operator[SEP] identifier[doc] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[Field] operator[SEP] identifier[FieldNames] operator[SEP] identifier[PATH] , identifier[path] operator[SEP] identifier[toString] operator[SEP] operator[SEP] , identifier[Field] operator[SEP] identifier[Store] operator[SEP] identifier[NO] , identifier[Field] operator[SEP] identifier[Index] operator[SEP] identifier[NOT_ANALYZED_NO_NORMS] operator[SEP] operator[SEP] operator[SEP]
}
identifier[Collection] operator[<] identifier[PropertyData] operator[>] identifier[props] operator[=] identifier[node] operator[SEP] identifier[getChildPropertiesData] operator[SEP] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[props] operator[==] Other[null] operator[SEP] {
Keyword[if] operator[SEP] identifier[loadAllProperties] operator[SEP] {
identifier[props] operator[=] identifier[stateProvider] operator[SEP] identifier[getChildPropertiesData] operator[SEP] identifier[node] operator[SEP] operator[SEP]
}
Keyword[else] {
identifier[props] operator[=] identifier[stateProvider] operator[SEP] identifier[listChildPropertiesData] operator[SEP] identifier[node] operator[SEP] operator[SEP] Keyword[if] operator[SEP] identifier[loadBatchingThreshold] operator[>] operator[-] Other[1] operator[&&] identifier[props] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[>] identifier[loadBatchingThreshold] operator[SEP] {
identifier[List] operator[<] identifier[QPathEntryFilter] operator[>] identifier[filters] operator[=] Keyword[new] identifier[ArrayList] operator[<] identifier[QPathEntryFilter] operator[>] operator[SEP] identifier[props] operator[SEP] identifier[size] operator[SEP] operator[SEP] operator[SEP] operator[SEP] Keyword[for] operator[SEP] Keyword[final] identifier[PropertyData] identifier[prop] operator[:] identifier[props] operator[SEP] {
identifier[filters] operator[SEP] identifier[add] operator[SEP] Keyword[new] identifier[ExactQPathEntryFilter] operator[SEP] Keyword[new] identifier[QPathEntry] operator[SEP] identifier[prop] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] , Other[0] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[props] operator[=] identifier[stateProvider] operator[SEP] identifier[getChildPropertiesData] operator[SEP] identifier[node] , identifier[filters] operator[SEP] operator[SEP]
}
}
}
Keyword[for] operator[SEP] Keyword[final] identifier[PropertyData] identifier[prop] operator[:] identifier[props] operator[SEP] {
Keyword[if] operator[SEP] identifier[indexFormatVersion] operator[SEP] identifier[getVersion] operator[SEP] operator[SEP] operator[>=] identifier[IndexFormatVersion] operator[SEP] identifier[V2] operator[SEP] identifier[getVersion] operator[SEP] operator[SEP] operator[SEP] {
identifier[addPropertyName] operator[SEP] identifier[doc] , identifier[prop] operator[SEP] identifier[getQPath] operator[SEP] operator[SEP] operator[SEP] identifier[getName] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
identifier[addValues] operator[SEP] identifier[doc] , identifier[prop] operator[SEP] operator[SEP]
}
Keyword[for] operator[SEP] identifier[Iterator] operator[<] identifier[Fieldable] operator[>] identifier[it] operator[=] identifier[doNotUseInExcerpt] operator[SEP] identifier[iterator] operator[SEP] operator[SEP] operator[SEP] identifier[it] operator[SEP] identifier[hasNext] operator[SEP] operator[SEP] operator[SEP] operator[SEP] {
identifier[doc] operator[SEP] identifier[add] operator[SEP] identifier[it] operator[SEP] identifier[next] operator[SEP] operator[SEP] operator[SEP] operator[SEP]
}
Keyword[return] identifier[doc] operator[SEP]
}
|
public CreateDeploymentResult withApiSummary(java.util.Map<String, java.util.Map<String, MethodSnapshot>> apiSummary) {
setApiSummary(apiSummary);
return this;
} | class class_name[name] begin[{]
method[withApiSummary, return_type[type[CreateDeploymentResult]], modifier[public], parameter[apiSummary]] begin[{]
call[.setApiSummary, parameter[member[.apiSummary]]]
return[THIS[]]
end[}]
END[}] | Keyword[public] identifier[CreateDeploymentResult] identifier[withApiSummary] operator[SEP] identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[java] operator[SEP] identifier[util] operator[SEP] identifier[Map] operator[<] identifier[String] , identifier[MethodSnapshot] operator[>] operator[>] identifier[apiSummary] operator[SEP] {
identifier[setApiSummary] operator[SEP] identifier[apiSummary] operator[SEP] operator[SEP] Keyword[return] Keyword[this] operator[SEP]
}
|
public <T> T mapTo(final Class<T> mappingClass, final JBBPMapperCustomFieldProcessor customFieldProcessor) {
return JBBPMapper.map(this, mappingClass, customFieldProcessor);
} | class class_name[name] begin[{]
method[mapTo, return_type[type[T]], modifier[public], parameter[mappingClass, customFieldProcessor]] begin[{]
return[call[JBBPMapper.map, parameter[THIS[], member[.mappingClass], member[.customFieldProcessor]]]]
end[}]
END[}] | Keyword[public] operator[<] identifier[T] operator[>] identifier[T] identifier[mapTo] operator[SEP] Keyword[final] identifier[Class] operator[<] identifier[T] operator[>] identifier[mappingClass] , Keyword[final] identifier[JBBPMapperCustomFieldProcessor] identifier[customFieldProcessor] operator[SEP] {
Keyword[return] identifier[JBBPMapper] operator[SEP] identifier[map] operator[SEP] Keyword[this] , identifier[mappingClass] , identifier[customFieldProcessor] operator[SEP] operator[SEP]
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.