code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
void truncate(long position)
{
buffer.truncate(position);
// TODO decide if it is worth making this faster than O(N)
final PatchPoint patch = patchPoints.truncate(position);
if (patch != null)
{
patchBuffer.truncate(patch.patchPosition);
}
} } | public class class_name {
void truncate(long position)
{
buffer.truncate(position);
// TODO decide if it is worth making this faster than O(N)
final PatchPoint patch = patchPoints.truncate(position);
if (patch != null)
{
patchBuffer.truncate(patch.patchPosition); // depends on control dependency: [if], data = [(patch]
}
} } |
public class class_name {
public static String getFailureDescription(ModelNode operationResult) {
if (isSuccess(operationResult)) {
return null;
}
if (operationResult != null) {
final ModelNode descr = operationResult.get(FAILURE_DESCRIPTION);
if (descr != null) {
return descr.asString();
}
}
return "Unknown failure";
} } | public class class_name {
public static String getFailureDescription(ModelNode operationResult) {
if (isSuccess(operationResult)) {
return null; // depends on control dependency: [if], data = [none]
}
if (operationResult != null) {
final ModelNode descr = operationResult.get(FAILURE_DESCRIPTION);
if (descr != null) {
return descr.asString(); // depends on control dependency: [if], data = [none]
}
}
return "Unknown failure";
} } |
public class class_name {
private void doUndeployNetwork(final NetworkConfig network, final Message<JsonObject> message) {
// First we need to load the network's context from the cluster.
final WrappedWatchableMap<String, String> data = new WrappedWatchableMap<String, String>(String.format("%s.%s", cluster, network.getName()), this.data.<String, String>getMap(String.format("%s.%s", cluster, network.getName())), vertx);
String scontext = data.get(String.format("%s.%s", cluster, network.getName()));
if (scontext == null) {
message.reply(new JsonObject().putString("status", "error").putString("message", "Network is not deployed."));
} else {
// Determine whether the network's manager is deployed.
final NetworkContext tempContext = Contexts.<NetworkContext>deserialize(new JsonObject(scontext));
if (managers.containsKey(tempContext.address())) {
// If the network's manager is deployed then unmerge the given
// configuration from the configuration of the network that's
// already running. If the resulting configuration is a no-component
// network then that indicates that the entire network is being undeployed.
// Otherwise, we simply update the existing configuration and allow the
// network's manager to handle deployment and undeployment of components.
NetworkConfig updatedConfig = Configs.unmergeNetworks(tempContext.config(), network);
final NetworkContext context = ContextBuilder.buildContext(updatedConfig, cluster);
// If the new configuration has no components then undeploy the entire network.
if (context.components().isEmpty()) {
// We need to watch the network's status key to determine when the network's
// components have been completely undeployed. Once that happens it's okay
// to then undeploy the network's manager.
data.watch(context.status(), MapEvent.Type.CHANGE, new Handler<MapEvent<String, String>>() {
@Override
public void handle(MapEvent<String, String> event) {
// When the network's status key is set to an empty string, that indicates
// that the network's manager has completely undeployed all components and
// connections within the network. The manager is the only element of the
// network left running, so we can go ahead and undeploy it.
if (event.value() != null && event.value().equals("")) {
// First, stop watching the status key so this handler doesn't accidentally
// get called again for some reason.
data.unwatch(context.status(), MapEvent.Type.CHANGE, this, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
// Now undeploy the manager from the context cluster. Once the manager
// has been undeployed the undeployment of the network is complete.
platform.undeployVerticle(managers.remove(context.address()), new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
if (result.failed()) {
message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
} else {
// We can be nice and unset the status key since the manager was undeployed :-)
DefaultNodeManager.this.context.execute(new Action<Void>() {
@Override
public Void perform() {
networks.remove(context.address());
data.remove(context.status());
return null;
}
}, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
message.reply(new JsonObject().putString("status", "ok"));
}
});
}
}
});
}
});
}
}
}, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
// Once we've started watching the status key, unset the network's context in
// the cluster. The network's manager will be notified of the configuration
// change and will begin undeploying all of its components. Once the components
// have been undeployed it will reset its status key.
if (result.failed()) {
message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
} else {
DefaultNodeManager.this.context.run(new Runnable() {
@Override
public void run() {
data.remove(context.address());
}
});
}
}
});
} else {
// If only a portion of the running network is being undeployed, we need
// to watch the network's status key for notification once the configuration
// change is complete.
data.watch(context.status(), MapEvent.Type.CHANGE, new Handler<MapEvent<String, String>>() {
@Override
public void handle(MapEvent<String, String> event) {
if (event.value() != null && event.value().equals(context.version())) {
// The network's configuration has been completely updated. Stop watching
// the network's status key and call the async handler.
data.unwatch(context.status(), null, this, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
message.reply(new JsonObject().putString("status", "ok").putObject("context", Contexts.serialize(context)));
}
});
}
}
}, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
// Once we've started watching the status key, update the network's context in
// the cluster. The network's manager will be notified of the configuration
// change and will begin deploying or undeploying components and connections
// as necessary.
if (result.failed()) {
message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
} else {
DefaultNodeManager.this.context.run(new Runnable() {
@Override
public void run() {
data.put(context.address(), Contexts.serialize(context).encode());
}
});
}
}
});
}
} else {
message.reply(new JsonObject().putString("status", "error").putString("message", "Network is not deployed."));
}
}
} } | public class class_name {
private void doUndeployNetwork(final NetworkConfig network, final Message<JsonObject> message) {
// First we need to load the network's context from the cluster.
final WrappedWatchableMap<String, String> data = new WrappedWatchableMap<String, String>(String.format("%s.%s", cluster, network.getName()), this.data.<String, String>getMap(String.format("%s.%s", cluster, network.getName())), vertx);
String scontext = data.get(String.format("%s.%s", cluster, network.getName()));
if (scontext == null) {
message.reply(new JsonObject().putString("status", "error").putString("message", "Network is not deployed.")); // depends on control dependency: [if], data = [none]
} else {
// Determine whether the network's manager is deployed.
final NetworkContext tempContext = Contexts.<NetworkContext>deserialize(new JsonObject(scontext));
if (managers.containsKey(tempContext.address())) {
// If the network's manager is deployed then unmerge the given
// configuration from the configuration of the network that's
// already running. If the resulting configuration is a no-component
// network then that indicates that the entire network is being undeployed.
// Otherwise, we simply update the existing configuration and allow the
// network's manager to handle deployment and undeployment of components.
NetworkConfig updatedConfig = Configs.unmergeNetworks(tempContext.config(), network);
final NetworkContext context = ContextBuilder.buildContext(updatedConfig, cluster);
// If the new configuration has no components then undeploy the entire network.
if (context.components().isEmpty()) {
// We need to watch the network's status key to determine when the network's
// components have been completely undeployed. Once that happens it's okay
// to then undeploy the network's manager.
data.watch(context.status(), MapEvent.Type.CHANGE, new Handler<MapEvent<String, String>>() {
@Override
public void handle(MapEvent<String, String> event) {
// When the network's status key is set to an empty string, that indicates
// that the network's manager has completely undeployed all components and
// connections within the network. The manager is the only element of the
// network left running, so we can go ahead and undeploy it.
if (event.value() != null && event.value().equals("")) {
// First, stop watching the status key so this handler doesn't accidentally
// get called again for some reason.
data.unwatch(context.status(), MapEvent.Type.CHANGE, this, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
// Now undeploy the manager from the context cluster. Once the manager
// has been undeployed the undeployment of the network is complete.
platform.undeployVerticle(managers.remove(context.address()), new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
if (result.failed()) {
message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage())); // depends on control dependency: [if], data = [none]
} else {
// We can be nice and unset the status key since the manager was undeployed :-)
DefaultNodeManager.this.context.execute(new Action<Void>() {
@Override
public Void perform() {
networks.remove(context.address());
data.remove(context.status());
return null;
}
}, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
message.reply(new JsonObject().putString("status", "ok"));
}
}); // depends on control dependency: [if], data = [none]
}
}
});
}
}); // depends on control dependency: [if], data = [none]
}
}
}, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
// Once we've started watching the status key, unset the network's context in
// the cluster. The network's manager will be notified of the configuration
// change and will begin undeploying all of its components. Once the components
// have been undeployed it will reset its status key.
if (result.failed()) {
message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage())); // depends on control dependency: [if], data = [none]
} else {
DefaultNodeManager.this.context.run(new Runnable() {
@Override
public void run() {
data.remove(context.address());
}
}); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
} else {
// If only a portion of the running network is being undeployed, we need
// to watch the network's status key for notification once the configuration
// change is complete.
data.watch(context.status(), MapEvent.Type.CHANGE, new Handler<MapEvent<String, String>>() {
@Override
public void handle(MapEvent<String, String> event) {
if (event.value() != null && event.value().equals(context.version())) {
// The network's configuration has been completely updated. Stop watching
// the network's status key and call the async handler.
data.unwatch(context.status(), null, this, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
message.reply(new JsonObject().putString("status", "ok").putObject("context", Contexts.serialize(context)));
}
}); // depends on control dependency: [if], data = [none]
}
}
}, new Handler<AsyncResult<Void>>() {
@Override
public void handle(AsyncResult<Void> result) {
// Once we've started watching the status key, update the network's context in
// the cluster. The network's manager will be notified of the configuration
// change and will begin deploying or undeploying components and connections
// as necessary.
if (result.failed()) {
message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage())); // depends on control dependency: [if], data = [none]
} else {
DefaultNodeManager.this.context.run(new Runnable() {
@Override
public void run() {
data.put(context.address(), Contexts.serialize(context).encode());
}
}); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
}
} else {
message.reply(new JsonObject().putString("status", "error").putString("message", "Network is not deployed.")); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public Result render(Object object) {
if (this.renderable == null) {
this.renderable = object;
} else {
assertObjectNoRenderableOrThrowException(this.renderable);
Map<String, Object> map;
// prepare the this.renderable as we now have at least two
// objects to render
if (this.renderable instanceof Map) {
map = (Map) this.renderable;
} else {
map = Maps.newHashMap();
// add original this.renderable
map.put(SwissKnife.getRealClassNameLowerCamelCase(this.renderable), this.renderable);
this.renderable = map;
}
// add object of this method
String key = SwissKnife.getRealClassNameLowerCamelCase(object);
if (map.containsKey(key)) {
throw new IllegalArgumentException(
String.format(
"Cannot store object with default name %s."
+ "An object with the same name is already stored."
+ "Consider using render(key, value) to name objects implicitly.",
key));
} else {
map.put(SwissKnife.getRealClassNameLowerCamelCase(object), object);
}
}
return this;
} } | public class class_name {
public Result render(Object object) {
if (this.renderable == null) {
this.renderable = object; // depends on control dependency: [if], data = [none]
} else {
assertObjectNoRenderableOrThrowException(this.renderable); // depends on control dependency: [if], data = [(this.renderable]
Map<String, Object> map;
// prepare the this.renderable as we now have at least two
// objects to render
if (this.renderable instanceof Map) {
map = (Map) this.renderable; // depends on control dependency: [if], data = [none]
} else {
map = Maps.newHashMap(); // depends on control dependency: [if], data = [none]
// add original this.renderable
map.put(SwissKnife.getRealClassNameLowerCamelCase(this.renderable), this.renderable); // depends on control dependency: [if], data = [none]
this.renderable = map; // depends on control dependency: [if], data = [none]
}
// add object of this method
String key = SwissKnife.getRealClassNameLowerCamelCase(object);
if (map.containsKey(key)) {
throw new IllegalArgumentException(
String.format(
"Cannot store object with default name %s."
+ "An object with the same name is already stored."
+ "Consider using render(key, value) to name objects implicitly.",
key));
} else {
map.put(SwissKnife.getRealClassNameLowerCamelCase(object), object); // depends on control dependency: [if], data = [none]
}
}
return this;
} } |
public class class_name {
public UpdateConnectivityInfoRequest withConnectivityInfo(ConnectivityInfo... connectivityInfo) {
if (this.connectivityInfo == null) {
setConnectivityInfo(new java.util.ArrayList<ConnectivityInfo>(connectivityInfo.length));
}
for (ConnectivityInfo ele : connectivityInfo) {
this.connectivityInfo.add(ele);
}
return this;
} } | public class class_name {
public UpdateConnectivityInfoRequest withConnectivityInfo(ConnectivityInfo... connectivityInfo) {
if (this.connectivityInfo == null) {
setConnectivityInfo(new java.util.ArrayList<ConnectivityInfo>(connectivityInfo.length)); // depends on control dependency: [if], data = [none]
}
for (ConnectivityInfo ele : connectivityInfo) {
this.connectivityInfo.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public List<String> getDomainObjectTypeNames() {
List<DomainObjectType> types = getDomainObjectTypes();
List<String> typeNames = new ArrayList<String>(types.size());
for (DomainObjectType typ : types) {
typeNames.add(typ.getTypeName());
}
return typeNames;
} } | public class class_name {
public List<String> getDomainObjectTypeNames() {
List<DomainObjectType> types = getDomainObjectTypes();
List<String> typeNames = new ArrayList<String>(types.size());
for (DomainObjectType typ : types) {
typeNames.add(typ.getTypeName());
// depends on control dependency: [for], data = [typ]
}
return typeNames;
} } |
public class class_name {
public void unsubscribe(Installation installation, String categoryToUnsubscribe) {
String url = "";
try {
url = IID_URL + installation.getDeviceToken() + "/rel/topics/" + URLEncoder.encode(categoryToUnsubscribe, StandardCharsets.UTF_8.toString());
} catch (UnsupportedEncodingException e1) {
//
}
try {
delete(url);
} catch (IOException e) {
logger.debug("Unregistering device from topic was unsuccessfull");
}
} } | public class class_name {
public void unsubscribe(Installation installation, String categoryToUnsubscribe) {
String url = "";
try {
url = IID_URL + installation.getDeviceToken() + "/rel/topics/" + URLEncoder.encode(categoryToUnsubscribe, StandardCharsets.UTF_8.toString()); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e1) {
//
} // depends on control dependency: [catch], data = [none]
try {
delete(url); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.debug("Unregistering device from topic was unsuccessfull");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Object invokeOptional(T target, Object... args) throws InvocationTargetException {
Method m = getMethod(target.getClass());
if (m == null) {
return null;
}
try {
return m.invoke(target, args);
} catch (IllegalAccessException e) {
return null;
}
} } | public class class_name {
public Object invokeOptional(T target, Object... args) throws InvocationTargetException {
Method m = getMethod(target.getClass());
if (m == null) {
return null; // depends on control dependency: [if], data = [none]
}
try {
return m.invoke(target, args); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String Out()
{
if( periods == null )
{
// means we are in unresolved week days mode
return "Unresolved days : " + days.implode( "," );
}
String out = "";
for( int i = 0; i < periods.size(); i++ )
{
out += "[" + periods.get( i ).getFrom() + "->" + periods.get( i ).getTo() + "]<br>";
}
return out;
} } | public class class_name {
public String Out()
{
if( periods == null )
{
// means we are in unresolved week days mode
return "Unresolved days : " + days.implode( "," ); // depends on control dependency: [if], data = [none]
}
String out = "";
for( int i = 0; i < periods.size(); i++ )
{
out += "[" + periods.get( i ).getFrom() + "->" + periods.get( i ).getTo() + "]<br>"; // depends on control dependency: [for], data = [i]
}
return out;
} } |
public class class_name {
protected void addCacheKeyGenerators(
Map<String, ICacheKeyGenerator> cacheKeyGenerators,
Iterable<ICacheKeyGenerator> gens)
{
if (gens != null) {
for (ICacheKeyGenerator gen : gens) {
String className = gen.getClass().getName();
ICacheKeyGenerator current = cacheKeyGenerators.get(className);
cacheKeyGenerators.put(className,
(current == null) ? gen : current.combine(gen));
}
}
} } | public class class_name {
protected void addCacheKeyGenerators(
Map<String, ICacheKeyGenerator> cacheKeyGenerators,
Iterable<ICacheKeyGenerator> gens)
{
if (gens != null) {
for (ICacheKeyGenerator gen : gens) {
String className = gen.getClass().getName();
ICacheKeyGenerator current = cacheKeyGenerators.get(className);
cacheKeyGenerators.put(className,
(current == null) ? gen : current.combine(gen));
// depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
private IJavaProject getCurrentJavaProject() {
IEditorInput input = getEditor().getEditorInput();
if ( !(input instanceof IFileEditorInput) ) {
return null;
}
IProject project = ((IFileEditorInput) input).getFile().getProject();
IJavaProject javaProject = JavaCore.create( project );
return javaProject;
} } | public class class_name {
private IJavaProject getCurrentJavaProject() {
IEditorInput input = getEditor().getEditorInput();
if ( !(input instanceof IFileEditorInput) ) {
return null; // depends on control dependency: [if], data = [none]
}
IProject project = ((IFileEditorInput) input).getFile().getProject();
IJavaProject javaProject = JavaCore.create( project );
return javaProject;
} } |
public class class_name {
public static RSAKey keyGen(int keySize) {
KeyPairGenerator generator = null;
try {
generator = KeyPairGenerator.getInstance(algorithm);
generator.initialize(keySize);
KeyPair keyPair = generator.generateKeyPair();
return new RSAKey(keyPair.getPublic(), keyPair.getPrivate());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return null;
} } | public class class_name {
public static RSAKey keyGen(int keySize) {
KeyPairGenerator generator = null;
try {
generator = KeyPairGenerator.getInstance(algorithm); // depends on control dependency: [try], data = [none]
generator.initialize(keySize); // depends on control dependency: [try], data = [none]
KeyPair keyPair = generator.generateKeyPair();
return new RSAKey(keyPair.getPublic(), keyPair.getPrivate()); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
public void marshall(UdpGroupSettings udpGroupSettings, ProtocolMarshaller protocolMarshaller) {
if (udpGroupSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(udpGroupSettings.getInputLossAction(), INPUTLOSSACTION_BINDING);
protocolMarshaller.marshall(udpGroupSettings.getTimedMetadataId3Frame(), TIMEDMETADATAID3FRAME_BINDING);
protocolMarshaller.marshall(udpGroupSettings.getTimedMetadataId3Period(), TIMEDMETADATAID3PERIOD_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UdpGroupSettings udpGroupSettings, ProtocolMarshaller protocolMarshaller) {
if (udpGroupSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(udpGroupSettings.getInputLossAction(), INPUTLOSSACTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(udpGroupSettings.getTimedMetadataId3Frame(), TIMEDMETADATAID3FRAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(udpGroupSettings.getTimedMetadataId3Period(), TIMEDMETADATAID3PERIOD_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static short[] trimToCapacity(short[] array, int maxCapacity) {
if (array.length > maxCapacity) {
short oldArray[] = array;
array = new short[maxCapacity];
System.arraycopy(oldArray, 0, array, 0, maxCapacity);
}
return array;
} } | public class class_name {
public static short[] trimToCapacity(short[] array, int maxCapacity) {
if (array.length > maxCapacity) {
short oldArray[] = array;
array = new short[maxCapacity];
// depends on control dependency: [if], data = [none]
System.arraycopy(oldArray, 0, array, 0, maxCapacity);
// depends on control dependency: [if], data = [maxCapacity)]
}
return array;
} } |
public class class_name {
public FacesConfigComponentType<FacesConfigType<T>> getOrCreateComponent()
{
List<Node> nodeList = childNode.get("component");
if (nodeList != null && nodeList.size() > 0)
{
return new FacesConfigComponentTypeImpl<FacesConfigType<T>>(this, "component", childNode, nodeList.get(0));
}
return createComponent();
} } | public class class_name {
public FacesConfigComponentType<FacesConfigType<T>> getOrCreateComponent()
{
List<Node> nodeList = childNode.get("component");
if (nodeList != null && nodeList.size() > 0)
{
return new FacesConfigComponentTypeImpl<FacesConfigType<T>>(this, "component", childNode, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createComponent();
} } |
public class class_name {
protected void agentCreated (ClientObject client, int agentId)
{
FoundAgent found = resolve(client, agentId, "agentCreated");
if (found == null) {
return;
}
log.info("Agent creation confirmed", "agent", found.agent.which());
if (found.state == AgentState.STARTED) {
found.bureau.agentStates.put(found.agent, AgentState.RUNNING);
found.agent.setClientOid(client.getOid());
} else if (found.state == AgentState.STILL_BORN) {
// TODO: have a timeout for this in case the client is misbehaving or hung
BureauSender.destroyAgent(found.bureau.clientObj, agentId);
found.bureau.agentStates.put(found.agent, AgentState.DESTROYED);
} else if (found.state == AgentState.PENDING ||
found.state == AgentState.RUNNING ||
found.state == AgentState.DESTROYED) {
log.warning("Ignoring confirmation of creation of an agent in an unexpected state",
"state", found.state, "agent", found.agent.which());
}
found.bureau.summarize();
} } | public class class_name {
protected void agentCreated (ClientObject client, int agentId)
{
FoundAgent found = resolve(client, agentId, "agentCreated");
if (found == null) {
return; // depends on control dependency: [if], data = [none]
}
log.info("Agent creation confirmed", "agent", found.agent.which());
if (found.state == AgentState.STARTED) {
found.bureau.agentStates.put(found.agent, AgentState.RUNNING); // depends on control dependency: [if], data = [none]
found.agent.setClientOid(client.getOid()); // depends on control dependency: [if], data = [none]
} else if (found.state == AgentState.STILL_BORN) {
// TODO: have a timeout for this in case the client is misbehaving or hung
BureauSender.destroyAgent(found.bureau.clientObj, agentId); // depends on control dependency: [if], data = [none]
found.bureau.agentStates.put(found.agent, AgentState.DESTROYED); // depends on control dependency: [if], data = [none]
} else if (found.state == AgentState.PENDING ||
found.state == AgentState.RUNNING ||
found.state == AgentState.DESTROYED) {
log.warning("Ignoring confirmation of creation of an agent in an unexpected state",
"state", found.state, "agent", found.agent.which()); // depends on control dependency: [if], data = [none]
}
found.bureau.summarize();
} } |
public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
protected <T> void applySearchCriteriaToQuery(SearchCriteriaBean criteria, CriteriaBuilder builder,
CriteriaQuery<?> query, Root<T> from, boolean countOnly) {
List<SearchCriteriaFilterBean> filters = criteria.getFilters();
if (filters != null && !filters.isEmpty()) {
List<Predicate> predicates = new ArrayList<>();
for (SearchCriteriaFilterBean filter : filters) {
if (filter.getOperator() == SearchCriteriaFilterOperator.eq) {
Path<Object> path = from.get(filter.getName());
Class<?> pathc = path.getJavaType();
if (pathc.isAssignableFrom(String.class)) {
predicates.add(builder.equal(path, filter.getValue()));
} else if (pathc.isEnum()) {
predicates.add(builder.equal(path, Enum.valueOf((Class)pathc, filter.getValue())));
}
} else if (filter.getOperator() == SearchCriteriaFilterOperator.bool_eq) {
predicates.add(builder.equal(from.<Boolean>get(filter.getName()), Boolean.valueOf(filter.getValue())));
} else if (filter.getOperator() == SearchCriteriaFilterOperator.gt) {
predicates.add(builder.greaterThan(from.<Long>get(filter.getName()), new Long(filter.getValue())));
} else if (filter.getOperator() == SearchCriteriaFilterOperator.gte) {
predicates.add(builder.greaterThanOrEqualTo(from.<Long>get(filter.getName()), new Long(filter.getValue())));
} else if (filter.getOperator() == SearchCriteriaFilterOperator.lt) {
predicates.add(builder.lessThan(from.<Long>get(filter.getName()), new Long(filter.getValue())));
} else if (filter.getOperator() == SearchCriteriaFilterOperator.lte) {
predicates.add(builder.lessThanOrEqualTo(from.<Long>get(filter.getName()), new Long(filter.getValue())));
} else if (filter.getOperator() == SearchCriteriaFilterOperator.neq) {
predicates.add(builder.notEqual(from.get(filter.getName()), filter.getValue()));
} else if (filter.getOperator() == SearchCriteriaFilterOperator.like) {
predicates.add(builder.like(builder.upper(from.<String>get(filter.getName())), filter.getValue().toUpperCase().replace('*', '%')));
}
}
query.where(predicates.toArray(new Predicate[predicates.size()]));
}
OrderByBean orderBy = criteria.getOrderBy();
if (orderBy != null && !countOnly) {
if (orderBy.isAscending()) {
query.orderBy(builder.asc(from.get(orderBy.getName())));
} else {
query.orderBy(builder.desc(from.get(orderBy.getName())));
}
}
} } | public class class_name {
@SuppressWarnings({ "unchecked", "rawtypes" })
protected <T> void applySearchCriteriaToQuery(SearchCriteriaBean criteria, CriteriaBuilder builder,
CriteriaQuery<?> query, Root<T> from, boolean countOnly) {
List<SearchCriteriaFilterBean> filters = criteria.getFilters();
if (filters != null && !filters.isEmpty()) {
List<Predicate> predicates = new ArrayList<>();
for (SearchCriteriaFilterBean filter : filters) {
if (filter.getOperator() == SearchCriteriaFilterOperator.eq) {
Path<Object> path = from.get(filter.getName());
Class<?> pathc = path.getJavaType();
if (pathc.isAssignableFrom(String.class)) {
predicates.add(builder.equal(path, filter.getValue())); // depends on control dependency: [if], data = [none]
} else if (pathc.isEnum()) {
predicates.add(builder.equal(path, Enum.valueOf((Class)pathc, filter.getValue()))); // depends on control dependency: [if], data = [none]
}
} else if (filter.getOperator() == SearchCriteriaFilterOperator.bool_eq) {
predicates.add(builder.equal(from.<Boolean>get(filter.getName()), Boolean.valueOf(filter.getValue()))); // depends on control dependency: [if], data = [none]
} else if (filter.getOperator() == SearchCriteriaFilterOperator.gt) {
predicates.add(builder.greaterThan(from.<Long>get(filter.getName()), new Long(filter.getValue()))); // depends on control dependency: [if], data = [none]
} else if (filter.getOperator() == SearchCriteriaFilterOperator.gte) {
predicates.add(builder.greaterThanOrEqualTo(from.<Long>get(filter.getName()), new Long(filter.getValue()))); // depends on control dependency: [if], data = [none]
} else if (filter.getOperator() == SearchCriteriaFilterOperator.lt) {
predicates.add(builder.lessThan(from.<Long>get(filter.getName()), new Long(filter.getValue()))); // depends on control dependency: [if], data = [none]
} else if (filter.getOperator() == SearchCriteriaFilterOperator.lte) {
predicates.add(builder.lessThanOrEqualTo(from.<Long>get(filter.getName()), new Long(filter.getValue()))); // depends on control dependency: [if], data = [none]
} else if (filter.getOperator() == SearchCriteriaFilterOperator.neq) {
predicates.add(builder.notEqual(from.get(filter.getName()), filter.getValue())); // depends on control dependency: [if], data = [none]
} else if (filter.getOperator() == SearchCriteriaFilterOperator.like) {
predicates.add(builder.like(builder.upper(from.<String>get(filter.getName())), filter.getValue().toUpperCase().replace('*', '%'))); // depends on control dependency: [if], data = [none]
}
}
query.where(predicates.toArray(new Predicate[predicates.size()])); // depends on control dependency: [if], data = [none]
}
OrderByBean orderBy = criteria.getOrderBy();
if (orderBy != null && !countOnly) {
if (orderBy.isAscending()) {
query.orderBy(builder.asc(from.get(orderBy.getName()))); // depends on control dependency: [if], data = [none]
} else {
query.orderBy(builder.desc(from.get(orderBy.getName()))); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected boolean isPackableWith(Object value, int choose) {
if (value == null) {
return false;
}
if (choose == CHOOSE_EXTENSION) {
if (value.equals(getDefaultFileExtension())) {
return true;
}
} else if (choose == CHOOSE_NAME) {
if (value.equals(getName())) {
return true;
}
}
return false;
} } | public class class_name {
protected boolean isPackableWith(Object value, int choose) {
if (value == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (choose == CHOOSE_EXTENSION) {
if (value.equals(getDefaultFileExtension())) {
return true; // depends on control dependency: [if], data = [none]
}
} else if (choose == CHOOSE_NAME) {
if (value.equals(getName())) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public void marshall(UpdateDetectorRequest updateDetectorRequest, ProtocolMarshaller protocolMarshaller) {
if (updateDetectorRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateDetectorRequest.getDetectorId(), DETECTORID_BINDING);
protocolMarshaller.marshall(updateDetectorRequest.getEnable(), ENABLE_BINDING);
protocolMarshaller.marshall(updateDetectorRequest.getFindingPublishingFrequency(), FINDINGPUBLISHINGFREQUENCY_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateDetectorRequest updateDetectorRequest, ProtocolMarshaller protocolMarshaller) {
if (updateDetectorRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateDetectorRequest.getDetectorId(), DETECTORID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateDetectorRequest.getEnable(), ENABLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateDetectorRequest.getFindingPublishingFrequency(), FINDINGPUBLISHINGFREQUENCY_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 clearStaleTimeouts() {
Iterator iterator = knownAlarms.values().iterator();
long currentTime = System.currentTimeMillis();
while (iterator.hasNext()) {
NotificationInfo info = (NotificationInfo)iterator.next();
// if period has expired remove reference to the notification
if ((info.firstSeenTime + period) < currentTime) {
iterator.remove();
}
}
} } | public class class_name {
private void clearStaleTimeouts() {
Iterator iterator = knownAlarms.values().iterator();
long currentTime = System.currentTimeMillis();
while (iterator.hasNext()) {
NotificationInfo info = (NotificationInfo)iterator.next();
// if period has expired remove reference to the notification
if ((info.firstSeenTime + period) < currentTime) {
iterator.remove(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
@ManagedOperation
public V get(K key) {
// 1. Try the L1 cache first
if(l1_cache != null) {
V val=l1_cache.get(key);
if(val != null) {
if(log.isTraceEnabled())
log.trace("returned value " + val + " for " + key + " from L1 cache");
return val;
}
}
// 2. Try the local cache
Cache.Value<Value<V>> val=l2_cache.getEntry(key);
Value<V> tmp;
if(val != null) {
tmp=val.getValue();
if(tmp !=null) {
V real_value=tmp.getVal();
if(real_value != null && l1_cache != null && val.getTimeout() >= 0)
l1_cache.put(key, real_value, val.getTimeout());
return tmp.getVal();
}
}
// 3. Execute a cluster wide GET
try {
RspList<Object> rsps=disp.callRemoteMethods(null,
new MethodCall(GET, key),
new RequestOptions(ResponseMode.GET_ALL, call_timeout));
for(Rsp rsp: rsps.values()) {
Object obj=rsp.getValue();
if(obj == null || obj instanceof Throwable)
continue;
val=(Cache.Value<Value<V>>)rsp.getValue();
if(val != null) {
tmp=val.getValue();
if(tmp != null) {
V real_value=tmp.getVal();
if(real_value != null && l1_cache != null && val.getTimeout() >= 0)
l1_cache.put(key, real_value, val.getTimeout());
return real_value;
}
}
}
return null;
}
catch(Throwable t) {
if(log.isWarnEnabled())
log.warn("get() failed", t);
return null;
}
} } | public class class_name {
@ManagedOperation
public V get(K key) {
// 1. Try the L1 cache first
if(l1_cache != null) {
V val=l1_cache.get(key);
if(val != null) {
if(log.isTraceEnabled())
log.trace("returned value " + val + " for " + key + " from L1 cache");
return val; // depends on control dependency: [if], data = [none]
}
}
// 2. Try the local cache
Cache.Value<Value<V>> val=l2_cache.getEntry(key);
Value<V> tmp;
if(val != null) {
tmp=val.getValue(); // depends on control dependency: [if], data = [none]
if(tmp !=null) {
V real_value=tmp.getVal();
if(real_value != null && l1_cache != null && val.getTimeout() >= 0)
l1_cache.put(key, real_value, val.getTimeout());
return tmp.getVal(); // depends on control dependency: [if], data = [none]
}
}
// 3. Execute a cluster wide GET
try {
RspList<Object> rsps=disp.callRemoteMethods(null,
new MethodCall(GET, key),
new RequestOptions(ResponseMode.GET_ALL, call_timeout));
for(Rsp rsp: rsps.values()) {
Object obj=rsp.getValue();
if(obj == null || obj instanceof Throwable)
continue;
val=(Cache.Value<Value<V>>)rsp.getValue(); // depends on control dependency: [for], data = [rsp]
if(val != null) {
tmp=val.getValue(); // depends on control dependency: [if], data = [none]
if(tmp != null) {
V real_value=tmp.getVal();
if(real_value != null && l1_cache != null && val.getTimeout() >= 0)
l1_cache.put(key, real_value, val.getTimeout());
return real_value; // depends on control dependency: [if], data = [none]
}
}
}
return null; // depends on control dependency: [try], data = [none]
}
catch(Throwable t) {
if(log.isWarnEnabled())
log.warn("get() failed", t);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void setupSSL(ReadDeploymentResults readDepl) {
SslType sslType = readDepl.deployment.getSsl();
m_config.m_sslEnable = m_config.m_sslEnable || (sslType != null && sslType.isEnabled());
if (m_config.m_sslEnable) {
try {
hostLog.info("SSL enabled for HTTP. Please point browser to HTTPS URL.");
m_config.m_sslExternal = m_config.m_sslExternal || (sslType != null && sslType.isExternal());
m_config.m_sslDR = m_config.m_sslDR || (sslType != null && sslType.isDr());
m_config.m_sslInternal = m_config.m_sslInternal || (sslType != null && sslType.isInternal());
boolean setSslBuilder = m_config.m_sslExternal || m_config.m_sslDR || m_config.m_sslInternal;
setupSslContextCreators(sslType, setSslBuilder);
if (m_config.m_sslExternal) {
hostLog.info("SSL enabled for admin and client port. Please enable SSL on client.");
}
if (m_config.m_sslDR) {
hostLog.info("SSL enabled for DR port. Please enable SSL on consumer clusters' DR connections.");
}
if (m_config.m_sslInternal) {
hostLog.info("SSL enabled for internal inter-node communication.");
}
CipherExecutor.SERVER.startup();
} catch (Exception e) {
VoltDB.crashLocalVoltDB("Unable to configure SSL", true, e);
}
}
} } | public class class_name {
private void setupSSL(ReadDeploymentResults readDepl) {
SslType sslType = readDepl.deployment.getSsl();
m_config.m_sslEnable = m_config.m_sslEnable || (sslType != null && sslType.isEnabled());
if (m_config.m_sslEnable) {
try {
hostLog.info("SSL enabled for HTTP. Please point browser to HTTPS URL."); // depends on control dependency: [try], data = [none]
m_config.m_sslExternal = m_config.m_sslExternal || (sslType != null && sslType.isExternal()); // depends on control dependency: [try], data = [none]
m_config.m_sslDR = m_config.m_sslDR || (sslType != null && sslType.isDr()); // depends on control dependency: [try], data = [none]
m_config.m_sslInternal = m_config.m_sslInternal || (sslType != null && sslType.isInternal()); // depends on control dependency: [try], data = [none]
boolean setSslBuilder = m_config.m_sslExternal || m_config.m_sslDR || m_config.m_sslInternal;
setupSslContextCreators(sslType, setSslBuilder); // depends on control dependency: [try], data = [none]
if (m_config.m_sslExternal) {
hostLog.info("SSL enabled for admin and client port. Please enable SSL on client."); // depends on control dependency: [if], data = [none]
}
if (m_config.m_sslDR) {
hostLog.info("SSL enabled for DR port. Please enable SSL on consumer clusters' DR connections."); // depends on control dependency: [if], data = [none]
}
if (m_config.m_sslInternal) {
hostLog.info("SSL enabled for internal inter-node communication."); // depends on control dependency: [if], data = [none]
}
CipherExecutor.SERVER.startup(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
VoltDB.crashLocalVoltDB("Unable to configure SSL", true, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void setTexCoord(String texName, String texCoordAttr, String shaderVarName)
{
synchronized (textures)
{
GVRTexture tex = textures.get(texName);
if (tex != null)
{
tex.setTexCoord(texCoordAttr, shaderVarName);
}
else
{
throw new UnsupportedOperationException("Texture must be set before updating texture coordinate information");
}
}
} } | public class class_name {
public void setTexCoord(String texName, String texCoordAttr, String shaderVarName)
{
synchronized (textures)
{
GVRTexture tex = textures.get(texName);
if (tex != null)
{
tex.setTexCoord(texCoordAttr, shaderVarName); // depends on control dependency: [if], data = [(tex]
}
else
{
throw new UnsupportedOperationException("Texture must be set before updating texture coordinate information");
}
}
} } |
public class class_name {
void checkSetupDone(String operation) {
if (!setupSuccessful()) {
String stateToString = setupStateToString(setupState);
Logger.e("Illegal state for operation (", operation, "): ", stateToString);
throw new IllegalStateException(stateToString + " Can't perform operation: " + operation);
}
} } | public class class_name {
void checkSetupDone(String operation) {
if (!setupSuccessful()) {
String stateToString = setupStateToString(setupState);
Logger.e("Illegal state for operation (", operation, "): ", stateToString); // depends on control dependency: [if], data = [none]
throw new IllegalStateException(stateToString + " Can't perform operation: " + operation);
}
} } |
public class class_name {
static boolean isJAXBElement(JType type) {
//noinspection RedundantIfStatement
if (type.fullName().startsWith(JAXBElement.class.getName())) {
return true;
}
return false;
} } | public class class_name {
static boolean isJAXBElement(JType type) {
//noinspection RedundantIfStatement
if (type.fullName().startsWith(JAXBElement.class.getName())) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static <T> Iterable<T> checkNoNullInside(Iterable<T> argument, String errorMessage) {
if (argument == null) {
return argument;
}
for (T element : argument) {
checkNotNull(element, errorMessage);
}
return argument;
} } | public class class_name {
public static <T> Iterable<T> checkNoNullInside(Iterable<T> argument, String errorMessage) {
if (argument == null) {
return argument; // depends on control dependency: [if], data = [none]
}
for (T element : argument) {
checkNotNull(element, errorMessage); // depends on control dependency: [for], data = [element]
}
return argument;
} } |
public class class_name {
public static double[][] getMatrix(final double[][] m1, final int[] r, final int[] c) {
final int rowdim = r.length, coldim = c.length;
final double[][] X = new double[rowdim][coldim];
for(int i = 0; i < rowdim; i++) {
final double[] rowM = m1[r[i]], rowX = X[i];
for(int j = 0; j < coldim; j++) {
rowX[j] = rowM[c[j]];
}
}
return X;
} } | public class class_name {
public static double[][] getMatrix(final double[][] m1, final int[] r, final int[] c) {
final int rowdim = r.length, coldim = c.length;
final double[][] X = new double[rowdim][coldim];
for(int i = 0; i < rowdim; i++) {
final double[] rowM = m1[r[i]], rowX = X[i];
for(int j = 0; j < coldim; j++) {
rowX[j] = rowM[c[j]]; // depends on control dependency: [for], data = [j]
}
}
return X;
} } |
public class class_name {
public long receiverId()
{
final long value;
if (ByteOrder.nativeOrder() == LITTLE_ENDIAN)
{
value =
(
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 7)) << 56) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 6) & 0xFF) << 48) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 5) & 0xFF) << 40) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 4) & 0xFF) << 32) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 3) & 0xFF) << 24) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 2) & 0xFF) << 16) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 1) & 0xFF) << 8) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 0) & 0xFF))
);
}
else
{
value =
(
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 0)) << 56) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 1) & 0xFF) << 48) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 2) & 0xFF) << 40) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 3) & 0xFF) << 32) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 4) & 0xFF) << 24) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 5) & 0xFF) << 16) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 6) & 0xFF) << 8) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 7) & 0xFF))
);
}
return value;
} } | public class class_name {
public long receiverId()
{
final long value;
if (ByteOrder.nativeOrder() == LITTLE_ENDIAN)
{
value =
(
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 7)) << 56) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 6) & 0xFF) << 48) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 5) & 0xFF) << 40) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 4) & 0xFF) << 32) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 3) & 0xFF) << 24) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 2) & 0xFF) << 16) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 1) & 0xFF) << 8) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 0) & 0xFF))
); // depends on control dependency: [if], data = [none]
}
else
{
value =
(
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 0)) << 56) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 1) & 0xFF) << 48) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 2) & 0xFF) << 40) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 3) & 0xFF) << 32) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 4) & 0xFF) << 24) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 5) & 0xFF) << 16) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 6) & 0xFF) << 8) |
(((long)getByte(RECEIVER_ID_FIELD_OFFSET + 7) & 0xFF))
); // depends on control dependency: [if], data = [none]
}
return value;
} } |
public class class_name {
private void initToolBar() {
toolbar = new JToolBar();
toolbar.add(new Button(firstPageAction));
toolbar.add(new Button(pageUpAction));
toolbar.add(new Button(pageDownAction));
toolbar.add(new Button(lastPageAction));
toolbar.addSeparator();
toolbar.add(pageSizeLabel);
toolbar.add(pageSizeField);
pageSizeField.setText(Integer.toString(getPageSize()));
pageSizeField.setHorizontalAlignment(JTextField.RIGHT);
pageSizeField.setAction(pageSizeAction);
pageSizeField.setMaximumSize(pageSizeField.getPreferredSize());
toolbar.addSeparator();
totalRowCountLabel.setText(String.format(totalRowCountLabelFormat, getRealRowCount()));
toolbar.add(totalRowCountLabel);
toolbar.add(pageField);
pageField.setText(Integer.toString(getPage() + 1));
pageField.setHorizontalAlignment(JTextField.RIGHT);
pageField.setAction(gotoPageAction);
pageField.setMaximumSize(pageField.getPreferredSize());
pageCountLabel.setText(String.format(pageCountLabelFormat, getPageCount()));
toolbar.add(pageCountLabel);
setActionEnabled();
TableModelListener listener = new TableModelListener() {
@Override
public void tableChanged(TableModelEvent tme) {
if (tme.getType() == TableModelEvent.INSERT || tme.getType() == TableModelEvent.DELETE) {
if (getPage() >= getPageCount()) {
setPage(getPageCount() - 1);
}
totalRowCountLabel.setText(String.format(totalRowCountLabelFormat, getRealRowCount()));
pageField.setText(Integer.toString(getPage() + 1));
pageCountLabel.setText(String.format(pageCountLabelFormat, getPageCount()));
}
}
};
addTableModelListener(listener);
} } | public class class_name {
private void initToolBar() {
toolbar = new JToolBar();
toolbar.add(new Button(firstPageAction));
toolbar.add(new Button(pageUpAction));
toolbar.add(new Button(pageDownAction));
toolbar.add(new Button(lastPageAction));
toolbar.addSeparator();
toolbar.add(pageSizeLabel);
toolbar.add(pageSizeField);
pageSizeField.setText(Integer.toString(getPageSize()));
pageSizeField.setHorizontalAlignment(JTextField.RIGHT);
pageSizeField.setAction(pageSizeAction);
pageSizeField.setMaximumSize(pageSizeField.getPreferredSize());
toolbar.addSeparator();
totalRowCountLabel.setText(String.format(totalRowCountLabelFormat, getRealRowCount()));
toolbar.add(totalRowCountLabel);
toolbar.add(pageField);
pageField.setText(Integer.toString(getPage() + 1));
pageField.setHorizontalAlignment(JTextField.RIGHT);
pageField.setAction(gotoPageAction);
pageField.setMaximumSize(pageField.getPreferredSize());
pageCountLabel.setText(String.format(pageCountLabelFormat, getPageCount()));
toolbar.add(pageCountLabel);
setActionEnabled();
TableModelListener listener = new TableModelListener() {
@Override
public void tableChanged(TableModelEvent tme) {
if (tme.getType() == TableModelEvent.INSERT || tme.getType() == TableModelEvent.DELETE) {
if (getPage() >= getPageCount()) {
setPage(getPageCount() - 1);
// depends on control dependency: [if], data = [none]
}
totalRowCountLabel.setText(String.format(totalRowCountLabelFormat, getRealRowCount()));
// depends on control dependency: [if], data = [none]
pageField.setText(Integer.toString(getPage() + 1));
// depends on control dependency: [if], data = [none]
pageCountLabel.setText(String.format(pageCountLabelFormat, getPageCount()));
// depends on control dependency: [if], data = [none]
}
}
};
addTableModelListener(listener);
} } |
public class class_name {
private void handlePipeLining() {
HttpServiceContextImpl sc = getHTTPContext();
WsByteBuffer buffer = sc.returnLastBuffer();
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Pipelined request found: " + buffer);
}
sc.clear();
// save it back so that we always release it
sc.storeAllocatedBuffer(buffer);
sc.disableBufferModification();
EventEngine events = HttpDispatcher.getEventService();
if (null != events) {
Event event = events.createEvent(HttpPipelineEventHandler.TOPIC_PIPELINING);
event.setProperty(CallbackIDs.CALLBACK_HTTPICL.getName(), this);
events.postEvent(event);
} else {
// unable to dispatch work request, continue on this thread
ready(getVirtualConnection());
}
} } | public class class_name {
private void handlePipeLining() {
HttpServiceContextImpl sc = getHTTPContext();
WsByteBuffer buffer = sc.returnLastBuffer();
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Pipelined request found: " + buffer); // depends on control dependency: [if], data = [none]
}
sc.clear();
// save it back so that we always release it
sc.storeAllocatedBuffer(buffer);
sc.disableBufferModification();
EventEngine events = HttpDispatcher.getEventService();
if (null != events) {
Event event = events.createEvent(HttpPipelineEventHandler.TOPIC_PIPELINING);
event.setProperty(CallbackIDs.CALLBACK_HTTPICL.getName(), this); // depends on control dependency: [if], data = [none]
events.postEvent(event); // depends on control dependency: [if], data = [none]
} else {
// unable to dispatch work request, continue on this thread
ready(getVirtualConnection()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private String fileExt(String url) {
if (url.indexOf("?") > -1) {
url = url.substring(0, url.indexOf("?"));
}
if (url.lastIndexOf(".") == -1) {
return null;
} else {
String ext = url.substring(url.lastIndexOf("."));
if (ext.indexOf("%") > -1) {
ext = ext.substring(0, ext.indexOf("%"));
}
if (ext.indexOf("/") > -1) {
ext = ext.substring(0, ext.indexOf("/"));
}
return ext.toLowerCase();
}
} } | public class class_name {
private String fileExt(String url) {
if (url.indexOf("?") > -1) {
url = url.substring(0, url.indexOf("?")); // depends on control dependency: [if], data = [none]
}
if (url.lastIndexOf(".") == -1) {
return null; // depends on control dependency: [if], data = [none]
} else {
String ext = url.substring(url.lastIndexOf("."));
if (ext.indexOf("%") > -1) {
ext = ext.substring(0, ext.indexOf("%")); // depends on control dependency: [if], data = [none]
}
if (ext.indexOf("/") > -1) {
ext = ext.substring(0, ext.indexOf("/")); // depends on control dependency: [if], data = [none]
}
return ext.toLowerCase(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public int numWildcards() {
int numWildcards = 0;
if (WILDCARD.equals(type())) {
numWildcards++;
}
if (WILDCARD.equals(subtype())) {
numWildcards++;
}
return numWildcards;
} } | public class class_name {
public int numWildcards() {
int numWildcards = 0;
if (WILDCARD.equals(type())) {
numWildcards++; // depends on control dependency: [if], data = [none]
}
if (WILDCARD.equals(subtype())) {
numWildcards++; // depends on control dependency: [if], data = [none]
}
return numWildcards;
} } |
public class class_name {
public void marshall(DeleteAddressBookRequest deleteAddressBookRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteAddressBookRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteAddressBookRequest.getAddressBookArn(), ADDRESSBOOKARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteAddressBookRequest deleteAddressBookRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteAddressBookRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteAddressBookRequest.getAddressBookArn(), ADDRESSBOOKARN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static ServerSetup[] verbose(ServerSetup[] serverSetups) {
ServerSetup[] copies = new ServerSetup[serverSetups.length];
for (int i = 0; i < serverSetups.length; i++) {
copies[i] = serverSetups[i].createCopy().setVerbose(true);
}
return copies;
} } | public class class_name {
public static ServerSetup[] verbose(ServerSetup[] serverSetups) {
ServerSetup[] copies = new ServerSetup[serverSetups.length];
for (int i = 0; i < serverSetups.length; i++) {
copies[i] = serverSetups[i].createCopy().setVerbose(true);
// depends on control dependency: [for], data = [i]
}
return copies;
} } |
public class class_name {
public DownloadMaterialResponse downloadMaterial(String mediaId, MaterialType type){
DownloadMaterialResponse response = new DownloadMaterialResponse();
String url = BASE_API_URL + "cgi-bin/material/get_material?access_token=" + config.getAccessToken();
RequestConfig config = RequestConfig.custom().setConnectionRequestTimeout(NetWorkCenter.CONNECT_TIMEOUT).setConnectTimeout(NetWorkCenter.CONNECT_TIMEOUT).setSocketTimeout(NetWorkCenter.CONNECT_TIMEOUT).build();
CloseableHttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(config).build();
HttpPost request = new HttpPost(url);
StringEntity mediaEntity = new StringEntity("{\"media_id\":\"" + mediaId + "\"}", ContentType.APPLICATION_JSON);
request.setEntity(mediaEntity);
CloseableHttpResponse httpResponse = null;
try{
httpResponse = client.execute(request);
if(HttpStatus.SC_OK == httpResponse.getStatusLine().getStatusCode()){
HttpEntity entity;
String resultJson;
switch (type){
case NEWS:
entity = httpResponse.getEntity();
resultJson = EntityUtils.toString(entity, Charset.forName("UTF-8"));
response = JSONUtil.toBean(resultJson, DownloadMaterialResponse.class);
LOG.debug("-----------------请求成功-----------------");
LOG.debug("响应结果:");
LOG.debug(resultJson);
if (StrUtil.isBlank(response.getErrcode())) {
response.setErrcode("0");
response.setErrmsg(resultJson);
}
break;
case VIDEO:
entity = httpResponse.getEntity();
resultJson = EntityUtils.toString(entity, Charset.forName("UTF-8"));
LOG.debug("-----------------请求成功-----------------");
LOG.debug("响应结果:");
LOG.debug(resultJson);
response = JSONUtil.toBean(resultJson, DownloadMaterialResponse.class);
if (StrUtil.isBlank(response.getErrcode())) {
response.setErrcode("0");
response.setErrmsg(resultJson);
// 通过down_url下载文件。文件放置在content中。通过writeTo方法获取
downloadVideo(response);
}
break;
default:
Header length = httpResponse.getHeaders("Content-Length")[0];
InputStream inputStream = httpResponse.getEntity().getContent();
response.setContent(inputStream, Integer.valueOf(length.getValue()));
break;
}
}else{
response.setErrcode(String.valueOf(httpResponse.getStatusLine().getStatusCode()));
response.setErrmsg("请求失败");
}
} catch (IOException e) {
LOG.error("IO流异常", e);
} catch (Exception e) {
LOG.error("其他异常", e);
}
return response;
} } | public class class_name {
public DownloadMaterialResponse downloadMaterial(String mediaId, MaterialType type){
DownloadMaterialResponse response = new DownloadMaterialResponse();
String url = BASE_API_URL + "cgi-bin/material/get_material?access_token=" + config.getAccessToken();
RequestConfig config = RequestConfig.custom().setConnectionRequestTimeout(NetWorkCenter.CONNECT_TIMEOUT).setConnectTimeout(NetWorkCenter.CONNECT_TIMEOUT).setSocketTimeout(NetWorkCenter.CONNECT_TIMEOUT).build();
CloseableHttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(config).build();
HttpPost request = new HttpPost(url);
StringEntity mediaEntity = new StringEntity("{\"media_id\":\"" + mediaId + "\"}", ContentType.APPLICATION_JSON);
request.setEntity(mediaEntity);
CloseableHttpResponse httpResponse = null;
try{
httpResponse = client.execute(request); // depends on control dependency: [try], data = [none]
if(HttpStatus.SC_OK == httpResponse.getStatusLine().getStatusCode()){
HttpEntity entity;
String resultJson;
switch (type){
case NEWS:
entity = httpResponse.getEntity();
resultJson = EntityUtils.toString(entity, Charset.forName("UTF-8"));
response = JSONUtil.toBean(resultJson, DownloadMaterialResponse.class);
LOG.debug("-----------------请求成功-----------------");
LOG.debug("响应结果:");
LOG.debug(resultJson);
if (StrUtil.isBlank(response.getErrcode())) {
response.setErrcode("0"); // depends on control dependency: [if], data = [none]
response.setErrmsg(resultJson); // depends on control dependency: [if], data = [none]
}
break;
case VIDEO:
entity = httpResponse.getEntity();
resultJson = EntityUtils.toString(entity, Charset.forName("UTF-8"));
LOG.debug("-----------------请求成功-----------------");
LOG.debug("响应结果:");
LOG.debug(resultJson);
response = JSONUtil.toBean(resultJson, DownloadMaterialResponse.class);
if (StrUtil.isBlank(response.getErrcode())) {
response.setErrcode("0"); // depends on control dependency: [if], data = [none]
response.setErrmsg(resultJson); // depends on control dependency: [if], data = [none]
// 通过down_url下载文件。文件放置在content中。通过writeTo方法获取
downloadVideo(response); // depends on control dependency: [if], data = [none]
}
break;
default:
Header length = httpResponse.getHeaders("Content-Length")[0];
InputStream inputStream = httpResponse.getEntity().getContent();
response.setContent(inputStream, Integer.valueOf(length.getValue()));
break;
}
}else{
response.setErrcode(String.valueOf(httpResponse.getStatusLine().getStatusCode())); // depends on control dependency: [if], data = [httpResponse.getStatusLine().getStatusCode())]
response.setErrmsg("请求失败"); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
LOG.error("IO流异常", e);
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
LOG.error("其他异常", e);
} // depends on control dependency: [catch], data = [none]
return response;
} } |
public class class_name {
@When("^I drop a Cassandra table named '(.+?)' using keyspace '(.+?)'$")
public void dropTableWithData(String table, String keyspace) {
try {
commonspec.getCassandraClient().useKeyspace(keyspace);
commonspec.getCassandraClient().dropTable(table);
} catch (Exception e) {
commonspec.getLogger().debug("Exception captured");
commonspec.getLogger().debug(e.toString());
commonspec.getExceptions().add(e);
}
} } | public class class_name {
@When("^I drop a Cassandra table named '(.+?)' using keyspace '(.+?)'$")
public void dropTableWithData(String table, String keyspace) {
try {
commonspec.getCassandraClient().useKeyspace(keyspace); // depends on control dependency: [try], data = [none]
commonspec.getCassandraClient().dropTable(table); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
commonspec.getLogger().debug("Exception captured");
commonspec.getLogger().debug(e.toString());
commonspec.getExceptions().add(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private boolean shouldRotateSignedPreKey(OmemoDevice userDevice) {
if (!OmemoConfiguration.getRenewOldSignedPreKeys()) {
return false;
}
Date now = new Date();
Date lastRenewal = getOmemoStoreBackend().getDateOfLastSignedPreKeyRenewal(userDevice);
if (lastRenewal == null) {
lastRenewal = new Date();
getOmemoStoreBackend().setDateOfLastSignedPreKeyRenewal(userDevice, lastRenewal);
}
long allowedAgeMillis = MILLIS_PER_HOUR * OmemoConfiguration.getRenewOldSignedPreKeysAfterHours();
return now.getTime() - lastRenewal.getTime() > allowedAgeMillis;
} } | public class class_name {
private boolean shouldRotateSignedPreKey(OmemoDevice userDevice) {
if (!OmemoConfiguration.getRenewOldSignedPreKeys()) {
return false; // depends on control dependency: [if], data = [none]
}
Date now = new Date();
Date lastRenewal = getOmemoStoreBackend().getDateOfLastSignedPreKeyRenewal(userDevice);
if (lastRenewal == null) {
lastRenewal = new Date(); // depends on control dependency: [if], data = [none]
getOmemoStoreBackend().setDateOfLastSignedPreKeyRenewal(userDevice, lastRenewal); // depends on control dependency: [if], data = [none]
}
long allowedAgeMillis = MILLIS_PER_HOUR * OmemoConfiguration.getRenewOldSignedPreKeysAfterHours();
return now.getTime() - lastRenewal.getTime() > allowedAgeMillis;
} } |
public class class_name {
public FieldElement pow22523() {
FieldElement t0, t1, t2;
// 2 == 2 * 1
t0 = square();
// 4 == 2 * 2
t1 = t0.square();
// 8 == 2 * 4
t1 = t1.square();
// z9 = z1*z8
t1 = multiply(t1);
// 11 == 9 + 2
t0 = t0.multiply(t1);
// 22 == 2 * 11
t0 = t0.square();
// 31 == 22 + 9
t0 = t1.multiply(t0);
// 2^6 - 2^1
t1 = t0.square();
// 2^10 - 2^5
for (int i = 1; i < 5; ++i) {
t1 = t1.square();
}
// 2^10 - 2^0
t0 = t1.multiply(t0);
// 2^11 - 2^1
t1 = t0.square();
// 2^20 - 2^10
for (int i = 1; i < 10; ++i) {
t1 = t1.square();
}
// 2^20 - 2^0
t1 = t1.multiply(t0);
// 2^21 - 2^1
t2 = t1.square();
// 2^40 - 2^20
for (int i = 1; i < 20; ++i) {
t2 = t2.square();
}
// 2^40 - 2^0
t1 = t2.multiply(t1);
// 2^41 - 2^1
t1 = t1.square();
// 2^50 - 2^10
for (int i = 1; i < 10; ++i) {
t1 = t1.square();
}
// 2^50 - 2^0
t0 = t1.multiply(t0);
// 2^51 - 2^1
t1 = t0.square();
// 2^100 - 2^50
for (int i = 1; i < 50; ++i) {
t1 = t1.square();
}
// 2^100 - 2^0
t1 = t1.multiply(t0);
// 2^101 - 2^1
t2 = t1.square();
// 2^200 - 2^100
for (int i = 1; i < 100; ++i) {
t2 = t2.square();
}
// 2^200 - 2^0
t1 = t2.multiply(t1);
// 2^201 - 2^1
t1 = t1.square();
// 2^250 - 2^50
for (int i = 1; i < 50; ++i) {
t1 = t1.square();
}
// 2^250 - 2^0
t0 = t1.multiply(t0);
// 2^251 - 2^1
t0 = t0.square();
// 2^252 - 2^2
t0 = t0.square();
// 2^252 - 3
return multiply(t0);
} } | public class class_name {
public FieldElement pow22523() {
FieldElement t0, t1, t2;
// 2 == 2 * 1
t0 = square();
// 4 == 2 * 2
t1 = t0.square();
// 8 == 2 * 4
t1 = t1.square();
// z9 = z1*z8
t1 = multiply(t1);
// 11 == 9 + 2
t0 = t0.multiply(t1);
// 22 == 2 * 11
t0 = t0.square();
// 31 == 22 + 9
t0 = t1.multiply(t0);
// 2^6 - 2^1
t1 = t0.square();
// 2^10 - 2^5
for (int i = 1; i < 5; ++i) {
t1 = t1.square(); // depends on control dependency: [for], data = [none]
}
// 2^10 - 2^0
t0 = t1.multiply(t0);
// 2^11 - 2^1
t1 = t0.square();
// 2^20 - 2^10
for (int i = 1; i < 10; ++i) {
t1 = t1.square(); // depends on control dependency: [for], data = [none]
}
// 2^20 - 2^0
t1 = t1.multiply(t0);
// 2^21 - 2^1
t2 = t1.square();
// 2^40 - 2^20
for (int i = 1; i < 20; ++i) {
t2 = t2.square(); // depends on control dependency: [for], data = [none]
}
// 2^40 - 2^0
t1 = t2.multiply(t1);
// 2^41 - 2^1
t1 = t1.square();
// 2^50 - 2^10
for (int i = 1; i < 10; ++i) {
t1 = t1.square(); // depends on control dependency: [for], data = [none]
}
// 2^50 - 2^0
t0 = t1.multiply(t0);
// 2^51 - 2^1
t1 = t0.square();
// 2^100 - 2^50
for (int i = 1; i < 50; ++i) {
t1 = t1.square(); // depends on control dependency: [for], data = [none]
}
// 2^100 - 2^0
t1 = t1.multiply(t0);
// 2^101 - 2^1
t2 = t1.square();
// 2^200 - 2^100
for (int i = 1; i < 100; ++i) {
t2 = t2.square(); // depends on control dependency: [for], data = [none]
}
// 2^200 - 2^0
t1 = t2.multiply(t1);
// 2^201 - 2^1
t1 = t1.square();
// 2^250 - 2^50
for (int i = 1; i < 50; ++i) {
t1 = t1.square(); // depends on control dependency: [for], data = [none]
}
// 2^250 - 2^0
t0 = t1.multiply(t0);
// 2^251 - 2^1
t0 = t0.square();
// 2^252 - 2^2
t0 = t0.square();
// 2^252 - 3
return multiply(t0);
} } |
public class class_name {
public Optional<Snippet> getOptionalSnippet(Integer snippetId, boolean downloadContent) {
try {
return (Optional.ofNullable(getSnippet(snippetId, downloadContent)));
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
}
} } | public class class_name {
public Optional<Snippet> getOptionalSnippet(Integer snippetId, boolean downloadContent) {
try {
return (Optional.ofNullable(getSnippet(snippetId, downloadContent))); // depends on control dependency: [try], data = [none]
} catch (GitLabApiException glae) {
return (GitLabApi.createOptionalFromException(glae));
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void apply(HSSFCell cell, HSSFCellStyle cellStyle, Map<String, String> style) {
HSSFWorkbook workBook = cell.getSheet().getWorkbook();
HSSFFont font = null;
if (ITALIC.equals(style.get(FONT_STYLE))) {
font = getFont(cell, font);
font.setItalic(true);
}
int fontSize = CssUtils.getInt(style.get(FONT_SIZE));
if (fontSize > 0) {
font = getFont(cell, font);
font.setFontHeightInPoints((short) fontSize);
}
if (BOLD.equals(style.get(FONT_WEIGHT))) {
font = getFont(cell, font);
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
}
String fontFamily = style.get(FONT_FAMILY);
if (StringUtils.isNotBlank(fontFamily)) {
font = getFont(cell, font);
font.setFontName(fontFamily);
}
HSSFColor color = CssUtils.parseColor(workBook, style.get(COLOR));
if (color != null) {
if (color.getIndex() != BLACK.index) {
font = getFont(cell, font);
font.setColor(color.getIndex());
}
else {
log.info("Text Color [{}] Is Black Or Fimiliar To Black, Ignore.",
style.remove(COLOR));
}
}
// text-decoration
String textDecoration = style.get(TEXT_DECORATION);
if (UNDERLINE.equals(textDecoration)) {
font = getFont(cell, font);
font.setUnderline(Font.U_SINGLE);
}
if (font != null) {
cellStyle.setFont(font);
}
} } | public class class_name {
public void apply(HSSFCell cell, HSSFCellStyle cellStyle, Map<String, String> style) {
HSSFWorkbook workBook = cell.getSheet().getWorkbook();
HSSFFont font = null;
if (ITALIC.equals(style.get(FONT_STYLE))) {
font = getFont(cell, font); // depends on control dependency: [if], data = [none]
font.setItalic(true); // depends on control dependency: [if], data = [none]
}
int fontSize = CssUtils.getInt(style.get(FONT_SIZE));
if (fontSize > 0) {
font = getFont(cell, font); // depends on control dependency: [if], data = [none]
font.setFontHeightInPoints((short) fontSize); // depends on control dependency: [if], data = [none]
}
if (BOLD.equals(style.get(FONT_WEIGHT))) {
font = getFont(cell, font); // depends on control dependency: [if], data = [none]
font.setBoldweight(Font.BOLDWEIGHT_BOLD); // depends on control dependency: [if], data = [none]
}
String fontFamily = style.get(FONT_FAMILY);
if (StringUtils.isNotBlank(fontFamily)) {
font = getFont(cell, font); // depends on control dependency: [if], data = [none]
font.setFontName(fontFamily); // depends on control dependency: [if], data = [none]
}
HSSFColor color = CssUtils.parseColor(workBook, style.get(COLOR));
if (color != null) {
if (color.getIndex() != BLACK.index) {
font = getFont(cell, font); // depends on control dependency: [if], data = [none]
font.setColor(color.getIndex()); // depends on control dependency: [if], data = [(color.getIndex()]
}
else {
log.info("Text Color [{}] Is Black Or Fimiliar To Black, Ignore.",
style.remove(COLOR)); // depends on control dependency: [if], data = [none]
}
}
// text-decoration
String textDecoration = style.get(TEXT_DECORATION);
if (UNDERLINE.equals(textDecoration)) {
font = getFont(cell, font); // depends on control dependency: [if], data = [none]
font.setUnderline(Font.U_SINGLE); // depends on control dependency: [if], data = [none]
}
if (font != null) {
cellStyle.setFont(font); // depends on control dependency: [if], data = [(font]
}
} } |
public class class_name {
public void marshall(GetDomainDetailRequest getDomainDetailRequest, ProtocolMarshaller protocolMarshaller) {
if (getDomainDetailRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getDomainDetailRequest.getDomainName(), DOMAINNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GetDomainDetailRequest getDomainDetailRequest, ProtocolMarshaller protocolMarshaller) {
if (getDomainDetailRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getDomainDetailRequest.getDomainName(), DOMAINNAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int getFamilyIndex(String family) {
if (family.equalsIgnoreCase(FontFactory.COURIER)) {
return COURIER;
}
if (family.equalsIgnoreCase(FontFactory.HELVETICA)) {
return HELVETICA;
}
if (family.equalsIgnoreCase(FontFactory.TIMES_ROMAN)) {
return TIMES_ROMAN;
}
if (family.equalsIgnoreCase(FontFactory.SYMBOL)) {
return SYMBOL;
}
if (family.equalsIgnoreCase(FontFactory.ZAPFDINGBATS)) {
return ZAPFDINGBATS;
}
return UNDEFINED;
} } | public class class_name {
public static int getFamilyIndex(String family) {
if (family.equalsIgnoreCase(FontFactory.COURIER)) {
return COURIER; // depends on control dependency: [if], data = [none]
}
if (family.equalsIgnoreCase(FontFactory.HELVETICA)) {
return HELVETICA; // depends on control dependency: [if], data = [none]
}
if (family.equalsIgnoreCase(FontFactory.TIMES_ROMAN)) {
return TIMES_ROMAN; // depends on control dependency: [if], data = [none]
}
if (family.equalsIgnoreCase(FontFactory.SYMBOL)) {
return SYMBOL; // depends on control dependency: [if], data = [none]
}
if (family.equalsIgnoreCase(FontFactory.ZAPFDINGBATS)) {
return ZAPFDINGBATS; // depends on control dependency: [if], data = [none]
}
return UNDEFINED;
} } |
public class class_name {
public static GridCoordSys makeGridCoordSys(Formatter sbuff, CoordinateSystem cs, VariableEnhanced v) {
if (sbuff != null) {
sbuff.format(" ");
v.getNameAndDimensions(sbuff, false, true);
sbuff.format(" check CS %s: ", cs.getName());
}
if (isGridCoordSys(sbuff, cs, v)) {
GridCoordSys gcs = new GridCoordSys(cs, sbuff);
if (sbuff != null) sbuff.format(" OK%n");
return gcs;
}
return null;
} } | public class class_name {
public static GridCoordSys makeGridCoordSys(Formatter sbuff, CoordinateSystem cs, VariableEnhanced v) {
if (sbuff != null) {
sbuff.format(" ");
// depends on control dependency: [if], data = [none]
v.getNameAndDimensions(sbuff, false, true);
// depends on control dependency: [if], data = [(sbuff]
sbuff.format(" check CS %s: ", cs.getName());
// depends on control dependency: [if], data = [none]
}
if (isGridCoordSys(sbuff, cs, v)) {
GridCoordSys gcs = new GridCoordSys(cs, sbuff);
if (sbuff != null) sbuff.format(" OK%n");
return gcs;
// depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{ // Return an error to stop the change
if (iChangeType == DBConstants.AFTER_REQUERY_TYPE)
{
this.clearCache();
}
if ((iChangeType == DBConstants.AFTER_UPDATE_TYPE)
|| (iChangeType == DBConstants.AFTER_ADD_TYPE))
{
this.doFirstValidRecord(bDisplayOption);
this.putCacheField();
}
if (iChangeType == DBConstants.AFTER_DELETE_TYPE)
{
this.removeCacheField();
}
if (iChangeType == DBConstants.FIELD_CHANGED_TYPE)
{
}
return super.doRecordChange(field, iChangeType, bDisplayOption);
} } | public class class_name {
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{ // Return an error to stop the change
if (iChangeType == DBConstants.AFTER_REQUERY_TYPE)
{
this.clearCache(); // depends on control dependency: [if], data = [none]
}
if ((iChangeType == DBConstants.AFTER_UPDATE_TYPE)
|| (iChangeType == DBConstants.AFTER_ADD_TYPE))
{
this.doFirstValidRecord(bDisplayOption); // depends on control dependency: [if], data = [none]
this.putCacheField(); // depends on control dependency: [if], data = [none]
}
if (iChangeType == DBConstants.AFTER_DELETE_TYPE)
{
this.removeCacheField(); // depends on control dependency: [if], data = [none]
}
if (iChangeType == DBConstants.FIELD_CHANGED_TYPE)
{
}
return super.doRecordChange(field, iChangeType, bDisplayOption);
} } |
public class class_name {
public boolean addWifiStateChangedListener(
NetworkStateChangedListener listener) {
synchronized (this) {
if (listeners.contains(listener)) {
return true;
}
return listeners.add(listener);
}
} } | public class class_name {
public boolean addWifiStateChangedListener(
NetworkStateChangedListener listener) {
synchronized (this) {
if (listeners.contains(listener)) {
return true; // depends on control dependency: [if], data = [none]
}
return listeners.add(listener);
}
} } |
public class class_name {
public static <I extends ImageGray<I>, D extends ImageGray<D>>
void hessian( DerivativeType type , I input , D derivXX , D derivYY , D derivXY , BorderType borderType ) {
ImageBorder<I> border = BorderType.SKIP == borderType ? null : FactoryImageBorder.wrap(borderType, input);
switch( type ) {
case SOBEL:
if( input instanceof GrayF32) {
HessianSobel.process((GrayF32) input, (GrayF32) derivXX, (GrayF32) derivYY, (GrayF32) derivXY, (ImageBorder_F32) border);
} else if( input instanceof GrayU8) {
HessianSobel.process((GrayU8) input, (GrayS16) derivXX, (GrayS16) derivYY, (GrayS16) derivXY, (ImageBorder_S32) border);
} else {
throw new IllegalArgumentException("Unknown input image type: "+input.getClass().getSimpleName());
}
break;
case THREE:
if( input instanceof GrayF32) {
HessianThree.process((GrayF32) input, (GrayF32) derivXX, (GrayF32) derivYY, (GrayF32) derivXY, (ImageBorder_F32) border);
} else if( input instanceof GrayU8) {
HessianThree.process((GrayU8) input, (GrayS16) derivXX, (GrayS16) derivYY, (GrayS16) derivXY, (ImageBorder_S32) border);
} else {
throw new IllegalArgumentException("Unknown input image type: "+input.getClass().getSimpleName());
}
break;
default:
throw new IllegalArgumentException("Unsupported derivative type "+type);
}
} } | public class class_name {
public static <I extends ImageGray<I>, D extends ImageGray<D>>
void hessian( DerivativeType type , I input , D derivXX , D derivYY , D derivXY , BorderType borderType ) {
ImageBorder<I> border = BorderType.SKIP == borderType ? null : FactoryImageBorder.wrap(borderType, input);
switch( type ) {
case SOBEL:
if( input instanceof GrayF32) {
HessianSobel.process((GrayF32) input, (GrayF32) derivXX, (GrayF32) derivYY, (GrayF32) derivXY, (ImageBorder_F32) border); // depends on control dependency: [if], data = [none]
} else if( input instanceof GrayU8) {
HessianSobel.process((GrayU8) input, (GrayS16) derivXX, (GrayS16) derivYY, (GrayS16) derivXY, (ImageBorder_S32) border); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown input image type: "+input.getClass().getSimpleName());
}
break;
case THREE:
if( input instanceof GrayF32) {
HessianThree.process((GrayF32) input, (GrayF32) derivXX, (GrayF32) derivYY, (GrayF32) derivXY, (ImageBorder_F32) border); // depends on control dependency: [if], data = [none]
} else if( input instanceof GrayU8) {
HessianThree.process((GrayU8) input, (GrayS16) derivXX, (GrayS16) derivYY, (GrayS16) derivXY, (ImageBorder_S32) border); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown input image type: "+input.getClass().getSimpleName());
}
break;
default:
throw new IllegalArgumentException("Unsupported derivative type "+type);
}
} } |
public class class_name {
protected void copyProperties(Object dest, Object source) {
try {
BeanUtils.copyProperties(dest, source);
} catch (Exception e) {
String errorMessage = MessageFormat.format("M:{0};;E:{1}",
e.getCause().getMessage(), e.toString());
throw new WebApplicationException(errorMessage, Status.BAD_REQUEST);
}
} } | public class class_name {
protected void copyProperties(Object dest, Object source) {
try {
BeanUtils.copyProperties(dest, source); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
String errorMessage = MessageFormat.format("M:{0};;E:{1}",
e.getCause().getMessage(), e.toString());
throw new WebApplicationException(errorMessage, Status.BAD_REQUEST);
}
} } // depends on control dependency: [catch], data = [none] |
public class class_name {
private static Set<Class<?>> collectConverterClass(String scanPackageName) {
Set<Class<?>> set = ClassUtil.getClassSet(scanPackageName);
if (CollectionUtils.isEmpty(set)) {
return Collections.emptySet();
}
Predicate<Class<?>> predicate = clazz -> clazz.isAnnotationPresent(Converter.class);
return set.parallelStream().filter(predicate).collect(Collectors.toSet());
} } | public class class_name {
private static Set<Class<?>> collectConverterClass(String scanPackageName) {
Set<Class<?>> set = ClassUtil.getClassSet(scanPackageName);
if (CollectionUtils.isEmpty(set)) {
return Collections.emptySet(); // depends on control dependency: [if], data = [none]
}
Predicate<Class<?>> predicate = clazz -> clazz.isAnnotationPresent(Converter.class);
return set.parallelStream().filter(predicate).collect(Collectors.toSet());
} } |
public class class_name {
public ListBackupJobsResult withBackupJobs(BackupJob... backupJobs) {
if (this.backupJobs == null) {
setBackupJobs(new java.util.ArrayList<BackupJob>(backupJobs.length));
}
for (BackupJob ele : backupJobs) {
this.backupJobs.add(ele);
}
return this;
} } | public class class_name {
public ListBackupJobsResult withBackupJobs(BackupJob... backupJobs) {
if (this.backupJobs == null) {
setBackupJobs(new java.util.ArrayList<BackupJob>(backupJobs.length)); // depends on control dependency: [if], data = [none]
}
for (BackupJob ele : backupJobs) {
this.backupJobs.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
protected String getPreviousForwardPath()
{
PreviousPageInfo prevPageInfo = getPreviousPageInfo();
if ( prevPageInfo != null )
{
ActionForward prevForward = prevPageInfo.getForward();
return prevForward != null ? prevForward.getPath() : null;
}
else
{
return null;
}
} } | public class class_name {
protected String getPreviousForwardPath()
{
PreviousPageInfo prevPageInfo = getPreviousPageInfo();
if ( prevPageInfo != null )
{
ActionForward prevForward = prevPageInfo.getForward();
return prevForward != null ? prevForward.getPath() : null; // depends on control dependency: [if], data = [none]
}
else
{
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <K, V> Map<K, V> filter(Map<K, V> map, Editor<Entry<K, V>> editor) {
if(null == map || null == editor) {
return map;
}
final Map<K, V> map2 = ObjectUtil.clone(map);
if (isEmpty(map2)) {
return map2;
}
map2.clear();
Entry<K, V> modified;
for (Entry<K, V> entry : map.entrySet()) {
modified = editor.edit(entry);
if (null != modified) {
map2.put(modified.getKey(), modified.getValue());
}
}
return map2;
} } | public class class_name {
public static <K, V> Map<K, V> filter(Map<K, V> map, Editor<Entry<K, V>> editor) {
if(null == map || null == editor) {
return map;
// depends on control dependency: [if], data = [none]
}
final Map<K, V> map2 = ObjectUtil.clone(map);
if (isEmpty(map2)) {
return map2;
// depends on control dependency: [if], data = [none]
}
map2.clear();
Entry<K, V> modified;
for (Entry<K, V> entry : map.entrySet()) {
modified = editor.edit(entry);
// depends on control dependency: [for], data = [entry]
if (null != modified) {
map2.put(modified.getKey(), modified.getValue());
// depends on control dependency: [if], data = [none]
}
}
return map2;
} } |
public class class_name {
public java.util.List<PlatformApplication> getPlatformApplications() {
if (platformApplications == null) {
platformApplications = new com.amazonaws.internal.SdkInternalList<PlatformApplication>();
}
return platformApplications;
} } | public class class_name {
public java.util.List<PlatformApplication> getPlatformApplications() {
if (platformApplications == null) {
platformApplications = new com.amazonaws.internal.SdkInternalList<PlatformApplication>(); // depends on control dependency: [if], data = [none]
}
return platformApplications;
} } |
public class class_name {
public static Version resolveVersion(MinecraftDirectory minecraftDir, String version) throws IOException {
Objects.requireNonNull(minecraftDir);
Objects.requireNonNull(version);
if (doesVersionExist(minecraftDir, version)) {
try {
return getVersionParser().parseVersion(resolveVersionHierarchy(version, minecraftDir), PlatformDescription.current());
} catch (JSONException e) {
throw new IOException("Couldn't parse version json: " + version, e);
}
} else {
return null;
}
} } | public class class_name {
public static Version resolveVersion(MinecraftDirectory minecraftDir, String version) throws IOException {
Objects.requireNonNull(minecraftDir);
Objects.requireNonNull(version);
if (doesVersionExist(minecraftDir, version)) {
try {
return getVersionParser().parseVersion(resolveVersionHierarchy(version, minecraftDir), PlatformDescription.current()); // depends on control dependency: [try], data = [none]
} catch (JSONException e) {
throw new IOException("Couldn't parse version json: " + version, e);
} // depends on control dependency: [catch], data = [none]
} else {
return null;
}
} } |
public class class_name {
public static final int[] getFullRankSubmatrixRowIndices(RealMatrix M) {
int row = M.getRowDimension();
int col = M.getColumnDimension();
SingularValueDecomposition dFact1 = new SingularValueDecomposition(M);
int r = dFact1.getRank();
int[] ret = new int[r];
if(r<row){
//we have to find a submatrix of M with row dimension = rank
RealMatrix fullM = MatrixUtils.createRealMatrix(1, col);
fullM.setRowVector(0, M.getRowVector(0));
ret[0] = 0;
int iRank = 1;
for(int i=1; i<row; i++){
RealMatrix tmp = MatrixUtils.createRealMatrix(fullM.getRowDimension()+1, col);
tmp.setSubMatrix(fullM.getData(), 0, 0);
tmp.setRowVector(fullM.getRowDimension(), M.getRowVector(i));
SingularValueDecomposition dFact_i = new SingularValueDecomposition(tmp);
int ri = dFact_i.getRank();
if(ri>iRank){
fullM = tmp;
ret[iRank] = i;
iRank = ri;
if(iRank==r){
break;//target reached!
}
}
}
}else{
for(int i=0; i<r; i++){
ret[i] = i;
}
}
return ret;
} } | public class class_name {
public static final int[] getFullRankSubmatrixRowIndices(RealMatrix M) {
int row = M.getRowDimension();
int col = M.getColumnDimension();
SingularValueDecomposition dFact1 = new SingularValueDecomposition(M);
int r = dFact1.getRank();
int[] ret = new int[r];
if(r<row){
//we have to find a submatrix of M with row dimension = rank
RealMatrix fullM = MatrixUtils.createRealMatrix(1, col);
fullM.setRowVector(0, M.getRowVector(0));
// depends on control dependency: [if], data = [none]
ret[0] = 0;
// depends on control dependency: [if], data = [none]
int iRank = 1;
for(int i=1; i<row; i++){
RealMatrix tmp = MatrixUtils.createRealMatrix(fullM.getRowDimension()+1, col);
tmp.setSubMatrix(fullM.getData(), 0, 0);
// depends on control dependency: [for], data = [none]
tmp.setRowVector(fullM.getRowDimension(), M.getRowVector(i));
// depends on control dependency: [for], data = [i]
SingularValueDecomposition dFact_i = new SingularValueDecomposition(tmp);
int ri = dFact_i.getRank();
if(ri>iRank){
fullM = tmp;
// depends on control dependency: [if], data = [none]
ret[iRank] = i;
// depends on control dependency: [if], data = [none]
iRank = ri;
// depends on control dependency: [if], data = [none]
if(iRank==r){
break;//target reached!
}
}
}
}else{
for(int i=0; i<r; i++){
ret[i] = i;
// depends on control dependency: [for], data = [i]
}
}
return ret;
} } |
public class class_name {
public Throwable getError(ClassLoader userCodeClassloader) {
if (this.throwable == null) {
return null;
}
else {
return this.throwable.deserializeError(userCodeClassloader);
}
} } | public class class_name {
public Throwable getError(ClassLoader userCodeClassloader) {
if (this.throwable == null) {
return null; // depends on control dependency: [if], data = [none]
}
else {
return this.throwable.deserializeError(userCodeClassloader); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static LongIteratorEx of(final Supplier<? extends LongIterator> iteratorSupplier) {
N.checkArgNotNull(iteratorSupplier, "iteratorSupplier");
return new LongIteratorEx() {
private LongIterator iter = null;
private LongIteratorEx iterEx = null;
private boolean isInitialized = false;
@Override
public boolean hasNext() {
if (isInitialized == false) {
init();
}
return iter.hasNext();
}
@Override
public long nextLong() {
if (isInitialized == false) {
init();
}
return iter.nextLong();
}
@Override
public void skip(long n) {
N.checkArgNotNegative(n, "n");
if (isInitialized == false) {
init();
}
if (iterEx != null) {
iterEx.skip(n);
} else {
super.skip(n);
}
}
@Override
public long count() {
if (isInitialized == false) {
init();
}
if (iterEx != null) {
return iterEx.count();
} else {
return super.count();
}
}
@Override
public void close() {
if (isInitialized == false) {
init();
}
if (iterEx != null) {
iterEx.close();
}
}
private void init() {
if (isInitialized == false) {
isInitialized = true;
iter = iteratorSupplier.get();
iterEx = iter instanceof LongIteratorEx ? (LongIteratorEx) iter : null;
}
}
};
} } | public class class_name {
public static LongIteratorEx of(final Supplier<? extends LongIterator> iteratorSupplier) {
N.checkArgNotNull(iteratorSupplier, "iteratorSupplier");
return new LongIteratorEx() {
private LongIterator iter = null;
private LongIteratorEx iterEx = null;
private boolean isInitialized = false;
@Override
public boolean hasNext() {
if (isInitialized == false) {
init();
// depends on control dependency: [if], data = [none]
}
return iter.hasNext();
}
@Override
public long nextLong() {
if (isInitialized == false) {
init();
// depends on control dependency: [if], data = [none]
}
return iter.nextLong();
}
@Override
public void skip(long n) {
N.checkArgNotNegative(n, "n");
if (isInitialized == false) {
init();
// depends on control dependency: [if], data = [none]
}
if (iterEx != null) {
iterEx.skip(n);
// depends on control dependency: [if], data = [none]
} else {
super.skip(n);
// depends on control dependency: [if], data = [none]
}
}
@Override
public long count() {
if (isInitialized == false) {
init();
// depends on control dependency: [if], data = [none]
}
if (iterEx != null) {
return iterEx.count();
// depends on control dependency: [if], data = [none]
} else {
return super.count();
// depends on control dependency: [if], data = [none]
}
}
@Override
public void close() {
if (isInitialized == false) {
init();
// depends on control dependency: [if], data = [none]
}
if (iterEx != null) {
iterEx.close();
// depends on control dependency: [if], data = [none]
}
}
private void init() {
if (isInitialized == false) {
isInitialized = true;
// depends on control dependency: [if], data = [none]
iter = iteratorSupplier.get();
// depends on control dependency: [if], data = [none]
iterEx = iter instanceof LongIteratorEx ? (LongIteratorEx) iter : null;
// depends on control dependency: [if], data = [none]
}
}
};
} } |
public class class_name {
public int setPageCount(final int num) {
int diff = num - getCheckableCount();
if (diff > 0) {
addIndicatorChildren(diff);
} else if (diff < 0) {
removeIndicatorChildren(-diff);
}
if (mCurrentPage >=num ) {
mCurrentPage = 0;
}
setCurrentPage(mCurrentPage);
return diff;
} } | public class class_name {
public int setPageCount(final int num) {
int diff = num - getCheckableCount();
if (diff > 0) {
addIndicatorChildren(diff); // depends on control dependency: [if], data = [(diff]
} else if (diff < 0) {
removeIndicatorChildren(-diff); // depends on control dependency: [if], data = [none]
}
if (mCurrentPage >=num ) {
mCurrentPage = 0; // depends on control dependency: [if], data = [none]
}
setCurrentPage(mCurrentPage);
return diff;
} } |
public class class_name {
public void marshall(GenericAttachment genericAttachment, ProtocolMarshaller protocolMarshaller) {
if (genericAttachment == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(genericAttachment.getTitle(), TITLE_BINDING);
protocolMarshaller.marshall(genericAttachment.getSubTitle(), SUBTITLE_BINDING);
protocolMarshaller.marshall(genericAttachment.getAttachmentLinkUrl(), ATTACHMENTLINKURL_BINDING);
protocolMarshaller.marshall(genericAttachment.getImageUrl(), IMAGEURL_BINDING);
protocolMarshaller.marshall(genericAttachment.getButtons(), BUTTONS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GenericAttachment genericAttachment, ProtocolMarshaller protocolMarshaller) {
if (genericAttachment == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(genericAttachment.getTitle(), TITLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(genericAttachment.getSubTitle(), SUBTITLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(genericAttachment.getAttachmentLinkUrl(), ATTACHMENTLINKURL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(genericAttachment.getImageUrl(), IMAGEURL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(genericAttachment.getButtons(), BUTTONS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public synchronized void addProperty(Object source, String name, Object value, boolean beforeUpdate) {
if (beforeUpdate == false && isLog4JProperty(name)) {
overrideProps.put(name, value);
reConfigureAsynchronously();
}
} } | public class class_name {
public synchronized void addProperty(Object source, String name, Object value, boolean beforeUpdate) {
if (beforeUpdate == false && isLog4JProperty(name)) {
overrideProps.put(name, value); // depends on control dependency: [if], data = [none]
reConfigureAsynchronously(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
{
if (thumbBounds.isEmpty() || !scrollbar.isEnabled())
{
return;
}
g.translate(thumbBounds.x, thumbBounds.y);
boolean vertical = isVertical();
int hgap = vertical ? 2 : 1;
int vgap = vertical ? 1 : 2;
int w = thumbBounds.width - (hgap * 2);
int h = thumbBounds.height - (vgap * 2);
// leave one pixel between thumb and right or bottom edge
if (vertical)
{
h -= 1;
}
else
{
w -= 1;
}
g.setColor(colorScheme.getToolingActiveBackground());
g.fillRect(hgap + 1, vgap + 1, w - 1, h - 1);
g.setColor(colorScheme.getToolingActiveBackground());
g.drawRoundRect(hgap, vgap, w, h, 3, 3);
g.translate(-thumbBounds.x, -thumbBounds.y);
} } | public class class_name {
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds)
{
if (thumbBounds.isEmpty() || !scrollbar.isEnabled())
{
return; // depends on control dependency: [if], data = [none]
}
g.translate(thumbBounds.x, thumbBounds.y);
boolean vertical = isVertical();
int hgap = vertical ? 2 : 1;
int vgap = vertical ? 1 : 2;
int w = thumbBounds.width - (hgap * 2);
int h = thumbBounds.height - (vgap * 2);
// leave one pixel between thumb and right or bottom edge
if (vertical)
{
h -= 1; // depends on control dependency: [if], data = [none]
}
else
{
w -= 1; // depends on control dependency: [if], data = [none]
}
g.setColor(colorScheme.getToolingActiveBackground());
g.fillRect(hgap + 1, vgap + 1, w - 1, h - 1);
g.setColor(colorScheme.getToolingActiveBackground());
g.drawRoundRect(hgap, vgap, w, h, 3, 3);
g.translate(-thumbBounds.x, -thumbBounds.y);
} } |
public class class_name {
@Override
public void execute(TaskExecutionContext context) { // e.g. error handling
debugFw("...Beginning the cron4j task (before run): {}", jobType);
final TaskExecutionContext nativeContext;
final OptionalThing<LaunchNowOption> nowOption;
if (context instanceof RomanticCron4jTaskExecutionContext) {
final RomanticCron4jTaskExecutionContext romantic = (RomanticCron4jTaskExecutionContext) context;
nativeContext = romantic.getNativeContext();
nowOption = romantic.getLaunchNowOption();
} else {
nativeContext = context;
nowOption = OptionalThing.empty();
}
try {
final LocalDateTime activationTime = currentTime.get();
final Cron4jJob job = findJob();
final Thread jobThread = Thread.currentThread();
RunnerResult runnerResult = null;
Throwable controllerCause = null;
try {
debugFw("...Calling doExecute() of task (before run)");
runnerResult = doExecute(job, nativeContext, nowOption); // not null
if (canTriggerNext(job, runnerResult)) {
debugFw("...Calling triggerNext() of job in task (after run)");
job.triggerNext(); // should be after current job ending
}
} catch (JobConcurrentlyExecutingException e) { // these catch statements are related to deriveRunnerExecResultType()
debugFw("...Calling catch clause of job concurrently executing exception: {}", e.getClass().getSimpleName());
final String msg = "Cannot execute the job task by concurrent execution: " + varyingCron + ", " + jobType.getSimpleName();
error(OptionalThing.of(job), msg, e);
controllerCause = e;
} catch (Throwable cause) { // from framework part (exception in appilcation job are already handled)
debugFw("...Calling catch clause of job controller's exception: {}", cause.getClass().getSimpleName());
final String msg = "Failed to execute the job task: " + varyingCron + ", " + jobType.getSimpleName();
error(OptionalThing.of(job), msg, cause);
controllerCause = cause;
}
final OptionalThing<RunnerResult> optRunnerResult = optRunnerResult(runnerResult); // empty when error
final OptionalThing<LocalDateTime> endTime = deriveEndTime(optRunnerResult);
debugFw("...Calling recordJobHistory() of task (after run): {}, {}", optRunnerResult, endTime);
recordJobHistory(nativeContext, job, jobThread, activationTime, optRunnerResult, endTime, optControllerCause(controllerCause));
debugFw("...Ending the cron4j task (after run): {}, {}", optRunnerResult, endTime);
} catch (Throwable coreCause) { // controller dead
final String msg = "Failed to control the job task: " + varyingCron + ", " + jobType.getSimpleName();
error(OptionalThing.empty(), msg, coreCause);
}
} } | public class class_name {
@Override
public void execute(TaskExecutionContext context) { // e.g. error handling
debugFw("...Beginning the cron4j task (before run): {}", jobType);
final TaskExecutionContext nativeContext;
final OptionalThing<LaunchNowOption> nowOption;
if (context instanceof RomanticCron4jTaskExecutionContext) {
final RomanticCron4jTaskExecutionContext romantic = (RomanticCron4jTaskExecutionContext) context;
nativeContext = romantic.getNativeContext(); // depends on control dependency: [if], data = [none]
nowOption = romantic.getLaunchNowOption(); // depends on control dependency: [if], data = [none]
} else {
nativeContext = context; // depends on control dependency: [if], data = [none]
nowOption = OptionalThing.empty(); // depends on control dependency: [if], data = [none]
}
try {
final LocalDateTime activationTime = currentTime.get();
final Cron4jJob job = findJob();
final Thread jobThread = Thread.currentThread();
RunnerResult runnerResult = null;
Throwable controllerCause = null;
try {
debugFw("...Calling doExecute() of task (before run)");
runnerResult = doExecute(job, nativeContext, nowOption); // not null // depends on control dependency: [try], data = [none]
if (canTriggerNext(job, runnerResult)) {
debugFw("...Calling triggerNext() of job in task (after run)");
job.triggerNext(); // should be after current job ending // depends on control dependency: [if], data = [none]
}
} catch (JobConcurrentlyExecutingException e) { // these catch statements are related to deriveRunnerExecResultType()
debugFw("...Calling catch clause of job concurrently executing exception: {}", e.getClass().getSimpleName());
final String msg = "Cannot execute the job task by concurrent execution: " + varyingCron + ", " + jobType.getSimpleName();
error(OptionalThing.of(job), msg, e);
controllerCause = e;
} catch (Throwable cause) { // from framework part (exception in appilcation job are already handled) // depends on control dependency: [catch], data = [none]
debugFw("...Calling catch clause of job controller's exception: {}", cause.getClass().getSimpleName());
final String msg = "Failed to execute the job task: " + varyingCron + ", " + jobType.getSimpleName();
error(OptionalThing.of(job), msg, cause);
controllerCause = cause;
} // depends on control dependency: [catch], data = [none]
final OptionalThing<RunnerResult> optRunnerResult = optRunnerResult(runnerResult); // empty when error
final OptionalThing<LocalDateTime> endTime = deriveEndTime(optRunnerResult);
debugFw("...Calling recordJobHistory() of task (after run): {}, {}", optRunnerResult, endTime);
recordJobHistory(nativeContext, job, jobThread, activationTime, optRunnerResult, endTime, optControllerCause(controllerCause)); // depends on control dependency: [try], data = [none]
debugFw("...Ending the cron4j task (after run): {}, {}", optRunnerResult, endTime); // depends on control dependency: [try], data = [none]
} catch (Throwable coreCause) { // controller dead
final String msg = "Failed to control the job task: " + varyingCron + ", " + jobType.getSimpleName();
error(OptionalThing.empty(), msg, coreCause);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static void doStormTranslation(Config heronConfig) {
if (heronConfig.containsKey(backtype.storm.Config.TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS)) {
heronConfig.put(backtype.storm.Config.TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS,
heronConfig.get(backtype.storm.Config.TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS).toString());
}
if (heronConfig.containsKey(backtype.storm.Config.TOPOLOGY_WORKERS)) {
Integer nWorkers = Utils.getInt(heronConfig.get(backtype.storm.Config.TOPOLOGY_WORKERS));
org.apache.heron.api.Config.setNumStmgrs(heronConfig, nWorkers);
}
if (heronConfig.containsKey(backtype.storm.Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS)) {
Integer nSecs =
Utils.getInt(heronConfig.get(backtype.storm.Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS));
org.apache.heron.api.Config.setMessageTimeoutSecs(heronConfig, nSecs);
}
if (heronConfig.containsKey(backtype.storm.Config.TOPOLOGY_MAX_SPOUT_PENDING)) {
Integer nPending =
Utils.getInt(
heronConfig.get(backtype.storm.Config.TOPOLOGY_MAX_SPOUT_PENDING).toString());
org.apache.heron.api.Config.setMaxSpoutPending(heronConfig, nPending);
}
if (heronConfig.containsKey(backtype.storm.Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS)) {
Integer tSecs =
Utils.getInt(
heronConfig.get(backtype.storm.Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS).toString());
org.apache.heron.api.Config.setTickTupleFrequency(heronConfig, tSecs);
}
if (heronConfig.containsKey(backtype.storm.Config.TOPOLOGY_DEBUG)) {
Boolean dBg =
Boolean.parseBoolean(heronConfig.get(backtype.storm.Config.TOPOLOGY_DEBUG).toString());
org.apache.heron.api.Config.setDebug(heronConfig, dBg);
}
} } | public class class_name {
private static void doStormTranslation(Config heronConfig) {
if (heronConfig.containsKey(backtype.storm.Config.TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS)) {
heronConfig.put(backtype.storm.Config.TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS,
heronConfig.get(backtype.storm.Config.TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS).toString()); // depends on control dependency: [if], data = [none]
}
if (heronConfig.containsKey(backtype.storm.Config.TOPOLOGY_WORKERS)) {
Integer nWorkers = Utils.getInt(heronConfig.get(backtype.storm.Config.TOPOLOGY_WORKERS));
org.apache.heron.api.Config.setNumStmgrs(heronConfig, nWorkers); // depends on control dependency: [if], data = [none]
}
if (heronConfig.containsKey(backtype.storm.Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS)) {
Integer nSecs =
Utils.getInt(heronConfig.get(backtype.storm.Config.TOPOLOGY_MESSAGE_TIMEOUT_SECS));
org.apache.heron.api.Config.setMessageTimeoutSecs(heronConfig, nSecs); // depends on control dependency: [if], data = [none]
}
if (heronConfig.containsKey(backtype.storm.Config.TOPOLOGY_MAX_SPOUT_PENDING)) {
Integer nPending =
Utils.getInt(
heronConfig.get(backtype.storm.Config.TOPOLOGY_MAX_SPOUT_PENDING).toString());
org.apache.heron.api.Config.setMaxSpoutPending(heronConfig, nPending); // depends on control dependency: [if], data = [none]
}
if (heronConfig.containsKey(backtype.storm.Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS)) {
Integer tSecs =
Utils.getInt(
heronConfig.get(backtype.storm.Config.TOPOLOGY_TICK_TUPLE_FREQ_SECS).toString());
org.apache.heron.api.Config.setTickTupleFrequency(heronConfig, tSecs); // depends on control dependency: [if], data = [none]
}
if (heronConfig.containsKey(backtype.storm.Config.TOPOLOGY_DEBUG)) {
Boolean dBg =
Boolean.parseBoolean(heronConfig.get(backtype.storm.Config.TOPOLOGY_DEBUG).toString());
org.apache.heron.api.Config.setDebug(heronConfig, dBg); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void setProperties(KsDef ksDef, Map<String, String> strategy_options)
{
Schema schema = CassandraPropertyReader.csmd.getSchema(databaseName);
if (schema != null && schema.getName() != null && schema.getName().equalsIgnoreCase(databaseName)
&& schema.getSchemaProperties() != null)
{
setKeyspaceProperties(ksDef, schema.getSchemaProperties(), strategy_options, schema.getDataCenters());
}
else
{
setDefaultReplicationFactor(strategy_options);
}
} } | public class class_name {
private void setProperties(KsDef ksDef, Map<String, String> strategy_options)
{
Schema schema = CassandraPropertyReader.csmd.getSchema(databaseName);
if (schema != null && schema.getName() != null && schema.getName().equalsIgnoreCase(databaseName)
&& schema.getSchemaProperties() != null)
{
setKeyspaceProperties(ksDef, schema.getSchemaProperties(), strategy_options, schema.getDataCenters()); // depends on control dependency: [if], data = [none]
}
else
{
setDefaultReplicationFactor(strategy_options); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected final boolean announceSynonym(LightweightTypeReference synonym, int flags, Acceptor acceptor) {
if (synonym.isUnknown()) {
return true;
}
return acceptor.accept(synonym, flags | ConformanceFlags.CHECKED_SUCCESS);
} } | public class class_name {
protected final boolean announceSynonym(LightweightTypeReference synonym, int flags, Acceptor acceptor) {
if (synonym.isUnknown()) {
return true; // depends on control dependency: [if], data = [none]
}
return acceptor.accept(synonym, flags | ConformanceFlags.CHECKED_SUCCESS);
} } |
public class class_name {
private boolean scrollToChildRect(Rect rect, boolean immediate) {
final int delta = computeScrollDeltaToGetChildRectOnScreen(rect);
final boolean scroll = delta != 0;
if (scroll) {
if (immediate) {
scrollBy(0, delta);
} else {
smoothScrollBy(0, delta);
}
}
return scroll;
} } | public class class_name {
private boolean scrollToChildRect(Rect rect, boolean immediate) {
final int delta = computeScrollDeltaToGetChildRectOnScreen(rect);
final boolean scroll = delta != 0;
if (scroll) {
if (immediate) {
scrollBy(0, delta); // depends on control dependency: [if], data = [none]
} else {
smoothScrollBy(0, delta); // depends on control dependency: [if], data = [none]
}
}
return scroll;
} } |
public class class_name {
public void setSelectionEnabled(boolean selectionEnabled) {
// Clean up first! Otherwise the handler list would just keep on growing.
if (selectionRegistration != null) {
selectionRegistration.removeHandler();
selectionRegistration = null;
}
if (gridSelectionRegistration != null) {
gridSelectionRegistration.removeHandler();
gridSelectionRegistration = null;
}
this.selectionEnabled = selectionEnabled;
// If enabled renew the handlers, and adjust grid selection type:
if (selectionEnabled) {
setAttribute("selectionType", SelectionStyle.MULTIPLE.getValue(), true);
selectionRegistration = mapModel.addFeatureSelectionHandler(this);
gridSelectionRegistration = addSelectionChangedHandler(this);
} else {
setAttribute("selectionType", SelectionStyle.NONE.getValue(), true);
}
} } | public class class_name {
public void setSelectionEnabled(boolean selectionEnabled) {
// Clean up first! Otherwise the handler list would just keep on growing.
if (selectionRegistration != null) {
selectionRegistration.removeHandler(); // depends on control dependency: [if], data = [none]
selectionRegistration = null; // depends on control dependency: [if], data = [none]
}
if (gridSelectionRegistration != null) {
gridSelectionRegistration.removeHandler(); // depends on control dependency: [if], data = [none]
gridSelectionRegistration = null; // depends on control dependency: [if], data = [none]
}
this.selectionEnabled = selectionEnabled;
// If enabled renew the handlers, and adjust grid selection type:
if (selectionEnabled) {
setAttribute("selectionType", SelectionStyle.MULTIPLE.getValue(), true); // depends on control dependency: [if], data = [none]
selectionRegistration = mapModel.addFeatureSelectionHandler(this); // depends on control dependency: [if], data = [none]
gridSelectionRegistration = addSelectionChangedHandler(this); // depends on control dependency: [if], data = [none]
} else {
setAttribute("selectionType", SelectionStyle.NONE.getValue(), true); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void forceUnlock(String lockName) {
Cache<Object, Integer> lockCache = getDistLockCache().getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE, Flag.SKIP_CACHE_LOAD);
FileCacheKey fileCacheKey = new FileCacheKey(indexName, lockName, affinitySegmentId);
Object previousValue = lockCache.remove(fileCacheKey);
if (previousValue!=null && trace) {
log.tracef("Lock forcibly removed for index: %s", indexName);
}
} } | public class class_name {
@Override
public void forceUnlock(String lockName) {
Cache<Object, Integer> lockCache = getDistLockCache().getAdvancedCache().withFlags(Flag.SKIP_CACHE_STORE, Flag.SKIP_CACHE_LOAD);
FileCacheKey fileCacheKey = new FileCacheKey(indexName, lockName, affinitySegmentId);
Object previousValue = lockCache.remove(fileCacheKey);
if (previousValue!=null && trace) {
log.tracef("Lock forcibly removed for index: %s", indexName); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private ColumnPrinter build(Map<String, Entry> entries)
{
ColumnPrinter printer = new ColumnPrinter();
printer.addColumn("PROPERTY");
printer.addColumn("FIELD");
printer.addColumn("DEFAULT");
printer.addColumn("VALUE");
printer.addColumn("DESCRIPTION");
Map<String, Entry> sortedEntries = Maps.newTreeMap();
sortedEntries.putAll(entries);
for ( Entry entry : sortedEntries.values() )
{
printer.addValue(0, entry.configurationName);
printer.addValue(1, entry.field.getDeclaringClass().getName() + "#" + entry.field.getName());
printer.addValue(2, entry.defaultValue);
printer.addValue(3, entry.has ? entry.value : "");
printer.addValue(4, entry.documentation);
}
return printer;
} } | public class class_name {
private ColumnPrinter build(Map<String, Entry> entries)
{
ColumnPrinter printer = new ColumnPrinter();
printer.addColumn("PROPERTY");
printer.addColumn("FIELD");
printer.addColumn("DEFAULT");
printer.addColumn("VALUE");
printer.addColumn("DESCRIPTION");
Map<String, Entry> sortedEntries = Maps.newTreeMap();
sortedEntries.putAll(entries);
for ( Entry entry : sortedEntries.values() )
{
printer.addValue(0, entry.configurationName); // depends on control dependency: [for], data = [entry]
printer.addValue(1, entry.field.getDeclaringClass().getName() + "#" + entry.field.getName()); // depends on control dependency: [for], data = [entry]
printer.addValue(2, entry.defaultValue); // depends on control dependency: [for], data = [entry]
printer.addValue(3, entry.has ? entry.value : "");
printer.addValue(4, entry.documentation); // depends on control dependency: [for], data = [entry]
}
return printer;
} } |
public class class_name {
protected Expression expression() {
Expression left = relationalExpression();
if (tokenizer.current().isSymbol("&&")) {
tokenizer.consume();
Expression right = expression();
return reOrder(left, right, BinaryOperation.Op.AND);
}
if (tokenizer.current().isSymbol("||")) {
tokenizer.consume();
Expression right = expression();
return reOrder(left, right, BinaryOperation.Op.OR);
}
return left;
} } | public class class_name {
protected Expression expression() {
Expression left = relationalExpression();
if (tokenizer.current().isSymbol("&&")) {
tokenizer.consume(); // depends on control dependency: [if], data = [none]
Expression right = expression();
return reOrder(left, right, BinaryOperation.Op.AND); // depends on control dependency: [if], data = [none]
}
if (tokenizer.current().isSymbol("||")) {
tokenizer.consume(); // depends on control dependency: [if], data = [none]
Expression right = expression();
return reOrder(left, right, BinaryOperation.Op.OR); // depends on control dependency: [if], data = [none]
}
return left;
} } |
public class class_name {
public final TableSubHeader render(int columnCount) {
TableSubHeader element = getWidget();
if(element == null) {
element = new TableSubHeader(this, columnCount);
setWidget(element);
}
render(element, columnCount);
return element;
} } | public class class_name {
public final TableSubHeader render(int columnCount) {
TableSubHeader element = getWidget();
if(element == null) {
element = new TableSubHeader(this, columnCount); // depends on control dependency: [if], data = [none]
setWidget(element); // depends on control dependency: [if], data = [(element]
}
render(element, columnCount);
return element;
} } |
public class class_name {
static boolean shouldRun(Configuration conf) {
String nodeHealthScript = conf.get(HEALTH_CHECK_SCRIPT_PROPERTY);
if (nodeHealthScript == null || nodeHealthScript.trim().isEmpty()) {
return false;
}
File f = new File(nodeHealthScript);
return f.exists() && f.canExecute();
} } | public class class_name {
static boolean shouldRun(Configuration conf) {
String nodeHealthScript = conf.get(HEALTH_CHECK_SCRIPT_PROPERTY);
if (nodeHealthScript == null || nodeHealthScript.trim().isEmpty()) {
return false; // depends on control dependency: [if], data = [none]
}
File f = new File(nodeHealthScript);
return f.exists() && f.canExecute();
} } |
public class class_name {
@Override
protected void paintComponent(Graphics g) {
final Graphics2D G2 = (Graphics2D) g.create();
G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
// Translate the coordinate system related to insets
G2.translate(getInnerBounds().x, getInnerBounds().y);
// Draw combined background image
G2.drawImage(bImage, 0, 0, null);
// Draw LCD display
if (isLcdVisible() && bImage != null) {
// Draw lcd text
if (getLcdColor() == LcdColor.CUSTOM) {
G2.setColor(getCustomLcdForeground());
} else {
G2.setColor(getLcdColor().TEXT_COLOR);
}
G2.setFont(getLcdUnitFont());
final double UNIT_STRING_WIDTH;
if (isLcdUnitStringVisible() && !getLcdUnitString().isEmpty()) {
unitLayout = new TextLayout(getLcdUnitString(), G2.getFont(), RENDER_CONTEXT);
UNIT_BOUNDARY.setFrame(unitLayout.getBounds());
//G2.drawString(getLcdUnitString(), (int) ((LCD.getWidth() - UNIT_BOUNDARY.getWidth()) - LCD.getWidth() * 0.03 + (getGaugeBounds().width - LCD.getWidth()) / 2.0), (int) (LCD.getHeight() * 0.6 + (getGaugeBounds().height - LCD.getHeight()) / 2.0));
G2.drawString(getLcdUnitString(), (int) ((LCD.getWidth() - UNIT_BOUNDARY.getWidth()) - LCD.getWidth() * 0.03 + (getGaugeBounds().width - LCD.getWidth()) / 2.0), (int) (LCD.getHeight() * lcdTextYPositionFactor + getGaugeBounds().height * 0.425));
UNIT_STRING_WIDTH = UNIT_BOUNDARY.getWidth();
} else {
UNIT_STRING_WIDTH = 0;
}
// Draw value
G2.setFont(getLcdValueFont());
switch (getLcdNumberSystem()) {
case HEX:
valueLayout = new TextLayout(Integer.toHexString((int) getLcdValue()).toUpperCase(), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
G2.drawString(Integer.toHexString((int) getLcdValue()).toUpperCase(), (int) ((LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09 + ((getGaugeBounds().width - LCD.getWidth()) / 2.0)), (int) (LCD.getHeight() * lcdTextYPositionFactor + getGaugeBounds().height * 0.425));
break;
case OCT:
valueLayout = new TextLayout(Integer.toOctalString((int) getLcdValue()), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
G2.drawString(Integer.toOctalString((int) getLcdValue()), (int) ((LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09 + ((getGaugeBounds().width - LCD.getWidth()) / 2.0)), (int) (LCD.getHeight() * lcdTextYPositionFactor + getGaugeBounds().height * 0.425));
break;
case DEC:
default:
valueLayout = new TextLayout(formatLcdValue(getLcdValue()), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds());
G2.drawString(formatLcdValue(getLcdValue()), (int) ((LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09 + ((getGaugeBounds().width - LCD.getWidth()) / 2.0)), (int) (LCD.getHeight() * lcdTextYPositionFactor + getGaugeBounds().height * 0.425));
break;
}
// Draw lcd info string
if (!getLcdInfoString().isEmpty() && !displayMulti) {
G2.setFont(getLcdInfoFont());
infoLayout = new TextLayout(getLcdInfoString(), G2.getFont(), RENDER_CONTEXT);
INFO_BOUNDARY.setFrame(infoLayout.getBounds());
G2.drawString(getLcdInfoString(), LCD.getBounds().x + 5, LCD.getBounds().y + (float) INFO_BOUNDARY.getHeight() + 5f);
}
if (displayMulti) {
// Draw oldValue
G2.setFont(lcdFormerValueFont);
oldValueLayout = new TextLayout(formatLcdValue(oldValue), G2.getFont(), RENDER_CONTEXT);
OLD_VALUE_BOUNDARY.setFrame(oldValueLayout.getBounds());
//G2.drawString(formatLcdValue(oldValue), (int) ((LCD.getWidth() - OLD_VALUE_BOUNDARY.getWidth()) / 2.0 + (getGaugeBounds().width - LCD.getWidth()) / 2.0), (int) (LCD.getHeight() * 0.9 + (getGaugeBounds().height - LCD.getHeight()) / 2.0));
G2.drawString(formatLcdValue(oldValue), (int) ((LCD.getWidth() - OLD_VALUE_BOUNDARY.getWidth()) / 2.0 + (getGaugeBounds().width - LCD.getWidth()) / 2.0), (int) (LCD.getHeight() * 0.9 + getGaugeBounds().height * 0.425));
}
// Draw lcd threshold indicator
if (getLcdNumberSystem() == NumberSystem.DEC && isLcdThresholdVisible() && getLcdValue() >= getLcdThreshold()) {
G2.drawImage(lcdThresholdImage, (int) (LCD.getX() + LCD.getHeight() * 0.0568181818), (int) (LCD.getY() + LCD.getHeight() - lcdThresholdImage.getHeight() - LCD.getHeight() * 0.0568181818), null);
}
}
// Draw user LED if enabled
if (isUserLedVisible()) {
G2.drawImage(getCurrentUserLedImage(), (int) (getGaugeBounds().width * getUserLedPosition().getX()), (int) (getGaugeBounds().height * getUserLedPosition().getY()), null);
}
// Draw combined foreground image
G2.drawImage(fImage, 0, 0, null);
if (!isEnabled()) {
G2.drawImage(disabledImage, 0, 0, null);
}
// Translate the coordinate system back to original
G2.translate(-getInnerBounds().x, -getInnerBounds().y);
G2.dispose();
} } | public class class_name {
@Override
protected void paintComponent(Graphics g) {
final Graphics2D G2 = (Graphics2D) g.create();
G2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
G2.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
G2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
G2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
// Translate the coordinate system related to insets
G2.translate(getInnerBounds().x, getInnerBounds().y);
// Draw combined background image
G2.drawImage(bImage, 0, 0, null);
// Draw LCD display
if (isLcdVisible() && bImage != null) {
// Draw lcd text
if (getLcdColor() == LcdColor.CUSTOM) {
G2.setColor(getCustomLcdForeground()); // depends on control dependency: [if], data = [none]
} else {
G2.setColor(getLcdColor().TEXT_COLOR); // depends on control dependency: [if], data = [(getLcdColor()]
}
G2.setFont(getLcdUnitFont()); // depends on control dependency: [if], data = [none]
final double UNIT_STRING_WIDTH;
if (isLcdUnitStringVisible() && !getLcdUnitString().isEmpty()) {
unitLayout = new TextLayout(getLcdUnitString(), G2.getFont(), RENDER_CONTEXT); // depends on control dependency: [if], data = [none]
UNIT_BOUNDARY.setFrame(unitLayout.getBounds()); // depends on control dependency: [if], data = [none]
//G2.drawString(getLcdUnitString(), (int) ((LCD.getWidth() - UNIT_BOUNDARY.getWidth()) - LCD.getWidth() * 0.03 + (getGaugeBounds().width - LCD.getWidth()) / 2.0), (int) (LCD.getHeight() * 0.6 + (getGaugeBounds().height - LCD.getHeight()) / 2.0));
G2.drawString(getLcdUnitString(), (int) ((LCD.getWidth() - UNIT_BOUNDARY.getWidth()) - LCD.getWidth() * 0.03 + (getGaugeBounds().width - LCD.getWidth()) / 2.0), (int) (LCD.getHeight() * lcdTextYPositionFactor + getGaugeBounds().height * 0.425)); // depends on control dependency: [if], data = [none]
UNIT_STRING_WIDTH = UNIT_BOUNDARY.getWidth(); // depends on control dependency: [if], data = [none]
} else {
UNIT_STRING_WIDTH = 0; // depends on control dependency: [if], data = [none]
}
// Draw value
G2.setFont(getLcdValueFont()); // depends on control dependency: [if], data = [none]
switch (getLcdNumberSystem()) {
case HEX:
valueLayout = new TextLayout(Integer.toHexString((int) getLcdValue()).toUpperCase(), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds()); // depends on control dependency: [if], data = [none]
G2.drawString(Integer.toHexString((int) getLcdValue()).toUpperCase(), (int) ((LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09 + ((getGaugeBounds().width - LCD.getWidth()) / 2.0)), (int) (LCD.getHeight() * lcdTextYPositionFactor + getGaugeBounds().height * 0.425)); // depends on control dependency: [if], data = [none]
break;
case OCT:
valueLayout = new TextLayout(Integer.toOctalString((int) getLcdValue()), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds()); // depends on control dependency: [if], data = [none]
G2.drawString(Integer.toOctalString((int) getLcdValue()), (int) ((LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09 + ((getGaugeBounds().width - LCD.getWidth()) / 2.0)), (int) (LCD.getHeight() * lcdTextYPositionFactor + getGaugeBounds().height * 0.425)); // depends on control dependency: [if], data = [none]
break;
case DEC:
default:
valueLayout = new TextLayout(formatLcdValue(getLcdValue()), G2.getFont(), RENDER_CONTEXT);
VALUE_BOUNDARY.setFrame(valueLayout.getBounds()); // depends on control dependency: [if], data = [none]
G2.drawString(formatLcdValue(getLcdValue()), (int) ((LCD.getWidth() - UNIT_STRING_WIDTH - VALUE_BOUNDARY.getWidth()) - LCD.getWidth() * 0.09 + ((getGaugeBounds().width - LCD.getWidth()) / 2.0)), (int) (LCD.getHeight() * lcdTextYPositionFactor + getGaugeBounds().height * 0.425)); // depends on control dependency: [if], data = [none]
break;
}
// Draw lcd info string
if (!getLcdInfoString().isEmpty() && !displayMulti) {
G2.setFont(getLcdInfoFont()); // depends on control dependency: [if], data = [none]
infoLayout = new TextLayout(getLcdInfoString(), G2.getFont(), RENDER_CONTEXT); // depends on control dependency: [if], data = [none]
INFO_BOUNDARY.setFrame(infoLayout.getBounds()); // depends on control dependency: [if], data = [none]
G2.drawString(getLcdInfoString(), LCD.getBounds().x + 5, LCD.getBounds().y + (float) INFO_BOUNDARY.getHeight() + 5f); // depends on control dependency: [if], data = [none]
}
if (displayMulti) {
// Draw oldValue
G2.setFont(lcdFormerValueFont); // depends on control dependency: [if], data = [none]
oldValueLayout = new TextLayout(formatLcdValue(oldValue), G2.getFont(), RENDER_CONTEXT); // depends on control dependency: [if], data = [none]
OLD_VALUE_BOUNDARY.setFrame(oldValueLayout.getBounds()); // depends on control dependency: [if], data = [none]
//G2.drawString(formatLcdValue(oldValue), (int) ((LCD.getWidth() - OLD_VALUE_BOUNDARY.getWidth()) / 2.0 + (getGaugeBounds().width - LCD.getWidth()) / 2.0), (int) (LCD.getHeight() * 0.9 + (getGaugeBounds().height - LCD.getHeight()) / 2.0));
G2.drawString(formatLcdValue(oldValue), (int) ((LCD.getWidth() - OLD_VALUE_BOUNDARY.getWidth()) / 2.0 + (getGaugeBounds().width - LCD.getWidth()) / 2.0), (int) (LCD.getHeight() * 0.9 + getGaugeBounds().height * 0.425)); // depends on control dependency: [if], data = [none]
}
// Draw lcd threshold indicator
if (getLcdNumberSystem() == NumberSystem.DEC && isLcdThresholdVisible() && getLcdValue() >= getLcdThreshold()) {
G2.drawImage(lcdThresholdImage, (int) (LCD.getX() + LCD.getHeight() * 0.0568181818), (int) (LCD.getY() + LCD.getHeight() - lcdThresholdImage.getHeight() - LCD.getHeight() * 0.0568181818), null); // depends on control dependency: [if], data = [none]
}
}
// Draw user LED if enabled
if (isUserLedVisible()) {
G2.drawImage(getCurrentUserLedImage(), (int) (getGaugeBounds().width * getUserLedPosition().getX()), (int) (getGaugeBounds().height * getUserLedPosition().getY()), null);
}
// Draw combined foreground image
G2.drawImage(fImage, 0, 0, null);
if (!isEnabled()) {
G2.drawImage(disabledImage, 0, 0, null);
}
// Translate the coordinate system back to original
G2.translate(-getInnerBounds().x, -getInnerBounds().y);
G2.dispose();
} } |
public class class_name {
public EClass getIfcSolidAngleMeasure() {
if (ifcSolidAngleMeasureEClass == null) {
ifcSolidAngleMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(737);
}
return ifcSolidAngleMeasureEClass;
} } | public class class_name {
public EClass getIfcSolidAngleMeasure() {
if (ifcSolidAngleMeasureEClass == null) {
ifcSolidAngleMeasureEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(737);
// depends on control dependency: [if], data = [none]
}
return ifcSolidAngleMeasureEClass;
} } |
public class class_name {
@Override
public CommercePriceEntry fetchByCommercePriceListId_First(
long commercePriceListId,
OrderByComparator<CommercePriceEntry> orderByComparator) {
List<CommercePriceEntry> list = findByCommercePriceListId(commercePriceListId,
0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} } | public class class_name {
@Override
public CommercePriceEntry fetchByCommercePriceListId_First(
long commercePriceListId,
OrderByComparator<CommercePriceEntry> orderByComparator) {
List<CommercePriceEntry> list = findByCommercePriceListId(commercePriceListId,
0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
private Result<NsDAO.Data> mayUserVirtueOfNS(AuthzTrans trans, String user, NsDAO.Data nsd, String ns_and_type, String access) {
String ns = nsd.name;
// If an ADMIN of the Namespace, then allow
Result<List<UserRoleDAO.Data>> rurd;
if ((rurd = userRoleDAO.readUserInRole(trans, user, nsd.name+ADMIN)).isOKhasData()) {
return Result.ok(nsd);
} else if(rurd.status==Result.ERR_Backend) {
return Result.err(rurd);
}
// If Specially granted Global Permission
if (isGranted(trans, user, Define.ROOT_NS,NS, ns_and_type, access)) {
return Result.ok(nsd);
}
// Check recur
int dot = ns.length();
if ((dot = ns.lastIndexOf('.', dot - 1)) >= 0) {
Result<NsDAO.Data> rnsd = deriveNs(trans, ns.substring(0, dot));
if (rnsd.isOK()) {
rnsd = mayUserVirtueOfNS(trans, user, rnsd.value, ns_and_type,access);
} else if(rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd);
}
if (rnsd.isOK()) {
return Result.ok(nsd);
} else if(rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd);
}
}
return Result.err(Status.ERR_Denied, "%s may not %s %s", user, access,
ns_and_type);
} } | public class class_name {
private Result<NsDAO.Data> mayUserVirtueOfNS(AuthzTrans trans, String user, NsDAO.Data nsd, String ns_and_type, String access) {
String ns = nsd.name;
// If an ADMIN of the Namespace, then allow
Result<List<UserRoleDAO.Data>> rurd;
if ((rurd = userRoleDAO.readUserInRole(trans, user, nsd.name+ADMIN)).isOKhasData()) {
return Result.ok(nsd); // depends on control dependency: [if], data = [none]
} else if(rurd.status==Result.ERR_Backend) {
return Result.err(rurd); // depends on control dependency: [if], data = [none]
}
// If Specially granted Global Permission
if (isGranted(trans, user, Define.ROOT_NS,NS, ns_and_type, access)) {
return Result.ok(nsd); // depends on control dependency: [if], data = [none]
}
// Check recur
int dot = ns.length();
if ((dot = ns.lastIndexOf('.', dot - 1)) >= 0) {
Result<NsDAO.Data> rnsd = deriveNs(trans, ns.substring(0, dot));
if (rnsd.isOK()) {
rnsd = mayUserVirtueOfNS(trans, user, rnsd.value, ns_and_type,access); // depends on control dependency: [if], data = [none]
} else if(rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd); // depends on control dependency: [if], data = [none]
}
if (rnsd.isOK()) {
return Result.ok(nsd); // depends on control dependency: [if], data = [none]
} else if(rnsd.status==Result.ERR_Backend) {
return Result.err(rnsd); // depends on control dependency: [if], data = [none]
}
}
return Result.err(Status.ERR_Denied, "%s may not %s %s", user, access,
ns_and_type);
} } |
public class class_name {
protected boolean writeBitwiseOp(int type, boolean simulate) {
type = type-BITWISE_OR;
if (type<0 || type>2) return false;
if (!simulate) {
int bytecode = getBitwiseOperationBytecode(type);
controller.getMethodVisitor().visitInsn(bytecode);
controller.getOperandStack().replace(getNormalOpResultType(), 2);
}
return true;
} } | public class class_name {
protected boolean writeBitwiseOp(int type, boolean simulate) {
type = type-BITWISE_OR;
if (type<0 || type>2) return false;
if (!simulate) {
int bytecode = getBitwiseOperationBytecode(type);
controller.getMethodVisitor().visitInsn(bytecode); // depends on control dependency: [if], data = [none]
controller.getOperandStack().replace(getNormalOpResultType(), 2); // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public String getAbsoluteRfsPathRelativeToWebInf(String path) {
if (path == null) {
return null;
}
// check for absolute path is system depended, let's just use the standard check
File f = new File(path);
if (f.isAbsolute()) {
// apparently this is an absolute path already
return f.getAbsolutePath();
}
return CmsFileUtil.normalizePath(getWebInfRfsPath() + path);
} } | public class class_name {
public String getAbsoluteRfsPathRelativeToWebInf(String path) {
if (path == null) {
return null; // depends on control dependency: [if], data = [none]
}
// check for absolute path is system depended, let's just use the standard check
File f = new File(path);
if (f.isAbsolute()) {
// apparently this is an absolute path already
return f.getAbsolutePath(); // depends on control dependency: [if], data = [none]
}
return CmsFileUtil.normalizePath(getWebInfRfsPath() + path);
} } |
public class class_name {
public static byte[] encode( byte[] dData )
{
if( dData == null )
{
throw new IllegalArgumentException( "Cannot encode null" );
}
byte[] eData = new byte[( ( dData.length + 2 ) / 3 ) * 4];
int eIndex = 0;
for( int i = 0; i < dData.length; i += 3 )
{
int d1;
int d2 = 0;
int d3 = 0;
int e1;
int e2;
int e3;
int e4;
int pad = 0;
d1 = dData[ i ];
if( ( i + 1 ) < dData.length )
{
d2 = dData[ i + 1 ];
if( ( i + 2 ) < dData.length )
{
d3 = dData[ i + 2 ];
}
else
{
pad = 1;
}
}
else
{
pad = 2;
}
e1 = ALPHASET[ ( d1 & I6O2 ) >> 2 ];
e2 = ALPHASET[ ( d1 & O6I2 ) << 4 | ( d2 & I4O4 ) >> 4 ];
e3 = ALPHASET[ ( d2 & O4I4 ) << 2 | ( d3 & I2O6 ) >> 6 ];
e4 = ALPHASET[ ( d3 & O2I6 ) ];
eData[ eIndex++ ] = (byte) e1;
eData[ eIndex++ ] = (byte) e2;
eData[ eIndex++ ] = ( pad < 2 ) ? (byte) e3 : (byte) '=';
eData[ eIndex++ ] = ( pad < 1 ) ? (byte) e4 : (byte) '=';
}
return eData;
} } | public class class_name {
public static byte[] encode( byte[] dData )
{
if( dData == null )
{
throw new IllegalArgumentException( "Cannot encode null" );
}
byte[] eData = new byte[( ( dData.length + 2 ) / 3 ) * 4];
int eIndex = 0;
for( int i = 0; i < dData.length; i += 3 )
{
int d1;
int d2 = 0;
int d3 = 0;
int e1;
int e2;
int e3;
int e4;
int pad = 0;
d1 = dData[ i ]; // depends on control dependency: [for], data = [i]
if( ( i + 1 ) < dData.length )
{
d2 = dData[ i + 1 ]; // depends on control dependency: [if], data = [none]
if( ( i + 2 ) < dData.length )
{
d3 = dData[ i + 2 ]; // depends on control dependency: [if], data = [none]
}
else
{
pad = 1; // depends on control dependency: [if], data = [none]
}
}
else
{
pad = 2; // depends on control dependency: [if], data = [none]
}
e1 = ALPHASET[ ( d1 & I6O2 ) >> 2 ]; // depends on control dependency: [for], data = [none]
e2 = ALPHASET[ ( d1 & O6I2 ) << 4 | ( d2 & I4O4 ) >> 4 ]; // depends on control dependency: [for], data = [none]
e3 = ALPHASET[ ( d2 & O4I4 ) << 2 | ( d3 & I2O6 ) >> 6 ]; // depends on control dependency: [for], data = [none]
e4 = ALPHASET[ ( d3 & O2I6 ) ]; // depends on control dependency: [for], data = [none]
eData[ eIndex++ ] = (byte) e1; // depends on control dependency: [for], data = [none]
eData[ eIndex++ ] = (byte) e2; // depends on control dependency: [for], data = [none]
eData[ eIndex++ ] = ( pad < 2 ) ? (byte) e3 : (byte) '='; // depends on control dependency: [for], data = [none]
eData[ eIndex++ ] = ( pad < 1 ) ? (byte) e4 : (byte) '='; // depends on control dependency: [for], data = [none]
}
return eData;
} } |
public class class_name {
public static void init(Context context, String fileName) {
reset();
Log.context = context;
String file = fileName != null && !fileName.endsWith(".properties") ? fileName + ".properties" : fileName;
if (file == null && context != null) {
file = context.getPackageName() + ".properties";
}
// Check from SDCard
InputStream fileIs = LogHelper.getConfigurationFileFromSDCard(file);
if (fileIs == null) {
// Check from Assets
fileIs = LogHelper.getConfigurationFileFromAssets(context, file);
}
if (fileIs != null) {
Properties configuration = new Properties();
try {
// There is no load(Reader) method on Android,
// so we have to use InputStream
configuration.load(fileIs);
// Then call configure.
configure(configuration);
} catch (IOException e) {
return;
} finally {
LogHelper.closeQuietly(fileIs);
}
}
} } | public class class_name {
public static void init(Context context, String fileName) {
reset();
Log.context = context;
String file = fileName != null && !fileName.endsWith(".properties") ? fileName + ".properties" : fileName;
if (file == null && context != null) {
file = context.getPackageName() + ".properties"; // depends on control dependency: [if], data = [none]
}
// Check from SDCard
InputStream fileIs = LogHelper.getConfigurationFileFromSDCard(file);
if (fileIs == null) {
// Check from Assets
fileIs = LogHelper.getConfigurationFileFromAssets(context, file); // depends on control dependency: [if], data = [none]
}
if (fileIs != null) {
Properties configuration = new Properties();
try {
// There is no load(Reader) method on Android,
// so we have to use InputStream
configuration.load(fileIs); // depends on control dependency: [try], data = [none]
// Then call configure.
configure(configuration); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
return;
} finally { // depends on control dependency: [catch], data = [none]
LogHelper.closeQuietly(fileIs);
}
}
} } |
public class class_name {
public String create(Session session, final String datacenter) {
final URI uri = createURI("/create");
final HttpRequestBuilder httpRequestBuilder = RequestUtils
.getHttpRequestBuilder(datacenter, null, null, "");
HTTP.Response httpResponse = HTTP.jsonRestCallViaPUT(uri.toString() + "?" + httpRequestBuilder.paramString(),
toJson(session));
if (httpResponse == null || httpResponse.code() != 200) {
die("Unable to create the session", uri, httpResponse);
}
final String id = fromJson(httpResponse.body(), SessionId.class).getId();
session.setId(id);
return id;
} } | public class class_name {
public String create(Session session, final String datacenter) {
final URI uri = createURI("/create");
final HttpRequestBuilder httpRequestBuilder = RequestUtils
.getHttpRequestBuilder(datacenter, null, null, "");
HTTP.Response httpResponse = HTTP.jsonRestCallViaPUT(uri.toString() + "?" + httpRequestBuilder.paramString(),
toJson(session));
if (httpResponse == null || httpResponse.code() != 200) {
die("Unable to create the session", uri, httpResponse); // depends on control dependency: [if], data = [none]
}
final String id = fromJson(httpResponse.body(), SessionId.class).getId();
session.setId(id);
return id;
} } |
public class class_name {
private static boolean postAggregatorDirectColumnIsOk(
final RowSignature aggregateRowSignature,
final DruidExpression expression,
final RexNode rexNode
)
{
if (!expression.isDirectColumnAccess()) {
return false;
}
// Check if a cast is necessary.
final ExprType toExprType = Expressions.exprTypeForValueType(
aggregateRowSignature.getColumnType(expression.getDirectColumn())
);
final ExprType fromExprType = Expressions.exprTypeForValueType(
Calcites.getValueTypeForSqlTypeName(rexNode.getType().getSqlTypeName())
);
return toExprType.equals(fromExprType);
} } | public class class_name {
private static boolean postAggregatorDirectColumnIsOk(
final RowSignature aggregateRowSignature,
final DruidExpression expression,
final RexNode rexNode
)
{
if (!expression.isDirectColumnAccess()) {
return false; // depends on control dependency: [if], data = [none]
}
// Check if a cast is necessary.
final ExprType toExprType = Expressions.exprTypeForValueType(
aggregateRowSignature.getColumnType(expression.getDirectColumn())
);
final ExprType fromExprType = Expressions.exprTypeForValueType(
Calcites.getValueTypeForSqlTypeName(rexNode.getType().getSqlTypeName())
);
return toExprType.equals(fromExprType);
} } |
public class class_name {
public long getReadSize(SectionHeader header) {
Preconditions.checkNotNull(header);
long pointerToRaw = header.get(POINTER_TO_RAW_DATA);
long virtSize = header.get(VIRTUAL_SIZE);
long sizeOfRaw = header.get(SIZE_OF_RAW_DATA);
long alignedPointerToRaw = header.getAlignedPointerToRaw();
// see Peter Ferrie's answer in:
// https://reverseengineering.stackexchange.com/questions/4324/reliable-algorithm-to-extract-overlay-of-a-pe
long readSize = fileAligned(pointerToRaw + sizeOfRaw)
- alignedPointerToRaw;
readSize = Math.min(readSize, header.getAlignedSizeOfRaw());
// see https://code.google.com/p/corkami/wiki/PE#section_table:
// "if bigger than virtual size, then virtual size is taken. "
// and:
// "a section can have a null VirtualSize: in this case, only the SizeOfRawData is taken into consideration. "
if (virtSize != 0) {
readSize = Math.min(readSize, header.getAlignedVirtualSize());
}
readSize = fileSizeAdjusted(alignedPointerToRaw, readSize);
// must not happen
if (readSize < 0) {
logger.error("Invalid readsize: " + readSize + " for file "
+ file.getName() + " adjusting readsize to 0");
readSize = 0;
}
assert readSize >= 0;
return readSize;
} } | public class class_name {
public long getReadSize(SectionHeader header) {
Preconditions.checkNotNull(header);
long pointerToRaw = header.get(POINTER_TO_RAW_DATA);
long virtSize = header.get(VIRTUAL_SIZE);
long sizeOfRaw = header.get(SIZE_OF_RAW_DATA);
long alignedPointerToRaw = header.getAlignedPointerToRaw();
// see Peter Ferrie's answer in:
// https://reverseengineering.stackexchange.com/questions/4324/reliable-algorithm-to-extract-overlay-of-a-pe
long readSize = fileAligned(pointerToRaw + sizeOfRaw)
- alignedPointerToRaw;
readSize = Math.min(readSize, header.getAlignedSizeOfRaw());
// see https://code.google.com/p/corkami/wiki/PE#section_table:
// "if bigger than virtual size, then virtual size is taken. "
// and:
// "a section can have a null VirtualSize: in this case, only the SizeOfRawData is taken into consideration. "
if (virtSize != 0) {
readSize = Math.min(readSize, header.getAlignedVirtualSize()); // depends on control dependency: [if], data = [none]
}
readSize = fileSizeAdjusted(alignedPointerToRaw, readSize);
// must not happen
if (readSize < 0) {
logger.error("Invalid readsize: " + readSize + " for file "
+ file.getName() + " adjusting readsize to 0"); // depends on control dependency: [if], data = [none]
readSize = 0; // depends on control dependency: [if], data = [none]
}
assert readSize >= 0;
return readSize;
} } |
public class class_name {
public static void clearEvidence(Network bn, int node) {
if (bn.isEvidence(node)) {
bn.clearEvidence(node);
bn.updateBeliefs();
}
} } | public class class_name {
public static void clearEvidence(Network bn, int node) {
if (bn.isEvidence(node)) {
bn.clearEvidence(node); // depends on control dependency: [if], data = [none]
bn.updateBeliefs(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void run(ExpectState state) throws Exception {
int flags = 0; // TCL.NAMESPACE_ONLY
// TODO Inject expect object, so that expect wrapper can access it
// clear previous expect_out
//interp.unsetVar("expect_out", flags);
String buffer = state.getBuffer();
logger.trace("Setting var expect_out(buffer) to " + buffer);
interp.setVar("expect_out", "buffer", buffer, flags);
int group = 0;
while(true) {
String match = state.getMatch(group);
String index = group + ",string";
group++;
if( match == null )
break;
logger.trace("Setting var expect_out(" + index +") to " + match);
interp.setVar("expect_out", index , match, flags);
}
ExpectEmulation.setExpContinue(interp, false);
if( tclCode != null && tclCode.toString().length() > 0 ) {
logger.debug("Running a tcl bit of code: " + tclCode.toString());
try {
interp.eval(tclCode, 0);
} catch(TclException e) {
logger.warn("Exception: " + e);
throw new Exception( interp.getResult().toString(), e);
}
if( ExpectEmulation.isExpContinue(interp) ) {
logger.info("Asked to continue");
state.exp_continue();
}
}
//interp.unsetVar("expect_out", flags);
} } | public class class_name {
public void run(ExpectState state) throws Exception {
int flags = 0; // TCL.NAMESPACE_ONLY
// TODO Inject expect object, so that expect wrapper can access it
// clear previous expect_out
//interp.unsetVar("expect_out", flags);
String buffer = state.getBuffer();
logger.trace("Setting var expect_out(buffer) to " + buffer);
interp.setVar("expect_out", "buffer", buffer, flags);
int group = 0;
while(true) {
String match = state.getMatch(group);
String index = group + ",string";
group++;
if( match == null )
break;
logger.trace("Setting var expect_out(" + index +") to " + match);
interp.setVar("expect_out", index , match, flags);
}
ExpectEmulation.setExpContinue(interp, false);
if( tclCode != null && tclCode.toString().length() > 0 ) {
logger.debug("Running a tcl bit of code: " + tclCode.toString());
try {
interp.eval(tclCode, 0); // depends on control dependency: [try], data = [none]
} catch(TclException e) {
logger.warn("Exception: " + e);
throw new Exception( interp.getResult().toString(), e);
} // depends on control dependency: [catch], data = [none]
if( ExpectEmulation.isExpContinue(interp) ) {
logger.info("Asked to continue"); // depends on control dependency: [if], data = [none]
state.exp_continue(); // depends on control dependency: [if], data = [none]
}
}
//interp.unsetVar("expect_out", flags);
} } |
public class class_name {
public static ISearch getSearch()
throws EFapsException
{
ISearch ret = null;
if (EFapsSystemConfiguration.get().containsAttributeValue(KernelSettings.INDEXSEARCHCLASS)) {
final String clazzname = EFapsSystemConfiguration.get().getAttributeValue(
KernelSettings.INDEXSEARCHCLASS);
try {
final Class<?> clazz = Class.forName(clazzname, false, EFapsClassLoader.getInstance());
ret = (ISearch) clazz.newInstance();
} catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) {
throw new EFapsException(Index.class, "Could not instanciate IDirectoryProvider", e);
}
} else {
ret = new ISearch()
{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/** The query. */
private String query;
@Override
public void setQuery(final String _query)
{
this.query = _query;
}
@Override
public String getQuery()
{
return this.query;
}
};
}
return ret;
} } | public class class_name {
public static ISearch getSearch()
throws EFapsException
{
ISearch ret = null;
if (EFapsSystemConfiguration.get().containsAttributeValue(KernelSettings.INDEXSEARCHCLASS)) {
final String clazzname = EFapsSystemConfiguration.get().getAttributeValue(
KernelSettings.INDEXSEARCHCLASS);
try {
final Class<?> clazz = Class.forName(clazzname, false, EFapsClassLoader.getInstance());
ret = (ISearch) clazz.newInstance();
} catch (final ClassNotFoundException | InstantiationException | IllegalAccessException e) {
throw new EFapsException(Index.class, "Could not instanciate IDirectoryProvider", e);
} // depends on control dependency: [catch], data = [none]
} else {
ret = new ISearch()
{
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 1L;
/** The query. */
private String query;
@Override
public void setQuery(final String _query)
{
this.query = _query;
}
@Override
public String getQuery()
{
return this.query;
}
};
}
return ret;
} } |
public class class_name {
private void augment(int v) {
int n = buildPath(path, 0, v, NIL);
for (int i = 2; i < n; i += 2) {
matching.match(path[i], path[i - 1]);
}
} } | public class class_name {
private void augment(int v) {
int n = buildPath(path, 0, v, NIL);
for (int i = 2; i < n; i += 2) {
matching.match(path[i], path[i - 1]); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public static synchronized void redirectPlatformLoggers() {
if (loggingEnabled || !LoggingSupport.isAvailable()) return;
loggingEnabled = true;
for (Map.Entry<String, WeakReference<PlatformLogger>> entry : loggers.entrySet()) {
WeakReference<PlatformLogger> ref = entry.getValue();
PlatformLogger plog = ref.get();
if (plog != null) {
plog.redirectToJavaLoggerProxy();
}
}
} } | public class class_name {
public static synchronized void redirectPlatformLoggers() {
if (loggingEnabled || !LoggingSupport.isAvailable()) return;
loggingEnabled = true;
for (Map.Entry<String, WeakReference<PlatformLogger>> entry : loggers.entrySet()) {
WeakReference<PlatformLogger> ref = entry.getValue();
PlatformLogger plog = ref.get();
if (plog != null) {
plog.redirectToJavaLoggerProxy(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static byte[] convertToXmlByteArray(List<PartETag> partETags) {
XmlWriter xml = new XmlWriter();
xml.start("CompleteMultipartUpload");
if (partETags != null) {
List<PartETag> sortedPartETags = new ArrayList<PartETag>(partETags);
Collections.sort(sortedPartETags, new Comparator<PartETag>() {
public int compare(PartETag tag1, PartETag tag2) {
if (tag1.getPartNumber() < tag2.getPartNumber()) return -1;
if (tag1.getPartNumber() > tag2.getPartNumber()) return 1;
return 0;
}
});
for (PartETag partEtag : sortedPartETags) {
xml.start("Part");
xml.start("PartNumber").value(Integer.toString(partEtag.getPartNumber())).end();
xml.start("ETag").value(partEtag.getETag()).end();
xml.end();
}
}
xml.end();
return xml.getBytes();
} } | public class class_name {
public static byte[] convertToXmlByteArray(List<PartETag> partETags) {
XmlWriter xml = new XmlWriter();
xml.start("CompleteMultipartUpload");
if (partETags != null) {
List<PartETag> sortedPartETags = new ArrayList<PartETag>(partETags);
Collections.sort(sortedPartETags, new Comparator<PartETag>() {
public int compare(PartETag tag1, PartETag tag2) {
if (tag1.getPartNumber() < tag2.getPartNumber()) return -1;
if (tag1.getPartNumber() > tag2.getPartNumber()) return 1;
return 0;
}
}); // depends on control dependency: [if], data = [none]
for (PartETag partEtag : sortedPartETags) {
xml.start("Part"); // depends on control dependency: [for], data = [none]
xml.start("PartNumber").value(Integer.toString(partEtag.getPartNumber())).end(); // depends on control dependency: [for], data = [partEtag]
xml.start("ETag").value(partEtag.getETag()).end(); // depends on control dependency: [for], data = [partEtag]
xml.end(); // depends on control dependency: [for], data = [none]
}
}
xml.end();
return xml.getBytes();
} } |
public class class_name {
private int createSimpleMDAGTransitionSet(MDAGNode node, SimpleMDAGNode[] mdagDataArray, int onePastLastCreatedTransitionSetIndex)
{
int pivotIndex = onePastLastCreatedTransitionSetIndex; // node自己的位置
node.setTransitionSetBeginIndex(pivotIndex);
onePastLastCreatedTransitionSetIndex += node.getOutgoingTransitionCount(); // 这个参数代表id的消耗
//Create a SimpleMDAGNode representing each _transition label/target combo in transitionTreeMap, recursively calling this method (if necessary)
//to set indices in these SimpleMDAGNodes that the set of transitions emitting from their respective _transition targets starts from.
TreeMap<Character, MDAGNode> transitionTreeMap = node.getOutgoingTransitions();
for (Entry<Character, MDAGNode> transitionKeyValuePair : transitionTreeMap.entrySet())
{
//Use the current _transition's label and target node to create a SimpleMDAGNode
//(which is a space-saving representation of the _transition), and insert it in to mdagDataArray
char transitionLabelChar = transitionKeyValuePair.getKey();
MDAGNode transitionTargetNode = transitionKeyValuePair.getValue();
mdagDataArray[pivotIndex] = new SimpleMDAGNode(transitionLabelChar, transitionTargetNode.isAcceptNode(), transitionTargetNode.getOutgoingTransitionCount());
/////
//If targetTransitionNode's outgoing _transition set hasn't been inserted in to mdagDataArray yet, call this method on it to do so.
//After this call returns, transitionTargetNode will contain the index in mdagDataArray that its _transition set starts from
if (transitionTargetNode.getTransitionSetBeginIndex() == -1)
onePastLastCreatedTransitionSetIndex = createSimpleMDAGTransitionSet(transitionTargetNode, mdagDataArray, onePastLastCreatedTransitionSetIndex);
mdagDataArray[pivotIndex++].setTransitionSetBeginIndex(transitionTargetNode.getTransitionSetBeginIndex());
}
/////
return onePastLastCreatedTransitionSetIndex;
} } | public class class_name {
private int createSimpleMDAGTransitionSet(MDAGNode node, SimpleMDAGNode[] mdagDataArray, int onePastLastCreatedTransitionSetIndex)
{
int pivotIndex = onePastLastCreatedTransitionSetIndex; // node自己的位置
node.setTransitionSetBeginIndex(pivotIndex);
onePastLastCreatedTransitionSetIndex += node.getOutgoingTransitionCount(); // 这个参数代表id的消耗
//Create a SimpleMDAGNode representing each _transition label/target combo in transitionTreeMap, recursively calling this method (if necessary)
//to set indices in these SimpleMDAGNodes that the set of transitions emitting from their respective _transition targets starts from.
TreeMap<Character, MDAGNode> transitionTreeMap = node.getOutgoingTransitions();
for (Entry<Character, MDAGNode> transitionKeyValuePair : transitionTreeMap.entrySet())
{
//Use the current _transition's label and target node to create a SimpleMDAGNode
//(which is a space-saving representation of the _transition), and insert it in to mdagDataArray
char transitionLabelChar = transitionKeyValuePair.getKey();
MDAGNode transitionTargetNode = transitionKeyValuePair.getValue();
mdagDataArray[pivotIndex] = new SimpleMDAGNode(transitionLabelChar, transitionTargetNode.isAcceptNode(), transitionTargetNode.getOutgoingTransitionCount()); // depends on control dependency: [for], data = [none]
/////
//If targetTransitionNode's outgoing _transition set hasn't been inserted in to mdagDataArray yet, call this method on it to do so.
//After this call returns, transitionTargetNode will contain the index in mdagDataArray that its _transition set starts from
if (transitionTargetNode.getTransitionSetBeginIndex() == -1)
onePastLastCreatedTransitionSetIndex = createSimpleMDAGTransitionSet(transitionTargetNode, mdagDataArray, onePastLastCreatedTransitionSetIndex);
mdagDataArray[pivotIndex++].setTransitionSetBeginIndex(transitionTargetNode.getTransitionSetBeginIndex()); // depends on control dependency: [for], data = [none]
}
/////
return onePastLastCreatedTransitionSetIndex;
} } |
public class class_name {
public void marshall(UpdateBasePathMappingRequest updateBasePathMappingRequest, ProtocolMarshaller protocolMarshaller) {
if (updateBasePathMappingRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateBasePathMappingRequest.getDomainName(), DOMAINNAME_BINDING);
protocolMarshaller.marshall(updateBasePathMappingRequest.getBasePath(), BASEPATH_BINDING);
protocolMarshaller.marshall(updateBasePathMappingRequest.getPatchOperations(), PATCHOPERATIONS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateBasePathMappingRequest updateBasePathMappingRequest, ProtocolMarshaller protocolMarshaller) {
if (updateBasePathMappingRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateBasePathMappingRequest.getDomainName(), DOMAINNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateBasePathMappingRequest.getBasePath(), BASEPATH_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateBasePathMappingRequest.getPatchOperations(), PATCHOPERATIONS_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 {
final static String normalizeWhitespace(String orig) {
StringBuilder sb = new StringBuilder();
boolean lastCharWasWhitespace = false;
boolean changed = false;
char[] characters = orig.toCharArray();
for (int i = 0; i < characters.length; i++) {
if (Character.isWhitespace(characters[i])) {
if (lastCharWasWhitespace) {
// suppress character
changed = true;
} else {
sb.append(' ');
changed |= characters[i] != ' ';
lastCharWasWhitespace = true;
}
} else {
sb.append(characters[i]);
lastCharWasWhitespace = false;
}
}
return changed ? sb.toString() : orig;
} } | public class class_name {
final static String normalizeWhitespace(String orig) {
StringBuilder sb = new StringBuilder();
boolean lastCharWasWhitespace = false;
boolean changed = false;
char[] characters = orig.toCharArray();
for (int i = 0; i < characters.length; i++) {
if (Character.isWhitespace(characters[i])) {
if (lastCharWasWhitespace) {
// suppress character
changed = true; // depends on control dependency: [if], data = [none]
} else {
sb.append(' '); // depends on control dependency: [if], data = [none]
changed |= characters[i] != ' '; // depends on control dependency: [if], data = [none]
lastCharWasWhitespace = true; // depends on control dependency: [if], data = [none]
}
} else {
sb.append(characters[i]); // depends on control dependency: [if], data = [none]
lastCharWasWhitespace = false; // depends on control dependency: [if], data = [none]
}
}
return changed ? sb.toString() : orig;
} } |
public class class_name {
protected String flagsToRegexOptions(int flags) {
StringBuilder options = new StringBuilder();
if ((flags & Pattern.CASE_INSENSITIVE) != 0) {
options.append("i");
}
if ((flags & Pattern.MULTILINE) != 0) {
options.append("m");
}
if ((flags & Pattern.DOTALL) != 0) {
options.append("s");
}
if ((flags & Pattern.UNICODE_CASE) != 0) {
options.append("u");
}
return options.toString();
} } | public class class_name {
protected String flagsToRegexOptions(int flags) {
StringBuilder options = new StringBuilder();
if ((flags & Pattern.CASE_INSENSITIVE) != 0) {
options.append("i"); // depends on control dependency: [if], data = [none]
}
if ((flags & Pattern.MULTILINE) != 0) {
options.append("m"); // depends on control dependency: [if], data = [none]
}
if ((flags & Pattern.DOTALL) != 0) {
options.append("s"); // depends on control dependency: [if], data = [none]
}
if ((flags & Pattern.UNICODE_CASE) != 0) {
options.append("u"); // depends on control dependency: [if], data = [none]
}
return options.toString();
} } |
public class class_name {
private static String constructOpenIdUrl(String issuer) {
String url = issuer;
if (!URI.create(issuer).isAbsolute()) {
// Use HTTPS if the protocol scheme is not specified in the URL.
url = HTTPS_PROTOCOL_PREFIX + issuer;
}
if (!url.endsWith("/")) {
url += "/";
}
return url + OPEN_ID_CONFIG_PATH;
} } | public class class_name {
private static String constructOpenIdUrl(String issuer) {
String url = issuer;
if (!URI.create(issuer).isAbsolute()) {
// Use HTTPS if the protocol scheme is not specified in the URL.
url = HTTPS_PROTOCOL_PREFIX + issuer; // depends on control dependency: [if], data = [none]
}
if (!url.endsWith("/")) {
url += "/"; // depends on control dependency: [if], data = [none]
}
return url + OPEN_ID_CONFIG_PATH;
} } |
public class class_name {
private File buildWar(List<ArtifactOrFile> classPathEntries) {
try {
List<String> classesUrls = classPathEntries.stream()
.map(ArtifactOrFile::file)
.filter(this::isDirectory)
.filter(url -> url.contains("classes"))
.collect(Collectors.toList());
List<File> classpathJars = classPathEntries.stream()
.map(ArtifactOrFile::file)
.filter(file -> file.endsWith(".jar"))
.map(File::new)
.collect(Collectors.toList());
return WarBuilder.build(classesUrls, classpathJars);
} catch (IOException e) {
throw new RuntimeException("failed to build war", e);
}
} } | public class class_name {
private File buildWar(List<ArtifactOrFile> classPathEntries) {
try {
List<String> classesUrls = classPathEntries.stream()
.map(ArtifactOrFile::file)
.filter(this::isDirectory)
.filter(url -> url.contains("classes"))
.collect(Collectors.toList());
List<File> classpathJars = classPathEntries.stream()
.map(ArtifactOrFile::file)
.filter(file -> file.endsWith(".jar"))
.map(File::new)
.collect(Collectors.toList());
return WarBuilder.build(classesUrls, classpathJars); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException("failed to build war", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected Object builtin(Type type) {
Class<?> rawType = Types.getRawType(type);
if (rawType.equals(WebContext.class)) {
return context;
} else if (rawType.equals(HttpServletRequest.class)) {
return context.request();
} else if (rawType.equals(HttpServletResponse.class)) {
return context.response();
} else if (rawType.equals(HttpSession.class)) {
return context.session();
} else if (rawType.equals(ServletContext.class)) {
return context.application();
} else {
// org.eiichiro.bootleg.Request.
return this;
}
} } | public class class_name {
protected Object builtin(Type type) {
Class<?> rawType = Types.getRawType(type);
if (rawType.equals(WebContext.class)) {
return context; // depends on control dependency: [if], data = [none]
} else if (rawType.equals(HttpServletRequest.class)) {
return context.request(); // depends on control dependency: [if], data = [none]
} else if (rawType.equals(HttpServletResponse.class)) {
return context.response(); // depends on control dependency: [if], data = [none]
} else if (rawType.equals(HttpSession.class)) {
return context.session(); // depends on control dependency: [if], data = [none]
} else if (rawType.equals(ServletContext.class)) {
return context.application(); // depends on control dependency: [if], data = [none]
} else {
// org.eiichiro.bootleg.Request.
return this; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static File storeOnCacheDir(Context context, Bitmap bitmap, String path, String filename, Bitmap.CompressFormat format, int quality) {
File dir = new File(context.getCacheDir(), path);
FileUtils.makeDirsIfNeeded(dir);
File file = new File(dir, filename);
if (!storeAsFile(bitmap, file, format, quality)) {
return null;
}
return file;
} } | public class class_name {
public static File storeOnCacheDir(Context context, Bitmap bitmap, String path, String filename, Bitmap.CompressFormat format, int quality) {
File dir = new File(context.getCacheDir(), path);
FileUtils.makeDirsIfNeeded(dir);
File file = new File(dir, filename);
if (!storeAsFile(bitmap, file, format, quality)) {
return null; // depends on control dependency: [if], data = [none]
}
return file;
} } |
public class class_name {
public void setPOMVersion(final String pomVersion) {
if (pomVersion == null && this.pomVersion == null) {
return;
} else if (pomVersion == null) {
removeChild(this.pomVersion);
this.pomVersion = null;
} else if (this.pomVersion == null) {
this.pomVersion = new KeyValueNode<String>(CommonConstants.CS_MAVEN_POM_VERSION_TITLE, pomVersion);
appendChild(this.pomVersion, false);
} else {
this.pomVersion.setValue(pomVersion);
}
} } | public class class_name {
public void setPOMVersion(final String pomVersion) {
if (pomVersion == null && this.pomVersion == null) {
return; // depends on control dependency: [if], data = [none]
} else if (pomVersion == null) {
removeChild(this.pomVersion); // depends on control dependency: [if], data = [none]
this.pomVersion = null; // depends on control dependency: [if], data = [none]
} else if (this.pomVersion == null) {
this.pomVersion = new KeyValueNode<String>(CommonConstants.CS_MAVEN_POM_VERSION_TITLE, pomVersion); // depends on control dependency: [if], data = [none]
appendChild(this.pomVersion, false); // depends on control dependency: [if], data = [(this.pomVersion]
} else {
this.pomVersion.setValue(pomVersion); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@SuppressWarnings("unchecked")
public <T> T features(Class<T> interfaceClass) {
try {
for (Method method : interfaceClass.getDeclaredMethods()) {
methods.put(method, findInvocationHandler(method));
}
return (T) Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class[] { interfaceClass }, this);
} catch (NoSuchMethodException e) {
throw new PicklockException("cannot resolve method/property " + e.getMessage() + " on " + getType());
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public <T> T features(Class<T> interfaceClass) {
try {
for (Method method : interfaceClass.getDeclaredMethods()) {
methods.put(method, findInvocationHandler(method)); // depends on control dependency: [for], data = [method]
}
return (T) Proxy.newProxyInstance(interfaceClass.getClassLoader(), new Class[] { interfaceClass }, this); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException e) {
throw new PicklockException("cannot resolve method/property " + e.getMessage() + " on " + getType());
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void addQueryParams(final Request request) {
if (absoluteDateCreated != null) {
request.addQueryParam("DateCreated", absoluteDateCreated.toString(Request.QUERY_STRING_DATE_FORMAT));
} else if (rangeDateCreated != null) {
request.addQueryDateRange("DateCreated", rangeDateCreated);
}
if (absoluteDateUpdated != null) {
request.addQueryParam("DateUpdated", absoluteDateUpdated.toString(Request.QUERY_STRING_DATE_FORMAT));
} else if (rangeDateUpdated != null) {
request.addQueryDateRange("DateUpdated", rangeDateUpdated);
}
if (friendlyName != null) {
request.addQueryParam("FriendlyName", friendlyName);
}
if (status != null) {
request.addQueryParam("Status", status.toString());
}
if (getPageSize() != null) {
request.addQueryParam("PageSize", Integer.toString(getPageSize()));
}
} } | public class class_name {
private void addQueryParams(final Request request) {
if (absoluteDateCreated != null) {
request.addQueryParam("DateCreated", absoluteDateCreated.toString(Request.QUERY_STRING_DATE_FORMAT)); // depends on control dependency: [if], data = [none]
} else if (rangeDateCreated != null) {
request.addQueryDateRange("DateCreated", rangeDateCreated); // depends on control dependency: [if], data = [none]
}
if (absoluteDateUpdated != null) {
request.addQueryParam("DateUpdated", absoluteDateUpdated.toString(Request.QUERY_STRING_DATE_FORMAT)); // depends on control dependency: [if], data = [none]
} else if (rangeDateUpdated != null) {
request.addQueryDateRange("DateUpdated", rangeDateUpdated); // depends on control dependency: [if], data = [none]
}
if (friendlyName != null) {
request.addQueryParam("FriendlyName", friendlyName); // depends on control dependency: [if], data = [none]
}
if (status != null) {
request.addQueryParam("Status", status.toString()); // depends on control dependency: [if], data = [none]
}
if (getPageSize() != null) {
request.addQueryParam("PageSize", Integer.toString(getPageSize())); // depends on control dependency: [if], data = [(getPageSize()]
}
} } |
public class class_name {
public boolean isDataDivision(final String line,
final CleaningContext context) {
if (context.isDataDivision()) {
Matcher matcher = IDENTIFICATION_DIVISION.matcher(line);
if (matcher.find()) {
context.setDataDivision(false);
emitErrorMessage("Found identification division in ["
+ line.trim() + "]. Lines ignored till data division.");
}
matcher = PROCEDURE_DIVISION.matcher(line);
if (matcher.find()) {
context.setDataDivision(false);
emitErrorMessage("Found procedure division in [" + line.trim()
+ "]. Remaining lines ignored.");
}
} else {
Matcher matcher = DATA_DIVISION.matcher(line);
if (matcher.find()) {
context.setDataDivision(true);
emitErrorMessage("Found data division in [" + line.trim()
+ "]. Started looking for data items.");
}
}
return context.isDataDivision();
} } | public class class_name {
public boolean isDataDivision(final String line,
final CleaningContext context) {
if (context.isDataDivision()) {
Matcher matcher = IDENTIFICATION_DIVISION.matcher(line);
if (matcher.find()) {
context.setDataDivision(false); // depends on control dependency: [if], data = [none]
emitErrorMessage("Found identification division in ["
+ line.trim() + "]. Lines ignored till data division."); // depends on control dependency: [if], data = [none]
}
matcher = PROCEDURE_DIVISION.matcher(line);
if (matcher.find()) {
context.setDataDivision(false); // depends on control dependency: [if], data = [none]
emitErrorMessage("Found procedure division in [" + line.trim()
+ "]. Remaining lines ignored."); // depends on control dependency: [if], data = [none]
}
} else {
Matcher matcher = DATA_DIVISION.matcher(line);
if (matcher.find()) {
context.setDataDivision(true);
emitErrorMessage("Found data division in [" + line.trim()
+ "]. Started looking for data items.");
}
}
return context.isDataDivision();
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.