code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public ChemComp getChemComp(String recordName) {
if (null == recordName) return null;
// handle non-existent ChemComp codes and do not repeatedly attempt to add these.
for (String str : unavailable) {
if (recordName.equals(str)) return getEmptyChemComp(recordName);
}
// Try to pull from zip, if fail then download.
ChemComp cc = getFromZip(recordName);
if (cc == null) {
s_logger.info("File "+recordName+" not found in archive. Attempting download from PDB.");
cc = downloadAndAdd(recordName);
}
// If a null record or an empty chemcomp, return a default ChemComp and blacklist.
if (cc == null || (null == cc.getName() && cc.getAtoms().size() == 0)) {
s_logger.info("Unable to find or download " + recordName + " - excluding from future searches.");
unavailable.add(recordName);
return getEmptyChemComp(recordName);
}
return cc;
} } | public class class_name {
@Override
public ChemComp getChemComp(String recordName) {
if (null == recordName) return null;
// handle non-existent ChemComp codes and do not repeatedly attempt to add these.
for (String str : unavailable) {
if (recordName.equals(str)) return getEmptyChemComp(recordName);
}
// Try to pull from zip, if fail then download.
ChemComp cc = getFromZip(recordName);
if (cc == null) {
s_logger.info("File "+recordName+" not found in archive. Attempting download from PDB."); // depends on control dependency: [if], data = [none]
cc = downloadAndAdd(recordName); // depends on control dependency: [if], data = [none]
}
// If a null record or an empty chemcomp, return a default ChemComp and blacklist.
if (cc == null || (null == cc.getName() && cc.getAtoms().size() == 0)) {
s_logger.info("Unable to find or download " + recordName + " - excluding from future searches."); // depends on control dependency: [if], data = [none]
unavailable.add(recordName); // depends on control dependency: [if], data = [none]
return getEmptyChemComp(recordName); // depends on control dependency: [if], data = [none]
}
return cc;
} } |
public class class_name {
private void processNodeStateEvent(NodeStateEvent event) {
switch (stateRef.get()) {
case BEFORE_INIT:
case DURING_INIT:
throw new AssertionError("Filter should not be marked ready until LBP init");
case CLOSING:
return; // ignore
case RUNNING:
for (LoadBalancingPolicy policy : policies) {
if (event.newState == NodeState.UP) {
policy.onUp(event.node);
} else if (event.newState == NodeState.DOWN || event.newState == NodeState.FORCED_DOWN) {
policy.onDown(event.node);
} else if (event.newState == NodeState.UNKNOWN) {
policy.onAdd(event.node);
} else if (event.newState == null) {
policy.onRemove(event.node);
} else {
LOG.warn("[{}] Unsupported event: {}", logPrefix, event);
}
}
break;
}
} } | public class class_name {
private void processNodeStateEvent(NodeStateEvent event) {
switch (stateRef.get()) {
case BEFORE_INIT:
case DURING_INIT:
throw new AssertionError("Filter should not be marked ready until LBP init");
case CLOSING:
return; // ignore
case RUNNING:
for (LoadBalancingPolicy policy : policies) {
if (event.newState == NodeState.UP) {
policy.onUp(event.node); // depends on control dependency: [if], data = [none]
} else if (event.newState == NodeState.DOWN || event.newState == NodeState.FORCED_DOWN) {
policy.onDown(event.node); // depends on control dependency: [if], data = [none]
} else if (event.newState == NodeState.UNKNOWN) {
policy.onAdd(event.node); // depends on control dependency: [if], data = [none]
} else if (event.newState == null) {
policy.onRemove(event.node); // depends on control dependency: [if], data = [none]
} else {
LOG.warn("[{}] Unsupported event: {}", logPrefix, event); // depends on control dependency: [if], data = [none]
}
}
break;
}
} } |
public class class_name {
public void removeClientNotificationListener(RESTRequest request, ObjectName name) {
NotificationTargetInformation nti = toNotificationTargetInformation(request, name.getCanonicalName());
// Remove locally
ClientNotificationListener listener = listeners.remove(nti);
// Check whether the producer of the notification is local or remote.
if (nti.getRoutingInformation() == null) {
// Remove the notification from the MBeanServer
MBeanServerHelper.removeClientNotification(name, listener);
} else {
// Remove the notification listener from the Target-Client Manager through EventAdmin
MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper.getMBeanRoutedNotificationHelper();
helper.removeRoutedNotificationListener(nti, listener);
}
} } | public class class_name {
public void removeClientNotificationListener(RESTRequest request, ObjectName name) {
NotificationTargetInformation nti = toNotificationTargetInformation(request, name.getCanonicalName());
// Remove locally
ClientNotificationListener listener = listeners.remove(nti);
// Check whether the producer of the notification is local or remote.
if (nti.getRoutingInformation() == null) {
// Remove the notification from the MBeanServer
MBeanServerHelper.removeClientNotification(name, listener); // depends on control dependency: [if], data = [none]
} else {
// Remove the notification listener from the Target-Client Manager through EventAdmin
MBeanRoutedNotificationHelper helper = MBeanRoutedNotificationHelper.getMBeanRoutedNotificationHelper();
helper.removeRoutedNotificationListener(nti, listener); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String getUserNameFromToken(String authToken) {
if (null == authToken) {
return null;
}
return authToken.split(TOKEN_SEPARATOR)[0];
} } | public class class_name {
public static String getUserNameFromToken(String authToken) {
if (null == authToken) {
return null; // depends on control dependency: [if], data = [none]
}
return authToken.split(TOKEN_SEPARATOR)[0];
} } |
public class class_name {
@Override
public EClass getIfcWarpingConstantMeasure() {
if (ifcWarpingConstantMeasureEClass == null) {
ifcWarpingConstantMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(893);
}
return ifcWarpingConstantMeasureEClass;
} } | public class class_name {
@Override
public EClass getIfcWarpingConstantMeasure() {
if (ifcWarpingConstantMeasureEClass == null) {
ifcWarpingConstantMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(893);
// depends on control dependency: [if], data = [none]
}
return ifcWarpingConstantMeasureEClass;
} } |
public class class_name {
@Pure
public Iterable<BusHub> busHubs() {
if (this.hubs == null) {
return Collections.emptyList();
}
return Collections.unmodifiableCollection(this.hubs);
} } | public class class_name {
@Pure
public Iterable<BusHub> busHubs() {
if (this.hubs == null) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableCollection(this.hubs);
} } |
public class class_name {
public void deleteUploadFile(HttpServletRequest request,
UploadFile uploadFile) {
try {
// removeImageFromCache(uploadFile.getId());
imageFilter.deleteUploadFile(request, uploadFile);
} catch (Exception ex) {
Debug.logError("[JdonFramework] deleteUploadFile error" + ex, module);
}
} } | public class class_name {
public void deleteUploadFile(HttpServletRequest request,
UploadFile uploadFile) {
try {
// removeImageFromCache(uploadFile.getId());
imageFilter.deleteUploadFile(request, uploadFile);
// depends on control dependency: [try], data = [none]
} catch (Exception ex) {
Debug.logError("[JdonFramework] deleteUploadFile error" + ex, module);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Statement withUpdatedParameters( Value updates )
{
if ( updates == null || updates.isEmpty() )
{
return this;
}
else
{
Map<String,Value> newParameters = newHashMapWithSize( Math.max( parameters.size(), updates.size() ) );
newParameters.putAll( parameters.asMap( ofValue() ) );
for ( Map.Entry<String, Value> entry : updates.asMap( ofValue() ).entrySet() )
{
Value value = entry.getValue();
if ( value.isNull() )
{
newParameters.remove( entry.getKey() );
}
else
{
newParameters.put( entry.getKey(), value );
}
}
return withParameters( value(newParameters) );
}
} } | public class class_name {
public Statement withUpdatedParameters( Value updates )
{
if ( updates == null || updates.isEmpty() )
{
return this; // depends on control dependency: [if], data = [none]
}
else
{
Map<String,Value> newParameters = newHashMapWithSize( Math.max( parameters.size(), updates.size() ) );
newParameters.putAll( parameters.asMap( ofValue() ) ); // depends on control dependency: [if], data = [none]
for ( Map.Entry<String, Value> entry : updates.asMap( ofValue() ).entrySet() )
{
Value value = entry.getValue();
if ( value.isNull() )
{
newParameters.remove( entry.getKey() ); // depends on control dependency: [if], data = [none]
}
else
{
newParameters.put( entry.getKey(), value ); // depends on control dependency: [if], data = [none]
}
}
return withParameters( value(newParameters) ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static MoleculerError create(Tree payload) {
// Get name field (~= NodeJS or Java class)
String name = payload.get("name", (String) null);
// Create built-in types
if (name != null && !name.isEmpty()) {
switch (name) {
case MOLECULER_ERROR:
return new MoleculerError(payload);
case MOLECULER_RETRYABLE_ERROR:
return new MoleculerRetryableError(payload);
case MOLECULER_SERVER_ERROR:
return new MoleculerServerError(payload);
case MOLECULER_CLIENT_ERROR:
return new MoleculerClientError(payload);
case SERVICE_NOT_FOUND_ERROR:
return new ServiceNotFoundError(payload);
case SERVICE_NOT_AVAILABLE_ERROR:
return new ServiceNotAvailableError(payload);
case VALIDATION_ERROR:
return new ValidationError(payload);
case REQUEST_TIMEOUT_ERROR:
return new RequestTimeoutError(payload);
case REQUEST_SKIPPED_ERROR:
return new RequestSkippedError(payload);
case REQUEST_REJECTED_ERROR:
return new RequestRejectedError(payload);
case QUEUE_IS_FULL_ERROR:
return new QueueIsFullError(payload);
case MAX_CALL_LEVEL_ERROR:
return new MaxCallLevelError(payload);
case SERVICE_SCHEMA_ERROR:
return new ServiceSchemaError(payload);
case BROKER_OPTIONS_ERROR:
return new BrokerOptionsError(payload);
case GRACEFUL_STOP_TIMEOUT_ERROR:
return new GracefulStopTimeoutError(payload);
case PROTOCOL_VERSION_MISMATCH_ERROR:
return new ProtocolVersionMismatchError(payload);
case INVALID_PACKET_DATA_ERROR:
return new InvalidPacketDataError(payload);
default:
// Create custom error class
Class<? extends MoleculerError> errorClass = customErrors.get(name);
if (errorClass != null) {
try {
Constructor<? extends MoleculerError> c = errorClass.getConstructor(new Class[] { Tree.class });
return c.newInstance(payload);
} catch (Exception cause) {
throw new MoleculerError("Unable to create error class '" + name + "'!", cause,
"MoleculerError", "unknown", false, 500, "UNABLE_TO_CREATE_CLASS", "type", name);
}
}
}
}
// Create undefined / unknown type
return new MoleculerError(payload);
} } | public class class_name {
public static MoleculerError create(Tree payload) {
// Get name field (~= NodeJS or Java class)
String name = payload.get("name", (String) null);
// Create built-in types
if (name != null && !name.isEmpty()) {
switch (name) {
case MOLECULER_ERROR:
return new MoleculerError(payload);
case MOLECULER_RETRYABLE_ERROR:
return new MoleculerRetryableError(payload);
case MOLECULER_SERVER_ERROR:
return new MoleculerServerError(payload);
case MOLECULER_CLIENT_ERROR:
return new MoleculerClientError(payload);
case SERVICE_NOT_FOUND_ERROR:
return new ServiceNotFoundError(payload);
case SERVICE_NOT_AVAILABLE_ERROR:
return new ServiceNotAvailableError(payload);
case VALIDATION_ERROR:
return new ValidationError(payload);
case REQUEST_TIMEOUT_ERROR:
return new RequestTimeoutError(payload);
case REQUEST_SKIPPED_ERROR:
return new RequestSkippedError(payload);
case REQUEST_REJECTED_ERROR:
return new RequestRejectedError(payload);
case QUEUE_IS_FULL_ERROR:
return new QueueIsFullError(payload);
case MAX_CALL_LEVEL_ERROR:
return new MaxCallLevelError(payload);
case SERVICE_SCHEMA_ERROR:
return new ServiceSchemaError(payload);
case BROKER_OPTIONS_ERROR:
return new BrokerOptionsError(payload);
case GRACEFUL_STOP_TIMEOUT_ERROR:
return new GracefulStopTimeoutError(payload);
case PROTOCOL_VERSION_MISMATCH_ERROR:
return new ProtocolVersionMismatchError(payload);
case INVALID_PACKET_DATA_ERROR:
return new InvalidPacketDataError(payload);
default:
// Create custom error class
Class<? extends MoleculerError> errorClass = customErrors.get(name);
if (errorClass != null) {
try {
Constructor<? extends MoleculerError> c = errorClass.getConstructor(new Class[] { Tree.class });
// depends on control dependency: [try], data = [none]
return c.newInstance(payload);
// depends on control dependency: [try], data = [none]
} catch (Exception cause) {
throw new MoleculerError("Unable to create error class '" + name + "'!", cause,
"MoleculerError", "unknown", false, 500, "UNABLE_TO_CREATE_CLASS", "type", name);
}
// depends on control dependency: [catch], data = [none]
}
}
}
// Create undefined / unknown type
return new MoleculerError(payload);
} } |
public class class_name {
protected void parseRootElement() {
JobExecutorXmlImpl jobExecutor = new JobExecutorXmlImpl();
List<ProcessEngineXml> processEngines = new ArrayList<ProcessEngineXml>();
for (Element element : rootElement.elements()) {
if(JOB_EXECUTOR.equals(element.getTagName())) {
parseJobExecutor(element, jobExecutor);
} else if(PROCESS_ENGINE.equals(element.getTagName())) {
parseProcessEngine(element, processEngines);
}
}
bpmPlatformXml = new BpmPlatformXmlImpl(jobExecutor, processEngines);
} } | public class class_name {
protected void parseRootElement() {
JobExecutorXmlImpl jobExecutor = new JobExecutorXmlImpl();
List<ProcessEngineXml> processEngines = new ArrayList<ProcessEngineXml>();
for (Element element : rootElement.elements()) {
if(JOB_EXECUTOR.equals(element.getTagName())) {
parseJobExecutor(element, jobExecutor); // depends on control dependency: [if], data = [none]
} else if(PROCESS_ENGINE.equals(element.getTagName())) {
parseProcessEngine(element, processEngines); // depends on control dependency: [if], data = [none]
}
}
bpmPlatformXml = new BpmPlatformXmlImpl(jobExecutor, processEngines);
} } |
public class class_name {
private static void addToReceivers(final BroadcastReceiver receiver, final String action) {
Set<String> actions = RECEIVERS.get(receiver);
if (actions == null) {
actions = new HashSet<String>(1);
RECEIVERS.put(receiver, actions);
}
actions.add(action);
} } | public class class_name {
private static void addToReceivers(final BroadcastReceiver receiver, final String action) {
Set<String> actions = RECEIVERS.get(receiver);
if (actions == null) {
actions = new HashSet<String>(1); // depends on control dependency: [if], data = [none]
RECEIVERS.put(receiver, actions); // depends on control dependency: [if], data = [none]
}
actions.add(action);
} } |
public class class_name {
public boolean containsDTOFor(JavaClass<?> entity, boolean root)
{
if (dtos.get(entity) == null)
{
return false;
}
return (root ? (dtos.get(entity).rootDTO != null) : (dtos.get(entity).nestedDTO != null));
} } | public class class_name {
public boolean containsDTOFor(JavaClass<?> entity, boolean root)
{
if (dtos.get(entity) == null)
{
return false; // depends on control dependency: [if], data = [none]
}
return (root ? (dtos.get(entity).rootDTO != null) : (dtos.get(entity).nestedDTO != null));
} } |
public class class_name {
public void sendInstances(Stream inputStream,
int numberInstances, boolean isTraining, boolean isTesting) {
int numberSamples = 0;
while (streamSource.hasMoreInstances()
&& numberSamples < numberInstances) {
numberSamples++;
numberInstancesSent++;
InstanceContentEvent instanceContentEvent = new InstanceContentEvent(
numberInstancesSent, nextInstance(), isTraining, isTesting);
inputStream.put(instanceContentEvent);
}
InstanceContentEvent instanceContentEvent = new InstanceContentEvent(
numberInstancesSent, null, isTraining, isTesting);
instanceContentEvent.setLast(true);
inputStream.put(instanceContentEvent);
} } | public class class_name {
public void sendInstances(Stream inputStream,
int numberInstances, boolean isTraining, boolean isTesting) {
int numberSamples = 0;
while (streamSource.hasMoreInstances()
&& numberSamples < numberInstances) {
numberSamples++; // depends on control dependency: [while], data = [none]
numberInstancesSent++; // depends on control dependency: [while], data = [none]
InstanceContentEvent instanceContentEvent = new InstanceContentEvent(
numberInstancesSent, nextInstance(), isTraining, isTesting);
inputStream.put(instanceContentEvent); // depends on control dependency: [while], data = [none]
}
InstanceContentEvent instanceContentEvent = new InstanceContentEvent(
numberInstancesSent, null, isTraining, isTesting);
instanceContentEvent.setLast(true);
inputStream.put(instanceContentEvent);
} } |
public class class_name {
public V put(K key, V value)
{
// Remove any existing matching key from the data
V removedObject = remove(key);
// Insert the data into the map.
dataMap.put(key, value);
// If the key is fresh, enqueue it.
if (removedObject != null)
{
keys.offer(key);
}
// Return the replaced value if there was one
return removedObject;
} } | public class class_name {
public V put(K key, V value)
{
// Remove any existing matching key from the data
V removedObject = remove(key);
// Insert the data into the map.
dataMap.put(key, value);
// If the key is fresh, enqueue it.
if (removedObject != null)
{
keys.offer(key); // depends on control dependency: [if], data = [none]
}
// Return the replaced value if there was one
return removedObject;
} } |
public class class_name {
public CompensatingTransactionOperationExecutor recordOperation(
Object[] args) {
if (args == null || args.length != 3) {
throw new IllegalArgumentException(
"Invalid arguments for bind operation");
}
Name dn = LdapTransactionUtils.getFirstArgumentAsName(args);
Object object = args[1];
Attributes attributes = null;
if (args[2] != null && !(args[2] instanceof Attributes)) {
throw new IllegalArgumentException(
"Invalid third argument to bind operation");
} else if (args[2] != null) {
attributes = (Attributes) args[2];
}
return new BindOperationExecutor(ldapOperations, dn, object, attributes);
} } | public class class_name {
public CompensatingTransactionOperationExecutor recordOperation(
Object[] args) {
if (args == null || args.length != 3) {
throw new IllegalArgumentException(
"Invalid arguments for bind operation");
}
Name dn = LdapTransactionUtils.getFirstArgumentAsName(args);
Object object = args[1];
Attributes attributes = null;
if (args[2] != null && !(args[2] instanceof Attributes)) {
throw new IllegalArgumentException(
"Invalid third argument to bind operation");
} else if (args[2] != null) {
attributes = (Attributes) args[2];
// depends on control dependency: [if], data = [none]
}
return new BindOperationExecutor(ldapOperations, dn, object, attributes);
} } |
public class class_name {
private List<Method> getExcludedMethods(final Class<?> cls) {
final List<Method> lst = new ArrayList<Method>();
for (final ContractExclude exclude : cls.getAnnotationsByType( ContractExclude.class )) {
final Class<?> clazz = exclude.value();
for (final String mthdName : exclude.methods()) {
try {
lst.add( clazz.getDeclaredMethod( mthdName ) );
} catch (NoSuchMethodException | SecurityException e) {
LOG.warn( String.format( "ContractExclude annotation on %s incorrect", cls ), e );
}
}
}
return lst;
} } | public class class_name {
private List<Method> getExcludedMethods(final Class<?> cls) {
final List<Method> lst = new ArrayList<Method>();
for (final ContractExclude exclude : cls.getAnnotationsByType( ContractExclude.class )) {
final Class<?> clazz = exclude.value();
for (final String mthdName : exclude.methods()) {
try {
lst.add( clazz.getDeclaredMethod( mthdName ) ); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException | SecurityException e) {
LOG.warn( String.format( "ContractExclude annotation on %s incorrect", cls ), e );
} // depends on control dependency: [catch], data = [none]
}
}
return lst;
} } |
public class class_name {
@SuppressWarnings("unchecked")
private static <V extends FeatureVector<F>, F> ArrayAdapter<F, ? super V> getAdapter(Factory<V, F> factory) {
if(factory instanceof NumberVector.Factory) {
return (ArrayAdapter<F, ? super V>) NumberVectorAdapter.STATIC;
}
return (ArrayAdapter<F, ? super V>) FeatureVectorAdapter.STATIC;
} } | public class class_name {
@SuppressWarnings("unchecked")
private static <V extends FeatureVector<F>, F> ArrayAdapter<F, ? super V> getAdapter(Factory<V, F> factory) {
if(factory instanceof NumberVector.Factory) {
return (ArrayAdapter<F, ? super V>) NumberVectorAdapter.STATIC; // depends on control dependency: [if], data = [none]
}
return (ArrayAdapter<F, ? super V>) FeatureVectorAdapter.STATIC;
} } |
public class class_name {
private static Page extractNonEmptyPage(PageBuffer pageBuffer)
{
Page page = pageBuffer.poll();
while (page != null && page.getPositionCount() == 0) {
page = pageBuffer.poll();
}
return page;
} } | public class class_name {
private static Page extractNonEmptyPage(PageBuffer pageBuffer)
{
Page page = pageBuffer.poll();
while (page != null && page.getPositionCount() == 0) {
page = pageBuffer.poll(); // depends on control dependency: [while], data = [none]
}
return page;
} } |
public class class_name {
@Override
public void render() {
if (false == HuluSetting.isDevMode) {
Response.sendError(this.errorCode, this.errorContent);
return;
}
if (null != e) {
StaticLog.error(e);
if (null == this.errorContent) {
this.errorContent = StrUtil.EMPTY;
}
String stacktraceContent = ExceptionUtil.stacktraceToString(e)
.replace("\tat", " \tat")
.replace("\n", "<br/>\n");
this.errorContent = StrUtil.format(TEMPLATE_ERROR, this.getErrorCode(), Request.getServletRequest().getRequestURI(), this.errorContent, stacktraceContent);
}
Response.setStatus(errorCode);
Response.write(errorContent, Response.CONTENT_TYPE_HTML);
} } | public class class_name {
@Override
public void render() {
if (false == HuluSetting.isDevMode) {
Response.sendError(this.errorCode, this.errorContent);
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
if (null != e) {
StaticLog.error(e);
// depends on control dependency: [if], data = [e)]
if (null == this.errorContent) {
this.errorContent = StrUtil.EMPTY;
// depends on control dependency: [if], data = [none]
}
String stacktraceContent = ExceptionUtil.stacktraceToString(e)
.replace("\tat", " \tat")
.replace("\n", "<br/>\n");
this.errorContent = StrUtil.format(TEMPLATE_ERROR, this.getErrorCode(), Request.getServletRequest().getRequestURI(), this.errorContent, stacktraceContent);
// depends on control dependency: [if], data = [none]
}
Response.setStatus(errorCode);
Response.write(errorContent, Response.CONTENT_TYPE_HTML);
} } |
public class class_name {
protected <T> T deserialiseResponseMessage(CloseableHttpResponse response, Class<T> responseClass) throws IOException {
T body = null;
HttpEntity entity = response.getEntity();
if (entity != null && responseClass != null) {
try (InputStream inputStream = entity.getContent()) {
try {
body = Serialiser.deserialise(inputStream, responseClass);
} catch (JsonSyntaxException e) {
// This can happen if an error HTTP code is received and the
// body of the response doesn't contain the expected object:
body = null;
}
}
} else {
EntityUtils.consume(entity);
}
return body;
} } | public class class_name {
protected <T> T deserialiseResponseMessage(CloseableHttpResponse response, Class<T> responseClass) throws IOException {
T body = null;
HttpEntity entity = response.getEntity();
if (entity != null && responseClass != null) {
try (InputStream inputStream = entity.getContent()) {
try {
body = Serialiser.deserialise(inputStream, responseClass); // depends on control dependency: [try], data = [none]
} catch (JsonSyntaxException e) {
// This can happen if an error HTTP code is received and the
// body of the response doesn't contain the expected object:
body = null;
} // depends on control dependency: [catch], data = [none]
}
} else {
EntityUtils.consume(entity);
}
return body;
} } |
public class class_name {
public static net.sf.cglib.reflect.FastClass newFastClassForMember(Class<?> type, Member member) {
if (!new net.sf.cglib.core.VisibilityPredicate(type, false).evaluate(member)) {
// the member cannot be indexed by fast class. Bail out.
return null;
}
boolean publiclyCallable = isPubliclyCallable(member);
if (!publiclyCallable && !hasSameVersionOfCglib(type.getClassLoader())) {
// The type is in a classloader with a different version of cglib and is not publicly visible
// (so we can't use the bridge classloader to work around). Bail out.
return null;
}
net.sf.cglib.reflect.FastClass.Generator generator =
new net.sf.cglib.reflect.FastClass.Generator();
if (publiclyCallable) {
// Use the bridge classloader if we can
generator.setClassLoader(getClassLoader(type));
}
generator.setType(type);
generator.setNamingPolicy(FASTCLASS_NAMING_POLICY);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Loading " + type + " FastClass with " + generator.getClassLoader());
}
return generator.create();
} } | public class class_name {
public static net.sf.cglib.reflect.FastClass newFastClassForMember(Class<?> type, Member member) {
if (!new net.sf.cglib.core.VisibilityPredicate(type, false).evaluate(member)) {
// the member cannot be indexed by fast class. Bail out.
return null; // depends on control dependency: [if], data = [none]
}
boolean publiclyCallable = isPubliclyCallable(member);
if (!publiclyCallable && !hasSameVersionOfCglib(type.getClassLoader())) {
// The type is in a classloader with a different version of cglib and is not publicly visible
// (so we can't use the bridge classloader to work around). Bail out.
return null; // depends on control dependency: [if], data = [none]
}
net.sf.cglib.reflect.FastClass.Generator generator =
new net.sf.cglib.reflect.FastClass.Generator();
if (publiclyCallable) {
// Use the bridge classloader if we can
generator.setClassLoader(getClassLoader(type)); // depends on control dependency: [if], data = [none]
}
generator.setType(type);
generator.setNamingPolicy(FASTCLASS_NAMING_POLICY);
if (logger.isLoggable(Level.FINE)) {
logger.fine("Loading " + type + " FastClass with " + generator.getClassLoader()); // depends on control dependency: [if], data = [none]
}
return generator.create();
} } |
public class class_name {
private void changeBody(ImmutableMap<Integer, String> argNames) {
for (Node ref : currentArgumentsAccesses) {
Node index = ref.getNext();
Node parent = ref.getParent();
int value = (int) index.getDouble(); // This was validated earlier.
@Nullable String name = argNames.get(value);
if (name == null) {
continue;
}
Node newName = IR.name(name).useSourceInfoIfMissingFrom(parent);
parent.replaceWith(newName);
// TODO(nickreid): See if we can do this fewer times. The accesses may be in different scopes.
compiler.reportChangeToEnclosingScope(newName);
}
} } | public class class_name {
private void changeBody(ImmutableMap<Integer, String> argNames) {
for (Node ref : currentArgumentsAccesses) {
Node index = ref.getNext();
Node parent = ref.getParent();
int value = (int) index.getDouble(); // This was validated earlier.
@Nullable String name = argNames.get(value);
if (name == null) {
continue;
}
Node newName = IR.name(name).useSourceInfoIfMissingFrom(parent);
parent.replaceWith(newName); // depends on control dependency: [for], data = [none]
// TODO(nickreid): See if we can do this fewer times. The accesses may be in different scopes.
compiler.reportChangeToEnclosingScope(newName); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public static void delete(String key, String word) {
Forest dic = get(key);
if (dic != null) {
Library.removeWord(dic, word);
}
} } | public class class_name {
public static void delete(String key, String word) {
Forest dic = get(key);
if (dic != null) {
Library.removeWord(dic, word); // depends on control dependency: [if], data = [(dic]
}
} } |
public class class_name {
private CmsDynamicFunctionBean.Format getFunctionFormat() {
CmsDynamicFunctionBean functionBean = null;
try {
CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, m_cms.readFile(m_element.getResource()));
CmsDynamicFunctionParser parser = new CmsDynamicFunctionParser();
functionBean = parser.parseFunctionBean(m_cms, content);
} catch (CmsException e) {
LOG.debug(e.getLocalizedMessage(), e);
return null;
}
CmsJspStandardContextBean contextBean = CmsJspStandardContextBean.getInstance(m_request);
String type = contextBean.getContainer().getType();
String width = contextBean.getContainer().getWidth();
int widthNum = -1;
try {
widthNum = Integer.parseInt(width);
} catch (NumberFormatException e) {
LOG.debug(e.getLocalizedMessage(), e);
}
return functionBean.getFormatForContainer(m_cms, type, widthNum);
} } | public class class_name {
private CmsDynamicFunctionBean.Format getFunctionFormat() {
CmsDynamicFunctionBean functionBean = null;
try {
CmsXmlContent content = CmsXmlContentFactory.unmarshal(m_cms, m_cms.readFile(m_element.getResource()));
CmsDynamicFunctionParser parser = new CmsDynamicFunctionParser();
functionBean = parser.parseFunctionBean(m_cms, content); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.debug(e.getLocalizedMessage(), e);
return null;
} // depends on control dependency: [catch], data = [none]
CmsJspStandardContextBean contextBean = CmsJspStandardContextBean.getInstance(m_request);
String type = contextBean.getContainer().getType();
String width = contextBean.getContainer().getWidth();
int widthNum = -1;
try {
widthNum = Integer.parseInt(width); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
LOG.debug(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
return functionBean.getFormatForContainer(m_cms, type, widthNum);
} } |
public class class_name {
public void forceTermination() {
// Only need to change root state
final Phaser root = this.root;
long s;
while ((s = root.state) >= 0) {
if (U.compareAndSwapLong(root, STATE, s, s | TERMINATION_BIT)) {
// signal all threads
releaseWaiters(0); // Waiters on evenQ
releaseWaiters(1); // Waiters on oddQ
return;
}
}
} } | public class class_name {
public void forceTermination() {
// Only need to change root state
final Phaser root = this.root;
long s;
while ((s = root.state) >= 0) {
if (U.compareAndSwapLong(root, STATE, s, s | TERMINATION_BIT)) {
// signal all threads
releaseWaiters(0); // Waiters on evenQ // depends on control dependency: [if], data = [none]
releaseWaiters(1); // Waiters on oddQ // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public SampleSummaryStatistics combine(final SampleSummaryStatistics other) {
if (other._parameterCount != _parameterCount) {
throw new IllegalArgumentException(format(
"Expected sample size of %d, but got %d.",
_parameterCount, other._parameterCount
));
}
for (int i = 0; i < _parameterCount; ++i) {
_moments.get(i).combine(other._moments.get(i));
_quantiles.get(i).combine(other._quantiles.get(i));
}
return this;
} } | public class class_name {
public SampleSummaryStatistics combine(final SampleSummaryStatistics other) {
if (other._parameterCount != _parameterCount) {
throw new IllegalArgumentException(format(
"Expected sample size of %d, but got %d.",
_parameterCount, other._parameterCount
));
}
for (int i = 0; i < _parameterCount; ++i) {
_moments.get(i).combine(other._moments.get(i)); // depends on control dependency: [for], data = [i]
_quantiles.get(i).combine(other._quantiles.get(i)); // depends on control dependency: [for], data = [i]
}
return this;
} } |
public class class_name {
private int detectJavaVersionNumber() {
String javaVersion = JAVA_VERSION;
final int lastDashNdx = javaVersion.lastIndexOf('-');
if (lastDashNdx != -1) {
javaVersion = javaVersion.substring(0, lastDashNdx);
}
if (javaVersion.startsWith("1.")) {
// up to java 8
final int index = javaVersion.indexOf('.', 2);
return Integer.parseInt(javaVersion.substring(2, index));
} else {
final int index = javaVersion.indexOf('.');
return Integer.parseInt(index == -1 ? javaVersion : javaVersion.substring(0, index));
}
} } | public class class_name {
private int detectJavaVersionNumber() {
String javaVersion = JAVA_VERSION;
final int lastDashNdx = javaVersion.lastIndexOf('-');
if (lastDashNdx != -1) {
javaVersion = javaVersion.substring(0, lastDashNdx); // depends on control dependency: [if], data = [none]
}
if (javaVersion.startsWith("1.")) {
// up to java 8
final int index = javaVersion.indexOf('.', 2);
return Integer.parseInt(javaVersion.substring(2, index)); // depends on control dependency: [if], data = [none]
} else {
final int index = javaVersion.indexOf('.');
return Integer.parseInt(index == -1 ? javaVersion : javaVersion.substring(0, index)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@GwtIncompatible("incompatible method")
private void reflectionAppend(
final Object lhs,
final Object rhs,
final Class<?> clazz) {
if (isRegistered(lhs, rhs)) {
return;
}
try {
register(lhs, rhs);
final Field[] fields = clazz.getDeclaredFields();
AccessibleObject.setAccessible(fields, true);
for (int i = 0; i < fields.length && isEquals; i++) {
final Field f = fields[i];
if (!ArrayUtils.contains(excludeFields, f.getName())
&& !f.getName().contains("$")
&& (testTransients || !Modifier.isTransient(f.getModifiers()))
&& !Modifier.isStatic(f.getModifiers())
&& !f.isAnnotationPresent(EqualsExclude.class)) {
try {
append(f.get(lhs), f.get(rhs));
} catch (final IllegalAccessException e) {
//this can't happen. Would get a Security exception instead
//throw a runtime exception in case the impossible happens.
throw new InternalError("Unexpected IllegalAccessException");
}
}
}
} finally {
unregister(lhs, rhs);
}
} } | public class class_name {
@GwtIncompatible("incompatible method")
private void reflectionAppend(
final Object lhs,
final Object rhs,
final Class<?> clazz) {
if (isRegistered(lhs, rhs)) {
return; // depends on control dependency: [if], data = [none]
}
try {
register(lhs, rhs); // depends on control dependency: [try], data = [none]
final Field[] fields = clazz.getDeclaredFields();
AccessibleObject.setAccessible(fields, true); // depends on control dependency: [try], data = [none]
for (int i = 0; i < fields.length && isEquals; i++) {
final Field f = fields[i];
if (!ArrayUtils.contains(excludeFields, f.getName())
&& !f.getName().contains("$")
&& (testTransients || !Modifier.isTransient(f.getModifiers()))
&& !Modifier.isStatic(f.getModifiers())
&& !f.isAnnotationPresent(EqualsExclude.class)) {
try {
append(f.get(lhs), f.get(rhs)); // depends on control dependency: [try], data = [none]
} catch (final IllegalAccessException e) {
//this can't happen. Would get a Security exception instead
//throw a runtime exception in case the impossible happens.
throw new InternalError("Unexpected IllegalAccessException");
} // depends on control dependency: [catch], data = [none]
}
}
} finally {
unregister(lhs, rhs);
}
} } |
public class class_name {
public static List<Thread> start(final Timer timer) {
if (!timer.isEnabled()) {
logger.info("当前服务器不启用定时器[" + timer.getClass().getSimpleName() + "]。");
return null;
}
int threadCount = timer.getThreadCount();
if (threadCount < 1) {
throw new IllegalArgumentException("定时器线程数不能小于1.");
}
List<Thread> threadList = new ArrayList<Thread>();
for (int i = 0; i < threadCount; i++) {
// 运行定时任务
String threadName = timer.getClass().getSimpleName() + "-" + i;
Thread thread = new Thread(threadName) {
@Override
public void run() {
TimerUtil.run(timer);
}
};
thread.start();
threadList.add(thread);
}
return threadList;
} } | public class class_name {
public static List<Thread> start(final Timer timer) {
if (!timer.isEnabled()) {
logger.info("当前服务器不启用定时器[" + timer.getClass().getSimpleName() + "]。");
// depends on control dependency: [if], data = [none]
return null;
// depends on control dependency: [if], data = [none]
}
int threadCount = timer.getThreadCount();
if (threadCount < 1) {
throw new IllegalArgumentException("定时器线程数不能小于1.");
}
List<Thread> threadList = new ArrayList<Thread>();
for (int i = 0; i < threadCount; i++) {
// 运行定时任务
String threadName = timer.getClass().getSimpleName() + "-" + i;
Thread thread = new Thread(threadName) {
@Override
public void run() {
TimerUtil.run(timer);
}
};
thread.start();
// depends on control dependency: [for], data = [none]
threadList.add(thread);
// depends on control dependency: [for], data = [none]
}
return threadList;
} } |
public class class_name {
private static void initBareJidAndDeviceId(OmemoManager manager) {
if (!manager.getConnection().isAuthenticated()) {
throw new IllegalStateException("Connection MUST be authenticated.");
}
if (manager.ownJid == null) {
manager.ownJid = manager.getConnection().getUser().asBareJid();
}
if (UNKNOWN_DEVICE_ID.equals(manager.deviceId)) {
SortedSet<Integer> storedDeviceIds = manager.getOmemoService().getOmemoStoreBackend().localDeviceIdsOf(manager.ownJid);
if (storedDeviceIds.size() > 0) {
manager.setDeviceId(storedDeviceIds.first());
} else {
manager.setDeviceId(randomDeviceId());
}
}
} } | public class class_name {
private static void initBareJidAndDeviceId(OmemoManager manager) {
if (!manager.getConnection().isAuthenticated()) {
throw new IllegalStateException("Connection MUST be authenticated.");
}
if (manager.ownJid == null) {
manager.ownJid = manager.getConnection().getUser().asBareJid(); // depends on control dependency: [if], data = [none]
}
if (UNKNOWN_DEVICE_ID.equals(manager.deviceId)) {
SortedSet<Integer> storedDeviceIds = manager.getOmemoService().getOmemoStoreBackend().localDeviceIdsOf(manager.ownJid);
if (storedDeviceIds.size() > 0) {
manager.setDeviceId(storedDeviceIds.first()); // depends on control dependency: [if], data = [none]
} else {
manager.setDeviceId(randomDeviceId()); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@Override
public IS13SessionData getAppSessionData(Class<? extends AppSession> clazz, String sessionId) {
if (clazz.equals(ClientS13Session.class)) {
ClientS13SessionDataReplicatedImpl data =
new ClientS13SessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer());
return data;
}
else if (clazz.equals(ServerS13Session.class)) {
ServerS13SessionDataReplicatedImpl data =
new ServerS13SessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer());
return data;
}
throw new IllegalArgumentException();
} } | public class class_name {
@Override
public IS13SessionData getAppSessionData(Class<? extends AppSession> clazz, String sessionId) {
if (clazz.equals(ClientS13Session.class)) {
ClientS13SessionDataReplicatedImpl data =
new ClientS13SessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer());
return data; // depends on control dependency: [if], data = [none]
}
else if (clazz.equals(ServerS13Session.class)) {
ServerS13SessionDataReplicatedImpl data =
new ServerS13SessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer());
return data; // depends on control dependency: [if], data = [none]
}
throw new IllegalArgumentException();
} } |
public class class_name {
private boolean updateSVScalar(String currentValue) {
String newValue = m_dbObj.getFieldValue(m_fieldName);
boolean bUpdated = false;
if (Utils.isEmpty(newValue)) {
if (!Utils.isEmpty(currentValue)) {
m_dbTran.deleteScalarValueColumn(m_tableDef, m_dbObj.getObjectID(), m_fieldName);
unindexTerms(currentValue);
bUpdated = true;
}
} else if (!newValue.equals(currentValue)) {
updateScalarReplaceValue(currentValue, newValue);
bUpdated = true;
}
return bUpdated;
} } | public class class_name {
private boolean updateSVScalar(String currentValue) {
String newValue = m_dbObj.getFieldValue(m_fieldName);
boolean bUpdated = false;
if (Utils.isEmpty(newValue)) {
if (!Utils.isEmpty(currentValue)) {
m_dbTran.deleteScalarValueColumn(m_tableDef, m_dbObj.getObjectID(), m_fieldName);
// depends on control dependency: [if], data = [none]
unindexTerms(currentValue);
// depends on control dependency: [if], data = [none]
bUpdated = true;
// depends on control dependency: [if], data = [none]
}
} else if (!newValue.equals(currentValue)) {
updateScalarReplaceValue(currentValue, newValue);
// depends on control dependency: [if], data = [none]
bUpdated = true;
// depends on control dependency: [if], data = [none]
}
return bUpdated;
} } |
public class class_name {
@Override
public void loadFromProperties(Properties props) {
String strValue = props.getProperty(container.getSimpleName() + "." + name);
if (strValue == null)
return;
try {
double doubleValue = Double.parseDouble(strValue);
set(doubleValue);
} catch (NumberFormatException nfe) {
}
} } | public class class_name {
@Override
public void loadFromProperties(Properties props) {
String strValue = props.getProperty(container.getSimpleName() + "." + name);
if (strValue == null)
return;
try {
double doubleValue = Double.parseDouble(strValue);
set(doubleValue); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException nfe) {
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void close() throws VoldemortException {
logger.debug("Close called for read-only store.");
this.fileModificationLock.writeLock().lock();
try {
if(isOpen) {
this.isOpen = false;
fileSet.close();
} else {
logger.debug("Attempt to close already closed store " + getName());
}
} finally {
this.fileModificationLock.writeLock().unlock();
}
} } | public class class_name {
@Override
public void close() throws VoldemortException {
logger.debug("Close called for read-only store.");
this.fileModificationLock.writeLock().lock();
try {
if(isOpen) {
this.isOpen = false; // depends on control dependency: [if], data = [none]
fileSet.close(); // depends on control dependency: [if], data = [none]
} else {
logger.debug("Attempt to close already closed store " + getName()); // depends on control dependency: [if], data = [none]
}
} finally {
this.fileModificationLock.writeLock().unlock();
}
} } |
public class class_name {
public Observable<ServiceResponse<List<RecommendedActionInner>>> listByDatabaseAdvisorWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (serverName == null) {
throw new IllegalArgumentException("Parameter serverName is required and cannot be null.");
}
if (databaseName == null) {
throw new IllegalArgumentException("Parameter databaseName is required and cannot be null.");
}
if (advisorName == null) {
throw new IllegalArgumentException("Parameter advisorName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listByDatabaseAdvisor(resourceGroupName, serverName, databaseName, advisorName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<RecommendedActionInner>>>>() {
@Override
public Observable<ServiceResponse<List<RecommendedActionInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<List<RecommendedActionInner>> clientResponse = listByDatabaseAdvisorDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<List<RecommendedActionInner>>> listByDatabaseAdvisorWithServiceResponseAsync(String resourceGroupName, String serverName, String databaseName, String advisorName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (serverName == null) {
throw new IllegalArgumentException("Parameter serverName is required and cannot be null.");
}
if (databaseName == null) {
throw new IllegalArgumentException("Parameter databaseName is required and cannot be null.");
}
if (advisorName == null) {
throw new IllegalArgumentException("Parameter advisorName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
return service.listByDatabaseAdvisor(resourceGroupName, serverName, databaseName, advisorName, this.client.subscriptionId(), this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<RecommendedActionInner>>>>() {
@Override
public Observable<ServiceResponse<List<RecommendedActionInner>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<List<RecommendedActionInner>> clientResponse = listByDatabaseAdvisorDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public Field updateFieldDecimalSpinner(
Field formFieldParam,
double minParam,
double maxParam,
double stepFactorParam,
String prefixParam)
{
if(formFieldParam != null && this.serviceTicket != null)
{
formFieldParam.setServiceTicket(this.serviceTicket);
}
if(formFieldParam != null)
{
formFieldParam.setTypeAsEnum(Field.Type.Decimal);
formFieldParam.setTypeMetaData(
this.getMetaDataForDecimalAs(
FieldMetaData.Decimal.SPINNER,
minParam,maxParam, stepFactorParam, prefixParam));
}
return new Field(this.postJson(
formFieldParam, WS.Path.FormField.Version1.formFieldUpdate()));
} } | public class class_name {
public Field updateFieldDecimalSpinner(
Field formFieldParam,
double minParam,
double maxParam,
double stepFactorParam,
String prefixParam)
{
if(formFieldParam != null && this.serviceTicket != null)
{
formFieldParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none]
}
if(formFieldParam != null)
{
formFieldParam.setTypeAsEnum(Field.Type.Decimal); // depends on control dependency: [if], data = [none]
formFieldParam.setTypeMetaData(
this.getMetaDataForDecimalAs(
FieldMetaData.Decimal.SPINNER,
minParam,maxParam, stepFactorParam, prefixParam)); // depends on control dependency: [if], data = [none]
}
return new Field(this.postJson(
formFieldParam, WS.Path.FormField.Version1.formFieldUpdate()));
} } |
public class class_name {
protected Object getSingleExcelRow(Object userObj, String key, boolean isExternalCall) {
logger.entering(new Object[] { userObj, key, isExternalCall });
Class<?> cls;
try {
cls = Class.forName(userObj.getClass().getName());
} catch (ClassNotFoundException e) {
throw new DataProviderException("Unable to find class of type + '" + userObj.getClass().getName() + "'", e);
}
int rowIndex = excelReader.getRowIndex(cls.getSimpleName(), key);
if (rowIndex == -1) {
throw new DataProviderException("Row with key '" + key + "' is not found");
}
Object object = getSingleExcelRow(userObj, rowIndex, isExternalCall);
logger.exiting(object);
return object;
} } | public class class_name {
protected Object getSingleExcelRow(Object userObj, String key, boolean isExternalCall) {
logger.entering(new Object[] { userObj, key, isExternalCall });
Class<?> cls;
try {
cls = Class.forName(userObj.getClass().getName()); // depends on control dependency: [try], data = [none]
} catch (ClassNotFoundException e) {
throw new DataProviderException("Unable to find class of type + '" + userObj.getClass().getName() + "'", e);
} // depends on control dependency: [catch], data = [none]
int rowIndex = excelReader.getRowIndex(cls.getSimpleName(), key);
if (rowIndex == -1) {
throw new DataProviderException("Row with key '" + key + "' is not found");
}
Object object = getSingleExcelRow(userObj, rowIndex, isExternalCall);
logger.exiting(object);
return object;
} } |
public class class_name {
@Override
protected void processAnnotations(Set<WebXml> fragments, boolean handlesTypesOnly, Map<String, JavaClassCacheEntry> javaClassCache) {
if (isAnnotationHandlingDetect()) {
super.processAnnotations(fragments, handlesTypesOnly, javaClassCache);
}
} } | public class class_name {
@Override
protected void processAnnotations(Set<WebXml> fragments, boolean handlesTypesOnly, Map<String, JavaClassCacheEntry> javaClassCache) {
if (isAnnotationHandlingDetect()) {
super.processAnnotations(fragments, handlesTypesOnly, javaClassCache); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<SDVariable> diff(List<SDVariable> i_v1) {
List<SDVariable> vals = doDiff(i_v1);
if(vals == null){
throw new IllegalStateException("Error executing diff operation: doDiff returned null for op: " + this.opName());
}
val outputVars = args();
for(int i = 0; i < vals.size(); i++) {
SDVariable var = outputVars[i];
SDVariable grad = var.getGradient();
if(grad != null) {
SDVariable gradVar = f().add(grad, vals.get(i));
try {
vals.set(i, gradVar);
} catch (UnsupportedOperationException e){
throw new UnsupportedOperationException("Use a mutable list when returning values from "+this.getClass().getSimpleName()+".doDiff (e.g. Arrays.asList instead of Collections.singletonList)", e);
}
sameDiff.setGradientForVariableName(var.getVarName(), gradVar);
} else {
SDVariable gradVar = vals.get(i);
sameDiff.updateVariableNameAndReference(gradVar,var.getVarName() + "-grad");
sameDiff.setGradientForVariableName(var.getVarName(), gradVar);
sameDiff.setForwardVariableForVarName(gradVar.getVarName(),var);
}
}
return vals;
} } | public class class_name {
public List<SDVariable> diff(List<SDVariable> i_v1) {
List<SDVariable> vals = doDiff(i_v1);
if(vals == null){
throw new IllegalStateException("Error executing diff operation: doDiff returned null for op: " + this.opName());
}
val outputVars = args();
for(int i = 0; i < vals.size(); i++) {
SDVariable var = outputVars[i];
SDVariable grad = var.getGradient();
if(grad != null) {
SDVariable gradVar = f().add(grad, vals.get(i));
try {
vals.set(i, gradVar); // depends on control dependency: [try], data = [none]
} catch (UnsupportedOperationException e){
throw new UnsupportedOperationException("Use a mutable list when returning values from "+this.getClass().getSimpleName()+".doDiff (e.g. Arrays.asList instead of Collections.singletonList)", e);
} // depends on control dependency: [catch], data = [none]
sameDiff.setGradientForVariableName(var.getVarName(), gradVar); // depends on control dependency: [if], data = [none]
} else {
SDVariable gradVar = vals.get(i);
sameDiff.updateVariableNameAndReference(gradVar,var.getVarName() + "-grad"); // depends on control dependency: [if], data = [(grad]
sameDiff.setGradientForVariableName(var.getVarName(), gradVar); // depends on control dependency: [if], data = [none]
sameDiff.setForwardVariableForVarName(gradVar.getVarName(),var); // depends on control dependency: [if], data = [(grad]
}
}
return vals;
} } |
public class class_name {
public Collection<String> getLocalPlacements() {
List<String> placements = Lists.newArrayList();
for (String placementName : _placementFactory.getValidPlacements()) {
Placement placement;
try {
placement = get(placementName);
} catch (UnknownPlacementException e) {
continue; // Placement must live in another data center.
}
placements.add(placement.getName());
}
return placements;
} } | public class class_name {
public Collection<String> getLocalPlacements() {
List<String> placements = Lists.newArrayList();
for (String placementName : _placementFactory.getValidPlacements()) {
Placement placement;
try {
placement = get(placementName); // depends on control dependency: [try], data = [none]
} catch (UnknownPlacementException e) {
continue; // Placement must live in another data center.
} // depends on control dependency: [catch], data = [none]
placements.add(placement.getName()); // depends on control dependency: [for], data = [none]
}
return placements;
} } |
public class class_name {
public void setWorkflowState(java.util.Collection<StringFilter> workflowState) {
if (workflowState == null) {
this.workflowState = null;
return;
}
this.workflowState = new java.util.ArrayList<StringFilter>(workflowState);
} } | public class class_name {
public void setWorkflowState(java.util.Collection<StringFilter> workflowState) {
if (workflowState == null) {
this.workflowState = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.workflowState = new java.util.ArrayList<StringFilter>(workflowState);
} } |
public class class_name {
final Node<K,V> find(int h, Object k) {
if (k != null) {
for (Node<K,V> e = first; e != null; ) {
int s; K ek;
if (((s = lockState) & (WAITER|WRITER)) != 0) {
if (e.hash == h &&
((ek = e.key) == k || (ek != null && k.equals(ek))))
return e;
e = e.next;
}
else if (U.compareAndSwapInt(this, LOCKSTATE, s,
s + READER)) {
TreeNode<K,V> r, p;
try {
p = ((r = root) == null ? null :
r.findTreeNode(h, k, null));
} finally {
Thread w;
if (U.getAndAddInt(this, LOCKSTATE, -READER) ==
(READER|WAITER) && (w = waiter) != null)
LockSupport.unpark(w);
}
return p;
}
}
}
return null;
} } | public class class_name {
final Node<K,V> find(int h, Object k) {
if (k != null) {
for (Node<K,V> e = first; e != null; ) {
int s; K ek;
if (((s = lockState) & (WAITER|WRITER)) != 0) {
if (e.hash == h &&
((ek = e.key) == k || (ek != null && k.equals(ek))))
return e;
e = e.next; // depends on control dependency: [if], data = [none]
}
else if (U.compareAndSwapInt(this, LOCKSTATE, s,
s + READER)) {
TreeNode<K,V> r, p;
try {
p = ((r = root) == null ? null :
r.findTreeNode(h, k, null)); // depends on control dependency: [try], data = [none]
} finally {
Thread w;
if (U.getAndAddInt(this, LOCKSTATE, -READER) ==
(READER|WAITER) && (w = waiter) != null)
LockSupport.unpark(w);
}
return p; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
public PlainChangesLog pushLog(QPath rootPath)
{
// session instance is always present in SessionChangesLog
PlainChangesLog cLog = new PlainChangesLogImpl(getDescendantsChanges(rootPath), session);
if (rootPath.equals(Constants.ROOT_PATH))
{
clear();
}
else
{
remove(rootPath);
}
return cLog;
} } | public class class_name {
public PlainChangesLog pushLog(QPath rootPath)
{
// session instance is always present in SessionChangesLog
PlainChangesLog cLog = new PlainChangesLogImpl(getDescendantsChanges(rootPath), session);
if (rootPath.equals(Constants.ROOT_PATH))
{
clear(); // depends on control dependency: [if], data = [none]
}
else
{
remove(rootPath); // depends on control dependency: [if], data = [none]
}
return cLog;
} } |
public class class_name {
public EEnum getIfcBuildingElementProxyTypeEnum() {
if (ifcBuildingElementProxyTypeEnumEEnum == null) {
ifcBuildingElementProxyTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(788);
}
return ifcBuildingElementProxyTypeEnumEEnum;
} } | public class class_name {
public EEnum getIfcBuildingElementProxyTypeEnum() {
if (ifcBuildingElementProxyTypeEnumEEnum == null) {
ifcBuildingElementProxyTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE
.getEPackage(Ifc2x3tc1Package.eNS_URI).getEClassifiers().get(788);
// depends on control dependency: [if], data = [none]
}
return ifcBuildingElementProxyTypeEnumEEnum;
} } |
public class class_name {
protected int decodeMandatoryParameters(ISUPParameterFactory parameterFactory, byte[] b, int index)
throws ParameterException {
int localIndex = index;
index += super.decodeMandatoryParameters(parameterFactory, b, index);
if (b.length - index > 5) {
try {
byte[] natureOfConnectionIndicators = new byte[1];
natureOfConnectionIndicators[0] = b[index++];
NatureOfConnectionIndicators _nai = parameterFactory.createNatureOfConnectionIndicators();
((AbstractISUPParameter) _nai).decode(natureOfConnectionIndicators);
this.setNatureOfConnectionIndicators(_nai);
} catch (Exception e) {
// AIOOBE or IllegalArg
throw new ParameterException("Failed to parse NatureOfConnectionIndicators due to: ", e);
}
try {
byte[] body = new byte[2];
body[0] = b[index++];
body[1] = b[index++];
ForwardCallIndicators v = parameterFactory.createForwardCallIndicators();
((AbstractISUPParameter) v).decode(body);
this.setForwardCallIndicators(v);
} catch (Exception e) {
// AIOOBE or IllegalArg
throw new ParameterException("Failed to parse ForwardCallIndicators due to: ", e);
}
try {
byte[] body = new byte[1];
body[0] = b[index++];
CallingPartyCategory v = parameterFactory.createCallingPartyCategory();
((AbstractISUPParameter) v).decode(body);
this.setCallingPartCategory(v);
} catch (Exception e) {
// AIOOBE or IllegalArg
throw new ParameterException("Failed to parse CallingPartyCategory due to: ", e);
}
try {
byte[] body = new byte[1];
body[0] = b[index++];
TransmissionMediumRequirement v = parameterFactory.createTransmissionMediumRequirement();
((AbstractISUPParameter) v).decode(body);
this.setTransmissionMediumRequirement(v);
} catch (Exception e) {
// AIOOBE or IllegalArg
throw new ParameterException("Failed to parse TransmissionMediumRequirement due to: ", e);
}
return index - localIndex;
} else {
throw new ParameterException("byte[] must have atleast eight octets");
}
} } | public class class_name {
protected int decodeMandatoryParameters(ISUPParameterFactory parameterFactory, byte[] b, int index)
throws ParameterException {
int localIndex = index;
index += super.decodeMandatoryParameters(parameterFactory, b, index);
if (b.length - index > 5) {
try {
byte[] natureOfConnectionIndicators = new byte[1];
natureOfConnectionIndicators[0] = b[index++]; // depends on control dependency: [try], data = [none]
NatureOfConnectionIndicators _nai = parameterFactory.createNatureOfConnectionIndicators();
((AbstractISUPParameter) _nai).decode(natureOfConnectionIndicators); // depends on control dependency: [try], data = [none]
this.setNatureOfConnectionIndicators(_nai); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// AIOOBE or IllegalArg
throw new ParameterException("Failed to parse NatureOfConnectionIndicators due to: ", e);
} // depends on control dependency: [catch], data = [none]
try {
byte[] body = new byte[2];
body[0] = b[index++]; // depends on control dependency: [try], data = [none]
body[1] = b[index++]; // depends on control dependency: [try], data = [none]
ForwardCallIndicators v = parameterFactory.createForwardCallIndicators();
((AbstractISUPParameter) v).decode(body); // depends on control dependency: [try], data = [none]
this.setForwardCallIndicators(v); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// AIOOBE or IllegalArg
throw new ParameterException("Failed to parse ForwardCallIndicators due to: ", e);
} // depends on control dependency: [catch], data = [none]
try {
byte[] body = new byte[1];
body[0] = b[index++]; // depends on control dependency: [try], data = [none]
CallingPartyCategory v = parameterFactory.createCallingPartyCategory();
((AbstractISUPParameter) v).decode(body); // depends on control dependency: [try], data = [none]
this.setCallingPartCategory(v); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// AIOOBE or IllegalArg
throw new ParameterException("Failed to parse CallingPartyCategory due to: ", e);
} // depends on control dependency: [catch], data = [none]
try {
byte[] body = new byte[1];
body[0] = b[index++]; // depends on control dependency: [try], data = [none]
TransmissionMediumRequirement v = parameterFactory.createTransmissionMediumRequirement();
((AbstractISUPParameter) v).decode(body); // depends on control dependency: [try], data = [none]
this.setTransmissionMediumRequirement(v); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// AIOOBE or IllegalArg
throw new ParameterException("Failed to parse TransmissionMediumRequirement due to: ", e);
} // depends on control dependency: [catch], data = [none]
return index - localIndex;
} else {
throw new ParameterException("byte[] must have atleast eight octets");
}
} } |
public class class_name {
@Override
public AbstractQPart appendSQL(final SQLSelect _sql)
{
if (this.ignoreCase) {
_sql.addPart(SQLPart.UPPER).addPart(SQLPart.PARENTHESIS_OPEN);
}
_sql.addColumnPart(this.tableIndex, this.attribute.getSqlColNames().get(0));
if (this.ignoreCase) {
_sql.addPart(SQLPart.PARENTHESIS_CLOSE);
}
return this;
} } | public class class_name {
@Override
public AbstractQPart appendSQL(final SQLSelect _sql)
{
if (this.ignoreCase) {
_sql.addPart(SQLPart.UPPER).addPart(SQLPart.PARENTHESIS_OPEN); // depends on control dependency: [if], data = [none]
}
_sql.addColumnPart(this.tableIndex, this.attribute.getSqlColNames().get(0));
if (this.ignoreCase) {
_sql.addPart(SQLPart.PARENTHESIS_CLOSE); // depends on control dependency: [if], data = [none]
}
return this;
} } |
public class class_name {
@Override
public void addDocument(@NotNull Document document) {
if (documentsCache != null && rankingAlgorithm != null && documentIndexCache != null) {
Set<FacetRank> facetRanks = rankingAlgorithm.calculate(buildFacets(document));
documentsCache.put(document.getId(), document);
documentIndexCache.put(document.getId(), new DocumentIndex(document, facetRanks));
}
} } | public class class_name {
@Override
public void addDocument(@NotNull Document document) {
if (documentsCache != null && rankingAlgorithm != null && documentIndexCache != null) {
Set<FacetRank> facetRanks = rankingAlgorithm.calculate(buildFacets(document));
documentsCache.put(document.getId(), document); // depends on control dependency: [if], data = [none]
documentIndexCache.put(document.getId(), new DocumentIndex(document, facetRanks)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static void setResizeWeight(JSplitPane pane, double weight) {
try {
Method m = JSplitPane.class.getMethod("setResizeWeight",
new Class[]{double.class});
m.invoke(pane, new Object[]{new Double(weight)});
} catch (NoSuchMethodException exc) {
} catch (IllegalAccessException exc) {
} catch (java.lang.reflect.InvocationTargetException exc) {
}
} } | public class class_name {
static void setResizeWeight(JSplitPane pane, double weight) {
try {
Method m = JSplitPane.class.getMethod("setResizeWeight",
new Class[]{double.class});
m.invoke(pane, new Object[]{new Double(weight)}); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException exc) {
} catch (IllegalAccessException exc) { // depends on control dependency: [catch], data = [none]
} catch (java.lang.reflect.InvocationTargetException exc) { // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public EClass getIfcResourceConstraintRelationship() {
if (ifcResourceConstraintRelationshipEClass == null) {
ifcResourceConstraintRelationshipEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc4Package.eNS_URI).getEClassifiers().get(572);
}
return ifcResourceConstraintRelationshipEClass;
} } | public class class_name {
@Override
public EClass getIfcResourceConstraintRelationship() {
if (ifcResourceConstraintRelationshipEClass == null) {
ifcResourceConstraintRelationshipEClass = (EClass) EPackage.Registry.INSTANCE
.getEPackage(Ifc4Package.eNS_URI).getEClassifiers().get(572);
// depends on control dependency: [if], data = [none]
}
return ifcResourceConstraintRelationshipEClass;
} } |
public class class_name {
private static String dumpArrayString(Object[] arguments) {
StringBuilder argBuf = new StringBuilder("[");
for (int i = 0; i < arguments.length; i++) {
if (i > 0) {
argBuf.append(", ");
}
argBuf.append(DefaultGroovyMethods.dump(arguments[i]));
}
argBuf.append("]");
return argBuf.toString();
} } | public class class_name {
private static String dumpArrayString(Object[] arguments) {
StringBuilder argBuf = new StringBuilder("[");
for (int i = 0; i < arguments.length; i++) {
if (i > 0) {
argBuf.append(", "); // depends on control dependency: [if], data = [none]
}
argBuf.append(DefaultGroovyMethods.dump(arguments[i])); // depends on control dependency: [for], data = [i]
}
argBuf.append("]");
return argBuf.toString();
} } |
public class class_name {
private Throwable mapException(EJSDeployedSupport s, RemoteException ex) //d135584
{
try
{
if (ex instanceof CSIException) {
CSIException csiex = (CSIException) ex;
return mapCSIException(s, csiex);
}
else if (ex.detail instanceof CSIException)
{
CSIException csiex = (CSIException) ex.detail; //d177787
return mapCSIException(s, csiex);
}
else if (ex instanceof CreateFailureException)
{
// For consistency, just map/return the CreateFailureException
// even if it contains an EJBException, as in most cases the
// EJBException would just be wrapped in a plain RemoteException,
// which CreateFailureException already is. d187050
// Since this is already a RemoteException, it only needs to be
// "mapped" if the method request is throught the ORB. d228774
if (!s.ivWrapper.ivInterface.ivORB)
{
return ex;
}
return getOrbUtils().mapException(ex);
}
else if (ex instanceof BeanNotReentrantException &&
(s.ivWrapper.ivInterface == BUSINESS_RMI_REMOTE ||
s.ivWrapper.ivInterface == SERVICE_ENDPOINT)) // d350987
{
// EJB 3.0 has defined an exception for this purpose. d366807.6
// This mapping is only done for business interfaces to insure
// compatibility with EJB 2.1 clients. 396839
BeanNotReentrantException bnre = (BeanNotReentrantException) ex;
EJBException caex = bnre.isTimeout() ? new ConcurrentAccessTimeoutException(ex.getMessage()) // d653777.1
: new ConcurrentAccessException(ex.getMessage());
caex.setStackTrace(ex.getStackTrace());
s.rootEx = caex;
return mapEJBException(s, caex);
}
else if (ex.detail instanceof EJBException)
{
EJBException ejbex = (EJBException) ex.detail;
return mapEJBException(s, ejbex);
}
else
{
// Since this is already a RemoteException, it only needs to be
// "mapped" if the method request is throught the ORB. d228774
if (!s.ivWrapper.ivInterface.ivORB)
{
return ex;
}
return getOrbUtils().mapException(ex);
}
} catch (CSIException e)
{
FFDCFilter.processException(e, CLASS_NAME + ".mapException", "119", this);
Tr.warning(tc, "UNABLE_TO_MAP_EXCEPTION_CNTR0013W"
, new Object[] { ex, e }); //p111002.5
return ex;
}
} } | public class class_name {
private Throwable mapException(EJSDeployedSupport s, RemoteException ex) //d135584
{
try
{
if (ex instanceof CSIException) {
CSIException csiex = (CSIException) ex;
return mapCSIException(s, csiex); // depends on control dependency: [if], data = [none]
}
else if (ex.detail instanceof CSIException)
{
CSIException csiex = (CSIException) ex.detail; //d177787
return mapCSIException(s, csiex); // depends on control dependency: [if], data = [none]
}
else if (ex instanceof CreateFailureException)
{
// For consistency, just map/return the CreateFailureException
// even if it contains an EJBException, as in most cases the
// EJBException would just be wrapped in a plain RemoteException,
// which CreateFailureException already is. d187050
// Since this is already a RemoteException, it only needs to be
// "mapped" if the method request is throught the ORB. d228774
if (!s.ivWrapper.ivInterface.ivORB)
{
return ex; // depends on control dependency: [if], data = [none]
}
return getOrbUtils().mapException(ex); // depends on control dependency: [if], data = [none]
}
else if (ex instanceof BeanNotReentrantException &&
(s.ivWrapper.ivInterface == BUSINESS_RMI_REMOTE ||
s.ivWrapper.ivInterface == SERVICE_ENDPOINT)) // d350987
{
// EJB 3.0 has defined an exception for this purpose. d366807.6
// This mapping is only done for business interfaces to insure
// compatibility with EJB 2.1 clients. 396839
BeanNotReentrantException bnre = (BeanNotReentrantException) ex;
EJBException caex = bnre.isTimeout() ? new ConcurrentAccessTimeoutException(ex.getMessage()) // d653777.1
: new ConcurrentAccessException(ex.getMessage());
caex.setStackTrace(ex.getStackTrace()); // depends on control dependency: [if], data = [none]
s.rootEx = caex; // depends on control dependency: [if], data = [none]
return mapEJBException(s, caex); // depends on control dependency: [if], data = [none]
}
else if (ex.detail instanceof EJBException)
{
EJBException ejbex = (EJBException) ex.detail;
return mapEJBException(s, ejbex); // depends on control dependency: [if], data = [none]
}
else
{
// Since this is already a RemoteException, it only needs to be
// "mapped" if the method request is throught the ORB. d228774
if (!s.ivWrapper.ivInterface.ivORB)
{
return ex; // depends on control dependency: [if], data = [none]
}
return getOrbUtils().mapException(ex); // depends on control dependency: [if], data = [none]
}
} catch (CSIException e)
{
FFDCFilter.processException(e, CLASS_NAME + ".mapException", "119", this);
Tr.warning(tc, "UNABLE_TO_MAP_EXCEPTION_CNTR0013W"
, new Object[] { ex, e }); //p111002.5
return ex;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean isTriggeringEvent(LoggingEvent event) {
//
// in the abnormal case of no contained filters
// always return true to avoid each logging event
// from having its own file.
if (headFilter == null) {
return false;
}
//
// otherwise loop through the filters
//
for (Filter f = headFilter; f != null; f = f.next) {
switch (f.decide(event)) {
case Filter.DENY:
return false;
case Filter.ACCEPT:
return true;
}
}
return true;
} } | public class class_name {
public boolean isTriggeringEvent(LoggingEvent event) {
//
// in the abnormal case of no contained filters
// always return true to avoid each logging event
// from having its own file.
if (headFilter == null) {
return false; // depends on control dependency: [if], data = [none]
}
//
// otherwise loop through the filters
//
for (Filter f = headFilter; f != null; f = f.next) {
switch (f.decide(event)) {
case Filter.DENY:
return false;
case Filter.ACCEPT:
return true;
}
}
return true;
} } |
public class class_name {
public void onReceivedPesponse(ResponseHeader header, Response response){
Packet packet = null;
updateRecv();
if (header.getXid() == -4) {
// -4 is the xid for AuthPacket
if(ErrorCode.AUTHENT_FAILED.equals(header.getErr())) {
if(getStatus().isAlive()){
setStatus(ConnectionStatus.AUTH_FAILED);
}
}
LOGGER.info("Got auth sessionid:0x" + session.id + ", error=" + header.getErr());
return;
}
if (header.getXid() == -1) {
// -1 means watcher notification
WatcherEvent event = (WatcherEvent) response;
if(LOGGER.isTraceEnabled()){
LOGGER.trace("Got Watcher " + event + " for sessionid 0x" + session.id);
}
eventThread.queueWatcherEvent( event );
return;
}
if (header.getXid() == -8) {
// -8 means server notification
ServerEvent event = (ServerEvent) response;
if(response instanceof CloseSessionEvent){
closeSession();
return;
}
if(LOGGER.isTraceEnabled()){
LOGGER.trace("Got Server " + event + " for sessionid 0x" + session.id);
}
eventThread.queueServerEvent( event );
return;
}
if (header.getXid() == -2) {
// -2 is the xid for pings
if(LOGGER.isTraceEnabled()){
LOGGER.info("Got ping response for sessionid: 0x" + session.id
+ " after " + (System.currentTimeMillis() - lastPingSentNs) + "ms");
}
pingResponse.set(header);
synchronized(pingResponse){
pingResponse.notifyAll();
}
return;
}
synchronized(pendingQueue){
// the XID out of order, we don't close session here.
// it doesn't mean the data integrate has problem.
if(pendingQueue.isEmpty()){
LOGGER.warn("The request queue is empty, but get packet xid=" + header.getXid());
// we don't close session here.
return;
}
int recvXid = header.getXid();
packet = pendingQueue.remove();
if (packet.protoHeader.getXid() != recvXid) {
if(LOGGER.isDebugEnabled()){
LOGGER.debug("Packet xid out of order, type=" + packet.protoHeader.getType()
+ ", queuedXid=" + packet.protoHeader.getXid() + ", xid=" + header.getXid());
}
// trim the pendingQueue to the received packet.
if(packet.protoHeader.getXid() > recvXid){
LOGGER.error("Packet xid out of order, drop the received packet, xid=" + header.getXid());
pendingQueue.addLast(packet);
packet = null;
} else {
while(packet.protoHeader.getXid() != recvXid){
LOGGER.error("Packet xid out of order, drop the queued packet, type=" + packet.protoHeader.getType()
+ ", queuedXid=" + packet.protoHeader.getXid());
packet.respHeader.setErr(ErrorCode.CONNECTION_LOSS);
finishPacket(packet);
if(! pendingQueue.isEmpty()){
packet = pendingQueue.remove();
} else {
return ;
}
}
}
}
}
PacketLatency.receivePacket(packet);
packet.respHeader.setXid(header.getXid());
packet.respHeader.setErr(header.getErr());
packet.respHeader.setDxid(header.getDxid());
if (header.getDxid() > 0) {
lastDxid = header.getDxid();
}
if (ErrorCode.OK.equals(header.getErr())) {
packet.response = response;
}
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Reading reply sessionid:0x"
+ session.id + ", packet=" + packet);
}
finishPacket(packet);
} } | public class class_name {
public void onReceivedPesponse(ResponseHeader header, Response response){
Packet packet = null;
updateRecv();
if (header.getXid() == -4) {
// -4 is the xid for AuthPacket
if(ErrorCode.AUTHENT_FAILED.equals(header.getErr())) {
if(getStatus().isAlive()){
setStatus(ConnectionStatus.AUTH_FAILED); // depends on control dependency: [if], data = [none]
}
}
LOGGER.info("Got auth sessionid:0x" + session.id + ", error=" + header.getErr()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (header.getXid() == -1) {
// -1 means watcher notification
WatcherEvent event = (WatcherEvent) response;
if(LOGGER.isTraceEnabled()){
LOGGER.trace("Got Watcher " + event + " for sessionid 0x" + session.id); // depends on control dependency: [if], data = [none]
}
eventThread.queueWatcherEvent( event ); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (header.getXid() == -8) {
// -8 means server notification
ServerEvent event = (ServerEvent) response;
if(response instanceof CloseSessionEvent){
closeSession(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if(LOGGER.isTraceEnabled()){
LOGGER.trace("Got Server " + event + " for sessionid 0x" + session.id); // depends on control dependency: [if], data = [none]
}
eventThread.queueServerEvent( event ); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (header.getXid() == -2) {
// -2 is the xid for pings
if(LOGGER.isTraceEnabled()){
LOGGER.info("Got ping response for sessionid: 0x" + session.id
+ " after " + (System.currentTimeMillis() - lastPingSentNs) + "ms"); // depends on control dependency: [if], data = [none]
}
pingResponse.set(header); // depends on control dependency: [if], data = [none]
synchronized(pingResponse){ // depends on control dependency: [if], data = [none]
pingResponse.notifyAll();
}
return; // depends on control dependency: [if], data = [none]
}
synchronized(pendingQueue){
// the XID out of order, we don't close session here.
// it doesn't mean the data integrate has problem.
if(pendingQueue.isEmpty()){
LOGGER.warn("The request queue is empty, but get packet xid=" + header.getXid()); // depends on control dependency: [if], data = [none]
// we don't close session here.
return; // depends on control dependency: [if], data = [none]
}
int recvXid = header.getXid();
packet = pendingQueue.remove();
if (packet.protoHeader.getXid() != recvXid) {
if(LOGGER.isDebugEnabled()){
LOGGER.debug("Packet xid out of order, type=" + packet.protoHeader.getType()
+ ", queuedXid=" + packet.protoHeader.getXid() + ", xid=" + header.getXid()); // depends on control dependency: [if], data = [none]
}
// trim the pendingQueue to the received packet.
if(packet.protoHeader.getXid() > recvXid){
LOGGER.error("Packet xid out of order, drop the received packet, xid=" + header.getXid()); // depends on control dependency: [if], data = [none]
pendingQueue.addLast(packet); // depends on control dependency: [if], data = [none]
packet = null; // depends on control dependency: [if], data = [none]
} else {
while(packet.protoHeader.getXid() != recvXid){
LOGGER.error("Packet xid out of order, drop the queued packet, type=" + packet.protoHeader.getType()
+ ", queuedXid=" + packet.protoHeader.getXid()); // depends on control dependency: [while], data = [none]
packet.respHeader.setErr(ErrorCode.CONNECTION_LOSS); // depends on control dependency: [while], data = [none]
finishPacket(packet); // depends on control dependency: [while], data = [none]
if(! pendingQueue.isEmpty()){
packet = pendingQueue.remove(); // depends on control dependency: [if], data = [none]
} else {
return ; // depends on control dependency: [if], data = [none]
}
}
}
}
}
PacketLatency.receivePacket(packet);
packet.respHeader.setXid(header.getXid());
packet.respHeader.setErr(header.getErr());
packet.respHeader.setDxid(header.getDxid());
if (header.getDxid() > 0) {
lastDxid = header.getDxid(); // depends on control dependency: [if], data = [none]
}
if (ErrorCode.OK.equals(header.getErr())) {
packet.response = response; // depends on control dependency: [if], data = [none]
}
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Reading reply sessionid:0x"
+ session.id + ", packet=" + packet); // depends on control dependency: [if], data = [none]
}
finishPacket(packet);
} } |
public class class_name {
public static boolean isBoolean(final String param) {
if (isEmpty(param)) {
return false;
}
return param.equalsIgnoreCase("true") || param.equalsIgnoreCase("false");
} } | public class class_name {
public static boolean isBoolean(final String param) {
if (isEmpty(param)) {
return false;
// depends on control dependency: [if], data = [none]
}
return param.equalsIgnoreCase("true") || param.equalsIgnoreCase("false");
} } |
public class class_name {
public static void shutDownMember(String name)
{
try
{
ObjectName serverName = new ObjectName("GemFire:type=Member,member="+name);
JMX jmx = SingletonGemFireJmx.getJmx();
MemberMXBean bean = jmx.newBean(MemberMXBean.class,serverName);
bean.shutDownMember();
//wait for member to shutdown
System.out.println("Waiting for member:"+name+" to shutdown");
while(GemFireJmxClient.checkMemberStatus(name,SingletonGemFireJmx.getJmx()))
{
Thread.sleep(shutDownDelay);
}
}
catch (MalformedObjectNameException e)
{
throw new RuntimeException("Unable to shutdown member "+name
+" ERROR:"+e.getMessage(),e);
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
} } | public class class_name {
public static void shutDownMember(String name)
{
try
{
ObjectName serverName = new ObjectName("GemFire:type=Member,member="+name);
JMX jmx = SingletonGemFireJmx.getJmx();
MemberMXBean bean = jmx.newBean(MemberMXBean.class,serverName);
bean.shutDownMember(); // depends on control dependency: [try], data = [none]
//wait for member to shutdown
System.out.println("Waiting for member:"+name+" to shutdown"); // depends on control dependency: [try], data = [none]
while(GemFireJmxClient.checkMemberStatus(name,SingletonGemFireJmx.getJmx()))
{
Thread.sleep(shutDownDelay); // depends on control dependency: [while], data = [none]
}
}
catch (MalformedObjectNameException e)
{
throw new RuntimeException("Unable to shutdown member "+name
+" ERROR:"+e.getMessage(),e);
} // depends on control dependency: [catch], data = [none]
catch (Exception e)
{
System.out.println(e.getMessage());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Collection<BeanRule> getBeanRules() {
Collection<BeanRule> idBasedBeanRules = beanRuleRegistry.getIdBasedBeanRules();
Collection<Set<BeanRule>> typeBasedBeanRules = beanRuleRegistry.getTypeBasedBeanRules();
Collection<BeanRule> configurableBeanRules = beanRuleRegistry.getConfigurableBeanRules();
int capacity = idBasedBeanRules.size();
for (Set<BeanRule> brs : typeBasedBeanRules) {
capacity += brs.size();
}
capacity += configurableBeanRules.size();
capacity = (int)(capacity / 0.9f) + 1;
Set<BeanRule> beanRuleSet = new HashSet<>(capacity, 0.9f);
beanRuleSet.addAll(idBasedBeanRules);
for (Set<BeanRule> brs : typeBasedBeanRules) {
beanRuleSet.addAll(brs);
}
beanRuleSet.addAll(configurableBeanRules);
return beanRuleSet;
} } | public class class_name {
public Collection<BeanRule> getBeanRules() {
Collection<BeanRule> idBasedBeanRules = beanRuleRegistry.getIdBasedBeanRules();
Collection<Set<BeanRule>> typeBasedBeanRules = beanRuleRegistry.getTypeBasedBeanRules();
Collection<BeanRule> configurableBeanRules = beanRuleRegistry.getConfigurableBeanRules();
int capacity = idBasedBeanRules.size();
for (Set<BeanRule> brs : typeBasedBeanRules) {
capacity += brs.size(); // depends on control dependency: [for], data = [brs]
}
capacity += configurableBeanRules.size();
capacity = (int)(capacity / 0.9f) + 1;
Set<BeanRule> beanRuleSet = new HashSet<>(capacity, 0.9f);
beanRuleSet.addAll(idBasedBeanRules);
for (Set<BeanRule> brs : typeBasedBeanRules) {
beanRuleSet.addAll(brs); // depends on control dependency: [for], data = [brs]
}
beanRuleSet.addAll(configurableBeanRules);
return beanRuleSet;
} } |
public class class_name {
private Expression joinOperations(Expression result, String operation, Expression next) {
if (!(result instanceof Operation)) {
return new Operation(operation, result, next);
}
Operation farRight = (Operation) result;
while (farRight.getRight() instanceof Operation) {
farRight = (Operation) farRight.getRight();
}
if (!farRight.isProtect() && ("+".equals(farRight.getOperation()) || "-".equals(farRight.getOperation()))) {
farRight.setRight(new Operation(operation, farRight.getRight(), next));
return result;
}
return new Operation(operation, result, next);
} } | public class class_name {
private Expression joinOperations(Expression result, String operation, Expression next) {
if (!(result instanceof Operation)) {
return new Operation(operation, result, next); // depends on control dependency: [if], data = [none]
}
Operation farRight = (Operation) result;
while (farRight.getRight() instanceof Operation) {
farRight = (Operation) farRight.getRight(); // depends on control dependency: [while], data = [none]
}
if (!farRight.isProtect() && ("+".equals(farRight.getOperation()) || "-".equals(farRight.getOperation()))) {
farRight.setRight(new Operation(operation, farRight.getRight(), next)); // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
return new Operation(operation, result, next);
} } |
public class class_name {
public static BeanInfo createBeanInfo(Class<? extends Object> c) {
BeanInfo bi = DefaultBeanInfoResolver.getBeanInfoHelper(c);
if (bi == null) {
bi = new ConfigBeanInfo(c);
DefaultBeanInfoResolver.addBeanInfo(c, bi);
}
return bi;
} } | public class class_name {
public static BeanInfo createBeanInfo(Class<? extends Object> c) {
BeanInfo bi = DefaultBeanInfoResolver.getBeanInfoHelper(c);
if (bi == null) {
bi = new ConfigBeanInfo(c); // depends on control dependency: [if], data = [none]
DefaultBeanInfoResolver.addBeanInfo(c, bi); // depends on control dependency: [if], data = [none]
}
return bi;
} } |
public class class_name {
@VisibleForTesting
synchronized void consumerSubscriptionRebalance() {
log.debug("Subscribed Topics " + this.consumer.subscription());
if (!this.subscribedTopics.isEmpty()) {
final Iterator<String> iter = this.subscribedTopics.iterator();
final List<String> topics = new ArrayList<>();
while (iter.hasNext()) {
topics.add(iter.next());
}
this.subscribedTopics.clear();
//re-subscribe topics that are needed
this.consumer.subscribe(topics);
}
} } | public class class_name {
@VisibleForTesting
synchronized void consumerSubscriptionRebalance() {
log.debug("Subscribed Topics " + this.consumer.subscription());
if (!this.subscribedTopics.isEmpty()) {
final Iterator<String> iter = this.subscribedTopics.iterator();
final List<String> topics = new ArrayList<>();
while (iter.hasNext()) {
topics.add(iter.next()); // depends on control dependency: [while], data = [none]
}
this.subscribedTopics.clear(); // depends on control dependency: [if], data = [none]
//re-subscribe topics that are needed
this.consumer.subscribe(topics); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private int canBeAccommodated(int sourceTypeIndex, int targetTypeIndex) {
if (sourceTypeIndex >= this.availableInstanceTypes.length
|| targetTypeIndex >= this.availableInstanceTypes.length) {
LOG.error("Cannot determine number of instance accomodations: invalid index");
return 0;
}
return this.instanceAccommodationMatrix[targetTypeIndex][sourceTypeIndex];
} } | public class class_name {
private int canBeAccommodated(int sourceTypeIndex, int targetTypeIndex) {
if (sourceTypeIndex >= this.availableInstanceTypes.length
|| targetTypeIndex >= this.availableInstanceTypes.length) {
LOG.error("Cannot determine number of instance accomodations: invalid index"); // depends on control dependency: [if], data = [none]
return 0; // depends on control dependency: [if], data = [none]
}
return this.instanceAccommodationMatrix[targetTypeIndex][sourceTypeIndex];
} } |
public class class_name {
public void setFleets(java.util.Collection<Fleet> fleets) {
if (fleets == null) {
this.fleets = null;
return;
}
this.fleets = new java.util.ArrayList<Fleet>(fleets);
} } | public class class_name {
public void setFleets(java.util.Collection<Fleet> fleets) {
if (fleets == null) {
this.fleets = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.fleets = new java.util.ArrayList<Fleet>(fleets);
} } |
public class class_name {
public void setCapacity(long capacity) {
if (capacity < MIN_HEADER_TABLE_SIZE || capacity > MAX_HEADER_TABLE_SIZE) {
throw new IllegalArgumentException("capacity is invalid: " + capacity);
}
// initially capacity will be -1 so init won't return here
if (this.capacity == capacity) {
return;
}
this.capacity = capacity;
if (capacity == 0) {
clear();
} else {
// initially size will be 0 so remove won't be called
while (size > capacity) {
remove();
}
}
int maxEntries = (int) (capacity / HpackHeaderField.HEADER_ENTRY_OVERHEAD);
if (capacity % HpackHeaderField.HEADER_ENTRY_OVERHEAD != 0) {
maxEntries++;
}
// check if capacity change requires us to reallocate the array
if (hpackHeaderFields != null && hpackHeaderFields.length == maxEntries) {
return;
}
HpackHeaderField[] tmp = new HpackHeaderField[maxEntries];
// initially length will be 0 so there will be no copy
int len = length();
int cursor = tail;
for (int i = 0; i < len; i++) {
HpackHeaderField entry = hpackHeaderFields[cursor++];
tmp[i] = entry;
if (cursor == hpackHeaderFields.length) {
cursor = 0;
}
}
tail = 0;
head = tail + len;
hpackHeaderFields = tmp;
} } | public class class_name {
public void setCapacity(long capacity) {
if (capacity < MIN_HEADER_TABLE_SIZE || capacity > MAX_HEADER_TABLE_SIZE) {
throw new IllegalArgumentException("capacity is invalid: " + capacity);
}
// initially capacity will be -1 so init won't return here
if (this.capacity == capacity) {
return; // depends on control dependency: [if], data = [none]
}
this.capacity = capacity;
if (capacity == 0) {
clear(); // depends on control dependency: [if], data = [none]
} else {
// initially size will be 0 so remove won't be called
while (size > capacity) {
remove(); // depends on control dependency: [while], data = [none]
}
}
int maxEntries = (int) (capacity / HpackHeaderField.HEADER_ENTRY_OVERHEAD);
if (capacity % HpackHeaderField.HEADER_ENTRY_OVERHEAD != 0) {
maxEntries++; // depends on control dependency: [if], data = [none]
}
// check if capacity change requires us to reallocate the array
if (hpackHeaderFields != null && hpackHeaderFields.length == maxEntries) {
return; // depends on control dependency: [if], data = [none]
}
HpackHeaderField[] tmp = new HpackHeaderField[maxEntries];
// initially length will be 0 so there will be no copy
int len = length();
int cursor = tail;
for (int i = 0; i < len; i++) {
HpackHeaderField entry = hpackHeaderFields[cursor++];
tmp[i] = entry; // depends on control dependency: [for], data = [i]
if (cursor == hpackHeaderFields.length) {
cursor = 0; // depends on control dependency: [if], data = [none]
}
}
tail = 0;
head = tail + len;
hpackHeaderFields = tmp;
} } |
public class class_name {
@Override
public CommerceAccountUserRel remove(Serializable primaryKey)
throws NoSuchAccountUserRelException {
Session session = null;
try {
session = openSession();
CommerceAccountUserRel commerceAccountUserRel = (CommerceAccountUserRel)session.get(CommerceAccountUserRelImpl.class,
primaryKey);
if (commerceAccountUserRel == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchAccountUserRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commerceAccountUserRel);
}
catch (NoSuchAccountUserRelException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } | public class class_name {
@Override
public CommerceAccountUserRel remove(Serializable primaryKey)
throws NoSuchAccountUserRelException {
Session session = null;
try {
session = openSession();
CommerceAccountUserRel commerceAccountUserRel = (CommerceAccountUserRel)session.get(CommerceAccountUserRelImpl.class,
primaryKey);
if (commerceAccountUserRel == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); // depends on control dependency: [if], data = [none]
}
throw new NoSuchAccountUserRelException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
primaryKey);
}
return remove(commerceAccountUserRel);
}
catch (NoSuchAccountUserRelException nsee) {
throw nsee;
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } |
public class class_name {
private CmsResource getMessageBundle() {
OpenCms.getLocaleManager();
String localString = CmsLocaleManager.getDefaultLocale().toString();
List<String> moduleResource = m_module.getResources();
for (String resourcePath : moduleResource) {
if (resourcePath.contains(PATH_I18N) && resourcePath.endsWith(localString)) {
try {
return m_cms.readResource(resourcePath);
} catch (CmsException e) {
LOG.error("Can not read message bundle", e);
}
}
}
String moduleFolder = getModuleFolder(m_module.getName());
if (CmsStringUtil.isEmptyOrWhitespaceOnly(moduleFolder)) {
return null;
}
String bundlePath = CmsStringUtil.joinPaths(
moduleFolder,
PATH_I18N,
m_module.getName() + SUFFIX_BUNDLE_FILE + "_" + localString);
if (m_cms.existsResource(bundlePath)) {
try {
return m_cms.readResource(bundlePath);
} catch (CmsException e) {
LOG.error("No bundle found for module", e);
}
}
return null;
} } | public class class_name {
private CmsResource getMessageBundle() {
OpenCms.getLocaleManager();
String localString = CmsLocaleManager.getDefaultLocale().toString();
List<String> moduleResource = m_module.getResources();
for (String resourcePath : moduleResource) {
if (resourcePath.contains(PATH_I18N) && resourcePath.endsWith(localString)) {
try {
return m_cms.readResource(resourcePath); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.error("Can not read message bundle", e);
} // depends on control dependency: [catch], data = [none]
}
}
String moduleFolder = getModuleFolder(m_module.getName());
if (CmsStringUtil.isEmptyOrWhitespaceOnly(moduleFolder)) {
return null; // depends on control dependency: [if], data = [none]
}
String bundlePath = CmsStringUtil.joinPaths(
moduleFolder,
PATH_I18N,
m_module.getName() + SUFFIX_BUNDLE_FILE + "_" + localString);
if (m_cms.existsResource(bundlePath)) {
try {
return m_cms.readResource(bundlePath); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
LOG.error("No bundle found for module", e);
} // depends on control dependency: [catch], data = [none]
}
return null;
} } |
public class class_name {
protected String getWidget(CmsWidgetDialogParameter param) {
if (param != null) {
return param.getWidget().getDialogWidget(getCms(), this, param);
}
return null;
} } | public class class_name {
protected String getWidget(CmsWidgetDialogParameter param) {
if (param != null) {
return param.getWidget().getDialogWidget(getCms(), this, param); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private List<ReportCodeLine> generateReportCodeBody(TestMethod rootMethod,
RunFailure runFailure, boolean executed) throws IllegalTestScriptException {
String currentStepLabelTtId = null;
List<ReportCodeLine> result = new ArrayList<>(rootMethod.getCodeBody().size());
for (int i = 0; i < rootMethod.getCodeBody().size(); i++) {
CodeLine codeLine = rootMethod.getCodeBody().get(i);
String rootTtId = Integer.toString(i);
String parentTtIdForRoot = null;
if (codeLine.getCode() instanceof TestStepLabel) {
parentTtIdForRoot = null;
currentStepLabelTtId = rootTtId;
} else if (codeLine.getCode() instanceof TestStep) {
throw new RuntimeException("not supported");
} else {
parentTtIdForRoot = currentStepLabelTtId;
}
StackLine rootStackLine = generateStackLine(
rootMethod, rootMethod.getKey(), i, codeLine.getStartLine());
List<StackLine> rootStackLines = new ArrayList<>(1);
rootStackLines.add(rootStackLine);
ReportCodeLine reportCodeLine = generateReportCodeLine(
codeLine, rootMethod.getArgVariables(), rootStackLines,
runFailure, executed, rootTtId, parentTtIdForRoot);
result.add(reportCodeLine);
// add direct child to HTML report
if (codeLine.getCode() instanceof SubMethodInvoke) {
SubMethodInvoke invoke = (SubMethodInvoke) codeLine.getCode();
// don't add child HTML report for childInvoke
// since the code body for the sub method is not the code body of
// the actually invoked method.
// TODO consider about this behavior
if (!invoke.isChildInvoke()) {
List<String> parentMethodArgTestDocs = reportCodeLine.getMethodArgTestDocs();
List<CodeLine> codeBody = invoke.getSubMethod().getCodeBody();
for (int j = 0; j < codeBody.size(); j++) {
CodeLine childCodeLine = codeBody.get(j);
if (childCodeLine.getCode() instanceof TestStepLabel) {
throw new RuntimeException("nested TestStepLabel is not supported yet");
} else if (childCodeLine.getCode() instanceof TestStep) {
throw new RuntimeException("not supported");
}
StackLine childStackLine = generateStackLine(invoke.getSubMethod(),
invoke.getSubMethodKey(), j, childCodeLine.getStartLine());
List<StackLine> childStackLines = new ArrayList<>(2);
childStackLines.add(childStackLine);
childStackLines.add(rootStackLine);
ReportCodeLine childReportCodeLine = generateReportCodeLine(
childCodeLine, parentMethodArgTestDocs, childStackLines,
runFailure, executed, rootTtId + "_" + j, rootTtId);
result.add(childReportCodeLine);
}
}
}
}
// update hasError and alreadyRun status of TestStepLabel CodeLine
// according to its child code block
ReportCodeLine currentStepLabelLine = null;
for (int i = 0; i < result.size(); i++) {
ReportCodeLine reportCodeLine = result.get(i);
Code code = reportCodeLine.getCodeLine().getCode();
if (code instanceof TestStepLabel) {
currentStepLabelLine = result.get(i);
continue;
}
if (currentStepLabelLine == null) {
continue; // no TestStepLabel to be updated
}
if (reportCodeLine.hasError()) {
// If child code block contains error,
// TestStepLabel also has error
currentStepLabelLine.setHasError(true);
currentStepLabelLine.setAlreadyRun(true);
// use error image for child code block
currentStepLabelLine.setImageId(reportCodeLine.getImageId());
} else if (!reportCodeLine.isAlreadyRun() && !currentStepLabelLine.hasError()) {
// If child code block contains not executed line,
// TestStepLabel is also not executed
currentStepLabelLine.setHasError(false);
currentStepLabelLine.setAlreadyRun(false);
}
}
return result;
} } | public class class_name {
private List<ReportCodeLine> generateReportCodeBody(TestMethod rootMethod,
RunFailure runFailure, boolean executed) throws IllegalTestScriptException {
String currentStepLabelTtId = null;
List<ReportCodeLine> result = new ArrayList<>(rootMethod.getCodeBody().size());
for (int i = 0; i < rootMethod.getCodeBody().size(); i++) {
CodeLine codeLine = rootMethod.getCodeBody().get(i);
String rootTtId = Integer.toString(i);
String parentTtIdForRoot = null;
if (codeLine.getCode() instanceof TestStepLabel) {
parentTtIdForRoot = null;
currentStepLabelTtId = rootTtId;
} else if (codeLine.getCode() instanceof TestStep) {
throw new RuntimeException("not supported");
} else {
parentTtIdForRoot = currentStepLabelTtId;
}
StackLine rootStackLine = generateStackLine(
rootMethod, rootMethod.getKey(), i, codeLine.getStartLine());
List<StackLine> rootStackLines = new ArrayList<>(1);
rootStackLines.add(rootStackLine);
ReportCodeLine reportCodeLine = generateReportCodeLine(
codeLine, rootMethod.getArgVariables(), rootStackLines,
runFailure, executed, rootTtId, parentTtIdForRoot);
result.add(reportCodeLine);
// add direct child to HTML report
if (codeLine.getCode() instanceof SubMethodInvoke) {
SubMethodInvoke invoke = (SubMethodInvoke) codeLine.getCode();
// don't add child HTML report for childInvoke
// since the code body for the sub method is not the code body of
// the actually invoked method.
// TODO consider about this behavior
if (!invoke.isChildInvoke()) {
List<String> parentMethodArgTestDocs = reportCodeLine.getMethodArgTestDocs();
List<CodeLine> codeBody = invoke.getSubMethod().getCodeBody();
for (int j = 0; j < codeBody.size(); j++) {
CodeLine childCodeLine = codeBody.get(j);
if (childCodeLine.getCode() instanceof TestStepLabel) {
throw new RuntimeException("nested TestStepLabel is not supported yet");
} else if (childCodeLine.getCode() instanceof TestStep) {
throw new RuntimeException("not supported");
}
StackLine childStackLine = generateStackLine(invoke.getSubMethod(),
invoke.getSubMethodKey(), j, childCodeLine.getStartLine());
List<StackLine> childStackLines = new ArrayList<>(2);
childStackLines.add(childStackLine); // depends on control dependency: [for], data = [none]
childStackLines.add(rootStackLine); // depends on control dependency: [for], data = [none]
ReportCodeLine childReportCodeLine = generateReportCodeLine(
childCodeLine, parentMethodArgTestDocs, childStackLines,
runFailure, executed, rootTtId + "_" + j, rootTtId);
result.add(childReportCodeLine); // depends on control dependency: [for], data = [none]
}
}
}
}
// update hasError and alreadyRun status of TestStepLabel CodeLine
// according to its child code block
ReportCodeLine currentStepLabelLine = null;
for (int i = 0; i < result.size(); i++) {
ReportCodeLine reportCodeLine = result.get(i);
Code code = reportCodeLine.getCodeLine().getCode();
if (code instanceof TestStepLabel) {
currentStepLabelLine = result.get(i);
continue;
}
if (currentStepLabelLine == null) {
continue; // no TestStepLabel to be updated
}
if (reportCodeLine.hasError()) {
// If child code block contains error,
// TestStepLabel also has error
currentStepLabelLine.setHasError(true);
currentStepLabelLine.setAlreadyRun(true);
// use error image for child code block
currentStepLabelLine.setImageId(reportCodeLine.getImageId());
} else if (!reportCodeLine.isAlreadyRun() && !currentStepLabelLine.hasError()) {
// If child code block contains not executed line,
// TestStepLabel is also not executed
currentStepLabelLine.setHasError(false);
currentStepLabelLine.setAlreadyRun(false);
}
}
return result;
} } |
public class class_name {
public static void showOnScreen(final int screen, final JFrame frame)
{
if (isScreenAvailableToShow(screen))
{
final GraphicsDevice[] graphicsDevices = getAvailableScreens();
graphicsDevices[screen].setFullScreenWindow(frame);
}
} } | public class class_name {
public static void showOnScreen(final int screen, final JFrame frame)
{
if (isScreenAvailableToShow(screen))
{
final GraphicsDevice[] graphicsDevices = getAvailableScreens();
graphicsDevices[screen].setFullScreenWindow(frame); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public EClass getDoubleType() {
if (doubleTypeEClass == null) {
doubleTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(77);
}
return doubleTypeEClass;
} } | public class class_name {
@Override
public EClass getDoubleType() {
if (doubleTypeEClass == null) {
doubleTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(77);
// depends on control dependency: [if], data = [none]
}
return doubleTypeEClass;
} } |
public class class_name {
public TVEpisodeInfo getEpisodeInfo(int tvID, int seasonNumber, int episodeNumber, String language, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.SEASON_NUMBER, seasonNumber);
parameters.add(Param.EPISODE_NUMBER, episodeNumber);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.EPISODE).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, TVEpisodeInfo.class);
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV Episode Info", url, ex);
}
} } | public class class_name {
public TVEpisodeInfo getEpisodeInfo(int tvID, int seasonNumber, int episodeNumber, String language, String... appendToResponse) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, tvID);
parameters.add(Param.SEASON_NUMBER, seasonNumber);
parameters.add(Param.EPISODE_NUMBER, episodeNumber);
parameters.add(Param.LANGUAGE, language);
parameters.add(Param.APPEND, appendToResponse);
URL url = new ApiUrl(apiKey, MethodBase.EPISODE).buildUrl(parameters);
String webpage = httpTools.getRequest(url);
try {
return MAPPER.readValue(webpage, TVEpisodeInfo.class); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV Episode Info", url, ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public MoveResult<Solution_> take() throws InterruptedException {
int moveIndex = nextMoveIndex;
nextMoveIndex++;
if (!backlog.isEmpty()) {
MoveResult<Solution_> result = backlog.remove(moveIndex);
if (result != null) {
return result;
}
}
while (true) {
MoveResult<Solution_> result = innerQueue.take();
// If 2 exceptions are added from different threads concurrently, either one could end up first.
// This is a known deviation from 100% reproducibility, that never occurs in a success scenario.
if (result.hasThrownException()) {
throw new IllegalStateException("The move thread with moveThreadIndex ("
+ result.getMoveThreadIndex() + ") has thrown an exception."
+ " Relayed here in the parent thread.",
result.getThrowable());
}
if (result.getMoveIndex() == moveIndex) {
return result;
} else {
backlog.put(result.getMoveIndex(), result);
}
}
} } | public class class_name {
public MoveResult<Solution_> take() throws InterruptedException {
int moveIndex = nextMoveIndex;
nextMoveIndex++;
if (!backlog.isEmpty()) {
MoveResult<Solution_> result = backlog.remove(moveIndex);
if (result != null) {
return result;
}
}
while (true) {
MoveResult<Solution_> result = innerQueue.take();
// If 2 exceptions are added from different threads concurrently, either one could end up first.
// This is a known deviation from 100% reproducibility, that never occurs in a success scenario.
if (result.hasThrownException()) {
throw new IllegalStateException("The move thread with moveThreadIndex ("
+ result.getMoveThreadIndex() + ") has thrown an exception."
+ " Relayed here in the parent thread.",
result.getThrowable());
}
if (result.getMoveIndex() == moveIndex) {
return result; // depends on control dependency: [if], data = [none]
} else {
backlog.put(result.getMoveIndex(), result); // depends on control dependency: [if], data = [(result.getMoveIndex()]
}
}
} } |
public class class_name {
public void marshall(LookupEventsRequest lookupEventsRequest, ProtocolMarshaller protocolMarshaller) {
if (lookupEventsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(lookupEventsRequest.getLookupAttributes(), LOOKUPATTRIBUTES_BINDING);
protocolMarshaller.marshall(lookupEventsRequest.getStartTime(), STARTTIME_BINDING);
protocolMarshaller.marshall(lookupEventsRequest.getEndTime(), ENDTIME_BINDING);
protocolMarshaller.marshall(lookupEventsRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(lookupEventsRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(LookupEventsRequest lookupEventsRequest, ProtocolMarshaller protocolMarshaller) {
if (lookupEventsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(lookupEventsRequest.getLookupAttributes(), LOOKUPATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(lookupEventsRequest.getStartTime(), STARTTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(lookupEventsRequest.getEndTime(), ENDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(lookupEventsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(lookupEventsRequest.getNextToken(), NEXTTOKEN_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 void println(int logLevel, String msg, Throwable tr) {
if (logLevel < logConfiguration.logLevel) {
return;
}
printlnInternal(logLevel, ((msg == null || msg.length() == 0)
? "" : (msg + SystemCompat.lineSeparator))
+ logConfiguration.throwableFormatter.format(tr));
} } | public class class_name {
private void println(int logLevel, String msg, Throwable tr) {
if (logLevel < logConfiguration.logLevel) {
return; // depends on control dependency: [if], data = [none]
}
printlnInternal(logLevel, ((msg == null || msg.length() == 0)
? "" : (msg + SystemCompat.lineSeparator))
+ logConfiguration.throwableFormatter.format(tr));
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static Map<String, ILdapServer> getLdapServerMap() {
final ApplicationContext applicationContext =
PortalApplicationContextLocator.getApplicationContext();
final Map<String, ILdapServer> ldapServers =
applicationContext.getBeansOfType(ILdapServer.class);
if (LOG.isDebugEnabled()) {
LOG.debug("Found Map of ILdapServers=" + ldapServers + "'");
}
return Collections.unmodifiableMap(ldapServers);
} } | public class class_name {
@SuppressWarnings("unchecked")
public static Map<String, ILdapServer> getLdapServerMap() {
final ApplicationContext applicationContext =
PortalApplicationContextLocator.getApplicationContext();
final Map<String, ILdapServer> ldapServers =
applicationContext.getBeansOfType(ILdapServer.class);
if (LOG.isDebugEnabled()) {
LOG.debug("Found Map of ILdapServers=" + ldapServers + "'"); // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableMap(ldapServers);
} } |
public class class_name {
public void writeDescribe(Describe describe) {
ensureBuffer();
int pos = out.writerIndex();
out.writeByte(DESCRIBE);
out.writeInt(0);
if (describe.statement != 0) {
out.writeByte('S');
out.writeLong(describe.statement);
} else if (describe.portal != null) {
out.writeByte('P');
Util.writeCStringUTF8(out, describe.portal);
} else {
out.writeByte('S');
Util.writeCStringUTF8(out, "");
}
out.setInt(pos + 1, out.writerIndex() - pos- 1);
} } | public class class_name {
public void writeDescribe(Describe describe) {
ensureBuffer();
int pos = out.writerIndex();
out.writeByte(DESCRIBE);
out.writeInt(0);
if (describe.statement != 0) {
out.writeByte('S'); // depends on control dependency: [if], data = [none]
out.writeLong(describe.statement); // depends on control dependency: [if], data = [(describe.statement]
} else if (describe.portal != null) {
out.writeByte('P'); // depends on control dependency: [if], data = [none]
Util.writeCStringUTF8(out, describe.portal); // depends on control dependency: [if], data = [none]
} else {
out.writeByte('S'); // depends on control dependency: [if], data = [none]
Util.writeCStringUTF8(out, ""); // depends on control dependency: [if], data = [none]
}
out.setInt(pos + 1, out.writerIndex() - pos- 1);
} } |
public class class_name {
private void writeResources()
{
Resources resources = m_factory.createResources();
m_plannerProject.setResources(resources);
List<net.sf.mpxj.planner.schema.Resource> resourceList = resources.getResource();
for (Resource mpxjResource : m_projectFile.getResources())
{
net.sf.mpxj.planner.schema.Resource plannerResource = m_factory.createResource();
resourceList.add(plannerResource);
writeResource(mpxjResource, plannerResource);
}
} } | public class class_name {
private void writeResources()
{
Resources resources = m_factory.createResources();
m_plannerProject.setResources(resources);
List<net.sf.mpxj.planner.schema.Resource> resourceList = resources.getResource();
for (Resource mpxjResource : m_projectFile.getResources())
{
net.sf.mpxj.planner.schema.Resource plannerResource = m_factory.createResource();
resourceList.add(plannerResource); // depends on control dependency: [for], data = [none]
writeResource(mpxjResource, plannerResource); // depends on control dependency: [for], data = [mpxjResource]
}
} } |
public class class_name {
public EList<MCFRG> getRG() {
if (rg == null) {
rg = new EObjectContainmentEList.Resolving<MCFRG>(MCFRG.class, this, AfplibPackage.MCF__RG);
}
return rg;
} } | public class class_name {
public EList<MCFRG> getRG() {
if (rg == null) {
rg = new EObjectContainmentEList.Resolving<MCFRG>(MCFRG.class, this, AfplibPackage.MCF__RG); // depends on control dependency: [if], data = [none]
}
return rg;
} } |
public class class_name {
public static String unexpand(CharSequence self, int tabStop) {
String s = self.toString();
if (s.length() == 0) return s;
try {
StringBuilder builder = new StringBuilder();
for (String line : readLines((CharSequence) s)) {
builder.append(unexpandLine(line, tabStop));
builder.append("\n");
}
// remove the normalized ending line ending if it was not present
if (!s.endsWith("\n")) {
builder.deleteCharAt(builder.length() - 1);
}
return builder.toString();
} catch (IOException e) {
/* ignore */
}
return s;
} } | public class class_name {
public static String unexpand(CharSequence self, int tabStop) {
String s = self.toString();
if (s.length() == 0) return s;
try {
StringBuilder builder = new StringBuilder();
for (String line : readLines((CharSequence) s)) {
builder.append(unexpandLine(line, tabStop)); // depends on control dependency: [for], data = [line]
builder.append("\n"); // depends on control dependency: [for], data = [none]
}
// remove the normalized ending line ending if it was not present
if (!s.endsWith("\n")) {
builder.deleteCharAt(builder.length() - 1); // depends on control dependency: [if], data = [none]
}
return builder.toString(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
/* ignore */
} // depends on control dependency: [catch], data = [none]
return s;
} } |
public class class_name {
public final void increaseWrittenMessages(
WriteRequest request, long currentTime) {
Object message = request.getMessage();
if (message instanceof IoBuffer) {
IoBuffer b = (IoBuffer) message;
if (b.hasRemaining()) {
return;
}
}
writtenMessages++;
lastWriteTime = currentTime;
if (getService() instanceof AbstractIoService) {
getService().getStatistics().increaseWrittenMessages(currentTime);
}
decreaseScheduledWriteMessages();
} } | public class class_name {
public final void increaseWrittenMessages(
WriteRequest request, long currentTime) {
Object message = request.getMessage();
if (message instanceof IoBuffer) {
IoBuffer b = (IoBuffer) message;
if (b.hasRemaining()) {
return; // depends on control dependency: [if], data = [none]
}
}
writtenMessages++;
lastWriteTime = currentTime;
if (getService() instanceof AbstractIoService) {
getService().getStatistics().increaseWrittenMessages(currentTime); // depends on control dependency: [if], data = [none]
}
decreaseScheduledWriteMessages();
} } |
public class class_name {
@Override
public void putStaticInfo(Persistable staticInfo) {
List<StatsStorageEvent> sses = checkStorageEvents(staticInfo);
if (!sessionIDs.contains(staticInfo.getSessionID())) {
sessionIDs.add(staticInfo.getSessionID());
}
SessionTypeWorkerId id = new SessionTypeWorkerId(staticInfo.getSessionID(), staticInfo.getTypeID(),
staticInfo.getWorkerID());
this.staticInfo.put(id, staticInfo);
db.commit(); //For write ahead log: need to ensure that we persist all data to disk...
StatsStorageEvent sse = null;
if (!listeners.isEmpty())
sse = new StatsStorageEvent(this, StatsStorageListener.EventType.PostStaticInfo, staticInfo.getSessionID(),
staticInfo.getTypeID(), staticInfo.getWorkerID(), staticInfo.getTimeStamp());
for (StatsStorageListener l : listeners) {
l.notify(sse);
}
notifyListeners(sses);
} } | public class class_name {
@Override
public void putStaticInfo(Persistable staticInfo) {
List<StatsStorageEvent> sses = checkStorageEvents(staticInfo);
if (!sessionIDs.contains(staticInfo.getSessionID())) {
sessionIDs.add(staticInfo.getSessionID()); // depends on control dependency: [if], data = [none]
}
SessionTypeWorkerId id = new SessionTypeWorkerId(staticInfo.getSessionID(), staticInfo.getTypeID(),
staticInfo.getWorkerID());
this.staticInfo.put(id, staticInfo);
db.commit(); //For write ahead log: need to ensure that we persist all data to disk...
StatsStorageEvent sse = null;
if (!listeners.isEmpty())
sse = new StatsStorageEvent(this, StatsStorageListener.EventType.PostStaticInfo, staticInfo.getSessionID(),
staticInfo.getTypeID(), staticInfo.getWorkerID(), staticInfo.getTimeStamp());
for (StatsStorageListener l : listeners) {
l.notify(sse); // depends on control dependency: [for], data = [l]
}
notifyListeners(sses);
} } |
public class class_name {
public DeleteIdentitiesRequest withIdentityIdsToDelete(String... identityIdsToDelete) {
if (this.identityIdsToDelete == null) {
setIdentityIdsToDelete(new java.util.ArrayList<String>(identityIdsToDelete.length));
}
for (String ele : identityIdsToDelete) {
this.identityIdsToDelete.add(ele);
}
return this;
} } | public class class_name {
public DeleteIdentitiesRequest withIdentityIdsToDelete(String... identityIdsToDelete) {
if (this.identityIdsToDelete == null) {
setIdentityIdsToDelete(new java.util.ArrayList<String>(identityIdsToDelete.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : identityIdsToDelete) {
this.identityIdsToDelete.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Override
protected String consumeDecimal() {
StringBuilder builder = null;
boolean noSign = false;
boolean noExponent = false;
boolean noDot = false;
boolean done = false;
char c = 0;
hasNext();
while (true) {
int start = this.offset;
while (this.offset < this.limit) {
c = this.buffer[this.offset];
if ((c == '+') || (c == '-')) {
if (noSign) {
done = true;
break;
} else {
noSign = true;
}
} else if (c == 'e') {
if (noExponent) {
done = true;
break;
} else {
noExponent = true;
noSign = false;
noDot = true;
}
} else if (c == '.') {
if (noDot) {
done = true;
break;
} else {
noDot = true;
}
} else if ((c >= '0') && (c <= '9')) {
noSign = true;
} else {
done = true;
break;
}
this.offset++;
}
if (done) {
return getAppended(builder, start, this.offset);
}
int len = this.offset - start;
if (len > 0) {
builder = append(builder, start, this.offset);
}
if (done || !fill()) {
if (builder == null) {
throw new IllegalStateException("Invalid character for decimal number: " + c);
}
return builder.toString();
}
}
} } | public class class_name {
@Override
protected String consumeDecimal() {
StringBuilder builder = null;
boolean noSign = false;
boolean noExponent = false;
boolean noDot = false;
boolean done = false;
char c = 0;
hasNext();
while (true) {
int start = this.offset;
while (this.offset < this.limit) {
c = this.buffer[this.offset]; // depends on control dependency: [while], data = [none]
if ((c == '+') || (c == '-')) {
if (noSign) {
done = true; // depends on control dependency: [if], data = [none]
break;
} else {
noSign = true; // depends on control dependency: [if], data = [none]
}
} else if (c == 'e') {
if (noExponent) {
done = true; // depends on control dependency: [if], data = [none]
break;
} else {
noExponent = true; // depends on control dependency: [if], data = [none]
noSign = false; // depends on control dependency: [if], data = [none]
noDot = true; // depends on control dependency: [if], data = [none]
}
} else if (c == '.') {
if (noDot) {
done = true; // depends on control dependency: [if], data = [none]
break;
} else {
noDot = true; // depends on control dependency: [if], data = [none]
}
} else if ((c >= '0') && (c <= '9')) {
noSign = true; // depends on control dependency: [if], data = [none]
} else {
done = true; // depends on control dependency: [if], data = [none]
break;
}
this.offset++; // depends on control dependency: [while], data = [none]
}
if (done) {
return getAppended(builder, start, this.offset); // depends on control dependency: [if], data = [none]
}
int len = this.offset - start;
if (len > 0) {
builder = append(builder, start, this.offset); // depends on control dependency: [if], data = [none]
}
if (done || !fill()) {
if (builder == null) {
throw new IllegalStateException("Invalid character for decimal number: " + c);
}
return builder.toString(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void makeUniqueTimeCoordinate2D(NetcdfFile ncfile, Group g, CoordinateTime2D time2D) {
CoordinateRuntime runtime = time2D.getRuntimeCoordinate();
int countU = 0;
for (int run = 0; run < time2D.getNruns(); run++) {
CoordinateTimeAbstract timeCoord = time2D.getTimeCoordinate(run);
countU += timeCoord.getSize();
}
int ntimes = countU;
String tcName = time2D.getName();
ncfile.addDimension(g, new Dimension(tcName, ntimes));
Variable v = ncfile
.addVariable(g, new Variable(ncfile, g, null, tcName, DataType.DOUBLE, tcName));
String units = runtime.getUnit(); // + " since " + runtime.getFirstDate();
v.addAttribute(new Attribute(CDM.UNITS, units));
v.addAttribute(new Attribute(CF.STANDARD_NAME, CF.TIME));
v.addAttribute(new Attribute(CDM.LONG_NAME, Grib.GRIB_VALID_TIME));
v.addAttribute(new Attribute(CF.CALENDAR, Calendar.proleptic_gregorian.toString()));
// the data is not generated until asked for to save space
if (!time2D.isTimeInterval()) {
v.setSPobject(new Time2Dinfo(Time2DinfoType.offU, time2D, null));
} else {
v.setSPobject(new Time2Dinfo(Time2DinfoType.intvU, time2D, null));
// bounds for intervals
String bounds_name = tcName + "_bounds";
Variable bounds = ncfile.addVariable(g,
new Variable(ncfile, g, null, bounds_name, DataType.DOUBLE, tcName + " 2"));
v.addAttribute(new Attribute(CF.BOUNDS, bounds_name));
bounds.addAttribute(new Attribute(CDM.UNITS, units));
bounds.addAttribute(new Attribute(CDM.LONG_NAME, "bounds for " + tcName));
bounds.setSPobject(new Time2Dinfo(Time2DinfoType.boundsU, time2D, null));
}
if (runtime.getNCoords() != 1) {
// for this case we have to generate a separate reftime, because have to use the same dimension
String refName = "ref" + tcName;
if (g.findVariable(refName) == null) {
Variable vref = ncfile
.addVariable(g, new Variable(ncfile, g, null, refName, DataType.DOUBLE, tcName));
vref.addAttribute(new Attribute(CF.STANDARD_NAME, CF.TIME_REFERENCE));
vref.addAttribute(new Attribute(CDM.LONG_NAME, Grib.GRIB_RUNTIME));
vref.addAttribute(new Attribute(CF.CALENDAR, Calendar.proleptic_gregorian.toString()));
vref.addAttribute(new Attribute(CDM.UNITS, units));
vref.setSPobject(new Time2Dinfo(Time2DinfoType.isUniqueRuntime, time2D, null));
}
}
} } | public class class_name {
private void makeUniqueTimeCoordinate2D(NetcdfFile ncfile, Group g, CoordinateTime2D time2D) {
CoordinateRuntime runtime = time2D.getRuntimeCoordinate();
int countU = 0;
for (int run = 0; run < time2D.getNruns(); run++) {
CoordinateTimeAbstract timeCoord = time2D.getTimeCoordinate(run);
countU += timeCoord.getSize(); // depends on control dependency: [for], data = [none]
}
int ntimes = countU;
String tcName = time2D.getName();
ncfile.addDimension(g, new Dimension(tcName, ntimes));
Variable v = ncfile
.addVariable(g, new Variable(ncfile, g, null, tcName, DataType.DOUBLE, tcName));
String units = runtime.getUnit(); // + " since " + runtime.getFirstDate();
v.addAttribute(new Attribute(CDM.UNITS, units));
v.addAttribute(new Attribute(CF.STANDARD_NAME, CF.TIME));
v.addAttribute(new Attribute(CDM.LONG_NAME, Grib.GRIB_VALID_TIME));
v.addAttribute(new Attribute(CF.CALENDAR, Calendar.proleptic_gregorian.toString()));
// the data is not generated until asked for to save space
if (!time2D.isTimeInterval()) {
v.setSPobject(new Time2Dinfo(Time2DinfoType.offU, time2D, null)); // depends on control dependency: [if], data = [none]
} else {
v.setSPobject(new Time2Dinfo(Time2DinfoType.intvU, time2D, null)); // depends on control dependency: [if], data = [none]
// bounds for intervals
String bounds_name = tcName + "_bounds";
Variable bounds = ncfile.addVariable(g,
new Variable(ncfile, g, null, bounds_name, DataType.DOUBLE, tcName + " 2"));
v.addAttribute(new Attribute(CF.BOUNDS, bounds_name)); // depends on control dependency: [if], data = [none]
bounds.addAttribute(new Attribute(CDM.UNITS, units)); // depends on control dependency: [if], data = [none]
bounds.addAttribute(new Attribute(CDM.LONG_NAME, "bounds for " + tcName)); // depends on control dependency: [if], data = [none]
bounds.setSPobject(new Time2Dinfo(Time2DinfoType.boundsU, time2D, null)); // depends on control dependency: [if], data = [none]
}
if (runtime.getNCoords() != 1) {
// for this case we have to generate a separate reftime, because have to use the same dimension
String refName = "ref" + tcName;
if (g.findVariable(refName) == null) {
Variable vref = ncfile
.addVariable(g, new Variable(ncfile, g, null, refName, DataType.DOUBLE, tcName));
vref.addAttribute(new Attribute(CF.STANDARD_NAME, CF.TIME_REFERENCE)); // depends on control dependency: [if], data = [none]
vref.addAttribute(new Attribute(CDM.LONG_NAME, Grib.GRIB_RUNTIME)); // depends on control dependency: [if], data = [none]
vref.addAttribute(new Attribute(CF.CALENDAR, Calendar.proleptic_gregorian.toString())); // depends on control dependency: [if], data = [none]
vref.addAttribute(new Attribute(CDM.UNITS, units)); // depends on control dependency: [if], data = [none]
vref.setSPobject(new Time2Dinfo(Time2DinfoType.isUniqueRuntime, time2D, null)); // depends on control dependency: [if], data = [null)]
}
}
} } |
public class class_name {
public static boolean contains2D(Coordinate[] coords, Coordinate coord) {
for (Coordinate coordinate : coords) {
if (coordinate.equals2D(coord)) {
return true;
}
}
return false;
} } | public class class_name {
public static boolean contains2D(Coordinate[] coords, Coordinate coord) {
for (Coordinate coordinate : coords) {
if (coordinate.equals2D(coord)) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
private void updateDates(Task parentTask)
{
if (parentTask.hasChildTasks())
{
int finished = 0;
Date plannedStartDate = parentTask.getStart();
Date plannedFinishDate = parentTask.getFinish();
Date actualStartDate = parentTask.getActualStart();
Date actualFinishDate = parentTask.getActualFinish();
Date earlyStartDate = parentTask.getEarlyStart();
Date earlyFinishDate = parentTask.getEarlyFinish();
Date lateStartDate = parentTask.getLateStart();
Date lateFinishDate = parentTask.getLateFinish();
for (Task task : parentTask.getChildTasks())
{
updateDates(task);
plannedStartDate = DateHelper.min(plannedStartDate, task.getStart());
plannedFinishDate = DateHelper.max(plannedFinishDate, task.getFinish());
actualStartDate = DateHelper.min(actualStartDate, task.getActualStart());
actualFinishDate = DateHelper.max(actualFinishDate, task.getActualFinish());
earlyStartDate = DateHelper.min(earlyStartDate, task.getEarlyStart());
earlyFinishDate = DateHelper.max(earlyFinishDate, task.getEarlyFinish());
lateStartDate = DateHelper.min(lateStartDate, task.getLateStart());
lateFinishDate = DateHelper.max(lateFinishDate, task.getLateFinish());
if (task.getActualFinish() != null)
{
++finished;
}
}
parentTask.setStart(plannedStartDate);
parentTask.setFinish(plannedFinishDate);
parentTask.setActualStart(actualStartDate);
parentTask.setEarlyStart(earlyStartDate);
parentTask.setEarlyFinish(earlyFinishDate);
parentTask.setLateStart(lateStartDate);
parentTask.setLateFinish(lateFinishDate);
//
// Only if all child tasks have actual finish dates do we
// set the actual finish date on the parent task.
//
if (finished == parentTask.getChildTasks().size())
{
parentTask.setActualFinish(actualFinishDate);
}
Duration duration = null;
if (plannedStartDate != null && plannedFinishDate != null)
{
duration = m_projectFile.getDefaultCalendar().getWork(plannedStartDate, plannedFinishDate, TimeUnit.DAYS);
parentTask.setDuration(duration);
}
}
} } | public class class_name {
private void updateDates(Task parentTask)
{
if (parentTask.hasChildTasks())
{
int finished = 0;
Date plannedStartDate = parentTask.getStart();
Date plannedFinishDate = parentTask.getFinish();
Date actualStartDate = parentTask.getActualStart();
Date actualFinishDate = parentTask.getActualFinish();
Date earlyStartDate = parentTask.getEarlyStart();
Date earlyFinishDate = parentTask.getEarlyFinish();
Date lateStartDate = parentTask.getLateStart();
Date lateFinishDate = parentTask.getLateFinish();
for (Task task : parentTask.getChildTasks())
{
updateDates(task); // depends on control dependency: [for], data = [task]
plannedStartDate = DateHelper.min(plannedStartDate, task.getStart()); // depends on control dependency: [for], data = [task]
plannedFinishDate = DateHelper.max(plannedFinishDate, task.getFinish()); // depends on control dependency: [for], data = [task]
actualStartDate = DateHelper.min(actualStartDate, task.getActualStart()); // depends on control dependency: [for], data = [task]
actualFinishDate = DateHelper.max(actualFinishDate, task.getActualFinish()); // depends on control dependency: [for], data = [task]
earlyStartDate = DateHelper.min(earlyStartDate, task.getEarlyStart()); // depends on control dependency: [for], data = [task]
earlyFinishDate = DateHelper.max(earlyFinishDate, task.getEarlyFinish()); // depends on control dependency: [for], data = [task]
lateStartDate = DateHelper.min(lateStartDate, task.getLateStart()); // depends on control dependency: [for], data = [task]
lateFinishDate = DateHelper.max(lateFinishDate, task.getLateFinish()); // depends on control dependency: [for], data = [task]
if (task.getActualFinish() != null)
{
++finished; // depends on control dependency: [if], data = [none]
}
}
parentTask.setStart(plannedStartDate); // depends on control dependency: [if], data = [none]
parentTask.setFinish(plannedFinishDate); // depends on control dependency: [if], data = [none]
parentTask.setActualStart(actualStartDate); // depends on control dependency: [if], data = [none]
parentTask.setEarlyStart(earlyStartDate); // depends on control dependency: [if], data = [none]
parentTask.setEarlyFinish(earlyFinishDate); // depends on control dependency: [if], data = [none]
parentTask.setLateStart(lateStartDate); // depends on control dependency: [if], data = [none]
parentTask.setLateFinish(lateFinishDate); // depends on control dependency: [if], data = [none]
//
// Only if all child tasks have actual finish dates do we
// set the actual finish date on the parent task.
//
if (finished == parentTask.getChildTasks().size())
{
parentTask.setActualFinish(actualFinishDate); // depends on control dependency: [if], data = [none]
}
Duration duration = null;
if (plannedStartDate != null && plannedFinishDate != null)
{
duration = m_projectFile.getDefaultCalendar().getWork(plannedStartDate, plannedFinishDate, TimeUnit.DAYS); // depends on control dependency: [if], data = [(plannedStartDate]
parentTask.setDuration(duration); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static StorageResourceId convertToDirectoryPath(StorageResourceId resourceId) {
if (resourceId.isStorageObject()) {
if (!objectHasDirectoryPath(resourceId.getObjectName())) {
resourceId = new StorageResourceId(
resourceId.getBucketName(), convertToDirectoryPath(resourceId.getObjectName()));
}
}
return resourceId;
} } | public class class_name {
public static StorageResourceId convertToDirectoryPath(StorageResourceId resourceId) {
if (resourceId.isStorageObject()) {
if (!objectHasDirectoryPath(resourceId.getObjectName())) {
resourceId = new StorageResourceId(
resourceId.getBucketName(), convertToDirectoryPath(resourceId.getObjectName())); // depends on control dependency: [if], data = [none]
}
}
return resourceId;
} } |
public class class_name {
public List<DateTimePeriod> toYears() {
ArrayList<DateTimePeriod> list = new ArrayList<DateTimePeriod>();
// default "current" year to start datetime
DateTime currentStart = getStart();
// calculate "next" year
DateTime nextStart = currentStart.plusYears(1);
// continue adding until we've reached the end
while (nextStart.isBefore(getEnd()) || nextStart.isEqual(getEnd())) {
// its okay to add the current
list.add(new DateTimeYear(currentStart, nextStart));
// increment both
currentStart = nextStart;
nextStart = currentStart.plusYears(1);
}
return list;
} } | public class class_name {
public List<DateTimePeriod> toYears() {
ArrayList<DateTimePeriod> list = new ArrayList<DateTimePeriod>();
// default "current" year to start datetime
DateTime currentStart = getStart();
// calculate "next" year
DateTime nextStart = currentStart.plusYears(1);
// continue adding until we've reached the end
while (nextStart.isBefore(getEnd()) || nextStart.isEqual(getEnd())) {
// its okay to add the current
list.add(new DateTimeYear(currentStart, nextStart)); // depends on control dependency: [while], data = [none]
// increment both
currentStart = nextStart; // depends on control dependency: [while], data = [none]
nextStart = currentStart.plusYears(1); // depends on control dependency: [while], data = [none]
}
return list;
} } |
public class class_name {
@Override
public int filterCountByG_T_E(long groupId, String type, boolean enabled) {
if (!InlineSQLHelperUtil.isEnabled(groupId)) {
return countByG_T_E(groupId, type, enabled);
}
StringBundler query = new StringBundler(4);
query.append(_FILTER_SQL_COUNT_COMMERCENOTIFICATIONTEMPLATE_WHERE);
query.append(_FINDER_COLUMN_G_T_E_GROUPID_2);
boolean bindType = false;
if (type == null) {
query.append(_FINDER_COLUMN_G_T_E_TYPE_1_SQL);
}
else if (type.equals("")) {
query.append(_FINDER_COLUMN_G_T_E_TYPE_3_SQL);
}
else {
bindType = true;
query.append(_FINDER_COLUMN_G_T_E_TYPE_2_SQL);
}
query.append(_FINDER_COLUMN_G_T_E_ENABLED_2);
String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
CommerceNotificationTemplate.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
Session session = null;
try {
session = openSession();
SQLQuery q = session.createSynchronizedSQLQuery(sql);
q.addScalar(COUNT_COLUMN_NAME,
com.liferay.portal.kernel.dao.orm.Type.LONG);
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId);
if (bindType) {
qPos.add(type);
}
qPos.add(enabled);
Long count = (Long)q.uniqueResult();
return count.intValue();
}
catch (Exception e) {
throw processException(e);
}
finally {
closeSession(session);
}
} } | public class class_name {
@Override
public int filterCountByG_T_E(long groupId, String type, boolean enabled) {
if (!InlineSQLHelperUtil.isEnabled(groupId)) {
return countByG_T_E(groupId, type, enabled); // depends on control dependency: [if], data = [none]
}
StringBundler query = new StringBundler(4);
query.append(_FILTER_SQL_COUNT_COMMERCENOTIFICATIONTEMPLATE_WHERE);
query.append(_FINDER_COLUMN_G_T_E_GROUPID_2);
boolean bindType = false;
if (type == null) {
query.append(_FINDER_COLUMN_G_T_E_TYPE_1_SQL); // depends on control dependency: [if], data = [none]
}
else if (type.equals("")) {
query.append(_FINDER_COLUMN_G_T_E_TYPE_3_SQL); // depends on control dependency: [if], data = [none]
}
else {
bindType = true; // depends on control dependency: [if], data = [none]
query.append(_FINDER_COLUMN_G_T_E_TYPE_2_SQL); // depends on control dependency: [if], data = [none]
}
query.append(_FINDER_COLUMN_G_T_E_ENABLED_2);
String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
CommerceNotificationTemplate.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
Session session = null;
try {
session = openSession(); // depends on control dependency: [try], data = [none]
SQLQuery q = session.createSynchronizedSQLQuery(sql);
q.addScalar(COUNT_COLUMN_NAME,
com.liferay.portal.kernel.dao.orm.Type.LONG); // depends on control dependency: [try], data = [none]
QueryPos qPos = QueryPos.getInstance(q);
qPos.add(groupId); // depends on control dependency: [try], data = [none]
if (bindType) {
qPos.add(type); // depends on control dependency: [if], data = [none]
}
qPos.add(enabled); // depends on control dependency: [try], data = [none]
Long count = (Long)q.uniqueResult();
return count.intValue(); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw processException(e);
} // depends on control dependency: [catch], data = [none]
finally {
closeSession(session);
}
} } |
public class class_name {
public static Query toQuery(Object o) throws PageException {
if (o instanceof Query) return (Query) o;
if (o instanceof ObjectWrap) {
return toQuery(((ObjectWrap) o).getEmbededObject());
}
if (o instanceof ResultSet) return new QueryImpl((ResultSet) o, "query", ThreadLocalPageContext.getTimeZone());
if (o instanceof Component) {
Member member = ((Component) o).getMember(Component.ACCESS_PRIVATE, KeyConstants.__toQuery, false, false);
if (member instanceof UDFPlus) {
UDFPlus udf = (UDFPlus) member;
if (udf.getReturnType() == CFTypes.TYPE_QUERY && udf.getFunctionArguments().length == 0) {
return Caster.toQuery(((Component) o).call(ThreadLocalPageContext.get(), KeyConstants.__toQuery, new Object[] {}));
}
}
}
throw new CasterException(o, "query");
} } | public class class_name {
public static Query toQuery(Object o) throws PageException {
if (o instanceof Query) return (Query) o;
if (o instanceof ObjectWrap) {
return toQuery(((ObjectWrap) o).getEmbededObject());
}
if (o instanceof ResultSet) return new QueryImpl((ResultSet) o, "query", ThreadLocalPageContext.getTimeZone());
if (o instanceof Component) {
Member member = ((Component) o).getMember(Component.ACCESS_PRIVATE, KeyConstants.__toQuery, false, false);
if (member instanceof UDFPlus) {
UDFPlus udf = (UDFPlus) member;
if (udf.getReturnType() == CFTypes.TYPE_QUERY && udf.getFunctionArguments().length == 0) {
return Caster.toQuery(((Component) o).call(ThreadLocalPageContext.get(), KeyConstants.__toQuery, new Object[] {})); // depends on control dependency: [if], data = [none]
}
}
}
throw new CasterException(o, "query");
} } |
public class class_name {
public String getPath(CodeType codeType, boolean bPackagePath)
{
String strSrcPath = DBConstants.BLANK;
if (!bPackagePath)
strSrcPath = this.getField(ClassProject.NAME).toString();
String pathChar = bPackagePath ? "." : "/";
switch (codeType)
{
case THICK:
if (!bPackagePath) if (!this.getField(ClassProject.PROJECT_PATH).isNull())
strSrcPath = this.getField(ClassProject.PROJECT_PATH).toString();
if (bPackagePath) if (!this.getField(ClassProject.PACKAGE_NAME).isNull())
strSrcPath = this.getField(ClassProject.PACKAGE_NAME).toString();
break;
case THIN:
if (!bPackagePath) if (!this.getField(ClassProject.THIN_PROJECT_PATH).isNull())
strSrcPath = this.getField(ClassProject.THIN_PROJECT_PATH).toString();
if (bPackagePath) if (!this.getField(ClassProject.THIN_PACKAGE).isNull())
strSrcPath = this.getField(ClassProject.THIN_PACKAGE).toString();
break;
case RESOURCE_PROPERTIES:
case RESOURCE_CODE:
if (!bPackagePath) if (!this.getField(ClassProject.RES_PROJECT_PATH).isNull())
strSrcPath = this.getField(ClassProject.RES_PROJECT_PATH).toString();
if (bPackagePath) if (!this.getField(ClassProject.RESOURCE_PACKAGE).isNull())
strSrcPath = this.getField(ClassProject.RESOURCE_PACKAGE).toString();
break;
case INTERFACE:
if (!bPackagePath) if (!this.getField(ClassProject.INTERFACE_PROJECT_PATH).isNull())
strSrcPath = this.getField(ClassProject.INTERFACE_PROJECT_PATH).toString();
if (bPackagePath) if (!this.getField(ClassProject.INTERFACE_PACKAGE).isNull())
strSrcPath = this.getField(ClassProject.INTERFACE_PACKAGE).toString();
break;
}
if (strSrcPath == null)
strSrcPath = DBConstants.BLANK;
if (this.getField(ClassProject.PARENT_FOLDER_ID).getValue() != 0)
{ // Continue up the chain
ClassProject classProject = (ClassProject)((ReferenceField)this.getField(ClassProject.PARENT_FOLDER_ID)).getReference();
if (classProject != null)
if ((classProject.getEditMode() == DBConstants.EDIT_CURRENT) || (classProject.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
{
String basePath = classProject.getPath(codeType, bPackagePath);
if (basePath != null) if (basePath.length() > 0)
{
if (".".equals(pathChar))
if ((strSrcPath.length() > 0) && (!strSrcPath.startsWith(".")))
basePath = DBConstants.BLANK; // The src path is not relative, start at the root
if ((basePath.endsWith(pathChar)) || (basePath.length() == 0))
pathChar = DBConstants.BLANK;
if (pathChar.length() > 0)
{
if (strSrcPath.startsWith(pathChar))
strSrcPath = strSrcPath.substring(1);
if (basePath.endsWith(pathChar))
basePath = basePath.substring(0, basePath.length() - 1);
}
if ((strSrcPath.length() == 0) || (basePath.length() == 0))
pathChar = DBConstants.BLANK;
strSrcPath = basePath + pathChar + strSrcPath;
}
}
}
if (!bPackagePath)
{
strSrcPath = Utility.replaceResources(strSrcPath, null, null, this.getRecordOwner());
try {
strSrcPath = Utility.replaceResources(strSrcPath, null, Utility.propertiesToMap(System.getProperties()), null);
} catch (SecurityException e) {
// Ignore
}
strSrcPath = Utility.normalizePath(strSrcPath);
}
return strSrcPath;
} } | public class class_name {
public String getPath(CodeType codeType, boolean bPackagePath)
{
String strSrcPath = DBConstants.BLANK;
if (!bPackagePath)
strSrcPath = this.getField(ClassProject.NAME).toString();
String pathChar = bPackagePath ? "." : "/";
switch (codeType)
{
case THICK:
if (!bPackagePath) if (!this.getField(ClassProject.PROJECT_PATH).isNull())
strSrcPath = this.getField(ClassProject.PROJECT_PATH).toString();
if (bPackagePath) if (!this.getField(ClassProject.PACKAGE_NAME).isNull())
strSrcPath = this.getField(ClassProject.PACKAGE_NAME).toString();
break;
case THIN:
if (!bPackagePath) if (!this.getField(ClassProject.THIN_PROJECT_PATH).isNull())
strSrcPath = this.getField(ClassProject.THIN_PROJECT_PATH).toString();
if (bPackagePath) if (!this.getField(ClassProject.THIN_PACKAGE).isNull())
strSrcPath = this.getField(ClassProject.THIN_PACKAGE).toString();
break;
case RESOURCE_PROPERTIES:
case RESOURCE_CODE:
if (!bPackagePath) if (!this.getField(ClassProject.RES_PROJECT_PATH).isNull())
strSrcPath = this.getField(ClassProject.RES_PROJECT_PATH).toString();
if (bPackagePath) if (!this.getField(ClassProject.RESOURCE_PACKAGE).isNull())
strSrcPath = this.getField(ClassProject.RESOURCE_PACKAGE).toString();
break;
case INTERFACE:
if (!bPackagePath) if (!this.getField(ClassProject.INTERFACE_PROJECT_PATH).isNull())
strSrcPath = this.getField(ClassProject.INTERFACE_PROJECT_PATH).toString();
if (bPackagePath) if (!this.getField(ClassProject.INTERFACE_PACKAGE).isNull())
strSrcPath = this.getField(ClassProject.INTERFACE_PACKAGE).toString();
break;
}
if (strSrcPath == null)
strSrcPath = DBConstants.BLANK;
if (this.getField(ClassProject.PARENT_FOLDER_ID).getValue() != 0)
{ // Continue up the chain
ClassProject classProject = (ClassProject)((ReferenceField)this.getField(ClassProject.PARENT_FOLDER_ID)).getReference();
if (classProject != null)
if ((classProject.getEditMode() == DBConstants.EDIT_CURRENT) || (classProject.getEditMode() == DBConstants.EDIT_IN_PROGRESS))
{
String basePath = classProject.getPath(codeType, bPackagePath);
if (basePath != null) if (basePath.length() > 0)
{
if (".".equals(pathChar))
if ((strSrcPath.length() > 0) && (!strSrcPath.startsWith(".")))
basePath = DBConstants.BLANK; // The src path is not relative, start at the root
if ((basePath.endsWith(pathChar)) || (basePath.length() == 0))
pathChar = DBConstants.BLANK;
if (pathChar.length() > 0)
{
if (strSrcPath.startsWith(pathChar))
strSrcPath = strSrcPath.substring(1);
if (basePath.endsWith(pathChar))
basePath = basePath.substring(0, basePath.length() - 1);
}
if ((strSrcPath.length() == 0) || (basePath.length() == 0))
pathChar = DBConstants.BLANK;
strSrcPath = basePath + pathChar + strSrcPath; // depends on control dependency: [if], data = [none]
}
}
}
if (!bPackagePath)
{
strSrcPath = Utility.replaceResources(strSrcPath, null, null, this.getRecordOwner());
try {
strSrcPath = Utility.replaceResources(strSrcPath, null, Utility.propertiesToMap(System.getProperties()), null);
} catch (SecurityException e) {
// Ignore
}
strSrcPath = Utility.normalizePath(strSrcPath);
}
return strSrcPath;
} } |
public class class_name {
public void add(OnLineStatistics B)
{
final OnLineStatistics A = this;
//XXX double compare.
if(A.n == B.n && B.n == 0)
return;//nothing to do!
else if(B.n == 0)
return;//still nothing!
else if (A.n == 0)
{
this.n = B.n;
this.mean = B.mean;
this.m2 = B.m2;
this.m3 = B.m3;
this.m4 = B.m4;
this.min = B.min;
this.max = B.max;
return;
}
double nX = B.n + A.n;
double nXsqrd = nX*nX;
double nAnB = B.n*A.n;
double AnSqrd = A.n*A.n;
double BnSqrd = B.n*B.n;
double delta = B.mean - A.mean;
double deltaSqrd = delta*delta;
double deltaCbd = deltaSqrd*delta;
double deltaQad = deltaSqrd*deltaSqrd;
double newMean = (A.n* A.mean + B.n * B.mean)/(A.n + B.n);
double newM2 = A.m2 + B.m2 + deltaSqrd / nX *nAnB;
double newM3 = A.m3 + B.m3 + deltaCbd* nAnB*(A.n - B.n) / nXsqrd + 3 * delta * (A.n * B.m2 - B.n * A.m2)/nX;
double newM4 = A.m4 + B.m4
+ deltaQad * (nAnB*(AnSqrd - nAnB + BnSqrd)/(nXsqrd*nX))
+ 6 * deltaSqrd*(AnSqrd*B.m2 + BnSqrd*A.m2)/nXsqrd
+ 4 * delta *(A.n*B.m3 - B.n*A.m3)/nX;
this.n = nX;
this.mean = newMean;
this.m2 = newM2;
this.m3 = newM3;
this.m4 = newM4;
this.min = Math.min(A.min, B.min);
this.max = Math.max(A.max, B.max);
} } | public class class_name {
public void add(OnLineStatistics B)
{
final OnLineStatistics A = this;
//XXX double compare.
if(A.n == B.n && B.n == 0)
return;//nothing to do!
else if(B.n == 0)
return;//still nothing!
else if (A.n == 0)
{
this.n = B.n; // depends on control dependency: [if], data = [none]
this.mean = B.mean; // depends on control dependency: [if], data = [none]
this.m2 = B.m2; // depends on control dependency: [if], data = [none]
this.m3 = B.m3; // depends on control dependency: [if], data = [none]
this.m4 = B.m4; // depends on control dependency: [if], data = [none]
this.min = B.min; // depends on control dependency: [if], data = [none]
this.max = B.max; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
double nX = B.n + A.n;
double nXsqrd = nX*nX;
double nAnB = B.n*A.n;
double AnSqrd = A.n*A.n;
double BnSqrd = B.n*B.n;
double delta = B.mean - A.mean;
double deltaSqrd = delta*delta;
double deltaCbd = deltaSqrd*delta;
double deltaQad = deltaSqrd*deltaSqrd;
double newMean = (A.n* A.mean + B.n * B.mean)/(A.n + B.n);
double newM2 = A.m2 + B.m2 + deltaSqrd / nX *nAnB;
double newM3 = A.m3 + B.m3 + deltaCbd* nAnB*(A.n - B.n) / nXsqrd + 3 * delta * (A.n * B.m2 - B.n * A.m2)/nX;
double newM4 = A.m4 + B.m4
+ deltaQad * (nAnB*(AnSqrd - nAnB + BnSqrd)/(nXsqrd*nX))
+ 6 * deltaSqrd*(AnSqrd*B.m2 + BnSqrd*A.m2)/nXsqrd
+ 4 * delta *(A.n*B.m3 - B.n*A.m3)/nX;
this.n = nX;
this.mean = newMean;
this.m2 = newM2;
this.m3 = newM3;
this.m4 = newM4;
this.min = Math.min(A.min, B.min);
this.max = Math.max(A.max, B.max);
} } |
public class class_name {
public E extractMin() {
if (size == 0) {
throw new NoSuchElementException();
}
E result = storage.array[0];
size--;
if (size > 0) {
storage.array[0] = storage.array[size];
downHeap();
}
storage.array[size] = null;
return result;
} } | public class class_name {
public E extractMin() {
if (size == 0) {
throw new NoSuchElementException();
}
E result = storage.array[0];
size--;
if (size > 0) {
storage.array[0] = storage.array[size]; // depends on control dependency: [if], data = [none]
downHeap(); // depends on control dependency: [if], data = [none]
}
storage.array[size] = null;
return result;
} } |
public class class_name {
private Scope createLoopNode(Node loopLabel, int lineno) {
Scope result = createScopeNode(Token.LOOP, lineno);
if (loopLabel != null) {
((Jump)loopLabel).setLoop(result);
}
return result;
} } | public class class_name {
private Scope createLoopNode(Node loopLabel, int lineno) {
Scope result = createScopeNode(Token.LOOP, lineno);
if (loopLabel != null) {
((Jump)loopLabel).setLoop(result); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
void commit() {
if (connection != null) {
try {
connection.commit();
} catch (SQLException e) {
throw new UroborosqlSQLException(e);
}
}
clearState();
} } | public class class_name {
void commit() {
if (connection != null) {
try {
connection.commit(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new UroborosqlSQLException(e);
} // depends on control dependency: [catch], data = [none]
}
clearState();
} } |
public class class_name {
public void run() {
// For log messages.
String client = socket.getInetAddress().getHostAddress();
if(log.isDebugEnabled()) {
log.info("Accepted Connection From: " + client);
}
PrintWriter out = null;
BufferedReader in = null;
try {
// Set timeout to 1 second.
socket.setSoTimeout(1000);
out = new PrintWriter(socket.getOutputStream(), true);
in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
String inputLine = in.readLine();
// Fix for zabbix_get.
if(inputLine.substring(0, 4).equals("ZBXD")) {
inputLine = inputLine.substring(13, inputLine.length());
}
if(inputLine != null) {
try {
Object value = container.getMetric(inputLine);
out.print(value.toString());
out.flush();
} catch(MetricsException me) {
if(log.isErrorEnabled()) {
log.error("Client: " + client + " Sent Unknown Key: " + inputLine);
}
out.print("ZBX_NOTSUPPORTED");
out.flush();
}
}
} catch(SocketTimeoutException ste) {
log.debug(client + ": Timeout Detected.");
} catch(Exception e) {
log.error(client + ": Error: " + e.toString());
} finally {
if(log.isDebugEnabled()) {
log.debug(client + ": Disconnected.");
}
try { if(in != null) { in.close(); } } catch(Exception e) { }
try { if(out != null) { out.close(); } } catch(Exception e) { }
try { socket.close(); } catch(Exception e) { }
}
} } | public class class_name {
public void run() {
// For log messages.
String client = socket.getInetAddress().getHostAddress();
if(log.isDebugEnabled()) {
log.info("Accepted Connection From: " + client); // depends on control dependency: [if], data = [none]
}
PrintWriter out = null;
BufferedReader in = null;
try {
// Set timeout to 1 second.
socket.setSoTimeout(1000); // depends on control dependency: [try], data = [none]
out = new PrintWriter(socket.getOutputStream(), true); // depends on control dependency: [try], data = [none]
in = new BufferedReader(new InputStreamReader(socket.getInputStream())); // depends on control dependency: [try], data = [none]
String inputLine = in.readLine();
// Fix for zabbix_get.
if(inputLine.substring(0, 4).equals("ZBXD")) {
inputLine = inputLine.substring(13, inputLine.length()); // depends on control dependency: [if], data = [none]
}
if(inputLine != null) {
try {
Object value = container.getMetric(inputLine);
out.print(value.toString()); // depends on control dependency: [try], data = [none]
out.flush(); // depends on control dependency: [try], data = [none]
} catch(MetricsException me) {
if(log.isErrorEnabled()) {
log.error("Client: " + client + " Sent Unknown Key: " + inputLine); // depends on control dependency: [if], data = [none]
}
out.print("ZBX_NOTSUPPORTED");
out.flush();
} // depends on control dependency: [catch], data = [none]
}
} catch(SocketTimeoutException ste) {
log.debug(client + ": Timeout Detected.");
} catch(Exception e) { // depends on control dependency: [catch], data = [none]
log.error(client + ": Error: " + e.toString());
} finally { // depends on control dependency: [catch], data = [none]
if(log.isDebugEnabled()) {
log.debug(client + ": Disconnected."); // depends on control dependency: [if], data = [none]
}
try { if(in != null) { in.close(); } } catch(Exception e) { } // depends on control dependency: [catch], data = [none] // depends on control dependency: [if], data = [none]
try { if(out != null) { out.close(); } } catch(Exception e) { } // depends on control dependency: [catch], data = [none] // depends on control dependency: [if], data = [none]
try { socket.close(); } catch(Exception e) { } // depends on control dependency: [try], data = [none] // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static int [] createRemapTable(String [] controlFields, String [] remappedFields) {
// create hash map with remapped fields
HashMap<String,Integer> map = new HashMap<String, Integer>();
for (int index = 0; index < remappedFields.length; index++) {
String field = remappedFields[index];
map.put(field, index);
}
// create remap table
int remap [] = new int[controlFields.length];
for (int index = 0; index < controlFields.length; index++) {
Integer remapIndex = map.get(controlFields[index]);
if(remapIndex == null) {
// no match
remapIndex = -1;
}
remap[index] = remapIndex;
}
return remap;
} } | public class class_name {
public static int [] createRemapTable(String [] controlFields, String [] remappedFields) {
// create hash map with remapped fields
HashMap<String,Integer> map = new HashMap<String, Integer>();
for (int index = 0; index < remappedFields.length; index++) {
String field = remappedFields[index];
map.put(field, index); // depends on control dependency: [for], data = [index]
}
// create remap table
int remap [] = new int[controlFields.length];
for (int index = 0; index < controlFields.length; index++) {
Integer remapIndex = map.get(controlFields[index]);
if(remapIndex == null) {
// no match
remapIndex = -1; // depends on control dependency: [if], data = [none]
}
remap[index] = remapIndex; // depends on control dependency: [for], data = [index]
}
return remap;
} } |
public class class_name {
private ITextEditor getEditor(IWorkbenchPart part)
{
if (part instanceof ITextEditor)
{
ITextEditor editorPart = (ITextEditor) part;
IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class);
if (resource != null && resource instanceof IFile)
{
return editorPart;
// IFile file = (IFile) resource;
// try
// {
// String contentTypeId = file.getContentDescription().getContentType().getId();
// if (SourceViewerEditorManager.getInstance().getContentTypeIds().contains(contentTypeId))
// {
// return editorPart;
// }
// } catch (CoreException e)
// {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
}
return null;
} } | public class class_name {
private ITextEditor getEditor(IWorkbenchPart part)
{
if (part instanceof ITextEditor)
{
ITextEditor editorPart = (ITextEditor) part;
IResource resource = (IResource) editorPart.getEditorInput().getAdapter(IResource.class);
if (resource != null && resource instanceof IFile)
{
return editorPart; // depends on control dependency: [if], data = [none]
// IFile file = (IFile) resource;
// try
// {
// String contentTypeId = file.getContentDescription().getContentType().getId();
// if (SourceViewerEditorManager.getInstance().getContentTypeIds().contains(contentTypeId))
// {
// return editorPart;
// }
// } catch (CoreException e)
// {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
}
return null;
} } |
public class class_name {
public static HashMap<String, String> createEvent(HashMap data, String typeStr, String dap, HashMap<String, String> info, boolean isStrictID) {
HashMap newEvent = new HashMap<String, String>();
EventType type;
try {
type = EventType.valueOf(typeStr.toUpperCase());
typeStr = type.toString().toLowerCase();
} catch (IllegalArgumentException e) {
LOG.error("{} event is not recognized, please try other event name", typeStr);
return new HashMap<String, String>();
} catch (Exception e) {
LOG.error(getStackTrace(e));
return new HashMap<String, String>();
}
newEvent.put("event", typeStr);
String pdate = getFstPdate(data, "");
if (!pdate.equals("")) {
String date = dateOffset(pdate, dap);
if (date != null) {
newEvent.put("date", date);
} else {
LOG.error("Given days after planting has a invalid value {}", dap);
return new HashMap<String, String>();
}
} else {
LOG.error("Planting date is not available in the given data set");
return new HashMap<String, String>();
}
if (isStrictID) {
String[] ids = info.keySet().toArray(new String[0]);
for (String id : ids) {
String path = AcePathfinder.INSTANCE.getPath(id);
if (path == null || !path.contains(typeStr)) {
LOG.warn("{} is not belong to {} event, please check if it is a typo");
// info.remove(id);
}
}
}
newEvent.putAll(info);
return newEvent;
} } | public class class_name {
public static HashMap<String, String> createEvent(HashMap data, String typeStr, String dap, HashMap<String, String> info, boolean isStrictID) {
HashMap newEvent = new HashMap<String, String>();
EventType type;
try {
type = EventType.valueOf(typeStr.toUpperCase()); // depends on control dependency: [try], data = [none]
typeStr = type.toString().toLowerCase(); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
LOG.error("{} event is not recognized, please try other event name", typeStr);
return new HashMap<String, String>();
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
LOG.error(getStackTrace(e));
return new HashMap<String, String>();
} // depends on control dependency: [catch], data = [none]
newEvent.put("event", typeStr);
String pdate = getFstPdate(data, "");
if (!pdate.equals("")) {
String date = dateOffset(pdate, dap);
if (date != null) {
newEvent.put("date", date); // depends on control dependency: [if], data = [none]
} else {
LOG.error("Given days after planting has a invalid value {}", dap); // depends on control dependency: [if], data = [none]
return new HashMap<String, String>(); // depends on control dependency: [if], data = [none]
}
} else {
LOG.error("Planting date is not available in the given data set"); // depends on control dependency: [if], data = [none]
return new HashMap<String, String>(); // depends on control dependency: [if], data = [none]
}
if (isStrictID) {
String[] ids = info.keySet().toArray(new String[0]);
for (String id : ids) {
String path = AcePathfinder.INSTANCE.getPath(id);
if (path == null || !path.contains(typeStr)) {
LOG.warn("{} is not belong to {} event, please check if it is a typo"); // depends on control dependency: [if], data = [none]
// info.remove(id);
}
}
}
newEvent.putAll(info);
return newEvent;
} } |
public class class_name {
public static void parse(
final String pattern, final List patternConverters,
final List formattingInfos, final Map converterRegistry, final Map rules) {
if (pattern == null) {
throw new NullPointerException("pattern");
}
StringBuffer currentLiteral = new StringBuffer(32);
int patternLength = pattern.length();
int state = LITERAL_STATE;
char c;
int i = 0;
ExtrasFormattingInfo formattingInfo = ExtrasFormattingInfo.getDefault();
while (i < patternLength) {
c = pattern.charAt(i++);
switch (state) {
case LITERAL_STATE:
// In literal state, the last char is always a literal.
if (i == patternLength) {
currentLiteral.append(c);
continue;
}
if (c == ESCAPE_CHAR) {
// peek at the next char.
switch (pattern.charAt(i)) {
case ESCAPE_CHAR:
currentLiteral.append(c);
i++; // move pointer
break;
default:
if (currentLiteral.length() != 0) {
patternConverters.add(
new LiteralPatternConverter(currentLiteral.toString()));
formattingInfos.add(ExtrasFormattingInfo.getDefault());
}
currentLiteral.setLength(0);
currentLiteral.append(c); // append %
state = CONVERTER_STATE;
formattingInfo = ExtrasFormattingInfo.getDefault();
}
} else {
currentLiteral.append(c);
}
break;
case CONVERTER_STATE:
currentLiteral.append(c);
switch (c) {
case '-':
formattingInfo =
new ExtrasFormattingInfo(
true,
formattingInfo.isRightTruncated(),
formattingInfo.getMinLength(),
formattingInfo.getMaxLength());
break;
case '!':
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
true,
formattingInfo.getMinLength(),
formattingInfo.getMaxLength());
break;
case '.':
state = DOT_STATE;
break;
default:
if ((c >= '0') && (c <= '9')) {
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
formattingInfo.isRightTruncated(),
c - '0',
formattingInfo.getMaxLength());
state = MIN_STATE;
} else {
i = finalizeConverter(
c, pattern, i, currentLiteral, formattingInfo,
converterRegistry, rules, patternConverters, formattingInfos);
// Next pattern is assumed to be a literal.
state = LITERAL_STATE;
formattingInfo = ExtrasFormattingInfo.getDefault();
currentLiteral.setLength(0);
}
} // switch
break;
case MIN_STATE:
currentLiteral.append(c);
if ((c >= '0') && (c <= '9')) {
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
formattingInfo.isRightTruncated(),
(formattingInfo.getMinLength() * 10) + (c - '0'),
formattingInfo.getMaxLength());
} else if (c == '.') {
state = DOT_STATE;
} else {
i = finalizeConverter(
c, pattern, i, currentLiteral, formattingInfo,
converterRegistry, rules, patternConverters, formattingInfos);
state = LITERAL_STATE;
formattingInfo = ExtrasFormattingInfo.getDefault();
currentLiteral.setLength(0);
}
break;
case DOT_STATE:
currentLiteral.append(c);
if ((c >= '0') && (c <= '9')) {
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
formattingInfo.isRightTruncated(),
formattingInfo.getMinLength(),
c - '0');
state = MAX_STATE;
} else {
LogLog.error(
"Error occured in position " + i
+ ".\n Was expecting digit, instead got char \"" + c + "\".");
state = LITERAL_STATE;
}
break;
case MAX_STATE:
currentLiteral.append(c);
if ((c >= '0') && (c <= '9')) {
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
formattingInfo.isRightTruncated(),
formattingInfo.getMinLength(),
(formattingInfo.getMaxLength() * 10) + (c - '0'));
} else {
i = finalizeConverter(
c, pattern, i, currentLiteral, formattingInfo,
converterRegistry, rules, patternConverters, formattingInfos);
state = LITERAL_STATE;
formattingInfo = ExtrasFormattingInfo.getDefault();
currentLiteral.setLength(0);
}
break;
} // switch
}
// while
if (currentLiteral.length() != 0) {
patternConverters.add(
new LiteralPatternConverter(currentLiteral.toString()));
formattingInfos.add(ExtrasFormattingInfo.getDefault());
}
} } | public class class_name {
public static void parse(
final String pattern, final List patternConverters,
final List formattingInfos, final Map converterRegistry, final Map rules) {
if (pattern == null) {
throw new NullPointerException("pattern");
}
StringBuffer currentLiteral = new StringBuffer(32);
int patternLength = pattern.length();
int state = LITERAL_STATE;
char c;
int i = 0;
ExtrasFormattingInfo formattingInfo = ExtrasFormattingInfo.getDefault();
while (i < patternLength) {
c = pattern.charAt(i++); // depends on control dependency: [while], data = [(i]
switch (state) {
case LITERAL_STATE:
// In literal state, the last char is always a literal.
if (i == patternLength) {
currentLiteral.append(c); // depends on control dependency: [if], data = [none]
continue;
}
if (c == ESCAPE_CHAR) {
// peek at the next char.
switch (pattern.charAt(i)) {
case ESCAPE_CHAR:
currentLiteral.append(c);
i++; // move pointer
break;
default:
if (currentLiteral.length() != 0) {
patternConverters.add(
new LiteralPatternConverter(currentLiteral.toString())); // depends on control dependency: [if], data = [none]
formattingInfos.add(ExtrasFormattingInfo.getDefault()); // depends on control dependency: [if], data = [none]
}
currentLiteral.setLength(0);
currentLiteral.append(c); // append %
state = CONVERTER_STATE;
formattingInfo = ExtrasFormattingInfo.getDefault();
}
} else {
currentLiteral.append(c); // depends on control dependency: [if], data = [(c]
}
break;
case CONVERTER_STATE:
currentLiteral.append(c);
switch (c) {
case '-':
formattingInfo =
new ExtrasFormattingInfo(
true,
formattingInfo.isRightTruncated(),
formattingInfo.getMinLength(),
formattingInfo.getMaxLength());
break;
case '!':
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
true,
formattingInfo.getMinLength(),
formattingInfo.getMaxLength());
break;
case '.':
state = DOT_STATE;
break;
default:
if ((c >= '0') && (c <= '9')) {
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
formattingInfo.isRightTruncated(),
c - '0',
formattingInfo.getMaxLength()); // depends on control dependency: [if], data = [none]
state = MIN_STATE; // depends on control dependency: [if], data = [none]
} else {
i = finalizeConverter(
c, pattern, i, currentLiteral, formattingInfo,
converterRegistry, rules, patternConverters, formattingInfos); // depends on control dependency: [if], data = [none]
// Next pattern is assumed to be a literal.
state = LITERAL_STATE; // depends on control dependency: [if], data = [none]
formattingInfo = ExtrasFormattingInfo.getDefault(); // depends on control dependency: [if], data = [none]
currentLiteral.setLength(0); // depends on control dependency: [if], data = [none]
}
} // switch
break;
case MIN_STATE:
currentLiteral.append(c);
if ((c >= '0') && (c <= '9')) {
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
formattingInfo.isRightTruncated(),
(formattingInfo.getMinLength() * 10) + (c - '0'),
formattingInfo.getMaxLength()); // depends on control dependency: [if], data = [none]
} else if (c == '.') {
state = DOT_STATE; // depends on control dependency: [if], data = [none]
} else {
i = finalizeConverter(
c, pattern, i, currentLiteral, formattingInfo,
converterRegistry, rules, patternConverters, formattingInfos); // depends on control dependency: [if], data = [none]
state = LITERAL_STATE; // depends on control dependency: [if], data = [none]
formattingInfo = ExtrasFormattingInfo.getDefault(); // depends on control dependency: [if], data = [none]
currentLiteral.setLength(0); // depends on control dependency: [if], data = [none]
}
break;
case DOT_STATE:
currentLiteral.append(c);
if ((c >= '0') && (c <= '9')) {
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
formattingInfo.isRightTruncated(),
formattingInfo.getMinLength(),
c - '0'); // depends on control dependency: [if], data = [none]
state = MAX_STATE; // depends on control dependency: [if], data = [none]
} else {
LogLog.error(
"Error occured in position " + i
+ ".\n Was expecting digit, instead got char \"" + c + "\"."); // depends on control dependency: [if], data = [none]
state = LITERAL_STATE; // depends on control dependency: [if], data = [none]
}
break;
case MAX_STATE:
currentLiteral.append(c);
if ((c >= '0') && (c <= '9')) {
formattingInfo =
new ExtrasFormattingInfo(
formattingInfo.isLeftAligned(),
formattingInfo.isRightTruncated(),
formattingInfo.getMinLength(),
(formattingInfo.getMaxLength() * 10) + (c - '0')); // depends on control dependency: [if], data = [none]
} else {
i = finalizeConverter(
c, pattern, i, currentLiteral, formattingInfo,
converterRegistry, rules, patternConverters, formattingInfos); // depends on control dependency: [if], data = [none]
state = LITERAL_STATE; // depends on control dependency: [if], data = [none]
formattingInfo = ExtrasFormattingInfo.getDefault(); // depends on control dependency: [if], data = [none]
currentLiteral.setLength(0); // depends on control dependency: [if], data = [none]
}
break;
} // switch
}
// while
if (currentLiteral.length() != 0) {
patternConverters.add(
new LiteralPatternConverter(currentLiteral.toString())); // depends on control dependency: [if], data = [none]
formattingInfos.add(ExtrasFormattingInfo.getDefault()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public InvalidChangeBatchException withMessages(String... messages) {
if (this.messages == null) {
setMessages(new com.amazonaws.internal.SdkInternalList<String>(messages.length));
}
for (String ele : messages) {
this.messages.add(ele);
}
return this;
} } | public class class_name {
public InvalidChangeBatchException withMessages(String... messages) {
if (this.messages == null) {
setMessages(new com.amazonaws.internal.SdkInternalList<String>(messages.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : messages) {
this.messages.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Override
public EClass getIfcRoot() {
if (ifcRootEClass == null) {
ifcRootEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(581);
}
return ifcRootEClass;
} } | public class class_name {
@Override
public EClass getIfcRoot() {
if (ifcRootEClass == null) {
ifcRootEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(581);
// depends on control dependency: [if], data = [none]
}
return ifcRootEClass;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.