code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public int getSpanStart(Object what) {
int count = mSpanCount;
Object[] spans = mSpans;
for (int i = count - 1; i >= 0; i--) {
if (spans[i] == what) {
int where = mSpanStarts[i];
if (where > mGapStart)
where -= mGapLength;
return where;
}
}
return -1;
} } | public class class_name {
public int getSpanStart(Object what) {
int count = mSpanCount;
Object[] spans = mSpans;
for (int i = count - 1; i >= 0; i--) {
if (spans[i] == what) {
int where = mSpanStarts[i];
if (where > mGapStart)
where -= mGapLength;
return where; // depends on control dependency: [if], data = [none]
}
}
return -1;
} } |
public class class_name {
private void handleVideoRequest(final Request request) {
String videoRequested = request.getParameter(VIDEO_INDEX_REQUEST_PARAM_KEY);
int videoFileIndex = 0;
try {
videoFileIndex = Integer.parseInt(videoRequested);
} catch (NumberFormatException e) {
LOG.error("Failed to parse video index: " + videoFileIndex);
}
Video[] video = getVideo();
if (video != null && videoFileIndex >= 0 && videoFileIndex < video.length) {
ContentEscape escape = new ContentEscape(video[videoFileIndex]);
escape.setCacheable(!Util.empty(getCacheKey()));
throw escape;
} else {
LOG.warn("Client requested invalid video clip: " + videoFileIndex);
}
} } | public class class_name {
private void handleVideoRequest(final Request request) {
String videoRequested = request.getParameter(VIDEO_INDEX_REQUEST_PARAM_KEY);
int videoFileIndex = 0;
try {
videoFileIndex = Integer.parseInt(videoRequested); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
LOG.error("Failed to parse video index: " + videoFileIndex);
} // depends on control dependency: [catch], data = [none]
Video[] video = getVideo();
if (video != null && videoFileIndex >= 0 && videoFileIndex < video.length) {
ContentEscape escape = new ContentEscape(video[videoFileIndex]);
escape.setCacheable(!Util.empty(getCacheKey())); // depends on control dependency: [if], data = [none]
throw escape;
} else {
LOG.warn("Client requested invalid video clip: " + videoFileIndex); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public ManagedObject injectAndPostConstruct(final Object target) throws InjectionException
{
final String METHOD_NAME="injectAndPostConstruct";
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.entering(CLASS_NAME, METHOD_NAME, target);
}
// PI30335: split inject logic from injectAndPostConstruct
ManagedObject r = inject(target);
// after injection then PostConstruct annotated methods on the host object needs to be invoked.
Throwable t = this.invokeAnnotTypeOnObjectAndHierarchy(target, ANNOT_TYPE.POST_CONSTRUCT);
if (null != t){
// log exception - and process InjectionExceptions so the error will be returned to the client as an error.
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, METHOD_NAME, "Exception caught during post construct processing: " + t);
}
if ( t instanceof InjectionException) {
InjectionException ie = (InjectionException) t;
throw ie;
} else {
// According to spec, can't proceed if invoking PostContruct(s) threw exceptions
RuntimeException re = new RuntimeException(t);
throw re;
}
}
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.exiting(CLASS_NAME, METHOD_NAME, r);
}
return r;
} } | public class class_name {
public ManagedObject injectAndPostConstruct(final Object target) throws InjectionException
{
final String METHOD_NAME="injectAndPostConstruct";
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.entering(CLASS_NAME, METHOD_NAME, target);
}
// PI30335: split inject logic from injectAndPostConstruct
ManagedObject r = inject(target);
// after injection then PostConstruct annotated methods on the host object needs to be invoked.
Throwable t = this.invokeAnnotTypeOnObjectAndHierarchy(target, ANNOT_TYPE.POST_CONSTRUCT);
if (null != t){
// log exception - and process InjectionExceptions so the error will be returned to the client as an error.
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.logp(Level.FINE, CLASS_NAME, METHOD_NAME, "Exception caught during post construct processing: " + t); // depends on control dependency: [if], data = [none]
}
if ( t instanceof InjectionException) {
InjectionException ie = (InjectionException) t;
throw ie;
} else {
// According to spec, can't proceed if invoking PostContruct(s) threw exceptions
RuntimeException re = new RuntimeException(t);
throw re;
}
}
if (TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINE)) {
logger.exiting(CLASS_NAME, METHOD_NAME, r);
}
return r;
} } |
public class class_name {
public void addTag(TagValue tag) {
//int pos = 0;
//while (pos < tags.size() && tags.get(pos).getId() < tag.getId()) pos++;
//tags.add(pos, tag);
tags.add(tag);
if (!hashTagsId.containsKey(tag.getId())) {
hashTagsId.put(tag.getId(), tag);
}
Tag t = TiffTags.getTag(tag.getId());
if (t != null) {
if (hashTagsName.containsKey(t.getName())) {
hashTagsName.put(t.getName(), tag);
}
}
} } | public class class_name {
public void addTag(TagValue tag) {
//int pos = 0;
//while (pos < tags.size() && tags.get(pos).getId() < tag.getId()) pos++;
//tags.add(pos, tag);
tags.add(tag);
if (!hashTagsId.containsKey(tag.getId())) {
hashTagsId.put(tag.getId(), tag); // depends on control dependency: [if], data = [none]
}
Tag t = TiffTags.getTag(tag.getId());
if (t != null) {
if (hashTagsName.containsKey(t.getName())) {
hashTagsName.put(t.getName(), tag); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
String getPrefix (String uri)
{
if (uriTable == null) {
return null;
} else {
return (String)uriTable.get(uri);
}
} } | public class class_name {
String getPrefix (String uri)
{
if (uriTable == null) {
return null; // depends on control dependency: [if], data = [none]
} else {
return (String)uriTable.get(uri); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void obtainStyledAttributes(@Nullable final AttributeSet attributeSet,
@AttrRes final int defaultStyle,
@StyleRes final int defaultStyleResource) {
TypedArray typedArray = getContext()
.obtainStyledAttributes(attributeSet, R.styleable.ColorPalettePreference,
defaultStyle, defaultStyleResource);
try {
obtainColorPalette(typedArray);
obtainDialogPreviewSize(typedArray);
obtainDialogPreviewShape(typedArray);
obtainDialogPreviewBorderWidth(typedArray);
obtainDialogPreviewBorderColor(typedArray);
obtainDialogPreviewBackground(typedArray);
obtainNumberOfColumns(typedArray);
} finally {
typedArray.recycle();
}
} } | public class class_name {
private void obtainStyledAttributes(@Nullable final AttributeSet attributeSet,
@AttrRes final int defaultStyle,
@StyleRes final int defaultStyleResource) {
TypedArray typedArray = getContext()
.obtainStyledAttributes(attributeSet, R.styleable.ColorPalettePreference,
defaultStyle, defaultStyleResource);
try {
obtainColorPalette(typedArray); // depends on control dependency: [try], data = [none]
obtainDialogPreviewSize(typedArray); // depends on control dependency: [try], data = [none]
obtainDialogPreviewShape(typedArray); // depends on control dependency: [try], data = [none]
obtainDialogPreviewBorderWidth(typedArray); // depends on control dependency: [try], data = [none]
obtainDialogPreviewBorderColor(typedArray); // depends on control dependency: [try], data = [none]
obtainDialogPreviewBackground(typedArray); // depends on control dependency: [try], data = [none]
obtainNumberOfColumns(typedArray); // depends on control dependency: [try], data = [none]
} finally {
typedArray.recycle();
}
} } |
public class class_name {
public static void incrementOtherOperationsCount(MapService service, String mapName) {
MapServiceContext mapServiceContext = service.getMapServiceContext();
MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
if (mapContainer.getMapConfig().isStatisticsEnabled()) {
LocalMapStatsImpl localMapStats = mapServiceContext.getLocalMapStatsProvider().getLocalMapStatsImpl(mapName);
localMapStats.incrementOtherOperations();
}
} } | public class class_name {
public static void incrementOtherOperationsCount(MapService service, String mapName) {
MapServiceContext mapServiceContext = service.getMapServiceContext();
MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
if (mapContainer.getMapConfig().isStatisticsEnabled()) {
LocalMapStatsImpl localMapStats = mapServiceContext.getLocalMapStatsProvider().getLocalMapStatsImpl(mapName);
localMapStats.incrementOtherOperations(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void startcteInutilizacaoCT(final com.fincatto.documentofiscal.cte300.webservices.inutilizacao.CteInutilizacaoStub.CteDadosMsg cteDadosMsg0, final com.fincatto.documentofiscal.cte300.webservices.inutilizacao.CteInutilizacaoStub.CteCabecMsgE cteCabecMsg1, final com.fincatto.documentofiscal.cte300.webservices.inutilizacao.CteInutilizacaoCallbackHandler callback) throws java.rmi.RemoteException {
final org.apache.axis2.client.OperationClient _operationClient = this._serviceClient.createClient(this._operations[0].getName());
_operationClient.getOptions().setAction("http://www.portalfiscal.inf.br/cte/wsdl/CteInutilizacao/cteInutilizacaoCT");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
this.addPropertyToOperationClient(_operationClient, org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&");
// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env;
final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
// Style is Doc.
env = this.toEnvelope(Stub.getFactory(_operationClient.getOptions().getSoapVersionURI()), cteDadosMsg0, this.optimizeContent(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/cte/wsdl/CteInutilizacao", "cteInutilizacaoCT")), new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/cte/wsdl/CteInutilizacao", "cteInutilizacaoCT"));
// add the soap_headers only if they are not null
if (cteCabecMsg1 != null) {
final org.apache.axiom.om.OMElement omElementcteCabecMsg1 = this.toOM(cteCabecMsg1, this.optimizeContent(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/cte/wsdl/CteInutilizacao", "cteInutilizacaoCT")));
this.addHeader(omElementcteCabecMsg1, env);
}
// adding SOAP soap_headers
this._serviceClient.addHeadersToEnvelope(env);
// create message context with that soap envelope
_messageContext.setEnvelope(env);
// add the message context to the operation client
_operationClient.addMessageContext(_messageContext);
_operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() {
@Override
public void onMessage(final org.apache.axis2.context.MessageContext resultContext) {
try {
final org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope();
final java.lang.Object object = CteInutilizacaoStub.this.fromOM(resultEnv.getBody().getFirstElement(), com.fincatto.documentofiscal.cte300.webservices.inutilizacao.CteInutilizacaoStub.CteInutilizacaoCTResult.class, CteInutilizacaoStub.this.getEnvelopeNamespaces(resultEnv));
callback.receiveResultcteInutilizacaoCT((com.fincatto.documentofiscal.cte300.webservices.inutilizacao.CteInutilizacaoStub.CteInutilizacaoCTResult) object);
} catch (final org.apache.axis2.AxisFault e) {
callback.receiveErrorcteInutilizacaoCT(e);
}
}
@Override
public void onError(final java.lang.Exception error) {
if (error instanceof org.apache.axis2.AxisFault) {
final org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error;
final org.apache.axiom.om.OMElement faultElt = f.getDetail();
if (faultElt != null) {
if (CteInutilizacaoStub.this.faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "cteInutilizacaoCT"))) {
// make the fault by reflection
try {
final java.lang.String exceptionClassName = (java.lang.String) CteInutilizacaoStub.this.faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "cteInutilizacaoCT"));
final java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
final java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(String.class);
final java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());
// message class
final java.lang.String messageClassName = (java.lang.String) CteInutilizacaoStub.this.faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "cteInutilizacaoCT"));
final java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
final java.lang.Object messageObject = CteInutilizacaoStub.this.fromOM(faultElt, messageClass, null);
final java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", messageClass);
m.invoke(ex, messageObject);
callback.receiveErrorcteInutilizacaoCT(new java.rmi.RemoteException(ex.getMessage(), ex));
} catch (final ClassCastException | org.apache.axis2.AxisFault | InstantiationException | IllegalAccessException | java.lang.reflect.InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) {
// we cannot intantiate the class - throw the original Axis fault
callback.receiveErrorcteInutilizacaoCT(f);
}
} else {
callback.receiveErrorcteInutilizacaoCT(f);
}
} else {
callback.receiveErrorcteInutilizacaoCT(f);
}
} else {
callback.receiveErrorcteInutilizacaoCT(error);
}
}
@Override
public void onFault(final org.apache.axis2.context.MessageContext faultContext) {
final org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext);
this.onError(fault);
}
@Override
public void onComplete() {
try {
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
} catch (final org.apache.axis2.AxisFault axisFault) {
callback.receiveErrorcteInutilizacaoCT(axisFault);
}
}
});
org.apache.axis2.util.CallbackReceiver _callbackReceiver;
if (this._operations[0].getMessageReceiver() == null && _operationClient.getOptions().isUseSeparateListener()) {
_callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
this._operations[0].setMessageReceiver(_callbackReceiver);
}
// execute the operation client
_operationClient.execute(false);
} } | public class class_name {
public void startcteInutilizacaoCT(final com.fincatto.documentofiscal.cte300.webservices.inutilizacao.CteInutilizacaoStub.CteDadosMsg cteDadosMsg0, final com.fincatto.documentofiscal.cte300.webservices.inutilizacao.CteInutilizacaoStub.CteCabecMsgE cteCabecMsg1, final com.fincatto.documentofiscal.cte300.webservices.inutilizacao.CteInutilizacaoCallbackHandler callback) throws java.rmi.RemoteException {
final org.apache.axis2.client.OperationClient _operationClient = this._serviceClient.createClient(this._operations[0].getName());
_operationClient.getOptions().setAction("http://www.portalfiscal.inf.br/cte/wsdl/CteInutilizacao/cteInutilizacaoCT");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
this.addPropertyToOperationClient(_operationClient, org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR, "&");
// create SOAP envelope with that payload
org.apache.axiom.soap.SOAPEnvelope env;
final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();
// Style is Doc.
env = this.toEnvelope(Stub.getFactory(_operationClient.getOptions().getSoapVersionURI()), cteDadosMsg0, this.optimizeContent(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/cte/wsdl/CteInutilizacao", "cteInutilizacaoCT")), new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/cte/wsdl/CteInutilizacao", "cteInutilizacaoCT"));
// add the soap_headers only if they are not null
if (cteCabecMsg1 != null) {
final org.apache.axiom.om.OMElement omElementcteCabecMsg1 = this.toOM(cteCabecMsg1, this.optimizeContent(new javax.xml.namespace.QName("http://www.portalfiscal.inf.br/cte/wsdl/CteInutilizacao", "cteInutilizacaoCT")));
this.addHeader(omElementcteCabecMsg1, env);
}
// adding SOAP soap_headers
this._serviceClient.addHeadersToEnvelope(env);
// create message context with that soap envelope
_messageContext.setEnvelope(env);
// add the message context to the operation client
_operationClient.addMessageContext(_messageContext);
_operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() {
@Override
public void onMessage(final org.apache.axis2.context.MessageContext resultContext) {
try {
final org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope();
final java.lang.Object object = CteInutilizacaoStub.this.fromOM(resultEnv.getBody().getFirstElement(), com.fincatto.documentofiscal.cte300.webservices.inutilizacao.CteInutilizacaoStub.CteInutilizacaoCTResult.class, CteInutilizacaoStub.this.getEnvelopeNamespaces(resultEnv));
callback.receiveResultcteInutilizacaoCT((com.fincatto.documentofiscal.cte300.webservices.inutilizacao.CteInutilizacaoStub.CteInutilizacaoCTResult) object);
// depends on control dependency: [try], data = [none]
} catch (final org.apache.axis2.AxisFault e) {
callback.receiveErrorcteInutilizacaoCT(e);
}
// depends on control dependency: [catch], data = [none]
}
@Override
public void onError(final java.lang.Exception error) {
if (error instanceof org.apache.axis2.AxisFault) {
final org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error;
final org.apache.axiom.om.OMElement faultElt = f.getDetail();
if (faultElt != null) {
if (CteInutilizacaoStub.this.faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "cteInutilizacaoCT"))) {
// make the fault by reflection
try {
final java.lang.String exceptionClassName = (java.lang.String) CteInutilizacaoStub.this.faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "cteInutilizacaoCT"));
final java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName);
final java.lang.reflect.Constructor constructor = exceptionClass.getConstructor(String.class);
final java.lang.Exception ex = (java.lang.Exception) constructor.newInstance(f.getMessage());
// message class
final java.lang.String messageClassName = (java.lang.String) CteInutilizacaoStub.this.faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(), "cteInutilizacaoCT"));
final java.lang.Class messageClass = java.lang.Class.forName(messageClassName);
final java.lang.Object messageObject = CteInutilizacaoStub.this.fromOM(faultElt, messageClass, null);
final java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", messageClass);
m.invoke(ex, messageObject);
// depends on control dependency: [try], data = [none]
callback.receiveErrorcteInutilizacaoCT(new java.rmi.RemoteException(ex.getMessage(), ex));
// depends on control dependency: [try], data = [none]
} catch (final ClassCastException | org.apache.axis2.AxisFault | InstantiationException | IllegalAccessException | java.lang.reflect.InvocationTargetException | NoSuchMethodException | ClassNotFoundException e) {
// we cannot intantiate the class - throw the original Axis fault
callback.receiveErrorcteInutilizacaoCT(f);
}
// depends on control dependency: [catch], data = [none]
} else {
callback.receiveErrorcteInutilizacaoCT(f);
// depends on control dependency: [if], data = [none]
}
} else {
callback.receiveErrorcteInutilizacaoCT(f);
// depends on control dependency: [if], data = [none]
}
} else {
callback.receiveErrorcteInutilizacaoCT(error);
// depends on control dependency: [if], data = [none]
}
}
@Override
public void onFault(final org.apache.axis2.context.MessageContext faultContext) {
final org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext);
this.onError(fault);
}
@Override
public void onComplete() {
try {
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
// depends on control dependency: [try], data = [none]
} catch (final org.apache.axis2.AxisFault axisFault) {
callback.receiveErrorcteInutilizacaoCT(axisFault);
}
// depends on control dependency: [catch], data = [none]
}
});
org.apache.axis2.util.CallbackReceiver _callbackReceiver;
if (this._operations[0].getMessageReceiver() == null && _operationClient.getOptions().isUseSeparateListener()) {
_callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
this._operations[0].setMessageReceiver(_callbackReceiver);
}
// execute the operation client
_operationClient.execute(false);
} } |
public class class_name {
private void initializeDrawableForDisplay(Drawable d) {
if (mBlockInvalidateCallback == null) {
mBlockInvalidateCallback = new BlockInvalidateCallback();
}
// Temporary fix for suspending callbacks during initialization. We
// don't want any of these setters causing an invalidate() since that
// may call back into DrawableContainer.
d.setCallback(mBlockInvalidateCallback.wrap(d.getCallback()));
try {
if (mDrawableContainerState.mEnterFadeDuration <= 0 && mHasAlpha) {
d.setAlpha(mAlpha);
}
if (mDrawableContainerState.mHasColorFilter) {
// Color filter always overrides tint.
d.setColorFilter(mDrawableContainerState.mColorFilter);
} else {
if (mDrawableContainerState.mHasTintList) {
DrawableCompat.setTintList(d, mDrawableContainerState.mTintList);
}
if (mDrawableContainerState.mHasTintMode) {
DrawableCompat.setTintMode(d, mDrawableContainerState.mTintMode);
}
}
d.setVisible(isVisible(), true);
d.setDither(mDrawableContainerState.mDither);
d.setState(getState());
d.setLevel(getLevel());
d.setBounds(getBounds());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
d.setLayoutDirection(getLayoutDirection());
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
d.setAutoMirrored(mDrawableContainerState.mAutoMirrored);
}
final Rect hotspotBounds = mHotspotBounds;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && hotspotBounds != null) {
d.setHotspotBounds(hotspotBounds.left, hotspotBounds.top,
hotspotBounds.right, hotspotBounds.bottom);
}
} finally {
d.setCallback(mBlockInvalidateCallback.unwrap());
}
} } | public class class_name {
private void initializeDrawableForDisplay(Drawable d) {
if (mBlockInvalidateCallback == null) {
mBlockInvalidateCallback = new BlockInvalidateCallback(); // depends on control dependency: [if], data = [none]
}
// Temporary fix for suspending callbacks during initialization. We
// don't want any of these setters causing an invalidate() since that
// may call back into DrawableContainer.
d.setCallback(mBlockInvalidateCallback.wrap(d.getCallback()));
try {
if (mDrawableContainerState.mEnterFadeDuration <= 0 && mHasAlpha) {
d.setAlpha(mAlpha); // depends on control dependency: [if], data = [none]
}
if (mDrawableContainerState.mHasColorFilter) {
// Color filter always overrides tint.
d.setColorFilter(mDrawableContainerState.mColorFilter); // depends on control dependency: [if], data = [none]
} else {
if (mDrawableContainerState.mHasTintList) {
DrawableCompat.setTintList(d, mDrawableContainerState.mTintList); // depends on control dependency: [if], data = [none]
}
if (mDrawableContainerState.mHasTintMode) {
DrawableCompat.setTintMode(d, mDrawableContainerState.mTintMode); // depends on control dependency: [if], data = [none]
}
}
d.setVisible(isVisible(), true); // depends on control dependency: [try], data = [none]
d.setDither(mDrawableContainerState.mDither); // depends on control dependency: [try], data = [none]
d.setState(getState()); // depends on control dependency: [try], data = [none]
d.setLevel(getLevel()); // depends on control dependency: [try], data = [none]
d.setBounds(getBounds()); // depends on control dependency: [try], data = [none]
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
d.setLayoutDirection(getLayoutDirection()); // depends on control dependency: [if], data = [none]
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
d.setAutoMirrored(mDrawableContainerState.mAutoMirrored); // depends on control dependency: [if], data = [none]
}
final Rect hotspotBounds = mHotspotBounds;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && hotspotBounds != null) {
d.setHotspotBounds(hotspotBounds.left, hotspotBounds.top,
hotspotBounds.right, hotspotBounds.bottom); // depends on control dependency: [if], data = [none]
}
} finally {
d.setCallback(mBlockInvalidateCallback.unwrap());
}
} } |
public class class_name {
public void afterCompletion(int status) {
for (DeferredEventNotification<?> notification : notifications) {
if (!notification.isBefore() && notification.getStatus().matches(status)) {
notification.run();
}
}
} } | public class class_name {
public void afterCompletion(int status) {
for (DeferredEventNotification<?> notification : notifications) {
if (!notification.isBefore() && notification.getStatus().matches(status)) {
notification.run(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
static public void substitute(StringBuilder sbuff, String match, String subst) {
int pos, fromIndex = 0;
int substLen = subst.length();
int matchLen = match.length();
while (0 <= (pos = sbuff.indexOf(match, fromIndex))) {
sbuff.replace(pos, pos + matchLen, subst);
fromIndex = pos + substLen; // make sure dont get into an infinite loop
}
} } | public class class_name {
static public void substitute(StringBuilder sbuff, String match, String subst) {
int pos, fromIndex = 0;
int substLen = subst.length();
int matchLen = match.length();
while (0 <= (pos = sbuff.indexOf(match, fromIndex))) {
sbuff.replace(pos, pos + matchLen, subst);
// depends on control dependency: [while], data = [none]
fromIndex = pos + substLen; // make sure dont get into an infinite loop
// depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
protected static Integer parseOptionalIntValue(JSONObject json, String key) {
try {
return Integer.valueOf(json.getInt(key));
} catch (JSONException e) {
LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_INTEGER_MISSING_1, key), e);
return null;
}
} } | public class class_name {
protected static Integer parseOptionalIntValue(JSONObject json, String key) {
try {
return Integer.valueOf(json.getInt(key)); // depends on control dependency: [try], data = [none]
} catch (JSONException e) {
LOG.info(Messages.get().getBundle().key(Messages.LOG_OPTIONAL_INTEGER_MISSING_1, key), e);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(RaidArray raidArray, ProtocolMarshaller protocolMarshaller) {
if (raidArray == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(raidArray.getRaidArrayId(), RAIDARRAYID_BINDING);
protocolMarshaller.marshall(raidArray.getInstanceId(), INSTANCEID_BINDING);
protocolMarshaller.marshall(raidArray.getName(), NAME_BINDING);
protocolMarshaller.marshall(raidArray.getRaidLevel(), RAIDLEVEL_BINDING);
protocolMarshaller.marshall(raidArray.getNumberOfDisks(), NUMBEROFDISKS_BINDING);
protocolMarshaller.marshall(raidArray.getSize(), SIZE_BINDING);
protocolMarshaller.marshall(raidArray.getDevice(), DEVICE_BINDING);
protocolMarshaller.marshall(raidArray.getMountPoint(), MOUNTPOINT_BINDING);
protocolMarshaller.marshall(raidArray.getAvailabilityZone(), AVAILABILITYZONE_BINDING);
protocolMarshaller.marshall(raidArray.getCreatedAt(), CREATEDAT_BINDING);
protocolMarshaller.marshall(raidArray.getStackId(), STACKID_BINDING);
protocolMarshaller.marshall(raidArray.getVolumeType(), VOLUMETYPE_BINDING);
protocolMarshaller.marshall(raidArray.getIops(), IOPS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(RaidArray raidArray, ProtocolMarshaller protocolMarshaller) {
if (raidArray == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(raidArray.getRaidArrayId(), RAIDARRAYID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(raidArray.getInstanceId(), INSTANCEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(raidArray.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(raidArray.getRaidLevel(), RAIDLEVEL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(raidArray.getNumberOfDisks(), NUMBEROFDISKS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(raidArray.getSize(), SIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(raidArray.getDevice(), DEVICE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(raidArray.getMountPoint(), MOUNTPOINT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(raidArray.getAvailabilityZone(), AVAILABILITYZONE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(raidArray.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(raidArray.getStackId(), STACKID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(raidArray.getVolumeType(), VOLUMETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(raidArray.getIops(), IOPS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
AddIfStartupLeader addIfStartupLeader(Object... objects) {
if (addIfStartupLeader == null) {
this.addIfStartupLeader = new AddIfStartupLeader(getWebServer().isStartupLeader());
}
addIfStartupLeader.ifAdd(objects);
return addIfStartupLeader;
} } | public class class_name {
AddIfStartupLeader addIfStartupLeader(Object... objects) {
if (addIfStartupLeader == null) {
this.addIfStartupLeader = new AddIfStartupLeader(getWebServer().isStartupLeader()); // depends on control dependency: [if], data = [none]
}
addIfStartupLeader.ifAdd(objects);
return addIfStartupLeader;
} } |
public class class_name {
@Override
public int cancel(String pattern, Character escape, TaskState state, boolean inState) {
String owner = getOwner();
if (owner == null)
return 0;
pattern = pattern == null ? null : Utils.normalizeString(pattern);
int updateCount = 0;
TransactionController tranController = new TransactionController();
try {
tranController.preInvoke();
updateCount = taskStore.cancel(pattern, escape, state, inState, owner);
} catch (Throwable x) {
tranController.setFailure(x);
} finally {
PersistentStoreException x = tranController.postInvoke(PersistentStoreException.class); // TODO proposed spec class
if (x != null)
throw x;
}
return updateCount;
} } | public class class_name {
@Override
public int cancel(String pattern, Character escape, TaskState state, boolean inState) {
String owner = getOwner();
if (owner == null)
return 0;
pattern = pattern == null ? null : Utils.normalizeString(pattern);
int updateCount = 0;
TransactionController tranController = new TransactionController();
try {
tranController.preInvoke(); // depends on control dependency: [try], data = [none]
updateCount = taskStore.cancel(pattern, escape, state, inState, owner); // depends on control dependency: [try], data = [none]
} catch (Throwable x) {
tranController.setFailure(x);
} finally { // depends on control dependency: [catch], data = [none]
PersistentStoreException x = tranController.postInvoke(PersistentStoreException.class); // TODO proposed spec class
if (x != null)
throw x;
}
return updateCount;
} } |
public class class_name {
private void saveProperties(String resourcePath, Map<String, String> properties) throws CmsException {
CmsResource resource;
CmsObject cms = getCmsObject();
int pos = resourcePath.indexOf("?");
String resName = resourcePath;
if (pos > -1) {
resName = resourcePath.substring(0, pos);
}
resource = cms.readResource(resName);
if (properties != null) {
for (Entry<String, String> entry : properties.entrySet()) {
String propertyName = entry.getKey();
String propertyValue = entry.getValue();
if (CmsStringUtil.isEmptyOrWhitespaceOnly(propertyValue)) {
propertyValue = "";
}
try {
CmsProperty currentProperty = cms.readPropertyObject(resource, propertyName, false);
// detect if property is a null property or not
if (currentProperty.isNullProperty()) {
// create new property object and set key and value
currentProperty = new CmsProperty();
currentProperty.setName(propertyName);
if (OpenCms.getWorkplaceManager().isDefaultPropertiesOnStructure()) {
// set structure value
currentProperty.setStructureValue(propertyValue);
currentProperty.setResourceValue(null);
} else {
// set resource value
currentProperty.setStructureValue(null);
currentProperty.setResourceValue(propertyValue);
}
} else if (currentProperty.getStructureValue() != null) {
// structure value has to be updated
currentProperty.setStructureValue(propertyValue);
currentProperty.setResourceValue(null);
} else {
// resource value has to be updated
currentProperty.setStructureValue(null);
currentProperty.setResourceValue(propertyValue);
}
CmsLock lock = cms.getLock(resource);
if (lock.isUnlocked()) {
// lock resource before operation
cms.lockResource(resName);
}
// write the property to the resource
cms.writePropertyObject(resName, currentProperty);
// unlock the resource
cms.unlockResource(resName);
} catch (CmsException e) {
// writing the property failed, log error
log(e.getLocalizedMessage());
}
}
}
} } | public class class_name {
private void saveProperties(String resourcePath, Map<String, String> properties) throws CmsException {
CmsResource resource;
CmsObject cms = getCmsObject();
int pos = resourcePath.indexOf("?");
String resName = resourcePath;
if (pos > -1) {
resName = resourcePath.substring(0, pos);
}
resource = cms.readResource(resName);
if (properties != null) {
for (Entry<String, String> entry : properties.entrySet()) {
String propertyName = entry.getKey();
String propertyValue = entry.getValue();
if (CmsStringUtil.isEmptyOrWhitespaceOnly(propertyValue)) {
propertyValue = ""; // depends on control dependency: [if], data = [none]
}
try {
CmsProperty currentProperty = cms.readPropertyObject(resource, propertyName, false);
// detect if property is a null property or not
if (currentProperty.isNullProperty()) {
// create new property object and set key and value
currentProperty = new CmsProperty(); // depends on control dependency: [if], data = [none]
currentProperty.setName(propertyName); // depends on control dependency: [if], data = [none]
if (OpenCms.getWorkplaceManager().isDefaultPropertiesOnStructure()) {
// set structure value
currentProperty.setStructureValue(propertyValue); // depends on control dependency: [if], data = [none]
currentProperty.setResourceValue(null); // depends on control dependency: [if], data = [none]
} else {
// set resource value
currentProperty.setStructureValue(null); // depends on control dependency: [if], data = [none]
currentProperty.setResourceValue(propertyValue); // depends on control dependency: [if], data = [none]
}
} else if (currentProperty.getStructureValue() != null) {
// structure value has to be updated
currentProperty.setStructureValue(propertyValue); // depends on control dependency: [if], data = [none]
currentProperty.setResourceValue(null); // depends on control dependency: [if], data = [null)]
} else {
// resource value has to be updated
currentProperty.setStructureValue(null); // depends on control dependency: [if], data = [null)]
currentProperty.setResourceValue(propertyValue); // depends on control dependency: [if], data = [none]
}
CmsLock lock = cms.getLock(resource);
if (lock.isUnlocked()) {
// lock resource before operation
cms.lockResource(resName); // depends on control dependency: [if], data = [none]
}
// write the property to the resource
cms.writePropertyObject(resName, currentProperty); // depends on control dependency: [try], data = [none]
// unlock the resource
cms.unlockResource(resName); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
// writing the property failed, log error
log(e.getLocalizedMessage());
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
protected String getJWTFromCookie(HttpServletRequest req) {
String serializedJWT = null;
Cookie[] cookies = req.getCookies();
if (cookieName != null && cookies != null) {
for (Cookie cookie : cookies) {
if (cookieName.equals(cookie.getName())) {
if (LOG.isDebugEnabled()) {
LOG.debug("{} cookie has been found and is being processed", cookieName);
}
serializedJWT = cookie.getValue();
break;
}
}
}
return serializedJWT;
} } | public class class_name {
protected String getJWTFromCookie(HttpServletRequest req) {
String serializedJWT = null;
Cookie[] cookies = req.getCookies();
if (cookieName != null && cookies != null) {
for (Cookie cookie : cookies) {
if (cookieName.equals(cookie.getName())) {
if (LOG.isDebugEnabled()) {
LOG.debug("{} cookie has been found and is being processed", cookieName); // depends on control dependency: [if], data = [none]
}
serializedJWT = cookie.getValue(); // depends on control dependency: [if], data = [none]
break;
}
}
}
return serializedJWT;
} } |
public class class_name {
public static Object[] toArray(List list)
{
Object[] result;
int size = list.size();
if (size == 0) {
result = NoArguments;
} else {
result = getObjectArrayPool().create(list.size());
for (int i = 0; i < size; i++) {
result[i] = list.get(i);
}
}
return result;
} } | public class class_name {
public static Object[] toArray(List list)
{
Object[] result;
int size = list.size();
if (size == 0) {
result = NoArguments; // depends on control dependency: [if], data = [none]
} else {
result = getObjectArrayPool().create(list.size()); // depends on control dependency: [if], data = [none]
for (int i = 0; i < size; i++) {
result[i] = list.get(i); // depends on control dependency: [for], data = [i]
}
}
return result;
} } |
public class class_name {
protected boolean doesCommonContentMatch(final CommonContent commonContent, final CSNodeWrapper node, boolean matchContent) {
if (!node.getNodeType().equals(CommonConstants.CS_NODE_COMMON_CONTENT)) return false;
// If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare
if (commonContent.getUniqueId() != null && commonContent.getUniqueId().matches("^\\d.*")) {
return commonContent.getUniqueId().equals(Integer.toString(node.getId()));
} else if (matchContent) {
return StringUtilities.similarDamerauLevenshtein(commonContent.getTitle(),
node.getTitle()) >= ProcessorConstants.MIN_MATCH_SIMILARITY;
} else {
// Check the parent has the same name
if (commonContent.getParent() != null) {
return commonContent.getParent().getTitle().equals(node.getParent().getTitle());
}
return true;
}
} } | public class class_name {
protected boolean doesCommonContentMatch(final CommonContent commonContent, final CSNodeWrapper node, boolean matchContent) {
if (!node.getNodeType().equals(CommonConstants.CS_NODE_COMMON_CONTENT)) return false;
// If the unique id is not from the parser, in which case it will start with a number than use the unique id to compare
if (commonContent.getUniqueId() != null && commonContent.getUniqueId().matches("^\\d.*")) {
return commonContent.getUniqueId().equals(Integer.toString(node.getId())); // depends on control dependency: [if], data = [none]
} else if (matchContent) {
return StringUtilities.similarDamerauLevenshtein(commonContent.getTitle(),
node.getTitle()) >= ProcessorConstants.MIN_MATCH_SIMILARITY; // depends on control dependency: [if], data = [none]
} else {
// Check the parent has the same name
if (commonContent.getParent() != null) {
return commonContent.getParent().getTitle().equals(node.getParent().getTitle()); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void setDecomposition(int decomposition)
{
checkNotFrozen();
boolean flag;
switch(decomposition) {
case NO_DECOMPOSITION:
flag = false;
break;
case CANONICAL_DECOMPOSITION:
flag = true;
break;
default:
throw new IllegalArgumentException("Wrong decomposition mode.");
}
if(flag == settings.readOnly().getFlag(CollationSettings.CHECK_FCD)) { return; }
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setFlag(CollationSettings.CHECK_FCD, flag);
setFastLatinOptions(ownedSettings);
} } | public class class_name {
@Override
public void setDecomposition(int decomposition)
{
checkNotFrozen();
boolean flag;
switch(decomposition) {
case NO_DECOMPOSITION:
flag = false;
break;
case CANONICAL_DECOMPOSITION:
flag = true;
break;
default:
throw new IllegalArgumentException("Wrong decomposition mode.");
}
if(flag == settings.readOnly().getFlag(CollationSettings.CHECK_FCD)) { return; } // depends on control dependency: [if], data = [none]
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setFlag(CollationSettings.CHECK_FCD, flag);
setFastLatinOptions(ownedSettings);
} } |
public class class_name {
public ManagedConnection matchManagedConnections(
final Set potentialMatches, final Subject subject,
final ConnectionRequestInfo requestInfo)
throws ResourceAdapterInternalException {
if (TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "matchManagedConnections", new Object[] {
potentialMatches, SibRaUtils.subjectToString(subject),
requestInfo });
}
ManagedConnection match = null;
// Check it is one of our request info objects
if (requestInfo instanceof SibRaConnectionRequestInfo) {
final SibRaConnectionRequestInfo sibRaRequestInfo = (SibRaConnectionRequestInfo) requestInfo;
final SibRaConnectionInfo connectionInfo = new SibRaConnectionInfo(
this, subject, sibRaRequestInfo);
// Iterate over the potential matches
for (final Iterator iterator = potentialMatches.iterator(); iterator
.hasNext()
&& (match == null);) {
final Object object = iterator.next();
// Check that it is one of ours
if (object instanceof SibRaManagedConnection) {
final SibRaManagedConnection potentialMatch = (SibRaManagedConnection) object;
// See if it matches
if (potentialMatch.matches(connectionInfo, sibRaRequestInfo
.getCoreConnection())) {
match = potentialMatch;
}
}
}
} else {
// Connection manager error if it is passing us someone else's
// request information
throw new ResourceAdapterInternalException(NLS
.getString("UNRECOGNISED_REQUEST_INFO_CWSIV0354"));
}
if (TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "matchManagedConnections", match);
}
return match;
} } | public class class_name {
public ManagedConnection matchManagedConnections(
final Set potentialMatches, final Subject subject,
final ConnectionRequestInfo requestInfo)
throws ResourceAdapterInternalException {
if (TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "matchManagedConnections", new Object[] {
potentialMatches, SibRaUtils.subjectToString(subject),
requestInfo });
}
ManagedConnection match = null;
// Check it is one of our request info objects
if (requestInfo instanceof SibRaConnectionRequestInfo) {
final SibRaConnectionRequestInfo sibRaRequestInfo = (SibRaConnectionRequestInfo) requestInfo;
final SibRaConnectionInfo connectionInfo = new SibRaConnectionInfo(
this, subject, sibRaRequestInfo);
// Iterate over the potential matches
for (final Iterator iterator = potentialMatches.iterator(); iterator
.hasNext()
&& (match == null);) {
final Object object = iterator.next();
// Check that it is one of ours
if (object instanceof SibRaManagedConnection) {
final SibRaManagedConnection potentialMatch = (SibRaManagedConnection) object;
// See if it matches
if (potentialMatch.matches(connectionInfo, sibRaRequestInfo
.getCoreConnection())) {
match = potentialMatch; // depends on control dependency: [if], data = [none]
}
}
}
} else {
// Connection manager error if it is passing us someone else's
// request information
throw new ResourceAdapterInternalException(NLS
.getString("UNRECOGNISED_REQUEST_INFO_CWSIV0354"));
}
if (TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "matchManagedConnections", match);
}
return match;
} } |
public class class_name {
@Override
public String getSourceName(Object source) {
if (source instanceof ElementSource) {
source = ((ElementSource) source).getDeclaringSource();
}
if (source instanceof Method) {
source = StackTraceElements.forMember((Method) source);
}
if (source instanceof StackTraceElement) {
return getFileString((StackTraceElement) source);
}
return stripPackages(source.toString());
} } | public class class_name {
@Override
public String getSourceName(Object source) {
if (source instanceof ElementSource) {
source = ((ElementSource) source).getDeclaringSource(); // depends on control dependency: [if], data = [none]
}
if (source instanceof Method) {
source = StackTraceElements.forMember((Method) source); // depends on control dependency: [if], data = [none]
}
if (source instanceof StackTraceElement) {
return getFileString((StackTraceElement) source); // depends on control dependency: [if], data = [none]
}
return stripPackages(source.toString());
} } |
public class class_name {
static IDevice obtainRealDevice(AndroidDebugBridge adb, String serial) {
// Get an existing real device.
for (IDevice adbDevice : adb.getDevices()) {
if (adbDevice.getSerialNumber().equals(serial)) {
return adbDevice;
}
}
throw new IllegalArgumentException("Unknown device serial: " + serial);
} } | public class class_name {
static IDevice obtainRealDevice(AndroidDebugBridge adb, String serial) {
// Get an existing real device.
for (IDevice adbDevice : adb.getDevices()) {
if (adbDevice.getSerialNumber().equals(serial)) {
return adbDevice; // depends on control dependency: [if], data = [none]
}
}
throw new IllegalArgumentException("Unknown device serial: " + serial);
} } |
public class class_name {
static private long computeStrides(int[] shape, int[] stride) {
long product = 1;
for (int ii = shape.length - 1; ii >= 0; ii--) {
final int thisDim = shape[ii];
if (thisDim < 0)
continue; // ignore vlen
stride[ii] = (int) product;
product *= thisDim;
}
return product;
} } | public class class_name {
static private long computeStrides(int[] shape, int[] stride) {
long product = 1;
for (int ii = shape.length - 1; ii >= 0; ii--) {
final int thisDim = shape[ii];
if (thisDim < 0)
continue; // ignore vlen
stride[ii] = (int) product;
// depends on control dependency: [for], data = [ii]
product *= thisDim;
// depends on control dependency: [for], data = [none]
}
return product;
} } |
public class class_name {
void constructLinearSystem(List<DMatrixRMaj> homographies,
List<List<PointIndex2D_F64>> observations) {
// parameters are encoded points first then the
int startView = totalFeatures*3;
A.reshape(numEquations,numUnknown);
DMatrixRMaj H = new DMatrixRMaj(3,3);
Point2D_F64 p = new Point2D_F64();
int row = 0;
for (int viewIdx = 0; viewIdx < homographies.size(); viewIdx++) {
N.apply(homographies.get(viewIdx),H);
int colView = startView + viewIdx*3;
List<PointIndex2D_F64> obs = observations.get(viewIdx);
for (int i = 0; i < obs.size(); i++) {
PointIndex2D_F64 p_pixel = obs.get(i);
N.apply(p_pixel,p);
// column this feature is at
int col = p_pixel.index*3;
// x component of pixel
// A(row,colView) = ...
A.data[row*A.numCols + col ] = p.x*H.get(2,0) - H.get(0,0);
A.data[row*A.numCols + col + 1] = p.x*H.get(2,1) - H.get(0,1);
A.data[row*A.numCols + col + 2] = p.x*H.get(2,2) - H.get(0,2);
A.data[row*A.numCols + colView ] = -1;
A.data[row*A.numCols + colView + 1 ] = 0;
A.data[row*A.numCols + colView + 2 ] = p.x;
// y component of pixel
row += 1;
A.data[row*A.numCols + col ] = p.y*H.get(2,0) - H.get(1,0);
A.data[row*A.numCols + col + 1] = p.y*H.get(2,1) - H.get(1,1);
A.data[row*A.numCols + col + 2] = p.y*H.get(2,2) - H.get(1,2);
A.data[row*A.numCols + colView ] = 0;
A.data[row*A.numCols + colView + 1 ] = -1;
A.data[row*A.numCols + colView + 2 ] = p.y;
row += 1;
}
}
} } | public class class_name {
void constructLinearSystem(List<DMatrixRMaj> homographies,
List<List<PointIndex2D_F64>> observations) {
// parameters are encoded points first then the
int startView = totalFeatures*3;
A.reshape(numEquations,numUnknown);
DMatrixRMaj H = new DMatrixRMaj(3,3);
Point2D_F64 p = new Point2D_F64();
int row = 0;
for (int viewIdx = 0; viewIdx < homographies.size(); viewIdx++) {
N.apply(homographies.get(viewIdx),H); // depends on control dependency: [for], data = [viewIdx]
int colView = startView + viewIdx*3;
List<PointIndex2D_F64> obs = observations.get(viewIdx);
for (int i = 0; i < obs.size(); i++) {
PointIndex2D_F64 p_pixel = obs.get(i);
N.apply(p_pixel,p); // depends on control dependency: [for], data = [none]
// column this feature is at
int col = p_pixel.index*3;
// x component of pixel
// A(row,colView) = ...
A.data[row*A.numCols + col ] = p.x*H.get(2,0) - H.get(0,0); // depends on control dependency: [for], data = [none]
A.data[row*A.numCols + col + 1] = p.x*H.get(2,1) - H.get(0,1); // depends on control dependency: [for], data = [none]
A.data[row*A.numCols + col + 2] = p.x*H.get(2,2) - H.get(0,2); // depends on control dependency: [for], data = [none]
A.data[row*A.numCols + colView ] = -1; // depends on control dependency: [for], data = [none]
A.data[row*A.numCols + colView + 1 ] = 0; // depends on control dependency: [for], data = [none]
A.data[row*A.numCols + colView + 2 ] = p.x; // depends on control dependency: [for], data = [none]
// y component of pixel
row += 1; // depends on control dependency: [for], data = [none]
A.data[row*A.numCols + col ] = p.y*H.get(2,0) - H.get(1,0); // depends on control dependency: [for], data = [none]
A.data[row*A.numCols + col + 1] = p.y*H.get(2,1) - H.get(1,1); // depends on control dependency: [for], data = [none]
A.data[row*A.numCols + col + 2] = p.y*H.get(2,2) - H.get(1,2); // depends on control dependency: [for], data = [none]
A.data[row*A.numCols + colView ] = 0; // depends on control dependency: [for], data = [none]
A.data[row*A.numCols + colView + 1 ] = -1; // depends on control dependency: [for], data = [none]
A.data[row*A.numCols + colView + 2 ] = p.y; // depends on control dependency: [for], data = [none]
row += 1; // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
public CMAEntry setField(String key, String locale, Object value) {
if (fields == null) {
fields = new LinkedHashMap<String, LinkedHashMap<String, Object>>();
}
LinkedHashMap<String, Object> field = fields.get(key);
if (field == null) {
field = new LinkedHashMap<String, Object>();
}
field.put(locale, value);
fields.put(key, field);
return this;
} } | public class class_name {
public CMAEntry setField(String key, String locale, Object value) {
if (fields == null) {
fields = new LinkedHashMap<String, LinkedHashMap<String, Object>>(); // depends on control dependency: [if], data = [none]
}
LinkedHashMap<String, Object> field = fields.get(key);
if (field == null) {
field = new LinkedHashMap<String, Object>(); // depends on control dependency: [if], data = [none]
}
field.put(locale, value);
fields.put(key, field);
return this;
} } |
public class class_name {
public void distribute(CmsObject cms, List<I_CmsNewsletterRecipient> recipients, I_CmsNewsletter newsletter) {
Iterator<I_CmsNewsletterRecipient> recipientsIterator = recipients.iterator();
while (recipientsIterator.hasNext()) {
I_CmsNewsletterRecipient recipient = recipientsIterator.next();
try {
Email mail = newsletter.getEmail(cms, recipient);
mail.addTo(recipient.getEmail(), recipient.getFullName());
mail.send();
} catch (Exception e) {
LOG.error(e.getMessage(), e);
}
}
} } | public class class_name {
public void distribute(CmsObject cms, List<I_CmsNewsletterRecipient> recipients, I_CmsNewsletter newsletter) {
Iterator<I_CmsNewsletterRecipient> recipientsIterator = recipients.iterator();
while (recipientsIterator.hasNext()) {
I_CmsNewsletterRecipient recipient = recipientsIterator.next();
try {
Email mail = newsletter.getEmail(cms, recipient);
mail.addTo(recipient.getEmail(), recipient.getFullName()); // depends on control dependency: [try], data = [none]
mail.send(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static long extractAllDefaultValue(Map<String, Map<String, Long>> targetStats)
{
Map<String, Long> allTimeMap = targetStats.get(ALLTIME_KEY);
if (allTimeMap == null)
{
return 0L;
}
Long defaultValue = allTimeMap.get(DEFAULT_KEY);
if (defaultValue == null)
{
return 0L;
}
return defaultValue;
} } | public class class_name {
public static long extractAllDefaultValue(Map<String, Map<String, Long>> targetStats)
{
Map<String, Long> allTimeMap = targetStats.get(ALLTIME_KEY);
if (allTimeMap == null)
{
return 0L; // depends on control dependency: [if], data = [none]
}
Long defaultValue = allTimeMap.get(DEFAULT_KEY);
if (defaultValue == null)
{
return 0L; // depends on control dependency: [if], data = [none]
}
return defaultValue;
} } |
public class class_name {
public Set<EnumType> getEnumTypes() {
Set<EnumType> ret = Sets.newTreeSet();
for (Entity entity : getEntities().getList()) {
for (Attribute attribute : entity.getAttributes().getList()) {
if (attribute.isEnum()) {
ret.add(attribute.getEnumType());
}
}
}
return ret;
} } | public class class_name {
public Set<EnumType> getEnumTypes() {
Set<EnumType> ret = Sets.newTreeSet();
for (Entity entity : getEntities().getList()) {
for (Attribute attribute : entity.getAttributes().getList()) {
if (attribute.isEnum()) {
ret.add(attribute.getEnumType()); // depends on control dependency: [if], data = [none]
}
}
}
return ret;
} } |
public class class_name {
public static <E> List<E> refineCandidates(final List<E> candidates, final Predicate<? super E> predicate) {
if (candidates.size() == 1) {
return candidates;
}
List<E> newCandidates = CollectionUtils.filter(candidates, predicate);
if (newCandidates.isEmpty()) {
return candidates;
}
return newCandidates;
} } | public class class_name {
public static <E> List<E> refineCandidates(final List<E> candidates, final Predicate<? super E> predicate) {
if (candidates.size() == 1) {
return candidates; // depends on control dependency: [if], data = [none]
}
List<E> newCandidates = CollectionUtils.filter(candidates, predicate);
if (newCandidates.isEmpty()) {
return candidates; // depends on control dependency: [if], data = [none]
}
return newCandidates;
} } |
public class class_name {
public static CompletableFuture<MessageSet> getMessagesAroundWhile(
TextChannel channel, Predicate<Message> condition, long around) {
CompletableFuture<MessageSet> future = new CompletableFuture<>();
channel.getApi().getThreadPool().getExecutorService().submit(() -> {
try {
List<Message> messages = new ArrayList<>();
Optional<Message> untilMessage =
getMessagesAroundAsStream(channel, around)
.peek(messages::add)
.filter(condition.negate())
.findFirst();
untilMessage.ifPresent(messages::remove);
future.complete(new MessageSetImpl(messages));
} catch (Throwable t) {
future.completeExceptionally(t);
}
});
return future;
} } | public class class_name {
public static CompletableFuture<MessageSet> getMessagesAroundWhile(
TextChannel channel, Predicate<Message> condition, long around) {
CompletableFuture<MessageSet> future = new CompletableFuture<>();
channel.getApi().getThreadPool().getExecutorService().submit(() -> {
try {
List<Message> messages = new ArrayList<>();
Optional<Message> untilMessage =
getMessagesAroundAsStream(channel, around)
.peek(messages::add)
.filter(condition.negate())
.findFirst();
untilMessage.ifPresent(messages::remove); // depends on control dependency: [try], data = [none]
future.complete(new MessageSetImpl(messages)); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
future.completeExceptionally(t);
} // depends on control dependency: [catch], data = [none]
});
return future;
} } |
public class class_name {
public FieldValue evaluate(FieldName name){
Map<FieldName, FieldValue> values = getValues();
FieldValue value = values.getOrDefault(name, EvaluationContext.UNDECLARED_VALUE);
if(value != EvaluationContext.UNDECLARED_VALUE){
return value;
}
return resolve(name);
} } | public class class_name {
public FieldValue evaluate(FieldName name){
Map<FieldName, FieldValue> values = getValues();
FieldValue value = values.getOrDefault(name, EvaluationContext.UNDECLARED_VALUE);
if(value != EvaluationContext.UNDECLARED_VALUE){
return value; // depends on control dependency: [if], data = [none]
}
return resolve(name);
} } |
public class class_name {
public KamNode resolve(final Kam kam, final KAMStore kAMStore,
final String belTerm, Map<String, String> nsmap,
Equivalencer equivalencer) throws ResolverException {
if (nulls(kam, kAMStore, belTerm, nsmap, equivalencer)) {
throw new InvalidArgument(
"null parameter(s) provided to resolve API.");
}
try {
// algorithm:
// - parse the bel term
// - get all parameters; remap to kam namespace by prefix
// - convert bel term to string replacing each parameter with '#'
// - get uuid for each parameter; ordered by sequence (l to r)
// - (x) if no match, attempt non-equivalence query
// - find kam node by term signature / uuids
// parse the bel term
Term term = null;
try {
term = BELParser.parseTerm(belTerm);
if (term == null) return null;
} catch (Exception e) {
// unrecognized BEL structure
return null;
}
// get all parameters; remap to kam namespace by prefix
List<Parameter> params = term.getAllParametersLeftToRight();
remapNamespace(params, nsmap);
// convert bel term to signature
String termSignature = term.toTermSignature();
// find uuids for all parameters; bucket both the mapped and
// unmapped namespace values
SkinnyUUID[] uuids = new SkinnyUUID[params.size()];
Parameter[] parray = params.toArray(new Parameter[params.size()]);
boolean missing = false;
for (int i = 0; i < parray.length; i++) {
Parameter param = parray[i];
Namespace ns = param.getNamespace();
if (ns == null) {
missing = true;
break;
}
String value = clean(param.getValue());
SkinnyUUID uuid = null;
try {
uuid = equivalencer.getUUID(ns, value);
} catch (EquivalencerException e) {
throw new ResolverException(e);
}
if (uuid != null && !kAMStore.getKamNodes(kam, uuid).isEmpty()) {
uuids[i] = uuid;
} else {
missing = true;
break;
}
}
// TODO Handle terms that may not have UUID parameters!
if (missing) {
KamNode kamNode = kAMStore.getKamNode(kam, belTerm);
return kamNode;
}
// find kam node by term signature / uuids
return kAMStore.getKamNodeForTerm(kam, termSignature,
term.getFunctionEnum(), uuids);
} catch (KAMStoreException e) {
throw new ResolverException(e);
}
} } | public class class_name {
public KamNode resolve(final Kam kam, final KAMStore kAMStore,
final String belTerm, Map<String, String> nsmap,
Equivalencer equivalencer) throws ResolverException {
if (nulls(kam, kAMStore, belTerm, nsmap, equivalencer)) {
throw new InvalidArgument(
"null parameter(s) provided to resolve API.");
}
try {
// algorithm:
// - parse the bel term
// - get all parameters; remap to kam namespace by prefix
// - convert bel term to string replacing each parameter with '#'
// - get uuid for each parameter; ordered by sequence (l to r)
// - (x) if no match, attempt non-equivalence query
// - find kam node by term signature / uuids
// parse the bel term
Term term = null;
try {
term = BELParser.parseTerm(belTerm); // depends on control dependency: [try], data = [none]
if (term == null) return null;
} catch (Exception e) {
// unrecognized BEL structure
return null;
} // depends on control dependency: [catch], data = [none]
// get all parameters; remap to kam namespace by prefix
List<Parameter> params = term.getAllParametersLeftToRight();
remapNamespace(params, nsmap);
// convert bel term to signature
String termSignature = term.toTermSignature();
// find uuids for all parameters; bucket both the mapped and
// unmapped namespace values
SkinnyUUID[] uuids = new SkinnyUUID[params.size()];
Parameter[] parray = params.toArray(new Parameter[params.size()]);
boolean missing = false;
for (int i = 0; i < parray.length; i++) {
Parameter param = parray[i];
Namespace ns = param.getNamespace();
if (ns == null) {
missing = true; // depends on control dependency: [if], data = [none]
break;
}
String value = clean(param.getValue());
SkinnyUUID uuid = null;
try {
uuid = equivalencer.getUUID(ns, value); // depends on control dependency: [try], data = [none]
} catch (EquivalencerException e) {
throw new ResolverException(e);
} // depends on control dependency: [catch], data = [none]
if (uuid != null && !kAMStore.getKamNodes(kam, uuid).isEmpty()) {
uuids[i] = uuid; // depends on control dependency: [if], data = [none]
} else {
missing = true; // depends on control dependency: [if], data = [none]
break;
}
}
// TODO Handle terms that may not have UUID parameters!
if (missing) {
KamNode kamNode = kAMStore.getKamNode(kam, belTerm);
return kamNode; // depends on control dependency: [if], data = [none]
}
// find kam node by term signature / uuids
return kAMStore.getKamNodeForTerm(kam, termSignature,
term.getFunctionEnum(), uuids);
} catch (KAMStoreException e) {
throw new ResolverException(e);
}
} } |
public class class_name {
public static String getNAFTagSet(final String postag, final String lang) {
String tag = null;
if (lang.equalsIgnoreCase("de")) {
tag = mapGermanCoNLL09TagSetToNAF(postag);
} else if (lang.equalsIgnoreCase("en")) {
tag = mapEnglishPennTagSetToNAF(postag);
} else if (lang.equalsIgnoreCase("es")) {
tag = mapSpanishAncoraTagSetToNAF(postag);
} else if (lang.equalsIgnoreCase("eu")) {
tag = mapUDTagSetToNAF(postag);
} else if (lang.equalsIgnoreCase("gl")) {
tag = mapGalicianCTAGTagSetToNAF(postag);
} else if (lang.equalsIgnoreCase("fr")) {
tag = mapFrenchCCTagSetToNAF(postag);
} else if (lang.equalsIgnoreCase("it")) {
tag = mapUDTagSetToNAF(postag);
} else if (lang.equalsIgnoreCase("nl")) {
tag = mapWotanTagSetToNAF(postag);
} else {
tag = "O";
}
return tag;
} } | public class class_name {
public static String getNAFTagSet(final String postag, final String lang) {
String tag = null;
if (lang.equalsIgnoreCase("de")) {
tag = mapGermanCoNLL09TagSetToNAF(postag); // depends on control dependency: [if], data = [none]
} else if (lang.equalsIgnoreCase("en")) {
tag = mapEnglishPennTagSetToNAF(postag); // depends on control dependency: [if], data = [none]
} else if (lang.equalsIgnoreCase("es")) {
tag = mapSpanishAncoraTagSetToNAF(postag); // depends on control dependency: [if], data = [none]
} else if (lang.equalsIgnoreCase("eu")) {
tag = mapUDTagSetToNAF(postag); // depends on control dependency: [if], data = [none]
} else if (lang.equalsIgnoreCase("gl")) {
tag = mapGalicianCTAGTagSetToNAF(postag); // depends on control dependency: [if], data = [none]
} else if (lang.equalsIgnoreCase("fr")) {
tag = mapFrenchCCTagSetToNAF(postag); // depends on control dependency: [if], data = [none]
} else if (lang.equalsIgnoreCase("it")) {
tag = mapUDTagSetToNAF(postag); // depends on control dependency: [if], data = [none]
} else if (lang.equalsIgnoreCase("nl")) {
tag = mapWotanTagSetToNAF(postag); // depends on control dependency: [if], data = [none]
} else {
tag = "O"; // depends on control dependency: [if], data = [none]
}
return tag;
} } |
public class class_name {
public void marshall(StopQueryRequest stopQueryRequest, ProtocolMarshaller protocolMarshaller) {
if (stopQueryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stopQueryRequest.getQueryId(), QUERYID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(StopQueryRequest stopQueryRequest, ProtocolMarshaller protocolMarshaller) {
if (stopQueryRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stopQueryRequest.getQueryId(), QUERYID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public final S build() {
S vt = createTransition();
markObjectAsModifiabilityFlag(vt);
vt.setId(mId);
if (mInterpolator != null) {
vt.setInterpolator(mInterpolator);
}
if (mReverse) {
vt.reverse();
}
return vt;
} } | public class class_name {
public final S build() {
S vt = createTransition();
markObjectAsModifiabilityFlag(vt);
vt.setId(mId);
if (mInterpolator != null) {
vt.setInterpolator(mInterpolator); // depends on control dependency: [if], data = [(mInterpolator]
}
if (mReverse) {
vt.reverse(); // depends on control dependency: [if], data = [none]
}
return vt;
} } |
public class class_name {
public void showCompression(Formatter f) {
if (mtype != H5header.MessageType.AttributeInfo) {
f.format("No fractal heap");
return;
}
MessageAttributeInfo info = (MessageAttributeInfo) messData;
info.showFractalHeap(f);
} } | public class class_name {
public void showCompression(Formatter f) {
if (mtype != H5header.MessageType.AttributeInfo) {
f.format("No fractal heap"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
MessageAttributeInfo info = (MessageAttributeInfo) messData;
info.showFractalHeap(f);
} } |
public class class_name {
public static Set<String> getClassPaths(String packageName, boolean isDecode) {
String packagePath = packageName.replace(StrUtil.DOT, StrUtil.SLASH);
Enumeration<URL> resources;
try {
resources = getClassLoader().getResources(packagePath);
} catch (IOException e) {
throw new UtilException(e, "Loading classPath [{}] error!", packagePath);
}
final Set<String> paths = new HashSet<String>();
String path;
while (resources.hasMoreElements()) {
path = resources.nextElement().getPath();
paths.add(isDecode ? URLUtil.decode(path, CharsetUtil.systemCharsetName()) : path);
}
return paths;
} } | public class class_name {
public static Set<String> getClassPaths(String packageName, boolean isDecode) {
String packagePath = packageName.replace(StrUtil.DOT, StrUtil.SLASH);
Enumeration<URL> resources;
try {
resources = getClassLoader().getResources(packagePath);
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new UtilException(e, "Loading classPath [{}] error!", packagePath);
}
// depends on control dependency: [catch], data = [none]
final Set<String> paths = new HashSet<String>();
String path;
while (resources.hasMoreElements()) {
path = resources.nextElement().getPath();
// depends on control dependency: [while], data = [none]
paths.add(isDecode ? URLUtil.decode(path, CharsetUtil.systemCharsetName()) : path);
// depends on control dependency: [while], data = [none]
}
return paths;
} } |
public class class_name {
private List<ClasspathElement> findClasspathOrder(final Set<ClasspathElement> uniqueClasspathElements,
final Queue<Entry<Integer, ClasspathElement>> toplevelClasspathEltsIndexed) {
final List<ClasspathElement> toplevelClasspathEltsOrdered = orderClasspathElements(
toplevelClasspathEltsIndexed);
for (final ClasspathElement classpathElt : uniqueClasspathElements) {
classpathElt.childClasspathElementsOrdered = orderClasspathElements(
classpathElt.childClasspathElementsIndexed);
}
final Set<ClasspathElement> visitedClasspathElts = new HashSet<>();
final List<ClasspathElement> order = new ArrayList<>();
for (final ClasspathElement toplevelClasspathElt : toplevelClasspathEltsOrdered) {
findClasspathOrderRec(toplevelClasspathElt, visitedClasspathElts, order);
}
return order;
} } | public class class_name {
private List<ClasspathElement> findClasspathOrder(final Set<ClasspathElement> uniqueClasspathElements,
final Queue<Entry<Integer, ClasspathElement>> toplevelClasspathEltsIndexed) {
final List<ClasspathElement> toplevelClasspathEltsOrdered = orderClasspathElements(
toplevelClasspathEltsIndexed);
for (final ClasspathElement classpathElt : uniqueClasspathElements) {
classpathElt.childClasspathElementsOrdered = orderClasspathElements(
classpathElt.childClasspathElementsIndexed); // depends on control dependency: [for], data = [classpathElt]
}
final Set<ClasspathElement> visitedClasspathElts = new HashSet<>();
final List<ClasspathElement> order = new ArrayList<>();
for (final ClasspathElement toplevelClasspathElt : toplevelClasspathEltsOrdered) {
findClasspathOrderRec(toplevelClasspathElt, visitedClasspathElts, order); // depends on control dependency: [for], data = [toplevelClasspathElt]
}
return order;
} } |
public class class_name {
public void setEndpointConfig(CommonConfig config)
{
if (this.config == null)
{
this.config = config;
//setup using provided configuration
Map<String, String> epConfProps = config.getProperties();
if (!epConfProps.isEmpty())
{
final Map<String, Object> propMap = getProperties();
if (propMap == null)
{
setProperties(new HashMap<String, Object>(epConfProps));
}
else
{
propMap.putAll(epConfProps);
}
InterceptorUtils.addInterceptors(this, epConfProps);
FeatureUtils.addFeatures(this, getBus(), epConfProps);
}
//handlers config is done later, as when this methods is called getBinding() can't
//be used without messing with the servlet destinations due to the endpoint address
//not having been rewritten yet.
}
} } | public class class_name {
public void setEndpointConfig(CommonConfig config)
{
if (this.config == null)
{
this.config = config; // depends on control dependency: [if], data = [none]
//setup using provided configuration
Map<String, String> epConfProps = config.getProperties();
if (!epConfProps.isEmpty())
{
final Map<String, Object> propMap = getProperties();
if (propMap == null)
{
setProperties(new HashMap<String, Object>(epConfProps)); // depends on control dependency: [if], data = [none]
}
else
{
propMap.putAll(epConfProps); // depends on control dependency: [if], data = [none]
}
InterceptorUtils.addInterceptors(this, epConfProps); // depends on control dependency: [if], data = [none]
FeatureUtils.addFeatures(this, getBus(), epConfProps); // depends on control dependency: [if], data = [none]
}
//handlers config is done later, as when this methods is called getBinding() can't
//be used without messing with the servlet destinations due to the endpoint address
//not having been rewritten yet.
}
} } |
public class class_name {
private void findAfterLocal(Result<Cursor> result,
RowCursor cursor,
Object []args,
Cursor cursorLocal)
{
long version = 0;
if (cursorLocal != null) {
version = cursorLocal.getVersion();
long time = cursorLocal.getUpdateTime();
long timeout = cursorLocal.getTimeout();
long now = CurrentTime.currentTime();
if (now <= time + timeout) {
result.ok(cursorLocal);
return;
}
}
TablePod tablePod = _table.getTablePod();
tablePod.getIfUpdate(cursor.getKey(), version,
result.then((table,r)->_selectQueryLocal.findOne(r, args)));
} } | public class class_name {
private void findAfterLocal(Result<Cursor> result,
RowCursor cursor,
Object []args,
Cursor cursorLocal)
{
long version = 0;
if (cursorLocal != null) {
version = cursorLocal.getVersion(); // depends on control dependency: [if], data = [none]
long time = cursorLocal.getUpdateTime();
long timeout = cursorLocal.getTimeout();
long now = CurrentTime.currentTime();
if (now <= time + timeout) {
result.ok(cursorLocal); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
TablePod tablePod = _table.getTablePod();
tablePod.getIfUpdate(cursor.getKey(), version,
result.then((table,r)->_selectQueryLocal.findOne(r, args)));
} } |
public class class_name {
public static Resource getResultResource(final JavaSparkContext sparkContext,
final SparkJobContext sparkJobContext) {
final HdfsHelper hdfsHelper = new HdfsHelper(sparkContext);
URI resultPath = sparkJobContext.getResultPath();
if (resultPath == null) {
resultPath = URI.create(SparkRunner.DEFAULT_RESULT_PATH + '/' + generateResultFilename(sparkJobContext));
} else {
if (hdfsHelper.isDirectory(resultPath)) {
if (resultPath.toString().endsWith("/")) {
resultPath = URI.create(resultPath.toString() + generateResultFilename(sparkJobContext));
} else {
resultPath = URI.create(resultPath.toString() + '/' + generateResultFilename(sparkJobContext));
}
} else {
resultPath = sparkJobContext.getResultPath();
}
}
return hdfsHelper.getResourceToUse(resultPath);
} } | public class class_name {
public static Resource getResultResource(final JavaSparkContext sparkContext,
final SparkJobContext sparkJobContext) {
final HdfsHelper hdfsHelper = new HdfsHelper(sparkContext);
URI resultPath = sparkJobContext.getResultPath();
if (resultPath == null) {
resultPath = URI.create(SparkRunner.DEFAULT_RESULT_PATH + '/' + generateResultFilename(sparkJobContext)); // depends on control dependency: [if], data = [none]
} else {
if (hdfsHelper.isDirectory(resultPath)) {
if (resultPath.toString().endsWith("/")) {
resultPath = URI.create(resultPath.toString() + generateResultFilename(sparkJobContext)); // depends on control dependency: [if], data = [none]
} else {
resultPath = URI.create(resultPath.toString() + '/' + generateResultFilename(sparkJobContext)); // depends on control dependency: [if], data = [none]
}
} else {
resultPath = sparkJobContext.getResultPath(); // depends on control dependency: [if], data = [none]
}
}
return hdfsHelper.getResourceToUse(resultPath);
} } |
public class class_name {
private static SortedSet<String> findApplicationPackageNames(ClassLoader cl) {
SortedSet<String> packages = new TreeSet<>();
while (cl != null) {
if (cl instanceof URLClassLoader) {
for (URL url : ((URLClassLoader)cl).getURLs()) {
String path = url.getPath();
if (!path.startsWith(JAVA_HOME) && !path.startsWith(MACOS_JAVA_EXTENSIONS_DIR) &&
path.endsWith(JAR_FILE_SUFFIX)) {
try {
try (ZipInputStream zip = new ZipInputStream(url.openStream())) {
for (ZipEntry entry = zip.getNextEntry(); entry != null; entry = zip.getNextEntry()) {
if (!entry.isDirectory() && entry.getName().endsWith(CLASS_FILE_SUFFIX)) {
// This ZipEntry represents a class. Now, what class does it represent?
String className = entry.getName().replace('/', '.'); // including ".class"
className = className.substring(0, className.length() - CLASS_FILE_SUFFIX.length());
if (className.contains(".") && !className.startsWith(STREAMSETS_PACKAGE)) {
// must end with a . as we don't want o.a.h matching o.a.ha
packages.add(className.substring(0, className.lastIndexOf('.')) + ".");
}
}
}
}
} catch (IOException unlikely) {
// since these are local URL we will likely only
// hit this if there is a corrupt jar in the classpath
// which we will ignore
if (SDCClassLoader.isDebug()) {
System.err.println("Error opening '" + url + "' : " + unlikely);
unlikely.printStackTrace();
}
}
}
}
}
cl = cl.getParent();
}
SystemPackage systemPackage = new SystemPackage(SDCClassLoader.SYSTEM_API_CHILDREN_CLASSES);
Iterator<String> iterator = packages.iterator();
while (iterator.hasNext()) {
String packageName = iterator.next();
if (systemPackage.isSystem(packageName)) {
iterator.remove();
}
}
removeLogicalDuplicates(packages);
return packages;
} } | public class class_name {
private static SortedSet<String> findApplicationPackageNames(ClassLoader cl) {
SortedSet<String> packages = new TreeSet<>();
while (cl != null) {
if (cl instanceof URLClassLoader) {
for (URL url : ((URLClassLoader)cl).getURLs()) {
String path = url.getPath();
if (!path.startsWith(JAVA_HOME) && !path.startsWith(MACOS_JAVA_EXTENSIONS_DIR) &&
path.endsWith(JAR_FILE_SUFFIX)) {
try {
try (ZipInputStream zip = new ZipInputStream(url.openStream())) {
for (ZipEntry entry = zip.getNextEntry(); entry != null; entry = zip.getNextEntry()) {
if (!entry.isDirectory() && entry.getName().endsWith(CLASS_FILE_SUFFIX)) {
// This ZipEntry represents a class. Now, what class does it represent?
String className = entry.getName().replace('/', '.'); // including ".class"
className = className.substring(0, className.length() - CLASS_FILE_SUFFIX.length()); // depends on control dependency: [if], data = [none]
if (className.contains(".") && !className.startsWith(STREAMSETS_PACKAGE)) {
// must end with a . as we don't want o.a.h matching o.a.ha
packages.add(className.substring(0, className.lastIndexOf('.')) + "."); // depends on control dependency: [if], data = [none]
}
}
}
}
} catch (IOException unlikely) {
// since these are local URL we will likely only
// hit this if there is a corrupt jar in the classpath
// which we will ignore
if (SDCClassLoader.isDebug()) {
System.err.println("Error opening '" + url + "' : " + unlikely); // depends on control dependency: [if], data = [none]
unlikely.printStackTrace(); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
}
}
cl = cl.getParent(); // depends on control dependency: [while], data = [none]
}
SystemPackage systemPackage = new SystemPackage(SDCClassLoader.SYSTEM_API_CHILDREN_CLASSES);
Iterator<String> iterator = packages.iterator();
while (iterator.hasNext()) {
String packageName = iterator.next();
if (systemPackage.isSystem(packageName)) {
iterator.remove(); // depends on control dependency: [if], data = [none]
}
}
removeLogicalDuplicates(packages);
return packages;
} } |
public class class_name {
public final String getProxyScript() {
StringBuilder buf = new StringBuilder("makeStaplerProxy('").append(getURL()).append("','").append(
WebApp.getCurrent().getCrumbIssuer().issueCrumb()
).append("',[");
boolean first=true;
for (Method m : getTarget().getClass().getMethods()) {
Collection<String> names;
if (m.getName().startsWith("js")) {
names = Collections.singleton(camelize(m.getName().substring(2)));
} else {
JavaScriptMethod a = m.getAnnotation(JavaScriptMethod.class);
if (a!=null) {
names = Arrays.asList(a.name());
if (names.isEmpty())
names = Collections.singleton(m.getName());
} else
continue;
}
for (String n : names) {
if (first) first = false;
else buf.append(',');
buf.append('\'').append(n).append('\'');
}
}
buf.append("])");
return buf.toString();
} } | public class class_name {
public final String getProxyScript() {
StringBuilder buf = new StringBuilder("makeStaplerProxy('").append(getURL()).append("','").append(
WebApp.getCurrent().getCrumbIssuer().issueCrumb()
).append("',[");
boolean first=true;
for (Method m : getTarget().getClass().getMethods()) {
Collection<String> names;
if (m.getName().startsWith("js")) {
names = Collections.singleton(camelize(m.getName().substring(2)));
} else {
JavaScriptMethod a = m.getAnnotation(JavaScriptMethod.class);
if (a!=null) {
names = Arrays.asList(a.name()); // depends on control dependency: [if], data = [(a]
if (names.isEmpty())
names = Collections.singleton(m.getName());
} else
continue;
}
for (String n : names) {
if (first) first = false;
else buf.append(',');
buf.append('\'').append(n).append('\'');
}
}
buf.append("])");
return buf.toString();
} } |
public class class_name {
public static void addMetadata(final HttpURLConnection request, final Map<String, String> metadata,
final OperationContext opContext) {
if (metadata != null) {
for (final Entry<String, String> entry : metadata.entrySet()) {
addMetadata(request, entry.getKey(), entry.getValue(), opContext);
}
}
} } | public class class_name {
public static void addMetadata(final HttpURLConnection request, final Map<String, String> metadata,
final OperationContext opContext) {
if (metadata != null) {
for (final Entry<String, String> entry : metadata.entrySet()) {
addMetadata(request, entry.getKey(), entry.getValue(), opContext); // depends on control dependency: [for], data = [entry]
}
}
} } |
public class class_name {
public void marshall(MetricDimension metricDimension, ProtocolMarshaller protocolMarshaller) {
if (metricDimension == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(metricDimension.getName(), NAME_BINDING);
protocolMarshaller.marshall(metricDimension.getValue(), VALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(MetricDimension metricDimension, ProtocolMarshaller protocolMarshaller) {
if (metricDimension == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(metricDimension.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(metricDimension.getValue(), VALUE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@SuppressWarnings("unchecked")
private void gatherOneMetric(
String metricName,
Metrics.MetricPublisherPublishMessage.Builder builder) {
Object metricValue = metrics.get(metricName).getValueAndReset();
// Decide how to handle the metric based on type
if (metricValue == null) {
return;
}
if (metricValue instanceof Map) {
for (Map.Entry<Object, Object> entry : ((Map<Object, Object>) metricValue).entrySet()) {
if (entry.getKey() != null && entry.getValue() != null) {
addDataToMetricPublisher(
builder, metricName + "/" + entry.getKey().toString(), entry.getValue());
}
}
} else if (metricValue instanceof Collection) {
int index = 0;
for (Object value : (Collection) metricValue) {
addDataToMetricPublisher(builder, metricName + "/" + (index++), value);
}
} else {
addDataToMetricPublisher(builder, metricName, metricValue);
}
} } | public class class_name {
@SuppressWarnings("unchecked")
private void gatherOneMetric(
String metricName,
Metrics.MetricPublisherPublishMessage.Builder builder) {
Object metricValue = metrics.get(metricName).getValueAndReset();
// Decide how to handle the metric based on type
if (metricValue == null) {
return; // depends on control dependency: [if], data = [none]
}
if (metricValue instanceof Map) {
for (Map.Entry<Object, Object> entry : ((Map<Object, Object>) metricValue).entrySet()) {
if (entry.getKey() != null && entry.getValue() != null) {
addDataToMetricPublisher(
builder, metricName + "/" + entry.getKey().toString(), entry.getValue()); // depends on control dependency: [if], data = [none]
}
}
} else if (metricValue instanceof Collection) {
int index = 0;
for (Object value : (Collection) metricValue) {
addDataToMetricPublisher(builder, metricName + "/" + (index++), value); // depends on control dependency: [for], data = [value]
}
} else {
addDataToMetricPublisher(builder, metricName, metricValue); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setDisplayName(String displayName) {
if (CmsStringUtil.isEmpty(displayName) || (IGNORE_DISPLAY_NAME.equals(displayName))) {
m_displayName = null;
setDisplayed(false);
} else {
m_displayName = displayName;
m_displayNameForConfiguration = displayName;
setDisplayed(true);
}
} } | public class class_name {
public void setDisplayName(String displayName) {
if (CmsStringUtil.isEmpty(displayName) || (IGNORE_DISPLAY_NAME.equals(displayName))) {
m_displayName = null; // depends on control dependency: [if], data = [none]
setDisplayed(false); // depends on control dependency: [if], data = [none]
} else {
m_displayName = displayName; // depends on control dependency: [if], data = [none]
m_displayNameForConfiguration = displayName; // depends on control dependency: [if], data = [none]
setDisplayed(true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static long getDateParameter(final ServletRequest pReq, final String pName, final long pDefault) {
String str = pReq.getParameter(pName);
try {
return str != null ? StringUtil.toDate(str).getTime() : pDefault;
}
catch (IllegalArgumentException iae) {
return pDefault;
}
} } | public class class_name {
public static long getDateParameter(final ServletRequest pReq, final String pName, final long pDefault) {
String str = pReq.getParameter(pName);
try {
return str != null ? StringUtil.toDate(str).getTime() : pDefault;
// depends on control dependency: [try], data = [none]
}
catch (IllegalArgumentException iae) {
return pDefault;
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void start() {
CircuitManager cm = this.stack.getCircuitManager();
long[] channelIDs = cm.getChannelIDs();
this.cic2Circuit.clear();
for (long channelID : channelIDs) {
Circuit c = new Circuit(cm.getCIC(channelID), cm.getDPC(channelID), this, scheduler);
cic2Circuit.put(channelID, c);
}
} } | public class class_name {
public void start() {
CircuitManager cm = this.stack.getCircuitManager();
long[] channelIDs = cm.getChannelIDs();
this.cic2Circuit.clear();
for (long channelID : channelIDs) {
Circuit c = new Circuit(cm.getCIC(channelID), cm.getDPC(channelID), this, scheduler);
cic2Circuit.put(channelID, c); // depends on control dependency: [for], data = [channelID]
}
} } |
public class class_name {
protected RangeVariable readTableOrSubquery() {
Table table = null;
SimpleName alias = null;
OrderedHashSet columnList = null;
BitMap columnNameQuoted = null;
SimpleName[] columnNameList = null;
if (token.tokenType == Tokens.OPENBRACKET) {
Expression e = XreadTableSubqueryOrJoinedTable();
table = e.subQuery.getTable();
if (table instanceof TableDerived) {
((TableDerived)table).dataExpression = e;
}
} else {
table = readTableName();
if (table.isView()) {
SubQuery sq = getViewSubquery((View) table);
// sq.queryExpression = ((View) table).queryExpression;
table = sq.getTable();
}
}
boolean hasAs = false;
if (token.tokenType == Tokens.AS) {
read();
checkIsNonCoreReservedIdentifier();
hasAs = true;
}
if (isNonCoreReservedIdentifier()) {
boolean limit = token.tokenType == Tokens.LIMIT
|| token.tokenType == Tokens.OFFSET;
int position = getPosition();
alias = HsqlNameManager.getSimpleName(token.tokenString,
isDelimitedIdentifier());
read();
if (token.tokenType == Tokens.OPENBRACKET) {
columnNameQuoted = new BitMap(32);
columnList = readColumnNames(columnNameQuoted, false);
} else if (!hasAs && limit) {
if (token.tokenType == Tokens.QUESTION
|| token.tokenType == Tokens.X_VALUE) {
alias = null;
rewind(position);
}
}
}
if (columnList != null) {
if (table.getColumnCount() != columnList.size()) {
throw Error.error(ErrorCode.X_42593);
}
columnNameList = new SimpleName[columnList.size()];
for (int i = 0; i < columnList.size(); i++) {
SimpleName name =
HsqlNameManager.getSimpleName((String) columnList.get(i),
columnNameQuoted.isSet(i));
columnNameList[i] = name;
}
}
RangeVariable range = new RangeVariable(table, alias, columnList,
columnNameList, compileContext);
return range;
} } | public class class_name {
protected RangeVariable readTableOrSubquery() {
Table table = null;
SimpleName alias = null;
OrderedHashSet columnList = null;
BitMap columnNameQuoted = null;
SimpleName[] columnNameList = null;
if (token.tokenType == Tokens.OPENBRACKET) {
Expression e = XreadTableSubqueryOrJoinedTable();
table = e.subQuery.getTable(); // depends on control dependency: [if], data = [none]
if (table instanceof TableDerived) {
((TableDerived)table).dataExpression = e; // depends on control dependency: [if], data = [none]
}
} else {
table = readTableName(); // depends on control dependency: [if], data = [none]
if (table.isView()) {
SubQuery sq = getViewSubquery((View) table);
// sq.queryExpression = ((View) table).queryExpression;
table = sq.getTable(); // depends on control dependency: [if], data = [none]
}
}
boolean hasAs = false;
if (token.tokenType == Tokens.AS) {
read(); // depends on control dependency: [if], data = [none]
checkIsNonCoreReservedIdentifier(); // depends on control dependency: [if], data = [none]
hasAs = true; // depends on control dependency: [if], data = [none]
}
if (isNonCoreReservedIdentifier()) {
boolean limit = token.tokenType == Tokens.LIMIT
|| token.tokenType == Tokens.OFFSET;
int position = getPosition();
alias = HsqlNameManager.getSimpleName(token.tokenString,
isDelimitedIdentifier()); // depends on control dependency: [if], data = [none]
read(); // depends on control dependency: [if], data = [none]
if (token.tokenType == Tokens.OPENBRACKET) {
columnNameQuoted = new BitMap(32); // depends on control dependency: [if], data = [none]
columnList = readColumnNames(columnNameQuoted, false); // depends on control dependency: [if], data = [none]
} else if (!hasAs && limit) {
if (token.tokenType == Tokens.QUESTION
|| token.tokenType == Tokens.X_VALUE) {
alias = null; // depends on control dependency: [if], data = [none]
rewind(position); // depends on control dependency: [if], data = [none]
}
}
}
if (columnList != null) {
if (table.getColumnCount() != columnList.size()) {
throw Error.error(ErrorCode.X_42593);
}
columnNameList = new SimpleName[columnList.size()]; // depends on control dependency: [if], data = [none]
for (int i = 0; i < columnList.size(); i++) {
SimpleName name =
HsqlNameManager.getSimpleName((String) columnList.get(i),
columnNameQuoted.isSet(i));
columnNameList[i] = name; // depends on control dependency: [for], data = [i]
}
}
RangeVariable range = new RangeVariable(table, alias, columnList,
columnNameList, compileContext);
return range;
} } |
public class class_name {
private static void analyzeCorpus(){
String zipFile = "src/main/resources/corpus/corpora.zip";
LOGGER.info("开始分析语料库");
long start = System.currentTimeMillis();
try{
analyzeCorpus(zipFile);
} catch (IOException ex) {
LOGGER.info("分析语料库失败:", ex);
}
long cost = System.currentTimeMillis() - start;
LOGGER.info("完成分析语料库,耗时:"+cost+"毫秒");
LOGGER.info("语料库行数为:"+LINES_COUNT.get()+",总字符数目为:"+CHAR_COUNT.get()+",总词数目为:"+WORD_COUNT.get()+",不重复词数目为:"+WORDS.size());
} } | public class class_name {
private static void analyzeCorpus(){
String zipFile = "src/main/resources/corpus/corpora.zip";
LOGGER.info("开始分析语料库");
long start = System.currentTimeMillis();
try{
analyzeCorpus(zipFile); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
LOGGER.info("分析语料库失败:", ex);
} // depends on control dependency: [catch], data = [none]
long cost = System.currentTimeMillis() - start;
LOGGER.info("完成分析语料库,耗时:"+cost+"毫秒");
LOGGER.info("语料库行数为:"+LINES_COUNT.get()+",总字符数目为:"+CHAR_COUNT.get()+",总词数目为:"+WORD_COUNT.get()+",不重复词数目为:"+WORDS.size());
} } |
public class class_name {
private Collection<DependencyInfo> createDependencyInfos(Collection<PhpPackage> phpPackages, Collection<DependencyInfo> dependencyInfos, Collection<String> directDependencies) {
HashMap<DependencyInfo, Collection<String>> parentToChildMap = new HashMap<>();
HashMap<String, DependencyInfo> packageDependencyMap = new HashMap<>();
// collect packages data and create its dependencyInfo
for (PhpPackage phpPackage : phpPackages) {
DependencyInfo dependencyInfo = createDependencyInfo(phpPackage);
if (dependencyInfo != null) {
parentToChildMap.put(dependencyInfo, phpPackage.getPackageRequire().keySet());
packageDependencyMap.put(phpPackage.getName(), dependencyInfo);
} else {
logger.debug("Didn't succeed to create dependencyInfo for {}", phpPackage.getName());
}
}
if (!packageDependencyMap.isEmpty()) {
for (String directDependency : directDependencies) {
// create hierarchy tree
DependencyInfo dependencyInfo = packageDependencyMap.get(directDependency);
if (dependencyInfo != null) {
collectChildren(dependencyInfo, packageDependencyMap, parentToChildMap);
dependencyInfos.add(dependencyInfo);
} else {
logger.debug("Didn't found {} in map {}", directDependency, packageDependencyMap.getClass().getName());
}
}
} else {
logger.debug("The map {} is empty ", packageDependencyMap.getClass().getName());
}
return dependencyInfos;
} } | public class class_name {
private Collection<DependencyInfo> createDependencyInfos(Collection<PhpPackage> phpPackages, Collection<DependencyInfo> dependencyInfos, Collection<String> directDependencies) {
HashMap<DependencyInfo, Collection<String>> parentToChildMap = new HashMap<>();
HashMap<String, DependencyInfo> packageDependencyMap = new HashMap<>();
// collect packages data and create its dependencyInfo
for (PhpPackage phpPackage : phpPackages) {
DependencyInfo dependencyInfo = createDependencyInfo(phpPackage);
if (dependencyInfo != null) {
parentToChildMap.put(dependencyInfo, phpPackage.getPackageRequire().keySet()); // depends on control dependency: [if], data = [(dependencyInfo]
packageDependencyMap.put(phpPackage.getName(), dependencyInfo); // depends on control dependency: [if], data = [none]
} else {
logger.debug("Didn't succeed to create dependencyInfo for {}", phpPackage.getName());
}
}
if (!packageDependencyMap.isEmpty()) {
for (String directDependency : directDependencies) {
// create hierarchy tree
DependencyInfo dependencyInfo = packageDependencyMap.get(directDependency);
if (dependencyInfo != null) {
collectChildren(dependencyInfo, packageDependencyMap, parentToChildMap);
dependencyInfos.add(dependencyInfo);
} else {
logger.debug("Didn't found {} in map {}", directDependency, packageDependencyMap.getClass().getName()); // depends on control dependency: [if], data = [none]
}
}
} else {
logger.debug("The map {} is empty ", packageDependencyMap.getClass().getName());
}
return dependencyInfos;
} } |
public class class_name {
@Trivial
public void unsetSslSupport(ServiceReference<ChannelFactoryProvider> ref) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.entry(this, tc, "unsetSslSupport", new Object[] { ref.getProperty("type"), ref });
}
// see if its for the same service ref, if yes then destroy
if (_sslFactoryProvider.getReference() == ref)
{
if (_isSSLChain) {
if (_isChainStarted)
performAction(destroyChainAction);
}
}
if (_sslFactoryProvider.unsetReference(ref)) {
_isSSLEnabled = false;
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "unsetSslSupport", _isSSLEnabled);
}
} } | public class class_name {
@Trivial
public void unsetSslSupport(ServiceReference<ChannelFactoryProvider> ref) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.entry(this, tc, "unsetSslSupport", new Object[] { ref.getProperty("type"), ref }); // depends on control dependency: [if], data = [none]
}
// see if its for the same service ref, if yes then destroy
if (_sslFactoryProvider.getReference() == ref)
{
if (_isSSLChain) {
if (_isChainStarted)
performAction(destroyChainAction);
}
}
if (_sslFactoryProvider.unsetReference(ref)) {
_isSSLEnabled = false; // depends on control dependency: [if], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "unsetSslSupport", _isSSLEnabled); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(CreateProfileRequest createProfileRequest, ProtocolMarshaller protocolMarshaller) {
if (createProfileRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createProfileRequest.getProfileName(), PROFILENAME_BINDING);
protocolMarshaller.marshall(createProfileRequest.getTimezone(), TIMEZONE_BINDING);
protocolMarshaller.marshall(createProfileRequest.getAddress(), ADDRESS_BINDING);
protocolMarshaller.marshall(createProfileRequest.getDistanceUnit(), DISTANCEUNIT_BINDING);
protocolMarshaller.marshall(createProfileRequest.getTemperatureUnit(), TEMPERATUREUNIT_BINDING);
protocolMarshaller.marshall(createProfileRequest.getWakeWord(), WAKEWORD_BINDING);
protocolMarshaller.marshall(createProfileRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING);
protocolMarshaller.marshall(createProfileRequest.getSetupModeDisabled(), SETUPMODEDISABLED_BINDING);
protocolMarshaller.marshall(createProfileRequest.getMaxVolumeLimit(), MAXVOLUMELIMIT_BINDING);
protocolMarshaller.marshall(createProfileRequest.getPSTNEnabled(), PSTNENABLED_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateProfileRequest createProfileRequest, ProtocolMarshaller protocolMarshaller) {
if (createProfileRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createProfileRequest.getProfileName(), PROFILENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createProfileRequest.getTimezone(), TIMEZONE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createProfileRequest.getAddress(), ADDRESS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createProfileRequest.getDistanceUnit(), DISTANCEUNIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createProfileRequest.getTemperatureUnit(), TEMPERATUREUNIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createProfileRequest.getWakeWord(), WAKEWORD_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createProfileRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createProfileRequest.getSetupModeDisabled(), SETUPMODEDISABLED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createProfileRequest.getMaxVolumeLimit(), MAXVOLUMELIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createProfileRequest.getPSTNEnabled(), PSTNENABLED_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static Moment of(
long elapsedTime,
int nanosecond,
TimeScale scale
) {
if (
(elapsedTime == 0)
&& (nanosecond == 0)
&& (scale == POSIX)
) {
return Moment.UNIX_EPOCH;
}
return new Moment(elapsedTime, nanosecond, scale);
} } | public class class_name {
public static Moment of(
long elapsedTime,
int nanosecond,
TimeScale scale
) {
if (
(elapsedTime == 0)
&& (nanosecond == 0)
&& (scale == POSIX)
) {
return Moment.UNIX_EPOCH; // depends on control dependency: [if], data = []
}
return new Moment(elapsedTime, nanosecond, scale);
} } |
public class class_name {
public boolean upgradeLock(TransactionImpl tx, Object obj)
{
LockEntry writer = getWriter(obj);
if (writer == null)
{
Collection readers = this.getReaders(obj);
if (readers.size() == 1)
{
LockEntry reader = (LockEntry) readers.iterator().next();
if (reader.isOwnedBy(tx))
{
if (upgradeLock(reader))
return true;
else
return upgradeLock(tx, obj);
}
}
else if (readers.size() == 0)
{
if (setWriter(tx, obj))
return true;
else
return upgradeLock(tx, obj);
}
}
else if (writer.isOwnedBy(tx))
{
return true; // If I already have Write, then I've upgraded.
}
return false;
} } | public class class_name {
public boolean upgradeLock(TransactionImpl tx, Object obj)
{
LockEntry writer = getWriter(obj);
if (writer == null)
{
Collection readers = this.getReaders(obj);
if (readers.size() == 1)
{
LockEntry reader = (LockEntry) readers.iterator().next();
if (reader.isOwnedBy(tx))
{
if (upgradeLock(reader))
return true;
else
return upgradeLock(tx, obj);
}
}
else if (readers.size() == 0)
{
if (setWriter(tx, obj))
return true;
else
return upgradeLock(tx, obj);
}
}
else if (writer.isOwnedBy(tx))
{
return true; // If I already have Write, then I've upgraded.
// depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static void setPreferredRoadInternColor(Integer color) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
if (color == null) {
prefs.remove("ROAD_INTERN_COLOR"); //$NON-NLS-1$
} else {
prefs.put("ROAD_INTERN_COLOR", Integer.toString(color.intValue())); //$NON-NLS-1$
}
try {
prefs.flush();
} catch (BackingStoreException exception) {
//
}
}
} } | public class class_name {
public static void setPreferredRoadInternColor(Integer color) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
if (color == null) {
prefs.remove("ROAD_INTERN_COLOR"); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
prefs.put("ROAD_INTERN_COLOR", Integer.toString(color.intValue())); //$NON-NLS-1$ // depends on control dependency: [if], data = [(color]
}
try {
prefs.flush(); // depends on control dependency: [try], data = [none]
} catch (BackingStoreException exception) {
//
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public Future<SendMessageResult> sendMessage(SendMessageRequest request,
AsyncHandler<SendMessageRequest, SendMessageResult> handler) {
QueueBufferCallback<SendMessageRequest, SendMessageResult> callback = null;
if (handler != null) {
callback = new QueueBufferCallback<SendMessageRequest, SendMessageResult>(handler, request);
}
QueueBufferFuture<SendMessageRequest, SendMessageResult> future = sendBuffer.sendMessage(request, callback);
future.setBuffer(this);
return future;
} } | public class class_name {
public Future<SendMessageResult> sendMessage(SendMessageRequest request,
AsyncHandler<SendMessageRequest, SendMessageResult> handler) {
QueueBufferCallback<SendMessageRequest, SendMessageResult> callback = null;
if (handler != null) {
callback = new QueueBufferCallback<SendMessageRequest, SendMessageResult>(handler, request); // depends on control dependency: [if], data = [(handler]
}
QueueBufferFuture<SendMessageRequest, SendMessageResult> future = sendBuffer.sendMessage(request, callback);
future.setBuffer(this);
return future;
} } |
public class class_name {
private void setValue(Element element, String attrName, Object pojo,
CustomPropertyDescriptor field) {
XmlNode attrXmlNode = field.getAnnotation(XmlNode.class);
log.debug("要赋值的fieldName为{}", field.getName());
final XmlTypeConvert convert = XmlTypeConverterUtil.resolve(attrXmlNode, field);
if (!BeanUtils.setProperty(pojo, field.getName(), convert.read(element, attrName))) {
log.debug("copy中复制{}时发生错误,属性[{}]的值将被忽略", field.getName(), field.getName());
}
} } | public class class_name {
private void setValue(Element element, String attrName, Object pojo,
CustomPropertyDescriptor field) {
XmlNode attrXmlNode = field.getAnnotation(XmlNode.class);
log.debug("要赋值的fieldName为{}", field.getName());
final XmlTypeConvert convert = XmlTypeConverterUtil.resolve(attrXmlNode, field);
if (!BeanUtils.setProperty(pojo, field.getName(), convert.read(element, attrName))) {
log.debug("copy中复制{}时发生错误,属性[{}]的值将被忽略", field.getName(), field.getName()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private ORCLUSCluster union(Relation<V> relation, ORCLUSCluster c1, ORCLUSCluster c2, int dim) {
ORCLUSCluster c = new ORCLUSCluster();
c.objectIDs = DBIDUtil.newHashSet(c1.objectIDs);
c.objectIDs.addDBIDs(c2.objectIDs);
c.objectIDs = DBIDUtil.newArray(c.objectIDs);
if(c.objectIDs.size() > 0) {
c.centroid = Centroid.make(relation, c.objectIDs).getArrayRef();
c.basis = findBasis(relation, c, dim);
}
else {
c.centroid = timesEquals(plusEquals(c1.centroid, c2.centroid), .5);
c.basis = identity(dim, c.centroid.length);
}
return c;
} } | public class class_name {
private ORCLUSCluster union(Relation<V> relation, ORCLUSCluster c1, ORCLUSCluster c2, int dim) {
ORCLUSCluster c = new ORCLUSCluster();
c.objectIDs = DBIDUtil.newHashSet(c1.objectIDs);
c.objectIDs.addDBIDs(c2.objectIDs);
c.objectIDs = DBIDUtil.newArray(c.objectIDs);
if(c.objectIDs.size() > 0) {
c.centroid = Centroid.make(relation, c.objectIDs).getArrayRef(); // depends on control dependency: [if], data = [none]
c.basis = findBasis(relation, c, dim); // depends on control dependency: [if], data = [none]
}
else {
c.centroid = timesEquals(plusEquals(c1.centroid, c2.centroid), .5); // depends on control dependency: [if], data = [none]
c.basis = identity(dim, c.centroid.length); // depends on control dependency: [if], data = [none]
}
return c;
} } |
public class class_name {
public com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails
.DeltaPresenceEstimationResultOrBuilder
getDeltaPresenceEstimationResultOrBuilder() {
if (resultCase_ == 9) {
return (com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.DeltaPresenceEstimationResult)
result_;
}
return com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.DeltaPresenceEstimationResult
.getDefaultInstance();
} } | public class class_name {
public com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails
.DeltaPresenceEstimationResultOrBuilder
getDeltaPresenceEstimationResultOrBuilder() {
if (resultCase_ == 9) {
return (com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.DeltaPresenceEstimationResult)
result_; // depends on control dependency: [if], data = [none]
}
return com.google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.DeltaPresenceEstimationResult
.getDefaultInstance();
} } |
public class class_name {
@Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
final String valueAsString = Objects.toString(pvalue, null);
if (StringUtils.isEmpty(valueAsString)) {
return true;
}
if (!StringUtils.isNumeric(valueAsString)) {
// EAN must be numeric, but that's handled by digits annotation
return true;
}
if (valueAsString.length() != Gtin8Validator.GTIN8_LENGTH
&& valueAsString.length() != Gtin13Validator.GTIN13_LENGTH) {
// EAN size is wrong, but that's handled by alternate size annotation
return true;
}
// calculate and check checksum (GTIN/EAN)
return CHECK_GTIN.isValid(valueAsString);
} } | public class class_name {
@Override
public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) {
final String valueAsString = Objects.toString(pvalue, null);
if (StringUtils.isEmpty(valueAsString)) {
return true; // depends on control dependency: [if], data = [none]
}
if (!StringUtils.isNumeric(valueAsString)) {
// EAN must be numeric, but that's handled by digits annotation
return true; // depends on control dependency: [if], data = [none]
}
if (valueAsString.length() != Gtin8Validator.GTIN8_LENGTH
&& valueAsString.length() != Gtin13Validator.GTIN13_LENGTH) {
// EAN size is wrong, but that's handled by alternate size annotation
return true; // depends on control dependency: [if], data = [none]
}
// calculate and check checksum (GTIN/EAN)
return CHECK_GTIN.isValid(valueAsString);
} } |
public class class_name {
public Collection<SerialMessage> initialize() {
ArrayList<SerialMessage> result = new ArrayList<SerialMessage>();
if (this.getNode().getManufacturer() == 0x010F && this.getNode().getDeviceType() == 0x0501) {
logger.warn("Detected Fibaro FGBS001 Universal Sensor - this device fails to respond to SENSOR_ALARM_GET and SENSOR_ALARM_SUPPORTED_GET.");
return result;
}
result.add(this.getSupportedMessage());
return result;
} } | public class class_name {
public Collection<SerialMessage> initialize() {
ArrayList<SerialMessage> result = new ArrayList<SerialMessage>();
if (this.getNode().getManufacturer() == 0x010F && this.getNode().getDeviceType() == 0x0501) {
logger.warn("Detected Fibaro FGBS001 Universal Sensor - this device fails to respond to SENSOR_ALARM_GET and SENSOR_ALARM_SUPPORTED_GET.");
// depends on control dependency: [if], data = [none]
return result;
// depends on control dependency: [if], data = [none]
}
result.add(this.getSupportedMessage());
return result;
} } |
public class class_name {
public void marshall(LicenseConfiguration licenseConfiguration, ProtocolMarshaller protocolMarshaller) {
if (licenseConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(licenseConfiguration.getLicenseConfigurationId(), LICENSECONFIGURATIONID_BINDING);
protocolMarshaller.marshall(licenseConfiguration.getLicenseConfigurationArn(), LICENSECONFIGURATIONARN_BINDING);
protocolMarshaller.marshall(licenseConfiguration.getName(), NAME_BINDING);
protocolMarshaller.marshall(licenseConfiguration.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(licenseConfiguration.getLicenseCountingType(), LICENSECOUNTINGTYPE_BINDING);
protocolMarshaller.marshall(licenseConfiguration.getLicenseRules(), LICENSERULES_BINDING);
protocolMarshaller.marshall(licenseConfiguration.getLicenseCount(), LICENSECOUNT_BINDING);
protocolMarshaller.marshall(licenseConfiguration.getLicenseCountHardLimit(), LICENSECOUNTHARDLIMIT_BINDING);
protocolMarshaller.marshall(licenseConfiguration.getConsumedLicenses(), CONSUMEDLICENSES_BINDING);
protocolMarshaller.marshall(licenseConfiguration.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(licenseConfiguration.getOwnerAccountId(), OWNERACCOUNTID_BINDING);
protocolMarshaller.marshall(licenseConfiguration.getConsumedLicenseSummaryList(), CONSUMEDLICENSESUMMARYLIST_BINDING);
protocolMarshaller.marshall(licenseConfiguration.getManagedResourceSummaryList(), MANAGEDRESOURCESUMMARYLIST_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(LicenseConfiguration licenseConfiguration, ProtocolMarshaller protocolMarshaller) {
if (licenseConfiguration == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(licenseConfiguration.getLicenseConfigurationId(), LICENSECONFIGURATIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(licenseConfiguration.getLicenseConfigurationArn(), LICENSECONFIGURATIONARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(licenseConfiguration.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(licenseConfiguration.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(licenseConfiguration.getLicenseCountingType(), LICENSECOUNTINGTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(licenseConfiguration.getLicenseRules(), LICENSERULES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(licenseConfiguration.getLicenseCount(), LICENSECOUNT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(licenseConfiguration.getLicenseCountHardLimit(), LICENSECOUNTHARDLIMIT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(licenseConfiguration.getConsumedLicenses(), CONSUMEDLICENSES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(licenseConfiguration.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(licenseConfiguration.getOwnerAccountId(), OWNERACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(licenseConfiguration.getConsumedLicenseSummaryList(), CONSUMEDLICENSESUMMARYLIST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(licenseConfiguration.getManagedResourceSummaryList(), MANAGEDRESOURCESUMMARYLIST_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean matches(String uri) {
if (uri == null) {
return false;
}
Matcher matcher = this.matchPattern.matcher(uri);
return matcher.matches();
} } | public class class_name {
public boolean matches(String uri) {
if (uri == null) {
return false; // depends on control dependency: [if], data = [none]
}
Matcher matcher = this.matchPattern.matcher(uri);
return matcher.matches();
} } |
public class class_name {
public final void castExpression() throws RecognitionException {
BaseDescr expr =null;
try {
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:540:5: ( ( LEFT_PAREN primitiveType )=> LEFT_PAREN primitiveType RIGHT_PAREN expr= unaryExpression | ( LEFT_PAREN type )=> LEFT_PAREN type RIGHT_PAREN unaryExpressionNotPlusMinus )
int alt55=2;
int LA55_0 = input.LA(1);
if ( (LA55_0==LEFT_PAREN) ) {
int LA55_1 = input.LA(2);
if ( (synpred20_DRL6Expressions()) ) {
alt55=1;
}
else if ( (synpred21_DRL6Expressions()) ) {
alt55=2;
}
else {
if (state.backtracking>0) {state.failed=true; return;}
int nvaeMark = input.mark();
try {
input.consume();
NoViableAltException nvae =
new NoViableAltException("", 55, 1, input);
throw nvae;
} finally {
input.rewind(nvaeMark);
}
}
}
else {
if (state.backtracking>0) {state.failed=true; return;}
NoViableAltException nvae =
new NoViableAltException("", 55, 0, input);
throw nvae;
}
switch (alt55) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:540:8: ( LEFT_PAREN primitiveType )=> LEFT_PAREN primitiveType RIGHT_PAREN expr= unaryExpression
{
match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_castExpression2727); if (state.failed) return;
pushFollow(FOLLOW_primitiveType_in_castExpression2729);
primitiveType();
state._fsp--;
if (state.failed) return;
match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_castExpression2731); if (state.failed) return;
pushFollow(FOLLOW_unaryExpression_in_castExpression2735);
expr=unaryExpression();
state._fsp--;
if (state.failed) return;
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:541:8: ( LEFT_PAREN type )=> LEFT_PAREN type RIGHT_PAREN unaryExpressionNotPlusMinus
{
match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_castExpression2752); if (state.failed) return;
pushFollow(FOLLOW_type_in_castExpression2754);
type();
state._fsp--;
if (state.failed) return;
match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_castExpression2756); if (state.failed) return;
pushFollow(FOLLOW_unaryExpressionNotPlusMinus_in_castExpression2758);
unaryExpressionNotPlusMinus();
state._fsp--;
if (state.failed) return;
}
break;
}
}
catch (RecognitionException re) {
throw re;
}
finally {
// do for sure before leaving
}
} } | public class class_name {
public final void castExpression() throws RecognitionException {
BaseDescr expr =null;
try {
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:540:5: ( ( LEFT_PAREN primitiveType )=> LEFT_PAREN primitiveType RIGHT_PAREN expr= unaryExpression | ( LEFT_PAREN type )=> LEFT_PAREN type RIGHT_PAREN unaryExpressionNotPlusMinus )
int alt55=2;
int LA55_0 = input.LA(1);
if ( (LA55_0==LEFT_PAREN) ) {
int LA55_1 = input.LA(2);
if ( (synpred20_DRL6Expressions()) ) {
alt55=1; // depends on control dependency: [if], data = [none]
}
else if ( (synpred21_DRL6Expressions()) ) {
alt55=2; // depends on control dependency: [if], data = [none]
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
int nvaeMark = input.mark();
try {
input.consume(); // depends on control dependency: [try], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 55, 1, input);
throw nvae;
} finally {
input.rewind(nvaeMark);
}
}
}
else {
if (state.backtracking>0) {state.failed=true; return;} // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
NoViableAltException nvae =
new NoViableAltException("", 55, 0, input);
throw nvae;
}
switch (alt55) {
case 1 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:540:8: ( LEFT_PAREN primitiveType )=> LEFT_PAREN primitiveType RIGHT_PAREN expr= unaryExpression
{
match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_castExpression2727); if (state.failed) return;
pushFollow(FOLLOW_primitiveType_in_castExpression2729);
primitiveType();
state._fsp--;
if (state.failed) return;
match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_castExpression2731); if (state.failed) return;
pushFollow(FOLLOW_unaryExpression_in_castExpression2735);
expr=unaryExpression();
state._fsp--;
if (state.failed) return;
}
break;
case 2 :
// src/main/resources/org/drools/compiler/lang/DRL6Expressions.g:541:8: ( LEFT_PAREN type )=> LEFT_PAREN type RIGHT_PAREN unaryExpressionNotPlusMinus
{
match(input,LEFT_PAREN,FOLLOW_LEFT_PAREN_in_castExpression2752); if (state.failed) return;
pushFollow(FOLLOW_type_in_castExpression2754);
type();
state._fsp--;
if (state.failed) return;
match(input,RIGHT_PAREN,FOLLOW_RIGHT_PAREN_in_castExpression2756); if (state.failed) return;
pushFollow(FOLLOW_unaryExpressionNotPlusMinus_in_castExpression2758);
unaryExpressionNotPlusMinus();
state._fsp--;
if (state.failed) return;
}
break;
}
}
catch (RecognitionException re) {
throw re;
}
finally {
// do for sure before leaving
}
} } |
public class class_name {
private static ValidationMessage[] vmFromVector(Vector v) {
ValidationMessage[] vm = new ValidationMessage[v.size()];
for (int i = 0; i < vm.length; i++) {
vm[i] = (ValidationMessage) v.get(i);
}
return vm;
} } | public class class_name {
private static ValidationMessage[] vmFromVector(Vector v) {
ValidationMessage[] vm = new ValidationMessage[v.size()];
for (int i = 0; i < vm.length; i++) {
vm[i] = (ValidationMessage) v.get(i); // depends on control dependency: [for], data = [i]
}
return vm;
} } |
public class class_name {
private Element getTopicDoc(final URI absolutePathToFile) {
final DocumentBuilder builder = getDocumentBuilder();
try {
final Document doc = builder.parse(absolutePathToFile.toString());
return doc.getDocumentElement();
} catch (final SAXException | IOException e) {
logger.error("Failed to parse " + absolutePathToFile + ": " + e.getMessage(), e);
}
return null;
} } | public class class_name {
private Element getTopicDoc(final URI absolutePathToFile) {
final DocumentBuilder builder = getDocumentBuilder();
try {
final Document doc = builder.parse(absolutePathToFile.toString());
return doc.getDocumentElement(); // depends on control dependency: [try], data = [none]
} catch (final SAXException | IOException e) {
logger.error("Failed to parse " + absolutePathToFile + ": " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
protected Collection<T> convertCollectionToCollection(final Collection value) {
Collection<T> collection = createCollection(value.size());
for (Object v : value) {
collection.add(convertType(v));
}
return collection;
} } | public class class_name {
protected Collection<T> convertCollectionToCollection(final Collection value) {
Collection<T> collection = createCollection(value.size());
for (Object v : value) {
collection.add(convertType(v)); // depends on control dependency: [for], data = [v]
}
return collection;
} } |
public class class_name {
public static <K, V> Map<K, V> updateMap(final Map<K, V> original, MapDifference<K, V> diff) throws MergeException {
Map<K, V> result = new HashMap<K, V>(original);
if (diff.areEqual()) {
return result;
}
for (Entry<K, V> entry : diff.entriesOnlyOnLeft().entrySet()) {
V originalValue = original.get(entry.getKey());
if (ObjectUtils.equals(originalValue, entry.getValue())) {
result.remove(entry.getKey());
}
}
for (Entry<K, V> entry : diff.entriesOnlyOnRight().entrySet()) {
K key = entry.getKey();
if (original.containsKey(key)) {
if (ObjectUtils.notEqual(original.get(key), entry.getValue())) {
throw new MergeException(String.format(
"tried to introduce a new value, but it was already there: %s (%s,%s)",
key, original.get(key), entry.getValue()));
}
}
result.put(entry.getKey(), entry.getValue());
}
for (Entry<K, ValueDifference<V>> entry : diff.entriesDiffering().entrySet()) {
K key = entry.getKey();
V originalValue = original.get(entry.getKey());
if (ObjectUtils.equals(originalValue, entry.getValue().leftValue())) {
// Map changed in diff only
result.put(key, entry.getValue().rightValue());
} else if (ObjectUtils.equals(originalValue, entry.getValue().rightValue())) {
// Diff would change value to value already in original Map
result.put(key, originalValue);
} else {
// Merge conflict, got 3 different Values
String errorMessage =
String
.format(
"Changes could not be applied, because original value differes from left-side of the"
+ "MapDifference: %s (%s,%s)", entry.getKey(), original.get(entry.getKey()),
entry.getValue());
throw new MergeException(errorMessage);
}
}
return result;
} } | public class class_name {
public static <K, V> Map<K, V> updateMap(final Map<K, V> original, MapDifference<K, V> diff) throws MergeException {
Map<K, V> result = new HashMap<K, V>(original);
if (diff.areEqual()) {
return result;
}
for (Entry<K, V> entry : diff.entriesOnlyOnLeft().entrySet()) {
V originalValue = original.get(entry.getKey());
if (ObjectUtils.equals(originalValue, entry.getValue())) {
result.remove(entry.getKey()); // depends on control dependency: [if], data = [none]
}
}
for (Entry<K, V> entry : diff.entriesOnlyOnRight().entrySet()) {
K key = entry.getKey();
if (original.containsKey(key)) {
if (ObjectUtils.notEqual(original.get(key), entry.getValue())) {
throw new MergeException(String.format(
"tried to introduce a new value, but it was already there: %s (%s,%s)",
key, original.get(key), entry.getValue()));
}
}
result.put(entry.getKey(), entry.getValue());
}
for (Entry<K, ValueDifference<V>> entry : diff.entriesDiffering().entrySet()) {
K key = entry.getKey();
V originalValue = original.get(entry.getKey());
if (ObjectUtils.equals(originalValue, entry.getValue().leftValue())) {
// Map changed in diff only
result.put(key, entry.getValue().rightValue());
} else if (ObjectUtils.equals(originalValue, entry.getValue().rightValue())) {
// Diff would change value to value already in original Map
result.put(key, originalValue);
} else {
// Merge conflict, got 3 different Values
String errorMessage =
String
.format(
"Changes could not be applied, because original value differes from left-side of the"
+ "MapDifference: %s (%s,%s)", entry.getKey(), original.get(entry.getKey()),
entry.getValue());
throw new MergeException(errorMessage);
}
}
return result;
} } |
public class class_name {
protected Expression relationalExpression() {
Expression left = term();
if (tokenizer.current().isSymbol("<")) {
tokenizer.consume();
Expression right = relationalExpression();
return reOrder(left, right, BinaryOperation.Op.LT);
}
if (tokenizer.current().isSymbol("<=")) {
tokenizer.consume();
Expression right = relationalExpression();
return reOrder(left, right, BinaryOperation.Op.LT_EQ);
}
if (tokenizer.current().isSymbol("=")) {
tokenizer.consume();
Expression right = relationalExpression();
return reOrder(left, right, BinaryOperation.Op.EQ);
}
if (tokenizer.current().isSymbol(">=")) {
tokenizer.consume();
Expression right = relationalExpression();
return reOrder(left, right, BinaryOperation.Op.GT_EQ);
}
if (tokenizer.current().isSymbol(">")) {
tokenizer.consume();
Expression right = relationalExpression();
return reOrder(left, right, BinaryOperation.Op.GT);
}
if (tokenizer.current().isSymbol("!=")) {
tokenizer.consume();
Expression right = relationalExpression();
return reOrder(left, right, BinaryOperation.Op.NEQ);
}
return left;
} } | public class class_name {
protected Expression relationalExpression() {
Expression left = term();
if (tokenizer.current().isSymbol("<")) {
tokenizer.consume(); // depends on control dependency: [if], data = [none]
Expression right = relationalExpression();
return reOrder(left, right, BinaryOperation.Op.LT); // depends on control dependency: [if], data = [none]
}
if (tokenizer.current().isSymbol("<=")) {
tokenizer.consume(); // depends on control dependency: [if], data = [none]
Expression right = relationalExpression();
return reOrder(left, right, BinaryOperation.Op.LT_EQ); // depends on control dependency: [if], data = [none]
}
if (tokenizer.current().isSymbol("=")) {
tokenizer.consume(); // depends on control dependency: [if], data = [none]
Expression right = relationalExpression();
return reOrder(left, right, BinaryOperation.Op.EQ); // depends on control dependency: [if], data = [none]
}
if (tokenizer.current().isSymbol(">=")) {
tokenizer.consume(); // depends on control dependency: [if], data = [none]
Expression right = relationalExpression();
return reOrder(left, right, BinaryOperation.Op.GT_EQ); // depends on control dependency: [if], data = [none]
}
if (tokenizer.current().isSymbol(">")) {
tokenizer.consume(); // depends on control dependency: [if], data = [none]
Expression right = relationalExpression();
return reOrder(left, right, BinaryOperation.Op.GT); // depends on control dependency: [if], data = [none]
}
if (tokenizer.current().isSymbol("!=")) {
tokenizer.consume(); // depends on control dependency: [if], data = [none]
Expression right = relationalExpression();
return reOrder(left, right, BinaryOperation.Op.NEQ); // depends on control dependency: [if], data = [none]
}
return left;
} } |
public class class_name {
public static byte[] getUnicodeByteArray(String str) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
try {
for (int i = 0; i < str.length(); i++) {
dos.writeChar((int) str.charAt(i));
}
} catch (Exception e) {
}
return baos.toByteArray();
} } | public class class_name {
public static byte[] getUnicodeByteArray(String str) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
try {
for (int i = 0; i < str.length(); i++) {
dos.writeChar((int) str.charAt(i)); // depends on control dependency: [for], data = [i]
}
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
return baos.toByteArray();
} } |
public class class_name {
protected final void beforeDelivery(final SIBusMessage message, MessageEndpoint endpoint) {
if (TRACE.isEntryEnabled()) {
final String methodName = "beforeDelivery";
SibTr.entry(this, TRACE, methodName, new Object [] { message, endpoint});
SibTr.exit(this, TRACE, methodName);
}
} } | public class class_name {
protected final void beforeDelivery(final SIBusMessage message, MessageEndpoint endpoint) {
if (TRACE.isEntryEnabled()) {
final String methodName = "beforeDelivery";
SibTr.entry(this, TRACE, methodName, new Object [] { message, endpoint}); // depends on control dependency: [if], data = [none]
SibTr.exit(this, TRACE, methodName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String getPropValueIds(CmsObject cms, String type, String value) {
if (PropType.isVfsList(type)) {
return convertPathsToIds(cms, value);
}
return value;
} } | public class class_name {
public static String getPropValueIds(CmsObject cms, String type, String value) {
if (PropType.isVfsList(type)) {
return convertPathsToIds(cms, value); // depends on control dependency: [if], data = [none]
}
return value;
} } |
public class class_name {
private void allocateOutput(int size, int channels) {
if (size <= outputCapacity && channels <= outputChannels) return;
for (int i = 0; i < Constants.MAX_CHANNELS; i++) {
channelData[i] = null;
}
for (int i = 0; i < channels; i++) {
channelData[i] = new ChannelData(size);
}
outputCapacity = size;
outputChannels = channels;
} } | public class class_name {
private void allocateOutput(int size, int channels) {
if (size <= outputCapacity && channels <= outputChannels) return;
for (int i = 0; i < Constants.MAX_CHANNELS; i++) {
channelData[i] = null; // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < channels; i++) {
channelData[i] = new ChannelData(size); // depends on control dependency: [for], data = [i]
}
outputCapacity = size;
outputChannels = channels;
} } |
public class class_name {
public static PostalCodesMapSharedConstants create() {
if (postalCodesMapConstants == null) { // NOPMD it's thread save!
synchronized (PostalCodesMapConstantsImpl.class) {
if (postalCodesMapConstants == null) {
postalCodesMapConstants = new PostalCodesMapConstantsImpl(
readMapFromProperties("PostalCodesMapConstants", "postalCodes"));
}
}
}
return postalCodesMapConstants;
} } | public class class_name {
public static PostalCodesMapSharedConstants create() {
if (postalCodesMapConstants == null) { // NOPMD it's thread save!
synchronized (PostalCodesMapConstantsImpl.class) { // depends on control dependency: [if], data = [none]
if (postalCodesMapConstants == null) {
postalCodesMapConstants = new PostalCodesMapConstantsImpl(
readMapFromProperties("PostalCodesMapConstants", "postalCodes")); // depends on control dependency: [if], data = [none]
}
}
}
return postalCodesMapConstants;
} } |
public class class_name {
public static HttpServletRequest unwrapMultipart( HttpServletRequest request )
{
if ( request instanceof MultipartRequestWrapper )
{
request = ( ( MultipartRequestWrapper ) request ).getRequest();
}
return request;
} } | public class class_name {
public static HttpServletRequest unwrapMultipart( HttpServletRequest request )
{
if ( request instanceof MultipartRequestWrapper )
{
request = ( ( MultipartRequestWrapper ) request ).getRequest(); // depends on control dependency: [if], data = [none]
}
return request;
} } |
public class class_name {
public Level level(Config config, Throwable error) {
if (error == null) {
return config.defaultMessageLevel();
}
if (error instanceof Error) {
return config.defaultErrorLevel();
}
return config.defaultThrowableLevel();
} } | public class class_name {
public Level level(Config config, Throwable error) {
if (error == null) {
return config.defaultMessageLevel(); // depends on control dependency: [if], data = [none]
}
if (error instanceof Error) {
return config.defaultErrorLevel(); // depends on control dependency: [if], data = [none]
}
return config.defaultThrowableLevel();
} } |
public class class_name {
private void generateDeletes(M2MEntity entity, String packageName) {
String idPart = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName);
String methodName = "";
String workId = "";
methodName = "deleteBy" + idPart;
if (!isMethodAlreadyDefined(entity, methodName)) {
// @formatter:off
MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC)
.addModifiers(Modifier.ABSTRACT)
.addAnnotation(AnnotationSpec.builder(BindSqlDelete.class)
.addMember("where", "$S",
entity.idName + "=" + SqlAnalyzer.PARAM_PREFIX + entity.idName
+ SqlAnalyzer.PARAM_SUFFIX)
.build())
.addParameter(ParameterSpec.builder(entity.propertyPrimaryKey, entity.idName)
.addAnnotation(AnnotationSpec.builder(BindSqlParam.class)
.addMember("value", "$S", entity.idName).build())
.build())
.returns(Integer.TYPE).build();
// @formatter:on
classBuilder.addMethod(methodSpec);
}
methodName = entity.entity1Name.simpleName() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName);
workId = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName);
methodName = "deleteBy" + methodName;
if (!isMethodAlreadyDefined(entity, methodName)) {
// @formatter:off
MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC)
.addModifiers(Modifier.ABSTRACT)
.addAnnotation(AnnotationSpec.builder(BindSqlDelete.class)
.addMember("where", "$S",
workId + "=" + SqlAnalyzer.PARAM_PREFIX + workId + SqlAnalyzer.PARAM_SUFFIX)
.build())
.addParameter(ParameterSpec.builder(entity.propertyKey1, workId)
.addAnnotation(
AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", workId).build())
.build())
.returns(Integer.TYPE).build();
// @formatter:on
classBuilder.addMethod(methodSpec);
}
methodName = entity.entity2Name.simpleName() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName);
workId = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName);
methodName = "deleteBy" + methodName;
if (!isMethodAlreadyDefined(entity, methodName)) {
// @formatter:off
MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC)
.addModifiers(Modifier.ABSTRACT)
.addAnnotation(AnnotationSpec.builder(BindSqlDelete.class)
.addMember("where", "$S",
workId + "=" + SqlAnalyzer.PARAM_PREFIX + workId + SqlAnalyzer.PARAM_SUFFIX)
.build())
.addParameter(ParameterSpec.builder(entity.propertyKey2, workId)
.addAnnotation(
AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", workId).build())
.build())
.returns(Integer.TYPE).build();
// @formatter:on
classBuilder.addMethod(methodSpec);
}
} } | public class class_name {
private void generateDeletes(M2MEntity entity, String packageName) {
String idPart = CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName);
String methodName = "";
String workId = "";
methodName = "deleteBy" + idPart;
if (!isMethodAlreadyDefined(entity, methodName)) {
// @formatter:off
MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC)
.addModifiers(Modifier.ABSTRACT)
.addAnnotation(AnnotationSpec.builder(BindSqlDelete.class)
.addMember("where", "$S",
entity.idName + "=" + SqlAnalyzer.PARAM_PREFIX + entity.idName
+ SqlAnalyzer.PARAM_SUFFIX)
.build())
.addParameter(ParameterSpec.builder(entity.propertyPrimaryKey, entity.idName)
.addAnnotation(AnnotationSpec.builder(BindSqlParam.class)
.addMember("value", "$S", entity.idName).build())
.build())
.returns(Integer.TYPE).build();
// @formatter:on
classBuilder.addMethod(methodSpec); // depends on control dependency: [if], data = [none]
}
methodName = entity.entity1Name.simpleName() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName);
workId = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName);
methodName = "deleteBy" + methodName;
if (!isMethodAlreadyDefined(entity, methodName)) {
// @formatter:off
MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC)
.addModifiers(Modifier.ABSTRACT)
.addAnnotation(AnnotationSpec.builder(BindSqlDelete.class)
.addMember("where", "$S",
workId + "=" + SqlAnalyzer.PARAM_PREFIX + workId + SqlAnalyzer.PARAM_SUFFIX)
.build())
.addParameter(ParameterSpec.builder(entity.propertyKey1, workId)
.addAnnotation(
AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", workId).build())
.build())
.returns(Integer.TYPE).build();
// @formatter:on
classBuilder.addMethod(methodSpec); // depends on control dependency: [if], data = [none]
}
methodName = entity.entity2Name.simpleName() + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, entity.idName);
workId = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, methodName);
methodName = "deleteBy" + methodName;
if (!isMethodAlreadyDefined(entity, methodName)) {
// @formatter:off
MethodSpec methodSpec = MethodSpec.methodBuilder(methodName).addModifiers(Modifier.PUBLIC)
.addModifiers(Modifier.ABSTRACT)
.addAnnotation(AnnotationSpec.builder(BindSqlDelete.class)
.addMember("where", "$S",
workId + "=" + SqlAnalyzer.PARAM_PREFIX + workId + SqlAnalyzer.PARAM_SUFFIX)
.build())
.addParameter(ParameterSpec.builder(entity.propertyKey2, workId)
.addAnnotation(
AnnotationSpec.builder(BindSqlParam.class).addMember("value", "$S", workId).build())
.build())
.returns(Integer.TYPE).build();
// @formatter:on
classBuilder.addMethod(methodSpec); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(SegmentDemographics segmentDemographics, ProtocolMarshaller protocolMarshaller) {
if (segmentDemographics == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(segmentDemographics.getAppVersion(), APPVERSION_BINDING);
protocolMarshaller.marshall(segmentDemographics.getChannel(), CHANNEL_BINDING);
protocolMarshaller.marshall(segmentDemographics.getDeviceType(), DEVICETYPE_BINDING);
protocolMarshaller.marshall(segmentDemographics.getMake(), MAKE_BINDING);
protocolMarshaller.marshall(segmentDemographics.getModel(), MODEL_BINDING);
protocolMarshaller.marshall(segmentDemographics.getPlatform(), PLATFORM_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(SegmentDemographics segmentDemographics, ProtocolMarshaller protocolMarshaller) {
if (segmentDemographics == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(segmentDemographics.getAppVersion(), APPVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(segmentDemographics.getChannel(), CHANNEL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(segmentDemographics.getDeviceType(), DEVICETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(segmentDemographics.getMake(), MAKE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(segmentDemographics.getModel(), MODEL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(segmentDemographics.getPlatform(), PLATFORM_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static Optional<Class> resolveSingleTypeArgument(Type genericType) {
if (genericType instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) genericType;
Type[] actualTypeArguments = pt.getActualTypeArguments();
if (actualTypeArguments.length == 1) {
Type actualTypeArgument = actualTypeArguments[0];
return resolveParameterizedTypeArgument(actualTypeArgument);
}
}
return Optional.empty();
} } | public class class_name {
private static Optional<Class> resolveSingleTypeArgument(Type genericType) {
if (genericType instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) genericType;
Type[] actualTypeArguments = pt.getActualTypeArguments();
if (actualTypeArguments.length == 1) {
Type actualTypeArgument = actualTypeArguments[0];
return resolveParameterizedTypeArgument(actualTypeArgument); // depends on control dependency: [if], data = [none]
}
}
return Optional.empty();
} } |
public class class_name {
public AiShadingMode getShadingMode() {
Property p = getProperty(PropertyKey.SHADING_MODE.m_key);
if (null == p || null == p.getData()) {
return (AiShadingMode) m_defaults.get(PropertyKey.SHADING_MODE);
}
return AiShadingMode.fromRawValue((Integer) p.getData());
} } | public class class_name {
public AiShadingMode getShadingMode() {
Property p = getProperty(PropertyKey.SHADING_MODE.m_key);
if (null == p || null == p.getData()) {
return (AiShadingMode) m_defaults.get(PropertyKey.SHADING_MODE); // depends on control dependency: [if], data = [none]
}
return AiShadingMode.fromRawValue((Integer) p.getData());
} } |
public class class_name {
private void renderCollision(Graphic g, TileCollision tile, int x, int y)
{
for (final CollisionFormula collision : tile.getCollisionFormulas())
{
final ImageBuffer buffer = collisionCache.get(collision);
if (buffer != null)
{
g.drawImage(buffer, x, y);
}
}
} } | public class class_name {
private void renderCollision(Graphic g, TileCollision tile, int x, int y)
{
for (final CollisionFormula collision : tile.getCollisionFormulas())
{
final ImageBuffer buffer = collisionCache.get(collision);
if (buffer != null)
{
g.drawImage(buffer, x, y);
// depends on control dependency: [if], data = [(buffer]
}
}
} } |
public class class_name {
public <T> int deleteBatch(T... entities) {
if(entities.length == 0){
return 0;
}
List<PropertyDesc[]> paramsList = new ArrayList<>();
String executeSql = null;
for(Object entity: entities){
List<PropertyDesc> propDescs = new ArrayList<>();
String sql = MirageUtil.buildDeleteSql(null, beanDescFactory, entityOperator, entity, nameConverter, propDescs);
if(executeSql == null){
executeSql = sql;
} else if(!sql.equals(executeSql)){
throw new IllegalArgumentException("A different entity is contained in the entity list.");
}
paramsList.add(propDescs.toArray(new PropertyDesc[propDescs.size()]));
}
return sqlExecutor.executeBatchUpdateSql(executeSql, paramsList, entities);
} } | public class class_name {
public <T> int deleteBatch(T... entities) {
if(entities.length == 0){
return 0;
// depends on control dependency: [if], data = [none]
}
List<PropertyDesc[]> paramsList = new ArrayList<>();
String executeSql = null;
for(Object entity: entities){
List<PropertyDesc> propDescs = new ArrayList<>();
String sql = MirageUtil.buildDeleteSql(null, beanDescFactory, entityOperator, entity, nameConverter, propDescs);
if(executeSql == null){
executeSql = sql;
// depends on control dependency: [if], data = [none]
} else if(!sql.equals(executeSql)){
throw new IllegalArgumentException("A different entity is contained in the entity list.");
}
paramsList.add(propDescs.toArray(new PropertyDesc[propDescs.size()]));
// depends on control dependency: [for], data = [none]
}
return sqlExecutor.executeBatchUpdateSql(executeSql, paramsList, entities);
} } |
public class class_name {
public Iterator<FeatureDescriptor> getFeatureDescriptors(
ELContext context,
Object base) {
if (base != null && base instanceof Map) {
Map map = (Map) base;
Iterator iter = map.keySet().iterator();
List<FeatureDescriptor> list = new ArrayList<FeatureDescriptor>();
while (iter.hasNext()) {
Object key = iter.next();
FeatureDescriptor descriptor = new FeatureDescriptor();
String name = (key==null)? null: key.toString();
descriptor.setName(name);
descriptor.setDisplayName(name);
descriptor.setShortDescription("");
descriptor.setExpert(false);
descriptor.setHidden(false);
descriptor.setPreferred(true);
if (key != null) {
descriptor.setValue("type", key.getClass());
}
descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE);
list.add(descriptor);
}
return list.iterator();
}
return null;
} } | public class class_name {
public Iterator<FeatureDescriptor> getFeatureDescriptors(
ELContext context,
Object base) {
if (base != null && base instanceof Map) {
Map map = (Map) base;
Iterator iter = map.keySet().iterator();
List<FeatureDescriptor> list = new ArrayList<FeatureDescriptor>();
while (iter.hasNext()) {
Object key = iter.next();
FeatureDescriptor descriptor = new FeatureDescriptor();
String name = (key==null)? null: key.toString();
descriptor.setName(name); // depends on control dependency: [while], data = [none]
descriptor.setDisplayName(name); // depends on control dependency: [while], data = [none]
descriptor.setShortDescription(""); // depends on control dependency: [while], data = [none]
descriptor.setExpert(false); // depends on control dependency: [while], data = [none]
descriptor.setHidden(false); // depends on control dependency: [while], data = [none]
descriptor.setPreferred(true); // depends on control dependency: [while], data = [none]
if (key != null) {
descriptor.setValue("type", key.getClass()); // depends on control dependency: [if], data = [none]
}
descriptor.setValue("resolvableAtDesignTime", Boolean.TRUE); // depends on control dependency: [while], data = [none]
list.add(descriptor); // depends on control dependency: [while], data = [none]
}
return list.iterator(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public List<Token> scan() {
while (peek() != EOF) {
if (peek() == '#') {
if (scanDire()) {
continue ;
}
if (scanSingleLineComment()) {
continue ;
}
if (scanMultiLineComment()) {
continue ;
}
if (scanNoParse()) {
continue ;
}
}
scanText();
}
return tokens;
} } | public class class_name {
public List<Token> scan() {
while (peek() != EOF) {
if (peek() == '#') {
if (scanDire()) {
continue ;
}
if (scanSingleLineComment()) {
continue ;
}
if (scanMultiLineComment()) {
continue ;
}
if (scanNoParse()) {
continue ;
}
}
scanText();
// depends on control dependency: [while], data = [none]
}
return tokens;
} } |
public class class_name {
public void directTermination(FailureScope failureScope) throws TerminationFailedException {
if (tc.isEntryEnabled())
Tr.entry(tc, "directTermination", new Object[] { failureScope, this });
Tr.info(tc, "CWRLS0014_HALT_PEER_RECOVERY", failureScope.serverName());
// If callbacks are registered, drive then now.
if (_registeredCallbacks != null) {
driveCallBacks(CALLBACK_TERMINATIONSTARTED, failureScope);
}
if (Configuration.HAEnabled()) {
Configuration.getRecoveryLogComponent().leaveCluster(failureScope);
}
// Extract the 'values' collection from the _registeredRecoveryAgents map and create an iterator
// from it. This iterator will return ArrayList objects each containing a set of RecoveryAgent
// objects. Each ArrayList corrisponds to a different sequence priority value.
final Collection registeredRecoveryAgentsValues = _registeredRecoveryAgents.values();
final Iterator registeredRecoveryAgentsValuesIterator = registeredRecoveryAgentsValues.iterator();
while (registeredRecoveryAgentsValuesIterator.hasNext()) {
// Extract the next ArrayList and create an iterator from it. This iterator will return RecoveryAgent
// objects that are registered at the same sequence priority value.
final ArrayList registeredRecoveryAgentsArray = (java.util.ArrayList) registeredRecoveryAgentsValuesIterator.next();
final Iterator registeredRecoveryAgentsArrayIterator = registeredRecoveryAgentsArray.iterator();
while (registeredRecoveryAgentsArrayIterator.hasNext()) {
// Extract the next RecoveryAgent object
final RecoveryAgent recoveryAgent = (RecoveryAgent) registeredRecoveryAgentsArrayIterator.next();
// Record the fact that we have an outstanding termination request for the RecoveryAgent.
addTerminationRecord(recoveryAgent, failureScope);
// Direct the RecoveryAgent instance to terminate processing of this failure scope
try {
recoveryAgent.terminateRecovery(failureScope);
} catch (TerminationFailedException exc) {
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination", "540", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "directTermination", exc);
throw exc;
} catch (Exception exc) {
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination", "576", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "directTermination", exc);
throw new TerminationFailedException(exc);
}
// Wait for 'terminationComplete' to be called. This callback may be issued from another thread.
synchronized (_outstandingTerminationRecords) {
while (terminationOutstanding(recoveryAgent, failureScope)) {
try {
_outstandingTerminationRecords.wait();
} catch (InterruptedException exc) {
// This exception is recieved if another thread interrupts this thread by calling this threads
// Thread.interrupt method. The RecoveryDirectorImpl class does not use this mechanism for
// breaking out of the wait call - it uses notifyAll to wake up all waiting threads. This
// exception should never be generated. If for some reason it is called then ignore it and
//start to wait again.
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination", "549", this);
}
}
}
}
}
// If callbacks are registered, drive then now.
if (_registeredCallbacks != null) {
driveCallBacks(CALLBACK_TERMINATIONCOMPLETE, failureScope);
}
if (tc.isEntryEnabled())
Tr.exit(tc, "directTermination");
} } | public class class_name {
public void directTermination(FailureScope failureScope) throws TerminationFailedException {
if (tc.isEntryEnabled())
Tr.entry(tc, "directTermination", new Object[] { failureScope, this });
Tr.info(tc, "CWRLS0014_HALT_PEER_RECOVERY", failureScope.serverName());
// If callbacks are registered, drive then now.
if (_registeredCallbacks != null) {
driveCallBacks(CALLBACK_TERMINATIONSTARTED, failureScope); // depends on control dependency: [if], data = [none]
}
if (Configuration.HAEnabled()) {
Configuration.getRecoveryLogComponent().leaveCluster(failureScope); // depends on control dependency: [if], data = [none]
}
// Extract the 'values' collection from the _registeredRecoveryAgents map and create an iterator
// from it. This iterator will return ArrayList objects each containing a set of RecoveryAgent
// objects. Each ArrayList corrisponds to a different sequence priority value.
final Collection registeredRecoveryAgentsValues = _registeredRecoveryAgents.values();
final Iterator registeredRecoveryAgentsValuesIterator = registeredRecoveryAgentsValues.iterator();
while (registeredRecoveryAgentsValuesIterator.hasNext()) {
// Extract the next ArrayList and create an iterator from it. This iterator will return RecoveryAgent
// objects that are registered at the same sequence priority value.
final ArrayList registeredRecoveryAgentsArray = (java.util.ArrayList) registeredRecoveryAgentsValuesIterator.next();
final Iterator registeredRecoveryAgentsArrayIterator = registeredRecoveryAgentsArray.iterator();
while (registeredRecoveryAgentsArrayIterator.hasNext()) {
// Extract the next RecoveryAgent object
final RecoveryAgent recoveryAgent = (RecoveryAgent) registeredRecoveryAgentsArrayIterator.next();
// Record the fact that we have an outstanding termination request for the RecoveryAgent.
addTerminationRecord(recoveryAgent, failureScope); // depends on control dependency: [while], data = [none]
// Direct the RecoveryAgent instance to terminate processing of this failure scope
try {
recoveryAgent.terminateRecovery(failureScope); // depends on control dependency: [try], data = [none]
} catch (TerminationFailedException exc) {
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination", "540", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "directTermination", exc);
throw exc;
} catch (Exception exc) { // depends on control dependency: [catch], data = [none]
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination", "576", this);
if (tc.isEntryEnabled())
Tr.exit(tc, "directTermination", exc);
throw new TerminationFailedException(exc);
} // depends on control dependency: [catch], data = [none]
// Wait for 'terminationComplete' to be called. This callback may be issued from another thread.
synchronized (_outstandingTerminationRecords) { // depends on control dependency: [while], data = [none]
while (terminationOutstanding(recoveryAgent, failureScope)) {
try {
_outstandingTerminationRecords.wait(); // depends on control dependency: [try], data = [none]
} catch (InterruptedException exc) {
// This exception is recieved if another thread interrupts this thread by calling this threads
// Thread.interrupt method. The RecoveryDirectorImpl class does not use this mechanism for
// breaking out of the wait call - it uses notifyAll to wake up all waiting threads. This
// exception should never be generated. If for some reason it is called then ignore it and
//start to wait again.
FFDCFilter.processException(exc, "com.ibm.ws.recoverylog.spi.RecoveryDirectorImpl.directTermination", "549", this);
} // depends on control dependency: [catch], data = [none]
}
}
}
}
// If callbacks are registered, drive then now.
if (_registeredCallbacks != null) {
driveCallBacks(CALLBACK_TERMINATIONCOMPLETE, failureScope); // depends on control dependency: [if], data = [none]
}
if (tc.isEntryEnabled())
Tr.exit(tc, "directTermination");
} } |
public class class_name {
public static boolean contains(String str, String searchStr) {
if (str == null || searchStr == null) {
return false;
}
return str.indexOf(searchStr) >= 0;
} } | public class class_name {
public static boolean contains(String str, String searchStr) {
if (str == null || searchStr == null) {
return false; // depends on control dependency: [if], data = [none]
}
return str.indexOf(searchStr) >= 0;
} } |
public class class_name {
private static Method findGetterWithCompatibleReturnType(final String getterName, final Class<?> clazz,
final boolean enforceBooleanReturnType) {
for( final Method method : clazz.getMethods() ) {
if( !getterName.equalsIgnoreCase(method.getName()) || method.getParameterTypes().length != 0
|| method.getReturnType().equals(void.class) ) {
continue; // getter must have correct name, 0 parameters and a return type
}
if( !enforceBooleanReturnType || boolean.class.equals(method.getReturnType())
|| Boolean.class.equals(method.getReturnType()) ) {
return method;
}
}
return null;
} } | public class class_name {
private static Method findGetterWithCompatibleReturnType(final String getterName, final Class<?> clazz,
final boolean enforceBooleanReturnType) {
for( final Method method : clazz.getMethods() ) {
if( !getterName.equalsIgnoreCase(method.getName()) || method.getParameterTypes().length != 0
|| method.getReturnType().equals(void.class) ) {
continue; // getter must have correct name, 0 parameters and a return type
}
if( !enforceBooleanReturnType || boolean.class.equals(method.getReturnType())
|| Boolean.class.equals(method.getReturnType()) ) {
return method; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
void completed(long bytesAffected) {
boolean needToFire = true;
synchronized (this.completedSemaphore) {
// If it's already completed, do nothing
if (this.completed || !this.channel.isOpen()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Future completed after already cancelled or socket was closed");
}
return;
}
// mark it completed, release sync lock, then process
this.completed = true;
// new timeout code - cancel timeout request if active
if (getTimeoutWorkItem() != null) {
getTimeoutWorkItem().state = TimerWorkItem.ENTRY_CANCELLED;
}
this.byteCount = bytesAffected;
// Loop over the buffers, updating the positions until
// we've exhausted the number of bytes affected
long numbytes = bytesAffected;
for (ByteBuffer buffer : this.buffers) {
int bufspace = buffer.remaining();
if (bytesAffected > bufspace) {
buffer.position(buffer.limit());
numbytes -= bufspace;
} else {
buffer.position(buffer.position() + (int) numbytes);
numbytes = 0;
break;
}
} // end for
if (this.firstListener == null) {
// Sync Read/Write request.
// must do this inside the sync, or else Sync Read/Write could complete
// before we get here, and we would be doing this on the next
// Read/Write request!
needToFire = false;
this.completedSemaphore.notifyAll();
}
}
if (needToFire) {
// ASync Read/Write request.
// need to do this outside the sync, or else we will hold the sync
// for the user's callback.
fireCompletionActions();
}
} } | public class class_name {
void completed(long bytesAffected) {
boolean needToFire = true;
synchronized (this.completedSemaphore) {
// If it's already completed, do nothing
if (this.completed || !this.channel.isOpen()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Future completed after already cancelled or socket was closed"); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
// mark it completed, release sync lock, then process
this.completed = true;
// new timeout code - cancel timeout request if active
if (getTimeoutWorkItem() != null) {
getTimeoutWorkItem().state = TimerWorkItem.ENTRY_CANCELLED; // depends on control dependency: [if], data = [none]
}
this.byteCount = bytesAffected;
// Loop over the buffers, updating the positions until
// we've exhausted the number of bytes affected
long numbytes = bytesAffected;
for (ByteBuffer buffer : this.buffers) {
int bufspace = buffer.remaining();
if (bytesAffected > bufspace) {
buffer.position(buffer.limit()); // depends on control dependency: [if], data = [none]
numbytes -= bufspace; // depends on control dependency: [if], data = [none]
} else {
buffer.position(buffer.position() + (int) numbytes); // depends on control dependency: [if], data = [none]
numbytes = 0; // depends on control dependency: [if], data = [none]
break;
}
} // end for
if (this.firstListener == null) {
// Sync Read/Write request.
// must do this inside the sync, or else Sync Read/Write could complete
// before we get here, and we would be doing this on the next
// Read/Write request!
needToFire = false; // depends on control dependency: [if], data = [none]
this.completedSemaphore.notifyAll(); // depends on control dependency: [if], data = [none]
}
}
if (needToFire) {
// ASync Read/Write request.
// need to do this outside the sync, or else we will hold the sync
// for the user's callback.
fireCompletionActions(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@RequestMapping(method = RequestMethod.POST, params = "action=removeByFName")
public ModelAndView removeByFName(
HttpServletRequest request,
HttpServletResponse response,
@RequestParam(value = "fname") String fname)
throws IOException {
IUserInstance ui = userInstanceManager.getUserInstance(request);
UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager();
IUserLayoutManager ulm = upm.getUserLayoutManager();
try {
String elementId =
ulm.getUserLayout().findNodeId(new PortletSubscribeIdResolver(fname));
if (elementId != null) {
// Delete the requested element node. This code is the same for
// all node types, so we can just have a generic action.
if (!ulm.deleteNode(elementId)) {
logger.info(
"Failed to remove element ID {} from layout root folder ID {}, delete node returned false",
elementId,
ulm.getRootFolderId());
response.setStatus(HttpServletResponse.SC_FORBIDDEN);
return new ModelAndView(
"jsonView",
Collections.singletonMap(
"error",
getMessage(
"error.element.update",
"Unable to update element",
RequestContextUtils.getLocale(request))));
}
} else {
response.sendError(HttpServletResponse.SC_BAD_REQUEST);
return null;
}
ulm.saveUserLayout();
return new ModelAndView("jsonView", Collections.emptyMap());
} catch (PortalException e) {
return handlePersistError(request, response, e);
}
} } | public class class_name {
@RequestMapping(method = RequestMethod.POST, params = "action=removeByFName")
public ModelAndView removeByFName(
HttpServletRequest request,
HttpServletResponse response,
@RequestParam(value = "fname") String fname)
throws IOException {
IUserInstance ui = userInstanceManager.getUserInstance(request);
UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager();
IUserLayoutManager ulm = upm.getUserLayoutManager();
try {
String elementId =
ulm.getUserLayout().findNodeId(new PortletSubscribeIdResolver(fname));
if (elementId != null) {
// Delete the requested element node. This code is the same for
// all node types, so we can just have a generic action.
if (!ulm.deleteNode(elementId)) {
logger.info(
"Failed to remove element ID {} from layout root folder ID {}, delete node returned false",
elementId,
ulm.getRootFolderId()); // depends on control dependency: [if], data = [none]
response.setStatus(HttpServletResponse.SC_FORBIDDEN); // depends on control dependency: [if], data = [none]
return new ModelAndView(
"jsonView",
Collections.singletonMap(
"error",
getMessage(
"error.element.update",
"Unable to update element",
RequestContextUtils.getLocale(request)))); // depends on control dependency: [if], data = [none]
}
} else {
response.sendError(HttpServletResponse.SC_BAD_REQUEST); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
ulm.saveUserLayout();
return new ModelAndView("jsonView", Collections.emptyMap());
} catch (PortalException e) {
return handlePersistError(request, response, e);
}
} } |
public class class_name {
protected final String getForCreate(final Class<?> pClass) {
if (this.sharedEntities.contains(pClass)) {
return null;
} else if (IHasSeSeller.class.isAssignableFrom(pClass)) {
return PrcEntityCreate.class.getSimpleName();
}
return null;
} } | public class class_name {
protected final String getForCreate(final Class<?> pClass) {
if (this.sharedEntities.contains(pClass)) {
return null; // depends on control dependency: [if], data = [none]
} else if (IHasSeSeller.class.isAssignableFrom(pClass)) {
return PrcEntityCreate.class.getSimpleName(); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private void handleOutstandingOperations(final ChannelHandlerContext ctx) {
if (sentRequestQueue.isEmpty()) {
LOGGER.trace(logIdent(ctx, endpoint) + "Not cancelling operations - sent queue is empty.");
return;
}
LOGGER.debug(logIdent(ctx, endpoint) + "Cancelling " + sentRequestQueue.size() + " outstanding requests.");
while (!sentRequestQueue.isEmpty()) {
REQUEST req = sentRequestQueue.poll();
try {
sideEffectRequestToCancel(req);
failSafe(env().scheduler(), moveResponseOut, req.observable(),
new RequestCancelledException("Request cancelled in-flight."));
} catch (Exception ex) {
LOGGER.info(
"Exception thrown while cancelling outstanding operation: {}",
user(req.toString()),
ex
);
}
}
sentRequestTimings.clear();
} } | public class class_name {
private void handleOutstandingOperations(final ChannelHandlerContext ctx) {
if (sentRequestQueue.isEmpty()) {
LOGGER.trace(logIdent(ctx, endpoint) + "Not cancelling operations - sent queue is empty."); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
LOGGER.debug(logIdent(ctx, endpoint) + "Cancelling " + sentRequestQueue.size() + " outstanding requests.");
while (!sentRequestQueue.isEmpty()) {
REQUEST req = sentRequestQueue.poll();
try {
sideEffectRequestToCancel(req); // depends on control dependency: [try], data = [none]
failSafe(env().scheduler(), moveResponseOut, req.observable(),
new RequestCancelledException("Request cancelled in-flight.")); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
LOGGER.info(
"Exception thrown while cancelling outstanding operation: {}",
user(req.toString()),
ex
);
} // depends on control dependency: [catch], data = [none]
}
sentRequestTimings.clear();
} } |
public class class_name {
public Map<String, Object> parseAggregations(SearchResponse response, KunderaQuery query, MetamodelImpl metaModel,
Class clazz, EntityMetadata m)
{
Map<String, Object> aggregationsMap = new LinkedHashMap<>();
if (query.isAggregated() == true && response.getAggregations() != null)
{
InternalAggregations internalAggs = ((InternalFilter) response.getAggregations().getAsMap()
.get(ESConstants.AGGREGATION_NAME)).getAggregations();
ListIterable<Expression> iterable = getSelectExpressionOrder(query);
if (query.isSelectStatement() && KunderaQueryUtils.hasGroupBy(query.getJpqlExpression()))
{
Terms buckets = (Terms) (internalAggs).getAsMap().get(ESConstants.GROUP_BY);
filterBuckets(buckets, query);
for (Terms.Bucket bucket : buckets.getBuckets())
{
logger.debug("key [{}], doc_count [{}]", bucket.getKey(), bucket.getDocCount());
TopHits topHits = bucket.getAggregations().get(ESConstants.TOP_HITS);
aggregationsMap.put(topHits.getHits().getAt(0).getId(),
buildRecords(iterable, (InternalAggregations) bucket.getAggregations()));
}
}
else
{
aggregationsMap = buildRecords(iterable, internalAggs);
}
}
return aggregationsMap;
} } | public class class_name {
public Map<String, Object> parseAggregations(SearchResponse response, KunderaQuery query, MetamodelImpl metaModel,
Class clazz, EntityMetadata m)
{
Map<String, Object> aggregationsMap = new LinkedHashMap<>();
if (query.isAggregated() == true && response.getAggregations() != null)
{
InternalAggregations internalAggs = ((InternalFilter) response.getAggregations().getAsMap()
.get(ESConstants.AGGREGATION_NAME)).getAggregations();
ListIterable<Expression> iterable = getSelectExpressionOrder(query);
if (query.isSelectStatement() && KunderaQueryUtils.hasGroupBy(query.getJpqlExpression()))
{
Terms buckets = (Terms) (internalAggs).getAsMap().get(ESConstants.GROUP_BY);
filterBuckets(buckets, query); // depends on control dependency: [if], data = [none]
for (Terms.Bucket bucket : buckets.getBuckets())
{
logger.debug("key [{}], doc_count [{}]", bucket.getKey(), bucket.getDocCount()); // depends on control dependency: [for], data = [bucket]
TopHits topHits = bucket.getAggregations().get(ESConstants.TOP_HITS);
aggregationsMap.put(topHits.getHits().getAt(0).getId(),
buildRecords(iterable, (InternalAggregations) bucket.getAggregations())); // depends on control dependency: [for], data = [none]
}
}
else
{
aggregationsMap = buildRecords(iterable, internalAggs); // depends on control dependency: [if], data = [none]
}
}
return aggregationsMap;
} } |
public class class_name {
@Override
public EJBLocalHome getEJBLocalHome()
{
EJSWrapperCommon wCommon = null; // d116480
try {
wCommon = home.getWrapper(); // d116337
} catch (Exception ex) {
// This is bad
FFDCFilter.processException(ex, CLASS_NAME + ".getEJBLocalHome",
"547", this);
Tr.warning(tc, "FAILED_TO_GET_WRAPPER_FOR_HOME_CNTR0002W", //p111002.3
new Object[] { ex });
return null; // d116480
}
return (EJBLocalHome) wCommon.getLocalObject(); // d116480
} } | public class class_name {
@Override
public EJBLocalHome getEJBLocalHome()
{
EJSWrapperCommon wCommon = null; // d116480
try {
wCommon = home.getWrapper(); // d116337 // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
// This is bad
FFDCFilter.processException(ex, CLASS_NAME + ".getEJBLocalHome",
"547", this);
Tr.warning(tc, "FAILED_TO_GET_WRAPPER_FOR_HOME_CNTR0002W", //p111002.3
new Object[] { ex });
return null; // d116480
} // depends on control dependency: [catch], data = [none]
return (EJBLocalHome) wCommon.getLocalObject(); // d116480
} } |
public class class_name {
public Object lookup(Identity oid)
{
CacheEntry entry = null;
SoftReference ref = (SoftReference) objectTable.get(oid);
if (ref != null)
{
entry = (CacheEntry) ref.get();
if (entry == null || entry.lifetime < System.currentTimeMillis())
{
objectTable.remove(oid); // Soft-referenced Object reclaimed by GC
// timeout, so set null
entry = null;
}
}
return entry != null ? entry.object : null;
} } | public class class_name {
public Object lookup(Identity oid)
{
CacheEntry entry = null;
SoftReference ref = (SoftReference) objectTable.get(oid);
if (ref != null)
{
entry = (CacheEntry) ref.get();
// depends on control dependency: [if], data = [none]
if (entry == null || entry.lifetime < System.currentTimeMillis())
{
objectTable.remove(oid); // Soft-referenced Object reclaimed by GC
// depends on control dependency: [if], data = [none]
// timeout, so set null
entry = null;
// depends on control dependency: [if], data = [none]
}
}
return entry != null ? entry.object : null;
} } |
public class class_name {
protected List<Attribute> getAttributes1(String ownerType, Long ownerId)
throws SQLException {
List<Attribute> attrs = getAttributes0(ownerType, ownerId);
if (attrs==null) return null;
ResultSet rs;
String query = "select RULE_SET_DETAILS from RULE_SET where RULE_SET_ID=?";
for (Attribute attr : attrs) {
String v = attr.getAttributeValue();
if (v!=null && v.startsWith(Asset.ATTRIBUTE_OVERFLOW)) {
Long assetId = new Long(v.substring(Asset.ATTRIBUTE_OVERFLOW.length()+1));
rs = db.runSelect(query, assetId);
if (rs.next()) {
attr.setAttributeValue(rs.getString(1));
}
}
}
return attrs;
} } | public class class_name {
protected List<Attribute> getAttributes1(String ownerType, Long ownerId)
throws SQLException {
List<Attribute> attrs = getAttributes0(ownerType, ownerId);
if (attrs==null) return null;
ResultSet rs;
String query = "select RULE_SET_DETAILS from RULE_SET where RULE_SET_ID=?";
for (Attribute attr : attrs) {
String v = attr.getAttributeValue();
if (v!=null && v.startsWith(Asset.ATTRIBUTE_OVERFLOW)) {
Long assetId = new Long(v.substring(Asset.ATTRIBUTE_OVERFLOW.length()+1));
rs = db.runSelect(query, assetId); // depends on control dependency: [if], data = [none]
if (rs.next()) {
attr.setAttributeValue(rs.getString(1)); // depends on control dependency: [if], data = [none]
}
}
}
return attrs;
} } |
public class class_name {
private static void copySingleRow(final Sheet srcSheet, final Sheet destSheet, final int sourceRowNum,
final int destinationRowNum, final boolean checkLock, final boolean setHiddenColumn) {
// Get the source / new row
Row newRow = destSheet.getRow(destinationRowNum);
Row sourceRow = srcSheet.getRow(sourceRowNum);
if (newRow == null) {
newRow = destSheet.createRow(destinationRowNum);
}
newRow.setHeight(sourceRow.getHeight());
// Loop through source columns to add to new row
for (int i = 0; i < sourceRow.getLastCellNum(); i++) {
// Grab a copy of the old/new cell
copyCell(destSheet, sourceRow, newRow, i, checkLock);
}
if (setHiddenColumn) {
ConfigurationUtility.setOriginalRowNumInHiddenColumn(newRow, sourceRow.getRowNum());
}
return;
} } | public class class_name {
private static void copySingleRow(final Sheet srcSheet, final Sheet destSheet, final int sourceRowNum,
final int destinationRowNum, final boolean checkLock, final boolean setHiddenColumn) {
// Get the source / new row
Row newRow = destSheet.getRow(destinationRowNum);
Row sourceRow = srcSheet.getRow(sourceRowNum);
if (newRow == null) {
newRow = destSheet.createRow(destinationRowNum);
// depends on control dependency: [if], data = [none]
}
newRow.setHeight(sourceRow.getHeight());
// Loop through source columns to add to new row
for (int i = 0; i < sourceRow.getLastCellNum(); i++) {
// Grab a copy of the old/new cell
copyCell(destSheet, sourceRow, newRow, i, checkLock);
// depends on control dependency: [for], data = [i]
}
if (setHiddenColumn) {
ConfigurationUtility.setOriginalRowNumInHiddenColumn(newRow, sourceRow.getRowNum());
// depends on control dependency: [if], data = [none]
}
return;
} } |
public class class_name {
AccessDeniedHandler getAccessDeniedHandler(H http) {
AccessDeniedHandler deniedHandler = this.accessDeniedHandler;
if (deniedHandler == null) {
deniedHandler = createDefaultDeniedHandler(http);
}
return deniedHandler;
} } | public class class_name {
AccessDeniedHandler getAccessDeniedHandler(H http) {
AccessDeniedHandler deniedHandler = this.accessDeniedHandler;
if (deniedHandler == null) {
deniedHandler = createDefaultDeniedHandler(http); // depends on control dependency: [if], data = [none]
}
return deniedHandler;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.